hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
108
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
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
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
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
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
5266eaf478d912daf91cd52c27e984db42cb1c43
688
cpp
C++
solved/PT07Y.cpp
mrpandey/spoj
d63378200806e595af2958b15e757383bed692cd
[ "WTFPL" ]
4
2018-04-23T18:37:09.000Z
2019-04-03T16:28:02.000Z
solved/PT07Y.cpp
mrpandey/spoj
d63378200806e595af2958b15e757383bed692cd
[ "WTFPL" ]
null
null
null
solved/PT07Y.cpp
mrpandey/spoj
d63378200806e595af2958b15e757383bed692cd
[ "WTFPL" ]
1
2021-07-01T03:54:33.000Z
2021-07-01T03:54:33.000Z
#include<iostream> #include<vector> #include<queue> using namespace std; int main(){ //ios::sync_with_stdio(false); int n, m; cin >> n >> m; if(n-m!=1) {cout << "NO\n"; return 0;} vector<vector<int> > adj(n, vector<int>()); int u, v; for(int i=0; i<m; i++){ cin >> u >> v; adj[u-1].push_back(v-1); adj[v-1].push_back(u-1); } int comp=1; queue<int> q; vector<bool> vis(n, false); q.push(0); while(!q.empty()){ int u = q.front(); vis[u] = true; q.pop(); for(int i=0; i<adj[u].size(); i++){ v = adj[u][i]; if(vis[v]) continue; q.push(v); } } for(int i=0; i<n; i++){ if(!vis[i]){ cout << "NO\n"; return 0; } } cout << "YES\n"; return 0; }
17.2
44
0.526163
mrpandey
526cb41ff8d86de4698d8fc53f71707f87855174
12,806
cc
C++
yggdrasil_decision_forests/model/decision_tree/decision_tree_test.cc
google/yggdrasil-decision-forests
0b284d8afe7ac4773abcdeee88a77681f8681127
[ "Apache-2.0" ]
135
2021-05-12T18:02:11.000Z
2022-03-30T16:48:44.000Z
yggdrasil_decision_forests/model/decision_tree/decision_tree_test.cc
google/yggdrasil-decision-forests
0b284d8afe7ac4773abcdeee88a77681f8681127
[ "Apache-2.0" ]
11
2021-06-25T17:25:38.000Z
2022-03-30T03:31:24.000Z
yggdrasil_decision_forests/model/decision_tree/decision_tree_test.cc
google/yggdrasil-decision-forests
0b284d8afe7ac4773abcdeee88a77681f8681127
[ "Apache-2.0" ]
10
2021-05-27T02:51:36.000Z
2022-03-28T07:03:52.000Z
/* * Copyright 2021 Google 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 * * 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. */ #include "yggdrasil_decision_forests/model/decision_tree/decision_tree.h" #include <string> #include <vector> #include "gtest/gtest.h" #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" #include "yggdrasil_decision_forests/dataset/data_spec.pb.h" #include "yggdrasil_decision_forests/dataset/data_spec_inference.h" #include "yggdrasil_decision_forests/dataset/example.pb.h" #include "yggdrasil_decision_forests/dataset/vertical_dataset.h" #include "yggdrasil_decision_forests/dataset/vertical_dataset_io.h" #include "yggdrasil_decision_forests/model/decision_tree/decision_tree.pb.h" #include "yggdrasil_decision_forests/utils/filesystem.h" #include "yggdrasil_decision_forests/utils/logging.h" #include "yggdrasil_decision_forests/utils/test.h" namespace yggdrasil_decision_forests { namespace model { namespace decision_tree { namespace { using row_t = dataset::VerticalDataset::row_t; std::string DatasetDir() { return file::JoinPath(test::DataRootDirectory(), "yggdrasil_decision_forests/" "test_data/dataset"); } TEST(DecisionTree, GetLeafAndGetPath) { DecisionTree tree; tree.CreateRoot(); tree.mutable_root()->CreateChildren(); tree.mutable_root()->mutable_node()->mutable_condition()->set_attribute(0); tree.mutable_root() ->mutable_node() ->mutable_condition() ->mutable_condition() ->mutable_higher_condition() ->set_threshold(1); dataset::proto::DataSpecification dataspec; auto* col_spec = dataspec.add_columns(); col_spec->set_name("a"); col_spec->set_type(dataset::proto::ColumnType::NUMERICAL); dataset::VerticalDataset dataset; dataset.set_data_spec(dataspec); CHECK_OK(dataset.CreateColumnsFromDataspec()); auto* col = dataset.MutableColumnWithCast<dataset::VerticalDataset::NumericalColumn>( 0); col->Add(0); col->Add(2); dataset.set_nrow(2); // We get the first positive child. CHECK_EQ(&tree.GetLeaf(dataset, 0), &tree.root().neg_child()->node()); CHECK_EQ(&tree.GetLeaf(dataset, 1), &tree.root().pos_child()->node()); { std::vector<const NodeWithChildren*> path; tree.GetPath(dataset, 0, &path); CHECK_EQ(path.size(), 2); CHECK_EQ(path[0], &tree.root()); CHECK_EQ(path[1], tree.root().neg_child()); } { std::vector<const NodeWithChildren*> path; tree.GetPath(dataset, 1, &path); CHECK_EQ(path.size(), 2); CHECK_EQ(path[0], &tree.root()); CHECK_EQ(path[1], tree.root().pos_child()); } // Switch the 0 and 1 rows. CHECK_EQ(&tree.GetLeafWithSwappedAttribute(dataset, 0, 0, 1), &tree.root().pos_child()->node()); CHECK_EQ(&tree.GetLeafWithSwappedAttribute(dataset, 1, 0, 0), &tree.root().neg_child()->node()); // Replace the row 0 and 1 by themself i.e. equivalent to "GetLeaf". CHECK_EQ(&tree.GetLeafWithSwappedAttribute(dataset, 0, 0, 0), &tree.root().neg_child()->node()); CHECK_EQ(&tree.GetLeafWithSwappedAttribute(dataset, 1, 0, 1), &tree.root().pos_child()->node()); // Switch the row 0 and 1 for an unused attribute. CHECK_EQ(&tree.GetLeafWithSwappedAttribute(dataset, 0, 2, 1), &tree.root().neg_child()->node()); CHECK_EQ(&tree.GetLeafWithSwappedAttribute(dataset, 1, 2, 0), &tree.root().pos_child()->node()); } class EvalConditions : public ::testing::Test { protected: void SetUp() override { const std::string toy_dataset_path = absl::StrCat("csv:", file::JoinPath(DatasetDir(), "toy.csv")); dataset::proto::DataSpecificationGuide guide; guide.mutable_default_column_guide() ->mutable_categorial() ->set_min_vocab_frequency(1); dataset::proto::DataSpecification data_spec; dataset::CreateDataSpec(toy_dataset_path, false, guide, &data_spec); CHECK_OK(LoadVerticalDataset(toy_dataset_path, data_spec, &dataset_)); } // Check the evaluation of a condition on VerticalDataset and proto::Example. // Returns the string representation of the condition. std::string CheckCondition(absl::string_view text_proto_condition, const int dataset_row, const bool expected_result) { const proto::NodeCondition condition = PARSE_TEST_PROTO(text_proto_condition); EXPECT_EQ(EvalCondition(condition, dataset_, dataset_row), expected_result); dataset::proto::Example example; dataset_.ExtractExample(dataset_row, &example); EXPECT_EQ(EvalCondition(condition, example), expected_result); std::string description; AppendConditionDescription(dataset_.data_spec(), condition, &description); return description; } dataset::VerticalDataset dataset_; }; TEST_F(EvalConditions, EvalConditionNA) { // The tested value is NA. CheckCondition( R"( na_value: true attribute: 1 condition { na_condition {} } )", 0, true); // The tested value is not NA. CheckCondition( R"( na_value: true attribute: 1 condition { na_condition {} } )", 1, false); } TEST_F(EvalConditions, EvalConditionHigher) { // The tested value is 2. CheckCondition( R"( na_value: true attribute: 1 condition { higher_condition { threshold: 1 } } )", 1, true); CheckCondition( R"( na_value: true attribute: 1 condition { higher_condition { threshold: 3 } } )", 1, false); // The tested value is NA. CheckCondition( R"( na_value: true attribute: 1 condition { higher_condition { threshold: 1 } } )", 0, true); CheckCondition( R"( na_value: false attribute: 1 condition { higher_condition { threshold: 1 } } )", 0, false); } TEST_F(EvalConditions, EvalConditionTrueValue) { // The tested value is false. CheckCondition( R"( na_value: true attribute: 6 condition { true_value_condition {} } )", 0, false); // The tested value is true. CheckCondition( R"( na_value: true attribute: 6 condition { true_value_condition {} } )", 1, true); } TEST_F(EvalConditions, EvalConditionContainsVector) { // The tested value is A=1. CheckCondition( R"( na_value: true attribute: 2 condition { contains_condition { elements: 1 elements: 2 } } )", 0, true); CheckCondition( R"( na_value: true attribute: 2 condition { contains_condition { elements: 2 elements: 3 } } )", 0, false); // The tested value is B=2. CheckCondition( R"( na_value: true attribute: 2 condition { contains_condition { elements: 2 elements: 3 } } )", 1, true); } TEST_F(EvalConditions, EvalConditionContainsVectorSet) { // The tested value is {X=1}. CheckCondition( R"( na_value: true attribute: 5 condition { contains_condition { elements: 1 elements: 2 } } )", 1, true); // The tested value is the *empty* set. CheckCondition( R"( na_value: true attribute: 5 condition { contains_condition { elements: 1 elements: 2 } } )", 0, false); } TEST_F(EvalConditions, EvalConditionContainsBitmap) { // The tested value is 1=A. CheckCondition( R"( na_value: true attribute: 2 condition { contains_bitmap_condition { elements_bitmap: "\x06" } } )", 0, true); CheckCondition( R"( na_value: true attribute: 2 condition { contains_bitmap_condition { elements_bitmap: "\x0c" } } )", 0, false); // The tested value is B=2. CheckCondition( R"( na_value: true attribute: 2 condition { contains_bitmap_condition { elements_bitmap: "\x0c" } } )", 1, true); } TEST_F(EvalConditions, EvalConditionContainsBitmapSet) { // The tested value is {X=1}. The condition is {1, 2}. CheckCondition( R"( na_value: true attribute: 5 condition { contains_bitmap_condition { elements_bitmap: "\x06" } } )", 1, true); // The tested value is the *empty* set. The condition is {1, 2}. CheckCondition( R"( na_value: true attribute: 5 condition { contains_bitmap_condition { elements_bitmap: "\x06" } } )", 0, false); } TEST_F(EvalConditions, EvalConditionOblique) { CheckCondition( R"( attribute: 0 condition { oblique_condition { attributes: 0 attributes: 1 weights: 1 weights: 1 threshold: 1 } } )", 1, true); CheckCondition( R"( attribute: 0 condition { oblique_condition { attributes: 0 attributes: 1 weights: 1 weights: 1 threshold: 5 } } )", 1, false); const auto description = CheckCondition( R"( attribute: 0 condition { oblique_condition { attributes: 0 attributes: 1 weights: 1 weights: -0.5 threshold: 3.5 } } )", 1, false); EXPECT_EQ( description, R"(Condition:: "Num_1"x1+"Num_2"x-0.5>=3.5 score:0.000000 training_examples:0 positive_training_examples:0 missing_value_evaluation:0)"); CheckCondition( R"( attribute: 0 na_value: true condition { oblique_condition { attributes: 0 attributes: 1 weights: 1 weights: 1 threshold: 1 } } )", 0, true); CheckCondition( R"( attribute: 0 na_value: false condition { oblique_condition { attributes: 0 attributes: 1 weights: 1 weights: 1 threshold: 1 } } )", 0, false); } TEST(DecisionTree, ScaleRegressorOutput) { DecisionTree tree; tree.CreateRoot(); tree.mutable_root()->CreateChildren(); tree.mutable_root() ->mutable_pos_child() ->mutable_node() ->mutable_regressor() ->set_top_value(1.f); tree.mutable_root() ->mutable_neg_child() ->mutable_node() ->mutable_regressor() ->set_top_value(2.f); tree.ScaleRegressorOutput(2.f); EXPECT_NEAR(tree.root().pos_child()->node().regressor().top_value(), 2.0f, 0.0001f); EXPECT_NEAR(tree.root().neg_child()->node().regressor().top_value(), 4.0f, 0.0001f); } TEST(DecisionTree, CountFeatureUsage) { DecisionTree tree; tree.CreateRoot(); auto* n0 = tree.mutable_root(); n0->CreateChildren(); auto* c0 = n0->mutable_node()->mutable_condition(); c0->set_attribute(0); c0->mutable_condition()->mutable_higher_condition()->set_threshold(1); auto* n2 = n0->mutable_neg_child(); n2->CreateChildren(); auto* c2 = n2->mutable_node()->mutable_condition(); c2->set_attribute(1); c2->mutable_condition()->mutable_oblique_condition()->add_attributes(1); c2->mutable_condition()->mutable_oblique_condition()->add_attributes(2); std::unordered_map<int32_t, int64_t> feature_usage; tree.CountFeatureUsage(&feature_usage); EXPECT_EQ(feature_usage.size(), 3); EXPECT_EQ(feature_usage[0], 1); EXPECT_EQ(feature_usage[1], 1); EXPECT_EQ(feature_usage[2], 1); } TEST(DecisionTree, DoSortedRangesIntersect) { std::vector<int> a; std::vector<int> b; const auto intersect = [&]() -> bool { return DoSortedRangesIntersect(a.begin(), a.end(), b.begin(), b.end()); }; EXPECT_FALSE(intersect()); a = {1, 2, 3}; b = {0, 4, 5}; EXPECT_FALSE(intersect()); a = {1, 2, 3}; b = {1, 4, 5}; EXPECT_TRUE(intersect()); a = {10}; b = {10}; EXPECT_TRUE(intersect()); a = {1, 2, 3}; b = {-2, -1, 3}; EXPECT_TRUE(intersect()); a = {1, 2, 3}; b = {-2, 2, 8}; EXPECT_TRUE(intersect()); a = {}; b = {0, 4, 5}; EXPECT_FALSE(intersect()); a = {1, 2, 3}; b = {}; EXPECT_FALSE(intersect()); } } // namespace } // namespace decision_tree } // namespace model } // namespace yggdrasil_decision_forests
25.975659
143
0.630017
google
526f8c4956a0cf823ccc8bb94b12052fffaa7adf
61,272
cpp
C++
core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp
anoopsharma00/incubator-trafodion
b109e2cf5883f8e763af853ab6fad7ce7110d9e8
[ "Apache-2.0" ]
null
null
null
core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp
anoopsharma00/incubator-trafodion
b109e2cf5883f8e763af853ab6fad7ce7110d9e8
[ "Apache-2.0" ]
null
null
null
core/conn/odbc/src/odbc/nsksrvr/Interface/marshalingsrvr_srvr.cpp
anoopsharma00/incubator-trafodion
b109e2cf5883f8e763af853ab6fad7ce7110d9e8
[ "Apache-2.0" ]
null
null
null
// @@@ START COPYRIGHT @@@ // // 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. // // @@@ END COPYRIGHT @@@ #include "ceercv.h" #include <platform_ndcs.h> #include "inoutparams.h" #include "odbcCommon.h" #include "odbc_sv.h" #include "Transport.h" #include "marshaling.h" #include "Global.h" #include "CSrvrStmt.h" #include "srvrcommon.h" extern void logError( short Code, short Severity, short Operation ); extern char errStrBuf1[], errStrBuf2[], errStrBuf3[], errStrBuf4[], errStrBuf5[]; //================== Marshaling ============================== CEE_status odbc_SQLSvc_InitializeDialogue_param_res_( CInterface* pnode , IDL_char*& buffer , IDL_unsigned_long& message_length , /* In */ const struct odbc_SQLSvc_InitializeDialogue_exc_ *exception_ , /* In */ const OUT_CONNECTION_CONTEXT_def *outContext ) { SRVRTRACE_ENTER(FILE_OMR+1); IDL_char* curptr; IDL_long wlength; IDL_long exceptionLength = 0; IDL_long computerNameLength = 0; IDL_long catalogLength = 0; IDL_long schemaLength = 0; VERSION_def version[4]; VERSION_def* versionPtr = &version[0]; wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_InitializeDialogue_exc_ *exception_ // wlength += sizeof(exception_->exception_nr); wlength += sizeof(exception_->exception_detail); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_InitializeDialogue_ParamError_exn_: wlength += sizeof(exceptionLength); if (exception_->u.ParamError.ParamDesc != NULL) { exceptionLength = strlen(exception_->u.ParamError.ParamDesc) + 1; wlength += exceptionLength; } break; case odbc_SQLSvc_InitializeDialogue_InvalidConnection_exn_: break; case odbc_SQLSvc_InitializeDialogue_SQLError_exn_: ERROR_DESC_LIST_length( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, wlength); break; case odbc_SQLSvc_InitializeDialogue_SQLInvalidHandle_exn_: break; case odbc_SQLSvc_InitializeDialogue_SQLNeedData_exn_: break; case odbc_SQLSvc_InitializeDialogue_InvalidUser_exn_: ERROR_DESC_LIST_length( (ERROR_DESC_LIST_def *)&exception_->u.InvalidUser.errorList, wlength); break; default: break; //LCOV_EXCL_STOP } // // length of OUT_CONNECTION_CONTEXT_def // // VERSION_LIST_def clientVersionList; // length of IDL_long versionListlength wlength += sizeof(outContext->versionList._length); // Get the versionPtr versionPtr = outContext->versionList._buffer; for (int i = 0; i < outContext->versionList._length; i++) { // length of componentId wlength += sizeof(versionPtr->componentId); // length of majorVersion wlength += sizeof(versionPtr->majorVersion); // length of minorVersion wlength += sizeof(versionPtr->minorVersion); // length of buildId wlength += sizeof(versionPtr->buildId); // Get the next versionlist values versionPtr++; } // get sizeof of nodeId wlength += sizeof(outContext->nodeId); // get sizeof processId wlength += sizeof(outContext->processId); // // length of SQL_IDENTIFIER_DEF computerName if (outContext->computerName[0] != '\0') { wlength += sizeof(computerNameLength); computerNameLength = strlen(outContext->computerName) + 1; wlength += computerNameLength; } else { wlength += sizeof(computerNameLength); computerNameLength = 0; } // length of SQL_IDENTIFIER_DEF catalog if (outContext->catalog[0] != '\0') { wlength += sizeof(catalogLength); catalogLength = strlen(outContext->catalog) + 1; wlength += catalogLength; } else { wlength += sizeof(catalogLength); catalogLength = 0; } // length of SQL_IDENTIFIER_DEF schema if (outContext->schema[0] != '\0') { wlength += sizeof(schemaLength); schemaLength = strlen(outContext->schema) + 1; wlength += schemaLength; } else { wlength += sizeof(schemaLength); schemaLength = 0; } wlength += sizeof(outContext->outContextOptions1); wlength += sizeof(outContext->outContextOptions2); if (outContext->outContextOptions1 & OUTCONTEXT_OPT1_ROLENAME || outContext->outContextOptions1 & OUTCONTEXT_OPT1_DOWNLOAD_CERTIFICATE) { wlength += sizeof(outContext->outContextOptionStringLen); wlength += outContext->outContextOptionStringLen; } // message_length message_length = wlength; if ((buffer = pnode->w_allocate(message_length)) == NULL) { return CEE_ALLOCFAIL; } curptr = buffer + sizeof(HEADER); // // copy odbc_SQLSvc_InitializeDialogue_exc_ *exception_ // IDL_long_copy((IDL_long *)&exception_->exception_nr, curptr); IDL_long_copy((IDL_long *)&exception_->exception_detail, curptr); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_InitializeDialogue_ParamError_exn_: IDL_long_copy(&exceptionLength, curptr); if (exception_->u.ParamError.ParamDesc != NULL) IDL_charArray_copy((const IDL_char *)exception_->u.ParamError.ParamDesc, curptr); break; case odbc_SQLSvc_InitializeDialogue_InvalidConnection_exn_: break; case odbc_SQLSvc_InitializeDialogue_SQLError_exn_: ERROR_DESC_LIST_copy( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, curptr); break; case odbc_SQLSvc_InitializeDialogue_SQLInvalidHandle_exn_: break; case odbc_SQLSvc_InitializeDialogue_SQLNeedData_exn_: break; case odbc_SQLSvc_InitializeDialogue_InvalidUser_exn_: ERROR_DESC_LIST_copy( (ERROR_DESC_LIST_def *)&exception_->u.InvalidUser.errorList, curptr); break; default: break; //LCOV_EXCL_STOP } // // copy OUT_CONNECTION_CONTEXT // // copy VERSION_LIST_def *versionList // Get the versionPtr versionPtr = outContext->versionList._buffer; // copy version length IDL_unsigned_long_copy((unsigned int *)&outContext->versionList._length, curptr); for (int i = 0; i < outContext->versionList._length; i++) { // copy componentId IDL_short_copy(&versionPtr->componentId, curptr); // copy majorVersion IDL_short_copy(&versionPtr->majorVersion, curptr); // copy minorVersion IDL_short_copy(&versionPtr->minorVersion, curptr); // copy buildId IDL_unsigned_long_copy(&versionPtr->buildId, curptr); // Get the next versionlist values versionPtr++; } // copy nodeid IDL_short_copy((IDL_short *) &outContext->nodeId, curptr); // copy processId IDL_unsigned_long_copy((IDL_unsigned_long *)&outContext->processId, curptr); //copy computerNameLength IDL_long_copy(&computerNameLength, curptr); // copy computerName if (outContext->computerName[0] != '\0') { IDL_charArray_copy(outContext->computerName, curptr); } // copy catalog length IDL_long_copy(&catalogLength, curptr); // copy catalog if (outContext->catalog[0] != '\0') { IDL_charArray_copy(outContext->catalog, curptr); } // copy schema length IDL_long_copy(&schemaLength, curptr); // copy catalog if (outContext->schema[0] != '\0') { IDL_charArray_copy(outContext->schema, curptr); } IDL_unsigned_long_copy((IDL_unsigned_long *)&outContext->outContextOptions1, curptr); IDL_unsigned_long_copy((IDL_unsigned_long *)&outContext->outContextOptions2, curptr); //#ifdef _TMP_SQ_SECURITY if (outContext->outContextOptions1 & OUTCONTEXT_OPT1_ROLENAME || outContext->outContextOptions1 & OUTCONTEXT_OPT1_DOWNLOAD_CERTIFICATE) { IDL_unsigned_long_copy((IDL_unsigned_long *)&outContext->outContextOptionStringLen, curptr); if (outContext->outContextOptionStringLen > 0) { IDL_byteArray_copy((BYTE *)(outContext->outContextOptionString), outContext->outContextOptionStringLen, curptr); } } //#else // if (outContext->outContextOptions1 & OUTCONTEXT_OPT1_ROLENAME) // { // IDL_unsigned_long_copy((IDL_unsigned_long *)&outContext->outContextOptionStringLen, curptr); // if (outContext->outContextOptionStringLen > 0) // { // IDL_charArray_copy(outContext->outContextOptionString, curptr); // } // } //#endif if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingas_srvr.cpp"); strcpy( errStrBuf3, "AS-odbcas_ASSvc_GetObjRefHdl_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } SRVRTRACE_EXIT(FILE_OMR+1); return CEE_SUCCESS; } // odbc_SQLSvc_InitializeDialogue_param_res_() CEE_status odbc_SQLSvc_TerminateDialogue_param_res_( CInterface* pnode , IDL_char*& buffer , IDL_unsigned_long& message_length , /* In */ const odbc_SQLSvc_TerminateDialogue_exc_ *exception_ ) { SRVRTRACE_ENTER(FILE_OMR+2); IDL_char* curptr; IDL_long wlength; IDL_long exceptionLength = 0; wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_TerminateDialogue_exc_ *exception_ // wlength += sizeof(exception_->exception_nr); wlength += sizeof(exception_->exception_detail); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_TerminateDialogue_ParamError_exn_: wlength += sizeof(exceptionLength); if (exception_->u.ParamError.ParamDesc != NULL) { exceptionLength = strlen(exception_->u.ParamError.ParamDesc) + 1; wlength += exceptionLength; } break; case odbc_SQLSvc_TerminateDialogue_InvalidConnection_exn_: break; case odbc_SQLSvc_TerminateDialogue_SQLError_exn_: ERROR_DESC_LIST_length( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, wlength); break; default: break; //LCOV_EXCL_STOP } // message_length message_length = wlength; if ((buffer = pnode->w_allocate(message_length)) == NULL) { return CEE_ALLOCFAIL; } curptr = buffer + sizeof(HEADER); // // copy odbc_SQLSvc_TerminateDialogue_exc_ *exception_ // IDL_long_copy((IDL_long *)&exception_->exception_nr, curptr); IDL_long_copy((IDL_long *)&exception_->exception_detail, curptr); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_TerminateDialogue_ParamError_exn_: IDL_long_copy(&exceptionLength, curptr); if (exception_->u.ParamError.ParamDesc != NULL) IDL_charArray_copy((const IDL_char *)exception_->u.ParamError.ParamDesc, curptr); break; case odbc_SQLSvc_TerminateDialogue_InvalidConnection_exn_: break; case odbc_SQLSvc_TerminateDialogue_SQLError_exn_: ERROR_DESC_LIST_copy( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, curptr); break; default: break; //LCOV_EXCL_STOP } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingas_srvr.cpp"); strcpy( errStrBuf3, "AS-odbcas_ASSvc_GetObjRefHdl_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } SRVRTRACE_EXIT(FILE_OMR+2); return CEE_SUCCESS; } CEE_status odbc_SQLSrvr_Close_param_res_( CInterface* pnode , IDL_char*& buffer , IDL_unsigned_long& message_length , /* In */ IDL_long returnCode , /* In */ IDL_long sqlWarningOrErrorLength , /* In */ BYTE *sqlWarningOrError , /* In */ IDL_long rowsAffected ) { SRVRTRACE_ENTER(FILE_OMR+12); IDL_char *curptr; IDL_long wlength; wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // length of IDL_long returnCode // wlength += sizeof(returnCode); // // length of IDL_long sqlWarningOrErrorLength // length of BYTE *sqlWarningOrError // if (sqlWarningOrError != NULL) { wlength += sizeof (sqlWarningOrErrorLength); wlength += sqlWarningOrErrorLength; } // // length of IDL_long rowsAffected // wlength += sizeof(rowsAffected); // // message_length = header + param + maplength + data length // message_length = wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } curptr = buffer + sizeof(HEADER); // // copy of IDL_long returnCode // IDL_long_copy(&returnCode, curptr); // // copy IDL_long sqlWarningOrErrorLength // copy BYTE *sqlWarningOrError // if (sqlWarningOrError != NULL) { IDL_long_copy(&sqlWarningOrErrorLength, curptr); IDL_byteArray_copy(sqlWarningOrError, sqlWarningOrErrorLength, curptr); } // // copy of IDL_long rowsAffected // IDL_long_copy(&rowsAffected, curptr); if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSrvr_Close_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } SRVRTRACE_EXIT(FILE_OMR+12); return CEE_SUCCESS; } CEE_status odbc_SQLSvc_StopServer_param_res_( CInterface* pnode , char*& buffer , UInt32& message_length , /* In */ const struct odbc_SQLSvc_StopServer_exc_ *exception_ ) { SRVRTRACE_ENTER(FILE_OMR+16); long* parptr; long* mapptr; char* curptr; char* pbuffer; long wlength; long maplength; short number_of_param = StopServer_out_params; wlength = sizeof(HEADER); maplength = (number_of_param + 1) * sizeof(long); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_StopServer_exc_ *exception_ // wlength += sizeof(odbc_SQLSvc_StopServer_exc_); switch(exception_->exception_nr) { case odbc_SQLSvc_StopServer_ParamError_exn_: STRING_length( exception_->u.ParamError.ParamDesc, wlength, maplength); break; case odbc_SQLSvc_StopServer_ProcessStopError_exn_: STRING_length( exception_->u.ProcessStopError.ErrorText, wlength, maplength); break; default: break; } // // message_length = header + param + maplength + data length // message_length = maplength + wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } pbuffer = buffer + sizeof(HEADER); parptr = (long*)pbuffer; mapptr = parptr + number_of_param; curptr = (char*)parptr + maplength; // // copy odbc_SQLSvc_StopServer_exc_ *exception_ // odbc_SQLSvc_StopServer_exc_* par1ptr = (odbc_SQLSvc_StopServer_exc_ *)curptr; memcpy(curptr, exception_, sizeof(odbc_SQLSvc_StopServer_exc_)); curptr += sizeof (odbc_SQLSvc_StopServer_exc_); switch(exception_->exception_nr) { case odbc_SQLSvc_StopServer_ParamError_exn_: STRING_copy( pbuffer, exception_->u.ParamError.ParamDesc, &par1ptr->u.ParamError.ParamDesc, curptr, mapptr); break; case odbc_SQLSvc_StopServer_ProcessStopError_exn_: STRING_copy( pbuffer, exception_->u.ProcessStopError.ErrorText, &par1ptr->u.ParamError.ParamDesc, curptr, mapptr); break; default: break; } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_StopServer_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_START } // // set end of map list // *(mapptr) = 0; // // save relative positions of all parameters // *(parptr++) = (long)par1ptr - (long)pbuffer; if (pnode->swap() == SWAP_YES) pnode->process_swap(pbuffer); SRVRTRACE_EXIT(FILE_OMR+16); return CEE_SUCCESS; } CEE_status odbc_SQLSvc_EnableServerTrace_param_res_( CInterface* pnode , char*& buffer , UInt32& message_length , /* In */ const struct odbc_SQLSvc_EnableServerTrace_exc_ *exception_ ) { SRVRTRACE_ENTER(FILE_OMR+17); long* parptr; long* mapptr; char* curptr; char* pbuffer; long wlength; long maplength; short number_of_param = EnableServerTrace_out_params; wlength = sizeof(HEADER); maplength = (number_of_param + 1) * sizeof(long); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_EnableServerTrace_exc_ *exception_ // wlength += sizeof(odbc_SQLSvc_EnableServerTrace_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_EnableServerTrace_ParamError_exn_: STRING_length( exception_->u.ParamError.ParamDesc, wlength, maplength); break; case odbc_SQLSvc_EnableServerTrace_TraceError_exn_: case odbc_SQLSvc_EnableServerTrace_TraceAlreadyEnabled_exn_: break; default: break; //LCOV_EXCL_STOP } // // message_length = header + param + maplength + data length // message_length = maplength + wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } pbuffer = buffer + sizeof(HEADER); parptr = (long*)pbuffer; mapptr = parptr + number_of_param; curptr = (char*)parptr + maplength; // // copy odbc_SQLSvc_EnableServerTrace_exc_ *exception_ // odbc_SQLSvc_EnableServerTrace_exc_* par1ptr = (odbc_SQLSvc_EnableServerTrace_exc_ *)curptr; memcpy(curptr, exception_, sizeof(odbc_SQLSvc_EnableServerTrace_exc_)); curptr += sizeof (odbc_SQLSvc_EnableServerTrace_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_EnableServerTrace_ParamError_exn_: STRING_copy( pbuffer, exception_->u.ParamError.ParamDesc, &par1ptr->u.ParamError.ParamDesc, curptr, mapptr); break; case odbc_SQLSvc_EnableServerTrace_TraceError_exn_: case odbc_SQLSvc_EnableServerTrace_TraceAlreadyEnabled_exn_: break; default: break; //LCOV_EXCL_STOP } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_EnableServerTrace_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } // // set end of map list // *(mapptr) = 0; // // save relative positions of all parameters // *(parptr++) = (long)par1ptr - (long)pbuffer; if (pnode->swap() == SWAP_YES) pnode->process_swap(pbuffer); SRVRTRACE_EXIT(FILE_OMR+17); return CEE_SUCCESS; } CEE_status odbc_SQLSvc_DisableServerTrace_param_res_( CInterface* pnode , char*& buffer , UInt32& message_length , /* In */ const struct odbc_SQLSvc_DisableServerTrace_exc_ *exception_ ) { SRVRTRACE_ENTER(FILE_OMR+18); long* parptr; long* mapptr; char* curptr; char* pbuffer; long wlength; long maplength; short number_of_param = DisableServerTrace_out_params; wlength = sizeof(HEADER); maplength = (number_of_param + 1) * sizeof(long); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_DisableServerTrace_exc_ *exception_ // wlength += sizeof(odbc_SQLSvc_DisableServerTrace_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_DisableServerTrace_ParamError_exn_: STRING_length( exception_->u.ParamError.ParamDesc, wlength, maplength); break; case odbc_SQLSvc_DisableServerTrace_TraceError_exn_: case odbc_SQLSvc_DisableServerTrace_TraceAlreadyDisabled_exn_: break; default: break; //LCOV_EXCL_STOP } // // message_length = header + param + maplength + data length // message_length = maplength + wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } pbuffer = buffer + sizeof(HEADER); parptr = (long*)pbuffer; mapptr = parptr + number_of_param; curptr = (char*)parptr + maplength; // // copy odbc_SQLSvc_DisableServerTrace_exc_ *exception_ // odbc_SQLSvc_DisableServerTrace_exc_* par1ptr = (odbc_SQLSvc_DisableServerTrace_exc_ *)curptr; memcpy(curptr, exception_, sizeof(odbc_SQLSvc_DisableServerTrace_exc_)); curptr += sizeof (odbc_SQLSvc_DisableServerTrace_exc_); switch(exception_->exception_nr) { case odbc_SQLSvc_DisableServerTrace_ParamError_exn_: STRING_copy( pbuffer, exception_->u.ParamError.ParamDesc, &par1ptr->u.ParamError.ParamDesc, curptr, mapptr); break; case odbc_SQLSvc_DisableServerTrace_TraceError_exn_: case odbc_SQLSvc_DisableServerTrace_TraceAlreadyDisabled_exn_: break; default: break; } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_DisableServerTrace_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } // // set end of map list // *(mapptr) = 0; // // save relative positions of all parameters // *(parptr++) = (long)par1ptr - (long)pbuffer; if (pnode->swap() == SWAP_YES) pnode->process_swap(pbuffer); SRVRTRACE_EXIT(FILE_OMR+18); return CEE_SUCCESS; } CEE_status odbc_SQLSvc_EnableServerStatistics_param_res_( CInterface* pnode , char*& buffer , UInt32& message_length , /* In */ const struct odbc_SQLSvc_EnableServerStatistics_exc_ *exception_ ) { SRVRTRACE_ENTER(FILE_OMR+19); long* parptr; long* mapptr; char* curptr; char* pbuffer; long wlength; long maplength; short number_of_param = EnableServerStatistics_out_params; wlength = sizeof(HEADER); maplength = (number_of_param + 1) * sizeof(long); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_EnableServerStatistics_exc_ *exception_ // wlength += sizeof(odbc_SQLSvc_EnableServerStatistics_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_EnableServerStatistics_ParamError_exn_: STRING_length( exception_->u.ParamError.ParamDesc, wlength, maplength); break; case odbc_SQLSvc_EnableServerStatistics_StatisticsError_exn_: case odbc_SQLSvc_EnableServerStatistics_StatisticsAlreadyEnabled_exn_: break; default: break; //LCOV_EXCL_STOP } // // message_length = header + param + maplength + data length // message_length = maplength + wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } pbuffer = buffer + sizeof(HEADER); parptr = (long*)pbuffer; mapptr = parptr + number_of_param; curptr = (char*)parptr + maplength; // // copy odbc_SQLSvc_EnableServerStatistics_exc_ *exception_ // odbc_SQLSvc_EnableServerStatistics_exc_* par1ptr = (odbc_SQLSvc_EnableServerStatistics_exc_ *)curptr; memcpy(curptr, exception_, sizeof(odbc_SQLSvc_EnableServerStatistics_exc_)); curptr += sizeof (odbc_SQLSvc_EnableServerStatistics_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_EnableServerStatistics_ParamError_exn_: STRING_copy( pbuffer, exception_->u.ParamError.ParamDesc, &par1ptr->u.ParamError.ParamDesc, curptr, mapptr); break; case odbc_SQLSvc_EnableServerStatistics_StatisticsError_exn_: case odbc_SQLSvc_EnableServerStatistics_StatisticsAlreadyEnabled_exn_: break; default: break; //LCOV_EXCL_STOP } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_EnableServerStatistics_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } // // set end of map list // *(mapptr) = 0; // // save relative positions of all parameters // *(parptr++) = (long)par1ptr - (long)pbuffer; if (pnode->swap() == SWAP_YES) pnode->process_swap(pbuffer); SRVRTRACE_EXIT(FILE_OMR+19); return CEE_SUCCESS; } CEE_status odbc_SQLSvc_DisableServerStatistics_param_res_( CInterface* pnode , char*& buffer , UInt32& message_length , /* In */ const struct odbc_SQLSvc_DisableServerStatistics_exc_ *exception_ ) { SRVRTRACE_ENTER(FILE_OMR+20); long* parptr; long* mapptr; char* curptr; char* pbuffer; long wlength; long maplength; short number_of_param = DisableServerStatistics_out_params; wlength = sizeof(HEADER); maplength = (number_of_param + 1) * sizeof(long); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_DisableServerStatistics_exc_ *exception_ // wlength += sizeof(odbc_SQLSvc_DisableServerStatistics_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_DisableServerStatistics_ParamError_exn_: STRING_length( exception_->u.ParamError.ParamDesc, wlength, maplength); break; case odbc_SQLSvc_DisableServerStatistics_StatisticsError_exn_: case odbc_SQLSvc_DisableServerStatistics_StatisticsAlreadyDisabled_exn_: break; default: break; //LCOV_EXCL_STOP } // // message_length = header + param + maplength + data length // message_length = maplength + wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } pbuffer = buffer + sizeof(HEADER); parptr = (long*)pbuffer; mapptr = parptr + number_of_param; curptr = (char*)parptr + maplength; // // copy odbc_SQLSvc_DisableServerStatistics_exc_ *exception_ // odbc_SQLSvc_DisableServerStatistics_exc_* par1ptr = (odbc_SQLSvc_DisableServerStatistics_exc_ *)curptr; memcpy(curptr, exception_, sizeof(odbc_SQLSvc_DisableServerStatistics_exc_)); curptr += sizeof (odbc_SQLSvc_DisableServerStatistics_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_DisableServerStatistics_ParamError_exn_: STRING_copy( pbuffer, exception_->u.ParamError.ParamDesc, &par1ptr->u.ParamError.ParamDesc, curptr, mapptr); break; case odbc_SQLSvc_DisableServerStatistics_StatisticsError_exn_: case odbc_SQLSvc_DisableServerStatistics_StatisticsAlreadyDisabled_exn_: break; default: break; //LCOV_EXCL_STOP } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_DisableServerStatistics_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } // // set end of map list // *(mapptr) = 0; // // save relative positions of all parameters // *(parptr++) = (long)par1ptr - (long)pbuffer; if (pnode->swap() == SWAP_YES) pnode->process_swap(pbuffer); SRVRTRACE_EXIT(FILE_OMR+20); return CEE_SUCCESS; } CEE_status odbc_SQLSvc_UpdateServerContext_param_res_( CInterface* pnode , char*& buffer , UInt32& message_length , /* In */ const struct odbc_SQLSvc_UpdateServerContext_exc_ *exception_ ) { SRVRTRACE_ENTER(FILE_OMR+21); long* parptr; long* mapptr; char* curptr; char* pbuffer; long wlength; long maplength; short number_of_param = UpdateServerContext_out_params; wlength = sizeof(HEADER); maplength = (number_of_param + 1) * sizeof(long); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_UpdateServerContext_exc_ *exception_ // wlength += sizeof(odbc_SQLSvc_UpdateServerContext_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_UpdateServerContext_ParamError_exn_: STRING_length( exception_->u.ParamError.ParamDesc, wlength, maplength); break; case odbc_SQLSvc_UpdateServerContext_SQLError_exn_: ERROR_DESC_LIST_length( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, wlength, maplength); break; default: break; //LCOV_EXCL_STOP } // // message_length = header + param + maplength + data length // message_length = maplength + wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } pbuffer = buffer + sizeof(HEADER); parptr = (long*)pbuffer; mapptr = parptr + number_of_param; curptr = (char*)parptr + maplength; // // copy odbc_SQLSvc_UpdateServerContext_exc_ *exception_ // odbc_SQLSvc_UpdateServerContext_exc_* par1ptr = (odbc_SQLSvc_UpdateServerContext_exc_ *)curptr; memcpy(curptr, exception_, sizeof(odbc_SQLSvc_UpdateServerContext_exc_)); curptr += sizeof (odbc_SQLSvc_UpdateServerContext_exc_); switch(exception_->exception_nr) { //LCOV_EXCL_START case odbc_SQLSvc_UpdateServerContext_ParamError_exn_: STRING_copy( pbuffer, exception_->u.ParamError.ParamDesc, &par1ptr->u.ParamError.ParamDesc, curptr, mapptr); break; case odbc_SQLSvc_UpdateServerContext_SQLError_exn_: ERROR_DESC_LIST_copy( pbuffer, (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, &par1ptr->u.SQLError.errorList, curptr, mapptr); break; default: break; //LCOV_EXCL_STOP } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_UpdateServerContext_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } // // set end of map list // *(mapptr) = 0; // // save relative positions of all parameters // *(parptr++) = (long)par1ptr - (long)pbuffer; if (pnode->swap() == SWAP_YES) pnode->process_swap(pbuffer); SRVRTRACE_EXIT(FILE_OMR+21); return CEE_SUCCESS; } CEE_status odbc_SQLSvc_MonitorCall_param_res_( CInterface* pnode , char*& buffer , UInt32& message_length , /* In */ const struct odbc_SQLSvc_MonitorCall_exc_ *exception_ ) { SRVRTRACE_ENTER(FILE_OMR+22); long* parptr; long* mapptr; char* curptr; char* pbuffer; long wlength; long maplength; short number_of_param = MonitorCall_out_params; wlength = sizeof(HEADER); maplength = (number_of_param + 1) * sizeof(long); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_MonitorCall_exc_ *exception_ // wlength += sizeof(odbc_SQLSvc_MonitorCall_exc_); switch(exception_->exception_nr) { default: break; } // // message_length = header + param + maplength + data length // message_length = maplength + wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } pbuffer = buffer + sizeof(HEADER); parptr = (long*)pbuffer; mapptr = parptr + number_of_param; curptr = (char*)parptr + maplength; // // copy odbc_SQLSvc_MonitorCall_exc_ *exception_ // odbc_SQLSvc_MonitorCall_exc_* par1ptr = (odbc_SQLSvc_MonitorCall_exc_ *)curptr; memcpy(curptr, exception_, sizeof(odbc_SQLSvc_MonitorCall_exc_)); curptr += sizeof (odbc_SQLSvc_MonitorCall_exc_); switch(exception_->exception_nr) { default: break; } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_MonitorCall_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } // // set end of map list // *(mapptr) = 0; // // save relative positions of all parameters // *(parptr++) = (long)par1ptr - (long)pbuffer; if (pnode->swap() == SWAP_YES) pnode->process_swap(pbuffer); SRVRTRACE_EXIT(FILE_OMR+22); return CEE_SUCCESS; } CEE_status odbc_SQLSrvr_Prepare_param_res_( CInterface* pnode , IDL_char*& buffer , IDL_unsigned_long& message_length , /* In */ IDL_long returnCode , /* In */ IDL_long sqlWarningOrErrorLength , /* In */ BYTE *sqlWarningOrError , /* In */ IDL_long sqlQueryType , /* In */ IDL_long stmtHandleKey , /* In */ IDL_long estimatedCost , /* In */ IDL_long inputDescLength , /* In */ BYTE *inputDesc , /* In */ IDL_long outputDescLength , /* In */ BYTE *outputDesc ) { SRVRTRACE_ENTER(FILE_OMR+15); IDL_char* curptr; IDL_long wlength; wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // length of IDL_long returnCode // wlength += sizeof(returnCode); // // length of IDL_long sqlWarningOrErrorLength // length of BYTE *sqlWarningOrError // if (sqlWarningOrError != NULL) { wlength += sizeof(sqlWarningOrErrorLength); wlength += sqlWarningOrErrorLength; } // // length of IDL_long sqlQueryType // wlength += sizeof(sqlQueryType); // // length of IDL_long stmtHandleKey // wlength += sizeof(stmtHandleKey); // // length of IDL_long estimatedCost // wlength += sizeof(estimatedCost); // // length of IDL_long inputDescLength // length of BYTE *inputDesc // if (inputDesc != NULL) { wlength += sizeof(inputDescLength); wlength += inputDescLength; } else wlength += sizeof(inputDescLength); // // length of IDL_long outputDescLength // length of BYTE *outputDesc // if (outputDesc != NULL) { wlength += sizeof(outputDescLength); wlength += outputDescLength; } else wlength += sizeof(outputDescLength); // // message_length = header + param + maplength + data length // message_length = wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } curptr = (IDL_char*)(buffer + sizeof(HEADER)); // // copy of IDL_long returnCode // IDL_long_copy(&returnCode, curptr); // // copy IDL_long sqlWarningOrErrorLength // copy BYTE *sqlWarningOrError // if (sqlWarningOrError != NULL) { IDL_long_copy(&sqlWarningOrErrorLength, curptr); IDL_byteArray_copy(sqlWarningOrError, sqlWarningOrErrorLength, curptr); } // // copy of IDL_long sqlQueryType // IDL_long_copy(&sqlQueryType, curptr); // // copy of IDL_long stmtHandle // IDL_long_copy(&stmtHandleKey, curptr); // // copy of IDL_long estimatedCost // IDL_long_copy(&estimatedCost, curptr); // // copy IDL_long inputDescLength // copy BYTE *inputDesc // if (inputDesc != NULL) { IDL_long_copy(&inputDescLength, curptr); IDL_byteArray_copy(inputDesc, inputDescLength, curptr); } else { IDL_long_copy(&inputDescLength, curptr); } // // copy IDL_long outputDescLength // copy BYTE *outputDesc // if (outputDesc != NULL) { IDL_long_copy(&outputDescLength, curptr); IDL_byteArray_copy(outputDesc, outputDescLength, curptr); } else { IDL_long_copy(&outputDescLength, curptr); } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSrvr_Prepare_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } SRVRTRACE_EXIT(FILE_OMR+15); return CEE_SUCCESS; } /* odbc_SQLSrvr_Prepare_param_res_() */ CEE_status odbc_SQLSrvr_Fetch_param_res_( CInterface* pnode , IDL_char*& buffer , UInt32& message_length , /* In */ IDL_long returnCode , /* In */ IDL_long sqlWarningOrErrorLength , /* In */ BYTE *sqlWarningOrError , /* In */ IDL_long rowsAffected , /* In */ IDL_long outValuesFormat , /* In */ IDL_long outValuesLength , /* In */ BYTE *outValues ) { SRVRTRACE_ENTER(FILE_OMR+15); IDL_char *curptr; IDL_long wlength; wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // length of IDL_long returnCode // wlength += sizeof(returnCode); // // length of IDL_long sqlWarningOrErrorLength // length of BYTE *sqlWarningOrError // if (sqlWarningOrError != NULL) { wlength += sizeof (sqlWarningOrErrorLength); wlength += sqlWarningOrErrorLength; } // // length of IDL_long rowsAffected // wlength += sizeof(outValuesFormat); // // length of IDL_long rowsAffected // wlength += sizeof(rowsAffected); // // length of IDL_long outValuesLength // length of BYTE *outValues // if (outValues != NULL) { wlength += sizeof (outValuesLength); wlength += outValuesLength; } else wlength += sizeof (outValuesLength); // // message_length = header + param + maplength + data length // message_length = wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) return CEE_ALLOCFAIL; curptr = (IDL_char*)(buffer + sizeof(HEADER)); // // copy of IDL_long returnCode // IDL_long_copy(&returnCode, curptr); // // copy IDL_long sqlWarningOrErrorLength // copy BYTE *sqlWarningOrError // if (sqlWarningOrError != NULL) { IDL_long_copy(&sqlWarningOrErrorLength, curptr); IDL_byteArray_copy(sqlWarningOrError, sqlWarningOrErrorLength, curptr); } // // copy of IDL_long rowsAffected // IDL_long_copy(&rowsAffected, curptr); // // copy of IDL_long outValuesFormat // IDL_long_copy(&outValuesFormat, curptr); // // copy IDL_long outValuesLength // copy BYTE *outValues // if (outValues != NULL) { IDL_long_copy(&outValuesLength, curptr); if (outValues != NULL) { IDL_byteArray_copy(outValues, outValuesLength, curptr); } } else { IDL_long_copy(&outValuesLength, curptr); } if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSrvr_Fetch_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_START } SRVRTRACE_EXIT(FILE_OMR+15); return CEE_SUCCESS; } // end odbc_SQLSrvr_Fetch_param_res_() CEE_status odbc_SQLSrvr_Execute_param_res_( CInterface* pnode , IDL_char*& buffer , IDL_unsigned_long& message_length , /* In */ IDL_long returnCode , /* In */ IDL_long sqlWarningOrErrorLength , /* In */ BYTE *sqlWarningOrError , /* In */ IDL_long rowsAffected , /* In */ IDL_long sqlQueryType // Used by ExecDirect for unique selects , /* In */ IDL_long estimatedCost , /* In */ IDL_long outValuesLength , /* In */ BYTE *outValues , /* In */ IDL_long outputDescLength // Used to return the output descriptors for ExecDirect , /* In */ BYTE *outputDesc // Used to return the output descriptors for ExecDirect , /* In */ Long stmtHandle // Statement handle - needed to copy out SPJ result sets , /* In */ IDL_long stmtHandleKey ) { SRVRTRACE_ENTER(FILE_OMR+15); IDL_char *curptr; IDL_long wlength; SRVR_STMT_HDL *pSrvrStmt = (SRVR_STMT_HDL *)stmtHandle; SRVR_STMT_HDL *rsSrvrStmt; // To iterate thru the result set Long rsStmtHandle; // result set statement handle IDL_long rsStmtLabelLength; IDL_char *rsStmtName; IDL_long rsOutputDescBufferLength; BYTE *rsOutputDescBuffer; IDL_long charSet = 1; // KAS - SQLCHARSETCODE_ISO88591 - change this when supporting character sets IDL_long numResultSets = 0; IDL_long proxySyntaxStringLen = 0; if(pSrvrStmt != NULL) numResultSets = pSrvrStmt->numResultSets; // SPJ result sets wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // length of IDL_long returnCode // wlength += sizeof(returnCode); // // length of IDL_long sqlWarningOrErrorLength // length of BYTE *sqlWarningOrError // wlength += sizeof (sqlWarningOrErrorLength); if (sqlWarningOrError != NULL) { wlength += sqlWarningOrErrorLength; } // // length of IDL_long outputDescLength // length of BYTE* outputDesc // wlength += sizeof (outputDescLength); if(outputDescLength > 0) wlength += outputDescLength; // // length of IDL_long rowsAffected // wlength += sizeof(rowsAffected); // // length of IDL_long sqlQueryType // wlength += sizeof(sqlQueryType); // // length of IDL_long estimatedCost // wlength += sizeof(estimatedCost); // // length of IDL_long outValuesLength // length of BYTE *outValues // wlength += sizeof (outValuesLength); if (outValues != NULL) { wlength += outValuesLength; } // // length of SPJ numResultSets // wlength += sizeof (numResultSets); if(numResultSets > 0) { // // length of result set information // rsSrvrStmt = pSrvrStmt->nextSpjRs; for (int i = 0; i < numResultSets; i++) { rsStmtHandle = (Long)rsSrvrStmt; rsStmtLabelLength = (IDL_long)rsSrvrStmt->stmtNameLen + 1; // add 1 for null rsStmtName = (IDL_char *)rsSrvrStmt->stmtName; rsOutputDescBufferLength = rsSrvrStmt->outputDescBufferLength; wlength += sizeof(stmtHandleKey); wlength += sizeof(rsStmtLabelLength); wlength += rsStmtLabelLength; wlength += sizeof(charSet); wlength += sizeof(rsOutputDescBufferLength); wlength += rsOutputDescBufferLength; wlength += sizeof(proxySyntaxStringLen); if(rsSrvrStmt->SpjProxySyntaxString != NULL) proxySyntaxStringLen = strlen(rsSrvrStmt->SpjProxySyntaxString); else proxySyntaxStringLen = 0; if(proxySyntaxStringLen > 0) wlength += proxySyntaxStringLen + 1; // null terminated string rsSrvrStmt = rsSrvrStmt->nextSpjRs; } // end for } // if numResultSets > 0 wlength += sizeof (proxySyntaxStringLen); if((pSrvrStmt != NULL) && (pSrvrStmt->SpjProxySyntaxString != NULL)) proxySyntaxStringLen = strlen(pSrvrStmt->SpjProxySyntaxString); else proxySyntaxStringLen = 0; if(proxySyntaxStringLen > 0) wlength += proxySyntaxStringLen + 1; // null terminated string // // message_length = header + data length // message_length = wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) return CEE_ALLOCFAIL; curptr = (IDL_char*)(buffer + sizeof(HEADER)); // // copy of IDL_long returnCode // IDL_long_copy(&returnCode, curptr); // // copy IDL_long sqlWarningOrErrorLength // copy BYTE *sqlWarningOrError // IDL_long_copy(&sqlWarningOrErrorLength, curptr); if (sqlWarningOrError != NULL) { IDL_byteArray_copy(sqlWarningOrError, sqlWarningOrErrorLength, curptr); } // // copy of IDL_long outDescLength // copy of BYTE* outDesc // IDL_long_copy(&outputDescLength, curptr); if(outputDescLength > 0 && outputDesc != NULL) IDL_byteArray_copy(outputDesc, outputDescLength, curptr); // // copy of IDL_long rowsAffected // IDL_long_copy(&rowsAffected, curptr); // // copy of IDL_long sqlQueryType // IDL_long_copy(&sqlQueryType, curptr); // // copy of IDL_long queryType // IDL_long_copy(&estimatedCost, curptr); // // copy IDL_long outValuesLength // copy BYTE *outValues // IDL_long_copy(&outValuesLength, curptr); if (outValues != NULL) IDL_byteArray_copy(outValues, outValuesLength, curptr); // // copy of IDL_long numResultSets // IDL_long_copy(&numResultSets, curptr); if(numResultSets > 0) { // // copy result set information // rsSrvrStmt = pSrvrStmt->nextSpjRs; for (int i = 0; i < numResultSets; i++) { rsStmtHandle = (Long)rsSrvrStmt; rsStmtLabelLength = (IDL_long)rsSrvrStmt->stmtNameLen + 1; // add 1 for null rsStmtName = (IDL_char *)rsSrvrStmt->stmtName; rsOutputDescBufferLength = rsSrvrStmt->outputDescBufferLength; rsOutputDescBuffer = rsSrvrStmt->outputDescBuffer; IDL_long_copy(&stmtHandleKey, curptr); IDL_long_copy(&rsStmtLabelLength, curptr); memcpy(curptr, rsStmtName, rsStmtLabelLength - 1); // subtract 1 for the null curptr = curptr + (rsStmtLabelLength - 1); *curptr = '\0'; curptr = curptr + 1; IDL_long_copy(&charSet, curptr); IDL_long_copy(&rsOutputDescBufferLength, curptr); memcpy(curptr, rsOutputDescBuffer, rsOutputDescBufferLength); curptr = curptr + rsOutputDescBufferLength; if(rsSrvrStmt->SpjProxySyntaxString != NULL) proxySyntaxStringLen = strlen(rsSrvrStmt->SpjProxySyntaxString); else proxySyntaxStringLen = 0; if(proxySyntaxStringLen > 0) { proxySyntaxStringLen = proxySyntaxStringLen + 1; // null terminated IDL_long_copy(&proxySyntaxStringLen, curptr); IDL_charArray_copy((const IDL_char *)rsSrvrStmt->SpjProxySyntaxString, curptr); } else IDL_long_copy(&proxySyntaxStringLen, curptr); rsSrvrStmt = rsSrvrStmt->nextSpjRs; } // end for } // if numResultSets > 0 if((pSrvrStmt != NULL) && (pSrvrStmt->SpjProxySyntaxString != NULL)) proxySyntaxStringLen = strlen(pSrvrStmt->SpjProxySyntaxString); else proxySyntaxStringLen = 0; if(proxySyntaxStringLen > 0) { proxySyntaxStringLen = proxySyntaxStringLen + 1; // null terminated IDL_long_copy(&proxySyntaxStringLen, curptr); IDL_charArray_copy((const IDL_char *)pSrvrStmt->SpjProxySyntaxString, curptr); } else IDL_long_copy(&proxySyntaxStringLen, curptr); if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "odbc_SQLSrvr_Execute_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } SRVRTRACE_EXIT(FILE_OMR+15); return CEE_SUCCESS; } // end odbc_SQLSrvr_Execute_param_res_() CEE_status odbc_SQLSrvr_SetConnectionOption_param_res_( CInterface* pnode , IDL_char*& buffer , IDL_unsigned_long& message_length , /* In */ const struct odbc_SQLSvc_SetConnectionOption_exc_ *exception_ , /* In */ ERROR_DESC_LIST_def *sqlWarning ) { SRVRTRACE_ENTER(FILE_OMR+3); IDL_char* curptr; IDL_long wlength; IDL_long exceptionLength; wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_SetConnectionOption_exc_ *exception_ // wlength += sizeof(exception_->exception_nr); wlength += sizeof(exception_->exception_detail); switch(exception_->exception_nr) { case odbc_SQLSvc_SetConnectionOption_ParamError_exn_: wlength += sizeof(exceptionLength); if (exception_->u.ParamError.ParamDesc != NULL) { exceptionLength = strlen(exception_->u.ParamError.ParamDesc) + 1; wlength += exceptionLength; } else { exceptionLength = 0; } break; case odbc_SQLSvc_SetConnectionOption_SQLError_exn_: ERROR_DESC_LIST_length( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, wlength); break; case odbc_SQLSvc_SetConnectionOption_InvalidConnection_exn_: case odbc_SQLSvc_SetConnectionOption_SQLInvalidHandle_exn_: break; default: break; } // // length of ERROR_DESC_LIST_def *sqlWarning // // ERROR_DESC_LIST_LENGTH2(sqlWarning) // // message_length = header + data length // message_length = wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) return CEE_ALLOCFAIL; curptr = (IDL_char*)(buffer + sizeof(HEADER)); // // copy odbc_SQLSvc_SetConnectionOption_exc_ *exception_ // IDL_long_copy((IDL_long *)&exception_->exception_nr, curptr); IDL_long_copy((IDL_long *)&exception_->exception_detail, curptr); switch(exception_->exception_nr) { case odbc_SQLSvc_SetConnectionOption_ParamError_exn_: IDL_long_copy(&exceptionLength, curptr); if (exception_->u.ParamError.ParamDesc != NULL) IDL_charArray_copy((const IDL_char *)exception_->u.ParamError.ParamDesc, curptr); break; case odbc_SQLSvc_SetConnectionOption_SQLError_exn_: ERROR_DESC_LIST_copy( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, curptr); break; case odbc_SQLSvc_SetConnectionOption_InvalidConnection_exn_: case odbc_SQLSvc_SetConnectionOption_SQLInvalidHandle_exn_: break; default: break; } // // copy ERROR_DESC_LIST_def *sqlWarning // ERROR_DESC_LIST_COPY2(sqlWarning, curptr); if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSrvr_SetConnectionOption_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } SRVRTRACE_EXIT(FILE_OMR+3); return CEE_SUCCESS; } // odbc_SQLSrvr_SetConnectionOption_param_res_() CEE_status odbc_SQLSrvr_GetSQLCatalogs_param_res_( CInterface* pnode , IDL_char*& buffer , IDL_unsigned_long& message_length , /* In */ const struct odbc_SQLSvc_GetSQLCatalogs_exc_ *exception_ , /* In */ const IDL_char *catStmtLabel , /* In */ SQLItemDescList_def *outputDesc , /* In */ ERROR_DESC_LIST_def *sqlWarning , /* In */ SRVR_STMT_HDL *pSrvrStmt ) { SRVRTRACE_ENTER(FILE_OMR+14); IDL_char* curptr; IDL_long wlength; IDL_long exceptionLength = 0; IDL_long catStmtLabelLength = 0; IDL_long proxySyntaxStringLen = 0; wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_GetSQLCatalogs_exc_ *exception_ // wlength += sizeof(exception_->exception_nr); wlength += sizeof(exception_->exception_detail); switch(exception_->exception_nr) { case odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_: wlength += sizeof(exceptionLength); if (exception_->u.ParamError.ParamDesc != NULL) { exceptionLength = strlen(exception_->u.ParamError.ParamDesc) + 1; wlength += exceptionLength; } break; case odbc_SQLSvc_GetSQLCatalogs_SQLError_exn_: ERROR_DESC_LIST_length( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, wlength); break; case odbc_SQLSvc_GetSQLCatalogs_InvalidConnection_exn_: case odbc_SQLSvc_GetSQLCatalogs_SQLInvalidHandle_exn_: break; default: break; } // // length of IDL_char *catStmtLabel // wlength += sizeof(catStmtLabelLength); if (catStmtLabel != NULL) { catStmtLabelLength = strlen(catStmtLabel)+1; wlength += catStmtLabelLength; } // // length of SQLItemDescList_def *outputDesc // SQLITEMDESC_LIST_length( outputDesc, wlength); // // length of ERROR_DESC_LIST_def *sqlWarning // // ERROR_DESC_LIST_LENGTH2(sqlWarning) // // // wlength += sizeof (proxySyntaxStringLen); if((pSrvrStmt != NULL) && (pSrvrStmt->SpjProxySyntaxString != NULL)) proxySyntaxStringLen = strlen(pSrvrStmt->SpjProxySyntaxString); else proxySyntaxStringLen = 0; if(proxySyntaxStringLen > 0) wlength += proxySyntaxStringLen + 1; // null terminated string // // message_length = header + data length // message_length = wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) return CEE_ALLOCFAIL; curptr = (IDL_char*)(buffer + sizeof(HEADER)); // // copy odbc_SQLSvc_GetSQLCatalogs_exc_ *exception_ // IDL_long_copy((IDL_long *)&exception_->exception_nr, curptr); IDL_long_copy((IDL_long *)&exception_->exception_detail, curptr); switch(exception_->exception_nr) { case odbc_SQLSvc_GetSQLCatalogs_ParamError_exn_: IDL_long_copy(&exceptionLength, curptr); if (exception_->u.ParamError.ParamDesc != NULL) IDL_charArray_copy((const IDL_char *)exception_->u.ParamError.ParamDesc, curptr); break; case odbc_SQLSvc_GetSQLCatalogs_SQLError_exn_: ERROR_DESC_LIST_copy( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, curptr); break; case odbc_SQLSvc_GetSQLCatalogs_InvalidConnection_exn_: case odbc_SQLSvc_GetSQLCatalogs_SQLInvalidHandle_exn_: break; default: break; } // // copy IDL_char *catStmtLabel // IDL_long_copy(&catStmtLabelLength, curptr); if (catStmtLabel != NULL) IDL_charArray_copy(catStmtLabel, curptr); // // copy of SQLItemDescList_def *outputDesc // SQLITEMDESC_LIST_copy(outputDesc, curptr); // // copy ERROR_DESC_LIST_def *sqlWarning // ERROR_DESC_LIST_COPY2(sqlWarning, curptr); // // copy the proxy Syntax // if((pSrvrStmt != NULL) && (pSrvrStmt->SpjProxySyntaxString != NULL)) proxySyntaxStringLen = strlen(pSrvrStmt->SpjProxySyntaxString); else proxySyntaxStringLen = 0; if(proxySyntaxStringLen > 0) { proxySyntaxStringLen = proxySyntaxStringLen + 1; // null terminated IDL_long_copy(&proxySyntaxStringLen, curptr); IDL_charArray_copy((const IDL_char *)pSrvrStmt->SpjProxySyntaxString, curptr); } else IDL_long_copy(&proxySyntaxStringLen, curptr); if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_GetSQLCatalogs_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } SRVRTRACE_EXIT(FILE_OMR+14); return CEE_SUCCESS; } // odbc_SQLSrvr_GetSQLCatalogs_param_res_() CEE_status odbc_SQLSrvr_EndTransaction_param_res_( CInterface* pnode , IDL_char*& buffer , IDL_unsigned_long& message_length , /* In */ const struct odbc_SQLSvc_EndTransaction_exc_ *exception_ , /* In */ ERROR_DESC_LIST_def *sqlWarning ) { SRVRTRACE_ENTER(FILE_OMR+13); IDL_char* curptr; IDL_long wlength; IDL_long exceptionLength = 0; wlength = sizeof(HEADER); // // calculate length of the buffer for each parameter // // // length of odbc_SQLSvc_EndTransaction_exc_ *exception_ // wlength += sizeof(exception_->exception_nr); wlength += sizeof(exception_->exception_detail); switch(exception_->exception_nr) { case odbc_SQLSvc_EndTransaction_ParamError_exn_: wlength += sizeof(exceptionLength); if (exception_->u.ParamError.ParamDesc != NULL) { exceptionLength = strlen(exception_->u.ParamError.ParamDesc) + 1; wlength += exceptionLength; } break; case odbc_SQLSvc_EndTransaction_SQLError_exn_: ERROR_DESC_LIST_length( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, wlength); break; case odbc_SQLSvc_GetSQLCatalogs_InvalidConnection_exn_: case odbc_SQLSvc_GetSQLCatalogs_SQLInvalidHandle_exn_: break; default: break; } // // length of ERROR_DESC_LIST_def *sqlWarning // // ERROR_DESC_LIST_LENGTH2(sqlWarning) // // message_length = header + data length // message_length = wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) return CEE_ALLOCFAIL; curptr = (IDL_char*)(buffer + sizeof(HEADER)); // // copy odbc_SQLSvc_GetSQLCatalogs_exc_ *exception_ // IDL_long_copy((IDL_long *)&exception_->exception_nr, curptr); IDL_long_copy((IDL_long *)&exception_->exception_detail, curptr); switch(exception_->exception_nr) { case odbc_SQLSvc_EndTransaction_ParamError_exn_: IDL_long_copy(&exceptionLength, curptr); if (exception_->u.ParamError.ParamDesc != NULL) IDL_charArray_copy((const IDL_char *)exception_->u.ParamError.ParamDesc, curptr); break; case odbc_SQLSvc_EndTransaction_SQLError_exn_: ERROR_DESC_LIST_copy( (ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, curptr); break; case odbc_SQLSvc_EndTransaction_InvalidConnection_exn_: case odbc_SQLSvc_EndTransaction_TransactionError_exn_: break; default: break; } // // copy ERROR_DESC_LIST_def *sqlWarning // ERROR_DESC_LIST_COPY2(sqlWarning, curptr); if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-odbc_SQLSvc_EndTransaction_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } } // odbc_SQLSrvr_EndTransaction_param_res_() CEE_status MxoSrvr_ValidateToken_param_res_( CInterface* pnode , char*& buffer , UInt32& message_length , /* In */ int outTokenLen , /* In */ unsigned char* outToken ) { SRVRTRACE_ENTER(FILE_OMR+21); long* parptr; long* mapptr; char* curptr; char* pbuffer; long wlength; long maplength; short number_of_param = 2; wlength = sizeof(HEADER); maplength = (number_of_param + 1) * sizeof(long); // // calculate length of the buffer for each parameter // // // length outTokenLen // wlength += sizeof(outTokenLen); // // length of outToken // if(outTokenLen > 0) { // BYTE_length(outTokenLen,outToken,wlength,maplength); wlength += outTokenLen; } // // message_length = header + param + maplength + data length // message_length = maplength + wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } pbuffer = buffer + sizeof(HEADER); parptr = (long*)pbuffer; mapptr = (long*)pbuffer + number_of_param; curptr = (char*)pbuffer + maplength; // // copy outTokenLen // IDL_long* par1ptr = (IDL_long* )curptr; IDL_long_copy(&outTokenLen, curptr); // // copy inToken // IDL_char* par2ptr = (IDL_char *)curptr; IDL_byteArray_copy(outToken,outTokenLen,curptr); if (curptr > buffer + message_length) { //LCOV_EXCL_START strcpy( errStrBuf2, "marshalingsrvr_srvr.cpp"); strcpy( errStrBuf3, "SRVR-MxoSrvr_ValidateToken_param_res_"); strcpy( errStrBuf4, "buffer overflow"); sprintf( errStrBuf5, "%d > %d", curptr - buffer, message_length); logError( PROGRAM_ERROR, SEVERITY_MAJOR, CAPTURE_ALL + PROCESS_STOP ); exit(1000); //LCOV_EXCL_STOP } // // set end of map list // *(mapptr) = 0; // // save relative positions of all parameters // *(parptr++) = (char *)par1ptr - pbuffer; *(parptr++) = (char *)par2ptr - pbuffer; SRVRTRACE_EXIT(FILE_OMR+21); return CEE_SUCCESS; } // MxoSrvr_ValidateToken_param_res_() CEE_status odbc_SQLsrvr_ExtractLob_param_res_( CInterface * pnode , char* &buffer , UInt32& message_length , const struct odbc_SQLsrvr_ExtractLob_exc_ *exception_ , IDL_long_long lobDataLen , IDL_char * lobDataValue ) { CEE_status sts = CEE_SUCCESS; IDL_long wlength = 0; char* curptr; IDL_long exceptionLength = 0; wlength += sizeof(HEADER); // calculate length of the buffer for each parameter // length of odbc_SQLsrvr_ExtractLob_exc_ wlength += sizeof(exception_->exception_nr); wlength += sizeof(exception_->exception_detail); switch(exception_->exception_nr) { case odbc_SQLsrvr_ExtractLob_ParamError_exn_: wlength += sizeof(exceptionLength); if (exception_->u.ParamError.ParamDesc != NULL) { exceptionLength = strlen(exception_->u.ParamError.ParamDesc) + 1; wlength += exceptionLength; } break; case odbc_SQLSrvr_ExtractLob_SQLError_exn_: ERROR_DESC_LIST_length((ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, wlength); break; case odbc_SQLsrvr_ExtractLob_InvalidConnection_exn_: case odbc_SQLSrvr_ExtractLob_SQLInvalidhandle_exn_: break; case obdc_SQLSrvr_ExtractLob_AllocLOBDataError_exn_: wlength += sizeof(exceptionLength); if (exception_->u.ParamError.ParamDesc != NULL) { exceptionLength = strlen(exception_->u.ParamError.ParamDesc) + 1; wlength += exceptionLength; } break; default: break; } // length of IDL_long LOB len wlength += sizeof(IDL_long); if (lobDataValue != NULL) { wlength += lobDataLen; } wlength += lobDataLen; // update the length of message message_length = wlength; buffer = pnode->w_allocate(message_length); if (buffer == NULL) { return CEE_ALLOCFAIL; } curptr = (IDL_char*)(buffer + sizeof(HEADER)); // copy odbc_SQLsrvr_ExtractLob_exc_ IDL_long_copy((IDL_long *)&exception_->exception_nr, curptr); IDL_long_copy((IDL_long *)&exception_->exception_detail, curptr); switch(exception_->exception_nr) { case odbc_SQLsrvr_ExtractLob_ParamError_exn_: case obdc_SQLSrvr_ExtractLob_AllocLOBDataError_exn_: IDL_long_copy(&exceptionLength, curptr); if (exception_->u.ParamError.ParamDesc != NULL) IDL_charArray_copy((const IDL_char *)exception_->u.ParamError.ParamDesc, curptr); break; case odbc_SQLSrvr_ExtractLob_SQLError_exn_: ERROR_DESC_LIST_copy((ERROR_DESC_LIST_def *)&exception_->u.SQLError.errorList, curptr); break; case odbc_SQLsrvr_ExtractLob_InvalidConnection_exn_: case odbc_SQLSrvr_ExtractLob_SQLInvalidhandle_exn_: break; default: break; } IDL_long_copy((IDL_long *)&lobDataLen, curptr); if (lobDataValue != NULL) { IDL_charArray_copy(lobDataValue, curptr); } return sts; }
25.476923
139
0.72955
anoopsharma00
5275bbb9ef33075c9eb3fb3840a8561190136fd6
486
hpp
C++
.experimentals/include/amtrs/ads/def.hpp
isaponsoft/libamtrs
5adf821ee15592fc3280985658ca8a4b175ffcaa
[ "BSD-2-Clause-FreeBSD" ]
1
2019-12-10T02:12:49.000Z
2019-12-10T02:12:49.000Z
.experimentals/include/amtrs/ads/def.hpp
isaponsoft/libamtrs
5adf821ee15592fc3280985658ca8a4b175ffcaa
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
.experimentals/include/amtrs/ads/def.hpp
isaponsoft/libamtrs
5adf821ee15592fc3280985658ca8a4b175ffcaa
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
/* Copyright (c) 2019, isaponsoft (Isao Shibuya) All rights reserved. * * Use of this source code is governed by a BSD-style license that * * can be found in the LICENSE file. */ #ifndef __libamtrs__ads__def__hpp #define __libamtrs__ads__def__hpp #include "../amtrs.hpp" AMTRS_NAMESPACE_BEGIN AMTRS_NAMESPACE_END #define AMTRS_ADS_NAMESPACE_BEGIN AMTRS_NAMESPACE_BEGIN namespace ads { #define AMTRS_ADS_NAMESPACE_END } AMTRS_NAMESPACE_END #endif
40.5
72
0.746914
isaponsoft
5278d45c9ec457ca7bb2f5c797ad4bca1e02ebc1
20
cpp
C++
Ursa/src/ursapch.cpp
quiniks/Ursa
4f6c7c153d9d4c2ccb4c42f06d2fa88910d15c8c
[ "Apache-2.0" ]
null
null
null
Ursa/src/ursapch.cpp
quiniks/Ursa
4f6c7c153d9d4c2ccb4c42f06d2fa88910d15c8c
[ "Apache-2.0" ]
null
null
null
Ursa/src/ursapch.cpp
quiniks/Ursa
4f6c7c153d9d4c2ccb4c42f06d2fa88910d15c8c
[ "Apache-2.0" ]
null
null
null
#include "ursapch.h"
20
20
0.75
quiniks
527972021bb18776906f67d173344252477b4297
6,851
cc
C++
pagespeed/rules/combine_external_resources.cc
gtmetrix/pagespeed-library
4aac4ab995bc99c6a40f0c820cfefc88db6fcf33
[ "Apache-2.0" ]
11
2016-08-23T12:31:32.000Z
2021-05-12T09:47:01.000Z
pagespeed/rules/combine_external_resources.cc
gtmetrix/page-speed-library
4aac4ab995bc99c6a40f0c820cfefc88db6fcf33
[ "Apache-2.0" ]
null
null
null
pagespeed/rules/combine_external_resources.cc
gtmetrix/page-speed-library
4aac4ab995bc99c6a40f0c820cfefc88db6fcf33
[ "Apache-2.0" ]
1
2019-03-13T00:51:45.000Z
2019-03-13T00:51:45.000Z
// Copyright 2009 Google Inc. 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 "pagespeed/rules/combine_external_resources.h" #include <string> #include "base/logging.h" #include "googleurl/src/gurl.h" #include "pagespeed/core/formatter.h" #include "pagespeed/core/pagespeed_input.h" #include "pagespeed/core/resource.h" #include "pagespeed/core/result_provider.h" #include "pagespeed/core/rule_input.h" #include "pagespeed/l10n/l10n.h" #include "pagespeed/proto/pagespeed_output.pb.h" namespace { // Allow 2 or fewer resources. Many sites have a site-wide CSS/JS file // as well as a per-page CSS/JS file. Thus we allow 2 resources per // hostname without showing a warning. const size_t kMaxResourcesPerDomain = 2; } // namespace namespace pagespeed { namespace rules { CombineExternalResources::CombineExternalResources(ResourceType resource_type) : pagespeed::Rule(pagespeed::InputCapabilities( pagespeed::InputCapabilities::ONLOAD | pagespeed::InputCapabilities::REQUEST_START_TIMES)), resource_type_(resource_type) { } bool CombineExternalResources::AppendResults(const RuleInput& rule_input, ResultProvider* provider) { const PagespeedInput& input = rule_input.pagespeed_input(); const HostResourceMap& host_resource_map = *input.GetHostResourceMap(); for (HostResourceMap::const_iterator iter = host_resource_map.begin(), end = host_resource_map.end(); iter != end; ++iter) { ResourceSet violations; for (ResourceSet::const_iterator resource_iter = iter->second.begin(), resource_end = iter->second.end(); resource_iter != resource_end; ++resource_iter) { const pagespeed::Resource* resource = *resource_iter; // exclude non-http resources std::string protocol = resource->GetProtocol(); if (protocol != "http" && protocol != "https") { continue; } if (resource->GetResourceType() != resource_type_) { continue; } // exclude post-onload resources if (input.IsResourceLoadedAfterOnload(*resource)) { continue; } const std::string& host = iter->first; if (host.empty()) { LOG(DFATAL) << "Empty host while processing " << resource->GetRequestUrl(); } violations.insert(resource); } if (violations.size() > kMaxResourcesPerDomain) { Result* result = provider->NewResult(); int requests_saved = violations.size() - kMaxResourcesPerDomain; for (ResourceSet::const_iterator violation_iter = violations.begin(), violation_end = violations.end(); violation_iter != violation_end; ++violation_iter) { result->add_resource_urls((*violation_iter)->GetRequestUrl()); } pagespeed::Savings* savings = result->mutable_savings(); savings->set_requests_saved(requests_saved); } } return true; } void CombineExternalResources::FormatResults(const ResultVector& results, RuleFormatter* formatter) { if (results.empty()) { return; } UserFacingString body_tmpl; if (resource_type_ == CSS) { // TRANSLATOR: Descriptive header describing a list of CSS resources that // are all served from a single domain (in violation of the // CombineExternalResources rule). It says how many resources were loaded // from that domain, gives the domain name itself, and is followed by a list // of the URLs of those resources. It then tells the webmaster how to solve // the problem, by combining the resources into fewer files. body_tmpl = _("There are %(NUM_FILES)s CSS files served from " "%(DOMAIN_NAME)s. They should be combined into as few files " "as possible."); } else if (resource_type_ == JS) { // TRANSLATOR: Descriptive header describing a list of JavaScript resources // that are all served from a single domain (in violation of the // CombineExternalResources rule). It says how many resources were loaded // from that domain, gives the domain name itself, and is followed by a list // of the URLs of those resources. It then tells the webmaster how to solve // the problem, by combining the resources into fewer files. body_tmpl = _("There are %(NUM_FILES)s JavaScript files served from " "%(DOMAIN_NAME)s. They should be combined into as few files " "as possible."); } else { LOG(DFATAL) << "Unknown violation type " << resource_type_; return; } for (ResultVector::const_iterator iter = results.begin(), end = results.end(); iter != end; ++iter) { const Result& result = **iter; GURL url(result.resource_urls(0)); UrlBlockFormatter* body = formatter->AddUrlBlock( body_tmpl, IntArgument("NUM_FILES", result.resource_urls_size()), StringArgument("DOMAIN_NAME", url.host())); for (int idx = 0; idx < result.resource_urls_size(); idx++) { body->AddUrl(result.resource_urls(idx)); } } } CombineExternalJavaScript::CombineExternalJavaScript() : CombineExternalResources(JS) { } const char* CombineExternalJavaScript::name() const { return "CombineExternalJavaScript"; } UserFacingString CombineExternalJavaScript::header() const { // TRANSLATOR: The name of a Page Speed rule that tells webmasters to combine // external JavaScript resources that are loaded from the same domain. This // appears in a list of rule names generated by Page Speed, telling webmasters // which rules they broke in their website. return _("Combine external JavaScript"); } CombineExternalCss::CombineExternalCss() : CombineExternalResources(CSS) { } const char* CombineExternalCss::name() const { return "CombineExternalCss"; } UserFacingString CombineExternalCss::header() const { // TRANSLATOR: The name of a Page Speed rule that tells webmasters to combine // external CSS resources that are loaded from the same domain. This // appears in a list of rule names generated by Page Speed, telling webmasters // which rules they broke in their website. return _("Combine external CSS"); } } // namespace rules } // namespace pagespeed
35.86911
80
0.687491
gtmetrix
5279fd930680f6b1642fd5eb1943d8bae0d1492a
2,350
cpp
C++
src/zk/connection_tests.cpp
vexingcodes/zookeeper-cpp
9dce1fce5370ecfdad713caf411a5ae9b851db33
[ "Apache-2.0" ]
126
2017-08-09T22:26:09.000Z
2022-01-21T22:39:46.000Z
src/zk/connection_tests.cpp
vexingcodes/zookeeper-cpp
9dce1fce5370ecfdad713caf411a5ae9b851db33
[ "Apache-2.0" ]
97
2017-08-09T23:08:41.000Z
2022-03-29T21:54:24.000Z
src/zk/connection_tests.cpp
vexingcodes/zookeeper-cpp
9dce1fce5370ecfdad713caf411a5ae9b851db33
[ "Apache-2.0" ]
38
2017-08-11T00:33:17.000Z
2021-05-13T09:19:27.000Z
#include <zk/tests/test.hpp> #include "connection.hpp" namespace zk { // This test is mostly to check that we still use the defaults. GTEST_TEST(connection_params_tests, defaults) { const auto res = connection_params::parse("zk://localhost/"); CHECK_EQ("zk", res.connection_schema()); CHECK_EQ(1U, res.hosts().size()); CHECK_EQ("localhost", res.hosts()[0]); CHECK_EQ("/", res.chroot()); CHECK_TRUE(res.randomize_hosts()); CHECK_FALSE(res.read_only()); CHECK_TRUE(connection_params::default_timeout == res.timeout()); connection_params manual; manual.hosts() = { "localhost" }; CHECK_EQ(manual, res); } GTEST_TEST(connection_params_tests, multi_hosts) { const auto res = connection_params::parse("zk://server-a,server-b,server-c/"); connection_params manual; manual.hosts() = { "server-a", "server-b", "server-c" }; CHECK_EQ(manual, res); } GTEST_TEST(connection_params_tests, chroot) { const auto res = connection_params::parse("zk://localhost/some/sub/path"); connection_params manual; manual.hosts() = { "localhost" }; manual.chroot() = "/some/sub/path"; CHECK_EQ(manual, res); } GTEST_TEST(connection_params_tests, randomize_hosts) { const auto res = connection_params::parse("zk://localhost/?randomize_hosts=false"); connection_params manual; manual.hosts() = { "localhost" }; manual.randomize_hosts() = false; CHECK_EQ(manual, res); } GTEST_TEST(connection_params_tests, read_only) { const auto res = connection_params::parse("zk://localhost/?read_only=true"); connection_params manual; manual.hosts() = { "localhost" }; manual.read_only() = true; CHECK_EQ(manual, res); } GTEST_TEST(connection_params_tests, randomize_and_read_only) { const auto res = connection_params::parse("zk://localhost/?randomize_hosts=false&read_only=1"); connection_params manual; manual.hosts() = { "localhost" }; manual.randomize_hosts() = false; manual.read_only() = true; CHECK_EQ(manual, res); } GTEST_TEST(connection_params_tests, timeout) { const auto res = connection_params::parse("zk://localhost/?timeout=0.5"); connection_params manual; manual.hosts() = { "localhost" }; manual.timeout() = std::chrono::milliseconds(500); CHECK_EQ(manual, res); } }
29.375
99
0.680851
vexingcodes
527a4107bc4e574ccc3c8ac5610b866f797ccd82
6,209
hpp
C++
include/instr/instruction_set.hpp
jaller200/comp4300-project3
f2106f6acaf44a84b3cb305b7c8f345bf037efae
[ "BSL-1.0" ]
null
null
null
include/instr/instruction_set.hpp
jaller200/comp4300-project3
f2106f6acaf44a84b3cb305b7c8f345bf037efae
[ "BSL-1.0" ]
null
null
null
include/instr/instruction_set.hpp
jaller200/comp4300-project3
f2106f6acaf44a84b3cb305b7c8f345bf037efae
[ "BSL-1.0" ]
null
null
null
#pragma once #include "instr/instruction_handler.hpp" #include "instr/instruction_metadata.hpp" #include "instr/instruction_parser.hpp" #include "instr/instruction_type.hpp" #include "pipeline/execution_buffer.hpp" #include "pipeline/instruction_decode_buffer.hpp" #include "pipeline/instruction_fetch_buffer.hpp" #include "pipeline/memory_buffer.hpp" #include "types.hpp" #include <array> #include <memory> #include <string> #include <unordered_map> /** * A basic class that holds an instruction set. * * Instructions will be registered by Opcode & Function (if defined) as a key: * * Opcode : 6 bits * Function : 6 bits * * Registration will be done with 16 bits, where the first 6 bits are the opcode * and the second 6 bits are the function (if necessary). This way I-Type (opcode 0) * instructions can be stored just as easily as R-Type and branch. */ class InstructionSet { public: // MARK: -- Public Types /** Instruction Opcode/Funct Keys (lower 8 bits = opcode, upper 8 bits = funct) */ using instr_id_t = hword_t; // MARK: -- Construction InstructionSet(); ~InstructionSet() = default; // MARK: -- Getter Methods /** * Returns an instruction handler for the opcode/funct pair. * @param opcode The opcode * @param funct The function * @return A raw pointer to the instruction handler, or nullptr if not found */ InstructionHandler * getInstructionHandler(word_t opcode, word_t funct) const; /** * Returns an instruction parser for the name. Trims and converts the * name to lower case. * @param name The name * @return A raw pointer to the instruction parser, or nullptr if not found */ InstructionParser * getInstructionParser(const std::string& name) const; // MARK: -- Registration Methods /** * Registers an I-Type instruction with the instruction set. * If the opcode is registered to another type, this will fail. * * In addition, the name will automatically be converted to lower case. * If there is a duplicate name found, or the name contains whitespace, this * returns false. * * @param name The name * @param opcode The opcode * @param parser The parser for the instruction * @param handler The handler for the instruction * @return Whether or not the registration succeeded */ bool registerIType(const std::string& name, word_t opcode, std::unique_ptr<InstructionParser> parser, std::unique_ptr<InstructionHandler> handler); /** * Registers a J-Type instruction with the instruction set. * If the opcode is registered to another type, this will fail. * * In addition, the name will automatically be converted to lower case. * If there is a duplicate name found, or if the name contains any * whitespace, this returns false. * * @param name The name * @param opcode The opcode * @param parser The parser for the instruction * @param handler The handler for the instruction * @return Whether or not the registration succeeded */ bool registerJType(const std::string& name, word_t opcode, std::unique_ptr<InstructionParser> parser, std::unique_ptr<InstructionHandler> handler); /** * Registers an R-Type instruction with the instruction set. * * If the opcode is registered as R-type, and there is a duplicate funct, * or if the opcode is registered as another type, this returns false. * * In addition, the name is automatically converted to lower case. If there * is a duplicate name found, or the name contains whitespace, the function * returns false. * * @param name The name * @param opcode The opcode * @param funct The function * @param parser The parser for the instruction * @param handler The handler for the instruction * @return Whether or not the registration succeeded */ bool registerRType(const std::string& name, word_t opcode, word_t funct, std::unique_ptr<InstructionParser> parser, std::unique_ptr<InstructionHandler> handler); // MARK: -- Psuedo Registration Methods /** * Registers a psuedo instruction type (no opcode / name) * @param name The name * @param parser The parser * @return Whether or not the registration succeeded */ bool registerPsuedoType(const std::string& name, std::unique_ptr<InstructionParser> parser); // MARK: -- Getter Methods /** * Returns the instruction type for an opcode * @param opcode The opcode * @return The instruction type, or UNKNOWN */ InstructionType getType(word_t opcode) const; /** * Returns the instruction type for an instruction name. Converts the * name to lower case first. * @param name The name * @return The instruction type, or UNKNOWN */ InstructionType getType(const std::string& name) const; private: // MARK: -- Private Variables; /** An array marking the registered type of the opcode. */ std::array<InstructionType, Instruction::LIMIT_OPCODE+1> m_arrOpcodeTypes; /** A map of instruction names to instruction metadata. */ std::unordered_map<std::string, std::shared_ptr<InstructionMetadata>> m_mapNameToMetadata; /** A map of instruction IDs (opcode/funct) to instruction metadata. */ std::unordered_map<instr_id_t, std::shared_ptr<InstructionMetadata>> m_mapIDToMetadata; // MARK: -- Private Methods /** * A private method to handle instruction registration. * @param name The name to register with * @param opcode The opcode to register with * @param funct The funct to register with * @param type The type to register with * @param parser The parser to register with * @param handler The handler to register with * @return True if successfully registered, false if the name, opcode, funct, or metadata are invalid or null */ bool registerInstruction(const std::string& name, word_t opcode, word_t funct, InstructionType type, std::unique_ptr<InstructionParser> parser, std::unique_ptr<InstructionHandler> handler); };
36.098837
193
0.692865
jaller200
527e58590ab1a684db26d01f832b8b83e76c5fa2
235
cpp
C++
Chapter12/Exercise75/Exercise75.cpp
Siddharth-Puhan/The-CPP-Workshop
220fbcf89d3d35b875ecadc885405984304ca9c6
[ "MIT" ]
86
2020-03-23T20:50:05.000Z
2022-02-19T21:41:38.000Z
Chapter12/Exercise75/Exercise75.cpp
Siddharth-Puhan/The-CPP-Workshop
220fbcf89d3d35b875ecadc885405984304ca9c6
[ "MIT" ]
7
2020-02-14T12:14:39.000Z
2021-12-27T09:15:01.000Z
Chapter12/Exercise75/Exercise75.cpp
Siddharth-Puhan/The-CPP-Workshop
220fbcf89d3d35b875ecadc885405984304ca9c6
[ "MIT" ]
66
2020-03-23T22:25:17.000Z
2022-02-01T09:01:41.000Z
#include <iostream> #include <vector> using namespace std; int main() { vector < int > vec = {1,2,3,4,5,6,7,8,9,10}; for (auto v: vec) { cout << v << " "; } cout << vec[3]; return 0; }
12.368421
48
0.451064
Siddharth-Puhan
52857fa785ac77257e1cf8cfef806c90310bbdee
826
cpp
C++
tools/multi/proj/provider/glue/_versionlist_.cpp
ionsphere/icu-cmake
ba3750c592a4f221da9bb80b9145d09f21279adc
[ "Apache-2.0" ]
null
null
null
tools/multi/proj/provider/glue/_versionlist_.cpp
ionsphere/icu-cmake
ba3750c592a4f221da9bb80b9145d09f21279adc
[ "Apache-2.0" ]
null
null
null
tools/multi/proj/provider/glue/_versionlist_.cpp
ionsphere/icu-cmake
ba3750c592a4f221da9bb80b9145d09f21279adc
[ "Apache-2.0" ]
null
null
null
// © 2017 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html /* ******************************************************************************* * * Copyright (C) 2009, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* */ #include <icuglue/icuglue.h> #include <unicode/coll.h> #if defined ( ICUGLUE_VER ) //#error DEFINED! #else #define GLUE_VER(x) puts("Version " # x ); #include <stdio.h> // generate list of versions #include <icuglue/fe_verlist.h> int main(int argc, const char *argv[]) { printf("I'm on " U_ICU_VERSION " but i have modules for: \n"); for(int i=0;fe_verlist[i];i++) { printf("%d: %s\n", i, fe_verlist[i]); } } #endif
21.179487
79
0.529056
ionsphere
528b90db80b723eace4d1fd5b780da15a9dc2686
2,748
cc
C++
Source/Content/Asset.cc
dkrutsko/OpenGL-Engine
2e61e6f9106a03915a21aba94c81af2360cc85bf
[ "Zlib" ]
3
2016-01-05T05:04:35.000Z
2020-01-08T22:17:14.000Z
Source/Content/Asset.cc
dkrutsko/OpenGL-Engine
2e61e6f9106a03915a21aba94c81af2360cc85bf
[ "Zlib" ]
null
null
null
Source/Content/Asset.cc
dkrutsko/OpenGL-Engine
2e61e6f9106a03915a21aba94c81af2360cc85bf
[ "Zlib" ]
null
null
null
//////////////////////////////////////////////////////////////////////////////// // -------------------------------------------------------------------------- // // // // (C) 2012-2013 David Krutsko // // See LICENSE.md for copyright // // // // -------------------------------------------------------------------------- // //////////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------// // Prefaces // //----------------------------------------------------------------------------// #include "Content/Asset.h" #include "Content/Content.h" #include "Engine/Console.h" //----------------------------------------------------------------------------// // Static Asset // //----------------------------------------------------------------------------// quint16 Asset::mAssetIDCounter = 0; //----------------------------------------------------------------------------// // Constructors Asset // //----------------------------------------------------------------------------// //////////////////////////////////////////////////////////////////////////////// /// <summary> </summary> Asset::Asset (quint16 assetID) { mReferences = 1; mAssetID = assetID; mManaged = false; } //////////////////////////////////////////////////////////////////////////////// /// <summary> </summary> Asset::Asset (const Asset& asset) { mReferences = 1; mManaged = false; mAssetID = asset.mAssetID; mSource = asset.mSource; } //----------------------------------------------------------------------------// // Methods Asset // //----------------------------------------------------------------------------// //////////////////////////////////////////////////////////////////////////////// /// <summary> </summary> void Asset::Retain (void) { ++mReferences; } //////////////////////////////////////////////////////////////////////////////// /// <summary> </summary> void Asset::Release (bool force) { // Check if the asset needs to be deleted if (force || mReferences == 1) { // Asset is managed by the content manager if (mManaged) Content::mLoaded.remove (mSource); // Delete asset delete this; } // Decrement references else --mReferences; }
32.329412
80
0.227074
dkrutsko
528c8eda9a2baae5e3b6c84e591d73d0e22ca41d
522
cc
C++
tests/unit/features/Alphabet_unittest.cc
ShankarNara/shogun
8ab196de16b8d8917e5c84770924c8d0f5a3d17c
[ "BSD-3-Clause" ]
2,753
2015-01-02T11:34:13.000Z
2022-03-25T07:04:27.000Z
tests/unit/features/Alphabet_unittest.cc
ShankarNara/shogun
8ab196de16b8d8917e5c84770924c8d0f5a3d17c
[ "BSD-3-Clause" ]
2,404
2015-01-02T19:31:41.000Z
2022-03-09T10:58:22.000Z
tests/unit/features/Alphabet_unittest.cc
ShankarNara/shogun
8ab196de16b8d8917e5c84770924c8d0f5a3d17c
[ "BSD-3-Clause" ]
1,156
2015-01-03T01:57:21.000Z
2022-03-26T01:06:28.000Z
/* * This software is distributed under BSD 3-clause license (see LICENSE file). * * Authors: Leon Kuchenbecker */ #include <shogun/features/Alphabet.h> #include <gtest/gtest.h> using namespace shogun; TEST(AlphabetTest, test_clone) { auto alph = std::make_shared<Alphabet>(PROTEIN); auto alph_clone = alph->clone()->as<Alphabet>(); EXPECT_EQ(alph->get_num_symbols(), alph_clone->get_num_symbols()); EXPECT_EQ(alph->get_num_symbols_in_histogram(), alph_clone->get_num_symbols_in_histogram()); }
22.695652
96
0.727969
ShankarNara
5290908f40b27ecb84dd434ea61817b34b578087
273
cpp
C++
Exercicios/Exercicios C - Uri #2/1070.cpp
yunger7/SENAI
85093e0ce3ed83e50dcd570d7c42b1dda4111929
[ "MIT" ]
1
2020-09-07T12:19:27.000Z
2020-09-07T12:19:27.000Z
Exercicios/Exercicios C - Uri #2/1070.cpp
yunger7/SENAI
85093e0ce3ed83e50dcd570d7c42b1dda4111929
[ "MIT" ]
null
null
null
Exercicios/Exercicios C - Uri #2/1070.cpp
yunger7/SENAI
85093e0ce3ed83e50dcd570d7c42b1dda4111929
[ "MIT" ]
null
null
null
#include <iostream> using namespace std; int main() { int x=0; scanf("%d",&x); if (x % 2 == 0){ x++; for (int c = 1; c <= 6; c++){ printf("%d\n",x); x += 2; } } else { for (int c = 1; c <= 6; c++){ printf("%d\n",x); x += 2; } } return 0; }
10.92
31
0.410256
yunger7
529463afc42721f02412b3dc30c8bd6aab15e562
1,858
cpp
C++
tests/day4.cpp
maxnoe/adventofcode2020
eb2a3ea03af02bf951f145f214da6a9221d8fe4f
[ "MIT" ]
null
null
null
tests/day4.cpp
maxnoe/adventofcode2020
eb2a3ea03af02bf951f145f214da6a9221d8fe4f
[ "MIT" ]
null
null
null
tests/day4.cpp
maxnoe/adventofcode2020
eb2a3ea03af02bf951f145f214da6a9221d8fe4f
[ "MIT" ]
null
null
null
#include "gtest/gtest.h" #include <iostream> #include <aocmaxnoe2020/aocmaxnoe2020.h> #include <aocmaxnoe2020/day4.h> using namespace aocmaxnoe2020; const std::string test_input = R"(ecl:gry pid:860033327 eyr:2020 hcl:#fffffd byr:1937 iyr:2017 cid:147 hgt:183cm iyr:2013 ecl:amb cid:350 eyr:2023 pid:028048884 hcl:#cfa07d byr:1929 hcl:#ae17e1 iyr:2013 eyr:2024 ecl:brn pid:760753108 byr:1931 hgt:179cm hcl:#cfa07d eyr:2025 pid:166559648 iyr:2011 ecl:brn hgt:59in )"; const std::string invalid = R"(eyr:1972 cid:100 hcl:#18171d ecl:amb hgt:170 pid:186cm iyr:2018 byr:1926 iyr:2019 hcl:#602927 eyr:1967 hgt:170cm ecl:grn pid:012533040 byr:1946 hcl:dab227 iyr:2012 ecl:brn hgt:182cm pid:021572410 eyr:2020 byr:1992 cid:277 hgt:59cm ecl:zzz eyr:2038 hcl:74454a iyr:2023 pid:3556412378 byr:2007 )"; const std::string valid = R"(pid:087499704 hgt:74in ecl:grn iyr:2012 eyr:2030 byr:1980 hcl:#623a2f eyr:2029 ecl:blu cid:129 byr:1989 iyr:2014 pid:896056539 hcl:#a97842 hgt:165cm hcl:#888785 hgt:164cm byr:2001 iyr:2015 cid:88 pid:545766238 ecl:hzl eyr:2022 iyr:2010 hgt:158cm hcl:#b6652a ecl:blu byr:1944 eyr:2021 pid:093154719 )"; TEST(TestDay4, TestParse) { day4::passports_t passports = day4::parse_input(test_input); ASSERT_EQ(4, passports.size()); ASSERT_EQ(8, passports.at(0).size()); ASSERT_EQ(7, passports.at(1).size()); ASSERT_EQ(7, passports.at(2).size()); ASSERT_EQ(6, passports.at(3).size()); } TEST(TestDay4, TestPart1) { day4::passports_t passports = day4::parse_input(test_input); ASSERT_EQ(2, day4::part1(passports)); } TEST(TestDay4, TestPart2Invalid) { day4::passports_t passports = day4::parse_input(invalid); ASSERT_EQ(0, day4::part2(passports)); } TEST(TestDay4, TestPart2Valid) { day4::passports_t passports = day4::parse_input(valid); ASSERT_EQ(4, day4::part2(passports)); }
24.12987
86
0.734661
maxnoe
5294ef657a32df492045f5182085c81e25a847dd
1,353
cpp
C++
src/msg.cpp
innogames/testtool
dfbb193ff5f1815cb1a0055cea2cd89779fc5888
[ "MIT" ]
6
2019-03-08T14:44:49.000Z
2022-03-21T11:29:05.000Z
src/msg.cpp
innogames/testtool
dfbb193ff5f1815cb1a0055cea2cd89779fc5888
[ "MIT" ]
2
2020-04-28T12:33:25.000Z
2021-03-19T08:21:45.000Z
src/msg.cpp
innogames/testtool
dfbb193ff5f1815cb1a0055cea2cd89779fc5888
[ "MIT" ]
null
null
null
// // Testtool - Logging Routines // // Copyright (c) 2018 InnoGames GmbH // #define FMT_HEADER_ONLY #include <fmt/format.h> #include <fmt/printf.h> #include <iostream> #include <string> #include <syslog.h> #include "lb_pool.h" #include "msg.h" using namespace std; void start_logging() { openlog("testtool", LOG_PID, LOG_LOCAL3); } void log(MessageType loglevel, string msg) { cout << msg << endl; int sysloglevel; switch (loglevel) { case MessageType::MSG_INFO: sysloglevel = LOG_INFO; break; case MessageType::MSG_CRIT: sysloglevel = LOG_CRIT; break; case MessageType::MSG_DEBUG: sysloglevel = LOG_DEBUG; break; case MessageType::MSG_STATE_UP: sysloglevel = LOG_INFO; break; case MessageType::MSG_STATE_DOWN: sysloglevel = LOG_INFO; break; } syslog(sysloglevel | LOG_LOCAL3, "%s", msg.c_str()); } void log(MessageType loglevel, LbPool *lbpool, string msg) { string out = "lbpool: " + lbpool->name + " " + msg; log(loglevel, out); } void log(MessageType loglevel, LbNode *lbnode, string msg) { string out = "lbnode: " + lbnode->name + " " + msg; log(loglevel, lbnode->parent_lbpool, out); } void log(MessageType loglevel, Healthcheck *hc, string msg) { string out = "healthcheck: " + hc->type + " " + hc->log_prefix + " " + msg; log(loglevel, hc->parent_lbnode, out); }
22.932203
77
0.673319
innogames
5296ed2cfbde46acd712199ec461423609efeea8
4,846
cc
C++
CondTools/DT/src/DTKeyedConfigCache.cc
jkiesele/cmssw
e626860d26692de5880c52c7c80aec7b859a0c60
[ "Apache-2.0" ]
1
2021-04-13T13:26:16.000Z
2021-04-13T13:26:16.000Z
CondTools/DT/src/DTKeyedConfigCache.cc
jkiesele/cmssw
e626860d26692de5880c52c7c80aec7b859a0c60
[ "Apache-2.0" ]
null
null
null
CondTools/DT/src/DTKeyedConfigCache.cc
jkiesele/cmssw
e626860d26692de5880c52c7c80aec7b859a0c60
[ "Apache-2.0" ]
null
null
null
/* * See header file for a description of this class. * * This class was originally defined in * CondCore/DTPlugins/src/DTConfigPluginHandler.cc * It was moved, renamed, and modified to not be a singleton * for thread safety, but otherwise little was changed. * * \author Paolo Ronchese INFN Padova * */ //----------------------- // This Class' Header -- //----------------------- #include "CondTools/DT/interface/DTKeyedConfigCache.h" //------------------------------- // Collaborating Class Headers -- //------------------------------- #include "CondFormats/DTObjects/interface/DTKeyedConfig.h" #include "CondCore/CondDB/interface/KeyList.h" #include <memory> //------------------- // Initializations -- //------------------- const int DTKeyedConfigCache::maxBrickNumber = 5000; const int DTKeyedConfigCache::maxStringNumber = 100000; const int DTKeyedConfigCache::maxByteNumber = 10000000; //---------------- // Constructors -- //---------------- DTKeyedConfigCache::DTKeyedConfigCache() : cachedBrickNumber(0), cachedStringNumber(0), cachedByteNumber(0) {} //-------------- // Destructor -- //-------------- DTKeyedConfigCache::~DTKeyedConfigCache() { purge(); } int DTKeyedConfigCache::get(cond::persistency::KeyList& keyList, int cfgId, const DTKeyedConfig*& obj) { bool cacheFound = false; int cacheAge = 999999999; std::map<int, counted_brick>::iterator cache_iter = brickMap.begin(); std::map<int, counted_brick>::iterator cache_icfg = brickMap.find(cfgId); std::map<int, counted_brick>::iterator cache_iend = brickMap.end(); if (cache_icfg != cache_iend) { std::pair<const int, counted_brick>& entry = *cache_icfg; counted_brick& cBrick = entry.second; cacheAge = cBrick.first; obj = cBrick.second; cacheFound = true; } std::map<int, const DTKeyedConfig*> ageMap; if (cacheFound) { if (!cacheAge) return 0; while (cache_iter != cache_iend) { std::pair<const int, counted_brick>& entry = *cache_iter++; counted_brick& cBrick = entry.second; int& brickAge = cBrick.first; if (brickAge < cacheAge) brickAge++; if (entry.first == cfgId) brickAge = 0; } return 0; } else { while (cache_iter != cache_iend) { std::pair<const int, counted_brick>& entry = *cache_iter++; counted_brick& cBrick = entry.second; ageMap.insert(std::pair<int, const DTKeyedConfig*>(++cBrick.first, entry.second.second)); } } std::vector<unsigned long long> checkedKeys; std::shared_ptr<DTKeyedConfig> kBrick; checkedKeys.push_back(cfgId); bool brickFound = false; try { keyList.load(checkedKeys); kBrick = keyList.get<DTKeyedConfig>(0); if (kBrick.get()) brickFound = (kBrick->getId() == cfgId); } catch (std::exception const& e) { } if (brickFound) { counted_brick cBrick(0, obj = new DTKeyedConfig(*kBrick)); brickMap.insert(std::pair<int, counted_brick>(cfgId, cBrick)); DTKeyedConfig::data_iterator d_iter = kBrick->dataBegin(); DTKeyedConfig::data_iterator d_iend = kBrick->dataEnd(); cachedBrickNumber++; cachedStringNumber += (d_iend - d_iter); while (d_iter != d_iend) cachedByteNumber += (*d_iter++).size(); } std::map<int, const DTKeyedConfig*>::reverse_iterator iter = ageMap.rbegin(); while ((cachedBrickNumber > maxBrickNumber) || (cachedStringNumber > maxStringNumber) || (cachedByteNumber > maxByteNumber)) { const DTKeyedConfig* oldestBrick = iter->second; int oldestId = oldestBrick->getId(); cachedBrickNumber--; DTKeyedConfig::data_iterator d_iter = oldestBrick->dataBegin(); DTKeyedConfig::data_iterator d_iend = oldestBrick->dataEnd(); cachedStringNumber -= (d_iend - d_iter); while (d_iter != d_iend) cachedByteNumber -= (*d_iter++).size(); brickMap.erase(oldestId); delete iter->second; iter++; } return 999; } void DTKeyedConfigCache::getData(cond::persistency::KeyList& keyList, int cfgId, std::vector<std::string>& list) { const DTKeyedConfig* obj = nullptr; get(keyList, cfgId, obj); if (obj == nullptr) return; DTKeyedConfig::data_iterator d_iter = obj->dataBegin(); DTKeyedConfig::data_iterator d_iend = obj->dataEnd(); while (d_iter != d_iend) list.push_back(*d_iter++); DTKeyedConfig::link_iterator l_iter = obj->linkBegin(); DTKeyedConfig::link_iterator l_iend = obj->linkEnd(); while (l_iter != l_iend) getData(keyList, *l_iter++, list); return; } void DTKeyedConfigCache::purge() { std::map<int, counted_brick>::const_iterator iter = brickMap.begin(); std::map<int, counted_brick>::const_iterator iend = brickMap.end(); while (iter != iend) { delete iter->second.second; iter++; } brickMap.clear(); cachedBrickNumber = 0; cachedStringNumber = 0; cachedByteNumber = 0; return; }
32.965986
114
0.657862
jkiesele
529879063a3d1eef64e353d0094a6c25314ddf2a
36,358
cc
C++
tensorstore/driver/downsample/downsample_util.cc
google/tensorstore
8df16a67553debaec098698ceaa5404eaf79634a
[ "BSD-2-Clause" ]
106
2020-04-02T20:00:18.000Z
2022-03-23T20:27:31.000Z
tensorstore/driver/downsample/downsample_util.cc
0xgpapad/tensorstore
dfc2972e54588a7b745afea8b9322b57b26b657a
[ "BSD-2-Clause" ]
28
2020-04-12T02:04:47.000Z
2022-03-23T20:27:03.000Z
tensorstore/driver/downsample/downsample_util.cc
0xgpapad/tensorstore
dfc2972e54588a7b745afea8b9322b57b26b657a
[ "BSD-2-Clause" ]
18
2020-04-08T06:41:30.000Z
2022-02-18T03:05:49.000Z
// Copyright 2020 The TensorStore Authors // // 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 "tensorstore/driver/downsample/downsample_util.h" #include <algorithm> #include <vector> #include "absl/container/fixed_array.h" #include "absl/container/inlined_vector.h" #include "absl/strings/str_join.h" #include "tensorstore/array.h" #include "tensorstore/box.h" #include "tensorstore/index.h" #include "tensorstore/index_interval.h" #include "tensorstore/index_space/index_transform.h" #include "tensorstore/index_space/internal/identity_transform.h" #include "tensorstore/index_space/internal/transform_rep.h" #include "tensorstore/util/iterate.h" #include "tensorstore/util/result.h" #include "tensorstore/util/span.h" namespace tensorstore { namespace internal_downsample { std::ostream& operator<<(std::ostream& os, const PropagatedIndexTransformDownsampling& x) { return os << "transform=" << x.transform << "\ninput_downsample_factors=" << absl::StrJoin(x.input_downsample_factors, ","); } namespace { /// Computes the number of output index maps that depend on each input dimension /// of `transform`. /// /// This is used by `PropagateIndexTransformDownsampling`. absl::FixedArray<DimensionIndex, internal::kNumInlinedDims> ComputeInputDimensionReferenceCounts(IndexTransformView<> transform) { using internal_index_space::TransformAccess; assert(transform.valid()); const DimensionIndex output_rank = transform.output_rank(); const DimensionIndex input_rank = transform.input_rank(); absl::FixedArray<DimensionIndex, internal::kNumInlinedDims> input_dimension_ref_counts(input_rank, false); auto transform_rep = TransformAccess::rep(transform); for (DimensionIndex output_dim = 0; output_dim < output_rank; ++output_dim) { const auto& output_map = transform_rep->output_index_maps()[output_dim]; switch (output_map.method()) { case OutputIndexMethod::constant: break; case OutputIndexMethod::single_input_dimension: ++input_dimension_ref_counts[output_map.input_dimension()]; break; case OutputIndexMethod::array: { const auto& index_array_data = output_map.index_array_data(); for (DimensionIndex input_dim = 0; input_dim < input_rank; ++input_dim) { if (index_array_data.byte_strides[input_dim] != 0) { ++input_dimension_ref_counts[input_dim]; } } break; } } } return input_dimension_ref_counts; } /// Determines the number of additional input dimensions needed by /// `PropagateIndexTransformDownsampling`. /// /// \param downsampled_transform Transform to the downsampled output domain. /// \param output_downsample_factors Downsample factors for each output /// dimension. /// \param input_dimension_ref_counts Must equal result of /// `ComputeInputDimensionReferenceCounts`. /// \param is_domain_empty Must equal /// `downsampled_transform.domain().box().is_empty()`. /// \returns The number of additional input dimensions. DimensionIndex ComputeAdditionalInputDimensionsNeeded( IndexTransformView<> downsampled_transform, span<const Index> output_downsample_factors, span<DimensionIndex> input_dimension_ref_counts, bool is_domain_empty) { using internal_index_space::TransformAccess; assert(downsampled_transform.valid()); const DimensionIndex output_rank = downsampled_transform.output_rank(); assert(input_dimension_ref_counts.size() == downsampled_transform.input_rank()); assert(output_downsample_factors.size() == output_rank); DimensionIndex additional_input_dims = 0; auto old_transform_rep = TransformAccess::rep(downsampled_transform); for (DimensionIndex output_dim = 0; output_dim < output_rank; ++output_dim) { assert(output_downsample_factors[output_dim] > 0); if (output_downsample_factors[output_dim] == 1) { // Output dimension is not strided, need not change. continue; } const auto& output_map = old_transform_rep->output_index_maps()[output_dim]; switch (output_map.method()) { case OutputIndexMethod::constant: // Will be converted to `single_input_dimension`. if (!is_domain_empty) { ++additional_input_dims; } break; case OutputIndexMethod::single_input_dimension: // If a given strided output dimension depends on exactly one input // dimension with stride 1 or -1, then we can just adjust it. // // Otherwise, we need to use an index array and a new dimension. if ((std::abs(output_map.stride()) != 1 || input_dimension_ref_counts[output_map.input_dimension()] != 1) && !downsampled_transform.input_domain() .box()[output_map.input_dimension()] .empty()) { ++additional_input_dims; } break; case OutputIndexMethod::array: { ++additional_input_dims; break; } } } return additional_input_dims; } /// Extends `output_map` to `new_input_rank`, and assigns to `new_output_map`. /// /// This is used by `PropagateIndexTransformDownsampling`. /// /// \param output_map Existing output map. /// \param new_output_map[out] New output map to assign. /// \param input_rank Input rank of `output_map`. /// \param new_input_rank Input rank of `new_output_map` (only relevant for /// `OutputIndexMethod::array`). absl::Status ExtendOutputIndexMap( const internal_index_space::OutputIndexMap& output_map, internal_index_space::OutputIndexMap& new_output_map, DimensionIndex input_rank, DimensionIndex new_input_rank) { new_output_map.offset() = output_map.offset(); // Unconditionally copy stride. While not strictly necessary for // `OutputIndexMethod::constant`, leaving the stride uninitialized in that // case leads to MemorySanitizer use-of-uninitialized-value errors because // some code paths check for `stride == 0` before checking if the method is // `constant`. new_output_map.stride() = output_map.stride(); switch (output_map.method()) { case OutputIndexMethod::constant: new_output_map.SetConstant(); break; case OutputIndexMethod::single_input_dimension: new_output_map.SetSingleInputDimension(output_map.input_dimension()); break; case OutputIndexMethod::array: { const auto& index_array_data = output_map.index_array_data(); auto& new_index_array_data = new_output_map.SetArrayIndexing(new_input_rank); new_index_array_data.element_pointer = index_array_data.element_pointer; new_index_array_data.index_range = index_array_data.index_range; std::copy_n(index_array_data.byte_strides, input_rank, new_index_array_data.byte_strides); std::fill_n(new_index_array_data.byte_strides + input_rank, new_input_rank - input_rank, Index(0)); break; } } return absl::OkStatus(); } /// Propagates a downsampling factor through a `single_input_dimension` output /// index map with stride of +/-1. /// /// This is used by `PropagateIndexTransformDownsampling`. /// /// \param original_offset Offset of the original output index map. /// \param original_stride Stride of the original output index map. Must be `1` /// or `-1`. /// \param input_interval Bounds for the corresponding input dimension in the /// downsampled input domain. /// \param output_downsample_factor Downsample factor to propagate. /// \param new_output_map[out] New output index map to assign. /// \param output_base_bounds Bounds for this dimension in the base output /// space. /// \param new_input_domain[out] Input domain of `propagated.transform` to /// update for `new_input_dim`. /// \param new_input_dim New input dimension index. /// \param propagated[out] Propagated transform. absl::Status PropagateUnitStrideSingleInputDimensionMapDownsampling( Index original_offset, Index original_stride, IndexInterval input_interval, Index output_downsample_factor, internal_index_space::OutputIndexMap& new_output_map, IndexInterval output_base_bounds, MutableBoxView<> new_input_domain, DimensionIndex new_input_dim, PropagatedIndexTransformDownsampling& propagated) { assert(original_stride == 1 || original_stride == -1); if (internal::MulOverflow(original_offset, output_downsample_factor, &new_output_map.offset())) { return absl::OutOfRangeError( tensorstore::StrCat("Integer overflow computing output offset ", original_offset, " * ", output_downsample_factor)); } TENSORSTORE_ASSIGN_OR_RETURN( auto bounds_interval, GetAffineTransformDomain(output_base_bounds, new_output_map.offset(), original_stride)); auto input_bounds = DownsampleInterval( bounds_interval, output_downsample_factor, DownsampleMethod::kMean); if (!Contains(input_bounds, input_interval)) { return absl::OutOfRangeError( tensorstore::StrCat("Propagated bounds interval ", input_bounds, " does not contain ", input_interval)); } propagated.input_downsample_factors[new_input_dim] = output_downsample_factor; new_output_map.SetSingleInputDimension(new_input_dim); TENSORSTORE_ASSIGN_OR_RETURN( auto new_interval, GetAffineTransformInverseDomain( input_interval, 0, original_stride * output_downsample_factor)); new_interval = Intersect(new_interval, bounds_interval); new_output_map.stride() = original_stride; new_input_domain[new_input_dim] = new_interval; return absl::OkStatus(); } /// Propagates a downsampling factor through a `single_input_dimension` output /// index map with non-unit stride or an input dimension that is also referenced /// from other output index maps. /// /// In this case a new input dimension is always added. /// /// This is used by `PropagateIndexTransformDownsampling`. /// /// \param output_map[in] Original output index map. /// \pre `output_map.method() == OutputIndexMethod::single_input_dimension` /// \param input_interval Bounds for the corresponding input dimension in the /// downsampled input domain. /// \param output_downsample_factor Downsample factor to propagate. /// \param new_output_map[out] New output index map to assign. /// \param output_base_bounds Bounds for this dimension in the base output /// space. /// \param new_input_domain[out] Input domain of `propagated.transform` to /// update for `new_input_dim`. /// \param new_input_dim New input dimension index. /// \param propagated[out] Propagated transform. absl::Status PropagateSingleInputDimensionMapDownsamplingAsNewDimension( const internal_index_space::OutputIndexMap& output_map, IndexInterval input_interval, Index output_downsample_factor, internal_index_space::OutputIndexMap& new_output_map, IndexInterval output_base_bounds, MutableBoxView<> new_input_domain, DimensionIndex new_input_dim, PropagatedIndexTransformDownsampling& propagated) { if (input_interval.size() == 1 || output_map.stride() == 0) { // Convert to constant map. This avoids allocating an index array // and makes the bounds checking logic below simpler since it does // not have to handle this case. Index adjusted_offset; if (internal::MulOverflow(input_interval.inclusive_min(), output_map.stride(), &adjusted_offset) || internal::AddOverflow(adjusted_offset, output_map.offset(), &adjusted_offset)) { return absl::OutOfRangeError(tensorstore::StrCat( "Integer overflow computing offset ", output_map.offset(), " + ", input_interval.inclusive_min(), " * ", output_map.stride())); } return PropagateUnitStrideSingleInputDimensionMapDownsampling( /*original_offset=*/adjusted_offset, /*original_stride=*/1, /*input_interval=*/IndexInterval::UncheckedSized(0, 1), output_downsample_factor, new_output_map, output_base_bounds, new_input_domain, new_input_dim, propagated); } propagated.input_downsample_factors[new_input_dim] = output_downsample_factor; if (output_downsample_factor > kInfIndex) { return absl::OutOfRangeError("Downsample factor is out of range"); } new_input_domain[new_input_dim] = IndexInterval::UncheckedSized(0, output_downsample_factor); // Convert to index array map. new_output_map.offset() = 0; new_output_map.stride() = 1; auto& new_index_array_data = new_output_map.SetArrayIndexing(new_input_domain.rank()); new_index_array_data.index_range = output_base_bounds; Index adjusted_stride; Index adjusted_offset; if (internal::MulOverflow(output_map.stride(), output_downsample_factor, &adjusted_stride)) { return absl::OutOfRangeError(tensorstore::StrCat( "Integer overflow computing stride ", output_map.stride(), " * ", output_downsample_factor)); } if (internal::MulOverflow(output_map.offset(), output_downsample_factor, &adjusted_offset)) { return absl::OutOfRangeError(tensorstore::StrCat( "Integer overflow computing offset ", output_map.offset(), " * ", output_downsample_factor)); } if (!input_interval.empty()) { TENSORSTORE_ASSIGN_OR_RETURN( auto output_range, GetAffineTransformRange(input_interval, adjusted_offset, adjusted_stride)); TENSORSTORE_ASSIGN_OR_RETURN( output_range, ShiftInterval(output_range, output_downsample_factor - 1, 0)); if (!Contains(output_base_bounds, output_range)) { return absl::OutOfRangeError(tensorstore::StrCat( "Output bounds interval ", output_base_bounds, " does not contain output range interval ", output_range)); } } // Use `new_index_array_data.byte_strides` as temporary buffer for calling // `AllocateArrayElementsLike`. Copy the byte strides of the existing index // array, and add an additional dimension std::fill_n(new_index_array_data.byte_strides, new_input_domain.rank(), Index(0)); new_index_array_data.byte_strides[output_map.input_dimension()] = 1; new_index_array_data.byte_strides[new_input_dim] = 2; new_index_array_data.element_pointer = AllocateArrayElementsLike<Index>( new_index_array_data.layout(new_input_domain), new_index_array_data.byte_strides, skip_repeated_elements); Index* array_origin = const_cast<Index*>(new_index_array_data.array_view(new_input_domain) .byte_strided_origin_pointer() .get()); for (Index j = 0; j < input_interval.size(); ++j) { const Index base_index = adjusted_offset + adjusted_stride * (input_interval.inclusive_min() + j); for (Index i = 0; i < output_downsample_factor; ++i) { Index x; if (internal::AddOverflow(base_index, i, &x) || x > output_base_bounds.inclusive_max()) { x = output_base_bounds.inclusive_max(); } else if (x < output_base_bounds.inclusive_min()) { x = output_base_bounds.inclusive_min(); } array_origin[input_interval.size() * i + j] = x; } } return absl::OkStatus(); } /// Creates a constant output map corresponding to an output index map that /// requires a new input dimension in the propagated transform. /// /// This is used to create a dummy constant output map in the case where the /// downsampled transform has an empty domain. /// /// \param output_downsample_factor Downsample factor to propagate. /// \param new_output_map[out] New output index map to assign. /// \param new_input_domain[in,out] Input domain of `propagated.transform` to /// update for `new_input_dim`. /// \param new_input_dim New input dimension index. /// \param propagated[out] Propagated transform. absl::Status PropagateIndexMapThatRequiresNewInputDimensionForEmptyDomain( Index output_downsample_factor, internal_index_space::OutputIndexMap& new_output_map, MutableBoxView<> new_input_domain, DimensionIndex new_input_dim, PropagatedIndexTransformDownsampling& propagated) { propagated.input_downsample_factors[new_input_dim] = output_downsample_factor; if (output_downsample_factor > kInfIndex) { return absl::OutOfRangeError("Downsample factor is out of range"); } new_input_domain[new_input_dim] = IndexInterval::UncheckedSized(0, output_downsample_factor); new_output_map.SetConstant(); new_output_map.offset() = 0; new_output_map.stride() = 0; return absl::OkStatus(); } /// Propagates a downsampling factor through an index array output index map. /// /// \param output_map Original output index map. /// \pre `output_map.method() == OutputIndexMethod::array` /// \param downsampled_input_domain Input domain of original transform. /// \param output_downsample_factor Downsample factor to propagate. /// \param new_output_map[out] New output index map to assign. /// \param output_base_bounds Bounds for this dimension in the base output /// space. /// \param new_input_domain[in,out] Input domain of `propagated.transform` to /// update for `new_input_dim`. /// \param new_input_dim New input dimension index. /// \param propagated[out] Propagated transform. absl::Status PropagateIndexArrayMapDownsampling( const internal_index_space::OutputIndexMap& output_map, BoxView<> downsampled_input_domain, Index output_downsample_factor, internal_index_space::OutputIndexMap& new_output_map, IndexInterval output_base_bounds, MutableBoxView<> new_input_domain, DimensionIndex new_input_dim, PropagatedIndexTransformDownsampling& propagated) { new_output_map.offset() = 0; propagated.input_downsample_factors[new_input_dim] = output_downsample_factor; if (output_downsample_factor > kInfIndex) { return absl::OutOfRangeError("Downsample factor is out of range"); } new_input_domain[new_input_dim] = IndexInterval::UncheckedSized(0, output_downsample_factor); const DimensionIndex input_rank = downsampled_input_domain.rank(); const auto& index_array_data = output_map.index_array_data(); new_output_map.stride() = 1; auto& new_index_array_data = new_output_map.SetArrayIndexing(new_input_domain.rank()); Index adjusted_stride; Index adjusted_offset; if (internal::MulOverflow(output_map.stride(), output_downsample_factor, &adjusted_stride)) { return absl::OutOfRangeError(tensorstore::StrCat( "Integer overflow computing stride ", output_map.stride(), " * ", output_downsample_factor)); } if (internal::MulOverflow(output_map.offset(), output_downsample_factor, &adjusted_offset)) { return absl::OutOfRangeError(tensorstore::StrCat( "Integer overflow computing offset ", output_map.offset(), " * ", output_downsample_factor)); } TENSORSTORE_ASSIGN_OR_RETURN( auto padded_output_interval, ShiftInterval(output_base_bounds, -(output_downsample_factor - 1), 0)); TENSORSTORE_ASSIGN_OR_RETURN( auto effective_index_range, GetAffineTransformDomain(padded_output_interval, adjusted_offset, adjusted_stride)); effective_index_range = Intersect(effective_index_range, index_array_data.index_range); new_index_array_data.index_range = output_base_bounds; // Use `new_index_array_data.byte_strides` as temporary buffer for // calling `AllocateArrayLike`. Copy the byte strides of the existing // index array, and add an additional dimension std::copy_n(index_array_data.byte_strides, input_rank, new_index_array_data.byte_strides); std::fill_n(new_index_array_data.byte_strides + input_rank, new_input_domain.rank() - input_rank, Index(0)); new_index_array_data.byte_strides[new_input_dim] = std::numeric_limits<Index>::max(); // Note that we pass `new_input_domain` to `AllocateArrayElementsLike` even // though it is only partially initialized; only dimensions up to // `new_input_dim` are initialized. The dimensions after `new_input_dim` have // the origin set to 0 and the shape set to 1, to ensure they are "skipped" // (i.e. byte_stride set to 0). new_index_array_data.element_pointer = AllocateArrayElementsLike<Index>( new_index_array_data.layout(new_input_domain), new_index_array_data.byte_strides, skip_repeated_elements); absl::Status status; IterateOverArrays( [&](const Index* existing_index, ByteStridedPointer<const Index> new_index) { const Index existing_index_value = *existing_index; if (!Contains(effective_index_range, existing_index_value)) { status = CheckContains(effective_index_range, existing_index_value); return false; } Index base_index = existing_index_value * adjusted_stride + adjusted_offset; const Index byte_stride = new_index_array_data.byte_strides[new_input_dim]; Index cur_index = std::max(base_index, output_base_bounds.inclusive_min()); for (Index i = 0; i < output_downsample_factor; ++i) { Index x; if (!internal::AddOverflow(base_index, i, &x) && output_base_bounds.exclusive_max() > x) { cur_index = std::max(cur_index, x); } assert(Contains(output_base_bounds, cur_index)); *const_cast<Index*>((new_index + i * byte_stride).get()) = cur_index; } return true; }, skip_repeated_elements, index_array_data.array_view(downsampled_input_domain), new_index_array_data.array_view(downsampled_input_domain)); return status; } } // namespace absl::Status PropagateIndexTransformDownsampling( IndexTransformView<> downsampled_transform, BoxView<> output_base_bounds, span<const Index> output_downsample_factors, PropagatedIndexTransformDownsampling& propagated) { using internal_index_space::TransformAccess; using internal_index_space::TransformRep; assert(downsampled_transform.valid()); const DimensionIndex output_rank = downsampled_transform.output_rank(); const DimensionIndex input_rank = downsampled_transform.input_rank(); assert(output_base_bounds.rank() == output_rank); assert(output_downsample_factors.size() == output_rank); auto input_dimension_ref_counts = ComputeInputDimensionReferenceCounts(downsampled_transform); const bool is_domain_empty = downsampled_transform.domain().box().is_empty(); DimensionIndex additional_input_dims = ComputeAdditionalInputDimensionsNeeded( downsampled_transform, output_downsample_factors, input_dimension_ref_counts, is_domain_empty); const DimensionIndex new_input_rank = input_rank + additional_input_dims; TENSORSTORE_RETURN_IF_ERROR(ValidateRank(new_input_rank)); auto new_transform = TransformRep::Allocate(new_input_rank, output_rank); new_transform->output_rank = output_rank; internal_index_space::CopyTransformRepDomain( TransformAccess::rep(downsampled_transform), new_transform.get()); new_transform->input_rank = new_input_rank; // Bounds of the new transform are always marked explicit, because they are // computed specifically for the exact output bounds, and the normal // propagation used for implicit bounds would not do the right thing. It is // assumed that any implicit bounds have already been resolved. new_transform->implicit_lower_bounds(new_input_rank).fill(false); new_transform->implicit_upper_bounds(new_input_rank).fill(false); MutableBoxView<> input_domain = new_transform->input_domain(new_input_rank); // Initialize origin and shape for new input dimensions. The origin does not // matter, but is set to avoid a spurious MemorySanitizer // use-of-uninitialized-value error in PropagateIndexArrayMapDownsampling. // The shape is set to 1 to ensure uninitialized dimensions are skipped when // allocating index arrays. std::fill(input_domain.origin().begin() + input_rank, input_domain.origin().begin() + new_input_rank, Index(0)); std::fill(input_domain.shape().begin() + input_rank, input_domain.shape().begin() + new_input_rank, Index(1)); propagated.input_downsample_factors.clear(); propagated.input_downsample_factors.resize(new_input_rank, 1); DimensionIndex next_input_dim = input_rank; for (DimensionIndex output_dim = 0; output_dim < output_rank; ++output_dim) { const auto& output_map = TransformAccess::rep(downsampled_transform) ->output_index_maps()[output_dim]; auto& new_output_map = new_transform->output_index_maps()[output_dim]; const Index output_downsample_factor = output_downsample_factors[output_dim]; if (output_downsample_factor == 1) { // No downsampling of this output dimension, just copy existing output // map. TENSORSTORE_RETURN_IF_ERROR(ExtendOutputIndexMap( output_map, new_output_map, input_rank, new_input_rank)); continue; } absl::Status status; switch (output_map.method()) { case OutputIndexMethod::constant: { if (is_domain_empty) { new_output_map.SetConstant(); new_output_map.offset() = 0; new_output_map.stride() = 0; break; } // New input dimension is required. status = PropagateUnitStrideSingleInputDimensionMapDownsampling( /*original_offset=*/output_map.offset(), /*original_stride=*/1, /*input_interval=*/IndexInterval::UncheckedSized(0, 1), output_downsample_factor, new_output_map, /*output_base_bounds=*/output_base_bounds[output_dim], input_domain, /*new_input_dim=*/next_input_dim++, propagated); break; } case OutputIndexMethod::single_input_dimension: { const DimensionIndex input_dim = output_map.input_dimension(); const IndexInterval input_interval = downsampled_transform.input_domain().box()[input_dim]; // Check if this map can be handled without creating a new input // dimension. if (std::abs(output_map.stride()) == 1 && input_dimension_ref_counts[input_dim] == 1) { status = PropagateUnitStrideSingleInputDimensionMapDownsampling( /*original_offset=*/output_map.offset(), /*original_stride=*/output_map.stride(), /*input_interval=*/input_interval, output_downsample_factor, new_output_map, /*output_base_bounds=*/output_base_bounds[output_dim], input_domain, /*new_input_dim=*/input_dim, propagated); break; } if (!IsFinite(input_interval)) { status = absl::InvalidArgumentError(tensorstore::StrCat( "Input domain ", input_interval, " is not finite")); break; } if (input_interval.empty()) { new_output_map.SetSingleInputDimension(input_dim); new_output_map.offset() = 0; new_output_map.stride() = 1; break; } // New input dimension is required. status = is_domain_empty ? PropagateIndexMapThatRequiresNewInputDimensionForEmptyDomain( output_downsample_factor, new_output_map, input_domain, next_input_dim++, propagated) : PropagateSingleInputDimensionMapDownsamplingAsNewDimension( output_map, input_interval, output_downsample_factor, new_output_map, output_base_bounds[output_dim], input_domain, next_input_dim++, propagated); break; } case OutputIndexMethod::array: { status = is_domain_empty ? PropagateIndexMapThatRequiresNewInputDimensionForEmptyDomain( output_downsample_factor, new_output_map, input_domain, next_input_dim++, propagated) : PropagateIndexArrayMapDownsampling( output_map, downsampled_transform.domain().box(), output_downsample_factor, new_output_map, output_base_bounds[output_dim], input_domain, next_input_dim++, propagated); break; } } if (!status.ok()) { return tensorstore::MaybeAnnotateStatus( status, tensorstore::StrCat("Propagating downsampling factor ", output_downsample_factor, " through output dimension ", output_dim)); } } internal_index_space::DebugCheckInvariants(new_transform.get()); propagated.transform = internal_index_space::TransformAccess::Make<IndexTransform<>>( std::move(new_transform)); return absl::OkStatus(); } Result<PropagatedIndexTransformDownsampling> PropagateIndexTransformDownsampling( IndexTransformView<> downsampled_transform, BoxView<> output_base_bounds, span<const Index> output_downsample_factors) { PropagatedIndexTransformDownsampling propagated; TENSORSTORE_RETURN_IF_ERROR(PropagateIndexTransformDownsampling( downsampled_transform, output_base_bounds, output_downsample_factors, propagated)); return propagated; } IndexInterval DownsampleInterval(IndexInterval base_interval, Index downsample_factor, DownsampleMethod method) { assert(downsample_factor > 0); Index inclusive_min; if (base_interval.inclusive_min() == -kInfIndex) { inclusive_min = -kInfIndex; } else { switch (method) { case DownsampleMethod::kStride: // Round up to ensure `base_interval` contains // `downsampled_inclusive_min * downsample_factor`. inclusive_min = CeilOfRatio(base_interval.inclusive_min(), downsample_factor); break; case DownsampleMethod::kMean: case DownsampleMethod::kMin: case DownsampleMethod::kMax: case DownsampleMethod::kMedian: case DownsampleMethod::kMode: // Round down since region-based methods can be computed from just a // single element. inclusive_min = FloorOfRatio(base_interval.inclusive_min(), downsample_factor); break; default: TENSORSTORE_UNREACHABLE; } } Index inclusive_max; if (base_interval.inclusive_max() == kInfIndex) { inclusive_max = kInfIndex; } else if (base_interval.empty()) { inclusive_max = inclusive_min - 1; } else { // Round down for all downsampling methods. inclusive_max = FloorOfRatio(base_interval.inclusive_max(), downsample_factor); } return IndexInterval::UncheckedClosed(inclusive_min, inclusive_max); } void DownsampleBounds(BoxView<> base_bounds, MutableBoxView<> downsampled_bounds, span<const Index> downsample_factors, DownsampleMethod method) { const DimensionIndex rank = base_bounds.rank(); assert(rank == downsampled_bounds.rank()); assert(rank == downsample_factors.size()); for (DimensionIndex i = 0; i < rank; ++i) { downsampled_bounds[i] = DownsampleInterval(base_bounds[i], downsample_factors[i], method); } } IndexDomain<> DownsampleDomain(IndexDomain<> base_domain, span<const Index> downsample_factors, DownsampleMethod method) { using internal_index_space::TransformAccess; using internal_index_space::TransformRep; const DimensionIndex rank = base_domain.rank(); assert(rank == downsample_factors.size()); auto rep = TransformRep::Allocate(rank, 0); rep->input_rank = rank; rep->output_rank = 0; DownsampleBounds(base_domain.box(), rep->input_domain(rank), downsample_factors, method); rep->implicit_lower_bounds(rank).DeepAssign( base_domain.implicit_lower_bounds()); rep->implicit_upper_bounds(rank).DeepAssign( base_domain.implicit_upper_bounds()); const auto& labels = base_domain.labels(); std::copy(labels.begin(), labels.end(), rep->input_labels().begin()); internal_index_space::DebugCheckInvariants(rep.get()); return TransformAccess::Make<IndexDomain<>>(std::move(rep)); } IndexTransform<> GetDownsampledDomainIdentityTransform( IndexDomainView<> base_domain, span<const Index> downsample_factors, DownsampleMethod downsample_method) { using internal_index_space::TransformAccess; using internal_index_space::TransformRep; const DimensionIndex rank = base_domain.rank(); assert(rank == downsample_factors.size()); auto rep = TransformRep::Allocate(rank, rank); rep->input_rank = rep->output_rank = rank; DownsampleBounds(base_domain.box(), rep->input_domain(rank), downsample_factors, downsample_method); rep->implicit_lower_bounds(rank).DeepAssign( base_domain.implicit_lower_bounds()); rep->implicit_upper_bounds(rank).DeepAssign( base_domain.implicit_upper_bounds()); const auto& labels = base_domain.labels(); std::copy(labels.begin(), labels.end(), rep->input_labels().begin()); internal_index_space::SetToIdentityTransform(rep->output_index_maps()); internal_index_space::DebugCheckInvariants(rep.get()); return TransformAccess::Make<IndexTransform<>>(std::move(rep)); } bool CanDownsampleIndexTransform(IndexTransformView<> base_transform, BoxView<> base_bounds, span<const Index> downsample_factors) { const Index output_rank = base_transform.output_rank(); assert(base_bounds.rank() == output_rank); assert(downsample_factors.size() == output_rank); for (DimensionIndex output_dim = 0; output_dim < output_rank; ++output_dim) { const Index downsample_factor = downsample_factors[output_dim]; const auto base_interval = base_bounds[output_dim]; const auto map = base_transform.output_index_maps()[output_dim]; switch (map.method()) { case OutputIndexMethod::constant: if (downsample_factor != 1 && ((base_interval.inclusive_min() != map.offset() && ((map.offset() % downsample_factor) != 0)) || (base_interval.inclusive_max() != map.offset() && ((map.offset() + 1) % downsample_factor) != 0))) { // single index is not aligned to a downsampling block return false; } break; case OutputIndexMethod::single_input_dimension: { if (downsample_factor == 1) break; if (map.stride() != 1 && map.stride() != -1) { return false; } const auto input_interval = base_transform.input_domain().box()[map.input_dimension()]; TENSORSTORE_ASSIGN_OR_RETURN( auto shifted_interval, GetAffineTransformRange(input_interval, map.offset(), map.stride()), false); if ((base_interval.inclusive_min() != shifted_interval.inclusive_min() && (shifted_interval.inclusive_min() % downsample_factor) != 0) || (base_interval.exclusive_max() != shifted_interval.exclusive_max() && (shifted_interval.exclusive_max() % downsample_factor) != 0)) { return false; } break; } case OutputIndexMethod::array: // Chunks with index array maps cannot be downsampled independently, // since our tracking of chunks does not handle non-rectangular regions. return false; } } return true; } } // namespace internal_downsample } // namespace tensorstore
45.221393
80
0.70664
google
529969a537876652947467da3907dda4ecae4417
1,156
cpp
C++
Training/暑期集训1 Shuffle.cpp
windcry1/My-ACM-ICPC
b85b1c83b72c6b51731dae946a0df57c31d3e7a1
[ "MIT" ]
null
null
null
Training/暑期集训1 Shuffle.cpp
windcry1/My-ACM-ICPC
b85b1c83b72c6b51731dae946a0df57c31d3e7a1
[ "MIT" ]
null
null
null
Training/暑期集训1 Shuffle.cpp
windcry1/My-ACM-ICPC
b85b1c83b72c6b51731dae946a0df57c31d3e7a1
[ "MIT" ]
null
null
null
//Author:LanceYu #include<cstring> #include<cmath> #include<cstdio> #include<cctype> #include<cstdlib> #include<ctime> #include<vector> #include<iostream> #include<string> #include<queue> #include<set> #include<map> #include<algorithm> #include<complex> #include<stack> #include<bitset> #include<iomanip> #define ll long long using namespace std; const double clf=1e-8; const int MMAX=0x7fffffff; const int INF=0xfffffff; const int mod=1e9+7; map<string,bool> ma; int main() { // ios::sync_with_stdio(false); // cin.tie(0); // cout.tie(0); //freopen("C:\\Users\\LENOVO\\Desktop\\in.txt","r",stdin); //freopen("C:\\Users\\LENOVO\\Desktop\\out.txt","w",stdout); int T,times=0; cin>>T; while(T--) { ma.clear(); int n; cin>>n; string s1,s2,s3,t; cin>>s1>>s2>>s3; int i=0; while(i!=n) { t+=s2[i]; t+=s1[i++]; } int cnt=0,f=1; while(!ma[t]) { cnt++; ma[t]=true; if(s3==t) { cout<<++times<<" "<<cnt<<endl; f=0; break; } s1=t.substr(0,n); s2=t.substr(n,n); i=0; t=""; while(i!=n) { t+=s2[i]; t+=s1[i++]; } } if(f) cout<<++times<<" -1"<<endl; } return 0; }
15.413333
61
0.581315
windcry1
529c974c7f1215d0229b7ff8f16488daa80f8774
226
cpp
C++
collection/cp/Algorithm_Collection-master/removeDuplicates.cpp
daemonslayer/Notebook
a9880be9bd86955afd6b8f7352822bc18673eda3
[ "Apache-2.0" ]
1
2019-03-24T13:12:01.000Z
2019-03-24T13:12:01.000Z
collection/cp/Algorithm_Collection-master/removeDuplicates.cpp
daemonslayer/Notebook
a9880be9bd86955afd6b8f7352822bc18673eda3
[ "Apache-2.0" ]
null
null
null
collection/cp/Algorithm_Collection-master/removeDuplicates.cpp
daemonslayer/Notebook
a9880be9bd86955afd6b8f7352822bc18673eda3
[ "Apache-2.0" ]
null
null
null
int removeDuplicates(int A[], int n) { // Start typing your C/C++ solution below // DO NOT write int main() function int i=0; int j; if (n<=1) return n; for (j=1;j<n;j++) { if (A[j] != A[i]) { A[++i]=A[j]; } } return i+1; }
13.294118
41
0.566372
daemonslayer
52a4dbe5f32625a9707455c1890d974e04646835
374
cpp
C++
cfi/call-wrong-num-func-vtable-stack.cpp
comparch-security/cpu-sec-bench
34506323a80637fae2a4d2add3bbbdaa4e6d8473
[ "MIT" ]
4
2021-11-12T03:41:54.000Z
2022-02-28T12:23:49.000Z
cfi/call-wrong-num-func-vtable-stack.cpp
comparch-security/cpu-sec-bench
34506323a80637fae2a4d2add3bbbdaa4e6d8473
[ "MIT" ]
null
null
null
cfi/call-wrong-num-func-vtable-stack.cpp
comparch-security/cpu-sec-bench
34506323a80637fae2a4d2add3bbbdaa4e6d8473
[ "MIT" ]
1
2021-11-29T08:38:28.000Z
2021-11-29T08:38:28.000Z
#include <cstdlib> #include "include/cfi.hpp" void fake_func() { exit(0); } int main() { Helper *orig = new Helper(); //create a fake vtable with 3 function pointers pfunc_t fake_vtable[3]; for(int i=0; i<3; i++) fake_vtable[i] = fake_func; // replace the vtable pointer write_vtable_pointer(orig, fake_vtable); orig->virtual_func(); return 4; }
17
49
0.663102
comparch-security
52a5c046dd736f7f68106486587a68a59de74e22
958
cpp
C++
raygame/button.cpp
LegendaryyDoc/Inheritance
23b5d360209e1d4031e0c2f06a827a7ab6b6664f
[ "MIT" ]
null
null
null
raygame/button.cpp
LegendaryyDoc/Inheritance
23b5d360209e1d4031e0c2f06a827a7ab6b6664f
[ "MIT" ]
null
null
null
raygame/button.cpp
LegendaryyDoc/Inheritance
23b5d360209e1d4031e0c2f06a827a7ab6b6664f
[ "MIT" ]
null
null
null
#include "raylib.h" #include "button.h" void Button::Draw() { } bool Button::CheckForClick() { bool rtn = false; Vector2 cursor = GetMousePosition(); if (CheckCollisionPointRec(cursor, rec)) { if (IsMouseButtonDown(MOUSE_LEFT_BUTTON)) { currentFrame = 1; rtn= true; } else { currentFrame = 0; rtn= false; } } //std::cout << currentFrame; DrawTexture(spriteCells[currentFrame], x, y, WHITE); return rtn; } Button::Button(const std::string * filename, const Vector2 & position, const int cellCount) { spriteCells = new Texture2D[cellCount]; frameCount = cellCount; for (int i = 0; i < cellCount; ++i) { spriteCells[i] = LoadTexture(filename[i].c_str()); } //rec = { x,y,w,h }; x = position.x; y = position.y; rec.x = position.x; rec.y = position.y; rec.width = spriteCells->width; rec.height = spriteCells->height; } Button::Button() { } Button::~Button() { UnloadTexture(spriteCells[currentFrame]); }
15.966667
91
0.65762
LegendaryyDoc
52a634ae2ca0f5584870f7fc30931b47abe97c2b
9,764
cpp
C++
src/MushGame/MushGameUtil.cpp
mushware/adanaxis-core-app
679ac3e8a122e059bb208e84c73efc19753e87dd
[ "MIT" ]
9
2020-11-02T17:20:40.000Z
2021-12-25T15:35:36.000Z
src/MushGame/MushGameUtil.cpp
mushware/adanaxis-core-app
679ac3e8a122e059bb208e84c73efc19753e87dd
[ "MIT" ]
2
2020-06-27T23:14:13.000Z
2020-11-02T17:28:32.000Z
src/MushGame/MushGameUtil.cpp
mushware/adanaxis-core-app
679ac3e8a122e059bb208e84c73efc19753e87dd
[ "MIT" ]
1
2021-05-12T23:05:42.000Z
2021-05-12T23:05:42.000Z
//%Header { /***************************************************************************** * * File: src/MushGame/MushGameUtil.cpp * * Copyright: Andy Southgate 2002-2007, 2020 * * 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. * ****************************************************************************/ //%Header } oQaGYO8jpftpyXnIPKJgUw /* * $Id: MushGameUtil.cpp,v 1.17 2006/12/14 00:33:49 southa Exp $ * $Log: MushGameUtil.cpp,v $ * Revision 1.17 2006/12/14 00:33:49 southa * Control fix and audio pacing * * Revision 1.16 2006/10/04 13:35:24 southa * Selective targetting * * Revision 1.15 2006/09/29 10:47:56 southa * Object AI * * Revision 1.14 2006/07/07 18:13:59 southa * Menu start and stop * * Revision 1.13 2006/06/29 11:40:40 southa * X11 and 64 bit fixes * * Revision 1.12 2006/06/01 15:39:27 southa * DrawArray verification and fixes * * Revision 1.11 2005/08/01 13:09:58 southa * Collision messaging * * Revision 1.10 2005/07/06 19:08:27 southa * Adanaxis control work * * Revision 1.9 2005/06/30 16:29:25 southa * Adanaxis work * * Revision 1.8 2005/06/29 11:11:15 southa * Camera and rendering work * * Revision 1.7 2005/06/23 17:25:25 southa * MushGame link work * * Revision 1.6 2005/06/23 13:56:59 southa * MushGame link work * * Revision 1.5 2005/06/23 11:58:29 southa * MushGame link work * * Revision 1.4 2005/06/22 20:01:59 southa * MushGame link work * * Revision 1.3 2005/06/21 15:57:48 southa * MushGame work * * Revision 1.2 2005/06/21 13:10:52 southa * MushGame work * * Revision 1.1 2005/06/20 16:14:31 southa * Adanaxis work * */ #include "MushGameUtil.h" #include "MushGameAppHandler.h" #include "MushGameClient.h" #include "MushGameData.h" #include "MushGameHostData.h" #include "MushGameHostSaveData.h" #include "MushGameHostVolatileData.h" #include "MushGameJobAdmission.h" #include "MushGameJobPlayerCreate.h" #include "MushGameLogic.h" #include "MushGameLink.h" #include "MushGameMessage.h" #include "MushGameRender.h" #include "MushGameSaveData.h" #include "MushGameServer.h" #include "MushGameVolatileData.h" using namespace Mushware; using namespace std; void MushGameUtil::MailboxToDigestMove(MushGameDigest& ioDigest, MushGameMailbox& ioMailbox) { MushGameMessage *pMessage; while (ioMailbox.TakeIfAvailable(pMessage)) { ioDigest.Give(pMessage); } } void MushGameUtil::MailboxToServerMove(MushGameServer& ioServer, MushGameMailbox& ioBoxToMove, MushGameLogic& ioLogic) { MushGameMessage *pMessage; while (ioBoxToMove.TakeIfAvailable(pMessage)) { ioServer.MessageConsume(ioLogic, *pMessage); } } void MushGameUtil::MailboxToClientMove(MushGameClient& ioClient, MushGameMailbox& ioBoxToMove, MushGameLogic& ioLogic) { MushGameMessage *pMessage; while (ioBoxToMove.TakeIfAvailable(pMessage)) { ioClient.MessageConsume(ioLogic, *pMessage); } } std::string MushGameUtil::ObjectName(const std::string& inPrefix, const std::string& inSuffix) { std::string basePrefix = "MushGame"; std::string retName = inPrefix + inSuffix; if (!MushcoreFactory::Sgl().Exists(retName)) { retName = basePrefix + inSuffix; if (!MushcoreFactory::Sgl().Exists(retName)) { throw MushcoreLogicFail("Unknown object name '"+inPrefix+"/"+basePrefix+inSuffix+"'"); } } return retName; } void MushGameUtil::LocalGameCreate(const std::string& inName, const std::string& inPrefix) { // Create the game objects DataObjectCreate<MushGameData>(inName, inPrefix, "Data")->GroupingNameSet(inName); DataObjectCreate<MushGameSaveData>(inName, inPrefix, "SaveData")->GroupingNameSet(inName); DataObjectCreate<MushGameVolatileData>(inName, inPrefix, "VolatileData")->GroupingNameSet(inName); DataObjectCreate<MushGameHostData>(inName, inPrefix, "HostData")->GroupingNameSet(inName); DataObjectCreate<MushGameHostSaveData>(inName, inPrefix, "HostSaveData")->GroupingNameSet(inName); DataObjectCreate<MushGameHostVolatileData>(inName, inPrefix, "HostVolatileData")->GroupingNameSet(inName); DataObjectCreate<MushGameServer>(inName, inPrefix, "Server")->GroupingNameSet(inName); DataObjectCreate<MushGameClient>(inName, inPrefix, "Client")->GroupingNameSet(inName); DataObjectCreate<MushGameRender>(inName, inPrefix, "Render")->GroupingNameSet(inName); MushGameLogic *pLogic = DataObjectCreate<MushGameLogic>(inName, inPrefix, "Logic"); pLogic->GroupingNameSet(inName); // Create local addresses and links std::string serverName = inName+"-localserver"; std::string clientName = inName+"-localclient"; pLogic->SaveData().ClientNameSet(clientName); pLogic->SaveData().RenderNameSet(inName); pLogic->SaveData().ControlMailboxNameSet(inName+"-controlmailbox"); pLogic->HostSaveData().ServerNameSet(serverName); DataObjectCreate<MushGameAddress>(serverName, inPrefix, "Address")->NameSet(serverName); DataObjectCreate<MushGameAddress>(clientName, inPrefix, "Address")->NameSet(clientName); DataObjectCreate<MushGameLink>(serverName, inPrefix, "LinkLocal")->SrcDestSet(clientName, serverName); DataObjectCreate<MushGameLink>(clientName, inPrefix, "LinkLocal")->SrcDestSet(serverName, clientName); pLogic->ServerAddressSet(serverName); pLogic->ClientAddressAdd(clientName); } void MushGameUtil::LocalGameJobsCreate(MushGameLogic& ioLogic) { std::string admissionName = "admission"; MushGameJobAdmission *pAdmissionCreate = new MushGameJobAdmission("j:"+admissionName); ioLogic.HostSaveData().JobListWRef().Give(admissionName, pAdmissionCreate); std::string localPlayerCreateName = "localplayercreate"; MushGameJobPlayerCreate *pLocalPlayerCreate = new MushGameJobPlayerCreate("j:"+localPlayerCreateName); ioLogic.SaveData().JobListWRef().Give(localPlayerCreateName, pLocalPlayerCreate); } std::string MushGameUtil::KeyFromString(const std::string& inStr) { if (inStr.size() < 2) { throw MushcoreDataFail("Message ID '"+inStr+"' too short to extract key"); } string::size_type barPos = inStr.find("|"); if (barPos == inStr.npos || barPos < 2) { return inStr.substr(2); } else { return inStr.substr(2, barPos - 2); } } std::string MushGameUtil::KeyFromMessage(const MushGameMessage& inMessage) { return KeyFromString(inMessage.Id()); } std::string MushGameUtil::ReplyIDFromMessage(const MushGameMessage& inMessage) { const std::string& idRef = inMessage.Id(); if (idRef.size() < 2) { throw MushcoreDataFail("Message ID '"+idRef+"' too short to extract key"); } string::size_type barPos = idRef.find("|"); if (barPos == idRef.npos) { barPos = 0; } return idRef.substr(barPos+1); } MushGameAppHandler& MushGameUtil::AppHandler(void) { MushGameAppHandler *pAppHandler=dynamic_cast<MushGameAppHandler *>(&MushcoreAppHandler::Sgl()); if (pAppHandler == NULL) { throw MushcoreRequestFail("AppHandler of wrong type for MushGameAppHandler"); } return *pAppHandler; } MushGameLogic& MushGameUtil::LogicWRef(void) { return AppHandler().LogicWRef(); } const MushGameLogic& MushGameUtil::LogicRef(void) { return AppHandler().LogicWRef(); } std::string MushGameUtil::ObjectName(const std::string& inPrefix, Mushware::U32 inNumber) { ostringstream nameStream; nameStream << inPrefix << ':' << inNumber; return nameStream.str(); } void MushGameUtil::ObjectNameDecode(std::string& outPrefix, Mushware::U32& outNumber, const std::string& inName) { string::size_type pos = inName.find(':'); if (pos == string::npos || pos == 0) { throw MushcoreDataFail("Cannot decode object name from '"+inName+"' - no colon"); } outPrefix = inName.substr(0, pos); istringstream nameStream(inName.substr(pos+1)); if (nameStream) nameStream >> outNumber; if (!nameStream) { throw MushcoreDataFail("Cannot decode object name from '"+inName+"'"); } } std::string MushGameUtil::StripFlags(std::vector<std::string> outFlags, const std::string& inString) { string::size_type startPos = 0; string::size_type endPos = 0; while (inString.size() > startPos && inString[startPos] == '[') { endPos = inString.find(']', startPos); if (endPos == string::npos) { throw MushcoreDataFail("Malformed flags in '"+inString+"'"); } outFlags.push_back(inString.substr(startPos+1, endPos-startPos-1)); startPos = endPos+1; } return inString.substr(startPos); }
31.701299
113
0.695924
mushware
52abcb2d2463f30400de695309b43093980da152
1,028
cpp
C++
UI/NewGameHUD/Widget/Widget_PressKey/SCpt_PressKey.cpp
Bornsoul/Revenger_JoyContinue
599716970ca87a493bf3a959b36de0b330b318f1
[ "MIT" ]
null
null
null
UI/NewGameHUD/Widget/Widget_PressKey/SCpt_PressKey.cpp
Bornsoul/Revenger_JoyContinue
599716970ca87a493bf3a959b36de0b330b318f1
[ "MIT" ]
null
null
null
UI/NewGameHUD/Widget/Widget_PressKey/SCpt_PressKey.cpp
Bornsoul/Revenger_JoyContinue
599716970ca87a493bf3a959b36de0b330b318f1
[ "MIT" ]
null
null
null
// Fill out your copyright notice in the Description page of Project Settings. #include "SCpt_PressKey.h" #include "WCpt_PressKey.h" #include "Widget_PressKeyItem.h" USCpt_PressKey::USCpt_PressKey() { PrimaryComponentTick.bCanEverTick = true; m_pWidgetComp_PressKey = CreateDefaultSubobject<UWCpt_PressKey>(TEXT("Widget")); if (m_pWidgetComp_PressKey == nullptr) { ULOG(TEXT("Widget is nullptr")); return; } } void USCpt_PressKey::BeginPlay() { Super::BeginPlay(); } void USCpt_PressKey::EndPlay(const EEndPlayReason::Type EndPlayReason) { Super::EndPlay(EndPlayReason); if (m_pWidgetComp_PressKey != nullptr) { if (m_pWidgetComp_PressKey->IsValidLowLevel()) { m_pWidgetComp_PressKey = nullptr; } } } void USCpt_PressKey::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) { Super::TickComponent(DeltaTime, TickType, ThisTickFunction); /*if (m_pWidgetComp_PressKey != nullptr) { m_pWidgetComp_PressKey->SetWorldLocation(m_vLocation); }*/ }
20.979592
119
0.765564
Bornsoul
52abedf1089d41f26c66fdee47412282f04a64ba
22,784
cpp
C++
src/binfhe/lib/fhew.cpp
cs854paper58/PerfEvaFHE
4913920e20c3488556702bd15095cc2055fa381a
[ "BSD-2-Clause" ]
null
null
null
src/binfhe/lib/fhew.cpp
cs854paper58/PerfEvaFHE
4913920e20c3488556702bd15095cc2055fa381a
[ "BSD-2-Clause" ]
null
null
null
src/binfhe/lib/fhew.cpp
cs854paper58/PerfEvaFHE
4913920e20c3488556702bd15095cc2055fa381a
[ "BSD-2-Clause" ]
null
null
null
// @file fhew.cpp - FHEW scheme (RingGSW accumulator) implementation // The scheme is described in https://eprint.iacr.org/2014/816 and in // Daniele Micciancio and Yuriy Polyakov, "Bootstrapping in FHEW-like // Cryptosystems", Cryptology ePrint Archive, Report 2020/086, // https://eprint.iacr.org/2020/086. // // Full reference to https://eprint.iacr.org/2014/816: // @misc{cryptoeprint:2014:816, // author = {Leo Ducas and Daniele Micciancio}, // title = {FHEW: Bootstrapping Homomorphic Encryption in less than a second}, // howpublished = {Cryptology ePrint Archive, Report 2014/816}, // year = {2014}, // note = {\url{https://eprint.iacr.org/2014/816}}, // @author TPOC: contact@palisade-crypto.org // // @copyright Copyright (c) 2019, Duality Technologies Inc. // All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. THIS SOFTWARE IS // PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO // EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "fhew.h" namespace lbcrypto { // Encryption as described in Section 5 of https://eprint.iacr.org/2014/816 // skNTT corresponds to the secret key z std::shared_ptr<RingGSWCiphertext> RingGSWAccumulatorScheme::EncryptAP( const std::shared_ptr<RingGSWCryptoParams> params, const NativePoly &skNTT, const LWEPlaintext &m) const { NativeInteger Q = params->GetLWEParams()->GetQ(); int64_t q = params->GetLWEParams()->Getq().ConvertToInt(); uint32_t N = params->GetLWEParams()->GetN(); uint32_t digitsG = params->GetDigitsG(); uint32_t digitsG2 = params->GetDigitsG2(); const shared_ptr<ILNativeParams> polyParams = params->GetPolyParams(); auto result = std::make_shared<RingGSWCiphertext>(digitsG2, 2); DiscreteUniformGeneratorImpl<NativeVector> dug; dug.SetModulus(Q); // Reduce mod q (dealing with negative number as well) int64_t mm = (((m % q) + q) % q) * (2 * N / q); int64_t sign = 1; if (mm >= N) { mm -= N; sign = -1; } // tempA is introduced to minimize the number of NTTs std::vector<NativePoly> tempA(digitsG2); for (uint32_t i = 0; i < digitsG2; ++i) { // populate result[i][0] with uniform random a (*result)[i][0] = NativePoly(dug, polyParams, Format::COEFFICIENT); tempA[i] = (*result)[i][0]; // populate result[i][1] with error e (*result)[i][1] = NativePoly(params->GetLWEParams()->GetDgg(), polyParams, Format::COEFFICIENT); } for (uint32_t i = 0; i < digitsG; ++i) { if (sign > 0) { // Add G Multiple (*result)[2 * i][0][mm].ModAddEq(params->GetGPower()[i], Q); // [a,as+e] + X^m*G (*result)[2 * i + 1][1][mm].ModAddEq(params->GetGPower()[i], Q); } else { // Subtract G Multiple (*result)[2 * i][0][mm].ModSubEq(params->GetGPower()[i], Q); // [a,as+e] - X^m*G (*result)[2 * i + 1][1][mm].ModSubEq(params->GetGPower()[i], Q); } } // 3*digitsG2 NTTs are called result->SetFormat(Format::EVALUATION); for (uint32_t i = 0; i < digitsG2; ++i) { tempA[i].SetFormat(Format::EVALUATION); (*result)[i][1] += tempA[i] * skNTT; } return result; } // Encryption for the GINX variant, as described in "Bootstrapping in FHEW-like // Cryptosystems" std::shared_ptr<RingGSWCiphertext> RingGSWAccumulatorScheme::EncryptGINX( const std::shared_ptr<RingGSWCryptoParams> params, const NativePoly &skNTT, const LWEPlaintext &m) const { NativeInteger Q = params->GetLWEParams()->GetQ(); uint32_t digitsG = params->GetDigitsG(); uint32_t digitsG2 = params->GetDigitsG2(); const shared_ptr<ILNativeParams> polyParams = params->GetPolyParams(); auto result = std::make_shared<RingGSWCiphertext>(digitsG2, 2); DiscreteUniformGeneratorImpl<NativeVector> dug; dug.SetModulus(Q); // tempA is introduced to minimize the number of NTTs std::vector<NativePoly> tempA(digitsG2); for (uint32_t i = 0; i < digitsG2; ++i) { (*result)[i][0] = NativePoly(dug, polyParams, Format::COEFFICIENT); tempA[i] = (*result)[i][0]; (*result)[i][1] = NativePoly(params->GetLWEParams()->GetDgg(), polyParams, Format::COEFFICIENT); } for (uint32_t i = 0; i < digitsG; ++i) { if (m > 0) { // Add G Multiple (*result)[2 * i][0][0].ModAddEq(params->GetGPower()[i], Q); // [a,as+e] + G (*result)[2 * i + 1][1][0].ModAddEq(params->GetGPower()[i], Q); } } // 3*digitsG2 NTTs are called result->SetFormat(Format::EVALUATION); for (uint32_t i = 0; i < digitsG2; ++i) { tempA[i].SetFormat(Format::EVALUATION); (*result)[i][1] += tempA[i] * skNTT; } return result; } // wrapper for KeyGen methods RingGSWEvalKey RingGSWAccumulatorScheme::KeyGen( const std::shared_ptr<RingGSWCryptoParams> params, const std::shared_ptr<LWEEncryptionScheme> lwescheme, const std::shared_ptr<const LWEPrivateKeyImpl> LWEsk) const { if (params->GetMethod() == AP) return KeyGenAP(params, lwescheme, LWEsk); else // GINX return KeyGenGINX(params, lwescheme, LWEsk); } // Key generation as described in Section 4 of https://eprint.iacr.org/2014/816 RingGSWEvalKey RingGSWAccumulatorScheme::KeyGenAP( const std::shared_ptr<RingGSWCryptoParams> params, const std::shared_ptr<LWEEncryptionScheme> lwescheme, const std::shared_ptr<const LWEPrivateKeyImpl> LWEsk) const { const auto &LWEParams = params->GetLWEParams(); const std::shared_ptr<const LWEPrivateKeyImpl> skN = lwescheme->KeyGenN(LWEParams); RingGSWEvalKey ek; ek.KSkey = lwescheme->KeySwitchGen(LWEParams, LWEsk, skN); NativePoly skNPoly = NativePoly(params->GetPolyParams()); skNPoly.SetValues(skN->GetElement(), Format::COEFFICIENT); skNPoly.SetFormat(Format::EVALUATION); NativeInteger q = LWEParams->Getq(); NativeInteger qHalf = q >> 1; int32_t qInt = q.ConvertToInt(); uint32_t n = LWEParams->Getn(); uint32_t baseR = params->GetBaseR(); std::vector<NativeInteger> digitsR = params->GetDigitsR(); ek.BSkey = std::make_shared<RingGSWBTKey>(n, baseR, digitsR.size()); #pragma omp parallel for for (uint32_t i = 0; i < n; ++i) for (uint32_t j = 1; j < baseR; ++j) for (uint32_t k = 0; k < digitsR.size(); ++k) { int32_t signedSK; if (LWEsk->GetElement()[i] < qHalf) signedSK = LWEsk->GetElement()[i].ConvertToInt(); else signedSK = (int32_t)LWEsk->GetElement()[i].ConvertToInt() - qInt; if (LWEsk->GetElement()[i] >= qHalf) signedSK -= qInt; (*ek.BSkey)[i][j][k] = *(EncryptAP( params, skNPoly, signedSK * (int32_t)j * (int32_t)digitsR[k].ConvertToInt())); } return ek; } // Bootstrapping keys generation for the GINX variant, as described in // "Bootstrapping in FHEW-like Cryptosystems" RingGSWEvalKey RingGSWAccumulatorScheme::KeyGenGINX( const std::shared_ptr<RingGSWCryptoParams> params, const std::shared_ptr<LWEEncryptionScheme> lwescheme, const std::shared_ptr<const LWEPrivateKeyImpl> LWEsk) const { RingGSWEvalKey ek; const std::shared_ptr<const LWEPrivateKeyImpl> skN = lwescheme->KeyGenN(params->GetLWEParams()); ek.KSkey = lwescheme->KeySwitchGen(params->GetLWEParams(), LWEsk, skN); NativePoly skNPoly = NativePoly(params->GetPolyParams()); skNPoly.SetValues(skN->GetElement(), Format::COEFFICIENT); skNPoly.SetFormat(Format::EVALUATION); uint64_t q = params->GetLWEParams()->Getq().ConvertToInt(); uint32_t n = params->GetLWEParams()->Getn(); ek.BSkey = std::make_shared<RingGSWBTKey>(1, 2, n); int64_t qHalf = (q >> 1); // handles ternary secrets using signed mod 3 arithmetic; 0 -> {0,0}, 1 -> // {1,0}, -1 -> {0,1} #pragma omp parallel for for (uint32_t i = 0; i < n; ++i) { int64_t s = LWEsk->GetElement()[i].ConvertToInt(); if (s > qHalf) s -= q; switch (s) { case 0: (*ek.BSkey)[0][0][i] = *(EncryptGINX(params, skNPoly, 0)); (*ek.BSkey)[0][1][i] = *(EncryptGINX(params, skNPoly, 0)); break; case 1: (*ek.BSkey)[0][0][i] = *(EncryptGINX(params, skNPoly, 1)); (*ek.BSkey)[0][1][i] = *(EncryptGINX(params, skNPoly, 0)); break; case -1: (*ek.BSkey)[0][0][i] = *(EncryptGINX(params, skNPoly, 0)); (*ek.BSkey)[0][1][i] = *(EncryptGINX(params, skNPoly, 1)); break; default: std::string errMsg = "ERROR: only ternary secret key distributions are supported."; PALISADE_THROW(not_implemented_error, errMsg); } } return ek; } // SignedDigitDecompose is a bottleneck operation // There are two approaches to do it. // The current approach appears to give the best performance // results. The two variants are labeled A and B. void RingGSWAccumulatorScheme::SignedDigitDecompose( const std::shared_ptr<RingGSWCryptoParams> params, const std::vector<NativePoly> &input, std::vector<NativePoly> *output) const { uint32_t N = params->GetLWEParams()->GetN(); uint32_t digitsG = params->GetDigitsG(); NativeInteger Q = params->GetLWEParams()->GetQ(); NativeInteger QHalf = Q >> 1; NativeInteger::SignedNativeInt Q_int = Q.ConvertToInt(); NativeInteger::SignedNativeInt baseG = NativeInteger(params->GetBaseG()).ConvertToInt(); NativeInteger::SignedNativeInt d = 0; NativeInteger::SignedNativeInt gBits = (NativeInteger::SignedNativeInt)std::log2(baseG); // VARIANT A NativeInteger::SignedNativeInt gBitsMaxBits = NativeInteger::MaxBits() - gBits; // VARIANT B // NativeInteger::SignedNativeInt gminus1 = (1 << gBits) - 1; // NativeInteger::SignedNativeInt baseGdiv2 = // (baseG >> 1)-1; // Signed digit decomposition for (uint32_t j = 0; j < 2; j++) { for (uint32_t k = 0; k < N; k++) { NativeInteger t = input[j][k]; if (t < QHalf) d += t.ConvertToInt(); else d += (NativeInteger::SignedNativeInt)t.ConvertToInt() - Q_int; for (uint32_t l = 0; l < digitsG; l++) { // remainder is signed // This approach gives a slightly better performance // VARIANT A NativeInteger::SignedNativeInt r = d << gBitsMaxBits; r >>= gBitsMaxBits; // VARIANT B // NativeInteger::SignedNativeInt r = d & gminus1; // if (r > baseGdiv2) r -= baseG; d -= r; d >>= gBits; if (r >= 0) (*output)[j + 2 * l][k] += NativeInteger(r); else (*output)[j + 2 * l][k] += NativeInteger(r + Q_int); } d = 0; } } } // AP Accumulation as described in "Bootstrapping in FHEW-like Cryptosystems" void RingGSWAccumulatorScheme::AddToACCAP( const std::shared_ptr<RingGSWCryptoParams> params, const RingGSWCiphertext &input, std::shared_ptr<RingGSWCiphertext> acc) const { uint32_t digitsG2 = params->GetDigitsG2(); const shared_ptr<ILNativeParams> polyParams = params->GetPolyParams(); std::vector<NativePoly> ct = acc->GetElements()[0]; std::vector<NativePoly> dct(digitsG2); // initialize dct to zeros for (uint32_t i = 0; i < digitsG2; i++) dct[i] = NativePoly(polyParams, Format::COEFFICIENT, true); // calls 2 NTTs for (uint32_t i = 0; i < 2; i++) ct[i].SetFormat(Format::COEFFICIENT); SignedDigitDecompose(params, ct, &dct); // calls digitsG2 NTTs for (uint32_t j = 0; j < digitsG2; j++) dct[j].SetFormat(Format::EVALUATION); // acc = dct * input (matrix product); // uses in-place * operators for the last call to dct[i] to gain performance // improvement for (uint32_t j = 0; j < 2; j++) { (*acc)[0][j].SetValuesToZero(); for (uint32_t l = 0; l < digitsG2; l++) { if (j == 0) (*acc)[0][j] += dct[l] * input[l][j]; else (*acc)[0][j] += (dct[l] *= input[l][j]); } } } // GINX Accumulation as described in "Bootstrapping in FHEW-like Cryptosystems" void RingGSWAccumulatorScheme::AddToACCGINX( const std::shared_ptr<RingGSWCryptoParams> params, const RingGSWCiphertext &input, const NativeInteger &a, std::shared_ptr<RingGSWCiphertext> acc) const { // cycltomic order uint32_t m = 2 * params->GetLWEParams()->GetN(); uint32_t digitsG2 = params->GetDigitsG2(); int64_t q = params->GetLWEParams()->Getq().ConvertToInt(); const shared_ptr<ILNativeParams> polyParams = params->GetPolyParams(); std::vector<NativePoly> ct = acc->GetElements()[0]; std::vector<NativePoly> dct(digitsG2); // initialize dct to zeros for (uint32_t i = 0; i < digitsG2; i++) dct[i] = NativePoly(polyParams, Format::COEFFICIENT, true); // calls 2 NTTs for (uint32_t i = 0; i < 2; i++) ct[i].SetFormat(Format::COEFFICIENT); SignedDigitDecompose(params, ct, &dct); for (uint32_t j = 0; j < digitsG2; j++) dct[j].SetFormat(Format::EVALUATION); uint64_t index = a.ConvertToInt() * (m / q); // index is in range [0,m] - so we need to adjust the edge case when // index = m to index = 0 if (index == m) index = 0; const NativePoly &monomial = params->GetMonomial(index); // acc = dct * input (matrix product); // uses in-place * operators for the last call to dct[i] to gain performance // improvement for (uint32_t j = 0; j < 2; j++) { NativePoly temp1 = (j < 1) ? dct[0] * input[0][j] : (dct[0] *= input[0][j]); for (uint32_t l = 1; l < digitsG2; l++) { if (j == 0) temp1 += dct[l] * input[l][j]; else temp1 += (dct[l] *= input[l][j]); } (*acc)[0][j] += (temp1 *= monomial); } } std::shared_ptr<RingGSWCiphertext> RingGSWAccumulatorScheme::BootstrapCore( const std::shared_ptr<RingGSWCryptoParams> params, const BINGATE gate, const RingGSWEvalKey &EK, const NativeVector &a, const NativeInteger &b, const std::shared_ptr<LWEEncryptionScheme> LWEscheme) const { if ((EK.BSkey == nullptr) || (EK.KSkey == nullptr)) { std::string errMsg = "Bootstrapping keys have not been generated. Please call BTKeyGen " "before calling bootstrapping."; PALISADE_THROW(config_error, errMsg); } const shared_ptr<ILNativeParams> polyParams = params->GetPolyParams(); NativeInteger q = params->GetLWEParams()->Getq(); NativeInteger Q = params->GetLWEParams()->GetQ(); uint32_t N = params->GetLWEParams()->GetN(); uint32_t baseR = params->GetBaseR(); uint32_t n = params->GetLWEParams()->Getn(); std::vector<NativeInteger> digitsR = params->GetDigitsR(); // Specifies the range [q1,q2) that will be used for mapping uint32_t qHalf = q.ConvertToInt() >> 1; NativeInteger q1 = params->GetGateConst()[static_cast<int>(gate)]; NativeInteger q2 = q1.ModAddFast(NativeInteger(qHalf), q); // depending on whether the value is the range, it will be set // to either Q/8 or -Q/8 to match binary arithmetic NativeInteger Q8 = Q / NativeInteger(8) + 1; NativeInteger Q8Neg = Q - Q8; NativeVector m(params->GetLWEParams()->GetN(), params->GetLWEParams()->GetQ()); // Since q | (2*N), we deal with a sparse embedding of Z_Q[x]/(X^{q/2}+1) to // Z_Q[x]/(X^N+1) uint32_t factor = (2 * N / q.ConvertToInt()); for (uint32_t j = 0; j < qHalf; j++) { NativeInteger temp = b.ModSub(j, q); if (q1 < q2) m[j * factor] = ((temp >= q1) && (temp < q2)) ? Q8Neg : Q8; else m[j * factor] = ((temp >= q2) && (temp < q1)) ? Q8 : Q8Neg; } std::vector<NativePoly> res(2); // no need to do NTT as all coefficients of this poly are zero res[0] = NativePoly(polyParams, Format::EVALUATION, true); res[1] = NativePoly(polyParams, Format::COEFFICIENT, false); res[1].SetValues(std::move(m), Format::COEFFICIENT); res[1].SetFormat(Format::EVALUATION); // main accumulation computation // the following loop is the bottleneck of bootstrapping/binary gate // evaluation auto acc = std::make_shared<RingGSWCiphertext>(1, 2); (*acc)[0] = std::move(res); if (params->GetMethod() == AP) { for (uint32_t i = 0; i < n; i++) { NativeInteger aI = q.ModSub(a[i], q); for (uint32_t k = 0; k < digitsR.size(); k++, aI /= NativeInteger(baseR)) { uint32_t a0 = (aI.Mod(baseR)).ConvertToInt(); if (a0) this->AddToACCAP(params, (*EK.BSkey)[i][a0][k], acc); } } } else { // if GINX for (uint32_t i = 0; i < n; i++) { // handles -a*E(1) this->AddToACCGINX(params, (*EK.BSkey)[0][0][i], q.ModSub(a[i], q), acc); // handles -a*E(-1) = a*E(1) this->AddToACCGINX(params, (*EK.BSkey)[0][1][i], a[i], acc); } } return acc; } // Full evaluation as described in "Bootstrapping in FHEW-like // Cryptosystems" std::shared_ptr<LWECiphertextImpl> RingGSWAccumulatorScheme::EvalBinGate( const std::shared_ptr<RingGSWCryptoParams> params, const BINGATE gate, const RingGSWEvalKey &EK, const std::shared_ptr<const LWECiphertextImpl> ct1, const std::shared_ptr<const LWECiphertextImpl> ct2, const std::shared_ptr<LWEEncryptionScheme> LWEscheme) const { NativeInteger q = params->GetLWEParams()->Getq(); NativeInteger Q = params->GetLWEParams()->GetQ(); uint32_t n = params->GetLWEParams()->Getn(); uint32_t N = params->GetLWEParams()->GetN(); NativeInteger Q8 = Q / NativeInteger(8) + 1; if (ct1 == ct2) { std::string errMsg = "ERROR: Please only use independent ciphertexts as inputs."; PALISADE_THROW(config_error, errMsg); } // By default, we compute XOR/XNOR using a combination of AND, OR, and NOT // gates if ((gate == XOR) || (gate == XNOR)) { auto ct1NOT = EvalNOT(params, ct1); auto ct2NOT = EvalNOT(params, ct2); auto ctAND1 = EvalBinGate(params, AND, EK, ct1, ct2NOT, LWEscheme); auto ctAND2 = EvalBinGate(params, AND, EK, ct1NOT, ct2, LWEscheme); auto ctOR = EvalBinGate(params, OR, EK, ctAND1, ctAND2, LWEscheme); // NOT is free so there is not cost to do it an extra time for XNOR if (gate == XOR) return ctOR; else // XNOR return EvalNOT(params, ctOR); } else { NativeVector a(n, q); NativeInteger b; // the additive homomorphic operation for XOR/NXOR is different from the // other gates we compute 2*(ct1 - ct2) mod 4 for XOR, me map 1,2 -> 1 and // 3,0 -> 0 if ((gate == XOR_FAST) || (gate == XNOR_FAST)) { a = ct1->GetA() - ct2->GetA(); a += a; b = ct1->GetB().ModSubFast(ct2->GetB(), q); b.ModAddFastEq(b, q); } else { // for all other gates, we simply compute (ct1 + ct2) mod 4 // for AND: 0,1 -> 0 and 2,3 -> 1 // for OR: 1,2 -> 1 and 3,0 -> 0 a = ct1->GetA() + ct2->GetA(); b = ct1->GetB().ModAddFast(ct2->GetB(), q); } auto acc = BootstrapCore(params, gate, EK, a, b, LWEscheme); NativeInteger bNew; NativeVector aNew(N, Q); // the accumulator result is encrypted w.r.t. the transposed secret key // we can transpose "a" to get an encryption under the original secret key NativePoly temp = (*acc)[0][0]; temp = temp.Transpose(); temp.SetFormat(Format::COEFFICIENT); aNew = temp.GetValues(); temp = (*acc)[0][1]; temp.SetFormat(Format::COEFFICIENT); // we add Q/8 to "b" to to map back to Q/4 (i.e., mod 2) arithmetic. bNew = Q8.ModAddFast(temp[0], Q); auto eQN = std::make_shared<LWECiphertextImpl>(std::move(aNew), std::move(bNew)); // Key switching const std::shared_ptr<const LWECiphertextImpl> eQ = LWEscheme->KeySwitch(params->GetLWEParams(), EK.KSkey, eQN); // Modulus switching return LWEscheme->ModSwitch(params->GetLWEParams(), eQ); } } // Full evaluation as described in "Bootstrapping in FHEW-like // Cryptosystems" std::shared_ptr<LWECiphertextImpl> RingGSWAccumulatorScheme::Bootstrap( const std::shared_ptr<RingGSWCryptoParams> params, const RingGSWEvalKey &EK, const std::shared_ptr<const LWECiphertextImpl> ct1, const std::shared_ptr<LWEEncryptionScheme> LWEscheme) const { NativeInteger q = params->GetLWEParams()->Getq(); NativeInteger Q = params->GetLWEParams()->GetQ(); uint32_t n = params->GetLWEParams()->Getn(); uint32_t N = params->GetLWEParams()->GetN(); NativeInteger Q8 = Q / NativeInteger(8) + 1; NativeVector a(n, q); NativeInteger b; a = ct1->GetA(); b = ct1->GetB().ModAddFast(q >> 2, q); auto acc = BootstrapCore(params, AND, EK, a, b, LWEscheme); NativeInteger bNew; NativeVector aNew(N, Q); // the accumulator result is encrypted w.r.t. the transposed secret key // we can transpose "a" to get an encryption under the original secret key NativePoly temp = (*acc)[0][0]; temp = temp.Transpose(); temp.SetFormat(Format::COEFFICIENT); aNew = temp.GetValues(); temp = (*acc)[0][1]; temp.SetFormat(Format::COEFFICIENT); // we add Q/8 to "b" to to map back to Q/4 (i.e., mod 2) arithmetic. bNew = Q8.ModAddFast(temp[0], Q); auto eQN = std::make_shared<LWECiphertextImpl>(std::move(aNew), std::move(bNew)); // Key switching const std::shared_ptr<const LWECiphertextImpl> eQ = LWEscheme->KeySwitch(params->GetLWEParams(), EK.KSkey, eQN); // Modulus switching return LWEscheme->ModSwitch(params->GetLWEParams(), eQ); } // Evaluation of the NOT operation; no key material is needed std::shared_ptr<LWECiphertextImpl> RingGSWAccumulatorScheme::EvalNOT( const std::shared_ptr<RingGSWCryptoParams> params, const std::shared_ptr<const LWECiphertextImpl> ct) const { NativeInteger q = params->GetLWEParams()->Getq(); uint32_t n = params->GetLWEParams()->Getn(); NativeVector a(n, q); for (uint32_t i = 0; i < n; i++) a[i] = q - ct->GetA(i); NativeInteger b = (q >> 2).ModSubFast(ct->GetB(), q); return std::make_shared<LWECiphertextImpl>(std::move(a), b); } }; // namespace lbcrypto
36.689211
80
0.654231
cs854paper58
52ac0a177d59b88600e4f2ab5b7924807eee94ad
12,317
cpp
C++
HoodieScript/GameUtilities/PlayerUtilities.cpp
NamelessHoodie/HoodieScript
bc3b250af0a1c5dbf545779ba5ef11780edb299b
[ "MIT" ]
2
2021-12-16T22:53:45.000Z
2022-03-26T21:05:29.000Z
HoodieScript/GameUtilities/PlayerUtilities.cpp
NamelessHoodie/HoodieScript
bc3b250af0a1c5dbf545779ba5ef11780edb299b
[ "MIT" ]
null
null
null
HoodieScript/GameUtilities/PlayerUtilities.cpp
NamelessHoodie/HoodieScript
bc3b250af0a1c5dbf545779ba5ef11780edb299b
[ "MIT" ]
2
2022-01-13T19:27:52.000Z
2022-01-30T18:19:01.000Z
#include "pch.h" #include "PlayerUtilities.h" #include <Amir/player_network_session.h> #include "GameDebugClasses/game_data_man.h" #include "GameDebugClasses/world_chr_man.h" #include <script_runtime.h> namespace hoodie_script { void PlayerUtilities::clearInventory() { EquipGameData equipGameData = PlayerIns::getMainChr(). getPlayerGameData(). getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); auto inventoryItems = equipInventoryData.GetInventoryItems(); for (auto i = inventoryItems.begin(); i != inventoryItems.end(); i++) { auto inventoryItem = *i; if (inventoryItem.itemType != ItemParamIdPrefix::Goods) equipInventoryData.discardInventoryItems(inventoryItem.inventoryIndex, inventoryItem.quantity); else equipGameData.modifyInventoryItemQuantity(inventoryItem.inventoryIndex, -(int32_t)inventoryItem.quantity); } } void PlayerUtilities::setSheathStateNetworked(uint16_t newSheatState) { if (!PlayerIns::isMainChrLoaded()) return; auto playableCharacter = PlayerIns::getMainChr(); if (!playableCharacter.hasHkbCharacter()) return; playableCharacter.getPlayerGameData().setWeaponSheathState(newSheatState); uint16_t sheathData[2] = { newSheatState, PlayerIns::getMainChr().getForwardId() }; PlayerNetworkSession session(PlayerNetworkSession::getInstance()); session.sessionPacketSend(13, (char*)sheathData, 4); } int32_t PlayerUtilities::GetInventorySlotDurability(InventorySlot slot) { EquipGameData equipGameData = PlayerIns::getMainChr(). getPlayerGameData(). getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); auto index = equipGameData.getInventoryItemIdBySlot(slot); auto inventoryItemInternal = equipInventoryData.getInventoryItemById(index); InventoryItem inventoryItem = InventoryItem(inventoryItemInternal, index); std::cout << std::dec << "InventoryItem : Index = " << inventoryItem.inventoryIndex << ", " << "UID = " << std::hex << inventoryItem.uniqueId << ", " << "ItemId = " << std::dec << inventoryItem.itemId << ", " << "ItemType = " << std::hex << (int32_t)inventoryItem.itemType << ", " << "Quantity = " << std::dec << inventoryItem.quantity << ", " << std::hex << "Unk1 = " << inventoryItem.unknown1 << std::endl; auto gaitemIns = inventoryItem.GetGaitemInstance(); if (gaitemIns.isValid()) { return gaitemIns.getDurability(); } return 0; } void PlayerUtilities::RemoveItemFromInventoryByItemId(ItemParamIdPrefix paramIdPrefix, int32_t paramItemId) { EquipGameData equipGameData = PlayerIns::getMainChr(). getPlayerGameData(). getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); std::optional<int32_t> indexOfItem = findInventoryIdByGiveId((uint32_t)paramIdPrefix + paramItemId); if (indexOfItem.has_value()) { auto a = equipInventoryData.getInventoryItemById(indexOfItem.value()); equipInventoryData.discardInventoryItems(indexOfItem.value(), 1); } } void PlayerUtilities::ReplaceWeaponRightActiveNetworked(const int32_t& equipParamWeaponTarget, const int32_t equipParamWeaponReplacement) { if (!PlayerIns::isMainChrLoaded()) return; PlayerIns mainPlayer = PlayerIns::getMainChr(); auto rightWeaponActiveIndex = mainPlayer.getPlayerGameData().getActiveRightHandSlot(); ReplaceWeaponRightHandBySlotIndexNetworked(rightWeaponActiveIndex, equipParamWeaponTarget, equipParamWeaponReplacement); } void PlayerUtilities::ReplaceWeaponLeftActiveNetworked(const int32_t& equipParamWeaponTarget, const int32_t equipParamWeaponReplacement) { if (!PlayerIns::isMainChrLoaded()) return; PlayerIns mainPlayer = PlayerIns::getMainChr(); auto leftWeaponActiveIndex = mainPlayer.getPlayerGameData().getActiveLeftHandSlot(); ReplaceWeaponLeftHandBySlotIndexNetworked(leftWeaponActiveIndex, equipParamWeaponTarget, equipParamWeaponReplacement); } void PlayerUtilities::ReplaceWeaponLeftHandBySlotIndexNetworked(uint32_t weaponSlot, int32_t equipParamWeaponTarget, const int32_t equipParamWeaponReplacement) { int array[]{ 0,2,4 }; ReplaceWeaponByInventorySlotNetworked((InventorySlot)array[weaponSlot], ItemParamIdPrefix::Weapon, equipParamWeaponTarget, equipParamWeaponReplacement, -1); } void PlayerUtilities::ReplaceWeaponRightHandBySlotIndexNetworked(uint32_t weaponSlot, int32_t equipParamWeaponTarget, const int32_t equipParamWeaponReplacement) { int array[]{ 1,3,5 }; ReplaceWeaponByInventorySlotNetworked((InventorySlot)array[weaponSlot], ItemParamIdPrefix::Weapon, equipParamWeaponTarget, equipParamWeaponReplacement, -1); } void PlayerUtilities::ReplaceWeaponByInventorySlotNetworked(InventorySlot inventorySlot, ItemParamIdPrefix paramIdPrefix, int32_t paramItemIdTarget, int32_t paramItemIdReplacement, int32_t durability) { if (!PlayerIns::isMainChrLoaded() || !PlayerIns::getMainChr().hasPlayerGameData()) return; if (durability == -1) durability = GetInventorySlotDurability(inventorySlot); else durability = getItemMaxDurability(paramIdPrefix, paramItemIdReplacement); PlayerGameData playerGameData = GameDataMan::getInstance().getPlayerGameData(); auto sheatState = playerGameData.getWeaponSheathState(); RemoveItemFromInventoryByInventorySlot(inventorySlot, paramIdPrefix); giveItemAndEquipInInventorySlot(inventorySlot, paramIdPrefix, paramItemIdReplacement, durability); setSheathStateNetworked(sheatState); } void PlayerUtilities::ReloadC0000() { if (PlayerIns::isMainChrLoaded()) return; if (!accessMultilevelPointer<uintptr_t>(PlayerIns::getMainChr().getAddress() + 0x1F90, 0x58, 0x8, 0x1F90, 0x28, 0x10, 0x28, 0xB8)) return; WorldChrMan::reloadCharacterFiles(L"c0000"); } int32_t PlayerUtilities::getItemMaxDurability(ItemParamIdPrefix paramIdPrefix, int32_t paramItemId) { uint16_t durabilityStage; if (paramIdPrefix == ItemParamIdPrefix::Weapon) { if (hoodie_script::script_runtime::paramPatcher->GetParamEntry(L"EquipParamWeapon", paramItemId, 0xBE, &durabilityStage)) { return (int16_t)(durabilityStage); } else { return NULL; } } else if (paramIdPrefix == ItemParamIdPrefix::Protector) { if (script_runtime::paramPatcher->GetParamEntry(L"EquipParamProtector", paramItemId, 0xAC, &durabilityStage)) { std::cout << durabilityStage << std::endl; return (int16_t)(durabilityStage); } else { return NULL; } } else { return NULL; } } void PlayerUtilities::RemoveItemFromInventoryByInventorySlot(InventorySlot slot, ItemParamIdPrefix paramIdPrefix) { EquipGameData equipGameData = PlayerIns::getMainChr(). getPlayerGameData(). getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); auto index = equipGameData.getInventoryItemIdBySlot(slot); EquipItemInInventoryIfPresentOrGiveAndEquip(slot, paramIdPrefix, 110000, -1); equipInventoryData.discardInventoryItems(index, 1); } void PlayerUtilities::EquipItemInInventoryIfPresentOrGiveAndEquip(InventorySlot slot, ItemParamIdPrefix paramIdPrefix, int32_t paramItemId, int32_t durability) { if (!tryEquipItemInInventorySlot(slot, paramIdPrefix, paramItemId)) { giveItemAndEquipInInventorySlot(slot, paramIdPrefix, paramItemId, durability); } } void PlayerUtilities::unequipAllEquipment() { GameDataMan gameDataMan = GameDataMan::getInstance(); PlayerGameData playerGameData = gameDataMan.getPlayerGameData(); EquipGameData equipGameData = playerGameData.getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); for (int32_t i = 0; i <= 21; ++i) { switch (i) { case 0: case 1: case 2: case 3: case 4: case 5: EquipItemInInventoryIfPresentOrGiveAndEquip((InventorySlot)i, ItemParamIdPrefix::Weapon, 110000, -1); break; case 12: EquipItemInInventoryIfPresentOrGiveAndEquip((InventorySlot)i, ItemParamIdPrefix::Protector, 900000, -1); break; case 13: EquipItemInInventoryIfPresentOrGiveAndEquip((InventorySlot)i, ItemParamIdPrefix::Protector, 901000, -1); break; case 14: EquipItemInInventoryIfPresentOrGiveAndEquip((InventorySlot)i, ItemParamIdPrefix::Protector, 902000, -1); break; case 15: EquipItemInInventoryIfPresentOrGiveAndEquip((InventorySlot)i, ItemParamIdPrefix::Protector, 903000, -1); break; case 6: case 7: case 8: case 9: case 17: case 18: case 19: case 20: case 21: { equipGameData.equipInventoryItem((InventorySlot)i, -1); break; } default: break; } } for (int32_t i = 0; i <= 0xE; ++i) { equipGameData.equipGoodsInventoryItem((GoodsSlot)i, -1); } for (int32_t i = 1; i <= 14; ++i) { playerGameData.setSpell(i, -1); } } std::optional<int32_t> PlayerUtilities::findInventoryIdByGiveId(int32_t giveId, bool disallowEquipped) { EquipGameData equipGameData = GameDataMan::getInstance(). getPlayerGameData(). getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); std::optional<int32_t> indexOfItem; auto items = equipInventoryData.GetInventoryItems(); for (auto i = items.begin(); i != items.end(); i++) { auto item = *i; auto itemFullyQualifiedGiveId = item.itemId + (int32_t)item.itemType; if (itemFullyQualifiedGiveId == giveId) { if (disallowEquipped) if (isInventoryItemEquipped(&item)) continue; indexOfItem = item.inventoryIndex; break; } } return indexOfItem; } bool PlayerUtilities::isInventoryItemEquipped(InventoryItem* item) { GameDataMan gameDataMan = GameDataMan::getInstance(); PlayerGameData playerGameData = gameDataMan.getPlayerGameData(); EquipGameData equipGameData = playerGameData.getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); for (int32_t i = 0; i <= 5; ++i) { auto indexOfInventoryItem = equipGameData.getInventoryItemIdBySlot((InventorySlot)i); auto inventoryItemInternal = equipInventoryData.getInventoryItemById(indexOfInventoryItem); auto inventoryItem = InventoryItem(inventoryItemInternal, indexOfInventoryItem); if (inventoryItem.uniqueId == item->uniqueId) return true; } return false; } void PlayerUtilities::giveItemAndEquipInInventorySlot(InventorySlot inventorySlot, ItemParamIdPrefix paramIdPrefix, int32_t paramItemId, int32_t durability) { EquipGameData equipGameData = PlayerIns::getMainChr(). getPlayerGameData(). getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); equipInventoryData.addItem(paramIdPrefix, paramItemId, 1, durability); tryEquipItemInInventorySlot(inventorySlot, paramIdPrefix, paramItemId); } bool PlayerUtilities::tryEquipItemInInventorySlot(InventorySlot inventorySlot, ItemParamIdPrefix paramIdPrefix, int32_t paramItemId) { EquipGameData equipGameData = PlayerIns::getMainChr(). getPlayerGameData(). getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); std::optional<int32_t>indexOfItem = findInventoryIdByGiveId((uint32_t)paramIdPrefix + paramItemId, true); if (!indexOfItem.has_value()) return false; equipGameData.equipInventoryItem(inventorySlot, indexOfItem.value()); PlayerNetworkSession::queueEquipmentPacket(); return true; } void PlayerUtilities::giveGoodsAndEquipInGoodSlot(GoodsSlot goodsSlot, int32_t paramItemId, int32_t quantity) { if (!PlayerIns::isMainChrLoaded()) return; EquipGameData equipGameData = PlayerIns::getMainChr(). getPlayerGameData(). getEquipGameData(); EquipInventoryData equipInventoryData = equipGameData.getEquipInventoryData(); std::optional<int32_t> indexOfItem = findInventoryIdByGiveId((uint32_t)ItemParamIdPrefix::Goods + paramItemId); if (!indexOfItem.has_value()) { equipInventoryData.addItem(ItemParamIdPrefix::Goods, paramItemId, quantity, 0); indexOfItem = findInventoryIdByGiveId((uint32_t)ItemParamIdPrefix::Goods + paramItemId); } if (indexOfItem.has_value()) { equipGameData.equipGoodsInventoryItem(goodsSlot, indexOfItem.value()); } } }
36.548961
410
0.766177
NamelessHoodie
52acea0cd8473acad382677cc4855ea389d0c0f5
2,415
cpp
C++
CsPlugin/Source/CsCore/Public/Collision/Script/CsScriptLibrary_Collision.cpp
closedsum/core
c3cae44a177b9684585043a275130f9c7b67fef0
[ "Unlicense" ]
2
2019-03-17T10:43:53.000Z
2021-04-20T21:24:19.000Z
CsPlugin/Source/CsCore/Public/Collision/Script/CsScriptLibrary_Collision.cpp
closedsum/core
c3cae44a177b9684585043a275130f9c7b67fef0
[ "Unlicense" ]
null
null
null
CsPlugin/Source/CsCore/Public/Collision/Script/CsScriptLibrary_Collision.cpp
closedsum/core
c3cae44a177b9684585043a275130f9c7b67fef0
[ "Unlicense" ]
null
null
null
// Copyright 2017-2021 Closed Sum Games, LLC. All Rights Reserved. #include "Collision/Script/CsScriptLibrary_Collision.h" #include "CsCore.h" // Library #include "Library/CsLibrary_Property.h" #include "Object/CsLibrary_Object.h" // Cached #pragma region namespace NCsScriptLibraryCollision { namespace NCached { namespace Str { CS_DEFINE_CACHED_FUNCTION_NAME_AS_STRING(UCsScriptLibrary_Collision, Set_CollisionPreset); CS_DEFINE_CACHED_FUNCTION_NAME_AS_STRING(UCsScriptLibrary_Collision, SetFromObject_CollisionPreset); } namespace Name { const FName CollisionPreset = FName("CollisionPreset"); } } } #pragma endregion Cached UCsScriptLibrary_Collision::UCsScriptLibrary_Collision(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { } bool UCsScriptLibrary_Collision::Set_CollisionPreset(const FString& Context, UPrimitiveComponent* Component, const FCsCollisionPreset& Preset) { using namespace NCsScriptLibraryCollision::NCached; const FString& Ctxt = Context.IsEmpty() ? Str::Set_CollisionPreset : Context; return Preset.SetSafe(Ctxt, Component); } bool UCsScriptLibrary_Collision::SetFromObject_CollisionPreset(const FString& Context, UObject* Object, UPrimitiveComponent* Component) { using namespace NCsScriptLibraryCollision::NCached; const FString& Ctxt = Context.IsEmpty() ? Str::SetFromObject_CollisionPreset : Context; // Check for properties of type: FCsCollisionPreset typedef NCsProperty::FLibrary PropertyLibrary; bool Success = false; typedef FCsCollisionPreset StructType; if (StructType* ImplAsStruct = PropertyLibrary::GetStructPropertyValuePtr<StructType>(Ctxt, Object, Object->GetClass(), Name::CollisionPreset)) { return ImplAsStruct->SetSafe(Ctxt, Component); } typedef NCsObject::FLibrary ObjectLibrary; UE_LOG(LogCs, Warning, TEXT("%s: Failed to find any properties from %s for CollisionPreset."), *Ctxt, *(ObjectLibrary::PrintObjectAndClass(Object))); UE_LOG(LogCs, Warning, TEXT("%s: - Failed to get struct property of type: FCsCollisionPreset with name: CollisionPreset."), *Context); return false; } FCollisionResponseContainer UCsScriptLibrary_Collision::SetCollisionResponse(const FCollisionResponseContainer& Container, const ECollisionChannel& Channel, const ECollisionResponse& NewResponse) { FCollisionResponseContainer Copy = Container; Copy.SetResponse(Channel, NewResponse); return Copy; }
32.2
195
0.804969
closedsum
52ae0a0789fafee6a0edd5f348ab2cf6b5132ec3
2,387
cpp
C++
due/Oscilloscope/Graphs/TextWriter.cpp
cazacov/Arduino
c66de663ae4ea9424d8281f2e23e03c30f50cacb
[ "MIT" ]
24
2015-01-23T09:59:54.000Z
2022-02-25T18:55:44.000Z
due/Oscilloscope/Graphs/TextWriter.cpp
cazacov/Arduino
c66de663ae4ea9424d8281f2e23e03c30f50cacb
[ "MIT" ]
1
2015-12-17T18:53:22.000Z
2015-12-17T18:53:22.000Z
due/Oscilloscope/Graphs/TextWriter.cpp
cazacov/Arduino
c66de663ae4ea9424d8281f2e23e03c30f50cacb
[ "MIT" ]
25
2015-12-10T20:39:39.000Z
2022-02-25T18:55:01.000Z
// // // #include "TextWriter.h" void TextWriter::A(int x0, int y0) { unsigned int a[][4] = {{0,0, 0,2}, {0,2, 1,4}, {1,4, 2,2}, {2,2, 2,0}, {0,2, 2,2}}; drawLetter(x0, y0, a, sizeof(a)/sizeof(a[0])); } void TextWriter::B(int x0, int y0) { unsigned int b[][4] = {{0,0, 0,4}, {0,4, 2,3}, {2,3, 0,2}, {0,2, 2,1}, {2,1, 0,0}}; drawLetter(x0, y0, b, sizeof(b)/sizeof(b[0])); } void TextWriter::E(int x0, int y0) { unsigned int e[][4] = {{2,4, 0,4}, {0,2, 2,2}, {2,0, 0,0}, {0,0, 0,4}}; drawLetter(x0, y0, e, sizeof(e)/sizeof(e[0])); } void TextWriter::G(int x0, int y0) { unsigned int g[][4] = {{2,3, 1,4}, {1,4, 0,2}, {0,2, 1,0}, {1,0, 2,1}, {2,1, 1,1}}; drawLetter(x0, y0, g, sizeof(g)/sizeof(g[0])); } void TextWriter::H(int x0, int y0) { unsigned int h[][4] = {{0,0, 0,4}, {2,4, 2,0}, {2,2, 0,2}}; drawLetter(x0, y0, h, sizeof(h)/sizeof(h[0])); } void TextWriter::J(int x0, int y0) { unsigned int j[][4] = {{0,0, 2,0}, {2,0, 2,4}}; drawLetter(x0, y0, j, sizeof(j)/sizeof(j[0])); } void TextWriter::L(int x0, int y0) { unsigned int l[][4] = {{0,4, 0,0}, {0,0, 2,0}}; drawLetter(x0, y0, l, sizeof(l)/sizeof(l[0])); } void TextWriter::N(int x0, int y0) { unsigned int n[][4] = {{0,0, 0,4}, {0,4, 2,0}, {2,0, 2,4}}; drawLetter(x0, y0, n, sizeof(n)/sizeof(n[0])); } void TextWriter::O(int x0, int y0) { unsigned int o[][4] = {{0,0, 0,4}, {0,4, 2,4}, {2,4, 2,0}, {2,0, 0, 0}}; drawLetter(x0, y0, o, sizeof(o)/sizeof(o[0])); } void TextWriter::R(int x0, int y0) { unsigned int r[][4] = {{0,0, 0,4}, {0,4, 2,3}, {2,3, 0,2}, {0,2, 2,0}}; drawLetter(x0, y0, r, sizeof(r)/sizeof(r[0])); } void TextWriter::S(int x0, int y0) { unsigned int s[][4] = {{2,4, 0,4}, {0,4, 0,2}, {0,2, 2,2}, {2,2, 2,0}, {2,0, 0,0}}; drawLetter(x0, y0, s, sizeof(s)/sizeof(s[0])); } void TextWriter::T(int x0, int y0) { unsigned int t[][4] = {{0,4, 2,4}, {1,4, 1,0}}; drawLetter(x0, y0, t, sizeof(t)/sizeof(t[0])); } void TextWriter::U(int x0, int y0) { unsigned int u[][4] = {{0,4, 0,0}, {0,0, 2,0}, {2,0, 2,4}}; drawLetter(x0, y0, u, sizeof(u)/sizeof(u[0])); } void TextWriter::drawLetter(int x0, int y0, unsigned int coordinates[][4], int lineCount) { for (int i = 0; i < lineCount; i++) { CanvasInt.line( (x0 + coordinates[i][0]) << 5, (y0 + coordinates[i][1]) << 5, (x0 + coordinates[i][2]) << 5, (y0 + coordinates[i][3]) << 5); } }
20.401709
89
0.525765
cazacov
52b0c5fddbc72d1cfdf2f12c76e627731bdf1de6
1,771
cpp
C++
Templates/Dominator Tree.cpp
Shefin-CSE16/Competitive-Programming
7c792081ae1d4b7060893165de34ffe7b9b7caed
[ "MIT" ]
5
2020-10-03T17:15:26.000Z
2022-03-29T21:39:22.000Z
Templates/Dominator Tree.cpp
Shefin-CSE16/Competitive-Programming
7c792081ae1d4b7060893165de34ffe7b9b7caed
[ "MIT" ]
null
null
null
Templates/Dominator Tree.cpp
Shefin-CSE16/Competitive-Programming
7c792081ae1d4b7060893165de34ffe7b9b7caed
[ "MIT" ]
1
2021-03-01T12:56:50.000Z
2021-03-01T12:56:50.000Z
/* * Dominator Tree Implementation * Source node of the DAG is the root of the Tree. * If any Ancestor of u is removed, u will be disconnected from the source in the DAG. * If u is removed, all the nodes in the subtree of u will be disconnected from the source in the DAG. */ const ll sz = 1e5 + 10, LN = 18; vector <ll> dag[sz], par[sz], dom[sz], tops; ll depth[sz], pa[LN][sz]; /* * dag : stores the DAG * dom : stores the Dominator Tree * par[u] : direct parent of u in the DAG * tops : stores the ascending topsort order of the DAG */ ll LCA(ll u, ll v) { if(depth[u] < depth[v]) swap(u,v); ll diff = depth[u] - depth[v]; for(ll i = 0; i < LN; i++) if( (diff>>i)&1 ) u = pa[i][u]; if(u == v) return u; for(ll i = LN-1; i >= 0; i--) { if(pa[i][u] != pa[i][v]) { u = pa[i][u]; v = pa[i][v]; } } return pa[0][u]; } // Add the node u to the Dominator Tree void add_node(ll u, ll p) { // Updating the Sparse Table pa[0][u] = p; for(ll i = 1; i < LN; i++) if(pa[i-1][u] != -1) pa[i][u] = pa[i-1][ pa[i-1][u] ]; depth[u] = (p==-1)? 0 : depth[p] + 1; if(p != -1) dom[p].push_back(u); } void build_dominator_tree() { for(ll &u : tops) { if(par[u].empty()) { add_node(u, -1); continue; } ll lca = par[u][0]; for(ll &p : par[u]) lca = LCA(lca, p); add_node(u, lca); } } void init(ll n) { for(ll i=1; i<=n; i++) { dag[i].clear(), par[i].clear(); dom[i].clear(); for(ll j=0; j<LN; j++) pa[j][i] = -1; } tops.clear(); } // init(n); // Traverse the DAG and do the necessary things. // build_dominator_tree(); to build the tree
22.417722
62
0.5048
Shefin-CSE16
52b1ca8c73dc8646e7a93a4a43dd64cafefe1c5c
626
cpp
C++
src/ScalingModules.cpp
Humhu/modprop
0cff8240d5e1522f620de8004c22a74491a0c9fb
[ "AFL-3.0" ]
1
2017-11-10T00:54:53.000Z
2017-11-10T00:54:53.000Z
src/ScalingModules.cpp
Humhu/modprop
0cff8240d5e1522f620de8004c22a74491a0c9fb
[ "AFL-3.0" ]
null
null
null
src/ScalingModules.cpp
Humhu/modprop
0cff8240d5e1522f620de8004c22a74491a0c9fb
[ "AFL-3.0" ]
null
null
null
#include "modprop/compo/ScalingModules.h" namespace argus { ScalingModule::ScalingModule() : _fS( 1.0 ), _bS( 1.0 ), _input( *this ), _output( *this ) { RegisterInput( &_input ); RegisterOutput( &_output ); } void ScalingModule::SetForwardScale( double s ) { _fS = s; } void ScalingModule::SetBackwardScale( double s ) { _bS = s; } void ScalingModule::Foreprop() { _output.Foreprop( _fS * _input.GetValue() ); } void ScalingModule::Backprop() { _input.Backprop( _bS * _output.GetBackpropValue() ); } InputPort& ScalingModule::GetInput() { return _input; } OutputPort& ScalingModule::GetOutput() { return _output; } }
22.357143
61
0.704473
Humhu
52b2dbabe4832e3e3240b827e44c4c3c4d45b8a8
1,756
cpp
C++
PressureEngineCore/Src/Graphics/Particles/ParticleMaster.cpp
Playturbo/PressureEngine
6b023165fcaecb267e13cf5532ea26a8da3f1450
[ "MIT" ]
1
2017-09-13T13:29:27.000Z
2017-09-13T13:29:27.000Z
PressureEngineCore/Src/Graphics/Particles/ParticleMaster.cpp
Playturbo/PressureEngine
6b023165fcaecb267e13cf5532ea26a8da3f1450
[ "MIT" ]
null
null
null
PressureEngineCore/Src/Graphics/Particles/ParticleMaster.cpp
Playturbo/PressureEngine
6b023165fcaecb267e13cf5532ea26a8da3f1450
[ "MIT" ]
1
2019-01-18T07:16:59.000Z
2019-01-18T07:16:59.000Z
#include "ParticleMaster.h" namespace Pressure { std::map<ParticleTexture, std::list<Particle>> ParticleMaster::s_Particles; std::unique_ptr<ParticleRenderer> ParticleMaster::s_Renderer = nullptr; void ParticleMaster::init(Loader& loader, GLFWwindow* window) { s_Renderer = std::make_unique<ParticleRenderer>(loader, Matrix4f().createProjectionMatrix(window)); } void ParticleMaster::tick(Camera& camera) { // Creates a loop that loop through all elements in all the lists in the map. auto map = s_Particles.begin(); while (map != s_Particles.end()) { bool empty = false; auto& list = map->second; auto particle = list.begin(); while (particle != list.end()) { if (!particle->isAlive(camera)) { particle = list.erase(particle); empty = list.size() == 0; } else particle++; } if (!map->first.isUseAdditiveBlending()) list.sort(sort_particles); if (empty) map = s_Particles.erase(map); else map++; } } void ParticleMaster::renderParticles(Camera& camera) { s_Renderer.get()->render(s_Particles, camera); } void ParticleMaster::cleanUp() { s_Renderer.get()->cleanUp(); } void ParticleMaster::addParticle(Particle& particle) { // Creates new list if it does not exist, else grabs existing one. auto it = s_Particles.find(particle.getTexture()); if (it == s_Particles.end()) s_Particles.emplace(particle.getTexture(), std::list<Particle>({ particle })); else it->second.emplace_front(particle); } void ParticleMaster::updateProjectionMatrix(Window& window) { s_Renderer->updateProjectionMatrix(window); } bool ParticleMaster::sort_particles(const Particle& left, const Particle& right) { return left.getDistance() > right.getDistance(); } }
27.4375
101
0.699886
Playturbo
52b2fdf2ce67c3f0b97c874549a2661d671b6dc4
1,393
cpp
C++
src/argos_lib/cpp/subsystems/swappable_controllers_subsystem.cpp
FRC1756-Argos/ArgosLib-Cpp
bd6f50329b9ddd1e603ee520b54c60d65f4fb6e7
[ "BSD-3-Clause" ]
null
null
null
src/argos_lib/cpp/subsystems/swappable_controllers_subsystem.cpp
FRC1756-Argos/ArgosLib-Cpp
bd6f50329b9ddd1e603ee520b54c60d65f4fb6e7
[ "BSD-3-Clause" ]
null
null
null
src/argos_lib/cpp/subsystems/swappable_controllers_subsystem.cpp
FRC1756-Argos/ArgosLib-Cpp
bd6f50329b9ddd1e603ee520b54c60d65f4fb6e7
[ "BSD-3-Clause" ]
null
null
null
/// \copyright Copyright (c) Argos FRC Team 1756. /// Open Source Software; you can modify and/or share it under the terms of /// the license file in the root directory of this project. #include "argos_lib/subsystems/swappable_controllers_subsystem.h" using namespace argos_lib; SwappableControllersSubsystem::SwappableControllersSubsystem(int driverControllerPort, int operatorControllerPort) : m_driverController(driverControllerPort), m_operatorController(operatorControllerPort), m_swapped(false) {} void SwappableControllersSubsystem::Swap() { m_driverController.SwapSettings(m_operatorController); m_swapped = !m_swapped; } XboxController& SwappableControllersSubsystem::DriverController() { return m_swapped ? m_operatorController : m_driverController; } XboxController& SwappableControllersSubsystem::OperatorController() { return m_swapped ? m_driverController : m_operatorController; } /** * Will be called periodically whenever the CommandScheduler runs. */ void SwappableControllersSubsystem::Periodic() { UpdateVibration(); } void SwappableControllersSubsystem::VibrateAll(VibrationModel newModel) { m_driverController.SetVibration(newModel); m_operatorController.SetVibration(newModel); } void SwappableControllersSubsystem::UpdateVibration() { m_driverController.UpdateVibration(); m_operatorController.UpdateVibration(); }
34.825
114
0.803302
FRC1756-Argos
52b64a8477f85d51f197e22e247e5e5eca124c96
952
cpp
C++
arrays/array_basics2.cpp
neerajsingh869/data-structures-and-algorithms
96087e68fdce743f90f75228af1c7d111f6b92b7
[ "MIT" ]
null
null
null
arrays/array_basics2.cpp
neerajsingh869/data-structures-and-algorithms
96087e68fdce743f90f75228af1c7d111f6b92b7
[ "MIT" ]
null
null
null
arrays/array_basics2.cpp
neerajsingh869/data-structures-and-algorithms
96087e68fdce743f90f75228af1c7d111f6b92b7
[ "MIT" ]
null
null
null
#include <iostream> #include <queue> using namespace std; void changes(int arr[], int n) { for (int i = 0; i < n; i++) { arr[i] = 10; } } int main() { int nums[] = {0, 1, 2, 3, 4, 5, 6, 7}; int n = sizeof(nums) / sizeof(nums[0]); // Before calling changes() for (int i = 0; i < n; i++) { cout << nums[i] << " "; } /* nums behaves like a pointer because it stores the adress of nums[0]. So if you have passed it to other function as argument, then it is call by reference.*/ changes(nums, n); cout <<"\n"<< nums << endl; // after calling changes() for (int i = 0; i < n; i++) { cout << nums[i] << " "; } // CONCLUSION /*So, if you don't want to make changes/modifications in original array, then first decalare another array, copy the original array elements in it and then pass the other array as arguments of the function*/ return 0; }
26.444444
86
0.563025
neerajsingh869
52b893a2537b9a4a29562dc015d3ad4b7f1ec5c1
576
cc
C++
src/math/Vector2.cc
shawndfl/game-sample
1937f4efb98e1ea5cc4f1124ba611b9626182d57
[ "MIT" ]
null
null
null
src/math/Vector2.cc
shawndfl/game-sample
1937f4efb98e1ea5cc4f1124ba611b9626182d57
[ "MIT" ]
null
null
null
src/math/Vector2.cc
shawndfl/game-sample
1937f4efb98e1ea5cc4f1124ba611b9626182d57
[ "MIT" ]
null
null
null
/* * Vector2.cc * * Created on: Aug 30, 2020 * Author: sdady */ #include "Vector2.h" #include "glad/glad.h" namespace bsk { /*************************************************/ Vector2::Vector2(): x(0), y(0) { } /*************************************************/ Vector2::Vector2(float x, float y) { this->x = x; this->y = y; } /*************************************************/ Vector2::~Vector2() { } /*************************************************/ void Vector2::setUniform(int name) const { glUniform2f(name, x, y); } } /* namespace bsk */
16.941176
51
0.369792
shawndfl
52b977559d59cd9245e09c35092a75cf4571f623
320
cpp
C++
src/h5viewer/main.cpp
martyngigg/h5view
2ab16840e0be132aca60f2815e9d45fab74c9ab1
[ "MIT" ]
null
null
null
src/h5viewer/main.cpp
martyngigg/h5view
2ab16840e0be132aca60f2815e9d45fab74c9ab1
[ "MIT" ]
3
2019-10-28T20:42:34.000Z
2020-03-08T09:38:54.000Z
src/h5viewer/main.cpp
martyngigg/h5view
2ab16840e0be132aca60f2815e9d45fab74c9ab1
[ "MIT" ]
null
null
null
#include <iostream> #include "h5view/h5view.hpp" using std::cerr; using std::cout; using h5view::first_object_name; int main(int argc, char **argv) { if(argc != 2) { cerr << "Usage: h5viewer filepath\n"; return 1; } std::cout << "First object name=" << first_object_name(argv[1]) << "\n"; return 0; }
18.823529
74
0.634375
martyngigg
52bba4b8a518acc0a303c2268558f9f7a9a5d643
3,530
cpp
C++
app/src/render/render_image.cpp
shuyanglin/antimony-interactive
4787dea233c62015babb0da5e299d9f41d500905
[ "MIT", "Unlicense" ]
null
null
null
app/src/render/render_image.cpp
shuyanglin/antimony-interactive
4787dea233c62015babb0da5e299d9f41d500905
[ "MIT", "Unlicense" ]
null
null
null
app/src/render/render_image.cpp
shuyanglin/antimony-interactive
4787dea233c62015babb0da5e299d9f41d500905
[ "MIT", "Unlicense" ]
null
null
null
#include <Python.h> #include <QCoreApplication> #include "render/render_image.h" #include "ui/viewport/depth_image.h" #include "fab/types/shape.h" #include "fab/util/region.h" #include "fab/tree/render.h" #include "fab/formats/png.h" RenderImage::RenderImage(Bounds b, QVector3D pos, float scale) : QObject(), bounds(b), pos(pos), scale(scale), depth((b.xmax - b.xmin) * scale, (b.ymax - b.ymin) * scale, QImage::Format_RGB32), shaded(depth.width(), depth.height(), depth.format()), halt_flag(0), color(255, 255, 255), flat(false) { // Nothing to do here // (render() must be called explicity) } void RenderImage::halt() { halt_flag = true; } static void processEvents() { QCoreApplication::processEvents(); } void RenderImage::render(Shape *shape) { depth.fill(0x000000); uint16_t* d16(new uint16_t[depth.width() * depth.height()]); uint16_t** d16_rows(new uint16_t*[depth.height()]); uint8_t (*s8)[3] = new uint8_t[depth.width() * depth.height()][3]; uint8_t (**s8_rows)[3] = new decltype(s8)[depth.height()]; for (int i=0; i < depth.height(); ++i) { d16_rows[i] = &d16[depth.width() * i]; s8_rows[i] = &s8[depth.width() * i]; } memset(d16, 0, depth.width() * depth.height() * 2); memset(s8, 0, depth.width() * depth.height() * 3); Region r = (Region) { .imin=0, .jmin=0, .kmin=0, .ni=(uint32_t)depth.width(), .nj=(uint32_t)depth.height(), .nk=uint32_t(fmax(1, (shape->bounds.zmax - shape->bounds.zmin) * scale)) }; build_arrays(&r, shape->bounds.xmin, shape->bounds.ymin, shape->bounds.zmin, shape->bounds.xmax, shape->bounds.ymax, shape->bounds.zmax); render16(shape->tree.get(), r, d16_rows, &halt_flag, &processEvents); shaded8(shape->tree.get(), r, d16_rows, s8_rows, &halt_flag, &processEvents); free_arrays(&r); // Copy from bitmap arrays into a QImage for (int j=0; j < depth.height(); ++j) { for (int i=0; i < depth.width(); ++i) { uint8_t pix = d16_rows[j][i] >> 8; uint8_t* norm = s8_rows[j][i]; if (pix) { depth.setPixel(i, depth.height() - j - 1, pix | (pix << 8) | (pix << 16)); shaded.setPixel(i, depth.height() - j - 1, norm[0] | (norm[1] << 8) | (norm[2] << 16)); } } } delete [] s8; delete [] s8_rows; delete [] d16; delete [] d16_rows; } void RenderImage::applyGradient(bool direction) { for (int j=0; j < depth.height(); ++j) { for (int i=0; i < depth.width(); ++i) { uint8_t pix = depth.pixel(i, j) & 0xff; if (pix) { if (direction) pix *= j / float(depth.height()); else pix *= 1 - j / float(depth.height()); depth.setPixel(i, j, pix | (pix << 8) | (pix << 16)); } } } } void RenderImage::setNormals(float xy, float z) { shaded.fill((int(z * 255) << 16) | int(xy * 255)); } DepthImageItem* RenderImage::addToViewport(Viewport* viewport) { return new DepthImageItem(pos, QVector3D(bounds.xmax - bounds.xmin, bounds.ymax - bounds.ymin, bounds.zmax - bounds.zmin), depth, shaded, color, flat, viewport); }
28.699187
81
0.530312
shuyanglin
52bc0b38a7df65353149b6d577f1874c98f1a1ff
1,080
cpp
C++
svgimageprovider.cpp
user1095108/qtnanosvg
9260ed11c9ba7d711e87110723e11e0c5eb706e4
[ "Unlicense" ]
2
2021-09-07T04:33:48.000Z
2022-01-08T07:28:42.000Z
svgimageprovider.cpp
user1095108/qtnanosvg
9260ed11c9ba7d711e87110723e11e0c5eb706e4
[ "Unlicense" ]
1
2021-10-14T10:56:14.000Z
2021-10-14T10:56:14.000Z
svgimageprovider.cpp
user1095108/qtnanosvg
9260ed11c9ba7d711e87110723e11e0c5eb706e4
[ "Unlicense" ]
null
null
null
#include <QFile> #include <QPainter> #include "qtnanosvg.hpp" #include "nanosvg/src/nanosvg.h" #include "svgimageprovider.hpp" ////////////////////////////////////////////////////////////////////////////// SVGImageProvider::SVGImageProvider(): QQuickImageProvider(QQmlImageProviderBase::Pixmap) { } ////////////////////////////////////////////////////////////////////////////// QPixmap SVGImageProvider::requestPixmap(QString const& id, QSize* sz, QSize const& rs) { QPixmap pixmap(*sz = rs); // if (QFile f(id); !rs.isEmpty() && f.open(QIODevice::ReadOnly)) { if (auto const sz(f.size()); sz) { QByteArray ba; ba.resize(sz + 1); if (f.read(ba.data(), sz) == sz) { ba.back() = {}; if (auto const nsi(nsvgParse(ba.data(), "px", 96)); nsi) { pixmap.fill(Qt::transparent); QPainter p(&pixmap); p.setRenderHint(QPainter::Antialiasing, true); drawSVGImage(&p, nsi, rs.width(), rs.height()); nsvgDelete(nsi); } } } } return pixmap; }
21.176471
78
0.496296
user1095108
1ebf0d559227f711f3d9cdecb096fb85ef3cc9cb
13,382
cpp
C++
gcpp/classes/ogetoptv.cpp
razzlefratz/MotleyTools
3c69c574351ce6f4b7e687c13278d4b6cbb200f3
[ "0BSD" ]
2
2015-10-15T19:32:42.000Z
2021-12-20T15:56:04.000Z
gcpp/classes/ogetoptv.cpp
razzlefratz/MotleyTools
3c69c574351ce6f4b7e687c13278d4b6cbb200f3
[ "0BSD" ]
null
null
null
gcpp/classes/ogetoptv.cpp
razzlefratz/MotleyTools
3c69c574351ce6f4b7e687c13278d4b6cbb200f3
[ "0BSD" ]
null
null
null
/*====================================================================* * * ogetoptv.cpp - implementation of the ogetoptv class. * * this is a posix compliant getoptv() function that supports absolutely * no extensions; visit the posix webpage that specifies this function * to learn more; * * <http://www.opengroup.org/onlinepubs/007904975/functions/getopt.html> * * we implemented this function to make console programs for windows and * debian linux act the same; microsoft c++ would not compile the debian * version of getoptv and after trying to fix it we decided to start over; * * this function conforms to posix standard in that it does not support * gnu style extensions such as "--option" for arguments or "ab::c" for * options strings; if you don't know what that means then you probably * won't care either; you should not implement these extentions, anyway; * * the posix standard says that command line options and their operands * must precede all other arguments; we find this restrictive and allow * option arguments to appear anywhere; this implementation re-arranges * a non-compliant argv[] to be posix compliant on completion; * * we have defined characters, instead of coding them, so that microsoft * folks can change '-' to '/' but preserve the posix behaviour; * * this implementation calls no functions and so there should not be any * problem with external declarations; a posix compliant unistd.h should * be enough; or use our getoptv.h as an alternative; or you can add the * following declarations in a header file, somwhere: * * extern char * optarg; * extern int optopt; * extern int optind; * extern int opterr; * * this implementation resets when you call it with optind=0 or optind=1; * the 0 is gnu/debian compliant and the 1 is posix compliant; after that * it runs to completion, unless you reset optind; * * the posix site does an excellent job of defining function behaviour and * illustrating its use; if you have questions, see them; you can also cut * and paste this c language code segment to get you started; * * ogetoptv options; * signed c; * optind = 1; * opterr = 1; * while ((c = options.getoptv(argc, argv, ":ab:c")) != -1) * { * switch(c) * { * case 'a': // optopt is 'a' * case 'b': // optopt is 'b'; optarg is string; * * case ':': // optopt is legal but no operand so optarg is null; * case '?': // optopt is illegal and optarg is null; * default: // valid options having no 'case' code; * } * } * * while (options.optind < argc) * { * // do stuff to argv[options.optind++]. * } * *. Motley Tools by Charles Maier *: Published 1982-2005 by Charles Maier for personal use *; Licensed under the Internet Software Consortium License * *--------------------------------------------------------------------*/ #ifndef oGETOPTV_SOURCE #define oGETOPTV_SOURCE /*====================================================================* * custom header files; *--------------------------------------------------------------------*/ #include <iostream> #include <cstring> #include <cstdlib> /*====================================================================* * custom source files; *--------------------------------------------------------------------*/ #include "../classes/ogetoptv.hpp" #include "../classes/oputoptv.hpp" #include "../classes/oversion.hpp" /*====================================================================* * program variables; *--------------------------------------------------------------------*/ char const * program_name = PACKAGE; /*====================================================================* * * signed opterr () const; * * return the error message flag state; * *--------------------------------------------------------------------*/ signed ogetoptv::opterr () const { return (this->mopterr); } /*====================================================================* * * ogetoptv & opterr (signed opterr); * * set the error message flag state; * *--------------------------------------------------------------------*/ ogetoptv & ogetoptv::opterr (signed opterr) { this->mopterr = opterr; return (* this); } /*====================================================================* * * signed optmin () const; * * return the minimum argument flag state; * *--------------------------------------------------------------------*/ signed ogetoptv::optmin () const { return (this->moptmin); } /*====================================================================* * * ogetoptv & optmin (signed optmin); * * set the minimum argument flag state; * *--------------------------------------------------------------------*/ ogetoptv & ogetoptv::optmin (signed optmin) { this->moptmin = optmin; return (* this); } /*====================================================================* * * signed optind () const; * * return the index of the next argv[] string; this index defines the * start address for the remainder of argument vector argv[]; * *--------------------------------------------------------------------*/ signed ogetoptv::optind () const { return (this->moptind); } /*====================================================================* * * ogetoptv & optind (signed optind); * * set the index of the next argv[] string; * *--------------------------------------------------------------------*/ ogetoptv & ogetoptv::optind (signed optind) { this->moptind = optind; return (* this); } /*====================================================================* * * signed optopt () const; * * return the value of the option character; * *--------------------------------------------------------------------*/ signed ogetoptv::optopt () const { return (this->moptopt); } /*====================================================================* * * char const * optarg () const; * * return a pointer to the option string; * *--------------------------------------------------------------------*/ char const * ogetoptv::optarg () const { return (this->moptarg); } /*====================================================================* * * signed argc () const; * * return the number of arguments left in argv; it is computed by * subtracting member mpotind from member margc; it can eliminate * the need for the customary "argc-=optind" statement; * *--------------------------------------------------------------------*/ signed ogetoptv::argc () const { return (this->margc - this->moptind); } /*====================================================================* * * char const ********************************************************************** argv () const; * * return the start address of the unprocessed portions of argv []; * *--------------------------------------------------------------------*/ char const ** ogetoptv::argv () const { return (this->margv + this->moptind); } /*====================================================================* * * char const * args () const; * * return option argument string address; * *--------------------------------------------------------------------*/ char const * ogetoptv::args () { return (this->moptarg); } /*====================================================================* * * signed operator++ (signed); * * return the value of member moptind and increment optind if less * than margc; this is not a posix feature; it is an extension; * *--------------------------------------------------------------------*/ signed ogetoptv::operator++ (signed) { return (this->moptind < this->margc? this->moptind++: this->moptind); } /*====================================================================* * * signed getoptv (int argc, char const * argv[], char const * optv []); * * *--------------------------------------------------------------------*/ signed ogetoptv::getoptv (int argc, char const * argv [], char const * optv []) { extern char const * program_name; char const ** action; char const * option; if ((this->moptind == 0) || (this->moptind == 1)) { this->margc = argc; this->margv = argv; for (program_name = this->mstring = * this->margv; * this->mstring; this->mstring++) { if ((* this->mstring == '/') || (* this->mstring == '\\')) { program_name = this->mstring + 1; } } this->mstring = (char *) (0); oversion::program (program_name); if (this->margc == this->moptmin) { oputoptv::putoptv (optv); std::exit (0); } this->mcount = this->moptind = 1; } optv++; optv++; while ((this->mcount < this->margc) || (this->mstring)) { if (this->mstring) { if (* this->mstring) { this->moptopt = * this->mstring++; this->moptarg = (char *) (0); #if 1 /* * This block is eseentially oputoptv::putopt(); */ for (option = * optv++; * option; option++) { if (* option == ':') { continue; } for (action = optv; * action; action++) { if (* option == ** action) { break; } } if (* action) { continue; } std::cerr << program_name << ": option '" << * option << "' has no description" << std::endl; } for (action = optv--; * action; action++) { for (option = * optv; * option; option++) { if (* option == ':') { continue; } if (* option == ** action) { break; } } if (* option) { continue; } std::cerr << program_name << ": description \"" << * action << "\" has no option" << std::endl; } #endif for (option = * optv; * option; option++) { if (this->moptopt == oGETOPTV_C_OPERAND) { continue; } if (* option == oGETOPTV_C_OPERAND) { continue; } if (* option == this->moptopt) { if (* ++ option != oGETOPTV_C_OPERAND) { return (this->moptopt); } if (* this->mstring) { this->moptarg = this->mstring; this->mstring = (char *) (0); return (this->moptopt); } if (this->mcount < this->margc) { this->moptarg = argv [this->mcount]; for (this->mindex = this->mcount++; this->mindex > this->moptind; -- this->mindex) { argv [this->mindex] = argv [this->mindex -1]; } argv [this->moptind++] = this->moptarg; return (this->moptopt); } if (this->mopterr) { std::cerr << program_name << ": option '" << (char) (this->moptopt) << "' has no operand" << std::endl; std::exit (this->mopterr); } if (** optv == oGETOPTV_C_OPERAND) { return (oGETOPTV_C_OPERAND); } return (oGETOPTV_C_ILLEGAL); } } if (this->mopterr) { std::cerr << program_name << ": option '" << (char) (this->moptopt) << "' has no meaning" << std::endl; std::exit (this->mopterr); } return (oGETOPTV_C_ILLEGAL); } this->mstring = (char *) (0); } if (this->mcount < this->margc) { this->mstring = this->margv [this->mcount]; if (* this->mstring == oGETOPTV_C_OPTIONS) { for (this->mindex = this->mcount; this->mindex > this->moptind; -- this->mindex) { this->margv [this->mindex] = this->margv [this->mindex -1]; } this->margv [this->moptind++] = this->mstring++; if (* this->mstring == oGETOPTV_C_OPTIONS) { if (! * ++ this->mstring) { this->moptarg = (char *) (0); this->moptopt = (char) (0); return (-1); } if (! std::strcmp (this->mstring, "version")) { oversion::print (); std::exit (0); } if (! std::strcmp (this->mstring, "help")) { optv--; optv--; oputoptv::putoptv (optv); std::exit (0); } this->mstring = (char *) (0); continue; } if (* this->mstring == oGETOPTV_C_VERSION) { oversion::print (); std::exit (0); } if (* this->mstring == oGETOPTV_C_SUMMARY) { optv--; optv--; oputoptv::putoptv (optv); std::exit (0); } } else { this->mstring = (char *) (0); } this->mcount++; } } this->moptarg = (char *) (0); this->moptopt = (char) (0); return (-1); } /*====================================================================* * * ogetoptv (); * *--------------------------------------------------------------------*/ ogetoptv::ogetoptv () { this->margs = new char [1]; this->margs [0] = (char) (0); this->moptarg = (char *) (0); this->moptopt = (char) (0); this->mopterr = 1; this->moptind = 1; this->moptmin = 0; return; } /*====================================================================* * * ~ogetoptv (); * *--------------------------------------------------------------------*/ ogetoptv::~ ogetoptv () { delete [] this->margs; this->moptarg = (char *) (0); this->moptopt = (char) (0); return; } /*====================================================================* * end implementation *--------------------------------------------------------------------*/ #endif
25.833977
110
0.453445
razzlefratz
1ebf66414def2e973c747bbf7321d75a8990a1b0
913
cpp
C++
Source/Bld.cpp
brigaudet/ERF
8277e9bdfff5590f9c208ac3dc9a4f38f1d7f556
[ "BSD-3-Clause-LBNL" ]
3
2020-11-05T19:41:55.000Z
2021-04-23T01:00:17.000Z
Source/Bld.cpp
brigaudet/ERF
8277e9bdfff5590f9c208ac3dc9a4f38f1d7f556
[ "BSD-3-Clause-LBNL" ]
98
2021-02-03T21:55:22.000Z
2022-03-31T05:14:42.000Z
Source/Bld.cpp
brigaudet/ERF
8277e9bdfff5590f9c208ac3dc9a4f38f1d7f556
[ "BSD-3-Clause-LBNL" ]
12
2020-11-02T04:55:38.000Z
2021-11-12T22:42:57.000Z
#include <AMReX_LevelBld.H> #include "ERF.H" class ERFBld : public amrex::LevelBld { virtual void variableSetUp(); virtual void variableCleanUp(); virtual amrex::AmrLevel* operator()(); virtual amrex::AmrLevel* operator()( amrex::Amr& papa, int lev, const amrex::Geometry& level_geom, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, amrex::Real time); }; ERFBld ERF_bld; amrex::LevelBld* getLevelBld() { return &ERF_bld; } void ERFBld::variableSetUp() { ERF::variableSetUp(); } void ERFBld::variableCleanUp() { ERF::variableCleanUp(); } amrex::AmrLevel* ERFBld::operator()() { return new ERF; } amrex::AmrLevel* ERFBld::operator()( amrex::Amr& papa, int lev, const amrex::Geometry& level_geom, const amrex::BoxArray& ba, const amrex::DistributionMapping& dm, amrex::Real time) { return new ERF(papa, lev, level_geom, ba, dm, time); }
16.303571
54
0.683461
brigaudet
1ec07297de92bed7558c678b21e7a15f83bfa95a
2,637
cpp
C++
Cpp/126.word-ladder-ii.cpp
zszyellow/leetcode
2ef6be04c3008068f8116bf28d70586e613a48c2
[ "MIT" ]
1
2015-12-19T23:05:35.000Z
2015-12-19T23:05:35.000Z
Cpp/126.word-ladder-ii.cpp
zszyellow/leetcode
2ef6be04c3008068f8116bf28d70586e613a48c2
[ "MIT" ]
null
null
null
Cpp/126.word-ladder-ii.cpp
zszyellow/leetcode
2ef6be04c3008068f8116bf28d70586e613a48c2
[ "MIT" ]
null
null
null
class Solution { public: vector<vector<string>> findLadders(string beginWord, string endWord, vector<string>& wordList) { vector<vector<string>> res; if (std::find(wordList.begin(), wordList.end(), endWord) == wordList.end()) return res; // preprocessing int L = beginWord.size(); unordered_map<string, vector<string>> combo_dict; for (string &word : wordList) { for (int i = 0; i < L; ++ i) { string pattern = string(word.begin(), word.begin()+i) + "*" + string(word.begin()+i+1, word.end()); if (combo_dict.find(pattern) == combo_dict.end()) combo_dict[pattern] = vector<string>{word}; else combo_dict[pattern].push_back(word); } } // bfs through path not word queue<vector<string>> q; q.push({beginWord}); unordered_set<string> visited; visited.insert(beginWord); unordered_set<string> unvisited_cur_level(wordList.begin(), wordList.end()); vector<string> sequence; int min_level = INT_MAX; int level = 0; while (!q.empty()) { auto path = q.front(); q.pop(); if (path.size() > level) { if (path.size() > min_level) break; else { level = path.size(); for (auto &v : visited) { unvisited_cur_level.erase(v); } } } string cur_word = path.back(); for (int i = 0; i < L; ++ i) { string pattern = string(cur_word.begin(), cur_word.begin()+i) + "*" + string(cur_word.begin()+i+1, cur_word.end()); if (combo_dict.find(pattern) != combo_dict.end()) { for (string &next_word : combo_dict[pattern]) { vector<string> new_path(path); if (next_word == endWord) { min_level = level; new_path.push_back(endWord); res.push_back(new_path); } else if (unvisited_cur_level.find(next_word) != unvisited_cur_level.end()) { visited.insert(next_word); new_path.push_back(next_word); q.push(new_path); } } } } } return res; } };
39.954545
109
0.452408
zszyellow
1ec2ca85529a4eac8478593b8c3046ce4f17f0f1
3,344
cpp
C++
aoc21/code18.cpp
nakst/jam
1ddca72698d86eb300c616732f2b9d5989f2a2bc
[ "MIT" ]
3
2021-11-25T16:23:55.000Z
2022-03-03T03:35:15.000Z
aoc21/code18.cpp
nakst/jam
1ddca72698d86eb300c616732f2b9d5989f2a2bc
[ "MIT" ]
null
null
null
aoc21/code18.cpp
nakst/jam
1ddca72698d86eb300c616732f2b9d5989f2a2bc
[ "MIT" ]
null
null
null
#include "ds.h" #define OPEN (-1) #define CLOSE (-2) #define COMMA (-3) struct Number { Array<int> c; }; Array<Number> numbers = {}; Number Add(Number left, Number right) { Number x = {}; x.c.Add(OPEN); for (int i = 0; i < left.c.Length(); i++) { x.c.Add(left.c[i]); } x.c.Add(COMMA); for (int i = 0; i < right.c.Length(); i++) { x.c.Add(right.c[i]); } x.c.Add(CLOSE); while (true) { int n = 0; bool didReduction = false; for (int i = 0; i < x.c.Length(); i++) { if (x.c[i] == OPEN) { if (n == 4) { // Explode. assert(x.c[i + 2] == COMMA); assert(x.c[i + 4] == CLOSE); for (int j = i; j >= 0; j--) { if (x.c[j] >= 0) { x.c[j] += x.c[i + 1]; break; } } for (int j = i + 4; j < x.c.Length(); j++) { if (x.c[j] >= 0) { x.c[j] += x.c[i + 3]; break; } } x.c.Delete(i); x.c.Delete(i); x.c.Delete(i); x.c.Delete(i); x.c.Delete(i); x.c.Insert(0, i); didReduction = true; break; } else { n++; } } else if (x.c[i] == CLOSE) { n--; } } if (!didReduction) { for (int i = 0; i < x.c.Length(); i++) { if (x.c[i] >= 10) { int y = x.c[i]; x.c.Delete(i); x.c.Insert(CLOSE, i); x.c.Insert((y + 1) / 2, i); x.c.Insert(COMMA, i); x.c.Insert(y / 2, i); x.c.Insert(OPEN, i); didReduction = true; break; } } } if (!didReduction) { break; } } return x; } int64_t Magnitude(Number x) { int n = 0; for (int i = 0; i < x.c.Length(); i++) { if (x.c[i] == OPEN) { n++; } else if (x.c[i] == CLOSE) { n--; } else if (x.c[i] == COMMA) { if (n == 1) { Number left = {}; Number right = {}; assert(x.c.First() == OPEN); assert(x.c.Last() == CLOSE); for (int j = 1; j < i; j++) { left.c.Add(x.c[j]); } for (int j = i + 1; j < x.c.Length() - 1; j++) { right.c.Add(x.c[j]); } int64_t r = Magnitude(left) * 3 + Magnitude(right) * 2; left.c.Free(); right.c.Free(); return r; } } else if (x.c[i] >= 0) { if (n == 0) { assert(x.c.Length() == 1); return x.c[i]; } } } return n; } void Part1() { Number left = numbers[0]; for (int i = 1; i < numbers.Length(); i++) { Number oldLeft = left; left = Add(oldLeft, numbers[i]); if (i >= 2) oldLeft.c.Free(); } printf("part 1: %ld\n", Magnitude(left)); left.c.Free(); } void Part2() { int64_t m = 0; for (int i = 0; i < numbers.Length(); i++) { for (int j = 0; j < numbers.Length(); j++) { if (i == j) { continue; } Number sum = Add(numbers[i], numbers[j]); int64_t x = Magnitude(sum); MAXIMIZE(m, x); sum.c.Free(); } } printf("part 2: %ld\n", m); } int main() { FILE *f = fopen("in18.txt", "rb"); while (true) { char line[1024]; if (fscanf(f, "%s\n", line) == -1) { break; } Number number = {}; for (int i = 0; line[i]; i++) { if (line[i] == '[') { number.c.Add(OPEN); } else if (line[i] == ']') { number.c.Add(CLOSE); } else if (line[i] == ',') { number.c.Add(COMMA); } else { number.c.Add(line[i] - '0'); } } numbers.Add(number); } fclose(f); Part1(); Part2(); for (int i = 0; i < numbers.Length(); i++) { numbers[i].c.Free(); } numbers.Free(); }
16
59
0.453947
nakst
1ec32d29433f15fc3dee70892d16c3f2aa76d0f5
1,139
hpp
C++
editor/src/FilePickerDialog.hpp
aleksigron/graphics-toolkit
f8e60c57316a72dff9de07512e9771deb3799208
[ "MIT" ]
null
null
null
editor/src/FilePickerDialog.hpp
aleksigron/graphics-toolkit
f8e60c57316a72dff9de07512e9771deb3799208
[ "MIT" ]
null
null
null
editor/src/FilePickerDialog.hpp
aleksigron/graphics-toolkit
f8e60c57316a72dff9de07512e9771deb3799208
[ "MIT" ]
null
null
null
#pragma once #include <cstdint> #include <filesystem> namespace kokko { namespace editor { class FilePickerDialog { public: enum class Type { FileOpen, FileSave, FolderOpen, }; struct Descriptor { const char* popupTitle; const char* descriptionText; const char* actionButtonText; Type dialogType; bool relativeToAssetPath; std::filesystem::path assetPath; }; FilePickerDialog(); void Update(); /* * Returns true when a dialog with the specied ID has finished. * If true, parameter pathOut is assigned the selected path, or an empty string, * if the dialog was cancelled. */ bool GetDialogResult(uint64_t id, std::filesystem::path& pathOut); uint64_t StartDialog(const Descriptor& descriptor); private: void CloseDialog(bool canceled); std::filesystem::path ConvertPath(const std::filesystem::path& path); std::filesystem::path currentPath; std::filesystem::path selectedFilePath; bool dialogClosed; uint64_t closedTitleHash; std::filesystem::path resultPath; uint64_t currentTitleHash; Descriptor descriptor; }; } }
17.523077
81
0.701493
aleksigron
1ec575e0ba9d494246a7a3391596c3f3253171f2
604
hpp
C++
src/framework/shared/inc/private/common/fxpkgioshared.hpp
IT-Enthusiast-Nepal/Windows-Driver-Frameworks
bfee6134f30f92a90dbf96e98d54582ecb993996
[ "MIT" ]
994
2015-03-18T21:37:07.000Z
2019-04-26T04:04:14.000Z
src/framework/shared/inc/private/common/fxpkgioshared.hpp
IT-Enthusiast-Nepal/Windows-Driver-Frameworks
bfee6134f30f92a90dbf96e98d54582ecb993996
[ "MIT" ]
13
2019-06-13T15:58:03.000Z
2022-02-18T22:53:35.000Z
src/framework/shared/inc/private/common/fxpkgioshared.hpp
IT-Enthusiast-Nepal/Windows-Driver-Frameworks
bfee6134f30f92a90dbf96e98d54582ecb993996
[ "MIT" ]
350
2015-03-19T04:29:46.000Z
2019-05-05T23:26:50.000Z
/*++ Copyright (c) Microsoft Corporation Module Name: FxPkgIoShared.hpp Abstract: This file contains portion of FxPkgIo.hpp that is need in shared code. Author: Environment: Revision History: --*/ #ifndef _FXPKGIOSHARED_HPP_ #define _FXPKGIOSHARED_HPP_ enum FxIoStopProcessingForPowerAction { FxIoStopProcessingForPowerHold = 1, FxIoStopProcessingForPowerPurgeManaged, FxIoStopProcessingForPowerPurgeNonManaged, }; // begin_wpp config // CUSTOM_TYPE(FxIoStopProcessingForPowerAction, ItemEnum(FxIoStopProcessingForPowerAction)); // end_wpp #endif // _FXPKGIOSHARED_HPP
16.324324
93
0.789735
IT-Enthusiast-Nepal
1ecd7463a2a9e13686fe60699bf7e5b6e21ece86
3,891
hpp
C++
c++/en/old_source_codes/nns_simuls/nns-3.0/nns-1.2/source_codes/Main.hpp
aimldl/coding
70ddbfaa454ab92fd072ee8dc614ecc330b34a70
[ "MIT" ]
null
null
null
c++/en/old_source_codes/nns_simuls/nns-3.0/nns-1.2/source_codes/Main.hpp
aimldl/coding
70ddbfaa454ab92fd072ee8dc614ecc330b34a70
[ "MIT" ]
null
null
null
c++/en/old_source_codes/nns_simuls/nns-3.0/nns-1.2/source_codes/Main.hpp
aimldl/coding
70ddbfaa454ab92fd072ee8dc614ecc330b34a70
[ "MIT" ]
null
null
null
#ifndef __MAIN_HPP_ #define __MAIN_HPP_ // For CSRN #include "ApiGnuplot.hpp" #include "ApiPostprocess.hpp" #include "BadukData.hpp" #include "Cnn.hpp" #include "CommandLineArguments.hpp" #include "Config.hpp" #include "ShellCommands.hpp" #include "Myiostream.hpp" // For reinforcement learning #include "GridWorld.hpp" #include "ReinforcementLearning.hpp" #include "CliffWalkingProblem.hpp" #include "RLGoEngine.hpp" #endif //============================================================================== // Comments //============================================================================== // The following lines set the standard input to a trace file. // In other words, cout outputs a message or string to the trace file, // not to the console output or computer monitor. // Use cerr to print out a message to the console. // // ofstream outputObj; // streambuf* streambuffer; // // string traceFileWithFullPath; // traceFileWithFullPath = configObj_p->get_traceFileWithFullPath_(); // // cout << " Standard output will be saved to '" << traceFileWithFullPath; // cout << "'." << endl; // outputObj.open( traceFileWithFullPath.c_str() ); // streambuffer = outputObj.rdbuf(); // cout.rdbuf( streambuffer ); // The following line to use scientific precision is less likely to be used in the future. // But keep these lines just in case. /* //#include <iomanip> // For setprecision // FOR DEBUGGING // Using scientific to find a bug. 5.8e-270 appears as 0 if cout is used. // So the code may work unexpectedly. double dummy (0.12345); cout << "#\tUse 'cout << setprecision(1) << scientific' for debugging." << endl; cout << "#\tA number in double will be displayed as follows." << endl; cout << "#\t" << dummy << "==>" << setprecision(1) << scientific << dummy << endl; cout << "#\tNote this formatting doesn't affect integers." << endl; cout << endl; // FOR DEBUGGING */ // Comment on Part 1. Process command-line arguments & configuration // // This part prepares the rest of the program by processing the command line // arguments and the configuration file (a text file). The default config file // is default.cfg. It is suggested to override the default config file when // you run this program because it's convenient to run it many times. // Currently, the command line arguments don't do much other than reading // the specified config file name because this program is designed to // configure simulation settings in a config file. // Reading the configuration file is nothing but mapping parameters/values // in the config file to member variables in the target classes. For example, // "simul_task_type = test_problem" in default.cfg is mapped to a variable // ConfigSimulations::taskType_ in ConfigSimulations.hpp. Note this mapping // is done in the next part. // // Design principle: // Correctness of the values read from a config file should be validated // in class Config and its derived classes. In this way, the // subsequent part of the program assumes those values are correct and // do not include lines to check errors. Moreover, it is logical to remove // an error caused by a config file when the file is processed. It helps // for debugging as well. // // Comment on Part 2. Configure classes // Configuring classes means that values in a configuration file are mapped // to static variables in classes. // // Comment on Part 3. Main part // Step 1. Prepare the input & target data. // Step 2. Instantiate & initialize classes. // Step 3. Run simulations. // // Design issue: // Class Csrn or Cmlp is unneccesary because Class Cnn uses Class Cell. // The cellular architecture level, only sees cells. // Just specify the cell type.
38.524752
90
0.66641
aimldl
1ed57e3ca977f967d35331c59767bb0d69065a0c
2,478
cpp
C++
intermediate/memoryAllocation/returningObjects.cpp
eduardorasgado/CppZerotoAdvance2018
909cc0f0e1521fd9ca83795bf84cbb9f725d9d4f
[ "MIT" ]
1
2019-06-20T17:51:10.000Z
2019-06-20T17:51:10.000Z
intermediate/memoryAllocation/returningObjects.cpp
eduardorasgado/CppZerotoAdvance2018
909cc0f0e1521fd9ca83795bf84cbb9f725d9d4f
[ "MIT" ]
2
2018-10-01T08:14:01.000Z
2018-10-06T05:27:26.000Z
intermediate/memoryAllocation/returningObjects.cpp
eduardorasgado/CppZerotoAdvance2018
909cc0f0e1521fd9ca83795bf84cbb9f725d9d4f
[ "MIT" ]
1
2018-10-05T10:54:10.000Z
2018-10-05T10:54:10.000Z
#include <iostream> #include <cstdlib> class Animal { private: std::string name; public: // common constructor Animal() { std::cout << "Animal created" << std::endl; } // copy constructor Animal(const Animal& other) : name{other.name} { std::cout << "Animal created by copying" << std::endl; } ~Animal() { std::cout << "Object Destructed: " << this->name << std::endl; } // Destructor void setName(std::string name) { this->name = name; } void speak() const { std::cout << "My name is " << this->name << std::endl; } }; // created a function returns an object/ inefficient way Animal createAnimal(); // function returning an object/ efficient way Animal* createAnimalEfficient(); int main() { std::cout << "-------------------------" << std::endl; //create an object dinalically // new is allocating memory on the heap which is bigger than the heap Animal *pCat = new Animal(); // the way to use a dynamically allocated instance method (*pCat).setName("Benito"); // but there is a better an even more elegant way to do this pCat->speak(); delete pCat; // lets delete Benito from memory // creating an animal inside a function(not recommended) Animal frog = createAnimal(); frog.speak(); // creating an animal throughout a function auto *pFrog = createAnimalEfficient(); pFrog->speak(); // the object created inside the function now can be // safely deallocated, because it is pointed by pFrog delete pFrog; return 0; } // function that returns and object Animal createAnimal() { /* * this way to return an object is quit inefficient *since were creating here the object, copying the object to *the object instance in main function and destructing the object created *here * */ Animal a; a.setName("Betty"); // returning a new object return a; } // An efficient way Animal* createAnimalEfficient() { /* * This is a good way because were not doing * object creation twice, we are returning an animal * by pointer, so we are passing the actual memory * location of the object created inside this function, * then in main this is passed as a pointer, it should be treated as it is. * */ Animal *pAnimal = new Animal(); pAnimal->setName("EfficientBetty"); return pAnimal; }
28.482759
98
0.624294
eduardorasgado
1ee1015465fdb830af43912e70139f3691a2efa4
1,704
hpp
C++
3rdParty/detail/index_lsb_set.hpp
zero9178/cld
2899ade8045074c5ee939253d2d7f8067c46e72d
[ "MIT" ]
14
2020-10-16T08:29:32.000Z
2021-12-21T10:37:05.000Z
3rdParty/detail/index_lsb_set.hpp
zero9178/cld
2899ade8045074c5ee939253d2d7f8067c46e72d
[ "MIT" ]
null
null
null
3rdParty/detail/index_lsb_set.hpp
zero9178/cld
2899ade8045074c5ee939253d2d7f8067c46e72d
[ "MIT" ]
null
null
null
// BITSET2 // // Copyright Claas Bontus // // Use, modification and distribution is subject to the // Boost Software License, Version 1.0. (See accompanying // file LICENSE.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // // Project home: https://github.com/ClaasBontus/bitset2 // #ifndef BITSET2_INDEX_LSB_SET_CB_HPP #define BITSET2_INDEX_LSB_SET_CB_HPP #include <climits> #include <cstddef> #include <limits> namespace Bitset2 { namespace detail { /// https://graphics.stanford.edu/~seander/bithacks.html#ZerosOnRightBinSearch template <class T> struct index_lsb_set { enum : size_t { npos = std::numeric_limits<size_t>::max(), n_bits = sizeof(T) * CHAR_BIT }; constexpr index_lsb_set() noexcept { static_assert((n_bits & (n_bits - 1)) == 0, "Number of bits in data type is not a power of 2"); } /// \brief Returns index of first (least significant) bit set in val. /// Returns npos if all bits are zero. constexpr size_t operator()(T val) const noexcept { return (T(0) == val) ? npos : find_idx(val, T(T(~T(0)) >> (n_bits >> 1)), n_bits >> 1, 1); } private: constexpr size_t find_idx(T val, T pttrn, size_t sh_rght, size_t ct) const noexcept { return (sh_rght == 1) ? (ct - size_t(T(val & T(0x1)))) : T(val & pttrn) == T(0) ? find_idx(T(val >> sh_rght), T(pttrn >> (sh_rght >> 1)), sh_rght >> 1, ct + sh_rght) : find_idx(val, T(pttrn >> (sh_rght >> 1)), sh_rght >> 1, ct); } }; // struct index_lsb_set } // namespace detail } // namespace Bitset2 #endif // BITSET2_INDEX_LSB_SET_CB_HPP
28.4
117
0.61385
zero9178
1ee2d992c12ef1713e38aeac04e66ba6ac8e5d00
2,236
cpp
C++
src/SpreadsheetImpl.cpp
zhangf911/SPLib
57ae498f61abe9c14670a974340251cd67ca99fb
[ "BSD-2-Clause" ]
1
2015-11-06T03:40:44.000Z
2015-11-06T03:40:44.000Z
src/SpreadsheetImpl.cpp
amyvmiwei/SPLib
57ae498f61abe9c14670a974340251cd67ca99fb
[ "BSD-2-Clause" ]
null
null
null
src/SpreadsheetImpl.cpp
amyvmiwei/SPLib
57ae498f61abe9c14670a974340251cd67ca99fb
[ "BSD-2-Clause" ]
1
2020-12-16T03:20:45.000Z
2020-12-16T03:20:45.000Z
// File: SpreadsheetImpl.cpp // SpreadsheetImpl implementation file // #include "splib.h" #include "TableImpl.h" #include "splibint.h" #include <string.h> namespace splib { SpreadsheetImpl::SpreadsheetImpl() { } SpreadsheetImpl::~SpreadsheetImpl() { for (std::vector<Table*>::size_type i = 0; i < tables.size(); i++) { delete tables[i]; } } Table& SpreadsheetImpl::insertTable(int index, const _TCHAR* name) { if (index < 0 || index > tableCount()) { throw IllegalArgumentException(); } if (name == 0) { throw IllegalArgumentException(); } if (tableExists(name)) { throw IllegalArgumentException(); } Table* table = new TableImpl(this); table->setName(name); tables.insert(tables.begin() + index, table); return *table; } Table& SpreadsheetImpl::table(int index) { if (index < 0 || index >= tableCount()) { throw IllegalArgumentException(); } return *(tables[index]); } Table& SpreadsheetImpl::table(const _TCHAR* name) { if (name == 0) { throw IllegalArgumentException(); } int index = find(name); if (index == -1) { throw IllegalArgumentException(); } return *(tables[index]); } int SpreadsheetImpl::tableCount() const { return (int) tables.size(); } bool SpreadsheetImpl::tableExists(const _TCHAR* name) { if (name == 0) { throw IllegalArgumentException(); } return find(name) != -1; } void SpreadsheetImpl::removeTable(int index) { if (index < 0 || index >= tableCount()) { throw IllegalArgumentException(); } delete tables[index]; tables.erase(tables.begin() + index); } void SpreadsheetImpl::removeTable(const _TCHAR* name) { if (name == 0) { throw IllegalArgumentException(); } int index = find(name); if (index == -1) { throw IllegalArgumentException(); } removeTable(index); } int SpreadsheetImpl::find(const _TCHAR* name) { for (int i = 0; i < (int) tables.size(); i++) { if (_tcscmp(name, tables[i]->getName()) == 0) { return i; } } return -1; } }
23.291667
73
0.580501
zhangf911
1ee399fb1e535109c68f9cab8d971597772bcae3
31,689
cc
C++
src/coordinator_node.cc
qian-long/TileDB-multinode
ba2a38b2cc6169935c73b76af8c53e8544c11300
[ "MIT" ]
null
null
null
src/coordinator_node.cc
qian-long/TileDB-multinode
ba2a38b2cc6169935c73b76af8c53e8544c11300
[ "MIT" ]
null
null
null
src/coordinator_node.cc
qian-long/TileDB-multinode
ba2a38b2cc6169935c73b76af8c53e8544c11300
[ "MIT" ]
null
null
null
#include <mpi.h> #include <string> #include <sstream> #include <cstring> #include <ostream> #include <iostream> #include <istream> #include <fstream> #include <algorithm> #include <cstdio> #include <functional> #include "assert.h" #include "coordinator_node.h" #include "csv_file.h" #include "debug.h" #include "hash_functions.h" #include "constants.h" #include "util.h" CoordinatorNode::CoordinatorNode(int rank, int nprocs, std::string datadir) { myrank_ = rank; nprocs_ = nprocs; nworkers_ = nprocs - 1; // TODO put in config file my_workspace_ = "./workspaces/workspace-0"; logger_ = new Logger(my_workspace_ + "/logfile"); executor_ = new Executor(my_workspace_); std::vector<int> workers; for (int i = 1; i < nprocs; ++i) { workers.push_back(i); } mpi_handler_ = new MPIHandler(0, workers, logger_); datadir_ = datadir; md_manager_ = new MetaDataManager(my_workspace_); } // TODO CoordinatorNode::~CoordinatorNode() { delete logger_; } Logger* CoordinatorNode::logger() { return logger_; } void CoordinatorNode::run() { logger_->log(LOG_INFO, "I am the master node"); send_all("hello", DEF_TAG); // Set array name std::string array_name = "test_F"; std::string filename = array_name + ".csv"; // Set attribute names std::vector<std::string> attribute_names; attribute_names.push_back("attr1"); attribute_names.push_back("attr2"); // Set attribute types std::vector<const std::type_info*> types; types.push_back(&typeid(int)); types.push_back(&typeid(int)); // Set dimension type types.push_back(&typeid(int)); // Set dimension names std::vector<std::string> dim_names; dim_names.push_back("i"); dim_names.push_back("j"); // Set dimension domains std::vector<std::pair<double,double> > dim_domains; dim_domains.push_back(std::pair<double,double>(0, 1000000)); dim_domains.push_back(std::pair<double,double>(0, 1000000)); // Create an array with irregular tiles ArraySchema array_schema = ArraySchema(array_name, attribute_names, dim_names, dim_domains, types, ArraySchema::HILBERT); ArraySchema array_schema_C = array_schema.clone("test_F_ordered"); std::string filename_C = "test_F.csv"; ArraySchema array_schema_D = array_schema.clone("test_G_ordered"); std::string filename_D = "test_G.csv"; DEBUG_MSG("Sending DEFINE ARRAY to all workers for " + array_schema_C.array_name()); DefineArrayMsg damsg_C = DefineArrayMsg(array_schema_C); send_and_receive(damsg_C); DEBUG_MSG("Sending ordered partition load instructions to all workers"); LoadMsg lmsg_C = LoadMsg(filename_C, array_schema_C, ORDERED_PARTITION); send_and_receive(lmsg_C); DEBUG_MSG("Sending DEFINE ARRAY to all workers for array " + array_schema_D.array_name()); DefineArrayMsg damsg_D = DefineArrayMsg(array_schema_D); send_and_receive(damsg_D); DEBUG_MSG("Sending ordered partition load instructions to all workers"); LoadMsg lmsg_D = LoadMsg(filename_D, array_schema_D, ORDERED_PARTITION); send_and_receive(lmsg_D); DEBUG_MSG("Sending join"); std::string join_ordered_result = "join_ordered_" + array_schema_C.array_name() + "_" + array_schema_D.array_name(); JoinMsg jmsg2 = JoinMsg(array_schema_C.array_name(), array_schema_D.array_name(), join_ordered_result); send_and_receive(jmsg2); DEBUG_MSG("Sending GET result to all workers"); GetMsg gmsg2 = GetMsg(join_ordered_result); send_and_receive(gmsg2); logger_->log(LOG_INFO, "Sending DEFINE ARRAY to all workers for array " + array_schema.array_name()); DefineArrayMsg damsg = DefineArrayMsg(array_schema); send_and_receive(damsg); logger_->log(LOG_INFO, "Sending ordered partition load instructions to all workers"); LoadMsg lmsg = LoadMsg(filename, array_schema, HASH_PARTITION); send_and_receive(lmsg); ArraySchema array_schema_B = array_schema.clone("test_G"); std::string filename_B = array_schema_B.array_name() + ".csv"; logger_->log(LOG_INFO, "Sending DEFINE ARRAY to all workers for array " + array_schema_B.array_name()); DefineArrayMsg damsg2 = DefineArrayMsg(array_schema_B); send_and_receive(damsg2); logger_->log(LOG_INFO, "Sending ordered partition load instructions to all workers"); LoadMsg lmsg2 = LoadMsg(filename_B, array_schema_B, HASH_PARTITION); send_and_receive(lmsg2); logger_->log(LOG_INFO, "Sending join hash"); std::string join_result = "join_hash_" + array_schema.array_name() + "_" + array_schema_B.array_name(); JoinMsg jmsg = JoinMsg("test_F", "test_G", join_result); send_and_receive(jmsg); logger_->log(LOG_INFO, "Sending GET result to all workers"); GetMsg gmsg1 = GetMsg(join_result); send_and_receive(gmsg1); /* DEBUG_MSG("sending subarray"); std::vector<double> vec; vec.push_back(0); vec.push_back(500000); vec.push_back(0); vec.push_back(500000); SubarrayMsg sbmsg("subarray", array_schema, vec); send_and_receive(sbmsg); DEBUG_MSG("done sending subarray messages"); std::string sarray_name = "subarray"; DEBUG_MSG("Sending GET " + sarray_name + " to all workers"); GetMsg gmsg1(sarray_name); send_and_receive(gmsg1); */ /* DEBUG_MSG("sending filter instruction to all workers"); std::string expr = "attr1"; // expression hard coded in executor.cc std::string result = "filter"; FilterMsg fmsg(array_name, expr, result); send_and_receive(fmsg); std::string farray_name = "filter"; DEBUG_MSG("Sending GET " + farray_name + " to all workers"); GetMsg gmsg2(farray_name); send_and_receive(gmsg2); */ /* std::string array_name2 = "test_A"; DEBUG_MSG("Sending DEFINE ARRAY to all workers for array test_load_hash"); ArraySchema array_schema2 = array_schema.clone(array_name2); DefineArrayMsg damsg2 = DefineArrayMsg(array_schema2); send_and_receive(damsg2); DEBUG_MSG("Sending HASH_PARTITION load instructions to all workers"); LoadMsg lmsg = LoadMsg(filename, array_schema2, LoadMsg::HASH); send_and_receive(lmsg); DEBUG_MSG("Sending GET " + array_name2 + " to all workers"); GetMsg gmsg2 = GetMsg(array_name2); send_and_receive(gmsg2); */ /* DEBUG_MSG("Sending ORDERED_PARTITION load instructions to all workers"); LoadMsg lmsg = LoadMsg(filename, array_schema, LoadMsg::ORDERED); send_and_receive(lmsg); DEBUG_MSG("Sending GET test_A to all workers"); GetMsg gmsg1 = GetMsg(array_name); send_and_receive(gmsg1); */ /* DEBUG_MSG("sending load instruction to all workers"); ArraySchema::Order order = ArraySchema::COLUMN_MAJOR; LoadMsg lmsg = LoadMsg(array_name, array_schema); send_and_receive(lmsg); DEBUG_MSG("sending get test instruction to all workers"); GetMsg gmsg = GetMsg("test_A"); send_and_receive(gmsg); */ /* DEBUG_MSG("sending filter instruction to all workers"); int attr_index = 1; Op op = GT; int operand = 4; Predicate<int> pred(attr_index, op, operand); DEBUG_MSG(pred.to_string()); FilterMsg<int> fmsg = FilterMsg<int>(array_schema.celltype(attr_index), array_schema, pred, "smallish_filter"); send_and_receive(fmsg); DEBUG_MSG("sending subarray"); std::vector<double> vec; vec.push_back(9); vec.push_back(11); vec.push_back(10); vec.push_back(13); SubarrayMsg sbmsg("subarray", array_schema, vec); send_and_receive(sbmsg); DEBUG_MSG("done sending subarray messages"); DEBUG_MSG("sending get subarray instruction to all workers"); GetMsg gmsg1 = GetMsg("subarray"); send_and_receive(gmsg1); */ quit_all(); } void CoordinatorNode::send_all(Msg& msg) { logger_->log(LOG_INFO, "send_all"); std::pair<char*, int> serial_pair = msg.serialize(); this->send_all(serial_pair.first, serial_pair.second, msg.msg_tag); } void CoordinatorNode::send_all(std::string serial_str, int tag) { this->send_all(serial_str.c_str(), serial_str.length(), tag); } void CoordinatorNode::send_all(const char* buffer, int buffer_size, int tag) { assert(buffer_size < MPI_BUFFER_LENGTH); for (int i = 1; i < nprocs_; i++) { MPI_Send((char *)buffer, buffer_size, MPI::CHAR, i, tag, MPI_COMM_WORLD); } } // dispatch to correct handler void CoordinatorNode::send_and_receive(Msg& msg) { send_all(msg); switch(msg.msg_tag) { case GET_TAG: handle_get(dynamic_cast<GetMsg&>(msg)); handle_acks(); break; case LOAD_TAG: handle_load(dynamic_cast<LoadMsg&>(msg)); handle_acks(); break; case PARALLEL_LOAD_TAG: handle_parallel_load(dynamic_cast<ParallelLoadMsg&>(msg)); handle_acks(); break; case DEFINE_ARRAY_TAG: case FILTER_TAG: case SUBARRAY_TAG: handle_acks(); break; case AGGREGATE_TAG: //handle_aggregate(); break; case JOIN_TAG: handle_join(dynamic_cast<JoinMsg&>(msg)); // acks handled internally break; default: // don't do anything break; } } int CoordinatorNode::handle_acks() { bool all_success = true; for (int nodeid = 1; nodeid <= nworkers_; nodeid++) { logger_->log(LOG_INFO, "Waiting for ack from worker " + util::to_string(nodeid)); AckMsg* ack = mpi_handler_->receive_ack(nodeid); if (ack->result() == AckMsg::ERROR) { all_success = false; } logger_->log(LOG_INFO, "Received ack " + ack->to_string() + " from worker: " + util::to_string(nodeid)); // cleanup delete ack; } return all_success ? 0 : -1; } /****************************************************** ** HANDLE GET ** ******************************************************/ void CoordinatorNode::handle_get(GetMsg& gmsg) { logger_->log(LOG_INFO, "In handle_get"); std::string outpath = my_workspace_ + "/GET_" + gmsg.array_name() + ".csv"; std::ofstream outfile; outfile.open(outpath.c_str()); bool keep_receiving = true; for (int nodeid = 1; nodeid < nprocs_; ++nodeid) { // error handling if file is not found on sender keep_receiving = mpi_handler_->receive_keep_receiving(nodeid); logger_->log(LOG_INFO, "Sender: " + util::to_string(nodeid) + " Keep receiving: " + util::to_string(keep_receiving)); if (keep_receiving == true) { logger_->log(LOG_INFO, "Waiting for sender " + util::to_string(nodeid)); mpi_handler_->receive_content(outfile, nodeid, GET_TAG); } } outfile.close(); } /****************************************************** ** HANDLE LOAD ** ******************************************************/ void CoordinatorNode::handle_load(LoadMsg& lmsg) { MetaData metadata; switch (lmsg.partition_type()) { case ORDERED_PARTITION: switch(lmsg.load_method()) { case LoadMsg::SORT: handle_load_ordered_sort(lmsg); break; case LoadMsg::SAMPLE: handle_load_ordered_sample(lmsg); break; default: // shouldn't get here break; } break; case HASH_PARTITION: handle_load_hash(lmsg); logger_->log_start(LOG_INFO, "Writing metadata to disk"); metadata = MetaData(HASH_PARTITION); md_manager_->store_metadata(lmsg.array_schema().array_name(), metadata); logger_->log_end(LOG_INFO); break; default: // TODO return error? break; } } void CoordinatorNode::handle_load_ordered_sort(LoadMsg& lmsg) { std::stringstream ss; std::string filepath = datadir_ + "/" + lmsg.filename(); // inject ids if regular or hilbert order ArraySchema& array_schema = lmsg.array_schema(); bool regular = array_schema.has_regular_tiles(); ArraySchema::Order order = array_schema.order(); std::string injected_filepath = filepath; std::string frag_name = "0_0"; if (regular || order == ArraySchema::HILBERT) { injected_filepath = executor_->loader()->workspace() + "/injected_" + array_schema.array_name() + "_" + frag_name + ".csv"; try { logger_->log_start(LOG_INFO, "Injecting ids into " + filepath + ", outputting to " + injected_filepath); executor_->loader()->inject_ids_to_csv_file(filepath, injected_filepath, array_schema); } catch(LoaderException& le) { logger_->log(LOG_INFO, "Caught loader exception " + le.what()); #ifdef NDEBUG remove(injected_filepath.c_str()); executor_->storage_manager()->delete_array(array_schema.array_name()); #endif throw LoaderException("[WorkerNode] Cannot inject ids to file\n" + le.what()); } } logger_->log_end(LOG_INFO); // local sort std::string sorted_filepath = executor_->loader()->workspace() + "/sorted_" + array_schema.array_name() + "_" + frag_name + ".csv"; logger_->log_start(LOG_INFO, "Sorting csv file " + injected_filepath + " into " + sorted_filepath); executor_->loader()->sort_csv_file(injected_filepath, sorted_filepath, array_schema); logger_->log_end(LOG_INFO); // send partitions back to worker nodes logger_->log(LOG_INFO, "Counting num_lines"); std::ifstream sorted_file; sorted_file.open(sorted_filepath.c_str()); // using cpp count algo function int num_lines = std::count(std::istreambuf_iterator<char>(sorted_file), std::istreambuf_iterator<char>(), '\n'); ss.str(std::string()); ss << "Splitting and sending sorted content to workers, num_lines: " << num_lines; logger_->log(LOG_INFO, ss.str()); int lines_per_worker = num_lines / nworkers_; // if not evenly split int remainder = num_lines % nworkers_; int pos = 0; int total = lines_per_worker; if (remainder > 0) { total++; } sorted_file.close(); //sorted_file.seekg(0, std::ios::beg); CSVFile csv(sorted_filepath, CSVFile::READ); CSVLine csv_line; std::vector<uint64_t> partitions; // nworkers - 1 partitions for (int nodeid = 1; nodeid < nprocs_; ++nodeid) { std::string line; std::stringstream content; int end = pos + lines_per_worker; if (remainder > 0) { end++; } logger_->log(LOG_INFO, "Sending sorted file part to nodeid " + util::to_string(nodeid) + " with " + util::to_string(end - pos) + " lines"); for(; pos < end - 1; ++pos) { csv >> csv_line; line = csv_line.str() + "\n"; mpi_handler_->send_content(line.c_str(), line.size(), nodeid, LOAD_TAG); } // need nworkers - 1 "stumps" for partition ranges assert(pos == end - 1); csv >> csv_line; line = csv_line.str() + "\n"; mpi_handler_->send_content(line.c_str(), line.size(), nodeid, LOAD_TAG); if (nodeid != nprocs_ - 1) { // not last node uint64_t sample = std::strtoull(csv_line.values()[0].c_str(), NULL, 10); partitions.push_back(sample); } // final send mpi_handler_->flush_send(nodeid, LOAD_TAG); assert(mpi_handler_->all_buffers_empty() == true); --remainder; } assert(partitions.size() == nworkers_ - 1); logger_->log(LOG_INFO, "Sending partition samples to all workers"); SamplesMsg msg(partitions); for (int worker = 1; worker <= nworkers_ ; worker++) { logger_->log(LOG_INFO, "Sending partitions to worker " + util::to_string(worker)); mpi_handler_->send_samples_msg(&msg, worker); } // store metadata to disk logger_->log_start(LOG_INFO, "Writing metadata to disk"); MetaData metadata(ORDERED_PARTITION, std::pair<uint64_t, uint64_t>(partitions[0], partitions[partitions.size()-1]), partitions); md_manager_->store_metadata(array_schema.array_name(), metadata); logger_->log_end(LOG_INFO); logger_->log(LOG_INFO, "Finished handle load ordered sort"); } void CoordinatorNode::handle_load_ordered_sample(LoadMsg& msg) { logger_->log(LOG_INFO, "Start Handle Load Ordered Partiion using Sampling"); std::stringstream ss; std::string filepath = datadir_ + "/" + msg.filename(); // inject cell ids and sample CSVFile csv_in(filepath, CSVFile::READ); CSVLine line_in, line_out; ArraySchema& array_schema = msg.array_schema(); ArraySchema::Order order = array_schema.order(); std::string frag_name = "0_0"; std::string injected_filepath = filepath; // TODO support other orderings later assert(array_schema.has_regular_tiles() || array_schema.order() == ArraySchema::HILBERT); injected_filepath = executor_->loader()->workspace() + "/injected_" + array_schema.array_name() + "_" + frag_name + ".csv"; CSVFile *csv_out = new CSVFile(injected_filepath, CSVFile::WRITE); uint64_t cell_id; std::vector<double> coordinates; unsigned int dim_num = array_schema.dim_num(); coordinates.resize(dim_num); double coordinate; int resevoir_count = 0; int num_samples = msg.num_samples(); std::vector<uint64_t> samples; logger_->log_start(LOG_INFO, "Inject cell ids to " + injected_filepath + " and while resevoir sampling"); while (csv_in >> line_in) { // Retrieve coordinates from the input line for(unsigned int i=0; i < array_schema.dim_num(); i++) { if(!(line_in >> coordinate)) throw LoaderException("Cannot read coordinate value from CSV file."); coordinates[i] = coordinate; } // Put the id at the beginning of the output line if(array_schema.has_regular_tiles()) { // Regular tiles if(order == ArraySchema::HILBERT) cell_id = array_schema.tile_id_hilbert(coordinates); else if(order == ArraySchema::ROW_MAJOR) cell_id = array_schema.tile_id_row_major(coordinates); else if(order == ArraySchema::COLUMN_MAJOR) cell_id = array_schema.tile_id_column_major(coordinates); } else { // Irregular tiles + Hilbert cell order cell_id = array_schema.cell_id_hilbert(coordinates); } line_out = cell_id; // Append the input line to the output line, // and then into the output CSV file line_out << line_in; (*csv_out) << line_out; // do resevoir sampling if (resevoir_count < num_samples) { samples.push_back(cell_id); } else { // replace elements with gradually decreasing probability // TODO double check off by one error? int r = (rand() % resevoir_count) + 1; // 0 to counter inclusive if (r < num_samples) { samples[r] = cell_id; } } resevoir_count++; } logger_->log_end(LOG_INFO); // call destructor to force flush delete csv_out; // sample and get partitions std::vector<uint64_t> partitions = get_partitions(samples, nworkers_ - 1); // scan input and send partitions to workers logger_->log_start(LOG_INFO, "Send partitions to workers, reading " + injected_filepath); CSVFile csv_injected(injected_filepath, CSVFile::READ); CSVLine csv_line; while (csv_injected >> csv_line) { int64_t cell_id = std::strtoll(csv_line.values()[0].c_str(), NULL, 10); int receiver = get_receiver(partitions, cell_id); std::string csv_line_str = csv_line.str() + "\n"; mpi_handler_->send_content(csv_line_str.c_str(), csv_line_str.length(), receiver, LOAD_TAG); } // flush all sends logger_->log(LOG_INFO, "Flushing all sends"); mpi_handler_->flush_all_sends(LOAD_TAG); logger_->log_end(LOG_INFO); // send partition boundaries back to workers to record logger_->log(LOG_INFO, "Sending partition samples to all workers: " + util::to_string(partitions)); SamplesMsg smsg(partitions); for (int worker = 1; worker <= nworkers_ ; worker++) { mpi_handler_->send_samples_msg(&smsg, worker); } // store metadata to disk logger_->log_start(LOG_INFO, "Writing metadata to disk"); MetaData metadata(ORDERED_PARTITION, std::pair<uint64_t, uint64_t>(partitions[0], partitions[partitions.size()-1]), partitions); md_manager_->store_metadata(array_schema.array_name(), metadata); logger_->log_end(LOG_INFO); logger_->log(LOG_INFO, "Finished handle load ordered sampling"); } void CoordinatorNode::handle_load_hash(LoadMsg& pmsg) { logger_->log(LOG_INFO, "Start Handle Load Hash Partiion"); std::stringstream ss; // TODO check that filename exists in workspace, error if doesn't ArraySchema array_schema = pmsg.array_schema(); std::string filepath = datadir_ + "/" + pmsg.filename(); logger_->log(LOG_INFO, "Sending data to workers based on hash value from " + filepath); // scan input file, compute hash on cell coords, send to worker CSVFile csv_in(filepath, CSVFile::READ); CSVLine csv_line; while (csv_in >> csv_line) { // TODO look into other hash fns, see hash_functions.h for borrowed ones std::string coord_id = csv_line.values()[0]; for (int i = 1; i < array_schema.dim_num(); ++i) { coord_id += ","; coord_id += csv_line.values()[i]; } std::size_t cell_id_hash = DEKHash(coord_id); int receiver = (cell_id_hash % nworkers_) + 1; std::string csv_line_str = csv_line.str() + "\n"; mpi_handler_->send_content(csv_line_str.c_str(), csv_line_str.length(), receiver, LOAD_TAG); } logger_->log(LOG_INFO, "Flushing all sends"); mpi_handler_->flush_all_sends(LOAD_TAG); } /****************************************************** ** HANDLE PARALLEL LOAD ** ******************************************************/ void CoordinatorNode::handle_parallel_load(ParallelLoadMsg& pmsg) { logger_->log(LOG_INFO, "In handle_parallel_load"); switch (pmsg.partition_type()) { case ORDERED_PARTITION: handle_parallel_load_ordered(pmsg); break; case HASH_PARTITION: handle_parallel_load_hash(pmsg); break; default: // TODO return error? break; } } // participates in all to all mpi exchange void CoordinatorNode::handle_parallel_load_hash(ParallelLoadMsg& pmsg) { logger_->log(LOG_INFO, "Participating in all to all communication"); mpi_handler_->finish_recv_a2a(); } void CoordinatorNode::handle_parallel_load_ordered(ParallelLoadMsg& pmsg) { logger_->log(LOG_INFO, "In handle parallel load ordered"); // receive samples from all workers logger_->log(LOG_INFO, "Receiving samples from workers"); std::vector<uint64_t> samples; std::stringstream ss; for (int worker = 1; worker <= nworkers_; ++worker) { logger_->log(LOG_INFO, "Waiting for samples from worker " + util::to_string(worker)); SamplesMsg* smsg = mpi_handler_->receive_samples_msg(worker); for (int i = 0; i < smsg->samples().size(); ++i) { samples.push_back(smsg->samples()[i]); } // TODO cleanup } // pick nworkers - 1 samples for the n - 1 "stumps" logger_->log(LOG_INFO, "Getting partitions"); std::vector<uint64_t> partitions = get_partitions(samples, nworkers_ - 1); logger_->log(LOG_INFO, "sending partitions back to all workers"); // send partition infor back to all workers logger_->log(LOG_INFO, "Partitions: " + util::to_string(partitions)); SamplesMsg msg(partitions); for (int worker = 1; worker <= nworkers_ ; worker++) { mpi_handler_->send_samples_msg(&msg, worker); } logger_->log_start(LOG_INFO, "Participating in all to all communication"); mpi_handler_->finish_recv_a2a(); logger_->log_end(LOG_INFO); // cleanup } /****************************************************** ** HANDLE JOIN ** ******************************************************/ void CoordinatorNode::handle_join(JoinMsg& msg) { MetaData *md_A = md_manager_->retrieve_metadata(msg.array_name_A()); MetaData *md_B = md_manager_->retrieve_metadata(msg.array_name_B()); assert(md_A->partition_type() == md_B->partition_type()); MetaData md_C; int r; switch (md_A->partition_type()) { case ORDERED_PARTITION: handle_join_ordered(msg); break; case HASH_PARTITION: break; default: // shouldn't get here break; } r = handle_acks(); if (r == 0) { logger_->log_start(LOG_INFO, "Query successful, writing new metadata"); md_C = MetaData(md_A->partition_type()); md_manager_->store_metadata(msg.result_array_name(), md_C); logger_->log_end(LOG_INFO); } else { logger_->log(LOG_INFO, "Query failed, no new array created"); } // cleanup delete md_A; delete md_B; } // TODO void CoordinatorNode::handle_join_ordered(JoinMsg& msg) { logger_->log_start(LOG_INFO, "All to all shuffle array A bounding coords"); mpi_handler_->finish_recv_a2a(); logger_->log_end(LOG_INFO); logger_->log_start(LOG_INFO, "All to all shuffle of array B bounding coords"); mpi_handler_->finish_recv_a2a(); logger_->log_end(LOG_INFO); logger_->log_start(LOG_INFO, "All to all shuffle of array A join fragments"); mpi_handler_->finish_recv_a2a(); logger_->log_end(LOG_INFO); logger_->log_start(LOG_INFO, "All to all shuffle of array B join fragments"); mpi_handler_->finish_recv_a2a(); logger_->log_end(LOG_INFO); } void CoordinatorNode::quit_all() { logger_->log(LOG_INFO, "Sending quit all"); send_all("quit", QUIT_TAG); } /****************************************************** **************** HELPER FUNCTIONS ******************** ******************************************************/ std::vector<uint64_t> CoordinatorNode::get_partitions(std::vector<uint64_t> samples, int k) { // We are picking k partition boundaries that will divide the // entire distributed dataset into k + 1 somewhat equal (hopefully) partitions std::sort(samples.begin(), samples.end()); std::vector<uint64_t> partitions; int num_partitions = k + 1; int num_samples_per_part = samples.size() / num_partitions; int remainder = samples.size() % num_partitions; if (remainder > 0) { num_samples_per_part++; } for (int i = 1; i <= k; ++i) { partitions.push_back(samples[i*num_samples_per_part]); } return partitions; } // TODO optimize to use binary search if needed // TODO move to util class inline int CoordinatorNode::get_receiver(std::vector<uint64_t> partitions, uint64_t cell_id) { int recv = 1; for (std::vector<uint64_t>::iterator it = partitions.begin(); it != partitions.end(); ++it) { if (cell_id <= *it) { return recv; } recv++; } return recv; } /****************************************************** *************** TESTING FUNCTIONS ******************** ******************************************************/ void CoordinatorNode::test_load(std::string array_name, std::string filename, PartitionType partition_type, LoadMsg::LoadMethod method) { logger_->log(LOG_INFO, "Test loading array_name: " + array_name + " filename: " + filename); logger_->log(LOG_INFO, "Sending DEFINE ARRAY to all workers for array " + array_name); ArraySchema * array_schema = get_test_arrayschema(array_name); DefineArrayMsg damsg = DefineArrayMsg(*array_schema); send_and_receive(damsg); logger_->log(LOG_INFO, "Sending LOAD ARRAY to all workers for array " + array_name); LoadMsg lmsg = LoadMsg(filename, *array_schema, partition_type, method); send_and_receive(lmsg); logger_->log(LOG_INFO, "Test Load Done"); // TODO don't leak memory delete array_schema; } void CoordinatorNode::test_parallel_load(std::string array_name, std::string filename, PartitionType partition_type, int num_samples = 10) { logger_->log(LOG_INFO, "Test parallel loading array_name: " + array_name + " filename: " + filename); logger_->log(LOG_INFO, "Sending DEFINE ARRAY to all workers for array " + array_name); ArraySchema * array_schema = get_test_arrayschema(array_name); DefineArrayMsg damsg = DefineArrayMsg(*array_schema); send_and_receive(damsg); logger_->log(LOG_INFO, "Sending PARALLEL LOAD ARRAY to all workers for array " + array_name); ParallelLoadMsg msg = ParallelLoadMsg(filename, partition_type, *array_schema, num_samples); send_and_receive(msg); logger_->log(LOG_INFO, "Test Parallel Load Done"); delete array_schema; } void CoordinatorNode::test_filter(std::string array_name) { logger_->log(LOG_INFO, "Start Filter"); ArraySchema* array_schema = get_test_arrayschema(array_name); // .5 selectivity int attr_index = 1; Op op = GE; int operand = 500000; Predicate<int> pred(attr_index, op, operand); logger_->log(LOG_INFO, pred.to_string()); /* FilterMsg<int> fmsg = FilterMsg<int>(array_schema->celltype(attr_index), *array_schema, pred, array_name+"_filtered"); send_and_receive(fmsg); */ logger_->log(LOG_INFO, "Test Filter Done"); // don't leak memory //delete array_schema; } void CoordinatorNode::test_subarray(std::string array_name) { logger_->log(LOG_INFO, "Start SubArray"); ArraySchema* array_schema = get_test_arrayschema(array_name); std::vector<double> vec; // .5 selectivity vec.push_back(0); vec.push_back(1000000); vec.push_back(0); vec.push_back(500000); SubarrayMsg sbmsg(array_name+"_subarray", *array_schema, vec); send_and_receive(sbmsg); logger_->log(LOG_INFO, "Test Subarray Done"); // don't leak memory //delete array_schema; } void CoordinatorNode::test_aggregate(std::string array_name) { logger_->log(LOG_INFO, "Start Aggregate3 test"); int attr_index = 1; AggregateMsg amsg(array_name, 1); send_and_receive(amsg); logger_->log(LOG_INFO, "Test Aggregate Done"); // don't leak memory //delete array_schema; } ArraySchema* CoordinatorNode::get_test_arrayschema(std::string array_name) { // array schema for test_[X}.csv if (array_name.compare(0, 4, "test") == 0) { // Set attribute names std::vector<std::string> attribute_names; attribute_names.push_back("attr1"); attribute_names.push_back("attr2"); // Set attribute types std::vector<const std::type_info*> types; types.push_back(&typeid(int)); types.push_back(&typeid(int)); // Set dimension type types.push_back(&typeid(int)); // Set dimension names std::vector<std::string> dim_names; dim_names.push_back("i"); dim_names.push_back("j"); // Set dimension domains std::vector<std::pair<double,double> > dim_domains; dim_domains.push_back(std::pair<double,double>(0, 1000000)); dim_domains.push_back(std::pair<double,double>(0, 1000000)); // Create an array with irregular tiles ArraySchema *array_schema = new ArraySchema(array_name, attribute_names, dim_names, dim_domains, types, ArraySchema::HILBERT); return array_schema; } // array schema for ais data // Set attribute names std::vector<std::string> attribute_names; attribute_names.push_back("sog"); // float attribute_names.push_back("cog"); // float attribute_names.push_back("heading"); // float attribute_names.push_back("rot"); // float attribute_names.push_back("status"); // int attribute_names.push_back("voyageid"); // int64_t attribute_names.push_back("mmsi"); // int64_t // Set attribute types std::vector<const std::type_info*> types; types.push_back(&typeid(float)); types.push_back(&typeid(float)); types.push_back(&typeid(float)); types.push_back(&typeid(float)); types.push_back(&typeid(int)); types.push_back(&typeid(int64_t)); types.push_back(&typeid(int64_t)); // Set dimension type types.push_back(&typeid(int64_t)); // Set dimension names std::vector<std::string> dim_names; dim_names.push_back("coordX"); dim_names.push_back("coordY"); // Set dimension domains std::vector<std::pair<double,double> > dim_domains; dim_domains.push_back(std::pair<double,double>(0, 360000000)); dim_domains.push_back(std::pair<double,double>(0, 180000000)); // Create an array with irregular tiles ArraySchema *array_schema = new ArraySchema(array_name, attribute_names, dim_names, dim_domains, types, ArraySchema::HILBERT); return array_schema; }
31.4375
144
0.678122
qian-long
1ee6fceff5c728389a29f3dcf33426e3b52b9672
5,701
cpp
C++
tket/tests/Graphs/RNG.cpp
vtomole/tket
ded37ab58176d64117a3e11e8a667ce0199a338a
[ "Apache-2.0" ]
null
null
null
tket/tests/Graphs/RNG.cpp
vtomole/tket
ded37ab58176d64117a3e11e8a667ce0199a338a
[ "Apache-2.0" ]
null
null
null
tket/tests/Graphs/RNG.cpp
vtomole/tket
ded37ab58176d64117a3e11e8a667ce0199a338a
[ "Apache-2.0" ]
null
null
null
// Copyright 2019-2022 Cambridge Quantum Computing // // 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 "RNG.hpp" using std::size_t; using std::vector; namespace tket { namespace graphs { namespace tests { size_t RNG::get_size_t(size_t max_value) { if (max_value == 0) { return 0; } // Raw data; now must convert to a value to return! const std::uint64_t random_int = m_engine(); if (max_value > m_engine.max() / 4) { // If choosing such a large potential number of values, // the bias will unavoidably be very bad, // if only generating a single random int. // Surely no deterministic function // f : {0,1,...,N} -> {0,1,...,M} // can be close to giving a uniform distribution, // if N != M are both large and nearly equal. // (Should be a theorem in here somewhere!) if (max_value >= m_engine.max()) { // Care! Maybe max_value+1 == 0 by wraparound, // so we cannot do division by max_value+1 ! return random_int; } return random_int % (max_value + 1); } // NOW we know that max_value+1 won't overflow. // Mathematical note on the below: let: // m = maximum possible value of "random_int" // w = interval_width // v = max possible value to return. // // Thus, random_int could be one of {0,1,2,...,m}, // and we must return one of {0,1,2,...,v}. // // With int arithmetic, we get w = int((m+1)/(v+1)). // // e.g., if m=5, v=2, then w = int(6/3) = 2, // the possible random_int values are {0,1,2,3,4,5}, // and this is partitioned into 3 sets: // {0,1}, {2,3}, {4,5}. // // [Since, with int arithmetic, // int(0/2) = int(1/2) = 0, int(2/2) = int(3/2) = 1, ...] // // Because these sets have equal size 2, each of the values 0,1,2 // has equal probability 1/3 of being returned. // BUT, what if (m+1)/(v+1) is not an integer? // // e.g., m=5, v=3. // Now, we must partition the set {0,1,2,3,4,5} into 4 subsets. // With the below algorithm, w=int((5+1)/(3+1)) = 1, so the partition is // {0}, {1}, {2}, {3,4,5}. // Notice that 0,1,2 have probabilities 1/6 of being returned, // but v=3 has probability 3/6 of being returned, quite a large bias. // // How bad can it be? In general: // // (m+1)/(v+1) - 1 < w <= (m+1)/(v+1). // Thus // m-v+1 <= w(v+1) <= m+1. // // Now, the random_int sets causing the values 0,1,...,v to be returned are // // { 0, 1, ..., w-1} --> returns 0 // { w, w+1, ..., 2w-1} --> returns 1 // {2w, 2w+1, ..., 3w-1} --> returns 2 // .... // {vw, vw+1, ..., (v+1)w - 1, ... , m } --> returns v // // Notice that all sets except the last have size w. // The last set has size m-vw+1. So, the final value v has // more ways than the other values 0,1,... to be returned, by a factor of // // U = (m-vw+1)/w = (m+1)/w - v. // // U is the "bias factor" which we want to be as close to 1 as possible. // Always, U >= (m+1)/[(m+1)/(v+1)] - v = v+1-v = 1, // as we already know. Also, // // U <= (m+1)(v+1)/(m-v+1) - v. // // Let's assume that v << m. // Then we can expand with a geometric series: // (m+1)(v+1)/(m-v+1) = (v+1).[1-v/(m+1)]^{-1} // = (v+1).[1 + v/(m+1) + A] // = v+1 + v(v+1)/(m+1) + (v+1)A, // // where A ~ (v/m)^2, with ~ here meaning // "roughly equal size, up to constant factors". // Thus, U <= 1 + v(v+1)/(m+1) + (v+1)A. // // So, finally, assume also that v(v+1) << m+1. // [This is the same as saying v^2 << m, since m = 2^64-1 is very large, // and thus m+1~m, sqrt(m+1)~sqrt(m)]. // // ...then: A ~ (v^2/m) / m << 1/m, (v+1)A << v/m << 1, // and so U = 1 + C where C << 1. // // Thus, the bias towards the max value v is negligible, as required. // Divide range into approximately equal widths. // Notice, we can't do m_engine.max()+1 because it overflows to 0. // But the chance of getting m_engine.max() is negligibly small anyway. const std::uint64_t interval_width = m_engine.max() / // Doesn't overflow, because of the above checks. (static_cast<std::uint64_t>(max_value) + 1); // interval_width cannot be zero, because we ensured above that // max_value + 1 <= m_engine.max(). const size_t result = random_int / interval_width; // Modulo arithmetic shouldn't be necessary, but be paranoid, // in case there are mistakes in the above analysis (very likely!) return result % (max_value + 1); } size_t RNG::get_size_t(size_t min_value, size_t max_value) { if (min_value > max_value) { std::swap(min_value, max_value); } return min_value + get_size_t(max_value - min_value); } vector<size_t> RNG::get_permutation(size_t size) { vector<size_t> numbers(size); for (size_t i = 0; i < size; ++i) { numbers[i] = i; } do_shuffle(numbers); return numbers; } void RNG::set_seed(size_t seed) { m_engine.seed(seed); } bool RNG::check_percentage(size_t percentage) { // e.g. the numbers {0,1,2,3,4} are 5% // of the numbers {0,1,...,99}. return get_size_t(99) < percentage; } } // namespace tests } // namespace graphs } // namespace tket
33.934524
77
0.592177
vtomole
1ee853fe5916fd89bba1a6a53ff83af9c68b963f
2,691
cpp
C++
vpnor/test/toc_flags.cpp
ibm-openbmc/hiomapd
8cef63e3a3652b25f6a310800c1e0bf09aeed4c6
[ "Apache-2.0" ]
14
2021-11-04T07:47:37.000Z
2022-03-21T10:10:30.000Z
vpnor/test/toc_flags.cpp
ibm-openbmc/hiomapd
8cef63e3a3652b25f6a310800c1e0bf09aeed4c6
[ "Apache-2.0" ]
17
2018-09-20T02:29:41.000Z
2019-04-05T04:43:11.000Z
vpnor/test/toc_flags.cpp
ibm-openbmc/hiomapd
8cef63e3a3652b25f6a310800c1e0bf09aeed4c6
[ "Apache-2.0" ]
9
2017-02-14T03:05:09.000Z
2019-01-07T20:39:42.000Z
// SPDX-License-Identifier: Apache-2.0 // Copyright (C) 2018 IBM Corp. #include "config.h" #include "vpnor/table.hpp" #include <cassert> #include "common.h" #include "vpnor/ffs.h" static constexpr auto BLOCK_SIZE = 4 * 1024; static constexpr auto DATA_MASK = ((1 << 24) - 1); int main() { namespace vpnor = openpower::virtual_pnor; struct pnor_partition part; std::string line; mbox_vlog = mbox_log_console; verbosity = MBOX_LOG_DEBUG; line = "partition01=FOO,00001000,00002000,80,ECC"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert((part.data.user.data[0]) == PARTITION_ECC_PROTECTED); assert(!(part.data.user.data[1] & DATA_MASK)); line = "partition01=FOO,00001000,00002000,80,PRESERVED"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert((part.data.user.data[1] & DATA_MASK) == PARTITION_PRESERVED); line = "partition01=FOO,00001000,00002000,80,READONLY"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert((part.data.user.data[1] & DATA_MASK) == PARTITION_READONLY); /* BACKUP is unimplemented */ line = "partition01=FOO,00001000,00002000,80,BACKUP"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert(!(part.data.user.data[1] & DATA_MASK)); line = "partition01=FOO,00001000,00002000,80,REPROVISION"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert((part.data.user.data[1] & DATA_MASK) == PARTITION_REPROVISION); line = "partition01=FOO,00001000,00002000,80,VOLATILE"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert((part.data.user.data[1] & DATA_MASK) == PARTITION_VOLATILE); line = "partition01=FOO,00001000,00002000,80,CLEARECC"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert((part.data.user.data[1] & DATA_MASK) == PARTITION_CLEARECC); line = "partition01=FOO,00001000,00002000,80,READWRITE"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert(((part.data.user.data[1] & DATA_MASK) ^ PARTITION_READONLY) == PARTITION_READONLY); line = "partition01=FOO,00001000,00002000,80,"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert(!(part.data.user.data[1] & DATA_MASK)); line = "partition01=FOO,00001000,00002000,80,junk"; vpnor::parseTocLine(line, BLOCK_SIZE, part); assert(!(part.data.user.data[0])); assert(!(part.data.user.data[1] & DATA_MASK)); return 0; }
33.6375
74
0.679301
ibm-openbmc
1ee88c7ebbc8356fbd7ff45399685e767a35509f
2,742
cpp
C++
src/utils/ImageFileUtil.cpp
skn123/CudaOtsu
6b997b4ee8ce7e006a59e06a2f4539696c25d721
[ "MIT" ]
6
2021-03-08T10:07:27.000Z
2022-01-20T06:11:15.000Z
src/utils/ImageFileUtil.cpp
skn123/CudaOtsu
6b997b4ee8ce7e006a59e06a2f4539696c25d721
[ "MIT" ]
9
2018-11-26T10:29:59.000Z
2019-09-04T07:28:18.000Z
src/utils/ImageFileUtil.cpp
skn123/CudaOtsu
6b997b4ee8ce7e006a59e06a2f4539696c25d721
[ "MIT" ]
5
2019-05-30T08:04:46.000Z
2020-12-17T08:18:22.000Z
#include "ImageFileUtil.h" #include "../libs/lodepng.h" #include <iostream> #include <sstream> #include <fstream> ImageFileUtil::ImageFileUtil() {} PngImage* ImageFileUtil::loadPngFile(const char* filename) { std::vector<unsigned char> png; std::vector<unsigned char> rawImage; unsigned imageWidth; unsigned imageHeight; if (!fileExists(filename)) { std::cout << "Cannot find or open file: " << filename << std::endl; return nullptr; } unsigned error = lodepng::load_file(png, filename); if (!error) { error = lodepng::decode(rawImage, imageWidth, imageHeight, png); } if (error) { std::cout << lodepng_error_text(error) << std::endl; return nullptr; } return new PngImage(filename, imageWidth, imageHeight, rawImage); } void ImageFileUtil::savePngFile(PngImage* pngImage, const char* newFileName = nullptr) { std::vector<unsigned char> png; unsigned error = lodepng::encode(png, pngImage->getRawPixelData(), pngImage->getWidth(), pngImage->getHeight()); const char* filename = newFileName != nullptr ? newFileName : pngImage->getFilename(); if (!error) lodepng::save_file(png, filename); if (error) { std::cout << lodepng_error_text(error) << std::endl; } } std::string ImageFileUtil::addPrefix(std::string fullFilePath, const char* prefix) { std::vector<std::string> pathParts; const char osPathDelimiter = getOsPathDelimiter(); pathParts = splitString(fullFilePath, osPathDelimiter); std::string newPathPart = pathParts.back(); pathParts.pop_back(); pathParts.push_back(prefix + newPathPart); return joinString(pathParts, osPathDelimiter); } std::vector<std::string> ImageFileUtil::splitString(std::string stringToSplit, const char delimiter) { std::vector<std::string> parts; std::istringstream f(stringToSplit); std::string part; while (std::getline(f, part, delimiter)) { parts.push_back(part); } return parts; } std::string ImageFileUtil::joinString(std::vector<std::string> strings, const char delimiter) { std::string resultString = strings.front(); for (std::vector<std::string>::size_type i = 1; i != strings.size(); i++) { resultString.append(delimiter + strings[i]); } return resultString; } void ImageFileUtil::saveCsvFile(std::vector<std::string> rows, const char * filename) { std::ofstream csvFile; csvFile.open(filename, std::ofstream::app); for (std::vector<std::string>::size_type i = 0; i != rows.size(); i++) { csvFile << rows[i] + "\n"; } csvFile.close(); } bool ImageFileUtil::fileExists(const char *fileName) { std::ifstream infile(fileName); return infile.good(); } char ImageFileUtil::getOsPathDelimiter() { #if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__) return '\\'; #endif return '/'; }
25.626168
113
0.712619
skn123
1eeefdf0d07916c5eefbbf7e284b65503b3b4158
1,542
hpp
C++
gui/grid_widget.hpp
myra-b/ising
2e03e121e37ecf00411f4aaf3275fa9259dd40d3
[ "Apache-2.0" ]
3
2017-09-19T11:27:59.000Z
2019-05-09T08:46:07.000Z
gui/grid_widget.hpp
myrabiedermann/ising
2e03e121e37ecf00411f4aaf3275fa9259dd40d3
[ "Apache-2.0" ]
3
2017-11-14T23:13:39.000Z
2017-12-12T11:46:53.000Z
gui/grid_widget.hpp
myrabiedermann/ising
2e03e121e37ecf00411f4aaf3275fa9259dd40d3
[ "Apache-2.0" ]
1
2017-08-16T12:43:37.000Z
2017-08-16T12:43:37.000Z
#pragma once #ifdef QT_NO_DEBUG #ifndef QT_NO_DEBUG_OUTPUT #define QT_NO_DEBUG_OUTPUT #endif #endif #ifndef USE_MATH_DEFINES #define USE_MATH_DEFINES #endif // #include "global.hpp" #include "system/montecarlohost.hpp" #include "system/spinsystem.hpp" #include <QGraphicsView> #include <QGraphicsScene> #include <QWidget> #include <QGridLayout> #include <QRect> #include <QtDebug> #include <QShowEvent> #include <cmath> #include <type_traits> #include <cstdint> #include <iostream> class GridWidget : public QGraphicsView { Q_OBJECT public: explicit GridWidget(QWidget *parent = Q_NULLPTR); GridWidget(const GridWidget&) = delete; void operator=(const GridWidget&) = delete; ~GridWidget(); void showEvent(QShowEvent *); void setRowsColumns(unsigned short,unsigned short); void setRows(unsigned short); void setColumns(unsigned short); public slots: void draw(const MonteCarloHost&); void draw(const Spinsystem&); void draw_test(); void refresh(); protected: QBrush getSpinColor(const Spin& spin); void drawRectangle(unsigned short, unsigned short, unsigned short, unsigned short, QPen, QBrush); void makeNewScene(); private: unsigned short rows = 0; unsigned short columns = 0; unsigned short width_of_rectangular = 0; unsigned short height_of_rectangular = 0; const unsigned short scene_width = 500; const unsigned short scene_height = 500; QGraphicsScene* scene; };
21.71831
101
0.699741
myra-b
1ef035004271d4796b96fa5f8b9c5fc1c2460552
1,173
cpp
C++
Library/Source/Blocks/FHBlock.cpp
AutomotiveDevOps/mdf4-converters
5c6624ca0a56317ce296233cb3fc80362b07a175
[ "MIT" ]
null
null
null
Library/Source/Blocks/FHBlock.cpp
AutomotiveDevOps/mdf4-converters
5c6624ca0a56317ce296233cb3fc80362b07a175
[ "MIT" ]
null
null
null
Library/Source/Blocks/FHBlock.cpp
AutomotiveDevOps/mdf4-converters
5c6624ca0a56317ce296233cb3fc80362b07a175
[ "MIT" ]
null
null
null
#include "FHBlock.h" #include <boost/endian/buffers.hpp> namespace mdf { #pragma pack(push, 1) struct FHBlockData { boost::endian::little_uint64_buf_t time_ns; boost::endian::little_uint16_buf_t tz_offset_min; boost::endian::little_uint16_buf_t dst_offset_min; boost::endian::little_uint8_buf_t time_flags; boost::endian::little_uint8_buf_t reserved[3]; }; #pragma pack(pop) bool FHBlock::load(uint8_t const* dataPtr) { bool result = false; // Load data into a struct for easier access. auto ptr = reinterpret_cast<FHBlockData const*>(dataPtr); timeNs = ptr->time_ns.value(); tzOffsetMin = ptr->tz_offset_min.value(); dstOffsetMin = ptr->dst_offset_min.value(); timeFlags = ptr->time_flags.value(); result = true; return result; } bool FHBlock::saveBlockData(uint8_t* dataPtr) { auto ptr = reinterpret_cast<FHBlockData*>(dataPtr); ptr->time_ns = timeNs; ptr->tz_offset_min = tzOffsetMin; ptr->dst_offset_min = dstOffsetMin; ptr->time_flags = timeFlags; return true; } }
26.659091
65
0.638534
AutomotiveDevOps
1ef2387c954bd00f8f4f0cea3ba1c849ce921e28
26,464
cpp
C++
Tools/GUILayer/UITypesBinding.cpp
yorung/XLE
083ce4c9d3fe32002ff5168e571cada2715bece4
[ "MIT" ]
1
2016-06-01T10:41:12.000Z
2016-06-01T10:41:12.000Z
Tools/GUILayer/UITypesBinding.cpp
yorung/XLE
083ce4c9d3fe32002ff5168e571cada2715bece4
[ "MIT" ]
null
null
null
Tools/GUILayer/UITypesBinding.cpp
yorung/XLE
083ce4c9d3fe32002ff5168e571cada2715bece4
[ "MIT" ]
null
null
null
// Copyright 2015 XLGAMES Inc. // // Distributed under the MIT License (See // accompanying file "LICENSE" or the website // http://www.opensource.org/licenses/mit-license.php) #pragma warning(disable:4512) #include "UITypesBinding.h" #include "EngineForward.h" #include "ExportedNativeTypes.h" #include "../ToolsRig/ModelVisualisation.h" #include "../ToolsRig/VisualisationUtils.h" #include "../../RenderCore/Assets/Material.h" #include "../../RenderCore/Assets/MaterialScaffold.h" #include "../../RenderCore/Metal/State.h" #include "../../Assets/DivergentAsset.h" #include "../../Assets/AssetUtils.h" #include "../../Assets/AssetServices.h" #include "../../Assets/InvalidAssetManager.h" #include "../../Assets/ConfigFileContainer.h" #include "../../Utility/StringFormat.h" #include <msclr/auto_gcroot.h> #include <iomanip> namespace Assets { template<> std::basic_string<ResChar> BuildTargetFilename<RenderCore::Assets::RawMaterial>(const char* init) { RenderCore::Assets::RawMaterial::RawMatSplitName splitName(init); return splitName._concreteFilename; } } namespace GUILayer { /////////////////////////////////////////////////////////////////////////////////////////////////// class InvalidatePropertyGrid : public OnChangeCallback { public: void OnChange(); InvalidatePropertyGrid(PropertyGrid^ linked); ~InvalidatePropertyGrid(); protected: msclr::auto_gcroot<PropertyGrid^> _linked; }; void InvalidatePropertyGrid::OnChange() { if (_linked.get()) { _linked->Refresh(); } } InvalidatePropertyGrid::InvalidatePropertyGrid(PropertyGrid^ linked) : _linked(linked) {} InvalidatePropertyGrid::~InvalidatePropertyGrid() {} void ModelVisSettings::AttachCallback(PropertyGrid^ callback) { _object->_changeEvent._callbacks.push_back( std::shared_ptr<OnChangeCallback>(new InvalidatePropertyGrid(callback))); } ModelVisSettings^ ModelVisSettings::CreateDefault() { auto attached = std::make_shared<ToolsRig::ModelVisSettings>(); return gcnew ModelVisSettings(std::move(attached)); } void ModelVisSettings::ModelName::set(String^ value) { // we need to make a filename relative to the current working // directory auto nativeName = clix::marshalString<clix::E_UTF8>(value); ::Assets::ResolvedAssetFile resName; ::Assets::MakeAssetName(resName, nativeName.c_str()); _object->_modelName = resName._fn; // also set the material name (the old material file probably won't match the new model file) XlChopExtension(resName._fn); XlCatString(resName._fn, dimof(resName._fn), ".material"); _object->_materialName = resName._fn; _object->_pendingCameraAlignToModel = true; _object->_changeEvent.Trigger(); } void ModelVisSettings::MaterialName::set(String^ value) { // we need to make a filename relative to the current working // directory auto nativeName = clix::marshalString<clix::E_UTF8>(value); ::Assets::ResolvedAssetFile resName; ::Assets::MakeAssetName(resName, nativeName.c_str()); _object->_materialName = resName._fn; _object->_changeEvent.Trigger(); } /////////////////////////////////////////////////////////////////////////////////////////////////// System::String^ VisMouseOver::IntersectionPt::get() { if (_object->_hasMouseOver) { return clix::marshalString<clix::E_UTF8>( std::string(StringMeld<64>() << std::setprecision(5) << _object->_intersectionPt[0] << "," << _object->_intersectionPt[1] << "," << _object->_intersectionPt[2])); } else { return "<<no intersection>>"; } } unsigned VisMouseOver::DrawCallIndex::get() { if (_object->_hasMouseOver) { return _object->_drawCallIndex; } else { return ~unsigned(0x0); } } System::String^ VisMouseOver::MaterialName::get() { auto fullName = FullMaterialName; if (fullName) { auto split = fullName->Split(';'); if (split && split->Length > 0) { auto s = split[split->Length-1]; int index = s->IndexOf(':'); return s->Substring((index>=0) ? (index+1) : 0); } } return "<<no material>>"; } System::String^ VisMouseOver::ModelName::get() { return clix::marshalString<clix::E_UTF8>(_modelSettings->_modelName); } bool VisMouseOver::HasMouseOver::get() { return _object->_hasMouseOver; } System::String^ VisMouseOver::FullMaterialName::get() { if (_object->_hasMouseOver) { auto scaffolds = _modelCache->GetScaffolds(_modelSettings->_modelName.c_str(), _modelSettings->_materialName.c_str()); if (scaffolds._material) { auto matName = scaffolds._material->GetMaterialName(_object->_materialGuid); if (matName) { return clix::marshalString<clix::E_UTF8>(std::string(matName)); } } } return nullptr; } uint64 VisMouseOver::MaterialBindingGuid::get() { if (_object->_hasMouseOver) { return _object->_materialGuid; } else { return ~uint64(0x0); } } void VisMouseOver::AttachCallback(PropertyGrid^ callback) { _object->_changeEvent._callbacks.push_back( std::shared_ptr<OnChangeCallback>(new InvalidatePropertyGrid(callback))); } VisMouseOver::VisMouseOver( std::shared_ptr<ToolsRig::VisMouseOver> attached, std::shared_ptr<ToolsRig::ModelVisSettings> settings, std::shared_ptr<RenderCore::Assets::ModelCache> cache) { _object = std::move(attached); _modelSettings = std::move(settings); _modelCache = std::move(cache); } VisMouseOver::VisMouseOver() { _object = std::make_shared<ToolsRig::VisMouseOver>(); } VisMouseOver::~VisMouseOver() { _object.reset(); _modelSettings.reset(); _modelCache.reset(); } /////////////////////////////////////////////////////////////////////////////////////////////////// template<typename NameType, typename ValueType> NameType PropertyPair<NameType, ValueType>::Name::get() { return _name; } template<typename NameType, typename ValueType> void PropertyPair<NameType, ValueType>::Name::set(NameType newValue) { _name = newValue; NotifyPropertyChanged("Name"); } template<typename NameType, typename ValueType> ValueType PropertyPair<NameType, ValueType>::Value::get() { return _value; } template<typename NameType, typename ValueType> void PropertyPair<NameType, ValueType>::Value::set(ValueType newValue) { _value = newValue; NotifyPropertyChanged("Value"); } template<typename NameType, typename ValueType> void PropertyPair<NameType, ValueType>::NotifyPropertyChanged(System::String^ propertyName) { PropertyChanged(this, gcnew PropertyChangedEventArgs(propertyName)); // _propertyChangedContext->Send( // gcnew System::Threading::SendOrPostCallback( // o => PropertyChanged(this, gcnew PropertyChangedEventArgs(propertyName)) // ), nullptr); } public ref class BindingConv { public: static BindingList<StringStringPair^>^ AsBindingList(const ParameterBox& paramBox); static ParameterBox AsParameterBox(BindingList<StringStringPair^>^); static ParameterBox AsParameterBox(BindingList<StringIntPair^>^); }; BindingList<StringStringPair^>^ BindingConv::AsBindingList(const ParameterBox& paramBox) { auto result = gcnew BindingList<StringStringPair^>(); std::vector<std::pair<const utf8*, std::string>> stringTable; BuildStringTable(stringTable, paramBox); for (auto i=stringTable.cbegin(); i!=stringTable.cend(); ++i) { result->Add( gcnew StringStringPair( clix::marshalString<clix::E_UTF8>(i->first), clix::marshalString<clix::E_UTF8>(i->second))); } return result; } ParameterBox BindingConv::AsParameterBox(BindingList<StringStringPair^>^ input) { ParameterBox result; for each(auto i in input) { // We get items with null names when they are being added, but // not quite finished yet. We have to ignore in this case. if (i->Name && i->Name->Length > 0 && i->Value) { result.SetParameter( (const utf8*)clix::marshalString<clix::E_UTF8>(i->Name).c_str(), clix::marshalString<clix::E_UTF8>(i->Value).c_str()); } } return result; } ParameterBox BindingConv::AsParameterBox(BindingList<StringIntPair^>^ input) { ParameterBox result; for each(auto i in input) { // We get items with null names when they are being added, but // not quite finished yet. We have to ignore in this case. if (i->Name && i->Name->Length > 0) { result.SetParameter( (const utf8*)clix::marshalString<clix::E_UTF8>(i->Name).c_str(), i->Value); } } return result; } /////////////////////////////////////////////////////////////////////////////////////////////////// BindingList<StringStringPair^>^ RawMaterial::MaterialParameterBox::get() { if (!_underlying) { return nullptr; } if (!_materialParameterBox) { _materialParameterBox = BindingConv::AsBindingList(_underlying->GetAsset()._asset._matParamBox); _materialParameterBox->ListChanged += gcnew ListChangedEventHandler( this, &RawMaterial::ParameterBox_Changed); _materialParameterBox->AllowNew = true; _materialParameterBox->AllowEdit = true; } return _materialParameterBox; } BindingList<StringStringPair^>^ RawMaterial::ShaderConstants::get() { if (!_underlying) { return nullptr; } if (!_shaderConstants) { _shaderConstants = BindingConv::AsBindingList(_underlying->GetAsset()._asset._constants); _shaderConstants->ListChanged += gcnew ListChangedEventHandler( this, &RawMaterial::ParameterBox_Changed); _shaderConstants->AllowNew = true; _shaderConstants->AllowEdit = true; } return _shaderConstants; } BindingList<StringStringPair^>^ RawMaterial::ResourceBindings::get() { if (!_underlying) { return nullptr; } if (!_resourceBindings) { _resourceBindings = BindingConv::AsBindingList(_underlying->GetAsset()._asset._resourceBindings); _resourceBindings->ListChanged += gcnew ListChangedEventHandler( this, &RawMaterial::ResourceBinding_Changed); _resourceBindings->AllowNew = true; _resourceBindings->AllowEdit = true; } return _resourceBindings; } void RawMaterial::ParameterBox_Changed(System::Object^ obj, ListChangedEventArgs^e) { // Commit these changes back to the native object by re-creating the parameter box // Ignore a couple of cases... // - moving an item is unimportant // - added a new item with a null name (this occurs when the new item // hasn't been fully filled in yet) // Similarly, don't we really need to process a removal of an item with // an empty name.. but there's no way to detect this case if (e->ListChangedType == ListChangedType::ItemMoved) { return; } using Box = BindingList<StringStringPair^>; if (e->ListChangedType == ListChangedType::ItemAdded) { assert(e->NewIndex < ((Box^)obj)->Count); if (!((Box^)obj)[e->NewIndex]->Name || ((Box^)obj)[e->NewIndex]->Name->Length > 0) { return; } } if (!!_underlying) { if (obj == _materialParameterBox) { auto transaction = _underlying->Transaction_Begin("Material parameter"); if (transaction) { transaction->GetAsset()._asset._matParamBox = BindingConv::AsParameterBox(_materialParameterBox); transaction->Commit(); } } else if (obj == _shaderConstants) { auto transaction = _underlying->Transaction_Begin("Material constant"); if (transaction) { transaction->GetAsset()._asset._constants = BindingConv::AsParameterBox(_shaderConstants); transaction->Commit(); } } } } void RawMaterial::ResourceBinding_Changed(System::Object^ obj, ListChangedEventArgs^ e) { if (e->ListChangedType == ListChangedType::ItemMoved) { return; } using Box = BindingList<StringStringPair^>; if (e->ListChangedType == ListChangedType::ItemAdded) { assert(e->NewIndex < ((Box^)obj)->Count); if (!((Box^)obj)[e->NewIndex]->Name || ((Box^)obj)[e->NewIndex]->Name->Length > 0) { return; } } if (!!_underlying) { assert(obj == _resourceBindings); auto transaction = _underlying->Transaction_Begin("Resource Binding"); if (transaction) { transaction->GetAsset()._asset._resourceBindings = BindingConv::AsParameterBox(_resourceBindings); transaction->Commit(); } } } List<System::String^>^ RawMaterial::BuildInheritanceList() { // create a RawMaterial wrapper object for all of the inheritted objects if (!!_underlying) { auto result = gcnew List<System::String^>(); auto& asset = _underlying->GetAsset(); auto searchRules = ::Assets::DefaultDirectorySearchRules( clix::marshalString<clix::E_UTF8>(_filename).c_str()); auto inheritted = asset._asset.ResolveInherited(searchRules); for (auto i = inheritted.cbegin(); i != inheritted.cend(); ++i) { result->Add(clix::marshalString<clix::E_UTF8>(*i)); } return result; } return nullptr; } List<System::String^>^ RawMaterial::BuildInheritanceList(System::String^ topMost) { auto temp = gcnew RawMaterial(topMost); auto result = temp->BuildInheritanceList(); delete temp; return result; } System::String^ RawMaterial::Filename::get() { return _filename; } System::String^ RawMaterial::SettingName::get() { return _settingName; } const RenderCore::Assets::RawMaterial* RawMaterial::GetUnderlying() { return (!!_underlying) ? &_underlying->GetAsset()._asset : nullptr; } RawMaterial::RawMaterial(System::String^ initialiser) { auto nativeInit = clix::marshalString<clix::E_UTF8>(initialiser); RenderCore::Assets::RawMaterial::RawMatSplitName splitName(nativeInit.c_str()); auto& source = ::Assets::GetDivergentAsset< ::Assets::ConfigFileListContainer<RenderCore::Assets::RawMaterial>>(splitName._initializerName.c_str()); _underlying = source; _filename = clix::marshalString<clix::E_UTF8>(splitName._concreteFilename); _settingName = clix::marshalString<clix::E_UTF8>(splitName._settingName); _renderStateSet = gcnew RenderStateSet(_underlying.GetNativePtr()); } // RawMaterial::RawMaterial( // std::shared_ptr<NativeConfig> underlying) // { // _underlying = std::move(underlying); // _renderStateSet = gcnew RenderStateSet(_underlying.GetNativePtr()); // _filename = "unknown"; // _settingName = "unknown"; // } RawMaterial::RawMaterial(RawMaterial^ cloneFrom) { _underlying = cloneFrom->_underlying; _renderStateSet = gcnew RenderStateSet(_underlying.GetNativePtr()); _filename = cloneFrom->_filename; _settingName = cloneFrom->_filename; } RawMaterial::~RawMaterial() { _underlying.reset(); delete _renderStateSet; } /////////////////////////////////////////////////////////////////////////////////////////////////// auto RenderStateSet::DoubleSided::get() -> CheckState { auto& stateSet = _underlying->GetAsset()._asset._stateSet; if (stateSet._flag & RenderCore::Assets::RenderStateSet::Flag::DoubleSided) { if (stateSet._doubleSided) return CheckState::Checked; else return CheckState::Unchecked; } return CheckState::Indeterminate; } void RenderStateSet::DoubleSided::set(CheckState checkState) { auto transaction = _underlying->Transaction_Begin("RenderState"); auto& stateSet = transaction->GetAsset()._asset._stateSet; if (checkState == CheckState::Indeterminate) { stateSet._flag &= ~RenderCore::Assets::RenderStateSet::Flag::DoubleSided; } else { stateSet._flag |= RenderCore::Assets::RenderStateSet::Flag::DoubleSided; stateSet._doubleSided = (checkState == CheckState::Checked); } transaction->Commit(); NotifyPropertyChanged("DoubleSided"); } CheckState RenderStateSet::Wireframe::get() { auto& stateSet = _underlying->GetAsset()._asset._stateSet; if (stateSet._flag & RenderCore::Assets::RenderStateSet::Flag::Wireframe) { if (stateSet._wireframe) return CheckState::Checked; else return CheckState::Unchecked; } return CheckState::Indeterminate; } void RenderStateSet::Wireframe::set(CheckState checkState) { auto transaction = _underlying->Transaction_Begin("RenderState"); auto& stateSet = transaction->GetAsset()._asset._stateSet; if (checkState == CheckState::Indeterminate) { stateSet._flag &= ~RenderCore::Assets::RenderStateSet::Flag::Wireframe; } else { stateSet._flag |= RenderCore::Assets::RenderStateSet::Flag::Wireframe; stateSet._wireframe = (checkState == CheckState::Checked); } transaction->Commit(); NotifyPropertyChanged("Wireframe"); } auto RenderStateSet::DeferredBlend::get() -> DeferredBlendState { return DeferredBlendState::Unset; } void RenderStateSet::DeferredBlend::set(DeferredBlendState) { NotifyPropertyChanged("DeferredBlend"); } class StandardBlendDef { public: StandardBlendModes _standardMode; RenderCore::Metal::BlendOp::Enum _op; RenderCore::Metal::Blend::Enum _src; RenderCore::Metal::Blend::Enum _dst; }; namespace BlendOp = RenderCore::Metal::BlendOp; using namespace RenderCore::Metal::Blend; static const StandardBlendDef s_standardBlendDefs[] = { { StandardBlendModes::NoBlending, BlendOp::NoBlending, One, RenderCore::Metal::Blend::Zero }, { StandardBlendModes::Decal, BlendOp::NoBlending, One, RenderCore::Metal::Blend::Zero }, { StandardBlendModes::Transparent, BlendOp::Add, SrcAlpha, InvSrcAlpha }, { StandardBlendModes::TransparentPremultiplied, BlendOp::Add, One, InvSrcAlpha }, { StandardBlendModes::Add, BlendOp::Add, One, One }, { StandardBlendModes::AddAlpha, BlendOp::Add, SrcAlpha, One }, { StandardBlendModes::Subtract, BlendOp::Subtract, One, One }, { StandardBlendModes::SubtractAlpha, BlendOp::Subtract, SrcAlpha, One }, { StandardBlendModes::Min, BlendOp::Min, One, One }, { StandardBlendModes::Max, BlendOp::Max, One, One } }; StandardBlendModes AsStandardBlendMode( const RenderCore::Assets::RenderStateSet& stateSet) { auto op = stateSet._forwardBlendOp; auto src = stateSet._forwardBlendSrc; auto dst = stateSet._forwardBlendDst; if (!(stateSet._flag & RenderCore::Assets::RenderStateSet::Flag::ForwardBlend)) { if (stateSet._flag & RenderCore::Assets::RenderStateSet::Flag::DeferredBlend) { if (stateSet._deferredBlend == RenderCore::Assets::RenderStateSet::DeferredBlend::Decal) return StandardBlendModes::Decal; return StandardBlendModes::NoBlending; } return StandardBlendModes::Inherit; } if (op == BlendOp::NoBlending) { if (stateSet._flag & RenderCore::Assets::RenderStateSet::Flag::DeferredBlend) if (stateSet._deferredBlend == RenderCore::Assets::RenderStateSet::DeferredBlend::Decal) return StandardBlendModes::Decal; return StandardBlendModes::NoBlending; } for (unsigned c=0; c<dimof(s_standardBlendDefs); ++c) if ( op == s_standardBlendDefs[c]._op && src == s_standardBlendDefs[c]._src && dst == s_standardBlendDefs[c]._dst) return s_standardBlendDefs[c]._standardMode; return StandardBlendModes::Complex; } auto RenderStateSet::StandardBlendMode::get() -> StandardBlendModes { const auto& underlying = _underlying->GetAsset(); return AsStandardBlendMode(underlying._asset._stateSet); } void RenderStateSet::StandardBlendMode::set(StandardBlendModes newMode) { if (newMode == StandardBlendModes::Complex) return; if (newMode == StandardBlendMode) return; if (newMode == StandardBlendModes::Inherit) { auto transaction = _underlying->Transaction_Begin("RenderState"); auto& stateSet = transaction->GetAsset()._asset._stateSet; stateSet._forwardBlendOp = BlendOp::NoBlending; stateSet._forwardBlendSrc = One; stateSet._forwardBlendDst = RenderCore::Metal::Blend::Zero; stateSet._deferredBlend = RenderCore::Assets::RenderStateSet::DeferredBlend::Opaque; stateSet._flag &= ~RenderCore::Assets::RenderStateSet::Flag::ForwardBlend; stateSet._flag &= ~RenderCore::Assets::RenderStateSet::Flag::DeferredBlend; NotifyPropertyChanged("StandardBlendMode"); transaction->Commit(); return; } for (unsigned c=0; c<dimof(s_standardBlendDefs); ++c) if (s_standardBlendDefs[c]._standardMode == newMode) { auto transaction = _underlying->Transaction_Begin("RenderState"); auto& stateSet = transaction->GetAsset()._asset._stateSet; stateSet._forwardBlendOp = s_standardBlendDefs[c]._op; stateSet._forwardBlendSrc = s_standardBlendDefs[c]._src; stateSet._forwardBlendDst = s_standardBlendDefs[c]._dst; stateSet._deferredBlend = RenderCore::Assets::RenderStateSet::DeferredBlend::Opaque; stateSet._flag |= RenderCore::Assets::RenderStateSet::Flag::ForwardBlend; stateSet._flag &= ~RenderCore::Assets::RenderStateSet::Flag::DeferredBlend; if (newMode == StandardBlendModes::Decal) { stateSet._deferredBlend = RenderCore::Assets::RenderStateSet::DeferredBlend::Decal; stateSet._flag |= RenderCore::Assets::RenderStateSet::Flag::DeferredBlend; } transaction->Commit(); NotifyPropertyChanged("StandardBlendMode"); return; } } RenderStateSet::RenderStateSet(std::shared_ptr<NativeConfig> underlying) { _underlying = std::move(underlying); _propertyChangedContext = System::Threading::SynchronizationContext::Current; } RenderStateSet::~RenderStateSet() { _underlying.reset(); } void RenderStateSet::NotifyPropertyChanged(System::String^ propertyName) { // This only works correctly in the UI thread. However, given that // this event can be raised by low-level engine code, we might be // in some other thread. We can get around that by using the // synchronisation functionality in .net to post a message to the // UI thread... That requires creating a delegate type and passing // propertyName to it. It's easy in C#. But it's a little more difficult // in C++/CLI. PropertyChanged(this, gcnew PropertyChangedEventArgs(propertyName)); // _propertyChangedContext->Send( // gcnew System::Threading::SendOrPostCallback( // o => PropertyChanged(this, gcnew PropertyChangedEventArgs(propertyName)) // ), nullptr); } /////////////////////////////////////////////////////////////////////////////////////////////////// InvalidAssetList::InvalidAssetList() { _assetList = gcnew List<Tuple<String^, String^>^>(); // get the list of assets from the underlying manager auto list = ::Assets::Services::GetInvalidAssetMan().GetAssets(); for (const auto& i : list) { _assetList->Add(gcnew Tuple<String^, String^>( clix::marshalString<clix::E_UTF8>(i._name), clix::marshalString<clix::E_UTF8>(i._errorString))); } } bool InvalidAssetList::HasInvalidAssets() { return ::Assets::Services::GetInvalidAssetMan().HasInvalidAssets(); } /////////////////////////////////////////////////////////////////////////////////////////////////// template PropertyPair<System::String^, unsigned>; template PropertyPair<System::String^, System::String^>; }
38.022989
130
0.599607
yorung
1ef4549004d79180e6d815c3e1c90e953ab6bd85
3,651
cpp
C++
src/main.cpp
dniklaus/wiring-adafruit-fram-spi-test
68d837325c512482d98f60414567764871a84fac
[ "MIT" ]
1
2021-01-07T13:10:17.000Z
2021-01-07T13:10:17.000Z
src/main.cpp
dniklaus/wiring-adafruit-fram-spi-test
68d837325c512482d98f60414567764871a84fac
[ "MIT" ]
null
null
null
src/main.cpp
dniklaus/wiring-adafruit-fram-spi-test
68d837325c512482d98f60414567764871a84fac
[ "MIT" ]
null
null
null
/* * main.cpp * * Created on: 15.03.2017 * Author: niklausd */ #include <Arduino.h> #include <SPI.h> #include <Adafruit_FRAM_SPI.h> // PlatformIO libraries #include <SerialCommand.h> // pio lib install 173, lib details see https://github.com/kroimon/Arduino-SerialCommand #include <Timer.h> // pio lib install 1699, lib details see https://github.com/dniklaus/wiring-timer // private libraries #include <DbgCliNode.h> #include <DbgCliTopic.h> #include <DbgCliCommand.h> #include <DbgTracePort.h> #include <DbgTraceContext.h> #include <DbgTraceOut.h> #include <DbgPrintConsole.h> #include <DbgTraceLevel.h> #include <AppDebug.h> #include <ProductDebug.h> #include <RamUtils.h> #ifndef BUILTIN_LED #define BUILTIN_LED 13 #endif SerialCommand* sCmd = 0; /* Example code to interrogate Adafruit SPI FRAM breakout for address size and storage capacity */ /* NOTE: This sketch will overwrite data already on the FRAM breakout */ uint8_t FRAM_CS = 10; Adafruit_FRAM_SPI fram = Adafruit_FRAM_SPI(); // use hardware SPI uint8_t FRAM_SCK = 13; uint8_t FRAM_MISO = 12; uint8_t FRAM_MOSI = 11; //Or use software SPI, any pins! //Adafruit_FRAM_SPI fram = Adafruit_FRAM_SPI(FRAM_SCK, FRAM_MISO, FRAM_MOSI, FRAM_CS); uint8_t addrSizeInBytes = 2; //Default to address size of two bytes uint32_t memSize; #if defined(ARDUINO_ARCH_SAMD) // for Zero, output on USB Serial console, remove line below if using programming port to program the Zero! #define Serial SerialUSB #endif int32_t readBack(uint32_t addr, int32_t data) { int32_t check = !data; int32_t wrapCheck, backup; fram.read(addr, (uint8_t*) &backup, sizeof(int32_t)); fram.writeEnable(true); fram.write(addr, (uint8_t*) &data, sizeof(int32_t)); fram.writeEnable(false); fram.read(addr, (uint8_t*) &check, sizeof(int32_t)); fram.read(0, (uint8_t*) &wrapCheck, sizeof(int32_t)); fram.writeEnable(true); fram.write(addr, (uint8_t*) &backup, sizeof(int32_t)); fram.writeEnable(false); // Check for warparound, address 0 will work anyway if (wrapCheck == check) { check = 0; } return check; } bool testAddrSize(uint8_t addrSize) { fram.setAddressSize(addrSize); if (readBack(4, 0xbeefbead) == 0xbeefbead) { return true; } return false; } void setup() { pinMode(BUILTIN_LED, OUTPUT); digitalWrite(BUILTIN_LED, 0); setupProdDebugEnv(); if (fram.begin(FRAM_CS, addrSizeInBytes)) { Serial.println("Found SPI FRAM"); } else { Serial.println("No SPI FRAM found ... check your connections\r\n"); while (1) ; } if (testAddrSize(2)) { addrSizeInBytes = 2; } else if (testAddrSize(3)) { addrSizeInBytes = 3; } else if (testAddrSize(4)) { addrSizeInBytes = 4; } else { Serial.println( "SPI FRAM can not be read/written with any address size\r\n"); while (1) { ; } } memSize = 0; while (readBack(memSize, memSize) == memSize) { memSize += 256; //Serial.print("Block: #"); Serial.println(memSize/256); } Serial.print("SPI FRAM address size is "); Serial.print(addrSizeInBytes); Serial.println(" bytes."); Serial.println("SPI FRAM capacity appears to be.."); Serial.print(memSize); Serial.println(" bytes"); Serial.print(memSize/0x400); Serial.println(" kilobytes"); Serial.print((memSize*8)/0x400); Serial.println(" kilobits"); if (memSize >= (0x100000/8)) { Serial.print((memSize*8)/0x100000); Serial.println(" megabits"); } } void loop() { if (0 != sCmd) { sCmd->readSerial(); // process serial commands } yield(); // process Timers }
23.554839
116
0.676527
dniklaus
1ef4dd357e2c5781a5f96babebc9f2cbec703052
109
hpp
C++
src/include/randest/data_provider.hpp
renegat96/randest
29449ff61398526cc1b88a1f003ed8fddef14693
[ "MIT" ]
null
null
null
src/include/randest/data_provider.hpp
renegat96/randest
29449ff61398526cc1b88a1f003ed8fddef14693
[ "MIT" ]
null
null
null
src/include/randest/data_provider.hpp
renegat96/randest
29449ff61398526cc1b88a1f003ed8fddef14693
[ "MIT" ]
null
null
null
#include <randest/data_provider.tcc> #include <randest/mem_data.hpp> #include <randest/binary_file_data.hpp>
27.25
39
0.807339
renegat96
1ef53ec52f3b80be3446bc57cdd8442819d20fc5
3,867
cpp
C++
src/bindings/Scriptdev2/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp
mfooo/wow
3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d
[ "OpenSSL" ]
1
2017-11-16T19:04:07.000Z
2017-11-16T19:04:07.000Z
src/bindings/Scriptdev2/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp
mfooo/wow
3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d
[ "OpenSSL" ]
null
null
null
src/bindings/Scriptdev2/scripts/kalimdor/caverns_of_time/culling_of_stratholme/boss_meathook.cpp
mfooo/wow
3e5fad4cfdf0fd1c0a2fd7c9844e6f140a1bb32d
[ "OpenSSL" ]
null
null
null
/* Copyright (C) 2006 - 2010 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/> * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ /* ScriptData SDName: instance_culling_of_stratholme SD%Complete: ?% SDComment: by MaxXx2021 SDCategory: Culling of Stratholme EndScriptData */ #include "precompiled.h" #include "def_culling_of_stratholme.h" enum { SPELL_CHAIN_N = 52696, SPELL_CHAIN_H = 58823, SPELL_EXPLODED_N = 52666, SPELL_EXPLODED_H = 58824, SPELL_FRENZY = 58841, SAY_MEATHOOK_AGGRO = -1594111, SAY_MEATHOOK_DEATH = -1594112, SAY_MEATHOOK_SLAY01 = -1594113, SAY_MEATHOOK_SLAY02 = -1594114, SAY_MEATHOOK_SLAY03 = -1594115 }; struct MANGOS_DLL_DECL boss_meathookAI : public ScriptedAI { boss_meathookAI(Creature *pCreature) : ScriptedAI(pCreature) { m_pInstance = (ScriptedInstance*)pCreature->GetInstanceData(); m_bIsHeroic = pCreature->GetMap()->IsRaidOrHeroicDungeon(); m_creature->SetActiveObjectState(true); Reset(); } ScriptedInstance* m_pInstance; bool m_bIsHeroic; uint32 Chain_Timer; uint32 Exploded_Timer; uint32 Frenzy_Timer; void Reset() { Chain_Timer = 6300; Exploded_Timer = 5000; Frenzy_Timer = 22300; } void Aggro(Unit* who) { DoScriptText(SAY_MEATHOOK_AGGRO, m_creature); } void JustDied(Unit *killer) { DoScriptText(SAY_MEATHOOK_DEATH, m_creature); if(m_pInstance) m_pInstance->SetData(TYPE_PHASE, 3); } void KilledUnit(Unit* pVictim) { switch(rand()%3) { case 0: DoScriptText(SAY_MEATHOOK_SLAY01, m_creature); break; case 1: DoScriptText(SAY_MEATHOOK_SLAY02, m_creature); break; case 2: DoScriptText(SAY_MEATHOOK_SLAY03, m_creature); break; } } void UpdateAI(const uint32 diff) { if (!m_creature->SelectHostileTarget() || !m_creature->getVictim()) return; DoMeleeAttackIfReady(); if (Chain_Timer < diff) { if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCast(target, m_bIsHeroic ? SPELL_CHAIN_H : SPELL_CHAIN_N); Chain_Timer = 6300; }else Chain_Timer -= diff; if (Exploded_Timer < diff) { if (Unit* target = m_creature->SelectAttackingTarget(ATTACKING_TARGET_RANDOM,0)) DoCast(target, m_bIsHeroic ? SPELL_EXPLODED_H : SPELL_EXPLODED_N); Exploded_Timer = 5000; }else Exploded_Timer -= diff; if (Frenzy_Timer < diff) { m_creature->InterruptNonMeleeSpells(false); DoCast(m_creature,SPELL_FRENZY); Frenzy_Timer = 23300; }else Frenzy_Timer -= diff; } }; CreatureAI* GetAI_boss_meathook(Creature* pCreature) { return new boss_meathookAI(pCreature); } void AddSC_boss_meathook() { Script *newscript; newscript = new Script; newscript->Name = "boss_meathook"; newscript->GetAI = &GetAI_boss_meathook; newscript->RegisterSelf(); }
28.021739
92
0.653737
mfooo
1ef79654974ecb856f0578181f16a33f388ebd9c
10,181
hpp
C++
common/util/bindings.hpp
Depau/tablecloth
c073d88130eb0b50552a7cd1cf9bc1576b9936ec
[ "MIT" ]
38
2018-08-06T13:12:57.000Z
2020-12-07T22:18:48.000Z
common/util/bindings.hpp
Depau/tablecloth
c073d88130eb0b50552a7cd1cf9bc1576b9936ec
[ "MIT" ]
5
2018-11-02T09:56:03.000Z
2020-02-14T22:34:55.000Z
common/util/bindings.hpp
Depau/tablecloth
c073d88130eb0b50552a7cd1cf9bc1576b9936ec
[ "MIT" ]
5
2018-10-02T08:40:56.000Z
2020-02-11T00:55:39.000Z
#pragma once #include <memory> #include <variant> namespace cloth { template<typename T> struct owner { constexpr explicit owner(T* t) noexcept : _val(t) {} constexpr explicit operator T*() noexcept { return _val; } private: T* _val; }; } // namespace cloth /// Generate conversions to Base #define CLOTH_BIND_BASE(Class, BaseClass) \ public: \ using Base = BaseClass; \ using deleter = cloth::util::deleter<Class>; \ Class(Base* base = nullptr) noexcept : _base(base) {} \ \ Class(cloth::owner<Base> base) noexcept : _base({static_cast<Base*>(base), deleter{*this}}) {} \ \ Base* base() noexcept \ { \ return &*_base; \ } \ \ operator Base*() noexcept \ { \ return base(); \ } \ \ Base const* base() const noexcept \ { \ return &*_base; \ } \ \ operator const Base*() const noexcept \ { \ return base(); \ } \ \ Class& from_voidptr(void* data) noexcept \ { \ return *static_cast<Class*>(data); \ } \ \ private: \ ::cloth::util::raw_or_unique_ptr<Base, Class::deleter> _base; \ \ public: #define CLOTH_ENABLE_BITMASK_OPS(Enum) \ template<> \ struct enable_bitmask_ops<Enum> : std::true_type {}; namespace cloth { template<typename Enum> struct enum_or_bool { constexpr enum_or_bool(Enum e) : e(e){}; constexpr enum_or_bool(bool e) : e(static_cast<Enum>(e)){}; constexpr operator Enum&() noexcept { return e; } constexpr operator const Enum&() const noexcept { return e; } constexpr operator bool() const noexcept { return static_cast<bool>(e); } Enum e; }; template<typename Enum> struct enable_bitmask_ops : std::false_type {}; template<typename Enum> constexpr auto operator|(Enum lhs, Enum rhs) -> std::enable_if_t<cloth::enable_bitmask_ops<Enum>::value, Enum> { return static_cast<Enum>(static_cast<std::underlying_type_t<Enum>>(lhs) | static_cast<std::underlying_type_t<Enum>>(rhs)); } template<typename Enum> constexpr auto operator&(Enum lhs, Enum rhs) -> std::enable_if_t<cloth::enable_bitmask_ops<Enum>::value, enum_or_bool<Enum>> { return static_cast<Enum>(static_cast<std::underlying_type_t<Enum>>(lhs) & static_cast<std::underlying_type_t<Enum>>(rhs)); } template<typename Enum> constexpr auto operator^(Enum lhs, Enum rhs) -> std::enable_if_t<cloth::enable_bitmask_ops<Enum>::value, Enum> { return static_cast<Enum>(static_cast<std::underlying_type_t<Enum>>(lhs) ^ static_cast<std::underlying_type_t<Enum>>(rhs)); } template<typename Enum> constexpr auto operator~(Enum rhs) -> std::enable_if_t<cloth::enable_bitmask_ops<Enum>::value, Enum> { return static_cast<Enum>(~static_cast<std::underlying_type_t<Enum>>(rhs)); } template<typename Enum> constexpr auto operator|=(Enum& lhs, Enum rhs) -> std::enable_if_t<cloth::enable_bitmask_ops<Enum>::value, Enum&> { lhs = static_cast<Enum>(static_cast<std::underlying_type_t<Enum>>(lhs) | static_cast<std::underlying_type_t<Enum>>(rhs)); return lhs; } template<typename Enum> constexpr auto operator&=(Enum& lhs, Enum rhs) -> std::enable_if_t<cloth::enable_bitmask_ops<Enum>::value, Enum&> { lhs = static_cast<Enum>(static_cast<std::underlying_type_t<Enum>>(lhs) & static_cast<std::underlying_type_t<Enum>>(rhs)); return lhs; } template<typename Enum> constexpr auto operator^=(Enum& lhs, Enum rhs) -> std::enable_if_t<cloth::enable_bitmask_ops<Enum>::value, Enum&> { lhs = static_cast<Enum>(static_cast<std::underlying_type_t<Enum>>(lhs) ^ static_cast<std::underlying_type_t<Enum>>(rhs)); return lhs; } } // namespace cloth namespace cloth::util { template<typename T1, typename T2> constexpr auto dynamic_is(const T2& t) -> std::enable_if_t<!std::is_pointer_v<T2>, bool> { return dynamic_cast<T1*>(&t) != nullptr; } template<typename T1, typename T2> constexpr auto dynamic_is(T2* t) -> std::enable_if_t<!std::is_pointer_v<T2>, bool> { return dynamic_cast<T1*>(t) != nullptr; } template<typename E, typename T> constexpr auto enum_cast(E e) noexcept -> std::enable_if_t<std::is_enum_v<E>, E> { return static_cast<E>(e); } /// Cast scoped enums to their underlying numeric type template<typename E> constexpr auto enum_cast(E e) noexcept -> std::enable_if_t<!std::is_enum_v<E>, E> { return e; } template<typename E, typename = std::enable_if_t<std::is_enum_v<E>>> constexpr auto enum_cast(E e) noexcept { return static_cast<std::underlying_type_t<E>>(e); } template<typename T, typename = int> struct has_destroy : std::false_type {}; template<typename T> struct has_destroy<T, decltype((void) std::declval<T>().destroy(), 0)> : std::true_type {}; template<typename Class> struct deleter { Class& klass; using Base = typename Class::Base; void operator()(Base* ptr) { if constexpr (has_destroy<Class>::value) { klass.destroy(); } else { delete ptr; } } }; /// A simple function pointer type alias template<typename Ret, typename... Args> using function_ptr = Ret (*)(Args...); template<typename T, typename Del = std::default_delete<T>> struct raw_or_unique_ptr { using value_type = T; using raw_ptr = value_type*; using unique_ptr = std::unique_ptr<value_type, Del>; raw_or_unique_ptr(raw_ptr ptr) noexcept : _data(ptr) {} raw_or_unique_ptr(unique_ptr&& ptr) noexcept : _data(std::move(ptr)) {} raw_or_unique_ptr(value_type& data) noexcept : _data(&data) {} raw_or_unique_ptr(value_type&& data) noexcept : _data(std::make_unique<value_type, Del>(std::move(data))) {} raw_or_unique_ptr(raw_or_unique_ptr const&) = delete; raw_or_unique_ptr(raw_or_unique_ptr&& rhs) noexcept { std::swap(_data, rhs._data); } void operator=(raw_or_unique_ptr const&) = delete; void operator=(raw_or_unique_ptr&& rhs) noexcept { std::swap(_data, rhs._data); } T& operator*() noexcept { if (std::holds_alternative<raw_ptr>(_data)) { return *std::get<raw_ptr>(_data); } else { return *std::get<unique_ptr>(_data); } } T const& operator*() const noexcept { if (std::holds_alternative<raw_ptr>(_data)) { return *std::get<raw_ptr>(_data); } else { return *std::get<unique_ptr>(_data); } } T* get() noexcept { if (std::holds_alternative<raw_ptr>(_data)) { return std::get<raw_ptr>(_data); } else { return std::get<unique_ptr>(_data).get(); } } T const* get() const noexcept { if (std::holds_alternative<raw_ptr>(_data)) { return std::get<raw_ptr>(_data); } else { return std::get<unique_ptr>(_data).get(); } } private: std::variant<raw_ptr, unique_ptr> _data; }; } // namespace cloth::util
36.754513
100
0.445732
Depau
1ef92e66563339e725e9db1ddd5944d44ce3bc82
1,548
cpp
C++
Source/OpenGL/GLBuffer.cpp
ShenMian/Graphics
729364ede3218a236051d3c1e74779021869d363
[ "Apache-2.0" ]
20
2021-12-10T05:45:00.000Z
2022-03-28T00:18:11.000Z
Source/OpenGL/GLBuffer.cpp
ShenMian/Graphics
729364ede3218a236051d3c1e74779021869d363
[ "Apache-2.0" ]
8
2021-12-10T08:55:03.000Z
2022-03-09T00:51:35.000Z
Source/OpenGL/GLBuffer.cpp
ShenMian/Graphics
729364ede3218a236051d3c1e74779021869d363
[ "Apache-2.0" ]
2
2021-11-13T12:02:29.000Z
2021-12-03T05:02:19.000Z
// Copyright 2021 ShenMian // License(Apache-2.0) #include "GLBuffer.h" #include "GLCheck.h" #include <cassert> #include <cstring> #include <unordered_map> namespace { std::unordered_map<Buffer::Type, uint32_t> GLType = { {Buffer::Type::Vertex, GL_ARRAY_BUFFER}, {Buffer::Type::Index, GL_ELEMENT_ARRAY_BUFFER}, {Buffer::Type::Uniform, GL_UNIFORM_BUFFER} }; std::unordered_map<Buffer::Usage, uint32_t> GLUsage = { {Buffer::Usage::Static, GL_STATIC_DRAW}, {Buffer::Usage::Dynamic, GL_DYNAMIC_DRAW}, {Buffer::Usage::Stream, GL_STREAM_DRAW} }; } GLBuffer::GLBuffer(size_t size, Type type, Usage usage) : Buffer(size, type, usage), glType(GLType[type]) { glCreateBuffers(1, &handle); bind(); glBufferData(glType, size, nullptr, GLUsage[usage]); GLCheckError(); } GLBuffer::~GLBuffer() { glDeleteBuffers(1, &handle); } void GLBuffer::map(size_t size, size_t offset) { const GLenum access = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT; if(data) return; // 缓冲区已处于映射状态 if(size == -1) size = this->size; assert(size <= this->size); bind(); data = glMapBufferRange(glType, offset, size, access); GLCheckError(); } void GLBuffer::unmap() { bind(); glUnmapBuffer(glType); data = nullptr; GLCheckError(); } void GLBuffer::flush(size_t size, size_t offset) { if(size == -1) size = this->size; assert(size <= this->size); bind(); glFlushMappedBufferRange(glType, offset, size); GLCheckError(); } void GLBuffer::bind() { glBindBuffer(glType, handle); GLCheckError(); } GLBuffer::operator GLuint() const { return handle; }
18.428571
58
0.702842
ShenMian
1efaa02d80c4ec972f788dbdf9a4ee1d557db82e
10,545
cpp
C++
TVGameShow/software/CFGTOOLDlg.cpp
cuongquay/led-matrix-display
6dd0e3be9ee23862610dab7b0d40970c6900e5e4
[ "Apache-2.0" ]
null
null
null
TVGameShow/software/CFGTOOLDlg.cpp
cuongquay/led-matrix-display
6dd0e3be9ee23862610dab7b0d40970c6900e5e4
[ "Apache-2.0" ]
null
null
null
TVGameShow/software/CFGTOOLDlg.cpp
cuongquay/led-matrix-display
6dd0e3be9ee23862610dab7b0d40970c6900e5e4
[ "Apache-2.0" ]
1
2020-06-13T08:34:26.000Z
2020-06-13T08:34:26.000Z
// CFGTOOLDlg.cpp : implementation file // #include "stdafx.h" #include "CFGTOOL.h" #include "CFGTOOLDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #define LOAD_DATA_MSG 1 #define MAX_DIGIT 12 BYTE buffer[MAX_DIGIT] = {0x00}; ///////////////////////////////////////////////////////////////////////////// // CCFGTOOLDlg dialog CCFGTOOLDlg::CCFGTOOLDlg(CWnd* pParent /*=NULL*/) : CDialog(CCFGTOOLDlg::IDD, pParent) { //{{AFX_DATA_INIT(CCFGTOOLDlg) m_nPlus_01 = 0; m_nMinus_01 = 0; m_nPlus_02 = 0; m_nPlus_03 = 0; m_nPlus_04 = 0; m_nMinus_02 = 0; m_nMinus_03 = 0; m_nMinus_04 = 0; //}}AFX_DATA_INIT // Note that LoadIcon does not require a subsequent DestroyIcon in Win32 m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); } void CCFGTOOLDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CCFGTOOLDlg) DDX_Control(pDX, IDC_STATIC_FRAME, m_Frame); DDX_Control(pDX, IDC_DIGIT_STATION_3, m_Station03); DDX_Control(pDX, IDC_DIGIT_STATION_4, m_Station04); DDX_Control(pDX, IDC_DIGIT_STATION_2, m_Station02); DDX_Control(pDX, IDC_DIGIT_STATION_1, m_Station01); DDX_Text(pDX, IDC_EDIT_PLUS_01, m_nPlus_01); DDV_MinMaxUInt(pDX, m_nPlus_01, 0, 999); DDX_Text(pDX, IDC_EDIT_MINUS_01, m_nMinus_01); DDV_MinMaxUInt(pDX, m_nMinus_01, 0, 999); DDX_Text(pDX, IDC_EDIT_PLUS_2, m_nPlus_02); DDV_MinMaxUInt(pDX, m_nPlus_02, 0, 999); DDX_Text(pDX, IDC_EDIT_PLUS_3, m_nPlus_03); DDV_MinMaxUInt(pDX, m_nPlus_03, 0, 999); DDX_Text(pDX, IDC_EDIT_PLUS_4, m_nPlus_04); DDV_MinMaxUInt(pDX, m_nPlus_04, 0, 999); DDX_Text(pDX, IDC_EDIT_MINUS_2, m_nMinus_02); DDV_MinMaxUInt(pDX, m_nMinus_02, 0, 999); DDX_Text(pDX, IDC_EDIT_MINUS_3, m_nMinus_03); DDV_MinMaxUInt(pDX, m_nMinus_03, 0, 999); DDX_Text(pDX, IDC_EDIT_MINUS_4, m_nMinus_04); DDV_MinMaxUInt(pDX, m_nMinus_04, 0, 999); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CCFGTOOLDlg, CDialog) //{{AFX_MSG_MAP(CCFGTOOLDlg) ON_WM_PAINT() ON_WM_QUERYDRAGICON() ON_WM_CLOSE() ON_BN_CLICKED(IDC_BUTTON_PLUS_01, OnButtonPlus01) ON_BN_CLICKED(IDC_BUTTON_PLUS_02, OnButtonPlus02) ON_BN_CLICKED(IDC_BUTTON_PLUS_03, OnButtonPlus03) ON_BN_CLICKED(IDC_BUTTON_PLUS_04, OnButtonPlus04) ON_BN_CLICKED(IDC_BUTTON_MINUS_01, OnButtonMinus01) ON_BN_CLICKED(IDC_BUTTON_MINUS_02, OnButtonMinus02) ON_BN_CLICKED(IDC_BUTTON_MINUS_03, OnButtonMinus03) ON_BN_CLICKED(IDC_BUTTON_MINUS_04, OnButtonMinus04) //}}AFX_MSG_MAP ON_WM_SERIAL(OnSerialMsg) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCFGTOOLDlg message handlers BOOL CCFGTOOLDlg::OnInitDialog() { CDialog::OnInitDialog(); // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon TCHAR szCOM[10] = _T("COM1"); FILE* file = NULL; file = fopen(_T("config.ini"),_T("rb")); if (file != NULL){ TCHAR szBuff[MAX_PATH] = {0}; while (fscanf(file,_T("%s"),szBuff) > 0) { if (strcmp((const char*)szBuff,_T("[HARDWARE]"))==0){ while (fscanf(file,_T("%s = %s"),szBuff,szCOM) > 0){ if (strcmp((const char*)szBuff,_T("PORT"))==0){ break; } } } } fclose(file); } if (m_Serial.Open(szCOM,m_hWnd,0)!=ERROR_SUCCESS) { CString csText = _T(""); csText.Format(_T("The %s isn't exist or may be used by another program!"),szCOM); MessageBox(csText,_T("OpenCOMM"),MB_OK); return FALSE; } // Register only for the receive event // m_Serial.SetMask( CSerial::EEventRecv ); m_Serial.SetupReadTimeouts(CSerial::EReadTimeoutNonblocking); m_Serial.Setup((CSerial::EBaudrate)CBR_9600); m_nPoint[0] =m_nPoint[1] =m_nPoint[2] =m_nPoint[3] =0; this->ShowDisplay(); CString csWindowText = _T("GameShow LED Display v1.00 - "); this->SetWindowText(csWindowText+_T("Designed by CuongQuay\x99")); return TRUE; // return TRUE unless you set the focus to a control } // If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework. void CCFGTOOLDlg::OnPaint() { if (IsIconic()) { CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle int cxIcon = GetSystemMetrics(SM_CXICON); int cyIcon = GetSystemMetrics(SM_CYICON); CRect rect; GetClientRect(&rect); int x = (rect.Width() - cxIcon + 1) / 2; int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon dc.DrawIcon(x, y, m_hIcon); } else { CDialog::OnPaint(); } } // The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CCFGTOOLDlg::OnQueryDragIcon() { return (HCURSOR) m_hIcon; } void CCFGTOOLDlg::OnOK() { this->UpdateData(TRUE); } void CCFGTOOLDlg::OnCancel() { } void CCFGTOOLDlg::OnClose() { CDialog::EndDialog(IDOK); } void CCFGTOOLDlg::OnButtonPlus01() { this->UpdateData(TRUE); if (m_nPlus_01 >=0 && m_nPlus_01 < 1000) if (m_nPoint[0] <1000) m_nPoint[0] += m_nPlus_01; if (m_nPoint[0] >=1000) m_nPoint[0] = 999; this->ShowDisplay(); } void CCFGTOOLDlg::OnButtonPlus02() { this->UpdateData(TRUE); if (m_nPlus_02 >=0 && m_nPlus_02 < 1000) if (m_nPoint[1] <1000) m_nPoint[1] += m_nPlus_02; if (m_nPoint[1] >=1000) m_nPoint[1] = 999; this->ShowDisplay(); } void CCFGTOOLDlg::OnButtonPlus03() { this->UpdateData(TRUE); if (m_nPlus_03 >=0 && m_nPlus_03 < 1000) if (m_nPoint[2] <1000) m_nPoint[2] += m_nPlus_03; if (m_nPoint[2] >=1000) m_nPoint[2] = 999; this->ShowDisplay(); } void CCFGTOOLDlg::OnButtonPlus04() { this->UpdateData(TRUE); if (m_nPlus_04 >=0 && m_nPlus_04 < 1000) if (m_nPoint[3] <1000) m_nPoint[3] += m_nPlus_04; if (m_nPoint[3] >=1000) m_nPoint[3] = 999; this->ShowDisplay(); } void CCFGTOOLDlg::OnButtonMinus01() { this->UpdateData(TRUE); if (m_nMinus_01 >=0 && m_nMinus_01 < 1000) if (m_nPoint[0] >=-99) m_nPoint[0] -= m_nMinus_01; if (m_nPoint[0] <-99) m_nPoint[0] = -99; this->ShowDisplay(); } void CCFGTOOLDlg::OnButtonMinus02() { this->UpdateData(TRUE); if (m_nMinus_02 >=0 && m_nMinus_02 < 1000) if (m_nPoint[1] >=-99) m_nPoint[1] -= m_nMinus_02; if (m_nPoint[1] <-99) m_nPoint[1] = -99; this->ShowDisplay(); } void CCFGTOOLDlg::OnButtonMinus03() { this->UpdateData(TRUE); if (m_nMinus_03 >=0 && m_nMinus_03 < 1000) if (m_nPoint[2] >=-99) m_nPoint[2] -= m_nMinus_03; if (m_nPoint[2] <-99) m_nPoint[2] = -99; this->ShowDisplay(); } void CCFGTOOLDlg::OnButtonMinus04() { this->UpdateData(TRUE); if (m_nMinus_04 >=0 && m_nMinus_04 < 1000) if (m_nPoint[3] >=-99) m_nPoint[3] -= m_nMinus_04; if (m_nPoint[3] <-99) m_nPoint[3] = -99; this->ShowDisplay(); } void CCFGTOOLDlg::SendData() { WORD wParam = 0; WORD lParam = MAX_DIGIT; BYTE nMsg = LOAD_DATA_MSG; BYTE msg[] = {0x55,0x55,0x55, nMsg, HIBYTE(wParam), LOBYTE(wParam), HIBYTE(lParam), LOBYTE(lParam) }; // send message command if (m_Serial.Write(msg,sizeof(msg))==ERROR_SUCCESS){ Sleep(100); } // send data buffer for (int i=0; i< MAX_DIGIT; i++){ m_Serial.Write(&buffer[i],sizeof(BYTE)); } } void CCFGTOOLDlg::DoFormat(int value, BYTE *buff) { if (value >=0){ buff[0] = (value/100); buff[1] = (value%100)/10; buff[2] = (value%100)%10; if (buff[0]==0) { buff[0] =0x0F; // off segments if (buff[1]==0) buff[1]=0x0F; } } else{ if ((value%100)/10){ buff[0] = 0x0A; // minus sign buff[1] = -(value%100)/10; buff[2] = -(value%100)%10; } else{ buff[0] = 0x0F; // off segments buff[1] = 0x0A; // minus sign buff[2] = -(value%100)%10; } } BYTE xtable[20] = {0}; FILE* file = NULL; file = fopen(_T("config.ini"),_T("rb")); if (file == NULL) return; TCHAR szBuff[MAX_PATH] = {0}; BYTE code = 0x00; BYTE index = 0; while (fscanf(file,_T("%s"),szBuff) > 0) { if (strcmp((const char*)szBuff,_T("[DECODE]"))==0){ while (fscanf(file,_T("%d = %x"),&index,&code) > 0){ xtable[index] = code; if (index > 15) break; } } } fclose(file); if (buff[0]!=0xFF){ buff[0] = xtable[buff[0]]; } if (buff[1]!=0xFF){ buff[1] = xtable[buff[1]]; } if (buff[2]!=0xFF){ buff[2] = xtable[buff[2]]; } } void CCFGTOOLDlg::FormatBuffer() { DoFormat(m_nPoint[0],&buffer[9]); DoFormat(m_nPoint[1],&buffer[6]); DoFormat(m_nPoint[2],&buffer[3]); DoFormat(m_nPoint[3],&buffer[0]); } void CCFGTOOLDlg::ShowDisplay() { CString csText = _T(""); csText.Format(_T("%3d"),m_nPoint[0]); CDigiStatic* pStatic = (CDigiStatic*)GetDlgItem(IDC_DIGIT_STATION_1); pStatic->SetText(csText); csText.Format(_T("%3d"),m_nPoint[1]); pStatic = (CDigiStatic*)GetDlgItem(IDC_DIGIT_STATION_2); pStatic->SetText(csText); csText.Format(_T("%3d"),m_nPoint[2]); pStatic = (CDigiStatic*)GetDlgItem(IDC_DIGIT_STATION_3); pStatic->SetText(csText); csText.Format(_T("%3d"),m_nPoint[3]); pStatic = (CDigiStatic*)GetDlgItem(IDC_DIGIT_STATION_4); pStatic->SetText(csText); this->FormatBuffer(); this->SendData(); } LRESULT CCFGTOOLDlg::OnSerialMsg (WPARAM wParam, LPARAM /*lParam*/) { CSerial::EEvent eEvent = CSerial::EEvent(LOWORD(wParam)); CSerial::EError eError = CSerial::EError(HIWORD(wParam)); if (eEvent & CSerial::EEventRecv) { // Create a clean buffer DWORD dwRead; char szData[1024*8]; const int nBuflen = sizeof(szData)-1; // Obtain the data from the serial port do { m_Serial.Read(szData,nBuflen,&dwRead); szData[dwRead] = '\0'; if (dwRead>0) { if (szData[0]==0x55 && szData[1]== 0x55 && szData[2]==0x55) { TRACE(_T("READ %d byte(s):"),dwRead); for (int i =0; i< int(dwRead); i++){ TRACE(_T("%02X "),BYTE(szData[i])); } TRACE(_T("\n")); } else { TRACE(_T("READ = %s \r\n"),szData); } } } while (dwRead == nBuflen); } return 0; }
24.811765
84
0.631958
cuongquay
1efb8a0e9adc57f201e55f6f0b98d8c18778cbf0
655
cc
C++
aoj/2/2301.cc
eagletmt/procon
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
[ "MIT" ]
1
2015-04-17T09:54:23.000Z
2015-04-17T09:54:23.000Z
aoj/2/2301.cc
eagletmt/procon
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
[ "MIT" ]
null
null
null
aoj/2/2301.cc
eagletmt/procon
adbe503eb3c1bbcc1538b2ee8988aa353937e8d4
[ "MIT" ]
null
null
null
#include <iostream> #include <cstdio> #include <cmath> using namespace std; double P, E, T; double solve(int K, double L, double R) { const double H = (L + R)/2.0; if (K == 0) { if (fabs(T - H) < E) { return 1.0; } else { return 0.0; } } if (R < T-E || T+E < L) { return 0.0; } else if (T-E <= L && R <= T+E) { return 1.0; } if (H <= T) { return P*solve(K-1, L, H) + (1.0-P)*solve(K-1, H, R); } else { return P*solve(K-1, H, R) + (1.0-P)*solve(K-1, L, H); } } int main() { int K; double L, R; cin >> K >> L >> R; cin >> P >> E >> T; printf("%.6f\n", solve(K, L, R)); return 0; }
15.595238
57
0.456489
eagletmt
48059fdf25cff4c9b709a417fc77d2503a8c5fc3
782
cpp
C++
reduce/central_limit.cpp
Fernal73/MPI
5e4b772bfa0e19ff0b5566968bfae5e5d780c227
[ "MIT" ]
null
null
null
reduce/central_limit.cpp
Fernal73/MPI
5e4b772bfa0e19ff0b5566968bfae5e5d780c227
[ "MIT" ]
null
null
null
reduce/central_limit.cpp
Fernal73/MPI
5e4b772bfa0e19ff0b5566968bfae5e5d780c227
[ "MIT" ]
null
null
null
#include <cstdlib> #include <iostream> #include <mpi.h> using namespace std; int main(int argc, char **argv) { MPI_Init(&argc, &argv); int rank, size; MPI_Comm_rank(MPI_COMM_WORLD, &rank); MPI_Comm_size(MPI_COMM_WORLD, &size); constexpr int buffer_count = 5000; float buffer[buffer_count]; memset(buffer, 0, sizeof(buffer)); // uniform sampling for (int rep = 0; rep < 1000; ++rep) { for (int i = 0; i < buffer_count; ++i) buffer[i] += rand() / (float)RAND_MAX; } float reception[buffer_count]; MPI_Reduce(&buffer, &reception, buffer_count, MPI_FLOAT, MPI_SUM, 0, MPI_COMM_WORLD); if (rank == 0) { for (int i = 0; i < buffer_count; ++i) cout << reception[i] << " "; cout << endl; } MPI_Finalize(); return 0; }
24.4375
70
0.62532
Fernal73
4805c2f7327658e3143b07363565bc5f92c43818
4,790
cpp
C++
src/Semantic/check missing return.cpp
Kerndog73/STELA
11449b4bb440494f3ec4b1172b2688b5ec1bcd0a
[ "MIT" ]
10
2018-06-20T05:12:59.000Z
2021-11-23T02:56:04.000Z
src/Semantic/check missing return.cpp
Kerndog73/STELA
11449b4bb440494f3ec4b1172b2688b5ec1bcd0a
[ "MIT" ]
null
null
null
src/Semantic/check missing return.cpp
Kerndog73/STELA
11449b4bb440494f3ec4b1172b2688b5ec1bcd0a
[ "MIT" ]
null
null
null
// // check missing return.cpp // STELA // // Created by Indi Kernick on 12/12/18. // Copyright © 2018 Indi Kernick. All rights reserved. // #include "check missing return.hpp" #include "scope lookup.hpp" using namespace stela; namespace { class Visitor final : public ast::Visitor { public: explicit Visitor(sym::Ctx ctx) : ctx{ctx} {} void visit(ast::Block &block) override { occurs = Occurs::no; bool maybeLeave = false; Term blockTerm = {}; for (auto s = block.nodes.cbegin(); s != block.nodes.cend(); ++s) { ast::Statement *stat = s->get(); stat->accept(*this); if (occurs == Occurs::yes && std::next(s) != block.nodes.cend()) { ast::Statement *nextStat = std::next(s)->get(); ctx.log.error(nextStat->loc) << "Unreachable code" << fatal; } if (occurs == Occurs::maybe && term != Term::returns) { maybeLeave = true; } blockTerm = maxTerm(blockTerm, term); } term = blockTerm; if (maybeLeave) { occurs = Occurs::maybe; } if (occurs != Occurs::yes) { block.nodes.push_back(make_retain<ast::Terminate>()); } } void visit(ast::If &fi) override { fi.body->accept(*this); const Term trooTerm = term; const Occurs trooOccurs = occurs; if (fi.elseBody) { fi.elseBody->accept(*this); } else { occurs = Occurs::no; } if (occurs != trooOccurs || term != trooTerm) { occurs = Occurs::maybe; } if (trooTerm == Term::returns) { term = Term::returns; } } void visit(ast::Switch &swich) override { bool foundDefault = false; size_t retCount = 0; size_t totalCases = swich.cases.size(); bool maybeRet = false; for (auto c = swich.cases.cbegin(); c != swich.cases.cend(); ++c) { if (!c->expr) { foundDefault = true; } c->body->accept(*this); if (term == Term::returns) { if (occurs == Occurs::maybe) { maybeRet = true; } else if (occurs == Occurs::yes) { ++retCount; } } else if (term == Term::continues) { if (occurs == Occurs::yes) { --totalCases; } if (occurs != Occurs::no && std::next(c) == swich.cases.cend()) { ctx.log.error(c->loc) << "Case may continue but this case does not precede another" << fatal; } } } term = Term::returns; if (retCount == totalCases && foundDefault) { occurs = Occurs::yes; swich.alwaysReturns = true; } else if (maybeRet || retCount != 0) { occurs = Occurs::maybe; swich.alwaysReturns = false; } else { occurs = Occurs::no; swich.alwaysReturns = false; } } void visit(ast::Break &) override { term = Term::breaks; occurs = Occurs::yes; } void visit(ast::Continue &) override { term = Term::continues; occurs = Occurs::yes; } void visit(ast::Return &) override { term = Term::returns; occurs = Occurs::yes; } void visit(ast::While &wile) override { wile.body->accept(*this); afterLoop(); } void visit(ast::For &four) override { four.body->accept(*this); afterLoop(); } void afterLoop() { if (term == Term::returns) { if (occurs != Occurs::no) { occurs = Occurs::maybe; } } else { term = Term::returns; occurs = Occurs::no; } } bool noReturn() const { return occurs == Occurs::no; } bool maybeReturn() const { return occurs == Occurs::maybe; } private: sym::Ctx ctx; enum class Term { continues, breaks, returns, }; enum class Occurs { no, maybe, yes }; Term term {}; Occurs occurs {}; Term maxTerm(const Term a, const Term b) { return static_cast<Term>(std::max( static_cast<int>(a), static_cast<int>(b) )); } Occurs maxOccurs(const Occurs a, const Occurs b) { return static_cast<Occurs>(std::max( static_cast<int>(a), static_cast<int>(b) )); } }; } void stela::checkMissingRet(sym::Ctx ctx, ast::Block &body, const ast::TypePtr &ret, const Loc loc) { Visitor visitor{ctx}; body.accept(visitor); bool retVoid = false; if (auto *btnType = lookupConcrete<ast::BtnType>(ctx, ret).get()) { retVoid = btnType->value == ast::BtnTypeEnum::Void; } if (retVoid && (visitor.noReturn() || visitor.maybeReturn())) { if (!body.nodes.empty() && dynamic_cast<ast::Terminate *>(body.nodes.back().get())) { body.nodes.pop_back(); } body.nodes.push_back(make_retain<ast::Return>()); return; } if (visitor.noReturn()) { ctx.log.error(loc) << "Non-void function does not return" << fatal; } if (visitor.maybeReturn()) { ctx.log.error(loc) << "Non-void function may not return" << fatal; } }
25.343915
103
0.573695
Kerndog73
48060382023e744db14683300891dcbbbbc883d5
9,770
cpp
C++
Software/OOP/Version 2/Soccer_Simulation_v2/Classes/Camera.cpp
Brenocq/SoccerOpenRCJ
1711e251861c124e49df21abb63eb169569bea4f
[ "MIT" ]
2
2019-05-02T23:01:06.000Z
2019-05-11T01:29:06.000Z
Software/OOP/Version 2/Soccer_Simulation_v2/Classes/Camera.cpp
Brenocq/SoccerOpenRCJ
1711e251861c124e49df21abb63eb169569bea4f
[ "MIT" ]
null
null
null
Software/OOP/Version 2/Soccer_Simulation_v2/Classes/Camera.cpp
Brenocq/SoccerOpenRCJ
1711e251861c124e49df21abb63eb169569bea4f
[ "MIT" ]
null
null
null
/////////////////////////////////////////////////////////// // Camera.cpp // Implementation of the Class Camera // Created on: 21-mar-2018 21:46:56 // Original author: Breno Queiroz /////////////////////////////////////////////////////////// #include "Camera.h" #if !defined(ARDUINO) #include <iostream>//cout,cin using std::cout; using std::cin; using std::endl; #include <iomanip>//setprecision using std::setprecision; #endif #if defined(ARDUINO) #include <Wire.h> Camera::Camera() : Sensor(0, 0), fieldOfViewH(75), fieldOfViewV(47) { } void Camera::begin(){ pixy = new PixyI2C; pixy->init(); } #else Camera::Camera(string name,int robotN) : Sensor(name, robotN), fieldOfViewH(75), fieldOfViewV(75) { } #endif Camera::~Camera(){ } #if !defined(ARDUINO) void Camera::initializeSimulation(int ID) { Sensor::initializeSimulation(ID); string name1 = sensorName + "1#" + std::to_string(robotNumber); if (simxGetObjectHandle(clientIDSimulation, (const simxChar*)name1.c_str(), (simxInt *)&handleCam1, (simxInt)simx_opmode_oneshot_wait) != simx_return_ok) cout << sensorName << "1- robot" << robotNumber << " not found!" << std::endl; else cout << "Connected to the sensor " << sensorName << "1- robot" << robotNumber << std::endl; string name2 = sensorName + "2#" + std::to_string(robotNumber); if (simxGetObjectHandle(clientIDSimulation, (const simxChar*)name2.c_str(), (simxInt *)&handleCam2, (simxInt)simx_opmode_oneshot_wait) != simx_return_ok) cout << sensorName << "2- robot" << robotNumber << " not found!" << std::endl; else cout << "Connected to the sensor " << sensorName << "2- robot" << robotNumber << std::endl; simxReadVisionSensor(clientIDSimulation, handleSimulation, &state, &auxCameraValues, &auxCameraValuesCount, simx_opmode_streaming); simxReadVisionSensor(clientIDSimulation, handleCam1, &state, &auxCameraValues, &auxCameraValuesCount, simx_opmode_streaming); simxReadVisionSensor(clientIDSimulation, handleCam2, &state, &auxCameraValues, &auxCameraValuesCount, simx_opmode_streaming); } #endif void Camera::updateCamera(){ #if defined(ARDUINO) static int i = 0; int j; uint16_t blocks; char buf[32]; blocks = pixy->getBlocks(); if (blocks){ setNumberObjects(blocks); for (int i = 0; i < blocks; i++){ int size = (pixy->blocks[i].width) > (pixy->blocks[i].height) ? (pixy->blocks[i].width) : (pixy->blocks[i].height); float _objX = pixy->blocks[i].x; float _objY = pixy->blocks[i].y; setObjectX(_objX / 320, i); setObjectY(_objY / 200, i); if ((pixy->blocks[i].width) > (pixy->blocks[i].height)){ float _objSize = pixy->blocks[i].width; setObjectSize(_objSize / 320, i); } else{ float _objSize = pixy->blocks[i].height; setObjectSize(_objSize / 200, i); } } for (int i = blocks; i < 10; i++){ setObjectX(0, i); setObjectY(0, i); setObjectSize(0, i); } /*Serial.print("pixy X:"); Serial.print(pixy->blocks[0].x); Serial.print(" Y:"); Serial.print(pixy->blocks[0].y); Serial.print(" width:"); Serial.print(pixy->blocks[0].width); Serial.print(" height:"); Serial.print(pixy->blocks[0].height); Serial.print(" signature:"); Serial.println(pixy->blocks[0].signature);*/ } else { for (int i = 0; i < 10; i++){ setObjectX(0, i); setObjectY(0, i); setObjectSize(0, i); setNumberObjects(0); } } #else if (simxReadVisionSensor(clientIDSimulation, handleSimulation, &state, &auxCameraValues, &auxCameraValuesCount, simx_opmode_streaming) == simx_return_ok){ setNumberObjects(auxCameraValues[15],0);//nothing=0 (ball) float objectLenght = auxCameraValues[21]; float objectHeight = auxCameraValues[22]; if (getNumberObjects("ball") != 0) { setObjectX(auxCameraValues[19]); setObjectY(auxCameraValues[20]); if (objectHeight > objectLenght) setObjectSize(objectHeight); else setObjectSize(objectLenght); } else { setNumberObjects(0); setObjectX(0); setObjectY(0); } } //----- Camera 1(yellow) -----// if (simxReadVisionSensor(clientIDSimulation, handleCam1, &state, &auxCameraValues, &auxCameraValuesCount, simx_opmode_streaming) == simx_return_ok){ //(15)num objects (19)Xobj1 (20)Yobj1 (21)Lenghtobj1 (22)Heightobj1 // (23) (24) (25)Xobj2 (26)Yobj2 (27)Lenghtobj2 (28)Heightobj2 setNumberObjects(auxCameraValues[15], 1); int selectObject = 0; if (getNumberObjects("goaly") == 2){ if (auxCameraValues[21] < auxCameraValues[27])//if object 1 is bigger than object 2 selectObject = 6;//use date from the other object } if (getNumberObjects("goaly") !=0) { setNumberObjects(auxCameraValues[15], 1); float objectLenght = auxCameraValues[21 + selectObject]; float objectHeight = auxCameraValues[22 + selectObject]; setObjectX(auxCameraValues[19 + selectObject], 1); setObjectY(auxCameraValues[20 + selectObject], 1); setObjectHeight(objectHeight, 1); setObjectLength(objectLenght, 1); if (objectHeight > objectLenght) setObjectSize(objectHeight,1); else setObjectSize(objectLenght,1); } else { setNumberObjects(0,1); setObjectX(0,1); setObjectY(0,1); } } //----- Camera 2(blue) -----// if (simxReadVisionSensor(clientIDSimulation, handleCam2, &state, &auxCameraValues, &auxCameraValuesCount, simx_opmode_streaming) == simx_return_ok){ //(15)num objects (19)Xobj1 (20)Yobj1 (21)Lenghtobj1 (22)Heightobj1 // (23) (24) (25)Xobj2 (26)Yobj2 (27)Lenghtobj2 (28)Heightobj2 setNumberObjects(auxCameraValues[15], 2); int selectObject = 0; if (getNumberObjects("goalb") == 2){ if (auxCameraValues[21] < auxCameraValues[27])//if object 1 is bigger than object 2 selectObject = 6;//use date from the other object } if (getNumberObjects("goalb") != 0) { setNumberObjects(auxCameraValues[15], 2); float objectLenght = auxCameraValues[21 + selectObject]; float objectHeight = auxCameraValues[22 + selectObject]; setObjectX(auxCameraValues[19 + selectObject], 2); setObjectY(auxCameraValues[20 + selectObject], 2); setObjectHeight(objectHeight, 2); setObjectLength(objectLenght, 2); if (objectHeight > objectLenght) setObjectSize(objectHeight, 2); else setObjectSize(objectLenght, 2); } else { setNumberObjects(0, 2); setObjectX(0, 2); setObjectY(0, 2); } } #endif } void Camera :: print()const{ #if defined(ARDUINO) if (getNumberObjects()>0) { int numObjects = getNumberObjects(); Serial.print("pixy numObj:"); Serial.print(numObjects); for (int i = 0; i<numObjects; i++) { Serial.println(" "); Serial.print(" Object "); Serial.print(i); Serial.print("--> X:"); Serial.print(getObjectX(i)); Serial.print(" Y:"); Serial.print(getObjectY(i)); Serial.print(" size:"); Serial.print(getObjectSize(i)); delay(100); } delay(1000); Serial.println(" "); Serial.println(" "); } else Serial.println("0 objects detected"); #else #endif } //Get property float Camera::getObjectX(string name)const { if (name=="ball") return objectX[0]; else if (name == "goal"){ if (getNumberObjects("goalb") > getNumberObjects("goaly")) return objectX[2]; else return objectX[1]; } else cout << endl << "getObjectX Camera: please use a valid name"; } float Camera::getObjectY(string name)const { if (name == "ball") return objectY[0]; else if (name == "goal"){ if (getNumberObjects("goalb") > getNumberObjects("goaly")) return objectY[2]; else return objectY[1]; } else cout << endl << "getObjectY Camera: please use a valid name"; } float Camera::getObjectSize(string name)const { if (name == "ball") return objectSize[0]; else if (name == "goal"){ if (objectSize[1] > objectSize[2]) return objectSize[1]; else return objectSize[2]; } else cout << endl << "getObjectSize Camera: please use a valid name"; } float Camera::getObjectLength(string name)const { if (name == "ball") return objectLenght[0]; else if (name == "goal"){ if (getNumberObjects("goalb") > getNumberObjects("goaly")) return objectLenght[2]; else return objectLenght[1]; } else cout << endl << "getObjectSize Camera: please use a valid name"; return 0; } float Camera::getObjectHeight(string name)const { if (name == "ball") return objectHeight[0]; else if (name == "goal"){ if (getNumberObjects("goalb") > getNumberObjects("goaly")) return objectHeight[2]; else return objectHeight[1]; } else cout << endl << "getObjectSize Camera: please use a valid name"; return 0; } int Camera::getNumberObjects(string name) const{ if (name == "ball") return numberObjects[0]; else if (name == "goaly") return numberObjects[1]; else if (name == "goalb") return numberObjects[2]; else cout << endl << "getObjectSize Camera: please use a valid name"; return 0; } int Camera::getFieldOfViewH()const { return fieldOfViewH; } int Camera::getFieldOfViewV()const { return fieldOfViewV; } //Set property void Camera::setObjectX(float val, int objN){ objectX[objN] = val; } void Camera::setObjectY(float val, int objN){ objectY[objN] = val; } void Camera::setObjectSize(float val, int objN) { objectSize[objN] = val; } void Camera::setObjectLength(float val, int objN) { objectLenght[objN] = val; } void Camera::setObjectHeight(float val, int objN) { objectHeight[objN] = val; } void Camera::setNumberObjects(int val, int objN){ numberObjects[objN] = val; }
27.755682
156
0.649949
Brenocq
4806568eb5c5e9c717e90d55e0ec7a96409bd50e
5,465
hpp
C++
src/vlGraphics/EdgeUpdateCallback.hpp
zpc930/visualizationlibrary
c81fa75c720a3d04d295b977a1f5dc4624428b53
[ "BSD-2-Clause" ]
null
null
null
src/vlGraphics/EdgeUpdateCallback.hpp
zpc930/visualizationlibrary
c81fa75c720a3d04d295b977a1f5dc4624428b53
[ "BSD-2-Clause" ]
null
null
null
src/vlGraphics/EdgeUpdateCallback.hpp
zpc930/visualizationlibrary
c81fa75c720a3d04d295b977a1f5dc4624428b53
[ "BSD-2-Clause" ]
null
null
null
/**************************************************************************************/ /* */ /* Visualization Library */ /* http://www.visualizationlibrary.org */ /* */ /* Copyright (c) 2005-2010, Michele Bosi */ /* 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. */ /* */ /**************************************************************************************/ #ifndef EdgeUpdateCallback_INCLUDE_ONCE #define EdgeUpdateCallback_INCLUDE_ONCE #include <vlGraphics/Actor.hpp> #include <vlGraphics/EdgeExtractor.hpp> #include <vlGraphics/Geometry.hpp> #include <vlGraphics/Camera.hpp> namespace vl { //! The EdgeUpdateCallback class updates at every frame the edges of an Actor for the purpose of edge-enhancement. //! \sa EdgeExtractor class EdgeUpdateCallback: public ActorEventCallback { VL_INSTRUMENT_CLASS(vl::EdgeUpdateCallback, ActorEventCallback) public: EdgeUpdateCallback(): mShowCreases(true) { VL_DEBUG_SET_OBJECT_NAME() } EdgeUpdateCallback(const std::vector<EdgeExtractor::Edge>& edge): mEdges(edge), mShowCreases(false) { VL_DEBUG_SET_OBJECT_NAME() } //! If \p true only the edges forming the silhouette of an object will be rendered. void setShowCreases(bool sonly) { mShowCreases = sonly; } //! If \p true only the edges forming the silhouette of an object will be rendered. bool showCreases() const { return mShowCreases; } virtual void onActorDelete(Actor*) {} virtual void onActorRenderStarted(Actor* act, real /*frame_clock*/, const Camera* cam, Renderable* renderable, const Shader*, int pass) { if (pass != 0) return; fmat4 vmat = (fmat4)cam->viewMatrix(); if (act->transform()) vmat = vmat * (fmat4)act->transform()->worldMatrix(); fmat4 nmat = vmat.as3x3(); nmat = nmat.getInverse().transpose(); ref<Geometry> geom = cast<Geometry>(renderable); ref<ArrayFloat3> vert_array = cast<ArrayFloat3>(geom->vertexArray()); // VL_CHECK(vert_array->size() == edges().size()*2); for(unsigned i=0; i<edges().size(); ++i) { bool insert_edge = edges()[i].isCrease() && showCreases(); if (!insert_edge) { fvec3 v1 = vmat * edges()[i].vertex1(); fvec3 v2 = vmat * edges()[i].vertex2(); fvec3 v = ((v1+v2) * 0.5f).normalize(); fvec3 n1 = nmat * edges()[i].normal1(); fvec3 n2 = nmat * edges()[i].normal2(); insert_edge = dot(n1, v) * dot(n2, v) < 0; } if ( insert_edge ) { vert_array->at(i*2+0) = edges()[i].vertex1(); vert_array->at(i*2+1) = edges()[i].vertex2(); } else { // degenerate vert_array->at(i*2+0) = vert_array->at(i*2+1); } } } const std::vector<EdgeExtractor::Edge>& edges() const { return mEdges; } std::vector<EdgeExtractor::Edge>& edges() { return mEdges; } private: std::vector<EdgeExtractor::Edge> mEdges; bool mShowCreases; }; } #endif
47.112069
140
0.507045
zpc930
480779afd2cdd1dfb5a4ebd00e961fb057db8e51
3,344
cpp
C++
libraries/audio/src/AudioEffectOptions.cpp
ey6es/hifi
23f9c799dde439e4627eef45341fb0d53feff80b
[ "Apache-2.0" ]
1
2015-03-11T19:49:20.000Z
2015-03-11T19:49:20.000Z
libraries/audio/src/AudioEffectOptions.cpp
ey6es/hifi
23f9c799dde439e4627eef45341fb0d53feff80b
[ "Apache-2.0" ]
null
null
null
libraries/audio/src/AudioEffectOptions.cpp
ey6es/hifi
23f9c799dde439e4627eef45341fb0d53feff80b
[ "Apache-2.0" ]
null
null
null
// // AudioEffectOptions.cpp // libraries/audio/src // // Copyright 2013 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include "AudioEffectOptions.h" static const QString MAX_ROOM_SIZE_HANDLE = "maxRoomSize"; static const QString ROOM_SIZE_HANDLE = "roomSize"; static const QString REVERB_TIME_HANDLE = "reverbTime"; static const QString DAMPIMG_HANDLE = "damping"; static const QString SPREAD_HANDLE = "spread"; static const QString INPUT_BANDWIDTH_HANDLE = "inputBandwidth"; static const QString EARLY_LEVEL_HANDLE = "earlyLevel"; static const QString TAIL_LEVEL_HANDLE = "tailLevel"; static const QString DRY_LEVEL_HANDLE = "dryLevel"; static const QString WET_LEVEL_HANDLE = "wetLevel"; AudioEffectOptions::AudioEffectOptions(QScriptValue arguments) : _maxRoomSize(50.0f), _roomSize(50.0f), _reverbTime(4.0f), _damping(0.5f), _spread(15.0f), _inputBandwidth(0.75f), _earlyLevel(-22.0f), _tailLevel(-28.0f), _dryLevel(0.0f), _wetLevel(6.0f) { if (arguments.property(MAX_ROOM_SIZE_HANDLE).isNumber()) { _maxRoomSize = arguments.property(MAX_ROOM_SIZE_HANDLE).toNumber(); } if (arguments.property(ROOM_SIZE_HANDLE).isNumber()) { _roomSize = arguments.property(ROOM_SIZE_HANDLE).toNumber(); } if (arguments.property(REVERB_TIME_HANDLE).isNumber()) { _reverbTime = arguments.property(REVERB_TIME_HANDLE).toNumber(); } if (arguments.property(DAMPIMG_HANDLE).isNumber()) { _damping = arguments.property(DAMPIMG_HANDLE).toNumber(); } if (arguments.property(SPREAD_HANDLE).isNumber()) { _spread = arguments.property(SPREAD_HANDLE).toNumber(); } if (arguments.property(INPUT_BANDWIDTH_HANDLE).isNumber()) { _inputBandwidth = arguments.property(INPUT_BANDWIDTH_HANDLE).toNumber(); } if (arguments.property(EARLY_LEVEL_HANDLE).isNumber()) { _earlyLevel = arguments.property(EARLY_LEVEL_HANDLE).toNumber(); } if (arguments.property(TAIL_LEVEL_HANDLE).isNumber()) { _tailLevel = arguments.property(TAIL_LEVEL_HANDLE).toNumber(); } if (arguments.property(DRY_LEVEL_HANDLE).isNumber()) { _dryLevel = arguments.property(DRY_LEVEL_HANDLE).toNumber(); } if (arguments.property(WET_LEVEL_HANDLE).isNumber()) { _wetLevel = arguments.property(WET_LEVEL_HANDLE).toNumber(); } } AudioEffectOptions::AudioEffectOptions(const AudioEffectOptions &other) { *this = other; } AudioEffectOptions& AudioEffectOptions::operator=(const AudioEffectOptions &other) { _maxRoomSize = other._maxRoomSize; _roomSize = other._roomSize; _reverbTime = other._reverbTime; _damping = other._damping; _spread = other._spread; _inputBandwidth = other._inputBandwidth; _earlyLevel = other._earlyLevel; _tailLevel = other._tailLevel; _dryLevel = other._dryLevel; _wetLevel = other._wetLevel; return *this; } QScriptValue AudioEffectOptions::constructor(QScriptContext* context, QScriptEngine* engine) { return engine->newQObject(new AudioEffectOptions(context->argument(0))); }
37.573034
94
0.700957
ey6es
48081e868788e0ee93c3e3e089e42fab2d22bd84
720
cpp
C++
hiro/gtk/widget/icon-view-item.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
153
2020-07-25T17:55:29.000Z
2021-10-01T23:45:01.000Z
hiro/gtk/widget/icon-view-item.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
245
2021-10-08T09:14:46.000Z
2022-03-31T08:53:13.000Z
hiro/gtk/widget/icon-view-item.cpp
CasualPokePlayer/ares
58690cd5fc7bb6566c22935c5b80504a158cca29
[ "BSD-3-Clause" ]
44
2020-07-25T08:51:55.000Z
2021-09-25T16:09:01.000Z
#if defined(Hiro_IconView) namespace hiro { auto pIconViewItem::construct() -> void { } auto pIconViewItem::destruct() -> void { } auto pIconViewItem::setIcon(const image& icon) -> void { if(auto parent = _parent()) { parent->setItemIcon(self().offset(), icon); } } auto pIconViewItem::setSelected(bool selected) -> void { if(auto parent = _parent()) { parent->setItemSelected(self().offset(), selected); } } auto pIconViewItem::setText(const string& text) -> void { if(auto parent = _parent()) { parent->setItemText(self().offset(), text); } } auto pIconViewItem::_parent() -> pIconView* { if(auto parent = self().parentIconView()) return parent->self(); return nullptr; } } #endif
19.459459
66
0.663889
CasualPokePlayer
4809458e29be353bc0bf673acb7e29177aa27e05
32,064
cpp
C++
src/gpg_multiplayer.cpp
isabella232/pienoon
a721180de4d9de3696af3b3734d1ad269975b111
[ "Apache-2.0", "MIT" ]
323
2015-01-05T10:16:13.000Z
2022-03-26T06:49:33.000Z
src/gpg_multiplayer.cpp
google/pienoon
a721180de4d9de3696af3b3734d1ad269975b111
[ "Apache-2.0" ]
1
2021-07-12T13:36:14.000Z
2021-07-12T13:36:14.000Z
src/gpg_multiplayer.cpp
isabella232/pienoon
a721180de4d9de3696af3b3734d1ad269975b111
[ "Apache-2.0", "MIT" ]
95
2015-01-02T12:01:31.000Z
2022-03-27T18:57:09.000Z
// Copyright 2014 Google Inc. 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 "precompiled.h" #include <algorithm> #include "fplbase/utilities.h" #include "gpg_multiplayer.h" namespace fpl { GPGMultiplayer::GPGMultiplayer() : message_mutex_(PTHREAD_MUTEX_INITIALIZER), instance_mutex_(PTHREAD_MUTEX_INITIALIZER), state_mutex_(PTHREAD_MUTEX_INITIALIZER) {} bool GPGMultiplayer::Initialize(const std::string& service_id) { state_ = kIdle; is_hosting_ = false; allow_reconnecting_ = true; service_id_ = service_id; gpg::AndroidPlatformConfiguration platform_configuration; platform_configuration.SetActivity((jobject)fplbase::AndroidGetActivity()); gpg::NearbyConnections::Builder nearby_builder; nearby_connections_ = nearby_builder.SetDefaultOnLog(gpg::LogLevel::VERBOSE) .SetServiceId(service_id_) .Create(platform_configuration); discovery_listener_.reset(nullptr); message_listener_.reset(nullptr); if (nearby_connections_ == nullptr) { fplbase::LogError(fplbase::kApplication, "GPGMultiplayer: Unable to build a NearbyConnections instance."); return false; } return true; } void GPGMultiplayer::AddAppIdentifier(const std::string& identifier) { gpg::AppIdentifier id; id.identifier = identifier; app_identifiers_.push_back(id); } void GPGMultiplayer::StartAdvertising() { QueueNextState(kAdvertising); } void GPGMultiplayer::StopAdvertising() { pthread_mutex_lock(&instance_mutex_); int num_connected_instances = connected_instances_.size(); pthread_mutex_unlock(&instance_mutex_); if (num_connected_instances > 0) { QueueNextState(kConnected); } else { QueueNextState(kIdle); } } void GPGMultiplayer::StartDiscovery() { QueueNextState(kDiscovering); } void GPGMultiplayer::StopDiscovery() { // check if we are connected pthread_mutex_lock(&instance_mutex_); int num_connected_instances = connected_instances_.size(); pthread_mutex_unlock(&instance_mutex_); if (num_connected_instances > 0) { QueueNextState(kConnected); } else { QueueNextState(kIdle); } } void GPGMultiplayer::ResetToIdle() { QueueNextState(kIdle); DisconnectAll(); pthread_mutex_lock(&instance_mutex_); connected_instances_.clear(); connected_instances_reverse_.clear(); instance_names_.clear(); pending_instances_.clear(); discovered_instances_.clear(); pthread_mutex_unlock(&instance_mutex_); pthread_mutex_lock(&message_mutex_); while (!incoming_messages_.empty()) incoming_messages_.pop(); pthread_mutex_unlock(&message_mutex_); } void GPGMultiplayer::DisconnectInstance(const std::string& instance_id) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Disconnect player (instance_id='%s')", instance_id.c_str()); nearby_connections_->Disconnect(instance_id); pthread_mutex_lock(&instance_mutex_); auto i = std::find(connected_instances_.begin(), connected_instances_.end(), instance_id); if (i != connected_instances_.end()) { connected_instances_.erase(i); UpdateConnectedInstances(); } if (IsConnected() && connected_instances_.size() == 0) { pthread_mutex_unlock(&instance_mutex_); QueueNextState(kIdle); } else { pthread_mutex_unlock(&instance_mutex_); } } void GPGMultiplayer::DisconnectAll() { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Disconnect all players"); // In case there are any connection requests outstanding, reject them. RejectAllConnectionRequests(); // Disconnect anyone we are connected to. pthread_mutex_lock(&instance_mutex_); for (const auto& instance : connected_instances_) { nearby_connections_->Disconnect(instance); } connected_instances_.clear(); UpdateConnectedInstances(); pthread_mutex_unlock(&instance_mutex_); if (state() == kConnected || state() == kConnectedWithDisconnections) { QueueNextState(kIdle); } } void GPGMultiplayer::SendConnectionRequest( const std::string& host_instance_id) { if (message_listener_ == nullptr) { message_listener_.reset(new MessageListener( [this](const std::string& instance_id, std::vector<uint8_t> const& payload, bool is_reliable) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: OnMessageReceived(%s) callback", instance_id.c_str()); this->MessageReceivedCallback(instance_id, payload, is_reliable); }, [this](const std::string& instance_id) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: OnDisconnect(%s) callback", instance_id.c_str()); this->DisconnectedCallback(instance_id); })); } LogInfo(fplbase::kApplication, "GPGMultiplayer: Sending connection request to %s", host_instance_id.c_str()); // Immediately stop discovery once we start connecting. nearby_connections_->SendConnectionRequest( my_instance_name_, host_instance_id, std::vector<uint8_t>{}, [this](int64_t client_id, gpg::ConnectionResponse const& response) { LogInfo(fplbase::kApplication, "GPGMultiplayer: OnConnectionResponse() callback"); this->ConnectionResponseCallback(response); }, message_listener_.get()); } void GPGMultiplayer::AcceptConnectionRequest( const std::string& client_instance_id) { if (message_listener_ == nullptr) { message_listener_.reset(new MessageListener( [this](const std::string& instance_id, std::vector<uint8_t> const& payload, bool is_reliable) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: OnMessageReceived(%s) callback", instance_id.c_str()); this->MessageReceivedCallback(instance_id, payload, is_reliable); }, [this](const std::string& instance_id) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: OnDisconnect(%s) callback", instance_id.c_str()); this->DisconnectedCallback(instance_id); })); } fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Accepting connection from %s", client_instance_id.c_str()); nearby_connections_->AcceptConnectionRequest( client_instance_id, std::vector<uint8_t>{}, message_listener_.get()); pthread_mutex_lock(&instance_mutex_); AddNewConnectedInstance(client_instance_id); UpdateConnectedInstances(); auto i = std::find(pending_instances_.begin(), pending_instances_.end(), client_instance_id); if (i != pending_instances_.end()) { pending_instances_.erase(i); } pthread_mutex_unlock(&instance_mutex_); } void GPGMultiplayer::RejectConnectionRequest( const std::string& client_instance_id) { LogInfo(fplbase::kApplication, "GPGMultiplayer: Rejecting connection from %s", client_instance_id.c_str()); nearby_connections_->RejectConnectionRequest(client_instance_id); pthread_mutex_lock(&instance_mutex_); auto i = std::find(pending_instances_.begin(), pending_instances_.end(), client_instance_id); if (i != pending_instances_.end()) { pending_instances_.erase(i); } pthread_mutex_unlock(&instance_mutex_); } void GPGMultiplayer::RejectAllConnectionRequests() { pthread_mutex_lock(&instance_mutex_); for (const auto& instance_id : pending_instances_) { nearby_connections_->RejectConnectionRequest(instance_id); } pending_instances_.clear(); pthread_mutex_unlock(&instance_mutex_); } // Call me once a frame! void GPGMultiplayer::Update() { pthread_mutex_lock(&state_mutex_); // unlocked in two places below if (!next_states_.empty()) { // Transition at most one state per frame. MultiplayerState next_state = next_states_.front(); next_states_.pop(); pthread_mutex_unlock(&state_mutex_); LogInfo(fplbase::kApplication, "GPGMultiplayer: Exiting state %d to enter state %d", state(), next_state); TransitionState(state(), next_state); } else { pthread_mutex_unlock(&state_mutex_); } // Now update based on what state we are in. switch (state()) { case kDiscovering: { pthread_mutex_lock(&instance_mutex_); bool has_discovered_instance = !discovered_instances_.empty(); pthread_mutex_unlock(&instance_mutex_); if (has_discovered_instance) { QueueNextState(kDiscoveringPromptedUser); } break; } case kDiscoveringPromptedUser: { DialogResponse response = GetConnectionDialogResponse(); if (response == kDialogNo) { // we decided not to connect to the first discovered instance. pthread_mutex_lock(&instance_mutex_); discovered_instances_.pop_front(); pthread_mutex_unlock(&instance_mutex_); QueueNextState(kDiscovering); } else if (response == kDialogYes) { // We decided to try to connect to the first discovered instance. pthread_mutex_lock(&instance_mutex_); auto instance = discovered_instances_.front(); discovered_instances_.pop_front(); pthread_mutex_unlock(&instance_mutex_); SendConnectionRequest(instance); QueueNextState(kDiscoveringWaitingForHost); } // Otherwise we haven't gotten a response yet. break; } case kConnectedWithDisconnections: { pthread_mutex_lock(&instance_mutex_); bool has_disconnected_instance = !disconnected_instances_.empty(); bool has_pending_instance = !pending_instances_.empty(); pthread_mutex_unlock(&instance_mutex_); if (!has_disconnected_instance) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: No disconnected instances."); QueueNextState(kConnected); } else if (has_pending_instance) { // Check if the pending instance is one of the disconnected ones. // If so, and we still have room, connect him. // Otherwise, reject. pthread_mutex_lock(&instance_mutex_); auto i = disconnected_instances_.find(pending_instances_.front()); bool is_reconnection = (i != disconnected_instances_.end()); pthread_mutex_unlock(&instance_mutex_); if (!is_reconnection) { // Not a disconnected instance. Reject. RejectConnectionRequest(pending_instances_.front()); } else if (max_connected_players_allowed() >= 0 && GetNumConnectedPlayers() >= max_connected_players_allowed()) { // Too many players to allow us back. Reject. But we might be // allowed back again in the future. RejectConnectionRequest(pending_instances_.front()); } else { // A valid reconnecting instance. Allow. AcceptConnectionRequest(pending_instances_.front()); } } break; } case kAdvertising: { pthread_mutex_lock(&instance_mutex_); bool has_pending_instance = !pending_instances_.empty(); pthread_mutex_unlock(&instance_mutex_); if (has_pending_instance) { if (max_connected_players_allowed() >= 0 && GetNumConnectedPlayers() >= max_connected_players_allowed()) { // Already have a full game, auto-reject any additional players. RejectConnectionRequest(pending_instances_.front()); } else { // Prompt the user to allow the connection. QueueNextState(kAdvertisingPromptedUser); } } break; } case kAdvertisingPromptedUser: { // check if we allowed connection int response = GetConnectionDialogResponse(); if (response == 0) { // Reject removes the instance_id from pending pthread_mutex_lock(&instance_mutex_); auto instance = pending_instances_.front(); pthread_mutex_unlock(&instance_mutex_); RejectConnectionRequest(instance); QueueNextState(kAdvertising); } else if (response == 1) { // Accept removes the instance_id from pending and adds it to connected pthread_mutex_lock(&instance_mutex_); auto instance = pending_instances_.front(); pthread_mutex_unlock(&instance_mutex_); AcceptConnectionRequest(instance); QueueNextState(kAdvertising); } // Otherwise we haven't gotten a response yet. break; } default: { // no default behavior break; } } } void GPGMultiplayer::TransitionState(MultiplayerState old_state, MultiplayerState new_state) { if (old_state == new_state) { return; } // First, exit the old state. switch (old_state) { case kDiscovering: case kDiscoveringPromptedUser: case kDiscoveringWaitingForHost: { // Make sure we are totally leaving the "discovering" world. if (new_state != kDiscoveringPromptedUser && new_state != kDiscoveringWaitingForHost && new_state != kDiscovering) { nearby_connections_->StopDiscovery(service_id_); fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Stopped discovery."); } break; } case kConnectedWithDisconnections: case kAdvertising: case kAdvertisingPromptedUser: { // Make sure we are totally leaving the "advertising" world. if (new_state != kAdvertising && new_state != kAdvertisingPromptedUser && new_state != kConnectedWithDisconnections) { nearby_connections_->StopAdvertising(); fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Stopped advertising"); } break; } default: { // no default behavior break; } } // Then, set the state. state_ = new_state; // Then, activate the new state. switch (new_state) { case kIdle: { is_hosting_ = false; ClearDisconnectedInstances(); break; } case kConnectedWithDisconnections: // advertises also case kAdvertising: { is_hosting_ = true; if (new_state != kConnectedWithDisconnections) { ClearDisconnectedInstances(); } if (old_state != kAdvertising && old_state != kAdvertisingPromptedUser && old_state != kConnectedWithDisconnections) { nearby_connections_->StartAdvertising( my_instance_name_, app_identifiers_, gpg::Duration::zero(), [this](int64_t client_id, gpg::StartAdvertisingResult const& result) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: StartAdvertising callback"); this->StartAdvertisingCallback(result); }, [this](int64_t client_id, gpg::ConnectionRequest const& connection_request) { this->ConnectionRequestCallback(connection_request); }); fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Starting advertising"); } break; } case kDiscovering: { is_hosting_ = false; ClearDisconnectedInstances(); if (old_state != kDiscoveringWaitingForHost && old_state != kDiscoveringPromptedUser) { if (discovery_listener_ == nullptr) { discovery_listener_.reset(new DiscoveryListener( [this](gpg::EndpointDetails const& endpoint_details) { this->DiscoveryEndpointFoundCallback(endpoint_details); }, [this](const std::string& instance_id) { this->DiscoveryEndpointLostCallback(instance_id); })); } nearby_connections_->StartDiscovery(service_id_, gpg::Duration::zero(), discovery_listener_.get()); fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Starting discovery"); } break; } case kAdvertisingPromptedUser: { pthread_mutex_lock(&instance_mutex_); std::string instance_id = pending_instances_.front(); std::string instance_name = instance_names_[instance_id]; std::string message = std::string("Accept connection from \"") + instance_name + "\"?"; pthread_mutex_unlock(&instance_mutex_); if (!DisplayConnectionDialog("Connection Request", message.c_str(), "Yes", "No")) { // Failed to display dialog, go back to previous state. QueueNextState(old_state); } break; } case kDiscoveringPromptedUser: { pthread_mutex_lock(&instance_mutex_); std::string instance_id = discovered_instances_.front(); std::string instance_name = instance_names_[instance_id]; std::string message = std::string("Connect to \"") + instance_name + "\"?"; pthread_mutex_unlock(&instance_mutex_); if (!DisplayConnectionDialog("Host Found", message.c_str(), "Yes", "No")) { // Failed to display dialog, go back to previous state. QueueNextState(old_state); } break; } case kConnected: { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Connection activated."); break; } default: { // no default behavior break; } } } void GPGMultiplayer::QueueNextState(MultiplayerState next_state) { pthread_mutex_lock(&state_mutex_); next_states_.push(next_state); pthread_mutex_unlock(&state_mutex_); } bool GPGMultiplayer::SendMessage(const std::string& instance_id, const std::vector<uint8_t>& payload, bool reliable) { if (GetPlayerNumberByInstanceId(instance_id) == -1) { // Ensure we are actually connected to the specified instance. return false; } else { } if (reliable) { nearby_connections_->SendReliableMessage(instance_id, payload); } else { nearby_connections_->SendUnreliableMessage(instance_id, payload); } return true; } void GPGMultiplayer::BroadcastMessage(const std::vector<uint8_t>& payload, bool reliable) { pthread_mutex_lock(&instance_mutex_); std::vector<std::string> all_instances{connected_instances_.begin(), connected_instances_.end()}; pthread_mutex_unlock(&instance_mutex_); if (reliable) { nearby_connections_->SendReliableMessage(all_instances, payload); } else { nearby_connections_->SendUnreliableMessage(all_instances, payload); } } bool GPGMultiplayer::HasMessage() { pthread_mutex_lock(&message_mutex_); bool empty = incoming_messages_.empty(); pthread_mutex_unlock(&message_mutex_); return !empty; } GPGMultiplayer::SenderAndMessage GPGMultiplayer::GetNextMessage() { if (HasMessage()) { pthread_mutex_lock(&message_mutex_); auto message = incoming_messages_.front(); incoming_messages_.pop(); pthread_mutex_unlock(&message_mutex_); return message; } else { SenderAndMessage blank{"", {}}; return blank; } } bool GPGMultiplayer::HasReconnectedPlayer() { pthread_mutex_lock(&instance_mutex_); bool has_reconnected_player = !reconnected_players_.empty(); pthread_mutex_unlock(&instance_mutex_); return has_reconnected_player; } int GPGMultiplayer::GetReconnectedPlayer() { pthread_mutex_lock(&instance_mutex_); if (reconnected_players_.empty()) { pthread_mutex_unlock(&instance_mutex_); return -1; } else { int player = reconnected_players_.front(); reconnected_players_.pop(); pthread_mutex_unlock(&instance_mutex_); return player; } } // Callbacks are below. // Callback on the host when it starts advertising. void GPGMultiplayer::StartAdvertisingCallback( gpg::StartAdvertisingResult const& result) { // We've started hosting if (result.status == gpg::StartAdvertisingResult::StatusCode::SUCCESS) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Started advertising (name='%s')", result.local_endpoint_name.c_str()); } else { fplbase::LogError(fplbase::kApplication, "GPGMultiplayer: FAILED to start advertising, error code %d", result.status); if (state() == kConnectedWithDisconnections) { // We couldn't allow reconnections, sorry! ClearDisconnectedInstances(); QueueNextState(kConnected); } else { QueueNextState(kError); } } } // Callback on the host when a client tries to connect. void GPGMultiplayer::ConnectionRequestCallback( gpg::ConnectionRequest const& connection_request) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Incoming connection (instance_id=%s,name=%s)", connection_request.remote_endpoint_id.c_str(), connection_request.remote_endpoint_name.c_str()); // process the incoming connection pthread_mutex_lock(&instance_mutex_); pending_instances_.push_back(connection_request.remote_endpoint_id); instance_names_[connection_request.remote_endpoint_id] = connection_request.remote_endpoint_name; pthread_mutex_unlock(&instance_mutex_); } // Callback on the client when it discovers a host. void GPGMultiplayer::DiscoveryEndpointFoundCallback( gpg::EndpointDetails const& endpoint_details) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Found endpoint"); pthread_mutex_lock(&instance_mutex_); instance_names_[endpoint_details.endpoint_id] = endpoint_details.name; discovered_instances_.push_back(endpoint_details.endpoint_id); pthread_mutex_unlock(&instance_mutex_); } // Callback on the client when a host it previous discovered disappears. void GPGMultiplayer::DiscoveryEndpointLostCallback( const std::string& instance_id) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Lost endpoint"); pthread_mutex_lock(&instance_mutex_); auto i = std::find(discovered_instances_.begin(), discovered_instances_.end(), instance_id); if (i != discovered_instances_.end()) { discovered_instances_.erase(i); } pthread_mutex_unlock(&instance_mutex_); } // Callback on the client when it is either accepted or rejected by the host. void GPGMultiplayer::ConnectionResponseCallback( gpg::ConnectionResponse const& response) { if (response.status == gpg::ConnectionResponse::StatusCode::ACCEPTED) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Connected!"); pthread_mutex_lock(&instance_mutex_); connected_instances_.push_back(response.remote_endpoint_id); UpdateConnectedInstances(); pthread_mutex_unlock(&instance_mutex_); QueueNextState(kConnected); } else { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Didn't connect, response status = %d", response.status); QueueNextState(kDiscovering); } } // Callback on host or client when an incoming message is received. void GPGMultiplayer::MessageReceivedCallback( const std::string& instance_id, std::vector<uint8_t> const& payload, bool is_reliable) { pthread_mutex_lock(&message_mutex_); incoming_messages_.push({instance_id, payload}); pthread_mutex_unlock(&message_mutex_); } // Callback on host or client when a connected instance disconnects. void GPGMultiplayer::DisconnectedCallback(const std::string& instance_id) { if (allow_reconnecting() && is_hosting() && IsConnected() && GetNumConnectedPlayers() > 1) { // We are connected, and we have other instances connected besides this one. // Rather than simply disconnecting this instance, let's remember it so we // can give it back its connection slot if it tries to reconnect. fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Allowing reconnection by instance %s", instance_id.c_str()); pthread_mutex_lock(&instance_mutex_); auto i = connected_instances_reverse_.find(instance_id); if (i != connected_instances_reverse_.end()) { int idx = i->second; disconnected_instances_[instance_id] = idx; // Put an empty instance ID as a placeholder for a disconnected instance. connected_instances_[idx] = ""; UpdateConnectedInstances(); } pthread_mutex_unlock(&instance_mutex_); // When the state is kConnectedWithDisconnections, we start advertising // again and allow only the disconnected instances to reconnect. QueueNextState(kConnectedWithDisconnections); } else { // Simply remove the connected index. pthread_mutex_lock(&instance_mutex_); auto i = std::find(connected_instances_.begin(), connected_instances_.end(), instance_id); if (i != connected_instances_.end()) { connected_instances_.erase(i); UpdateConnectedInstances(); } pthread_mutex_unlock(&instance_mutex_); if (IsConnected() && GetNumConnectedPlayers() == 0) { QueueNextState(kIdle); } } } // Important: make sure you lock instance_mutex_ before calling this. void GPGMultiplayer::UpdateConnectedInstances() { connected_instances_reverse_.clear(); for (unsigned int i = 0; i < connected_instances_.size(); i++) { connected_instances_reverse_[connected_instances_[i]] = i; } } // Important: make sure you lock instance_mutex_ before calling this. int GPGMultiplayer::AddNewConnectedInstance(const std::string& instance_id) { int new_index = -1; // First, check if we are a reconnection. if (state() == kConnectedWithDisconnections) { auto i = disconnected_instances_.find(instance_id); if (i != disconnected_instances_.end()) { // We've got a disconnected instance, let's find a slot. if (connected_instances_[i->second] == "") { new_index = i->second; connected_instances_[new_index] = instance_id; disconnected_instances_.erase(i); } // If the slot was already taken, fall through to default behavior below. } } if (new_index == -1) { if (max_connected_players_allowed() < 0 || (int)connected_instances_.size() < max_connected_players_allowed()) { // There's an empty player slot at the end, just connect there. new_index = connected_instances_.size(); connected_instances_.push_back(instance_id); } else { // We're full, but there might be a reserved spot for a disconnected // player. We'll just use that. Sorry, prevoius player! for (unsigned int i = 0; i < connected_instances_.size(); i++) { if (connected_instances_[i] == "") { new_index = i; connected_instances_[new_index] = instance_id; break; } } } } if (state() == kConnectedWithDisconnections && new_index >= 0) { fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Connected a reconnected player"); reconnected_players_.push(new_index); } fplbase::LogInfo(fplbase::kApplication, "GPGMultiplayer: Instance %s goes in slot %d", instance_id.c_str(), new_index); return new_index; } void GPGMultiplayer::ClearDisconnectedInstances() { disconnected_instances_.clear(); while (!reconnected_players_.empty()) reconnected_players_.pop(); } int GPGMultiplayer::GetNumConnectedPlayers() { int num_players = 0; pthread_mutex_lock(&instance_mutex_); for (auto instance_id : connected_instances_) { if (instance_id != "") { num_players++; } } pthread_mutex_unlock(&instance_mutex_); return num_players; } int GPGMultiplayer::GetPlayerNumberByInstanceId( const std::string& instance_id) { pthread_mutex_lock(&instance_mutex_); auto i = connected_instances_reverse_.find(instance_id); int player_num = ((i != connected_instances_reverse_.end()) ? i->second : -1); pthread_mutex_unlock(&instance_mutex_); return player_num; } std::string GPGMultiplayer::GetInstanceIdByPlayerNumber(unsigned int player) { pthread_mutex_lock(&instance_mutex_); // Copy out of thread-unsafe storage. std::string instance_id = (player < connected_instances_.size()) ? connected_instances_[player] : ""; pthread_mutex_unlock(&instance_mutex_); return instance_id; } // JNI calls for displaying the connection prompt and getting the results. // Show a dialog box, allowing the user to reply to a Yes or No question. bool GPGMultiplayer::DisplayConnectionDialog(const char* title, const char* question_text, const char* yes_text, const char* no_text) { #ifdef __ANDROID__ if (auto_connect_) { return true; } bool question_shown = false; JNIEnv* env = fplbase::AndroidGetJNIEnv(); jobject activity = fplbase::AndroidGetActivity(); jclass fpl_class = env->GetObjectClass(activity); jmethodID is_text_dialog_open = env->GetMethodID(fpl_class, "isTextDialogOpen", "()Z"); jboolean open = env->CallBooleanMethod(activity, is_text_dialog_open); jmethodID get_query_dialog_response = env->GetMethodID(fpl_class, "getQueryDialogResponse", "()I"); int response = env->CallIntMethod(activity, get_query_dialog_response); if (!open && response == -1) { jmethodID show_query_dialog = env->GetMethodID(fpl_class, "showQueryDialog", "(Ljava/lang/String;Ljava/lang/String;" "Ljava/lang/String;Ljava/lang/String;)V"); jstring titlej = env->NewStringUTF(title); jstring questionj = env->NewStringUTF(question_text); jstring yesj = env->NewStringUTF(yes_text); jstring noj = env->NewStringUTF(no_text); env->CallVoidMethod(activity, show_query_dialog, titlej, questionj, yesj, noj); env->DeleteLocalRef(titlej); env->DeleteLocalRef(questionj); env->DeleteLocalRef(yesj); env->DeleteLocalRef(noj); question_shown = true; } env->DeleteLocalRef(fpl_class); env->DeleteLocalRef(activity); return question_shown; #else (void)title; (void)question_text; (void)yes_text; (void)no_text; return false; #endif } // Get the user's reply to the connection dialog (kDialogNo for No, kDialogYes // for Yes), or kDialogWaiting if there is no result yet. Calling this consumes // the result. GPGMultiplayer::DialogResponse GPGMultiplayer::GetConnectionDialogResponse() { #ifdef __ANDROID__ // If we are set to automatically connect, pretend this is true. if (auto_connect_) { return kDialogYes; } JNIEnv* env = fplbase::AndroidGetJNIEnv(); jobject activity = fplbase::AndroidGetActivity(); jclass fpl_class = env->GetObjectClass(activity); jmethodID get_query_dialog_response = env->GetMethodID(fpl_class, "getQueryDialogResponse", "()I"); int result = env->CallIntMethod(activity, get_query_dialog_response); if (result >= 0) { jmethodID reset_query_dialog_response = env->GetMethodID(fpl_class, "resetQueryDialogResponse", "()V"); env->CallVoidMethod(activity, reset_query_dialog_response); } env->DeleteLocalRef(fpl_class); env->DeleteLocalRef(activity); switch (result) { case 0: return kDialogNo; case 1: return kDialogYes; default: return kDialogWaiting; } #else return kDialogWaiting; #endif } } // namespace fpl
36.067492
80
0.683103
isabella232
48096ad7d2fb39deb394920b266dff9a8c83229c
3,733
hpp
C++
include/bulk/partitionings/block.hpp
roelhem/Bulk
8a84bb8cf0a71a5d67ed6ffd818f072d9076630f
[ "MIT" ]
92
2016-05-11T14:26:04.000Z
2022-01-07T03:54:19.000Z
include/bulk/partitionings/block.hpp
roelhem/Bulk
8a84bb8cf0a71a5d67ed6ffd818f072d9076630f
[ "MIT" ]
6
2016-05-15T05:58:47.000Z
2020-11-25T15:29:26.000Z
include/bulk/partitionings/block.hpp
roelhem/Bulk
8a84bb8cf0a71a5d67ed6ffd818f072d9076630f
[ "MIT" ]
13
2016-05-14T11:14:14.000Z
2022-01-25T10:17:24.000Z
#include "partitioning.hpp" namespace bulk { /** * A block distribution. This equally block-distributes the first G axes. */ template <int D, int G = D> class block_partitioning : public rectangular_partitioning<D, G> { public: using rectangular_partitioning<D, G>::local_size; using rectangular_partitioning<D, G>::origin; using rectangular_partitioning<D, G>::global; /** * Constructs a block partitioning in nD. * * `grid`: the number of processors in each dimension * `data_size`: the global number of processors along each axis */ block_partitioning(index_type<D> data_size, index_type<G> grid) : block_partitioning(data_size, grid, iota_()) {} /** * Constructs a block partitioning in nD. * * `grid`: the number of processors in each dimension * `data_size`: the global number of processors along each axis * `axes`: an array of size `G` that indicates the axes over which to * partition */ block_partitioning(index_type<D> data_size, index_type<G> grid, index_type<G> axes) : rectangular_partitioning<D, G>(data_size, grid), axes_(axes) { static_assert(G <= D, "Dimensionality of the data should be larger or equal to " "that of the processor grid."); block_size_ = data_size; for (int i = 0; i < G; ++i) { int d = axes_[i]; block_size_[d] = ((data_size[d] - 1) / grid[i]) + 1; } } /** Compute the local indices of a element using its global indices */ index_type<D> local(index_type<D> index) override final { auto t = this->owner(index); for (int d = 0; d < D; ++d) { index[d] = index[d] - this->origin(t)[d]; } return index; } /** The total number of elements along each axis on the processor index with * `idxs...` */ index_type<D> local_size(index_type<G> idxs) override final { index_type<D> size = this->global_size_; for (int i = 0; i < G; ++i) { auto dim = axes_[i]; size[dim] = (this->global_size_[dim] + this->grid_size_[i] - idxs[i] - 1) / this->grid_size_[i]; } return size; } /** Block in first 'G' dimensions. */ index_type<G> multi_owner(index_type<D> xs) override final { index_type<G> result = {}; for (int i = 0; i < G; ++i) { auto d = this->axes_[i]; auto n = this->global_size_[d]; auto k = this->block_size_[d]; auto P = this->grid_size_[i]; // For irregular block partitionings, only the first 'l' processors will // have block_size_, the other n - l processors have block_size - 1. auto l = P - (k * P - n); if (xs[d] <= k * l) { result[i] = xs[d] / block_size_[d]; } else { result[i] = l + (xs[d] - k * l) / (block_size_[d] - 1); } } return result; } /** Obtain the block size in each dimension. */ index_type<D> block_size() const { return block_size_; } /** Obtain the origin of the block of processor `multi_index'. */ index_type<D> origin(index_type<G> multi_index) const override { index_type<D> result = {}; for (int i = 0; i < G; ++i) { auto d = axes_[i]; auto n = this->global_size_[d]; auto k = this->block_size_[d]; auto P = this->grid_size_[i]; auto l = P - (k * P - n); auto t = multi_index[i]; if (t <= l) { result[d] = k * multi_index[i]; } else { result[d] = k * l + (t - l) * (k - 1); } } return result; } private: index_type<D> block_size_; index_type<G> axes_; static index_type<G> iota_() { index_type<G> result = {}; for (int i = 0; i < G; ++i) { result[i] = i; } return result; } }; } // namespace bulk
29.864
78
0.587999
roelhem
48099fb01e53902dbb585e37eba837e8dce47af8
31,219
cpp
C++
src/mongo/db/mongod_options.cpp
benety/mongo
203430ac9559f82ca01e3cbb3b0e09149fec0835
[ "Apache-2.0" ]
null
null
null
src/mongo/db/mongod_options.cpp
benety/mongo
203430ac9559f82ca01e3cbb3b0e09149fec0835
[ "Apache-2.0" ]
null
null
null
src/mongo/db/mongod_options.cpp
benety/mongo
203430ac9559f82ca01e3cbb3b0e09149fec0835
[ "Apache-2.0" ]
null
null
null
/** * Copyright (C) 2018-present MongoDB, Inc. * * This program is free software: you can redistribute it and/or modify * it under the terms of the Server Side Public License, version 1, * as published by MongoDB, Inc. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * Server Side Public License for more details. * * You should have received a copy of the Server Side Public License * along with this program. If not, see * <http://www.mongodb.com/licensing/server-side-public-license>. * * As a special exception, the copyright holders give permission to link the * code of portions of this program with the OpenSSL library under certain * conditions as described in each individual source file and distribute * linked combinations including the program with the OpenSSL library. You * must comply with the Server Side Public License in all respects for * all of the code used other than as permitted herein. If you modify file(s) * with this exception, you may extend this exception to your version of the * file(s), but you are not obligated to do so. If you do not wish to do so, * delete this exception statement from your version. If you delete this * exception statement from all source files in the program, then also delete * it in the license file. */ #include "mongo/db/mongod_options.h" #include <boost/filesystem.hpp> #include <iostream> #include <string> #include <vector> #include "mongo/base/init.h" #include "mongo/base/status.h" #include "mongo/bson/json.h" #include "mongo/bson/util/builder.h" #include "mongo/config.h" #include "mongo/db/auth/cluster_auth_mode.h" #include "mongo/db/cluster_auth_mode_option_gen.h" #include "mongo/db/global_settings.h" #include "mongo/db/keyfile_option_gen.h" #include "mongo/db/mongod_options_general_gen.h" #include "mongo/db/mongod_options_legacy_gen.h" #include "mongo/db/mongod_options_replication_gen.h" #include "mongo/db/mongod_options_sharding_gen.h" #include "mongo/db/mongod_options_storage_gen.h" #include "mongo/db/repl/repl_settings.h" #include "mongo/db/server_options.h" #include "mongo/db/server_options_base.h" #include "mongo/db/server_options_nongeneral_gen.h" #include "mongo/db/server_options_server_helpers.h" #include "mongo/db/storage/storage_parameters_gen.h" #include "mongo/logv2/log.h" #include "mongo/logv2/log_domain_global.h" #include "mongo/logv2/log_manager.h" #include "mongo/util/net/ssl_options.h" #include "mongo/util/options_parser/startup_options.h" #include "mongo/util/str.h" #include "mongo/util/version.h" #define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kControl namespace mongo { using std::endl; std::string storageDBPathDescription() { StringBuilder sb; sb << "Directory for datafiles - defaults to " << storageGlobalParams.kDefaultDbPath; #ifdef _WIN32 boost::filesystem::path currentPath = boost::filesystem::current_path(); sb << " which is " << currentPath.root_name().string() << storageGlobalParams.kDefaultDbPath << " based on the current working drive"; #endif return sb.str(); } Status addMongodOptions(moe::OptionSection* options) try { uassertStatusOK(addGeneralServerOptions(options)); uassertStatusOK(addNonGeneralServerOptions(options)); uassertStatusOK(addMongodGeneralOptions(options)); uassertStatusOK(addMongodReplicationOptions(options)); uassertStatusOK(addMongodShardingOptions(options)); uassertStatusOK(addMongodStorageOptions(options)); uassertStatusOK(addMongodLegacyOptions(options)); uassertStatusOK(addKeyfileServerOption(options)); uassertStatusOK(addClusterAuthModeServerOption(options)); return Status::OK(); } catch (const AssertionException& ex) { return ex.toStatus(); } void printMongodHelp(const moe::OptionSection& options) { std::cout << options.helpString() << std::endl; }; namespace { void appendSysInfo(BSONObjBuilder* obj) { auto o = BSONObjBuilder(obj->subobjStart("sysinfo")); #if defined(_SC_PAGE_SIZE) o.append("_SC_PAGE_SIZE", (long long)sysconf(_SC_PAGE_SIZE)); #endif #if defined(_SC_PHYS_PAGES) o.append("_SC_PHYS_PAGES", (long long)sysconf(_SC_PHYS_PAGES)); #endif #if defined(_SC_AVPHYS_PAGES) o.append("_SC_AVPHYS_PAGES", (long long)sysconf(_SC_AVPHYS_PAGES)); #endif } } // namespace bool handlePreValidationMongodOptions(const moe::Environment& params, const std::vector<std::string>& args) { if (params.count("help") && params["help"].as<bool>() == true) { printMongodHelp(moe::startupOptions); return false; } if (params.count("version") && params["version"].as<bool>() == true) { auto&& vii = VersionInfoInterface::instance(); std::cout << mongodVersion(vii) << std::endl; vii.logBuildInfo(&std::cout); return false; } if (params.count("sysinfo") && params["sysinfo"].as<bool>() == true) { BSONObjBuilder obj; appendSysInfo(&obj); std::cout << tojson(obj.done(), ExtendedRelaxedV2_0_0, true) << std::endl; return false; } if (params.count("master") || params.count("slave")) { LOGV2_FATAL_CONTINUE(20881, "Master/slave replication is no longer supported"); return false; } if (params.count("replication.enableMajorityReadConcern") && params["replication.enableMajorityReadConcern"].as<bool>() == false) { LOGV2_FATAL_CONTINUE(5324700, "enableMajorityReadConcern:false is no longer supported"); return false; } return true; } Status validateMongodOptions(const moe::Environment& params) { Status ret = validateServerOptions(params); if (!ret.isOK()) { return ret; } if (params.count("nojournal") && params.count("storage.journal.enabled")) { return Status(ErrorCodes::BadValue, "Can't specify both --journal and --nojournal options."); } #ifdef _WIN32 if (params.count("install") || params.count("reinstall")) { if (params.count("storage.dbPath") && !boost::filesystem::path(params["storage.dbPath"].as<std::string>()).is_absolute()) { return Status(ErrorCodes::BadValue, "dbPath requires an absolute file path with Windows services"); } } #endif if (params.count("storage.queryableBackupMode")) { // Command line options that are disallowed when --queryableBackupMode is specified. for (const auto& disallowedOption : {"replication.replSet", "configsvr", "upgrade", "repair", "profile", "restore"}) { if (params.count(disallowedOption)) { return Status(ErrorCodes::BadValue, str::stream() << "Cannot specify both queryable backup mode and " << disallowedOption); } } bool isClusterRoleShard = params.count("shardsvr"); if (params.count("sharding.clusterRole")) { auto clusterRole = params["sharding.clusterRole"].as<std::string>(); isClusterRoleShard = isClusterRoleShard || (clusterRole == "shardsvr"); } if (isClusterRoleShard && !params.count("sharding._overrideShardIdentity")) { return Status( ErrorCodes::BadValue, "shardsvr cluster role with queryableBackupMode requires _overrideShardIdentity"); } } return Status::OK(); } Status canonicalizeMongodOptions(moe::Environment* params) { Status ret = canonicalizeServerOptions(params); if (!ret.isOK()) { return ret; } if (params->count("nojournal")) { Status ret = params->set("storage.journal.enabled", moe::Value(!(*params)["nojournal"].as<bool>())); if (!ret.isOK()) { return ret; } ret = params->remove("nojournal"); if (!ret.isOK()) { return ret; } } // "security.authorization" comes from the config file, so override it if "auth" is // set since those come from the command line. if (params->count("auth")) { Status ret = params->set("security.authorization", (*params)["auth"].as<bool>() ? moe::Value(std::string("enabled")) : moe::Value(std::string("disabled"))); if (!ret.isOK()) { return ret; } ret = params->remove("auth"); if (!ret.isOK()) { return ret; } } // "sharding.archiveMovedChunks" comes from the config file, so override it if // "noMoveParanoia" or "moveParanoia" are set since those come from the command line. if (params->count("noMoveParanoia")) { Status ret = params->set("sharding.archiveMovedChunks", moe::Value(!(*params)["noMoveParanoia"].as<bool>())); if (!ret.isOK()) { return ret; } ret = params->remove("noMoveParanoia"); if (!ret.isOK()) { return ret; } } if (params->count("moveParanoia")) { Status ret = params->set("sharding.archiveMovedChunks", moe::Value((*params)["moveParanoia"].as<bool>())); if (!ret.isOK()) { return ret; } ret = params->remove("moveParanoia"); if (!ret.isOK()) { return ret; } } // "sharding.clusterRole" comes from the config file, so override it if "configsvr" or // "shardsvr" are set since those come from the command line. if (params->count("configsvr")) { if ((*params)["configsvr"].as<bool>() == false) { // Handle the case where "configsvr" comes from the legacy config file and is set to // false. This option is not allowed in the YAML config. return Status(ErrorCodes::BadValue, "configsvr option cannot be set to false in config file"); } Status ret = params->set("sharding.clusterRole", moe::Value(std::string("configsvr"))); if (!ret.isOK()) { return ret; } ret = params->remove("configsvr"); if (!ret.isOK()) { return ret; } } if (params->count("shardsvr")) { if ((*params)["shardsvr"].as<bool>() == false) { // Handle the case where "shardsvr" comes from the legacy config file and is set to // false. This option is not allowed in the YAML config. return Status(ErrorCodes::BadValue, "shardsvr option cannot be set to false in config file"); } Status ret = params->set("sharding.clusterRole", moe::Value(std::string("shardsvr"))); if (!ret.isOK()) { return ret; } ret = params->remove("shardsvr"); if (!ret.isOK()) { return ret; } } if (params->count("profile")) { int profilingMode; Status ret = params->get("profile", &profilingMode); if (!ret.isOK()) { return ret; } std::string profilingModeString; if (profilingMode == 0) { profilingModeString = "off"; } else if (profilingMode == 1) { profilingModeString = "slowOp"; } else if (profilingMode == 2) { profilingModeString = "all"; } else { StringBuilder sb; sb << "Bad value for profile: " << profilingMode << ". Supported modes are: (0=off|1=slowOp|2=all)"; return Status(ErrorCodes::BadValue, sb.str()); } ret = params->set("operationProfiling.mode", moe::Value(profilingModeString)); if (!ret.isOK()) { return ret; } ret = params->remove("profile"); if (!ret.isOK()) { return ret; } } // Ensure that "replication.replSet" logically overrides "replication.replSetName". We // can't canonicalize them as the same option, because they mean slightly different things. // "replication.replSet" can include a seed list, while "replication.replSetName" just has // the replica set name. if (params->count("replication.replSet") && params->count("replication.replSetName")) { ret = params->remove("replication.replSetName"); if (!ret.isOK()) { return ret; } } // "security.javascriptEnabled" comes from the config file, so override it if "noscripting" // is set since that comes from the command line. if (params->count("noscripting")) { Status ret = params->set("security.javascriptEnabled", moe::Value(!(*params)["noscripting"].as<bool>())); if (!ret.isOK()) { return ret; } ret = params->remove("noscripting"); if (!ret.isOK()) { return ret; } } return Status::OK(); } Status storeMongodOptions(const moe::Environment& params) { Status ret = storeServerOptions(params); if (!ret.isOK()) { return ret; } // TODO: Integrate these options with their setParameter counterparts if (params.count("security.authSchemaVersion")) { return Status(ErrorCodes::BadValue, "security.authSchemaVersion is currently not supported in config files"); } if (params.count("security.enableLocalhostAuthBypass")) { return Status(ErrorCodes::BadValue, "security.enableLocalhostAuthBypass is currently not supported in config " "files"); } if (params.count("storage.engine")) { storageGlobalParams.engine = params["storage.engine"].as<std::string>(); storageGlobalParams.engineSetByUser = true; } if (params.count("storage.dbPath")) { storageGlobalParams.dbpath = params["storage.dbPath"].as<std::string>(); if (params.count("processManagement.fork") && storageGlobalParams.dbpath[0] != '/') { // we need to change dbpath if we fork since we change // cwd to "/" // fork only exists on *nix // so '/' is safe storageGlobalParams.dbpath = serverGlobalParams.cwd + "/" + storageGlobalParams.dbpath; } } #ifdef _WIN32 if (storageGlobalParams.dbpath.size() > 1 && storageGlobalParams.dbpath[storageGlobalParams.dbpath.size() - 1] == '/') { // size() check is for the unlikely possibility of --dbpath "/" storageGlobalParams.dbpath = storageGlobalParams.dbpath.erase(storageGlobalParams.dbpath.size() - 1); } StringData dbpath(storageGlobalParams.dbpath); if (dbpath.size() >= 2 && dbpath.startsWith("\\\\")) { // Check if the dbpath is on a Windows network share (eg. \\myserver\myshare) LOGV2_WARNING_OPTIONS(5808500, {logv2::LogTag::kStartupWarnings}, "dbpath should not be used on a network share"); } #endif if (params.count("operationProfiling.mode")) { std::string profilingMode = params["operationProfiling.mode"].as<std::string>(); if (profilingMode == "off") { serverGlobalParams.defaultProfile = 0; } else if (profilingMode == "slowOp") { serverGlobalParams.defaultProfile = 1; } else if (profilingMode == "all") { serverGlobalParams.defaultProfile = 2; } else { StringBuilder sb; sb << "Bad value for operationProfiling.mode: " << profilingMode << ". Supported modes are: (off|slowOp|all)"; return Status(ErrorCodes::BadValue, sb.str()); } } if (params.count("storage.syncPeriodSecs")) { storageGlobalParams.syncdelay = params["storage.syncPeriodSecs"].as<double>(); storageGlobalParams.checkpointDelaySecs = static_cast<size_t>(params["storage.syncPeriodSecs"].as<double>()); if (storageGlobalParams.syncdelay < 0 || storageGlobalParams.syncdelay > StorageGlobalParams::kMaxSyncdelaySecs) { return Status(ErrorCodes::BadValue, str::stream() << "syncdelay out of allowed range (0-" << StorageGlobalParams::kMaxSyncdelaySecs << "s)"); } } if (params.count("storage.directoryPerDB")) { storageGlobalParams.directoryperdb = params["storage.directoryPerDB"].as<bool>(); } if (params.count("storage.queryableBackupMode") && params["storage.queryableBackupMode"].as<bool>()) { storageGlobalParams.queryableBackupMode = true; } if (params.count("storage.groupCollections")) { storageGlobalParams.groupCollections = params["storage.groupCollections"].as<bool>(); } if (params.count("storage.journal.enabled")) { storageGlobalParams.dur = params["storage.journal.enabled"].as<bool>(); } if (params.count("storage.journal.commitIntervalMs")) { // don't check if dur is false here as many will just use the default, and will default // to off on win32. ie no point making life a little more complex by giving an error on // a dev environment. auto journalCommitIntervalMs = params["storage.journal.commitIntervalMs"].as<int>(); storageGlobalParams.journalCommitIntervalMs.store(journalCommitIntervalMs); if (journalCommitIntervalMs < 1 || journalCommitIntervalMs > StorageGlobalParams::kMaxJournalCommitIntervalMs) { return Status(ErrorCodes::BadValue, str::stream() << "--journalCommitInterval out of allowed range (1-" << StorageGlobalParams::kMaxJournalCommitIntervalMs << "ms)"); } } if (params.count("security.javascriptEnabled")) { mongodGlobalParams.scriptingEnabled = params["security.javascriptEnabled"].as<bool>(); } if (params.count("security.clusterIpSourceAllowlist")) { auto allowlistedClusterNetwork = std::make_shared<std::vector<std::string>>(); for (const std::string& allowlistEntry : params["security.clusterIpSourceAllowlist"].as<std::vector<std::string>>()) { std::vector<std::string> intermediates; str::splitStringDelim(allowlistEntry, &intermediates, ','); std::copy(intermediates.begin(), intermediates.end(), std::back_inserter(*allowlistedClusterNetwork)); } mongodGlobalParams.allowlistedClusterNetwork = allowlistedClusterNetwork; } if (params.count("repair") && params["repair"].as<bool>() == true) { storageGlobalParams.upgrade = 1; // --repair implies --upgrade storageGlobalParams.repair = 1; } if (params.count("upgrade") && params["upgrade"].as<bool>() == true) { storageGlobalParams.upgrade = 1; } if (params.count("notablescan")) { storageGlobalParams.noTableScan.store(params["notablescan"].as<bool>()); } if (params.count("restore") && params["restore"].as<bool>() == true) { storageGlobalParams.restore = 1; if (storageGlobalParams.repair) { return Status(ErrorCodes::BadValue, str::stream() << "Cannot specify both --repair and --restore"); } } repl::ReplSettings replSettings; if (params.count("replication.serverless")) { if (params.count("replication.replSet") || params.count("replication.replSetName")) { return Status(ErrorCodes::BadValue, "serverless cannot be used with replSet or replSetName options"); } // Starting a node in "serverless" mode implies it uses a replSet. replSettings.setServerlessMode(); } if (params.count("replication.replSet")) { /* seed list of hosts for the repl set */ replSettings.setReplSetString(params["replication.replSet"].as<std::string>().c_str()); } else if (params.count("replication.replSetName")) { // "replSetName" is previously removed if "replSet" and "replSetName" are both found to be // set by the user. Therefore, we only need to check for it if "replSet" in not found. replSettings.setReplSetString(params["replication.replSetName"].as<std::string>().c_str()); } else { // If neither "replication.replSet" nor "replication.replSetName" is set, then we are in // standalone mode. // // A standalone node does not use the oplog collection, so special truncation handling for // the capped collection is unnecessary. // // A standalone node that will be reintroduced to its replica set must not allow oplog // truncation while in standalone mode because oplog history needed for startup recovery as // a replica set member could be deleted. Replication can need history older than the last // checkpoint to support transactions. // // Note: we only use this to defer oplog collection truncation via OplogStones in WT. Non-WT // storage engines will continue to perform regular capped collection handling for the oplog // collection, regardless of this parameter setting. storageGlobalParams.allowOplogTruncation = false; } if (replSettings.usingReplSets() && (params.count("security.authorization") && params["security.authorization"].as<std::string>() == "enabled") && !serverGlobalParams.startupClusterAuthMode.x509Only() && serverGlobalParams.keyFile.empty()) { return Status( ErrorCodes::BadValue, str::stream() << "security.keyFile is required when authorization is enabled with replica sets"); } serverGlobalParams.enableMajorityReadConcern = true; if (storageGlobalParams.engineSetByUser && (storageGlobalParams.engine == "devnull")) { LOGV2(5324701, "Test storage engine does not support enableMajorityReadConcern=true, forcibly " "setting to false", "storageEngine"_attr = storageGlobalParams.engine); serverGlobalParams.enableMajorityReadConcern = false; } if (!serverGlobalParams.enableMajorityReadConcern) { // Lock-free reads is not supported with enableMajorityReadConcern=false, so we disable it. if (!storageGlobalParams.disableLockFreeReads) { LOGV2_WARNING(4788401, "Lock-free reads is not compatible with " "enableMajorityReadConcern=false: disabling lock-free reads."); storageGlobalParams.disableLockFreeReads = true; } } if (params.count("replication.oplogSizeMB")) { long long x = params["replication.oplogSizeMB"].as<int>(); if (x <= 0) { return Status(ErrorCodes::BadValue, str::stream() << "bad --oplogSize, arg must be greater than 0," "found: " << x); } // note a small size such as x==1 is ok for an arbiter. if (x > 1000 && sizeof(void*) == 4) { StringBuilder sb; sb << "--oplogSize of " << x << "MB is too big for 32 bit version. Use 64 bit build instead."; return Status(ErrorCodes::BadValue, sb.str()); } replSettings.setOplogSizeBytes(x * 1024 * 1024); invariant(replSettings.getOplogSizeBytes() > 0); } if (params.count("storage.oplogMinRetentionHours")) { storageGlobalParams.oplogMinRetentionHours.store( params["storage.oplogMinRetentionHours"].as<double>()); if (storageGlobalParams.oplogMinRetentionHours.load() < 0) { return Status(ErrorCodes::BadValue, "bad --oplogMinRetentionHours, argument must be greater or equal to 0"); } invariant(storageGlobalParams.oplogMinRetentionHours.load() >= 0); } if (params.count("cacheSize")) { long x = params["cacheSize"].as<long>(); if (x <= 0) { return Status(ErrorCodes::BadValue, "bad --cacheSize arg"); } return Status(ErrorCodes::BadValue, "--cacheSize option not currently supported"); } if (!params.count("net.port")) { if (params.count("sharding.clusterRole")) { std::string clusterRole = params["sharding.clusterRole"].as<std::string>(); if (clusterRole == "configsvr") { serverGlobalParams.port = ServerGlobalParams::ConfigServerPort; } else if (clusterRole == "shardsvr") { serverGlobalParams.port = ServerGlobalParams::ShardServerPort; } else { StringBuilder sb; sb << "Bad value for sharding.clusterRole: " << clusterRole << ". Supported modes are: (configsvr|shardsvr)"; return Status(ErrorCodes::BadValue, sb.str()); } } } else { if (serverGlobalParams.port < 0 || serverGlobalParams.port > 65535) { return Status(ErrorCodes::BadValue, "bad --port number"); } } if (params.count("sharding.clusterRole")) { auto clusterRoleParam = params["sharding.clusterRole"].as<std::string>(); const bool replicationEnabled = params.count("replication.replSet") || params.count("replication.replSetName") || params.count("replication.serverless"); // Force to set up the node as a replica set, unless we're a shard and we're using queryable // backup mode. if ((clusterRoleParam == "configsvr" || !params.count("storage.queryableBackupMode")) && !replicationEnabled) { return Status(ErrorCodes::BadValue, str::stream() << "Cannot start a " << clusterRoleParam << " as a standalone server. Please use the option " "--replSet to start the node as a replica set."); } if (clusterRoleParam == "configsvr") { serverGlobalParams.clusterRole = ClusterRole::ConfigServer; // Config server requires majority read concern. uassert(5324702, str::stream() << "Cannot initialize config server with " << "enableMajorityReadConcern=false", serverGlobalParams.enableMajorityReadConcern); // If we haven't explicitly specified a journal option, default journaling to true for // the config server role if (!params.count("storage.journal.enabled")) { storageGlobalParams.dur = true; } if (!params.count("storage.dbPath")) { storageGlobalParams.dbpath = storageGlobalParams.kDefaultConfigDbPath; } } else if (clusterRoleParam == "shardsvr") { serverGlobalParams.clusterRole = ClusterRole::ShardServer; } } if (params.count("sharding.archiveMovedChunks")) { serverGlobalParams.moveParanoia = params["sharding.archiveMovedChunks"].as<bool>(); } if (params.count("sharding._overrideShardIdentity")) { auto docAsString = params["sharding._overrideShardIdentity"].as<std::string>(); try { serverGlobalParams.overrideShardIdentity = fromjson(docAsString); } catch (const DBException& exception) { return exception.toStatus( "Error encountered while parsing _overrideShardIdentity JSON document"); } } if (params.count("pairwith") || params.count("arbiter") || params.count("opIdMem")) { return Status(ErrorCodes::BadValue, "****\n" "Replica Pairs have been deprecated. Invalid options: " "--pairwith, --arbiter, and/or --opIdMem\n" "<http://dochub.mongodb.org/core/replicapairs>\n" "****"); } #ifdef _WIN32 // If dbPath is a default value, prepend with drive name so log entries are explicit // We must resolve the dbpath before it stored in repairPath in the default case. if (storageGlobalParams.dbpath == storageGlobalParams.kDefaultDbPath || storageGlobalParams.dbpath == storageGlobalParams.kDefaultConfigDbPath) { boost::filesystem::path currentPath = boost::filesystem::current_path(); storageGlobalParams.dbpath = currentPath.root_name().string() + storageGlobalParams.dbpath; } #endif // Check if we are 32 bit and have not explicitly specified any journaling options if (sizeof(void*) == 4 && !params.count("storage.journal.enabled")) { LOGV2_WARNING(20880, "32-bit servers don't have journaling enabled by default. Please use " "--journal if you want durability"); } bool isClusterRoleShard = params.count("shardsvr"); bool isClusterRoleConfig = params.count("configsvr"); if (params.count("sharding.clusterRole")) { auto clusterRole = params["sharding.clusterRole"].as<std::string>(); isClusterRoleShard = isClusterRoleShard || (clusterRole == "shardsvr"); isClusterRoleConfig = isClusterRoleConfig || (clusterRole == "configsvr"); } if ((isClusterRoleShard || isClusterRoleConfig) && skipShardingConfigurationChecks) { auto clusterRoleStr = isClusterRoleConfig ? "--configsvr" : "--shardsvr"; return Status(ErrorCodes::BadValue, str::stream() << "Can not specify " << clusterRoleStr << " and set skipShardingConfigurationChecks=true"); } if ((isClusterRoleShard || isClusterRoleConfig) && params.count("setParameter")) { std::map<std::string, std::string> parameters = params["setParameter"].as<std::map<std::string, std::string>>(); const bool requireApiVersionValue = ([&parameters] { const auto requireApiVersionParam = parameters.find("requireApiVersion"); if (requireApiVersionParam == parameters.end()) { return false; } const auto& val = requireApiVersionParam->second; return (0 == val.compare("1")) || (0 == val.compare("true")); })(); if (requireApiVersionValue) { auto clusterRoleStr = isClusterRoleConfig ? "--configsvr" : "--shardsvr"; return Status(ErrorCodes::BadValue, str::stream() << "Can not specify " << clusterRoleStr << " and set requireApiVersion=true"); } } setGlobalReplSettings(replSettings); return Status::OK(); } } // namespace mongo
42.130904
100
0.614434
benety
480c577f2bc6940629b26193af2f1b98eb1ec2fa
10,452
cxx
C++
cmake-2.8.10.1/Source/cmGlobalVisualStudio10Generator.cxx
vidkidz/crossbridge
ba0bf94aee0ce6cf7eb5be882382e52bc57ba396
[ "MIT" ]
1
2016-04-09T02:58:13.000Z
2016-04-09T02:58:13.000Z
cmake-2.8.10.1/Source/cmGlobalVisualStudio10Generator.cxx
vidkidz/crossbridge
ba0bf94aee0ce6cf7eb5be882382e52bc57ba396
[ "MIT" ]
null
null
null
cmake-2.8.10.1/Source/cmGlobalVisualStudio10Generator.cxx
vidkidz/crossbridge
ba0bf94aee0ce6cf7eb5be882382e52bc57ba396
[ "MIT" ]
null
null
null
/*============================================================================ CMake - Cross Platform Makefile Generator Copyright 2000-2009 Kitware, Inc., Insight Software Consortium Distributed under the OSI-approved BSD License (the "License"); see accompanying file Copyright.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License for more information. ============================================================================*/ #include "windows.h" // this must be first to define GetCurrentDirectory #include "cmGlobalVisualStudio10Generator.h" #include "cmLocalVisualStudio10Generator.h" #include "cmMakefile.h" #include "cmSourceFile.h" #include "cmake.h" cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() { this->FindMakeProgramFile = "CMakeVS10FindMake.cmake"; std::string vc10Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\10.0\\Setup\\VC;" "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); } //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) { cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); if(!this->PlatformToolset.empty()) { mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", this->PlatformToolset.c_str()); } } //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) { fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; fout << "# Visual Studio 2010\n"; } ///! Create a local generator appropriate to this Global Generator cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() { cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator(cmLocalVisualStudioGenerator::VS10); lg->SetPlatformName(this->GetPlatformName()); lg->SetGlobalGenerator(this); return lg; } //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::Generate() { this->LongestSource = LongestSourcePath(); this->cmGlobalVisualStudio8Generator::Generate(); if(this->LongestSource.Length > 0) { cmMakefile* mf = this->LongestSource.Target->GetMakefile(); cmOStringStream e; e << "The binary and/or source directory paths may be too long to generate " "Visual Studio 10 files for this project. " "Consider choosing shorter directory names to build this project with " "Visual Studio 10. " "A more detailed explanation follows." "\n" "There is a bug in the VS 10 IDE that renders property dialog fields " "blank for files referenced by full path in the project file. " "However, CMake must reference at least one file by full path:\n" " " << this->LongestSource.SourceFile->GetFullPath() << "\n" "This is because some Visual Studio tools would append the relative " "path to the end of the referencing directory path, as in:\n" " " << mf->GetCurrentOutputDirectory() << "/" << this->LongestSource.SourceRel << "\n" "and then incorrectly complain that the file does not exist because " "the path length is too long for some internal buffer or API. " "To avoid this problem CMake must use a full path for this file " "which then triggers the VS 10 property dialog bug."; mf->IssueMessage(cmake::WARNING, e.str().c_str()); } } //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator ::GetDocumentation(cmDocumentationEntry& entry) const { entry.Name = this->GetName(); entry.Brief = "Generates Visual Studio 10 project files."; entry.Full = ""; } //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator ::EnableLanguage(std::vector<std::string>const & lang, cmMakefile *mf, bool optional) { cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional); } //---------------------------------------------------------------------------- const char* cmGlobalVisualStudio10Generator::GetPlatformToolset() { if(!this->PlatformToolset.empty()) { return this->PlatformToolset.c_str(); } return 0; } //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio10Generator::GetUserMacrosDirectory() { std::string base; std::string path; // base begins with the VisualStudioProjectsLocation reg value... if (cmSystemTools::ReadRegistryValue( "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\10.0;" "VisualStudioProjectsLocation", base)) { cmSystemTools::ConvertToUnixSlashes(base); // 9.0 macros folder: path = base + "/VSMacros80"; // *NOT* a typo; right now in Visual Studio 2008 beta the macros // folder is VSMacros80... They may change it to 90 before final // release of 2008 or they may not... we'll have to keep our eyes // on it } // path is (correctly) still empty if we did not read the base value from // the Registry value return path; } //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio10Generator::GetUserMacrosRegKeyBase() { return "Software\\Microsoft\\VisualStudio\\10.0\\vsmacros"; } std::string cmGlobalVisualStudio10Generator ::GenerateBuildCommand(const char* makeProgram, const char *projectName, const char* additionalOptions, const char *targetName, const char* config, bool ignoreErrors, bool fast) { // now build the test std::string makeCommand = cmSystemTools::ConvertToOutputPath(makeProgram); std::string lowerCaseCommand = makeCommand; cmSystemTools::LowerCase(lowerCaseCommand); // If makeProgram is devenv, parent class knows how to generate command: if (lowerCaseCommand.find("devenv") != std::string::npos || lowerCaseCommand.find("VCExpress") != std::string::npos) { return cmGlobalVisualStudio7Generator::GenerateBuildCommand(makeProgram, projectName, additionalOptions, targetName, config, ignoreErrors, fast); } // Otherwise, assume MSBuild command line, and construct accordingly. // if there are spaces in the makeCommand, assume a full path // and convert it to a path with no spaces in it as the // RunSingleCommand does not like spaces if(makeCommand.find(' ') != std::string::npos) { cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand); } // msbuild.exe CxxOnly.sln /t:Build /p:Configuration=Debug /target:ALL_BUILD if(!targetName || strlen(targetName) == 0) { targetName = "ALL_BUILD"; } bool clean = false; if ( targetName && strcmp(targetName, "clean") == 0 ) { clean = true; makeCommand += " "; makeCommand += projectName; makeCommand += ".sln "; makeCommand += "/t:Clean "; } else { makeCommand += " "; makeCommand += targetName; makeCommand += ".vcxproj "; } makeCommand += "/p:Configuration="; if(config && strlen(config)) { makeCommand += config; } else { makeCommand += "Debug"; } makeCommand += " /p:VisualStudioVersion="; makeCommand += this->GetIDEVersion(); if ( additionalOptions ) { makeCommand += " "; makeCommand += additionalOptions; } return makeCommand; } //---------------------------------------------------------------------------- bool cmGlobalVisualStudio10Generator::Find64BitTools(cmMakefile* mf) { if(!this->PlatformToolset.empty()) { return true; } // This edition does not come with 64-bit tools. Look for them. // // TODO: Detect available tools? x64\v100 exists but does not work? // KHLM\\SOFTWARE\\Microsoft\\MSBuild\\ToolsVersions\\4.0;VCTargetsPath // c:/Program Files (x86)/MSBuild/Microsoft.Cpp/v4.0/Platforms/ // {Itanium,Win32,x64}/PlatformToolsets/{v100,v90,Windows7.1SDK} std::string winSDK_7_1; if(cmSystemTools::ReadRegistryValue( "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\" "Windows\\v7.1;InstallationFolder", winSDK_7_1)) { cmOStringStream m; m << "Found Windows SDK v7.1: " << winSDK_7_1; mf->DisplayStatus(m.str().c_str(), -1); this->PlatformToolset = "Windows7.1SDK"; return true; } else { cmOStringStream e; e << "Cannot enable 64-bit tools with Visual Studio 2010 Express.\n" << "Install the Microsoft Windows SDK v7.1 to get 64-bit tools:\n" << " http://msdn.microsoft.com/en-us/windows/bb980924.aspx"; mf->IssueMessage(cmake::FATAL_ERROR, e.str().c_str()); cmSystemTools::SetFatalErrorOccured(); return false; } } //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio10Generator ::GenerateRuleFile(std::string const& output) const { // The VS 10 generator needs to create the .rule files on disk. // Hide them away under the CMakeFiles directory. std::string ruleDir = this->GetCMakeInstance()->GetHomeOutputDirectory(); ruleDir += cmake::GetCMakeFilesDirectory(); ruleDir += "/"; ruleDir += cmSystemTools::ComputeStringMD5( cmSystemTools::GetFilenamePath(output).c_str()); std::string ruleFile = ruleDir + "/"; ruleFile += cmSystemTools::GetFilenameName(output); ruleFile += ".rule"; return ruleFile; } //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::PathTooLong( cmTarget* target, cmSourceFile* sf, std::string const& sfRel) { size_t len = (strlen(target->GetMakefile()->GetCurrentOutputDirectory()) + 1 + sfRel.length()); if(len > this->LongestSource.Length) { this->LongestSource.Length = len; this->LongestSource.Target = target; this->LongestSource.SourceFile = sf; this->LongestSource.SourceRel = sfRel; } } //---------------------------------------------------------------------------- bool cmGlobalVisualStudio10Generator::UseFolderProperty() { return IsExpressEdition() ? false : cmGlobalGenerator::UseFolderProperty(); }
35.794521
78
0.626483
vidkidz
480e2169317faac8bddff0ca86cafdb8233d130c
1,746
cpp
C++
Dev/SourcesEngine/Gugu/Element/2D/ElementSFDrawable.cpp
Legulysse/gugu-engine
0014f85f27f378f4490918638fcc747367e82243
[ "Zlib" ]
15
2018-06-30T12:02:03.000Z
2022-02-16T00:23:45.000Z
Dev/SourcesEngine/Gugu/Element/2D/ElementSFDrawable.cpp
Legulysse/gugu-engine
0014f85f27f378f4490918638fcc747367e82243
[ "Zlib" ]
null
null
null
Dev/SourcesEngine/Gugu/Element/2D/ElementSFDrawable.cpp
Legulysse/gugu-engine
0014f85f27f378f4490918638fcc747367e82243
[ "Zlib" ]
1
2018-07-26T22:40:20.000Z
2018-07-26T22:40:20.000Z
//////////////////////////////////////////////////////////////// // Header #include "Gugu/Common.h" #include "Gugu/Element/2D/ElementSFDrawable.h" //////////////////////////////////////////////////////////////// // Includes #include "Gugu/Window/Renderer.h" #include "Gugu/System/SystemUtility.h" #include <SFML/Graphics/Drawable.hpp> #include <SFML/Graphics/RenderTarget.hpp> //////////////////////////////////////////////////////////////// // File Implementation namespace gugu { ElementSFDrawable::ElementSFDrawable() : m_sfDrawable(nullptr) , m_callbackOnSizeChanged(nullptr) { } ElementSFDrawable::~ElementSFDrawable() { SafeDelete(m_sfDrawable); } void ElementSFDrawable::SetSFDrawable(sf::Drawable* _pSFDrawable) { SafeDelete(m_sfDrawable); m_sfDrawable = _pSFDrawable; } sf::Drawable* ElementSFDrawable::GetSFDrawable() const { return m_sfDrawable; } void ElementSFDrawable::SetCallbackOnSizeChanged(DelegateElementSizeChanged callbackOnSizeChanged) { m_callbackOnSizeChanged = callbackOnSizeChanged; } void ElementSFDrawable::OnSizeChanged(Vector2f _kOldSize) { if (m_callbackOnSizeChanged) { m_callbackOnSizeChanged(this); } } void ElementSFDrawable::RenderImpl(RenderPass& _kRenderPass, const sf::Transform& _kTransformSelf) { if (m_sfDrawable) { _kRenderPass.target->draw(*m_sfDrawable, _kTransformSelf); //Stats if (_kRenderPass.frameInfos) { _kRenderPass.frameInfos->statDrawCalls += 1; // TODO: find away to retrieve triangles count. } _kRenderPass.statRenderedDrawables += 1; } } } // namespace gugu
23.28
99
0.607102
Legulysse
481058c0407f8b60a4e2ff8fa43946ed39285ac8
1,738
cc
C++
cpp/Score_permutation.cc
powernit/epicode
e81d4387d2ae442d21631dfc958690d424e1d84d
[ "MIT" ]
258
2016-07-18T03:28:15.000Z
2021-12-05T09:08:44.000Z
cpp/Score_permutation.cc
powernit/epicode
e81d4387d2ae442d21631dfc958690d424e1d84d
[ "MIT" ]
7
2016-08-13T22:12:29.000Z
2022-02-25T17:50:11.000Z
cpp/Score_permutation.cc
powernit/epicode
e81d4387d2ae442d21631dfc958690d424e1d84d
[ "MIT" ]
154
2016-07-18T06:29:24.000Z
2021-09-20T18:33:05.000Z
// Copyright (c) 2013 Elements of Programming Interviews. All rights reserved. #include <cassert> #include <iostream> #include <random> #include <vector> using std::cout; using std::default_random_engine; using std::endl; using std::random_device; using std::uniform_int_distribution; using std::vector; // @include int CountPermutations(int k, const vector<int>& score_ways) { vector<int> permutations(k + 1, 0); permutations[0] = 1; // One way to reach 0. for (int i = 0; i <= k; ++i) { for (int score : score_ways) { if (i >= score) { permutations[i] += permutations[i - score]; } } } return permutations[k]; } // @exclude void SimpleTest() { int k = 12; vector<int> score_ways = {2, 3, 7}; assert(18 == CountPermutations(k, score_ways)); } int main(int argc, char* argv[]) { SimpleTest(); default_random_engine gen((random_device())()); int k; vector<int> score_ways; if (argc == 1) { uniform_int_distribution<int> k_dis(0, 999); k = k_dis(gen); uniform_int_distribution<int> size_dis(1, 50); score_ways.resize(size_dis(gen)); for (int i = 0; i < score_ways.size(); ++i) { uniform_int_distribution<int> score_dis(1, 1000); score_ways[i] = score_dis(gen); } } else if (argc == 2) { k = atoi(argv[1]); uniform_int_distribution<int> size_dis(1, 50); score_ways.resize(size_dis(gen)); for (int i = 0; i < score_ways.size(); ++i) { uniform_int_distribution<int> score_dis(1, 1000); score_ways[i] = score_dis(gen); } } else { k = atoi(argv[1]); for (int i = 2; i < argc; ++i) { score_ways.emplace_back(atoi(argv[i])); } } cout << CountPermutations(k, score_ways) << endl; return 0; }
25.940299
78
0.628308
powernit
4810dc57efded153cc58025a7b7ead6e5999d4e8
3,826
cpp
C++
SDKs/CryCode/3.6.15/CryEngine/CryAction/VehicleSystem/VehicleDamageBehaviorAISignal.cpp
amrhead/FireNET
34d439aa0157b0c895b20b2b664fddf4f9b84af1
[ "BSD-2-Clause" ]
4
2017-12-18T20:10:16.000Z
2021-02-07T21:21:24.000Z
SDKs/CryCode/3.8.1/CryEngine/CryAction/VehicleSystem/VehicleDamageBehaviorAISignal.cpp
amrhead/FireNET
34d439aa0157b0c895b20b2b664fddf4f9b84af1
[ "BSD-2-Clause" ]
null
null
null
SDKs/CryCode/3.8.1/CryEngine/CryAction/VehicleSystem/VehicleDamageBehaviorAISignal.cpp
amrhead/FireNET
34d439aa0157b0c895b20b2b664fddf4f9b84af1
[ "BSD-2-Clause" ]
3
2019-03-11T21:36:15.000Z
2021-02-07T21:21:26.000Z
/************************************************************************* Crytek Source File. Copyright (C), Crytek Studios, 2001-2006. ------------------------------------------------------------------------- $Id$ $DateTime$ Description: Implements a damage behavior which send an AI signal ------------------------------------------------------------------------- History: - 23:11:2006: Created by Mathieu Pinard *************************************************************************/ #include "StdAfx.h" #include "IAgent.h" #include "IVehicleSystem.h" #include "VehicleDamageBehaviorAISignal.h" //------------------------------------------------------------------------ bool CVehicleDamageBehaviorAISignal::Init(IVehicle* pVehicle, const CVehicleParams& table) { m_pVehicle = pVehicle; CVehicleParams signalTable = table.findChild("AISignal"); if (!signalTable) return false; if (!signalTable.getAttr("signalId", m_signalId)) return false; m_signalText = signalTable.getAttr("signalText"); m_freeSignalText = signalTable.getAttr("freeSignalText"); m_freeSignalRadius = 15.0f; signalTable.getAttr("freeSignalRadius", m_freeSignalRadius); m_freeSignalRepeat = false; signalTable.getAttr("freeSignalRepeat",m_freeSignalRepeat); return true; } void CVehicleDamageBehaviorAISignal::Reset() { if (m_isActive) ActivateUpdate(false); } //------------------------------------------------------------------------ void CVehicleDamageBehaviorAISignal::ActivateUpdate(bool activate) { if (activate && !m_isActive) { m_timeCounter = 1.0f; m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_AlwaysUpdate); } else if (!activate && m_isActive) m_pVehicle->SetObjectUpdate(this, IVehicle::eVOU_NoUpdate); m_isActive = activate; } //------------------------------------------------------------------------ void CVehicleDamageBehaviorAISignal::OnDamageEvent(EVehicleDamageBehaviorEvent event, const SVehicleDamageBehaviorEventParams& behaviorParams) { if(event == eVDBE_VehicleDestroyed || event == eVDBE_MaxRatioExceeded) { ActivateUpdate(false); return; } if(event != eVDBE_Hit) return; IEntity* pEntity = m_pVehicle->GetEntity(); CRY_ASSERT(pEntity); IAISystem* pAISystem = gEnv->pAISystem; if(!pAISystem) return; if (!m_freeSignalText.empty() && pEntity) { Vec3 entityPosition = pEntity->GetPos(); IAISignalExtraData* pData = gEnv->pAISystem->CreateSignalExtraData(); pData->point = entityPosition; pAISystem->SendAnonymousSignal(m_signalId, m_freeSignalText.c_str(), entityPosition, m_freeSignalRadius, NULL, pData); if(m_freeSignalRepeat) ActivateUpdate(true); } if (!pEntity || !pEntity->HasAI()) return; IAISignalExtraData* pExtraData = pAISystem->CreateSignalExtraData(); CRY_ASSERT(pExtraData); if (pExtraData) pExtraData->iValue = behaviorParams.shooterId; pAISystem->SendSignal(SIGNALFILTER_SENDER, m_signalId, m_signalText.c_str(), pEntity->GetAI(), pExtraData); } void CVehicleDamageBehaviorAISignal::Update( const float deltaTime ) { if(m_pVehicle->IsDestroyed()) { ActivateUpdate(false); return; } m_timeCounter -= deltaTime; if(m_timeCounter < 0.0f) { IEntity* pEntity = m_pVehicle->GetEntity(); CRY_ASSERT(pEntity); IAISystem* pAISystem = gEnv->pAISystem; CRY_ASSERT(pAISystem); Vec3 entityPosition = pEntity->GetPos(); IAISignalExtraData* pData = gEnv->pAISystem->CreateSignalExtraData(); pData->point = entityPosition; pAISystem->SendAnonymousSignal(m_signalId, m_freeSignalText.c_str(), entityPosition, m_freeSignalRadius, NULL, pData); m_timeCounter = 1.0f; } } void CVehicleDamageBehaviorAISignal::GetMemoryUsage(ICrySizer * s) const { s->AddObject(this,sizeof(*this)); s->AddObject(m_signalText); } DEFINE_VEHICLEOBJECT(CVehicleDamageBehaviorAISignal);
26.943662
120
0.653424
amrhead
48125ad0a671cb50bf7bb151cdbd99db6bfeb1a6
3,835
cpp
C++
Advanced Algorithms and Complexity/Coping with NP-complete problems/maximise_weight.cpp
OssamaEls/Data-Structures-and-Algorithms
b6affc28a792f577010e666d565ec6cc7f0ecbfa
[ "MIT" ]
null
null
null
Advanced Algorithms and Complexity/Coping with NP-complete problems/maximise_weight.cpp
OssamaEls/Data-Structures-and-Algorithms
b6affc28a792f577010e666d565ec6cc7f0ecbfa
[ "MIT" ]
null
null
null
Advanced Algorithms and Complexity/Coping with NP-complete problems/maximise_weight.cpp
OssamaEls/Data-Structures-and-Algorithms
b6affc28a792f577010e666d565ec6cc7f0ecbfa
[ "MIT" ]
null
null
null
//Input Format.The first line contains an integer 𝑛 — the number of people in the company.The next line //contains 𝑛 numbers 𝑓𝑖 — the fun factors of each of the 𝑛 people in the company.Each of the next 𝑛−1 //lines describes the subordination structure.Everyone but for the CEO of the company has exactly one //direct boss.There are no cycles : nobody can be a boss of a boss of a ... of a boss of himself.So, the //subordination structure is a regular tree.Each of the 𝑛 − 1 lines contains two integers 𝑢 and 𝑣, and //you know that either 𝑢 is the boss of 𝑣 or vice versa(you don’t really need to know which one is the //boss, but you can invite only one of them or none of them). // //Constraints. 1 ≤ 𝑛 ≤ 100 000; 1 ≤ 𝑓𝑖 ≤ 1 000; 1 ≤ 𝑢, 𝑣 ≤ 𝑛; 𝑢 ̸ = 𝑣. // //Output Format.Output the maximum possible total fun factor of the party(the sum of fun factors of all // the invited people) #include <iostream> #include <vector> #include <sys/resource.h> struct Vertex { int weight; std::vector <int> children; }; typedef std::vector<Vertex> Graph; typedef std::vector<int> Sum; using std::vector; Graph ReadTree() { int vertices_count; std::cin >> vertices_count; Graph tree(vertices_count); for (int i = 0; i < vertices_count; ++i) std::cin >> tree[i].weight; for (int i = 1; i < vertices_count; ++i) { int from, to, weight; std::cin >> from >> to; tree[from - 1].children.push_back(to - 1); tree[to - 1].children.push_back(from - 1); } return tree; } void dfs(const Graph& graph, int vertex, int parent, vector<vector<int>>& actual_tree) { for (int child : graph[vertex].children) if (child != parent) { actual_tree[vertex].push_back(child); dfs(graph, child, vertex, actual_tree); } } int maximise_total_weight(const Graph& graph, const vector<vector<int>>& tree, vector<int>& max_weights, int vertex) { if (max_weights[vertex] == 0) { if (tree[vertex].empty()) { max_weights[vertex] = graph[vertex].weight; } else { int m1 = graph[vertex].weight; for (int child : tree[vertex]) { for (int great_child : tree[child]) { m1 = m1 + maximise_total_weight(graph, tree, max_weights, great_child); } } int m0 = 0; for (int child : tree[vertex]) { m0 = m0 + maximise_total_weight(graph, tree, max_weights, child); } max_weights[vertex] = m0 < m1 ? m1 : m0; } } return max_weights[vertex]; } int MaxWeightIndependentTreeSubset(const Graph& graph) { size_t size = graph.size(); if (size == 0) return 0; vector<vector<int>> tree(size); dfs(graph, 0, -1, tree); vector<int> max_weights(size, 0); return maximise_total_weight(graph, tree, max_weights, 0); } int main_with_large_stack_space() { Graph tree = ReadTree(); int weight = MaxWeightIndependentTreeSubset(tree); std::cout << weight << std::endl; return 0; } int main(int argc, char** argv) { // This code is here to increase the stack size to avoid stack overflow // in depth-first search. const rlim_t kStackSize = 64L * 1024L * 1024L; // min stack size = 64 Mb struct rlimit rl; int result; result = getrlimit(RLIMIT_STACK, &rl); if (result == 0) { if (rl.rlim_cur < kStackSize) { rl.rlim_cur = kStackSize; result = setrlimit(RLIMIT_STACK, &rl); if (result != 0) { fprintf(stderr, "setrlimit returned result = %d\n", result); } } } return main_with_large_stack_space(); }
29.5
116
0.59661
OssamaEls
4815fcc9841fd2f3e523841e8749cd62ecf0fd64
4,359
cpp
C++
tests/src/nearest_neighbors/visible_proximity_tests.cpp
falcowinkler/flockingbird
eed3e7cead4a37635625d1055fb0a830e6152d1b
[ "MIT" ]
2
2021-05-30T19:19:50.000Z
2021-08-29T05:58:21.000Z
tests/src/nearest_neighbors/visible_proximity_tests.cpp
falcowinkler/flockingbird
eed3e7cead4a37635625d1055fb0a830e6152d1b
[ "MIT" ]
null
null
null
tests/src/nearest_neighbors/visible_proximity_tests.cpp
falcowinkler/flockingbird
eed3e7cead4a37635625d1055fb0a830e6152d1b
[ "MIT" ]
1
2021-12-01T07:00:49.000Z
2021-12-01T07:00:49.000Z
#include "nearest_neighbors/nanoflann.hpp" #include "nearest_neighbors/visible_proximity.hpp" #include "utility/random_numbers.hpp" #include "gtest/gtest.h" #include <cmath> #include <cstdlib> #include <vector> using namespace nanoflann; using namespace flockingbird; class VisibleProximityTest : public ::testing::Test { public: protected: VisibleProximityTest() : flock(Flock(0, 10, 10)) { Vector2D dummyDirection = Vector2D(1.0, 1.0); Boid boid1 = Boid(Vector2D(1.01, 2.12), dummyDirection); Boid boid2 = Boid(Vector2D(1.5, 2.5), dummyDirection); Boid boid3 = Boid(Vector2D(5, 4), dummyDirection); Boid boid4 = Boid(Vector2D(5.01, 3.99), dummyDirection); flock.boids.push_back(boid1); flock.boids.push_back(boid2); flock.boids.push_back(boid3); flock.boids.push_back(boid4); }; Flock flock; virtual void TearDown(){}; }; TEST_F(VisibleProximityTest, FindNearestNeighborsInCloseProximity) { VisibleProximity visibleProximity(flock); const float visionRange = 1; std::vector<Boid> visibleBoids = visibleProximity.of(/*boid at index*/ 0, visionRange); EXPECT_EQ(visibleBoids.size(), 1); Boid firstBoid = visibleBoids.front(); EXPECT_EQ(firstBoid.position.x, 1.5); EXPECT_EQ(firstBoid.position.y, 2.5); } TEST_F(VisibleProximityTest, FindsPointsOnEdgeOfSearchRadius) { VisibleProximity visibleProximity(flock); const float visionRange = 0.3845 + 1E-5; // ((1.5 - 1.01) ^ 2 + (2.5-2.12) ^ 2 == 0.3845) std::vector<Boid> visibleBoids = visibleProximity.of(/*boid at index*/ 0, visionRange); EXPECT_EQ(visibleBoids.size(), 1); Boid firstBoid = visibleBoids.front(); EXPECT_EQ(firstBoid.position.x, 1.5); EXPECT_EQ(firstBoid.position.y, 2.5); } TEST_F(VisibleProximityTest, ExcludesPointsOnEdgeOfSearchRadius) { VisibleProximity visibleProximity(flock); const float visionRange = 0.3844; // ((1.5 - 1.01) ^ 2 + (2.5-2.12) ^ 2 == 0.3845) std::vector<Boid> visibleBoids = visibleProximity.of(/*boid at index*/ 0, visionRange); EXPECT_EQ(visibleBoids.size(), 0); } TEST_F(VisibleProximityTest, MultipleCallsDontVaryTheResult) { VisibleProximity visibleProximity(flock); const float visionRange = 0.3844; // ((1.5 - 1.01) ^ 2 + (2.5-2.12) ^ 2 == 0.3845) visibleProximity.of(/*boid at index*/ 0, visionRange); visibleProximity.of(/*boid at index*/ 2, visionRange); visibleProximity.of(/*boid at index*/ 1, visionRange); std::vector<Boid> visibleBoids = visibleProximity.of(0, visionRange); EXPECT_EQ(visibleBoids.size(), 0); } TEST_F(VisibleProximityTest, FindTheWholeFlockWithASufficientVisionRange) { VisibleProximity visibleProximity(flock); const float visionRange = 50; std::vector<Boid> visibleBoids = visibleProximity.of(/*boid at index*/ 2, visionRange); EXPECT_EQ(visibleBoids.size(), flock.boids.size() - 1); } TEST_F(VisibleProximityTest, FindsNeigborWithVeryNarrowVision) { VisibleProximity visibleProximity(flock); const float visionRange = 0.2; std::vector<Boid> visibleBoids = visibleProximity.of(/*boid at index*/ 2, visionRange); EXPECT_EQ(visibleBoids.size(), 1); } /* * Random tests * */ inline float L2_Reference(Vector2D a, Vector2D b) { return pow(a.x - b.x, 2) + pow(a.y - b.y, 2); } TEST_F(VisibleProximityTest, RandomTests) { int N = 30; // if test runs in under 1 sec, we can reach this fps for (int testRun = 0; testRun < N; testRun++) { int numBoids = 500; std::vector<Boid> boids; for (int boid = 0; boid < numBoids; boid++) { boids.push_back( Boid(Vector2D(randomInBounds(0, 10), randomInBounds(0, 10)), Vector2D(0, 0))); } float visionRange = randomInBounds(0, 10); Flock flock = Flock(); flock.boids = boids; Flock refFlock(flock); VisibleProximity visibleProximity(flock); for (int i = 0; i < numBoids; i++) { std::vector<Boid> visibleBoids = visibleProximity.of(/*boid at index*/ i, visionRange); for (auto boidIt = visibleBoids.begin(); boidIt != visibleBoids.end(); boidIt++) { EXPECT_LE(L2_Reference(boidIt->position, refFlock.boids[i].position), visionRange); } } } }
36.325
99
0.666208
falcowinkler
4818223e907164f123db5669c2d9396977ef78db
3,431
cpp
C++
src/Library/Shaders/TransparencyShaderOp.cpp
aravindkrishnaswamy/rise
297d0339a7f7acd1418e322a30a21f44c7dbbb1d
[ "BSD-2-Clause" ]
1
2018-12-20T19:31:02.000Z
2018-12-20T19:31:02.000Z
src/Library/Shaders/TransparencyShaderOp.cpp
aravindkrishnaswamy/rise
297d0339a7f7acd1418e322a30a21f44c7dbbb1d
[ "BSD-2-Clause" ]
null
null
null
src/Library/Shaders/TransparencyShaderOp.cpp
aravindkrishnaswamy/rise
297d0339a7f7acd1418e322a30a21f44c7dbbb1d
[ "BSD-2-Clause" ]
null
null
null
////////////////////////////////////////////////////////////////////// // // TransparencyShaderOp.cpp - Implementation of the TransparencyShaderOp class // // Author: Aravind Krishnaswamy // Date of Birth: March 8, 2005 // Tabs: 4 // Comments: // // License Information: Please see the attached LICENSE.TXT file // ////////////////////////////////////////////////////////////////////// #include "pch.h" #include "TransparencyShaderOp.h" #include "../Utilities/GeometricUtilities.h" using namespace RISE; using namespace RISE::Implementation; TransparencyShaderOp::TransparencyShaderOp( const IPainter& transparency_, const bool bOneSided_ ) : transparency( transparency_ ), bOneSided( bOneSided_ ) { transparency.addref(); } TransparencyShaderOp::~TransparencyShaderOp( ) { transparency.release(); } //! Tells the shader to apply shade to the given intersection point void TransparencyShaderOp::PerformOperation( const RuntimeContext& rc, ///< [in] Runtime context const RayIntersection& ri, ///< [in] Intersection information const IRayCaster& caster, ///< [in] The Ray Caster to use for all ray casting needs const IRayCaster::RAY_STATE& rs, ///< [in] Current ray state RISEPel& c, ///< [in/out] Resultant color from op const IORStack* const ior_stack, ///< [in/out] Index of refraction stack const ScatteredRayContainer* pScat ///< [in] Scattering information ) const { // What we do is continue the ray through this intersection and composite with the value behind Ray ray = ri.geometric.ray; ray.Advance( ri.geometric.range+2e-8 ); RISEPel cthis; if( caster.CastRay( rc, ri.geometric.rast, ray, cthis, rs, 0, ri.pRadianceMap, ior_stack ) ) { // Blend by painter color // But if we one sided only and the ray is coming from behind, then don't if( bOneSided ) { if( Vector3Ops::Dot( ri.geometric.ray.dir, ri.geometric.vNormal ) > 0 ) { c = cthis; } } // Blend const RISEPel factor = transparency.GetColor(ri.geometric); c = cthis*factor + c*(1.0-factor); } } //! Tells the shader to apply shade to the given intersection point for the given wavelength /// \return Amplitude of spectral function Scalar TransparencyShaderOp::PerformOperationNM( const RuntimeContext& rc, ///< [in] Runtime context const RayIntersection& ri, ///< [in] Intersection information const IRayCaster& caster, ///< [in] The Ray Caster to use for all ray casting needs const IRayCaster::RAY_STATE& rs, ///< [in] Current ray state const Scalar caccum, ///< [in] Current value for wavelength const Scalar nm, ///< [in] Wavelength to shade const IORStack* const ior_stack, ///< [in/out] Index of refraction stack const ScatteredRayContainer* pScat ///< [in] Scattering information ) const { Scalar c=0; // What we do is continue the ray through this intersection and composite with the value behind Ray ray = ri.geometric.ray; ray.Advance( ri.geometric.range+2e-8 ); if( caster.CastRayNM( rc, ri.geometric.rast, ray, c, rs, nm, 0, ri.pRadianceMap, ior_stack ) ) { // Blend by painter color // But if we one sided only and the ray is coming from behind, then don't if( bOneSided ) { if( Vector3Ops::Dot( ri.geometric.ray.dir, ri.geometric.vNormal ) > 0 ) { return c; } } // Blend const Scalar trans = transparency.GetColorNM(ri.geometric,nm); c = caccum*(1.0-trans) + c*trans; } return c; }
33.637255
97
0.67269
aravindkrishnaswamy
48187e95fce3b2a0d60dc195260dc6f30eeb228f
2,864
cc
C++
zircon/system/dev/block/as370-sdhci/as370-sdhci.cc
winksaville/Fuchsia
a0ec86f1d51ae8d2538ff3404dad46eb302f9b4f
[ "BSD-3-Clause" ]
3
2020-08-02T04:46:18.000Z
2020-08-07T10:10:53.000Z
zircon/system/dev/block/as370-sdhci/as370-sdhci.cc
winksaville/Fuchsia
a0ec86f1d51ae8d2538ff3404dad46eb302f9b4f
[ "BSD-3-Clause" ]
null
null
null
zircon/system/dev/block/as370-sdhci/as370-sdhci.cc
winksaville/Fuchsia
a0ec86f1d51ae8d2538ff3404dad46eb302f9b4f
[ "BSD-3-Clause" ]
1
2020-08-07T10:11:49.000Z
2020-08-07T10:11:49.000Z
// Copyright 2019 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 "as370-sdhci.h" #include <lib/device-protocol/pdev.h> #include <memory> #include <ddk/binding.h> #include <ddk/debug.h> #include <ddk/platform-defs.h> #include <fbl/alloc_checker.h> namespace sdhci { zx_status_t As370Sdhci::Create(void* ctx, zx_device_t* parent) { ddk::PDev pdev(parent); if (!pdev.is_valid()) { zxlogf(ERROR, "%s: ZX_PROTOCOL_PDEV not available\n", __FILE__); return ZX_ERR_NO_RESOURCES; } else { pdev.ShowInfo(); } std::optional<ddk::MmioBuffer> core_mmio; zx_status_t status = pdev.MapMmio(0, &core_mmio); if (status != ZX_OK) { zxlogf(ERROR, "%s: MapMmio failed\n", __FILE__); return status; } zx::interrupt irq; if ((status = pdev.GetInterrupt(0, &irq)) != ZX_OK) { zxlogf(ERROR, "%s: Failed to map interrupt\n", __FILE__); return status; } fbl::AllocChecker ac; std::unique_ptr<As370Sdhci> device(new (&ac) As370Sdhci(parent, *std::move(core_mmio), std::move(irq))); if (!ac.check()) { zxlogf(ERROR, "%s: As370Sdhci alloc failed\n", __FILE__); return ZX_ERR_NO_MEMORY; } if ((status = device->Init()) != ZX_OK) { return status; } if ((status = device->DdkAdd("as370-sdhci")) != ZX_OK) { zxlogf(ERROR, "%s: DdkAdd failed\n", __FILE__); return status; } __UNUSED auto* dummy = device.release(); return ZX_OK; } zx_status_t As370Sdhci::Init() { return ZX_OK; } zx_status_t As370Sdhci::SdhciGetInterrupt(zx::interrupt* out_irq) { out_irq->reset(irq_.release()); return ZX_OK; } zx_status_t As370Sdhci::SdhciGetMmio(zx::vmo* out_mmio, zx_off_t* out_offset) { core_mmio_.get_vmo()->duplicate(ZX_RIGHT_SAME_RIGHTS, out_mmio); *out_offset = core_mmio_.get_offset(); return ZX_OK; } zx_status_t As370Sdhci::SdhciGetBti(uint32_t index, zx::bti* out_bti) { ddk::PDev pdev(parent()); if (!pdev.is_valid()) { return ZX_ERR_NO_RESOURCES; } return pdev.GetBti(index, out_bti); } uint32_t As370Sdhci::SdhciGetBaseClock() { return 0; } uint64_t As370Sdhci::SdhciGetQuirks() { return SDHCI_QUIRK_STRIP_RESPONSE_CRC_PRESERVE_ORDER | SDHCI_QUIRK_NO_DMA; } void As370Sdhci::SdhciHwReset() {} } // namespace sdhci static constexpr zx_driver_ops_t as370_sdhci_driver_ops = []() -> zx_driver_ops_t { zx_driver_ops_t ops = {}; ops.version = DRIVER_OPS_VERSION; ops.bind = sdhci::As370Sdhci::Create; return ops; }(); ZIRCON_DRIVER_BEGIN(as370_sdhci, as370_sdhci_driver_ops, "zircon", "0.1", 3) BI_ABORT_IF(NE, BIND_PROTOCOL, ZX_PROTOCOL_PDEV), BI_ABORT_IF(NE, BIND_PLATFORM_DEV_VID, PDEV_VID_SYNAPTICS), BI_MATCH_IF(EQ, BIND_PLATFORM_DEV_DID, PDEV_DID_AS370_SDHCI0), ZIRCON_DRIVER_END(as370_sdhci)
27.27619
100
0.698324
winksaville
481a1e888edeec4886eee0735473addf22e87086
11,722
cpp
C++
src/robot/devices/externalFileClass.cpp
1069B/Tower_Takeover
331a323216cd006a8cc3bc7a326ebe3a463e429f
[ "MIT" ]
null
null
null
src/robot/devices/externalFileClass.cpp
1069B/Tower_Takeover
331a323216cd006a8cc3bc7a326ebe3a463e429f
[ "MIT" ]
3
2019-07-26T15:56:19.000Z
2019-07-29T02:55:32.000Z
src/robot/devices/externalFileClass.cpp
1069B/Tower_Takeover
331a323216cd006a8cc3bc7a326ebe3a463e429f
[ "MIT" ]
null
null
null
#include "externalFileClass.hpp" bool ExternalFile::SDCardIsInserted(){ std::fstream m_file; m_file.open("/usd/.PROS_SD_Detection/SD_Card.txt", std::ios::app); m_file.close(); m_file.open("/usd/.PROS_SD_Detection/SD_Card.txt", std::ios::in); if(m_file.is_open()){ m_file.close(); return true; } return false; } ExternalFile::ExternalFile(const std::string p_address, const bool p_erase){ m_fileAddress = "/usd/" + p_address; m_file.open(m_fileAddress, std::ios::in); if(!p_erase && m_file.is_open()){ m_file.close(); } else{ m_file.open(m_fileAddress, std::ios::out); m_file.close(); } } bool ExternalFile::fileExist(){ if(!SDCardIsInserted()){ return false; } m_file.open(m_fileAddress, std::ios::in); if(m_file.is_open()){ m_file.close(); return true; } return false; } bool ExternalFile::varExist(const std::string p_varibleTitle){ m_file.open(m_fileAddress, std::ios::in); std::string tempString; while(std::getline(m_file, tempString)){ if(!tempString.find(p_varibleTitle)){ m_file.close(); return true; } } m_file.close(); return false; } int ExternalFile::addLine(const std::string p_lineValue){ m_file.open(m_fileAddress, std::ios::app); m_file << p_lineValue << std::endl; m_file.close(); return 0; } int ExternalFile::updateLine(const std::string p_varibleTitle, const std::string p_lineValue){ std::vector<std::string> stringVector; std::string tempString; m_file.open(m_fileAddress, std::ios::in); while(std::getline(m_file, tempString)){ if(!tempString.find(p_varibleTitle)){ tempString = p_lineValue; stringVector.push_back(tempString); } else{ stringVector.push_back(tempString); } } m_file.close(); m_file.open(m_fileAddress, std::ios::out); for(int x = 0; x < stringVector.size(); x++){ m_file << stringVector.at(x) << std::endl; } m_file.close(); return 0; } std::string ExternalFile::readLine(const std::string p_varibleTitle){ m_file.open(m_fileAddress, std::ios::in); std::string tempString; while(std::getline(m_file, tempString)){ if(!tempString.find(p_varibleTitle)){ m_file.close(); return tempString; } } m_file.close(); return "Error"; } int ExternalFile::storeVar(const std::string p_varibleTitle, const std::string p_lineValue){ if(varExist(p_varibleTitle)){ updateLine(p_varibleTitle, p_lineValue); } else{ addLine(p_lineValue); } return 0; } int ExternalFile::storeInt(const std::string p_varibleName, const int p_varibleValue){ std::string varibleTitle = p_varibleName + ":Int= "; std::string lineValue = varibleTitle + std::to_string(p_varibleValue); return storeVar(varibleTitle, lineValue); } int ExternalFile::readInt(const std::string varibleName){ std::string varibleTitle = varibleName + ":Int= "; std::string lineValue = readLine(varibleTitle); if(lineValue == "Error") return -1; return std::stoi(lineValue.substr(varibleTitle.size())); } int ExternalFile::storeDouble(const std::string p_varibleName, const double p_varibleValue){ std::string varibleTitle = p_varibleName + ":Double= "; std::string lineValue = varibleTitle + std::to_string(p_varibleValue); return storeVar(varibleTitle, lineValue); } double ExternalFile::readDouble(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":Double= "; std::string lineValue = readLine(varibleTitle); if(lineValue == "Error") return -1.1; return std::stod(lineValue.substr(varibleTitle.size())); } int ExternalFile::storeChar(const std::string p_varibleName, const char p_varibleValue){ std::string varibleTitle = p_varibleName + ":Char= "; std::string lineValue = varibleTitle + p_varibleValue; return storeVar(varibleTitle, lineValue); } char ExternalFile::readChar(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":Char= "; std::string lineValue = readLine(varibleTitle); if(lineValue == "Error") return 'E'; return lineValue.at(varibleTitle.size()); } int ExternalFile::storeBool(const std::string p_varibleName, const bool p_varibleValue){ std::string varibleTitle = p_varibleName + ":Bool= "; std::string lineValue = varibleTitle + std::to_string(p_varibleValue); return storeVar(varibleTitle, lineValue); } bool ExternalFile::readBool(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":Bool= "; std::string lineValue = readLine(varibleTitle); if(lineValue == "Error") return false; return std::stoi(lineValue.substr(varibleTitle.size())); } int ExternalFile::storeString(const std::string p_varibleName, const std::string p_varibleValue){ std::string varibleTitle = p_varibleName + ":String= "; std::string lineValue = varibleTitle + p_varibleValue; return storeVar(varibleTitle, lineValue); } std::string ExternalFile::readString(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":String= "; std::string lineValue = readLine(varibleTitle); if(lineValue == "Error") return "Error"; return lineValue.substr(varibleTitle.size()); } // Array of Varibles int ExternalFile::storeIntArray(const std::string p_varibleName,const std::vector<int> p_varibleValue){ std::string varibleTitle = p_varibleName + ":IntArray= "; std::string lineValue = varibleTitle; for(int x = 0; x<p_varibleValue.size()-1; x++){ lineValue += std::to_string(p_varibleValue.at(x))+ ", "; } lineValue += std::to_string(p_varibleValue.at(p_varibleValue.size()-1))+"~"; return storeVar(varibleTitle, lineValue); } std::vector<int> ExternalFile::readIntArray(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":IntArray= "; std::string lineValue = readLine(varibleTitle); std::vector<int> tempVec; if(lineValue == "Error"){ tempVec.push_back(-1); return tempVec; } int position = (int)varibleTitle.size(); bool x = true; while(x){ std::string tempString = lineValue.substr(position); if(tempString.find(",") == -1){ tempVec.push_back(std::stoi(tempString.substr(0, tempString.find("~")))); x = false; } else{ tempVec.push_back(std::stoi(tempString.substr(0,tempString.find(",")))); position+=tempString.find(",")+2; } } return tempVec; } int ExternalFile::storeDoubleArray(const std::string p_varibleName, const std::vector<double> p_varibleValue){ std::string varibleTitle = p_varibleName + ":DoubleArray= "; std::string lineValue = varibleTitle; for(int x = 0; x<p_varibleValue.size()-1; x++){ lineValue += std::to_string(p_varibleValue.at(x))+ ", "; } lineValue += std::to_string(p_varibleValue.at(p_varibleValue.size()-1))+"~"; return storeVar(varibleTitle, lineValue); } std::vector<double> ExternalFile::readDoubleArray(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":DoubleArray= "; std::string lineValue = readLine(varibleTitle); std::vector<double> tempVec; if(lineValue == "Error"){ tempVec.push_back(-1.1); return tempVec; } int position = (int)varibleTitle.size(); bool x = true; while(x){ std::string tempString = lineValue.substr(position); if(tempString.find(",") == -1){ tempVec.push_back(std::stod(tempString.substr(0, tempString.find("~")))); x = false; } else{ tempVec.push_back(std::stod(tempString.substr(0,tempString.find(",")))); position+=tempString.find(",")+2; } } return tempVec; } int ExternalFile::storeCharArray(const std::string p_varibleName, const std::vector<char> p_varibleValue){ std::string varibleTitle = p_varibleName + ":CharArray= "; std::string lineValue = varibleTitle; for(int x = 0; x<p_varibleValue.size()-1; x++){ lineValue += std::string(1, p_varibleValue.at(x))+ ", "; } lineValue += std::string(1, p_varibleValue.at(p_varibleValue.size()-1))+"~"; return storeVar(varibleTitle, lineValue); } std::vector<char> ExternalFile::readCharArray(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":CharArray= "; std::string lineValue = readLine(varibleTitle); std::vector<char> tempVec; if(lineValue == "Error"){ tempVec.push_back('E'); tempVec.push_back('R'); return tempVec; } int position = (int)varibleTitle.size(); bool x = true; while(x){ std::string tempString = lineValue.substr(position); if(tempString.find(",") == -1){ tempVec.push_back(tempString.at(tempString.find("~")-1)); x = false; } else{ tempVec.push_back(tempString.at(tempString.find(",")-1)); position+=tempString.find(",")+2; } } return tempVec; } int ExternalFile::storeBoolArray(const std::string p_varibleName, const std::vector<bool> p_varibleValue){ std::string varibleTitle = p_varibleName + ":BoolArray= "; std::string lineValue = varibleTitle; for(int x = 0; x<p_varibleValue.size()-1; x++){ lineValue += std::to_string(p_varibleValue.at(x))+ ", "; } lineValue += std::to_string(p_varibleValue.at(p_varibleValue.size()-1))+"~"; return storeVar(varibleTitle, lineValue); } std::vector<bool> ExternalFile::readBoolArray(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":BoolArray= "; std::string lineValue = readLine(varibleTitle); std::vector<bool> tempVec; if(lineValue == "Error"){ tempVec.push_back(false); return tempVec; } int position = (int)varibleTitle.size(); bool x = true; while(x){ std::string tempString = lineValue.substr(position); if(tempString.find(",") == -1){ tempVec.push_back(std::stoi(tempString.substr(0, tempString.find("~")))); x = false; } else{ tempVec.push_back(std::stoi(tempString.substr(0,tempString.find(",")))); position+=tempString.find(",")+2; } } return tempVec; } int ExternalFile::storeStringArray(const std::string p_varibleName, const std::vector<std::string> p_varibleValue){ std::string varibleTitle = p_varibleName + ":StringArray= "; std::string lineValue = varibleTitle; for(int x = 0; x<p_varibleValue.size()-1; x++){ lineValue += p_varibleValue.at(x)+ ", "; } lineValue += p_varibleValue.at(p_varibleValue.size()-1)+"~"; return storeVar(varibleTitle, lineValue); } std::vector<std::string> ExternalFile::readStringArray(const std::string p_varibleName){ std::string varibleTitle = p_varibleName + ":StringArray= "; std::string lineValue = readLine(varibleTitle); std::vector<std::string> tempVec; if(lineValue == "Error"){ tempVec.push_back("Error"); return tempVec; } int position = (int)varibleTitle.size(); bool x = true; while(x){ std::string tempString = lineValue.substr(position); if(tempString.find(",") == -1){ tempVec.push_back(tempString.substr(0, tempString.find("~"))); x = false; } else{ tempVec.push_back(tempString.substr(0,tempString.find(","))); position+=tempString.find(",")+2; } } return tempVec; }
35.095808
115
0.649548
1069B
481d74ac07a63be9e04420ce81ed6a85c7a87c44
551
cpp
C++
55. Jump Game| LIS variant.cpp
i-am-grut/Leetcode-top-interview-q
5f763f9a15558a1bfef62d860a4fe89326eee450
[ "MIT" ]
2
2021-06-25T07:26:30.000Z
2021-07-14T05:46:57.000Z
55. Jump Game| LIS variant.cpp
i-am-grut/Leetcode-top-interview-q
5f763f9a15558a1bfef62d860a4fe89326eee450
[ "MIT" ]
null
null
null
55. Jump Game| LIS variant.cpp
i-am-grut/Leetcode-top-interview-q
5f763f9a15558a1bfef62d860a4fe89326eee450
[ "MIT" ]
null
null
null
class Solution { public: bool canJump(vector<int>& nums) { int n=nums.size(); if(n==0 || n==1){ return true; } if(nums[0]==0){ return false; } bool dp[n]; dp[0]=true; //LIS for(int i=1;i<n;i++){ dp[i]=false; for(int j=i-1;j>=0;j--){ if(dp[j]!=false && nums[j]+j>=i){ dp[i]=true; break; } } } return dp[n-1]; } };
20.407407
49
0.321234
i-am-grut
481eb51151b2c71d48f3439b321aff841c45f75f
6,222
cpp
C++
sunglasses/src/Physics/GJKAlgorithm.cpp
jonathanbuchanan/Sunglasses
ab82b66f32650a813234cee8963f9b598ef5c1c8
[ "MIT" ]
1
2016-04-01T02:21:27.000Z
2016-04-01T02:21:27.000Z
sunglasses/src/Physics/GJKAlgorithm.cpp
jonathanbuchanan/Sunglasses
ab82b66f32650a813234cee8963f9b598ef5c1c8
[ "MIT" ]
49
2015-07-08T13:48:06.000Z
2017-06-27T01:40:51.000Z
sunglasses/src/Physics/GJKAlgorithm.cpp
jonathanbuchanan/Sunglasses
ab82b66f32650a813234cee8963f9b598ef5c1c8
[ "MIT" ]
null
null
null
// Copyright 2016 Jonathan Buchanan. // This file is part of Sunglasses, which is licensed under the MIT License. // See LICENSE.md for details. #include <sunglasses/Physics/GJKAlgorithm.h> #include <iostream> namespace sunglasses { glm::vec3 getFarthestPointAlongAxis(PhysicsColliderMesh *mesh, glm::vec3 axis) { glm::vec3 farthestPoint = mesh->getPositionAtIndex(0); float farthestDistance = glm::dot(mesh->getPositionAtIndex(0), axis); for (int i = 0; i < mesh->getVertexCount(); i++) { float temporaryDistance = glm::dot(mesh->getPositionAtIndex(i), axis); if (temporaryDistance > farthestDistance) { farthestDistance = temporaryDistance; farthestPoint = mesh->getPositionAtIndex(i); } } return farthestPoint; } glm::vec3 getFarthestPointAlongAxis(PhysicsColliderSphere *sphere, glm::vec3 axis) { glm::vec3 localPoint = glm::normalize(axis) * sphere->getRadius(); glm::vec3 globalPoint = localPoint + sphere->getPosition(); return globalPoint; } glm::vec3 getFarthestPointAlongAxis(PhysicsColliderAABB *aabb, glm::vec3 axis) { glm::vec3 AABBPoints[8] = { glm::vec3(aabb->getSecondPointX(), aabb->getSecondPointY(), aabb->getSecondPointZ()), glm::vec3(aabb->getFirstPointX(), aabb->getSecondPointY(), aabb->getSecondPointZ()), glm::vec3(aabb->getSecondPointX(), aabb->getFirstPointY(), aabb->getSecondPointZ()), glm::vec3(aabb->getSecondPointX(), aabb->getSecondPointY(), aabb->getFirstPointZ()), glm::vec3(aabb->getFirstPointX(), aabb->getFirstPointY(), aabb->getSecondPointZ()), glm::vec3(aabb->getFirstPointX(), aabb->getSecondPointY(), aabb->getFirstPointZ()), glm::vec3(aabb->getSecondPointX(), aabb->getFirstPointY(), aabb->getFirstPointZ()), glm::vec3(aabb->getFirstPointX(), aabb->getFirstPointY(), aabb->getFirstPointZ()) }; glm::vec3 farthestPoint = AABBPoints[0]; float farthestDistance = glm::dot(AABBPoints[0], axis); for (int i = 0; i < 8; i++) { float temporaryDistance = glm::dot(AABBPoints[i], axis); if (temporaryDistance > farthestDistance) { farthestDistance = temporaryDistance; farthestPoint = AABBPoints[i]; } } return farthestPoint; } glm::vec3 support(PhysicsColliderMesh *first, PhysicsColliderMesh *second, glm::vec3 axis, Simplex &simplex) { glm::vec3 firstPoint = getFarthestPointAlongAxis(first, axis); glm::vec3 secondPoint = getFarthestPointAlongAxis(second, -axis); glm::vec3 result = firstPoint - secondPoint; return result; } glm::vec3 support(PhysicsColliderMesh *first, PhysicsColliderSphere *sphere, glm::vec3 axis, Simplex &simplex) { glm::vec3 firstPoint = getFarthestPointAlongAxis(first, axis); glm::vec3 secondPoint = getFarthestPointAlongAxis(sphere, -axis); glm::vec3 result = firstPoint - secondPoint; return result; } glm::vec3 support(PhysicsColliderMesh *first, PhysicsColliderAABB *aabb, glm::vec3 axis, Simplex &simplex) { glm::vec3 firstPoint = getFarthestPointAlongAxis(first, axis); glm::vec3 secondPoint = getFarthestPointAlongAxis(aabb, -axis); glm::vec3 result = firstPoint - secondPoint; return result; } glm::vec3 tripleCross(glm::vec3 a, glm::vec3 b, glm::vec3 c) { return a * b * c; } bool processLine(Simplex &simplex, glm::vec3 &direction) { glm::vec3 a = simplex.a; glm::vec3 b = simplex.b; glm::vec3 ao = -a; glm::vec3 ab = b - a; glm::vec3 abPerp = glm::cross(glm::cross(ab, ao), ab); direction = abPerp; return false; } bool processTriangle(Simplex &simplex, glm::vec3 &direction) { glm::vec3 a = simplex.a; glm::vec3 b = simplex.b; glm::vec3 c = simplex.c; glm::vec3 ao = -a; glm::vec3 ab = b - a; glm::vec3 ac = c - a; glm::vec3 abc = glm::cross(ab, ac); glm::vec3 abPerp = glm::cross(ab, abc); glm::vec3 acPerp = glm::cross(abc, ac); bool firstFailed = false; bool secondFailed = false; if (glm::dot(abPerp, ao) > 0) { simplex.set(a, b); direction = tripleCross(ab, ao, ab); } else { firstFailed = true; } if (glm::dot(acPerp, ao) > 0) { simplex.set(a, c); direction = tripleCross(ac, ao, ac); } else { secondFailed = true; } if (firstFailed == true && secondFailed == true) { if (glm::dot(abc, ao) > 0) { direction = abc; } else { simplex.set(a, c, b); direction = -abc; } } return false; } bool processTetrahedron(Simplex &simplex, glm::vec3 &direction) { glm::vec3 a = simplex.a; glm::vec3 b = simplex.b; glm::vec3 c = simplex.c; glm::vec3 d = simplex.d; glm::vec3 ao = -a; glm::vec3 ab = b - a; glm::vec3 ac = c - a; glm::vec3 ad = d - a; glm::vec3 abc = glm::cross(ab, ac); glm::vec3 acd = glm::cross(ac, ad); glm::vec3 adb = glm::cross(ad, ab); bool collision = true; if (glm::dot(abc, ao) > 0) { collision = false; } if (glm::dot(acd, ao) > 0) { simplex.set(a, c, d); collision = false; } if (glm::dot(adb, ao) > 0) { simplex.set(a, d, b); collision = false; } if (collision) return true; a = simplex.a; b = simplex.b; c = simplex.c; d = simplex.d; ao = -a; ab = b - a; ac = c - a; ad = d - a; abc = glm::cross(ab, ac); bool done = false; if (glm::dot(ab, abc) > 0) { simplex.set(a, b); direction = tripleCross(ab, ao, ab); done = true; } if (glm::dot(abc, ac) > 0) { simplex.set(a, c); direction = tripleCross(ac, ao, ac); done = true; } if (!done) { simplex.set(a, b, c); direction = abc; } return false; } bool processSimplex(Simplex &simplex, glm::vec3 &direction) { if (simplex.size == 2) return processLine(simplex, direction); else if (simplex.size == 3) return processTriangle(simplex, direction); else if (simplex.size == 4) return processTetrahedron(simplex, direction); return false; } } // namespace
29.628571
112
0.612022
jonathanbuchanan
481ed80201f82ef25036bd11ae8d6b31cc62cb4b
3,072
cpp
C++
artifact/storm/src/storm/utility/builder.cpp
glatteis/tacas21-artifact
30b4f522bd3bdb4bebccbfae93f19851084a3db5
[ "MIT" ]
null
null
null
artifact/storm/src/storm/utility/builder.cpp
glatteis/tacas21-artifact
30b4f522bd3bdb4bebccbfae93f19851084a3db5
[ "MIT" ]
null
null
null
artifact/storm/src/storm/utility/builder.cpp
glatteis/tacas21-artifact
30b4f522bd3bdb4bebccbfae93f19851084a3db5
[ "MIT" ]
1
2022-02-05T12:39:53.000Z
2022-02-05T12:39:53.000Z
#include <storm/models/sparse/StochasticTwoPlayerGame.h> #include "storm/utility/builder.h" #include "storm/models/sparse/Dtmc.h" #include "storm/models/sparse/Ctmc.h" #include "storm/models/sparse/Mdp.h" #include "storm/models/sparse/Pomdp.h" #include "storm/models/sparse/MarkovAutomaton.h" #include "storm/exceptions/InvalidModelException.h" namespace storm { namespace utility { namespace builder { template<typename ValueType, typename RewardModelType> std::shared_ptr<storm::models::sparse::Model<ValueType, RewardModelType>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<ValueType, RewardModelType>&& components) { switch (modelType) { case storm::models::ModelType::Dtmc: return std::make_shared<storm::models::sparse::Dtmc<ValueType, RewardModelType>>(std::move(components)); case storm::models::ModelType::Ctmc: return std::make_shared<storm::models::sparse::Ctmc<ValueType, RewardModelType>>(std::move(components)); case storm::models::ModelType::Mdp: return std::make_shared<storm::models::sparse::Mdp<ValueType, RewardModelType>>(std::move(components)); case storm::models::ModelType::Pomdp: return std::make_shared<storm::models::sparse::Pomdp<ValueType, RewardModelType>>(std::move(components)); case storm::models::ModelType::MarkovAutomaton: return std::make_shared<storm::models::sparse::MarkovAutomaton<ValueType, RewardModelType>>(std::move(components)); case storm::models::ModelType::S2pg: return std::make_shared<storm::models::sparse::StochasticTwoPlayerGame<ValueType, RewardModelType>>(std::move(components)); } STORM_LOG_THROW(false, storm::exceptions::InvalidModelException, "Unknown model type"); } template std::shared_ptr<storm::models::sparse::Model<double>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<double>&& components); template std::shared_ptr<storm::models::sparse::Model<double, storm::models::sparse::StandardRewardModel<storm::Interval>>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<double, storm::models::sparse::StandardRewardModel<storm::Interval>>&& components); template std::shared_ptr<storm::models::sparse::Model<storm::RationalNumber>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<storm::RationalNumber>&& components); template std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents<storm::RationalFunction>&& components); } } }
73.142857
320
0.681641
glatteis
48212a1472ffd40fc0488b5f9d61fc9fa7296d10
3,041
cpp
C++
libraries/chain/evaluator.cpp
1aerostorm/golos
06105e960537347bee7c4657e0b63c85adfff26f
[ "MIT" ]
8
2019-03-29T10:44:05.000Z
2019-11-01T12:06:57.000Z
libraries/chain/evaluator.cpp
1aerostorm/golos
06105e960537347bee7c4657e0b63c85adfff26f
[ "MIT" ]
63
2019-12-29T18:26:15.000Z
2021-08-25T13:14:25.000Z
libraries/chain/evaluator.cpp
1aerostorm/golos
06105e960537347bee7c4657e0b63c85adfff26f
[ "MIT" ]
5
2019-04-11T17:58:55.000Z
2019-10-27T16:24:21.000Z
#include <golos/chain/evaluator.hpp> #include <golos/chain/database.hpp> #include <golos/chain/account_object.hpp> #include <golos/chain/steem_objects.hpp> namespace golos { namespace chain { asset get_balance(const database& _db, const account_object &account, balance_type type, asset_symbol_type symbol) { switch(type) { case MAIN_BALANCE: if (symbol == STEEM_SYMBOL) { return account.balance; } else if (symbol == SBD_SYMBOL) { return account.sbd_balance; } else { GOLOS_CHECK_VALUE(_db.has_hardfork(STEEMIT_HARDFORK_0_24__95), "invalid symbol"); return _db.get_or_default_account_balance(account.name, symbol).balance; } case SAVINGS: if (symbol == STEEM_SYMBOL) { return account.savings_balance; } else if (symbol == SBD_SYMBOL) { return account.savings_sbd_balance; } else { GOLOS_CHECK_VALUE(false, "invalid symbol"); } case VESTING: GOLOS_CHECK_VALUE(symbol == VESTS_SYMBOL, "invalid symbol"); return account.vesting_shares; case EFFECTIVE_VESTING: GOLOS_CHECK_VALUE(symbol == VESTS_SYMBOL, "invalid symbol"); return account.effective_vesting_shares(); case HAVING_VESTING: GOLOS_CHECK_VALUE(symbol == VESTS_SYMBOL, "invalid symbol"); return account.available_vesting_shares(false); case AVAILABLE_VESTING: GOLOS_CHECK_VALUE(symbol == VESTS_SYMBOL, "invalid symbol"); return account.available_vesting_shares(true); case TIP_BALANCE: if (symbol == STEEM_SYMBOL) { return account.tip_balance; } else { GOLOS_CHECK_VALUE(_db.has_hardfork(STEEMIT_HARDFORK_0_24__95), "invalid symbol"); return _db.get_or_default_account_balance(account.name, symbol).tip_balance; } default: FC_ASSERT(false, "invalid balance type"); } } std::string get_balance_name(balance_type type) { switch(type) { case MAIN_BALANCE: return "fund"; case SAVINGS: return "savings"; case VESTING: return "vesting shares"; case EFFECTIVE_VESTING: return "effective vesting shares"; case HAVING_VESTING: return "having vesting shares"; case AVAILABLE_VESTING: return "available vesting shares"; case TIP_BALANCE: return "tip balance"; default: FC_ASSERT(false, "invalid balance type"); } } } } // golos::chain
47.515625
124
0.542914
1aerostorm
48218bcc6c1635295fbbefa0cc4105edc15745de
719
cpp
C++
src/attic/BezierCurve.cpp
mgerhardy/myplayground
ad5ed00e7946108f2991ad9031096da161f2e6a7
[ "MIT" ]
1
2018-01-18T20:09:47.000Z
2018-01-18T20:09:47.000Z
src/attic/BezierCurve.cpp
mgerhardy/myplayground
ad5ed00e7946108f2991ad9031096da161f2e6a7
[ "MIT" ]
null
null
null
src/attic/BezierCurve.cpp
mgerhardy/myplayground
ad5ed00e7946108f2991ad9031096da161f2e6a7
[ "MIT" ]
null
null
null
#include "BezierCurve.h" #include "engine/common/Math.h" #include <assert.h> BezierCurve::BezierCurve () { } BezierCurve::~BezierCurve () { } float BezierCurve::lerp (const double a, const double b, const double t) { const double p = a + (b - a) * t; return p; } float BezierCurve::bezier (const Points& points, const double t) { if (points.size() == 2) { const double p = lerp(points[0], points[1], t); return p; } assert(points.size() > 2); Points::const_iterator i = points.begin(); double prev = *i++; Points lerped; for (; i != points.end(); ++i) { const double current = *i; const double p = lerp(prev, current, t); prev = current; lerped.push_back(p); } return bezier(lerped, t); }
17.975
72
0.641168
mgerhardy
4827b63227ac1ae126081fcbed824c8e9077ca0c
164,620
cpp
C++
vulkanon/generator/tmp/05-gen-callingvector/vulkanon/l0_boss5-left.cpp
pqrs-org/Vulkanon
3c161b83e64f18be2ba916055e5761fbc0b61028
[ "Unlicense" ]
5
2020-04-20T02:28:15.000Z
2021-12-05T22:04:06.000Z
vulkanon/generator/tmp/05-gen-callingvector/vulkanon/l0_boss5-left.cpp
pqrs-org/Vulkanon
3c161b83e64f18be2ba916055e5761fbc0b61028
[ "Unlicense" ]
null
null
null
vulkanon/generator/tmp/05-gen-callingvector/vulkanon/l0_boss5-left.cpp
pqrs-org/Vulkanon
3c161b83e64f18be2ba916055e5761fbc0b61028
[ "Unlicense" ]
null
null
null
extern const BulletStepFunc bullet_7381bc6f43eb422d458a2239f53566ea_8bfcd38de5961107785fdc25e687ca15[] = { stepfunc_efe2c0d124d296be77286f5d11e9f0b8_8bfcd38de5961107785fdc25e687ca15, stepfunc_0fdd59aa50ca3c3515c1b7e88bbab930_8bfcd38de5961107785fdc25e687ca15, NULL}; extern const BulletStepFunc bullet_7ec1b7e792d02c73be80cb4c5cc56a1c_8bfcd38de5961107785fdc25e687ca15[] = { stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_5e8e5dd10e033233c7403e7dee40b025_8bfcd38de5961107785fdc25e687ca15, stepfunc_48335121df3ff5225f00d637f2b62596_8bfcd38de5961107785fdc25e687ca15, stepfunc_dae2cf81747ffb5070f05c8837b1d568_8bfcd38de5961107785fdc25e687ca15, NULL};
75.931734
107
0.973539
pqrs-org
482e60d05b4432939cb7c915d0fa77c36b23effb
1,106
cpp
C++
01.SaralySystem/src/transaction/add_commissioned_employee.cpp
tomoyuki-nakabayashi/AgileSoftwareDevelopment
b162a24b2c12bdaeeed4f1b618e92d33e759318c
[ "MIT" ]
null
null
null
01.SaralySystem/src/transaction/add_commissioned_employee.cpp
tomoyuki-nakabayashi/AgileSoftwareDevelopment
b162a24b2c12bdaeeed4f1b618e92d33e759318c
[ "MIT" ]
1
2018-03-27T12:18:38.000Z
2018-04-18T12:15:36.000Z
01.SaralySystem/src/transaction/add_commissioned_employee.cpp
tomoyuki-nakabayashi/AgileSoftwareDevelopment
b162a24b2c12bdaeeed4f1b618e92d33e759318c
[ "MIT" ]
null
null
null
// Copyright <2018> Tomoyuki-Nakabayashi // This software is released under the MIT License, see LICENSE. #include <transaction/add_commissioned_employee.h> #include <payroll_domain/commissioned_classification.h> #include <payroll_domain/biweekly_schedule.h> namespace transaction { using payroll_domain::CommissionedClassification; using payroll_domain::BiweeklySchedule; AddCommissionedEmployee::AddCommissionedEmployee(int id, std::string name, std::string addr, double salary, double commission_rate) : AddEmployeeTransaction{id, name, addr} , salary_{salary} , commission_rate_{commission_rate} { } UPtrPayClass AddCommissionedEmployee::GetClassification() const { return UPtrPayClass(new CommissionedClassification{salary_, commission_rate_}); } UPtrPaySchedule AddCommissionedEmployee::GetSchedule() const { return UPtrPaySchedule(new BiweeklySchedule{}); } } // namespace transaction
35.677419
81
0.669982
tomoyuki-nakabayashi
48312cbfad28db1b270bd75377e093e82b6d30f3
1,994
cpp
C++
src/base/CamelReaderWriterQueueWL.cpp
nneesshh/netsystem
8ff391f38ebba07fb83edc8581d7203134012feb
[ "Apache-2.0" ]
null
null
null
src/base/CamelReaderWriterQueueWL.cpp
nneesshh/netsystem
8ff391f38ebba07fb83edc8581d7203134012feb
[ "Apache-2.0" ]
null
null
null
src/base/CamelReaderWriterQueueWL.cpp
nneesshh/netsystem
8ff391f38ebba07fb83edc8581d7203134012feb
[ "Apache-2.0" ]
null
null
null
//------------------------------------------------------------------------------ // CamelReaderWriterQueueWL.cpp // (C) 2016 n.lee //------------------------------------------------------------------------------ #include "CamelReaderWriterQueueWL.h" #include "platform_utilities.h" #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN 1 # include <windows.h> #endif #ifdef _DEBUG # define RWQUEUE_CONSUME_WATERLINE 128 #else # define RWQUEUE_CONSUME_WATERLINE 2048 #endif #define RWQUEUE_PRODUCE_WATERLINE 8192 //------------------------------------------------------------------------------ /** */ CCamelReaderWriterQueueWL::CCamelReaderWriterQueueWL() : _callbacks(256) { } //------------------------------------------------------------------------------ /** */ CCamelReaderWriterQueueWL::~CCamelReaderWriterQueueWL() { } //------------------------------------------------------------------------------ /** */ void CCamelReaderWriterQueueWL::RunOnce() { // work queue int ncount = 0; CallbackEntry workCb; while (!_close && ncount < RWQUEUE_CONSUME_WATERLINE && _callbacks.try_dequeue(workCb)) { workCb(); // ++ncount; } } //------------------------------------------------------------------------------ /** */ void CCamelReaderWriterQueueWL::Close() { // // Set done flag and notify. // _close = true; } //------------------------------------------------------------------------------ /** */ bool CCamelReaderWriterQueueWL::Add(std::function<void()>&& workCb) { if (_close) { // error fprintf(stderr, "[CCamelWorkQueue::Add()] can't enqueue, callback is dropped!!!"); return false; } // // Add work item. // if (!_callbacks.enqueue(std::move(workCb))) { // error fprintf(stderr, "[CCamelWorkQueue::Add()] enqueue failed, callback is dropped!!!"); return false; } // decrease produce speed, wait main thread to consume if (_callbacks.size_approx() >= RWQUEUE_PRODUCE_WATERLINE) { util_sleep(15); } return true; } /** -- EOF -- **/
20.141414
85
0.490973
nneesshh
4838143530d158a17848e6fbac3a0c84b9a5d0d1
1,545
cpp
C++
src/ioobject.cpp
abbyssoul/libcadence
c9a49d95df608497e9551f7d62169d0c78a48737
[ "Apache-2.0" ]
2
2020-04-24T15:07:33.000Z
2020-06-12T07:01:53.000Z
src/ioobject.cpp
abbyssoul/libcadence
c9a49d95df608497e9551f7d62169d0c78a48737
[ "Apache-2.0" ]
null
null
null
src/ioobject.cpp
abbyssoul/libcadence
c9a49d95df608497e9551f7d62169d0c78a48737
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2016 Ivan Ryabov * * 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. */ /******************************************************************************* * libcadence * @file ioobject.cpp * @brief Implementation of IOObject ******************************************************************************/ #include "cadence/ioobject.hpp" using namespace Solace; using namespace cadence; IOObject::IOResult IOObject::read(ByteWriter& destBuffer, size_type bytesToRead) { auto destSlice = destBuffer.viewRemaining().slice(0, bytesToRead); return read(destSlice) .then([&destBuffer](auto bytesRead) { destBuffer.advance(bytesRead); return bytesRead; }); } IOObject::IOResult IOObject::write(ByteReader& srcBuffer, size_type bytesToWrite) { return write(srcBuffer.viewRemaining().slice(0, bytesToWrite)) .then([&srcBuffer](auto bytesRead) { srcBuffer.advance(bytesRead); return bytesRead; }); }
31.530612
80
0.616828
abbyssoul
4839df4259064d37c9fa66ac7ecc18fe920df6d9
559
cpp
C++
BAC/exercises/ch8/UVa10954.cpp
Anyrainel/aoapc-code
e787a01380698fb9236d933462052f97b20e6132
[ "Apache-2.0" ]
3
2017-08-15T06:00:01.000Z
2018-12-10T09:05:53.000Z
BAC/exercises/ch8/UVa10954.cpp
Anyrainel/aoapc-related-code
e787a01380698fb9236d933462052f97b20e6132
[ "Apache-2.0" ]
null
null
null
BAC/exercises/ch8/UVa10954.cpp
Anyrainel/aoapc-related-code
e787a01380698fb9236d933462052f97b20e6132
[ "Apache-2.0" ]
2
2017-09-16T18:46:27.000Z
2018-05-22T05:42:03.000Z
// UVa10954 Add All // Rujia Liu // 题意:有n个数的集合S,每次可以从S中删除两个数,然后把它们的和放回集合,直到剩一个数。每次操作的开销等于删除的两个数之和。求最小总开销。 // 算法:Huffman编码 #include<cstdio> #include<queue> using namespace std; int main() { int n, x; while(scanf("%d", &n) == 1 && n) { priority_queue<int, vector<int>, greater<int> > q; for(int i = 0; i < n; i++) { scanf("%d", &x); q.push(x); } int ans = 0; for(int i = 0; i < n-1; i++) { int a = q.top(); q.pop(); int b = q.top(); q.pop(); ans += a+b; q.push(a+b); } printf("%d\n", ans); } return 0; }
22.36
72
0.531306
Anyrainel
483a6f49df9f84078f07a23dbc3ecfcc4034026c
348
cpp
C++
invertedNestedLoops2.cpp
yishenli/learncpp
734a3ef753b32a3252b731d7e370b808fcf79a6b
[ "MIT" ]
null
null
null
invertedNestedLoops2.cpp
yishenli/learncpp
734a3ef753b32a3252b731d7e370b808fcf79a6b
[ "MIT" ]
null
null
null
invertedNestedLoops2.cpp
yishenli/learncpp
734a3ef753b32a3252b731d7e370b808fcf79a6b
[ "MIT" ]
null
null
null
#include <iostream> int main() { const int max = 9; int outer = 1; while (outer <= max) { for (int i = 0; i < max - outer; ++i) { std::cout << " "; } int inner = 1; while (inner <= outer) { std::cout << inner << ' '; ++inner; } std::cout << '\n'; ++outer; } return 0; }
12.888889
41
0.408046
yishenli
483b59bf1d67d39d4204b480123f6ad2f3cca821
2,295
cpp
C++
src/libs/dios_util/src/util_timer.cpp
dios-game/dios
ce947382bcc8692ea70533d6def112a2838a9d0e
[ "MIT" ]
1
2016-05-25T02:57:02.000Z
2016-05-25T02:57:02.000Z
src/libs/dios_util/src/util_timer.cpp
dios-game/dios
ce947382bcc8692ea70533d6def112a2838a9d0e
[ "MIT" ]
null
null
null
src/libs/dios_util/src/util_timer.cpp
dios-game/dios
ce947382bcc8692ea70533d6def112a2838a9d0e
[ "MIT" ]
1
2021-04-17T16:06:00.000Z
2021-04-17T16:06:00.000Z
#include "precompiled.h" #include "util_timer.h" NS_DS_BEGIN NS_UTIL_BEGIN #if ( DS_TARGET_PLATFORM == DS_PLATFORM_WIN32 ) class WinMicroTimer { public: WinMicroTimer( void ) { QueryPerformanceFrequency( (LARGE_INTEGER*)(&m_frequency) ); m_frequency = m_frequency / 1000000; } inline ds_uint64 getMicroSecond( void ) { ds_uint64 t; QueryPerformanceCounter((LARGE_INTEGER*)(&t)); return (t / m_frequency); } private: ds_uint64 m_frequency; }; ds_uint64 CTimer::GetMicroSecond( void ) { static WinMicroTimer win_micro_timer; return win_micro_timer.getMicroSecond(); } ds_uint32 CTimer::GetMilliSecond( void ) { struct _timeb tb; _ftime(&tb); return ((tb.time&0x003FFFFF)*1000)+tb.millitm; } #else ds_uint64 CTimer::GetMicroSecond( void ) { struct timeval tv; struct timezone tz; gettimeofday( &tv, &tz ); return (tv.tv_sec * 1000000) + tv.tv_usec; } ds_uint32 CTimer::GetMilliSecond( void ) { struct timeval tv; struct timezone tz; gettimeofday( &tv, &tz ); return (tv.tv_sec * 1000) + (tv.tv_usec / 1000); } #endif ds_int64 CElapsedTimer::GetElapsedHours() const { return std::chrono::duration_cast<std::chrono::hours>(std::chrono::high_resolution_clock::now() - m_begin).count(); } ds_int64 CElapsedTimer::GetElapsedMinutes() const { return std::chrono::duration_cast<std::chrono::minutes>(std::chrono::high_resolution_clock::now() - m_begin).count(); } ds_int64 CElapsedTimer::GetElapsedSeconds() const { return std::chrono::duration_cast<std::chrono::seconds>(std::chrono::high_resolution_clock::now() - m_begin).count(); } ds_int64 CElapsedTimer::GetElapsedNano() const { return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - m_begin).count(); } ds_int64 CElapsedTimer::GetElapsedMicro() const { return std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_begin).count(); } double CElapsedTimer::GetElapsed() const { return std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::high_resolution_clock::now() - m_begin).count(); } void CElapsedTimer::Reset() { m_begin = std::chrono::high_resolution_clock::now(); } CElapsedTimer::CElapsedTimer() : m_begin(std::chrono::high_resolution_clock::now()) { } NS_UTIL_END NS_DS_END
22.95
127
0.741612
dios-game
483f2f935ea9bb8a2fcd2cc98eec67bf3b2e90ec
11,343
cc
C++
mindspore/ccsrc/plugin/device/cpu/kernel/fractional_max_pool3d_grad_with_fixed_ksize_cpu_kernel.cc
httpsgithu/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
1
2022-02-23T09:13:43.000Z
2022-02-23T09:13:43.000Z
mindspore/ccsrc/plugin/device/cpu/kernel/fractional_max_pool3d_grad_with_fixed_ksize_cpu_kernel.cc
949144093/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
null
null
null
mindspore/ccsrc/plugin/device/cpu/kernel/fractional_max_pool3d_grad_with_fixed_ksize_cpu_kernel.cc
949144093/mindspore
c29d6bb764e233b427319cb89ba79e420f1e2c64
[ "Apache-2.0" ]
null
null
null
/** * Copyright 2021 Huawei Technologies Co., Ltd * * 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 "plugin/device/cpu/kernel/fractional_max_pool3d_grad_with_fixed_ksize_cpu_kernel.h" #include <algorithm> #include <cmath> #include <iostream> #include <limits> #include <utility> #include <vector> #include <string> #include "plugin/device/cpu/hal/device/cpu_device_address.h" namespace mindspore { namespace kernel { namespace { constexpr size_t kDimSize4 = 4; constexpr size_t kDimSize5 = 5; constexpr size_t kInputIndex0 = 0; constexpr size_t kInputIndex1 = 1; constexpr size_t kInputIndex2 = 2; constexpr size_t kFormatNCDHWIndexC = 0; constexpr size_t kFormatNCDHWIndexD = 1; constexpr size_t kFormatNCDHWIndexH = 2; constexpr size_t kFormatNCDHWIndexW = 3; constexpr size_t kFormatNDHWCIndexD = 0; constexpr size_t kFormatNDHWCIndexH = 1; constexpr size_t kFormatNDHWCIndexW = 2; constexpr size_t kFormatNDHWCIndexC = 3; constexpr size_t kInputsNum = 3; constexpr size_t kOutputsNum = 1; #define ADD_KERNEL(t1, t2, t3, t4) \ KernelAttr() \ .AddInputAttr(kNumberType##t1) \ .AddInputAttr(kNumberType##t2) \ .AddInputAttr(kNumberType##t3) \ .AddOutputAttr(kNumberType##t4) } // namespace void FractionalMaxPool3DGradWithFixedKsizeCPUKernelMod::InitKernel(const CNodePtr &kernel_node) { MS_EXCEPTION_IF_NULL(kernel_node); kernel_name_ = common::AnfAlgo::GetCNodeName(kernel_node); input_shape_ = AnfAlgo::GetInputDeviceShape(kernel_node, kInputIndex0); out_backprop_shape_ = AnfAlgo::GetInputDeviceShape(kernel_node, kInputIndex1); out_backprop_type_ = AnfAlgo::GetInputDeviceDataType(kernel_node, kInputIndex1); argmax_shape_ = AnfAlgo::GetInputDeviceShape(kernel_node, kInputIndex2); argmax_type_ = AnfAlgo::GetInputDeviceDataType(kernel_node, kInputIndex2); data_format_ = common::AnfAlgo::GetNodeAttr<string>(kernel_node, FORMAT); size_t input_dims = input_shape_.size(); size_t out_backprop_dims = out_backprop_shape_.size(); size_t argmax_dims = argmax_shape_.size(); if (data_format_ == "NCDHW") { c_dim_ = kFormatNCDHWIndexC; d_dim_ = kFormatNCDHWIndexD; h_dim_ = kFormatNCDHWIndexH; w_dim_ = kFormatNCDHWIndexW; if (input_shape_.size() == kDimSize5) { inputN_ = input_shape_[0]; c_dim_++; d_dim_++; h_dim_++; w_dim_++; } inputC_ = input_shape_[c_dim_]; inputD_ = input_shape_[d_dim_]; inputH_ = input_shape_[h_dim_]; inputW_ = input_shape_[w_dim_]; outputD_ = out_backprop_shape_[d_dim_]; outputH_ = out_backprop_shape_[h_dim_]; outputW_ = out_backprop_shape_[w_dim_]; } else { c_dim_ = kFormatNDHWCIndexC; d_dim_ = kFormatNDHWCIndexD; h_dim_ = kFormatNDHWCIndexH; w_dim_ = kFormatNDHWCIndexW; if (input_shape_.size() == kDimSize5) { inputN_ = input_shape_[0]; c_dim_++; d_dim_++; h_dim_++; w_dim_++; } inputC_ = input_shape_[c_dim_]; inputD_ = input_shape_[d_dim_]; inputH_ = input_shape_[h_dim_]; inputW_ = input_shape_[w_dim_]; outputD_ = out_backprop_shape_[d_dim_]; outputH_ = out_backprop_shape_[h_dim_]; outputW_ = out_backprop_shape_[w_dim_]; } if (!(input_dims == kDimSize4 || input_dims == kDimSize5)) { MS_EXCEPTION(TypeError) << "Input data dimensions must be equal to 4 or 5, but got " << input_dims; } for (size_t i = 0; i < input_dims; i++) { if (input_shape_[i] <= 0) { MS_EXCEPTION(ValueError) << "FractionalMaxPool3DGradWithFixedKsize: expected the " "input dimension cannot be empty"; } } if (!(out_backprop_dims == kDimSize4 || out_backprop_dims == kDimSize5)) { MS_EXCEPTION(TypeError) << "out_backprop data dimensions must be equal to 4 or 5, but got " << out_backprop_dims; } for (size_t i = 0; i < out_backprop_dims; i++) { if (out_backprop_shape_[i] <= 0) { MS_EXCEPTION(ValueError) << "FractionalMaxPool3DGradWithFixedKsize: expected the " "out_backprop dimension cannot be empty"; } } if (!(argmax_dims == kDimSize4 || argmax_dims == kDimSize5)) { MS_EXCEPTION(TypeError) << "argmax data dimensions must be equal to 4 or 5, but got " << argmax_dims; } for (size_t i = 0; i < argmax_dims; i++) { if (argmax_shape_[i] <= 0) { MS_EXCEPTION(ValueError) << "FractionalMaxPool3DGradWithFixedKsize: expected the " "argmax dimension cannot be empty"; } } } template <typename backprop_t, typename argmax_t> bool FractionalMaxPool3DGradWithFixedKsizeCPUKernelMod::GradComputeTemplate(const std::vector<AddressPtr> &inputs, const std::vector<AddressPtr> &outputs) { auto out_backprop_data = reinterpret_cast<backprop_t *>(inputs[1]->addr); auto argmax_data = reinterpret_cast<argmax_t *>(inputs[2]->addr); auto output_data = reinterpret_cast<backprop_t *>(outputs[0]->addr); size_t output_size = outputs[0]->size; if (memset_s(output_data, output_size, 0, output_size) != EOK) { MS_LOG(EXCEPTION) << "Output buffer memset failed."; } if (input_shape_.size() == kDimSize4) { auto shard_fractional_max_pool3d_grad_with_fixed_ksize = [&](size_t start, size_t end) { for (auto plane = start; plane < end; ++plane) { backprop_t *outputForPlane = output_data + plane * inputD_ * inputH_ * inputW_; backprop_t *outbackpropForPlane = out_backprop_data + plane * outputD_ * outputH_ * outputW_; argmax_t *argmaxForPlane = argmax_data + plane * outputD_ * outputH_ * outputW_; int64_t h, w, t; for (t = 0; t < outputD_; ++t) { for (h = 0; h < outputH_; ++h) { for (w = 0; w < outputW_; ++w) { argmax_t outputIndex = t * outputH_ * outputW_ + h * outputW_ + w; argmax_t index = argmaxForPlane[outputIndex]; if (index < 0 && index >= inputD_ * inputH_ * inputW_) { MS_LOG(EXCEPTION) << "FractionalMaxPool3DGradWithFixedKsize " "index value is illegal."; } outputForPlane[index] += outbackpropForPlane[outputIndex]; } } } } }; CPUKernelUtils::ParallelFor(shard_fractional_max_pool3d_grad_with_fixed_ksize, inputC_); } else { auto shard_fractional_max_pool3d_grad_with_fixed_ksize = [&](size_t start, size_t end) { for (auto batch = start; batch < end; ++batch) { for (int64_t plane = 0; plane < inputC_; ++plane) { auto output_data_n = output_data + batch * inputC_ * inputW_ * inputH_ * inputD_; auto out_backprop_data_n = out_backprop_data + batch * inputC_ * outputW_ * outputH_ * outputD_; auto argmax_data_n = argmax_data + batch * inputC_ * outputW_ * outputH_ * outputD_; backprop_t *outputForPlane = output_data_n + plane * inputD_ * inputH_ * inputW_; backprop_t *outbackpropForPlane = out_backprop_data_n + plane * outputD_ * outputH_ * outputW_; argmax_t *argmaxForPlane = argmax_data_n + plane * outputD_ * outputH_ * outputW_; int64_t h, w, t; for (t = 0; t < outputD_; ++t) { for (h = 0; h < outputH_; ++h) { for (w = 0; w < outputW_; ++w) { argmax_t outputIndex = t * outputH_ * outputW_ + h * outputW_ + w; argmax_t index = argmaxForPlane[outputIndex]; if (index < 0 && index >= inputD_ * inputH_ * inputW_) { MS_LOG(EXCEPTION) << "FractionalMaxPool3DGradWithFixedKsize " "index value is illegal."; } outputForPlane[index] += outbackpropForPlane[outputIndex]; } } } } } }; CPUKernelUtils::ParallelFor(shard_fractional_max_pool3d_grad_with_fixed_ksize, inputN_); } return true; } template <typename backprop_t> bool FractionalMaxPool3DGradWithFixedKsizeCPUKernelMod::DoComputeWithArgmaxType(const std::vector<AddressPtr> &inputs, const std::vector<AddressPtr> &outputs, TypeId argmax_type_) { switch (argmax_type_) { case kNumberTypeInt32: return GradComputeTemplate<backprop_t, int32_t>(inputs, outputs); case kNumberTypeInt64: return GradComputeTemplate<backprop_t, int64_t>(inputs, outputs); default: MS_EXCEPTION(TypeError) << "argmax_type" << argmax_type_ << "not support, must be in [{DT_INT32, DT_INT64}]."; return false; } } bool FractionalMaxPool3DGradWithFixedKsizeCPUKernelMod::Launch(const std::vector<AddressPtr> &inputs, const std::vector<AddressPtr> &workspace, const std::vector<AddressPtr> &outputs) { CHECK_KERNEL_INPUTS_NUM(inputs.size(), kInputsNum, kernel_name_); CHECK_KERNEL_OUTPUTS_NUM(outputs.size(), kOutputsNum, kernel_name_); switch (out_backprop_type_) { case kNumberTypeFloat16: return DoComputeWithArgmaxType<float16>(inputs, outputs, argmax_type_); case kNumberTypeFloat32: return DoComputeWithArgmaxType<float>(inputs, outputs, argmax_type_); case kNumberTypeFloat64: return DoComputeWithArgmaxType<double>(inputs, outputs, argmax_type_); case kNumberTypeInt32: return DoComputeWithArgmaxType<int32_t>(inputs, outputs, argmax_type_); case kNumberTypeInt64: return DoComputeWithArgmaxType<int64_t>(inputs, outputs, argmax_type_); default: MS_EXCEPTION(TypeError) << "out_backprop_type" << out_backprop_type_ << "not support, must be in [{DT_FLOAT16, DT_FLOAT, DT_DOUBLE, DT_INT32, DT_INT64}]."; } return true; } std::vector<KernelAttr> FractionalMaxPool3DGradWithFixedKsizeCPUKernelMod::GetOpSupport() { static std::vector<KernelAttr> kernel_attr_list = { ADD_KERNEL(Int32, Int32, Int32, Int32), ADD_KERNEL(Int64, Int64, Int32, Int64), ADD_KERNEL(Float16, Float16, Int32, Float16), ADD_KERNEL(Float32, Float32, Int32, Float32), ADD_KERNEL(Float64, Float64, Int32, Float64), ADD_KERNEL(Int32, Int32, Int64, Int32), ADD_KERNEL(Int64, Int64, Int64, Int64), ADD_KERNEL(Float16, Float16, Int64, Float16), ADD_KERNEL(Float32, Float32, Int64, Float32), ADD_KERNEL(Float64, Float64, Int64, Float64)}; return kernel_attr_list; } MS_KERNEL_FACTORY_REG(NativeCpuKernelMod, FractionalMaxPool3DGradWithFixedKsize, FractionalMaxPool3DGradWithFixedKsizeCPUKernelMod); } // namespace kernel } // namespace mindspore
45.372
119
0.664903
httpsgithu
c617798ac904d56e48a37c30273eadb25eee3ae2
6,897
cpp
C++
examples/logreg.cpp
haptork/easyLambda
2a8cae9c6e26517e301b5aa6f9c1518aa5a22417
[ "BSL-1.0" ]
537
2016-03-15T09:26:41.000Z
2022-01-18T02:44:56.000Z
examples/logreg.cpp
haptork/easyLambda
2a8cae9c6e26517e301b5aa6f9c1518aa5a22417
[ "BSL-1.0" ]
10
2016-03-15T11:56:00.000Z
2019-11-14T20:01:47.000Z
examples/logreg.cpp
haptork/easyLambda
2a8cae9c6e26517e301b5aa6f9c1518aa5a22417
[ "BSL-1.0" ]
55
2016-03-15T11:53:07.000Z
2020-12-27T02:53:21.000Z
/*! * @file * An example of logistic regression training and testing. * The data is taken from: * * command to run: * mpirung -n 4 ./bin/logreg "data/logreg/train.csv" * * For running on some different data-set specify the columns etc. in `fromFile` * Also change the `D` parameter and inFile variable. * Testing data files can be given as arguments after training data file. * * benchmarks at the bottom * */ #include <array> #include <iostream> #include <stdexcept> #include <ezl.hpp> #include <ezl/algorithms/io.hpp> #include <ezl/algorithms/reduceAlls.hpp> #include <ezl/algorithms/reduces.hpp> #include <ezl/algorithms/fromFile.hpp> using namespace std; using ezl::fromFile; using ezl::fromMem; using ezl::rise; using ezl::Karta; using ezl::llmode; using ezl::flow; template <size_t D> double calcNorm(const array<double, D> &weights, const array<double, D> &weightsNew) { auto sum = 0.; for (size_t i = 0; i < weights.size(); ++i) { auto minus = weights[i] - weightsNew[i]; sum += (minus * minus); } return sqrt(sum); } void logreg(int argc, char* argv[]) { std::string inFile = "data/logreg/train.csv"; if (argc < 2) { Karta::inst().print0("Provide args as glob pattern for train files followed" " by test file pattern(s). Continuing with default: " + inFile); } else { inFile = std::string(argv[1]); } constexpr auto D = 3; // number of features constexpr auto maxIters = 1000; // specify columns and other read properties if required. auto reader = fromFile<double, array<double, D>>(inFile).colSeparator(","); auto data = rise(reader).get(); // load once in memory if (data.empty()) { Karta::inst().print("no data"); return; } array<double, D> w{}, wn{}, grad{}; // weights initialised to zero; auto sumAr = [](auto &a, auto &b) -> auto & { // updating the reference transform(begin(b), end(b), begin(a), begin(a), plus<double>()); return a; }; auto sigmoid = [](double x) { return 1. / (1. + exp(-x)); }; auto calcGrad = [&](const double &y, array<double, D> x) { auto s = sigmoid(inner_product(begin(w), end(w), begin(x), 0.)) - y; for_each(begin(x), end(x), [&s](double& x) { x *= s; }); return x; }; // build flow for final gradient value in all procs auto train = rise(fromMem(data)).map(calcGrad).colsTransform() .reduce(sumAr, array<double, D>{}).inprocess() .reduce(sumAr, array<double, D>{}).prll(1., llmode::dupe) .build(); auto iters = 0; auto norm = 0.; while (iters++ < maxIters) { tie(grad) = flow(train).get()[0]; // running flow constexpr static auto gamma = 0.002; transform(begin(w), end(w), begin(grad), begin(wn), [](double a, double b) { return a - gamma * b;}); norm = calcNorm(wn, w); w = move(wn); constexpr auto epsilon = 0.0001; if(norm < epsilon) break; } Karta::inst().print0("iters: " + to_string(iters-1)); Karta::inst().print0("norm: " + to_string(norm)); // building testing flow auto testFlow = rise(reader) .map<2>([&](auto x) { auto pred = 0.; for (size_t i = 0; i < x.size(); ++i) { pred += w[i] * x[i]; } return (sigmoid(pred) > 0.5); }).colsTransform() .reduce<1, 2>(ezl::count(), 0) .dump("", "real-y, predicted-y, count") .build(); for (int i = 1; i < argc; ++i) { // testing all the file patterns reader = reader.filePattern(argv[i]); Karta::inst().print0("Testing file " + string(argv[i])); flow(testFlow).run(); } } int main(int argc, char *argv[]) { ezl::Env env{argc, argv, false}; try { logreg(argc, argv); } catch (const exception& ex) { cerr<<"error: "<<ex.what()<<'\n'; env.abort(1); } catch (...) { cerr<<"unknown exception\n"; env.abort(2); } return 0; } /*! * benchmark results: i7(hdd); input: 450MBs * *nprocs* | 1 | 2 | 4 | * --- |--- |--- |--- | * *time(s)*| 120 | 63 | 38 | * * benchmark results: Linux(lustre); input: 48GBs; iterations: 10; units: secs * *nprocs* | 1x24 | 2x24 | 4x24 | 8x24 | 16x24 | * --- |--- |--- |--- | --- | --- | * *time(s)*| 335 | 182 | 98 | 55 | 31 | * * benchmark results: Linux(lustre); input: weak; iterations: 10; units: secs * *nprocs* | 1x24 | 2x24 | 4x24 | 8x24 | 16x24 | * *input* | 3GB | 6GB | 12GB | 24GB | 48GB | * --- |--- |--- |--- | --- | --- | * *time(s)*| 22 | 22 | 26 | 26 | 29 | * --- |--- |--- |--- | --- | --- | * *nprocs* | 4x12 | 8x6 | 8x12 | 16x6 | * *input* | 6GB | 6GB | 12GB | 12GB | * --- |--- |--- |--- | --- | * *time(s)*| 23 | 23 | 27 | 26 | * * benchmark results: Linux(nfs-3); input: 48GBs; iterations: 10; units: secs * *nprocs* | 2x12 | 4x12 | 8x12 | 16x12 | * --- |--- |--- |--- | --- | * *time(s)*| 520 | 260 | 140 | 75 | * * benchmark results: Linux(nfs-3); input: weak; iterations: 10; units: secs * *nprocs* | 2x12 | 4x12 | 8x12 | 16x12 | * *input* | 3GB | 6GB | 12GB | 24GB | * --- |--- |--- |--- | --- | * *time(s)*| 31 | 31 | 34 | 32 / 90 | * --- |--- |--- |--- | --- | * *nprocs* | 4x6 | 8x6 | 16x6 | * *input* | 3GB | 6GB | 12GB | * --- |--- |--- |--- | * *time(s)*| 31 | 31 | 65 / 31 | * * **Remark:** the value with 16 x 12 / 16 x 6 sometimes takes long time * (~90secs / 65secs), usually when benchmark is run for the * first time. * * benchmark results: Linux(nfs-3); input: 2.9GBs; iterations: 100; units: secs * *nprocs* | 1x12 | 2x12 | 4x12 | 8x12 | 12x12 | * --- |--- |--- |--- | --- | | * *time(s)*| 190 | 91 | 50 | 36 | 34 | * * benchmark results: EC2(nfs-3); input: 2.2GBs; iterations: 10 ; units: secs * *nprocs* | 8 | 16 | 32 | * --- |--- |--- |--- | * *time(s)* ezl | 54 | 27 | 15 | * *time(s)* PySpark| 150 | 102 | 72 | * */
38.316667
80
0.46484
haptork
c61c06a60cbab435911aaf510ce4d13adeea461a
1,639
cc
C++
cpp/Max_difference_unlimited_pairs.cc
powernit/epicode
e81d4387d2ae442d21631dfc958690d424e1d84d
[ "MIT" ]
258
2016-07-18T03:28:15.000Z
2021-12-05T09:08:44.000Z
cpp/Max_difference_unlimited_pairs.cc
powernit/epicode
e81d4387d2ae442d21631dfc958690d424e1d84d
[ "MIT" ]
7
2016-08-13T22:12:29.000Z
2022-02-25T17:50:11.000Z
cpp/Max_difference_unlimited_pairs.cc
powernit/epicode
e81d4387d2ae442d21631dfc958690d424e1d84d
[ "MIT" ]
154
2016-07-18T06:29:24.000Z
2021-09-20T18:33:05.000Z
// Copyright (c) 2013 Elements of Programming Interviews. All rights reserved. #include <cassert> #include <iostream> #include <limits> #include <random> #include <vector> using std::cout; using std::default_random_engine; using std::endl; using std::numeric_limits; using std::random_device; using std::uniform_int_distribution; using std::vector; // @include int MaxProfitUnlimitedPairs(const vector<int> &A) { int profit = 0; for (int i = 1; i < A.size(); ++i) { int delta = A[i] - A[i - 1]; if (delta > 0) { profit += delta; } } return profit; } // @exclude int CheckAns(const vector<int> &A) { int profit = 0; for (int i = 1; i < A.size(); ++i) { if (A[i] > A[i - 1]) { profit += A[i] - A[i - 1]; } } return profit; } int main(int argc, char *argv[]) { default_random_engine gen((random_device())()); int n = 5; // random tests for n = 40, k = 4 for 100 times for (int times = 0; times < 100; ++times) { vector<int> A; uniform_int_distribution<int> dis(0, 99); for (int i = 0; i < n; ++i) { A.emplace_back(dis(gen)); } cout << "n = " << n << endl; cout << CheckAns(A) << endl; cout << MaxProfitUnlimitedPairs(A) << endl; assert(CheckAns(A) == MaxProfitUnlimitedPairs(A)); } // For input if (argc == 2) { n = atoi(argv[1]); } else { uniform_int_distribution<int> dis(1, 10000); n = dis(gen); } vector<int> A; uniform_int_distribution<int> dis(0, 99); for (int i = 0; i < n; ++i) { A.emplace_back(dis(gen)); } cout << "n = " << n << endl; cout << MaxProfitUnlimitedPairs(A) << endl; return 0; }
22.452055
78
0.586333
powernit
c61c69c6b974c2fd62a077ae3a621f286c6f3ebf
26,670
cpp
C++
win/devkit/plug-ins/gpuCache/gpuCacheSample.cpp
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
10
2018-03-30T16:09:02.000Z
2021-12-07T07:29:19.000Z
win/devkit/plug-ins/gpuCache/gpuCacheSample.cpp
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
null
null
null
win/devkit/plug-ins/gpuCache/gpuCacheSample.cpp
leegoonz/Maya-devkit
b81fe799b58e854e4ef16435426d60446e975871
[ "ADSL" ]
9
2018-06-02T09:18:49.000Z
2021-12-20T09:24:35.000Z
//- //**************************************************************************/ // Copyright 2015 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk // license agreement provided at the time of installation or download, // or which otherwise accompanies this software in either electronic // or hard copy form. //**************************************************************************/ //+ #include "gpuCacheSample.h" #include "gpuCacheVBOProxy.h" #include <Alembic/Util/Murmur3.h> #include <boost/weak_ptr.hpp> #include <boost/unordered_map.hpp> #include <boost/foreach.hpp> #include <cassert> namespace { using namespace GPUCache; //============================================================================== // LOCAL FUNCTIONS & CLASSES //============================================================================== //============================================================================== // CLASS ArrayBaseImp //============================================================================== class ArrayBaseImp { public: typedef ArrayBase::Callback Callback; typedef ArrayBase::Key Key; static void registerCreationCallback(Callback callback) { creationCallbacks.push_back(callback); } static void unregisterCreationCallback(Callback callback) { Callbacks::iterator it = std::find( creationCallbacks.begin(), creationCallbacks.end(), callback); if (it != creationCallbacks.end()) { creationCallbacks.erase(it); } } static void invokeCreationCallback(const Key& key) { BOOST_FOREACH(const Callback& callback, creationCallbacks) { (*callback)(key); } } static void registerDestructionCallback(Callback callback) { destructionCallbacks.push_back(callback); } static void unregisterDestructionCallback(Callback callback) { Callbacks::iterator it = std::find( destructionCallbacks.begin(), destructionCallbacks.end(), callback); if (it != destructionCallbacks.end()) { destructionCallbacks.erase(it); } } static void invokeDestructionCallback(const Key& key) { BOOST_FOREACH(const Callback& callback, destructionCallbacks) { (*callback)(key); } } private: typedef std::vector<ArrayBase::Callback> Callbacks; static Callbacks creationCallbacks; static Callbacks destructionCallbacks; }; ArrayBaseImp::Callbacks ArrayBaseImp::creationCallbacks; ArrayBaseImp::Callbacks ArrayBaseImp::destructionCallbacks; //============================================================================== // CLASS ArrayRegistryImp //============================================================================== template <typename T> class ArrayRegistryImp { public: typedef ArrayBase::Digest Digest; typedef ArrayBase::Key Key; typedef ArrayBase::KeyHash KeyHash; typedef ArrayBase::KeyEqualTo KeyEqualTo; static ArrayRegistryImp<T>& singleton() { return fsSingleton; } ~ArrayRegistryImp() { // Unfortunately, we can't check that all buffers have been // freed here. The reason is Maya does not take the time to // clean-up the dependency graph when exiting. Therefore, // there might still exist some ShapeNode alived at exit time // and these will indirectly keep these buffers alive. // // The way to check that the mechanism is working correctly is // therefore to perform the following MEL commands "file -f // -new; gpuCache -q -sgs;" and check that everything has // been freed. The gpuCache regression test does that. // // assert(fMap.size() == 0); } tbb::mutex& mutex() { return fMutex; } boost::shared_ptr<Array<T> > lookup( const Digest& digest, size_t size ) { // Caller will accept either readable or non-readable. First look for non-readable. boost::shared_ptr<Array<T> > ret = lookupNonReadable(digest, size); if (!ret) { ret = lookupReadable(digest, size); } return ret; } boost::shared_ptr<Array<T> > lookupNonReadable( const Digest& digest, size_t size ) { typename Map::const_iterator it = fMapNonReadable.find(Key(size * sizeof(T), digest)); if (it != fMapNonReadable.end()) { // Might return null if the weak_ptr<> is now dangling // but not yet removed from the map... boost::shared_ptr<Array<T> > ret = it->second.lock(); if (!ret) { fMapNonReadable.erase(it); } return ret; } else { return boost::shared_ptr<Array<T> >(); } } boost::shared_ptr<ReadableArray<T> > lookupReadable( const Digest& digest, size_t size ) { typename MapReadable::const_iterator it = fMapReadable.find(Key(size * sizeof(T), digest)); if (it != fMapReadable.end()) { // Might return null if the weak_ptr<> is now dangling // but not yet removed from the map... boost::shared_ptr<ReadableArray<T> > ret = it->second.lock(); if (!ret) { fMapReadable.erase(it); } return ret; } else { return boost::shared_ptr<ReadableArray<T> >(); } } void insert(boost::shared_ptr<Array<T> > array) { if (array->isReadable()) { fMapReadable.insert(std::make_pair(array->key(), array->getReadableArray())); } else { fMapNonReadable.insert(std::make_pair(array->key(), array)); } } void removeIfStaled(const Key& key, bool readable) { if (readable) { typename MapReadable::const_iterator it = fMapReadable.find(key); if (it != fMapReadable.end()) { // Might return null if the weak_ptr<> is now dangling // but not yet removed from the map... boost::shared_ptr<Array<T> > ret = it->second.lock(); if (!ret) { // Get rid of the stalled entry so that insert() can // work properly. fMapReadable.erase(it); } } } else { typename Map::const_iterator it = fMapNonReadable.find(key); if (it != fMapNonReadable.end()) { // Might return null if the weak_ptr<> is now dangling // but not yet removed from the map... boost::shared_ptr<Array<T> > ret = it->second.lock(); if (!ret) { // Get rid of the stalled entry so that insert() can // work properly. fMapNonReadable.erase(it); } } } } private: typedef boost::unordered_map< Key, boost::weak_ptr<Array<T> >, KeyHash, KeyEqualTo> Map; typedef boost::unordered_map< Key, boost::weak_ptr<ReadableArray<T> >, KeyHash, KeyEqualTo> MapReadable; static ArrayRegistryImp fsSingleton; tbb::mutex fMutex; Map fMapNonReadable; MapReadable fMapReadable; }; template <typename T> ArrayRegistryImp<T> ArrayRegistryImp<T>::fsSingleton; template class ArrayRegistryImp<IndexBuffer::index_t>; template class ArrayRegistryImp<float>; //============================================================================== // CLASS IndexBufferRegistry //============================================================================== class IndexBufferRegistry { public: typedef IndexBuffer::index_t index_t; typedef IndexBuffer::Key Key; typedef IndexBuffer::KeyHash KeyHash; typedef IndexBuffer::KeyEqualTo KeyEqualTo; static IndexBufferRegistry& singleton() { return fsSingleton; } ~IndexBufferRegistry() {} tbb::mutex& mutex() { return fMutex; } boost::shared_ptr<IndexBuffer> lookup( const boost::shared_ptr<Array<index_t> >& array, const size_t beginIdx, const size_t endIdx ) { Map::const_iterator it = fMap.find(Key(array, beginIdx, endIdx)); if (it != fMap.end()) { // Might return null if the weak_ptr<> is now dangling // but not yet removed from the map... boost::shared_ptr<IndexBuffer> ret = it->second.lock(); if (!ret) { // Get rid of the stalled entry so that insert() can // work properly. fMap.erase(it); } return ret; } else { return boost::shared_ptr<IndexBuffer>(); } } void insert(boost::shared_ptr<IndexBuffer> buffer) { fMap.insert( std::make_pair( Key(buffer->array(), buffer->beginIdx(), buffer->endIdx()), buffer)); } void removeIfStaled( const boost::shared_ptr<Array<index_t> >& array, const size_t beginIdx, const size_t endIdx ) { Map::const_iterator it = fMap.find(Key(array, beginIdx, endIdx)); if (it != fMap.end()) { // Might return null if the weak_ptr<> is now dangling // but not yet removed from the map... boost::shared_ptr<IndexBuffer> ret = it->second.lock(); if (!ret) { // Get rid of the stalled entry so that insert() can // work properly. fMap.erase(it); } } } size_t nbAllocated() { return fMap.size(); } size_t nbAllocatedBytes() { size_t bytes = 0; BOOST_FOREACH(const Map::value_type& v, fMap) { boost::shared_ptr<IndexBuffer> buf = v.second.lock(); if (buf) { bytes += buf->bytes(); } } return bytes; } private: typedef boost::unordered_map< Key, boost::weak_ptr<IndexBuffer>, KeyHash, KeyEqualTo > Map; static IndexBufferRegistry fsSingleton; tbb::mutex fMutex; Map fMap; }; IndexBufferRegistry IndexBufferRegistry::fsSingleton; //============================================================================== // CLASS VertexBufferRegistry //============================================================================== class VertexBufferRegistry { public: typedef VertexBuffer::Key Key; typedef VertexBuffer::KeyHash KeyHash; typedef VertexBuffer::KeyEqualTo KeyEqualTo; static VertexBufferRegistry& singleton() { return fsSingleton; } ~VertexBufferRegistry() {} tbb::mutex& mutex() { return fMutex; } boost::shared_ptr<VertexBuffer> lookup( const boost::shared_ptr<Array<float> >& array, const MHWRender::MVertexBufferDescriptor& desc ) { Map::const_iterator it = fMap.find(Key(array, desc)); if (it != fMap.end()) { // Might return null if the weak_ptr<> is now dangling // but not yet removed from the map... boost::shared_ptr<VertexBuffer> ret = it->second.lock(); if (!ret) { // Get rid of the stalled entry so that insert() can // work properly. fMap.erase(it); } return ret; } else { return boost::shared_ptr<VertexBuffer>(); } } void insert(boost::shared_ptr<VertexBuffer> buffer) { fMap.insert( std::make_pair( Key(buffer->array(), buffer->descriptor()), buffer)); } void removeIfStaled( const boost::shared_ptr<Array<float> >& array, const MHWRender::MVertexBufferDescriptor& desc ) { Map::const_iterator it = fMap.find(Key(array, desc)); if (it != fMap.end()) { // Might return null if the weak_ptr<> is now dangling // but not yet removed from the map... boost::shared_ptr<VertexBuffer> ret = it->second.lock(); if (!ret) { // Get rid of the stalled entry so that insert() can // work properly. fMap.erase(it); } } } size_t nbAllocated() { return fMap.size(); } size_t nbAllocatedBytes() { size_t bytes = 0; BOOST_FOREACH(const Map::value_type& v, fMap) { boost::shared_ptr<VertexBuffer> buf = v.second.lock(); if (buf) { bytes += buf->bytes(); } } return bytes; } private: typedef boost::unordered_map< Key, boost::weak_ptr<VertexBuffer>, KeyHash, KeyEqualTo > Map; static VertexBufferRegistry fsSingleton; tbb::mutex fMutex; Map fMap; }; VertexBufferRegistry VertexBufferRegistry::fsSingleton; } namespace GPUCache { //============================================================================== // CLASS ArrayBase //============================================================================== void ArrayBase::registerCreationCallback(Callback callback) { ArrayBaseImp::registerCreationCallback(callback); } void ArrayBase::unregisterCreationCallback(Callback callback) { ArrayBaseImp::unregisterCreationCallback(callback); } void ArrayBase::registerDestructionCallback(Callback callback) { ArrayBaseImp::registerDestructionCallback(callback); } void ArrayBase::unregisterDestructionCallback(Callback callback) { ArrayBaseImp::unregisterDestructionCallback(callback); } ArrayBase::ArrayBase(size_t bytes, const Digest& digest, bool isReadable) : fKey(bytes, digest) , fIsReadable(isReadable) { ArrayBaseImp::invokeCreationCallback(fKey); } ArrayBase::~ArrayBase() { ArrayBaseImp::invokeDestructionCallback(fKey); } //============================================================================== // CLASS ArrayReadInterface //============================================================================== template class ArrayReadInterface<IndexBuffer::index_t>; template class ArrayReadInterface<float>; //============================================================================== // CLASS Array //============================================================================== template <typename T> Array<T>::~Array() { tbb::mutex::scoped_lock lock(ArrayRegistryImp<T>::singleton().mutex()); ArrayRegistryImp<T>::singleton().removeIfStaled(key(), isReadable()); } template class Array<IndexBuffer::index_t>; template class Array<float>; //============================================================================== // CLASS ReadableArray //============================================================================== template class ReadableArray<IndexBuffer::index_t>; template class ReadableArray<float>; //============================================================================== // CLASS ArrayRegistry //============================================================================== template <typename T> tbb::mutex& ArrayRegistry<T>::mutex() { return ArrayRegistryImp<T>::singleton().mutex(); } template <typename T> boost::shared_ptr<Array<T> > ArrayRegistry<T>::lookup( const Digest& digest, size_t size ) { boost::shared_ptr<Array<T> > result = ArrayRegistryImp<T>::singleton().lookup(digest, size); assert(!result || result->digest() == digest); assert(!result || result->bytes() == size * sizeof(T)); return result; } template <typename T> boost::shared_ptr<Array<T> > ArrayRegistry<T>::lookupNonReadable( const Digest& digest, size_t size ) { boost::shared_ptr<Array<T> > result = ArrayRegistryImp<T>::singleton().lookupNonReadable(digest, size); assert(!result || result->digest() == digest); assert(!result || result->bytes() == size * sizeof(T)); return result; } template <typename T> boost::shared_ptr<ReadableArray<T> > ArrayRegistry<T>::lookupReadable( const Digest& digest, size_t size ) { boost::shared_ptr<ReadableArray<T> > result = ArrayRegistryImp<T>::singleton().lookupReadable(digest, size); assert(!result || result->digest() == digest); assert(!result || result->bytes() == size * sizeof(T)); return result; } template <typename T> void ArrayRegistry<T>::insert( boost::shared_ptr<Array<T> > array ) { ArrayRegistryImp<T>::singleton().insert(array); } template class ArrayRegistry<IndexBuffer::index_t>; template class ArrayRegistry<float>; //============================================================================== // CLASS SharedArray //============================================================================== template <typename T> boost::shared_ptr<ReadableArray<T> > SharedArray<T>::create( const boost::shared_array<T>& data, size_t size) { // Compute the Murmur3 cryptographic hash-key. Digest digest; Alembic::Util::MurmurHash3_x64_128( data.get(), size * sizeof(T), sizeof(T), digest.words); return create(data, digest, size); } template <typename T> boost::shared_ptr<ReadableArray<T> > SharedArray<T>::create( const boost::shared_array<T>& data, Digest digest, size_t size) { // We first look if a similar array already exists in the // cache. If so, we return the cached array to promote sharing as // much as possible. boost::shared_ptr<ReadableArray<T> > ret; { tbb::mutex::scoped_lock lock(ArrayRegistry<T>::mutex()); ret = ArrayRegistry<T>::lookupReadable(digest, size); if (!ret) { ret = boost::make_shared<SharedArray<T> >( data, size, digest); ArrayRegistry<T>::insert(ret); } } return ret; } template <typename T> SharedArray<T>::~SharedArray() {} template <typename T> const T* SharedArray<T>::get() const { return fData.get(); } template class SharedArray<IndexBuffer::index_t>; template class SharedArray<float>; //============================================================================== // CLASS IndexBuffer //============================================================================== boost::shared_ptr<IndexBuffer> IndexBuffer::create( const boost::shared_ptr<Array<index_t> >& array, const size_t beginIdx, const size_t endIdx ) { // We first look if a similar array already exists in the // cache. If so, we return the cached array to promote sharing as // much as possible. boost::shared_ptr<IndexBuffer> ret; { tbb::mutex::scoped_lock lock( IndexBufferRegistry::singleton().mutex()); ret = IndexBufferRegistry::singleton().lookup( array, beginIdx, endIdx); if (!ret) { ret = boost::make_shared<IndexBuffer>( array, beginIdx, endIdx); IndexBufferRegistry::singleton().insert(ret); } } return ret; } size_t IndexBuffer::nbAllocated() { tbb::mutex::scoped_lock lock( IndexBufferRegistry::singleton().mutex()); return IndexBufferRegistry::singleton().nbAllocated(); } size_t IndexBuffer::nbAllocatedBytes() { tbb::mutex::scoped_lock lock( IndexBufferRegistry::singleton().mutex()); return IndexBufferRegistry::singleton().nbAllocatedBytes(); } IndexBuffer::~IndexBuffer() { tbb::mutex::scoped_lock lock( IndexBufferRegistry::singleton().mutex()); IndexBufferRegistry::singleton().removeIfStaled( fArray, fBeginIdx, fEndIdx); } void IndexBuffer::ReplaceArrayInstance(boost::shared_ptr<Array<index_t> >& newArray) const { assert(ArrayBase::KeyEqualTo()(fArray->key(), newArray->key())); if (fArray != newArray) { boost::shared_ptr<Array<index_t> >& nonConstArray = const_cast<boost::shared_ptr<Array<index_t> >& >(fArray); nonConstArray = newArray; } } //============================================================================== // CLASS VertexBuffer //============================================================================== boost::shared_ptr<VertexBuffer> VertexBuffer::createPositions( const boost::shared_ptr<Array<float> >& array) { return create(array, MHWRender::MVertexBufferDescriptor( MString(""), MHWRender::MGeometry::kPosition, MHWRender::MGeometry::kFloat, 3)); } boost::shared_ptr<VertexBuffer> VertexBuffer::createNormals( const boost::shared_ptr<Array<float> >& array) { return create(array, MHWRender::MVertexBufferDescriptor( MString(""), MHWRender::MGeometry::kNormal, MHWRender::MGeometry::kFloat, 3)); } boost::shared_ptr<VertexBuffer> VertexBuffer::createUVs( const boost::shared_ptr<Array<float> >& array) { return create( array, MHWRender::MVertexBufferDescriptor( MString("mayaUVIn"), MHWRender::MGeometry::kTexture, MHWRender::MGeometry::kFloat, 2)); } boost::shared_ptr<VertexBuffer> VertexBuffer::create( const boost::shared_ptr<Array<float> >& array, const MHWRender::MVertexBufferDescriptor& desc) { // We first look if a similar array already exists in the // cache. If so, we return the cached array to promote sharing as // much as possible. boost::shared_ptr<VertexBuffer> ret; { tbb::mutex::scoped_lock lock( VertexBufferRegistry::singleton().mutex()); ret = VertexBufferRegistry::singleton().lookup(array, desc); if (!ret) { ret = boost::make_shared<VertexBuffer>( array, desc); VertexBufferRegistry::singleton().insert(ret); } } return ret; } size_t VertexBuffer::nbAllocated() { tbb::mutex::scoped_lock lock( VertexBufferRegistry::singleton().mutex()); return VertexBufferRegistry::singleton().nbAllocated(); } size_t VertexBuffer::nbAllocatedBytes() { tbb::mutex::scoped_lock lock( VertexBufferRegistry::singleton().mutex()); return VertexBufferRegistry::singleton().nbAllocatedBytes(); } VertexBuffer::~VertexBuffer() { tbb::mutex::scoped_lock lock( VertexBufferRegistry::singleton().mutex()); VertexBufferRegistry::singleton().removeIfStaled( fArray, fDescriptor); } void VertexBuffer::ReplaceArrayInstance(boost::shared_ptr<Array<float> >& newArray) const { assert(ArrayBase::KeyEqualTo()(fArray->key(), newArray->key())); if (fArray != newArray) { boost::shared_ptr<Array<float> >& nonConstArray = const_cast<boost::shared_ptr<Array<float> >& >(fArray); nonConstArray = newArray; } } //============================================================================== // CLASS ShapeSample //============================================================================== ShapeSample::ShapeSample( double timeInSeconds, size_t numWires, size_t numVerts, const boost::shared_ptr<IndexBuffer>& wireVertIndices, const boost::shared_ptr<IndexBuffer>& triangleVertIndices, const boost::shared_ptr<VertexBuffer>& positions, const MBoundingBox& boundingBox, const MColor& diffuseColor, bool visibility ) : fTimeInSeconds(timeInSeconds), fNumWires(numWires), fNumVerts(numVerts), fWireVertIndices(wireVertIndices), fTriangleVertIndices( std::vector<boost::shared_ptr<IndexBuffer> >(1, triangleVertIndices)), fPositions(positions), fBoundingBox(boundingBox), fDiffuseColor(diffuseColor), fVisibility(visibility), fBoundingBoxPlaceHolder(false) { assert( wireVertIndices ? (wireVertIndices->numIndices() == 2 * fNumWires) : (fNumWires == 0) ); assert( positions ? (positions->numVerts() == fNumVerts) : (fNumVerts == 0) ); } ShapeSample::ShapeSample( double timeInSeconds, size_t numWires, size_t numVerts, const boost::shared_ptr<IndexBuffer>& wireVertIndices, const std::vector<boost::shared_ptr<IndexBuffer> >& triangleVertIndices, const boost::shared_ptr<VertexBuffer>& positions, const MBoundingBox& boundingBox, const MColor& diffuseColor, bool visibility ) : fTimeInSeconds(timeInSeconds), fNumWires(numWires), fNumVerts(numVerts), fWireVertIndices(wireVertIndices), fTriangleVertIndices(triangleVertIndices), fPositions(positions), fBoundingBox(boundingBox), fDiffuseColor(diffuseColor), fVisibility(visibility), fBoundingBoxPlaceHolder(false) { assert( wireVertIndices ? (wireVertIndices->numIndices() == 2 * fNumWires) : (fNumWires == 0) ); assert( positions ? (positions->numVerts() == fNumVerts) : (fNumVerts == 0) ); } ShapeSample::~ShapeSample() {} size_t ShapeSample::numTriangles() const { size_t result = 0; for(size_t i=0; i<numIndexGroups(); ++i) { result += numTriangles(i); } return result; } void ShapeSample::setNormals( const boost::shared_ptr<VertexBuffer>& normals ) { assert( !normals || normals->numVerts() == fNumVerts ); fNormals = normals; } void ShapeSample::setUVs( const boost::shared_ptr<VertexBuffer>& uvs ) { assert( !uvs || uvs->numVerts() == fNumVerts ); fUVs = uvs; } }
30.067644
118
0.541395
leegoonz
c61fefb57288bfadbe5fb89cf78c995d48351ae8
17,082
cpp
C++
src/core/graphics/basic_renderer.cpp
Caravetta/Engine
6e2490a68727dc731b466335499f3204490acc5f
[ "MIT" ]
2
2018-05-21T02:12:50.000Z
2019-04-23T20:56:00.000Z
src/core/graphics/basic_renderer.cpp
Caravetta/Engine
6e2490a68727dc731b466335499f3204490acc5f
[ "MIT" ]
12
2018-05-30T13:15:25.000Z
2020-02-02T21:29:42.000Z
src/core/graphics/basic_renderer.cpp
Caravetta/Engine
6e2490a68727dc731b466335499f3204490acc5f
[ "MIT" ]
2
2018-06-14T19:03:29.000Z
2018-12-30T07:37:22.000Z
#include "basic_renderer.h" #include "ecs.h" #include "gtx/string_cast.hpp" namespace Engine { char light_pass_vert[] = " \ #version 330 core\n \ \ layout(location = 0) in vec3 vertexPosition_modelspace;\n \ \ out vec2 uv;\n \ \ void main(){\n \ gl_Position = vec4(vertexPosition_modelspace, 1);\n \ uv = (vertexPosition_modelspace.xy+vec2(1,1))/2.0;\n \ }\n \ "; char light_pass_frag[] = " \ #version 330 core\n \ \ out vec4 FragColor;\n \ \ in vec2 uv;\n \ \ uniform sampler2D gPosition;\n \ uniform sampler2D gNormal;\n \ uniform sampler2D gAlbedoSpec;\n \ \ struct Light {\n \ vec3 Position;\n \ vec3 Color;\n \ float Linear;\n \ float Quadratic;\n \ };\n \ \ void main()\n \ {\n \ vec3 viewPos = vec3(0, 0, 0);\n \ \ Light light;\n \ light.Position = vec3(0.5, 0.1, -7);\n \ light.Color = vec3(1, 1, 0);\n \ light.Linear = 0.7;\n \ light.Quadratic = 1.8;\n \ \ // retrieve data from gbuffer\n \ vec3 FragPos = texture(gPosition, uv).rgb;\n \ vec3 Normal = texture(gNormal, uv).rgb;\n \ vec3 Diffuse = texture(gAlbedoSpec, uv).rgb;\n \ \ // then calculate lighting as usual\n \ vec3 lighting = Diffuse * 0.9; // hard-coded ambient component\n \ vec3 viewDir = normalize(viewPos - FragPos);\n \ \ // diffuse\n \ vec3 lightDir = normalize(light.Position - FragPos);\n \ vec3 diffuse = max(dot(Normal, lightDir), 0.0) * Diffuse * light.Color;\n \ // attenuation\n \ float distance = length(light.Position - FragPos);\n \ float attenuation = 1.0 / (1.0 + light.Linear * distance + light.Quadratic * distance * distance);\n \ diffuse *= attenuation;\n \ lighting += diffuse;\n \ FragColor = vec4(lighting, 1.0);\n \ }\n \ "; char pass_frag1[] = " \ #version 330 core\n \ out vec4 color;\n \ in vec2 uv;\n \ \ uniform sampler2D text;\n \ mat3 sx = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );\n \ mat3 sy = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );\n \ void main()\n \ {\n \ vec3 diffuse = texture(text, uv.st).rgb;\n \ mat3 I;\n \ for (int i=0; i<3; i++) {\n \ for (int j=0; j<3; j++) {\n \ vec3 sample = texelFetch(text, ivec2(gl_FragCoord) + ivec2(i-1,j-1), 0 ).rgb;\n \ I[i][j] = length(sample);\n \ }\n \ }\n \ float gx = dot(sx[0], I[0]) + dot(sx[1], I[1]) + dot(sx[2], I[2]);\n \ float gy = dot(sy[0], I[0]) + dot(sy[1], I[1]) + dot(sy[2], I[2]);\n \ float g = sqrt(pow(gx, 2.0)+pow(gy, 2.0));\n \ color = vec4(diffuse - vec3(g), 1.0);\n \ }\n \ "; Engine::Render_Texture* _outline; struct Outline_Pass : public Engine::Render_Pass { Engine::Material* _material; Outline_Pass( Engine::Material& material ) { _material = &material; }; void configure( void ) { Engine::Camera camera = get_active_camera(); Engine::Render_Texture_Info texture_info(camera.window->width(), camera.window->height(), Engine::Texture_Format::RGB_FORMAT, Engine::Data_Type::UNSIGNED_BYTE); _outline = new (std::nothrow) Engine::Render_Texture(texture_info); }; void execute( Engine::Render_Context& context ) { blit(context, *context.get_color_texture(Engine::Attachment_Type::COLOR_ATTACHMENT_0), *_outline, *_material); }; void cleanup( void ) { }; }; Outline_Pass* outline_pass; int width = 0; int height = 0; void Basic_Renderer::init( void ) { // Setup G Buffer Engine::Render_Texture_Info format(800, 600, Engine::Texture_Format::RGB_16F_FORMAT, Engine::Texture_Format::RGB_FORMAT, Engine::Data_Type::FLOAT_DATA); position_texture = new Engine::Render_Texture(format); normal_texture = new Engine::Render_Texture(format); Engine::Render_Texture_Info albformat(800, 600, Engine::Texture_Format::RGB_FORMAT, Engine::Texture_Format::RGB_FORMAT, Engine::Data_Type::UNSIGNED_BYTE); albedo_texture = new Engine::Render_Texture(albformat); lighting_texture = new Engine::Render_Texture(albformat); Engine::Render_Texture_Info depthformat(800, 600, Engine::Texture_Format::DEPTH24_STENCIL8_FORMAT, Engine::Texture_Format::DEPTH_STENCIL, Engine::Data_Type::UNSIGNED_INT_24_8); depth_texture = new Engine::Render_Texture(depthformat); std::vector<Engine::Shader_String> shader_strings = {{Engine::VERTEX_SHADER, light_pass_vert, sizeof(light_pass_vert)}, {Engine::FRAGMENT_SHADER, pass_frag1, sizeof(pass_frag1)}}; lighting_shader = new Engine::Shader(shader_strings); Engine::add_shader(lighting_shader->id(), *lighting_shader); outline_material.shader_id = lighting_shader->id(); outline_pass = new Outline_Pass(outline_material); outline_pass->configure(); #if 1 std::vector<Engine::Shader_String> shader_strings1 = {{Engine::VERTEX_SHADER, light_pass_vert, sizeof(light_pass_vert)}, {Engine::FRAGMENT_SHADER, light_pass_frag, sizeof(light_pass_frag)}}; lighting_shader1 = new Engine::Shader(shader_strings1); #endif } int l_width = 800; int l_height = 600; void Basic_Renderer::update( float time_step ) { Engine::Entity_Group group({Engine::component_id<Engine::Mesh_Info>(), Engine::component_id<Engine::Transform>(), Engine::component_id<Engine::Material>()}); Engine::Component_Data_Array<Engine::Transform> trans_infos(group); Engine::Component_Data_Array<Engine::Mesh_Info> mesh_infos(group); Engine::Component_Data_Array<Engine::Material> material_infos(group); Engine::Camera camera = get_active_camera(); // Check to see if we need to regen textures since window changed size //REMOVE if ( width != camera.window->width() || height != camera.window->height() ) { width = camera.window->width(); height = camera.window->height(); position_texture->reload(width, height); normal_texture->reload(width, height); albedo_texture->reload(width, height); lighting_texture->reload(width, height); depth_texture->reload(width, height); _outline->reload(width, height); l_width = width; l_height = height; } Engine::Render_Context* render_context = Engine::Render_Context::instance(); size_t num_entites = trans_infos.size(); // Attach the G Buffer render_context->bind(); render_context->set_color_texture(albedo_texture, Engine::Attachment_Type::COLOR_ATTACHMENT_0); render_context->set_color_texture(position_texture, Engine::Attachment_Type::COLOR_ATTACHMENT_1); render_context->set_color_texture(normal_texture, Engine::Attachment_Type::COLOR_ATTACHMENT_2); render_context->set_depth_texture(depth_texture); Engine::graphics_clear(Engine::COLOR_BUFFER_CLEAR | Engine::DEPTH_BUFFER_CLEAR); Engine::Attachment_Type attachments[3] = { Engine::Attachment_Type::COLOR_ATTACHMENT_0, Engine::Attachment_Type::COLOR_ATTACHMENT_1, Engine::Attachment_Type::COLOR_ATTACHMENT_2 }; Engine::set_draw_buffers(attachments, 3); Engine::enable_graphics_option(Engine::DEPTH_TEST_OPTION); Engine::set_depth_func(Engine::DEPTH_LESS_FUNC); Engine::graphics_clear(Engine::COLOR_BUFFER_CLEAR | Engine::DEPTH_BUFFER_CLEAR); /** Start G Buffer Pass **/ for ( size_t ii = 0; ii < num_entites; ii++ ) { Engine::Transform trans = trans_infos[ii]; Engine::Mesh_Info mesh_info = mesh_infos[ii]; Engine::Material material = material_infos[ii]; Shader shader = get_shader(material.shader_id); use_program(shader.id()); size_t indc = 0; Engine::bind_mesh(mesh_info.handle, indc); Engine::Matrix4f model_transform = Engine::model_transform(trans.position, trans.scale, trans.rotation); int mvp_location = shader.uniform_id("per"); if ( mvp_location != -1 ) { shader.set_uniform_mat4(mvp_location, (Engine::Matrix4f*)&camera.perspective); } mvp_location = shader.uniform_id("view"); if ( mvp_location != -1 ) { shader.set_uniform_mat4(mvp_location, (Engine::Matrix4f*)&camera.view); } mvp_location = shader.uniform_id("model"); if ( mvp_location != -1 ) { shader.set_uniform_mat4(mvp_location, (Engine::Matrix4f*)&model_transform); } Engine::draw_elements_data(Engine::TRIANGLE_MODE, indc, Engine::UNSIGNED_INT, 0); } Engine::disable_graphics_option(Engine::DEPTH_TEST_OPTION); render_context->clear_color_texture(Engine::Attachment_Type::COLOR_ATTACHMENT_1); render_context->clear_color_texture(Engine::Attachment_Type::COLOR_ATTACHMENT_2); /** End G Buffer Pass **/ // render passes go here outline_pass->execute(*render_context); /** Start Lighting Pass **/ Engine::Render_Texture* end_texure = render_context->get_color_texture(Engine::Attachment_Type::COLOR_ATTACHMENT_0); Engine::bind_texture(Texture_Unit::TEXTURE_UNIT_0, position_texture->texture()); Engine::bind_texture(Texture_Unit::TEXTURE_UNIT_1, normal_texture->texture()); Engine::bind_texture(Texture_Unit::TEXTURE_UNIT_2, end_texure->texture()); render_context->set_color_texture(lighting_texture, Attachment_Type::COLOR_ATTACHMENT_0); use_program(lighting_shader1->id()); int32_t texture_pos = lighting_shader1->uniform_id("gPosition"); int32_t texture_norm = lighting_shader1->uniform_id("gNormal"); int32_t texture_alb = lighting_shader1->uniform_id("gAlbedoSpec"); lighting_shader1->set_uniform_int1(texture_pos, 0); lighting_shader1->set_uniform_int1(texture_norm, 1); lighting_shader1->set_uniform_int1(texture_alb, 2); uint32_t buff_id = render_context->quad_id(); bind_vertex_array(buff_id); draw_data(Engine::TRIANGLE_MODE, 0, 6); bind_vertex_array(0); Engine::bind_texture(Texture_Unit::TEXTURE_UNIT_0, 0); Engine::bind_texture(Texture_Unit::TEXTURE_UNIT_1, 0); Engine::bind_texture(Texture_Unit::TEXTURE_UNIT_2, 0); /** End Lighting Pass **/ //render_context->clear_color_texture(Engine::Attachment_Type::DEPTH_STENCIL_ATTACHMENT); } void Basic_Renderer::shutdown( void ) { } } // end namespace Engine
57.130435
136
0.406451
Caravetta
c6216a733e5a42023596134d2f5ad5324d3f092f
15,480
hpp
C++
include/Types.hpp
scribelang/scribe
8b82ed839e290c1204928dcd196237c6cd6000ba
[ "MIT" ]
2
2021-12-01T06:45:58.000Z
2021-12-01T07:30:52.000Z
include/Types.hpp
scribelang/scribe
8b82ed839e290c1204928dcd196237c6cd6000ba
[ "MIT" ]
null
null
null
include/Types.hpp
scribelang/scribe
8b82ed839e290c1204928dcd196237c6cd6000ba
[ "MIT" ]
null
null
null
/* MIT License Copyright (c) 2022 Scribe Language Repositories 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. */ #ifndef TYPES_HPP #define TYPES_HPP #include "Context.hpp" #include "Error.hpp" #include "Values.hpp" namespace sc { enum Types : uint16_t { TVOID, // TNIL, // = i1 (0) // TBOOL, // = i1 TTYPE, TANY, TINT, TFLT, TPTR, TFUNC, TSTRUCT, TVARIADIC, _LAST }; enum TypeInfoMask { REF = 1 << 0, // is a reference STATIC = 1 << 1, // is static CONST = 1 << 2, // is const VOLATILE = 1 << 3, // is volatile COMPTIME = 1 << 4, // is comptime VARIADIC = 1 << 5, // is variadic }; class Stmt; class StmtExpr; class StmtVar; class StmtFnDef; class StmtFnCallInfo; typedef bool (*IntrinsicFn)(Context &c, StmtExpr *stmt, Stmt **source, Vector<Stmt *> &args); #define INTRINSIC(name) \ bool intrinsic_##name(Context &c, StmtExpr *stmt, Stmt **source, Vector<Stmt *> &args) class Type { uint32_t id; Types type; uint16_t info; public: Type(const Types &type, const uint16_t &info, const uint32_t &id); virtual ~Type(); bool isBaseCompatible(Context &c, Type *rhs, const ModuleLoc *loc); String infoToStr(); String baseToStr(); bool requiresCast(Type *other); virtual uint32_t getUniqID(); // used by codegen virtual uint32_t getID(); virtual bool isTemplate(const size_t &weak_depth = 0); virtual String toStr(const size_t &weak_depth = 0); virtual Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0) = 0; virtual bool mergeTemplatesFrom(Type *ty, const size_t &weak_depth = 0); virtual void unmergeTemplates(const size_t &weak_depth = 0); virtual bool isCompatible(Context &c, Type *rhs, const ModuleLoc *loc); inline void setInfo(const size_t &inf) { info = inf; } inline void appendInfo(const size_t &inf) { info |= inf; } inline uint16_t getInfo() const { return info; } inline bool isPrimitive() const { return isInt() || isFlt(); } inline bool isPrimitiveOrPtr() const { return isInt() || isFlt() || isPtr(); } inline bool isIntegral() const { return isInt(); } inline bool isFloat() const { return isFlt(); } virtual Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); #define SetModifierX(Fn, Mod) \ inline void set##Fn() \ { \ info |= Mod; \ } SetModifierX(Static, STATIC); SetModifierX(Const, CONST); SetModifierX(Volatile, VOLATILE); SetModifierX(Ref, REF); SetModifierX(Comptime, COMPTIME); SetModifierX(Variadic, VARIADIC); #define UnsetModifierX(Fn, Mod) \ inline void unset##Fn() \ { \ info &= ~Mod; \ } UnsetModifierX(Static, STATIC); UnsetModifierX(Const, CONST); UnsetModifierX(Volatile, VOLATILE); UnsetModifierX(Ref, REF); UnsetModifierX(Comptime, COMPTIME); UnsetModifierX(Variadic, VARIADIC); #define IsTyX(Fn, Ty) \ inline bool is##Fn() const \ { \ return type == T##Ty; \ } IsTyX(Void, VOID); IsTyX(TypeTy, TYPE); IsTyX(Any, ANY); IsTyX(Int, INT); IsTyX(Flt, FLT); IsTyX(Ptr, PTR); IsTyX(Func, FUNC); IsTyX(Struct, STRUCT); IsTyX(Variadic, VARIADIC); #define IsModifierX(Fn, Mod) \ inline bool has##Fn() const \ { \ return info & Mod; \ } IsModifierX(Static, STATIC); IsModifierX(Const, CONST); IsModifierX(Volatile, VOLATILE); IsModifierX(Ref, REF); IsModifierX(Comptime, COMPTIME); IsModifierX(Variadic, VARIADIC); inline const uint32_t &getBaseID() const { return id; } }; template<typename T> T *as(Type *t) { return static_cast<T *>(t); } class VoidTy : public Type { public: VoidTy(); VoidTy(const uint16_t &info); ~VoidTy(); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); static VoidTy *create(Context &c); Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; class AnyTy : public Type { public: AnyTy(); AnyTy(const uint16_t &info); ~AnyTy(); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); static AnyTy *create(Context &c); Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; class IntTy : public Type { uint16_t bits; bool sign; // signed public: IntTy(const uint16_t &bits, const bool &sign); IntTy(const uint16_t &info, const uint32_t &id, const uint16_t &bits, const bool &sign); ~IntTy(); uint32_t getID(); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); static IntTy *create(Context &c, const uint16_t &_bits, const bool &_sign); inline const uint16_t &getBits() const { return bits; } inline const bool &isSigned() const { return sign; } Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; class FltTy : public Type { uint16_t bits; public: FltTy(const uint16_t &bits); FltTy(const uint16_t &info, const uint32_t &id, const uint16_t &bits); ~FltTy(); uint32_t getID(); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); static FltTy *create(Context &c, const uint16_t &_bits); inline const uint16_t &getBits() const { return bits; } Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; class TypeTy : public Type { uint32_t containedtyid; public: TypeTy(); TypeTy(const uint16_t &info, const uint32_t &id, const uint32_t &containedtyid); ~TypeTy(); uint32_t getUniqID(); bool isTemplate(const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); bool mergeTemplatesFrom(Type *ty, const size_t &weak_depth = 0); void unmergeTemplates(const size_t &weak_depth = 0); static TypeTy *create(Context &c); void clearContainedTy(); void setContainedTy(Type *ty); Type *getContainedTy(); Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; class PtrTy : public Type { Type *to; uint16_t count; // 0 = normal pointer, > 0 = array pointer with count = size bool is_weak; // required for self referencing members in struct public: PtrTy(Type *to, const uint16_t &count, const bool &is_weak); PtrTy(const uint16_t &info, const uint32_t &id, Type *to, const uint16_t &count, const bool &is_weak); ~PtrTy(); uint32_t getUniqID(); bool isTemplate(const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); bool mergeTemplatesFrom(Type *ty, const size_t &weak_depth = 0); void unmergeTemplates(const size_t &weak_depth = 0); static PtrTy *create(Context &c, Type *ptr_to, const uint16_t &count, const bool &is_weak); inline void setTo(Type *ty) { to = ty; } inline void setWeak(const bool &weak) { is_weak = weak; } inline Type *&getTo() { return to; } inline const uint16_t &getCount() { return count; } inline bool isWeak() { return is_weak; } inline bool isArrayPtr() { return count > 0; } Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; class StructTy : public Type { Map<StringRef, size_t> fieldpos; Vector<StringRef> fieldnames; Vector<Type *> fields; Map<StringRef, size_t> templatepos; Vector<StringRef> templatenames; Vector<TypeTy *> templates; bool has_template; bool externed; public: StructTy(const Vector<StringRef> &fieldnames, const Vector<Type *> &fields, const Vector<StringRef> &templatenames, const Vector<TypeTy *> &templates, const bool &externed); StructTy(const uint16_t &info, const uint32_t &id, const Vector<StringRef> &fieldnames, const Map<StringRef, size_t> &fieldpos, const Vector<Type *> &fields, const Vector<StringRef> &templatenames, const Map<StringRef, size_t> &templatepos, const Vector<TypeTy *> &templates, const bool &has_template, const bool &externed); ~StructTy(); uint32_t getUniqID(); bool isTemplate(const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); bool mergeTemplatesFrom(Type *ty, const size_t &weak_depth = 0); void unmergeTemplates(const size_t &weak_depth = 0); bool isCompatible(Context &c, Type *rhs, const ModuleLoc *loc); // specializes a structure type StructTy *applyTemplates(Context &c, const ModuleLoc *loc, const Vector<Type *> &actuals); // returns a NON-def struct type StructTy *instantiate(Context &c, const ModuleLoc *loc, const Vector<Stmt *> &callargs); static StructTy *create(Context &c, const Vector<StringRef> &_fieldnames, const Vector<Type *> &_fields, const Vector<StringRef> &_templatenames, const Vector<TypeTy *> &_templates, const bool &_externed); inline void insertField(StringRef name, Type *ty) { fieldpos[name] = fields.size(); fieldnames.push_back(name); fields.push_back(ty); } inline void setExterned(const bool &ext) { externed = ext; } inline StringRef getFieldName(const size_t &idx) { return fieldnames[idx]; } inline Vector<Type *> &getFields() { return fields; } inline const Vector<TypeTy *> &getTemplates() { return templates; } inline const Vector<StringRef> &getTemplateNames() { return templatenames; } inline void clearTemplates() { templates.clear(); } inline void setTemplate(const bool &has_templ) { has_template = has_templ; } inline bool isExtern() { return externed; } Type *getField(StringRef name); Type *getField(const size_t &pos); bool hasTemplate(); Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; enum IntrinType { INONE, IPARSE, IVALUE, }; class FuncTy : public Type { StmtVar *var; Vector<Type *> args; Type *ret; IntrinsicFn intrin; IntrinType inty; uint32_t uniqid; bool externed; public: FuncTy(StmtVar *var, const Vector<Type *> &args, Type *ret, IntrinsicFn intrin, const IntrinType &inty, const bool &externed); FuncTy(const uint16_t &info, const uint32_t &id, StmtVar *var, const Vector<Type *> &args, Type *ret, IntrinsicFn intrin, const IntrinType &inty, const uint32_t &uniqid, const bool &externed); ~FuncTy(); // returns ID of parameters + ret type uint32_t getSignatureID(); uint32_t getNonUniqID(); uint32_t getID(); bool isTemplate(const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); bool mergeTemplatesFrom(Type *ty, const size_t &weak_depth = 0); void unmergeTemplates(const size_t &weak_depth = 0); bool isCompatible(Context &c, Type *rhs, const ModuleLoc *loc); // specializes a function type using StmtFnCallInfo FuncTy *createCall(Context &c, const ModuleLoc *loc, const Vector<Stmt *> &callargs); static FuncTy *create(Context &c, StmtVar *_var, const Vector<Type *> &_args, Type *_ret, IntrinsicFn _intrin, const IntrinType &_inty, const bool &_externed); inline void setVar(StmtVar *v) { var = v; } inline void setArg(const size_t &idx, Type *arg) { args[idx] = arg; } inline void setRet(Type *retty) { ret = retty; } inline void insertArg(Type *arg) { args.push_back(arg); } inline void insertArg(const size_t &idx, Type *arg) { args.insert(args.begin() + idx, arg); } inline void eraseArg(const size_t &idx) { args.erase(args.begin() + idx); } inline void setExterned(const bool &ext) { externed = ext; } inline StmtVar *&getVar() { return var; } inline Vector<Type *> &getArgs() { return args; } inline Type *getArg(const size_t &idx) { return args.size() > idx ? args[idx] : nullptr; } inline Type *getRet() { return ret; } inline bool isIntrinsic() { return intrin != nullptr; } inline bool isParseIntrinsic() { return inty == IPARSE; } inline bool isExtern() { return externed; } inline IntrinsicFn getIntrinsicFn() { return intrin; } void updateUniqID(); bool callIntrinsic(Context &c, StmtExpr *stmt, Stmt **source, Vector<Stmt *> &callargs); Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; class VariadicTy : public Type { Vector<Type *> args; public: VariadicTy(const Vector<Type *> &args); VariadicTy(const uint16_t &info, const uint32_t &id, const Vector<Type *> &args); ~VariadicTy(); bool isTemplate(const size_t &weak_depth = 0); String toStr(const size_t &weak_depth = 0); Type *clone(Context &c, const bool &as_is = false, const size_t &weak_depth = 0); bool mergeTemplatesFrom(Type *ty, const size_t &weak_depth = 0); void unmergeTemplates(const size_t &weak_depth = 0); bool isCompatible(Context &c, Type *rhs, const ModuleLoc *loc); static VariadicTy *create(Context &c, const Vector<Type *> &_args); inline void addArg(Type *ty) { args.push_back(ty); } inline Vector<Type *> &getArgs() { return args; } inline Type *getArg(const size_t &idx) { return args.size() > idx ? args[idx] : nullptr; } Value *toDefaultValue(Context &c, const ModuleLoc *loc, ContainsData cd, const size_t &weak_depth = 0); }; // helpful functions inline IntTy *mkI0Ty(Context &c) { return IntTy::create(c, 0, true); } inline IntTy *mkI1Ty(Context &c) { return IntTy::create(c, 1, true); } inline IntTy *mkI8Ty(Context &c) { return IntTy::create(c, 8, true); } inline IntTy *mkI16Ty(Context &c) { return IntTy::create(c, 16, true); } inline IntTy *mkI32Ty(Context &c) { return IntTy::create(c, 32, true); } inline IntTy *mkI64Ty(Context &c) { return IntTy::create(c, 64, true); } inline IntTy *mkU8Ty(Context &c) { return IntTy::create(c, 8, false); } inline IntTy *mkU16Ty(Context &c) { return IntTy::create(c, 16, false); } inline IntTy *mkU32Ty(Context &c) { return IntTy::create(c, 32, false); } inline IntTy *mkU64Ty(Context &c) { return IntTy::create(c, 64, false); } inline FltTy *mkF0Ty(Context &c) { return FltTy::create(c, 0); } inline FltTy *mkF32Ty(Context &c) { return FltTy::create(c, 32); } inline FltTy *mkF64Ty(Context &c) { return FltTy::create(c, 64); } inline PtrTy *mkPtrTy(Context &c, Type *to, const size_t &count, const bool &is_weak) { return PtrTy::create(c, to, count, is_weak); } inline Type *mkStrTy(Context &c) { Type *res = IntTy::create(c, 8, true); res = PtrTy::create(c, res, 0, false); res->setConst(); return res; } inline VoidTy *mkVoidTy(Context &c) { return VoidTy::create(c); } inline AnyTy *mkAnyTy(Context &c) { return AnyTy::create(c); } inline TypeTy *mkTypeTy(Context &c) { return TypeTy::create(c); } } // namespace sc #endif // TYPES_HPP
23.85208
93
0.691085
scribelang
c621ff4fd2aecfd1ca1209c8f0b71cc9d0d1689a
1,389
cpp
C++
test/function/scalar/asinpi.cpp
yaeldarmon/boost.simd
561316cc54bdc6353ca78f3b6d7e9120acd11144
[ "BSL-1.0" ]
null
null
null
test/function/scalar/asinpi.cpp
yaeldarmon/boost.simd
561316cc54bdc6353ca78f3b6d7e9120acd11144
[ "BSL-1.0" ]
null
null
null
test/function/scalar/asinpi.cpp
yaeldarmon/boost.simd
561316cc54bdc6353ca78f3b6d7e9120acd11144
[ "BSL-1.0" ]
null
null
null
//================================================================================================== /*! Copyright 2015 NumScale SAS Copyright 2015 J.T. Lapreste Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ //================================================================================================== #include <boost/simd/function/scalar/asinpi.hpp> #include <simd_test.hpp> #include <boost/simd/constant/inf.hpp> #include <boost/simd/constant/minf.hpp> #include <boost/simd/constant/nan.hpp> #include <boost/simd/constant/one.hpp> #include <boost/simd/constant/mone.hpp> #include <boost/simd/constant/zero.hpp> #include <boost/simd/constant/mzero.hpp> STF_CASE_TPL (" asinpi", STF_IEEE_TYPES) { namespace bs = boost::simd; namespace bd = boost::dispatch; using bs::asinpi; using r_t = decltype(asinpi(T())); // return type conformity test STF_TYPE_IS(r_t, T); // specific values tests #ifndef BOOST_SIMD_NO_INVALIDS STF_ULP_EQUAL(asinpi(bs::Nan<T>()), bs::Nan<r_t>(), 0.5); #endif STF_ULP_EQUAL(asinpi(bs::Half<T>()), T(1)/6, 0.5); STF_ULP_EQUAL(asinpi(bs::Mhalf<T>()), -T(1)/6, 0.5); STF_ULP_EQUAL(asinpi(bs::Mone<T>()), -0.5, 0.5); STF_ULP_EQUAL(asinpi(bs::One<T>()), 0.5, 0.5); STF_ULP_EQUAL(asinpi(bs::Zero<T>()), bs::Zero<r_t>(), 0.5); }
32.302326
100
0.595392
yaeldarmon
c622a8c7367790c9c0e76b440ce73da8ce00645d
1,719
cpp
C++
code/C/num2en.cpp
LingfengPang/C-C-learning
4ad4a8f56f1ed06622c4b6f4cd0749c0541b7641
[ "MIT" ]
4
2021-04-16T02:20:25.000Z
2021-10-04T12:22:35.000Z
code/C/num2en.cpp
LingfengPang/C-C-learning
4ad4a8f56f1ed06622c4b6f4cd0749c0541b7641
[ "MIT" ]
null
null
null
code/C/num2en.cpp
LingfengPang/C-C-learning
4ad4a8f56f1ed06622c4b6f4cd0749c0541b7641
[ "MIT" ]
2
2022-01-08T06:30:20.000Z
2022-03-26T08:39:20.000Z
#include <iostream> #include <cmath> #include <string> using namespace std; int main(){ //num是一个两位数 int num; string res; cin >> num; if(num < 10||num>99){ return 0; } int _1stdig = num/10; int _2nddig = num%10; if(num == 10){ cout <<"ten"<<endl; } switch (_1stdig) { case 1:break; case 2: res+="twenty";break; case 3: res+="thirty";break; case 4: res+="forty";break; case 5: res+="fifty";break; case 6: res+="sixty";break; case 7: res+="seventy";break; case 8: res+="eighty";break; case 9: res+="ninty";break; default: break; } if(_2nddig == 0 ){ cout << res <<endl; system("pause"); return 0; } else if(_1stdig >= 2) res+="-"; if(num >= 20) switch (_2nddig) { case 1: res+="one";break; case 2: res+="two";break; case 3: res+="three";break; case 4: res+="four";break; case 5: res+="five";break; case 6: res+="six";break; case 7: res+="seven";break; case 8: res+="eigh";break; case 9: res+="nine";break; default: break; } else switch (_2nddig) { case 1: res+="eleven";break; case 2: res+="twelve";break; case 3: res+="thirteen";break; case 4: res+="fourteen";break; case 5: res+="fifteen";break; case 6: res+="sixteen";break; case 7: res+="seventeen";break; case 8: res+="eighteen";break; case 9: res+="nineteen";break; default: break; } cout << res <<endl; system("pause"); return 0; }
22.038462
39
0.481094
LingfengPang
c6270adb490cf5d2a69bec5a9f03a03d22840976
627
hpp
C++
library/ATF/_trap_create_setdata.hpp
lemkova/Yorozuya
f445d800078d9aba5de28f122cedfa03f26a38e4
[ "MIT" ]
29
2017-07-01T23:08:31.000Z
2022-02-19T10:22:45.000Z
library/ATF/_trap_create_setdata.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
90
2017-10-18T21:24:51.000Z
2019-06-06T02:30:33.000Z
library/ATF/_trap_create_setdata.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
44
2017-12-19T08:02:59.000Z
2022-02-24T23:15:01.000Z
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually #pragma once #include <common/common.h> #include <CPlayer.hpp> #include <_character_create_setdata.hpp> START_ATF_NAMESPACE #pragma pack(push, 8) struct _trap_create_setdata : _character_create_setdata { int nHP; CPlayer *pMaster; int nTrapMaxAttackPnt; public: _trap_create_setdata(); void ctor__trap_create_setdata(); }; #pragma pack(pop) static_assert(ATF::checkSize<_trap_create_setdata, 56>(), "_trap_create_setdata"); END_ATF_NAMESPACE
27.26087
108
0.708134
lemkova
c628648dd45076ff7bda737c34dfbd5d603ce0e3
4,277
cxx
C++
Accelerators/Vtkm/vtkmlib/ImageDataConverter.cxx
michaelchanwahyan/vtk-8.1.2
243225b750443f76dcb119c1bb8e72d41e505bc0
[ "BSD-3-Clause" ]
2
2017-12-08T07:50:51.000Z
2018-07-22T19:12:56.000Z
Accelerators/Vtkm/vtkmlib/ImageDataConverter.cxx
sakjain92/VTK
1c32f7a180e2750d4678744d7fc47a00f0eb4780
[ "BSD-3-Clause" ]
1
2019-06-03T17:04:59.000Z
2019-06-05T15:13:28.000Z
Accelerators/Vtkm/vtkmlib/ImageDataConverter.cxx
sakjain92/VTK
1c32f7a180e2750d4678744d7fc47a00f0eb4780
[ "BSD-3-Clause" ]
1
2020-07-20T06:43:49.000Z
2020-07-20T06:43:49.000Z
/*========================================================================= Program: Visualization Toolkit Module: ImageDataConverter.h 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 "ImageDataConverter.h" #include <vtkm/cont/ArrayHandleUniformPointCoordinates.h> #include <vtkm/cont/DataSetBuilderUniform.h> #include "ArrayConverters.h" #include "vtkDataArray.h" #include "vtkDataSetAttributes.h" #include "vtkImageData.h" #include "vtkPointData.h" namespace tovtkm { //------------------------------------------------------------------------------ // convert an image data type vtkm::cont::DataSet Convert(vtkImageData *input, FieldsFlag fields) { int extent[6]; input->GetExtent(extent); double vorigin[3]; input->GetOrigin(vorigin); double vspacing[3]; input->GetSpacing(vspacing); int vdims[3]; input->GetDimensions(vdims); vtkm::Vec<vtkm::FloatDefault, 3> origin( (static_cast<double>(extent[0]) * vspacing[0]) + vorigin[0], (static_cast<double>(extent[2]) * vspacing[1]) + vorigin[1], (static_cast<double>(extent[4]) * vspacing[2]) + vorigin[2]); vtkm::Vec<vtkm::FloatDefault, 3> spacing(vspacing[0], vspacing[1], vspacing[2]); vtkm::Id3 dims(vdims[0], vdims[1], vdims[2]); vtkm::cont::DataSet dataset = vtkm::cont::DataSetBuilderUniform::Create(dims, origin, spacing); ProcessFields(input, dataset, fields); return dataset; } } // tovtkm namespace fromvtkm { bool Convert(const vtkm::cont::DataSet& voutput, int extents[6], vtkImageData* output, vtkDataSet* input) { vtkm::cont::CoordinateSystem cs = voutput.GetCoordinateSystem(); if (!cs.GetData().IsType<vtkm::cont::ArrayHandleUniformPointCoordinates>()) { return false; } auto points = cs.GetData().Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>(); auto portal = points.GetPortalConstControl(); auto origin = portal.GetOrigin(); auto spacing = portal.GetSpacing(); auto dim = portal.GetDimensions(); VTKM_ASSERT((extents[1] - extents[0] + 1) == dim[0] && (extents[3] - extents[2] + 1) == dim[1] && (extents[5] - extents[4] + 1) == dim[2]); origin[0] -= static_cast<vtkm::FloatDefault>(extents[0]) * spacing[0]; origin[1] -= static_cast<vtkm::FloatDefault>(extents[2]) * spacing[1]; origin[2] -= static_cast<vtkm::FloatDefault>(extents[4]) * spacing[2]; output->SetExtent(extents); output->SetOrigin(origin[0], origin[1], origin[2]); output->SetSpacing(spacing[0], spacing[1], spacing[2]); // Next we need to convert any extra fields from vtkm over to vtk bool arraysConverted = fromvtkm::ConvertArrays(voutput, output); // Pass information about attributes. for (int attributeType = 0; attributeType < vtkDataSetAttributes::NUM_ATTRIBUTES; attributeType++) { vtkDataArray* attribute = input->GetPointData()->GetAttribute(attributeType); if (attribute == nullptr) { continue; } output->GetPointData()->SetActiveAttribute(attribute->GetName(), attributeType); } return arraysConverted; } bool Convert(const vtkm::cont::DataSet& voutput, vtkImageData* output, vtkDataSet* input) { vtkm::cont::CoordinateSystem cs = voutput.GetCoordinateSystem(); if (!cs.GetData().IsType<vtkm::cont::ArrayHandleUniformPointCoordinates>()) { return false; } auto points = cs.GetData().Cast<vtkm::cont::ArrayHandleUniformPointCoordinates>(); auto portal = points.GetPortalConstControl(); auto dim = portal.GetDimensions(); int extents[6] = {0, static_cast<int>(dim[0] - 1), 0, static_cast<int>(dim[1] - 1), 0, static_cast<int>(dim[2] - 1)}; return Convert(voutput, extents, output, input); } } // fromvtkm
32.648855
86
0.630348
michaelchanwahyan