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 109 | 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 48.5k ⌀ | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
65ef1b7788fdb9915b2b22718e100afcb738eff3 | 1,812 | cpp | C++ | src/technique/main.cpp | ref2401/cg | 4654377f94fe54945c33156911ca25e807c96236 | [
"MIT"
] | 2 | 2019-04-02T14:19:01.000Z | 2021-05-27T13:42:20.000Z | src/technique/main.cpp | ref2401/cg | 4654377f94fe54945c33156911ca25e807c96236 | [
"MIT"
] | 4 | 2016-11-05T14:17:14.000Z | 2017-03-30T15:03:37.000Z | src/technique/main.cpp | ref2401/cg | 4654377f94fe54945c33156911ca25e807c96236 | [
"MIT"
] | null | null | null | #include <memory>
#include <sstream>
#include <utility>
#include <windows.h>
#include "cg/base/base.h"
#include "cg/base/math.h"
#include "cg/sys/app.h"
#include "technique/deferred_lighting/deferred_lighting.h"
#include "technique/fur_simulation/fur_simulation_opengl.h"
#include "technique/parallax_occlusion_mapping/parallax_occlusion_mapping.h"
#include "technique/pbr/pbr.h"
using cg::sys::Clock_report;
namespace {
std::string get_report_message(const Clock_report& report)
{
std::ostringstream out;
out << std::endl << "----- Exec report ----- " << std::endl;
out << "\ttotal time: " << report.elapsed_seconds() << " seconds." << std::endl;
out << "\tfps(avg): " << report.fps() << ", total frames: " << report.frame_count << std::endl;
out << "\tups(avg): " << report.ups() << ", total updates: " << report.update_count << std::endl;
out << "----- -----" << std::endl << std::endl;
return out.str();
}
} // namespace
int main(int argc, char* argv[])
{
using cg::sys::Application;
using cg::sys::Application_desc;
Application_desc app_desc;
app_desc.window_position = uint2(90, 50);
app_desc.viewport_size = uint2(960, 540);
try {
Application app(app_desc);
auto report = app.run_dx11_example<pbr::pbr>();
//auto report = app.run_dx11_example<parallax_occlusion_mapping::parallax_occlusion_mapping>();
//auto report = app.run_opengl_example<fur_simulation::Fur_simulation_opengl_example>();
//auto report = app.run_opengl_example<deferred_lighting::Deferred_lighting>();
OutputDebugString(get_report_message(report).c_str());
}
catch (std::exception& exc) {
OutputDebugString("\nException:\n");
OutputDebugString(cg::exception_message(exc).c_str());
OutputDebugString("----------\n");
}
return 1;
}
| 30.711864 | 99 | 0.6766 | ref2401 |
65f84ea98358c166790090ef82943551625efb91 | 1,457 | cpp | C++ | src/pizza_delivery.cpp | ltowarek/pizza-delivery | 674d2e8fb671abc466c9a6a16e2fd79a6205cf20 | [
"MIT"
] | null | null | null | src/pizza_delivery.cpp | ltowarek/pizza-delivery | 674d2e8fb671abc466c9a6a16e2fd79a6205cf20 | [
"MIT"
] | null | null | null | src/pizza_delivery.cpp | ltowarek/pizza-delivery | 674d2e8fb671abc466c9a6a16e2fd79a6205cf20 | [
"MIT"
] | null | null | null | #include "pizza_delivery.h"
int pizzadelivery::PizzaDelivery::TotalDeliveryCost(const int size_x,
const int size_y,
const std::vector<int> &grid) const {
auto output = int{0};
for (int y = 0; y < size_y; ++y) {
for (int x = 0; x < size_x; ++x) {
auto tmp_output = DeliveryCost(x, y, size_x, size_y, grid);
if (tmp_output < output || output == 0) {
output = tmp_output;
}
}
}
return output;
}
int pizzadelivery::PizzaDelivery::DeliveryCost(const int start_x,
const int start_y,
const int size_x,
const int size_y,
const std::vector<int> &grid) const {
auto output = int{0};
for (int y = 0; y < size_y; ++y) {
for (int x = 0; x < size_x; ++x) {
output += ManhattanDistance(start_x, start_y, x, y) * grid[y * size_x + x];
}
}
return output;
}
int pizzadelivery::PizzaDelivery::ManhattanDistance(const int start_x,
const int start_y,
const int end_x,
const int end_y) const {
return std::abs(end_x - start_x) + std::abs(end_y - start_y);
}
| 34.690476 | 89 | 0.444749 | ltowarek |
5a0204add9076f9a0f4e4aa29fb039ed9ca099d8 | 2,157 | cpp | C++ | src/dHRU_interface_to_R.cpp | petrmaca/dHRUM | 5ef85f199ed5a926035d01fec264303bbbef27ac | [
"MIT"
] | null | null | null | src/dHRU_interface_to_R.cpp | petrmaca/dHRUM | 5ef85f199ed5a926035d01fec264303bbbef27ac | [
"MIT"
] | 6 | 2021-08-19T07:31:05.000Z | 2021-09-16T19:32:53.000Z | src/dHRU_interface_to_R.cpp | petrmaca/dHRUM | 5ef85f199ed5a926035d01fec264303bbbef27ac | [
"MIT"
] | null | null | null | #include <Rcpp.h>
#include "dHRUM.h"
//' Initialization of dHRU pointer to a dHRUM
//'
//' Creates pointer instance of dHRUM for the catchment.
//' initializes a dimension of dHRUM controled by the number of single Hru, areas of all single Hrus,
//' and ID's of all single Hrus.
//'
//' @param dimdHru a single \code{numberDta} number of single Hrus.
//' @param vecAreas a \code{numeric vector} of size \code{dimHru} of Areas for all single HRUs on dHRU.
//' @param hrusIDs a \code{character vector} of size \code{dimHru} of Id's for all single HRUs on dHRU.
//' @return dHRUM_ptr pointer to dHru instance.
//' @export
//' @examples
//' nHrus <- 200
//' Areas <- runif(nHrus,min = 1,max = 10)
//' IdsHrus <- paste0("ID",seq(1:length(Areas)))
//' dhrus <- initdHruModel(nHrus,Areas,IdsHrus)
// [[Rcpp::export]]
Rcpp::XPtr<dHRUM> initdHruModel(numberDta dimdHru, Rcpp::NumericVector vecAreas, Rcpp::StringVector hrusIDs) {
// implicit form
// 1) creates dHRU instance on the heap (allocates memory and call constructor with no arguments)
// 2) creates dhruPTR variable on the stack initialized with pointer to dHRU's instance
dHRUM* dHRUM_ptr = new dHRUM();
unsigned vecArSize = vecAreas.size();
unsigned vecIdNamesSize = hrusIDs.size();
if(!((dimdHru == vecArSize) && (dimdHru == vecIdNamesSize) && (vecIdNamesSize == vecArSize))) {
Rcpp::stop("\nThe dim of dHRU single HRU units does not correspond to the length of Areas or Ids.\n");
} else {
single_HMunit sHRU_to_VEC;
dHRUM_ptr->initHrusVec(dimdHru, sHRU_to_VEC);
std::vector<std::string> vecIDs;
vecIDs.resize(dimdHru);
for(unsigned id=0;id<dimdHru;id++){
vecIDs[id] = hrusIDs[id];
}
hdata vecAreasHD(1,dimdHru);
for(unsigned aa=0;aa<dimdHru;aa++){
vecAreasHD[aa] = (numberSel) vecAreas[aa];
// Rcpp::Rcout << vecAreasHD[aa] << "\n";
}
dHRUM_ptr->initHrusID(vecIDs);
// for(unsigned aa=0;aa<dimdHru;aa++){
// Rcpp::Rcout << "Id of single Hru on positon " << aa << " is " << dHRU_ptr->getSingleHruId(aa) << "\n";
// }
dHRUM_ptr->setAreasToHrus(vecAreasHD);
}
return Rcpp::XPtr<dHRUM>(dHRUM_ptr);
}
| 41.480769 | 113 | 0.675012 | petrmaca |
5a02c1cdb8d55c7f08d701b6d0869ada1e2ecec8 | 784 | cpp | C++ | src/Strategy.cpp | maxvu/bjsim4 | 944811eafdbe6a088d9190e92f6108c28ba7b972 | [
"MIT"
] | null | null | null | src/Strategy.cpp | maxvu/bjsim4 | 944811eafdbe6a088d9190e92f6108c28ba7b972 | [
"MIT"
] | null | null | null | src/Strategy.cpp | maxvu/bjsim4 | 944811eafdbe6a088d9190e92f6108c28ba7b972 | [
"MIT"
] | null | null | null | #include "Strategy.hpp"
#include "Seat.hpp"
#include "Hand.hpp"
#include <string>
namespace bjsim4 {
double DealerStrategy::decideInsurance (
const Seat & seat
) {
return 0.0;
}
double DealerStrategy::decideBet (
const Seat & seat
) {
return 0.0;
}
double DealerStrategy::decideSidebet (
const Seat & seat,
std::string sidebetName
) {
return 0.0;
}
HandOption DealerStrategy::decideHand (
const Seat & seat
) {
Hand hand = seat.getCurrentHand();
HandDetail detail = hand.getDetail();
if ( detail.getBestValue() < 17 )
return HandOption::HIT;
if ( detail.getBestValue() > 17 )
return HandOption::STAND;
return seat.getRules().dealerStandsOnSoft17()
? HandOption::STAND
: HandOption::HIT;
}
};
| 17.818182 | 49 | 0.645408 | maxvu |
5a06b3b2e6a811a4af51a46ee206619fc49c21c1 | 21,235 | hpp | C++ | src/Ystring/Utf/Utf16WChars.hpp | wvffle/Ystring | a1ee9da1e433a2e74e432da6834638d547265126 | [
"BSD-2-Clause"
] | null | null | null | src/Ystring/Utf/Utf16WChars.hpp | wvffle/Ystring | a1ee9da1e433a2e74e432da6834638d547265126 | [
"BSD-2-Clause"
] | 1 | 2021-02-28T12:46:55.000Z | 2021-03-03T20:58:14.000Z | src/Ystring/Utf/Utf16WChars.hpp | wvffle/Ystring | a1ee9da1e433a2e74e432da6834638d547265126 | [
"BSD-2-Clause"
] | 1 | 2021-02-28T13:02:43.000Z | 2021-02-28T13:02:43.000Z | //****************************************************************************
// Copyright © 2015 Jan Erik Breimo. All rights reserved.
// Created by Jan Erik Breimo on 2015-07-30
//
// This file is distributed under the Simplified BSD License.
// License text is included with the source distribution.
//****************************************************************************
#pragma once
#define UTF16W_NULL L"\u0000"
#define UTF16W_START_OF_HEADING L"\u0001"
#define UTF16W_START_OF_TEXT L"\u0002"
#define UTF16W_END_OF_TEXT L"\u0003"
#define UTF16W_END_OF_TRANSMISSION L"\u0004"
#define UTF16W_ENQUIRY L"\u0005"
#define UTF16W_ACKNOWLEDGE L"\u0006"
#define UTF16W_BELL L"\u0007"
#define UTF16W_BACKSPACE L"\u0008"
#define UTF16W_CHARACTER_TABULATION L"\u0009"
#define UTF16W_LINE_FEED L"\u000A"
#define UTF16W_LINE_TABULATION L"\u000B"
#define UTF16W_FORM_FEED L"\u000C"
#define UTF16W_CARRIAGE_RETURN L"\u000D"
#define UTF16W_SHIFT_OUT L"\u000E"
#define UTF16W_SHIFT_IN L"\u000F"
#define UTF16W_DATA_LINK_ESCAPE L"\u0010"
#define UTF16W_DEVICE_CONTROL_ONE L"\u0011"
#define UTF16W_DEVICE_CONTROL_TWO L"\u0012"
#define UTF16W_DEVICE_CONTROL_THREE L"\u0013"
#define UTF16W_DEVICE_CONTROL_FOUR L"\u0014"
#define UTF16W_NEGATIVE_ACKNOWLEDGE L"\u0015"
#define UTF16W_SYNCHRONOUS_IDLE L"\u0016"
#define UTF16W_END_OF_TRANSMISSION_BLOCK L"\u0017"
#define UTF16W_CANCEL L"\u0018"
#define UTF16W_END_OF_MEDIUM L"\u0019"
#define UTF16W_SUBSTITUTE L"\u001A"
#define UTF16W_ESCAPE L"\u001B"
#define UTF16W_INFORMATION_SEPARATOR_FOUR L"\u001C"
#define UTF16W_INFORMATION_SEPARATOR_THREE L"\u001D"
#define UTF16W_INFORMATION_SEPARATOR_TWO L"\u001E"
#define UTF16W_INFORMATION_SEPARATOR_ONE L"\u001F"
#define UTF16W_DELETE L"\u007F"
#define UTF16W_BREAK_PERMITTED_HERE L"\u0082"
#define UTF16W_NO_BREAK_HERE L"\u0083"
#define UTF16W_NEXT_LINE L"\u0085"
#define UTF16W_START_OF_SELECTED_AREA L"\u0086"
#define UTF16W_END_OF_SELECTED_AREA L"\u0087"
#define UTF16W_CHARACTER_TABULATION_SET L"\u0088"
#define UTF16W_CHARACTER_TABULATION_WITH_JUSTIFICATION L"\u0089"
#define UTF16W_LINE_TABULATION_SET L"\u008A"
#define UTF16W_PARTIAL_LINE_FORWARD L"\u008B"
#define UTF16W_PARTIAL_LINE_BACKWARD L"\u008C"
#define UTF16W_REVERSE_LINE_FEED L"\u008D"
#define UTF16W_SINGLE_SHIFT_TWO L"\u008E"
#define UTF16W_SINGLE_SHIFT_THREE L"\u008F"
#define UTF16W_DEVICE_CONTROL_STRING L"\u0090"
#define UTF16W_PRIVATE_USE_ONE L"\u0091"
#define UTF16W_PRIVATE_USE_TWO L"\u0092"
#define UTF16W_SET_TRANSMIT_STATE L"\u0093"
#define UTF16W_CANCEL_CHARACTER L"\u0094"
#define UTF16W_MESSAGE_WAITING L"\u0095"
#define UTF16W_START_OF_GUARDED_AREA L"\u0096"
#define UTF16W_END_OF_GUARDED_AREA L"\u0097"
#define UTF16W_START_OF_STRING L"\u0098"
#define UTF16W_SINGLE_CHARACTER_INTRODUCER L"\u009A"
#define UTF16W_CONTROL_SEQUENCE_INTRODUCER L"\u009B"
#define UTF16W_STRING_TERMINATOR L"\u009C"
#define UTF16W_OPERATING_SYSTEM_COMMAND L"\u009D"
#define UTF16W_PRIVACY_MESSAGE L"\u009E"
#define UTF16W_APPLICATION_PROGRAM_COMMAND L"\u009F"
#define UTF16W_NO_BREAK_SPACE L"\u00A0"
#define UTF16W_INVERTED_EXCLAMATION_MARK L"\u00A1"
#define UTF16W_CENT_SIGN L"\u00A2"
#define UTF16W_POUND_SIGN L"\u00A3"
#define UTF16W_CURRENCY_SIGN L"\u00A4"
#define UTF16W_YEN_SIGN L"\u00A5"
#define UTF16W_BROKEN_BAR L"\u00A6"
#define UTF16W_SECTION_SIGN L"\u00A7"
#define UTF16W_DIAERESIS L"\u00A8"
#define UTF16W_COPYRIGHT_SIGN L"\u00A9"
#define UTF16W_FEMININE_ORDINAL_INDICATOR L"\u00AA"
#define UTF16W_LEFT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK L"\u00AB"
#define UTF16W_NOT_SIGN L"\u00AC"
#define UTF16W_SOFT_HYPHEN L"\u00AD"
#define UTF16W_REGISTERED_SIGN L"\u00AE"
#define UTF16W_MACRON L"\u00AF"
#define UTF16W_DEGREE_SIGN L"\u00B0"
#define UTF16W_PLUS_MINUS_SIGN L"\u00B1"
#define UTF16W_SUPERSCRIPT_TWO L"\u00B2"
#define UTF16W_SUPERSCRIPT_THREE L"\u00B3"
#define UTF16W_ACUTE_ACCENT L"\u00B4"
#define UTF16W_MICRO_SIGN L"\u00B5"
#define UTF16W_PILCROW_SIGN L"\u00B6"
#define UTF16W_MIDDLE_DOT L"\u00B7"
#define UTF16W_CEDILLA L"\u00B8"
#define UTF16W_SUPERSCRIPT_ONE L"\u00B9"
#define UTF16W_MASCULINE_ORDINAL_INDICATOR L"\u00BA"
#define UTF16W_RIGHT_POINTING_DOUBLE_ANGLE_QUOTATION_MARK L"\u00BB"
#define UTF16W_VULGAR_FRACTION_ONE_QUARTER L"\u00BC"
#define UTF16W_VULGAR_FRACTION_ONE_HALF L"\u00BD"
#define UTF16W_VULGAR_FRACTION_THREE_QUARTERS L"\u00BE"
#define UTF16W_INVERTED_QUESTION_MARK L"\u00BF"
#define UTF16W_LATIN_CAPITAL_A_WITH_GRAVE L"\u00C0"
#define UTF16W_LATIN_CAPITAL_A_WITH_ACUTE L"\u00C1"
#define UTF16W_LATIN_CAPITAL_A_WITH_CIRCUMFLEX L"\u00C2"
#define UTF16W_LATIN_CAPITAL_A_WITH_TILDE L"\u00C3"
#define UTF16W_LATIN_CAPITAL_A_WITH_DIAERESIS L"\u00C4"
#define UTF16W_LATIN_CAPITAL_A_WITH_RING_ABOVE L"\u00C5"
#define UTF16W_LATIN_CAPITAL_AE L"\u00C6"
#define UTF16W_LATIN_CAPITAL_C_WITH_CEDILLA L"\u00C7"
#define UTF16W_LATIN_CAPITAL_E_WITH_GRAVE L"\u00C8"
#define UTF16W_LATIN_CAPITAL_E_WITH_ACUTE L"\u00C9"
#define UTF16W_LATIN_CAPITAL_E_WITH_CIRCUMFLEX L"\u00CA"
#define UTF16W_LATIN_CAPITAL_E_WITH_DIAERESIS L"\u00CB"
#define UTF16W_LATIN_CAPITAL_I_WITH_GRAVE L"\u00CC"
#define UTF16W_LATIN_CAPITAL_I_WITH_ACUTE L"\u00CD"
#define UTF16W_LATIN_CAPITAL_I_WITH_CIRCUMFLEX L"\u00CE"
#define UTF16W_LATIN_CAPITAL_I_WITH_DIAERESIS L"\u00CF"
#define UTF16W_LATIN_CAPITAL_ETH L"\u00D0"
#define UTF16W_LATIN_CAPITAL_N_WITH_TILDE L"\u00D1"
#define UTF16W_LATIN_CAPITAL_O_WITH_GRAVE L"\u00D2"
#define UTF16W_LATIN_CAPITAL_O_WITH_ACUTE L"\u00D3"
#define UTF16W_LATIN_CAPITAL_O_WITH_CIRCUMFLEX L"\u00D4"
#define UTF16W_LATIN_CAPITAL_O_WITH_TILDE L"\u00D5"
#define UTF16W_LATIN_CAPITAL_O_WITH_DIAERESIS L"\u00D6"
#define UTF16W_MULTIPLICATION_SIGN L"\u00D7"
#define UTF16W_LATIN_CAPITAL_O_WITH_STROKE L"\u00D8"
#define UTF16W_LATIN_CAPITAL_U_WITH_GRAVE L"\u00D9"
#define UTF16W_LATIN_CAPITAL_U_WITH_ACUTE L"\u00DA"
#define UTF16W_LATIN_CAPITAL_U_WITH_CIRCUMFLEX L"\u00DB"
#define UTF16W_LATIN_CAPITAL_U_WITH_DIAERESIS L"\u00DC"
#define UTF16W_LATIN_CAPITAL_Y_WITH_ACUTE L"\u00DD"
#define UTF16W_LATIN_CAPITAL_THORN L"\u00DE"
#define UTF16W_LATIN_SMALL_SHARP_S L"\u00DF"
#define UTF16W_LATIN_SMALL_A_WITH_GRAVE L"\u00E0"
#define UTF16W_LATIN_SMALL_A_WITH_ACUTE L"\u00E1"
#define UTF16W_LATIN_SMALL_A_WITH_CIRCUMFLEX L"\u00E2"
#define UTF16W_LATIN_SMALL_A_WITH_TILDE L"\u00E3"
#define UTF16W_LATIN_SMALL_A_WITH_DIAERESIS L"\u00E4"
#define UTF16W_LATIN_SMALL_A_WITH_RING_ABOVE L"\u00E5"
#define UTF16W_LATIN_SMALL_AE L"\u00E6"
#define UTF16W_LATIN_SMALL_C_WITH_CEDILLA L"\u00E7"
#define UTF16W_LATIN_SMALL_E_WITH_GRAVE L"\u00E8"
#define UTF16W_LATIN_SMALL_E_WITH_ACUTE L"\u00E9"
#define UTF16W_LATIN_SMALL_E_WITH_CIRCUMFLEX L"\u00EA"
#define UTF16W_LATIN_SMALL_E_WITH_DIAERESIS L"\u00EB"
#define UTF16W_LATIN_SMALL_I_WITH_GRAVE L"\u00EC"
#define UTF16W_LATIN_SMALL_I_WITH_ACUTE L"\u00ED"
#define UTF16W_LATIN_SMALL_I_WITH_CIRCUMFLEX L"\u00EE"
#define UTF16W_LATIN_SMALL_I_WITH_DIAERESIS L"\u00EF"
#define UTF16W_LATIN_SMALL_ETH L"\u00F0"
#define UTF16W_LATIN_SMALL_N_WITH_TILDE L"\u00F1"
#define UTF16W_LATIN_SMALL_O_WITH_GRAVE L"\u00F2"
#define UTF16W_LATIN_SMALL_O_WITH_ACUTE L"\u00F3"
#define UTF16W_LATIN_SMALL_O_WITH_CIRCUMFLEX L"\u00F4"
#define UTF16W_LATIN_SMALL_O_WITH_TILDE L"\u00F5"
#define UTF16W_LATIN_SMALL_O_WITH_DIAERESIS L"\u00F6"
#define UTF16W_DIVISION_SIGN L"\u00F7"
#define UTF16W_LATIN_SMALL_O_WITH_STROKE L"\u00F8"
#define UTF16W_LATIN_SMALL_U_WITH_GRAVE L"\u00F9"
#define UTF16W_LATIN_SMALL_U_WITH_ACUTE L"\u00FA"
#define UTF16W_LATIN_SMALL_U_WITH_CIRCUMFLEX L"\u00FB"
#define UTF16W_LATIN_SMALL_U_WITH_DIAERESIS L"\u00FC"
#define UTF16W_LATIN_SMALL_Y_WITH_ACUTE L"\u00FD"
#define UTF16W_LATIN_SMALL_THORN L"\u00FE"
#define UTF16W_LATIN_SMALL_Y_WITH_DIAERESIS L"\u00FF"
#define UTF16W_COMBINING_GRAVE_ACCENT L"\u0300"
#define UTF16W_COMBINING_ACUTE_ACCENT L"\u0301"
#define UTF16W_COMBINING_CIRCUMFLEX_ACCENT L"\u0302"
#define UTF16W_COMBINING_TILDE L"\u0303"
#define UTF16W_COMBINING_MACRON L"\u0304"
#define UTF16W_COMBINING_OVERLINE L"\u0305"
#define UTF16W_COMBINING_BREVE L"\u0306"
#define UTF16W_COMBINING_DOT_ABOVE L"\u0307"
#define UTF16W_COMBINING_DIAERESIS L"\u0308"
#define UTF16W_COMBINING_HOOK_ABOVE L"\u0309"
#define UTF16W_COMBINING_RING_ABOVE L"\u030A"
#define UTF16W_COMBINING_DOUBLE_ACUTE_ACCENT L"\u030B"
#define UTF16W_COMBINING_CARON L"\u030C"
#define UTF16W_COMBINING_VERTICAL_LINE_ABOVE L"\u030D"
#define UTF16W_COMBINING_DOUBLE_VERTICAL_LINE_ABOVE L"\u030E"
#define UTF16W_COMBINING_DOUBLE_GRAVE_ACCENT L"\u030F"
#define UTF16W_COMBINING_CANDRABINDU L"\u0310"
#define UTF16W_COMBINING_INVERTED_BREVE L"\u0311"
#define UTF16W_COMBINING_TURNED_COMMA_ABOVE L"\u0312"
#define UTF16W_COMBINING_COMMA_ABOVE L"\u0313"
#define UTF16W_COMBINING_REVERSED_COMMA_ABOVE L"\u0314"
#define UTF16W_COMBINING_COMMA_ABOVE_RIGHT L"\u0315"
#define UTF16W_COMBINING_GRAVE_ACCENT_BELOW L"\u0316"
#define UTF16W_COMBINING_ACUTE_ACCENT_BELOW L"\u0317"
#define UTF16W_COMBINING_LEFT_TACK_BELOW L"\u0318"
#define UTF16W_COMBINING_RIGHT_TACK_BELOW L"\u0319"
#define UTF16W_COMBINING_LEFT_ANGLE_ABOVE L"\u031A"
#define UTF16W_COMBINING_HORN L"\u031B"
#define UTF16W_COMBINING_LEFT_HALF_RING_BELOW L"\u031C"
#define UTF16W_COMBINING_UP_TACK_BELOW L"\u031D"
#define UTF16W_COMBINING_DOWN_TACK_BELOW L"\u031E"
#define UTF16W_COMBINING_PLUS_SIGN_BELOW L"\u031F"
#define UTF16W_COMBINING_MINUS_SIGN_BELOW L"\u0320"
#define UTF16W_COMBINING_PALATALIZED_HOOK_BELOW L"\u0321"
#define UTF16W_COMBINING_RETROFLEX_HOOK_BELOW L"\u0322"
#define UTF16W_COMBINING_DOT_BELOW L"\u0323"
#define UTF16W_COMBINING_DIAERESIS_BELOW L"\u0324"
#define UTF16W_COMBINING_RING_BELOW L"\u0325"
#define UTF16W_COMBINING_COMMA_BELOW L"\u0326"
#define UTF16W_COMBINING_CEDILLA L"\u0327"
#define UTF16W_COMBINING_OGONEK L"\u0328"
#define UTF16W_COMBINING_VERTICAL_LINE_BELOW L"\u0329"
#define UTF16W_COMBINING_BRIDGE_BELOW L"\u032A"
#define UTF16W_COMBINING_INVERTED_DOUBLE_ARCH_BELOW L"\u032B"
#define UTF16W_COMBINING_CARON_BELOW L"\u032C"
#define UTF16W_COMBINING_CIRCUMFLEX_ACCENT_BELOW L"\u032D"
#define UTF16W_COMBINING_BREVE_BELOW L"\u032E"
#define UTF16W_COMBINING_INVERTED_BREVE_BELOW L"\u032F"
#define UTF16W_COMBINING_TILDE_BELOW L"\u0330"
#define UTF16W_COMBINING_MACRON_BELOW L"\u0331"
#define UTF16W_COMBINING_LOW_LINE L"\u0332"
#define UTF16W_COMBINING_DOUBLE_LOW_LINE L"\u0333"
#define UTF16W_COMBINING_TILDE_OVERLAY L"\u0334"
#define UTF16W_COMBINING_SHORT_STROKE_OVERLAY L"\u0335"
#define UTF16W_COMBINING_LONG_STROKE_OVERLAY L"\u0336"
#define UTF16W_COMBINING_SHORT_SOLIDUS_OVERLAY L"\u0337"
#define UTF16W_COMBINING_LONG_SOLIDUS_OVERLAY L"\u0338"
#define UTF16W_COMBINING_RIGHT_HALF_RING_BELOW L"\u0339"
#define UTF16W_COMBINING_INVERTED_BRIDGE_BELOW L"\u033A"
#define UTF16W_COMBINING_SQUARE_BELOW L"\u033B"
#define UTF16W_COMBINING_SEAGULL_BELOW L"\u033C"
#define UTF16W_COMBINING_X_ABOVE L"\u033D"
#define UTF16W_COMBINING_VERTICAL_TILDE L"\u033E"
#define UTF16W_COMBINING_DOUBLE_OVERLINE L"\u033F"
#define UTF16W_COMBINING_GRAVE_TONE_MARK L"\u0340"
#define UTF16W_COMBINING_ACUTE_TONE_MARK L"\u0341"
#define UTF16W_COMBINING_GREEK_PERISPOMENI L"\u0342"
#define UTF16W_COMBINING_GREEK_KORONIS L"\u0343"
#define UTF16W_COMBINING_GREEK_DIALYTIKA_TONOS L"\u0344"
#define UTF16W_COMBINING_GREEK_YPOGEGRAMMENI L"\u0345"
#define UTF16W_COMBINING_BRIDGE_ABOVE L"\u0346"
#define UTF16W_COMBINING_EQUALS_SIGN_BELOW L"\u0347"
#define UTF16W_COMBINING_DOUBLE_VERTICAL_LINE_BELOW L"\u0348"
#define UTF16W_COMBINING_LEFT_ANGLE_BELOW L"\u0349"
#define UTF16W_COMBINING_NOT_TILDE_ABOVE L"\u034A"
#define UTF16W_COMBINING_HOMOTHETIC_ABOVE L"\u034B"
#define UTF16W_COMBINING_ALMOST_EQUAL_TO_ABOVE L"\u034C"
#define UTF16W_COMBINING_LEFT_RIGHT_ARROW_BELOW L"\u034D"
#define UTF16W_COMBINING_UPWARDS_ARROW_BELOW L"\u034E"
#define UTF16W_COMBINING_GRAPHEME_JOINER L"\u034F"
#define UTF16W_COMBINING_RIGHT_ARROWHEAD_ABOVE L"\u0350"
#define UTF16W_COMBINING_LEFT_HALF_RING_ABOVE L"\u0351"
#define UTF16W_COMBINING_FERMATA L"\u0352"
#define UTF16W_COMBINING_X_BELOW L"\u0353"
#define UTF16W_COMBINING_LEFT_ARROWHEAD_BELOW L"\u0354"
#define UTF16W_COMBINING_RIGHT_ARROWHEAD_BELOW L"\u0355"
#define UTF16W_COMBINING_RIGHT_ARROWHEAD_AND_UP_ARROWHEAD_BELOW L"\u0356"
#define UTF16W_COMBINING_RIGHT_HALF_RING_ABOVE L"\u0357"
#define UTF16W_COMBINING_DOT_ABOVE_RIGHT L"\u0358"
#define UTF16W_COMBINING_ASTERISK_BELOW L"\u0359"
#define UTF16W_COMBINING_DOUBLE_RING_BELOW L"\u035A"
#define UTF16W_COMBINING_ZIGZAG_ABOVE L"\u035B"
#define UTF16W_COMBINING_DOUBLE_BREVE_BELOW L"\u035C"
#define UTF16W_COMBINING_DOUBLE_BREVE L"\u035D"
#define UTF16W_COMBINING_DOUBLE_MACRON L"\u035E"
#define UTF16W_COMBINING_DOUBLE_MACRON_BELOW L"\u035F"
#define UTF16W_COMBINING_DOUBLE_TILDE L"\u0360"
#define UTF16W_COMBINING_DOUBLE_INVERTED_BREVE L"\u0361"
#define UTF16W_COMBINING_DOUBLE_RIGHTWARDS_ARROW_BELOW L"\u0362"
#define UTF16W_COMBINING_LATIN_SMALL_A L"\u0363"
#define UTF16W_COMBINING_LATIN_SMALL_E L"\u0364"
#define UTF16W_COMBINING_LATIN_SMALL_I L"\u0365"
#define UTF16W_COMBINING_LATIN_SMALL_O L"\u0366"
#define UTF16W_COMBINING_LATIN_SMALL_U L"\u0367"
#define UTF16W_COMBINING_LATIN_SMALL_C L"\u0368"
#define UTF16W_COMBINING_LATIN_SMALL_D L"\u0369"
#define UTF16W_COMBINING_LATIN_SMALL_H L"\u036A"
#define UTF16W_COMBINING_LATIN_SMALL_M L"\u036B"
#define UTF16W_COMBINING_LATIN_SMALL_R L"\u036C"
#define UTF16W_COMBINING_LATIN_SMALL_T L"\u036D"
#define UTF16W_COMBINING_LATIN_SMALL_V L"\u036E"
#define UTF16W_COMBINING_LATIN_SMALL_X L"\u036F"
#define UTF16W_GREEK_CAPITAL_ALPHA L"\u0391"
#define UTF16W_GREEK_CAPITAL_BETA L"\u0392"
#define UTF16W_GREEK_CAPITAL_GAMMA L"\u0393"
#define UTF16W_GREEK_CAPITAL_DELTA L"\u0394"
#define UTF16W_GREEK_CAPITAL_EPSILON L"\u0395"
#define UTF16W_GREEK_CAPITAL_ZETA L"\u0396"
#define UTF16W_GREEK_CAPITAL_ETA L"\u0397"
#define UTF16W_GREEK_CAPITAL_THETA L"\u0398"
#define UTF16W_GREEK_CAPITAL_IOTA L"\u0399"
#define UTF16W_GREEK_CAPITAL_KAPPA L"\u039A"
#define UTF16W_GREEK_CAPITAL_LAMDA L"\u039B"
#define UTF16W_GREEK_CAPITAL_MU L"\u039C"
#define UTF16W_GREEK_CAPITAL_NU L"\u039D"
#define UTF16W_GREEK_CAPITAL_XI L"\u039E"
#define UTF16W_GREEK_CAPITAL_OMICRON L"\u039F"
#define UTF16W_GREEK_CAPITAL_PI L"\u03A0"
#define UTF16W_GREEK_CAPITAL_RHO L"\u03A1"
#define UTF16W_GREEK_CAPITAL_SIGMA L"\u03A3"
#define UTF16W_GREEK_CAPITAL_TAU L"\u03A4"
#define UTF16W_GREEK_CAPITAL_UPSILON L"\u03A5"
#define UTF16W_GREEK_CAPITAL_PHI L"\u03A6"
#define UTF16W_GREEK_CAPITAL_CHI L"\u03A7"
#define UTF16W_GREEK_CAPITAL_PSI L"\u03A8"
#define UTF16W_GREEK_CAPITAL_OMEGA L"\u03A9"
#define UTF16W_GREEK_SMALL_ALPHA L"\u03B1"
#define UTF16W_GREEK_SMALL_BETA L"\u03B2"
#define UTF16W_GREEK_SMALL_GAMMA L"\u03B3"
#define UTF16W_GREEK_SMALL_DELTA L"\u03B4"
#define UTF16W_GREEK_SMALL_EPSILON L"\u03B5"
#define UTF16W_GREEK_SMALL_ZETA L"\u03B6"
#define UTF16W_GREEK_SMALL_ETA L"\u03B7"
#define UTF16W_GREEK_SMALL_THETA L"\u03B8"
#define UTF16W_GREEK_SMALL_IOTA L"\u03B9"
#define UTF16W_GREEK_SMALL_KAPPA L"\u03BA"
#define UTF16W_GREEK_SMALL_LAMDA L"\u03BB"
#define UTF16W_GREEK_SMALL_MU L"\u03BC"
#define UTF16W_GREEK_SMALL_NU L"\u03BD"
#define UTF16W_GREEK_SMALL_XI L"\u03BE"
#define UTF16W_GREEK_SMALL_OMICRON L"\u03BF"
#define UTF16W_GREEK_SMALL_PI L"\u03C0"
#define UTF16W_GREEK_SMALL_RHO L"\u03C1"
#define UTF16W_GREEK_SMALL_FINAL_SIGMA L"\u03C2"
#define UTF16W_GREEK_SMALL_SIGMA L"\u03C3"
#define UTF16W_GREEK_SMALL_TAU L"\u03C4"
#define UTF16W_GREEK_SMALL_UPSILON L"\u03C5"
#define UTF16W_GREEK_SMALL_PHI L"\u03C6"
#define UTF16W_GREEK_SMALL_CHI L"\u03C7"
#define UTF16W_GREEK_SMALL_PSI L"\u03C8"
#define UTF16W_GREEK_SMALL_OMEGA L"\u03C9"
#define UTF16W_OGHAM_SPACE_MARK L"\u1680"
#define UTF16W_MONGOLIAN_VOWEL_SEPARATOR L"\u180E"
#define UTF16W_EN_QUAD L"\u2000"
#define UTF16W_EM_QUAD L"\u2001"
#define UTF16W_EN_SPACE L"\u2002"
#define UTF16W_EM_SPACE L"\u2003"
#define UTF16W_THREE_PER_EM_SPACE L"\u2004"
#define UTF16W_FOUR_PER_EM_SPACE L"\u2005"
#define UTF16W_SIX_PER_EM_SPACE L"\u2006"
#define UTF16W_FIGURE_SPACE L"\u2007"
#define UTF16W_PUNCTUATION_SPACE L"\u2008"
#define UTF16W_THIN_SPACE L"\u2009"
#define UTF16W_HAIR_SPACE L"\u200A"
#define UTF16W_ZERO_WIDTH_SPACE L"\u200B"
#define UTF16W_ZERO_WIDTH_NON_JOINER L"\u200C"
#define UTF16W_ZERO_WIDTH_JOINER L"\u200D"
#define UTF16W_LINE_SEPARATOR L"\u2028"
#define UTF16W_PARAGRAPH_SEPARATOR L"\u2029"
#define UTF16W_NARROW_NO_BREAK_SPACE L"\u202F"
#define UTF16W_MEDIUM_MATHEMATICAL_SPACE L"\u205F"
#define UTF16W_WORD_JOINER L"\u2060"
#define UTF16W_IDEOGRAPHIC_SPACE L"\u3000"
#define UTF16W_ZERO_WIDTH_NO_BREAK_SPACE L"\uFEFF"
| 60.498575 | 78 | 0.652837 | wvffle |
5a0a154003aa0708028043afe8b398252241bc52 | 4,034 | cpp | C++ | src/ped-hi-main.cpp | yp/Heu-MCHC | 30c4a5e189c7ab67d82357d2c8a98833a556345a | [
"BSD-3-Clause"
] | 1 | 2020-06-30T04:39:34.000Z | 2020-06-30T04:39:34.000Z | src/ped-hi-main.cpp | yp/Heu-MCHC | 30c4a5e189c7ab67d82357d2c8a98833a556345a | [
"BSD-3-Clause"
] | null | null | null | src/ped-hi-main.cpp | yp/Heu-MCHC | 30c4a5e189c7ab67d82357d2c8a98833a556345a | [
"BSD-3-Clause"
] | null | null | null | /**
*
*
* Heu-MCHC
*
* A fast and accurate heuristic algorithm for the haplotype inference
* problem on pedigree data with recombinations and mutations
*
* Copyright (C) 2009,2010,2011 Yuri PIROLA
*
* Distributed under the terms of the GNU General Public License (GPL)
*
*
* This file is part of Heu-MCHC.
*
* Heu-MCHC is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Heu-MCHC 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 Heu-MCHC. If not, see <http://www.gnu.org/licenses/>.
*
**/
#include "locus-graph.hpp"
#include "log.h"
#include "my_time.h"
#include "util.h"
#include "gen-ped-IO.h"
#include "solve.hpp"
#include "log-build-info.h"
#define DEFAULT_GAMMA 0.20
#ifndef MAX_TENT
#define MAX_TENT 10
#endif
#ifndef MAX_EVENTS
#define MAX_EVENTS 2000
#endif
using namespace std;
pmytime pt_gauss;
#if (defined NO_MUTATIONS) || (defined NO_RECOMBINATIONS)
// if mutations or recombinations are not admitted, do no prefer
// anything
static const BP_T p1min[2]= {0.001, 0.001};
static const BP_T p1max[2]= {0.125, 0.125};
#else
// if mutations and recombinations are admitted, prefer recombinations
static const BP_T p1min[2]= {0.00075, 0.001};
static const BP_T p1max[2]= {0.10000, 0.125};
#endif
int main(int argc, char * argv[]) {
double gamma= DEFAULT_GAMMA;
char* foutname= "out.txt";
if (argc>1) {
foutname= argv[1];
}
if (argc>2) {
gamma= atoi(argv[2])/100.0;
}
INFO("PED-HI started.");
PRINT_SYSTEM_INFORMATIONS;
pmytime pt_gen= MYTIME_create_with_name("general timer");
pt_gauss= MYTIME_create_with_name("gauss timer");
MYTIME_start(pt_gen);
pgenped gp= gp_read_from_file(stdin);
BP_T* p1= NPALLOC(BP_T, ped::e_variable_t::N_KINDS);
ped::e_vars_t* mut_vars= NULL;
size_t max_mut= MAX_EVENTS;
for (size_t tent= 0; tent<MAX_TENT; ++tent) {
srand(tent*1981);
for (size_t i= 0; i<ped::e_variable_t::N_KINDS; ++i) {
#if MAX_TENT > 1
p1[i]= p1min[i]+((p1max[i]-p1min[i])*(MAX_TENT-tent-1)/(MAX_TENT-1));
#else
p1[i]= p1max[i];
#endif
}
try {
INFO("**** Starting new trial.");
ped::e_vars_t* ris= calculate_minimum_solution(gp, max_mut, gamma, p1);
INFO("Trial " ST_FMTL(3) " . No. of events= " ST_FMT "", tent+1, ris->size());
STATS("# trial " ST_FMT "", tent+1);
STATS("# predicted events " ST_FMT "", ris->size());
if (mut_vars==NULL || ris->size()<mut_vars->size()) {
if (mut_vars!=NULL)
delete mut_vars;
mut_vars= ris;
max_mut= mut_vars->size();
FILE* fout= fopen(foutname, "w");
fprintf(fout, "= RESULTING EVENTS\n");
for(ped::e_vars_t::const_iterator it= mut_vars->begin();
it!=mut_vars->end();
++it) {
fprintf(fout, "= %s %4d %4d %2d\n", ped::kind_names[(*it).kind()], (*it).i, (*it).l, (*it).p);
}
fclose(fout);
} else {
delete ris;
}
} catch (ped_hi_exception& e) {
ERROR("Trial " ST_FMTL(3) " failed. \"%s\"", tent+1, e.get_message().c_str());
}
}
if (mut_vars!=NULL) {
FILE* fout= fopen(foutname, "w");
fprintf(fout, "= RESULTING EVENTS\n");
for(ped::e_vars_t::const_iterator it= mut_vars->begin();
it!=mut_vars->end();
++it) {
fprintf(fout, "= %s %4d %4d %2d\n", ped::kind_names[(*it).kind()], (*it).i, (*it).l, (*it).p);
}
fclose(fout);
delete mut_vars;
} else {
FATAL("No trials ended with a valid mutation set.");
}
pfree(p1);
gp_destroy(gp);
MYTIME_stop(pt_gen);
MYTIME_LOG(pt_gauss);
MYTIME_LOG(pt_gen);
INFO("PED-HI stopped.");
MYTIME_destroy(pt_gen);
MYTIME_destroy(pt_gauss);
resource_usage_log();
return 0;
}
| 28.20979 | 98 | 0.658651 | yp |
5a0af5da6763ec46d135ba38bdeefe44148cd1b6 | 59,121 | cpp | C++ | morph.cpp | 1Hyena/atomorph | bea16cbf810d153072d3c2d7632341e6ead3632e | [
"MIT"
] | 2 | 2019-11-26T04:46:27.000Z | 2020-12-24T06:04:31.000Z | morph.cpp | 1Hyena/atomorph | bea16cbf810d153072d3c2d7632341e6ead3632e | [
"MIT"
] | 1 | 2018-08-20T23:35:21.000Z | 2018-08-21T07:50:55.000Z | morph.cpp | 1Hyena/atomorph | bea16cbf810d153072d3c2d7632341e6ead3632e | [
"MIT"
] | null | null | null | /*
* See Copyright Notice in atomorph.h
*/
#include "atomorph.h"
namespace am {
morph::morph() {
std::default_random_engine e(0);
e1 = e;
}
morph::~morph() {
clear();
}
void morph::clear() {
while (!frames.empty()) {
frame f = frames.begin()->second;
while (!f.blobs.empty()) {
delete f.blobs.back();
f.blobs.pop_back();
}
frames.erase(frames.begin());
}
frames.clear();
while (!chains.empty()) {
chain c = chains.begin()->second;
clear_chain(&c);
chains.erase(chains.begin());
}
chains.clear();
identifier= 0;
energy = 0.0;
bbox_x1 = UINT16_MAX;
bbox_y1 = UINT16_MAX;
bbox_x2 = 0;
bbox_y2 = 0;
if (worker.is_running()) {
worker.stop();
worker.clear();
}
if (fluid) delete fluid;
}
void morph::compute() {
if (is_busy()) return;
if (worker.is_running()) worker.resume();
else worker.start();
}
void morph::iterate(size_t iterations) {
if (is_busy()) return;
if (worker.is_running()) worker.resume(iterations);
else worker.start (iterations);
}
void morph::compute(double seconds) {
if (is_busy()) return;
if (worker.is_running()) worker.resume(seconds);
else worker.start(seconds);
}
void morph::suspend() {
while (is_busy()) {
// Attempt to suspend the worker.
worker.pause();
std::this_thread::sleep_for(std::chrono::milliseconds(0));
}
}
bool morph::suspend(double timeout) {
if (!is_busy()) return true;
std::chrono::steady_clock::time_point t_start, t_end;
t_start = std::chrono::steady_clock::now();
while (1) {
// Attempt to suspend the worker.
worker.pause();
if (worker.is_paused()) break;
t_end = std::chrono::steady_clock::now();
if (std::chrono::duration_cast<std::chrono::nanoseconds>(t_end - t_start).count() > (timeout * 1000000000)) {
return false;
}
std::this_thread::sleep_for(std::chrono::milliseconds(0));
}
return true;
}
bool morph::synchronize() {
if (!worker.is_paused()) return false;
if (worker.get_seed() != seed) worker.set_seed(seed);
worker.set_blob_delimiter (blob_delimiter);
worker.set_blob_threshold (blob_threshold);
worker.set_blob_max_size (blob_max_size);
worker.set_blob_min_size (blob_min_size);
worker.set_blob_box_grip (blob_box_grip);
worker.set_blob_box_samples(blob_box_samples);
worker.set_blob_number (blob_number);
worker.set_degeneration (degeneration);
worker.set_density (density);
worker.set_threads (threads);
worker.set_cycle_length (cycle_length);
worker.set_bbox(bbox_x1, bbox_y1, bbox_x2, bbox_y2);
worker.set_blob_weights(blob_rgba_weight, blob_size_weight, blob_xy_weight);
if (identifier != worker.get_identifier()) {
// Reset everything.
worker.clear();
std::map<size_t, frame>::iterator it;
refresh_frames();
for (it=frames.begin(); it!=frames.end(); ++it) {
worker.set_frame(it->first, &(it->second));
}
worker.set_identifier(identifier);
if (fluid) delete fluid;
fluid = nullptr;
}
{
// Load results.
state = worker.get_state();
energy = worker.get_energy();
std::map<size_t, frame>::iterator fit;
for (fit=frames.begin(); fit!=frames.end(); ++fit) {
frame *to = &(fit->second);
frame *from = worker.get_frame(fit->first);
while (!to->blobs.empty()) {
delete to->blobs.back();
to->blobs.pop_back();
}
to->owners.clear();
for (size_t i=0; i<from->blobs.size(); ++i) {
blob* b= from->blobs[i];
if (!b) continue;
blob* new_blob = new blob;
new_blob->index = to->blobs.size();
new_blob->r = b->r;
new_blob->g = b->g;
new_blob->b = b->b;
new_blob->a = b->a;
new_blob->x = b->x;
new_blob->y = b->y;
new_blob->surface = b->surface;
new_blob->group = b->group;
to->blobs.push_back(new_blob);
}
}
const std::map<size_t, chain> *chains_from = worker.get_chains();
std::map<size_t, chain>::const_iterator cit;
// Get chain updates from worker's chains.
for (cit=chains_from->begin(); cit!=chains_from->end(); ++cit) {
size_t chain_key = cit->first;
// If this chain already exists, it might have different attributes.
if ((chains[chain_key].width != chains_from->at(chain_key).width
|| chains[chain_key].height != chains_from->at(chain_key).height)) {
// Chains are different, free the target to allocate memory again later.
if (!renew_chain(&(chains[chain_key]), cit->second.width, cit->second.height)) {
chains.erase(chain_key);
return false;
}
}
// Normally the above memory allocation is not needed because the morph should
// not change its parameters very often, although the implementation allows it
// by essentially restarting the whole procedure whenever critical parameters
// change. For normal synchronization, only the below code is called to refresh
// the key points and splines for example.
for (size_t y=0; y<chains[chain_key].height; ++y) {
for (size_t x=0; x<chains[chain_key].width; ++x) {
chains[chain_key].points[x][y] = chains_from->at(chain_key).points[x][y];
double vx = chains[chain_key].points[x][y].s.x + chains[chain_key].points[x][y].s.x_fract / double(UINT8_MAX+1);
double vy = chains[chain_key].points[x][y].s.y + chains[chain_key].points[x][y].s.y_fract / double(UINT8_MAX+1);
if (y == 0) chains[chain_key].splines[x].clearCPoints();
chains[chain_key].splines[x].AddSplinePoint(glnemo::Vec3D(vx, vy, 0.0));
}
}
if (chains[chain_key].max_surface != chains_from->at(chain_key).max_surface) {
// Number of particles in the fluid simulator has changed, reset the simulation.
chains[chain_key].max_surface = chains_from->at(chain_key).max_surface;
if (fluid) {
delete fluid;
fluid = nullptr;
}
}
}
// Delete chains that don't exist in worker's chains.
std::vector<size_t> delete_keys;
for (cit=chains.begin(); cit!=chains.end(); ++cit) {
if (chains_from->find(cit->first) != chains_from->end()) continue;
delete_keys.push_back(cit->first);
}
while (!delete_keys.empty()) {
clear_chain(&(chains[delete_keys.back()]));
chains.erase(delete_keys.back());
delete_keys.pop_back();
}
worker.set_identifier(identifier);
if (skip_state) {
worker.next_state();
skip_state = false;
}
// Initialize the fluid simulator if needed.
if (!fluid && width > 0 && height > 0) {
size_t particle_count = 0;
for (cit=chains.begin(); cit!=chains.end(); ++cit) {
particle_count += cit->second.max_surface;
}
fluid = new (std::nothrow) FluidModel(width*sparseness+20, height*sparseness+20, particle_count);
if (fluid) {
Particle *particles = fluid->getParticles();
for (size_t i=0; i<particle_count; ++i) {
Particle *p = &(particles[i]);
p->clear();
p->x = width *sparseness/2.0 - 10;
p->y = height*sparseness/2.0 - 10;
p->u = 0.0;
p->v = 0.0;
p->gravity_x = p->x;
p->gravity_y = p->y;
p->freedom_r = 1.0;
p->R = 0.0; p->r = p->R;
p->G = 1.0; p->g = p->G; // Should never appear in morphs.
p->B = 0.0; p->b = p->B;
p->A = 1.0; p->a = p->A;
p->active = false;
p->mature = false;
}
}
}
}
return true;
}
void morph::refresh_frames() {
std::map<size_t, frame>::iterator it;
size_t index = 0;
for (it=frames.begin(); it!=frames.end(); ++it) {
it->second.index = index++;
if (it->second.pixels.empty()) {
it->second.x = (bbox_x1 <= bbox_x2 ? (bbox_x1 + bbox_x2)/2.0 : 0.0);
it->second.y = (bbox_y1 <= bbox_y2 ? (bbox_y1 + bbox_y2)/2.0 : 0.0);
it->second.r = 0.0;
it->second.g = 0.0;
it->second.b = 0.0;
it->second.a = 0.0;
}
}
}
bool morph::add_frame(size_t frame_key) {
if (frames.find(frame_key) != frames.end()) return false;
frames[frame_key].x = (bbox_x1 <= bbox_x2 ? (bbox_x1 + bbox_x2)/2.0 : 0.0);
frames[frame_key].y = (bbox_y1 <= bbox_y2 ? (bbox_y1 + bbox_y2)/2.0 : 0.0);
refresh_frames();
return true;
}
bool morph::add_pixel(size_t frame_key, pixel px) {
if (blob_delimiter == HSP) {
px.c = rgb_to_hsp(px.c);
}
add_frame(frame_key);
am::frame *f = &(frames[frame_key]);
auto pixelmap = &(f->pixels);
size_t pos = px.y * (UINT16_MAX+1) + px.x;
(*pixelmap)[pos] = px;
identifier++;
if (px.x < bbox_x1) bbox_x1 = px.x;
if (px.y < bbox_y1) bbox_y1 = px.y;
if (px.x > bbox_x2) bbox_x2 = px.x;
if (px.y > bbox_y2) bbox_y2 = px.y;
if (pixelmap->size() == 1) {
f->x = px.x;
f->y = px.y;
f->r = px.c.r / 255.0;
f->g = px.c.g / 255.0;
f->b = px.c.b / 255.0;
f->a = px.c.a / 255.0;
return true;
}
double weight = 1.0 / double(pixelmap->size());
f->x = (1.0 - weight)*f->x + weight*px.x;
f->y = (1.0 - weight)*f->y + weight*px.y;
f->r = (1.0 - weight)*f->r + weight*(px.c.r/255.0);
f->g = (1.0 - weight)*f->g + weight*(px.c.g/255.0);
f->b = (1.0 - weight)*f->b + weight*(px.c.b/255.0);
f->a = (1.0 - weight)*f->a + weight*(px.c.a/255.0);
return true;
}
pixel morph::get_average_pixel (size_t f) {
pixel px = create_pixel(0,0,0,0,0,0);
if (!has_frame(f)) return px;
px.x = round(frames[f].x);
px.y = round(frames[f].y);
px.c.r = round(255.0*frames[f].r);
px.c.g = round(255.0*frames[f].g);
px.c.b = round(255.0*frames[f].b);
px.c.a = round(255.0*frames[f].a);
if (blob_delimiter == HSP) {
px.c = hsp_to_rgb(px.c);
}
return px;
}
pixel morph::get_average_pixel (size_t f, size_t b) {
pixel px = create_pixel(0,0,0,0,0,0);
if (!has_frame(f)
|| frames[f].blobs.size() <= b
|| frames[f].blobs[b] == nullptr) {
return px;
}
px.x = round(frames[f].blobs[b]->x);
px.y = round(frames[f].blobs[b]->y);
px.c.r = round(255.0*frames[f].blobs[b]->r);
px.c.g = round(255.0*frames[f].blobs[b]->g);
px.c.b = round(255.0*frames[f].blobs[b]->b);
px.c.a = round(255.0*frames[f].blobs[b]->a);
if (blob_delimiter == HSP) {
px.c = hsp_to_rgb(px.c);
}
return px;
}
pixel morph::get_pixel (size_t f, size_t pos) {
pixel px = create_pixel(0,0,0,0,0,0);
if (!has_pixel(f,pos)) {
// Asking a pixel from void gives
// a fully transparent pixel.
return px;
}
px = frames[f].pixels[pos];
if (blob_delimiter == HSP) {
px.c = hsp_to_rgb(px.c);
}
return px;
}
size_t morph::get_pixel_count (size_t f) {
if (!has_frame(f)) return 0;
return frames[f].pixels.size();
}
size_t morph::get_blob_count (size_t f) {
if (!has_frame(f)) return 0;
return frames[f].blobs.size();
}
size_t morph::get_frame_key (double t) {
double integ;
t = std::modf(t, &integ);
if (t < 0.0) t += 1.0;
size_t f = t * frames.size();
std::map<size_t, frame>::iterator it;
size_t i=0;
size_t frame = SIZE_MAX;
for (it=frames.begin(); it!=frames.end(); ++it) {
if (i++ == f) {
frame = it->first;
break;
}
}
return frame;
}
size_t morph::get_blob_count () {
size_t count = 0;
std::map<size_t, frame>::iterator it;
for (it=frames.begin(); it!=frames.end(); ++it) {
count += get_blob_count(it->first);
}
return count;
}
void morph::set_seed(unsigned seed) {
std::default_random_engine e(seed);
e1 = e;
PerlinNoise l_map(seed); lag_map = l_map;
PerlinNoise s_map(seed+1); slope_map = s_map;
this->seed = seed;
}
double morph::normalize_time(double t) {
double integ, time = std::modf(t, &integ);
if (time < 0.0) time += 1.0;
return time;
}
const blob* morph::get_pixels(size_t blob_index, double time, std::vector<pixel> *to) {
time = normalize_time(time);
double t = time;
if (frames.empty()) return nullptr;
size_t frame_key = get_frame_key(t);
size_t blob_count = get_blob_count(frame_key);
if (blob_index >= blob_count) return nullptr;
double dt = 1.0 / double(frames.size());
t = std::max(0.0, (t - (frame_key * dt)) / dt);
const blob * bl = get_blob(frame_key, blob_index);
if (!bl) return nullptr;
if (chains.empty()) {
std::set<size_t>::iterator it;
for (it=bl->surface.begin(); it!=bl->surface.end(); ++it) {
pixel px = get_pixel(frame_key, *it);
to->push_back(px);
}
}
else {
std::map<size_t, std::vector<color >> colors;
std::map<size_t, std::vector<double>> weights;
if (chains.find(bl->group) == chains.end()) return nullptr;
size_t w = chains[bl->group].width;
size_t h = chains[bl->group].height;
point**p = chains[bl->group].points;
size_t y = frames[frame_key].index;
size_t y_next = (y+1)%h;
assert(y < h);
std::map<size_t, frame>::iterator it = frames.find(frame_key);
++it;
if (it == frames.end()) it = frames.begin();
size_t next_frame_key = it->first;
for (size_t x=0; x<w; ++x) {
pixel px1, px2;
point pt1 = p[x][y];
point pt2 = p[x][y_next];
if (!point_has_pixel(pt1)
&& !point_has_pixel(pt2)) continue;
if (point_has_pixel(pt1)
&& !point_has_pixel(pt2)) {
px1 = get_pixel(frame_key, xy2pos(pt1.s.x, pt1.s.y));
px2 = px1;
px2.x = pt2.s.x;
px2.y = pt2.s.y;
px2.c.a = 0;
}
else if (point_has_pixel(pt2)
&& !point_has_pixel(pt1)) {
px2 = get_pixel(next_frame_key, xy2pos(pt2.s.x, pt2.s.y));
px1 = px2;
px1.x = pt1.s.x;
px1.y = pt1.s.y;
px1.c.a = 0;
}
else {
px1 = get_pixel(frame_key, xy2pos(pt1.s.x, pt1.s.y));
px2 = get_pixel(next_frame_key, xy2pos(pt2.s.x, pt2.s.y));
}
point pt = pt1;
if (motion == LINEAR) pt = interpolate(pt1, pt2, 1.0 - t);
else if (motion == SPLINE && chains[bl->group].splines) {
glnemo::Vec3D v = chains[bl->group].splines[x].GetInterpolatedSplinePoint(time);
double fract, integ;
fract = std::modf(v.x, &integ); pt.s.x = integ; pt.s.x_fract = std::round(fract * UINT8_MAX);
fract = std::modf(v.y, &integ); pt.s.y = integ; pt.s.y_fract = std::round(fract * UINT8_MAX);
}
pixel px;
px.x = pt.s.x;
px.y = pt.s.y;
if (fading == PERLIN) {
double f = 8.0; // Frequency
int octaves = 8; // Octaves
double bbox_w = bbox_x2 - bbox_x1 + 1.0;
double bbox_h = bbox_y2 - bbox_y1 + 1.0;
double perlin_x = (((pt1.s.x-bbox_x1)*(UINT8_MAX+1)+pt1.s.x_fract) / double(bbox_w*(UINT8_MAX+1)))*f;
double perlin_y = (((pt1.s.y-bbox_y1)*(UINT8_MAX+1)+pt1.s.y_fract) / double(bbox_h*(UINT8_MAX+1)))*f;
double lag = lag_map. octaveNoise(perlin_x, perlin_y, octaves)*0.5 + 0.5;
double slope = slope_map.octaveNoise(perlin_x, perlin_y, 8)*0.5 + 0.5;
px.c = interpolate(px1.c, px2.c, lag, slope, 1.0 - t);
}
else if (fading == COSINE) px.c = interpolate(px1.c, px2.c, 0.5, 0.5, 1.0 - t);
else px.c = interpolate(px1.c, px2.c, 1.0 - t);
if (px.x >= width || px.y >= height) {
if (px.x > bbox_x2 || px.x < bbox_x1
|| px.y > bbox_y2 || px.y < bbox_y1) continue;
}
// Bilinear interpolation:
double total_weight= UINT8_MAX * UINT8_MAX;
double weight_x1y1 = ((UINT8_MAX - pt.s.x_fract) * (UINT8_MAX - pt.s.y_fract)) / total_weight;
double weight_x2y1 = ( pt.s.x_fract * (UINT8_MAX - pt.s.y_fract)) / total_weight;
double weight_x1y2 = ((UINT8_MAX - pt.s.x_fract) * pt.s.y_fract ) / total_weight;
double weight_x2y2 = ( pt.s.x_fract * pt.s.y_fract ) / total_weight;
size_t pos = xy2pos(px.x, px.y);
if (weight_x1y1 > 0.0) {
colors [pos].push_back(px.c);
weights[pos].push_back(weight_x1y1);
}
if ((px.x < bbox_x2 || px.x+1 < width) && weight_x2y1 > 0.0) {
pos = xy2pos(px.x + 1, px.y);
colors [pos].push_back(px.c);
weights[pos].push_back(weight_x2y1);
}
if ((px.y < bbox_y2 || px.y+1 < height) && weight_x1y2 > 0.0) {
pos = xy2pos(px.x, px.y + 1);
colors [pos].push_back(px.c);
weights[pos].push_back(weight_x1y2);
}
if (weight_x2y2 > 0.0) {
if ((px.y < bbox_y2 && px.x < bbox_x2)
|| (px.y+1 < height && px.x+1 < width)) {
pos = xy2pos(px.x + 1, px.y + 1);
colors [pos].push_back(px.c);
weights[pos].push_back(weight_x2y2);
}
}
}
std::map<size_t, pixel> blob;
std::map<size_t, std::vector<color>>::iterator cit;
for (cit = colors.begin(); cit!=colors.end(); ++cit) {
std::vector<color> *cs = &(cit->second);
std::vector<double>*ws = &(weights[cit->first]);
size_t vsz = cs->size();
double r = 0.0, g = 0.0, b = 0.0, a = 0.0;
double weight_sum = 0.0;
for (size_t c = 0; c<vsz; ++c) {
weight_sum += ws->at(c);
r += cs->at(c).r * ws->at(c);
g += cs->at(c).g * ws->at(c);
b += cs->at(c).b * ws->at(c);
a += cs->at(c).a * ws->at(c);
}
double w = density > 0 ? double(vsz)/double(density) : 0.0;
if (w > 1.0) w = 1.0;
r = std::round(r/weight_sum);
g = std::round(g/weight_sum);
b = std::round(b/weight_sum);
a = std::round(w*(a/weight_sum));
size_t pos = cit->first;
uint16_t x = pos % (UINT16_MAX+1);
uint16_t y = pos / (UINT16_MAX+1);
pixel px = create_pixel(x,y,r,g,b,a);
if (feather > 0) blob[pos] = px;
else to->push_back(px);
}
if (feather > 0) {
std::vector<std::set<size_t>> layers;
std::map<size_t, pixel> peeled_blob = blob;
while (!peeled_blob.empty() && layers.size() < feather) {
std::set<size_t> border;
std::map<size_t, pixel>::iterator pit;
for (pit = peeled_blob.begin(); pit!=peeled_blob.end(); ++pit) {
size_t pos = pit->first;
uint16_t x = pos % (UINT16_MAX+1);
uint16_t y = pos / (UINT16_MAX+1);
if (x == 0 || x == UINT16_MAX
|| y == 0 || y == UINT16_MAX) {
border.insert(pos);
continue;
}
if (peeled_blob.find(xy2pos(x+1, y )) == peeled_blob.end()
|| peeled_blob.find(xy2pos(x-1, y )) == peeled_blob.end()
|| peeled_blob.find(xy2pos(x, y+1)) == peeled_blob.end()
|| peeled_blob.find(xy2pos(x, y-1)) == peeled_blob.end()) {
border.insert(pos);
}
}
std::set<size_t>::iterator bt;
for (bt = border.begin(); bt != border.end(); ++bt) {
size_t pos = *bt;
peeled_blob.erase(pos);
}
layers.push_back(border);
}
size_t lsz = layers.size();
for (size_t l=0; l<lsz; ++l) {
std::set<size_t> *layer = &(layers[l]);
std::set<size_t>::iterator lt;
for (lt = layer->begin(); lt != layer->end(); ++lt) {
pixel px = blob[*lt];
px.c.a = std::round(double(px.c.a)*(double(l+1)/double(feather+1)));
to->push_back(px);
}
}
std::map<size_t, pixel>::iterator pit;
for (pit = peeled_blob.begin(); pit!=peeled_blob.end(); ++pit) {
to->push_back(pit->second);
}
}
}
return bl;
}
void morph::update_particle( Particle *p, const blob * blob_before, const blob * blob_after, point **points,
std::map<size_t, size_t>& sources, std::map<size_t, size_t>& destinations, double t,
size_t y, size_t y_next, size_t frame_key, size_t next_frame_key, size_t chain_key, double time )
{
double previous_surface = blob_before->surface.size();
double next_surface = blob_after->surface.size();
size_t src_pos = p->source_pos;
size_t dst_pos = p->destination_pos;
size_t src_x = sources[src_pos];
size_t dst_x = destinations[dst_pos];
// If area is growing then gain the real source x from the destination.
if (next_surface > previous_surface) {
src_x = destinations[dst_pos];
}
{
point pt1 = points[src_x][y];
point pt2 = points[dst_x][y_next];
pixel px1, px2;
if (point_has_pixel(pt1)
&& !point_has_pixel(pt2)) {
px1 = get_pixel(frame_key, xy2pos(pt1.s.x, pt1.s.y));
px2 = px1;
px2.x = pt2.s.x;
px2.y = pt2.s.y;
if (next_surface > 0.0) px2.c.a = 0;
}
else if (point_has_pixel(pt2)
&& !point_has_pixel(pt1)) {
px2 = get_pixel(next_frame_key, xy2pos(pt2.s.x, pt2.s.y));
px1 = px2;
px1.x = pt1.s.x;
px1.y = pt1.s.y;
if (previous_surface > 0.0) px1.c.a = 0;
}
else {
px1 = get_pixel(frame_key, xy2pos(pt1.s.x, pt1.s.y));
px2 = get_pixel(next_frame_key, xy2pos(pt2.s.x, pt2.s.y));
}
color c;
if (fading == PERLIN) {
double f = 8.0; // Frequency
int octaves = 8; // Octaves
double bbox_w = bbox_x2 - bbox_x1 + 1.0;
double bbox_h = bbox_y2 - bbox_y1 + 1.0;
double perlin_x = (((pt1.s.x-bbox_x1)*(UINT8_MAX+1)+pt1.s.x_fract) / double(bbox_w*(UINT8_MAX+1)))*f;
double perlin_y = (((pt1.s.y-bbox_y1)*(UINT8_MAX+1)+pt1.s.y_fract) / double(bbox_h*(UINT8_MAX+1)))*f;
double lag = lag_map. octaveNoise(perlin_x, perlin_y, octaves)*0.5 + 0.5;
double slope = slope_map.octaveNoise(perlin_x, perlin_y, 8)*0.5 + 0.5;
c = interpolate(px1.c, px2.c, lag, slope, 1.0 - t);
}
else if (fading == COSINE) c = interpolate(px1.c, px2.c, 0.5, 0.5, 1.0 - t);
else c = interpolate(px1.c, px2.c, 1.0 - t);
point pt = pt1;
if (motion == LINEAR) pt = interpolate(pt1, pt2, 1.0 - t);
else if (motion == SPLINE && chains[chain_key].splines) {
glnemo::Vec3D v = chains[chain_key].splines[src_x].GetInterpolatedSplinePoint(time);
double fract, integ;
fract = std::modf(v.x, &integ); pt.s.x = integ; pt.s.x_fract = std::round(fract * UINT8_MAX);
fract = std::modf(v.y, &integ); pt.s.y = integ; pt.s.y_fract = std::round(fract * UINT8_MAX);
}
float ptx, pty;
point2xy(pt, &ptx, &pty);
p->gravity_x = std::min(std::max((ptx * sparseness) + 10.0, 1.0), double(width *sparseness + 10.0) );
p->gravity_y = std::min(std::max((pty * sparseness) + 10.0, 1.0), double(height*sparseness + 10.0) );
p->R = c.r/255.0;
p->G = c.g/255.0;
p->B = c.b/255.0;
p->A = c.a/255.0;
if (show_blobs == DISTINCT) {
std::mt19937 gen(chain_key);
std::uniform_real_distribution<double> uniform_dist_color(0.0, 1.0);
p->R = uniform_dist_color(gen);
p->G = uniform_dist_color(gen);
p->B = uniform_dist_color(gen);
p->A = 1.0;
}
else if (show_blobs == AVERAGE) {
p->R = blob_before->r;
p->G = blob_before->g;
p->B = blob_before->b;
p->A = blob_before->a;
}
p->r = t*p->R + (1.0-t)*p->r;
p->g = t*p->G + (1.0-t)*p->g;
p->b = t*p->B + (1.0-t)*p->b;
p->a = t*p->A + (1.0-t)*p->a;
if (!p->mature) {
if (p->source_owner) {
p->x = p->gravity_x;
p->y = p->gravity_y;
// These lines should only be called
// for a newly created particle that was
// first to occupy its source location:
p->r = p->R;
p->g = p->G;
p->b = p->B;
p->a = p->A;
// Otherwise wrongly coloured single particles
// start appearing during the morph when new
// particles are created.
}
if (previous_surface == 0.0) p->strength = 0.1;
else p->strength = 1.0;
p->freedom_r = 1.0;
}
}
}
void morph::step_fluid(size_t frame_key, double t, double time) {
// t is for current transition between 2 images, time is overall time across all key frames.
size_t iptc = 0;
size_t particle_count = fluid->get_particle_count();
Particle *particles = fluid->getParticles();
std::map<size_t, chain>::const_iterator cit;
for (cit=chains.begin(); cit!=chains.end(); ++cit) {
size_t chain_key = cit->first;
size_t w = cit->second.width;
size_t h = cit->second.height;
point **points = cit->second.points;
size_t y = frames[frame_key].index;
size_t y_next = (y+1)%h;
std::map<size_t, frame>::iterator fit = frames.find(frame_key); ++fit;
if (fit == frames.end()) fit = frames.begin();
size_t next_frame_key = fit->first;
const blob* blob_before = find_blob_by_group(frame_key, chain_key);
const blob* blob_after = find_blob_by_group(next_frame_key, chain_key);
double previous_surface = blob_before->surface.size();
double next_surface = blob_after->surface.size();
double current_surface = std::round((1.0-t)*previous_surface + t*next_surface);
size_t active_count = 0;
size_t active_limit = current_surface;
{
std::map<size_t, size_t> sources; // pt1 has fluid, pt2 maybe not
std::map<size_t, size_t> destinations; // pt2 has fluid, pt1 maybe not
std::map<size_t, std::vector<Particle *>> particles_by_destination;
std::map<size_t, std::vector<Particle *>> particles_by_source;
std::vector<Particle *> free_particles;
std::vector<Particle *> update_particles;
for (size_t x=0; x<w && iptc < particle_count; ++x) {
point pt1 = points[x][y];
point pt2 = points[x][y_next];
{
// Map this pixel as a possible destination.
// The vector it holds contains indexes for
// detailed lookups about this destination.
size_t destination_pos = xy2pos(pt2.s.x, pt2.s.y);
if (point_has_fluid(pt2)) {
destinations[destination_pos] = x;
}
// Map this pixel as a possible source.
size_t source_pos = xy2pos(pt1.s.x, pt1.s.y);
if (point_has_fluid(pt1)) {
sources[source_pos] = x;
}
}
{
Particle *p = &(particles[iptc++]);
if (p->active && p->frame_key == frame_key) {
// Map this particle as an existing particle.
active_count++;
particles_by_destination[p->destination_pos].push_back(p);
particles_by_source [p->source_pos ].push_back(p);
update_particles.push_back(p);
}
else {
p->active = false;
free_particles.push_back(p);
}
}
}
if (active_count < active_limit) {
size_t to_create = active_limit - active_count;
// Add new particles.
while (to_create > 0) {
assert(!free_particles.empty());
Particle *p = free_particles.back();
free_particles.pop_back();
update_particles.push_back(p);
p->clear();
p->frame_key = frame_key;
{
bool source_found = false;
std::map<size_t, size_t>::iterator it;
std::vector<size_t > source_candidates;
// First see if any of the source positions is still unused,
// it is the highest priority to have these filled.
for (it=sources.begin(); it!=sources.end(); ++it) {
size_t pos = it->first;
if (particles_by_source.find(pos) != particles_by_source.end()
&& !particles_by_source[pos].empty()) {
// This source is already taken.
continue;
}
// Free source was found, take it.
source_candidates.push_back(pos);
}
if (!source_candidates.empty()) {
std::uniform_int_distribution<size_t> uniform_dist_candidate(0, source_candidates.size()-1);
size_t pos = source_candidates[uniform_dist_candidate(e1)];
assert(sources.find(pos) != sources.end());
size_t x = sources[pos];
p->source_pos = pos;
particles_by_source[pos].push_back(p);
source_found = true;
{
// This source was unoccupied, take its default destination
// even if it leads to a place without HAS_FLUID flag and thus this
// particle must be destroyed sooner or later during this morph.
point pt2 = points[x][y_next];
size_t destination_pos = xy2pos(pt2.s.x, pt2.s.y);
p->destination_pos = destination_pos;
particles_by_destination[destination_pos].push_back(p);
assert(destinations.find(destination_pos) != destinations.end());
}
}
if (!source_found) {
// All sources are already occupied, this new particle must now
// share the source with some other particle, but it will still
// must get an unused destination. Search for such destination.
bool destination_found = false;
for (it=destinations.begin(); it!=destinations.end(); ++it) {
size_t pos = it->first;
size_t x = it->second;
if (particles_by_destination.find(pos) != particles_by_destination.end()
&& !particles_by_destination[pos].empty()) {
// This destination is already taken.
continue;
}
// Free destination was found, take it.
p->destination_pos = pos;
particles_by_destination[pos].push_back(p);
destination_found = true;
{
// Destination was found but all the sources were already
// occupied. Now see the pt1 of this destination even if
// it does not have HAS_FLUID flag.
point pt1 = points[x][y];
size_t source_pos = xy2pos(pt1.s.x, pt1.s.y);
p->source_pos = source_pos;
particles_by_source[source_pos].push_back(p);
source_found = true;
assert(sources.find(source_pos) != sources.end());
}
break;
}
assert(destination_found);
}
assert(source_found);
}
{
size_t pos = p->source_pos;
// Find a suitable starting position for this particle.
if (particles_by_source.find(pos) != particles_by_source.end()
&& particles_by_source[pos].size() > 1) {
// Another particle exists with the same source,
// copy its location for seamless creation.
std::uniform_int_distribution<size_t> uniform_dist_p(0, particles_by_source[pos].size()-2);
Particle *parent = particles_by_source[pos].at(uniform_dist_p(e1));
assert(parent != p);
p->copy_from(parent);
p->mature = parent->mature;
p->strength = parent->strength;
std::uniform_real_distribution<double> uniform_dist_fuzz(0.0, 1.0);
p->x = std::min(p->x + uniform_dist_fuzz(e1), width * sparseness-10.0);
p->y = std::min(p->y + uniform_dist_fuzz(e1), height* sparseness-10.0);
p->source_owner = false;
}
else {
// No other particle currently exists with the
// same source location. Copy the attractor's
// current position for the initial setup of this
// new particle.
p->mature = false;
p->source_owner = true;
update_particle(p, blob_before, blob_after, points, sources,
destinations, t, y, y_next, frame_key,
next_frame_key, chain_key, time);
}
}
p->active = true;
to_create--;
}
}
else if (active_count > active_limit) {
size_t to_delete = active_count - active_limit;
// Delete particles.
std::shuffle(update_particles.begin(), update_particles.end(), e1);
while (to_delete > 0) {
assert(!update_particles.empty());
Particle *p = update_particles.back();
p->active = false;
update_particles.pop_back();
to_delete--;
}
}
{
// Particles either created or deleted by now, update their positions.
size_t usz = update_particles.size();
for (size_t i=0; i < usz; ++i) {
Particle *p = update_particles[i];
if (!p->active) continue;
update_particle(p, blob_before, blob_after, points, sources,
destinations, t, y, y_next, frame_key,
next_frame_key, chain_key, time);
}
}
}
}
double freedom = std::sqrt(width*width + height*height) * double(sparseness) / 4.0;
double freedom_radius = freedom*(1.0 - t);
for (size_t step = 0; step < fluidsteps; ++step) fluid->step(fluidsteps - (step+1), freedom_radius, t);
}
void morph::draw_fluid(double time, std::vector<pixel> *image) {
if (!fluid || chains.empty()) return;
time = normalize_time(time);
double t = time;
if (frames.empty()) return;
size_t frame_key = get_frame_key(t);
double dt = 1.0 / double(frames.size());
t = std::max(0.0, (t - (frame_key * dt)) / dt);
// t is 0.0 at the beginning of frame
// t is 1.0 at the end of this frame
step_fluid(frame_key, t, time);
std::map<size_t, color> image_buffer;
Particle *particles = fluid->getParticles();
size_t particle_count = fluid->get_particle_count();
std::map<size_t, std::vector<color >> colors;
std::map<size_t, std::vector<double >> weights;
std::map<size_t, std::vector<Particle* >> startups;
for (size_t i=0; i<particle_count; ++i) {
Particle *p = &(particles[i]);
if (p->active == false) continue;
{
// Correct the colours so they would not blur too much.
// Blobs that appear from nothingness should be blended
// with their surroundings a lot though to avoid sharp
// gradient spots in the very beginnning of the morph.
//double w = 1.0 / (100.0 * std::pow(t, 2.0)+1.0);
double w = (1.0 / (100.0*std::pow((t-(1.0*(1.0-p->strength))), 2.0)+1.0)) * std::pow(p->strength, 2.0);
p->r = (w * p->R)+(1.0 - w)*p->r;
p->g = (w * p->G)+(1.0 - w)*p->g;
p->b = (w * p->B)+(1.0 - w)*p->b;
p->a = (w * p->A)+(1.0 - w)*p->a;
}
double px, py;
if (p->x <= 10.0) px = 0.0;
else if (p->x >= width*sparseness + 10.0) px = (width-1);
else px = (p->x-10.0)/sparseness;
if (p->y <= 10.0) py = 0.0;
else if (p->y >= height*sparseness+ 10.0) py = (height-1);
else py = (p->y-10.0)/sparseness;
uint16_t x = std::min(int(px), width - 1);
uint16_t y = std::min(int(py), height- 1);
size_t pos = xy2pos(x, y);
if (!p->mature) {
p->mature = true;
}
double x_fract, y_fract;
x_fract = std::modf(px, &px);
y_fract = std::modf(py, &py);
if (px >= width || py >= height) {
if (px > bbox_x2 || px < bbox_x1
|| py > bbox_y2 || py < bbox_y1) continue;
}
// Bilinear interpolation:
double weight_x1y1 = ((1.0 - x_fract) * (1.0 - y_fract));
double weight_x2y1 = ( x_fract * (1.0 - y_fract));
double weight_x1y2 = ((1.0 - x_fract) * y_fract );
double weight_x2y2 = ( x_fract * y_fract );
color c = create_color(p->r, p->g, p->b, p->a);
if (weight_x1y1 > 0.0) {
colors [pos].push_back(c);
weights[pos].push_back(weight_x1y1);
}
if ((x < bbox_x2 || x+1 < width) && weight_x2y1 > 0.0) {
pos = xy2pos(x + 1, y);
colors [pos].push_back(c);
weights[pos].push_back(weight_x2y1);
}
if ((y < bbox_y2 || y+1 < height) && weight_x1y2 > 0.0) {
pos = xy2pos(x, y + 1);
colors [pos].push_back(c);
weights[pos].push_back(weight_x1y2);
}
if (weight_x2y2 > 0.0) {
if ((y < bbox_y2 && x < bbox_x2)
|| (y+1 < height && x+1 < width)) {
pos = xy2pos(x + 1, y + 1);
colors [pos].push_back(c);
weights[pos].push_back(weight_x2y2);
}
}
}
std::map<size_t, color> blob;
std::map<size_t, std::vector<color>>::iterator cit;
for (cit = colors.begin(); cit!=colors.end(); ++cit) {
std::vector<color > *cs = &(cit->second);
std::vector<double > *ws = &(weights[cit->first]);
size_t vsz = cs->size();
double r = 0.0, g = 0.0, b = 0.0, a = 0.0;
double weight_sum = 0.0;
for (size_t c = 0; c<vsz; ++c) {
double weight = ws->at(c);
weight_sum += weight;
r += cs->at(c).r * weight;
g += cs->at(c).g * weight;
b += cs->at(c).b * weight;
a += cs->at(c).a * weight;
}
r = std::round(r/weight_sum);
g = std::round(g/weight_sum);
b = std::round(b/weight_sum);
a = std::round(a/weight_sum);
if (keep_background) {
double alpha = 1.0 - std::pow(t, 24.0);
a *= alpha;
}
size_t pos = cit->first;
uint16_t x = pos % (UINT16_MAX+1);
uint16_t y = pos / (UINT16_MAX+1);
pixel px = create_pixel(x,y,r,g,b,a);
size_t imgpos = y*width + x;
if (feather > 0) blob[pos] = px.c;
else image_buffer[imgpos] = px.c;
}
if (feather > 0) {
for (size_t layer = 0; layer < feather; ++layer) {
double alpha = 1.0 - (double(layer + 1) / double(feather + 1));
std::set<size_t> border;
std::map<size_t, color>::iterator it;
for (it = blob.begin(); it!=blob.end(); ++it) {
size_t pos = it->first;
uint16_t x = pos % (UINT16_MAX+1);
uint16_t y = pos / (UINT16_MAX+1);
size_t ps;
if (x+1 < width && blob.find( (ps = xy2pos(x+1, y )) ) == blob.end()) border.insert(ps);
if (y+1 < height && blob.find( (ps = xy2pos(x, y+1)) ) == blob.end()) border.insert(ps);
if (x > 0 && blob.find( (ps = xy2pos(x-1, y )) ) == blob.end()) border.insert(ps);
if (y > 0 && blob.find( (ps = xy2pos(x, y-1)) ) == blob.end()) border.insert(ps);
}
if (border.empty()) break;
std::map<size_t, color> blob_buf;
for (const auto& pos: border) {
uint16_t x = pos % (UINT16_MAX+1);
uint16_t y = pos / (UINT16_MAX+1);
std::set<size_t> components;
size_t ps;
if (x+1 < width && blob.find( (ps = xy2pos(x+1, y )) ) != blob.end()) components.insert(ps);
if (y+1 < height && blob.find( (ps = xy2pos(x, y+1)) ) != blob.end()) components.insert(ps);
if (x > 0 && blob.find( (ps = xy2pos(x-1, y )) ) != blob.end()) components.insert(ps);
if (y > 0 && blob.find( (ps = xy2pos(x, y-1)) ) != blob.end()) components.insert(ps);
assert(!components.empty());
double r = 0.0, g = 0.0, b = 0.0, a = 0.0;
double w = components.size();
for (const auto& comp: components) {
color c = blob[comp];
r += (c.r/255.0) / w;
g += (c.g/255.0) / w;
b += (c.b/255.0) / w;
a += (c.a/255.0) / w;
}
a *= alpha;
blob_buf[pos] = create_color(r, g, b, a);
}
for (it = blob_buf.begin(); it!=blob_buf.end(); ++it) {
blob[it->first] = it->second;
}
}
std::map<size_t, color>::iterator it;
for (it = blob.begin(); it!=blob.end(); ++it) {
size_t pos = it->first;
uint16_t x = pos % (UINT16_MAX+1);
uint16_t y = pos / (UINT16_MAX+1);
size_t imgpos = y*width + x;
image_buffer[imgpos] = it->second;
}
}
{
std::map<size_t, color>::iterator cit;
for (cit = image_buffer.begin(); cit!=image_buffer.end(); ++cit) {
size_t pos = cit->first;
color c = cit->second;
if (keep_background) {
color bgc = image->at(pos).c;
double bgr = double(bgc.r)/255.0;
double bgg = double(bgc.g)/255.0;
double bgb = double(bgc.b)/255.0;
double bga = double(bgc.a)/255.0;
double r = c.r/255.0;
double g = c.g/255.0;
double b = c.b/255.0;
double a = c.a/255.0;
r = a*r + (1.0-a)*bgr;
g = a*g + (1.0-a)*bgg;
b = a*b + (1.0-a)*bgb;
a = bga + (1.0-bga)*a;
c.r = std::round(r*255.0);
c.g = std::round(g*255.0);
c.b = std::round(b*255.0);
c.a = std::round(a*255.0);
}
image->at(pos).c = c;
}
}
}
void morph::draw_atoms(double t, std::vector<pixel> *image) {
std::map<size_t, std::vector<am::color >> colors;
const am::blob *bl;
size_t b = 0;
std::vector<pixel> pixels;
while ( (bl = get_pixels(b++, t, &pixels)) != nullptr ) {
size_t group = bl->group;
pixel px_ave = blob2pixel(bl);
while (!pixels.empty()) {
pixel px = pixels.back();
size_t pos = px.y*width + px.x;
pixels.pop_back();
if (pos >= image->size()) continue;
unsigned char rr,gg,bb,aa;
if (show_blobs == DISTINCT) {
std::mt19937 gen(group);
std::uniform_int_distribution<unsigned char> uniform_dist_byte(0, 255);
rr = uniform_dist_byte(gen);
gg = uniform_dist_byte(gen);
bb = uniform_dist_byte(gen);
aa = 255;
}
else if (show_blobs == AVERAGE) {
rr = px_ave.c.r;
gg = px_ave.c.g;
bb = px_ave.c.b;
aa = px_ave.c.a;
}
else {
rr = px.c.r;
gg = px.c.g;
bb = px.c.b;
aa = px.c.a;
}
if (aa == 0) continue;
colors[pos].push_back(create_color(rr,gg,bb,aa));
}
}
std::map<size_t, std::vector<color>>::iterator cit;
for (cit = colors.begin(); cit!=colors.end(); ++cit) {
size_t pos = cit->first;
std::vector<color> *cs = &(cit->second);
size_t vsz = cs->size();
double r = 0.0, g = 0.0, b = 0.0, a = 0.0;
double rsum = 0.0, gsum = 0.0, bsum = 0.0, asum = 0.0;
for (size_t c = 0; c<vsz; ++c) {
double sr = cs->at(c).r/255.0;
double sg = cs->at(c).g/255.0;
double sb = cs->at(c).b/255.0;
double sa = cs->at(c).a/255.0;
asum += sa;
rsum += sr*sa;
gsum += sg*sa;
bsum += sb*sa;
if (c == 0) {
r = sr;
g = sg;
b = sb;
a = sa;
}
else {
r = sa*sr + (1.0-sa)*r;
g = sa*sg + (1.0-sa)*g;
b = sa*sb + (1.0-sa)*b;
a = a + (1.0-a)*(cs->at(c).a/255.0);
}
}
if (blend_blobs) {
r = rsum/asum;
g = gsum/asum;
b = bsum/asum;
}
if (keep_background) {
color bgc = image->at(pos).c;
double bgr = double(bgc.r)/255.0;
double bgg = double(bgc.g)/255.0;
double bgb = double(bgc.b)/255.0;
double bga = double(bgc.a)/255.0;
r = a*r + (1.0-a)*bgr;
g = a*g + (1.0-a)*bgg;
b = a*b + (1.0-a)*bgb;
a = bga + (1.0-bga)*a;
}
image->at(pos).c = create_color(r, g, b, a);
}
}
void morph::get_pixels(double t, std::vector<pixel> *image) {
image->clear();
image->reserve(width*height);
for (size_t y=0; y<height; ++y) {
for (size_t x=0; x<width; ++x) {
pixel px = create_pixel(x,y,0,0,0,0);
if (keep_background) px.c = get_background(x, y, t);
image->push_back(px);
}
}
if (fluid && fluidsteps > 0) draw_fluid(t, image);
else draw_atoms(t, image);
return;
}
pixel morph::blob2pixel(const blob *bl) {
pixel px = create_pixel(bl->x, bl->y, create_color(bl->r, bl->g, bl->b, bl->a));
if (blob_delimiter == HSP) {
px.c = hsp_to_rgb(px.c);
}
return px;
}
color morph::get_background(uint16_t x, uint16_t y, double time) {
if (frames.empty()) return create_color(0.0, 0.0 ,0.0 ,0.0);
size_t position = xy2pos(x, y);
time = normalize_time(time);
double t = time;
size_t frame_key = get_frame_key(t);
std::map<size_t, frame>::iterator it = frames.find(frame_key);
++it;
if (it == frames.end()) it = frames.begin();
size_t next_frame_key = it->first;
double dt = 1.0 / double(frames.size());
t = std::max(0.0, (t - (frame_key * dt)) / dt);
color c1 = get_pixel(frame_key, position).c;
color c2 = get_pixel(next_frame_key, position).c;
if (fading == PERLIN) {
double f = 8.0; // Frequency
int octaves = 8; // Octaves
double bbox_w = bbox_x2 - bbox_x1 + 1.0;
double bbox_h = bbox_y2 - bbox_y1 + 1.0;
double perlin_x = ((x-bbox_x1) / double(bbox_w))*f;
double perlin_y = ((y-bbox_y1) / double(bbox_h))*f;
double lag = lag_map. octaveNoise(perlin_x, perlin_y, octaves)*0.5 + 0.5;
double slope = slope_map.octaveNoise(perlin_x, perlin_y, 8)*0.5 + 0.5;
return interpolate(c1, c2, lag, slope, 1.0 - t);
}
else if (fading == COSINE) return interpolate(c1, c2, 0.5, 0.5, 1.0 - t);
return interpolate(c1, c2, 1.0 - t);
}
color morph::interpolate(color c1, color c2, double lag, double slope, double str) {
if (fading == COSINE || fading == PERLIN) {
const double pi = 3.14159265358;
double s = (slope+0.1)/1.1;
double l = (1.0 - s) * lag;
if (str <= l ) str = 0.0;
else if (str >= (l+s)) str = 1.0;
else str = ((-cos((str-l)*(pi/s))+1.0)/2.0);
}
return interpolate(c1, c2, str);
}
color morph::interpolate(color c1, color c2, double c1_weight) {
color c;
c.r = std::round(c1_weight * double(c1.r) + (1.0 - c1_weight) * double(c2.r));
c.g = std::round(c1_weight * double(c1.g) + (1.0 - c1_weight) * double(c2.g));
c.b = std::round(c1_weight * double(c1.b) + (1.0 - c1_weight) * double(c2.b));
c.a = std::round(c1_weight * double(c1.a) + (1.0 - c1_weight) * double(c2.a));
return c;
}
pixel morph::interpolate(pixel px1, pixel px2, double px1_weight) {
pixel px;
px.x = std::round(px1_weight * double(px1.x) + (1.0 - px1_weight) * double(px2.x));
px.y = std::round(px1_weight * double(px1.y) + (1.0 - px1_weight) * double(px2.y));
px.c.r = std::round(px1_weight * double(px1.c.r) + (1.0 - px1_weight) * double(px2.c.r));
px.c.g = std::round(px1_weight * double(px1.c.g) + (1.0 - px1_weight) * double(px2.c.g));
px.c.b = std::round(px1_weight * double(px1.c.b) + (1.0 - px1_weight) * double(px2.c.b));
px.c.a = std::round(px1_weight * double(px1.c.a) + (1.0 - px1_weight) * double(px2.c.a));
return px;
}
point morph::interpolate(point pt1, point pt2, double pt1_weight) {
point pt;
double x1 = (double(UINT8_MAX+1)*pt1.s.x + pt1.s.x_fract);
double y1 = (double(UINT8_MAX+1)*pt1.s.y + pt1.s.y_fract);
double x2 = (double(UINT8_MAX+1)*pt2.s.x + pt2.s.x_fract);
double y2 = (double(UINT8_MAX+1)*pt2.s.y + pt2.s.y_fract);
double x = (pt1_weight * x1 + (1.0 - pt1_weight) * x2);
double y = (pt1_weight * y1 + (1.0 - pt1_weight) * y2);
pt.s.x = x / double(UINT8_MAX+1); pt.s.x_fract = x - (pt.s.x*(UINT8_MAX+1));
pt.s.y = y / double(UINT8_MAX+1); pt.s.y_fract = y - (pt.s.y*(UINT8_MAX+1));
return pt;
}
void morph::set_resolution(uint16_t w, uint16_t h) {
width = w;
height = h;
}
double morph::get_time(size_t frame_index, size_t total_frames_out) {
if (total_frames_out == 0) return 0.0;
if (finite) {
if (total_frames_out == 1) {
if (get_frame_count() == 0) return 0.0;
return (1.0 - (1.0/double(get_frame_count())))/2.0;
}
double t = double(frame_index) / double(total_frames_out-1);
t*= 1.0 - (1.0/double(get_frame_count()));
return t;
}
return double(frame_index) / double(total_frames_out);
}
blob * morph::find_blob_by_group(size_t frame_key, size_t group) {
if (!has_frame(frame_key)) return nullptr;
std::vector<blob*> *blobs = &(frames[frame_key].blobs);
size_t bsz = blobs->size();
for (size_t i=0; i< bsz; ++i) {
if (blobs->at(i)->group == group) return blobs->at(i);
}
return nullptr;
}
void morph::set_fluid(unsigned f) {
if (fluidsteps != f) {
fluidsteps = f;
if (fluidsteps > 0 && density > 1) {
set_density(1);
}
}
}
void morph::set_density(uint16_t d) {
if (density != d) {
density = d;
identifier++;
if (fluidsteps != 0 && density > 1) {
set_fluid(0);
}
}
}
}
| 37.560991 | 132 | 0.457266 | 1Hyena |
5a0e557795694871014b66568bf27061727b462e | 1,981 | cpp | C++ | mr.Sadman/Classes/GameAct/Objects/Physical/Explosion.cpp | 1pkg/dump | 0ee579cb6a97ae64d5367cc624b2407d7d4b1c7b | [
"MIT"
] | null | null | null | mr.Sadman/Classes/GameAct/Objects/Physical/Explosion.cpp | 1pkg/dump | 0ee579cb6a97ae64d5367cc624b2407d7d4b1c7b | [
"MIT"
] | 3 | 2020-12-11T10:01:27.000Z | 2022-02-13T22:12:05.000Z | mr.Sadman/Classes/GameAct/Objects/Tech/Explosion.cpp | 1pkg/dump | 0ee579cb6a97ae64d5367cc624b2407d7d4b1c7b | [
"MIT"
] | null | null | null | #include "Explosion.hpp"
#include "Game/Levels/Chunk.hpp"
namespace Objects
{
namespace Tech
{
Explosion::Explosion()
: Stream( Direction::Empty )
{
}
void
Explosion::initialize()
{
Stream::initialize();
_particle->setStartColor( cocos2d::Color4F::RED );
_particle->setEndColor( cocos2d::Color4F::ORANGE );
}
std::string
Explosion::getName() const
{
return "Explosion";
}
void
Explosion::setSize( cocos2d::Size size )
{
// configuration
float koef = 1.0f / sqrt( 2.0f );
_particle->setStartSize( 5.0f );
_particle->setEndSize( 5.0f );
_particle->setStartSizeVar( 0.0f );
_particle->setEndSizeVar( 0.0f );
_particle->setRadialAccel( size.width * size.width / 500.0f );
_particle->setLife( 0.7f );
_particle->setLifeVar( 0.2f );
_particle->setEmissionRate( 80.0f );
switch ( _direction )
{
case Objects::Direction::Left:
_particle->setGravity( cocos2d::Vec2( -2.0f * size.width, 0.0f ) );
break;
case Objects::Direction::Right:
_particle->setGravity( cocos2d::Vec2( 2.0f * size.width, 0.0f ) );
break;
case Objects::Direction::Top:
_particle->setGravity( cocos2d::Vec2( 0.0f, 2.0f * size.width ) );
break;
case Objects::Direction::Bottom:
_particle->setGravity( cocos2d::Vec2( 0.0f, -2.0f * size.width ) );
break;
case Objects::Direction::D45:
_particle->setGravity( cocos2d::Vec2( -2.0f * size.width * koef, 2.0f * size.width * koef ) );
break;
case Objects::Direction::D135:
_particle->setGravity( cocos2d::Vec2( 2.0f * size.width * koef, 2.0f * size.width * koef ) );
break;
case Objects::Direction::D225:
_particle->setGravity( cocos2d::Vec2( 2.0f * size.width * koef, -2.0f * size.width * koef ) );
break;
case Objects::Direction::D315:
_particle->setGravity( cocos2d::Vec2( -2.0f * size.width * koef, -2.0f * size.width * koef ) );
break;
default:
break;
}
StaticObject::setSize( size );
}
}
} | 22.770115 | 99 | 0.639071 | 1pkg |
5a0f4c35866219242e694614390440b7b6d7b308 | 97 | cpp | C++ | src/helloworld_cli/lib.cpp | qrealka/OTUS_CPP | 900f793c2cc148932213b0f12fc54834254f2b33 | [
"BSL-1.0"
] | 1 | 2022-02-24T15:21:23.000Z | 2022-02-24T15:21:23.000Z | src/helloworld_cli/lib.cpp | qrealka/OTUS_CPP | 900f793c2cc148932213b0f12fc54834254f2b33 | [
"BSL-1.0"
] | null | null | null | src/helloworld_cli/lib.cpp | qrealka/OTUS_CPP | 900f793c2cc148932213b0f12fc54834254f2b33 | [
"BSL-1.0"
] | null | null | null | #include "lib.h"
#include "version.h"
unsigned version()
{
return PROJECT_VERSION_PATCH;
}
| 10.777778 | 33 | 0.701031 | qrealka |
5a131bdaca85bb9c307ae23f1cc9a27c5adc7973 | 2,228 | cpp | C++ | src/lua/functions/core/libs/result_functions.cpp | Waclaw-I/BagnoOTS | dbeb04322698ecdb795eba196872815b36ca134f | [
"MIT"
] | null | null | null | src/lua/functions/core/libs/result_functions.cpp | Waclaw-I/BagnoOTS | dbeb04322698ecdb795eba196872815b36ca134f | [
"MIT"
] | null | null | null | src/lua/functions/core/libs/result_functions.cpp | Waclaw-I/BagnoOTS | dbeb04322698ecdb795eba196872815b36ca134f | [
"MIT"
] | null | null | null | /**
* Canary - A free and open-source MMORPG server emulator
* Copyright (C) 2021 OpenTibiaBR <opentibiabr@outlook.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "otpch.h"
#include "lua/functions/core/libs/result_functions.hpp"
int ResultFunctions::luaResultGetNumber(lua_State* L) {
DBResult_ptr res = ScriptEnvironment::getResultByID(getNumber<uint32_t>(L, 1));
if (!res) {
pushBoolean(L, false);
return 1;
}
const std::string& s = getString(L, 2);
lua_pushnumber(L, res->getNumber<int64_t>(s));
return 1;
}
int ResultFunctions::luaResultGetString(lua_State* L) {
DBResult_ptr res = ScriptEnvironment::getResultByID(getNumber<uint32_t>(L, 1));
if (!res) {
pushBoolean(L, false);
return 1;
}
const std::string& s = getString(L, 2);
pushString(L, res->getString(s));
return 1;
}
int ResultFunctions::luaResultGetStream(lua_State* L) {
DBResult_ptr res = ScriptEnvironment::getResultByID(getNumber<uint32_t>(L, 1));
if (!res) {
pushBoolean(L, false);
return 1;
}
unsigned long length;
const char* stream = res->getStream(getString(L, 2), length);
lua_pushlstring(L, stream, length);
lua_pushnumber(L, length);
return 2;
}
int ResultFunctions::luaResultNext(lua_State* L) {
DBResult_ptr res = ScriptEnvironment::getResultByID(getNumber<uint32_t>(L, -1));
if (!res) {
pushBoolean(L, false);
return 1;
}
pushBoolean(L, res->next());
return 1;
}
int ResultFunctions::luaResultFree(lua_State* L) {
pushBoolean(L, ScriptEnvironment::removeResult(getNumber<uint32_t>(L, -1)));
return 1;
}
| 28.935065 | 81 | 0.72711 | Waclaw-I |
5a13282259899c9df6f4b6007e53d2d08adae39a | 1,629 | hpp | C++ | cppcache/src/EvictionThread.hpp | austxcodemonkey/geode-native | a816ac99cbbac557629686cb2542fdc74d464338 | [
"Apache-2.0"
] | null | null | null | cppcache/src/EvictionThread.hpp | austxcodemonkey/geode-native | a816ac99cbbac557629686cb2542fdc74d464338 | [
"Apache-2.0"
] | 1 | 2021-02-23T12:27:00.000Z | 2021-02-23T12:27:00.000Z | cppcache/src/EvictionThread.hpp | isabella232/geode-native | 0d9a99d5e0632de62df17921950cf3f6640efb33 | [
"Apache-2.0"
] | null | null | null | /*
* 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.
*/
#pragma once
#ifndef GEODE_EVICTIONTHREAD_H_
#define GEODE_EVICTIONTHREAD_H_
#include <atomic>
#include <condition_variable>
#include <deque>
#include <mutex>
#include <thread>
namespace apache {
namespace geode {
namespace client {
class EvictionController;
/**
* This class does the actual evictions
*/
class EvictionThread {
public:
explicit EvictionThread(EvictionController* parent);
void start();
void stop();
void svc();
void putEvictionInfo(int32_t info);
private:
std::thread m_thread;
std::atomic<bool> m_run;
EvictionController* m_pParent;
std::deque<int32_t> m_queue;
std::mutex m_queueMutex;
std::condition_variable m_queueCondition;
static const char* NC_Evic_Thread;
};
} // namespace client
} // namespace geode
} // namespace apache
#endif // GEODE_EVICTIONTHREAD_H_
| 26.274194 | 75 | 0.750153 | austxcodemonkey |
5a1667fe6fe1ae6f5aeb07f962d0fbd12e26b77e | 857 | cpp | C++ | GameEngine/GameEngine/src/graphics/filter/FilterArray.cpp | SamCooksley/GameEngine | 3c32eba545428c8aa3227abcb815d8d799ab92d9 | [
"Apache-2.0"
] | null | null | null | GameEngine/GameEngine/src/graphics/filter/FilterArray.cpp | SamCooksley/GameEngine | 3c32eba545428c8aa3227abcb815d8d799ab92d9 | [
"Apache-2.0"
] | null | null | null | GameEngine/GameEngine/src/graphics/filter/FilterArray.cpp | SamCooksley/GameEngine | 3c32eba545428c8aa3227abcb815d8d799ab92d9 | [
"Apache-2.0"
] | null | null | null | #include "stdafx.h"
#include "FilterArray.h"
#include "..\Graphics.h"
namespace engine {
namespace graphics {
FilterArray::FilterArray(const std::shared_ptr<Shader> & _shader) :
Material(_shader),
m_srcUnit(0)
{
setTexture<Texture2DArray>("src", nullptr);
getTextureUnit("src", &m_srcUnit);
}
FilterArray::~FilterArray()
{ }
void FilterArray::Apply(Texture2DArray & _src, Texture2DArray & _dst)
{
if (_src.getDepth() != _dst.getDepth())
{
throw std::invalid_argument("different layers");
}
auto & fb = Graphics::getContext().captureFBO;
fb->Bind();
fb->Reset(_dst.getWidth(), _dst.getHeight(), _dst.getDepth());
_dst.Bind();
fb->AttachTemp(_dst, FrameBufferAttachment::COLOUR, 0);
Bind();
_src.Bind(m_srcUnit);
Graphics::RenderQuad();
}
} } // engine::graphics | 20.902439 | 71 | 0.64294 | SamCooksley |
5a200bd60c68ec8dff80dfa1e7b369dd0000ed43 | 366 | cpp | C++ | Problem Set Volumes/Volume 1/146 - ID Codes.cpp | Md-Shamim-Ahmmed/UVA-Online-Judge-Problems-Solution | 2334edb153a134aebb883b57d8b4faf0cb859331 | [
"MIT"
] | null | null | null | Problem Set Volumes/Volume 1/146 - ID Codes.cpp | Md-Shamim-Ahmmed/UVA-Online-Judge-Problems-Solution | 2334edb153a134aebb883b57d8b4faf0cb859331 | [
"MIT"
] | null | null | null | Problem Set Volumes/Volume 1/146 - ID Codes.cpp | Md-Shamim-Ahmmed/UVA-Online-Judge-Problems-Solution | 2334edb153a134aebb883b57d8b4faf0cb859331 | [
"MIT"
] | null | null | null | #include <iostream>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
bool ans (string& s) {
if(next_permutation(s.begin(), s.end()))
return true;
else
return false;
}
int main()
{
string str;
while (cin >> str && str !="#") {
if (ans(str))
cout << str << endl;
else
cout << "No Successor" << endl;
}
return 0;
}
| 14.076923 | 41 | 0.601093 | Md-Shamim-Ahmmed |
5a23cca0ad1422c9a5b3c3516c6af534eab25b4c | 488 | cpp | C++ | cpp14faqs/code/c++14/plus.cpp | ancientscience/ancientscience.github.io | 2c8e3c6a8017164fd86fabaaa3343257cea54405 | [
"MIT"
] | null | null | null | cpp14faqs/code/c++14/plus.cpp | ancientscience/ancientscience.github.io | 2c8e3c6a8017164fd86fabaaa3343257cea54405 | [
"MIT"
] | null | null | null | cpp14faqs/code/c++14/plus.cpp | ancientscience/ancientscience.github.io | 2c8e3c6a8017164fd86fabaaa3343257cea54405 | [
"MIT"
] | null | null | null | #include <algorithm>
#include <iostream>
#include <iterator>
#include <ostream>
#include <set>
#include <string>
#include <vector>
int main()
{
std::vector<const char *> v {"3", "2", "1"};
std::set<std::string, std::greater<>> s {"a", "aaa", "aa"};
std::vector<std::string> dest;
std::transform(v.begin(), v.end(), s.begin(),
std::back_inserter(dest), std::plus<>());
for (const auto& elem : dest)
{
std::cout << elem << std::endl;
}
}
| 19.52 | 63 | 0.557377 | ancientscience |
5a23d113720bf4bb11f6658ad9a1c9beab7269f0 | 7,784 | cpp | C++ | apps/BlockDef/blockObDot.cpp | assignonward/aosuite | 243771d237970fe1175aaabc7d8d22f691076b6b | [
"MIT"
] | null | null | null | apps/BlockDef/blockObDot.cpp | assignonward/aosuite | 243771d237970fe1175aaabc7d8d22f691076b6b | [
"MIT"
] | null | null | null | apps/BlockDef/blockObDot.cpp | assignonward/aosuite | 243771d237970fe1175aaabc7d8d22f691076b6b | [
"MIT"
] | 1 | 2018-08-11T20:39:07.000Z | 2018-08-11T20:39:07.000Z | /* MIT License
*
* Copyright (c) 2021 Assign Onward
*
* 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.
*/
// Design Intent:
//
// The dot() functions of block object family members are intended to create
// a read-only graphviz presentation of the block structure, showing object
// nesting, key labels and data value summaries. Larger data objects may be
// abbreviated to convey the structure of larger blocks rather than the
// absolute complete contents.
//
// When protocols start specifying operations, the intent is for the .dot graphs
// to include arrows and symbols to illustrate the operands, operations and
// where the results of the operations appear in the structure.
//
#include "blockOb.h"
/* Calculation edge drawing syntax:
node_145 -> hashCalc [constraint=false];
node_138 -> hashCalc [constraint=false ltail=cluster_76];
node_141 -> hashCalc [constraint=false];
hashCalc -> node_143;
or drawn on the right side:
node_145 -> hashCalc [constraint=false];
node_138 -> hashCalc [constraint=false ltail=cluster_76];
node_141 -> hashCalc [constraint=false];
node_143 -> hashCalc [dir=back];
*/
qint32 dex = 0;
DotSerial ValueBase::dotEmptyNode( qint32 i )
{ return DotSerial(i,' ')+"node_m"+DotSerial::number( dex++ )+" [ label=\"\"; shape=plaintext; ];\n"; }
DotSerial ValueBase::dotName( RiceyInt k )
{ if ( dict.codesContainCode( k ) )
return dict.nameFromCode(k);
else
return intToRice( k ).toHex();
}
DotSerial ValueBase::dotArrayName( RiceyInt k, qint32 sz )
{ return dotName(k) + ( "["+DotSerial::number( sz )+"]" ); }
DotSerial ValueBase::clusterWrap( Mode m, ValueBase *vb, const DotSerial &kn )
{ DotSerial dot;
Mode sm = vb ? (vb->sel() ? selected : m ) : m;
bool nm = vb ? (vb->sel() ? true : false ) : false;
qint32 d = vb ? vb->depth() : 0;
DotSerial uid = vb ? vb->id() : "_z"+DotSerial::number( dex++ );
DotSerial v = vb ? vb->dot(m) : "";
DotSerial lab = ensureQuotes( /* uid+":" +DotSerial::number(d)+":"+ */ removeQuotes( kn ) );
qint32 i = 2; // indent spaces per depth level
dot.append( DotSerial(d*i,' ')+"subgraph cluster"+uid+" {\n" );
dot.append( DotSerial(2+d*i,' ')+"label = "+lab+";\n" );
dot.append( DotSerial(2+d*i,' ')+lineColor( sm, d )+"\n" );
dot.append( DotSerial(2+d*i,' ')+ bgColor( sm, d )+"\n" );
dot.append( DotSerial(2+d*i,' ')+"margin = 4;\n\n" );
if ( v.size() > 0 )
{ if ( !v.trimmed().startsWith( "subgraph" ) && !v.trimmed().startsWith( "node" ) )
{ dot.append( DotSerial(4+d*i,' ')+"node"+uid+" [ label="+v+"; "+( nm ? "color=crimson" : lineColor(m,d) )+" ];\n" );
}
else
{ dot.append( v );
if ( !v.trimmed().endsWith( ";" ) )
dot.append( DotSerial(3+d*i,' ')+";" );
dot.append( "\n" );
}
}
else
dot.append( dotEmptyNode(4+d*i) );
dot.append( DotSerial(d*i,' ')+"}\n" );
return dot;
}
DotSerial ValueBase::lineColor( Mode m, qint32 depth )
{ switch ( m )
{ case make: return "color=\""+wheelColor( QColor( "darkgreen" ), 0.10, 0.15, 0.15, 1.6, depth)+"\";";
case build: return "color=\""+wheelColor( QColor( "darkblue" ), 0.05, 0.15, 0.1 , 1.6, depth)+"\";";
case idle: return "color=\""+wheelColor( QColor( "grey" ), 0.05, 0.0 , 0.1 , 1.6, depth)+"\";";
case selected: return "color=\""+wheelColor( QColor( "crimson" ), 0.05, 0.02, 0.1 , 1.6, depth)+"\";";
}
return "";
}
DotSerial ValueBase::bgColor( Mode m, qint32 depth )
{ switch ( m )
{ case make: return "bgcolor=\""+wheelColor( QColor( "mintcream" ), 0.05, 0.12, 0.07, 0.0, depth)+"\";";
case build: return "bgcolor=\""+wheelColor( QColor( "#D4E6F8" ), 0.04, 0.10, 0.06, 0.0, depth)+"\";";
case idle: return "bgcolor=\""+wheelColor( QColor( "gainsboro" ), 0.05, 0.05, 0.1 , 0.0, depth)+"\";";
case selected: return "bgcolor=\""+wheelColor( QColor( "#FFD8D8" ), 0.02, 0.05, 0.02, 0.0, depth)+"\";";
}
return "";
}
DotSerial ValueBase::wheelColor( const QColor &c, qreal hDep, qreal sDep, qreal lDep, qreal ph, qint32 depth )
{ if ( hDep > 0.5 ) hDep = 0.5;
if ( hDep < 0.0 ) hDep = 0.0;
if ( sDep > 0.5 ) sDep = 0.5;
if ( sDep < 0.0 ) sDep = 0.0;
if ( lDep > 0.5 ) lDep = 0.5;
if ( lDep < 0.0 ) lDep = 0.0;
qreal nHue = c.hslHueF();
qreal nSat = c.hslSaturationF(); if (nSat < sDep) nSat = sDep; if ( (nSat + sDep) > 1.0 ) nSat = 1.0 - sDep;
qreal nLig = c.lightnessF(); if (nLig < lDep) nLig = lDep; if ( (nLig + lDep) > 1.0 ) nLig = 1.0 - lDep;
nHue += hDep * cos( ((qreal)depth)* 70.0*6.28318530718/360.0 + ph );
nSat += sDep * cos( ((qreal)depth)* 25.0*6.28318530718/360.0 + ph );
nLig += lDep * sin( ((qreal)depth)*130.0*6.28318530718/360.0 + ph );
while ( nHue > 1.0 ) { nHue -= 1.0; } if ( nHue < 0.0 ) nHue = 0.0;
if ( nSat > 1.0 ) nSat = 1.0;
if ( nSat < 0.0 ) nSat = 0.0;
if ( nLig > 1.0 ) nLig = 1.0;
if ( nLig < 0.0 ) nLig = 0.0;
QColor ct; ct.setHslF( nHue, nSat, nLig );
DotSerial cs;
cs.append( (quint8)ct.red() );
cs.append( (quint8)ct.green() );
cs.append( (quint8)ct.blue() );
return "#"+cs.toHex();
}
DotSerial KeyValuePair::dot(Mode m) const
{ return clusterWrap( m, value(), dotName( key() ) ); }
DotSerial KeyValueArray::dot(Mode m) const
{ return clusterWrap( m, value(), dotArrayName( key(), size() ) ); }
DotSerial ValueBaseArray::dot(Mode m) const
{ DotSerial d;
if ( size() == 0 )
d.append( dotEmptyNode(depth()*2+4) );
else for ( qint32 i = 0; i < size(); i++ )
d.append( clusterWrap( m, at(i), "["+DotSerial::number(i)+"]" ) );
return d;
}
DotSerial BlockValueObject::dot(Mode m) const
{ DotSerial d;
QList<RiceyInt>keys = value().keys();
if ( keys.size() == 0 )
d.append( dotEmptyNode(depth()*2+4) );
else foreach ( RiceyInt i, keys )
{ if (( value(i)->type() & RDT_ARRAY ) == 0 )
d.append( clusterWrap( m, value(i), dotName( i ) ) );
else
d.append( clusterWrap( m, value(i),dotArrayName( i, value(i)->size() ) ) );
}
return d;
}
/**
* @brief BlockValueByteArray::dot
* @param m - mode, unused here
* @return hex representation of byte array, maxed out at 20 bytes shown, show size when > 20
*/
DotSerial BlockValueByteArray::dot(Mode m) const
{ (void)m;
DotSerial s = removeQuotes( json() );
qint32 sz = s.size()/2; // sz = Number of bytes represented
if ( sz <= 12 )
return ensureQuotes( s );
if ( sz <= 20 )
{ qint32 m = 2*(sz/2);
return ensureQuotes( s.mid( 0,m )+"\n"+s.mid(m) );
}
return ensureQuotes( s.mid( 0,20 )+
QString( "...\n%1 bytes total\n..." ).arg( sz ).toUtf8()+
s.mid( s.size()-20 ) );
}
| 40.123711 | 125 | 0.609198 | assignonward |
5a25f2ebed44139167fd87cf14474d33f873a798 | 1,571 | cpp | C++ | src/rt/api_input.cpp | Thecontrarian/Rosebud | 29f57a4acace2b75c00d83099e678582257cc72e | [
"MIT"
] | null | null | null | src/rt/api_input.cpp | Thecontrarian/Rosebud | 29f57a4acace2b75c00d83099e678582257cc72e | [
"MIT"
] | 1 | 2016-12-27T02:32:55.000Z | 2016-12-27T02:38:41.000Z | src/rt/api_input.cpp | Thecontrarian/Rosebud | 29f57a4acace2b75c00d83099e678582257cc72e | [
"MIT"
] | null | null | null | #include "rose.h"
rose_api_error rose_rt_base::mouse(int16_t* x, int16_t* y) {
int16_t* pointer = (int16_t*) pointer_positions.begin;
*x = pointer[20];
*y = pointer[21];
return ROSE_API_ERR_NONE;
}
rose_api_error rose_rt_base::btn(uint8_t idx, bool* res) {
*res = rose_get_bit(btn_states.begin, idx);
return ROSE_API_ERR_NONE;
}
rose_api_error rose_rt_base::btnp(uint8_t idx, bool* res) {
bool cur_state = rose_get_bit(btn_states.begin, idx);
bool prev_state = rose_get_bit(prev_btn_states.begin, idx);
*res = (cur_state && !prev_state);
return ROSE_API_ERR_NONE;
}
rose_api_error rose_rt_base::wheel(int16_t* x, int16_t* y) {
int16_t* pointer = (int16_t*) mouse_wheel.begin;
*x = pointer[0];
*y = pointer[1];
return ROSE_API_ERR_NONE;
}
rose_api_error rose_rt_base::wheel_inverted(bool* res) {
bool* inverted = (bool*) (mouse_wheel.begin + 4);
*res = *inverted;
return ROSE_API_ERR_NONE;
}
rose_api_error rose_rt_base::key(rose_keycode keycode, bool* res) {
if (keycode >= ROSE_KEYCODE_UNKNOWN) {
return ROSE_API_ERR_OUT_OF_BOUNDS;
}
*res = rose_get_bit(key_states.begin, keycode);
return ROSE_API_ERR_NONE;
}
rose_api_error rose_rt_base::keyp(rose_keycode keycode, bool* res) {
if (keycode >= ROSE_KEYCODE_UNKNOWN) {
return ROSE_API_ERR_OUT_OF_BOUNDS;
}
bool cur_state = rose_get_bit(key_states.begin, keycode);
bool prev_state = rose_get_bit(prev_key_states.begin, keycode);
*res = (cur_state && !prev_state);
return ROSE_API_ERR_NONE;
} | 30.803922 | 68 | 0.705283 | Thecontrarian |
5a262eb94b2591e0cafb718ae825727767c2bdf0 | 1,963 | cpp | C++ | test/vector/multi_indexer.cpp | BryanFlynt/xstd | 4c11f614b828a93e20cb35903c179cfd52fef47e | [
"Apache-2.0"
] | null | null | null | test/vector/multi_indexer.cpp | BryanFlynt/xstd | 4c11f614b828a93e20cb35903c179cfd52fef47e | [
"Apache-2.0"
] | null | null | null | test/vector/multi_indexer.cpp | BryanFlynt/xstd | 4c11f614b828a93e20cb35903c179cfd52fef47e | [
"Apache-2.0"
] | null | null | null | /**
* \file multi_indexer.cpp
* \author Bryan Flynt
* \date Jan 18, 2021
* \copyright Copyright (C) 2021 Bryan Flynt - All Rights Reserved
*/
#include "catch.hpp"
#include "xstd/detail/vector/multi_indexer.hpp"
#include <iostream>
TEST_CASE("MultiIndexer", "[default]") {
using namespace xstd;
SECTION("1-D Operations"){
const std::size_t N = 10;
std::vector<int> a(N);
std::size_t n = 0;
std::generate(a.begin(), a.end(), [&n](){return n++;});
RowMajorIndex<1> index({N});
std::cout << " Value = " << std::size_t(index) << std::endl;
REQUIRE( 0 == a[index] );
REQUIRE( 1 == a[++index] );
REQUIRE( 2 == a[++index] );
index++;
REQUIRE( 3 == a[index] );
index = 4;
REQUIRE( 4 == a[index] );
auto i = index(5);
REQUIRE( 5 == a[i] );
REQUIRE( 6 == a[++index] );
REQUIRE( 7 == a[++index] );
REQUIRE( 8 == a[++index] );
REQUIRE( 9 == a[++index] );
REQUIRE( index.size() == 10 );
}
SECTION("2-D Operations"){
const std::size_t R = 2;
const std::size_t C = 4;
RowMajorIndex<2> index({R,C});
std::vector<int> a(index.size());
std::size_t n = 0;
std::generate(a.begin(), a.end(), [&n](){return n++;});
REQUIRE( 0 == a[index] );
REQUIRE( 1 == a[++index] );
REQUIRE( 2 == a[++index] );
index++;
REQUIRE( 3 == a[index] );
index = 4;
REQUIRE( 4 == a[index] );
REQUIRE( 5 == a[++index] );
REQUIRE( 6 == a[++index] );
REQUIRE( 7 == a[++index] );
auto i = index(1,2);
REQUIRE( 6 == a[i] );
index--;
REQUIRE( 5 == a[index] );
}
SECTION("3-D Operations"){
const std::size_t R = 2;
const std::size_t C = 4;
const std::size_t M = 2;
RowMajorIndex<3> index({R,C,M});
std::vector<int> a(index.size());
std::size_t n = 0;
std::generate(a.begin(), a.end(), [&n](){return n++;});
REQUIRE( 0 == a[index] );
REQUIRE( 1 == a[++index] );
REQUIRE( 2 == a[++index] );
auto i = index(1,3,1);
REQUIRE( index.size()-1 == a[i] );
}
}
| 19.058252 | 67 | 0.537952 | BryanFlynt |
5a264934b35655724a893142fe948447957b98b2 | 1,807 | cpp | C++ | src/cage/controller.cpp | pancpp/cage | 3a4eb5e3b6d40e6dee8e61bf984c83bf336e5999 | [
"BSL-1.0"
] | null | null | null | src/cage/controller.cpp | pancpp/cage | 3a4eb5e3b6d40e6dee8e61bf984c83bf336e5999 | [
"BSL-1.0"
] | null | null | null | src/cage/controller.cpp | pancpp/cage | 3a4eb5e3b6d40e6dee8e61bf984c83bf336e5999 | [
"BSL-1.0"
] | null | null | null | /**
* COPYRIGHT (C) 2020 Leyuan Pan ALL RIGHTS RESERVED.
*
* @brief HTTP and WEBSOCKET controller.
* @author Leyuan Pan
* @date Oct 04, 2020
*/
#include "cage/controller.hpp"
namespace cage {
void Controller::RegisterRouter(RouterPtr p_router) {
router_vec_.push_back(std::move(p_router));
}
Controller::HttpViewPtr Controller::GetHttpView(std::string const& target) {
std::string url = ParseUrl(target);
for (auto& p_router : router_vec_) {
auto p_view = p_router->GetHttpView(url);
if (p_view) {
return p_view;
}
}
return nullptr;
}
Controller::WebsockViewPtr Controller::MakeWebsockView(HttpRequest request,
SenderType sender,
CloserType closer) {
std::string url = ParseUrl(
std::string_view(request.target().data(), request.target().size()));
for (auto& p_router : router_vec_) {
auto view_maker = p_router->GetWebsockViewMaker(url);
if (view_maker) {
return view_maker(std::move(request), std::move(sender),
std::move(closer));
}
}
return nullptr;
}
std::string Controller::ServerName() {
return "BeastInCage/0.0.1";
}
std::size_t Controller::WebsockMsgQueCap() {
return 1024;
}
std::chrono::seconds Controller::SocketTimeout() {
return std::chrono::seconds(30);
}
std::size_t Controller::HttpHeadLimit() {
return 8 * 1024;
}
std::size_t Controller::HttpBodyLimit() {
return 1024 * 1024;
}
std::string Controller::ParseUrl(std::string_view target) {
std::size_t qsym_pos = target.find('?');
if (qsym_pos == std::string_view::npos) {
return std::string(target.data(), target.size());
} else {
return std::string(target.data(), qsym_pos);
}
}
} // namespace cage
| 24.418919 | 76 | 0.6342 | pancpp |
5a2977a9c42ccbdb70e1ca35f439046c475c7952 | 2,120 | hpp | C++ | src/detail/ReadConfig.hpp | epicbrownie/Epic | c54159616b899bb24c6d59325d582e73f2803ab6 | [
"MIT"
] | null | null | null | src/detail/ReadConfig.hpp | epicbrownie/Epic | c54159616b899bb24c6d59325d582e73f2803ab6 | [
"MIT"
] | 29 | 2016-08-01T14:50:12.000Z | 2017-12-17T20:28:27.000Z | src/detail/ReadConfig.hpp | epicbrownie/Epic | c54159616b899bb24c6d59325d582e73f2803ab6 | [
"MIT"
] | null | null | null | //////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2016 Ronnie Brohn (EpicBrownie)
//
// Distributed under The MIT License (MIT).
// (See accompanying file License.txt or copy at
// https://opensource.org/licenses/MIT)
//
// Please report any bugs, typos, or suggestions to
// https://github.com/epicbrownie/Epic/issues
//
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include <Epic/Config.hpp>
#include <Epic/TMP/TypeTraits.hpp>
//////////////////////////////////////////////////////////////////////////////
namespace Epic::detail
{
enum class eConfigProperty
{
DefaultAllocator,
AudioAllocator
};
template<eConfigProperty P, class D, class C>
struct ConfigProperty;
}
//////////////////////////////////////////////////////////////////////////////
namespace Epic::detail
{
template<class T>
using HasDefaultAllocator = typename T::DefaultAllocator;
template<class T>
using HasAudioAllocator = typename T::AudioAllocator;
}
//////////////////////////////////////////////////////////////////////////////
template<Epic::detail::eConfigProperty P, class D, class C>
struct Epic::detail::ConfigProperty
{
using Type = D;
};
template<class D, class C>
struct Epic::detail::ConfigProperty<Epic::detail::eConfigProperty::DefaultAllocator, D, C>
{
using Type = Epic::TMP::DetectedOrT<D, Epic::detail::HasDefaultAllocator, C>;
};
template<class D, class C>
struct Epic::detail::ConfigProperty<Epic::detail::eConfigProperty::AudioAllocator, D, C>
{
using Type = Epic::TMP::DetectedOrT<D, Epic::detail::HasAudioAllocator, C>;
};
//////////////////////////////////////////////////////////////////////////////
namespace Epic::detail
{
template<eConfigProperty Prop, class C = Epic::Config<true>>
using GetConfigProperty = ConfigProperty<Prop, Epic::TMP::detail::InvalidType, C>;
template<eConfigProperty Prop, class Default, class C = Epic::Config<true>>
using GetConfigPropertyOr = ConfigProperty<Prop, Default, C>;
}
| 28.648649 | 90 | 0.546698 | epicbrownie |
5a2d74cd33cf865f27bbb51c260d8d8bb2bb349a | 7,103 | cpp | C++ | ivb-3-14/Korotkov-D.A/lab.02.11.cpp | bykovskyy/2014 | 474c6eb940978d4f323ef4dc2eac8e0360f19612 | [
"BSD-2-Clause"
] | null | null | null | ivb-3-14/Korotkov-D.A/lab.02.11.cpp | bykovskyy/2014 | 474c6eb940978d4f323ef4dc2eac8e0360f19612 | [
"BSD-2-Clause"
] | null | null | null | ivb-3-14/Korotkov-D.A/lab.02.11.cpp | bykovskyy/2014 | 474c6eb940978d4f323ef4dc2eac8e0360f19612 | [
"BSD-2-Clause"
] | null | null | null | /**Коротков Даниил*/
/**Задание 11*/
#pragma warning(disable : 4996)
#include <cstdio>
#include <cstdlib>
#include <cstring>
static double **
__loadMatrix(
const char * const szFileName,
int * piRows,
int * piCols);
static void
__destroyMatrix(double **pMatrix, int rows, int cols);
static int
__exception(const char * const szMessage)
{
fprintf(stderr, "%s\n", szMessage);
return EXIT_FAILURE;
}
static void
__printMatrix(double **pMatrix, int rows, int cols);
static double
__findZeroElement(double **pMatrix, int rows, int cols);
static void
__outputMinElements(double **pMatrix, int rows, int cols);
int
main(int argc, char **argv)
{
if (argc < 3) {
return __exception("Not found input file");
}
int mRows1 = 0;
int mCols1 = 0;
int mRows2 = 0;
int mCols2 = 0;
double ** matrix1 = __loadMatrix(argv[1], &mRows1, &mCols1);
double ** matrix2 = __loadMatrix(argv[2], &mRows2, &mCols2);
/** Output */
fprintf(stdout, "Matrix N1:\n");
__printMatrix(matrix1, mRows1, mCols1);
fprintf(stdout, "Matrix N2:\n");
__printMatrix(matrix2, mRows2, mCols2);
/** Find Max element */
double Max1 = __findZeroElement(matrix1, mRows1, mCols1);
double Max2 = __findZeroElement(matrix2, mRows2, mCols2);
if (Max1 < Max2) {
fprintf(stdout, "Output matrix N1:\n");
__outputMinElements(matrix1, mRows1, mCols1);
} else {
fprintf(stdout, "Output matrix N2:\n");
__outputMinElements(matrix2, mRows2, mCols2);
}
__destroyMatrix(matrix1, mRows1, mCols1);
__destroyMatrix(matrix2, mRows2, mCols2);
system("pause");
return EXIT_SUCCESS;
}
/** */
#include <string>
#include <vector>
class NumberFromFileParser
{
typedef std::vector<double> __MatrixLine;
typedef std::vector< __MatrixLine > __Matrix;
friend double **
__loadMatrix(
const char * const szFileName,
int * piRows,
int * piCols);
public:
NumberFromFileParser()
: _ch(0), _fd(0)
{
}
~NumberFromFileParser()
{
}
bool eof() const
{
return feof(_fd) > 0;
}
bool next()
{
_ch = fgetc(_fd);
return _ch != EOF;
}
bool isWhitespace() const
{
return isspace((int)_ch) > 0;
}
bool isDigit() const
{
return isdigit((int)_ch) > 0;
}
bool isDot() const
{
return _ch == '.' ||
_ch == ',';
}
bool isSign() const
{
return _ch == '-' ||
_ch == '+';
}
bool isEndOfLine() const
{
return _ch == '\r' ||
_ch == '\n';
}
void skipWhitespace()
{
while (!eof() && isWhitespace() && next());
}
void skipEndOfLine()
{
while (!eof() && isEndOfLine() && next());
}
void parseNumber()
{
skipWhitespace();
while (!eof() && !isWhitespace() &&
(isSign() || isDot() || isDigit())) {
put();
next();
}
}
void put()
{
_buffer.push_back(_ch);
}
bool parse(const char * const name, __Matrix &matrix)
{
std::vector<double> row;
matrix.clear();
if (_fd == 0)
_fd = fopen(name, "r");
if (_fd == 0)
return false;
next();
while (!eof()) {
_buffer.clear();
parseNumber();
if (_buffer.size() > 0) {
row.push_back(atof(_buffer.c_str()));
}
if (isEndOfLine()) {
skipEndOfLine();
matrix.push_back(row);
row.clear();
}
}
if (row.size() > 0)
matrix.push_back(row);
fclose(_fd);
_fd = 0;
return true;
}
private:
char _ch;
FILE *_fd;
std::string _buffer;
};
double **
__loadMatrix(
const char * const szFileName,
int * piRows,
int * piCols)
{
NumberFromFileParser parser;
NumberFromFileParser::__Matrix matrix;
int retval = parser.parse(szFileName, matrix);
if (retval) {
(*piRows) = matrix.size();
double **result = new double * [matrix.size()];
for (
NumberFromFileParser::__MatrixLine::size_type k = 0;
k < matrix.size();
k++) {
NumberFromFileParser::__MatrixLine line = matrix.at(k);
result[k] = new double [line.size()];
(*piCols) = line.size();
for (
NumberFromFileParser::__Matrix::size_type i = 0;
i < line.size();
++i) {
result[k][i] = line.at(i);
}
}
return result;
}
return 0;
}
void
__destroyMatrix(double **pMatrix, int rows, int cols)
{
if (pMatrix != 0) {
for (int i = 0; i < rows; i++) {
if (pMatrix[i] != 0)
delete[] pMatrix[i];
}
delete[] pMatrix;
}
}
void
__printMatrix(double **pMatrix, int rows, int cols)
{
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j) {
if (j > 0)
fprintf(stdout, " ");
fprintf(stdout, "%3.5f", pMatrix[i][j]);
}
fprintf(stdout, "\n");
}
}
double
__findZeroElement(double **pMatrix, int rows, int cols)
{
double result = 0;
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j) {
if (pMatrix[i][j]=0)
result += 1 ;
}
}
return result;
}
void
__outputMinElements(double **pMatrix, int rows, int cols)
{
for (int i = 0; i < rows; ++i) {
int max = 0;
for (int j = 0; j < cols; ++j) {
if (pMatrix[i][j] < 0)
max += 1;
}
fprintf(stdout, "%d\n", max);
}
}
| 27.214559 | 79 | 0.420245 | bykovskyy |
5a2dc1041fea245f0df2fa5b0fa35a25b2e397f3 | 1,121 | cpp | C++ | DataStructure/CS/4_1_vector.cpp | Leon-Francis/NCEPU-CS-COURSES | 65a186c9f5dc88fef4eb3fd7a550500c0d27b38c | [
"Apache-2.0"
] | 1 | 2021-03-31T03:04:52.000Z | 2021-03-31T03:04:52.000Z | DataStructure/CS/4_1_vector.cpp | Leon-Francis/NCEPU-CS-COURSES | 65a186c9f5dc88fef4eb3fd7a550500c0d27b38c | [
"Apache-2.0"
] | null | null | null | DataStructure/CS/4_1_vector.cpp | Leon-Francis/NCEPU-CS-COURSES | 65a186c9f5dc88fef4eb3fd7a550500c0d27b38c | [
"Apache-2.0"
] | 1 | 2021-09-03T13:33:51.000Z | 2021-09-03T13:33:51.000Z | #include<iostream>
#include<vector>
using namespace std;
int main()
{
int numberA,numberB;
cin>>numberA>>numberB;
int number=numberA+numberB;
vector <vector<int>> a;
a.resize(number,vector<int>(3));
for(int i=0;i<numberA;i++){
for(int j=0;j<3;j++){
cin>>a[i][j];
}
}
int row,column,value;
for(int i=0;i<numberB;i++){
int flag=0;
cin>>row>>column>>value;
for(int k=0;k<numberA;k++){
if(row==a[k][0]&&column==a[k][1]){
a[k][2]+=value;
number--;
flag=1;
}
}
if(flag==0){
a[numberA][0]=row;
a[numberA][1]=column;
a[numberA][2]=value;
numberA++;
}
}
int numberOut=number;
for(int i=0;i<number;i++){
if(a[i][2]==0){
numberOut--;
continue;
}
for(int j=0;j<3;j++){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
if(numberOut==0){
cout<<-1<<" "<<-1<<" "<<-1;
}
cout<<endl;
return 0;
}
| 20.759259 | 46 | 0.4157 | Leon-Francis |
5a2fc9ce78df9f238aadae0cd56fb31fc97b0daa | 2,023 | hpp | C++ | Engine/Code/Engine/Math/IntVec2.hpp | sam830917/TenNenDemon | a5f60007b73cccc6af8675c7f3dec597008dfdb4 | [
"MIT"
] | null | null | null | Engine/Code/Engine/Math/IntVec2.hpp | sam830917/TenNenDemon | a5f60007b73cccc6af8675c7f3dec597008dfdb4 | [
"MIT"
] | null | null | null | Engine/Code/Engine/Math/IntVec2.hpp | sam830917/TenNenDemon | a5f60007b73cccc6af8675c7f3dec597008dfdb4 | [
"MIT"
] | null | null | null | #pragma once
struct IntVec2
{
public:
int x = 0;
int y = 0;
static const IntVec2 ZERO;
static const IntVec2 ONE;
public:
// Construction/Destruction
~IntVec2() = default;
IntVec2() = default;
IntVec2( const IntVec2& copyFrom );
explicit IntVec2( int initialX, int initialY );
// Accessors (const methods)
float GetLength() const;
int GetLengthSquared() const;
int GetTaxicabLength() const;
float GetOrientationRadians() const;
float GetOrientationDegrees() const;
const IntVec2 GetRotated90Degrees() const;
const IntVec2 GetRotatedMinus90Degrees() const;
// Mutators (non-const methods)
void Rotate90Degrees();
void RotateMinus90Degrees();
void SetFromText( const char* text );
// Operators (self-mutating / non-const)
bool operator==( const IntVec2& compare ) const;
bool operator!=( const IntVec2& compare ) const;
const IntVec2 operator+( const IntVec2& vecToAdd ) const; // IntVec2 + IntVec2
const IntVec2 operator-( const IntVec2& vecToSubtract ) const; // IntVec2 - IntVec2
const IntVec2 operator-() const; // -IntVec2, i.e. "unary negation"
const IntVec2 operator*( int uniformScale ) const; // IntVec2 * int
const IntVec2 operator*( const IntVec2& vecToMultiply ) const; // IntVec2 * IntVec2
const IntVec2 operator/( float inverseScale ) const; // IntVec2 / float
// Operators (self-mutating / non-const)
void operator+=( const IntVec2& vecToAdd ); // IntVec2 += IntVec2
void operator-=( const IntVec2& vecToSubtract ); // IntVec2 -= IntVec2
void operator*=( const int uniformScale ); // IntVec2 *= int
void operator/=( const int uniformDivisor ); // IntVec2 /= int
void operator=( const IntVec2& copyFrom ); // IntVec2 = IntVec2
// Standalone "friend" functions that are conceptually, but not actually, part of IntVec2::
friend const IntVec2 operator*( int uniformScale, const IntVec2& vecToScale ); // int * IntVec2
}; | 38.903846 | 96 | 0.67474 | sam830917 |
5a31ac6c558ce7d433cac63a29a1f0f05a16ca29 | 764 | hpp | C++ | src/threshold.hpp | minijackson/INF4710-TP3 | 7285ee279e65e0d76a752d0f1be936ca79638473 | [
"MIT"
] | null | null | null | src/threshold.hpp | minijackson/INF4710-TP3 | 7285ee279e65e0d76a752d0f1be936ca79638473 | [
"MIT"
] | null | null | null | src/threshold.hpp | minijackson/INF4710-TP3 | 7285ee279e65e0d76a752d0f1be936ca79638473 | [
"MIT"
] | null | null | null | #pragma once
#include "cl_mat.hpp"
#include <opencv2/opencv.hpp>
enum LightnessComponent { intensity, value, lightness, luma, luma_rounded };
cv::Mat_<uint8_t> threshold(cv::Mat_<cv::Vec4b> const& input,
uint8_t limit,
LightnessComponent component = intensity);
cv::Mat_<uint8_t> threshold_gnupar(cv::Mat_<cv::Vec4b> const& input,
uint8_t limit,
LightnessComponent component = intensity);
CLMat<uint8_t> threshold_cl(cv::Mat_<cv::Vec4b> const& input, uint8_t limit);
cv::Mat_<uint8_t> threshold_cv(cv::Mat_<cv::Vec4b> const& input, uint8_t limit);
cv::Mat_<uint8_t> threshold_cvcl(cv::Mat_<cv::Vec4b> const& input, uint8_t limit);
| 36.380952 | 82 | 0.633508 | minijackson |
5a31bad41c7e164b66c9bf4f99d81b3af3ae510a | 600 | cpp | C++ | 1000/70/1076c.cpp | actium/cf | d7be128c3a9adb014a231a399f1c5f19e1ab2a38 | [
"Unlicense"
] | 1 | 2020-07-03T15:55:52.000Z | 2020-07-03T15:55:52.000Z | 1000/70/1076c.cpp | actium/cf | d7be128c3a9adb014a231a399f1c5f19e1ab2a38 | [
"Unlicense"
] | null | null | null | 1000/70/1076c.cpp | actium/cf | d7be128c3a9adb014a231a399f1c5f19e1ab2a38 | [
"Unlicense"
] | 3 | 2020-10-01T14:55:28.000Z | 2021-07-11T11:33:58.000Z | #include <iostream>
#include <cmath>
void no_answer()
{
std::cout << "N" << '\n';
}
void answer(double x, double y)
{
std::cout << "Y" << std::fixed << ' ' << x << ' ' << y << '\n';
}
void solve(unsigned d)
{
if (d == 0)
return answer(0, 0);
if (d < 4)
return no_answer();
const double q = sqrt(d * (d - 4));
answer((d + q) / 2, (d - q) / 2);
}
void test_case()
{
unsigned d;
std::cin >> d;
solve(d);
}
int main()
{
std::cout.precision(9);
size_t t;
std::cin >> t;
while (t-- > 0)
test_case();
return 0;
}
| 12.244898 | 67 | 0.456667 | actium |
5a32685be23db614797fdf5f5022934b5b331cb2 | 5,360 | cpp | C++ | src/PyZPK/utils/utils.cpp | gargarchit/PyZPK | 682c20efc6ae5d7bf705f9fcbcbf003d9e382412 | [
"Apache-2.0"
] | 4 | 2020-05-21T13:55:33.000Z | 2020-08-17T00:59:29.000Z | src/PyZPK/utils/utils.cpp | gargarchit/PyZPK | 682c20efc6ae5d7bf705f9fcbcbf003d9e382412 | [
"Apache-2.0"
] | 1 | 2020-07-21T07:37:59.000Z | 2020-07-21T07:39:14.000Z | src/PyZPK/utils/utils.cpp | gargarchit/PyZPK | 682c20efc6ae5d7bf705f9fcbcbf003d9e382412 | [
"Apache-2.0"
] | null | null | null | #include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>
#include <pybind11/cast.h>
#include <pybind11/complex.h>
#include <pybind11/operators.h>
#include <vector>
#include <cassert>
#include <cmath>
#include <cstdlib>
#include <limits>
#include <random>
#include <cstddef>
#include <iostream>
#include <libff/algebra/scalar_multiplication/multiexp.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_pp.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_g1.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_g2.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_init.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_pairing.hpp>
#include <libff/algebra/curves/public_params.hpp>
#include <libff/algebra/exponentiation/exponentiation.hpp>
#include <libff/algebra/fields/field_utils.hpp>
#include <libff/algebra/fields/bigint.hpp>
#include <libff/algebra/fields/fp_aux.tcc>
#include <libff/common/profiling.hpp>
#include <libff/common/utils.hpp>
#include <libff/common/serialization.hpp>
#include <libff/algebra/curves/mnt/mnt6/mnt6_g2.hpp>
#include <libff/algebra/curves/mnt/mnt4/mnt4_g1.hpp>
#include <libff/algebra/curves/mnt/mnt4/mnt4_g2.hpp>
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
#include <libff/algebra/curves/alt_bn128/alt_bn128_init.hpp>
#include <gmp.h>
using namespace std;
namespace py = pybind11;
using namespace libff;
// Used as FieldT class type
void declare_utils_Fp_model(py::module &m)
{
// bigint wrapper class around GMP's MPZ long integers.
py::class_<bigint<5l>>(m, "bigint")
.def(py::init<>())
.def(py::init<const unsigned long>())
.def(py::init<const char *>())
.def("test_bit", &bigint<5l>::test_bit)
.def("randomize", &bigint<5l>::randomize);
// Implementation of arithmetic in the finite field F[p], for prime p of fixed length.
py::class_<Fp_model<5l, libff::mnt46_modulus_B>>(m, "Fp_model")
.def(py::init<>())
.def(py::init<const bigint<5l> &>())
.def(py::init<const long, const bool>())
.def_readwrite("mont_repr", &Fp_model<5l, libff::mnt46_modulus_B>::mont_repr)
.def_static("random_element", []() {
Fp_model<5l, mnt46_modulus_B> r;
while (mpn_cmp(r.mont_repr.data, mnt46_modulus_B.data, 5l))
{
r.mont_repr.randomize();
size_t bitno = GMP_NUMB_BITS * 5 - 1;
while (mnt46_modulus_B.test_bit(bitno) == false)
{
const size_t part = bitno / GMP_NUMB_BITS;
const size_t bit = bitno - (GMP_NUMB_BITS * part);
r.mont_repr.data[part] &= ~(1ul << bit);
bitno--;
}
}
return r;
})
.def("inverse", &Fp_model<5l, libff::mnt46_modulus_B>::inverse)
.def("print", &Fp_model<5l, libff::mnt46_modulus_B>::print)
.def("is_zero", &Fp_model<5l, libff::mnt46_modulus_B>::is_zero)
.def_static("one", &Fp_model<5l, libff::mnt46_modulus_B>::one)
.def_static("zero", &Fp_model<5l, libff::mnt46_modulus_B>::zero)
.def_static("size_in_bits", &Fp_model<5l, libff::mnt46_modulus_B>::size_in_bits)
.def("as_ulong", &Fp_model<5l, libff::mnt46_modulus_B>::as_ulong)
.def(py::self * py::self)
.def(py::self *= py::self)
.def(-py::self);
py::class_<Fp_model<4l, libff::alt_bn128_modulus_r>>(m, "Fp_model4bn")
.def(py::init<>())
.def(py::init<const bigint<4l> &>())
.def(py::init<const long, const bool>())
.def_readwrite("mont_repr", &Fp_model<4l, libff::alt_bn128_modulus_r>::mont_repr)
.def_static("random_element", []() {
Fp_model<5l, mnt46_modulus_B> r;
while (mpn_cmp(r.mont_repr.data, mnt46_modulus_B.data, 5l))
{
r.mont_repr.randomize();
size_t bitno = GMP_NUMB_BITS * 5 - 1;
while (mnt46_modulus_B.test_bit(bitno) == false)
{
const size_t part = bitno / GMP_NUMB_BITS;
const size_t bit = bitno - (GMP_NUMB_BITS * part);
r.mont_repr.data[part] &= ~(1ul << bit);
bitno--;
}
}
return r;
})
.def("inverse", &Fp_model<4l, libff::alt_bn128_modulus_r>::inverse)
.def("print", &Fp_model<4l, libff::alt_bn128_modulus_r>::print)
.def("is_zero", &Fp_model<4l, libff::alt_bn128_modulus_r>::is_zero)
.def_static("one", &Fp_model<4l, libff::alt_bn128_modulus_r>::one)
.def_static("zero", &Fp_model<4l, libff::alt_bn128_modulus_r>::zero)
.def_static("size_in_bits", &Fp_model<4l, libff::alt_bn128_modulus_r>::size_in_bits)
.def("as_ulong", &Fp_model<4l, libff::alt_bn128_modulus_r>::as_ulong)
.def(py::self * py::self)
.def(py::self *= py::self)
.def(-py::self);
}
void declare_G1(py::module &m)
{
py::class_<mnt4_G1>(m, "mnt4_G1")
.def(py::init<>())
.def_static("one", &mnt4_G1::one);
}
void declare_G2(py::module &m)
{
py::class_<mnt4_G2>(m, "mnt4_G2")
.def(py::init<>())
.def_static("one", &mnt4_G2::one);
}
void init_utils(py::module &m)
{
declare_utils_Fp_model(m);
declare_G1(m);
declare_G2(m);
} | 39.124088 | 92 | 0.619216 | gargarchit |
5a36a2cc3636f45f26988d6e74b65fe2a3eabefd | 715 | cpp | C++ | 31-40/031 Next Permutation/NextPermutation.cpp | tiandaochouqin1/leetcode | 9dcfc1aafd4dcf2e2a7cb0fa84677b59d7d34430 | [
"Apache-2.0"
] | 1 | 2021-04-17T17:32:56.000Z | 2021-04-17T17:32:56.000Z | 31-40/031 Next Permutation/NextPermutation.cpp | tiandaochouqin1/leetcode | 9dcfc1aafd4dcf2e2a7cb0fa84677b59d7d34430 | [
"Apache-2.0"
] | null | null | null | 31-40/031 Next Permutation/NextPermutation.cpp | tiandaochouqin1/leetcode | 9dcfc1aafd4dcf2e2a7cb0fa84677b59d7d34430 | [
"Apache-2.0"
] | null | null | null | #include <vector>
#include <iostream>
using namespace std;
class Solution{
public:
vector<int> nextPermutaion(vector<int>& vec)
{
vector<int>::iterator v1=prev(vec.end()),v2=vec.end()-1;
int tmp;
for(;(v1-1)!=vec.begin()&&*(v1-1)>*v1;--v1) ;
if(!(v1-1==vec.begin()&&*(v1-1)>*v1))//iter_swap(v1-1,v2)
{ tmp=*(v1-1);
*(v1-1)=*v2;
*v2=tmp;}
for(;v1<v2;++v1,--v2)//reverse(v1,v2)
{ tmp=*v1;
*v1=*v2;
*v2=tmp;
}
return vec;
}
};
int main()
{
Solution s;
vector<int> v{1,2,3};
vector<int> res=s.nextPermutaion(v);
for(auto i:res)
cout<<i<<" ";
return 1;
} | 22.34375 | 65 | 0.471329 | tiandaochouqin1 |
5a3814ccb3c24edacb36caf75c8b2da5978dc2d0 | 2,593 | cpp | C++ | src/sample/main.cpp | WilstonOreo/omnicalib | 5dcea24eb68fab19860e37c272f32288cd3fce71 | [
"MIT"
] | 4 | 2017-04-14T14:15:02.000Z | 2018-12-09T17:18:27.000Z | src/sample/main.cpp | cr8tr/omnicalib | 5dcea24eb68fab19860e37c272f32288cd3fce71 | [
"MIT"
] | null | null | null | src/sample/main.cpp | cr8tr/omnicalib | 5dcea24eb68fab19860e37c272f32288cd3fce71 | [
"MIT"
] | 2 | 2019-12-05T07:36:31.000Z | 2021-07-21T09:58:34.000Z | /* Copyright (c) 2014-2016 "OmniCalibration" by cr8tr
* Calibration Format for Omnidome (http://omnido.me).
* Created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
*
* This file is part of Omnidome.
*
* Simplified BSD license
* Copyright (c) 2016
* 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 HOLDERS 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 <QDebug>
#include <QApplication>
#include "sample.h"
int main(int argc, char* argv[]) {
// This line is absolutely mandatory for being able to have multiple
// QOpenGLWidgets in different windows!!!
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QSurfaceFormat _format;
_format.setProfile(QSurfaceFormat::CompatibilityProfile);
#ifdef DEBUG
_format.setOption(QSurfaceFormat::DebugContext);
#endif
QSurfaceFormat::setDefaultFormat(_format);
QApplication _a(argc, argv);
// Get filename of calibration from command line arguments
QStringList&& _args = QCoreApplication::arguments();
QString _filename;
if (_args.size() < 2) {
qDebug() << "Usage: ./bin/Debug/sampleApp calibration.omnic";
qDebug() << "Pass omnic calibration file as command line argument.";
return EXIT_FAILURE;
}
for (int i = 1; i < _args.size(); ++i) {
_filename += " "+_args[i] ;
}
_filename = _filename.trimmed();
/// Run sample application
omnic::Sample _sample(_filename);
return _a.exec();
}
| 36.521127 | 82 | 0.742383 | WilstonOreo |
5a386f5740ac989ce7a9e93af127a3c1bf608355 | 2,298 | cpp | C++ | stacker_cpp/window_title_screen.cpp | MrCrazyID/Stacker | d232fe21f4a1d1c75905c66fed319a394f2a2ffe | [
"MIT"
] | 1 | 2019-04-05T08:24:40.000Z | 2019-04-05T08:24:40.000Z | stacker_cpp/window_title_screen.cpp | idelsink/stacker | d232fe21f4a1d1c75905c66fed319a394f2a2ffe | [
"MIT"
] | null | null | null | stacker_cpp/window_title_screen.cpp | idelsink/stacker | d232fe21f4a1d1c75905c66fed319a394f2a2ffe | [
"MIT"
] | null | null | null | /**
* @file window_title_screen.cpp
* @author Ingmar Delsink
* @date 2 may 2014
* @brief File containing the GUI of the Title screen of Stacker.
* In this file evertyhing of the title screen of Stacker in relation with the GUI
* can be found.
*/
#include "window_title_screen.h"
#include "ui_window_title_screen.h"
#include "window_main_screen.h"
#include "AppInfo.h"
window_title_screen::window_title_screen(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::window_title_screen)
{
ui->setupUi(this);
this->setWindowTitle(APPNAME_VERSION); //set window title
timer.start(100, this); //setup timer for color looping
}
window_title_screen::~window_title_screen()
{
delete ui;
}
//********************************************************************************
//pushButton Start clicked
void window_title_screen::on_pushButton_TitleWindowStart_clicked(void)
{
timer.stop();
newWindow_MainScreen = new window_main_screen();
newWindow_MainScreen->show();
this->close();
}
//********************************************************************************
//The is a timer functions, it does tasks on a timer
void window_title_screen::timerEvent(QTimerEvent *event)
{
int delay_time = 1200;
if (event->timerId() == timer.timerId())
{
ui->label_TitleWindowStacker->setStyleSheet("QLabel#label_TitleWindowStacker { color: rgb(255, 0, 0); font: 75 12pt Lucida Console;}");
ui->pushButton_TitleWindowStart->setText("PRESS");
delay(delay_time);
ui->label_TitleWindowStacker->setStyleSheet("QLabel#label_TitleWindowStacker { color: rgb(255, 255, 0); font: 75 12pt Lucida Console;}");
ui->pushButton_TitleWindowStart->setText("TO");
delay(delay_time);
ui->label_TitleWindowStacker->setStyleSheet("QLabel#label_TitleWindowStacker { color: rgb(0, 255, 0); font: 75 12pt Lucida Console;}");
ui->pushButton_TitleWindowStart->setText("PLAY");
delay(delay_time);
ui->label_TitleWindowStacker->setStyleSheet("QLabel#label_TitleWindowStacker { color: rgb(255, 0, 255); font: 75 12pt Lucida Console;}");
ui->pushButton_TitleWindowStart->setText("☟☟");
delay(delay_time);
}
else
{
QWidget::timerEvent(event);
}
}
| 33.794118 | 145 | 0.64752 | MrCrazyID |
5a3f18e2602df263cdfef44befc7f0774e5ea772 | 1,875 | cpp | C++ | cpp/Letter Combinations of a Phone Number.cpp | vishnureddys/leetcode | dcec596bab8fbf99cdaab7d4ba09865e34f7a0aa | [
"MIT"
] | null | null | null | cpp/Letter Combinations of a Phone Number.cpp | vishnureddys/leetcode | dcec596bab8fbf99cdaab7d4ba09865e34f7a0aa | [
"MIT"
] | null | null | null | cpp/Letter Combinations of a Phone Number.cpp | vishnureddys/leetcode | dcec596bab8fbf99cdaab7d4ba09865e34f7a0aa | [
"MIT"
] | null | null | null | /*
17. Letter Combinations of a Phone Number
Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any order.
A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.
Example 1:
Input: digits = "23"
Output: ["ad","ae","af","bd","be","bf","cd","ce","cf"]
Example 2:
Input: digits = ""
Output: []
Example 3:
Input: digits = "2"
Output: ["a","b","c"]
Constraints:
0 <= digits.length <= 4
digits[i] is a digit in the range ['2', '9'].
*/
class Solution {
public:
vector<string> letterCombinations(string digits) {
int n = digits.size();
unordered_map<char, string> map =
{
{'2',"abc"},
{'3', "def"},
{'4', "ghi"},
{'5', "jkl"},
{'6', "mno"},
{'7', "pqrs"},
{'8', "tuv"},
{'9',"wxyz"}
};
vector<string> ans;
// For all the letters in the number
for(int i=0;i<n;i++){
string letters = map[digits[i]];
// If the ans vector is empty
if(ans.empty()) {
// Get all the characters and put it into the ans vector
for(int j=0;j<letters.size();j++){
string s; s += letters[j];
ans.push_back(s);
}
}
// If ans already has some element
else {
// new_ans would have (n*m) elements.
vector<string> new_ans;
for(int j=0;j<letters.size();j++)
for(int k=0;k<ans.size(); k++)
new_ans.push_back(ans[k]+letters[j]);
ans = new_ans;
}
}
return ans;
}
};
| 28.409091 | 157 | 0.4832 | vishnureddys |
5a413f063cfd76c67eb3130bbbcdf06993fe542f | 234 | hpp | C++ | gb++/src/Input/Input.hpp | dfrias100/gb-plus-plus | e5c48f18ab24315f1a5c70789cd3c1cae9428baf | [
"MIT"
] | null | null | null | gb++/src/Input/Input.hpp | dfrias100/gb-plus-plus | e5c48f18ab24315f1a5c70789cd3c1cae9428baf | [
"MIT"
] | null | null | null | gb++/src/Input/Input.hpp | dfrias100/gb-plus-plus | e5c48f18ab24315f1a5c70789cd3c1cae9428baf | [
"MIT"
] | null | null | null | #ifndef INPUT_HPP
#define INPUT_HPP
#include "../Window/Window.hpp"
#include "../Memory/Memory.hpp"
struct InputHandler {
Window* EmuWindow;
Memory* EmulatorCore;
sf::Event* EventVar;
bool GetInput();
};
#endif // !INPUT_HPP
| 13.764706 | 31 | 0.709402 | dfrias100 |
5a42b33f0e78c19f29a0874c7d3176bc5c072f76 | 7,047 | cpp | C++ | src/caffe/sparse_blob.cpp | alemagnani/caffe | 9dfd7e44a452800566260d8b6f9bc27a29a34d76 | [
"BSD-2-Clause"
] | 2 | 2015-12-02T09:51:57.000Z | 2016-05-03T09:34:30.000Z | src/caffe/sparse_blob.cpp | alemagnani/caffe | 9dfd7e44a452800566260d8b6f9bc27a29a34d76 | [
"BSD-2-Clause"
] | null | null | null | src/caffe/sparse_blob.cpp | alemagnani/caffe | 9dfd7e44a452800566260d8b6f9bc27a29a34d76 | [
"BSD-2-Clause"
] | null | null | null | #include <vector>
#include "caffe/blob.hpp"
#include "caffe/common.hpp"
#include "caffe/sparse_blob.hpp"
#include "caffe/syncedmem.hpp"
#include "caffe/util/math_functions.hpp"
namespace caffe {
template<typename Dtype>
void SparseBlob<Dtype>::Reshape(const vector<int>& shape, const int nnz) {
CHECK_EQ(shape.size(), 2);
CHECK_GE(shape[0], 0);
CHECK_GE(shape[1], 0);
CHECK_GE(nnz, 0);
int previous_num = 0;
if (this->shape_.size() > 0) {
previous_num = this->shape_[0];
}
this->shape_.resize(2);
this->shape_[0] = shape[0];
this->shape_[1] = shape[1];
this->count_ = shape[0] * shape[1];
if (this->count_) {
if (nnz != nnz_) {
nnz_ = nnz;
this->data_.reset(new SyncedMemory(nnz_ * sizeof(Dtype)));
indices_.reset(new SyncedMemory(nnz_ * sizeof(int)));
}
if (previous_num != shape[0]) {
ptr_.reset(new SyncedMemory((this->shape_[0] + 1) * sizeof(int)));
}
} else {
this->data_.reset(reinterpret_cast<SyncedMemory*>(NULL));
indices_.reset(reinterpret_cast<SyncedMemory*>(NULL));
ptr_.reset(reinterpret_cast<SyncedMemory*>(NULL));
}
}
template<typename Dtype>
void SparseBlob<Dtype>::Reshape(const int num, const int channels,
const int height, const int width) {
CHECK_EQ(height, 1);
CHECK_EQ(width, 1);
vector<int> shape(2);
shape[0] = num;
shape[1] = channels;
Reshape(shape, 1);
}
template<typename Dtype>
void SparseBlob<Dtype>::Reshape(const vector<int>& shape) {
CHECK_GE(shape.size(), 2);
for( int i = 2; i < shape.size(); i++) {
CHECK_EQ(shape[i], 1);
}
vector<int> newshape(2);
newshape[0] = shape[0];
newshape[1] = shape[1];
Reshape(newshape, 1);
}
template<typename Dtype>
void SparseBlob<Dtype>::ReshapeLike(const Blob<Dtype>& other) {
if (const SparseBlob<Dtype>* sparseBlob =
dynamic_cast<SparseBlob<Dtype>*>((Blob<Dtype>*) (&other))) {
Reshape(other.shape(), sparseBlob->nnz());
} else {
Reshape(other.shape());
}
}
template<typename Dtype>
SparseBlob<Dtype>::SparseBlob(const vector<int>& shape,
const int nnz)
:nnz_(0) {
Reshape(shape, nnz);
}
template<typename Dtype>
SparseBlob<Dtype>::SparseBlob(const int num, const int channels, const int nnz)
:nnz_(0) {
vector<int> shape(2);
shape[0] = num;
shape[1] = channels;
Reshape(shape, nnz);
}
template<typename Dtype>
void SparseBlob<Dtype>::set_cpu_data(Dtype* data) {
LOG(FATAL)<< "set_cpu_data is not supported";
}
template<typename Dtype>
void SparseBlob<Dtype>::set_gpu_data(Dtype* data) {
LOG(FATAL)<< "set_gpu_data is not supported";
}
template<typename Dtype>
void SparseBlob<Dtype>::set_cpu_data(Dtype* data, int* indices, int* ptr,
int nnz, int total_size) {
CHECK(data);
CHECK(indices);
CHECK(ptr);
nnz_ = nnz;
if (total_size == -1) {
total_size = nnz;
}
CHECK_GE(total_size, nnz);
this->data_->set_cpu_data(reinterpret_cast<void*>(data),
total_size * sizeof(Dtype));
indices_->set_cpu_data(reinterpret_cast<void*>(indices),
total_size * sizeof(int));
ptr_->set_cpu_data(reinterpret_cast<void*>(ptr),
(this->shape_[0] + 1) * sizeof(int));
}
template<typename Dtype>
void SparseBlob<Dtype>::set_gpu_data(Dtype* data, int* indices, int* ptr,
int nnz, int total_size) {
CHECK(data);
CHECK(indices);
CHECK(ptr);
nnz_ = nnz;
if (total_size == -1) {
total_size = nnz;
}
CHECK_GE(total_size, nnz);
this->data_->set_gpu_data(data, total_size * sizeof(Dtype));
indices_->set_gpu_data(indices, total_size * sizeof(int));
ptr_->set_gpu_data(ptr, (this->shape_[0] + 1) * sizeof(int));
}
template<typename Dtype>
const Dtype* SparseBlob<Dtype>::cpu_diff() const {
LOG(FATAL)<< "cpu_diff is not supported";
return NULL;
}
template<typename Dtype>
const Dtype* SparseBlob<Dtype>::gpu_diff() const {
LOG(FATAL)<< "gpu_diff is not supported";
return NULL;
}
template<typename Dtype>
Dtype* SparseBlob<Dtype>::mutable_cpu_diff() {
LOG(FATAL)<< "cpu_mutable_diff is not supported";
return NULL;
}
template<typename Dtype>
Dtype* SparseBlob<Dtype>::mutable_gpu_diff() {
LOG(FATAL)<< "gpu_mutable_diff is not supported";
return NULL;
}
template<typename Dtype>
const int* SparseBlob<Dtype>::cpu_indices() const {
CHECK(indices_);
return (const int*) indices_->cpu_data();
}
template<typename Dtype>
const int* SparseBlob<Dtype>::cpu_ptr() const {
CHECK(ptr_);
return (const int*) ptr_->cpu_data();
}
template<typename Dtype>
const int* SparseBlob<Dtype>::gpu_indices() const {
CHECK(indices_);
return (const int*) indices_->gpu_data();
}
template<typename Dtype>
const int* SparseBlob<Dtype>::gpu_ptr() const {
CHECK(ptr_);
return (const int*) ptr_->gpu_data();
}
template<typename Dtype>
int* SparseBlob<Dtype>::mutable_cpu_indices() {
CHECK(indices_);
return reinterpret_cast<int*>(indices_->mutable_cpu_data());
}
template<typename Dtype>
int* SparseBlob<Dtype>::mutable_cpu_ptr() {
CHECK(ptr_);
return reinterpret_cast<int*>(ptr_->mutable_cpu_data());
}
template<typename Dtype>
int* SparseBlob<Dtype>::mutable_gpu_indices() {
CHECK(indices_);
return reinterpret_cast<int*>(indices_->mutable_gpu_data());
}
template<typename Dtype>
int* SparseBlob<Dtype>::mutable_gpu_ptr() {
CHECK(ptr_);
return reinterpret_cast<int*>(ptr_->mutable_gpu_data());
}
template<typename Dtype>
void SparseBlob<Dtype>::ShareData(const Blob<Dtype>& other) {
LOG(FATAL)<< "ShareData is not supported";
}
template<typename Dtype>
void SparseBlob<Dtype>::ShareDiff(const Blob<Dtype>& other) {
LOG(FATAL)<< "ShareDiff is not supported";
}
template<typename Dtype>
void SparseBlob<Dtype>::Update() {
LOG(FATAL)<< "Update is not supported";
}
template <typename Dtype>
Dtype SparseBlob<Dtype>::asum_data() const {
NOT_IMPLEMENTED;
return 0;
}
template <typename Dtype>
Dtype SparseBlob<Dtype>::asum_diff() const {
NOT_IMPLEMENTED;
return 0;
}
template <typename Dtype>
Dtype SparseBlob<Dtype>::sumsq_data() const {
NOT_IMPLEMENTED;
return 0;
}
template <typename Dtype>
Dtype SparseBlob<Dtype>::sumsq_diff() const {
NOT_IMPLEMENTED;
return 0;
}
template <typename Dtype>
void SparseBlob<Dtype>::scale_data(Dtype scale_factor) {
NOT_IMPLEMENTED;
}
template <typename Dtype>
void SparseBlob<Dtype>::scale_diff(Dtype scale_factor) {
NOT_IMPLEMENTED;
}
template<typename Dtype>
void SparseBlob<Dtype>::CopyFrom(const Blob<Dtype>& source, bool copy_diff,
bool reshape) {
LOG(FATAL)<< "CopyFrom is not supported";
}
template<typename Dtype>
void SparseBlob<Dtype>::FromProto(const BlobProto& proto, bool reshape) {
LOG(FATAL)<< "FromProto is not supported";
}
template<typename Dtype>
void SparseBlob<Dtype>::ToProto(BlobProto* proto, bool write_diff) const {
LOG(FATAL)<< "ToProto is not supported";
}
INSTANTIATE_CLASS(SparseBlob);
} // namespace caffe
| 25.440433 | 79 | 0.677877 | alemagnani |
5a47cdc6fcaa6cc1dce8b7a0f191b31647ade007 | 4,115 | cpp | C++ | code/server/tests/single_channel_server_test.cpp | doleron/raspberry-as-gige-camera | ac73b09f126870684e8417da4be6ebb44822a322 | [
"MIT"
] | 20 | 2021-08-29T17:54:48.000Z | 2022-03-06T07:17:10.000Z | code/server/tests/single_channel_server_test.cpp | doleron/raspberry-as-gige-camera | ac73b09f126870684e8417da4be6ebb44822a322 | [
"MIT"
] | null | null | null | code/server/tests/single_channel_server_test.cpp | doleron/raspberry-as-gige-camera | ac73b09f126870684e8417da4be6ebb44822a322 | [
"MIT"
] | 2 | 2021-11-28T09:51:30.000Z | 2022-02-05T08:40:16.000Z |
#include "gtest/gtest.h"
#include "rpiasgige/single_channel_server.hpp"
static const int TEST_DATA_SIZE = 3 * 1280 * 1024;
class Single_Channel_ServerTest : public ::testing::Test
{
};
/**
* This class aims to expose the protected methods in order we can test them.
**/
class Single_Channel_Server_Wrapper : public rpiasgige::Single_Channel_Server
{
public:
Single_Channel_Server_Wrapper() :
rpiasgige::Single_Channel_Server("Single_Channel_Server_Wrapper", 4242, HEADER_SIZE, HEADER_SIZE + TEST_DATA_SIZE) {}
virtual ~Single_Channel_Server_Wrapper() {};
const char *get_response_buffer_wrapper() const
{
return this->get_response_buffer();
}
bool set_buffer_value_wrapper(int from, int size, const void *data)
{
return this->set_buffer_value(from, size, data);
}
bool clean_output_buffer_wrapper(const int from, const int size)
{
return this->clean_output_buffer(from, size);
}
void set_status_wrapper(const char *status)
{
this->set_status(status);
}
void set_response_data_size_wrapper(int size)
{
this->set_response_data_size(size);
}
protected:
void respond_to_client(int &client_socket, const int data_size)
{
}
};
TEST_F(Single_Channel_ServerTest, set_buffer_value_Test)
{
char data[TEST_DATA_SIZE];
int char_size = sizeof(char);
for(int i = 0; i < TEST_DATA_SIZE; ++i) {
data[i] = (i % char_size) + 1;
}
Single_Channel_Server_Wrapper server;
ASSERT_TRUE(server.set_buffer_value_wrapper(rpiasgige::Single_Channel_Server::HEADER_SIZE, TEST_DATA_SIZE, data));
const char * data_ro = server.get_response_buffer_wrapper() + rpiasgige::Single_Channel_Server::HEADER_SIZE;
for(int i = 0; i < TEST_DATA_SIZE; ++i) {
char expected = (i % char_size) + 1;
EXPECT_EQ(data_ro[i], expected) << "Expected to get " << expected << " but got " << data_ro[i] << " at index " << i;
}
}
TEST_F(Single_Channel_ServerTest, clean_output_buffer_Test)
{
char data[TEST_DATA_SIZE];
int char_size = sizeof(char);
for(int i = 0; i < TEST_DATA_SIZE; ++i) {
data[i] = (i % char_size) + 1;
}
Single_Channel_Server_Wrapper server;
server.set_buffer_value_wrapper(rpiasgige::Single_Channel_Server::HEADER_SIZE, TEST_DATA_SIZE, data);
const char * data_ro = server.get_response_buffer_wrapper() + rpiasgige::Single_Channel_Server::HEADER_SIZE;
for(int i = 0; i < TEST_DATA_SIZE; ++i) {
int expected = (i % char_size) + 1;
ASSERT_EQ(data_ro[i], expected) << "Expected to get " << expected << " but got " << data_ro[i] << " at index " << i;
}
ASSERT_TRUE(server.clean_output_buffer_wrapper(rpiasgige::Single_Channel_Server::HEADER_SIZE, TEST_DATA_SIZE));
for(int i = 0; i < TEST_DATA_SIZE; ++i) {
EXPECT_EQ(data_ro[i], 0) << "Expected to get 0 but got " << data_ro[i] << " at index " << i;
}
}
TEST_F(Single_Channel_ServerTest, set_status_Test)
{
char status[rpiasgige::Single_Channel_Server::STATUS_SIZE];
int char_size = sizeof(char);
for(int i = 0; i < rpiasgige::Single_Channel_Server::STATUS_SIZE; ++i) {
status[i] = (i % char_size) + 1;
}
Single_Channel_Server_Wrapper server;
server.set_status_wrapper(status);
const char *response_buffer_ro = server.get_response_buffer_wrapper();
for(int i = 0; i < rpiasgige::Single_Channel_Server::STATUS_SIZE; ++i) {
int expected = (i % char_size) + 1;
EXPECT_EQ(status[i], (i % char_size) + 1);
}
}
TEST_F(Single_Channel_ServerTest, set_response_data_size_Test)
{
Single_Channel_Server_Wrapper server;
server.set_response_data_size_wrapper(TEST_DATA_SIZE);
const char *response_buffer_ro = server.get_response_buffer_wrapper();
int data_size_copy;
memcpy(&data_size_copy, response_buffer_ro + rpiasgige::Single_Channel_Server::DATA_SIZE_ADDRESS, sizeof(int));
EXPECT_EQ(TEST_DATA_SIZE, data_size_copy) << "Expected to get " << TEST_DATA_SIZE << " but got " << data_size_copy;
} | 27.804054 | 125 | 0.685055 | doleron |
5a4e842176ad36aa5adff6864bfe30a36008d7cc | 895 | cpp | C++ | DynamicProgramming/0279-Perfect-Squares/memorySearch-150ms.cpp | FeiZhao0531/PlayLeetCode | ed23477fd6086d5139bda3d93feeabc09b06854d | [
"MIT"
] | 5 | 2019-05-11T18:33:32.000Z | 2019-12-13T09:13:02.000Z | DynamicProgramming/0279-Perfect-Squares/memorySearch-150ms.cpp | FeiZhao0531/PlayLeetCode | ed23477fd6086d5139bda3d93feeabc09b06854d | [
"MIT"
] | null | null | null | DynamicProgramming/0279-Perfect-Squares/memorySearch-150ms.cpp | FeiZhao0531/PlayLeetCode | ed23477fd6086d5139bda3d93feeabc09b06854d | [
"MIT"
] | null | null | null | /// Source : https://leetcode.com/problems/perfect-squares/description/
/// Author : Fei
/// Time : Jul-18-2019
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
/// Memory Search
/// Time Complexity: O(n)
/// Space Complexity: O(n)
class Solution {
public:
int numSquares(int n) {
assert( n > 0);
memo = vector<int>( 1 + n, INT_MAX); // memo[i] : result of numSquares(i)
return memorySearch( n);
}
private:
vector<int> memo;
int memorySearch( int n) {
if( n <= 3)
return n;
for( int i=1; i*i <= n; ++i) {
int rest = n - i * i;
if( memo[rest] == INT_MAX) memo[rest] = memorySearch( rest);
memo[n] = min( memo[n], memo[rest] + 1);
}
return memo[n];
}
};;
int main() {
cout << Solution().numSquares(5) << endl;
return 0;
}
| 19.042553 | 81 | 0.532961 | FeiZhao0531 |
990000fc46691106c4cd6a2cba4d1a74f4cac8d9 | 2,282 | hpp | C++ | boost/assign/v2/ref/wrapper/framework.hpp | rogard/assign_v2 | 8735f57177dbee57514b4e80c498dd4b89f845e5 | [
"BSL-1.0"
] | null | null | null | boost/assign/v2/ref/wrapper/framework.hpp | rogard/assign_v2 | 8735f57177dbee57514b4e80c498dd4b89f845e5 | [
"BSL-1.0"
] | null | null | null | boost/assign/v2/ref/wrapper/framework.hpp | rogard/assign_v2 | 8735f57177dbee57514b4e80c498dd4b89f845e5 | [
"BSL-1.0"
] | null | null | null | //////////////////////////////////////////////////////////////////////////////
// Boost.Assign v2 //
// //
// Copyright (C) 2003-2004 Thorsten Ottosen //
// Copyright (C) 2011 Erwann Rogard //
// Use, modification and distribution are subject to the //
// Boost Software License, Version 1.0. (See accompanying file //
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
//////////////////////////////////////////////////////////////////////////////
#ifndef BOOST_ASSIGN_V2_REF_WRAPPER_FRAMEWORK_ER_2011_HPP
#define BOOST_ASSIGN_V2_REF_WRAPPER_FRAMEWORK_ER_2011_HPP
namespace boost{
namespace assign{
namespace v2{
namespace ref{
template<typename Tag, typename T>
struct wrapper{
// specialize on Tag
};
namespace result_of{
template<typename Tag, typename T>
struct wrap{
typedef ref::wrapper<Tag,T> type;
};
}
template<typename Tag, typename T>
inline ref::wrapper<Tag,T>
wrap(T & t)
{
typedef ref::wrapper<Tag,T> result_;
return result_( t );
}
template<typename Tag, typename T>
inline ref::wrapper<Tag, T const>
wrap(T const & t)
{
typedef ref::wrapper<Tag,T const> result_;
return result_( t );
}
}// ref
}// v2
}// assign
}// boost
#include <boost/mpl/bool.hpp>
#include <boost/ref.hpp>
// The part below extends boost/ref.hpp.
namespace boost{
# define AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(U) \
template<typename Tag, typename T> \
class is_reference_wrapper<U> \
: public mpl::true_ \
{ \
}; \
\
template<typename Tag, typename T> \
class unwrap_reference<U> \
{ \
public: \
typedef T type; \
}; \
/**/
#define u assign::v2::ref::wrapper<Tag, T>
AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(u)
#if !defined(BOOST_NO_CV_SPECIALIZATIONS)
AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(u const )
AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(u volatile )
AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF(u const volatile )
#endif
#undef u
#undef AUX_REFERENCE_WRAPPER_METAFUNCTIONS_DEF
}// boost
#endif // BOOST_ASSIGN_V2_REF_WRAPPER_FRAMEWORK_ER_2011_HPP
| 25.640449 | 78 | 0.599912 | rogard |
9901e5d075ebf8df1d7cc599e4fc85142c48f3a8 | 5,207 | cpp | C++ | src/Graphics/Sprite.cpp | UltimaBGD/Ngine | f672c52ca391b32fd0f808166c8728cf4597a077 | [
"Apache-2.0"
] | null | null | null | src/Graphics/Sprite.cpp | UltimaBGD/Ngine | f672c52ca391b32fd0f808166c8728cf4597a077 | [
"Apache-2.0"
] | null | null | null | src/Graphics/Sprite.cpp | UltimaBGD/Ngine | f672c52ca391b32fd0f808166c8728cf4597a077 | [
"Apache-2.0"
] | null | null | null | /**********************************************************************************************
*
* Ngine - A (mainly) 2D game engine.
*
* Copyright (C) 2019 NerdThings
*
* LICENSE: Apache License 2.0
* View: https://github.com/NerdThings/Ngine/blob/master/LICENSE
*
**********************************************************************************************/
#include "Sprite.h"
#include <cmath>
#include "../Graphics/Color.h"
#include "../Graphics/Texture2D.h"
#include "Rectangle.h"
#include "Vector2.h"
#include "Drawing.h"
namespace NerdThings::Ngine::Graphics {
// Public Constructor(s)
TSprite::TSprite(std::shared_ptr<TTexture2D> texture_) {
_Textures.push_back(texture_);
DrawHeight = texture_->Height;
DrawWidth = texture_->Width;
}
TSprite::TSprite(std::shared_ptr<TTexture2D> texture_, int frameWidth_, int frameHeight_, int drawWidth_, int drawHeight_,
float imageSpeed_, int startingFrame)
: DrawHeight(drawHeight_), DrawWidth(drawWidth_), FrameWidth(frameWidth_), FrameHeight(frameHeight_),
ImageSpeed(imageSpeed_) {
_Textures.push_back(texture_);
CurrentFrame = startingFrame;
}
TSprite::TSprite(std::vector<std::shared_ptr<TTexture2D>> textures_, float imageSpeed_, int startingFrame_) { }
// Public Methods
void TSprite::Draw(TVector2 position_, float rotation_, TVector2 origin_) {
Drawing::DrawTexture(GetCurrentTexture(),
TRectangle(
position_,
static_cast<float>(DrawWidth),
static_cast<float>(DrawHeight)),
GetSourceRectangle(),
TColor::White,
origin_,
rotation_);
}
int TSprite::FrameX() {
if (!_SpriteSheet)
return 0;
auto x = 0;
for (auto i = 0; i < CurrentFrame; i++) {
x += FrameWidth;
if (x >= GetCurrentTexture()->Width)
x = 0;
}
return x;
}
int TSprite::FrameY() {
if (!_SpriteSheet)
return 0;
auto x = 0;
auto y = 0;
for (auto i = 0; i < CurrentFrame; i++) {
x += FrameWidth;
if (x >= GetCurrentTexture()->Width) {
x = 0;
y += FrameHeight;
}
}
return y;
}
std::shared_ptr<TTexture2D> TSprite::GetCurrentTexture() {
if (_Textures.empty())
return nullptr;
if (_SpriteSheet) {
return _Textures[0];
}
return _Textures[CurrentFrame];
}
TRectangle TSprite::GetSourceRectangle() {
if (_SpriteSheet)
return {
static_cast<float>(FrameX()),
static_cast<float>(FrameY()),
static_cast<float>(FrameWidth),
static_cast<float>(FrameHeight)
};
else
return {
0,
0,
static_cast<float>(GetCurrentTexture()->Width),
static_cast<float>(GetCurrentTexture()->Height)
};
}
bool TSprite::IsAnimated() {
if (_SpriteSheet) {
if (GetCurrentTexture() != nullptr)
return FrameHeight != GetCurrentTexture()->Height || FrameWidth != GetCurrentTexture()->Width;
else
return false;
} else {
return _Textures.size() > 1;
}
}
void TSprite::SetTexture(std::shared_ptr<TTexture2D> texture_) {
_Textures.clear();
_Textures.push_back(texture_);
}
void TSprite::SetTextures(std::vector<std::shared_ptr<TTexture2D> > textures_) {
_Textures = textures_;
}
void TSprite::Update() {
if (IsAnimated()) {
// Increment timer
_AnimationTimer++;
while (_AnimationTimer > 0 && fmod(_AnimationTimer, ImageSpeed) == 0) {
// Reset timer
_AnimationTimer = 0;
// Increase frame
CurrentFrame++;
// Reset if out of range
if (_SpriteSheet) {
auto count = (GetCurrentTexture()->Width / FrameWidth) * (GetCurrentTexture()->Height / FrameHeight);
if (CurrentFrame > count - 1)
CurrentFrame = 0;
} else {
if (CurrentFrame > _Textures.size() - 1)
CurrentFrame = 0;
}
}
}
}
// Operators
bool TSprite::operator==(const TSprite &b) {
return _Textures == b._Textures && DrawHeight == b.DrawHeight && DrawWidth == b.DrawWidth && FrameHeight == b.FrameHeight && FrameWidth == b.FrameWidth && ImageSpeed == b.ImageSpeed;
}
bool TSprite::operator!=(const TSprite &b) {
return _Textures != b._Textures || DrawHeight != b.DrawHeight || DrawWidth != b.DrawWidth || FrameHeight != b.FrameHeight || FrameWidth != b.FrameWidth || ImageSpeed != b.ImageSpeed;
}
}
| 30.450292 | 190 | 0.507586 | UltimaBGD |
99044b017e71ead8e60459362316c9c1e16d6c3a | 471 | cpp | C++ | Leetcode/997.cpp | prameetu/CP_codes | 41f8cfc188d2e08a8091bc5134247d05ba8a78f5 | [
"MIT"
] | null | null | null | Leetcode/997.cpp | prameetu/CP_codes | 41f8cfc188d2e08a8091bc5134247d05ba8a78f5 | [
"MIT"
] | null | null | null | Leetcode/997.cpp | prameetu/CP_codes | 41f8cfc188d2e08a8091bc5134247d05ba8a78f5 | [
"MIT"
] | null | null | null | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int findJudge(int n, vector<vector<int>>& trust) {
int judge(-1);
map <int,int> mp;
vector <int> v(n+1,0);
for(auto x:trust)
{
v[x[0]]++;
mp[x[1]]++;
}
for(int i=1;i<=n;i++){
if(mp[i] == n-1 && v[i] == 0)
return i;
}
return -1;
}
}; | 16.241379 | 54 | 0.373673 | prameetu |
99128280a791d59bfafbcd69bff76e377b5476df | 1,011 | cpp | C++ | src/User/Command/Channel/PART.cpp | hallainea/ft_irc | 389ff7c1c93e72739e373c74b69ec826535216e4 | [
"Apache-2.0"
] | 6 | 2021-12-10T18:35:26.000Z | 2022-03-23T21:46:14.000Z | src/User/Command/Channel/PART.cpp | Assxios/ft_irc | 389ff7c1c93e72739e373c74b69ec826535216e4 | [
"Apache-2.0"
] | null | null | null | src/User/Command/Channel/PART.cpp | Assxios/ft_irc | 389ff7c1c93e72739e373c74b69ec826535216e4 | [
"Apache-2.0"
] | 3 | 2021-12-19T18:11:13.000Z | 2022-02-02T13:29:31.000Z | #include "../Command.hpp"
#include "../../../Utils/Utils.hpp"
#include "../../../Server/Server.hpp"
#include "../../User.hpp"
void PART(irc::Command *command)
{
if (command->getParameters().size() == 0)
{
command->reply(461, "PART");
return;
}
std::vector<std::string> channels = irc::split(command->getParameters()[0], ",");
for (std::vector<std::string>::iterator it = channels.begin(); it != channels.end(); ++it)
{
std::string &channel = *it;
if (channel.size() == 0)
continue;
if (command->getServer().isChannel(channel))
{
irc::Channel &chan = command->getServer().getChannel(channel);
if (!chan.isUser(command->getUser()))
{
command->reply(442, channel);
continue;
}
chan.broadcast(command->getUser(), "PART " + channel + (command->getTrailer().size() ? " :" + command->getTrailer() : ""));
chan.removeUser(command->getUser());
if (chan.getUsers().size() == 0)
command->getServer().delChannel(chan);
}
else
command->reply(403, channel);
}
}
| 28.083333 | 126 | 0.613254 | hallainea |
991adeea4419452a5a0fbf4a501e4388d985348d | 871 | hpp | C++ | cpp-projects/tous-les-prenoms-app/widgets/list_names_m.hpp | FlorianLance/TousLesPrenoms | 57e2b6b39efac924e10066f97f9a718bd069f9d6 | [
"MIT"
] | null | null | null | cpp-projects/tous-les-prenoms-app/widgets/list_names_m.hpp | FlorianLance/TousLesPrenoms | 57e2b6b39efac924e10066f97f9a718bd069f9d6 | [
"MIT"
] | null | null | null | cpp-projects/tous-les-prenoms-app/widgets/list_names_m.hpp | FlorianLance/TousLesPrenoms | 57e2b6b39efac924e10066f97f9a718bd069f9d6 | [
"MIT"
] | null | null | null |
#pragma once
// Qt
#include <QAbstractListModel>
#include <QSortFilterProxyModel>
// local
#include "data/data.hpp"
#include "data/settings.hpp"
namespace tool::ui {
enum class Mode {
Filtered,Saved,Removed
};
class ListNamesM : public QAbstractListModel{
Q_OBJECT
public:
ListNamesM(Mode mode);
int rowCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role= Qt::DisplayRole) const;
bool setData(const QModelIndex &index, const QVariant &value, int role);
// QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const{
// return QVariant();
// }
void update();
void update2();
tool::Data *nData = nullptr;
DisplaySettings *dSettings = nullptr;
bool initialized = false;
private:
Mode m_mode;
// QAbstractItemModel interface
};
}
| 18.145833 | 102 | 0.699196 | FlorianLance |
991e0568a4c06ddf4755672ecd465e6485733a51 | 643 | cpp | C++ | p1478.cpp | joe1166/noi | be2e9fcd8306ff4f20a4306e219656346a396013 | [
"Apache-2.0"
] | null | null | null | p1478.cpp | joe1166/noi | be2e9fcd8306ff4f20a4306e219656346a396013 | [
"Apache-2.0"
] | null | null | null | p1478.cpp | joe1166/noi | be2e9fcd8306ff4f20a4306e219656346a396013 | [
"Apache-2.0"
] | null | null | null | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, s;
int a, b, c;
vector<int> z;
int counta = 0;
int main(int argc, char const *argv[])
{
cin >> n >> s;
int x[n], y[n];
cin >> a >> b;
c = a + b;
for (int i = 0; i < n; i++)
{
cin >> x[i] >> y[i];
if (x[i] <= c)
{
z.push_back(y[i]);
}
}
sort(z.begin(), z.end());
for (int i = 0; i < z.size(); i++)
{
if (s - z[i] < 0)
{
break;
}
s -= z[i];
counta++;
}
cout << counta;
//system("PAUSE");
return 0;
}
| 14.953488 | 38 | 0.390358 | joe1166 |
991f111953f6188c3c052b7beba8115a7724d60b | 2,235 | cpp | C++ | Homeworks/homework009.cpp | JcsnP/My-Playground | 683600bd32ee7050bbe2cfca8eaf96eb1cdf039c | [
"Unlicense"
] | 2 | 2020-12-31T09:30:57.000Z | 2021-03-15T05:04:18.000Z | Homeworks/homework009.cpp | JcsnP/My-Playground | 683600bd32ee7050bbe2cfca8eaf96eb1cdf039c | [
"Unlicense"
] | null | null | null | Homeworks/homework009.cpp | JcsnP/My-Playground | 683600bd32ee7050bbe2cfca8eaf96eb1cdf039c | [
"Unlicense"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
typedef long int ll;
void input();
void deposit();
void withdraw();
void show();
struct Account{
long long int accountID;
int accountType;
ll money = 0;
ll limit = 0;
};
struct Person{
int personID;
char firstName[100];
char lastName[100];
struct Account account;
} customer_account;
int main(){
int choice;
input();
while(true){
cout << "------------------------------------------------------\n";
cout << "(1) Deposit " << "(2) Withdraw " << "(3) Exit" << endl;
cout << "------------------------------------------------------\n";
cin >> choice;
if(choice == 1) deposit();
else if(choice == 2) withdraw();
else if(choice == 3){
show();
break;
}else break;
}
}
void input(){
int type(0);
ll limit(0);
cout << "Customer id: "; cin >> customer_account.personID;
cout << "Enter first name: "; cin >> customer_account.firstName;
cout << "Enter last name: "; cin >> customer_account.lastName;
//account details
cout << "Enter account number: "; cin >> customer_account.account.accountID;
cout << "Choose account type (1) or (2): "; cin >> type;
cout << "Enter initial money: "; cin >> customer_account.account.money;
//limit
if(type == 2){
cout << "Enter Limit: "; cin >> limit;
}
}
void show(){
cout << "Customer id: " << customer_account.personID << endl;
cout << "Customer First Name: " << customer_account.firstName << endl;
cout << "Customer Last Name: " << customer_account.lastName << endl;
cout << "Account number: " << customer_account.account.accountID << endlCus;
if(customer_account.account.accountType == 1){
cout << "Account type: (1) Savings account" << endl;
}else{
cout << "Account type: (2) Current account" << endl;
}
cout << "Balance: " << customer_account.account.money << endl;
if(customer_account.account.accountType == 2){
cout << "Limit: " << customer_account.account.limit << endl;
}
}
void deposit(){
ll money;
cout << "Please enter the amount you want to deposit: "; cin >> money;
customer_account.account.money += money;
}
void withdraw(){
ll money;
cout << "Please enter the amount you wish to withdraw: "; cin >> money;
customer_account.account.money -= money;
}
| 24.293478 | 77 | 0.612081 | JcsnP |
992501051e97fd41becd60a3a251b5de6cddf8eb | 2,602 | hpp | C++ | src/RandomizedCollection.hpp | znso4/LeetCodeAnswers | 232f5b2c4a66b461d336e80998e2ce4ac069f467 | [
"Apache-2.0"
] | 1 | 2020-08-24T15:47:18.000Z | 2020-08-24T15:47:18.000Z | src/RandomizedCollection.hpp | znso4/LeetCodeAnswers | 232f5b2c4a66b461d336e80998e2ce4ac069f467 | [
"Apache-2.0"
] | null | null | null | src/RandomizedCollection.hpp | znso4/LeetCodeAnswers | 232f5b2c4a66b461d336e80998e2ce4ac069f467 | [
"Apache-2.0"
] | null | null | null | #include "pch.h"
#pragma once
using std::cout;
using std::endl;
template<typename ValueType = int, typename IndexType = size_t>
class RandomizedCollection {
std::vector<ValueType> values;
std::unordered_map<ValueType, std::unordered_set<IndexType>> indices;
std::mt19937 rIndex;
public:
/** Initialize your data structure here. */
RandomizedCollection() {}
/** Inserts a value to the collection. Returns true if the collection did not already contain the specified element. */
bool insert(ValueType val) {
bool ret = (indices.find(val) == indices.end());
indices[val].insert(values.size());
values.push_back(val);
return ret;
}
/** Removes a value from the collection. Returns true if the collection contained the specified element. */
bool remove(ValueType val) {
if (indices.find(val) == indices.end()) {
return false;
}
else {
ValueType tail = values.back();
if (val != tail) {
ValueType i = *indices[val].begin();
values[i] = tail;
indices[tail].erase(values.size() - 1);
indices[tail].insert(i);
indices[val].erase(i);
}
else {
indices[val].erase(values.size() - 1);
}
values.pop_back();
if (indices[val].empty()) indices.erase(val);
return true;
}
}
/** Get a random element from the collection. */
IndexType getRandom() {
return values[rIndex() % values.size()];
}
static void test() {
// 初始化一个空的集合。
RandomizedCollection<> collection;
// 向集合中插入 1 。返回 true 表示集合不包含 1 。
cout << collection.insert(1) << endl;
// 向集合中插入另一个 1 。返回 false 表示集合包含 1 。集合现在包含 [1,1] 。
cout << collection.insert(1) << endl;
// 向集合中插入 2 ,返回 true 。集合现在包含 [1,1,2] 。
cout << collection.insert(2) << endl;
// getRandom 应当有 2/3 的概率返回 1 ,1/3 的概率返回 2 。
int result = 0;
for (int i = 0; i < 1000; ++i) {
if (collection.getRandom() == 1) ++result;
}
cout << "P(1) == " << result * 1.0 / 1000 << endl;
// 从集合中删除 1 ,返回 true 。集合现在包含 [1,2] 。
cout << collection.remove(1) << endl;
// getRandom 应有相同概率返回 1 和 2 。
result = 0;
for (int i = 0; i < 1000; ++i) {
if (collection.getRandom() == 1) ++result;
}
cout << "P(1) == " << result * 1.0 / 1000 << endl;
cout << collection.remove(100) << endl;
}
};
| 31.349398 | 123 | 0.532283 | znso4 |
9925b4f8c0a423bf76a0ac93e97560159e81bb32 | 19,060 | cc | C++ | minisat/core/Solver.cc | mmaroti/minisat-stripped | b596823164759f401faa30244b97051e80d15816 | [
"MIT"
] | null | null | null | minisat/core/Solver.cc | mmaroti/minisat-stripped | b596823164759f401faa30244b97051e80d15816 | [
"MIT"
] | null | null | null | minisat/core/Solver.cc | mmaroti/minisat-stripped | b596823164759f401faa30244b97051e80d15816 | [
"MIT"
] | null | null | null | /***************************************************************************************[Solver.cc]
Copyright (c) 2003-2006, Niklas Een, Niklas Sorensson
Copyright (c) 2007-2010, Niklas Sorensson
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**************************************************************************************************/
#include <math.h>
#include <algorithm>
#include "Solver.h"
using namespace Minisat;
// Constructor:
Solver::Solver()
: // User parameters
var_decay(0.95), clause_decay(0.999), random_var_freq(0),
random_seed(91648253), luby_restart(true),
restart_first(100), restart_inc(2),
// Internal parameters
learntsize_factor(1.0 / 3.0), learntsize_inc(1.1),
learntsize_adjust_start_confl(100), learntsize_adjust_inc(1.5),
// Statistics
solves(0), starts(0), decisions(0), rnd_decisions(0), propagations(0),
conflicts(0), clauses_literals(0), learnts_literals(0),
max_literals(0), tot_literals(0),
// State
ok(true), cla_inc(1), var_inc(1), watches(), qhead(0), simpDB_assigns(-1),
simpDB_props(0), order_heap({activity}) {}
// Problem specification:
Lit Solver::addLiteral() {
int v = nVars();
int l = std::max(Lit(v, false).toInt() + 1, Lit(v, true).toInt() + 1);
if (watches.size() < l)
watches.resize(l);
assigns.push_back(l_Undef);
vardata.push_back({Clause::UNDEF, 0});
activity.push_back(0.0);
analyze_seen.push_back(false);
insertVarOrder(v);
return Lit(v, true);
}
bool Solver::takeClause(std::vector<Lit> &ps) {
assert(decisionLevel() == 0);
if (!ok)
return false;
// Check if clause is satisfied and remove false/duplicate literals:
std::sort(ps.begin(), ps.end());
Lit p = lit_Undef;
auto i = ps.begin();
auto j = ps.begin();
auto end = ps.end();
while (i != end) {
if (value(*i) == l_True || *i == ~p) {
return true;
} else if (value(*i) != l_False && *i != p) {
*j = p = *i;
++j;
}
++i;
}
ps.erase(j, ps.end());
if (ps.empty())
return ok = false;
else if (ps.size() == 1) {
uncheckedEnqueue(ps[0]);
return ok = (propagate() == Clause::UNDEF);
}
CRef cr = new Clause(ps, false);
clauses.push_back(cr);
attachClause(cr);
return true;
}
void Solver::attachClause(CRef cr) {
const Clause& c = *cr;
assert(c.size() > 1);
occurences(~c[0]).push_back(Watcher(cr, c[1]));
occurences(~c[1]).push_back(Watcher(cr, c[0]));
if (c.learnt()) learnts_literals += c.size();
else clauses_literals += c.size(); }
void Solver::detachClause(CRef cr) {
const Clause& c = *cr;
assert(c.size() > 1);
// remove(occurences(~c[0]), Watcher(cr, c[1]));
std::vector<Watcher> &occ0 = occurences(~c[0]);
*std::find(occ0.begin(), occ0.end(), Watcher(cr, c[1])) = occ0.back();
occ0.pop_back();
// remove(occurences(~c[1]), Watcher(cr, c[0]));
std::vector<Watcher> &occ1 = occurences(~c[1]);
*std::find(occ1.begin(), occ1.end(), Watcher(cr, c[0])) = occ1.back();
occ1.pop_back();
if (c.learnt()) learnts_literals -= c.size();
else clauses_literals -= c.size(); }
void Solver::removeClause(CRef cr) {
Clause& c = *cr;
detachClause(cr);
// Don't leave pointers to free'd memory!
if (locked(c)) vardata[c[0].var()].reason = Clause::UNDEF;
delete cr;
}
// Revert to the state at given level (keeping all assignment at 'level' but not beyond).
//
void Solver::cancelUntil(int level) {
if (decisionLevel() > level){
for (int c = trail.size()-1; c >= trail_lim[level]; c--){
Var x = trail[c].var();
assigns [x] = l_Undef;
insertVarOrder(x); }
qhead = trail_lim[level];
trail.resize(trail_lim[level]);
trail_lim.resize(level);
} }
//=================================================================================================
// Major methods:
Lit Solver::pickBranchLit()
{
Var next = var_Undef;
// Random decision:
if (drand() < random_var_freq && !order_heap.empty()){
next = order_heap[irand(order_heap.size())];
if (value(next) == l_Undef)
rnd_decisions++; }
// Activity based decision:
while (next == var_Undef || value(next) != l_Undef)
if (order_heap.empty()){
next = var_Undef;
break;
}else
next = order_heap.removeMin();
return next == var_Undef ? lit_Undef : Lit(next, drand() < 0.5);
}
/*_________________________________________________________________________________________________
|
| analyze : (confl : Clause*) (out_learnt : std::vector<Lit>&) (out_btlevel : int&) -> [void]
|
| Description:
| Analyze conflict and produce a reason clause.
|
| Pre-conditions:
| * 'out_learnt' is assumed to be cleared.
| * Current decision level must be greater than root level.
|
| Post-conditions:
| * 'out_learnt[0]' is the asserting literal at level 'out_btlevel'.
| * If out_learnt.size() > 1 then 'out_learnt[1]' has the greatest decision level of the
| rest of literals. There may be others from the same level though.
|
|________________________________________________________________________________________________@*/
void Solver::analyze(CRef confl, std::vector<Lit>& out_learnt, int& out_btlevel)
{
int pathC = 0;
Lit p = lit_Undef;
// Generate conflict clause:
//
out_learnt.push_back(lit_Undef); // (leave room for the asserting literal)
int index = trail.size() - 1;
do{
assert(confl != Clause::UNDEF); // (otherwise should be UIP)
Clause& c = *confl;
if (c.learnt())
claBumpActivity(c);
for (int j = (p == lit_Undef) ? 0 : 1; j < c.size(); j++){
Lit q = c[j];
if (!analyze_seen[q.var()] && level(q.var()) > 0){
varBumpActivity(q.var());
analyze_seen[q.var()] = true;
if (level(q.var()) >= decisionLevel())
pathC++;
else
out_learnt.push_back(q);
}
}
// Select next clause to look at:
while (!analyze_seen[trail[index--].var()]);
p = trail[index+1];
confl = reason(p.var());
analyze_seen[p.var()] = false;
pathC--;
}while (pathC > 0);
out_learnt[0] = ~p;
// Simplify conflict clause:
//
int i, j;
analyze_toclear = out_learnt;
unsigned int abstract_level = 0;
for (i = 1; i < out_learnt.size(); i++)
abstract_level |= abstractLevel(out_learnt[i].var()); // (maintain an abstraction of levels involved in conflict)
for (i = j = 1; i < out_learnt.size(); i++)
if (reason(out_learnt[i].var()) == Clause::UNDEF || !litRedundant(out_learnt[i], abstract_level))
out_learnt[j++] = out_learnt[i];
max_literals += out_learnt.size();
out_learnt.resize(j);
tot_literals += out_learnt.size();
// Find correct backtrack level:
//
if (out_learnt.size() == 1)
out_btlevel = 0;
else{
int max_i = 1;
// Find the first literal assigned at the next-highest level:
for (int i = 2; i < out_learnt.size(); i++)
if (level(out_learnt[i].var()) > level(out_learnt[max_i].var()))
max_i = i;
// Swap-in this literal at index 1:
Lit p = out_learnt[max_i];
out_learnt[max_i] = out_learnt[1];
out_learnt[1] = p;
out_btlevel = level(p.var());
}
for (auto const& elem : analyze_toclear) {
analyze_seen[elem.var()] = false;
}
}
// Check if 'p' can be removed. 'abstract_levels' is used to abort early if the algorithm is
// visiting literals at levels that cannot be removed later.
bool Solver::litRedundant(Lit p, unsigned int abstract_levels)
{
analyze_stack.clear(); analyze_stack.push_back(p);
int top = analyze_toclear.size();
while (analyze_stack.size() > 0){
assert(reason(analyze_stack.back().var()) != Clause::UNDEF);
Clause& c = *reason(analyze_stack.back().var()); analyze_stack.pop_back();
for (int i = 1; i < c.size(); i++){
Lit p = c[i];
if (!analyze_seen[p.var()] && level(p.var()) > 0){
if (reason(p.var()) != Clause::UNDEF && (abstractLevel(p.var()) & abstract_levels) != 0){
analyze_seen[p.var()] = true;
analyze_stack.push_back(p);
analyze_toclear.push_back(p);
}else{
for (int j = top; j < analyze_toclear.size(); j++)
analyze_seen[analyze_toclear[j].var()] = false;
analyze_toclear.resize(top);
return false;
}
}
}
}
return true;
}
void Solver::uncheckedEnqueue(Lit p, CRef from)
{
assert(value(p) == l_Undef);
assigns[p.var()] = lbool(!p.sign());
vardata[p.var()] = {from, decisionLevel()};
trail.push_back(p);
}
/*_________________________________________________________________________________________________
|
| propagate : [void] -> [Clause*]
|
| Description:
| Propagates all enqueued facts. If a conflict arises, the conflicting clause is returned,
| otherwise Clause::UNDEF.
|
| Post-conditions:
| * the propagation queue is empty, even if there was a conflict.
|________________________________________________________________________________________________@*/
CRef Solver::propagate()
{
CRef confl = Clause::UNDEF;
int num_props = 0;
while (qhead < trail.size()){
Lit p = trail[qhead++]; // 'p' is enqueued fact to propagate.
std::vector<Watcher>& ws = occurences(p);
std::vector<Watcher>::iterator i, j, end;
num_props++;
for (i = j = ws.begin(), end = ws.end(); i != end;){
// Try to avoid inspecting the clause:
Lit blocker = i->blocker;
if (value(blocker) == l_True){
*j++ = *i++; continue; }
// Make sure the false literal is data[1]:
CRef cr = i->cref;
Clause& c = *cr;
Lit false_lit = ~p;
if (c[0] == false_lit)
c[0] = c[1], c[1] = false_lit;
assert(c[1] == false_lit);
i++;
// If 0th watch is true, then clause is already satisfied.
Lit first = c[0];
Watcher w = Watcher(cr, first);
if (first != blocker && value(first) == l_True){
*j++ = w; continue; }
// Look for new watch:
for (int k = 2; k < c.size(); k++)
if (value(c[k]) != l_False){
c[1] = c[k]; c[k] = false_lit;
occurences(~c[1]).push_back(w);
goto NextClause; }
// Did not find watch -- clause is unit under assignment:
*j++ = w;
if (value(first) == l_False){
confl = cr;
qhead = trail.size();
// Copy the remaining watches:
while (i < end)
*j++ = *i++;
}else
uncheckedEnqueue(first, cr);
NextClause:;
}
ws.erase(j, end);
}
propagations += num_props;
simpDB_props -= num_props;
return confl;
}
/*_________________________________________________________________________________________________
|
| reduceDB : () -> [void]
|
| Description:
| Remove half of the learnt clauses, minus the clauses locked by the current assignment. Locked
| clauses are clauses that are reason to some assignment. Binary clauses are never removed.
|________________________________________________________________________________________________@*/
namespace {
struct reduceDB_lt {
bool operator () (CRef x, CRef y) {
return x->size() > 2 && (y->size() == 2 || x->activity() < y->activity());
}
};
}
void Solver::reduceDB()
{
int i, j;
float extra_lim = cla_inc / learnts.size(); // Remove any clause below this activity
std::sort(learnts.begin(), learnts.end(), reduceDB_lt());
// Don't delete binary or locked clauses. From the rest, delete clauses from the first half
// and clauses with activity smaller than 'extra_lim':
for (i = j = 0; i < learnts.size(); i++){
Clause& c = *learnts[i];
if (c.size() > 2 && !locked(c) && (i < learnts.size() / 2 || c.activity() < extra_lim))
removeClause(learnts[i]);
else
learnts[j++] = learnts[i];
}
learnts.resize(j);
}
/*_________________________________________________________________________________________________
|
| simplify : [void] -> [bool]
|
| Description:
| Simplify the clause database according to the current top-level assigment. Currently, the only
| thing done here is the removal of satisfied clauses, but more things can be put here.
|________________________________________________________________________________________________@*/
bool Solver::simplify()
{
assert(decisionLevel() == 0);
if (!ok || propagate() != Clause::UNDEF)
return ok = false;
if (nAssigns() == simpDB_assigns || (simpDB_props > 0))
return true;
// Remove satisfied clauses:
ClauseSatisfied pred = {assigns};
learnts.erase(std::remove_if(learnts.begin(), learnts.end(), pred),
learnts.end());
clauses.erase(std::remove_if(clauses.begin(), clauses.end(), pred),
clauses.end());
simpDB_assigns = nAssigns();
simpDB_props = clauses_literals + learnts_literals; // (shouldn't depend on stats really, but it will do for now)
return true;
}
/*_________________________________________________________________________________________________
|
| search : (nof_conflicts : int) (params : const SearchParams&) -> [lbool]
|
| Description:
| Search for a model the specified number of conflicts.
| NOTE! Use negative value for 'nof_conflicts' indicate infinity.
|
| Output:
| 'l_True' if a partial assigment that is consistent with respect to the clauseset is found. If
| all variables are decision variables, this means that the clause set is satisfiable. 'l_False'
| if the clause set is unsatisfiable. 'l_Undef' if the bound on number of conflicts is reached.
|________________________________________________________________________________________________@*/
lbool Solver::search(int nof_conflicts)
{
assert(ok);
int backtrack_level;
int conflictC = 0;
std::vector<Lit> learnt_clause;
starts++;
for (;;){
CRef confl = propagate();
if (confl != Clause::UNDEF){
// CONFLICT
conflicts++; conflictC++;
if (decisionLevel() == 0) return l_False;
learnt_clause.clear();
analyze(confl, learnt_clause, backtrack_level);
cancelUntil(backtrack_level);
if (learnt_clause.size() == 1){
uncheckedEnqueue(learnt_clause[0]);
}else{
Lit p = learnt_clause[0];
CRef cr = new Clause(learnt_clause, true);
learnts.push_back(cr);
attachClause(cr);
claBumpActivity(*cr);
uncheckedEnqueue(p, cr);
}
varDecayActivity();
claDecayActivity();
if (--learntsize_adjust_cnt == 0){
learntsize_adjust_confl *= learntsize_adjust_inc;
learntsize_adjust_cnt = (int)learntsize_adjust_confl;
max_learnts *= learntsize_inc;
}
}else{
// NO CONFLICT
if (nof_conflicts >= 0 && conflictC >= nof_conflicts){
// Reached bound on number of conflicts:
cancelUntil(0);
return l_Undef; }
// Simplify the set of problem clauses:
if (decisionLevel() == 0 && !simplify())
return l_False;
if (learnts.size()-nAssigns() >= max_learnts)
// Reduce the set of learnt clauses:
reduceDB();
// New variable decision:
decisions++;
Lit next = pickBranchLit();
if (next == lit_Undef)
// Model found:
return l_True;
// Increase decision level and enqueue 'next'
newDecisionLevel();
uncheckedEnqueue(next);
}
}
}
/*
Finite subsequences of the Luby-sequence:
0: 1
1: 1 1 2
2: 1 1 2 1 1 2 4
3: 1 1 2 1 1 2 4 1 1 2 1 1 2 4 8
...
*/
static double luby(double y, int x){
// Find the finite subsequence that contains index 'x', and the
// size of that subsequence:
int size, seq;
for (size = 1, seq = 0; size < x+1; seq++, size = 2*size+1);
while (size-1 != x){
size = (size-1)>>1;
seq--;
x = x % size;
}
return pow(y, seq);
}
lbool Solver::solve_()
{
model.clear();
if (!ok) return l_False;
solves++;
max_learnts = nClauses() * learntsize_factor;
learntsize_adjust_confl = learntsize_adjust_start_confl;
learntsize_adjust_cnt = (int)learntsize_adjust_confl;
lbool status = l_Undef;
// Search:
int curr_restarts = 0;
while (status == l_Undef){
double rest_base = luby_restart ? luby(restart_inc, curr_restarts) : pow(restart_inc, curr_restarts);
status = search(rest_base * restart_first);
curr_restarts++;
}
if (status == l_True){
// Extend & copy model:
model.resize(nVars());
for (int i = 0; i < nVars(); i++) model[i] = value(i);
}else if (status == l_False)
ok = false;
cancelUntil(0);
return status;
}
| 32.195946 | 121 | 0.580063 | mmaroti |
992897b2e656c0a418b851fb3d29a3a461ad74bb | 4,914 | hpp | C++ | include/convolution.hpp | infinitesnow/InceptionCL | e3d3a6218e551d42dfcead4f121cec294d50d85c | [
"Unlicense"
] | 2 | 2017-10-05T13:13:41.000Z | 2019-05-15T19:20:49.000Z | include/convolution.hpp | infinitesnow/InceptionCL | e3d3a6218e551d42dfcead4f121cec294d50d85c | [
"Unlicense"
] | null | null | null | include/convolution.hpp | infinitesnow/InceptionCL | e3d3a6218e551d42dfcead4f121cec294d50d85c | [
"Unlicense"
] | null | null | null | #ifndef CONVOLUTION_H
#define CONVOLUTION_H
#include <misc.hpp>
class filter{
public:
filter();
filter(Volume weights_volume, short stride, float bias) :
weights_volume{weights_volume}, stride{stride}, bias{bias} {
size = weights_volume.get_range().get(0);
depth = weights_volume.get_range().get(2);
BOOST_LOG_TRIVIAL(trace) << "Building a filter of size " << size << ", depth " << depth;
}
size_t size;
size_t depth;
short stride;
float bias;
void operator() (Volume& input, Volume& output, short f, cl::sycl::queue& q);
private:
Volume weights_volume;
};
class convolver {
public:
//
// Constructor for convolution operations
convolver(std::vector<Volume> weights_vector, short stride, float bias) :
stride{stride}, bias{bias} {
// Get number of filters
this->filter_number = weights_vector.size();
// Filter size; must be the same for all filters
this->size = weights_vector[0].get_range().get(0);
// Instantiate filters
for (short f=0;f<filter_number;f++){
BOOST_LOG_TRIVIAL(trace) << "Convolver: Instantiating filter " << f+1;
filter ft=filter(weights_vector[f],stride,bias);
this->filters_vector.push_back(ft);
};
// Compute padding
this->padding = floor(size/2);
};
// Constructor for pooling operations
convolver(short size, short stride) : size{size}, stride{stride} {
this->padding = floor(size/2);
this->is_pool=true;
};
bool is_pool=false;
bool is_soft=false;
short size;
short stride;
short padding;
float bias;
Volume* initialize_hard(Volume& v, cl::sycl::queue& q){
this->input_volume = v;
this->q= q;
this->input_width = input_volume.get_range().get(0);
this->input_height = input_volume.get_range().get(1);
this->input_depth = input_volume.get_range().get(2);
if (is_pool) filter_number=input_depth;
this->output_volume = Volume(cl::sycl::range<3>(input_width,input_height,filter_number));
pad_init();
return &this->output_volume;
};
Volume* initialize_soft(Volume* input, size_t iw, size_t ih, size_t previous_fn, cl::sycl::queue q){
this->is_soft=true;
this->q= q;
this->input = input;
this->input_width = iw;
this->input_height = ih;
this->input_depth = previous_fn;
this->output_volume = Volume(cl::sycl::range<3>(input_width,input_height,filter_number));
pad_init();
return &this->output_volume;
}
Volume input_volume;
Volume* input;
size_t input_width;
size_t input_height;
size_t input_depth;
Volume output_volume;
cl::sycl::queue q;
void convolve();
void pool();
private:
Volume padded_volume;
size_t padded_width;
size_t padded_height;
size_t padded_depth;
void pad_init();
void pad_fill();
int filter_number;
std::vector<filter> filters_vector;
};
class concatenator{
public:
int volumes_number;
std::vector<Volume*> input_volumes;
std::vector<size_t> input_depths;
std::vector<size_t> offsets;
size_t output_width;
size_t output_height;
size_t output_depth;
Volume concatenated_volume;
concatenator(std::vector<Volume*> input_volumes){
BOOST_LOG_TRIVIAL(debug) << "CONCAT: Instantiating concatenator...";
this->input_volumes=input_volumes;
this->volumes_number=input_volumes.size();
BOOST_LOG_TRIVIAL(trace) << "CONCAT: Concatenating " << volumes_number << " volumes";
this->output_width=input_volumes[0]->get_range().get(0);
this->output_height=input_volumes[0]->get_range().get(1);
// Extract depth from each volume; we'll need this to compute offsets and total depth
for (int i=0; i<volumes_number;i++) {
BOOST_LOG_TRIVIAL(trace) << "CONCAT: Volume "<<i+1<<" is of size ("
<< input_volumes[i]->get_range().get(0) << ","
<< input_volumes[i]->get_range().get(1) << ","
<< input_volumes[i]->get_range().get(2) << ")";
input_depths.push_back(input_volumes[i]->get_range().get(2));
};
this->output_depth=std::accumulate(input_depths.begin(),input_depths.end(),0);
BOOST_LOG_TRIVIAL(trace) << "CONCAT: Concatenation output is of size ("
<< output_width << ","
<< output_height << ","
<< output_depth <<")";
this->offsets=std::vector<size_t>(volumes_number);
for (int i=0; i<volumes_number; i++) {
int offset=std::accumulate(input_depths.begin(), input_depths.begin()+i, 0);
BOOST_LOG_TRIVIAL(trace) << "CONCAT: Computed " << i+1 << "^ offset: " << offset;
offsets[i]=offset;
}
this->concatenated_volume=Volume(cl::sycl::range<3>(output_width,output_height,output_depth));
};
void concatenate(cl::sycl::queue q);
};
#endif
| 31.5 | 104 | 0.640822 | infinitesnow |
992d3966629c3cc6f6a9d52228310ab79f85956c | 15,237 | cpp | C++ | source/SimplexNoise.cpp | nhaflinger/Vesuvius | 93db82977dae0080a7705fe2532258be54500860 | [
"MIT"
] | null | null | null | source/SimplexNoise.cpp | nhaflinger/Vesuvius | 93db82977dae0080a7705fe2532258be54500860 | [
"MIT"
] | null | null | null | source/SimplexNoise.cpp | nhaflinger/Vesuvius | 93db82977dae0080a7705fe2532258be54500860 | [
"MIT"
] | null | null | null | //
// SimplexNoise.cpp
//
// code attribution: Stefan Gustavson (from original Perlin noise by Ken Perlin)
//
#include "SimplexNoise.h"
#include <iostream>
using namespace Utilities;
unsigned char perm2[] = { 151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180,
151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
102,143,54, 65,25,63,161, 1,216,80,73,209,76,132,187,208, 89,18,169,200,196,
135,130,116,188,159,86,164,100,109,198,173,186, 3,64,52,217,226,250,124,123,
5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,
223,183,170,213,119,248,152, 2,44,154,163, 70,221,153,101,155,167, 43,172,9,
129,22,39,253, 19,98,108,110,79,113,224,232,178,185, 112,104,218,246,97,228,
251,34,242,193,238,210,144,12,191,179,162,241, 81,51,145,235,249,14,239,107,
49,192,214, 31,181,199,106,157,184, 84,204,176,115,121,50,45,127, 4,150,254,
138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180
};
//
// public methods
//
SimplexNoise::SimplexNoise()
{
}
SimplexNoise::~SimplexNoise()
{
}
float SimplexNoise::SimplexNoise1D(float x)
{
int i0 = floor(x);
int i1 = i0 + 1;
float x0 = x - i0;
float x1 = x0 - 1.0f;
float n0, n1;
float t0 = 1.0f - x0*x0;
// if(t0 < 0.0f) t0 = 0.0f; // this never happens for the 1D case
t0 *= t0;
n0 = t0 * t0 * grad1D(perm2[i0 & 0xff], x0);
float t1 = 1.0f - x1*x1;
// if(t1 < 0.0f) t1 = 0.0f; // this never happens for the 1D case
t1 *= t1;
n1 = t1 * t1 * grad1D(perm2[i1 & 0xff], x1);
// The maximum value of this noise is 8*(3/4)^4 = 2.53125
// A factor of 0.395 would scale to fit exactly within [-1,1], but
// we want to match PRMan's 1D noise, so we scale it down some more.
return 0.25f * (n0 + n1);
}
float SimplexNoise::SimplexNoise2D(float x, float y)
{
float n0, n1, n2; // Noise contributions from the three corners
// Skew the input space to determine which simplex cell we're in
float s = (x + y)*F2; // Hairy factor for 2D
float xs = x + s;
float ys = y + s;
int i = floor(xs);
int j = floor(ys);
float t = (float)(i + j)*G2;
float X0 = i - t; // Unskew the cell origin back to (x,y) space
float Y0 = j - t;
float x0 = x - X0; // The x,y distances from the cell origin
float y0 = y - Y0;
// For the 2D case, the simplex shape is an equilateral triangle.
// Determine which simplex we are in.
int i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords
if (x0 > y0) { i1 = 1; j1 = 0; } // lower triangle, XY order: (0,0)->(1,0)->(1,1)
else { i1 = 0; j1 = 1; } // upper triangle, YX order: (0,0)->(0,1)->(1,1)
// A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and
// a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where
// c = (3-sqrt(3))/6
float x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords
float y1 = y0 - j1 + G2;
float x2 = x0 - 1.0f + 2.0f * G2; // Offsets for last corner in (x,y) unskewed coords
float y2 = y0 - 1.0f + 2.0f * G2;
// Wrap the integer indices at 256, to avoid indexing perm2[] out of bounds
int ii = i & 0xff;
int jj = j & 0xff;
// Calculate the contribution from the three corners
float t0 = 0.5f - x0*x0 - y0*y0;
if (t0 < 0.0f) n0 = 0.0f;
else {
t0 *= t0;
n0 = t0 * t0 * grad2D(perm2[ii + perm2[jj]], x0, y0);
}
float t1 = 0.5f - x1*x1 - y1*y1;
if (t1 < 0.0f) n1 = 0.0f;
else {
t1 *= t1;
n1 = t1 * t1 * grad2D(perm2[ii + i1 + perm2[jj + j1]], x1, y1);
}
float t2 = 0.5f - x2*x2 - y2*y2;
if (t2 < 0.0f) n2 = 0.0f;
else {
t2 *= t2;
n2 = t2 * t2 * grad2D(perm2[ii + 1 + perm2[jj + 1]], x2, y2);
}
// Add contributions from each corner to get the final noise value.
// The result is scaled to return values in the interval [-1,1].
return 40.0f * (n0 + n1 + n2); // TODO: The scale factor is preliminary!
}
float SimplexNoise::SimplexNoise3D(float x, float y, float z)
{
float n0, n1, n2, n3; // Noise contributions from the four corners
// Skew the input space to determine which simplex cell we're in
float s = (x + y + z)*F3; // Very nice and simple skew factor for 3D
float xs = x + s;
float ys = y + s;
float zs = z + s;
int i = floor(xs);
int j = floor(ys);
int k = floor(zs);
float t = (float)(i + j + k)*G3;
float X0 = i - t; // Unskew the cell origin back to (x,y,z) space
float Y0 = j - t;
float Z0 = k - t;
float x0 = x - X0; // The x,y,z distances from the cell origin
float y0 = y - Y0;
float z0 = z - Z0;
// For the 3D case, the simplex shape is a slightly irregular tetrahedron.
// Determine which simplex we are in.
int i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords
int i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords
/* This code would benefit from a backport from the GLSL version! */
if (x0 >= y0) {
if (y0 >= z0)
{
i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 1; k2 = 0;
} // X Y Z order
else if (x0 >= z0) { i1 = 1; j1 = 0; k1 = 0; i2 = 1; j2 = 0; k2 = 1; } // X Z Y order
else { i1 = 0; j1 = 0; k1 = 1; i2 = 1; j2 = 0; k2 = 1; } // Z X Y order
}
else { // x0<y0
if (y0<z0) { i1 = 0; j1 = 0; k1 = 1; i2 = 0; j2 = 1; k2 = 1; } // Z Y X order
else if (x0<z0) { i1 = 0; j1 = 1; k1 = 0; i2 = 0; j2 = 1; k2 = 1; } // Y Z X order
else { i1 = 0; j1 = 1; k1 = 0; i2 = 1; j2 = 1; k2 = 0; } // Y X Z order
}
// A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z),
// a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and
// a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where
// c = 1/6.
float x1 = x0 - i1 + G3; // Offsets for second corner in (x,y,z) coords
float y1 = y0 - j1 + G3;
float z1 = z0 - k1 + G3;
float x2 = x0 - i2 + 2.0f*G3; // Offsets for third corner in (x,y,z) coords
float y2 = y0 - j2 + 2.0f*G3;
float z2 = z0 - k2 + 2.0f*G3;
float x3 = x0 - 1.0f + 3.0f*G3; // Offsets for last corner in (x,y,z) coords
float y3 = y0 - 1.0f + 3.0f*G3;
float z3 = z0 - 1.0f + 3.0f*G3;
// Wrap the integer indices at 256, to avoid indexing perm2[] out of bounds
int ii = i & 0xff;
int jj = j & 0xff;
int kk = k & 0xff;
// Calculate the contribution from the four corners
float t0 = 0.5f - x0*x0 - y0*y0 - z0*z0;
if (t0 < 0.0f) n0 = 0.0f;
else {
t0 *= t0;
n0 = t0 * t0 * grad3D(perm2[ii + perm2[jj + perm2[kk]]], x0, y0, z0);
}
float t1 = 0.5f - x1*x1 - y1*y1 - z1*z1;
if (t1 < 0.0f) n1 = 0.0f;
else {
t1 *= t1;
n1 = t1 * t1 * grad3D(perm2[ii + i1 + perm2[jj + j1 + perm2[kk + k1]]], x1, y1, z1);
}
float t2 = 0.5f - x2*x2 - y2*y2 - z2*z2;
if (t2 < 0.0f) n2 = 0.0f;
else {
t2 *= t2;
n2 = t2 * t2 * grad3D(perm2[ii + i2 + perm2[jj + j2 + perm2[kk + k2]]], x2, y2, z2);
}
float t3 = 0.5f - x3*x3 - y3*y3 - z3*z3;
if (t3<0.0f) n3 = 0.0f;
else {
t3 *= t3;
n3 = t3 * t3 * grad3D(perm2[ii + 1 + perm2[jj + 1 + perm2[kk + 1]]], x3, y3, z3);
}
// Add contributions from each corner to get the final noise value.
// The result is scaled to stay just inside [-1,1]
return 72.0f * (n0 + n1 + n2 + n3);
}
float SimplexNoise::SimplexNoise4D(float x, float y, float z, float w)
{
float n0, n1, n2, n3, n4; // Noise contributions from the five corners
// Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in
float s = (x + y + z + w) * F4; // Factor for 4D skewing
float xs = x + s;
float ys = y + s;
float zs = z + s;
float ws = w + s;
int i = floor(xs);
int j = floor(ys);
int k = floor(zs);
int l = floor(ws);
float t = (i + j + k + l) * G4; // Factor for 4D unskewing
float X0 = i - t; // Unskew the cell origin back to (x,y,z,w) space
float Y0 = j - t;
float Z0 = k - t;
float W0 = l - t;
float x0 = x - X0; // The x,y,z,w distances from the cell origin
float y0 = y - Y0;
float z0 = z - Z0;
float w0 = w - W0;
// For the 4D case, the simplex is a 4D shape I won't even try to describe.
// To find out which of the 24 possible simplices we're in, we need to
// determine the magnitude ordering of x0, y0, z0 and w0.
// The method below is a good way of finding the ordering of x,y,z,w and
// then find the correct traversal order for the simplex were in.
// First, six pair-wise comparisons are performed between each possible pair
// of the four coordinates, and the results are used to add up binary bits
// for an integer index.
int c1 = (x0 > y0) ? 32 : 0;
int c2 = (x0 > z0) ? 16 : 0;
int c3 = (y0 > z0) ? 8 : 0;
int c4 = (x0 > w0) ? 4 : 0;
int c5 = (y0 > w0) ? 2 : 0;
int c6 = (z0 > w0) ? 1 : 0;
int c = c1 + c2 + c3 + c4 + c5 + c6;
int i1, j1, k1, l1; // The integer offsets for the second simplex corner
int i2, j2, k2, l2; // The integer offsets for the third simplex corner
int i3, j3, k3, l3; // The integer offsets for the fourth simplex corner
// simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order.
// Many values of c will never occur, since e.g. x>y>z>w makes x<z, y<w and x<w
// impossible. Only the 24 indices which have non-zero entries make any sense.
// We use a thresholding to set the coordinates in turn from the largest magnitude.
// The number 3 in the "simplex" array is at the position of the largest coordinate.
i1 = simplex[c][0] >= 3 ? 1 : 0;
j1 = simplex[c][1] >= 3 ? 1 : 0;
k1 = simplex[c][2] >= 3 ? 1 : 0;
l1 = simplex[c][3] >= 3 ? 1 : 0;
// The number 2 in the "simplex" array is at the second largest coordinate.
i2 = simplex[c][0] >= 2 ? 1 : 0;
j2 = simplex[c][1] >= 2 ? 1 : 0;
k2 = simplex[c][2] >= 2 ? 1 : 0;
l2 = simplex[c][3] >= 2 ? 1 : 0;
// The number 1 in the "simplex" array is at the second smallest coordinate.
i3 = simplex[c][0] >= 1 ? 1 : 0;
j3 = simplex[c][1] >= 1 ? 1 : 0;
k3 = simplex[c][2] >= 1 ? 1 : 0;
l3 = simplex[c][3] >= 1 ? 1 : 0;
// The fifth corner has all coordinate offsets = 1, so no need to look that up.
float x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords
float y1 = y0 - j1 + G4;
float z1 = z0 - k1 + G4;
float w1 = w0 - l1 + G4;
float x2 = x0 - i2 + 2.0f*G4; // Offsets for third corner in (x,y,z,w) coords
float y2 = y0 - j2 + 2.0f*G4;
float z2 = z0 - k2 + 2.0f*G4;
float w2 = w0 - l2 + 2.0f*G4;
float x3 = x0 - i3 + 3.0f*G4; // Offsets for fourth corner in (x,y,z,w) coords
float y3 = y0 - j3 + 3.0f*G4;
float z3 = z0 - k3 + 3.0f*G4;
float w3 = w0 - l3 + 3.0f*G4;
float x4 = x0 - 1.0f + 4.0f*G4; // Offsets for last corner in (x,y,z,w) coords
float y4 = y0 - 1.0f + 4.0f*G4;
float z4 = z0 - 1.0f + 4.0f*G4;
float w4 = w0 - 1.0f + 4.0f*G4;
// Wrap the integer indices at 256, to avoid indexing perm2[] out of bounds
int ii = i & 0xff;
int jj = j & 0xff;
int kk = k & 0xff;
int ll = l & 0xff;
// Calculate the contribution from the five corners
float t0 = 0.5f - x0*x0 - y0*y0 - z0*z0 - w0*w0;
if (t0 < 0.0f) n0 = 0.0f;
else {
t0 *= t0;
n0 = t0 * t0 * grad4D(perm2[ii + perm2[jj + perm2[kk + perm2[ll]]]], x0, y0, z0, w0);
}
float t1 = 0.5f - x1*x1 - y1*y1 - z1*z1 - w1*w1;
if (t1 < 0.0f) n1 = 0.0f;
else {
t1 *= t1;
n1 = t1 * t1 * grad4D(perm2[ii + i1 + perm2[jj + j1 + perm2[kk + k1 + perm2[ll + l1]]]], x1, y1, z1, w1);
}
float t2 = 0.5f - x2*x2 - y2*y2 - z2*z2 - w2*w2;
if (t2 < 0.0f) n2 = 0.0f;
else {
t2 *= t2;
n2 = t2 * t2 * grad4D(perm2[ii + i2 + perm2[jj + j2 + perm2[kk + k2 + perm2[ll + l2]]]], x2, y2, z2, w2);
}
float t3 = 0.5f - x3*x3 - y3*y3 - z3*z3 - w3*w3;
if (t3 < 0.0f) n3 = 0.0f;
else {
t3 *= t3;
n3 = t3 * t3 * grad4D(perm2[ii + i3 + perm2[jj + j3 + perm2[kk + k3 + perm2[ll + l3]]]], x3, y3, z3, w3);
}
float t4 = 0.5f - x4*x4 - y4*y4 - z4*z4 - w4*w4;
if (t4 < 0.0f) n4 = 0.0f;
else {
t4 *= t4;
n4 = t4 * t4 * grad4D(perm2[ii + 1 + perm2[jj + 1 + perm2[kk + 1 + perm2[ll + 1]]]], x4, y4, z4, w4);
}
// Sum up and scale the result to cover the range [-1,1]
return 62.0f * (n0 + n1 + n2 + n3 + n4);
}
float SimplexNoise::turbulence(float pnt[3], float lacunarity, float gain, int octaves, float flow)
{
float amp = 1.0;
float sum = 0.0f;
float pp[3] = { pnt[0], pnt[1], pnt[2] };
for (int i = 0; i < octaves; i++)
{
sum += amp * 0.5 * (SimplexNoise4D(pp[0], pp[1], pp[2], flow) + 1.0);
amp *= gain;
pp[0] *= lacunarity; pp[1] *= lacunarity; pp[2] *= lacunarity;
}
return sum;
}
//
// private methods
//
float SimplexNoise::fade(float t)
{
return t * t * t * (t * (t * 6 - 15) + 10);
}
float SimplexNoise::grad1D(int hash, float x) {
int h = hash & 15;
float grad = 1.0 + (h & 7); // Gradient value 1.0, 2.0, ..., 8.0
if (h & 8) grad = -grad; // and a random sign for the gradient
return (grad * x); // Multiply the gradient with the distance
}
float SimplexNoise::grad2D(int hash, float x, float y) {
int h = hash & 7; // Convert low 3 bits of hash code
float u = h<4 ? x : y; // into 8 simple gradient directions,
float v = h<4 ? y : x; // and compute the dot product with (x,y).
return ((h & 1) ? -u : u) + ((h & 2) ? -2.0*v : 2.0*v);
}
float SimplexNoise::grad3D(int hash, float x, float y, float z) {
int h = hash & 15; // Convert low 4 bits of hash code into 12 simple
float u = h<8 ? x : y; // gradient directions, and compute dot product.
float v = h<4 ? y : h == 12 || h == 14 ? x : z; // Fix repeats at h = 12 to 15
return ((h & 1) ? -u : u) + ((h & 2) ? -v : v);
}
float SimplexNoise::grad4D(int hash, float x, float y, float z, float t) {
int h = hash & 31; // Convert low 5 bits of hash code into 32 simple
float u = h<24 ? x : y; // gradient directions, and compute dot product
float v = h<16 ? y : z;
float w = h<8 ? z : t;
return ((h & 1) ? -u : u) + ((h & 2) ? -v : v) + ((h & 4) ? -w : w);
}
| 36.021277 | 108 | 0.571504 | nhaflinger |
992f537c9e4a8a4c1852c34cd3cac384f0b205fa | 33,733 | hpp | C++ | src/video/defaultfont.hpp | yocto-8/yocto-8 | 4911a82f399776731d3030234c731c15593f1910 | [
"MIT"
] | 22 | 2021-06-20T21:23:29.000Z | 2022-03-26T01:46:10.000Z | src/video/defaultfont.hpp | yocto-8/yocto-8 | 4911a82f399776731d3030234c731c15593f1910 | [
"MIT"
] | 2 | 2021-09-06T12:08:32.000Z | 2021-09-06T12:23:55.000Z | src/video/defaultfont.hpp | yocto-8/yocto-8 | 4911a82f399776731d3030234c731c15593f1910 | [
"MIT"
] | 1 | 2021-11-26T08:34:59.000Z | 2021-11-26T08:34:59.000Z | #pragma once
// generated with scripts/generate_font_array.py
#include <array>
#include <cstdint>
namespace video
{
static constexpr std::array<std::uint8_t, 2048> pico8_builtin_font = {
// glyph 0
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 1
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 2
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 3
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 4
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 5
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 6
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 7
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 8
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 9
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 10
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 11
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 12
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 13
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 14
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 15
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 16
0b00000111,
0b00000111,
0b00000111,
0b00000111,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 17
0b00000000,
0b00000111,
0b00000111,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 18
0b00000000,
0b00000111,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 19
0b00000000,
0b00000101,
0b00000010,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 20
0b00000000,
0b00000101,
0b00000000,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 21
0b00000000,
0b00000101,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 22
0b00000100,
0b00000110,
0b00000111,
0b00000110,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 23
0b00000001,
0b00000011,
0b00000111,
0b00000011,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 24
0b00000111,
0b00000001,
0b00000001,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 25
0b00000000,
0b00000100,
0b00000100,
0b00000100,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 26
0b00000101,
0b00000111,
0b00000010,
0b00000111,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 27
0b00000000,
0b00000000,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 28
0b00000000,
0b00000000,
0b00000000,
0b00000001,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 29
0b00000000,
0b00000000,
0b00000000,
0b00000011,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 30
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 31
0b00000010,
0b00000101,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 32 (' ')
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 33 ('!')
0b00000010,
0b00000010,
0b00000010,
0b00000000,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 34 ('"')
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 35 ('#')
0b00000101,
0b00000111,
0b00000101,
0b00000111,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 36 ('$')
0b00000111,
0b00000011,
0b00000110,
0b00000111,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 37 ('%')
0b00000101,
0b00000100,
0b00000010,
0b00000001,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 38 ('&')
0b00000011,
0b00000011,
0b00000110,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 39 (''')
0b00000010,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 40 ('(')
0b00000010,
0b00000001,
0b00000001,
0b00000001,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 41 (')')
0b00000010,
0b00000100,
0b00000100,
0b00000100,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 42 ('*')
0b00000101,
0b00000010,
0b00000111,
0b00000010,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 43 ('+')
0b00000000,
0b00000010,
0b00000111,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 44 (',')
0b00000000,
0b00000000,
0b00000000,
0b00000010,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 45 ('-')
0b00000000,
0b00000000,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 46 ('.')
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 47 ('/')
0b00000100,
0b00000010,
0b00000010,
0b00000010,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 48 ('0')
0b00000111,
0b00000101,
0b00000101,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 49 ('1')
0b00000011,
0b00000010,
0b00000010,
0b00000010,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 50 ('2')
0b00000111,
0b00000100,
0b00000111,
0b00000001,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 51 ('3')
0b00000111,
0b00000100,
0b00000110,
0b00000100,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 52 ('4')
0b00000101,
0b00000101,
0b00000111,
0b00000100,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 53 ('5')
0b00000111,
0b00000001,
0b00000111,
0b00000100,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 54 ('6')
0b00000001,
0b00000001,
0b00000111,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 55 ('7')
0b00000111,
0b00000100,
0b00000100,
0b00000100,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 56 ('8')
0b00000111,
0b00000101,
0b00000111,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 57 ('9')
0b00000111,
0b00000101,
0b00000111,
0b00000100,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 58 (':')
0b00000000,
0b00000010,
0b00000000,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 59 (';')
0b00000000,
0b00000010,
0b00000000,
0b00000010,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 60 ('<')
0b00000100,
0b00000010,
0b00000001,
0b00000010,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 61 ('=')
0b00000000,
0b00000111,
0b00000000,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 62 ('>')
0b00000001,
0b00000010,
0b00000100,
0b00000010,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 63 ('?')
0b00000111,
0b00000100,
0b00000110,
0b00000000,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 64 ('@')
0b00000010,
0b00000101,
0b00000101,
0b00000001,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 65 ('A')
0b00000000,
0b00000110,
0b00000101,
0b00000111,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 66 ('B')
0b00000000,
0b00000011,
0b00000011,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 67 ('C')
0b00000000,
0b00000110,
0b00000001,
0b00000001,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 68 ('D')
0b00000000,
0b00000011,
0b00000101,
0b00000101,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 69 ('E')
0b00000000,
0b00000111,
0b00000011,
0b00000001,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 70 ('F')
0b00000000,
0b00000111,
0b00000011,
0b00000001,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 71 ('G')
0b00000000,
0b00000110,
0b00000001,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 72 ('H')
0b00000000,
0b00000101,
0b00000101,
0b00000111,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 73 ('I')
0b00000000,
0b00000111,
0b00000010,
0b00000010,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 74 ('J')
0b00000000,
0b00000111,
0b00000010,
0b00000010,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 75 ('K')
0b00000000,
0b00000101,
0b00000011,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 76 ('L')
0b00000000,
0b00000001,
0b00000001,
0b00000001,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 77 ('M')
0b00000000,
0b00000111,
0b00000111,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 78 ('N')
0b00000000,
0b00000011,
0b00000101,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 79 ('O')
0b00000000,
0b00000110,
0b00000101,
0b00000101,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 80 ('P')
0b00000000,
0b00000110,
0b00000101,
0b00000111,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 81 ('Q')
0b00000000,
0b00000010,
0b00000101,
0b00000011,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 82 ('R')
0b00000000,
0b00000011,
0b00000101,
0b00000011,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 83 ('S')
0b00000000,
0b00000110,
0b00000001,
0b00000100,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 84 ('T')
0b00000000,
0b00000111,
0b00000010,
0b00000010,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 85 ('U')
0b00000000,
0b00000101,
0b00000101,
0b00000101,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 86 ('V')
0b00000000,
0b00000101,
0b00000101,
0b00000111,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 87 ('W')
0b00000000,
0b00000101,
0b00000101,
0b00000111,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 88 ('X')
0b00000000,
0b00000101,
0b00000010,
0b00000010,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 89 ('Y')
0b00000000,
0b00000101,
0b00000111,
0b00000100,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 90 ('Z')
0b00000000,
0b00000111,
0b00000100,
0b00000001,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 91 ('[')
0b00000011,
0b00000001,
0b00000001,
0b00000001,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 92 ('\')
0b00000001,
0b00000010,
0b00000010,
0b00000010,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 93 (']')
0b00000110,
0b00000100,
0b00000100,
0b00000100,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 94 ('^')
0b00000010,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 95 ('_')
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 96 ('`')
0b00000010,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 97 ('a')
0b00000111,
0b00000101,
0b00000111,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 98 ('b')
0b00000111,
0b00000101,
0b00000011,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 99 ('c')
0b00000110,
0b00000001,
0b00000001,
0b00000001,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 100 ('d')
0b00000011,
0b00000101,
0b00000101,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 101 ('e')
0b00000111,
0b00000001,
0b00000011,
0b00000001,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 102 ('f')
0b00000111,
0b00000001,
0b00000011,
0b00000001,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 103 ('g')
0b00000110,
0b00000001,
0b00000001,
0b00000101,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 104 ('h')
0b00000101,
0b00000101,
0b00000111,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 105 ('i')
0b00000111,
0b00000010,
0b00000010,
0b00000010,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 106 ('j')
0b00000111,
0b00000010,
0b00000010,
0b00000010,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 107 ('k')
0b00000101,
0b00000101,
0b00000011,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 108 ('l')
0b00000001,
0b00000001,
0b00000001,
0b00000001,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 109 ('m')
0b00000111,
0b00000111,
0b00000101,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 110 ('n')
0b00000011,
0b00000101,
0b00000101,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 111 ('o')
0b00000110,
0b00000101,
0b00000101,
0b00000101,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 112 ('p')
0b00000111,
0b00000101,
0b00000111,
0b00000001,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
// glyph 113 ('q')
0b00000010,
0b00000101,
0b00000101,
0b00000011,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 114 ('r')
0b00000111,
0b00000101,
0b00000011,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 115 ('s')
0b00000110,
0b00000001,
0b00000111,
0b00000100,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 116 ('t')
0b00000111,
0b00000010,
0b00000010,
0b00000010,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 117 ('u')
0b00000101,
0b00000101,
0b00000101,
0b00000101,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 118 ('v')
0b00000101,
0b00000101,
0b00000101,
0b00000111,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 119 ('w')
0b00000101,
0b00000101,
0b00000101,
0b00000111,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 120 ('x')
0b00000101,
0b00000101,
0b00000010,
0b00000101,
0b00000101,
0b00000000,
0b00000000,
0b00000000,
// glyph 121 ('y')
0b00000101,
0b00000101,
0b00000111,
0b00000100,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 122 ('z')
0b00000111,
0b00000100,
0b00000010,
0b00000001,
0b00000111,
0b00000000,
0b00000000,
0b00000000,
// glyph 123 ('{')
0b00000110,
0b00000010,
0b00000011,
0b00000010,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 124 ('|')
0b00000010,
0b00000010,
0b00000010,
0b00000010,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 125 ('}')
0b00000011,
0b00000010,
0b00000110,
0b00000010,
0b00000011,
0b00000000,
0b00000000,
0b00000000,
// glyph 126 ('~')
0b00000000,
0b00000100,
0b00000111,
0b00000001,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 127
0b00000000,
0b00000010,
0b00000101,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 128
0b01111111,
0b01111111,
0b01111111,
0b01111111,
0b01111111,
0b00000000,
0b00000000,
0b00000000,
// glyph 129
0b01010101,
0b00101010,
0b01010101,
0b00101010,
0b01010101,
0b00000000,
0b00000000,
0b00000000,
// glyph 130
0b01000001,
0b01111111,
0b01011101,
0b01011101,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 131
0b00111110,
0b01100011,
0b01100011,
0b01110111,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 132
0b00010001,
0b01000100,
0b00010001,
0b01000100,
0b00010001,
0b00000000,
0b00000000,
0b00000000,
// glyph 133
0b00000100,
0b00111100,
0b00011100,
0b00011110,
0b00010000,
0b00000000,
0b00000000,
0b00000000,
// glyph 134
0b00011100,
0b00101110,
0b00111110,
0b00111110,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 135
0b00110110,
0b00111110,
0b00111110,
0b00011100,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 136
0b00011100,
0b00110110,
0b01110111,
0b00110110,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 137
0b00011100,
0b00011100,
0b00111110,
0b00011100,
0b00010100,
0b00000000,
0b00000000,
0b00000000,
// glyph 138
0b00011100,
0b00111110,
0b01111111,
0b00101010,
0b00111010,
0b00000000,
0b00000000,
0b00000000,
// glyph 139
0b00111110,
0b01100111,
0b01100011,
0b01100111,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 140
0b01111111,
0b01011101,
0b01111111,
0b01000001,
0b01111111,
0b00000000,
0b00000000,
0b00000000,
// glyph 141
0b00111000,
0b00001000,
0b00001000,
0b00001110,
0b00001110,
0b00000000,
0b00000000,
0b00000000,
// glyph 142
0b00111110,
0b01100011,
0b01101011,
0b01100011,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 143
0b00001000,
0b00011100,
0b00111110,
0b00011100,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 144
0b00000000,
0b00000000,
0b01010101,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 145
0b00111110,
0b01110011,
0b01100011,
0b01110011,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 146
0b00001000,
0b00011100,
0b01111111,
0b00111110,
0b00100010,
0b00000000,
0b00000000,
0b00000000,
// glyph 147
0b00111110,
0b00011100,
0b00001000,
0b00011100,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 148
0b00111110,
0b01110111,
0b01100011,
0b01100011,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 149
0b00000000,
0b00000101,
0b01010010,
0b00100000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 150
0b00000000,
0b00010001,
0b00101010,
0b01000100,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 151
0b00111110,
0b01101011,
0b01110111,
0b01101011,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 152
0b01111111,
0b00000000,
0b01111111,
0b00000000,
0b01111111,
0b00000000,
0b00000000,
0b00000000,
// glyph 153
0b01010101,
0b01010101,
0b01010101,
0b01010101,
0b01010101,
0b00000000,
0b00000000,
0b00000000,
// glyph 154
0b00001110,
0b00000100,
0b00011110,
0b00101101,
0b00100110,
0b00000000,
0b00000000,
0b00000000,
// glyph 155
0b00010001,
0b00100001,
0b00100001,
0b00100101,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 156
0b00001100,
0b00011110,
0b00100000,
0b00100000,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 157
0b00001000,
0b00011110,
0b00001000,
0b00100100,
0b00011010,
0b00000000,
0b00000000,
0b00000000,
// glyph 158
0b01001110,
0b00000100,
0b00111110,
0b01000101,
0b00100110,
0b00000000,
0b00000000,
0b00000000,
// glyph 159
0b00100010,
0b01011111,
0b00010010,
0b00010010,
0b00001010,
0b00000000,
0b00000000,
0b00000000,
// glyph 160
0b00011110,
0b00001000,
0b00111100,
0b00010001,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 161 ('¡')
0b00010000,
0b00001100,
0b00000010,
0b00001100,
0b00010000,
0b00000000,
0b00000000,
0b00000000,
// glyph 162 ('¢')
0b00100010,
0b01111010,
0b00100010,
0b00100010,
0b00010010,
0b00000000,
0b00000000,
0b00000000,
// glyph 163 ('£')
0b00011110,
0b00100000,
0b00000000,
0b00000010,
0b00111100,
0b00000000,
0b00000000,
0b00000000,
// glyph 164 ('¤')
0b00001000,
0b00111100,
0b00010000,
0b00000010,
0b00001100,
0b00000000,
0b00000000,
0b00000000,
// glyph 165 ('¥')
0b00000010,
0b00000010,
0b00000010,
0b00100010,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 166 ('¦')
0b00001000,
0b00111110,
0b00001000,
0b00001100,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 167 ('§')
0b00010010,
0b00111111,
0b00010010,
0b00000010,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 168 ('¨')
0b00111100,
0b00010000,
0b01111110,
0b00000100,
0b00111000,
0b00000000,
0b00000000,
0b00000000,
// glyph 169 ('©')
0b00000010,
0b00000111,
0b00110010,
0b00000010,
0b00110010,
0b00000000,
0b00000000,
0b00000000,
// glyph 170 ('ª')
0b00001111,
0b00000010,
0b00001110,
0b00010000,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 171 ('«')
0b00111110,
0b01000000,
0b01000000,
0b00100000,
0b00011000,
0b00000000,
0b00000000,
0b00000000,
// glyph 172 ('¬')
0b00111110,
0b00010000,
0b00001000,
0b00001000,
0b00010000,
0b00000000,
0b00000000,
0b00000000,
// glyph 173
0b00001000,
0b00111000,
0b00000100,
0b00000010,
0b00111100,
0b00000000,
0b00000000,
0b00000000,
// glyph 174 ('®')
0b00110010,
0b00000111,
0b00010010,
0b01111000,
0b00011000,
0b00000000,
0b00000000,
0b00000000,
// glyph 175 ('¯')
0b01111010,
0b01000010,
0b00000010,
0b00001010,
0b01110010,
0b00000000,
0b00000000,
0b00000000,
// glyph 176 ('°')
0b00001001,
0b00111110,
0b01001011,
0b01101101,
0b01100110,
0b00000000,
0b00000000,
0b00000000,
// glyph 177 ('±')
0b00011010,
0b00100111,
0b00100010,
0b01110011,
0b00110010,
0b00000000,
0b00000000,
0b00000000,
// glyph 178 ('²')
0b00111100,
0b01001010,
0b01001001,
0b01001001,
0b01000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 179 ('³')
0b00010010,
0b00111010,
0b00010010,
0b00111010,
0b00011010,
0b00000000,
0b00000000,
0b00000000,
// glyph 180 ('´')
0b00100011,
0b01100010,
0b00100010,
0b00100010,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 181 ('µ')
0b00001100,
0b00000000,
0b00001000,
0b00101010,
0b01001101,
0b00000000,
0b00000000,
0b00000000,
// glyph 182 ('¶')
0b00000000,
0b00001100,
0b00010010,
0b00100001,
0b01000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 183 ('·')
0b01111101,
0b01111001,
0b00010001,
0b00111101,
0b01011101,
0b00000000,
0b00000000,
0b00000000,
// glyph 184 ('¸')
0b00111110,
0b00111100,
0b00001000,
0b00011110,
0b00101110,
0b00000000,
0b00000000,
0b00000000,
// glyph 185 ('¹')
0b00000110,
0b00100100,
0b01111110,
0b00100110,
0b00010000,
0b00000000,
0b00000000,
0b00000000,
// glyph 186 ('º')
0b00100100,
0b01001110,
0b00000100,
0b01000110,
0b00111100,
0b00000000,
0b00000000,
0b00000000,
// glyph 187 ('»')
0b00001010,
0b00111100,
0b01011010,
0b01000110,
0b00110000,
0b00000000,
0b00000000,
0b00000000,
// glyph 188 ('¼')
0b00011110,
0b00000100,
0b00011110,
0b01000100,
0b00111000,
0b00000000,
0b00000000,
0b00000000,
// glyph 189 ('½')
0b00010100,
0b00111110,
0b00100100,
0b00001000,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 190 ('¾')
0b00111010,
0b01010110,
0b01010010,
0b00110000,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 191 ('¿')
0b00000100,
0b00011100,
0b00000100,
0b00011110,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 192 ('À')
0b00001000,
0b00000010,
0b00111110,
0b00100000,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 193 ('Á')
0b00100010,
0b00100010,
0b00100110,
0b00100000,
0b00011000,
0b00000000,
0b00000000,
0b00000000,
// glyph 194 ('Â')
0b00111110,
0b00011000,
0b00100100,
0b01110010,
0b00110000,
0b00000000,
0b00000000,
0b00000000,
// glyph 195 ('Ã')
0b00000100,
0b00110110,
0b00101100,
0b00100110,
0b01100100,
0b00000000,
0b00000000,
0b00000000,
// glyph 196 ('Ä')
0b00111110,
0b00011000,
0b00100100,
0b01000010,
0b00110000,
0b00000000,
0b00000000,
0b00000000,
// glyph 197 ('Å')
0b00011010,
0b00100111,
0b00100010,
0b00100011,
0b00010010,
0b00000000,
0b00000000,
0b00000000,
// glyph 198 ('Æ')
0b00001110,
0b01100100,
0b00011100,
0b00101000,
0b01111000,
0b00000000,
0b00000000,
0b00000000,
// glyph 199 ('Ç')
0b00000100,
0b00000010,
0b00000110,
0b00101011,
0b00011001,
0b00000000,
0b00000000,
0b00000000,
// glyph 200 ('È')
0b00000000,
0b00000000,
0b00001110,
0b00010000,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 201 ('É')
0b00000000,
0b00001010,
0b00011111,
0b00010010,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 202 ('Ê')
0b00000000,
0b00000100,
0b00001111,
0b00010101,
0b00001101,
0b00000000,
0b00000000,
0b00000000,
// glyph 203 ('Ë')
0b00000000,
0b00000100,
0b00001100,
0b00000110,
0b00001110,
0b00000000,
0b00000000,
0b00000000,
// glyph 204 ('Ì')
0b00111110,
0b00100000,
0b00010100,
0b00000100,
0b00000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 205 ('Í')
0b00110000,
0b00001000,
0b00001110,
0b00001000,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 206 ('Î')
0b00001000,
0b00111110,
0b00100010,
0b00100000,
0b00011000,
0b00000000,
0b00000000,
0b00000000,
// glyph 207 ('Ï')
0b00111110,
0b00001000,
0b00001000,
0b00001000,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 208 ('Ð')
0b00010000,
0b01111110,
0b00011000,
0b00010100,
0b00010010,
0b00000000,
0b00000000,
0b00000000,
// glyph 209 ('Ñ')
0b00000100,
0b00111110,
0b00100100,
0b00100010,
0b00110010,
0b00000000,
0b00000000,
0b00000000,
// glyph 210 ('Ò')
0b00001000,
0b00111110,
0b00001000,
0b00111110,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 211 ('Ó')
0b00111100,
0b00100100,
0b00100010,
0b00010000,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 212 ('Ô')
0b00000100,
0b01111100,
0b00010010,
0b00010000,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 213 ('Õ')
0b00111110,
0b00100000,
0b00100000,
0b00100000,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 214 ('Ö')
0b00100100,
0b01111110,
0b00100100,
0b00100000,
0b00010000,
0b00000000,
0b00000000,
0b00000000,
// glyph 215 ('×')
0b00000110,
0b00100000,
0b00100110,
0b00010000,
0b00001100,
0b00000000,
0b00000000,
0b00000000,
// glyph 216 ('Ø')
0b00111110,
0b00100000,
0b00010000,
0b00011000,
0b00100110,
0b00000000,
0b00000000,
0b00000000,
// glyph 217 ('Ù')
0b00000100,
0b00111110,
0b00100100,
0b00000100,
0b00111000,
0b00000000,
0b00000000,
0b00000000,
// glyph 218 ('Ú')
0b00100010,
0b00100100,
0b00100000,
0b00010000,
0b00001100,
0b00000000,
0b00000000,
0b00000000,
// glyph 219 ('Û')
0b00111110,
0b00100010,
0b00101101,
0b00110000,
0b00001100,
0b00000000,
0b00000000,
0b00000000,
// glyph 220 ('Ü')
0b00011100,
0b00001000,
0b00111110,
0b00001000,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 221 ('Ý')
0b00101010,
0b00101010,
0b00100000,
0b00010000,
0b00001100,
0b00000000,
0b00000000,
0b00000000,
// glyph 222 ('Þ')
0b00011100,
0b00000000,
0b00111110,
0b00001000,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 223 ('ß')
0b00000100,
0b00000100,
0b00011100,
0b00100100,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 224 ('à')
0b00001000,
0b00111110,
0b00001000,
0b00001000,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 225 ('á')
0b00000000,
0b00011100,
0b00000000,
0b00000000,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 226 ('â')
0b00111110,
0b00100000,
0b00101000,
0b00010000,
0b00101100,
0b00000000,
0b00000000,
0b00000000,
// glyph 227 ('ã')
0b00001000,
0b00111110,
0b00110000,
0b01011110,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 228 ('ä')
0b00100000,
0b00100000,
0b00100000,
0b00010000,
0b00001110,
0b00000000,
0b00000000,
0b00000000,
// glyph 229 ('å')
0b00010000,
0b00100100,
0b00100100,
0b01000100,
0b01000010,
0b00000000,
0b00000000,
0b00000000,
// glyph 230 ('æ')
0b00000010,
0b00011110,
0b00000010,
0b00000010,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 231 ('ç')
0b00111110,
0b00100000,
0b00100000,
0b00010000,
0b00001100,
0b00000000,
0b00000000,
0b00000000,
// glyph 232 ('è')
0b00001100,
0b00010010,
0b00100001,
0b01000000,
0b00000000,
0b00000000,
0b00000000,
0b00000000,
// glyph 233 ('é')
0b00001000,
0b00111110,
0b00001000,
0b00101010,
0b00101010,
0b00000000,
0b00000000,
0b00000000,
// glyph 234 ('ê')
0b00111110,
0b00100000,
0b00010100,
0b00001000,
0b00010000,
0b00000000,
0b00000000,
0b00000000,
// glyph 235 ('ë')
0b00111100,
0b00000000,
0b00111110,
0b00000000,
0b00011110,
0b00000000,
0b00000000,
0b00000000,
// glyph 236 ('ì')
0b00001000,
0b00000100,
0b00100100,
0b01000010,
0b01111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 237 ('í')
0b01000000,
0b00101000,
0b00010000,
0b01101000,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 238 ('î')
0b00011110,
0b00000100,
0b00011110,
0b00000100,
0b00111100,
0b00000000,
0b00000000,
0b00000000,
// glyph 239 ('ï')
0b00000100,
0b00111110,
0b00100100,
0b00000100,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 240 ('ð')
0b00011100,
0b00010000,
0b00010000,
0b00010000,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 241 ('ñ')
0b00011110,
0b00010000,
0b00011110,
0b00010000,
0b00011110,
0b00000000,
0b00000000,
0b00000000,
// glyph 242 ('ò')
0b00111110,
0b00000000,
0b00111110,
0b00100000,
0b00011000,
0b00000000,
0b00000000,
0b00000000,
// glyph 243 ('ó')
0b00100100,
0b00100100,
0b00100100,
0b00100000,
0b00010000,
0b00000000,
0b00000000,
0b00000000,
// glyph 244 ('ô')
0b00010100,
0b00010100,
0b00010100,
0b01010100,
0b00110010,
0b00000000,
0b00000000,
0b00000000,
// glyph 245 ('õ')
0b00000010,
0b00000010,
0b00100010,
0b00010010,
0b00001110,
0b00000000,
0b00000000,
0b00000000,
// glyph 246 ('ö')
0b00111110,
0b00100010,
0b00100010,
0b00100010,
0b00111110,
0b00000000,
0b00000000,
0b00000000,
// glyph 247 ('÷')
0b00111110,
0b00100010,
0b00100000,
0b00010000,
0b00001100,
0b00000000,
0b00000000,
0b00000000,
// glyph 248 ('ø')
0b00111110,
0b00100000,
0b00111100,
0b00100000,
0b00011000,
0b00000000,
0b00000000,
0b00000000,
// glyph 249 ('ù')
0b00000110,
0b00100000,
0b00100000,
0b00010000,
0b00001110,
0b00000000,
0b00000000,
0b00000000,
// glyph 250 ('ú')
0b00000000,
0b00010101,
0b00010000,
0b00001000,
0b00000110,
0b00000000,
0b00000000,
0b00000000,
// glyph 251 ('û')
0b00000000,
0b00000100,
0b00011110,
0b00010100,
0b00000100,
0b00000000,
0b00000000,
0b00000000,
// glyph 252 ('ü')
0b00000000,
0b00000000,
0b00001100,
0b00001000,
0b00011110,
0b00000000,
0b00000000,
0b00000000,
// glyph 253 ('ý')
0b00000000,
0b00011100,
0b00011000,
0b00010000,
0b00011100,
0b00000000,
0b00000000,
0b00000000,
// glyph 254 ('þ')
0b00001000,
0b00000100,
0b01100011,
0b00010000,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
// glyph 255 ('ÿ')
0b00001000,
0b00010000,
0b01100011,
0b00000100,
0b00001000,
0b00000000,
0b00000000,
0b00000000,
};
}
| 13.100194 | 70 | 0.672872 | yocto-8 |
9933502f0f7fc49e49778412dc563fe0d8b63df3 | 112 | hh | C++ | viewer/window.hh | jpanikulam/experiments | be36319a89f8baee54d7fa7618b885edb7025478 | [
"MIT"
] | 1 | 2019-04-14T11:40:28.000Z | 2019-04-14T11:40:28.000Z | viewer/window.hh | IJDykeman/experiments-1 | 22badf166b2ea441e953939463f751020b8c251b | [
"MIT"
] | 5 | 2018-04-18T13:54:29.000Z | 2019-08-22T20:04:17.000Z | viewer/window.hh | IJDykeman/experiments-1 | 22badf166b2ea441e953939463f751020b8c251b | [
"MIT"
] | 1 | 2018-12-24T03:45:47.000Z | 2018-12-24T03:45:47.000Z | #pragma once
#include "viewer/window_2d.hh"
#include "viewer/window_3d.hh"
#include "viewer/window_manager.hh"
| 18.666667 | 35 | 0.776786 | jpanikulam |
99347ce92b704738640cf9d469aa7960fe4a0206 | 179 | hpp | C++ | src/source/math/group_c/inverse_table_c.hpp | mvpwizard/DLA | 5ead2574e61e619ca3a93f1e771e3988fc144928 | [
"MIT"
] | 1 | 2019-03-24T12:07:46.000Z | 2019-03-24T12:07:46.000Z | src/source/math/group_c/inverse_table_c.hpp | nepitdev/DLA | 5ead2574e61e619ca3a93f1e771e3988fc144928 | [
"MIT"
] | 10 | 2019-03-06T20:27:39.000Z | 2019-11-27T08:28:12.000Z | src/source/math/group_c/inverse_table_c.hpp | openepit/DLA | 5ead2574e61e619ca3a93f1e771e3988fc144928 | [
"MIT"
] | null | null | null | #pragma once
#include <cstdint>
namespace dla
{
class inverse_table_c
{
private:
inverse_table_c() {}
public:
static const uint16_t L[];
};
} | 12.785714 | 34 | 0.581006 | mvpwizard |
9937d9d160e68e30228e1073a8082f3dc446ce0e | 328 | hh | C++ | payload/game/ui/SectionId.hh | stblr/mkw-sp | 0505b427ace12cd8258776930e4f2576d38a7b1f | [
"MIT"
] | 24 | 2022-01-31T00:35:29.000Z | 2022-03-20T17:03:04.000Z | payload/game/ui/SectionId.hh | stblr/mkw-sp | 0505b427ace12cd8258776930e4f2576d38a7b1f | [
"MIT"
] | 135 | 2022-01-31T09:24:26.000Z | 2022-03-31T19:49:07.000Z | payload/game/ui/SectionId.hh | stblr/mkw-sp | 0505b427ace12cd8258776930e4f2576d38a7b1f | [
"MIT"
] | 13 | 2022-01-31T04:10:22.000Z | 2022-03-26T10:06:41.000Z | #pragma once
namespace UI {
enum class SectionId {
TimeAttack = 0x1f,
GhostReplay = 0x34,
TitleFromMenu = 0x41,
TitleFromOptions = 0x43,
MiiSelectCreate = 0x45,
MiiSelectChange = 0x46,
ChangeCourse = 0x4a,
ChangeGhostData = 0x4d,
Channel = 0x7a,
Max = 0x95,
};
} // namespace UI
| 13.12 | 28 | 0.631098 | stblr |
993842e17248f74f51012f74af006d613e9d884c | 288 | hpp | C++ | include/spmdfy/Pass/Passes/PrintCFGPass.hpp | schwarzschild-radius/spmdfy | 9b5543e3446347277f15b9fe2aee3c7f8311bc78 | [
"MIT"
] | 6 | 2019-07-26T12:37:32.000Z | 2021-03-13T06:18:07.000Z | include/spmdfy/Pass/Passes/PrintCFGPass.hpp | schwarzschild-radius/spmdfy | 9b5543e3446347277f15b9fe2aee3c7f8311bc78 | [
"MIT"
] | 6 | 2019-06-19T06:04:01.000Z | 2019-08-23T11:12:31.000Z | include/spmdfy/Pass/Passes/PrintCFGPass.hpp | schwarzschild-radius/spmdfy | 9b5543e3446347277f15b9fe2aee3c7f8311bc78 | [
"MIT"
] | 1 | 2020-05-28T06:43:12.000Z | 2020-05-28T06:43:12.000Z | #ifndef PRINT_CFG_PASS_HPP
#define PRINT_CFG_PASS_HPP
#include <spmdfy/Pass/PassHandler.hpp>
namespace spmdfy {
namespace pass {
bool print_cfg_pass(SpmdTUTy&, clang::ASTContext&, Workspace&);
PASS(print_cfg_pass, print_cfg_pass_t);
} // namespace pass
} // namespace spmdfy
#endif | 16.941176 | 63 | 0.777778 | schwarzschild-radius |
993cb04616cf0637d4347b9ddc8378b59c7c5652 | 5,358 | cpp | C++ | Source/Beezer/Dialogs/InputAlert.cpp | Teknomancer/beezer | 37dc9029aff5bd42bd38d01c7059ccbea4bb95a7 | [
"BSD-3-Clause"
] | 3 | 2020-08-20T18:57:52.000Z | 2021-12-13T03:11:19.000Z | Source/Beezer/Dialogs/InputAlert.cpp | Teknomancer/beezer | 37dc9029aff5bd42bd38d01c7059ccbea4bb95a7 | [
"BSD-3-Clause"
] | 22 | 2020-02-24T21:40:44.000Z | 2021-04-18T15:07:15.000Z | Source/Beezer/Dialogs/InputAlert.cpp | Teknomancer/beezer | 37dc9029aff5bd42bd38d01c7059ccbea4bb95a7 | [
"BSD-3-Clause"
] | null | null | null | // SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2002 Ramshankar (aka Teknomancer).
// Copyright (c) 2011 Chris Roberts.
// All rights reserved.
#include "InputAlert.h"
#include "UIConstants.h"
#include <Button.h>
#include <TextControl.h>
#include <Layout.h>
#include <GroupLayout.h>
#include <cassert>
static uint32 const kButton0 = '_b0_';
static uint32 const kButton2 = '_b2_';
static uint32 const kButton1 = '_b1_';
static uint32 const kInputBox = '_ip_';
uint32 const InputAlert::kInputMessage = 'inpt';
const char * const InputAlert::kInputText = "input_field";
const char * const InputAlert::kButtonIndex = "button_index";
InputAlert::InputAlert(const char* title, const char* text, const char* initialText, bool hideTyping,
const char* button1, const char* button2, const char* button3, button_width width,
alert_type type)
: BAlert(title, "\n\n", button1, button2, button3, width, type)
{
InitInputAlert(title, text, initialText, hideTyping);
}
InputAlert::InputAlert(const char* title, const char* text, const char* initialText, bool hideTyping,
const char* button1, const char* button2, const char* button3, button_width width,
button_spacing spacing, alert_type type)
: BAlert(title, "\n\n", button1, button2, button3, width, spacing, type)
{
InitInputAlert(title, text, initialText, hideTyping);
}
void InputAlert::InitInputAlert(const char* title, const char* label, const char* initialText, bool hideTyping)
{
font_height fntHt;
be_plain_font->GetHeight(&fntHt);
float lineHeight = fntHt.ascent + fntHt.descent + fntHt.leading;
BTextView* textView = TextView();
textView->SetText(title);
// Do our own Go() type function. Nice workaround used - See MessageReceived() and GetInput()
// work in conjunction. Not too much CPU usage infact. What we do here is we erase BAlert's
// button message and assign our own. Then trap it in MessageReceived and set "m_inputText"
// then set "m_isQuitting" to true so that our GetInput() function adds the "m_inputText" to be
// returned, then quit using the PostMessage() call.
BButton* button0 = ButtonAt(0);
if (button0)
{
button0->SetMessage(new BMessage(kButton0));
m_LastButton = button0;
}
BButton* button1 = ButtonAt(1);
if (button1)
{
button1->SetMessage(new BMessage(kButton1));
m_LastButton = button1;
}
BButton* button2 = ButtonAt(2);
if (button2)
{
button2->SetMessage(new BMessage(kButton2));
m_LastButton = button2;
}
assert(m_LastButton);
m_inputBox = new BTextControl(BRect(K_MARGIN, K_MARGIN, 400, 2 * K_MARGIN + lineHeight),
"_textInput_", label, initialText, NULL, B_FOLLOW_LEFT_TOP, B_WILL_DRAW | B_NAVIGABLE);
m_inputBox->SetDivider(m_inputBox->StringWidth(label) + 10);
m_inputBox->SetModificationMessage(new BMessage(kInputBox));
m_inputBox->TextView()->HideTyping(hideTyping);
if (strlen(initialText) == 0)
m_LastButton->SetEnabled(false);
BGroupLayout* layout = dynamic_cast<BGroupLayout*>(GetLayout());
assert(layout);
BView* alertView = FindView("TAlertView");
assert(alertView);
layout->SetOrientation(B_VERTICAL);
layout->SetSpacing(K_MARGIN);
int32 const textViewIndex = layout->IndexOfView(alertView);
layout->AddView(textViewIndex + 1, m_inputBox);
ResizeTo(m_inputBox->Frame().Width(),
layout->LayoutArea().Height() + layout->ItemAt(layout->CountItems() - 1)->Layout()->LayoutArea().Height());
CenterOnScreen();
m_inputBox->MakeFocus(true);
}
BMessage InputAlert::GetInput(BWindow* window)
{
// Show and thus start the message loop.
BMessage msg(kInputMessage);
m_isQuitting = false;
Show();
// Wait till "m_isQuitting" turns true (meaning the user has finished typing and has pressed
// one of the buttons. Till then wait and update the owner window (so it Draws when alert is moved
// over its views) */
while (m_isQuitting == false)
{
if (window)
window->UpdateIfNeeded();
snooze(50000);
}
// OK time to return the things we need to
msg.AddInt32(kButtonIndex, m_buttonIndex);
msg.AddString(kInputText, m_inputText);
return msg;
}
void InputAlert::MessageReceived(BMessage* message)
{
switch (message->what)
{
case kButton0: case kButton1 : case kButton2:
{
int32 w = message->what;
m_buttonIndex = w == kButton0 ? 0 : w == kButton1 ? 1 : 2;
m_inputText = m_inputBox->Text();
m_isQuitting = true;
snooze(20000);
PostMessage(B_QUIT_REQUESTED);
break;
}
case kInputBox:
{
int32 const len = strlen(m_inputBox->Text());
if (len > 0)
m_LastButton->SetEnabled(true);
else
m_LastButton->SetEnabled(false);
break;
}
default:
BAlert::MessageReceived(message);
break;
}
}
BTextControl* InputAlert::TextControl() const
{
// Return pointer to our BTextControl incase caller needs to fiddle with it
return m_inputBox;
}
| 31.892857 | 121 | 0.650056 | Teknomancer |
993e81847162937bbdeb31644b7db843a87d977e | 1,692 | cpp | C++ | gameboy/test/src/bit_set_reset_test.cpp | ffdd270/study_emu | 985ce70e260a3a7dd5e238376a2303017f3355d9 | [
"MIT"
] | 9 | 2020-05-22T09:42:42.000Z | 2022-01-06T00:51:15.000Z | gameboy/test/src/bit_set_reset_test.cpp | ffdd270/study_emu | 985ce70e260a3a7dd5e238376a2303017f3355d9 | [
"MIT"
] | 1 | 2021-04-18T06:56:03.000Z | 2021-04-18T06:56:03.000Z | gameboy/test/src/bit_set_reset_test.cpp | ffdd270/study_emu | 985ce70e260a3a7dd5e238376a2303017f3355d9 | [
"MIT"
] | 3 | 2020-05-17T15:31:14.000Z | 2022-01-06T12:18:03.000Z | #include <catch.hpp>
#include "GameboyCPU.h"
#include "util.h"
TEST_CASE( "BIT SET RESET TEST", "[BIT SET RESET TEST]" )
{
std::shared_ptr<GameboyCPU> ptr_cpu = GameboyCPU::Create();
GameboyCPU & cpu = *(ptr_cpu);;
cpu.TestReset();
SECTION("BIT B, R")
{
SECTION("BIT 0~7, A")
{
callSetRegister8(cpu, Register8BitIndex::A, 0b10001000 );
const bool RequireResult[8] = { true, true, true, false, true, true, true, false };
for( int i = 0; i < 8; i++ )
{
REQUIRE( RequireResult[i] == bitTest(cpu, Register8BitIndex::A, i ) );
}
check_flags( cpu, false, true, false, false );
}
SECTION("BIT 0~7, (HL)")
{
callSetMemory3Step(cpu, Register8BitIndex::D, 0x3030, 0b10001000 );
const bool RequireResult[8] = { true, true, true, false, true, true, true, false };
for( int i = 0; i < 8; i++ )
{
REQUIRE( RequireResult[i] == bitTest(cpu, Register8BitIndex::MEM_HL, i ) );
}
check_flags( cpu, false, true, false, false );
}
}
SECTION("SET B, R")
{
SECTION("SET 4, A")
{
callSetRegister8(cpu, Register8BitIndex::A, 0b0 );
REQUIRE( 0b00010000 == setBitByRegister(cpu, Register8BitIndex::A, 4 ) );
}
SECTION("SET 7, (HL)")
{
callSetMemory3Step(cpu, Register8BitIndex::D, 0x2460, 0b0 );
REQUIRE( 0b10000000 == setBitByMemory( cpu, 0x2460, 7 ) );
}
}
SECTION("RES B, R")
{
SECTION("RES 6, D")
{
callSetRegister8(cpu, Register8BitIndex::D, 0xff );
REQUIRE( 0b10111111 == resetBitByRegister(cpu, Register8BitIndex::D, 6 ) );
}
SECTION("RES 0, (HL)")
{
callSetMemory3Step(cpu, Register8BitIndex::E, 0x3080, 0xff );
REQUIRE( 0b11111110 == resetBitByMemory( cpu, 0x3080, 0 ) );
}
}
} | 23.830986 | 86 | 0.625296 | ffdd270 |
994769ae6dcf1e3635b8561c4511a6fa202374c0 | 2,501 | cpp | C++ | JotaZ80/instructions/exchange.cpp | jotacoder/JotaMasterSystem | 96985770969ec5971da2999513679fdb43cd01b7 | [
"MIT"
] | 1 | 2018-05-12T11:58:22.000Z | 2018-05-12T11:58:22.000Z | JotaZ80/instructions/exchange.cpp | jotacoder/JotaMasterSystem | 96985770969ec5971da2999513679fdb43cd01b7 | [
"MIT"
] | null | null | null | JotaZ80/instructions/exchange.cpp | jotacoder/JotaMasterSystem | 96985770969ec5971da2999513679fdb43cd01b7 | [
"MIT"
] | 3 | 2017-10-13T02:41:20.000Z | 2019-02-07T20:21:26.000Z | /** JotaMasterSystem: A Master System Emulator
* Copyright (c) Juan José Chica <jotacoder@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "z80.h"
#include "utils.h"
#include <algorithm>
namespace jota
{
int Z80::ex_DE_HL()
{
std::swap(registers().DE, registers().HL);
return 4;
}
int Z80::ex_AF_AFalt()
{
std::swap(registers().AF, alternatives().AF);
return 4;
}
int Z80::exx()
{
std::swap(registers().BC, alternatives().BC);
std::swap(registers().DE, alternatives().DE);
std::swap(registers().HL, alternatives().HL);
return 4;
}
int Z80::ex_$SP$_HL()
{
uint8 top = m_memory->read(stack_pointer());
std::swap(top , registers().L);
m_memory->write(stack_pointer(), top);
uint8 top1 = m_memory->read(stack_pointer()+1);
std::swap(top1 , registers().H);
m_memory->write(stack_pointer()+1, top1);
return 19;
}
int Z80::ex_$SP$_IX()
{
uint8 top = m_memory->read(stack_pointer());
std::swap(top , indexation().IXl);
m_memory->write(stack_pointer(), top);
uint8 top1 = m_memory->read(stack_pointer()+1);
std::swap(top1 , indexation().IXh);
m_memory->write(stack_pointer()+1, top1);
return 23;
}
int Z80::ex_$SP$_IY()
{
uint8 top = m_memory->read(stack_pointer());
std::swap(top , indexation().IYl);
m_memory->write(stack_pointer(), top);
uint8 top1 = m_memory->read(stack_pointer()+1);
std::swap(top1 , indexation().IYh);
m_memory->write(stack_pointer()+1, top1);
return 23;
}
}
| 26.606383 | 80 | 0.703319 | jotacoder |
99483076009e5bb0f85eaedcbee7e59638d8be20 | 6,420 | cpp | C++ | src/optick_capi.cpp | Honeybunch/optick | 98679acad976fba57f4d4231cabd4800d4e1caa5 | [
"MIT"
] | 2 | 2020-07-21T13:22:30.000Z | 2020-07-21T21:14:42.000Z | src/optick_capi.cpp | Honeybunch/optick | 98679acad976fba57f4d4231cabd4800d4e1caa5 | [
"MIT"
] | null | null | null | src/optick_capi.cpp | Honeybunch/optick | 98679acad976fba57f4d4231cabd4800d4e1caa5 | [
"MIT"
] | null | null | null | // The MIT License(MIT)
//
// Copyright(c) 2019 Vadim Slyusarev
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files(the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions :
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include "optick_capi.h"
#if USE_OPTICK
#include "optick_core.h"
#if defined(__MACH__)
#include <stdlib.h>
#else
#include <malloc.h>
#endif
#include <string.h>
#include <stdarg.h>
OPTICK_API void OptickAPI_SetAllocator(OptickAPI_AllocateFn allocateFn, OptickAPI_DeallocateFn deallocateFn, OptickAPI_InitThreadCb initThreadCb)
{
::Optick::SetAllocator(allocateFn, deallocateFn, initThreadCb);
}
OPTICK_API void OptickAPI_RegisterThread(const char* inThreadName, uint16_t inThreadNameLength)
{
Optick::OptickString<256> threadName(inThreadName, inThreadNameLength);
Optick::RegisterThread(threadName.data);
}
OPTICK_API uint64_t OptickAPI_RegisterStorage(const char* name, uint64_t inThreadId, OptickAPI_ThreadMask inThreadMask)
{
return (uint64_t)::Optick::RegisterStorage(name, inThreadId, (Optick::ThreadMask::Type)inThreadMask);
}
OPTICK_API uint64_t OptickAPI_CreateEventDescription(const char* inFunctionName, const char* inFileName, uint32_t inFileLine, OptickAPI_Category category)
{
Optick::OptickString<128> name(inFunctionName, (uint16_t)strlen(inFunctionName));
Optick::OptickString<256> file(inFileName, (uint16_t)strlen(inFileName));
uint8_t flags = Optick::EventDescription::COPY_NAME_STRING | Optick::EventDescription::COPY_FILENAME_STRING | Optick::EventDescription::IS_CUSTOM_NAME;
return (uint64_t)::Optick::CreateDescription(name.data, file.data, inFileLine, nullptr, (Optick::Category::Type)category, flags);
}
OPTICK_API uint64_t OptickAPI_PushEvent(uint64_t inEventDescription)
{
return (uint64_t)Optick::Event::Start(*((Optick::EventDescription*)inEventDescription));
}
OPTICK_API void OptickAPI_PopEvent(uint64_t inEventData)
{
Optick::Event::Stop(*((Optick::EventData*)inEventData));
}
OPTICK_API uint64_t OptickAPI_PushGPUEvent(uint64_t inEventDescription)
{
return (uint64_t)Optick::GPUEvent::Start(*((Optick::EventDescription*)inEventDescription));
}
OPTICK_API void OptickAPI_PopGPUEvent(uint64_t inEventData)
{
Optick::GPUEvent::Stop(*((Optick::EventData*)inEventData));
}
OPTICK_API OptickAPI_GPUContext OptickAPI_SetGpuContext(OptickAPI_GPUContext context)
{
Optick::GPUContext prevCtx = Optick::SetGpuContext(Optick::GPUContext(context.cmdBuffer, (Optick::GPUQueueType)context.queue, context.node));
return {prevCtx.cmdBuffer, (OptickAPI_GPUQueueType)prevCtx.queue, prevCtx.node};
}
OPTICK_API void OptickAPI_NextFrame()
{
Optick::Event::Pop();
Optick::EndFrame();
Optick::Update();
Optick::BeginFrame();
Optick::Event::Push(*Optick::GetFrameDescription());
}
OPTICK_API void OptickAPI_StartCapture()
{
Optick::StartCapture();
}
OPTICK_API void OptickAPI_StopCapture(const char* inFileName, uint16_t inFileNameLength)
{
Optick::OptickString<256> fileName(inFileName, inFileNameLength);
Optick::StopCapture();
Optick::SaveCapture(fileName.data);
}
OPTICK_API void OptickAPI_Shutdown()
{
Optick::Shutdown();
}
OPTICK_API bool OptickAPI_SetStateChangedCallback(OptickAPI_StateCallback cb)
{
return ::Optick::SetStateChangedCallback((Optick::StateCallback)cb);
}
OPTICK_API bool OptickAPI_AttachSummary(const char* key, const char* value)
{
return ::Optick::AttachSummary(key, value);
}
OPTICK_API bool OptickAPI_AttachFile(OptickAPI_File type, const char* name, const uint8_t* data, uint32_t size)
{
return ::Optick::AttachFile((Optick::File::Type)type, name, data, size);
}
OPTICK_API void OptickAPI_GPUInitD3D12(ID3D12Device* device, ID3D12CommandQueue** cmdQueues, uint32_t numQueues)
{
::Optick::InitGpuD3D12(device, cmdQueues, numQueues);
}
OPTICK_API void OptickAPI_GPUInitVulkan(VkDevice* vkDevices, VkPhysicalDevice* vkPhysicalDevices, VkQueue* vkQueues, uint32_t* cmdQueuesFamily, uint32_t numQueues, const OptickAPI_VulkanFunctions* functions)
{
::Optick::InitGpuVulkan(vkDevices, vkPhysicalDevices, vkQueues, cmdQueuesFamily, numQueues, (const Optick::VulkanFunctions*)functions);
}
OPTICK_API void OptickAPI_GPUFlip(void* swapChain)
{
::Optick::GpuFlip(swapChain);
}
OPTICK_API void OptickAPI_GPUShutdown()
{
::Optick::ShutdownGpu();
}
OPTICK_API void OptickAPI_AttachTag_String(uint64_t inEventDescription, const char* inValue)
{
Optick::Tag::Attach(*(Optick::EventDescription*)inEventDescription, inValue);
}
OPTICK_API void OptickAPI_AttachTag_Int32(uint64_t inEventDescription, int32_t inValue)
{
Optick::Tag::Attach(*(Optick::EventDescription*)inEventDescription, inValue);
}
OPTICK_API void OptickAPI_AttachTag_Float(uint64_t inEventDescription, float inValue)
{
Optick::Tag::Attach(*(Optick::EventDescription*)inEventDescription, inValue);
}
OPTICK_API void OptickAPI_AttachTag_UInt32(uint64_t inEventDescription, uint32_t inValue)
{
Optick::Tag::Attach(*(Optick::EventDescription*)inEventDescription, inValue);
}
OPTICK_API void OptickAPI_AttachTag_UInt64(uint64_t inEventDescription, uint64_t inValue)
{
Optick::Tag::Attach(*(Optick::EventDescription*)inEventDescription, inValue);
}
OPTICK_API void OptickAPI_AttachTag_Point(uint64_t inEventDescription, float x, float y, float z)
{
Optick::Tag::Attach(*(Optick::EventDescription*)inEventDescription, x, y, z);
}
#endif //USE_OPTICK
| 36.067416 | 208 | 0.773209 | Honeybunch |
99538e566fe1bec1349450f3606ea07efc08ed62 | 289 | hpp | C++ | include/display.hpp | ImanolFotia/Gameboy-Emulator | 09f0a7a2a487b749f231d0f90f7128ba2940ff26 | [
"MIT"
] | 1 | 2020-10-01T00:22:19.000Z | 2020-10-01T00:22:19.000Z | include/display.hpp | ImanolFotia/Gameboy-Emulator | 09f0a7a2a487b749f231d0f90f7128ba2940ff26 | [
"MIT"
] | null | null | null | include/display.hpp | ImanolFotia/Gameboy-Emulator | 09f0a7a2a487b749f231d0f90f7128ba2940ff26 | [
"MIT"
] | null | null | null | #pragma once
#include "types.hpp"
#define TILE_SIZE 8
#define NUM_TILES 32
#define MAX_PIXELS 256
#define LCDC_TILE_DATA_TABLE_BEGIN 0x8000
#define LCDC_TILE_DATA_TABLE_END 0x8FFF
#define NO_LCDC_TILE_DATA_TABLE_BEGIN 0x8800
#define NO_LCDC_TILE_DATA_TABLE_END 0x97FF
class display {}; | 20.642857 | 44 | 0.84083 | ImanolFotia |
995ae1e5bd6f10f45f0788991011936c8e01578a | 1,164 | cpp | C++ | core/ilwisobjects/domain/domainhelper.cpp | ridoo/IlwisCore | 9d9837507d804a4643545a03fd40d9b4d0eaee45 | [
"Apache-2.0"
] | null | null | null | core/ilwisobjects/domain/domainhelper.cpp | ridoo/IlwisCore | 9d9837507d804a4643545a03fd40d9b4d0eaee45 | [
"Apache-2.0"
] | null | null | null | core/ilwisobjects/domain/domainhelper.cpp | ridoo/IlwisCore | 9d9837507d804a4643545a03fd40d9b4d0eaee45 | [
"Apache-2.0"
] | null | null | null | #include "kernel.h"
#include "ilwisdata.h"
#include "range.h"
#include "domain.h"
#include "itemrange.h"
#include "domainitem.h"
#include "itemdomain.h"
#include "identifieritem.h"
#include "thematicitem.h"
#include "numericdomain.h"
#include "numericrange.h"
#include "juliantime.h"
#include "domainhelper.h"
using namespace Ilwis;
DomainHelper::DomainHelper()
{
}
IDomain DomainHelper::create(Range* range) {
IDomain domain;
switch(range->valueType()){
case itINTEGER:
case itFLOAT:
case itDOUBLE:
case itTIME:
case itDATE:
case itDATETIME:
domain.set(new NumericDomain(static_cast<NumericRange *>(range)));break;
case itTHEMATICITEM:
domain.set(new ThematicDomain(range)); break;
case itNAMEDITEM:
domain.set(new NamedIdDomain(range)); break;
};
return domain;
}
IDomain DomainHelper::fromTimeInterval(const QString& beg, const QString& end, const Duration &step) {
return DomainHelper::create(new TimeInterval(beg, end, step));
}
IDomain DomainHelper::fromNumericRange(double beg, double end, double step) {
return DomainHelper::create(new NumericRange(beg, end, step));
}
| 24.25 | 102 | 0.713058 | ridoo |
99652bc4c2065d1c715ebe2f2dd84432a4d7d23d | 2,385 | hpp | C++ | include/codegen/include/GlobalNamespace/HTTPLeaderboardsModel_--c.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | 1 | 2021-11-12T09:29:31.000Z | 2021-11-12T09:29:31.000Z | include/codegen/include/GlobalNamespace/HTTPLeaderboardsModel_--c.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | null | null | null | include/codegen/include/GlobalNamespace/HTTPLeaderboardsModel_--c.hpp | Futuremappermydud/Naluluna-Modifier-Quest | bfda34370764b275d90324b3879f1a429a10a873 | [
"MIT"
] | 2 | 2021-10-03T02:14:20.000Z | 2021-11-12T09:29:36.000Z | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
#pragma pack(push, 8)
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: HTTPLeaderboardsModel
#include "GlobalNamespace/HTTPLeaderboardsModel.hpp"
// Completed includes
// Begin forward declares
// Forward declaring namespace: System
namespace System {
// Forward declaring type: Func`2<T, TResult>
template<typename T, typename TResult>
class Func_2;
}
// Forward declaring namespace: LeaderboardsDTO
namespace LeaderboardsDTO {
// Forward declaring type: LeaderboardEntryDTO
class LeaderboardEntryDTO;
}
// Completed forward declares
// Type namespace:
namespace GlobalNamespace {
// Autogenerated type: HTTPLeaderboardsModel/<>c
class HTTPLeaderboardsModel::$$c : public ::Il2CppObject {
public:
// Get static field: static public readonly HTTPLeaderboardsModel/<>c <>9
static GlobalNamespace::HTTPLeaderboardsModel::$$c* _get_$$9();
// Set static field: static public readonly HTTPLeaderboardsModel/<>c <>9
static void _set_$$9(GlobalNamespace::HTTPLeaderboardsModel::$$c* value);
// Get static field: static public System.Func`2<LeaderboardsDTO.LeaderboardEntryDTO,System.String> <>9__12_0
static System::Func_2<LeaderboardsDTO::LeaderboardEntryDTO*, ::Il2CppString*>* _get_$$9__12_0();
// Set static field: static public System.Func`2<LeaderboardsDTO.LeaderboardEntryDTO,System.String> <>9__12_0
static void _set_$$9__12_0(System::Func_2<LeaderboardsDTO::LeaderboardEntryDTO*, ::Il2CppString*>* value);
// static private System.Void .cctor()
// Offset: 0xB428A0
static void _cctor();
// System.String <GetLeaderboardEntriesAsync>b__12_0(LeaderboardsDTO.LeaderboardEntryDTO x)
// Offset: 0xB42910
::Il2CppString* $GetLeaderboardEntriesAsync$b__12_0(LeaderboardsDTO::LeaderboardEntryDTO* x);
// public System.Void .ctor()
// Offset: 0xB42908
// Implemented from: System.Object
// Base method: System.Void Object::.ctor()
static HTTPLeaderboardsModel::$$c* New_ctor();
}; // HTTPLeaderboardsModel/<>c
}
#include "extern/beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
DEFINE_IL2CPP_ARG_TYPE(GlobalNamespace::HTTPLeaderboardsModel::$$c*, "", "HTTPLeaderboardsModel/<>c");
#pragma pack(pop)
| 45 | 113 | 0.72956 | Futuremappermydud |
9965341215d1a466617d5fa49a1f9cc9cd8e75e7 | 562 | cpp | C++ | implementation/others/qsort.cpp | Layomiiety/Algorithmic-thinking | fc280717db051a26d19a583f3206402215d05c0a | [
"CC0-1.0"
] | null | null | null | implementation/others/qsort.cpp | Layomiiety/Algorithmic-thinking | fc280717db051a26d19a583f3206402215d05c0a | [
"CC0-1.0"
] | null | null | null | implementation/others/qsort.cpp | Layomiiety/Algorithmic-thinking | fc280717db051a26d19a583f3206402215d05c0a | [
"CC0-1.0"
] | null | null | null | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define arr array
int n,l,r,a[100010];
void qsort(int l,int r){
int mid=a[(l+r)/2];
int i=l,j=r;
do{
while(a[i]<mid) i++;
while(a[j]>mid) j--;
if (i<=j) {
swap(a[i],a[j]);
i++;
j--;
}
}while(i<=j);
if (l<j) qsort(l,j);
if (i<r) qsort(i,r);
}
int main(){
scanf("%d",&n);
for (int i=0;i<n;i++) scanf("%d",&a[i]);
qsort(0,n-1);
for (int i=0;i<n;i++) printf("%d ",a[i]);
return 0;
}
| 20.071429 | 45 | 0.435943 | Layomiiety |
9968a54a493b177695afd96d9d729a7db67ccc5b | 282 | cpp | C++ | test/common.cpp | andrew-murray/cpp-metrics | 9d126227b825c561fab5db79b01f267bd0ea9412 | [
"Apache-2.0"
] | 1 | 2018-07-31T00:49:23.000Z | 2018-07-31T00:49:23.000Z | test/common.cpp | andrew-murray/cpp-metrics | 9d126227b825c561fab5db79b01f267bd0ea9412 | [
"Apache-2.0"
] | null | null | null | test/common.cpp | andrew-murray/cpp-metrics | 9d126227b825c561fab5db79b01f267bd0ea9412 | [
"Apache-2.0"
] | null | null | null | #include "common.hpp"
namespace mock {
static std::atomic<int> g_time;
mock::clock::time_point clock::now() {
return time_point(duration((int)g_time));
}
void clock::set_time(const int& val) {
g_time = val;
}
int clock::time(){
return (int)g_time;
}
} | 15.666667 | 47 | 0.62766 | andrew-murray |
99752e42c7d604d633fc229f0237347974c4984e | 47 | hpp | C++ | src/boost_math_tools_polynomial_gcd.hpp | miathedev/BoostForArduino | 919621dcd0c157094bed4df752b583ba6ea6409e | [
"BSL-1.0"
] | 10 | 2018-03-17T00:58:42.000Z | 2021-07-06T02:48:49.000Z | src/boost_math_tools_polynomial_gcd.hpp | miathedev/BoostForArduino | 919621dcd0c157094bed4df752b583ba6ea6409e | [
"BSL-1.0"
] | 2 | 2021-03-26T15:17:35.000Z | 2021-05-20T23:55:08.000Z | src/boost_math_tools_polynomial_gcd.hpp | miathedev/BoostForArduino | 919621dcd0c157094bed4df752b583ba6ea6409e | [
"BSL-1.0"
] | 4 | 2019-05-28T21:06:37.000Z | 2021-07-06T03:06:52.000Z | #include <boost/math/tools/polynomial_gcd.hpp>
| 23.5 | 46 | 0.808511 | miathedev |
9979e4f09cf7b3e90e287d719b6b3af7ec937e9f | 24,053 | cpp | C++ | Source/RobCoG/Utilities/HandInformationParser.cpp | yukilikespie/RobCoG_FleX-4.16 | a6d1e8c0abb8ac1e36c5967cb886de8c154b2948 | [
"BSD-3-Clause"
] | null | null | null | Source/RobCoG/Utilities/HandInformationParser.cpp | yukilikespie/RobCoG_FleX-4.16 | a6d1e8c0abb8ac1e36c5967cb886de8c154b2948 | [
"BSD-3-Clause"
] | null | null | null | Source/RobCoG/Utilities/HandInformationParser.cpp | yukilikespie/RobCoG_FleX-4.16 | a6d1e8c0abb8ac1e36c5967cb886de8c154b2948 | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2017, Institute for Artificial Intelligence - University of Bremen
#include "HandInformationParser.h"
#include "Paths.h"
#include "ConfigCacheIni.h"
HandInformationParser::HandInformationParser()
{
ConfigFileHandler = MakeShareable(new FConfigCacheIni(EConfigCacheType::DiskBacked));
}
HandInformationParser::~HandInformationParser()
{
}
void HandInformationParser::GetHandInformationForGraspType(FHandOrientation & InitialHandOrientation, FHandOrientation & ClosedHandOrietation, FHandVelocity & HandVelocity, const FString ConfigPath)
{
ReadGraspTypeIni(InitialHandOrientation, ClosedHandOrietation, HandVelocity, ConfigPath);
}
void HandInformationParser::SetHandInformationForGraspType(const FHandOrientation & InitialHandOrientation, const FHandOrientation & ClosedHandOrietation, const FHandVelocity & HandVelocity, const FString ConfigPath)
{
WriteGraspTypeIni(InitialHandOrientation, ClosedHandOrietation, HandVelocity, ConfigPath);
}
void HandInformationParser::WriteGraspTypeIni(const FHandOrientation & InitialHandOrientation, const FHandOrientation & ClosedHandOrientation, const FHandVelocity & HandVelocity, const FString ConfigPath)
{
if (!ConfigFileHandler.IsValid()) return;
UE_LOG(LogTemp, Warning, TEXT("ConfigPath: %s"), *ConfigPath);
// Write Initial Hand Orientation into ini file
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("ThumbDistalOrientation"), InitialHandOrientation.ThumbOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("ThumbItermediateOrientation"), InitialHandOrientation.ThumbOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("ThumbProximalOrientation"), InitialHandOrientation.ThumbOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("ThumbMetacarpalOrientation"), InitialHandOrientation.ThumbOrientation.MetacarpalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("IndexDistalOrientation"), InitialHandOrientation.IndexOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("IndexItermediateOrientation"), InitialHandOrientation.IndexOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("IndexProximalOrientation"), InitialHandOrientation.IndexOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("IndexMetacarpalOrientation"), InitialHandOrientation.IndexOrientation.MetacarpalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("MiddleDistalOrientation"), InitialHandOrientation.MiddleOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("MiddleItermediateOrientation"), InitialHandOrientation.MiddleOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("MiddleProximalOrientation"), InitialHandOrientation.MiddleOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("MiddleMetacarpalOrientation"), InitialHandOrientation.MiddleOrientation.MetacarpalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("RingDistalOrientation"), InitialHandOrientation.RingOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("RingItermediateOrientation"), InitialHandOrientation.RingOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("RingProximalOrientation"), InitialHandOrientation.RingOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("RingMetacarpalOrientation"), InitialHandOrientation.RingOrientation.MetacarpalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("PinkyDistalOrientation"), InitialHandOrientation.PinkyOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("PinkyItermediateOrientation"), InitialHandOrientation.PinkyOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("PinkyProximalOrientation"), InitialHandOrientation.PinkyOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*InitOrientationSection, TEXT("PinkyMetacarpalOrientation"), InitialHandOrientation.PinkyOrientation.MetacarpalOrientation.Orientation, ConfigPath);
//Write Closed Hand Orientation into ini file
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("ThumbDistalOrientation"), ClosedHandOrientation.ThumbOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("ThumbItermediateOrientation"), ClosedHandOrientation.ThumbOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("ThumbProximalOrientation"), ClosedHandOrientation.ThumbOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("ThumbMetacarpalOrientation"), ClosedHandOrientation.ThumbOrientation.MetacarpalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("IndexDistalOrientation"), ClosedHandOrientation.IndexOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("IndexItermediateOrientation"), ClosedHandOrientation.IndexOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("IndexProximalOrientation"), ClosedHandOrientation.IndexOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("IndexMetacarpalOrientation"), ClosedHandOrientation.IndexOrientation.MetacarpalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("MiddleDistalOrientation"), ClosedHandOrientation.MiddleOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("MiddleItermediateOrientation"), ClosedHandOrientation.MiddleOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("MiddleProximalOrientation"), ClosedHandOrientation.MiddleOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("MiddleMetacarpalOrientation"), ClosedHandOrientation.MiddleOrientation.MetacarpalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("RingDistalOrientation"), ClosedHandOrientation.RingOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("RingItermediateOrientation"), ClosedHandOrientation.RingOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("RingProximalOrientation"), ClosedHandOrientation.RingOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("RingMetacarpalOrientation"), ClosedHandOrientation.RingOrientation.MetacarpalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("PinkyDistalOrientation"), ClosedHandOrientation.PinkyOrientation.DistalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("PinkyItermediateOrientation"), ClosedHandOrientation.PinkyOrientation.IntermediateOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("PinkyProximalOrientation"), ClosedHandOrientation.PinkyOrientation.ProximalOrientation.Orientation, ConfigPath);
ConfigFileHandler->SetRotator(*ClosedOrientationSection, TEXT("PinkyMetacarpalOrientation"), ClosedHandOrientation.PinkyOrientation.MetacarpalOrientation.Orientation, ConfigPath);
//Write Velocity into ini file
ConfigFileHandler->SetVector(*VelocitySection, TEXT("ThumbDistalVelocity"), HandVelocity.ThumbVelocity.DistalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("ThumbItermediateVelocity"), HandVelocity.ThumbVelocity.IntermediateVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("ThumbProximalVelocity"), HandVelocity.ThumbVelocity.ProximalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("ThumbMetacarpalVelocity"), HandVelocity.ThumbVelocity.MetacarpalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("IndexDistalVelocity"), HandVelocity.IndexVelocity.DistalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("IndexItermediateVelocity"), HandVelocity.IndexVelocity.IntermediateVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("IndexProximalVelocity"), HandVelocity.IndexVelocity.ProximalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("IndexMetacarpalVelocity"), HandVelocity.IndexVelocity.MetacarpalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("MiddleDistalVelocity"), HandVelocity.MiddleVelocity.DistalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("MiddleItermediateVelocity"), HandVelocity.MiddleVelocity.IntermediateVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("MiddleProximalVelocity"), HandVelocity.MiddleVelocity.ProximalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("MiddleMetacarpalVelocity"), HandVelocity.MiddleVelocity.MetacarpalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("RingDistalVelocity"), HandVelocity.RingVelocity.DistalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("RingItermediateVelocity"), HandVelocity.RingVelocity.IntermediateVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("RingProximalVelocity"), HandVelocity.RingVelocity.ProximalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("RingMetacarpalVelocity"), HandVelocity.RingVelocity.MetacarpalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("PinkyDistalVelocity"), HandVelocity.PinkyVelocity.DistalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("PinkyItermediateVelocity"), HandVelocity.PinkyVelocity.IntermediateVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("PinkyProximalVelocity"), HandVelocity.PinkyVelocity.ProximalVelocity.Velocity, ConfigPath);
ConfigFileHandler->SetVector(*VelocitySection, TEXT("PinkyMetacarpalVelocity"), HandVelocity.PinkyVelocity.MetacarpalVelocity.Velocity, ConfigPath);
ConfigFileHandler->Flush(true, ConfigPath);
}
void HandInformationParser::ReadGraspTypeIni(FHandOrientation & InitialHandOrientation, FHandOrientation & ClosedHandOrientation, FHandVelocity & HandVelocity, const FString ConfigPath)
{
if (!ConfigFileHandler.IsValid()) return;
// InitOrientation
bool bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("ThumbDistalOrientation"), InitialHandOrientation.ThumbOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("ThumbItermediateOrientation"), InitialHandOrientation.ThumbOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("ThumbProximalOrientation"), InitialHandOrientation.ThumbOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("ThumbMetacarpalOrientation"), InitialHandOrientation.ThumbOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("IndexDistalOrientation"), InitialHandOrientation.IndexOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("IndexItermediateOrientation"), InitialHandOrientation.IndexOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("IndexProximalOrientation"), InitialHandOrientation.IndexOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("IndexMetacarpalOrientation"), InitialHandOrientation.IndexOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("MiddleDistalOrientation"), InitialHandOrientation.MiddleOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("MiddleItermediateOrientation"), InitialHandOrientation.MiddleOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("MiddleProximalOrientation"), InitialHandOrientation.MiddleOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("MiddleMetacarpalOrientation"), InitialHandOrientation.MiddleOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("RingDistalOrientation"), InitialHandOrientation.RingOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("RingItermediateOrientation"), InitialHandOrientation.RingOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("RingProximalOrientation"), InitialHandOrientation.RingOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("RingMetacarpalOrientation"), InitialHandOrientation.RingOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("PinkyDistalOrientation"), InitialHandOrientation.PinkyOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("PinkyItermediateOrientation"), InitialHandOrientation.PinkyOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("PinkyProximalOrientation"), InitialHandOrientation.PinkyOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*InitOrientationSection, TEXT("PinkyMetacarpalOrientation"), InitialHandOrientation.PinkyOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
//ClosedOrientation
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("ThumbDistalOrientation"), ClosedHandOrientation.ThumbOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("ThumbItermediateOrientation"), ClosedHandOrientation.ThumbOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("ThumbProximalOrientation"), ClosedHandOrientation.ThumbOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("ThumbMetacarpalOrientation"), ClosedHandOrientation.ThumbOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("IndexDistalOrientation"), ClosedHandOrientation.IndexOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("IndexItermediateOrientation"), ClosedHandOrientation.IndexOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("IndexProximalOrientation"), ClosedHandOrientation.IndexOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("IndexMetacarpalOrientation"), ClosedHandOrientation.IndexOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("MiddleDistalOrientation"), ClosedHandOrientation.MiddleOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("MiddleItermediateOrientation"), ClosedHandOrientation.MiddleOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("MiddleProximalOrientation"), ClosedHandOrientation.MiddleOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("MiddleMetacarpalOrientation"), ClosedHandOrientation.MiddleOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("RingDistalOrientation"), ClosedHandOrientation.RingOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("RingItermediateOrientation"), ClosedHandOrientation.RingOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("RingProximalOrientation"), ClosedHandOrientation.RingOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("RingMetacarpalOrientation"), ClosedHandOrientation.RingOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("PinkyDistalOrientation"), ClosedHandOrientation.PinkyOrientation.DistalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("PinkyItermediateOrientation"), ClosedHandOrientation.PinkyOrientation.IntermediateOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("PinkyProximalOrientation"), ClosedHandOrientation.PinkyOrientation.ProximalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetRotator(*ClosedOrientationSection, TEXT("PinkyMetacarpalOrientation"), ClosedHandOrientation.PinkyOrientation.MetacarpalOrientation.Orientation, ConfigPath);
if (!bSuccess) return;
//Velocity
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("ThumbDistalVelocity"), HandVelocity.ThumbVelocity.DistalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("ThumbItermediateVelocity"), HandVelocity.ThumbVelocity.IntermediateVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("ThumbProximalVelocity"), HandVelocity.ThumbVelocity.ProximalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("ThumbMetacarpalVelocity"), HandVelocity.ThumbVelocity.MetacarpalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("IndexDistalVelocity"), HandVelocity.IndexVelocity.DistalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("IndexItermediateVelocity"), HandVelocity.IndexVelocity.IntermediateVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("IndexProximalVelocity"), HandVelocity.IndexVelocity.ProximalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("IndexMetacarpalVelocity"), HandVelocity.IndexVelocity.MetacarpalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("MiddleDistalVelocity"), HandVelocity.MiddleVelocity.DistalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("MiddleItermediateVelocity"), HandVelocity.MiddleVelocity.IntermediateVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("MiddleProximalVelocity"), HandVelocity.MiddleVelocity.ProximalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("MiddleMetacarpalVelocity"), HandVelocity.MiddleVelocity.MetacarpalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("RingDistalVelocity"), HandVelocity.RingVelocity.DistalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("RingItermediateVelocity"), HandVelocity.RingVelocity.IntermediateVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("RingProximalVelocity"), HandVelocity.RingVelocity.ProximalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("RingMetacarpalVelocity"), HandVelocity.RingVelocity.MetacarpalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("PinkyDistalVelocity"), HandVelocity.PinkyVelocity.DistalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("PinkyItermediateVelocity"), HandVelocity.PinkyVelocity.IntermediateVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("PinkyProximalVelocity"), HandVelocity.PinkyVelocity.ProximalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
bSuccess = ConfigFileHandler->GetVector(*VelocitySection, TEXT("PinkyMetacarpalVelocity"), HandVelocity.PinkyVelocity.MetacarpalVelocity.Velocity, ConfigPath);
if (!bSuccess) return;
} | 94.32549 | 216 | 0.85374 | yukilikespie |
997b1c96d92b354ce0da6b7010c16a170937ab6d | 1,664 | cpp | C++ | Arrays Questions/20 Array questions.cpp | Benson1198/CPP | b12494becadc9431303cfdb51c5134dc68c679c3 | [
"MIT"
] | null | null | null | Arrays Questions/20 Array questions.cpp | Benson1198/CPP | b12494becadc9431303cfdb51c5134dc68c679c3 | [
"MIT"
] | null | null | null | Arrays Questions/20 Array questions.cpp | Benson1198/CPP | b12494becadc9431303cfdb51c5134dc68c679c3 | [
"MIT"
] | 1 | 2020-10-06T09:17:33.000Z | 2020-10-06T09:17:33.000Z | // How do you find the missing number in a given integer array of 1 to 100? (solution)
// How do you find the duplicate number on a given integer array? (solution)
// How do you find the largest and smallest number in an unsorted integer array? (solution)
// How do you find all pairs of an integer array whose sum is equal to a given number? (solution)
// How do you find duplicate numbers in an array if it contains multiple duplicates? (solution)
// How to remove duplicates from a given array in Java? (solution)
// How do you search a target value in a rotated array? (solution)
// Given an unsorted array of integers, find the length of the longest consecutive elements sequence? (solution)
// How is an integer array sorted in place using the quicksort algorithm? (solution)
// How do you remove duplicates from an array in place? (solution)
// How do you reverse an array in place in Java? (solution)
// How are duplicates removed from an array without using any library? (solution)
// How to convert a byte array to String? (solution)
// What is the difference between an array and a linked list? (answer)
// How do you perform a binary search in a given array? (solution)
// How to find a median of two sorts arrays? (solution)
// How to rotate an array left and right by a given number K? (solution)
// How do you find duplicates from an unsorted array? (solution)
// Given an array of integers sorted in ascending order, find the starting and ending position of a given value? (solution)
// Given an integer array, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum? (solution) | 42.666667 | 145 | 0.748798 | Benson1198 |
997d423ab9efb82afaaae0ef779bebfb4cdbd0ae | 547 | cpp | C++ | Mathematical Algorithms/Extended Euclidean Algorithm.cpp | praharshjain/Algorithms | ea63a2654453f129076ee7d0041f6af3046e4dfc | [
"MIT"
] | null | null | null | Mathematical Algorithms/Extended Euclidean Algorithm.cpp | praharshjain/Algorithms | ea63a2654453f129076ee7d0041f6af3046e4dfc | [
"MIT"
] | null | null | null | Mathematical Algorithms/Extended Euclidean Algorithm.cpp | praharshjain/Algorithms | ea63a2654453f129076ee7d0041f6af3046e4dfc | [
"MIT"
] | 2 | 2020-11-28T05:59:16.000Z | 2021-03-26T14:10:58.000Z | #include <iostream>
using namespace std;
//Extended Euclidean Algorithm
long long gcdExtended(long long a, long long b, long long *x, long long *y)
{
// Base Case
if (a == 0)
{
*x = 0;
*y = 1;
return b;
}
long long x1, y1, gcd = gcdExtended(b % a, a, &x1, &y1);
*x = y1 - (b / a) * x1;
*y = x1;
return gcd;
}
int main()
{
long long x, y, a = 35, b = 15, g = gcdExtended(a, b, &x, &y);
cout << "gcd(" << a << ", " << b << ") = " << g << ", x = " << x << ", y = " << y;
return 0;
} | 23.782609 | 86 | 0.453382 | praharshjain |
5f58e49027b4e2d3bd8514243b9c1f0865b6ea63 | 1,080 | cpp | C++ | src/auto.cpp | Discobots-1104A/2021-2022-branch-sample | 0941e1e52d4d129fe0c91c8fe376589e03289e00 | [
"MIT"
] | 1 | 2021-09-25T23:51:15.000Z | 2021-09-25T23:51:15.000Z | src/auto.cpp | Discobots-1104A/2021-2022-branch-sample | 0941e1e52d4d129fe0c91c8fe376589e03289e00 | [
"MIT"
] | 4 | 2021-11-13T23:49:49.000Z | 2022-01-22T21:26:28.000Z | src/auto.cpp | Discobots-1104A/2021-2022-kidney-failure | 0941e1e52d4d129fe0c91c8fe376589e03289e00 | [
"MIT"
] | null | null | null | //* auto code
//* headers
#include "autos/autonomous.h"
#include "gui/guiGlobals.h"
#include "main.h"
namespace Autonomous {
e_autonomousSelection autonomousSelection = e_autonomousSelection::E_NONE;
int autonomousSelectionConfirmation = 0;
} // namespace Autonomous
//* auto callback
void autonomous() {
GUI::autonomousSelectedTextBuffer =
"Running auto: " + GUI::autonomousSelectedText;
lv_label_set_text(GUI::autonomousSelectedLabel,
GUI::autonomousSelectedTextBuffer.c_str());
lv_obj_align(GUI::autonomousSelectedLabel, NULL, LV_ALIGN_IN_TOP_MID, 0, 200);
switch (Autonomous::autonomousSelection) {
case Autonomous::e_autonomousSelection::E_LIVE:
Autonomous::liveAuto();
break;
case Autonomous::e_autonomousSelection::E_SKILLS:
Autonomous::skillsAuto();
break;
case Autonomous::e_autonomousSelection::E_TEST:
Autonomous::testAuto();
break;
case Autonomous::e_autonomousSelection::E_NONE:
//TODO: properly handle this error
std::cout << "[AUTO] something has gone terribly wrong\n";
break;
}
} | 30 | 80 | 0.734259 | Discobots-1104A |
5f58f6319f9f91408aff850f04a7c1d7b4791231 | 320 | cc | C++ | uvpp/src/check.cc | Qard/river.js | 62cebbfa61cef96d241487e8c35d46211d0a68b8 | [
"MIT"
] | 3 | 2018-04-06T08:58:55.000Z | 2018-04-15T20:48:43.000Z | uvpp/src/check.cc | Qard/river.js | 62cebbfa61cef96d241487e8c35d46211d0a68b8 | [
"MIT"
] | 6 | 2018-04-13T04:50:08.000Z | 2018-04-13T05:06:22.000Z | uvpp/src/check.cc | Qard/river.js | 62cebbfa61cef96d241487e8c35d46211d0a68b8 | [
"MIT"
] | null | null | null | #include "check.hh"
Check::Check(uv_loop_t* loop) {
uv_check_init(loop, this);
}
Check::~Check() {
if (!this->is_closing()) {
this->close([](uv_handle_t* handle){});
}
}
int Check::start(uv_check_cb callback) {
return uv_check_start(this, callback);
}
int Check::stop() {
return uv_check_stop(this);
}
| 16 | 43 | 0.653125 | Qard |
5f5a15fcbeb04302fd820478cdb9cac9f4d5b45f | 320 | cpp | C++ | competitive_programming/programming_contests/uri/our_days_are_never_coming_back.cpp | LeandroTk/Algorithms | 569ed68eba3eeff902f8078992099c28ce4d7cd6 | [
"MIT"
] | 205 | 2018-12-01T17:49:49.000Z | 2021-12-22T07:02:27.000Z | competitive_programming/programming_contests/uri/our_days_are_never_coming_back.cpp | LeandroTk/Algorithms | 569ed68eba3eeff902f8078992099c28ce4d7cd6 | [
"MIT"
] | 2 | 2020-01-01T16:34:29.000Z | 2020-04-26T19:11:13.000Z | competitive_programming/programming_contests/uri/our_days_are_never_coming_back.cpp | LeandroTk/Algorithms | 569ed68eba3eeff902f8078992099c28ce4d7cd6 | [
"MIT"
] | 50 | 2018-11-28T20:51:36.000Z | 2021-11-29T04:08:25.000Z | // https://www.urionlinejudge.com.br/judge/en/problems/view/1864
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
string text = "LIFE IS NOT A PROBLEM TO BE SOLVED";
string final = "";
for (int i = 0; i < n; i++) final += text[i];
cout << final << endl;
return 0;
} | 15.238095 | 64 | 0.621875 | LeandroTk |
5f6274eec54512c22e45e3814eb428855068dbd3 | 2,392 | hpp | C++ | include/Agate/Util/ModelData.hpp | dfnzhc/CGT | eab79c203c8ce24bfa738c593bd2665bed387d63 | [
"MIT"
] | null | null | null | include/Agate/Util/ModelData.hpp | dfnzhc/CGT | eab79c203c8ce24bfa738c593bd2665bed387d63 | [
"MIT"
] | null | null | null | include/Agate/Util/ModelData.hpp | dfnzhc/CGT | eab79c203c8ce24bfa738c593bd2665bed387d63 | [
"MIT"
] | null | null | null | //
// Created by 秋鱼 on 2022/4/28.
//
#pragma once
#include <Agate/Shader/Matrix.h>
#include <Agate/Shader/CudaBufferView.hpp>
#include <optix_types.h>
#include <Agate/Shader/Material.hpp>
#include "AABB.hpp"
#include "Camera.hpp"
namespace Agate {
struct MeshData
{
std::string name;
Matrix4x4 transform;
std::vector<GenericBufferView> indices;
std::vector<BufferView<float3>> positions;
std::vector<BufferView<float3>> normals;
std::vector<BufferView<float2>> texcoords;
std::vector<int32_t> material_idx;
OptixTraversableHandle gas_handle = 0;
CUdeviceptr d_gas_output = 0;
AABB object_aabb;
AABB world_aabb;
};
class ModelData
{
public:
ModelData() = default;
~ModelData();
void finalize();
void cleanup();
void addMesh(const std::vector<float3>& vertices, const std::vector<uint3>& indices);
void addMeshFromGLTF(std::string_view filename);
void addCamera(const Camera& camera) { cameras_.push_back(camera); }
void addMesh(std::shared_ptr<MeshData> mesh) { meshes_.push_back(mesh); }
void addMaterial(const MaterialData& mtl) { materials_.push_back(mtl); }
void addBuffer(uint64_t buf_size, const void* data);
void addImage(
int32_t width,
int32_t height,
int32_t bits_per_component,
int32_t num_components,
const void* data
);
void addSampler(
cudaTextureAddressMode address_s,
cudaTextureAddressMode address_t,
cudaTextureFilterMode filter_mode,
int32_t image_idx
);
CUdeviceptr getBuffer(int32_t buffer_index, int32_t offset = -1) const;
cudaArray_t getImage(int32_t image_index) const { return images_[image_index]; }
cudaTextureObject_t getSampler(int32_t sampler_index) const { return samplers_[sampler_index]; }
Camera camera();
AABB aabb() const { return aabb_; }
const std::vector<MaterialData>& materials() const { return materials_; }
const std::vector<std::shared_ptr<MeshData>>& meshes() const { return meshes_; }
private:
std::vector<Camera> cameras_;
std::vector<std::shared_ptr<MeshData>> meshes_;
std::vector<MaterialData> materials_;
std::vector<CUdeviceptr> buffers_;
std::vector<int32_t> buffer_offsets_;
std::vector<cudaTextureObject_t> samplers_;
std::vector<cudaArray_t> images_;
AABB aabb_;
};
} // namespace Agate
| 27.813953 | 100 | 0.701087 | dfnzhc |
5f666bcdf274820fb1d811c3a886823e9d2d224c | 1,082 | cpp | C++ | Binary Trees/height-of-binary-tree.cpp | ComputerScientist-01/100-Days-Of-DSA | 28942615a88c12382ca0b1580f5da393f957d584 | [
"MIT"
] | 4 | 2021-06-22T15:24:54.000Z | 2021-08-05T02:53:34.000Z | Binary Trees/height-of-binary-tree.cpp | AdityaPrakash-26/100-Days-Of-DSA | 821a26b128db3f9b555d87fab6d89d76fae22119 | [
"MIT"
] | null | null | null | Binary Trees/height-of-binary-tree.cpp | AdityaPrakash-26/100-Days-Of-DSA | 821a26b128db3f9b555d87fab6d89d76fae22119 | [
"MIT"
] | 1 | 2021-07-11T09:42:03.000Z | 2021-07-11T09:42:03.000Z | #include "bits/stdc++.h"
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int val)
{
data = val;
left = NULL;
right = NULL;
}
};
int sumNodes(Node *root)
{
if (root == NULL)
{
return 0;
}
return sumNodes(root->left) + sumNodes(root->right) + root->data;
}
// time complexity of this f(x) will be O(n) as we are doing O(1) operation
//for very element in the binary tree and it has n elements
int calcHeight(Node *root)
{
if (root == NULL)
{
return 0;
}
int lHeight = calcHeight(root->left);
int rHeight = calcHeight(root->right);
return max(lHeight, rHeight) + 1;
}
// 1
// / \
// 2 3
// / \ / \
// 4 5 6 7
int main()
{
struct Node *root = new Node(1);
root->left = new Node(2);
root->right = new Node(3);
root->left->left = new Node(4);
root->left->right = new Node(5);
root->right->left = new Node(6);
root->right->right = new Node(7);
cout << " " << calcHeight(root);
return 0;
}
| 17.737705 | 75 | 0.547135 | ComputerScientist-01 |
5f66afb90590009dceed6d48193a54849256c70b | 7,461 | hpp | C++ | zeccup/zeccup/military/woodland/fuel.hpp | LISTINGS09/ZECCUP | e0ad1fae580dde6e5d90903b1295fecc41684f63 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 3 | 2016-08-29T09:23:49.000Z | 2019-06-13T20:29:28.000Z | zeccup/zeccup/military/woodland/fuel.hpp | LISTINGS09/ZECCUP | e0ad1fae580dde6e5d90903b1295fecc41684f63 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | zeccup/zeccup/military/woodland/fuel.hpp | LISTINGS09/ZECCUP | e0ad1fae580dde6e5d90903b1295fecc41684f63 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | class FuelLarge
{
name = $STR_ZECCUP_FuelLarge;
};
class FuelMedium
{
name = $STR_ZECCUP_FuelMedium;
// EAST
class FuelDump_CUP_O_RU {
name = $STR_ZECCUP_MilitaryWoodland_FuelMedium_FuelDump_CUP_O_RU; // Credit: 2600K
icon = "\ca\data\flag_rus_co.paa";
side = 8;
class Object1 {side = 8; vehicle = "Land_CamoNet_EAST"; rank = ""; position[] = {0.14917,-0.199463,0}; dir = 180;};
class Object2 {side = 8; vehicle = "Land_fort_rampart"; rank = ""; position[] = {0.375,-2.27441,0}; dir = 0;};
class Object3 {side = 8; vehicle = "Land_fort_bagfence_round"; rank = ""; position[] = {-9.96082,0.377441,0}; dir = 270;};
class Object4 {side = 8; vehicle = "Land_fort_bagfence_long"; rank = ""; position[] = {-6.10962,-2.36108,0}; dir = 180;};
class Object5 {side = 8; vehicle = "Barrel2"; rank = ""; position[] = {-0.530396,-1.23584,0}; dir = 0;};
class Object6 {side = 8; vehicle = "Land_WoodenTable_large_F"; rank = ""; position[] = {-2.62524,-1.25342,0}; dir = 89.6789;};
class Object7 {side = 8; vehicle = "Land_Pallets_stack_F"; rank = ""; position[] = {2,-1.125,0}; dir = 270.002;};
class Object8 {side = 8; vehicle = "Land_CratesShabby_F"; rank = ""; position[] = {3.36792,-1.24658,0}; dir = 105;};
class Object9 {side = 8; vehicle = "Land_CampingChair_V2_F"; rank = ""; position[] = {-3.12256,-0.730957,0}; dir = 359.976;};
class Object10 {side = 8; vehicle = "Land_CampingChair_V2_F"; rank = ""; position[] = {-2.12268,-0.48291,0}; dir = 345.008;};
class Object12 {side = 8; vehicle = "CUP_A1_fuelstation_army"; rank = ""; position[] = {4.49011,5.85913,0}; dir = 0;};
class Object13 {side = 8; vehicle = "Land_fort_bagfence_corner"; rank = ""; position[] = {-5.47046,4.28662,0}; dir = 270;};
class Object14 {side = 8; vehicle = "Land_fort_bagfence_long"; rank = ""; position[] = {-4.88892,7.51538,0}; dir = 90;};
class Object15 {side = 8; vehicle = "Barrel2"; rank = ""; position[] = {-1.67078,9.60986,0}; dir = 330;};
class Object16 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {1.375,3.875,0}; dir = 150;};
class Object17 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {0,10.75,0}; dir = 90;};
class Object18 {side = 8; vehicle = "Land_MetalBarrel_F"; rank = ""; position[] = {3.49988,4,0}; dir = 29.9737;};
class Object19 {side = 8; vehicle = "Land_MetalBarrel_F"; rank = ""; position[] = {2.49988,3.875,0}; dir = 359.986;};
class Object20 {side = 8; vehicle = "Fort_Crate_wood"; rank = ""; position[] = {1.24805,12.3738,0}; dir = 270;};
class Object21 {side = 8; vehicle = "Land_fort_bagfence_corner"; rank = ""; position[] = {7.77954,-1.21338,0}; dir = 270;};
class Object22 {side = 8; vehicle = "Land_Ind_TankSmall2"; rank = ""; position[] = {9.2843,9.12354,0}; dir = 270;};
class Object23 {side = 8; vehicle = "Land_fort_bagfence_long"; rank = ""; position[] = {8.36108,2.01538,0}; dir = 90;};
class Object24 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {11.1284,6.63843,0}; dir = 90;};
class Object25 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {10.6488,5.94482,0}; dir = 15;};
};
// WEST
class FuelDump_CUP_B_CDF {
name = $STR_ZECCUP_MilitaryWoodland_FuelMedium_FuelDump_CUP_B_CDF; // Credit: 2600K
icon = "\ca\data\flag_usa_co.paa";
side = 8;
class Object1 {side = 8; vehicle = "CUP_A1_fuelstation_army"; rank = ""; position[] = {0.134888,-0.734131,0}; dir = 180;};
class Object2 {side = 8; vehicle = "Land_BagFenceRound"; rank = ""; position[] = {-5.57751,-7.94995,0}; dir = 30;};
class Object3 {side = 8; vehicle = "Land_BagFenceLong"; rank = ""; position[] = {-2.7478,-7.9856,0}; dir = 0;};
class Object4 {side = 8; vehicle = "Land_BagFenceEnd"; rank = ""; position[] = {-6.52063,-5.875,0}; dir = 255;};
class Object5 {side = 8; vehicle = "Land_BagFenceEnd"; rank = ""; position[] = {-0.442139,-7.73706,0}; dir = 345;};
class Object6 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {-5.5,-4.125,0}; dir = 90;};
class Object7 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {-6.125,-3.5,0}; dir = 210;};
class Object8 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {-6.5,-4.25,0}; dir = 120;};
class Object9 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {-5.375,-3.375,0}; dir = 285;};
class Object10 {side = 8; vehicle = "Land_MetalBarrel_F"; rank = ""; position[] = {-0.625122,-4.125,0}; dir = 329.978;};
class Object11 {side = 8; vehicle = "Land_MetalBarrel_F"; rank = ""; position[] = {-0.625,-3.375,0}; dir = 299.999;};
class Object13 {side = 8; vehicle = "Land_BagFenceLong"; rank = ""; position[] = {1.7522,11.5144,0}; dir = 0;};
class Object14 {side = 8; vehicle = "FoldTable"; rank = ""; position[] = {3.12512,8.12451,0}; dir = 345;};
class Object15 {side = 8; vehicle = "Fort_Crate_wood"; rank = ""; position[] = {-0.877197,1.74951,0}; dir = 285;};
class Object16 {side = 8; vehicle = "FoldChair"; rank = ""; position[] = {3.41492,8.97754,0}; dir = 45;};
class Object17 {side = 8; vehicle = "Land_MetalBarrel_empty_F"; rank = ""; position[] = {1,4,0}; dir = 150;};
class Object18 {side = 8; vehicle = "Land_MetalBarrel_F"; rank = ""; position[] = {1.74976,4,0}; dir = 359.986;};
class Object19 {side = 8; vehicle = "Land_MetalBarrel_F"; rank = ""; position[] = {1.37476,3.25,0}; dir = 29.9739;};
class Object20 {side = 8; vehicle = "FoldChair"; rank = ""; position[] = {2.83496,7.26978,0}; dir = 135;};
class Object21 {side = 8; vehicle = "Land_Ind_TankSmall2"; rank = ""; position[] = {8.50134,-4.96582,0}; dir = 180;};
class Object22 {side = 8; vehicle = "Land_BagFenceEnd"; rank = ""; position[] = {11.4421,-0.512939,0}; dir = 165;};
class Object23 {side = 8; vehicle = "Land_CamoNetVar_NATO"; rank = ""; position[] = {5.59875,5.63745,0}; dir = 0;};
class Object24 {side = 8; vehicle = "Land_BagFenceRound"; rank = ""; position[] = {13.5171,0.430176,0}; dir = 300;};
class Object25 {side = 8; vehicle = "Land_BagFenceRound"; rank = ""; position[] = {13.0857,11.8157,0}; dir = 225;};
class Object26 {side = 8; vehicle = "Land_BagFenceLong"; rank = ""; position[] = {13.5527,3.25977,0}; dir = 270;};
class Object27 {side = 8; vehicle = "Land_BagFenceLong"; rank = ""; position[] = {4.60254,11.5271,0}; dir = 0;};
class Object28 {side = 8; vehicle = "Land_BagFenceLong"; rank = ""; position[] = {13.5273,8.96045,0}; dir = 270;};
class Object29 {side = 8; vehicle = "Land_BagFenceLong"; rank = ""; position[] = {13.54,6.11011,0}; dir = 270;};
class Object30 {side = 8; vehicle = "Barrel2"; rank = ""; position[] = {7.8446,3.38916,0}; dir = 0;};
class Object31 {side = 8; vehicle = "Barrel2"; rank = ""; position[] = {5.59351,4.01514,0}; dir = 30;};
class Object32 {side = 8; vehicle = "Land_Pallets_stack_F"; rank = ""; position[] = {4.125,3.25,0}; dir = 270.001;};
class Object33 {side = 8; vehicle = "Land_BagFenceEnd"; rank = ""; position[] = {6.92712,11.2156,0}; dir = 15;};
class Object34 {side = 8; vehicle = "Land_BagFenceEnd"; rank = ""; position[] = {10.7488,12.2813,0}; dir = 180;};
class Object35 {side = 8; vehicle = "Land_Sacks_heap_F"; rank = ""; position[] = {12.875,8.25,0}; dir = 90;};
};
};
class FuelSmall
{
name = $STR_ZECCUP_FuelSmall;
};
| 86.755814 | 129 | 0.615869 | LISTINGS09 |
5f67e6b8df33f644ed36fb18f42f8f54488ad3db | 1,033 | cpp | C++ | Engine/Lang/AST/Nodes/ASTNodeScope.cpp | GabyForceQ/PolluxEngine | 2dbc84ed1d434f1b6d794f775f315758f0e8cc49 | [
"BSD-3-Clause"
] | 3 | 2020-05-19T20:24:28.000Z | 2020-09-27T11:28:42.000Z | Engine/Lang/AST/Nodes/ASTNodeScope.cpp | GabyForceQ/PolluxEngine | 2dbc84ed1d434f1b6d794f775f315758f0e8cc49 | [
"BSD-3-Clause"
] | 31 | 2020-05-27T11:01:27.000Z | 2020-08-08T15:53:23.000Z | Engine/Lang/AST/Nodes/ASTNodeScope.cpp | GabyForceQ/PolluxEngine | 2dbc84ed1d434f1b6d794f775f315758f0e8cc49 | [
"BSD-3-Clause"
] | null | null | null | /*****************************************************************************************************************************
* Copyright 2020 Gabriel Gheorghe. All rights reserved.
* This code is licensed under the BSD 3-Clause "New" or "Revised" License
* License url: https://github.com/GabyForceQ/PolluxEngine/blob/master/LICENSE
*****************************************************************************************************************************/
#include "Engine/enginepch.hpp"
#include "ASTNodeScope.hpp"
namespace Pollux::Lang
{
ASTNodeScope::ASTNodeScope() noexcept
:
ASTNodeBase{ Token{ TokenKind::Undefined, g_pEmptyString } }
{
RegisterType("ASTNodeScope", +ASTNodeKind::ASTNodeScope);
}
void ASTNodeScope::Accept(IASTNodeVisitor* pVisitor)
{
return pVisitor->Visit(this);
}
void ASTNodeScope::InsertStatement(ASTNodeBase* pStatement)
{
pStatements.push_back(pStatement);
}
const std::vector<ASTNodeBase*>& ASTNodeScope::GetStatements() const noexcept
{
return pStatements;
}
} | 30.382353 | 127 | 0.56728 | GabyForceQ |
5f681577402a52968a8b8c4c300a738780f0a272 | 10,717 | cpp | C++ | media_softlet/agnostic/common/codec/hal/codechal_oca_debug.cpp | LhGu/media-driver | e73c1d9a6cb8ff0c619766174cf618863520bf46 | [
"Intel",
"BSD-3-Clause",
"MIT"
] | null | null | null | media_softlet/agnostic/common/codec/hal/codechal_oca_debug.cpp | LhGu/media-driver | e73c1d9a6cb8ff0c619766174cf618863520bf46 | [
"Intel",
"BSD-3-Clause",
"MIT"
] | null | null | null | media_softlet/agnostic/common/codec/hal/codechal_oca_debug.cpp | LhGu/media-driver | e73c1d9a6cb8ff0c619766174cf618863520bf46 | [
"Intel",
"BSD-3-Clause",
"MIT"
] | null | null | null | /*
* Copyright (c) 2022, Intel Corporation
*
* 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.
*/
//!
//! \file codechal_oca_debug.cpp
//! \brief Defines the oca debug interface shared by codec only.
//! \details The debug interface dumps output from Media based on in input config file.
//!
#include "codechal_oca_debug.h"
CodechalOcaDumper::CodechalOcaDumper()
{
}
CodechalOcaDumper::~CodechalOcaDumper()
{
MOS_DeleteArray(m_pOcaDecodeParam);
}
void CodechalOcaDumper::Delete(void *&p)
{
CodechalOcaDumper *pOcaDumper = (CodechalOcaDumper *)p;
MOS_Delete(pOcaDumper);
p = nullptr;
}
void CodechalOcaDumper::AllocateBufferSize(uint32_t allocSize)
{
if (m_pOcaDecodeParam)
{
if (allocSize > ((CODECHAL_OCA_DECODE_HEADER*)m_pOcaDecodeParam)->Header.allocSize)
{
MOS_DeleteArray(m_pOcaDecodeParam);
}
else
{
// Reuse previous buffer.
allocSize = ((CODECHAL_OCA_DECODE_HEADER*)m_pOcaDecodeParam)->Header.allocSize;
}
}
if (nullptr == m_pOcaDecodeParam)
{
m_pOcaDecodeParam = (CODECHAL_OCA_DECODE_HEADER *)MOS_NewArray(char, allocSize);
}
}
void CodechalOcaDumper::SetAvcDecodeParam(
PCODEC_AVC_PIC_PARAMS picParams,
PCODEC_AVC_SLICE_PARAMS sliceParams,
uint32_t numSlices)
{
uint32_t sliceNum = (numSlices > CODECHAL_OCA_DECODE_MAX_SLICE_NUM) ? CODECHAL_OCA_DECODE_MAX_SLICE_NUM : numSlices;
// OCA Buffer dumps header + pic parameter + slice parameter
uint32_t size = sizeof(CODECHAL_OCA_DECODE_HEADER) +
sizeof(CODECHAL_OCA_DECODE_AVC_PIC_PARAM) +
sliceNum * sizeof(CODECHAL_OCA_DECODE_AVC_SLICE_PARAM);
uint32_t allocSize = size;
AllocateBufferSize(allocSize);
if (nullptr == m_pOcaDecodeParam)
{
return;
}
memset(m_pOcaDecodeParam, 0, size);
m_pOcaDecodeParam->Header.size = size;
m_pOcaDecodeParam->Header.allocSize = allocSize;
m_pOcaDecodeParam->Component = COMPONENT_Decode;
m_pOcaDecodeParam->numSlices = sliceNum;
uint32_t offset = sizeof(CODECHAL_OCA_DECODE_HEADER);
CODECHAL_OCA_DECODE_AVC_PIC_PARAM* pPicParam = (CODECHAL_OCA_DECODE_AVC_PIC_PARAM *)((char*)m_pOcaDecodeParam + offset);
offset += sizeof(CODECHAL_OCA_DECODE_AVC_PIC_PARAM);
CODECHAL_OCA_DECODE_AVC_SLICE_PARAM* pSliceParam = (CODECHAL_OCA_DECODE_AVC_SLICE_PARAM *)((char*)m_pOcaDecodeParam + offset);
if (nullptr == pPicParam || nullptr == pSliceParam)
{
return;
}
if (picParams)
{
pPicParam->picParams.params = *picParams;
pPicParam->picParams.bValid = true;
}
for(uint16_t i = 0; i < sliceNum; i++)
{
if (sliceParams)
{
pSliceParam[i].bValid = true;
pSliceParam[i].sliceParams.slice_data_size = sliceParams[i].slice_data_size;
pSliceParam[i].sliceParams.slice_data_offset = sliceParams[i].slice_data_offset;
pSliceParam[i].sliceParams.slice_data_bit_offset = sliceParams[i].slice_data_bit_offset;
pSliceParam[i].sliceParams.first_mb_in_slice = sliceParams[i].first_mb_in_slice;
pSliceParam[i].sliceParams.NumMbsForSlice = sliceParams[i].NumMbsForSlice;
pSliceParam[i].sliceParams.slice_type = sliceParams[i].slice_type;
pSliceParam[i].sliceParams.direct_spatial_mv_pred_flag = sliceParams[i].direct_spatial_mv_pred_flag;
pSliceParam[i].sliceParams.num_ref_idx_l0_active_minus1 = sliceParams[i].num_ref_idx_l0_active_minus1;
pSliceParam[i].sliceParams.num_ref_idx_l1_active_minus1 = sliceParams[i].num_ref_idx_l1_active_minus1;
pSliceParam[i].sliceParams.cabac_init_idc = sliceParams[i].cabac_init_idc;
pSliceParam[i].sliceParams.slice_qp_delta = sliceParams[i].slice_qp_delta;
pSliceParam[i].sliceParams.disable_deblocking_filter_idc = sliceParams[i].disable_deblocking_filter_idc;
pSliceParam[i].sliceParams.slice_alpha_c0_offset_div2 = sliceParams[i].slice_alpha_c0_offset_div2;
pSliceParam[i].sliceParams.slice_beta_offset_div2 = sliceParams[i].slice_beta_offset_div2;
pSliceParam[i].sliceParams.slice_id = sliceParams[i].slice_id;
pSliceParam[i].sliceParams.first_mb_in_next_slice = sliceParams[i].first_mb_in_next_slice;
}
}
}
void CodechalOcaDumper::SetHevcDecodeParam(
PCODEC_HEVC_PIC_PARAMS picParams,
PCODEC_HEVC_EXT_PIC_PARAMS extPicParams,
PCODEC_HEVC_SCC_PIC_PARAMS sccPicParams,
PCODEC_HEVC_SLICE_PARAMS sliceParams,
PCODEC_HEVC_EXT_SLICE_PARAMS extSliceParams,
uint32_t numSlices,
bool shortFormatInUse)
{
uint32_t sliceNum = (numSlices > CODECHAL_OCA_DECODE_MAX_SLICE_NUM) ? CODECHAL_OCA_DECODE_MAX_SLICE_NUM : numSlices;
uint32_t size = sizeof(CODECHAL_OCA_DECODE_HEADER) +
sizeof(CODECHAL_OCA_DECODE_HEVC_PIC_PARAM) +
sliceNum * sizeof(CODECHAL_OCA_DECODE_HEVC_SLICE_PARAM);
uint32_t allocSize = size;
AllocateBufferSize(allocSize);
if (nullptr == m_pOcaDecodeParam)
{
return;
}
memset(m_pOcaDecodeParam, 0, size);
m_pOcaDecodeParam->Header.size = size;
m_pOcaDecodeParam->Header.allocSize = allocSize;
m_pOcaDecodeParam->Component = COMPONENT_Decode;
m_pOcaDecodeParam->numSlices = sliceNum;
m_pOcaDecodeParam->shortFormatInUse = shortFormatInUse;
uint32_t offset = sizeof(CODECHAL_OCA_DECODE_HEADER);
CODECHAL_OCA_DECODE_HEVC_PIC_PARAM* pPicParam = (CODECHAL_OCA_DECODE_HEVC_PIC_PARAM *)((char*)m_pOcaDecodeParam + offset);
offset += sizeof(CODECHAL_OCA_DECODE_HEVC_PIC_PARAM);
CODECHAL_OCA_DECODE_HEVC_SLICE_PARAM* pSliceParam = (CODECHAL_OCA_DECODE_HEVC_SLICE_PARAM *)((char*)m_pOcaDecodeParam + offset);
if (nullptr == pPicParam || nullptr == pSliceParam)
{
return;
}
if (picParams)
{
pPicParam->picParams.params = *picParams;
pPicParam->picParams.bValid = true;
}
if (extPicParams)
{
pPicParam->extPicParams.params = *extPicParams;
pPicParam->extPicParams.bValid = true;
}
if (sccPicParams)
{
pPicParam->sccPicParams.params = *sccPicParams;
pPicParam->sccPicParams.bValid = true;
}
for(uint16_t i = 0; i < sliceNum; i++)
{
if (sliceParams)
{
pSliceParam[i].bValid = true;
pSliceParam[i].sliceParams.slice_data_size = sliceParams[i].slice_data_size;
pSliceParam[i].sliceParams.slice_data_offset = sliceParams[i].slice_data_offset;
pSliceParam[i].sliceParams.NumEmuPrevnBytesInSliceHdr = sliceParams[i].NumEmuPrevnBytesInSliceHdr;
pSliceParam[i].sliceParams.ByteOffsetToSliceData = sliceParams[i].ByteOffsetToSliceData;
pSliceParam[i].sliceParams.collocated_ref_idx = sliceParams[i].collocated_ref_idx;
pSliceParam[i].sliceParams.num_ref_idx_l0_active_minus1 = sliceParams[i].num_ref_idx_l0_active_minus1;
pSliceParam[i].sliceParams.num_ref_idx_l1_active_minus1 = sliceParams[i].num_ref_idx_l1_active_minus1;
pSliceParam[i].sliceParams.LongSliceFlags.LastSliceOfPic = sliceParams[i].LongSliceFlags.fields.LastSliceOfPic;
pSliceParam[i].sliceParams.LongSliceFlags.dependent_slice_segment_flag = sliceParams[i].LongSliceFlags.fields.dependent_slice_segment_flag;
pSliceParam[i].sliceParams.LongSliceFlags.slice_type = sliceParams[i].LongSliceFlags.fields.slice_type;
pSliceParam[i].sliceParams.LongSliceFlags.color_plane_id = sliceParams[i].LongSliceFlags.fields.color_plane_id;
pSliceParam[i].sliceParams.LongSliceFlags.slice_sao_luma_flag = sliceParams[i].LongSliceFlags.fields.slice_sao_luma_flag;
pSliceParam[i].sliceParams.LongSliceFlags.slice_sao_chroma_flag = sliceParams[i].LongSliceFlags.fields.slice_sao_chroma_flag;
pSliceParam[i].sliceParams.LongSliceFlags.mvd_l1_zero_flag = sliceParams[i].LongSliceFlags.fields.mvd_l1_zero_flag;
pSliceParam[i].sliceParams.LongSliceFlags.cabac_init_flag = sliceParams[i].LongSliceFlags.fields.cabac_init_flag;
pSliceParam[i].sliceParams.LongSliceFlags.slice_temporal_mvp_enabled_flag = sliceParams[i].LongSliceFlags.fields.slice_temporal_mvp_enabled_flag;
pSliceParam[i].sliceParams.LongSliceFlags.slice_deblocking_filter_disabled_flag = sliceParams[i].LongSliceFlags.fields.slice_deblocking_filter_disabled_flag;
pSliceParam[i].sliceParams.LongSliceFlags.collocated_from_l0_flag = sliceParams[i].LongSliceFlags.fields.collocated_from_l0_flag;
pSliceParam[i].sliceParams.LongSliceFlags.slice_loop_filter_across_slices_enabled_flag = sliceParams[i].LongSliceFlags.fields.slice_loop_filter_across_slices_enabled_flag;
}
}
}
| 49.615741 | 183 | 0.678082 | LhGu |
5f69d4ccb72cd1bb147e4f1b64a009f97aa89104 | 4,707 | cpp | C++ | firmware/examples/RGBLED-Draw/RGBStrip.cpp | brunolewin/virtual-shields-spark | fc5c8fa9cc3a1135229db707b566b0da5f345f0d | [
"MIT"
] | 98 | 2015-05-01T16:57:54.000Z | 2021-02-22T17:19:11.000Z | firmware/examples/RGBLED-Draw/RGBStrip.cpp | brunolewin/virtual-shields-spark | fc5c8fa9cc3a1135229db707b566b0da5f345f0d | [
"MIT"
] | 30 | 2015-05-18T09:58:39.000Z | 2018-09-13T17:42:23.000Z | firmware/examples/RGBLED-Draw/RGBStrip.cpp | brunolewin/virtual-shields-spark | fc5c8fa9cc3a1135229db707b566b0da5f345f0d | [
"MIT"
] | 64 | 2015-04-30T22:56:14.000Z | 2021-04-18T08:43:15.000Z | /*
Copyright(c) Microsoft Open Technologies, Inc. All rights reserved.
The MIT License(MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files(the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions :
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
#include "RGBStrip.h"
#define _TCHAR String
extern "C" {
#include <string.h>
#include <stdlib.h>
}
const int stripClock = 2;
const int stripData = 3;
const int stripLen = 48;
BYTE r0, b0, g0, r, g, b;
// Array of stored Pixel values
PIXEL_VALUES Pixels[stripLen];
void RGBStrip::begin()
{
// Set pins to outputs
pinMode(stripClock, OUTPUT);
pinMode(stripData, OUTPUT);
digitalWrite(stripClock, LOW);
digitalWrite(stripData, LOW);
clear();
}
void RGBStrip::clear()
{
// Reset all the pixels
for (int i = 0; i < stripLen; i++)
{
SetPixel(i, 0, 0, 0);
}
ShiftAllPixels();
}
_PIXEL_VALUES RGBStrip::getPixel(int pos)
{
return Pixels[pos];
}
void RGBStrip::setDim(int dim)
{
this->dim = dim == 0 ? 1 : dim;
}
void RGBStrip::setSpeed(int speed)
{
this->speed = speed;
}
int sgn(int value) {
return value == 0 ? 0 : (value < 1 ? -1 : 1);
}
void RGBStrip::setAll(BYTE r, BYTE g, BYTE b) {
int i;
r0 = r/dim;
b0=b/dim;
g0=g/dim;
tick();
}
void RGBStrip::tick() {
r = speed == 0 || abs(r0-r) < speed ? r0 : r+sgn(r0-r)*speed;
g = speed == 0 || abs(g0-g) < speed ? g0 : g+sgn(g0-g)*speed;
b = speed == 0 || abs(b0-b) < speed ? b0 : b+sgn(b0-b)*speed;
for (int i = 0; i < stripLen; i++)
{
SetPixel(i, r, g, b);
}
ShiftAllPixels();
}
void RGBStrip::SetPixels(int set[], int len, BYTE r, BYTE g, BYTE b)
{
for (int i = 0; i < len; i++)
{
SetPixel(set[i], r, g, b);
}
}
// Sets the pixel color in our array
void RGBStrip::SetPixel(int pixel, BYTE Red, BYTE Green, BYTE Blue)
{
if (pixel < stripLen)
{
Pixels[pixel].Red = Red | 0x80;
Pixels[pixel].Green = Green | 0x80;
Pixels[pixel].Blue = Blue | 0x80;
}
}
void RGBStrip::SetPixel(int pixel, _PIXEL_VALUES values)
{
if (pixel < stripLen)
{
Pixels[pixel].Red = values.Red;
Pixels[pixel].Green = values.Green;
Pixels[pixel].Blue = values.Blue;
}
}
// Sends the color of a pixel to the strip
void RGBStrip::ShiftPixel(int pixel)
{
PPIXEL_VALUES PixelValues = &Pixels[pixel];
BYTE bit;
int i;
for (i = 7; i >= 0; i--)
{
bit = (PixelValues->Green >> i) & 0x01;
digitalWrite(stripData, bit);
digitalWrite(stripClock, HIGH);
digitalWrite(stripClock, LOW);
}
for (i = 7; i >= 0; i--)
{
bit = (PixelValues->Red >> i) & 0x01;
digitalWrite(stripData, bit);
digitalWrite(stripClock, HIGH);
digitalWrite(stripClock, LOW);
}
for (i = 7; i >= 0; i--)
{
bit = (PixelValues->Blue >> i) & 0x01;
digitalWrite(stripData, bit);
digitalWrite(stripClock, HIGH);
digitalWrite(stripClock, LOW);
}
}
// Sends all the pixel colors to the strip
void RGBStrip::ShiftAllPixels()
{
int i;
digitalWrite(stripData, 0);
for (i = 0; i < 8; i++)
{
digitalWrite(stripClock, HIGH);
digitalWrite(stripClock, LOW);
}
for (i = 0; i < 8; i++)
{
digitalWrite(stripClock, HIGH);
digitalWrite(stripClock, LOW);
}
for (i = 0; i < 8; i++)
{
digitalWrite(stripClock, HIGH);
digitalWrite(stripClock, LOW);
}
for (i = 0; i < stripLen; i++)
{
ShiftPixel(i);
}
digitalWrite(stripData, 0);
for (i = 0; i < 8; i++)
{
digitalWrite(stripClock, HIGH);
digitalWrite(stripClock, LOW);
}
for (i = 0; i < 8; i++)
{
digitalWrite(stripClock, HIGH);
digitalWrite(stripClock, LOW);
}
} | 23.30198 | 81 | 0.616741 | brunolewin |
5f6c278429834b5710f6b20bb4c11eaff3e9453b | 5,425 | cpp | C++ | book/Convertor/src/TagTest.cpp | SergeyStrukov/CCore-3-xx | 820507e78f8aa35ca05761e00e060c8f64c59af5 | [
"BSL-1.0"
] | 8 | 2017-12-21T07:00:16.000Z | 2020-04-02T09:05:55.000Z | book/Convertor/src/TagTest.cpp | SergeyStrukov/CCore-3-xx | 820507e78f8aa35ca05761e00e060c8f64c59af5 | [
"BSL-1.0"
] | null | null | null | book/Convertor/src/TagTest.cpp | SergeyStrukov/CCore-3-xx | 820507e78f8aa35ca05761e00e060c8f64c59af5 | [
"BSL-1.0"
] | 1 | 2020-03-30T09:54:18.000Z | 2020-03-30T09:54:18.000Z | /* TagTest.cpp */
//----------------------------------------------------------------------------------------
//
// Project: Book Convertor 1.00
//
// License: Boost Software License - Version 1.0 - August 17th, 2003
//
// see http://www.boost.org/LICENSE_1_0.txt or the local copy
//
// Copyright (c) 2018 Sergey Strukov. All rights reserved.
//
//----------------------------------------------------------------------------------------
#include <inc/TagTest.h>
#include <CCore/inc/CharProp.h>
namespace App {
/* class TagTest */
StrLen TagTest::ToString(int code)
{
switch( code )
{
case Error_NoBlock : return "No opened text block"_c;
case Error_BlockMismatch : return "Text block mismatch"_c;
case Error_InBlock : return "Text block is opened"_c;
case Error_NotList : return "Not a list"_c;
case Error_NotItem : return "Not a list item"_c;
case Error_ItemNotClosed : return "List item is not closed"_c;
case Error_HasFmt : return "Format flag is active"_c;
case Error_NoFmt : return "Format flag is not active"_c;
default: return "???"_c;
}
}
auto TagTest::noFormat() const -> TagErrorId
{
if( fmt_b ) return Error_HasFmt;
if( fmt_i ) return Error_HasFmt;
if( fmt_u ) return Error_HasFmt;
if( fmt_sub ) return Error_HasFmt;
if( fmt_sup ) return Error_HasFmt;
if( fmt_span ) return Error_HasFmt;
if( fmt_a ) return Error_HasFmt;
return {};
}
auto TagTest::open(BlockType bt) -> TagErrorId
{
if( block==NoBlock )
{
block=bt;
return {};
}
return Error_InBlock;
}
auto TagTest::close(BlockType bt) -> TagErrorId
{
if( block==bt )
{
block=NoBlock;
return noFormat();
}
return block?Error_BlockMismatch:Error_NoBlock;
}
auto TagTest::setFmt(bool &flag) -> TagErrorId
{
if( notOpened() ) return Error_NoBlock;
if( flag ) return Error_HasFmt;
flag=true;
return {};
}
auto TagTest::clearFmt(bool &flag) -> TagErrorId
{
if( !flag ) return Error_NoFmt;
flag=false;
return {};
}
bool TagTest::TestSpace(StrLen str)
{
for(char ch : str ) if( !CharIsSpace(ch) ) return false;
return true;
}
void TagTest::setId(String)
{
}
// frame
auto TagTest::frame(String str) -> TagErrorId
{
if( notOpened() && !TestSpace(Range(str)) ) return Error_NoBlock;
return {};
}
// text
auto TagTest::tagH1() -> TagErrorId
{
return open(Block_H1);
}
auto TagTest::tagH1end() -> TagErrorId
{
return close(Block_H1);
}
auto TagTest::tagH2() -> TagErrorId
{
return open(Block_H2);
}
auto TagTest::tagH2end() -> TagErrorId
{
return close(Block_H2);
}
auto TagTest::tagH3() -> TagErrorId
{
return open(Block_H3);
}
auto TagTest::tagH3end() -> TagErrorId
{
return close(Block_H3);
}
auto TagTest::tagH4() -> TagErrorId
{
return open(Block_H4);
}
auto TagTest::tagH4end() -> TagErrorId
{
return close(Block_H4);
}
auto TagTest::tagH5() -> TagErrorId
{
return open(Block_H5);
}
auto TagTest::tagH5end() -> TagErrorId
{
return close(Block_H5);
}
auto TagTest::tagP() -> TagErrorId
{
return open(Block_P);
}
auto TagTest::tagP(String) -> TagErrorId
{
return open(Block_P);
}
auto TagTest::tagPend() -> TagErrorId
{
return close(Block_P);
}
auto TagTest::tagPRE() -> TagErrorId
{
return open(Block_PRE);
}
auto TagTest::tagPREend() -> TagErrorId
{
return close(Block_PRE);
}
// format
auto TagTest::tagB() -> TagErrorId
{
return setFmt(fmt_b);
}
auto TagTest::tagBend() -> TagErrorId
{
return clearFmt(fmt_b);
}
auto TagTest::tagI() -> TagErrorId
{
return setFmt(fmt_i);
}
auto TagTest::tagIend() -> TagErrorId
{
return clearFmt(fmt_i);
}
auto TagTest::tagU() -> TagErrorId
{
return setFmt(fmt_u);
}
auto TagTest::tagUend() -> TagErrorId
{
return clearFmt(fmt_u);
}
auto TagTest::tagSUB() -> TagErrorId
{
return setFmt(fmt_sub);
}
auto TagTest::tagSUBend() -> TagErrorId
{
return clearFmt(fmt_sub);
}
auto TagTest::tagSUP() -> TagErrorId
{
return setFmt(fmt_sup);
}
auto TagTest::tagSUPend() -> TagErrorId
{
return clearFmt(fmt_sup);
}
auto TagTest::tagSPAN(String) -> TagErrorId
{
return setFmt(fmt_span);
}
auto TagTest::tagSPANend() -> TagErrorId
{
return clearFmt(fmt_span);
}
// hyperlink
auto TagTest::tagA(String) -> TagErrorId
{
return setFmt(fmt_a);
}
auto TagTest::tagA(String,String) -> TagErrorId
{
return setFmt(fmt_a);
}
auto TagTest::tagAend() -> TagErrorId
{
return clearFmt(fmt_a);
}
// list
auto TagTest::tagOL() -> TagErrorId
{
return open(Block_OL);
}
auto TagTest::tagOLend() -> TagErrorId
{
if( item ) return Error_ItemNotClosed;
return close(Block_OL);
}
auto TagTest::tagUL() -> TagErrorId
{
return open(Block_UL);
}
auto TagTest::tagULend() -> TagErrorId
{
if( item ) return Error_ItemNotClosed;
return close(Block_UL);
}
auto TagTest::tagLI() -> TagErrorId
{
if( inList() && !item )
{
item=true;
return {};
}
return Error_NotList;
}
auto TagTest::tagLIend() -> TagErrorId
{
if( inList() && item )
{
item=false;
return noFormat();
}
return Error_NotItem;
}
// image
auto TagTest::tagImg(String) -> TagErrorId
{
if( block ) return Error_InBlock;
return {};
}
// complete
auto TagTest::complete() -> TagErrorId
{
if( block ) return Error_InBlock;
return {};
}
} // namespace App
| 15.544413 | 90 | 0.627097 | SergeyStrukov |
5f6fe22fb0174d8e6dc13e32c7f883b09dac7155 | 3,352 | cpp | C++ | powerberry-dsp/src/adc/adc_dummy.cpp | Steckdoose4711/powerberry | 15c722ff66f0db5c00ddfb71ccc2c75d69b78d39 | [
"MIT"
] | null | null | null | powerberry-dsp/src/adc/adc_dummy.cpp | Steckdoose4711/powerberry | 15c722ff66f0db5c00ddfb71ccc2c75d69b78d39 | [
"MIT"
] | 20 | 2022-03-11T19:44:31.000Z | 2022-03-21T19:13:46.000Z | powerberry-dsp/src/adc/adc_dummy.cpp | Steckdoose4711/powerberry | 15c722ff66f0db5c00ddfb71ccc2c75d69b78d39 | [
"MIT"
] | null | null | null | /**
* @file adc_dummy.h
* @author Florian Atzenhofer
* @date 30.20.2021
* @brief Module to generate ADC Dummy Values [Implementation]
*
* This module generates an ideal sinewave and returns it's values
*/
#include "adc_dummy.h"
#include <math.h>
#include <iostream>
#include <stdlib.h>
static size_t nr_samples = 100;
static double current_time_radiant = 0;
static double max_amplitude = 0.5;
static size_t sine_wave_frequency = 50;
static double offset_v = 2.5; // offset voltage for the sine wave
adc_dummy::adc_dummy()
{
// calculating an ideal sine wave with a resolution of
// calculate one ideal sinewave
for(size_t i = 0; i < nr_samples; i++)
{
double datapoint = max_amplitude * sin(current_time_radiant);
datapoint += offset_v;
m_sine_wave.emplace_back(datapoint);
current_time_radiant += ((2 * M_PI) / nr_samples);
}
// get current cpu tick timestamp to simulate the "oscillating" sine wave when reading from it
m_start = std::chrono::steady_clock::now();
}
float adc_dummy::read_voltage(size_t const channel)
{
// at first, we have to get the time for the current periode of the sinewave
size_t time_in_this_periode = get_time_in_current_periode();
double duration_periode = (1.0 / sine_wave_frequency * 1.0) * 1000;
size_t index = (nr_samples / duration_periode) * time_in_this_periode;
// now we know the sample point of the sine wave for the current time
double sample_point = m_sine_wave[index];
//std::cout << "time: " << time_in_this_periode << std::endl;
//std::cout << "index: " << index << std::endl;
//std::cout << "original sample point: " << sample_point << std::endl;
// now we add a noise to the sampled adc value to simulate measurement inaccuracy
add_noise_to_sample(sample_point);
//std::cout << "noisy sample point: " << sample_point << std::endl;
return sample_point;
}
void adc_dummy::set_reference_voltage(float const v_reference)
{
// nothing to do here
}
size_t adc_dummy::get_number_channels()
{
return 1;
}
size_t adc_dummy::get_time_in_current_periode()
{
// get sample time of the sinewave
auto duration_since_start = std::chrono::steady_clock::now() - m_start;
auto diff = std::chrono::duration <double, std::milli> (duration_since_start).count();
size_t rounded_diff = round(diff); // time since start in milliseconds
size_t periode_time = (1.0f / (sine_wave_frequency * 1.0f)) * 1000.0f; // periode time in milliseconds
// this is the sample point of the sinewave
size_t time_in_this_periode = rounded_diff % periode_time;
return time_in_this_periode;
}
void adc_dummy::add_noise_to_sample(double & sample)
{
if(sample == 0) return; // no noise will be added to a sample of 0V
// generate noise for sampling point to simulate a realistig measured adc value
int max_val = 100;
double scaler = 0.05; // noise can be 5% of the amplitude of the measured signal
int randVal = rand() % (2 * max_val);
double noise = randVal - max_val; // get random value between -100 and 100
double max_sample = sample * scaler;
double scaled_noise = noise / (max_val * 1.0f / max_sample);
// add noise to sample
sample += scaled_noise;
}
| 32.543689 | 111 | 0.680788 | Steckdoose4711 |
5f703b06ecacf331251ed1c38548bd2eeb9d1322 | 2,126 | cpp | C++ | src/http_router.cpp | jonathonl/IPSuite | 76dfd7913388851c6714645252b2caa3c5596dcc | [
"MIT"
] | 1 | 2016-03-01T15:23:13.000Z | 2016-03-01T15:23:13.000Z | src/http_router.cpp | jonathonl/IPSuite | 76dfd7913388851c6714645252b2caa3c5596dcc | [
"MIT"
] | null | null | null | src/http_router.cpp | jonathonl/IPSuite | 76dfd7913388851c6714645252b2caa3c5596dcc | [
"MIT"
] | null | null | null |
#include "http_router.hpp"
#include "uniform_resource_identifier.hpp"
namespace manifold
{
namespace http
{
//----------------------------------------------------------------//
void router::register_handler(const std::regex& expression, const std::function<void(server::request&& req, server::response&& res, const std::smatch& matches)>& handler)
{
if (handler)
this->routes_.emplace_back(expression, handler);
}
//----------------------------------------------------------------//
//----------------------------------------------------------------//
void router::register_handler(const std::regex& expression, const std::string& method, const std::function<void(server::request&& req, server::response&& res, const std::smatch& matches)>& handler)
{
if (handler)
this->routes_.emplace_back(expression, handler, method);
}
//----------------------------------------------------------------//
//----------------------------------------------------------------//
void router::route(server::request&& req, server::response&& res)
{
bool both_matched = false;
bool path_matched = false;
std::string request_path = percent_decode(uri(req.head().path()).path());
std::string request_method = req.head().method();
std::smatch sm;
for (auto rt = this->routes_.begin(); !both_matched && rt != this->routes_.end(); ++rt)
{
if (std::regex_match(request_path, sm, rt->expression))
{
if (rt->method.empty() || rt->method == request_method)
{
rt->handler(std::move(req), std::move(res), sm);
both_matched = true;
}
path_matched = true;
}
}
if (!both_matched)
{
if (path_matched)
{
res.head().status_code(status_code::method_not_allowed);
res.end();
}
else
{
res.head().status_code(status_code::not_found);
res.end();
}
}
}
//----------------------------------------------------------------//
}
} | 32.707692 | 201 | 0.464722 | jonathonl |
5f7e1fb5223265351033218ccb30a01db993c27b | 4,286 | cpp | C++ | srcAmiga/rsi/sphere.cpp | privatosan/RayStorm | 17e27259a8a1d6b2fcfa16886c6e4cdd81be8cfa | [
"MIT"
] | 2 | 2016-04-03T23:57:54.000Z | 2019-12-05T17:50:37.000Z | srcAmiga/rsi/sphere.cpp | privatosan/RayStorm | 17e27259a8a1d6b2fcfa16886c6e4cdd81be8cfa | [
"MIT"
] | null | null | null | srcAmiga/rsi/sphere.cpp | privatosan/RayStorm | 17e27259a8a1d6b2fcfa16886c6e4cdd81be8cfa | [
"MIT"
] | 2 | 2015-06-20T19:22:47.000Z | 2021-11-15T15:22:14.000Z | /***************
* MODUL: sphere
* NAME: sphere.cpp
* DESCRIPTION: Functions for sphere object class
* AUTHORS: Andreas Heumann, Mike Hesser
* HISTORY:
* DATE NAME COMMENT
* 11.02.95 ah initial release
* 13.03.95 ah added Update()
* 27.08.95 ah added animation
* 11.10.95 ah added Identify()
* 14.04.96 ah added code for normal flipping
***************/
#include <math.h>
#ifndef TYPEDEFS_H
#include "typedefs.h"
#endif
#ifndef VOXEL_H
#include "voxel.h"
#endif
#ifndef OBJECT_H
#include "object.h"
#endif
#ifndef INTERSEC_H
#include "intersec.h"
#endif
#ifndef SPHERE_H
#include "sphere.h"
#endif
/*************
* DESCRIPTION: Constructor of sphere (sets the default values)
* INPUT: none
* OUTPUT: none
*************/
SPHERE::SPHERE()
{
ir = 0.f;
}
/*************
* DESCRIPTION: Returns identification for sphere
* INPUT: none
* OUTPUT: IDENT_SPHERE
*************/
ULONG SPHERE::Identify()
{
return IDENT_SPHERE;
}
/*************
* DESCRIPTION: Generate Voxel
* INPUT: -
* OUTPUT: none
*************/
void SPHERE::GenVoxel()
{
// generate voxel
voxel.min.x = pos.x-r;
voxel.min.y = pos.y-r;
voxel.min.z = pos.z-r;
voxel.max.x = pos.x+r;
voxel.max.y = pos.y+r;
voxel.max.z = pos.z+r;
}
/*************
* DESCRIPTION: Update sphere parameters
* INPUT: time actual time
* OUTPUT: none
*************/
void SPHERE::Update(const float time)
{
TIME t;
float f;
if(actor)
{
if(time != this->time)
{
if((actor->time.begin != this->time) || (actor->time.end != time))
{
t.begin = this->time;
t.end = time;
actor->Animate(&t);
}
// animated sphere
// animate position
actor->matrix->MultVectMat(&pos);
// animate radius
f = actor->act_size.x / actor->axis_size.x;
r *= f;
ir *= f;
}
}
// square of radius for intersection test
rsq = r*r;
irsq = rsq*ir*ir;
// inverted delta of radius squares for density function
inv_delta_irsq = 1.f / (irsq - rsq);
}
/*************
* DESCRIPTION: Ray/sphere intersection test
* INPUT: ray Pointer to actual ray
* OUTPUT: TRUE if hit else FALSE
*************/
#ifndef LOWLEVEL
BOOL SPHERE::RayIntersect(RAY *ray)
{
VECTOR adj;
float b, t, s;
STATISTIC(STAT_SPHERETEST);
// Translate ray origin to object space and negate everything.
// (Thus, we translate the sphere into ray space, which saves
// us a couple of negations below.)
VecSub(&pos, &ray->start, &adj);
// Solve quadratic equation.
b = adj.x * ray->dir.x + adj.y * ray->dir.y + adj.z * ray->dir.z;
t = b * b - adj.x * adj.x - adj.y * adj.y - adj.z * adj.z + rsq;
if (t < 0.f)
return FALSE;
t = sqrt(t);
s = b - t;
if(s > 0.f)
{
if(s < ray->lambda)
{
// Is our intersection nearer ?
ray->lambda = s;
ray->obj = this;
ray->enter = TRUE;
STATISTIC(STAT_SPHEREHIT);
return TRUE;
}
}
s = b + t;
if(s > 0.f)
{
if(s < ray->lambda)
{
// Is our intersection nearer ?
ray->lambda = s;
ray->obj = this;
ray->enter = FALSE;
STATISTIC(STAT_SPHEREHIT);
return TRUE;
}
}
return FALSE;
}
#endif
/*************
* DESCRIPTION: Compute normal to sphere at pos
* INPUT: dir direction vector
* hitpos hitposition
* nrm normal
* geon geometric normal
* OUTPUT: nrm is the normal at pos
*************/
void SPHERE::Normal(const VECTOR *dir, const VECTOR *hitpos, VECTOR *nrm, VECTOR *geon)
{
float rr;
rr = 1.f/r;
VecSubScaled(hitpos, rr, &this->pos, nrm);
VecNormalizeNoRet(nrm);
if(dotp(dir, nrm) > 0.f)
{
// flip normal
SetVector(nrm, -nrm->x, -nrm->y, -nrm->z);
}
*geon = *nrm;
}
/*************
* DESCRIPTION: compute density of sphere at position
* INPUT: hitpos position to compute density at
* OUTPUT: computed density (0 (outside) ... 1 (inside))
*************/
float SPHERE::Density(const VECTOR *hitpos)
{
float t;
VECTOR deltapos;
VecSub(hitpos, &pos, &deltapos);
t = deltapos.x*deltapos.x + deltapos.y*deltapos.y + deltapos.z*deltapos.z;
if(t > rsq)
return 0.f;
if(t < irsq)
return 1.f;
return (t - rsq) * inv_delta_irsq;
}
| 20.216981 | 87 | 0.570929 | privatosan |
5f8035b8a8b69fa7695f29d65a0bb23752b64a6c | 4,342 | cpp | C++ | svn_cvs_maps.cpp | BRL-CAD/repowork | d5180d99f1086614301cf4c3db44a2b2dd57ebb3 | [
"CC0-1.0"
] | null | null | null | svn_cvs_maps.cpp | BRL-CAD/repowork | d5180d99f1086614301cf4c3db44a2b2dd57ebb3 | [
"CC0-1.0"
] | null | null | null | svn_cvs_maps.cpp | BRL-CAD/repowork | d5180d99f1086614301cf4c3db44a2b2dd57ebb3 | [
"CC0-1.0"
] | null | null | null | /* S V N _ C V S _ M A P S . C P P
* BRL-CAD
*
* Published in 2020 by the United States Government.
* This work is in the public domain.
*
*/
/** @file svn_cvs_maps.cpp
*
* Utility functions
*
*/
#include <iostream>
#include <sstream>
#include <locale>
#include "repowork.h"
int
git_map_svn_committers(git_fi_data *s, std::string &svn_map)
{
// read map
std::ifstream infile(svn_map, std::ifstream::binary);
if (!infile.good()) {
std::cerr << "Could not open svn_map file: " << svn_map << "\n";
exit(-1);
}
// Create mapping of ids to svn committers
std::map<std::string, std::string> svn_committer_map;
std::string line;
while (std::getline(infile, line)) {
// Skip empty lines
if (!line.length()) {
continue;
}
size_t spos = line.find_first_of(" ");
if (spos == std::string::npos) {
std::cerr << "Invalid svn map line!: " << line << "\n";
exit(-1);
}
std::string id = line.substr(0, spos);
std::string committer = line.substr(spos+1, std::string::npos);
svn_committer_map[id] = committer;
}
// Iterate over the commits and assign committers.
for (size_t i = 0; i < s->commits.size(); i++) {
git_commit_data *c = &(s->commits[i]);
if (!c->svn_id.length()) {
continue;
}
if (svn_committer_map.find(c->svn_id) != svn_committer_map.end()) {
std::string svncommitter = svn_committer_map[c->svn_id];
//std::cerr << "Found SVN commit \"" << c->svn_id << "\" with committer \"" << svncommitter << "\"\n";
c->svn_committer = svncommitter;
}
}
return 0;
}
void
read_key_sha1_map(git_fi_data *s, std::string &keysha1file)
{
std::ifstream infile(keysha1file, std::ifstream::binary);
if (!infile.good()) {
std::cerr << "Could not open file: " << keysha1file << "\n";
exit(-1);
}
std::string line;
while (std::getline(infile, line)) {
if (!line.length()) continue;
size_t cpos = line.find_first_of(":");
std::string key = line.substr(0, cpos);
std::string sha1 = line.substr(cpos+1, std::string::npos);
s->sha12key[sha1] = key;
s->key2sha1[key] = sha1;
}
infile.close();
}
void
read_key_cvsbranch_map(
git_fi_data *s,
std::string &branchfile)
{
std::map<std::string, std::string> key2branch;
std::ifstream infile(branchfile, std::ifstream::binary);
if (!infile.good()) {
std::cerr << "Could not open file: " << branchfile << "\n";
exit(-1);
}
std::string line;
while (std::getline(infile, line)) {
if (!line.length()) continue;
size_t cpos = line.find_first_of(":");
std::string key = line.substr(0, cpos);
std::string branch = line.substr(cpos+1, std::string::npos);
if (key2branch.find(key) != key2branch.end()) {
std::string oldbranch = key2branch[key];
if (oldbranch != branch) {
std::cout << "WARNING: non-unique key maps to both branch " << oldbranch << " and branch " << branch << ", overriding\n";
}
}
if (s->key2sha1.find(key) != s->key2sha1.end()) {
s->key2cvsbranch[key] = branch;
}
}
infile.close();
}
void
read_key_cvsauthor_map( git_fi_data *s, std::string &authorfile)
{
std::map<std::string, std::string> key2author;
std::ifstream infile(authorfile, std::ifstream::binary);
if (!infile.good()) {
std::cerr << "Could not open file: " << authorfile << "\n";
exit(-1);
}
std::string line;
while (std::getline(infile, line)) {
if (!line.length()) continue;
size_t cpos = line.find_first_of(":");
std::string key = line.substr(0, cpos);
std::string author = line.substr(cpos+1, std::string::npos);
if (key2author.find(key) != key2author.end()) {
std::string oldauthor = key2author[key];
if (oldauthor != author) {
std::cout << "WARNING: non-unique key maps to both author " << oldauthor << " and author " << author << ", overriding\n";
}
}
if (s->key2sha1.find(key) != s->key2sha1.end()) {
s->key2cvsauthor[key] = author;
}
}
infile.close();
}
// Local Variables:
// tab-width: 8
// mode: C++
// c-basic-offset: 4
// indent-tabs-mode: t
// c-file-style: "stroustrup"
// End:
// ex: shiftwidth=4 tabstop=8
| 28.379085 | 138 | 0.582681 | BRL-CAD |
5f90a5d0bae7347086c89d5224405696f3c08cc5 | 1,890 | cpp | C++ | OOP/3-Examen2-EditorDeTexto_MFC/cascaronMFC_Clases.cpp | NestorJavier/Programacion_avanzada-Visual- | 1ccb8d41988d860689a6f8ef74bdd53da62c5214 | [
"MIT"
] | null | null | null | OOP/3-Examen2-EditorDeTexto_MFC/cascaronMFC_Clases.cpp | NestorJavier/Programacion_avanzada-Visual- | 1ccb8d41988d860689a6f8ef74bdd53da62c5214 | [
"MIT"
] | null | null | null | OOP/3-Examen2-EditorDeTexto_MFC/cascaronMFC_Clases.cpp | NestorJavier/Programacion_avanzada-Visual- | 1ccb8d41988d860689a6f8ef74bdd53da62c5214 | [
"MIT"
] | null | null | null | #include <afxwin.h>
int x = 88, y = 100, iEsp_x = 8;//La variable iEsp_x es el espacio que existe entre caracteres
RECT rWrk;
BOOL band = FALSE;
class CCascaron_Frame: public CFrameWnd
{
afx_msg void OnPaint();
afx_msg void OnLButtonDown(UINT, CPoint);
afx_msg void OnChar(UINT);
void Txt();
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CCascaron_Frame, CFrameWnd)//clase Marco
ON_WM_PAINT()
ON_WM_LBUTTONDOWN()
ON_WM_CHAR()
END_MESSAGE_MAP()
void CCascaron_Frame::OnPaint()
{
CPaintDC dc(this);
if(band)
{
dc.TextOut(50, 50, "Editor de texto");
dc.Rectangle(95, 99, 322, 200);
}
}
void CCascaron_Frame::OnChar(UINT nChar)
{
CDC *pDC = GetDC();
rWrk.top = 100;
rWrk.bottom = 198;
rWrk.left = 96;
rWrk.right = 320;
if(y < rWrk.bottom)
{
if(x < rWrk.right-iEsp_x)
{
if(y<rWrk.top)
y = 100;
switch(nChar)
{
case '\r':
x = 88;
y += 20;
break;
case '\b':
if(x == rWrk.left-iEsp_x)
{
y -= 20;
x = rWrk.right-iEsp_x*2;
pDC->TextOut(rWrk.right-iEsp_x, y, " ");
}
else
{
pDC->TextOut(x, y, " ");
x-=iEsp_x;
}
break;
default:
pDC->TextOut(x+=iEsp_x, y, nChar);
}
}
else
{
x = 88;
y = y + 20;
if(y<rWrk.bottom && nChar != '\b')
pDC->TextOut(x+=iEsp_x, y, nChar);
}
}
else
{
x = 88;
y = 100;
InvalidateRect(&rWrk, TRUE);
}
}
void CCascaron_Frame::OnLButtonDown(UINT f, CPoint p)
{
CClientDC pDC(this);
//x = p.x;
//y = p.y;
band = TRUE;
Invalidate();//parametros por default
}
class CCascaron_MFC: public CWinApp//Clase Aplicacion
{
virtual BOOL InitInstance()
{
//AfxMessageBox("Hola MFC");
CCascaron_Frame* pMarco = new CCascaron_Frame;
pMarco->Create(NULL, (CString)"Cascaron MFC");
m_pMainWnd = pMarco;
m_pMainWnd->ShowWindow(SW_SHOWNORMAL);
return TRUE;
}
};
CCascaron_MFC theApp; | 15.75 | 95 | 0.609524 | NestorJavier |
5f9771aec9cd438c59166fed0605f56a15800597 | 345 | cpp | C++ | Part1/Chapter4/L4-10.cpp | flics04/SSQCbook-Base-Luogu | c7ddbcfec58d6cc8f6396309daa8b511b6c8673d | [
"MIT"
] | null | null | null | Part1/Chapter4/L4-10.cpp | flics04/SSQCbook-Base-Luogu | c7ddbcfec58d6cc8f6396309daa8b511b6c8673d | [
"MIT"
] | null | null | null | Part1/Chapter4/L4-10.cpp | flics04/SSQCbook-Base-Luogu | c7ddbcfec58d6cc8f6396309daa8b511b6c8673d | [
"MIT"
] | null | null | null | #include <cstdio>
using namespace std;
int main() {
int k, coin = 0, day = 0;
scanf("%d", &k);
for (int i = 1; ; i++)
for (int j = 1; j <= i; j++) {
coin += i;
day++;
if (day == k) {
printf("%d\n", coin);
return 0;
}
}
return 0;
}
| 18.157895 | 38 | 0.33913 | flics04 |
5f9a5e72814144fcef9c26ddd06b1cfcae133bba | 323 | hpp | C++ | src/reir/exec/parser.hpp | large-scale-oltp-team/reir | 427db5f24e15f22cd2a4f4a716caf9392dae1d9b | [
"Apache-2.0"
] | 1 | 2020-03-04T10:57:14.000Z | 2020-03-04T10:57:14.000Z | src/reir/exec/parser.hpp | large-scale-oltp-team/reir | 427db5f24e15f22cd2a4f4a716caf9392dae1d9b | [
"Apache-2.0"
] | 3 | 2018-11-02T07:47:26.000Z | 2018-11-05T09:06:54.000Z | src/reir/exec/parser.hpp | large-scale-oltp-team/reir | 427db5f24e15f22cd2a4f4a716caf9392dae1d9b | [
"Apache-2.0"
] | null | null | null | #ifndef REIR_PARSER_HPP_
#define REIR_PARSER_HPP_
#include <cstdint>
#include <functional>
#include "ast_node.hpp"
namespace reir {
namespace node {
struct Statement;
}
class TokenStream;
void parse(const std::string& code, const std::function<void(node::Node*)>& fun);
} // namespace reir
#endif // REIR_PARSER_HPP_
| 17.944444 | 81 | 0.749226 | large-scale-oltp-team |
5f9e203d596e6853e6b15ab8f96df7e442eb99d4 | 672 | cpp | C++ | Maximum Erasure Value.cpp | chaitanyks/fuzzy-disco | bc52f779c68da3f259f116cc1f41c464db290fbf | [
"MIT"
] | 1 | 2021-12-12T05:55:44.000Z | 2021-12-12T05:55:44.000Z | Maximum Erasure Value.cpp | chaitanyks/fuzzy-disco | bc52f779c68da3f259f116cc1f41c464db290fbf | [
"MIT"
] | null | null | null | Maximum Erasure Value.cpp | chaitanyks/fuzzy-disco | bc52f779c68da3f259f116cc1f41c464db290fbf | [
"MIT"
] | null | null | null | // https://leetcode.com/problems/maximum-erasure-value/submissions/
// 1695. Maximum Erasure Value
class Solution {
public:
int maximumUniqueSubarray(vector<int>& nums) {
map<int,int> mp;
int n = nums.size();
int sum = 0;
int ans = 0;
int start = 0;
for(int i=0;i<n;i++)
{
while(mp[nums[i]] != 0)
{
sum -= nums[start];
mp[nums[start]]--;
start++;
}
mp[nums[i]]++;
sum += nums[i];
ans = max(ans, sum);
}
return ans;
}
};
| 22.4 | 67 | 0.397321 | chaitanyks |
5fa649938d8a96a259e807b92ad86adcff9d724a | 5,333 | hpp | C++ | OcularCore/include/Graphics/Mesh/MeshLoaders/OBJ/ResourceLoader_OBJ.hpp | ssell/OcularEngine | c80cc4fcdb7dd7ce48d3af330bd33d05312076b1 | [
"Apache-2.0"
] | 8 | 2017-01-27T01:06:06.000Z | 2020-11-05T20:23:19.000Z | OcularCore/include/Graphics/Mesh/MeshLoaders/OBJ/ResourceLoader_OBJ.hpp | ssell/OcularEngine | c80cc4fcdb7dd7ce48d3af330bd33d05312076b1 | [
"Apache-2.0"
] | 39 | 2016-06-03T02:00:36.000Z | 2017-03-19T17:47:39.000Z | OcularCore/include/Graphics/Mesh/MeshLoaders/OBJ/ResourceLoader_OBJ.hpp | ssell/OcularEngine | c80cc4fcdb7dd7ce48d3af330bd33d05312076b1 | [
"Apache-2.0"
] | 4 | 2019-05-22T09:13:36.000Z | 2020-12-01T03:17:45.000Z | /**
* Copyright 2014-2017 Steven T Sell (ssell@vertexfragment.com)
*
* 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.
*/
#pragma once
#ifndef __H__OCULAR_GRAPHICS_RESOURCE_LOADER_OBJ__H__
#define __H__OCULAR_GRAPHICS_RESOURCE_LOADER_OBJ__H__
#include "Resources/ResourceLoader.hpp"
#include "Graphics/Mesh/Vertex.hpp"
#include <vector>
//------------------------------------------------------------------------------------------
class OBJState;
class OBJGroup;
class OBJMaterial;
struct OBJFace;
struct OBJVertexGroup;
/**
* \addtogroup Ocular
* @{
*/
namespace Ocular
{
namespace Core
{
class MultiResource;
}
/**
* \addtogroup Graphics
* @{
*/
namespace Graphics
{
class Mesh;
class Material;
/**
* \class ResourceLoader_OBJ
*
* ResourceLoader implementation for the Wavefront OBJ geometric data file format.
*
* The OBJ file format can describe multiple individual meshes, and so this ResourceLoader
* creates and returns a MultiResource instance. In addition to the MultiResource, it also
* loads in each individual mesh as a Mesh resource.
*
* See the OBJImporter class for information on how to use an OBJ file in the Ocular Engne.
*/
class ResourceLoader_OBJ : public Core::AResourceLoader
{
public:
ResourceLoader_OBJ();
virtual ~ResourceLoader_OBJ();
/**
* Loads the entire OBJ file into memory and returns a pointer to the resulting MultiResource instance.
*
* \param[out] resource The MultiResource containing all subresource Meshes and Materials contained within the file.
* \param[in] file The OBJ file that is to be represented by the MultiResource.
*/
virtual bool loadResource(Core::Resource* &resource, Core::File const& file, std::string const& mappingName) override;
/**
* Loads a specific OBJ group as an individual Mesh resource.
*
* It should be noted that loading an individual group requires the full parsing of the OBJ file.
* Because of this, the entire MutliResource is loaded at once to prevent multiple calls to parse the same file.
*
* \param[out] resource The subresource loaded as an instance of Mesh.
* \param[in] file The OBJ file that the subresource is contained within.
* \param[in] mappingName Individual mapping name of the subresource. From this, the OBJ group name for the mesh is extracted.
*/
virtual bool loadSubResource(Core::Resource* &resource, Core::File const& file, std::string const& mappingName) override;
/**
* Catalogs a list of all groups in the specified OBJ file and records them as individual Mesh mappings.
*
* Ignores any group named 'default'.
*
* \param[in] file The OBJ file to explore.
*/
virtual bool exploreResource(Core::File const& file) override;
protected:
//------------------------------------------------------------
// Mesh Methods
//------------------------------------------------------------
void createMeshes(Core::MultiResource* multiResource);
void createMesh(Mesh* mesh, OBJGroup const* group);
void addFace(OBJFace const* face, std::vector<Vertex>* vertices, std::vector<uint32_t>* indices, Math::Vector3f& min, Math::Vector3f& max);
void faceToVertex(std::vector<Vertex>* vertices, OBJVertexGroup const& group, Math::Vector3f& min, Math::Vector3f& max);
//------------------------------------------------------------
// Material Methods
//------------------------------------------------------------
void createMaterials(Core::MultiResource* multiResource);
void createMaterial(Material* material, OBJMaterial const* objMaterial, std::string const& relPath);
//------------------------------------------------------------
// Misc Methods
//------------------------------------------------------------
bool isFileValid(Core::File const& file) const;
void splitParentSubNames(std::string const& mappingName, std::string& parent, std::string& sub) const;
private:
OBJState* m_CurrState;
};
}
/**
* @} End of Doxygen Groups
*/
}
/**
* @} End of Doxygen Groups
*/
//------------------------------------------------------------------------------------------
#endif | 37.556338 | 151 | 0.558785 | ssell |
5fa9dc24e222d9159975121ff0818a93c7e5bc50 | 1,125 | hpp | C++ | SW/_Tests/main.hpp | DF4IAH/DL0WH_BiTuner_Firmware | 1b5600dde4d955d3d7a422a4d98bc9bbbd231e82 | [
"MIT"
] | 3 | 2019-06-17T05:50:05.000Z | 2022-01-24T09:55:12.000Z | SW/_Tests/main.hpp | DF4IAH/DL0WH_BiTuner | 1b5600dde4d955d3d7a422a4d98bc9bbbd231e82 | [
"MIT"
] | null | null | null | SW/_Tests/main.hpp | DF4IAH/DL0WH_BiTuner | 1b5600dde4d955d3d7a422a4d98bc9bbbd231e82 | [
"MIT"
] | null | null | null | #ifndef _MAIN_H
#define _MAIN_H
#include <stdint.h>
#ifndef true
# define true 1U
#endif
#ifndef false
# define false 0U
#endif
typedef enum RtosMsgDefaultCmds_ENUM {
MsgDefault__InitDo = 0x01U,
MsgDefault__InitDone,
MsgDefault__SetVar01_IOs = 0x41U,
MsgDefault__SetVar02_Clocking,
MsgDefault__SetVar03_C_L_CV_CH,
//MsgDefault__GetVar01_x = 0x81U,
MsgDefault__CallFunc01_MCU_ADC1 = 0xc1U,
MsgDefault__CallFunc02_MCU_ADC3_VDIODE,
MsgDefault__CallFunc03_MCU_ADC2_FWD,
MsgDefault__CallFunc04_MCU_ADC2_REV,
} RtosMsgDefaultCmds_t;
void __disable_irq(void);
void __enable_irq(void);
void usbLog(char* buf);
void usbLogLen(char* buf, int lenusbLog);
void mainCalcFloat2IntFrac(float val, uint8_t fracCnt, int32_t* outInt, uint32_t* outFrac);
float mainCalc_fwdRev_mV(float adc_mv, float vdiode_mv);
float mainCalc_VSWR(float fwd, float rev);
float mainCalc_mV_to_mW(float mV);
uint32_t osKernelSysTick(void);
int main(int argc, char* argv[]);
#endif
| 21.634615 | 91 | 0.695111 | DF4IAH |
5fabbb09a718e911e854122360fbce0469cb0ed0 | 33,407 | cpp | C++ | Engine2D/BattleEngine.cpp | MarkusPfundstein/OpenGL-2D-RPG-Engine-iPhone | b9643e6a6243952f8e17f216a860e58b197e2247 | [
"Unlicense"
] | 2 | 2015-11-05T21:25:18.000Z | 2016-02-15T08:55:44.000Z | Engine2D/BattleEngine.cpp | MarkusPfundstein/OpenGL-2D-RPG-Engine-iPhone | b9643e6a6243952f8e17f216a860e58b197e2247 | [
"Unlicense"
] | null | null | null | Engine2D/BattleEngine.cpp | MarkusPfundstein/OpenGL-2D-RPG-Engine-iPhone | b9643e6a6243952f8e17f216a860e58b197e2247 | [
"Unlicense"
] | null | null | null | //
// BattleEngine.cpp
// Engine2D
//
// Created by Markus Pfundstein on 10/15/11.
// Copyright 2011 The Saints. All rights reserved.
//
#include <iostream>
#include <math.h>
#include <fstream>
using namespace std;
#include "BattleEngine.h"
#include "Gui.h"
#include "Texture2D.h"
#include "AnimatedSprite.h"
#include "Constants.h"
#include "Helpers.h"
#include "Player.h"
#include "Characters.h"
#include "Monster.h"
#include "Font.h"
#include "BattleHelpers.h"
#include "GameEngine.h"
#include "Inventory.h"
BattleEngine::BattleEngine(Font &_f, GameEngine &_e, Inventory &_i) : fontUsed(_f), engineUsed(_e), inventoryUsed(_i)
{
this->createBuffers();
this->playerUsed = NULL;
for (int i = 0; i < MAX_MONSTER_PER_BATTLE; i++)
monsters[i] = NULL;
Texture2D *battleTex = new Texture2D((char*)"battleGUI.png");
this->gui = new Sprite2D();
this->gui->loadData(*battleTex, 4, 4, 1, (char*)"battle GUI");
delete battleTex;
for (int i = 0; i < MENU_ITEMS_BATTLE; i++)
{
this->menuItems[i].isActive = true;
this->menuItems[i].texId = i;
this->menuItems[i].menuCode = (MENU_CODES)i;
}
}
BattleEngine::~BattleEngine()
{
// delete all memory allocated for background texture
glDeleteBuffers(1, &this->backgroundTBO);
glDeleteBuffers(1, &this->backgroundVBO);
Texture2D::delete_texture(this->gui->getTexture());
this->gui->delete_buffers();
delete this->gui;
}
void BattleEngine::clearMemory()
{
Texture2D::delete_texture(this->backgroundTexId);
this->charInFocus = NULL;
this->monsterInFocus = NULL;
this->playerUsed = NULL;
for (int i = 0; i < this->monstersInBattle; i++)
delete this->monsters[i], monsters[i] = NULL;
delete [] itemSelector, itemSelector = NULL;
}
bool BattleEngine::initializeBattle(Player &_player, const char* battleScript)
{
bool noError = true;
this->playerUsed = &_player;
// parse Battlescript
this->parseBattleScript(battleScript);
float xOffset = 10;
float yOffset = 60;
Point2D position = {350,80};
// initialize position for the characters
for (int i = 0; i < this->playerUsed->getNCharsInGroup(); i++)
{
Characters *c = &this->playerUsed->getCharacterAtPosition(i);
c->getSprite().setPos(position);
c->setIsMoving(false);
c->setActionPoints(10);
c->setIsAttacking(false);
Point2D weaponpos = c->getSprite().getRect().pos;
weaponpos.y += c->getSprite().getRect().height/2;
c->getWeaponSprite().setPos(weaponpos);
position.x += xOffset;
position.y += yOffset;
c = NULL;
}
this->reallocItems = false;
this->allocMemForItems();
bool playerStarts = true;
if (playerStarts)
this->playerTurn = true;
else
this->playerTurn = false;
this->currentBattleState = WAIT_FOR_INPUT;
this->charInFocus = NULL;
this->monsterInFocus = NULL;
this->setTimerBack();
this->isPaused = false;
this->valueChanged = 0;
this->itemCurrentlyUsed = NULL;
return noError;
}
void BattleEngine::allocMemForItems()
{
if (reallocItems)
{
delete [] itemSelector, itemSelector = NULL;
reallocItems = false;
}
float startX = 32;
Rect2D r = {startX,62,inventoryUsed.getItemSet().getRect().width,inventoryUsed.getItemSet().getRect().height};
int offsetX = r.width + r.width/2;
int offsetY = r.height + r.height/2;
int n = this->itemsInBattle = inventoryUsed.getItemsUsed();
this->itemSelector = new ItemSelector[n];
this->itemsDisplayed = 0; // <= only used to disable the item button when count is 0
// go through all the items the character has in inventory and create a rect for them
for (int i = 0; i < n; i++)
{
Item *t = &inventoryUsed.getItemsAtPosition(i);
if (t->getCollected())
{
itemSelector[i].rect = r;
itemSelector[i].selected = false;
r.pos.x += offsetX;
itemsDisplayed++;
if (itemsDisplayed%3==0)
{
r.pos.y += offsetY;
r.pos.x = startX;
}
}
t = NULL;
}
}
int BattleEngine::update()
{
int goOn = 1;
int i;
static int monstersDead = 0;
static int playersDead = 0;
if (this->playerTurn)
this->handlePlayers();
if (!this->playerTurn)
this->handleMonster();
// update characters
for (int i = 0; i < this->getPlayerUsed().getNCharsInGroup(); i++)
{
Characters *c = &this->getPlayerUsed().getCharacterAtPosition(i);
// if char is alive
if (c->getIsAlive())
{
// we check if his hitpoints are under 0
if (c->getHitpoints() <= 0 )
{
c->setIsAlive(false);
c->setHitpoints(0);
playersDead++;
}
// we check if he is defending
if (c->getIsDefending() && !c->getSprite().getIsAnimating())
{
// and NOT moving (attacking)
if (!c->getIsMoving())
c->getSprite().setAnimationState(ANI_STATE_DEF);
}
// alive+not moving = stand
// check if he is animating right now
else if (!c->getSprite().getIsAnimating())
c->getSprite().setAnimationState(ANI_STATE_STANDING);
// update position of spirte
c->getSprite().updateAnimationState();
// of weapon
c->getWeaponSprite().updateAnimationState();
}
else
{
// player is dead
c->getSprite().setAnimationState(ANI_STATE_DEAD);
}
c = NULL;
}
for (i = 0; i < this->monstersInBattle; i++)
{
// check monster if its still alive and increment the dead counter respectively
if (this->monsters[i]->getHitpoints()<=0 && this->monsters[i]->getIsAlive())
{
this->monsters[i]->setHitpoints(0);
this->monsters[i]->setIsAlive(false);
monstersDead++;
}
else
{
this->monsters[i]->getSprite().updateAnimationState();
}
}
// end battle if monsters dead equals the number of monsters in battle
if (monstersDead==this->monstersInBattle)
{
goOn = -1;
monstersDead = 0;
}
// same goes for characters
if (playersDead==this->playerUsed->getNCharsInGroup())
{
goOn = 0;
playersDead = 0;
}
if (timerIsOn)
timer++;
if (timer > this->timerSpeed)
{
this->setTimerBack();
this->isPaused = false;
}
return goOn;
}
void BattleEngine::handlePlayers()
{
// handle animations
if (this->charInFocus != NULL)
{
if (this->currentBattleState == WAIT_FOR_INPUT)
{
// set all menu items ALWAYS active again
for (int i = 0; i < MENU_ITEMS_BATTLE-1; i++)
menuItems[i].isActive = 1;
// and than check which one shall not be active
if (this->charInFocus->getActionpoints() < AP_ATTACK)
menuItems[ATTACK].isActive = false;
if (this->charInFocus->getActionpoints() < AP_DEFENSE || this->charInFocus->getIsDefending())
menuItems[DEFEND].isActive = false;
if (this->charInFocus->getActionpoints() < AP_MAGIC)
menuItems[MAGIC].isActive = false;
if (this->charInFocus->getActionpoints() < AP_ITEM || this->itemsDisplayed <= 0)
menuItems[ITEM].isActive = false;
}
// we have selected a player AND a monster AND are not waiting
if (this->monsterInFocus != NULL && !this->isPaused)
{
Rect2D t = this->charInFocus->getTargetRect();
// we update players position
// result = 1 means that the first location is reached , so the player is moving TOWARDS the monster
int result = this->charInFocus->updatePosition(this->charInFocus->getAttackType(), t, this->charInFocus->getIsAttacking(), 1, 1);
if (result==1)
{
// this is the moment when the player is at the enemy
this->isPaused = true;
this->charInFocus->setIsAttacking(false);
this->charInFocus->setTargetRect(rectMake(this->charInFocus->getOldPos().x, this->charInFocus->getOldPos().y, this->charInFocus->getSprite().getRect().width, this->charInFocus->getSprite().getRect().height));
this->charInFocus->setOldPos(this->charInFocus->getSprite().getRect().pos);
// let weapon animate
this->charInFocus->getWeaponSprite().setIsAnimating(true);
this->charInFocus->getWeaponSprite().setEndAnimationState(3);
this->charInFocus->getWeaponSprite().setAnimationSpeed(5);
this->charInFocus->getWeaponSprite().resetAfterEndAnimationStateIsReached(true);
// when the animation stops we call damagePlayerToMonster which will give the damage and animate the monster hurt
this->charInFocus->getWeaponSprite().setEndAnimationFunction(&BattleEngine::damagePlayerToMonster, *this);
// we let the engine wait for 60 frames
this->startTimer(60);
}
// player reached his original position
else if (result == 0)
{
this->monsterInFocus->getSprite().setAnimationState(0);
this->charInFocus->setIsMoving(false);
this->monsterInFocus = NULL;
}
}
}
}
void BattleEngine::handleMonster()
{
static int monstersWhoDidSth = 0;
// handle monster which turn it is
if (monsters[monstersWhoDidSth]->getIsAlive())
{
if ( !monsters[monstersWhoDidSth]->getFinishedWithTurn())
{
this->monsters[monstersWhoDidSth]->handleKI(*this);
monsters[monstersWhoDidSth]->updateMonster(*this);
}
else
monstersWhoDidSth++;
}
else
monstersWhoDidSth++;
// end battle if condition = true
if (monstersWhoDidSth == this->monstersInBattle)
{
monstersWhoDidSth = 0;
this->resetTurn();
}
}
void BattleEngine::resetTurn()
{
if (this->playerTurn)
{
this->playerTurn = false;
for (int i = 0; i < this->playerUsed->getNCharsInGroup(); i++)
{
// increase player action points
int ap = this->playerUsed->getCharacterAtPosition(i).getActionpoints();
ap += AP_GAIN_PER_TURN;
this->playerUsed->getCharacterAtPosition(i).setActionPoints(ap);
}
for (int i = 0; i < this->monstersInBattle; i++)
{
this->monsters[i]->setIsDefending(false);
}
return;
}
else if (!this->playerTurn)
{
this->playerTurn = true;
for (int i = 0; i < this->monstersInBattle; i++)
{
if (this->monsters[i]->getIsAlive())
{
this->monsters[i]->setFinishedWithTurn(false);
this->monsters[i]->setKi_set(false);
// increase monster action points
int ap = this->monsters[i]->getActionpoints();
ap += AP_GAIN_PER_TURN;
this->monsters[i]->setActionPoints(ap);
}
}
for (int i = 0; i <this->playerUsed->getNCharsInGroup(); i++)
{
this->playerUsed->getCharacterAtPosition(i).setIsDefending(false);
}
return;
}
}
void BattleEngine::handleInput(const Point2D &at_position)
{
if (this->playerTurn && !this->isPaused)
{
Point2D point = at_position;
if (this->currentBattleState == WAIT_FOR_INPUT)
{
if (this->charInFocus == NULL)
{
// check if player ends turn
if (isPointInRect(&point, &menuItems[END_TURN].rect))
{
this->resetTurn();
}
else
{
// check if player selects a char
Rect2D characterRect;
for(int i = 0; i < this->getPlayerUsed().getNCharsInGroup(); i++)
{
characterRect = this->getPlayerUsed().getCharacterAtPosition(i).getSprite().getRect();
if (isPointInRect(&point, &characterRect) && this->getPlayerUsed().getCharacterAtPosition(i).getIsAlive() && this->charInFocus == NULL)
{
this->charInFocus = &this->getPlayerUsed().getCharacterAtPosition(i);
}
}
}
}
// player selected a char aready
else
{
if (!this->charInFocus->getIsMoving())
{
// check for the menu items
for (int i = 0; i < MENU_ITEMS_BATTLE-1; i++)
{
if (isPointInRect(&point, &menuItems[i].rect) && menuItems[i].isActive)
{
switch (menuItems[i].menuCode)
{
case ATTACK:
this->currentBattleState = PLAYER_ATTACK;
break;
case MAGIC:
break;
case ITEM:
this->currentBattleState = PLAYER_ITEM;
break;
case DEFEND:
this->charInFocus->Defend();
this->charInFocus->getSprite().setAnimationState(ANI_STATE_DEF);
break;
case CANCEL:
this->freeCharInFocus();
this->currentBattleState = WAIT_FOR_INPUT;
break;
case END_TURN:
break;
}
}
}
}
}
}
// we are not in Wait for Input
else if (this->currentBattleState == PLAYER_ATTACK)
{
// cancel pressed
if (isPointInRect(&point, &menuItems[CANCEL].rect))
{
this->currentBattleState = WAIT_FOR_INPUT;
}
// clicked somewhere else
else
{
// clicks on monster
for (int i = 0; i < this->monstersInBattle; i++)
{
Rect2D monsterRect = this->monsters[i]->getSprite().getRect();
if (isPointInRect(&point, &monsterRect) && this->monsters[i]->getIsAlive())
{
if (this->currentBattleState == PLAYER_ATTACK && this->charInFocus->getActionpoints() >= AP_ATTACK)
{
// deduct action points needed for that action
int ap = this->charInFocus->getActionpoints();
ap -= AP_ATTACK;
this->charInFocus->setActionPoints(ap);
// set the monster in focus
this->monsterInFocus = this->monsters[i];
// set back to wait for input state
this->currentBattleState = WAIT_FOR_INPUT;
// set moving state, attacktype, save old Position and set target Coordinates
this->charInFocus->setIsMoving(true);
this->charInFocus->setAttackType(MELEE);
this->charInFocus->setOldPos(this->charInFocus->getSprite().getRect().pos);
this->charInFocus->setIsAttacking(true);
this->charInFocus->setTargetRect(this->monsterInFocus->getSprite().getRect());
this->charInFocus->getSprite().setAnimationState(ANI_STATE_STANDING);
}
}
}
}
}
else if (this->currentBattleState==PLAYER_ITEM || this->currentBattleState == ITEM_SELECTED)
{
if (this->currentBattleState == PLAYER_ITEM)
{
// cancel pressed
if (isPointInRect(&point, &menuItems[CANCEL].rect))
{
this->currentBattleState = WAIT_FOR_INPUT;
}
else
{
for (int i = 0; i < this->itemsInBattle; i++)
{
if (isPointInRect(&point, &itemSelector[i].rect))
{
if (inventoryUsed.getItemsAtPosition(i).getCollected())
{
this->currentBattleState = ITEM_SELECTED;
itemSelector[i].selected = true;
}
}
else
itemSelector[i].selected = false;
}
}
}
else if (this->currentBattleState == ITEM_SELECTED)
{
// cancel pressed
if (isPointInRect(&point, &menuItems[CANCEL].rect))
{
this->currentBattleState = PLAYER_ITEM;
for (int i = 0; i < this->itemsInBattle; i++)
itemSelector[i].selected = false;
}
else
{
Characters* temp = NULL;
// clicks on monster
for (int i = 0; i < this->monstersInBattle; i++)
{
Rect2D monsterRect = this->monsters[i]->getSprite().getRect();
if (isPointInRect(&point, &monsterRect) && this->monsters[i]->getIsAlive())
{
temp = static_cast<Characters*>(this->monsters[i]);
}
}
// clicks on characters
for (int i = 0; i < this->playerUsed->getNCharsInGroup(); i++)
{
Rect2D t = this->playerUsed->getCharacterAtPosition(i).getSprite().getRect();
if (isPointInRect(&point, &t))
temp = &this->playerUsed->getCharacterAtPosition(i);
}
// temp must be not NULL if player chose a target
if (temp != NULL)
{
for (int i = 0; i < itemsInBattle; i++)
{
if (itemSelector[i].selected)
{
Item *t = &inventoryUsed.getItemsAtPosition(i);
if (t->getNumberCollected()>0)
{
int ap = this->charInFocus->getActionpoints();
ap -= AP_ITEM;
this->charInFocus->setActionPoints(ap);
// NECESSARY!!!!
t->pointToTargetAndEngine(*temp, *this);
// adjust the pointer to the right adress
this->itemCurrentlyUsed = t;
// initialize animation
// reset has to be called before setAnimationState to reset to 0
this->charInFocus->getSprite().resetAfterEndAnimationStateIsReached(true);
this->charInFocus->getSprite().setIsAnimating(1);
this->charInFocus->getSprite().setAnimationSpeed(30);
this->charInFocus->getSprite().setAnimationState(5);
this->charInFocus->getSprite().setEndAnimationState(6);
// call the useItem function after the animation ends
this->charInFocus->getSprite().setEndAnimationFunction(&BattleEngine::useItem, *this);
this->startTimer(30);
this->isPaused = true;
this->currentBattleState = WAIT_FOR_INPUT;
}
t = NULL;
}
}
}
temp = NULL;
}
}
}
}
// not player turn, no input
else
return;
}
void BattleEngine::damagePlayerToMonster()
{
if (this->charInFocus != NULL && this->monsterInFocus != NULL)
{
this->lastvalueChanged = -giveDamageTo(*this->monsterInFocus, *this->charInFocus, this->charInFocus->getAttackType());
this->valueChanged = true;
this->pointOfValueChanged = this->monsterInFocus->getSprite().getRect().pos;
this->monsterInFocus->getSprite().setIsAnimating(true);
this->monsterInFocus->getSprite().setAnimationSpeed(2);
this->monsterInFocus->getSprite().setEndAnimationState(1);
this->monsterInFocus->getSprite().resetAfterEndAnimationStateIsReached(1);
}
}
void BattleEngine::useItem()
{
if (!itemCurrentlyUsed->use())
{
this->reallocItems = true;
// an item count reached 0, so we have to realloc everything
allocMemForItems();
}
itemCurrentlyUsed->freeTargetAndEngine();
itemCurrentlyUsed = NULL;
}
void BattleEngine::draw()
{
// first we draw the background
glBindBuffer(GL_ARRAY_BUFFER, this->backgroundVBO);
glVertexPointer(3, GL_FLOAT, 0, (char*)NULL);
glBindTexture(GL_TEXTURE_2D, this->backgroundTexId);
glBindBuffer(GL_ARRAY_BUFFER, this->backgroundTBO);
glTexCoordPointer(2, GL_FLOAT, 0, (void*)NULL);
glDisable(GL_BLEND);
glDrawArrays(GL_TRIANGLES, 0, 6);
glEnable(GL_BLEND);
int i;
// than the monsters
for (i = 0; i < this->monstersInBattle; i++)
{
if (this->monsters[i]->getIsAlive())
this->monsters[i]->getSprite().drawAnimated();
}
// than we draw the four characters
for (i = 0; i < this->playerUsed->getNCharsInGroup(); i++)
{
this->playerUsed->getCharacterAtPosition(i).getSprite().drawAnimated();
// and their weapons
this->playerUsed->getCharacterAtPosition(i).getWeaponSprite().drawAnimated();
}
// than we draw the damage
this->drawChangeInValue();
if (this->charInFocus != NULL)
{
if (!this->charInFocus->getIsMoving())
{
Rect2D tempRect = this->charInFocus->getSprite().getRect();
if (this->currentBattleState == WAIT_FOR_INPUT)
{
Point2D charaMidpoint = getMidpointOf(&tempRect);
this->drawMenuAround(charaMidpoint);
}
else if (this->currentBattleState == PLAYER_ATTACK)
{
// draw cancel menu to the right of the selected char
this->gui->setPos(menuItems[CANCEL].rect.pos);
this->gui->draw(CANCEL);
this->fontUsed.draw_string(180, 30, 1.0, 10, 0.8f, 0, 0.2f, 0.8f, "ATTACK: #CHOOSE TARGET");
}
else if (this->currentBattleState == PLAYER_ITEM)
{
Sprite2D *itemSet = &this->inventoryUsed.getItemSet();
// draw item menu as a grid
for (int i = 0; i < this->inventoryUsed.getItemsUsed(); i++)
{
Item *item = &this->inventoryUsed.getItemsAtPosition(i);
if (item->getCollected())
{
itemSet->setPos(this->itemSelector[i].rect.pos);
itemSet->draw(item->getTexId());
Point2D p = this->itemSelector[i].rect.pos;
p.x += itemSet->getRect().width-20;
p.y += itemSet->getRect().height-10;
this->fontUsed.draw_string(p.x, p.y, 1, 10, 1.0f, 1.0f, 1.0f, 1.0f, "%02d", item->getNumberCollected());
}
item = NULL;
}
this->gui->setPos(menuItems[CANCEL].rect.pos);
this->gui->draw(CANCEL);
itemSet = NULL;
}
else if (this->currentBattleState == ITEM_SELECTED)
{
this->gui->setPos(menuItems[CANCEL].rect.pos);
this->gui->draw(CANCEL);
this->fontUsed.draw_string(180, 30, 1.0, 10, 0.8f, 0, 0.2f, 0.8f, "ITEM: #CHOOSE TARGET");
}
this->fontUsed.draw_string(0, 0, 1.0, 10, 0.8f, 0, 0.2f, 0.8f, "%s HP:%d/%d MP:%d/%d LP:%d AP:%d", this->charInFocus->getSprite().getName(), this->charInFocus->getHitpoints(), this->charInFocus->getMaxHitpoints(), this->charInFocus->getManapoints(), this->charInFocus->getMaxManapoints(),this->charInFocus->getLimitpoints(), this->charInFocus->getActionpoints());
}
}
else
{
// Menu Item for ending a turn
if (this->playerTurn)
{
menuItems[END_TURN].rect = rectMake(400, 250, 64, 64);
this->gui->setPos(menuItems[END_TURN].rect.pos);
this->gui->draw(END_TURN);
}
}
if (SHOW_MONSTER_INFO)
{
float offset = 0;
for (int i = 0; i < this->monstersInBattle; i++)
{
this->fontUsed.draw_string(10, 220+offset, 1.0, 10, 0.8f, 0, 0.2f, 0.8f, "Monster:%d HP:%d/%d MP:%d/%d AP:%d", i, this->monsters[i]->getHitpoints(), this->monsters[i]->getMaxHitpoints(), this->monsters[i]->getManapoints(), this->monsters[i]->getManapoints(),this->monsters[i]->getActionpoints());
offset += 20;
}
}
}
void BattleEngine::drawChangeInValue()
{
static int Timer = 0;
static float alpha = 1.0f;
if (valueChanged)
{
Timer++;
// draw damage at pointOfValueChanged
float r;
float g;
float b;
if (this->lastvalueChanged >= 0)
{
r = 0.0f;
g = 1.0f;
b = 0.0f;
}
else if (this->lastvalueChanged == 0)
{
r = 0.0f;
g = 0.0f;
b = 0.0f;
}
else
{
r = 1.0f;
g = 0.0f;
b = 0.0f;
}
this->fontUsed.draw_string(pointOfValueChanged.x, pointOfValueChanged.y, 1.0, 10, r, g, b, alpha, "%d", this->lastvalueChanged);
// fancy animation
pointOfValueChanged.y--;
alpha -= 1/WAIT_TIME;
if (Timer>WAIT_TIME)
{
Timer=0;
valueChanged = 0;
alpha = 1.0f;
}
}
}
void BattleEngine::drawMenuAround(Point2D &_p)
{
Point2D t;
static const float radius = 62.0f;
int i;
float angle = 306.0f;
float offset_angle = 360/(MENU_ITEMS_BATTLE-1);
for (i = 0; i < MENU_ITEMS_BATTLE-1; i++)
{
t.x = _p.x + cosf(angle*PI/180.0f) * radius;
t.y = _p.y + sinf(angle*PI/180.0f) * radius;
t.x -= this->gui->getRect().width/2;
t.y -= this->gui->getRect().height/2;
this->gui->setPos(t);
if (!this->menuItems[i].isActive)
glColor4f(0.5f, 0.5f, 0.5f, 0.5f);
this->gui->draw(menuItems[i].texId);
if (!this->menuItems[i].isActive)
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
angle -= offset_angle;
this->menuItems[i].rect = rectMake(t.x, t.y, 64, 64);
}
}
void BattleEngine::startTimer(float time)
{
this->timerIsOn = true;
this->timerSpeed = time;
}
void BattleEngine::setTimerBack()
{
this->timerIsOn = false;
this->timer = 0;
}
void BattleEngine::freeCharInFocus()
{
this->charInFocus = NULL;
}
void BattleEngine::parseBattleScript(const char *filename)
{
const char* path = getPathFromIPhoneFile(filename);
char buffer[40];
memset(buffer, 0, 40);
ifstream inputFile;
inputFile.open(path);
// parsing.
//first we parse the texture to load
inputFile>>buffer;
// load texture for background
Texture2D *backTex = new Texture2D(buffer);
this->backgroundTexId = backTex->texture;
delete backTex;
// than we load all the enemys
// first we parse the number of enemys in this battle
inputFile>>buffer;
this->monstersInBattle = atoi(buffer);
Point2D monsterCoordinate;
// than we parse through all the monsters
for (int i = 0; i < this->monstersInBattle; i++)
{
this->monsters[i] = new Monster();
// first we parse the texture the monster will use
inputFile>>buffer;
Texture2D *tempTex = new Texture2D(buffer);
this->monsters[i]->create(*tempTex, 2, 1, buffer);
delete tempTex, tempTex = NULL;
// than the coordinates
inputFile>>buffer;
monsterCoordinate.x = atoi(buffer);
inputFile>>buffer;
monsterCoordinate.y = atoi(buffer);
this->monsters[i]->getSprite().setPos(monsterCoordinate);
// than the KI Flag
inputFile>>buffer;
KI_FLAG flagToSet = this->setFlagForMonster(buffer);
this->monsters[i]->setKI_Flag(flagToSet);
// than the hitpoints
inputFile>>buffer;
this->monsters[i]->setMaxHitpoints(atoi(buffer));
this->monsters[i]->setHitpoints(atoi(buffer));
// than the manapoints
inputFile>>buffer;
this->monsters[i]->setMaxManapoints(atoi(buffer));
this->monsters[i]->setManapoints(atoi(buffer));
// than the action points
inputFile>>buffer;
this->monsters[i]->setActionPoints(atoi(buffer));
// attack
inputFile>>buffer;
this->monsters[i]->setAttackStrength(atoi(buffer));
// defense
inputFile>>buffer;
this->monsters[i]->setDefense(atoi(buffer));
char monsterName[40];
memset(monsterName, 0, 40);
sprintf(monsterName, "Monster: %d", i);
this->monsters[i]->getSprite().setName(monsterName);
}
inputFile.close();
}
enum KI_FLAG BattleEngine::setFlagForMonster(const char *buffer)
{
if (strcmp(buffer, _KI_SCRIPT_KI_AGGRO)==0)
return KI_AGGRO;
else if (strcmp(buffer, _KI_SCRIPT_KI_DEFENSE)==0)
return KI_DEFENSE;
else
return STANDARD_FLAG;
}
void BattleEngine::createBuffers()
{
const GLfloat vertices[] = {
SCREEN_WIDTH_IPHONE, 0, 0,
0, 0, 0,
0, SCREEN_HEIGHT_IPHONE, 0,
0, SCREEN_HEIGHT_IPHONE, 0,
SCREEN_WIDTH_IPHONE, SCREEN_HEIGHT_IPHONE, 0,
SCREEN_WIDTH_IPHONE, 0, 0,
};
glGenBuffers(1, &this->backgroundVBO);
glBindBuffer(GL_ARRAY_BUFFER, this->backgroundVBO);
glBufferData(GL_ARRAY_BUFFER, 18*sizeof(GLfloat), vertices, GL_STATIC_DRAW);
const GLfloat texcoords[] = {
1, 0,
0, 0,
0, 1,
0, 1,
1, 1,
1, 0
};
glGenBuffers(1, &this->backgroundTBO);
glBindBuffer(GL_ARRAY_BUFFER, this->backgroundTBO);
glBufferData(GL_ARRAY_BUFFER, 48, texcoords, GL_STATIC_DRAW);
}
void BattleEngine::freeMonsterInFocus()
{
this->monsterInFocus = NULL;
}
Player& BattleEngine::getPlayerUsed() const
{
return *this->playerUsed;
}
bool BattleEngine::getPlayerTurn() const
{
return this->playerTurn;
}
void BattleEngine::setLastvalueChanged(int val)
{
this->lastvalueChanged = val;
}
void BattleEngine::setpointOfValueChanged(Point2D &p)
{
this->pointOfValueChanged = p;
}
void BattleEngine::setvalueChanged(bool val)
{
this->valueChanged = val;
}
| 33.847011 | 375 | 0.510612 | MarkusPfundstein |
5fb4518236edb66bdd16f90fec2d3393598043ee | 478 | cpp | C++ | src/test/BFCombinationFinderTest.cpp | simophin/game-matcher-qt | 706c94010216fb0d7d76e2428e5e907b4dd78372 | [
"MIT"
] | null | null | null | src/test/BFCombinationFinderTest.cpp | simophin/game-matcher-qt | 706c94010216fb0d7d76e2428e5e907b4dd78372 | [
"MIT"
] | null | null | null | src/test/BFCombinationFinderTest.cpp | simophin/game-matcher-qt | 706c94010216fb0d7d76e2428e5e907b4dd78372 | [
"MIT"
] | null | null | null | //
// Created by Fanchao Liu on 21/08/20.
//
#include <catch2/catch.hpp>
#include "BFCombinationFinder.h"
#include "MockGameStats.h"
TEST_CASE("BFCombinationFinder") {
SECTION("Should match levels when other factors are the same") {
MockGameStats gameStats;
gameStats.scorer = [] (auto) { return 0; };
BFCombinationFinder finder(2, gameStats);
finder.find({1, 2}, {
PlayerInfo(1, Member::Male, 1, false),
});
}
} | 21.727273 | 68 | 0.619247 | simophin |
5fbb97b02e314224a87840d1cf8f08d6f9f449aa | 374 | hpp | C++ | src/host/color.hpp | danieldeankon/hypertrace | d58a6ea28af45b875c477df4065667e9b4b88a49 | [
"MIT"
] | null | null | null | src/host/color.hpp | danieldeankon/hypertrace | d58a6ea28af45b875c477df4065667e9b4b88a49 | [
"MIT"
] | null | null | null | src/host/color.hpp | danieldeankon/hypertrace | d58a6ea28af45b875c477df4065667e9b4b88a49 | [
"MIT"
] | null | null | null | #pragma once
#include <cstdint>
#include <vec.hpp>
typedef vec<float, 3> color3;
color3 make_color(color3 c, float g=2.2f) {
return c.map([g](float x) { return pow(x, g); });
}
color3 make_color(uint32_t c, float g=2.2f) {
return make_color(color3(
float((c>>16)&0xFF)/0xFF,
float((c>>8)&0xFF)/0xFF,
float((c>>0)&0xFF)/0xFF
), g);
}
| 18.7 | 53 | 0.593583 | danieldeankon |
5fc843213af2742100beb146f604981d09286c99 | 1,165 | cpp | C++ | SurfaceReconstruction/SurfaceReconstruction/SurfaceExtraction/SphereNodeStatesChecker.cpp | pavelsevecek/TSR | ca411dedf178e5830f0536e361136f1e16751bc8 | [
"BSD-3-Clause"
] | 102 | 2017-10-17T10:10:59.000Z | 2022-01-19T02:10:29.000Z | SurfaceReconstruction/SurfaceReconstruction/SurfaceExtraction/SphereNodeStatesChecker.cpp | pavelsevecek/TSR | ca411dedf178e5830f0536e361136f1e16751bc8 | [
"BSD-3-Clause"
] | 2 | 2019-12-21T11:59:15.000Z | 2020-09-08T11:38:36.000Z | SurfaceReconstruction/SurfaceReconstruction/SurfaceExtraction/SphereNodeStatesChecker.cpp | pavelsevecek/TSR | ca411dedf178e5830f0536e361136f1e16751bc8 | [
"BSD-3-Clause"
] | 27 | 2017-10-18T09:37:34.000Z | 2022-03-22T01:30:51.000Z | /*
* Copyright (C) 2018 by Author: Aroudj, Samir
* TU Darmstadt - Graphics, Capture and Massively Parallel Computing
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the BSD 3-Clause license. See the License.txt file for details.
*/
#include "SurfaceReconstruction/Scene/Tree/Scope.h"
#include "SurfaceReconstruction/SurfaceExtraction/SphereNodeStatesChecker.h"
using namespace Math;
using namespace SurfaceReconstruction;
SphereNodeStatesChecker::SphereNodeStatesChecker(const Vector3 &sphereCenter, const Real sphereRadius, const uint32 maxDepth,
const uint32 *nodeStates, const uint32 requiredFlags) :
SphereNodesChecker(sphereCenter, sphereRadius, maxDepth), mNodeStates(nodeStates), mRequiredFlags(requiredFlags)
{
}
SphereNodeStatesChecker::~SphereNodeStatesChecker()
{
}
bool SphereNodeStatesChecker::isIgnored(const Scope &scope, const bool isLeaf, const uint32 depth) const
{
// ignore if there was no change
const uint32 state = mNodeStates[scope.getNodeIndex()];
if (mRequiredFlags != (mRequiredFlags & state))
return true;
return SphereNodesChecker::isIgnored(scope, isLeaf, depth);
} | 32.361111 | 125 | 0.791416 | pavelsevecek |
5fd283b66092e8ab33abbf0f4a12fc042c948d11 | 4,665 | cpp | C++ | OpenGLExample_02/OpenGLExample_02/main.cpp | SnowyLake/OpenGL_Learn | ae389cb45992eb90595482e0b4eca41b967e63b3 | [
"MIT"
] | 4 | 2020-11-27T14:20:28.000Z | 2022-03-12T03:11:04.000Z | OpenGLExample_02/OpenGLExample_02/main.cpp | SnowyLake/OpenGL_Learn | ae389cb45992eb90595482e0b4eca41b967e63b3 | [
"MIT"
] | null | null | null | OpenGLExample_02/OpenGLExample_02/main.cpp | SnowyLake/OpenGL_Learn | ae389cb45992eb90595482e0b4eca41b967e63b3 | [
"MIT"
] | null | null | null | #include<glad/glad.h>
#include<GLFW/glfw3.h>
#include<iostream>
void FramebufferSizeCallback(GLFWwindow* window, int width, int height);
void ProcessInput(GLFWwindow* window);
//setting
const unsigned int SCR_WIDTH = 800;
const unsigned int SCR_HEIGHT = 600;
const char* vertexShaderSource = "#version 330 core\n"
"layout(location = 0)in vec3 aPos;\n"
"void main()\n"
"{\n"
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
"}\n";
const char* fragmentShaderSource = "#version 330 core\n"
"out vec4 FragColor;\n"
"void main()\n"
"{\n"
" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
"}\n";
int main()
{
//glfw:initialize and configure
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
#ifdef _APPLE_
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
#endif // _APPLE_
//glfw:create window
GLFWwindow* window = glfwCreateWindow(SCR_WIDTH, SCR_HEIGHT, "LearnOpenGL", NULL, NULL);
if (window==NULL)
{
std::cout << "Failed to create GLFW window" << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
glfwSetFramebufferSizeCallback(window, FramebufferSizeCallback);
//glad
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress))
{
std::cout << "Failed to initialize GLAD" << std::endl;
return -1;
}
//----------shader program----------
//vertex shader
int vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexShaderSource, NULL);
glCompileShader(vertexShader);
//check for shader compile errors
int success;
char infoLog[512];
glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);
if (!success)
{
glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);
std::cout << "ERROR::SHADER::VERTEX::COMPILATION_FAILED\n" << infoLog << std::endl;
}
//fragment shader
int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
glCompileShader(fragmentShader);
//check for shader compile errors
glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);
if (!success)
{
glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);
std::cout << "ERROR::SHADER::FRAGMENT::COMPILATION_FAILED\n" << infoLog << std::endl;
}
//link shader
int shaderProgram = glCreateProgram();
glAttachShader(shaderProgram, vertexShader);
glAttachShader(shaderProgram, fragmentShader);
glLinkProgram(shaderProgram);
//check for linking errors
glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
if (!success)
{
glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);
std::cout << "ERROR::SHADER::PROGRAM::LINKING_FAILED\n" << infoLog << std::endl;
}
glDeleteShader(vertexShader);
glDeleteShader(fragmentShader);
//set up vertex data (and buffer(s)) and configure vertex attributes
float vertices[] = {
-0.5f, -0.5f, 0.0f, // left
0.5f, -0.5f, 0.0f, // right
0.0f, 0.5f, 0.0f // top
};
unsigned int VAO, VBO;
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
//bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
//safely unbind
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
//uncomment this call to draw in wireframe polygons.
//glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
//render loop
while (!glfwWindowShouldClose(window))
{
//input
ProcessInput(window);
//render
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
//draw triangle
glUseProgram(shaderProgram);
glBindVertexArray(VAO);
glDrawArrays(GL_TRIANGLES, 0, 3);
//glBindVertexArray(0);
//glfw: swap buffers and poll IO events (keys pressed/released, mouse moved etc.)
glfwSwapBuffers(window);
glfwPollEvents();
}
//optional: de-allocate all resources once they've outlived their purpose
glDeleteVertexArrays(1, &VAO);
glDeleteBuffers(1, &VBO);
//glfw:terminate
glfwTerminate();
return 0;
}
void ProcessInput(GLFWwindow* window)
{
if (glfwGetKey(window,GLFW_KEY_ESCAPE)==GLFW_PRESS)
{
glfwSetWindowShouldClose(window, true);
}
}
void FramebufferSizeCallback(GLFWwindow* window, int width, int height)
{
glViewport(0, 0, width, height);
} | 28.975155 | 116 | 0.707824 | SnowyLake |
5fd526fd32219d99e9086898fbe31d55fccdc997 | 2,394 | cpp | C++ | tc 160+/CakeDivision.cpp | ibudiselic/contest-problem-solutions | 88082981b4d87da843472e3ca9ed5f4c42b3f0aa | [
"BSD-2-Clause"
] | 3 | 2015-05-25T06:24:37.000Z | 2016-09-10T07:58:00.000Z | tc 160+/CakeDivision.cpp | ibudiselic/contest-problem-solutions | 88082981b4d87da843472e3ca9ed5f4c42b3f0aa | [
"BSD-2-Clause"
] | null | null | null | tc 160+/CakeDivision.cpp | ibudiselic/contest-problem-solutions | 88082981b4d87da843472e3ca9ed5f4c42b3f0aa | [
"BSD-2-Clause"
] | 5 | 2015-05-25T06:24:40.000Z | 2021-08-19T19:22:29.000Z | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <cstring>
using namespace std;
class CakeDivision {
public:
double ratio(double length, double width, int pieces) {
if (pieces == 1)
return max(length, width)/min(length, width);
double ret = 1e32;
for (int i=1; i<=pieces/2; ++i)
ret = min(
ret,
min(
max(ratio(length*i/pieces, width, i), ratio(length*(1-double(i)/pieces), width, pieces-i)),
max(ratio(length, width*i/pieces, i), ratio(length, width*(1-double(i)/pieces), pieces-i))
)
);
return ret;
}
// BEGIN CUT HERE
public:
void run_test(int Case) { if ((Case == -1) || (Case == 0)) test_case_0(); if ((Case == -1) || (Case == 1)) test_case_1(); if ((Case == -1) || (Case == 2)) test_case_2(); if ((Case == -1) || (Case == 3)) test_case_3(); if ((Case == -1) || (Case == 4)) test_case_4(); }
private:
template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); }
void verify_case(int Case, const double &Expected, const double &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: \"" << Expected << '\"' << endl; cerr << "\tReceived: \"" << Received << '\"' << endl; } }
void test_case_0() { int Arg0 = 2; int Arg1 = 3; int Arg2 = 6; double Arg3 = 1.0; verify_case(0, Arg3, ratio(Arg0, Arg1, Arg2)); }
void test_case_1() { int Arg0 = 5; int Arg1 = 5; int Arg2 = 5; double Arg3 = 1.8; verify_case(1, Arg3, ratio(Arg0, Arg1, Arg2)); }
void test_case_2() { int Arg0 = 333; int Arg1 = 333; int Arg2 = 9; double Arg3 = 1.0; verify_case(2, Arg3, ratio(Arg0, Arg1, Arg2)); }
void test_case_3() { int Arg0 = 500; int Arg1 = 1; int Arg2 = 10; double Arg3 = 50.0; verify_case(3, Arg3, ratio(Arg0, Arg1, Arg2)); }
void test_case_4() { int Arg0 = 950; int Arg1 = 430; int Arg2 = 9; double Arg3 = 1.2573099415204678; verify_case(4, Arg3, ratio(Arg0, Arg1, Arg2)); }
// END CUT HERE
};
// BEGIN CUT HERE
int main()
{
CakeDivision ___test;
___test.run_test(-1);
}
// END CUT HERE
| 39.245902 | 315 | 0.588972 | ibudiselic |
5fd5df8c3f9cce24b755a315de654f46d627b079 | 8,497 | cc | C++ | src/solvers/test/test_MGCoarseMeshPreconditioner.cc | baklanovp/libdetran | 820efab9d03ae425ccefb9520bdb6c086fdbf939 | [
"MIT"
] | 4 | 2015-03-07T16:20:23.000Z | 2020-02-10T13:40:16.000Z | src/solvers/test/test_MGCoarseMeshPreconditioner.cc | baklanovp/libdetran | 820efab9d03ae425ccefb9520bdb6c086fdbf939 | [
"MIT"
] | 3 | 2018-02-27T21:24:22.000Z | 2020-12-16T00:56:44.000Z | src/solvers/test/test_MGCoarseMeshPreconditioner.cc | baklanovp/libdetran | 820efab9d03ae425ccefb9520bdb6c086fdbf939 | [
"MIT"
] | 9 | 2015-03-07T16:20:26.000Z | 2022-01-29T00:14:23.000Z | //----------------------------------*-C++-*-----------------------------------//
/**
* @file test_MGCoarseMeshPreconditioner.cc
* @brief Test of MGCoarseMeshPreconditioner
* @note Copyright(C) 2012-2013 Jeremy Roberts
*/
//----------------------------------------------------------------------------//
// LIST OF TEST FUNCTIONS
#define TEST_LIST \
FUNC(test_MGCoarseMeshPreconditioner_no_condense) \
FUNC(test_MGCoarseMeshPreconditioner_space) \
FUNC(test_MGCoarseMeshPreconditioner_energy) \
FUNC(test_MGCoarseMeshPreconditioner_space_energy)
#include "TestDriver.hh"
#include "solvers/mg/MGCoarseMeshPreconditioner.hh"
#include "callow/utils/Initialization.hh"
#include "solvers/test/fixedsource_fixture.hh"
using namespace detran_test;
using namespace detran;
using namespace detran_utilities;
using namespace callow;
using namespace std;
using std::cout;
using std::endl;
#define COUT(c) cout << c << endl;
int main(int argc, char *argv[])
{
callow_initialize(argc, argv);
RUN(argc, argv);
callow_finalize();
}
/// Dummy preconditioner
class TestPC: public MGCoarseMeshPreconditioner
{
public:
TestPC(SP_input input,
SP_material material,
SP_mesh mesh)
: MGCoarseMeshPreconditioner(input, material, mesh,
SP_scattersource(0), SP_fissionsource(0), 0, false, false, "testpc")
, d_phi(35, 1.0)
{
for (int g = 0; g < 7; ++g)
for (int i = 0; i < 5; ++i)
d_phi[5*g+i] = g+1;
}
void apply(Vector &b, Vector &x){}
SP_matrix R(){return d_restrict;}
SP_matrix P(){return d_prolong;}
Vector &phi(){return d_phi;}
void build(const double keff = 1.0, SP_state state = SP_state(0))
{
MGCoarseMeshPreconditioner::build(1.0);
}
private:
Vector d_phi;
};
//----------------------------------------------------------------------------//
// TEST DEFINITIONS
//----------------------------------------------------------------------------//
/*
* This tests the restriction and prolongation matrices directly to ensure
* they each represent identity matrices of full dimension.
*/
int test_MGCoarseMeshPreconditioner_no_condense(int argc, char *argv[])
{
FixedSourceData data = get_fixedsource_data(1, 7);
// No condensation, so P = R = I.
vec_int f_per_c(7, 1);
data.input->put<int>("mgpc_coarse_mesh_level", 1);
data.input->put<vec_int>("mgpc_fine_per_coarse_group", f_per_c);
TestPC pc(data.input, data.material, data.mesh);
pc.build();
TEST(pc.R()->number_columns() == 35);
TEST(pc.R()->number_rows() == 35);
TEST(pc.P()->number_columns() == 35);
TEST(pc.P()->number_rows() == 35);
TEST(pc.R()->number_nonzeros() == 35);
TEST(pc.P()->number_nonzeros() == 35);
for (int i = 0; i < 35; ++i)
{
for (int j = 0; j < 35; ++j)
{
TEST(soft_equiv(i == j ? 1.0 : 0.0, (*pc.R())(i, j)));
TEST(soft_equiv(i == j ? 1.0 : 0.0, (*pc.P())(i, j)));
}
}
return 0;
}
/*
* This tests condensation in space (1-D). The fine mesh has 5 cells,
* and we use a level 2. This implies the following mapping:
* fine: [0 1 2 3 4]
* coarse: [0 0 0 1 1]
* The flux starts as [1 1 1 1 1 2 2 ... 7 7 7 7 7]
* and condenses to [1 1 2 2 ... 7 7]
*/
int test_MGCoarseMeshPreconditioner_space(int argc, char *argv[])
{
FixedSourceData data = get_fixedsource_data(1, 7);
// mesh condensation, level 2 = [3, 2]
vec_int f_per_c(7, 1);
data.input->put<int>("mgpc_coarse_mesh_level", 2);
data.input->put<vec_int>("mgpc_fine_per_coarse_group", f_per_c);
TestPC pc(data.input, data.material, data.mesh);
//pc.R()->display(true);
pc.R()->print_matlab("R.out");
COUT("lala");
pc.build();
pc.R()->print_matlab("R.out");
COUT("lala");
//pc.P()->display(true);
pc.P()->print_matlab("P.out");
TEST(pc.R()->number_columns() == 35);
TEST(pc.R()->number_rows() == 14);
TEST(pc.P()->number_columns() == 14);
TEST(pc.P()->number_rows() == 35);
Vector phi_c(14, 0.0);
for (int g = 0; g < 7; ++g)
for (int i = 0; i < 2; ++i)
phi_c[2 * g + i] = g + 1;
Vector tmp_c(14, 0.0);
pc.R()->multiply(pc.phi(), tmp_c);
for (int i = 0; i < 14; ++i)
{
//DISP(phi_c[i] << " " << tmp_c[i]);
TEST(soft_equiv(phi_c[i], tmp_c[i]));
}
Vector tmp_f(35, 0.0);
pc.P()->multiply(tmp_c, tmp_f);
for (int i = 0; i < 35; ++i)
{
//DISP(pc.phi()[i] << " " << tmp_f[i]);
TEST(soft_equiv(pc.phi()[i], tmp_f[i]));
}
return 0;
}
/*
* This tests condensation in space (1-D). The fine mesh has 5 cells,
* and we use a level 2. This implies the following mapping:
* fine: [0 1 2 3 4]
* coarse: [0 0 0 1 1]
* The flux starts as [1 1 1 1 1 2 2 ... 7 7 7 7 7]
* and condenses to [1 1 2 2 ... 7 7]
*/
int test_MGCoarseMeshPreconditioner_energy(int argc, char *argv[])
{
FixedSourceData data = get_fixedsource_data(1, 7);
// Linear energy spectrum and key
vec_dbl spectrum(7, 0.0);
for (int i = 0; i < 7; ++i)
spectrum[i] = (double)(i+1) * 0.084515425472852;
std::string spectrum_key = "ALL";
vec_int spectrum_map(data.mesh->number_cells(), 0);
data.mesh->add_mesh_map(spectrum_key, spectrum_map);
// Mapping with [0 1 2 | 3 4 5 6] -> [0 | 1]
//vec_int f_per_c(2, 3); f_per_c[1] = 4;
vec_int f_per_c(1, 7);
data.input->put<vec_int>("mgpc_fine_per_coarse_group", f_per_c);
// Using our own spectrum
data.input->put<int>("mgpc_condensation_option", 5);
data.input->put<vec_dbl>("mgpc_spectrum", spectrum);
data.input->put<string>("mgpc_spectrum_key", spectrum_key);
// No coarse meshing in space
data.input->put<int>("mgpc_coarse_mesh_level", 1);
TestPC pc(data.input, data.material, data.mesh);
pc.R()->print_matlab("R.out");
COUT("lala");
pc.build();
pc.R()->print_matlab("R.out");
COUT("lala");
//pc.P()->display(true);
pc.P()->print_matlab("P.out");
return 0;
TEST(pc.R()->number_columns() == 35);
TEST(pc.R()->number_rows() == 14);
TEST(pc.P()->number_columns() == 14);
TEST(pc.P()->number_rows() == 35);
Vector phi_c(14, 0.0);
for (int g = 0; g < 7; ++g)
for (int i = 0; i < 2; ++i)
phi_c[2 * g + i] = g + 1;
Vector tmp_c(14, 0.0);
pc.R()->multiply(pc.phi(), tmp_c);
//
// for (int i = 0; i < 14; ++i)
// {
// //DISP(phi_c[i] << " " << tmp_c[i]);
// TEST(soft_equiv(phi_c[i], tmp_c[i]));
// }
// Vector tmp_f(35, 0.0);
// pc.P()->multiply(tmp_c, tmp_f);
// for (int i = 0; i < 35; ++i)
// {
// //DISP(pc.phi()[i] << " " << tmp_f[i]);
// TEST(soft_equiv(pc.phi()[i], tmp_f[i]));
// }
return 0;
}
/*
* This tests condensation in space (1-D) and energy. The fine mesh has
* 5 cells, and we use a level 2. This implies the following mapping:
* fine: [0 1 2 3 4]
* coarse: [0 0 0 1 1]
* In energy, we go from [0 1 2 3 4 5 6] to [0 0 0 1 1 1 1].
* The flux starts as [1 1 1 1 1 2 2 ... 7 7 7 7 7]
* and condenses to [6 6 22 22]
* where 6 = 1+2+3 and 22 = 4+5+6+7
*/
int test_MGCoarseMeshPreconditioner_space_energy(int argc, char *argv[])
{
FixedSourceData data = get_fixedsource_data(1, 7);
// energy and mesh condensation
vec_int f_per_c(2, 3);
f_per_c[1] = 4;
vec_int reg_map(5, 0);
data.mesh->add_mesh_map("REGION", reg_map);
data.input->put<int>("mgpc_coarse_mesh_level", 2);
data.input->put<vec_int>("mgpc_fine_per_coarse_group", f_per_c);
vec_dbl spectrum(7, 0.0);
for (int g = 0; g < 7; ++g)
spectrum[g] = g + 1;
data.input->put<vec_dbl>("mgpc_spectrum", spectrum);
data.input->put<std::string>("mgpc_spectrum_key", "REGION");
data.input->put<int>("mgpc_condensation_option",
TestPC::CONDENSE_WITH_USER_SPECTRUM);
TestPC pc(data.input, data.material, data.mesh);
pc.build();
TEST(pc.R()->number_columns() == 35);
TEST(pc.R()->number_rows() == 4);
TEST(pc.P()->number_columns() == 4);
TEST(pc.P()->number_rows() == 35);
double phi_c[] =
{ 6, 6, 22, 22 };
Vector tmp_c(4, 0.0);
pc.R()->multiply(pc.phi(), tmp_c);
for (int i = 0; i < 4; ++i)
{
TEST(soft_equiv(phi_c[i], tmp_c[i]));
}
Vector tmp_f(35, 0.0);
pc.P()->multiply(tmp_c, tmp_f);
for (int i = 0; i < 35; ++i)
{
TEST(soft_equiv(pc.phi()[i], tmp_f[i]));
}
return 0;
}
//----------------------------------------------------------------------------//
// end of test_MGCoarseMeshPreconditioner.cc
//----------------------------------------------------------------------------//
| 30.024735 | 80 | 0.573497 | baklanovp |
5fd68c3e900a0c4d8b6c1d5bb5b5cb9d03e0a8cc | 2,797 | cpp | C++ | src/VM/SrcFile.cpp | cstanze/blossom | 2be90c6f16897a2acc1c40dad933a973e1ef2f57 | [
"MIT"
] | 3 | 2021-08-16T22:22:02.000Z | 2021-11-15T02:39:38.000Z | src/VM/SrcFile.cpp | cstanze/blossom | 2be90c6f16897a2acc1c40dad933a973e1ef2f57 | [
"MIT"
] | 1 | 2021-09-27T19:22:37.000Z | 2022-03-29T12:41:24.000Z | src/VM/SrcFile.cpp | cstanze/blossom | 2be90c6f16897a2acc1c40dad933a973e1ef2f57 | [
"MIT"
] | null | null | null | #include "VM/SrcFile.hpp"
#include "Common/FS.hpp"
#include <cstdarg>
static size_t src_id() {
static size_t sid = 0;
return sid++;
}
namespace blossom {
SrcFile::SrcFile(const std::string &dir, const std::string &path,
const bool is_main)
: m_id(src_id()), m_dir(dir), m_path(path), m_is_main(is_main) {}
Errors SrcFile::load_file() {
FILE *fp;
char *line = NULL;
size_t len = 0;
ssize_t read;
fp = fopen(m_path.c_str(), "r");
if (fp == NULL) {
fprintf(stderr, "failed to open source file: %s\n", m_path.c_str());
return E_FILE_IO;
}
size_t prefix_idx = m_data.size();
std::string code;
std::vector<src_col_range_t> cols;
size_t begin, end;
while ((read = getline(&line, &len, fp)) != -1) {
begin = code.size();
code += line;
end = code.size();
cols.push_back({prefix_idx + begin, prefix_idx + end});
}
fclose(fp);
if (line)
free(line);
if (code.empty()) {
fprintf(stderr, "encountered empty file: %s\n", m_path.c_str());
return E_FILE_EMPTY;
}
add_data(code);
add_cols(cols);
return E_OK;
}
void SrcFile::add_data(const std::string &data) { m_data += data; }
void SrcFile::add_cols(const std::vector<src_col_range_t> &cols) {
m_cols.insert(m_cols.end(), cols.begin(), cols.end());
}
void SrcFile::fail(const size_t &idx, const char *msg, ...) const {
va_list vargs;
va_start(vargs, msg);
fail(idx, msg, vargs);
va_end(vargs);
}
void SrcFile::fail(const size_t &idx, const char *msg, va_list vargs) const {
size_t line, col_begin, col_end, col;
bool found = false;
for (size_t i = 0; i < m_cols.size(); ++i) {
if (idx >= m_cols[i].begin && idx < m_cols[i].end) {
line = i;
col_begin = m_cols[i].begin;
col_end = m_cols[i].end;
col = idx - col_begin;
found = true;
break;
}
}
if (!found && !m_is_bytecode_loaded) {
fprintf(stderr, "could not find error: ");
vfprintf(stderr, msg, vargs);
fprintf(stderr, "\n");
fprintf(stderr, "in file: %s, with index: %zu\n", m_path.c_str(), idx);
return;
}
fprintf(stderr,
"%s:%zu:%zu: error: ", FS::relativePath(m_path, m_dir).c_str(),
line + 1, col + 1);
vfprintf(stderr, msg, vargs);
fprintf(stderr, "\n");
if (m_is_bytecode_loaded) return; // no source code available
std::string err_line = m_data.substr(col_begin, col_end - col_begin);
if (err_line.back() == '\n')
err_line.pop_back();
fprintf(stderr, "%s\n", err_line.c_str());
std::string spcs;
int tab_count = 0;
for (auto &ch : err_line) {
if (ch == '\t')
++tab_count;
}
for (int i = 0; i < tab_count; ++i)
spcs += '\t';
for (int i = 0; i < col - tab_count; ++i) {
spcs += " ";
}
fprintf(stderr, "%s^\n", spcs.c_str());
}
}
| 24.321739 | 77 | 0.600286 | cstanze |
5fdd44a50eb725cb9e0e8dfcd55cf16818fb2420 | 1,632 | cpp | C++ | code_blocks/check-rshillma/main.cpp | NewYaroslav/xtechnical_analysis | f81431cc5b36a9f3a4c561e0502e84310a3e0b2a | [
"MIT"
] | 12 | 2020-01-20T14:22:18.000Z | 2022-01-26T04:41:36.000Z | code_blocks/check-rshillma/main.cpp | NewYaroslav/xtechnical_analysis | f81431cc5b36a9f3a4c561e0502e84310a3e0b2a | [
"MIT"
] | 1 | 2020-05-23T07:35:03.000Z | 2020-05-23T07:35:03.000Z | code_blocks/check-rshillma/main.cpp | NewYaroslav/xtechnical_analysis | f81431cc5b36a9f3a4c561e0502e84310a3e0b2a | [
"MIT"
] | 9 | 2019-11-02T19:01:55.000Z | 2021-07-08T21:51:44.000Z | #include <iostream>
#include "xtechnical_indicators.hpp"
#include <array>
int main() {
std::cout << "Hello world!" << std::endl;
std::array<double, 20> test_data = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
xtechnical_indicators::RSHILLMA<double, xtechnical_indicators::SMA<double>, xtechnical_indicators::SMA<double>> iRSHILLMA(5, 10, 100, 1.5);
for(size_t j = 0; j < 100; ++j)
for(size_t i = 0; i < test_data.size(); ++i) {
iRSHILLMA.update(test_data[i]);
}
for(size_t i = 0; i < test_data.size(); ++i) {
iRSHILLMA.update(test_data[i]);
std::cout
<< "update " << test_data[i]
<< " get " << iRSHILLMA.get()
<< std::endl;
}
/* проверяем методы тест */
std::cout << "test(20)" << std::endl;
iRSHILLMA.test(20);
std::cout << "get " << iRSHILLMA.get() << std::endl;
std::cout << "test(21)" << std::endl;
iRSHILLMA.test(21);
std::cout << "get " << iRSHILLMA.get() << std::endl;
std::cout << "test(10)" << std::endl;
iRSHILLMA.test(10);
std::cout << "get " << iRSHILLMA.get() << std::endl;
for(size_t i = test_data.size() - 1; i > 0; --i) {
iRSHILLMA.update(test_data[i]);
std::cout
<< "update " << test_data[i]
<< " get " << iRSHILLMA.get()
<< std::endl;
}
for(size_t i = 0; i < test_data.size(); ++i) {
iRSHILLMA.update(test_data[i]);
std::cout
<< "update " << test_data[i]
<< " get " << iRSHILLMA.get()
<< std::endl;
}
std::system("pause");
return 0;
}
| 28.631579 | 143 | 0.517157 | NewYaroslav |
5fe830a02f7555bbe8f394a1bb29c65f03e1d68e | 4,595 | cpp | C++ | lab5.cpp | Jaymeet2003/CS-141 | f9b1d6023cfdc0582f403b536e693924d2ebcd36 | [
"BSD-3-Clause"
] | null | null | null | lab5.cpp | Jaymeet2003/CS-141 | f9b1d6023cfdc0582f403b536e693924d2ebcd36 | [
"BSD-3-Clause"
] | null | null | null | lab5.cpp | Jaymeet2003/CS-141 | f9b1d6023cfdc0582f403b536e693924d2ebcd36 | [
"BSD-3-Clause"
] | null | null | null | /*
Author:Jaymeet Patel
UIN: 656971609
System: Windows VSCode
Course: CS 141 Lab 5
*/
#include <iostream>
using namespace std;
// Display the board using an array and length N of the array
void displayBoard(char arr[], int N){
// HINT: use a loop to iterate through the array
// N IS IMPORTANT
// Split the board into three different parts, TOP, MIDDLE, BOTTOM=
// CODE HERE
cout << "-------" << endl;
for (int i = 1; i < N+1; ++i){
cout << "|" << arr[i-1];
if ( (i % 3) == 0) {
cout << "|" << endl;
cout << "-------" << endl;
}
}
}
// Here you will need to take in the array as input and update it using reference parameters
// You were provided the function please enter the missing parameters and complete the function.
void makeMove(char arr[], char piece, int position){
// CODE HERE
arr[position - 1] = piece;
}
// Check whether the move position entered is valid, returning true or false.
// Receive parameters for the move position and all the board pieces.
// If the intended destination is already occupied or the selected
// move position is not between 1..9 (inclusive) then return false.
// *** In the line below supply the return type and any needed parameters and uncomment it.
// Please enter the parameters you feel are needed for this function as they are not provided for you
bool moveIsValid(char arr[], int pos){
// CODE HERE
if ( arr[pos -1] != ' '){
return false;
}
else if ( (arr[pos - 1] < 1) && (arr[pos - 1] > 9)){
return false;
}
else {
return true;
}
}
// This function returns whether a player has won or not
// Please enter the parameters you feel are needed for this function as they are not provided for you
bool thereIsAWin(char arr[], char piece){
// if winning condition found then set win = true
bool win = false;
// CODE HERE
if (((arr[0] == piece) && (arr[1] == piece) && (arr[2] == piece)) ||
((arr[3] == piece) && (arr[4] == piece) && (arr[5] == piece)) ||
((arr[6] == piece) && (arr[7] == piece) && (arr[8] == piece)) ||
((arr[0] == piece) && (arr[3] == piece) && (arr[6] == piece)) ||
((arr[1] == piece) && (arr[4] == piece) && (arr[7] == piece)) ||
((arr[2] == piece) && (arr[5] == piece) && (arr[8] == piece)) ||
((arr[0] == piece) && (arr[4] == piece) && (arr[8] == piece)) ||
((arr[2] == piece) && (arr[4] == piece) && (arr[6] == piece))){
win = true;
}
return win;
}
int main(){
// N is the length of the char array given
int N = 9;
char arr[N] = {' ',' ',' ',' ',' ',' ',' ',' ',' ' };
// Initializing the different game variables
char pieceToMove = 'X';
int moveNumber = 0;
int position;
cout << "Welcome to the TicTacToe game! \n"
<< "Take turns entering the move destination (1..9) \n"
<< "or '0' (zero) to exit."
<< endl;
while(moveNumber <= 9){
// DisplayBoard is already given to you parameterized please use those parameters
displayBoard(arr, N);
// Prompt for and get move.
cout << moveNumber << ". Enter the move (1..9) for " << pieceToMove << ": ";
cin >> position; // the position at which the move is made
// See if 0 was entered, indicating the desire to exit the program
if( position == 0) {
// 0 was entered. Break out of enclosing loop, to exit the program.
break;
}
//**** PLEASE UN-COMMENT THE CODE BELOW TO GET THE VALID MOVE WORKING WITH YOUR PARAMETERS ****
if(!moveIsValid( arr, position)) {
cout << "That move is not valid. Retry.";
continue;
}
//**** PLEASE UNCOMMENT AND FIX THE FUNCTION WITH YOUR PARAMETERS****
makeMove( arr, pieceToMove, position );
// *** Add any needed parameters below to function thereIsAWin(...) *****
if(thereIsAWin( arr, pieceToMove )) { // if win was detected then the game stops
// After a win again display the board.
displayBoard(arr, N);
cout << endl
<< "Congratulations player " << pieceToMove << ". You WON!" << endl;
break;
}
// Change to the other piece for next move.
if( pieceToMove == 'X') {
pieceToMove = 'O';
}
else {
pieceToMove = 'X';
}
moveNumber++;
}
cout << "Exiting program..." << endl;
return 0;
}
| 16.648551 | 102 | 0.54951 | Jaymeet2003 |
5ff3632019c0c03cbfcc51f40f86d7fef71a5e97 | 1,023 | cpp | C++ | src/templates.cpp | zrzw/learn-cpp | ca3f8af734ad585fb836b571e02765226ba9428d | [
"Unlicense"
] | null | null | null | src/templates.cpp | zrzw/learn-cpp | ca3f8af734ad585fb836b571e02765226ba9428d | [
"Unlicense"
] | null | null | null | src/templates.cpp | zrzw/learn-cpp | ca3f8af734ad585fb836b571e02765226ba9428d | [
"Unlicense"
] | null | null | null | #include <iostream>
#include <stdexcept>
template <typename T>
class Stack{
public:
explicit Stack(std::initializer_list<T> il)
: sz{il.size()}
{
elem = new T[sz];
stack_ptr = sz-1;
size_t i=0;
for(auto& a: il){
elem[i++] = a;
}
}
~Stack() { delete[] elem; }
Stack(Stack& r) : sz{r.sz}, stack_ptr{r.stack_ptr}
{
for(size_t i=0; i<sz; ++i){
elem[i] = r.elem[i];
}
}
Stack(Stack&& r) : sz{r.sz}, stack_ptr{r.stack_ptr}
{
elem = r.elem;
r.elem = nullptr;
}
Stack& operator=(Stack&&); //not implemented
T pop(){
if(stack_ptr >= 0)
return elem[stack_ptr--];
throw std::out_of_range{"elem"};
}
private:
T* elem;
size_t sz;
size_t stack_ptr;
};
int main(){
Stack<int> s1 {1, 2, 4, 8, 16, 32};
std::cout << s1.pop() << std::endl;
Stack<int> s2 = std::move(s1);
std::cout << s2.pop() << std::endl;
return 0;
}
| 21.3125 | 55 | 0.488759 | zrzw |
5ff46d34ef45bda092dec4e3c003288f9310a734 | 792 | cpp | C++ | leetcode/linked_list/merge_sorted_list.cpp | codingpotato/algorithm-cpp | 793dc9e141000f48ea19c77ef0047923a7667358 | [
"MIT"
] | null | null | null | leetcode/linked_list/merge_sorted_list.cpp | codingpotato/algorithm-cpp | 793dc9e141000f48ea19c77ef0047923a7667358 | [
"MIT"
] | null | null | null | leetcode/linked_list/merge_sorted_list.cpp | codingpotato/algorithm-cpp | 793dc9e141000f48ea19c77ef0047923a7667358 | [
"MIT"
] | null | null | null | #include <doctest/doctest.h>
#include "list.h"
#include "verify.h"
// 21. Merge Two Sorted Lists
class Solution {
public:
ListNode* mergeTwoLists(ListNode* l1, ListNode* l2) {
ListNode dummy;
auto current = &dummy;
while (l1 && l2) {
if (l1->val <= l2->val) {
current->next = l1;
current = current->next;
l1 = l1->next;
} else {
current->next = l2;
current = current->next;
l2 = l2->next;
}
}
if (l1) {
current->next = l1;
} else {
current->next = l2;
}
return dummy.next;
}
};
TEST_CASE("Merge Two Sorted Lists") {
Solution s;
List list1{1, 2, 4};
List list2{1, 3, 4};
auto head = s.mergeTwoLists(list1.head, list2.head);
verify_list(head, {1, 1, 2, 3, 4, 4});
}
| 20.307692 | 55 | 0.545455 | codingpotato |
5ff73cb480bfc3269a2764df67e006225e5b9d8c | 236,523 | cc | C++ | src/protos/Docflow/DocflowV3.pb.cc | ltitbe/diadocsdk-cpp | 2f375a8ee6660a02ebf1b7917995e016dace96ef | [
"MIT"
] | 7 | 2016-05-31T17:37:54.000Z | 2022-01-17T14:28:18.000Z | src/protos/Docflow/DocflowV3.pb.cc | ltitbe/diadocsdk-cpp | 2f375a8ee6660a02ebf1b7917995e016dace96ef | [
"MIT"
] | 22 | 2017-02-07T09:34:02.000Z | 2021-09-06T08:08:34.000Z | src/protos/Docflow/DocflowV3.pb.cc | ltitbe/diadocsdk-cpp | 2f375a8ee6660a02ebf1b7917995e016dace96ef | [
"MIT"
] | 23 | 2016-06-07T06:11:47.000Z | 2020-10-06T13:00:21.000Z | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Docflow/DocflowV3.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "Docflow/DocflowV3.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace Diadoc {
namespace Api {
namespace Proto {
namespace Docflow {
namespace {
const ::google::protobuf::Descriptor* DocflowV3_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
DocflowV3_reflection_ = NULL;
const ::google::protobuf::Descriptor* SenderTitleDocflow_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SenderTitleDocflow_reflection_ = NULL;
const ::google::protobuf::Descriptor* ConfirmationDocflow_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ConfirmationDocflow_reflection_ = NULL;
const ::google::protobuf::Descriptor* SignatureRejectionDocflow_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SignatureRejectionDocflow_reflection_ = NULL;
const ::google::protobuf::Descriptor* ParticipantResponseDocflow_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ParticipantResponseDocflow_reflection_ = NULL;
const ::google::protobuf::Descriptor* AmendmentRequestDocflow_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AmendmentRequestDocflow_reflection_ = NULL;
const ::google::protobuf::Descriptor* RevocationDocflowV3_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
RevocationDocflowV3_reflection_ = NULL;
const ::google::protobuf::Descriptor* RevocationRequestDocflow_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
RevocationRequestDocflow_reflection_ = NULL;
const ::google::protobuf::Descriptor* RevocationResponseDocflow_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
RevocationResponseDocflow_reflection_ = NULL;
const ::google::protobuf::Descriptor* ReceiptDocflowV3_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ReceiptDocflowV3_reflection_ = NULL;
const ::google::protobuf::Descriptor* OuterDocflow_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
OuterDocflow_reflection_ = NULL;
const ::google::protobuf::Descriptor* OuterDocflowEntities_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
OuterDocflowEntities_reflection_ = NULL;
const ::google::protobuf::Descriptor* StatusEntity_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
StatusEntity_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_Docflow_2fDocflowV3_2eproto() {
protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"Docflow/DocflowV3.proto");
GOOGLE_CHECK(file != NULL);
DocflowV3_descriptor_ = file->message_type(0);
static const int DocflowV3_offsets_[13] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, sendertitle_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, confirmation_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, proxyresponse_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, recipientreceipt_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, recipientresponse_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, amendmentrequest_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, revocation_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, senderreceipt_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, resolution_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, resolutionentities_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, outerdocflows_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, outerdocflowentities_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, docflowstatus_),
};
DocflowV3_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
DocflowV3_descriptor_,
DocflowV3::default_instance_,
DocflowV3_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocflowV3, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(DocflowV3));
SenderTitleDocflow_descriptor_ = file->message_type(1);
static const int SenderTitleDocflow_offsets_[6] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SenderTitleDocflow, isfinished_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SenderTitleDocflow, attachment_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SenderTitleDocflow, sentat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SenderTitleDocflow, deliveredat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SenderTitleDocflow, roamingnotification_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SenderTitleDocflow, sendersignaturestatus_),
};
SenderTitleDocflow_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
SenderTitleDocflow_descriptor_,
SenderTitleDocflow::default_instance_,
SenderTitleDocflow_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SenderTitleDocflow, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SenderTitleDocflow, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(SenderTitleDocflow));
ConfirmationDocflow_descriptor_ = file->message_type(2);
static const int ConfirmationDocflow_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ConfirmationDocflow, isfinished_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ConfirmationDocflow, confirmationattachment_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ConfirmationDocflow, confirmedat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ConfirmationDocflow, receipt_),
};
ConfirmationDocflow_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ConfirmationDocflow_descriptor_,
ConfirmationDocflow::default_instance_,
ConfirmationDocflow_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ConfirmationDocflow, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ConfirmationDocflow, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ConfirmationDocflow));
SignatureRejectionDocflow_descriptor_ = file->message_type(3);
static const int SignatureRejectionDocflow_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureRejectionDocflow, signaturerejection_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureRejectionDocflow, isformal_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureRejectionDocflow, deliveredat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureRejectionDocflow, plaintext_),
};
SignatureRejectionDocflow_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
SignatureRejectionDocflow_descriptor_,
SignatureRejectionDocflow::default_instance_,
SignatureRejectionDocflow_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureRejectionDocflow, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SignatureRejectionDocflow, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(SignatureRejectionDocflow));
ParticipantResponseDocflow_descriptor_ = file->message_type(4);
static const int ParticipantResponseDocflow_offsets_[7] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, isfinished_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, signature_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, title_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, rejection_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, sentat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, deliveredat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, responsestatus_),
};
ParticipantResponseDocflow_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ParticipantResponseDocflow_descriptor_,
ParticipantResponseDocflow::default_instance_,
ParticipantResponseDocflow_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ParticipantResponseDocflow, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ParticipantResponseDocflow));
AmendmentRequestDocflow_descriptor_ = file->message_type(5);
static const int AmendmentRequestDocflow_offsets_[8] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, isfinished_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, amendmentrequest_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, sentat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, deliveredat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, receipt_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, amendmentflags_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, plaintext_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, confirmationdocflow_),
};
AmendmentRequestDocflow_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
AmendmentRequestDocflow_descriptor_,
AmendmentRequestDocflow::default_instance_,
AmendmentRequestDocflow_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AmendmentRequestDocflow, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(AmendmentRequestDocflow));
RevocationDocflowV3_descriptor_ = file->message_type(6);
static const int RevocationDocflowV3_offsets_[7] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, isfinished_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, revocationrequest_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, revocationresponse_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, initiatorboxid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, revocationstatus_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, resolutionentities_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, outerdocflowentities_),
};
RevocationDocflowV3_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
RevocationDocflowV3_descriptor_,
RevocationDocflowV3::default_instance_,
RevocationDocflowV3_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationDocflowV3, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(RevocationDocflowV3));
RevocationRequestDocflow_descriptor_ = file->message_type(7);
static const int RevocationRequestDocflow_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationRequestDocflow, revocationrequest_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationRequestDocflow, sentat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationRequestDocflow, deliveredat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationRequestDocflow, roamingnotification_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationRequestDocflow, plaintext_),
};
RevocationRequestDocflow_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
RevocationRequestDocflow_descriptor_,
RevocationRequestDocflow::default_instance_,
RevocationRequestDocflow_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationRequestDocflow, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationRequestDocflow, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(RevocationRequestDocflow));
RevocationResponseDocflow_descriptor_ = file->message_type(8);
static const int RevocationResponseDocflow_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationResponseDocflow, recipientsignature_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationResponseDocflow, signaturerejection_),
};
RevocationResponseDocflow_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
RevocationResponseDocflow_descriptor_,
RevocationResponseDocflow::default_instance_,
RevocationResponseDocflow_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationResponseDocflow, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(RevocationResponseDocflow, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(RevocationResponseDocflow));
ReceiptDocflowV3_descriptor_ = file->message_type(9);
static const int ReceiptDocflowV3_offsets_[6] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReceiptDocflowV3, isfinished_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReceiptDocflowV3, receiptattachment_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReceiptDocflowV3, sentat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReceiptDocflowV3, deliveredat_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReceiptDocflowV3, confirmation_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReceiptDocflowV3, status_),
};
ReceiptDocflowV3_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ReceiptDocflowV3_descriptor_,
ReceiptDocflowV3::default_instance_,
ReceiptDocflowV3_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReceiptDocflowV3, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReceiptDocflowV3, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ReceiptDocflowV3));
OuterDocflow_descriptor_ = file->message_type(10);
static const int OuterDocflow_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflow, docflownamedid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflow, parententityid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflow, outerdocflowentityid_),
};
OuterDocflow_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
OuterDocflow_descriptor_,
OuterDocflow::default_instance_,
OuterDocflow_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflow, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflow, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(OuterDocflow));
OuterDocflowEntities_descriptor_ = file->message_type(11);
static const int OuterDocflowEntities_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflowEntities, docflownamedid_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflowEntities, docflowfriendlyname_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflowEntities, statusentities_),
};
OuterDocflowEntities_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
OuterDocflowEntities_descriptor_,
OuterDocflowEntities::default_instance_,
OuterDocflowEntities_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflowEntities, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(OuterDocflowEntities, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(OuterDocflowEntities));
StatusEntity_descriptor_ = file->message_type(12);
static const int StatusEntity_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StatusEntity, attachment_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StatusEntity, status_),
};
StatusEntity_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
StatusEntity_descriptor_,
StatusEntity::default_instance_,
StatusEntity_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StatusEntity, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(StatusEntity, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(StatusEntity));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_Docflow_2fDocflowV3_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
DocflowV3_descriptor_, &DocflowV3::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SenderTitleDocflow_descriptor_, &SenderTitleDocflow::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ConfirmationDocflow_descriptor_, &ConfirmationDocflow::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SignatureRejectionDocflow_descriptor_, &SignatureRejectionDocflow::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ParticipantResponseDocflow_descriptor_, &ParticipantResponseDocflow::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AmendmentRequestDocflow_descriptor_, &AmendmentRequestDocflow::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
RevocationDocflowV3_descriptor_, &RevocationDocflowV3::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
RevocationRequestDocflow_descriptor_, &RevocationRequestDocflow::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
RevocationResponseDocflow_descriptor_, &RevocationResponseDocflow::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ReceiptDocflowV3_descriptor_, &ReceiptDocflowV3::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
OuterDocflow_descriptor_, &OuterDocflow::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
OuterDocflowEntities_descriptor_, &OuterDocflowEntities::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
StatusEntity_descriptor_, &StatusEntity::default_instance());
}
} // namespace
void protobuf_ShutdownFile_Docflow_2fDocflowV3_2eproto() {
delete DocflowV3::default_instance_;
delete DocflowV3_reflection_;
delete SenderTitleDocflow::default_instance_;
delete SenderTitleDocflow_reflection_;
delete ConfirmationDocflow::default_instance_;
delete ConfirmationDocflow_reflection_;
delete SignatureRejectionDocflow::default_instance_;
delete SignatureRejectionDocflow_reflection_;
delete ParticipantResponseDocflow::default_instance_;
delete ParticipantResponseDocflow_reflection_;
delete AmendmentRequestDocflow::default_instance_;
delete AmendmentRequestDocflow_reflection_;
delete RevocationDocflowV3::default_instance_;
delete RevocationDocflowV3_reflection_;
delete RevocationRequestDocflow::default_instance_;
delete RevocationRequestDocflow_reflection_;
delete RevocationResponseDocflow::default_instance_;
delete RevocationResponseDocflow_reflection_;
delete ReceiptDocflowV3::default_instance_;
delete ReceiptDocflowV3_reflection_;
delete OuterDocflow::default_instance_;
delete OuterDocflow_reflection_;
delete OuterDocflowEntities::default_instance_;
delete OuterDocflowEntities_reflection_;
delete StatusEntity::default_instance_;
delete StatusEntity_reflection_;
}
void protobuf_AddDesc_Docflow_2fDocflowV3_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::Diadoc::Api::Proto::protobuf_AddDesc_Timestamp_2eproto();
::Diadoc::Api::Proto::Documents::protobuf_AddDesc_Documents_2fDocument_2eproto();
::Diadoc::Api::Proto::Docflow::protobuf_AddDesc_Docflow_2fAttachmentV3_2eproto();
::Diadoc::Api::Proto::Docflow::protobuf_AddDesc_Docflow_2fRoamingNotification_2eproto();
::Diadoc::Api::Proto::Docflow::protobuf_AddDesc_Docflow_2fResolutionDocflowV3_2eproto();
::Diadoc::Api::Proto::protobuf_AddDesc_OuterDocflowStatus_2eproto();
::Diadoc::Api::Proto::protobuf_AddDesc_DocflowStatusV3_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\027Docflow/DocflowV3.proto\022\030Diadoc.Api.Pr"
"oto.Docflow\032\017Timestamp.proto\032\030Documents/"
"Document.proto\032\032Docflow/AttachmentV3.pro"
"to\032!Docflow/RoamingNotification.proto\032!D"
"ocflow/ResolutionDocflowV3.proto\032\030OuterD"
"ocflowStatus.proto\032\025DocflowStatusV3.prot"
"o\"\240\007\n\tDocflowV3\022A\n\013SenderTitle\030\001 \002(\0132,.D"
"iadoc.Api.Proto.Docflow.SenderTitleDocfl"
"ow\022C\n\014Confirmation\030\002 \001(\0132-.Diadoc.Api.Pr"
"oto.Docflow.ConfirmationDocflow\022K\n\rProxy"
"Response\030\013 \001(\01324.Diadoc.Api.Proto.Docflo"
"w.ParticipantResponseDocflow\022D\n\020Recipien"
"tReceipt\030\004 \001(\0132*.Diadoc.Api.Proto.Docflo"
"w.ReceiptDocflowV3\022O\n\021RecipientResponse\030"
"\005 \001(\01324.Diadoc.Api.Proto.Docflow.Partici"
"pantResponseDocflow\022K\n\020AmendmentRequest\030"
"\006 \001(\01321.Diadoc.Api.Proto.Docflow.Amendme"
"ntRequestDocflow\022A\n\nRevocation\030\007 \001(\0132-.D"
"iadoc.Api.Proto.Docflow.RevocationDocflo"
"wV3\022A\n\rSenderReceipt\030\010 \001(\0132*.Diadoc.Api."
"Proto.Docflow.ReceiptDocflowV3\022A\n\nResolu"
"tion\030\t \001(\0132-.Diadoc.Api.Proto.Docflow.Re"
"solutionDocflowV3\022J\n\022ResolutionEntities\030"
"\n \001(\0132..Diadoc.Api.Proto.Docflow.Resolut"
"ionEntitiesV3\022=\n\rOuterDocflows\030\014 \003(\0132&.D"
"iadoc.Api.Proto.Docflow.OuterDocflow\022L\n\024"
"OuterDocflowEntities\030\r \003(\0132..Diadoc.Api."
"Proto.Docflow.OuterDocflowEntities\0228\n\rDo"
"cflowStatus\030\016 \002(\0132!.Diadoc.Api.Proto.Doc"
"flowStatusV3\"\347\002\n\022SenderTitleDocflow\022\022\n\nI"
"sFinished\030\001 \002(\010\022@\n\nAttachment\030\002 \002(\0132,.Di"
"adoc.Api.Proto.Docflow.SignedAttachmentV"
"3\022+\n\006SentAt\030\003 \001(\0132\033.Diadoc.Api.Proto.Tim"
"estamp\0220\n\013DeliveredAt\030\004 \001(\0132\033.Diadoc.Api"
".Proto.Timestamp\022J\n\023RoamingNotification\030"
"\005 \001(\0132-.Diadoc.Api.Proto.Docflow.Roaming"
"Notification\022P\n\025SenderSignatureStatus\030\006 "
"\002(\01621.Diadoc.Api.Proto.Documents.SenderS"
"ignatureStatus\"\346\001\n\023ConfirmationDocflow\022\022"
"\n\nIsFinished\030\001 \002(\010\022L\n\026ConfirmationAttach"
"ment\030\002 \001(\0132,.Diadoc.Api.Proto.Docflow.Si"
"gnedAttachmentV3\0220\n\013ConfirmedAt\030\003 \001(\0132\033."
"Diadoc.Api.Proto.Timestamp\022;\n\007Receipt\030\004 "
"\001(\0132*.Diadoc.Api.Proto.Docflow.ReceiptDo"
"cflowV3\"\274\001\n\031SignatureRejectionDocflow\022H\n"
"\022SignatureRejection\030\001 \002(\0132,.Diadoc.Api.P"
"roto.Docflow.SignedAttachmentV3\022\020\n\010IsFor"
"mal\030\002 \002(\010\0220\n\013DeliveredAt\030\003 \001(\0132\033.Diadoc."
"Api.Proto.Timestamp\022\021\n\tPlainText\030\004 \001(\t\"\233"
"\003\n\032ParticipantResponseDocflow\022\022\n\nIsFinis"
"hed\030\001 \002(\010\0228\n\tSignature\030\002 \001(\0132%.Diadoc.Ap"
"i.Proto.Docflow.SignatureV3\022;\n\005Title\030\003 \001"
"(\0132,.Diadoc.Api.Proto.Docflow.SignedAtta"
"chmentV3\022F\n\tRejection\030\004 \001(\01323.Diadoc.Api"
".Proto.Docflow.SignatureRejectionDocflow"
"\022+\n\006SentAt\030\005 \001(\0132\033.Diadoc.Api.Proto.Time"
"stamp\0220\n\013DeliveredAt\030\006 \001(\0132\033.Diadoc.Api."
"Proto.Timestamp\022K\n\016ResponseStatus\030\007 \002(\0162"
"3.Diadoc.Api.Proto.Documents.RecipientRe"
"sponseStatus\"\210\003\n\027AmendmentRequestDocflow"
"\022\022\n\nIsFinished\030\001 \002(\010\022F\n\020AmendmentRequest"
"\030\002 \001(\0132,.Diadoc.Api.Proto.Docflow.Signed"
"AttachmentV3\022+\n\006SentAt\030\003 \001(\0132\033.Diadoc.Ap"
"i.Proto.Timestamp\0220\n\013DeliveredAt\030\004 \001(\0132\033"
".Diadoc.Api.Proto.Timestamp\022;\n\007Receipt\030\005"
" \001(\0132*.Diadoc.Api.Proto.Docflow.ReceiptD"
"ocflowV3\022\026\n\016AmendmentFlags\030\006 \002(\005\022\021\n\tPlai"
"nText\030\007 \001(\t\022J\n\023ConfirmationDocflow\030\010 \001(\013"
"2-.Diadoc.Api.Proto.Docflow.Confirmation"
"Docflow\"\303\003\n\023RevocationDocflowV3\022\022\n\nIsFin"
"ished\030\001 \002(\010\022M\n\021RevocationRequest\030\002 \002(\01322"
".Diadoc.Api.Proto.Docflow.RevocationRequ"
"estDocflow\022O\n\022RevocationResponse\030\003 \001(\01323"
".Diadoc.Api.Proto.Docflow.RevocationResp"
"onseDocflow\022\026\n\016InitiatorBoxId\030\004 \002(\t\022F\n\020R"
"evocationStatus\030\005 \002(\0162,.Diadoc.Api.Proto"
".Documents.RevocationStatus\022J\n\022Resolutio"
"nEntities\030\006 \001(\0132..Diadoc.Api.Proto.Docfl"
"ow.ResolutionEntitiesV3\022L\n\024OuterDocflowE"
"ntities\030\007 \003(\0132..Diadoc.Api.Proto.Docflow"
".OuterDocflowEntities\"\241\002\n\030RevocationRequ"
"estDocflow\022G\n\021RevocationRequest\030\001 \002(\0132,."
"Diadoc.Api.Proto.Docflow.SignedAttachmen"
"tV3\022+\n\006SentAt\030\002 \001(\0132\033.Diadoc.Api.Proto.T"
"imestamp\0220\n\013DeliveredAt\030\003 \001(\0132\033.Diadoc.A"
"pi.Proto.Timestamp\022J\n\023RoamingNotificatio"
"n\030\004 \001(\0132-.Diadoc.Api.Proto.Docflow.Roami"
"ngNotification\022\021\n\tPlainText\030\005 \001(\t\"\257\001\n\031Re"
"vocationResponseDocflow\022A\n\022RecipientSign"
"ature\030\001 \001(\0132%.Diadoc.Api.Proto.Docflow.S"
"ignatureV3\022O\n\022SignatureRejection\030\002 \001(\01323"
".Diadoc.Api.Proto.Docflow.SignatureRejec"
"tionDocflow\"\325\002\n\020ReceiptDocflowV3\022\022\n\nIsFi"
"nished\030\001 \002(\010\022G\n\021ReceiptAttachment\030\002 \001(\0132"
",.Diadoc.Api.Proto.Docflow.SignedAttachm"
"entV3\022+\n\006SentAt\030\003 \001(\0132\033.Diadoc.Api.Proto"
".Timestamp\0220\n\013DeliveredAt\030\004 \001(\0132\033.Diadoc"
".Api.Proto.Timestamp\022C\n\014Confirmation\030\005 \001"
"(\0132-.Diadoc.Api.Proto.Docflow.Confirmati"
"onDocflow\022@\n\006Status\030\006 \002(\01620.Diadoc.Api.P"
"roto.Documents.GeneralReceiptStatus\"\\\n\014O"
"uterDocflow\022\026\n\016DocflowNamedId\030\001 \002(\t\022\026\n\016P"
"arentEntityId\030\002 \002(\t\022\034\n\024OuterDocflowEntit"
"yId\030\003 \002(\t\"\213\001\n\024OuterDocflowEntities\022\026\n\016Do"
"cflowNamedId\030\001 \002(\t\022\033\n\023DocflowFriendlyNam"
"e\030\002 \002(\t\022>\n\016StatusEntities\030\003 \003(\0132&.Diadoc"
".Api.Proto.Docflow.StatusEntity\"z\n\014Statu"
"sEntity\022@\n\nAttachment\030\001 \002(\0132,.Diadoc.Api"
".Proto.Docflow.SignedAttachmentV3\022(\n\006Sta"
"tus\030\002 \002(\0132\030.Diadoc.Api.Proto.Status", 4395);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"Docflow/DocflowV3.proto", &protobuf_RegisterTypes);
DocflowV3::default_instance_ = new DocflowV3();
SenderTitleDocflow::default_instance_ = new SenderTitleDocflow();
ConfirmationDocflow::default_instance_ = new ConfirmationDocflow();
SignatureRejectionDocflow::default_instance_ = new SignatureRejectionDocflow();
ParticipantResponseDocflow::default_instance_ = new ParticipantResponseDocflow();
AmendmentRequestDocflow::default_instance_ = new AmendmentRequestDocflow();
RevocationDocflowV3::default_instance_ = new RevocationDocflowV3();
RevocationRequestDocflow::default_instance_ = new RevocationRequestDocflow();
RevocationResponseDocflow::default_instance_ = new RevocationResponseDocflow();
ReceiptDocflowV3::default_instance_ = new ReceiptDocflowV3();
OuterDocflow::default_instance_ = new OuterDocflow();
OuterDocflowEntities::default_instance_ = new OuterDocflowEntities();
StatusEntity::default_instance_ = new StatusEntity();
DocflowV3::default_instance_->InitAsDefaultInstance();
SenderTitleDocflow::default_instance_->InitAsDefaultInstance();
ConfirmationDocflow::default_instance_->InitAsDefaultInstance();
SignatureRejectionDocflow::default_instance_->InitAsDefaultInstance();
ParticipantResponseDocflow::default_instance_->InitAsDefaultInstance();
AmendmentRequestDocflow::default_instance_->InitAsDefaultInstance();
RevocationDocflowV3::default_instance_->InitAsDefaultInstance();
RevocationRequestDocflow::default_instance_->InitAsDefaultInstance();
RevocationResponseDocflow::default_instance_->InitAsDefaultInstance();
ReceiptDocflowV3::default_instance_->InitAsDefaultInstance();
OuterDocflow::default_instance_->InitAsDefaultInstance();
OuterDocflowEntities::default_instance_->InitAsDefaultInstance();
StatusEntity::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_Docflow_2fDocflowV3_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_Docflow_2fDocflowV3_2eproto {
StaticDescriptorInitializer_Docflow_2fDocflowV3_2eproto() {
protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
}
} static_descriptor_initializer_Docflow_2fDocflowV3_2eproto_;
// ===================================================================
#ifndef _MSC_VER
const int DocflowV3::kSenderTitleFieldNumber;
const int DocflowV3::kConfirmationFieldNumber;
const int DocflowV3::kProxyResponseFieldNumber;
const int DocflowV3::kRecipientReceiptFieldNumber;
const int DocflowV3::kRecipientResponseFieldNumber;
const int DocflowV3::kAmendmentRequestFieldNumber;
const int DocflowV3::kRevocationFieldNumber;
const int DocflowV3::kSenderReceiptFieldNumber;
const int DocflowV3::kResolutionFieldNumber;
const int DocflowV3::kResolutionEntitiesFieldNumber;
const int DocflowV3::kOuterDocflowsFieldNumber;
const int DocflowV3::kOuterDocflowEntitiesFieldNumber;
const int DocflowV3::kDocflowStatusFieldNumber;
#endif // !_MSC_VER
DocflowV3::DocflowV3()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.DocflowV3)
}
void DocflowV3::InitAsDefaultInstance() {
sendertitle_ = const_cast< ::Diadoc::Api::Proto::Docflow::SenderTitleDocflow*>(&::Diadoc::Api::Proto::Docflow::SenderTitleDocflow::default_instance());
confirmation_ = const_cast< ::Diadoc::Api::Proto::Docflow::ConfirmationDocflow*>(&::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::default_instance());
proxyresponse_ = const_cast< ::Diadoc::Api::Proto::Docflow::ParticipantResponseDocflow*>(&::Diadoc::Api::Proto::Docflow::ParticipantResponseDocflow::default_instance());
recipientreceipt_ = const_cast< ::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3*>(&::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::default_instance());
recipientresponse_ = const_cast< ::Diadoc::Api::Proto::Docflow::ParticipantResponseDocflow*>(&::Diadoc::Api::Proto::Docflow::ParticipantResponseDocflow::default_instance());
amendmentrequest_ = const_cast< ::Diadoc::Api::Proto::Docflow::AmendmentRequestDocflow*>(&::Diadoc::Api::Proto::Docflow::AmendmentRequestDocflow::default_instance());
revocation_ = const_cast< ::Diadoc::Api::Proto::Docflow::RevocationDocflowV3*>(&::Diadoc::Api::Proto::Docflow::RevocationDocflowV3::default_instance());
senderreceipt_ = const_cast< ::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3*>(&::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::default_instance());
resolution_ = const_cast< ::Diadoc::Api::Proto::Docflow::ResolutionDocflowV3*>(&::Diadoc::Api::Proto::Docflow::ResolutionDocflowV3::default_instance());
resolutionentities_ = const_cast< ::Diadoc::Api::Proto::Docflow::ResolutionEntitiesV3*>(&::Diadoc::Api::Proto::Docflow::ResolutionEntitiesV3::default_instance());
docflowstatus_ = const_cast< ::Diadoc::Api::Proto::DocflowStatusV3*>(&::Diadoc::Api::Proto::DocflowStatusV3::default_instance());
}
DocflowV3::DocflowV3(const DocflowV3& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.DocflowV3)
}
void DocflowV3::SharedCtor() {
_cached_size_ = 0;
sendertitle_ = NULL;
confirmation_ = NULL;
proxyresponse_ = NULL;
recipientreceipt_ = NULL;
recipientresponse_ = NULL;
amendmentrequest_ = NULL;
revocation_ = NULL;
senderreceipt_ = NULL;
resolution_ = NULL;
resolutionentities_ = NULL;
docflowstatus_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
DocflowV3::~DocflowV3() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.DocflowV3)
SharedDtor();
}
void DocflowV3::SharedDtor() {
if (this != default_instance_) {
delete sendertitle_;
delete confirmation_;
delete proxyresponse_;
delete recipientreceipt_;
delete recipientresponse_;
delete amendmentrequest_;
delete revocation_;
delete senderreceipt_;
delete resolution_;
delete resolutionentities_;
delete docflowstatus_;
}
}
void DocflowV3::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DocflowV3::descriptor() {
protobuf_AssignDescriptorsOnce();
return DocflowV3_descriptor_;
}
const DocflowV3& DocflowV3::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
DocflowV3* DocflowV3::default_instance_ = NULL;
DocflowV3* DocflowV3::New() const {
return new DocflowV3;
}
void DocflowV3::Clear() {
if (_has_bits_[0 / 32] & 255) {
if (has_sendertitle()) {
if (sendertitle_ != NULL) sendertitle_->::Diadoc::Api::Proto::Docflow::SenderTitleDocflow::Clear();
}
if (has_confirmation()) {
if (confirmation_ != NULL) confirmation_->::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::Clear();
}
if (has_proxyresponse()) {
if (proxyresponse_ != NULL) proxyresponse_->::Diadoc::Api::Proto::Docflow::ParticipantResponseDocflow::Clear();
}
if (has_recipientreceipt()) {
if (recipientreceipt_ != NULL) recipientreceipt_->::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::Clear();
}
if (has_recipientresponse()) {
if (recipientresponse_ != NULL) recipientresponse_->::Diadoc::Api::Proto::Docflow::ParticipantResponseDocflow::Clear();
}
if (has_amendmentrequest()) {
if (amendmentrequest_ != NULL) amendmentrequest_->::Diadoc::Api::Proto::Docflow::AmendmentRequestDocflow::Clear();
}
if (has_revocation()) {
if (revocation_ != NULL) revocation_->::Diadoc::Api::Proto::Docflow::RevocationDocflowV3::Clear();
}
if (has_senderreceipt()) {
if (senderreceipt_ != NULL) senderreceipt_->::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::Clear();
}
}
if (_has_bits_[8 / 32] & 4864) {
if (has_resolution()) {
if (resolution_ != NULL) resolution_->::Diadoc::Api::Proto::Docflow::ResolutionDocflowV3::Clear();
}
if (has_resolutionentities()) {
if (resolutionentities_ != NULL) resolutionentities_->::Diadoc::Api::Proto::Docflow::ResolutionEntitiesV3::Clear();
}
if (has_docflowstatus()) {
if (docflowstatus_ != NULL) docflowstatus_->::Diadoc::Api::Proto::DocflowStatusV3::Clear();
}
}
outerdocflows_.Clear();
outerdocflowentities_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool DocflowV3::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.DocflowV3)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .Diadoc.Api.Proto.Docflow.SenderTitleDocflow SenderTitle = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_sendertitle()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_Confirmation;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow Confirmation = 2;
case 2: {
if (tag == 18) {
parse_Confirmation:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_confirmation()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_RecipientReceipt;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 RecipientReceipt = 4;
case 4: {
if (tag == 34) {
parse_RecipientReceipt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_recipientreceipt()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_RecipientResponse;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow RecipientResponse = 5;
case 5: {
if (tag == 42) {
parse_RecipientResponse:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_recipientresponse()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(50)) goto parse_AmendmentRequest;
break;
}
// optional .Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow AmendmentRequest = 6;
case 6: {
if (tag == 50) {
parse_AmendmentRequest:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_amendmentrequest()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_Revocation;
break;
}
// optional .Diadoc.Api.Proto.Docflow.RevocationDocflowV3 Revocation = 7;
case 7: {
if (tag == 58) {
parse_Revocation:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_revocation()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(66)) goto parse_SenderReceipt;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 SenderReceipt = 8;
case 8: {
if (tag == 66) {
parse_SenderReceipt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_senderreceipt()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(74)) goto parse_Resolution;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionDocflowV3 Resolution = 9;
case 9: {
if (tag == 74) {
parse_Resolution:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_resolution()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(82)) goto parse_ResolutionEntities;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionEntitiesV3 ResolutionEntities = 10;
case 10: {
if (tag == 82) {
parse_ResolutionEntities:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_resolutionentities()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(90)) goto parse_ProxyResponse;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow ProxyResponse = 11;
case 11: {
if (tag == 90) {
parse_ProxyResponse:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_proxyresponse()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(98)) goto parse_OuterDocflows;
break;
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflow OuterDocflows = 12;
case 12: {
if (tag == 98) {
parse_OuterDocflows:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_outerdocflows()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(98)) goto parse_OuterDocflows;
if (input->ExpectTag(106)) goto parse_OuterDocflowEntities;
break;
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflowEntities OuterDocflowEntities = 13;
case 13: {
if (tag == 106) {
parse_OuterDocflowEntities:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_outerdocflowentities()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(106)) goto parse_OuterDocflowEntities;
if (input->ExpectTag(114)) goto parse_DocflowStatus;
break;
}
// required .Diadoc.Api.Proto.DocflowStatusV3 DocflowStatus = 14;
case 14: {
if (tag == 114) {
parse_DocflowStatus:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_docflowstatus()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.DocflowV3)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.DocflowV3)
return false;
#undef DO_
}
void DocflowV3::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.DocflowV3)
// required .Diadoc.Api.Proto.Docflow.SenderTitleDocflow SenderTitle = 1;
if (has_sendertitle()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->sendertitle(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow Confirmation = 2;
if (has_confirmation()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->confirmation(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 RecipientReceipt = 4;
if (has_recipientreceipt()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->recipientreceipt(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow RecipientResponse = 5;
if (has_recipientresponse()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->recipientresponse(), output);
}
// optional .Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow AmendmentRequest = 6;
if (has_amendmentrequest()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->amendmentrequest(), output);
}
// optional .Diadoc.Api.Proto.Docflow.RevocationDocflowV3 Revocation = 7;
if (has_revocation()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, this->revocation(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 SenderReceipt = 8;
if (has_senderreceipt()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, this->senderreceipt(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionDocflowV3 Resolution = 9;
if (has_resolution()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
9, this->resolution(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionEntitiesV3 ResolutionEntities = 10;
if (has_resolutionentities()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
10, this->resolutionentities(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow ProxyResponse = 11;
if (has_proxyresponse()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
11, this->proxyresponse(), output);
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflow OuterDocflows = 12;
for (int i = 0; i < this->outerdocflows_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
12, this->outerdocflows(i), output);
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflowEntities OuterDocflowEntities = 13;
for (int i = 0; i < this->outerdocflowentities_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
13, this->outerdocflowentities(i), output);
}
// required .Diadoc.Api.Proto.DocflowStatusV3 DocflowStatus = 14;
if (has_docflowstatus()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
14, this->docflowstatus(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.DocflowV3)
}
::google::protobuf::uint8* DocflowV3::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.DocflowV3)
// required .Diadoc.Api.Proto.Docflow.SenderTitleDocflow SenderTitle = 1;
if (has_sendertitle()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->sendertitle(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow Confirmation = 2;
if (has_confirmation()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->confirmation(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 RecipientReceipt = 4;
if (has_recipientreceipt()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->recipientreceipt(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow RecipientResponse = 5;
if (has_recipientresponse()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->recipientresponse(), target);
}
// optional .Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow AmendmentRequest = 6;
if (has_amendmentrequest()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
6, this->amendmentrequest(), target);
}
// optional .Diadoc.Api.Proto.Docflow.RevocationDocflowV3 Revocation = 7;
if (has_revocation()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
7, this->revocation(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 SenderReceipt = 8;
if (has_senderreceipt()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
8, this->senderreceipt(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionDocflowV3 Resolution = 9;
if (has_resolution()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
9, this->resolution(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionEntitiesV3 ResolutionEntities = 10;
if (has_resolutionentities()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
10, this->resolutionentities(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow ProxyResponse = 11;
if (has_proxyresponse()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
11, this->proxyresponse(), target);
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflow OuterDocflows = 12;
for (int i = 0; i < this->outerdocflows_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
12, this->outerdocflows(i), target);
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflowEntities OuterDocflowEntities = 13;
for (int i = 0; i < this->outerdocflowentities_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
13, this->outerdocflowentities(i), target);
}
// required .Diadoc.Api.Proto.DocflowStatusV3 DocflowStatus = 14;
if (has_docflowstatus()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
14, this->docflowstatus(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.DocflowV3)
return target;
}
int DocflowV3::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .Diadoc.Api.Proto.Docflow.SenderTitleDocflow SenderTitle = 1;
if (has_sendertitle()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->sendertitle());
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow Confirmation = 2;
if (has_confirmation()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->confirmation());
}
// optional .Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow ProxyResponse = 11;
if (has_proxyresponse()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->proxyresponse());
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 RecipientReceipt = 4;
if (has_recipientreceipt()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->recipientreceipt());
}
// optional .Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow RecipientResponse = 5;
if (has_recipientresponse()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->recipientresponse());
}
// optional .Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow AmendmentRequest = 6;
if (has_amendmentrequest()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->amendmentrequest());
}
// optional .Diadoc.Api.Proto.Docflow.RevocationDocflowV3 Revocation = 7;
if (has_revocation()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->revocation());
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 SenderReceipt = 8;
if (has_senderreceipt()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->senderreceipt());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional .Diadoc.Api.Proto.Docflow.ResolutionDocflowV3 Resolution = 9;
if (has_resolution()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->resolution());
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionEntitiesV3 ResolutionEntities = 10;
if (has_resolutionentities()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->resolutionentities());
}
// required .Diadoc.Api.Proto.DocflowStatusV3 DocflowStatus = 14;
if (has_docflowstatus()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->docflowstatus());
}
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflow OuterDocflows = 12;
total_size += 1 * this->outerdocflows_size();
for (int i = 0; i < this->outerdocflows_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->outerdocflows(i));
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflowEntities OuterDocflowEntities = 13;
total_size += 1 * this->outerdocflowentities_size();
for (int i = 0; i < this->outerdocflowentities_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->outerdocflowentities(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void DocflowV3::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const DocflowV3* source =
::google::protobuf::internal::dynamic_cast_if_available<const DocflowV3*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void DocflowV3::MergeFrom(const DocflowV3& from) {
GOOGLE_CHECK_NE(&from, this);
outerdocflows_.MergeFrom(from.outerdocflows_);
outerdocflowentities_.MergeFrom(from.outerdocflowentities_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_sendertitle()) {
mutable_sendertitle()->::Diadoc::Api::Proto::Docflow::SenderTitleDocflow::MergeFrom(from.sendertitle());
}
if (from.has_confirmation()) {
mutable_confirmation()->::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::MergeFrom(from.confirmation());
}
if (from.has_proxyresponse()) {
mutable_proxyresponse()->::Diadoc::Api::Proto::Docflow::ParticipantResponseDocflow::MergeFrom(from.proxyresponse());
}
if (from.has_recipientreceipt()) {
mutable_recipientreceipt()->::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::MergeFrom(from.recipientreceipt());
}
if (from.has_recipientresponse()) {
mutable_recipientresponse()->::Diadoc::Api::Proto::Docflow::ParticipantResponseDocflow::MergeFrom(from.recipientresponse());
}
if (from.has_amendmentrequest()) {
mutable_amendmentrequest()->::Diadoc::Api::Proto::Docflow::AmendmentRequestDocflow::MergeFrom(from.amendmentrequest());
}
if (from.has_revocation()) {
mutable_revocation()->::Diadoc::Api::Proto::Docflow::RevocationDocflowV3::MergeFrom(from.revocation());
}
if (from.has_senderreceipt()) {
mutable_senderreceipt()->::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::MergeFrom(from.senderreceipt());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_resolution()) {
mutable_resolution()->::Diadoc::Api::Proto::Docflow::ResolutionDocflowV3::MergeFrom(from.resolution());
}
if (from.has_resolutionentities()) {
mutable_resolutionentities()->::Diadoc::Api::Proto::Docflow::ResolutionEntitiesV3::MergeFrom(from.resolutionentities());
}
if (from.has_docflowstatus()) {
mutable_docflowstatus()->::Diadoc::Api::Proto::DocflowStatusV3::MergeFrom(from.docflowstatus());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void DocflowV3::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DocflowV3::CopyFrom(const DocflowV3& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DocflowV3::IsInitialized() const {
if ((_has_bits_[0] & 0x00001001) != 0x00001001) return false;
if (has_sendertitle()) {
if (!this->sendertitle().IsInitialized()) return false;
}
if (has_confirmation()) {
if (!this->confirmation().IsInitialized()) return false;
}
if (has_proxyresponse()) {
if (!this->proxyresponse().IsInitialized()) return false;
}
if (has_recipientreceipt()) {
if (!this->recipientreceipt().IsInitialized()) return false;
}
if (has_recipientresponse()) {
if (!this->recipientresponse().IsInitialized()) return false;
}
if (has_amendmentrequest()) {
if (!this->amendmentrequest().IsInitialized()) return false;
}
if (has_revocation()) {
if (!this->revocation().IsInitialized()) return false;
}
if (has_senderreceipt()) {
if (!this->senderreceipt().IsInitialized()) return false;
}
if (has_resolution()) {
if (!this->resolution().IsInitialized()) return false;
}
if (has_resolutionentities()) {
if (!this->resolutionentities().IsInitialized()) return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->outerdocflows())) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->outerdocflowentities())) return false;
if (has_docflowstatus()) {
if (!this->docflowstatus().IsInitialized()) return false;
}
return true;
}
void DocflowV3::Swap(DocflowV3* other) {
if (other != this) {
std::swap(sendertitle_, other->sendertitle_);
std::swap(confirmation_, other->confirmation_);
std::swap(proxyresponse_, other->proxyresponse_);
std::swap(recipientreceipt_, other->recipientreceipt_);
std::swap(recipientresponse_, other->recipientresponse_);
std::swap(amendmentrequest_, other->amendmentrequest_);
std::swap(revocation_, other->revocation_);
std::swap(senderreceipt_, other->senderreceipt_);
std::swap(resolution_, other->resolution_);
std::swap(resolutionentities_, other->resolutionentities_);
outerdocflows_.Swap(&other->outerdocflows_);
outerdocflowentities_.Swap(&other->outerdocflowentities_);
std::swap(docflowstatus_, other->docflowstatus_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata DocflowV3::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = DocflowV3_descriptor_;
metadata.reflection = DocflowV3_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int SenderTitleDocflow::kIsFinishedFieldNumber;
const int SenderTitleDocflow::kAttachmentFieldNumber;
const int SenderTitleDocflow::kSentAtFieldNumber;
const int SenderTitleDocflow::kDeliveredAtFieldNumber;
const int SenderTitleDocflow::kRoamingNotificationFieldNumber;
const int SenderTitleDocflow::kSenderSignatureStatusFieldNumber;
#endif // !_MSC_VER
SenderTitleDocflow::SenderTitleDocflow()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
}
void SenderTitleDocflow::InitAsDefaultInstance() {
attachment_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignedAttachmentV3*>(&::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::default_instance());
sentat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
deliveredat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
roamingnotification_ = const_cast< ::Diadoc::Api::Proto::Docflow::RoamingNotification*>(&::Diadoc::Api::Proto::Docflow::RoamingNotification::default_instance());
}
SenderTitleDocflow::SenderTitleDocflow(const SenderTitleDocflow& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
}
void SenderTitleDocflow::SharedCtor() {
_cached_size_ = 0;
isfinished_ = false;
attachment_ = NULL;
sentat_ = NULL;
deliveredat_ = NULL;
roamingnotification_ = NULL;
sendersignaturestatus_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
SenderTitleDocflow::~SenderTitleDocflow() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
SharedDtor();
}
void SenderTitleDocflow::SharedDtor() {
if (this != default_instance_) {
delete attachment_;
delete sentat_;
delete deliveredat_;
delete roamingnotification_;
}
}
void SenderTitleDocflow::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SenderTitleDocflow::descriptor() {
protobuf_AssignDescriptorsOnce();
return SenderTitleDocflow_descriptor_;
}
const SenderTitleDocflow& SenderTitleDocflow::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
SenderTitleDocflow* SenderTitleDocflow::default_instance_ = NULL;
SenderTitleDocflow* SenderTitleDocflow::New() const {
return new SenderTitleDocflow;
}
void SenderTitleDocflow::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<SenderTitleDocflow*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 63) {
ZR_(isfinished_, sendersignaturestatus_);
if (has_attachment()) {
if (attachment_ != NULL) attachment_->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::Clear();
}
if (has_sentat()) {
if (sentat_ != NULL) sentat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_deliveredat()) {
if (deliveredat_ != NULL) deliveredat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_roamingnotification()) {
if (roamingnotification_ != NULL) roamingnotification_->::Diadoc::Api::Proto::Docflow::RoamingNotification::Clear();
}
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool SenderTitleDocflow::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required bool IsFinished = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &isfinished_)));
set_has_isfinished();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_Attachment;
break;
}
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Attachment = 2;
case 2: {
if (tag == 18) {
parse_Attachment:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_attachment()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_SentAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
case 3: {
if (tag == 26) {
parse_SentAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_sentat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_DeliveredAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
case 4: {
if (tag == 34) {
parse_DeliveredAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_deliveredat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_RoamingNotification;
break;
}
// optional .Diadoc.Api.Proto.Docflow.RoamingNotification RoamingNotification = 5;
case 5: {
if (tag == 42) {
parse_RoamingNotification:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_roamingnotification()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_SenderSignatureStatus;
break;
}
// required .Diadoc.Api.Proto.Documents.SenderSignatureStatus SenderSignatureStatus = 6;
case 6: {
if (tag == 48) {
parse_SenderSignatureStatus:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::Diadoc::Api::Proto::Documents::SenderSignatureStatus_IsValid(value)) {
set_sendersignaturestatus(static_cast< ::Diadoc::Api::Proto::Documents::SenderSignatureStatus >(value));
} else {
mutable_unknown_fields()->AddVarint(6, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
return false;
#undef DO_
}
void SenderTitleDocflow::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
// required bool IsFinished = 1;
if (has_isfinished()) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->isfinished(), output);
}
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Attachment = 2;
if (has_attachment()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->attachment(), output);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->sentat(), output);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->deliveredat(), output);
}
// optional .Diadoc.Api.Proto.Docflow.RoamingNotification RoamingNotification = 5;
if (has_roamingnotification()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->roamingnotification(), output);
}
// required .Diadoc.Api.Proto.Documents.SenderSignatureStatus SenderSignatureStatus = 6;
if (has_sendersignaturestatus()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
6, this->sendersignaturestatus(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
}
::google::protobuf::uint8* SenderTitleDocflow::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
// required bool IsFinished = 1;
if (has_isfinished()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->isfinished(), target);
}
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Attachment = 2;
if (has_attachment()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->attachment(), target);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->sentat(), target);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->deliveredat(), target);
}
// optional .Diadoc.Api.Proto.Docflow.RoamingNotification RoamingNotification = 5;
if (has_roamingnotification()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->roamingnotification(), target);
}
// required .Diadoc.Api.Proto.Documents.SenderSignatureStatus SenderSignatureStatus = 6;
if (has_sendersignaturestatus()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
6, this->sendersignaturestatus(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.SenderTitleDocflow)
return target;
}
int SenderTitleDocflow::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required bool IsFinished = 1;
if (has_isfinished()) {
total_size += 1 + 1;
}
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Attachment = 2;
if (has_attachment()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->attachment());
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->sentat());
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->deliveredat());
}
// optional .Diadoc.Api.Proto.Docflow.RoamingNotification RoamingNotification = 5;
if (has_roamingnotification()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->roamingnotification());
}
// required .Diadoc.Api.Proto.Documents.SenderSignatureStatus SenderSignatureStatus = 6;
if (has_sendersignaturestatus()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->sendersignaturestatus());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SenderTitleDocflow::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const SenderTitleDocflow* source =
::google::protobuf::internal::dynamic_cast_if_available<const SenderTitleDocflow*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void SenderTitleDocflow::MergeFrom(const SenderTitleDocflow& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_isfinished()) {
set_isfinished(from.isfinished());
}
if (from.has_attachment()) {
mutable_attachment()->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::MergeFrom(from.attachment());
}
if (from.has_sentat()) {
mutable_sentat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.sentat());
}
if (from.has_deliveredat()) {
mutable_deliveredat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.deliveredat());
}
if (from.has_roamingnotification()) {
mutable_roamingnotification()->::Diadoc::Api::Proto::Docflow::RoamingNotification::MergeFrom(from.roamingnotification());
}
if (from.has_sendersignaturestatus()) {
set_sendersignaturestatus(from.sendersignaturestatus());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void SenderTitleDocflow::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SenderTitleDocflow::CopyFrom(const SenderTitleDocflow& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SenderTitleDocflow::IsInitialized() const {
if ((_has_bits_[0] & 0x00000023) != 0x00000023) return false;
if (has_attachment()) {
if (!this->attachment().IsInitialized()) return false;
}
if (has_sentat()) {
if (!this->sentat().IsInitialized()) return false;
}
if (has_deliveredat()) {
if (!this->deliveredat().IsInitialized()) return false;
}
if (has_roamingnotification()) {
if (!this->roamingnotification().IsInitialized()) return false;
}
return true;
}
void SenderTitleDocflow::Swap(SenderTitleDocflow* other) {
if (other != this) {
std::swap(isfinished_, other->isfinished_);
std::swap(attachment_, other->attachment_);
std::swap(sentat_, other->sentat_);
std::swap(deliveredat_, other->deliveredat_);
std::swap(roamingnotification_, other->roamingnotification_);
std::swap(sendersignaturestatus_, other->sendersignaturestatus_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata SenderTitleDocflow::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SenderTitleDocflow_descriptor_;
metadata.reflection = SenderTitleDocflow_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ConfirmationDocflow::kIsFinishedFieldNumber;
const int ConfirmationDocflow::kConfirmationAttachmentFieldNumber;
const int ConfirmationDocflow::kConfirmedAtFieldNumber;
const int ConfirmationDocflow::kReceiptFieldNumber;
#endif // !_MSC_VER
ConfirmationDocflow::ConfirmationDocflow()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
}
void ConfirmationDocflow::InitAsDefaultInstance() {
confirmationattachment_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignedAttachmentV3*>(&::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::default_instance());
confirmedat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
receipt_ = const_cast< ::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3*>(&::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::default_instance());
}
ConfirmationDocflow::ConfirmationDocflow(const ConfirmationDocflow& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
}
void ConfirmationDocflow::SharedCtor() {
_cached_size_ = 0;
isfinished_ = false;
confirmationattachment_ = NULL;
confirmedat_ = NULL;
receipt_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ConfirmationDocflow::~ConfirmationDocflow() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
SharedDtor();
}
void ConfirmationDocflow::SharedDtor() {
if (this != default_instance_) {
delete confirmationattachment_;
delete confirmedat_;
delete receipt_;
}
}
void ConfirmationDocflow::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ConfirmationDocflow::descriptor() {
protobuf_AssignDescriptorsOnce();
return ConfirmationDocflow_descriptor_;
}
const ConfirmationDocflow& ConfirmationDocflow::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
ConfirmationDocflow* ConfirmationDocflow::default_instance_ = NULL;
ConfirmationDocflow* ConfirmationDocflow::New() const {
return new ConfirmationDocflow;
}
void ConfirmationDocflow::Clear() {
if (_has_bits_[0 / 32] & 15) {
isfinished_ = false;
if (has_confirmationattachment()) {
if (confirmationattachment_ != NULL) confirmationattachment_->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::Clear();
}
if (has_confirmedat()) {
if (confirmedat_ != NULL) confirmedat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_receipt()) {
if (receipt_ != NULL) receipt_->::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ConfirmationDocflow::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required bool IsFinished = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &isfinished_)));
set_has_isfinished();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_ConfirmationAttachment;
break;
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 ConfirmationAttachment = 2;
case 2: {
if (tag == 18) {
parse_ConfirmationAttachment:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_confirmationattachment()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_ConfirmedAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp ConfirmedAt = 3;
case 3: {
if (tag == 26) {
parse_ConfirmedAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_confirmedat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_Receipt;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 Receipt = 4;
case 4: {
if (tag == 34) {
parse_Receipt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_receipt()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
return false;
#undef DO_
}
void ConfirmationDocflow::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
// required bool IsFinished = 1;
if (has_isfinished()) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->isfinished(), output);
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 ConfirmationAttachment = 2;
if (has_confirmationattachment()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->confirmationattachment(), output);
}
// optional .Diadoc.Api.Proto.Timestamp ConfirmedAt = 3;
if (has_confirmedat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->confirmedat(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 Receipt = 4;
if (has_receipt()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->receipt(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
}
::google::protobuf::uint8* ConfirmationDocflow::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
// required bool IsFinished = 1;
if (has_isfinished()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->isfinished(), target);
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 ConfirmationAttachment = 2;
if (has_confirmationattachment()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->confirmationattachment(), target);
}
// optional .Diadoc.Api.Proto.Timestamp ConfirmedAt = 3;
if (has_confirmedat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->confirmedat(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 Receipt = 4;
if (has_receipt()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->receipt(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.ConfirmationDocflow)
return target;
}
int ConfirmationDocflow::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required bool IsFinished = 1;
if (has_isfinished()) {
total_size += 1 + 1;
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 ConfirmationAttachment = 2;
if (has_confirmationattachment()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->confirmationattachment());
}
// optional .Diadoc.Api.Proto.Timestamp ConfirmedAt = 3;
if (has_confirmedat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->confirmedat());
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 Receipt = 4;
if (has_receipt()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->receipt());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ConfirmationDocflow::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ConfirmationDocflow* source =
::google::protobuf::internal::dynamic_cast_if_available<const ConfirmationDocflow*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ConfirmationDocflow::MergeFrom(const ConfirmationDocflow& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_isfinished()) {
set_isfinished(from.isfinished());
}
if (from.has_confirmationattachment()) {
mutable_confirmationattachment()->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::MergeFrom(from.confirmationattachment());
}
if (from.has_confirmedat()) {
mutable_confirmedat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.confirmedat());
}
if (from.has_receipt()) {
mutable_receipt()->::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::MergeFrom(from.receipt());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ConfirmationDocflow::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ConfirmationDocflow::CopyFrom(const ConfirmationDocflow& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ConfirmationDocflow::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_confirmationattachment()) {
if (!this->confirmationattachment().IsInitialized()) return false;
}
if (has_confirmedat()) {
if (!this->confirmedat().IsInitialized()) return false;
}
if (has_receipt()) {
if (!this->receipt().IsInitialized()) return false;
}
return true;
}
void ConfirmationDocflow::Swap(ConfirmationDocflow* other) {
if (other != this) {
std::swap(isfinished_, other->isfinished_);
std::swap(confirmationattachment_, other->confirmationattachment_);
std::swap(confirmedat_, other->confirmedat_);
std::swap(receipt_, other->receipt_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ConfirmationDocflow::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ConfirmationDocflow_descriptor_;
metadata.reflection = ConfirmationDocflow_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int SignatureRejectionDocflow::kSignatureRejectionFieldNumber;
const int SignatureRejectionDocflow::kIsFormalFieldNumber;
const int SignatureRejectionDocflow::kDeliveredAtFieldNumber;
const int SignatureRejectionDocflow::kPlainTextFieldNumber;
#endif // !_MSC_VER
SignatureRejectionDocflow::SignatureRejectionDocflow()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
}
void SignatureRejectionDocflow::InitAsDefaultInstance() {
signaturerejection_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignedAttachmentV3*>(&::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::default_instance());
deliveredat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
}
SignatureRejectionDocflow::SignatureRejectionDocflow(const SignatureRejectionDocflow& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
}
void SignatureRejectionDocflow::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
signaturerejection_ = NULL;
isformal_ = false;
deliveredat_ = NULL;
plaintext_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
SignatureRejectionDocflow::~SignatureRejectionDocflow() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
SharedDtor();
}
void SignatureRejectionDocflow::SharedDtor() {
if (plaintext_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete plaintext_;
}
if (this != default_instance_) {
delete signaturerejection_;
delete deliveredat_;
}
}
void SignatureRejectionDocflow::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SignatureRejectionDocflow::descriptor() {
protobuf_AssignDescriptorsOnce();
return SignatureRejectionDocflow_descriptor_;
}
const SignatureRejectionDocflow& SignatureRejectionDocflow::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
SignatureRejectionDocflow* SignatureRejectionDocflow::default_instance_ = NULL;
SignatureRejectionDocflow* SignatureRejectionDocflow::New() const {
return new SignatureRejectionDocflow;
}
void SignatureRejectionDocflow::Clear() {
if (_has_bits_[0 / 32] & 15) {
if (has_signaturerejection()) {
if (signaturerejection_ != NULL) signaturerejection_->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::Clear();
}
isformal_ = false;
if (has_deliveredat()) {
if (deliveredat_ != NULL) deliveredat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_plaintext()) {
if (plaintext_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
plaintext_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool SignatureRejectionDocflow::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 SignatureRejection = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_signaturerejection()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(16)) goto parse_IsFormal;
break;
}
// required bool IsFormal = 2;
case 2: {
if (tag == 16) {
parse_IsFormal:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &isformal_)));
set_has_isformal();
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_DeliveredAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 3;
case 3: {
if (tag == 26) {
parse_DeliveredAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_deliveredat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_PlainText;
break;
}
// optional string PlainText = 4;
case 4: {
if (tag == 34) {
parse_PlainText:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_plaintext()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::PARSE,
"plaintext");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
return false;
#undef DO_
}
void SignatureRejectionDocflow::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 SignatureRejection = 1;
if (has_signaturerejection()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->signaturerejection(), output);
}
// required bool IsFormal = 2;
if (has_isformal()) {
::google::protobuf::internal::WireFormatLite::WriteBool(2, this->isformal(), output);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 3;
if (has_deliveredat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->deliveredat(), output);
}
// optional string PlainText = 4;
if (has_plaintext()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"plaintext");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
4, this->plaintext(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
}
::google::protobuf::uint8* SignatureRejectionDocflow::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 SignatureRejection = 1;
if (has_signaturerejection()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->signaturerejection(), target);
}
// required bool IsFormal = 2;
if (has_isformal()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(2, this->isformal(), target);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 3;
if (has_deliveredat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->deliveredat(), target);
}
// optional string PlainText = 4;
if (has_plaintext()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"plaintext");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
4, this->plaintext(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow)
return target;
}
int SignatureRejectionDocflow::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 SignatureRejection = 1;
if (has_signaturerejection()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->signaturerejection());
}
// required bool IsFormal = 2;
if (has_isformal()) {
total_size += 1 + 1;
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 3;
if (has_deliveredat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->deliveredat());
}
// optional string PlainText = 4;
if (has_plaintext()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->plaintext());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SignatureRejectionDocflow::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const SignatureRejectionDocflow* source =
::google::protobuf::internal::dynamic_cast_if_available<const SignatureRejectionDocflow*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void SignatureRejectionDocflow::MergeFrom(const SignatureRejectionDocflow& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_signaturerejection()) {
mutable_signaturerejection()->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::MergeFrom(from.signaturerejection());
}
if (from.has_isformal()) {
set_isformal(from.isformal());
}
if (from.has_deliveredat()) {
mutable_deliveredat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.deliveredat());
}
if (from.has_plaintext()) {
set_plaintext(from.plaintext());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void SignatureRejectionDocflow::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SignatureRejectionDocflow::CopyFrom(const SignatureRejectionDocflow& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SignatureRejectionDocflow::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
if (has_signaturerejection()) {
if (!this->signaturerejection().IsInitialized()) return false;
}
if (has_deliveredat()) {
if (!this->deliveredat().IsInitialized()) return false;
}
return true;
}
void SignatureRejectionDocflow::Swap(SignatureRejectionDocflow* other) {
if (other != this) {
std::swap(signaturerejection_, other->signaturerejection_);
std::swap(isformal_, other->isformal_);
std::swap(deliveredat_, other->deliveredat_);
std::swap(plaintext_, other->plaintext_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata SignatureRejectionDocflow::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SignatureRejectionDocflow_descriptor_;
metadata.reflection = SignatureRejectionDocflow_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ParticipantResponseDocflow::kIsFinishedFieldNumber;
const int ParticipantResponseDocflow::kSignatureFieldNumber;
const int ParticipantResponseDocflow::kTitleFieldNumber;
const int ParticipantResponseDocflow::kRejectionFieldNumber;
const int ParticipantResponseDocflow::kSentAtFieldNumber;
const int ParticipantResponseDocflow::kDeliveredAtFieldNumber;
const int ParticipantResponseDocflow::kResponseStatusFieldNumber;
#endif // !_MSC_VER
ParticipantResponseDocflow::ParticipantResponseDocflow()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
}
void ParticipantResponseDocflow::InitAsDefaultInstance() {
signature_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignatureV3*>(&::Diadoc::Api::Proto::Docflow::SignatureV3::default_instance());
title_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignedAttachmentV3*>(&::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::default_instance());
rejection_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignatureRejectionDocflow*>(&::Diadoc::Api::Proto::Docflow::SignatureRejectionDocflow::default_instance());
sentat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
deliveredat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
}
ParticipantResponseDocflow::ParticipantResponseDocflow(const ParticipantResponseDocflow& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
}
void ParticipantResponseDocflow::SharedCtor() {
_cached_size_ = 0;
isfinished_ = false;
signature_ = NULL;
title_ = NULL;
rejection_ = NULL;
sentat_ = NULL;
deliveredat_ = NULL;
responsestatus_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ParticipantResponseDocflow::~ParticipantResponseDocflow() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
SharedDtor();
}
void ParticipantResponseDocflow::SharedDtor() {
if (this != default_instance_) {
delete signature_;
delete title_;
delete rejection_;
delete sentat_;
delete deliveredat_;
}
}
void ParticipantResponseDocflow::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ParticipantResponseDocflow::descriptor() {
protobuf_AssignDescriptorsOnce();
return ParticipantResponseDocflow_descriptor_;
}
const ParticipantResponseDocflow& ParticipantResponseDocflow::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
ParticipantResponseDocflow* ParticipantResponseDocflow::default_instance_ = NULL;
ParticipantResponseDocflow* ParticipantResponseDocflow::New() const {
return new ParticipantResponseDocflow;
}
void ParticipantResponseDocflow::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<ParticipantResponseDocflow*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 127) {
ZR_(isfinished_, responsestatus_);
if (has_signature()) {
if (signature_ != NULL) signature_->::Diadoc::Api::Proto::Docflow::SignatureV3::Clear();
}
if (has_title()) {
if (title_ != NULL) title_->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::Clear();
}
if (has_rejection()) {
if (rejection_ != NULL) rejection_->::Diadoc::Api::Proto::Docflow::SignatureRejectionDocflow::Clear();
}
if (has_sentat()) {
if (sentat_ != NULL) sentat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_deliveredat()) {
if (deliveredat_ != NULL) deliveredat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ParticipantResponseDocflow::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required bool IsFinished = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &isfinished_)));
set_has_isfinished();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_Signature;
break;
}
// optional .Diadoc.Api.Proto.Docflow.SignatureV3 Signature = 2;
case 2: {
if (tag == 18) {
parse_Signature:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_signature()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_Title;
break;
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Title = 3;
case 3: {
if (tag == 26) {
parse_Title:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_title()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_Rejection;
break;
}
// optional .Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow Rejection = 4;
case 4: {
if (tag == 34) {
parse_Rejection:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_rejection()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_SentAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 5;
case 5: {
if (tag == 42) {
parse_SentAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_sentat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(50)) goto parse_DeliveredAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 6;
case 6: {
if (tag == 50) {
parse_DeliveredAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_deliveredat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(56)) goto parse_ResponseStatus;
break;
}
// required .Diadoc.Api.Proto.Documents.RecipientResponseStatus ResponseStatus = 7;
case 7: {
if (tag == 56) {
parse_ResponseStatus:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::Diadoc::Api::Proto::Documents::RecipientResponseStatus_IsValid(value)) {
set_responsestatus(static_cast< ::Diadoc::Api::Proto::Documents::RecipientResponseStatus >(value));
} else {
mutable_unknown_fields()->AddVarint(7, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
return false;
#undef DO_
}
void ParticipantResponseDocflow::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
// required bool IsFinished = 1;
if (has_isfinished()) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->isfinished(), output);
}
// optional .Diadoc.Api.Proto.Docflow.SignatureV3 Signature = 2;
if (has_signature()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->signature(), output);
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Title = 3;
if (has_title()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->title(), output);
}
// optional .Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow Rejection = 4;
if (has_rejection()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->rejection(), output);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 5;
if (has_sentat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->sentat(), output);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 6;
if (has_deliveredat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->deliveredat(), output);
}
// required .Diadoc.Api.Proto.Documents.RecipientResponseStatus ResponseStatus = 7;
if (has_responsestatus()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
7, this->responsestatus(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
}
::google::protobuf::uint8* ParticipantResponseDocflow::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
// required bool IsFinished = 1;
if (has_isfinished()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->isfinished(), target);
}
// optional .Diadoc.Api.Proto.Docflow.SignatureV3 Signature = 2;
if (has_signature()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->signature(), target);
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Title = 3;
if (has_title()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->title(), target);
}
// optional .Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow Rejection = 4;
if (has_rejection()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->rejection(), target);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 5;
if (has_sentat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->sentat(), target);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 6;
if (has_deliveredat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
6, this->deliveredat(), target);
}
// required .Diadoc.Api.Proto.Documents.RecipientResponseStatus ResponseStatus = 7;
if (has_responsestatus()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
7, this->responsestatus(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.ParticipantResponseDocflow)
return target;
}
int ParticipantResponseDocflow::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required bool IsFinished = 1;
if (has_isfinished()) {
total_size += 1 + 1;
}
// optional .Diadoc.Api.Proto.Docflow.SignatureV3 Signature = 2;
if (has_signature()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->signature());
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Title = 3;
if (has_title()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->title());
}
// optional .Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow Rejection = 4;
if (has_rejection()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->rejection());
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 5;
if (has_sentat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->sentat());
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 6;
if (has_deliveredat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->deliveredat());
}
// required .Diadoc.Api.Proto.Documents.RecipientResponseStatus ResponseStatus = 7;
if (has_responsestatus()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->responsestatus());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ParticipantResponseDocflow::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ParticipantResponseDocflow* source =
::google::protobuf::internal::dynamic_cast_if_available<const ParticipantResponseDocflow*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ParticipantResponseDocflow::MergeFrom(const ParticipantResponseDocflow& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_isfinished()) {
set_isfinished(from.isfinished());
}
if (from.has_signature()) {
mutable_signature()->::Diadoc::Api::Proto::Docflow::SignatureV3::MergeFrom(from.signature());
}
if (from.has_title()) {
mutable_title()->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::MergeFrom(from.title());
}
if (from.has_rejection()) {
mutable_rejection()->::Diadoc::Api::Proto::Docflow::SignatureRejectionDocflow::MergeFrom(from.rejection());
}
if (from.has_sentat()) {
mutable_sentat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.sentat());
}
if (from.has_deliveredat()) {
mutable_deliveredat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.deliveredat());
}
if (from.has_responsestatus()) {
set_responsestatus(from.responsestatus());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ParticipantResponseDocflow::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ParticipantResponseDocflow::CopyFrom(const ParticipantResponseDocflow& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ParticipantResponseDocflow::IsInitialized() const {
if ((_has_bits_[0] & 0x00000041) != 0x00000041) return false;
if (has_signature()) {
if (!this->signature().IsInitialized()) return false;
}
if (has_title()) {
if (!this->title().IsInitialized()) return false;
}
if (has_rejection()) {
if (!this->rejection().IsInitialized()) return false;
}
if (has_sentat()) {
if (!this->sentat().IsInitialized()) return false;
}
if (has_deliveredat()) {
if (!this->deliveredat().IsInitialized()) return false;
}
return true;
}
void ParticipantResponseDocflow::Swap(ParticipantResponseDocflow* other) {
if (other != this) {
std::swap(isfinished_, other->isfinished_);
std::swap(signature_, other->signature_);
std::swap(title_, other->title_);
std::swap(rejection_, other->rejection_);
std::swap(sentat_, other->sentat_);
std::swap(deliveredat_, other->deliveredat_);
std::swap(responsestatus_, other->responsestatus_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ParticipantResponseDocflow::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ParticipantResponseDocflow_descriptor_;
metadata.reflection = ParticipantResponseDocflow_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int AmendmentRequestDocflow::kIsFinishedFieldNumber;
const int AmendmentRequestDocflow::kAmendmentRequestFieldNumber;
const int AmendmentRequestDocflow::kSentAtFieldNumber;
const int AmendmentRequestDocflow::kDeliveredAtFieldNumber;
const int AmendmentRequestDocflow::kReceiptFieldNumber;
const int AmendmentRequestDocflow::kAmendmentFlagsFieldNumber;
const int AmendmentRequestDocflow::kPlainTextFieldNumber;
const int AmendmentRequestDocflow::kConfirmationDocflowFieldNumber;
#endif // !_MSC_VER
AmendmentRequestDocflow::AmendmentRequestDocflow()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
}
void AmendmentRequestDocflow::InitAsDefaultInstance() {
amendmentrequest_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignedAttachmentV3*>(&::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::default_instance());
sentat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
deliveredat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
receipt_ = const_cast< ::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3*>(&::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::default_instance());
confirmationdocflow_ = const_cast< ::Diadoc::Api::Proto::Docflow::ConfirmationDocflow*>(&::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::default_instance());
}
AmendmentRequestDocflow::AmendmentRequestDocflow(const AmendmentRequestDocflow& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
}
void AmendmentRequestDocflow::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
isfinished_ = false;
amendmentrequest_ = NULL;
sentat_ = NULL;
deliveredat_ = NULL;
receipt_ = NULL;
amendmentflags_ = 0;
plaintext_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
confirmationdocflow_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
AmendmentRequestDocflow::~AmendmentRequestDocflow() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
SharedDtor();
}
void AmendmentRequestDocflow::SharedDtor() {
if (plaintext_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete plaintext_;
}
if (this != default_instance_) {
delete amendmentrequest_;
delete sentat_;
delete deliveredat_;
delete receipt_;
delete confirmationdocflow_;
}
}
void AmendmentRequestDocflow::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AmendmentRequestDocflow::descriptor() {
protobuf_AssignDescriptorsOnce();
return AmendmentRequestDocflow_descriptor_;
}
const AmendmentRequestDocflow& AmendmentRequestDocflow::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
AmendmentRequestDocflow* AmendmentRequestDocflow::default_instance_ = NULL;
AmendmentRequestDocflow* AmendmentRequestDocflow::New() const {
return new AmendmentRequestDocflow;
}
void AmendmentRequestDocflow::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<AmendmentRequestDocflow*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 255) {
ZR_(isfinished_, amendmentflags_);
if (has_amendmentrequest()) {
if (amendmentrequest_ != NULL) amendmentrequest_->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::Clear();
}
if (has_sentat()) {
if (sentat_ != NULL) sentat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_deliveredat()) {
if (deliveredat_ != NULL) deliveredat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_receipt()) {
if (receipt_ != NULL) receipt_->::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::Clear();
}
if (has_plaintext()) {
if (plaintext_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
plaintext_->clear();
}
}
if (has_confirmationdocflow()) {
if (confirmationdocflow_ != NULL) confirmationdocflow_->::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::Clear();
}
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool AmendmentRequestDocflow::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required bool IsFinished = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &isfinished_)));
set_has_isfinished();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_AmendmentRequest;
break;
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 AmendmentRequest = 2;
case 2: {
if (tag == 18) {
parse_AmendmentRequest:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_amendmentrequest()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_SentAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
case 3: {
if (tag == 26) {
parse_SentAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_sentat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_DeliveredAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
case 4: {
if (tag == 34) {
parse_DeliveredAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_deliveredat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_Receipt;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 Receipt = 5;
case 5: {
if (tag == 42) {
parse_Receipt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_receipt()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_AmendmentFlags;
break;
}
// required int32 AmendmentFlags = 6;
case 6: {
if (tag == 48) {
parse_AmendmentFlags:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>(
input, &amendmentflags_)));
set_has_amendmentflags();
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_PlainText;
break;
}
// optional string PlainText = 7;
case 7: {
if (tag == 58) {
parse_PlainText:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_plaintext()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::PARSE,
"plaintext");
} else {
goto handle_unusual;
}
if (input->ExpectTag(66)) goto parse_ConfirmationDocflow;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow ConfirmationDocflow = 8;
case 8: {
if (tag == 66) {
parse_ConfirmationDocflow:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_confirmationdocflow()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
return false;
#undef DO_
}
void AmendmentRequestDocflow::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
// required bool IsFinished = 1;
if (has_isfinished()) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->isfinished(), output);
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 AmendmentRequest = 2;
if (has_amendmentrequest()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->amendmentrequest(), output);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->sentat(), output);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->deliveredat(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 Receipt = 5;
if (has_receipt()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->receipt(), output);
}
// required int32 AmendmentFlags = 6;
if (has_amendmentflags()) {
::google::protobuf::internal::WireFormatLite::WriteInt32(6, this->amendmentflags(), output);
}
// optional string PlainText = 7;
if (has_plaintext()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"plaintext");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
7, this->plaintext(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow ConfirmationDocflow = 8;
if (has_confirmationdocflow()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, this->confirmationdocflow(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
}
::google::protobuf::uint8* AmendmentRequestDocflow::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
// required bool IsFinished = 1;
if (has_isfinished()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->isfinished(), target);
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 AmendmentRequest = 2;
if (has_amendmentrequest()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->amendmentrequest(), target);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->sentat(), target);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->deliveredat(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 Receipt = 5;
if (has_receipt()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->receipt(), target);
}
// required int32 AmendmentFlags = 6;
if (has_amendmentflags()) {
target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(6, this->amendmentflags(), target);
}
// optional string PlainText = 7;
if (has_plaintext()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"plaintext");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
7, this->plaintext(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow ConfirmationDocflow = 8;
if (has_confirmationdocflow()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
8, this->confirmationdocflow(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.AmendmentRequestDocflow)
return target;
}
int AmendmentRequestDocflow::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required bool IsFinished = 1;
if (has_isfinished()) {
total_size += 1 + 1;
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 AmendmentRequest = 2;
if (has_amendmentrequest()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->amendmentrequest());
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->sentat());
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->deliveredat());
}
// optional .Diadoc.Api.Proto.Docflow.ReceiptDocflowV3 Receipt = 5;
if (has_receipt()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->receipt());
}
// required int32 AmendmentFlags = 6;
if (has_amendmentflags()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::Int32Size(
this->amendmentflags());
}
// optional string PlainText = 7;
if (has_plaintext()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->plaintext());
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow ConfirmationDocflow = 8;
if (has_confirmationdocflow()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->confirmationdocflow());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AmendmentRequestDocflow::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const AmendmentRequestDocflow* source =
::google::protobuf::internal::dynamic_cast_if_available<const AmendmentRequestDocflow*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void AmendmentRequestDocflow::MergeFrom(const AmendmentRequestDocflow& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_isfinished()) {
set_isfinished(from.isfinished());
}
if (from.has_amendmentrequest()) {
mutable_amendmentrequest()->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::MergeFrom(from.amendmentrequest());
}
if (from.has_sentat()) {
mutable_sentat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.sentat());
}
if (from.has_deliveredat()) {
mutable_deliveredat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.deliveredat());
}
if (from.has_receipt()) {
mutable_receipt()->::Diadoc::Api::Proto::Docflow::ReceiptDocflowV3::MergeFrom(from.receipt());
}
if (from.has_amendmentflags()) {
set_amendmentflags(from.amendmentflags());
}
if (from.has_plaintext()) {
set_plaintext(from.plaintext());
}
if (from.has_confirmationdocflow()) {
mutable_confirmationdocflow()->::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::MergeFrom(from.confirmationdocflow());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void AmendmentRequestDocflow::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AmendmentRequestDocflow::CopyFrom(const AmendmentRequestDocflow& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool AmendmentRequestDocflow::IsInitialized() const {
if ((_has_bits_[0] & 0x00000021) != 0x00000021) return false;
if (has_amendmentrequest()) {
if (!this->amendmentrequest().IsInitialized()) return false;
}
if (has_sentat()) {
if (!this->sentat().IsInitialized()) return false;
}
if (has_deliveredat()) {
if (!this->deliveredat().IsInitialized()) return false;
}
if (has_receipt()) {
if (!this->receipt().IsInitialized()) return false;
}
if (has_confirmationdocflow()) {
if (!this->confirmationdocflow().IsInitialized()) return false;
}
return true;
}
void AmendmentRequestDocflow::Swap(AmendmentRequestDocflow* other) {
if (other != this) {
std::swap(isfinished_, other->isfinished_);
std::swap(amendmentrequest_, other->amendmentrequest_);
std::swap(sentat_, other->sentat_);
std::swap(deliveredat_, other->deliveredat_);
std::swap(receipt_, other->receipt_);
std::swap(amendmentflags_, other->amendmentflags_);
std::swap(plaintext_, other->plaintext_);
std::swap(confirmationdocflow_, other->confirmationdocflow_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata AmendmentRequestDocflow::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AmendmentRequestDocflow_descriptor_;
metadata.reflection = AmendmentRequestDocflow_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int RevocationDocflowV3::kIsFinishedFieldNumber;
const int RevocationDocflowV3::kRevocationRequestFieldNumber;
const int RevocationDocflowV3::kRevocationResponseFieldNumber;
const int RevocationDocflowV3::kInitiatorBoxIdFieldNumber;
const int RevocationDocflowV3::kRevocationStatusFieldNumber;
const int RevocationDocflowV3::kResolutionEntitiesFieldNumber;
const int RevocationDocflowV3::kOuterDocflowEntitiesFieldNumber;
#endif // !_MSC_VER
RevocationDocflowV3::RevocationDocflowV3()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
}
void RevocationDocflowV3::InitAsDefaultInstance() {
revocationrequest_ = const_cast< ::Diadoc::Api::Proto::Docflow::RevocationRequestDocflow*>(&::Diadoc::Api::Proto::Docflow::RevocationRequestDocflow::default_instance());
revocationresponse_ = const_cast< ::Diadoc::Api::Proto::Docflow::RevocationResponseDocflow*>(&::Diadoc::Api::Proto::Docflow::RevocationResponseDocflow::default_instance());
resolutionentities_ = const_cast< ::Diadoc::Api::Proto::Docflow::ResolutionEntitiesV3*>(&::Diadoc::Api::Proto::Docflow::ResolutionEntitiesV3::default_instance());
}
RevocationDocflowV3::RevocationDocflowV3(const RevocationDocflowV3& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
}
void RevocationDocflowV3::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
isfinished_ = false;
revocationrequest_ = NULL;
revocationresponse_ = NULL;
initiatorboxid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
revocationstatus_ = 0;
resolutionentities_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
RevocationDocflowV3::~RevocationDocflowV3() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
SharedDtor();
}
void RevocationDocflowV3::SharedDtor() {
if (initiatorboxid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete initiatorboxid_;
}
if (this != default_instance_) {
delete revocationrequest_;
delete revocationresponse_;
delete resolutionentities_;
}
}
void RevocationDocflowV3::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RevocationDocflowV3::descriptor() {
protobuf_AssignDescriptorsOnce();
return RevocationDocflowV3_descriptor_;
}
const RevocationDocflowV3& RevocationDocflowV3::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
RevocationDocflowV3* RevocationDocflowV3::default_instance_ = NULL;
RevocationDocflowV3* RevocationDocflowV3::New() const {
return new RevocationDocflowV3;
}
void RevocationDocflowV3::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<RevocationDocflowV3*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 63) {
ZR_(isfinished_, revocationstatus_);
if (has_revocationrequest()) {
if (revocationrequest_ != NULL) revocationrequest_->::Diadoc::Api::Proto::Docflow::RevocationRequestDocflow::Clear();
}
if (has_revocationresponse()) {
if (revocationresponse_ != NULL) revocationresponse_->::Diadoc::Api::Proto::Docflow::RevocationResponseDocflow::Clear();
}
if (has_initiatorboxid()) {
if (initiatorboxid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
initiatorboxid_->clear();
}
}
if (has_resolutionentities()) {
if (resolutionentities_ != NULL) resolutionentities_->::Diadoc::Api::Proto::Docflow::ResolutionEntitiesV3::Clear();
}
}
#undef OFFSET_OF_FIELD_
#undef ZR_
outerdocflowentities_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool RevocationDocflowV3::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required bool IsFinished = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &isfinished_)));
set_has_isfinished();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_RevocationRequest;
break;
}
// required .Diadoc.Api.Proto.Docflow.RevocationRequestDocflow RevocationRequest = 2;
case 2: {
if (tag == 18) {
parse_RevocationRequest:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_revocationrequest()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_RevocationResponse;
break;
}
// optional .Diadoc.Api.Proto.Docflow.RevocationResponseDocflow RevocationResponse = 3;
case 3: {
if (tag == 26) {
parse_RevocationResponse:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_revocationresponse()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_InitiatorBoxId;
break;
}
// required string InitiatorBoxId = 4;
case 4: {
if (tag == 34) {
parse_InitiatorBoxId:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_initiatorboxid()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->initiatorboxid().data(), this->initiatorboxid().length(),
::google::protobuf::internal::WireFormat::PARSE,
"initiatorboxid");
} else {
goto handle_unusual;
}
if (input->ExpectTag(40)) goto parse_RevocationStatus;
break;
}
// required .Diadoc.Api.Proto.Documents.RevocationStatus RevocationStatus = 5;
case 5: {
if (tag == 40) {
parse_RevocationStatus:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::Diadoc::Api::Proto::Documents::RevocationStatus_IsValid(value)) {
set_revocationstatus(static_cast< ::Diadoc::Api::Proto::Documents::RevocationStatus >(value));
} else {
mutable_unknown_fields()->AddVarint(5, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectTag(50)) goto parse_ResolutionEntities;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionEntitiesV3 ResolutionEntities = 6;
case 6: {
if (tag == 50) {
parse_ResolutionEntities:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_resolutionentities()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_OuterDocflowEntities;
break;
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflowEntities OuterDocflowEntities = 7;
case 7: {
if (tag == 58) {
parse_OuterDocflowEntities:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_outerdocflowentities()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(58)) goto parse_OuterDocflowEntities;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
return false;
#undef DO_
}
void RevocationDocflowV3::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
// required bool IsFinished = 1;
if (has_isfinished()) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->isfinished(), output);
}
// required .Diadoc.Api.Proto.Docflow.RevocationRequestDocflow RevocationRequest = 2;
if (has_revocationrequest()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->revocationrequest(), output);
}
// optional .Diadoc.Api.Proto.Docflow.RevocationResponseDocflow RevocationResponse = 3;
if (has_revocationresponse()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->revocationresponse(), output);
}
// required string InitiatorBoxId = 4;
if (has_initiatorboxid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->initiatorboxid().data(), this->initiatorboxid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"initiatorboxid");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
4, this->initiatorboxid(), output);
}
// required .Diadoc.Api.Proto.Documents.RevocationStatus RevocationStatus = 5;
if (has_revocationstatus()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
5, this->revocationstatus(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionEntitiesV3 ResolutionEntities = 6;
if (has_resolutionentities()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
6, this->resolutionentities(), output);
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflowEntities OuterDocflowEntities = 7;
for (int i = 0; i < this->outerdocflowentities_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, this->outerdocflowentities(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
}
::google::protobuf::uint8* RevocationDocflowV3::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
// required bool IsFinished = 1;
if (has_isfinished()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->isfinished(), target);
}
// required .Diadoc.Api.Proto.Docflow.RevocationRequestDocflow RevocationRequest = 2;
if (has_revocationrequest()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->revocationrequest(), target);
}
// optional .Diadoc.Api.Proto.Docflow.RevocationResponseDocflow RevocationResponse = 3;
if (has_revocationresponse()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->revocationresponse(), target);
}
// required string InitiatorBoxId = 4;
if (has_initiatorboxid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->initiatorboxid().data(), this->initiatorboxid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"initiatorboxid");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
4, this->initiatorboxid(), target);
}
// required .Diadoc.Api.Proto.Documents.RevocationStatus RevocationStatus = 5;
if (has_revocationstatus()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
5, this->revocationstatus(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionEntitiesV3 ResolutionEntities = 6;
if (has_resolutionentities()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
6, this->resolutionentities(), target);
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflowEntities OuterDocflowEntities = 7;
for (int i = 0; i < this->outerdocflowentities_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
7, this->outerdocflowentities(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.RevocationDocflowV3)
return target;
}
int RevocationDocflowV3::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required bool IsFinished = 1;
if (has_isfinished()) {
total_size += 1 + 1;
}
// required .Diadoc.Api.Proto.Docflow.RevocationRequestDocflow RevocationRequest = 2;
if (has_revocationrequest()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->revocationrequest());
}
// optional .Diadoc.Api.Proto.Docflow.RevocationResponseDocflow RevocationResponse = 3;
if (has_revocationresponse()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->revocationresponse());
}
// required string InitiatorBoxId = 4;
if (has_initiatorboxid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->initiatorboxid());
}
// required .Diadoc.Api.Proto.Documents.RevocationStatus RevocationStatus = 5;
if (has_revocationstatus()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->revocationstatus());
}
// optional .Diadoc.Api.Proto.Docflow.ResolutionEntitiesV3 ResolutionEntities = 6;
if (has_resolutionentities()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->resolutionentities());
}
}
// repeated .Diadoc.Api.Proto.Docflow.OuterDocflowEntities OuterDocflowEntities = 7;
total_size += 1 * this->outerdocflowentities_size();
for (int i = 0; i < this->outerdocflowentities_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->outerdocflowentities(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void RevocationDocflowV3::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const RevocationDocflowV3* source =
::google::protobuf::internal::dynamic_cast_if_available<const RevocationDocflowV3*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void RevocationDocflowV3::MergeFrom(const RevocationDocflowV3& from) {
GOOGLE_CHECK_NE(&from, this);
outerdocflowentities_.MergeFrom(from.outerdocflowentities_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_isfinished()) {
set_isfinished(from.isfinished());
}
if (from.has_revocationrequest()) {
mutable_revocationrequest()->::Diadoc::Api::Proto::Docflow::RevocationRequestDocflow::MergeFrom(from.revocationrequest());
}
if (from.has_revocationresponse()) {
mutable_revocationresponse()->::Diadoc::Api::Proto::Docflow::RevocationResponseDocflow::MergeFrom(from.revocationresponse());
}
if (from.has_initiatorboxid()) {
set_initiatorboxid(from.initiatorboxid());
}
if (from.has_revocationstatus()) {
set_revocationstatus(from.revocationstatus());
}
if (from.has_resolutionentities()) {
mutable_resolutionentities()->::Diadoc::Api::Proto::Docflow::ResolutionEntitiesV3::MergeFrom(from.resolutionentities());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void RevocationDocflowV3::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RevocationDocflowV3::CopyFrom(const RevocationDocflowV3& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RevocationDocflowV3::IsInitialized() const {
if ((_has_bits_[0] & 0x0000001b) != 0x0000001b) return false;
if (has_revocationrequest()) {
if (!this->revocationrequest().IsInitialized()) return false;
}
if (has_revocationresponse()) {
if (!this->revocationresponse().IsInitialized()) return false;
}
if (has_resolutionentities()) {
if (!this->resolutionentities().IsInitialized()) return false;
}
if (!::google::protobuf::internal::AllAreInitialized(this->outerdocflowentities())) return false;
return true;
}
void RevocationDocflowV3::Swap(RevocationDocflowV3* other) {
if (other != this) {
std::swap(isfinished_, other->isfinished_);
std::swap(revocationrequest_, other->revocationrequest_);
std::swap(revocationresponse_, other->revocationresponse_);
std::swap(initiatorboxid_, other->initiatorboxid_);
std::swap(revocationstatus_, other->revocationstatus_);
std::swap(resolutionentities_, other->resolutionentities_);
outerdocflowentities_.Swap(&other->outerdocflowentities_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata RevocationDocflowV3::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = RevocationDocflowV3_descriptor_;
metadata.reflection = RevocationDocflowV3_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int RevocationRequestDocflow::kRevocationRequestFieldNumber;
const int RevocationRequestDocflow::kSentAtFieldNumber;
const int RevocationRequestDocflow::kDeliveredAtFieldNumber;
const int RevocationRequestDocflow::kRoamingNotificationFieldNumber;
const int RevocationRequestDocflow::kPlainTextFieldNumber;
#endif // !_MSC_VER
RevocationRequestDocflow::RevocationRequestDocflow()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
}
void RevocationRequestDocflow::InitAsDefaultInstance() {
revocationrequest_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignedAttachmentV3*>(&::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::default_instance());
sentat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
deliveredat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
roamingnotification_ = const_cast< ::Diadoc::Api::Proto::Docflow::RoamingNotification*>(&::Diadoc::Api::Proto::Docflow::RoamingNotification::default_instance());
}
RevocationRequestDocflow::RevocationRequestDocflow(const RevocationRequestDocflow& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
}
void RevocationRequestDocflow::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
revocationrequest_ = NULL;
sentat_ = NULL;
deliveredat_ = NULL;
roamingnotification_ = NULL;
plaintext_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
RevocationRequestDocflow::~RevocationRequestDocflow() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
SharedDtor();
}
void RevocationRequestDocflow::SharedDtor() {
if (plaintext_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete plaintext_;
}
if (this != default_instance_) {
delete revocationrequest_;
delete sentat_;
delete deliveredat_;
delete roamingnotification_;
}
}
void RevocationRequestDocflow::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RevocationRequestDocflow::descriptor() {
protobuf_AssignDescriptorsOnce();
return RevocationRequestDocflow_descriptor_;
}
const RevocationRequestDocflow& RevocationRequestDocflow::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
RevocationRequestDocflow* RevocationRequestDocflow::default_instance_ = NULL;
RevocationRequestDocflow* RevocationRequestDocflow::New() const {
return new RevocationRequestDocflow;
}
void RevocationRequestDocflow::Clear() {
if (_has_bits_[0 / 32] & 31) {
if (has_revocationrequest()) {
if (revocationrequest_ != NULL) revocationrequest_->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::Clear();
}
if (has_sentat()) {
if (sentat_ != NULL) sentat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_deliveredat()) {
if (deliveredat_ != NULL) deliveredat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_roamingnotification()) {
if (roamingnotification_ != NULL) roamingnotification_->::Diadoc::Api::Proto::Docflow::RoamingNotification::Clear();
}
if (has_plaintext()) {
if (plaintext_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
plaintext_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool RevocationRequestDocflow::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 RevocationRequest = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_revocationrequest()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_SentAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 2;
case 2: {
if (tag == 18) {
parse_SentAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_sentat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_DeliveredAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 3;
case 3: {
if (tag == 26) {
parse_DeliveredAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_deliveredat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_RoamingNotification;
break;
}
// optional .Diadoc.Api.Proto.Docflow.RoamingNotification RoamingNotification = 4;
case 4: {
if (tag == 34) {
parse_RoamingNotification:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_roamingnotification()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_PlainText;
break;
}
// optional string PlainText = 5;
case 5: {
if (tag == 42) {
parse_PlainText:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_plaintext()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::PARSE,
"plaintext");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
return false;
#undef DO_
}
void RevocationRequestDocflow::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 RevocationRequest = 1;
if (has_revocationrequest()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->revocationrequest(), output);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 2;
if (has_sentat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->sentat(), output);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 3;
if (has_deliveredat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->deliveredat(), output);
}
// optional .Diadoc.Api.Proto.Docflow.RoamingNotification RoamingNotification = 4;
if (has_roamingnotification()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->roamingnotification(), output);
}
// optional string PlainText = 5;
if (has_plaintext()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"plaintext");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
5, this->plaintext(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
}
::google::protobuf::uint8* RevocationRequestDocflow::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 RevocationRequest = 1;
if (has_revocationrequest()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->revocationrequest(), target);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 2;
if (has_sentat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->sentat(), target);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 3;
if (has_deliveredat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->deliveredat(), target);
}
// optional .Diadoc.Api.Proto.Docflow.RoamingNotification RoamingNotification = 4;
if (has_roamingnotification()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->roamingnotification(), target);
}
// optional string PlainText = 5;
if (has_plaintext()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->plaintext().data(), this->plaintext().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"plaintext");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
5, this->plaintext(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.RevocationRequestDocflow)
return target;
}
int RevocationRequestDocflow::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 RevocationRequest = 1;
if (has_revocationrequest()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->revocationrequest());
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 2;
if (has_sentat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->sentat());
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 3;
if (has_deliveredat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->deliveredat());
}
// optional .Diadoc.Api.Proto.Docflow.RoamingNotification RoamingNotification = 4;
if (has_roamingnotification()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->roamingnotification());
}
// optional string PlainText = 5;
if (has_plaintext()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->plaintext());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void RevocationRequestDocflow::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const RevocationRequestDocflow* source =
::google::protobuf::internal::dynamic_cast_if_available<const RevocationRequestDocflow*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void RevocationRequestDocflow::MergeFrom(const RevocationRequestDocflow& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_revocationrequest()) {
mutable_revocationrequest()->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::MergeFrom(from.revocationrequest());
}
if (from.has_sentat()) {
mutable_sentat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.sentat());
}
if (from.has_deliveredat()) {
mutable_deliveredat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.deliveredat());
}
if (from.has_roamingnotification()) {
mutable_roamingnotification()->::Diadoc::Api::Proto::Docflow::RoamingNotification::MergeFrom(from.roamingnotification());
}
if (from.has_plaintext()) {
set_plaintext(from.plaintext());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void RevocationRequestDocflow::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RevocationRequestDocflow::CopyFrom(const RevocationRequestDocflow& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RevocationRequestDocflow::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_revocationrequest()) {
if (!this->revocationrequest().IsInitialized()) return false;
}
if (has_sentat()) {
if (!this->sentat().IsInitialized()) return false;
}
if (has_deliveredat()) {
if (!this->deliveredat().IsInitialized()) return false;
}
if (has_roamingnotification()) {
if (!this->roamingnotification().IsInitialized()) return false;
}
return true;
}
void RevocationRequestDocflow::Swap(RevocationRequestDocflow* other) {
if (other != this) {
std::swap(revocationrequest_, other->revocationrequest_);
std::swap(sentat_, other->sentat_);
std::swap(deliveredat_, other->deliveredat_);
std::swap(roamingnotification_, other->roamingnotification_);
std::swap(plaintext_, other->plaintext_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata RevocationRequestDocflow::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = RevocationRequestDocflow_descriptor_;
metadata.reflection = RevocationRequestDocflow_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int RevocationResponseDocflow::kRecipientSignatureFieldNumber;
const int RevocationResponseDocflow::kSignatureRejectionFieldNumber;
#endif // !_MSC_VER
RevocationResponseDocflow::RevocationResponseDocflow()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
}
void RevocationResponseDocflow::InitAsDefaultInstance() {
recipientsignature_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignatureV3*>(&::Diadoc::Api::Proto::Docflow::SignatureV3::default_instance());
signaturerejection_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignatureRejectionDocflow*>(&::Diadoc::Api::Proto::Docflow::SignatureRejectionDocflow::default_instance());
}
RevocationResponseDocflow::RevocationResponseDocflow(const RevocationResponseDocflow& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
}
void RevocationResponseDocflow::SharedCtor() {
_cached_size_ = 0;
recipientsignature_ = NULL;
signaturerejection_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
RevocationResponseDocflow::~RevocationResponseDocflow() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
SharedDtor();
}
void RevocationResponseDocflow::SharedDtor() {
if (this != default_instance_) {
delete recipientsignature_;
delete signaturerejection_;
}
}
void RevocationResponseDocflow::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* RevocationResponseDocflow::descriptor() {
protobuf_AssignDescriptorsOnce();
return RevocationResponseDocflow_descriptor_;
}
const RevocationResponseDocflow& RevocationResponseDocflow::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
RevocationResponseDocflow* RevocationResponseDocflow::default_instance_ = NULL;
RevocationResponseDocflow* RevocationResponseDocflow::New() const {
return new RevocationResponseDocflow;
}
void RevocationResponseDocflow::Clear() {
if (_has_bits_[0 / 32] & 3) {
if (has_recipientsignature()) {
if (recipientsignature_ != NULL) recipientsignature_->::Diadoc::Api::Proto::Docflow::SignatureV3::Clear();
}
if (has_signaturerejection()) {
if (signaturerejection_ != NULL) signaturerejection_->::Diadoc::Api::Proto::Docflow::SignatureRejectionDocflow::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool RevocationResponseDocflow::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .Diadoc.Api.Proto.Docflow.SignatureV3 RecipientSignature = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_recipientsignature()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_SignatureRejection;
break;
}
// optional .Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow SignatureRejection = 2;
case 2: {
if (tag == 18) {
parse_SignatureRejection:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_signaturerejection()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
return false;
#undef DO_
}
void RevocationResponseDocflow::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
// optional .Diadoc.Api.Proto.Docflow.SignatureV3 RecipientSignature = 1;
if (has_recipientsignature()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->recipientsignature(), output);
}
// optional .Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow SignatureRejection = 2;
if (has_signaturerejection()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->signaturerejection(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
}
::google::protobuf::uint8* RevocationResponseDocflow::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
// optional .Diadoc.Api.Proto.Docflow.SignatureV3 RecipientSignature = 1;
if (has_recipientsignature()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->recipientsignature(), target);
}
// optional .Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow SignatureRejection = 2;
if (has_signaturerejection()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->signaturerejection(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.RevocationResponseDocflow)
return target;
}
int RevocationResponseDocflow::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional .Diadoc.Api.Proto.Docflow.SignatureV3 RecipientSignature = 1;
if (has_recipientsignature()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->recipientsignature());
}
// optional .Diadoc.Api.Proto.Docflow.SignatureRejectionDocflow SignatureRejection = 2;
if (has_signaturerejection()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->signaturerejection());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void RevocationResponseDocflow::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const RevocationResponseDocflow* source =
::google::protobuf::internal::dynamic_cast_if_available<const RevocationResponseDocflow*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void RevocationResponseDocflow::MergeFrom(const RevocationResponseDocflow& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_recipientsignature()) {
mutable_recipientsignature()->::Diadoc::Api::Proto::Docflow::SignatureV3::MergeFrom(from.recipientsignature());
}
if (from.has_signaturerejection()) {
mutable_signaturerejection()->::Diadoc::Api::Proto::Docflow::SignatureRejectionDocflow::MergeFrom(from.signaturerejection());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void RevocationResponseDocflow::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void RevocationResponseDocflow::CopyFrom(const RevocationResponseDocflow& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool RevocationResponseDocflow::IsInitialized() const {
if (has_recipientsignature()) {
if (!this->recipientsignature().IsInitialized()) return false;
}
if (has_signaturerejection()) {
if (!this->signaturerejection().IsInitialized()) return false;
}
return true;
}
void RevocationResponseDocflow::Swap(RevocationResponseDocflow* other) {
if (other != this) {
std::swap(recipientsignature_, other->recipientsignature_);
std::swap(signaturerejection_, other->signaturerejection_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata RevocationResponseDocflow::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = RevocationResponseDocflow_descriptor_;
metadata.reflection = RevocationResponseDocflow_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ReceiptDocflowV3::kIsFinishedFieldNumber;
const int ReceiptDocflowV3::kReceiptAttachmentFieldNumber;
const int ReceiptDocflowV3::kSentAtFieldNumber;
const int ReceiptDocflowV3::kDeliveredAtFieldNumber;
const int ReceiptDocflowV3::kConfirmationFieldNumber;
const int ReceiptDocflowV3::kStatusFieldNumber;
#endif // !_MSC_VER
ReceiptDocflowV3::ReceiptDocflowV3()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
}
void ReceiptDocflowV3::InitAsDefaultInstance() {
receiptattachment_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignedAttachmentV3*>(&::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::default_instance());
sentat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
deliveredat_ = const_cast< ::Diadoc::Api::Proto::Timestamp*>(&::Diadoc::Api::Proto::Timestamp::default_instance());
confirmation_ = const_cast< ::Diadoc::Api::Proto::Docflow::ConfirmationDocflow*>(&::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::default_instance());
}
ReceiptDocflowV3::ReceiptDocflowV3(const ReceiptDocflowV3& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
}
void ReceiptDocflowV3::SharedCtor() {
_cached_size_ = 0;
isfinished_ = false;
receiptattachment_ = NULL;
sentat_ = NULL;
deliveredat_ = NULL;
confirmation_ = NULL;
status_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ReceiptDocflowV3::~ReceiptDocflowV3() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
SharedDtor();
}
void ReceiptDocflowV3::SharedDtor() {
if (this != default_instance_) {
delete receiptattachment_;
delete sentat_;
delete deliveredat_;
delete confirmation_;
}
}
void ReceiptDocflowV3::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ReceiptDocflowV3::descriptor() {
protobuf_AssignDescriptorsOnce();
return ReceiptDocflowV3_descriptor_;
}
const ReceiptDocflowV3& ReceiptDocflowV3::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
ReceiptDocflowV3* ReceiptDocflowV3::default_instance_ = NULL;
ReceiptDocflowV3* ReceiptDocflowV3::New() const {
return new ReceiptDocflowV3;
}
void ReceiptDocflowV3::Clear() {
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
&reinterpret_cast<ReceiptDocflowV3*>(16)->f) - \
reinterpret_cast<char*>(16))
#define ZR_(first, last) do { \
size_t f = OFFSET_OF_FIELD_(first); \
size_t n = OFFSET_OF_FIELD_(last) - f + sizeof(last); \
::memset(&first, 0, n); \
} while (0)
if (_has_bits_[0 / 32] & 63) {
ZR_(isfinished_, status_);
if (has_receiptattachment()) {
if (receiptattachment_ != NULL) receiptattachment_->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::Clear();
}
if (has_sentat()) {
if (sentat_ != NULL) sentat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_deliveredat()) {
if (deliveredat_ != NULL) deliveredat_->::Diadoc::Api::Proto::Timestamp::Clear();
}
if (has_confirmation()) {
if (confirmation_ != NULL) confirmation_->::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::Clear();
}
}
#undef OFFSET_OF_FIELD_
#undef ZR_
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ReceiptDocflowV3::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required bool IsFinished = 1;
case 1: {
if (tag == 8) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &isfinished_)));
set_has_isfinished();
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_ReceiptAttachment;
break;
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 ReceiptAttachment = 2;
case 2: {
if (tag == 18) {
parse_ReceiptAttachment:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_receiptattachment()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_SentAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
case 3: {
if (tag == 26) {
parse_SentAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_sentat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(34)) goto parse_DeliveredAt;
break;
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
case 4: {
if (tag == 34) {
parse_DeliveredAt:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_deliveredat()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(42)) goto parse_Confirmation;
break;
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow Confirmation = 5;
case 5: {
if (tag == 42) {
parse_Confirmation:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_confirmation()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(48)) goto parse_Status;
break;
}
// required .Diadoc.Api.Proto.Documents.GeneralReceiptStatus Status = 6;
case 6: {
if (tag == 48) {
parse_Status:
int value;
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>(
input, &value)));
if (::Diadoc::Api::Proto::Documents::GeneralReceiptStatus_IsValid(value)) {
set_status(static_cast< ::Diadoc::Api::Proto::Documents::GeneralReceiptStatus >(value));
} else {
mutable_unknown_fields()->AddVarint(6, value);
}
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
return false;
#undef DO_
}
void ReceiptDocflowV3::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
// required bool IsFinished = 1;
if (has_isfinished()) {
::google::protobuf::internal::WireFormatLite::WriteBool(1, this->isfinished(), output);
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 ReceiptAttachment = 2;
if (has_receiptattachment()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->receiptattachment(), output);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->sentat(), output);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->deliveredat(), output);
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow Confirmation = 5;
if (has_confirmation()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
5, this->confirmation(), output);
}
// required .Diadoc.Api.Proto.Documents.GeneralReceiptStatus Status = 6;
if (has_status()) {
::google::protobuf::internal::WireFormatLite::WriteEnum(
6, this->status(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
}
::google::protobuf::uint8* ReceiptDocflowV3::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
// required bool IsFinished = 1;
if (has_isfinished()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(1, this->isfinished(), target);
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 ReceiptAttachment = 2;
if (has_receiptattachment()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->receiptattachment(), target);
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->sentat(), target);
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->deliveredat(), target);
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow Confirmation = 5;
if (has_confirmation()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
5, this->confirmation(), target);
}
// required .Diadoc.Api.Proto.Documents.GeneralReceiptStatus Status = 6;
if (has_status()) {
target = ::google::protobuf::internal::WireFormatLite::WriteEnumToArray(
6, this->status(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.ReceiptDocflowV3)
return target;
}
int ReceiptDocflowV3::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required bool IsFinished = 1;
if (has_isfinished()) {
total_size += 1 + 1;
}
// optional .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 ReceiptAttachment = 2;
if (has_receiptattachment()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->receiptattachment());
}
// optional .Diadoc.Api.Proto.Timestamp SentAt = 3;
if (has_sentat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->sentat());
}
// optional .Diadoc.Api.Proto.Timestamp DeliveredAt = 4;
if (has_deliveredat()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->deliveredat());
}
// optional .Diadoc.Api.Proto.Docflow.ConfirmationDocflow Confirmation = 5;
if (has_confirmation()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->confirmation());
}
// required .Diadoc.Api.Proto.Documents.GeneralReceiptStatus Status = 6;
if (has_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::EnumSize(this->status());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ReceiptDocflowV3::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ReceiptDocflowV3* source =
::google::protobuf::internal::dynamic_cast_if_available<const ReceiptDocflowV3*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ReceiptDocflowV3::MergeFrom(const ReceiptDocflowV3& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_isfinished()) {
set_isfinished(from.isfinished());
}
if (from.has_receiptattachment()) {
mutable_receiptattachment()->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::MergeFrom(from.receiptattachment());
}
if (from.has_sentat()) {
mutable_sentat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.sentat());
}
if (from.has_deliveredat()) {
mutable_deliveredat()->::Diadoc::Api::Proto::Timestamp::MergeFrom(from.deliveredat());
}
if (from.has_confirmation()) {
mutable_confirmation()->::Diadoc::Api::Proto::Docflow::ConfirmationDocflow::MergeFrom(from.confirmation());
}
if (from.has_status()) {
set_status(from.status());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ReceiptDocflowV3::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReceiptDocflowV3::CopyFrom(const ReceiptDocflowV3& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ReceiptDocflowV3::IsInitialized() const {
if ((_has_bits_[0] & 0x00000021) != 0x00000021) return false;
if (has_receiptattachment()) {
if (!this->receiptattachment().IsInitialized()) return false;
}
if (has_sentat()) {
if (!this->sentat().IsInitialized()) return false;
}
if (has_deliveredat()) {
if (!this->deliveredat().IsInitialized()) return false;
}
if (has_confirmation()) {
if (!this->confirmation().IsInitialized()) return false;
}
return true;
}
void ReceiptDocflowV3::Swap(ReceiptDocflowV3* other) {
if (other != this) {
std::swap(isfinished_, other->isfinished_);
std::swap(receiptattachment_, other->receiptattachment_);
std::swap(sentat_, other->sentat_);
std::swap(deliveredat_, other->deliveredat_);
std::swap(confirmation_, other->confirmation_);
std::swap(status_, other->status_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ReceiptDocflowV3::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ReceiptDocflowV3_descriptor_;
metadata.reflection = ReceiptDocflowV3_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int OuterDocflow::kDocflowNamedIdFieldNumber;
const int OuterDocflow::kParentEntityIdFieldNumber;
const int OuterDocflow::kOuterDocflowEntityIdFieldNumber;
#endif // !_MSC_VER
OuterDocflow::OuterDocflow()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.OuterDocflow)
}
void OuterDocflow::InitAsDefaultInstance() {
}
OuterDocflow::OuterDocflow(const OuterDocflow& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.OuterDocflow)
}
void OuterDocflow::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
docflownamedid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
parententityid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
outerdocflowentityid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
OuterDocflow::~OuterDocflow() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.OuterDocflow)
SharedDtor();
}
void OuterDocflow::SharedDtor() {
if (docflownamedid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete docflownamedid_;
}
if (parententityid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete parententityid_;
}
if (outerdocflowentityid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete outerdocflowentityid_;
}
if (this != default_instance_) {
}
}
void OuterDocflow::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* OuterDocflow::descriptor() {
protobuf_AssignDescriptorsOnce();
return OuterDocflow_descriptor_;
}
const OuterDocflow& OuterDocflow::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
OuterDocflow* OuterDocflow::default_instance_ = NULL;
OuterDocflow* OuterDocflow::New() const {
return new OuterDocflow;
}
void OuterDocflow::Clear() {
if (_has_bits_[0 / 32] & 7) {
if (has_docflownamedid()) {
if (docflownamedid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
docflownamedid_->clear();
}
}
if (has_parententityid()) {
if (parententityid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
parententityid_->clear();
}
}
if (has_outerdocflowentityid()) {
if (outerdocflowentityid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
outerdocflowentityid_->clear();
}
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool OuterDocflow::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.OuterDocflow)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required string DocflowNamedId = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_docflownamedid()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflownamedid().data(), this->docflownamedid().length(),
::google::protobuf::internal::WireFormat::PARSE,
"docflownamedid");
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_ParentEntityId;
break;
}
// required string ParentEntityId = 2;
case 2: {
if (tag == 18) {
parse_ParentEntityId:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_parententityid()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->parententityid().data(), this->parententityid().length(),
::google::protobuf::internal::WireFormat::PARSE,
"parententityid");
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_OuterDocflowEntityId;
break;
}
// required string OuterDocflowEntityId = 3;
case 3: {
if (tag == 26) {
parse_OuterDocflowEntityId:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_outerdocflowentityid()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->outerdocflowentityid().data(), this->outerdocflowentityid().length(),
::google::protobuf::internal::WireFormat::PARSE,
"outerdocflowentityid");
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.OuterDocflow)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.OuterDocflow)
return false;
#undef DO_
}
void OuterDocflow::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.OuterDocflow)
// required string DocflowNamedId = 1;
if (has_docflownamedid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflownamedid().data(), this->docflownamedid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"docflownamedid");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->docflownamedid(), output);
}
// required string ParentEntityId = 2;
if (has_parententityid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->parententityid().data(), this->parententityid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"parententityid");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->parententityid(), output);
}
// required string OuterDocflowEntityId = 3;
if (has_outerdocflowentityid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->outerdocflowentityid().data(), this->outerdocflowentityid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"outerdocflowentityid");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
3, this->outerdocflowentityid(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.OuterDocflow)
}
::google::protobuf::uint8* OuterDocflow::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.OuterDocflow)
// required string DocflowNamedId = 1;
if (has_docflownamedid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflownamedid().data(), this->docflownamedid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"docflownamedid");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->docflownamedid(), target);
}
// required string ParentEntityId = 2;
if (has_parententityid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->parententityid().data(), this->parententityid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"parententityid");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->parententityid(), target);
}
// required string OuterDocflowEntityId = 3;
if (has_outerdocflowentityid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->outerdocflowentityid().data(), this->outerdocflowentityid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"outerdocflowentityid");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->outerdocflowentityid(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.OuterDocflow)
return target;
}
int OuterDocflow::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required string DocflowNamedId = 1;
if (has_docflownamedid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->docflownamedid());
}
// required string ParentEntityId = 2;
if (has_parententityid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->parententityid());
}
// required string OuterDocflowEntityId = 3;
if (has_outerdocflowentityid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->outerdocflowentityid());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void OuterDocflow::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const OuterDocflow* source =
::google::protobuf::internal::dynamic_cast_if_available<const OuterDocflow*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void OuterDocflow::MergeFrom(const OuterDocflow& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_docflownamedid()) {
set_docflownamedid(from.docflownamedid());
}
if (from.has_parententityid()) {
set_parententityid(from.parententityid());
}
if (from.has_outerdocflowentityid()) {
set_outerdocflowentityid(from.outerdocflowentityid());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void OuterDocflow::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void OuterDocflow::CopyFrom(const OuterDocflow& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool OuterDocflow::IsInitialized() const {
if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false;
return true;
}
void OuterDocflow::Swap(OuterDocflow* other) {
if (other != this) {
std::swap(docflownamedid_, other->docflownamedid_);
std::swap(parententityid_, other->parententityid_);
std::swap(outerdocflowentityid_, other->outerdocflowentityid_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata OuterDocflow::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = OuterDocflow_descriptor_;
metadata.reflection = OuterDocflow_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int OuterDocflowEntities::kDocflowNamedIdFieldNumber;
const int OuterDocflowEntities::kDocflowFriendlyNameFieldNumber;
const int OuterDocflowEntities::kStatusEntitiesFieldNumber;
#endif // !_MSC_VER
OuterDocflowEntities::OuterDocflowEntities()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
}
void OuterDocflowEntities::InitAsDefaultInstance() {
}
OuterDocflowEntities::OuterDocflowEntities(const OuterDocflowEntities& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
}
void OuterDocflowEntities::SharedCtor() {
::google::protobuf::internal::GetEmptyString();
_cached_size_ = 0;
docflownamedid_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
docflowfriendlyname_ = const_cast< ::std::string*>(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
OuterDocflowEntities::~OuterDocflowEntities() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
SharedDtor();
}
void OuterDocflowEntities::SharedDtor() {
if (docflownamedid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete docflownamedid_;
}
if (docflowfriendlyname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
delete docflowfriendlyname_;
}
if (this != default_instance_) {
}
}
void OuterDocflowEntities::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* OuterDocflowEntities::descriptor() {
protobuf_AssignDescriptorsOnce();
return OuterDocflowEntities_descriptor_;
}
const OuterDocflowEntities& OuterDocflowEntities::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
OuterDocflowEntities* OuterDocflowEntities::default_instance_ = NULL;
OuterDocflowEntities* OuterDocflowEntities::New() const {
return new OuterDocflowEntities;
}
void OuterDocflowEntities::Clear() {
if (_has_bits_[0 / 32] & 3) {
if (has_docflownamedid()) {
if (docflownamedid_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
docflownamedid_->clear();
}
}
if (has_docflowfriendlyname()) {
if (docflowfriendlyname_ != &::google::protobuf::internal::GetEmptyStringAlreadyInited()) {
docflowfriendlyname_->clear();
}
}
}
statusentities_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool OuterDocflowEntities::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required string DocflowNamedId = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_docflownamedid()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflownamedid().data(), this->docflownamedid().length(),
::google::protobuf::internal::WireFormat::PARSE,
"docflownamedid");
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_DocflowFriendlyName;
break;
}
// required string DocflowFriendlyName = 2;
case 2: {
if (tag == 18) {
parse_DocflowFriendlyName:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_docflowfriendlyname()));
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflowfriendlyname().data(), this->docflowfriendlyname().length(),
::google::protobuf::internal::WireFormat::PARSE,
"docflowfriendlyname");
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_StatusEntities;
break;
}
// repeated .Diadoc.Api.Proto.Docflow.StatusEntity StatusEntities = 3;
case 3: {
if (tag == 26) {
parse_StatusEntities:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_statusentities()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(26)) goto parse_StatusEntities;
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
return false;
#undef DO_
}
void OuterDocflowEntities::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
// required string DocflowNamedId = 1;
if (has_docflownamedid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflownamedid().data(), this->docflownamedid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"docflownamedid");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
1, this->docflownamedid(), output);
}
// required string DocflowFriendlyName = 2;
if (has_docflowfriendlyname()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflowfriendlyname().data(), this->docflowfriendlyname().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"docflowfriendlyname");
::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased(
2, this->docflowfriendlyname(), output);
}
// repeated .Diadoc.Api.Proto.Docflow.StatusEntity StatusEntities = 3;
for (int i = 0; i < this->statusentities_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->statusentities(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
}
::google::protobuf::uint8* OuterDocflowEntities::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
// required string DocflowNamedId = 1;
if (has_docflownamedid()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflownamedid().data(), this->docflownamedid().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"docflownamedid");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->docflownamedid(), target);
}
// required string DocflowFriendlyName = 2;
if (has_docflowfriendlyname()) {
::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField(
this->docflowfriendlyname().data(), this->docflowfriendlyname().length(),
::google::protobuf::internal::WireFormat::SERIALIZE,
"docflowfriendlyname");
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
2, this->docflowfriendlyname(), target);
}
// repeated .Diadoc.Api.Proto.Docflow.StatusEntity StatusEntities = 3;
for (int i = 0; i < this->statusentities_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->statusentities(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.OuterDocflowEntities)
return target;
}
int OuterDocflowEntities::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required string DocflowNamedId = 1;
if (has_docflownamedid()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->docflownamedid());
}
// required string DocflowFriendlyName = 2;
if (has_docflowfriendlyname()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->docflowfriendlyname());
}
}
// repeated .Diadoc.Api.Proto.Docflow.StatusEntity StatusEntities = 3;
total_size += 1 * this->statusentities_size();
for (int i = 0; i < this->statusentities_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->statusentities(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void OuterDocflowEntities::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const OuterDocflowEntities* source =
::google::protobuf::internal::dynamic_cast_if_available<const OuterDocflowEntities*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void OuterDocflowEntities::MergeFrom(const OuterDocflowEntities& from) {
GOOGLE_CHECK_NE(&from, this);
statusentities_.MergeFrom(from.statusentities_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_docflownamedid()) {
set_docflownamedid(from.docflownamedid());
}
if (from.has_docflowfriendlyname()) {
set_docflowfriendlyname(from.docflowfriendlyname());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void OuterDocflowEntities::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void OuterDocflowEntities::CopyFrom(const OuterDocflowEntities& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool OuterDocflowEntities::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
if (!::google::protobuf::internal::AllAreInitialized(this->statusentities())) return false;
return true;
}
void OuterDocflowEntities::Swap(OuterDocflowEntities* other) {
if (other != this) {
std::swap(docflownamedid_, other->docflownamedid_);
std::swap(docflowfriendlyname_, other->docflowfriendlyname_);
statusentities_.Swap(&other->statusentities_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata OuterDocflowEntities::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = OuterDocflowEntities_descriptor_;
metadata.reflection = OuterDocflowEntities_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int StatusEntity::kAttachmentFieldNumber;
const int StatusEntity::kStatusFieldNumber;
#endif // !_MSC_VER
StatusEntity::StatusEntity()
: ::google::protobuf::Message() {
SharedCtor();
// @@protoc_insertion_point(constructor:Diadoc.Api.Proto.Docflow.StatusEntity)
}
void StatusEntity::InitAsDefaultInstance() {
attachment_ = const_cast< ::Diadoc::Api::Proto::Docflow::SignedAttachmentV3*>(&::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::default_instance());
status_ = const_cast< ::Diadoc::Api::Proto::Status*>(&::Diadoc::Api::Proto::Status::default_instance());
}
StatusEntity::StatusEntity(const StatusEntity& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
// @@protoc_insertion_point(copy_constructor:Diadoc.Api.Proto.Docflow.StatusEntity)
}
void StatusEntity::SharedCtor() {
_cached_size_ = 0;
attachment_ = NULL;
status_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
StatusEntity::~StatusEntity() {
// @@protoc_insertion_point(destructor:Diadoc.Api.Proto.Docflow.StatusEntity)
SharedDtor();
}
void StatusEntity::SharedDtor() {
if (this != default_instance_) {
delete attachment_;
delete status_;
}
}
void StatusEntity::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* StatusEntity::descriptor() {
protobuf_AssignDescriptorsOnce();
return StatusEntity_descriptor_;
}
const StatusEntity& StatusEntity::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_Docflow_2fDocflowV3_2eproto();
return *default_instance_;
}
StatusEntity* StatusEntity::default_instance_ = NULL;
StatusEntity* StatusEntity::New() const {
return new StatusEntity;
}
void StatusEntity::Clear() {
if (_has_bits_[0 / 32] & 3) {
if (has_attachment()) {
if (attachment_ != NULL) attachment_->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::Clear();
}
if (has_status()) {
if (status_ != NULL) status_->::Diadoc::Api::Proto::Status::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool StatusEntity::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::google::protobuf::uint32 tag;
// @@protoc_insertion_point(parse_start:Diadoc.Api.Proto.Docflow.StatusEntity)
for (;;) {
::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127);
tag = p.first;
if (!p.second) goto handle_unusual;
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Attachment = 1;
case 1: {
if (tag == 10) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_attachment()));
} else {
goto handle_unusual;
}
if (input->ExpectTag(18)) goto parse_Status;
break;
}
// required .Diadoc.Api.Proto.Status Status = 2;
case 2: {
if (tag == 18) {
parse_Status:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_status()));
} else {
goto handle_unusual;
}
if (input->ExpectAtEnd()) goto success;
break;
}
default: {
handle_unusual:
if (tag == 0 ||
::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
goto success;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
success:
// @@protoc_insertion_point(parse_success:Diadoc.Api.Proto.Docflow.StatusEntity)
return true;
failure:
// @@protoc_insertion_point(parse_failure:Diadoc.Api.Proto.Docflow.StatusEntity)
return false;
#undef DO_
}
void StatusEntity::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// @@protoc_insertion_point(serialize_start:Diadoc.Api.Proto.Docflow.StatusEntity)
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Attachment = 1;
if (has_attachment()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->attachment(), output);
}
// required .Diadoc.Api.Proto.Status Status = 2;
if (has_status()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->status(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
// @@protoc_insertion_point(serialize_end:Diadoc.Api.Proto.Docflow.StatusEntity)
}
::google::protobuf::uint8* StatusEntity::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// @@protoc_insertion_point(serialize_to_array_start:Diadoc.Api.Proto.Docflow.StatusEntity)
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Attachment = 1;
if (has_attachment()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->attachment(), target);
}
// required .Diadoc.Api.Proto.Status Status = 2;
if (has_status()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->status(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
// @@protoc_insertion_point(serialize_to_array_end:Diadoc.Api.Proto.Docflow.StatusEntity)
return target;
}
int StatusEntity::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .Diadoc.Api.Proto.Docflow.SignedAttachmentV3 Attachment = 1;
if (has_attachment()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->attachment());
}
// required .Diadoc.Api.Proto.Status Status = 2;
if (has_status()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->status());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void StatusEntity::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const StatusEntity* source =
::google::protobuf::internal::dynamic_cast_if_available<const StatusEntity*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void StatusEntity::MergeFrom(const StatusEntity& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_attachment()) {
mutable_attachment()->::Diadoc::Api::Proto::Docflow::SignedAttachmentV3::MergeFrom(from.attachment());
}
if (from.has_status()) {
mutable_status()->::Diadoc::Api::Proto::Status::MergeFrom(from.status());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void StatusEntity::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void StatusEntity::CopyFrom(const StatusEntity& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool StatusEntity::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
if (has_attachment()) {
if (!this->attachment().IsInitialized()) return false;
}
if (has_status()) {
if (!this->status().IsInitialized()) return false;
}
return true;
}
void StatusEntity::Swap(StatusEntity* other) {
if (other != this) {
std::swap(attachment_, other->attachment_);
std::swap(status_, other->status_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata StatusEntity::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = StatusEntity_descriptor_;
metadata.reflection = StatusEntity_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace Docflow
} // namespace Proto
} // namespace Api
} // namespace Diadoc
// @@protoc_insertion_point(global_scope)
| 37.271194 | 175 | 0.697133 | ltitbe |
5ffa024c40a0443955509fdc2a5e14238e3c0ee8 | 1,005 | cpp | C++ | Cxx-Primer/Solutions/ch08/ex8_08.cpp | memcpy0/CxxPrimer-Solutions | 423dc687054490f7897782908edc86871e2d6a7a | [
"Apache-2.0"
] | null | null | null | Cxx-Primer/Solutions/ch08/ex8_08.cpp | memcpy0/CxxPrimer-Solutions | 423dc687054490f7897782908edc86871e2d6a7a | [
"Apache-2.0"
] | null | null | null | Cxx-Primer/Solutions/ch08/ex8_08.cpp | memcpy0/CxxPrimer-Solutions | 423dc687054490f7897782908edc86871e2d6a7a | [
"Apache-2.0"
] | 1 | 2021-11-10T09:20:33.000Z | 2021-11-10T09:20:33.000Z | /* ex8_08.cpp
** Exercise 8.8
**
** Created by memcpy on 2021/10/16.
** @Brief Revise the program from the previous exercise to append its output to its given file.
** Run the program on the same output file at least twice to ensure that the data are preserved
** @See ex8_07.cpp
** @Run give a parameter: "../data/book.txt ../data/out.txt"
** @Output 0-201-78345-X 5 110
** 0-201-78346-X 9 839.2
*/
#include <fstream>
#include <iostream>
#include "../ch07/ex7_26.h"
int main(int argc, char **argv) {
std::ifstream input(argv[1]);
std::ofstream output(argv[2], std::ofstream::app); // or std::ofstream::out | std::ofstream::app
Sales_data total;
if (read(input, total)) {
Sales_data trans;
while (read(input, trans)) {
if (total.isbn() == trans.isbn())
total.combine(trans);
else {
print(output, total) << std::endl;
total = trans;
}
}
print(output, total) << std::endl;
} else {
std::cerr << "No data?!" << std::endl;
}
return 0;
} | 28.714286 | 104 | 0.624876 | memcpy0 |
2700cfc3a1ebf02756c294cba71fa8a057d4de9f | 317 | cpp | C++ | graphics.cpp | travmygit/fffrenderer | a7d713bc43745838fbfc6c2015439deac37ef14c | [
"MIT"
] | null | null | null | graphics.cpp | travmygit/fffrenderer | a7d713bc43745838fbfc6c2015439deac37ef14c | [
"MIT"
] | null | null | null | graphics.cpp | travmygit/fffrenderer | a7d713bc43745838fbfc6c2015439deac37ef14c | [
"MIT"
] | 1 | 2022-03-18T04:12:24.000Z | 2022-03-18T04:12:24.000Z | #include "graphics.h"
fff::Color fff::Color::White = fff::Color(255, 255, 255, 255);
fff::Color fff::Color::Black = fff::Color(0, 0, 0, 255);
fff::Color fff::Color::Red = fff::Color(255, 0, 0, 255);
fff::Color fff::Color::Green = fff::Color(0, 255, 0, 255);
fff::Color fff::Color::Blue = fff::Color(0, 0, 255, 255); | 39.625 | 62 | 0.630915 | travmygit |
dfeea373ab0e9302c1724cef0515ccd53e9ff5bb | 9,507 | cpp | C++ | Engine/Output/Graphics/Animation/TexturedAnimation/TexturedAnimation.cpp | gregory-vovchok/YEngine | e28552e52588bd90db01dd53e5fc817d0a26d146 | [
"BSD-2-Clause"
] | null | null | null | Engine/Output/Graphics/Animation/TexturedAnimation/TexturedAnimation.cpp | gregory-vovchok/YEngine | e28552e52588bd90db01dd53e5fc817d0a26d146 | [
"BSD-2-Clause"
] | null | null | null | Engine/Output/Graphics/Animation/TexturedAnimation/TexturedAnimation.cpp | gregory-vovchok/YEngine | e28552e52588bd90db01dd53e5fc817d0a26d146 | [
"BSD-2-Clause"
] | 1 | 2020-12-04T08:57:03.000Z | 2020-12-04T08:57:03.000Z | #include "TexturedAnimation.h"
#include <Engine/Output/File/File.h>
#include <Engine/Core/AssetLibrary/AssetLibrary.h>
#ifdef SendMessage
#undef SendMessage
#endif
StringANSI TexturedAnimation::texturedAnimationsSuffix = "t-anim";
StringANSI TexturedAnimation::texturedAnimationsDir = "/animations/t-animations/";
TexturedAnimation::TexturedAnimation(void): currentFrameInfo(NIL), positionOffsetEnable(false), hitboxEnable(false)
{
AddClassProperty(TEXTURED_ANIMATION_CLASS);
}
TexturedAnimation::~TexturedAnimation(void)
{
Destroy();
Destroying();
}
Hitbox* TexturedAnimation::GetHitbox(void)const
{
if(atlas.IsNotEmpty())
{
Atlas2D::Frame* frame = atlas.Get()->GetFrameInfo(currentFrame);
if(frame) { return frame->GetHitbox(); }
}
return NIL;
}
bool TexturedAnimation::IsHitboxEnabled(void)const
{
return hitboxEnable;
}
void TexturedAnimation::SetHitboxEnable(bool _enable)
{
hitboxEnable = _enable;
if(IsReceiversExist(PolygonalSurface::CHANGE_HITBOX_ENABLE_MESSAGE)) { SendPackage(PolygonalSurface::CHANGE_HITBOX_ENABLE_MESSAGE, hitboxEnable); }
}
void TexturedAnimation::Destroy(void)
{
if(atlas.IsNotEmpty())
{
if(IsReceiversExist(DESTROY_TEXTURED_ANIMATION_MESSAGE)) { SendMessage(DESTROY_TEXTURED_ANIMATION_MESSAGE); }
atlas.Get()->Disconnect(Atlas2D::DESTROY_ATLAS_MESSAGE, this);
atlas.Get()->Disconnect(Atlas2D::INIT_ATLAS_MESSAGE, this);
atlas.Clear();
amountOfFrames = 0;
currentFrameSize = Vector2(0.0f, 0.0f);
currentFrameInfo = NIL;
}
}
Atlas2D* TexturedAnimation::GetAtlas(void)
{
return atlas.Get();
}
bool TexturedAnimation::IsExist(void)const
{
return atlas.IsNotEmpty() && atlas.Get()->IsExist();
}
Atlas2D::Frame* TexturedAnimation::GetCurrentFrameInfo(void)const
{
return currentFrameInfo;
}
void TexturedAnimation::SetCurrentFrame(StringANSI _frameName)
{
if(atlas.IsNotEmpty())
{
SetCurrentFrame(atlas.Get()->GetIndexOfFrame(_frameName));
}
}
StringANSI TexturedAnimation::GetNameOfCurrentFrame(void)const
{
if(atlas.IsNotEmpty())
{
Atlas2D::Frame* frame = atlas.Get()->GetFrameInfo(currentFrame);
if(frame) { return frame->GetName(); }
}
return "";
}
void TexturedAnimation::BindAtlas(Atlas2D* _atlas)
{
if(atlas.Get() != _atlas)
{
if(atlas.IsNotEmpty())
{
atlas.Get()->Disconnect(Atlas2D::DESTROY_ATLAS_MESSAGE, this);
atlas.Get()->Disconnect(Atlas2D::INIT_ATLAS_MESSAGE, this);
atlas.Get()->Disconnect(PolygonalSurface::CHANGE_HITBOX_MESSAGE, this);
AtlasIsDestroyed();
atlas.Clear();
}
if(_atlas)
{
atlas.Attach(_atlas);
atlas.Get()->Connect(Atlas2D::DESTROY_ATLAS_MESSAGE, this, Caller<>(this, &TexturedAnimation::AtlasIsDestroyed));
atlas.Get()->Connect(Atlas2D::INIT_ATLAS_MESSAGE, this, Caller<>(this, &TexturedAnimation::AtlasIsCreated));
atlas.Get()->Connect(PolygonalSurface::CHANGE_HITBOX_MESSAGE, this, Caller<>(this, &TexturedAnimation::HitboxIsChanged));
if(atlas.Get()->IsExist())
{
AtlasIsCreated();
}
if(IsReceiversExist(CHANGE_ATLAS_MESSAGE)) { SendPackage(CHANGE_ATLAS_MESSAGE, atlas.Get()->GetName()); }
}
}
}
void TexturedAnimation::HitboxIsChanged(StringANSI _name)
{
if(IsReceiversExist(PolygonalSurface::CHANGE_HITBOX_MESSAGE)) { SendPackage(PolygonalSurface::CHANGE_HITBOX_MESSAGE, _name); }
}
void TexturedAnimation::AtlasIsCreated(void)
{
amountOfFrames = atlas.Get()->GetAmountOfFrames();
currentFrameSize = atlas.Get()->GetFrameInfo(0)->sizeInPixels;
SetCurrentFrame(Numerical<int32>::_GetMin(currentFrame, amountOfFrames - 1));
if(IsReceiversExist(INIT_TEXTURED_ANIMATION_MESSAGE)) { SendMessage(INIT_TEXTURED_ANIMATION_MESSAGE); }
}
void TexturedAnimation::AtlasIsDestroyed(void)
{
if(IsReceiversExist(DESTROY_TEXTURED_ANIMATION_MESSAGE)) { SendMessage(DESTROY_TEXTURED_ANIMATION_MESSAGE); }
amountOfFrames = 0;
currentFrameSize = Vector2(0.0f, 0.0f);
currentFrameInfo = NIL;
}
Vector2 TexturedAnimation::GetCurrentFrameSize(void)const
{
return currentFrameSize;
}
void TexturedAnimation::CurrentFrameIsChanged(void)
{
if(atlas.IsNotEmpty())
{
if(currentFrameInfo = atlas.Get()->GetFrameInfo(currentFrame))
{
if(!atlas.Get()->IsFrameSizeAligned())
{
currentFrameSize = currentFrameInfo->sizeInPixels;
}
}
AbstractAnimation::CurrentFrameIsChanged();
}
}
bool TexturedAnimation::IsPositionOffsetEnabled(void)const
{
return positionOffsetEnable;
}
void TexturedAnimation::SetPositionOffsetEnable(bool _enable)
{
if(positionOffsetEnable == _enable) { return; }
positionOffsetEnable = _enable;
if(IsReceiversExist(ENABLE_POSITION_OFFSET_MESSAGE)) { SendPackage(ENABLE_POSITION_OFFSET_MESSAGE, positionOffsetEnable); }
}
StringANSI TexturedAnimation::_GetDir(void)
{
return texturedAnimationsDir;
}
void TexturedAnimation::_SetFileSuffix(StringANSI _suffix)
{
texturedAnimationsSuffix = _suffix;
}
StringANSI TexturedAnimation::_GetFileSuffix(void)
{
return texturedAnimationsSuffix;
}
bool TexturedAnimation::SaveToFile(StringANSI _path)
{
if(_path.empty())
{
_path = AssetLibrary::_GetDir() + texturedAnimationsDir + GetName() + "." + texturedAnimationsSuffix;
}
File file(_path, File::REWRITE);
if(!SaveToFile(file))
{
file.Remove();
return false;
}
return true;
}
bool TexturedAnimation::SaveToFile(File& _file)
{
if(_file.IsOpened() && (_file.GetAccessMode() == File::WRITE || _file.GetAccessMode() == File::REWRITE))
{
int32 version = 1;
_file.Write(version);
_file.Write(properties);
_file.Write(GetName().length());
_file.WriteString(GetName());
AbstractAnimation::SaveDerivedToFile(_file);
_file.Write(positionOffsetEnable);
_file.Write(atlas.IsNotEmpty());
if(atlas.IsNotEmpty())
{
bool atlasIsCommonAsset = atlas.Get()->GetAddress(&AssetLibrary::_GetAssets()) ? true : false;
_file.Write(atlasIsCommonAsset);
if(atlasIsCommonAsset)
{
if(!AssetLibrary::_IsAssetExist(atlas.Get()->GetName(), AssetLibrary::ATLAS_2D_ASSET))
{
atlas.Get()->SaveToFile();
}
_file.Write(atlas.Get()->GetName().length());
_file.WriteString(atlas.Get()->GetName());
}
else
{
atlas.Get()->SaveToFile(_file);
}
}
_file.Write(hitboxEnable);
return true;
}
return false;
}
bool TexturedAnimation::SaveAsToFile(StringANSI _name)
{
File file(AssetLibrary::_GetDir() + TexturedAnimation::_GetDir() + _name + "." + TexturedAnimation::_GetFileSuffix(), File::REWRITE);
if(!SaveAsToFile(file, _name))
{
file.Remove();
return false;
}
return true;
}
bool TexturedAnimation::SaveAsToFile(File& _file, StringANSI _name)
{
if(_file.IsOpened() && (_file.GetAccessMode() == File::WRITE || _file.GetAccessMode() == File::REWRITE))
{
int32 version = 1;
_file.Write(version);
_file.Write(properties);
_file.Write(_name.length());
_file.WriteString(_name);
AbstractAnimation::SaveDerivedToFile(_file);
_file.Write(positionOffsetEnable);
_file.Write(atlas.IsNotEmpty());
if(atlas.IsNotEmpty())
{
bool atlasIsCommonAsset = atlas.Get()->GetAddress(&AssetLibrary::_GetAssets()) ? true : false;
_file.Write(atlasIsCommonAsset);
if(atlasIsCommonAsset)
{
if(!AssetLibrary::_IsAssetExist(atlas.Get()->GetName(), AssetLibrary::ATLAS_2D_ASSET))
{
atlas.Get()->SaveToFile();
}
_file.Write(atlas.Get()->GetName().length());
_file.WriteString(atlas.Get()->GetName());
}
else
{
atlas.Get()->SaveToFile(_file);
}
}
_file.Write(hitboxEnable);
return true;
}
return false;
}
bool TexturedAnimation::LoadFromFile(StringANSI _path, bool _auto)
{
if(_auto)
{
_path = AssetLibrary::_GetDir() + texturedAnimationsDir + _path + "." + texturedAnimationsSuffix;
}
File file(_path, File::READ);
return LoadFromFile(file);
}
bool TexturedAnimation::LoadFromFile(File& _file)
{
if(_file.IsOpened() && _file.GetAccessMode() == File::READ)
{
Destroy();
int32 version;
_file.Read(version);
_file.Read(properties);
StringANSI name;
int32 length;
_file.Read(length);
_file.ReadString(name, length);
Rename(name);
AbstractAnimation::LoadDerivedFromFile(_file);
bool positionOffsetIsEnabled;
_file.Read(positionOffsetIsEnabled);
SetPositionOffsetEnable(positionOffsetIsEnabled);
bool atlasIsExist;
_file.Read(atlasIsExist);
if(atlasIsExist)
{
bool atlasIsCommonAsset;
_file.Read(atlasIsCommonAsset);
Atlas2D* buildInAtlas;
if(atlasIsCommonAsset)
{
StringANSI name;
int32 length;
_file.Read(length);
_file.ReadString(name, length);
buildInAtlas = dynamic_cast<Atlas2D*>(AssetLibrary::_LoadCommonAsset<Atlas2D>(name));
}
else
{
buildInAtlas = dynamic_cast<Atlas2D*>(AssetLibrary::_LoadPrivateAsset<Atlas2D>(_file));
}
if(buildInAtlas) { BindAtlas(buildInAtlas); }
}
bool hitboxIsEnabled;
_file.Read(hitboxIsEnabled);
SetHitboxEnable(hitboxIsEnabled);
return true;
}
return false;
}
TexturedAnimation* TexturedAnimation::_LoadFromFile(StringANSI _path, bool _auto)
{
if(_auto)
{
_path = AssetLibrary::_GetDir() + texturedAnimationsDir + _path + "." + texturedAnimationsSuffix;
}
File file(_path, File::READ);
return _LoadFromFile(file);
}
TexturedAnimation* TexturedAnimation::_LoadFromFile(File& _file)
{
if(_file.IsOpened() && _file.GetAccessMode() == File::READ)
{
TexturedAnimation* animation = new TexturedAnimation();
if(animation->LoadFromFile(_file))
{
return animation;
}
delete animation;
}
return NIL;
}
| 22.058005 | 148 | 0.729357 | gregory-vovchok |
dff3116746428a60242bf1f1e0dc5327f48f3ec0 | 1,820 | cpp | C++ | week_06/01_particlesDrag/src/ofApp.cpp | bschorr/OFAnimation_Spring2015 | 869ededa36bf0bd432129e5a551db5d19d1f5d35 | [
"MIT"
] | 37 | 2015-01-28T13:20:19.000Z | 2021-04-02T02:50:35.000Z | week_06/01_particlesDrag/src/ofApp.cpp | bschorr/OFAnimation_Spring2015 | 869ededa36bf0bd432129e5a551db5d19d1f5d35 | [
"MIT"
] | null | null | null | week_06/01_particlesDrag/src/ofApp.cpp | bschorr/OFAnimation_Spring2015 | 869ededa36bf0bd432129e5a551db5d19d1f5d35 | [
"MIT"
] | 13 | 2015-02-06T23:16:22.000Z | 2018-02-03T14:44:06.000Z | #include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofBackground(255);
gravity.set(0, 0.2);
color.set(0, 100, 255);
}
//--------------------------------------------------------------
void ofApp::update(){
for (int i = 0; i < particleList.size(); i++) {
particleList[i].resetForces();
particleList[i].update();
}
}
//--------------------------------------------------------------
void ofApp::draw(){
ofSetColor(color);
for (int i = 0; i < particleList.size(); i++) {
particleList[i].draw(color);
}
ofSetColor(255, 0, 0);
string debug = "Drag your mouse around.";
ofDrawBitmapString(debug, 20, 20);
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key){
}
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){
Particle p(ofVec2f(x, y));
particleList.push_back(p);
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){
}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){
}
| 22.469136 | 64 | 0.347253 | bschorr |
dff4c7070acd57b351fa184f13db9a0a837f26f1 | 638 | cpp | C++ | leetcode/binary-tree/257.(Recur)binary-tree-paths.cpp | saurabhraj042/dsaPrep | 0973a03bc565a2850003c7e48d99b97ff83b1d01 | [
"MIT"
] | 23 | 2021-10-30T04:11:52.000Z | 2021-11-27T09:16:18.000Z | leetcode/binary-tree/257.(Recur)binary-tree-paths.cpp | Pawanupadhyay10/placement-prep | 0449fa7cbc56e7933e6b090936ab7c15ca5f290f | [
"MIT"
] | null | null | null | leetcode/binary-tree/257.(Recur)binary-tree-paths.cpp | Pawanupadhyay10/placement-prep | 0449fa7cbc56e7933e6b090936ab7c15ca5f290f | [
"MIT"
] | 4 | 2021-10-30T03:26:05.000Z | 2021-11-14T12:15:04.000Z | // saurabhraj042
//https://leetcode.com/problems/binary-tree-paths/
class Solution {
public:
void trav(TreeNode* n,vector<string> &a,string s){
// whenever we reach the leaf node we push it in our ans
if(!n->left && !n->right){
a.push_back(s);
return;
}
if(n->left) trav(n->left,a,s + "->" + to_string(n->left->val));
if(n->right) trav(n->right,a,s + "->" + to_string(n->right->val));
}
vector<string> binaryTreePaths(TreeNode* root) {
// Recursive soln
vector<string> a;
trav(root,a,to_string(root->val));
return a;
}
};
| 25.52 | 74 | 0.548589 | saurabhraj042 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.