hexsha stringlengths 40 40 | size int64 19 11.4M | ext stringclasses 13 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 3 270 | max_stars_repo_name stringlengths 5 110 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 270 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 270 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 19 11.4M | avg_line_length float64 1.93 229k | max_line_length int64 12 688k | alphanum_fraction float64 0.07 0.99 | matches listlengths 1 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2e98fc7e6c42f246a3bcacc578bfaef419ab0518 | 28,606 | cpp | C++ | codecs/image.cpp | mattvchandler/asciiart | 65eeb38aa42b98d49ce15bb2cc3a98950edb18cc | [
"MIT"
] | 5 | 2020-06-02T18:05:43.000Z | 2022-02-19T10:44:47.000Z | codecs/image.cpp | mattvchandler/asciiart | 65eeb38aa42b98d49ce15bb2cc3a98950edb18cc | [
"MIT"
] | null | null | null | codecs/image.cpp | mattvchandler/asciiart | 65eeb38aa42b98d49ce15bb2cc3a98950edb18cc | [
"MIT"
] | 1 | 2021-11-29T15:32:54.000Z | 2021-11-29T15:32:54.000Z | #include "image.hpp"
#include <array>
#include <fstream>
#include <iostream>
#include <iterator>
#include <limits>
#include <memory>
#include <set>
#include <stdexcept>
#include <tuple>
#include <cassert>
#include <cmath>
#include <cstring>
#ifdef HAS_ENDIAN
#include <endian.h>
#endif
#ifdef HAS_BYTESWAP
#include <byteswap.h>
#endif
#include "avif.hpp"
#include "bmp.hpp"
#include "bpg.hpp"
#include "flif.hpp"
#include "gif.hpp"
#include "heif.hpp"
#include "ico.hpp"
#include "jp2.hpp"
#include "jpeg.hpp"
#include "jxl.hpp"
#include "mcmap.hpp"
#include "openexr.hpp"
#include "pcx.hpp"
#include "png.hpp"
#include "pnm.hpp"
#include "sif.hpp"
#include "srf.hpp"
#include "svg.hpp"
#include "tga.hpp"
#include "tiff.hpp"
#include "webp.hpp"
#include "xpm.hpp"
bool Image::header_cmp(unsigned char a, char b){ return a == static_cast<unsigned char>(b); };
std::vector<unsigned char> Image::read_input_to_memory(std::istream & input)
{
// read whole stream into memory
std::vector<unsigned char> data;
std::array<char, 4096> buffer;
while(input)
{
input.read(std::data(buffer), std::size(buffer));
if(input.bad())
throw std::runtime_error {"Error reading input file"};
data.insert(std::end(data), std::begin(buffer), std::begin(buffer) + input.gcount());
}
return data;
}
void Image::set_size(std::size_t w, std::size_t h)
{
width_ = w; height_ = h;
image_data_.resize(height_);
for(auto && row: image_data_)
row.resize(width_);
}
void Image::transpose_image(exif::Orientation orientation)
{
if(orientation == exif::Orientation::r_90 || orientation == exif::Orientation::r_270)
{
// prepare a buffer for transposed data if rotated 90 or 270 degrees
decltype(image_data_) transpose_buf;
transpose_buf.resize(width_);
for(auto & row: transpose_buf)
row.resize(height_);
for(std::size_t row = 0; row < width_; ++row)
{
for(std::size_t col = 0; col < height_; ++col)
{
if(orientation == exif::Orientation::r_90)
transpose_buf[row][col] = image_data_[col][width_ - row - 1];
else // r_270
transpose_buf[row][col] = image_data_[height_ - col - 1][row];
}
}
std::swap(width_, height_);
std::swap(image_data_, transpose_buf);
}
else if(orientation == exif::Orientation::r_180)
{
std::reverse(std::begin(image_data_), std::end(image_data_));
for(auto && row: image_data_)
std::reverse(std::begin(row), std::end(row));
}
}
Image Image::scale(std::size_t new_width, std::size_t new_height) const
{
Image new_img;
new_img.set_size(new_width, new_height);
const auto px_col = static_cast<float>(width_) / static_cast<float>(new_width);
const auto px_row = static_cast<float>(height_) / static_cast<float>(new_height);
float row = 0.0f;
for(std::size_t new_row = 0; new_row < new_height; ++new_row, row += px_row)
{
float col = 0.0f;
for(std::size_t new_col = 0; new_col < new_width; ++new_col, col += px_col)
{
float r_sum = 0.0f;
float g_sum = 0.0f;
float b_sum = 0.0f;
float a_sum = 0.0f;
float cell_count {0.0f};
for(float y = row; y < row + px_row && y < height_; y += 1.0f)
{
for(float x = col; x < col + px_col && x < width_; x += 1.0f)
{
auto x_ind = static_cast<std::size_t>(x);
auto y_ind = static_cast<std::size_t>(y);
if(x_ind >= width_ || y_ind >= height_)
throw std::runtime_error{"Output coords out of range"};
auto pix = image_data_[y_ind][x_ind];
r_sum += static_cast<float>(pix.r) * static_cast<float>(pix.r);
g_sum += static_cast<float>(pix.g) * static_cast<float>(pix.g);
b_sum += static_cast<float>(pix.b) * static_cast<float>(pix.b);
a_sum += static_cast<float>(pix.a) * static_cast<float>(pix.a);
cell_count += 1.0f;
}
}
new_img.image_data_[new_row][new_col] = Color{
static_cast<unsigned char>(std::sqrt(r_sum / cell_count)),
static_cast<unsigned char>(std::sqrt(g_sum / cell_count)),
static_cast<unsigned char>(std::sqrt(b_sum / cell_count)),
static_cast<unsigned char>(std::sqrt(a_sum / cell_count))
};
}
}
return new_img;
}
struct Octree_node // technically this would be a sedectree
{
const static std::size_t max_depth {8};
std::uint64_t r{0}, g{0}, b{0}, a{0};
std::size_t pixel_count {0};
std::array<std::unique_ptr<Octree_node>, 16> children {};
Color to_color() const
{
return Color {static_cast<unsigned char>(r / pixel_count), static_cast<unsigned char>(g / pixel_count), static_cast<unsigned char>(b / pixel_count), static_cast<unsigned char>(a / pixel_count)};
}
static auto get_index(const Color & c, std::size_t depth)
{
return
(((c.r >> (7 - depth)) & 0x01) << 3) |
(((c.g >> (7 - depth)) & 0x01) << 2) |
(((c.b >> (7 - depth)) & 0x01) << 1) |
((c.a >> (7 - depth)) & 0x01);
}
struct Sum
{
std::uint64_t r{0}, g{0}, b{0}, a{0};
std::size_t pixel_count {0};
std::size_t leaves_counted {0};
std::vector<Octree_node *> reducible_descendants;
Sum & operator+=(const Sum & other)
{
r += other.r;
g += other.g;
b += other.b;
a += other.a;
pixel_count += other.pixel_count;
leaves_counted += other.leaves_counted;
reducible_descendants.insert(std::end(reducible_descendants), std::begin(other.reducible_descendants), std::end(other.reducible_descendants));
return *this;
}
};
Sum sum()
{
if(pixel_count > 0)
return Sum{r, g, b, a, pixel_count, 1, {}};
Sum totals;
totals.reducible_descendants.push_back(this);
for(auto && i: children)
{
if(i)
{
totals += i->sum();
}
}
return totals;
}
std::size_t reduce(const Sum & s)
{
assert(pixel_count == 0); // Can't reduce leaf nodes
assert(s.leaves_counted > 1); // Can't reduce nodes with fewer than 1 leaf
r = s.r;
g = s.g;
b = s.b;
a = s.a;
pixel_count = s.pixel_count;
for(auto && i: children)
{
if(i)
i.reset();
}
return s.leaves_counted;
}
Octree_node * split(const Color & c, std::size_t depth)
{
assert(pixel_count > 0); // can only split leaves
assert(depth < max_depth);
auto avg = to_color();
auto c_index = get_index(c, depth + 1);
auto avg_index = get_index(avg, depth + 1);
children[c_index] = std::make_unique<Octree_node>();
children[avg_index] = std::make_unique<Octree_node>();
children[avg_index]->r = r;
children[avg_index]->g = g;
children[avg_index]->b = b;
children[avg_index]->a = a;
children[avg_index]->pixel_count = pixel_count;
r = g = b = a = pixel_count = 0;
return children[c_index].get();
}
void collect_colors(std::vector<Color> & palette) const
{
if(pixel_count > 0)
{
palette.emplace_back(to_color());
}
else
{
for(auto && i: children)
{
if(i)
i->collect_colors(palette);
}
}
}
Color lookup_color(const Color & c) const
{
auto build_color = [](Color & color, std::size_t index, std::size_t depth)
{
color.r |= ((index >> 3) & 0x01) << (7 - depth);
color.g |= ((index >> 2) & 0x01) << (7 - depth);
color.b |= ((index >> 1) & 0x01) << (7 - depth);
color.a |= ( index & 0x01) << (7 - depth);
};
Color path_color {0, 0, 0, 0};
bool exact_match = true;
auto node = this;
for(std::size_t depth = 0; depth < max_depth; ++depth)
{
if(node->pixel_count)
return node->to_color();
if(exact_match)
{
if(auto index = get_index(c, depth); node->children[index])
{
build_color(path_color, index, depth);
node = node->children[index].get();
continue;
}
else
exact_match = false;
}
// if we're not at a leaf, and the exact leaf is missing, find the child that represents the closest color without exceeding the value of any channel
auto closest_index = std::numeric_limits<std::size_t>::max();
auto closest_not_exceeding_index = std::numeric_limits<std::size_t>::max();
auto closest_dist = std::numeric_limits<float>::max();
auto closest_not_exceeding_dist = std::numeric_limits<float>::max();
Color closest_node_color;
Color closest_not_exceeding_node_color;
for(int i = 0; i < static_cast<int>(std::size(node->children)); ++i)
{
if(node->children[i])
{
auto node_color = path_color;
// append this depth's color information
build_color(node_color, i, depth);
// don't exceed the value on any channel (unless there's no other choice). The next layer down will only increase the value of each channel
auto not_exceeding = (node_color.r <= c.r || node_color.g <= c.g || node_color.b <= c.b || node_color.a <= c.a);
auto dist = color_dist2(node_color, c);
if(dist < closest_dist)
{
closest_index = i;
closest_dist = dist;
closest_node_color = node_color;
}
if(not_exceeding && dist < closest_not_exceeding_dist)
{
closest_not_exceeding_index = i;
closest_not_exceeding_dist = dist;
closest_not_exceeding_node_color = node_color;
}
}
}
if(closest_index >= std::size(node->children))
break;
if(closest_not_exceeding_index < std::size(node->children))
{
node = node->children[closest_not_exceeding_index].get();
path_color = closest_not_exceeding_node_color;
}
else
{
node = node->children[closest_index].get();
path_color = closest_node_color;
}
}
if(node->pixel_count)
return node->to_color();
else
throw std::logic_error{"Color not found"};
}
};
std::tuple<Octree_node, std::vector<Color>, bool> octree_quantitize(const Image & image, std::size_t num_colors, bool gif_transparency)
{
if(num_colors == 0)
throw std::domain_error {"empty palette requested"};
unsigned char alpha_threshold = 127;
std::vector<Color> palette;
palette.reserve(num_colors);
std::size_t num_leaves{0};
bool reduced_colors {false};
Octree_node root;
std::array<std::set<Octree_node *>, Octree_node::max_depth> reducible_nodes;
reducible_nodes[0].insert(&root);
for(std::size_t row = 0; row < image.get_height(); ++row)
{
for(std::size_t col = 0; col < image.get_width(); ++col)
{
auto c = image[row][col];
if(gif_transparency)
{
if(c.a > alpha_threshold)
c.a = 255;
else
c = {0, 0, 0, 0};
}
Octree_node * node = &root;
for(std::size_t i = 0; i < Octree_node::max_depth; ++i)
{
if(node->pixel_count) // is this a leaf node?
{
// if room for more than 1 node, split a leaf
if(i < Octree_node::max_depth - 1 && num_leaves < num_colors)
{
reducible_nodes[i].insert(node);
node = node->split(c, i);
continue;
}
else
{
break;
}
}
auto index = Octree_node::get_index(c, i);
if(!node->children[index])
{
node->children[index] = std::make_unique<Octree_node>();
if(i < Octree_node::max_depth - 1)
reducible_nodes[i + 1].insert(node->children[index].get());
}
node = node->children[index].get();
}
// at a leaf node
// is this a new leaf_node?
if(node->pixel_count == 0)
++num_leaves;
node->r += c.r;
node->g += c.g;
node->b += c.b;
node->a += c.a;
++node->pixel_count;
while(num_leaves > num_colors)
{
reduced_colors = true;
// reduce a node to get back under the limit
// try to find a reducible node (non leaf w/ # of leaf descendants > 1)
// * At the lowest level possible
// * Representing the lowest # of pixels possible
Octree_node * min_reduce_node {nullptr};
Octree_node::Sum min_reduce_node_sum;
min_reduce_node_sum.pixel_count = std::numeric_limits<std::size_t>::max();
for(std::size_t i = std::size(reducible_nodes); i-- > 0;)
{
if(!std::empty(reducible_nodes[i]))
{
decltype(std::begin(reducible_nodes[i])) min_reduce_node_it;
for(auto n = std::begin(reducible_nodes[i]); n != std::end(reducible_nodes[i]); ++n)
{
auto sum = (*n)->sum();
if(sum.leaves_counted > 1 && sum.pixel_count < min_reduce_node_sum.pixel_count)
{
min_reduce_node = *n;
min_reduce_node_sum = sum;
min_reduce_node_it = n;
}
}
if(min_reduce_node)
{
reducible_nodes[i].erase(min_reduce_node_it);
// remove all children nodes from reducible_nodes
for(std::size_t j = i + 1; j < std::size(reducible_nodes); ++j)
{
for(auto && n: min_reduce_node_sum.reducible_descendants)
reducible_nodes[j].erase(n);
}
break;
}
}
}
if(!min_reduce_node)
throw std::logic_error{"Could not find a node to reduce"};
num_leaves -= min_reduce_node->reduce(min_reduce_node_sum) - 1;
}
}
}
root.collect_colors(palette);
assert(std::size(palette) <= num_colors);
return {std::move(root), std::move(palette), reduced_colors};
}
std::vector<Color> Image::generate_palette(std::size_t num_colors, bool gif_transparency) const
{
return std::move(std::get<1>(octree_quantitize(*this, num_colors, gif_transparency)));
}
std::vector<Color> Image::generate_and_apply_palette(std::size_t num_colors, bool gif_transparency)
{
auto octree = octree_quantitize(*this, num_colors, gif_transparency);
auto & root = std::get<0>(octree);
auto & palette = std::get<1>(octree);
auto reduced_colors = std::get<2>(octree);
if(reduced_colors)
dither([&root](const Color & c){ return root.lookup_color(c); });
return std::move(palette);
}
void Image::dither(const std::function<Color(const Color &)> & palette_fun)
{
if(height_ < 2 || width_ < 2)
return;
// Floyd-Steinberg dithering
// keep a copy of the current and next row converted to floats for running calculations
std::vector<FColor> current_row(width_), next_row(width_);
for(std::size_t col = 0; col < width_; ++col)
{
next_row[col] = image_data_[0][col];
if(next_row[col].a > 0.5f)
next_row[col].a = 1.0f;
else
next_row[col] = {0.0f, 0.0f, 0.0f, 0.0f};
}
for(std::size_t row = 0; row < height_; ++row)
{
std::swap(next_row, current_row);
if(row < height_ - 1)
{
for(std::size_t col = 0; col < width_; ++col)
{
next_row[col] = image_data_[row + 1][col];
if(next_row[col].a > 0.5f)
next_row[col].a = 1.0f;
else
next_row[col] = {0.0f, 0.0f, 0.0f, 0.0f};
}
}
for(std::size_t col = 0; col < width_; ++col)
{
auto old_pix = current_row[col];
Color new_pix = palette_fun(old_pix.clamp());
// convert back to int and store to actual pixel data
image_data_[row][col] = new_pix;
auto quant_error = old_pix - new_pix;
if(col < width_ - 1)
current_row[col + 1] += quant_error * 7.0f / 16.0f;
if(row < height_ - 1)
{
if(col > 0)
next_row[col - 1] += quant_error * 3.0f / 16.0f;
next_row[col ] += quant_error * 5.0f / 16.0f;
if(col < width_ - 1)
next_row[col + 1] += quant_error * 1.0f / 16.0f;
}
}
}
}
void Image::convert(const Args & args) const
{
if(!args.convert_filename)
return;
std::ofstream out{args.convert_filename->first, std::ios_base::binary};
if(!out)
throw std::runtime_error {"Could not open " + args.convert_filename->first + " for writing: " + std::strerror(errno)};
auto & ext = args.convert_filename->second;
if(false); // dummy statement
#ifdef AVIF_FOUND
else if(ext == ".avif")
Avif::write(out, *this, args.invert);
#endif
else if(ext == ".bmp")
Bmp::write(out, *this, args.invert);
else if(ext == ".cur")
Ico::write_cur(out, *this, args.invert);
else if(ext == ".ico")
Ico::write_ico(out, *this, args.invert);
#ifdef ZLIB_FOUND
else if(ext == ".dat")
MCMap::write(out, *this, args.bg, args.invert);
#endif
#ifdef FLIF_ENC_FOUND
else if(ext == ".flif")
Flif::write(out, *this, args.invert);
#endif
#ifdef GIF_FOUND
else if(ext == ".gif")
Gif::write(out, *this, args.invert);
#endif
#ifdef HEIF_FOUND
else if(ext == ".heif")
Heif::write(out, *this, args.invert);
#endif
#ifdef JPEG_FOUND
else if(ext == ".jpeg" || ext == ".jpg")
Jpeg::write(out, *this, args.bg, args.invert);
#endif
#ifdef JP2_FOUND
else if(ext == ".jp2")
Jp2::write(out, *this, args.invert);
#endif
#ifdef JXL_FOUND
else if(ext == ".jxl")
Jxl::write(out, *this, args.invert);
#endif
#ifdef OpenEXR_FOUND
else if(ext == ".exr")
OpenEXR::write(out, *this, args.invert);
#endif
else if(ext == ".pcx")
Pcx::write(out, *this, args.bg, args.invert);
#ifdef PNG_FOUND
else if(ext == ".png")
Png::write(out, *this, args.invert);
#endif
else if(ext == ".pbm")
Pnm::write_pbm(out, *this, args.bg, args.invert);
else if(ext == ".pgm")
Pnm::write_pgm(out, *this, args.bg, args.invert);
else if(ext == ".ppm")
Pnm::write_ppm(out, *this, args.bg, args.invert);
else if(ext == ".pam")
Pnm::write_pam(out, *this, args.invert);
else if(ext == ".pfm")
Pnm::write_pfm(out, *this, args.bg, args.invert);
else if(ext == ".tga")
Tga::write(out, *this, args.invert);
#ifdef TIFF_FOUND
else if(ext == ".tif")
Tiff::write(out, *this, args.invert);
#endif
#ifdef WEBP_FOUND
else if(ext == ".webp")
Webp::write(out, *this, args.invert);
#endif
#ifdef XPM_FOUND
else if(ext == ".xpm")
Xpm::write(out, *this, args.invert);
#endif
else
throw std::runtime_error {"Unsupported conversion type: " + ext};
}
[[nodiscard]] std::unique_ptr<Image> get_image_data(const Args & args)
{
std::string extension;
std::ifstream input_file;
if(args.input_filename != "-")
{
input_file.open(args.input_filename, std::ios_base::in | std::ios_base::binary);
auto pos = args.input_filename.find_last_of('.');
if(pos != std::string::npos)
extension = args.input_filename.substr(pos);
for(auto && i: extension)
i = std::tolower(i);
}
std::istream & input = args.input_filename == "-" ? std::cin : input_file;
if(!input)
throw std::runtime_error{"Could not open input file " + (args.input_filename == "-" ? "" : ("(" + args.input_filename + ") ")) + ": " + std::string{std::strerror(errno)}};
Image::Header header;
input.read(std::data(header), std::size(header));
if(input.eof()) // technically, some image files could be smaller than 12 bytes, but they wouldn't be interesting images
throw std::runtime_error{"Could not read file header " + (args.input_filename == "-" ? "" : ("(" + args.input_filename + ") ")) + ": not enough bytes"};
else if(!input)
throw std::runtime_error{"Could not read input file " + (args.input_filename == "-" ? "" : ("(" + args.input_filename + ") ")) + ": " + std::string{std::strerror(errno)}};
// rewind (seekg(0) not always supported for pipes)
for(auto i = std::rbegin(header); i != std::rend(header); ++i)
input.putback(*i);
if(input.bad())
throw std::runtime_error{"Unable to rewind stream"};
switch(args.force_file)
{
case Args::Force_file::detect:
if(is_avif(header))
{
#ifdef AVIF_FOUND
return std::make_unique<Avif>(input);
#else
throw std::runtime_error{"Not compiled with AVIF support"};
#endif
}
else if(is_bmp(header))
{
return std::make_unique<Bmp>(input);
}
else if(is_bpg(header))
{
#ifdef BPG_FOUND
return std::make_unique<Bpg>(input);
#else
throw std::runtime_error{"Not compiled with BPG support"};
#endif
}
else if(is_flif(header))
{
#ifdef FLIF_DEC_FOUND
return std::make_unique<Flif>(input);
#else
throw std::runtime_error{"Not compiled with FLIF support"};
#endif
}
else if(is_gif(header))
{
#ifdef GIF_FOUND
return std::make_unique<Gif>(input);
#else
throw std::runtime_error{"Not compiled with GIF support"};
#endif
}
else if(is_heif(header))
{
#ifdef HEIF_FOUND
return std::make_unique<Heif>(input);
#else
throw std::runtime_error{"Not compiled with HEIF support"};
#endif
}
else if(is_ico(header))
{
return std::make_unique<Ico>(input);
}
else if(is_jp2(header))
{
#ifdef JP2_FOUND
return std::make_unique<Jp2>(input, Jp2::Type::JP2);
#else
throw std::runtime_error{"Not compiled with JPEG 2000 support"};
#endif
}
else if(is_jpx(header))
{
#ifdef JP2_FOUND
return std::make_unique<Jp2>(input, Jp2::Type::JPX);
#else
throw std::runtime_error{"Not compiled with JPEG 2000 support"};
#endif
}
else if(is_openexr(header))
{
#ifdef OpenEXR_FOUND
return std::make_unique<OpenEXR>(input);
#else
throw std::runtime_error{"Not compiled with OpenExr support"};
#endif
}
else if(is_jpeg(header))
{
#ifdef JPEG_FOUND
return std::make_unique<Jpeg>(input);
#else
throw std::runtime_error{"Not compiled with JPEG support"};
#endif
}
else if(is_jxl(header))
{
#ifdef JXL_FOUND
return std::make_unique<Jxl>(input);
#else
throw std::runtime_error{"Not compiled with JPEG XL support"};
#endif
}
else if(is_png(header))
{
#ifdef PNG_FOUND
return std::make_unique<Png>(input);
#else
throw std::runtime_error{"Not compiled with PNG support"};
#endif
}
else if(is_pnm(header))
{
return std::make_unique<Pnm>(input);
}
else if(is_srf(header))
{
return std::make_unique<Srf>(input);
}
else if(is_tiff(header))
{
#ifdef TIFF_FOUND
return std::make_unique<Tiff>(input);
#else
throw std::runtime_error{"Not compiled with TIFF support"};
#endif
}
else if(is_webp(header))
{
#ifdef WEBP_FOUND
return std::make_unique<Webp>(input);
#else
throw std::runtime_error{"Not compiled with WEBP support"};
#endif
}
else if(extension == ".dat")
{
#ifdef ZLIB_FOUND
return std::make_unique<MCMap>(input);
#else
throw std::runtime_error{"Not compiled with Minecraft map item / .dat support"};
#endif
}
else if(extension == ".pcx")
{
return std::make_unique<Pcx>(input);
}
else if(extension == ".svg" || extension == ".svgz")
{
#ifdef SVG_FOUND
return std::make_unique<Svg>(input, args.input_filename);
#else
throw std::runtime_error{"Not compiled with SVG support"};
#endif
}
else if(extension == ".tga")
{
return std::make_unique<Tga>(input);
}
else if(extension == ".xpm")
{
#ifdef XPM_FOUND
return std::make_unique<Xpm>(input);
#else
throw std::runtime_error{"Not compiled with XPM support"};
#endif
}
else if(extension == ".jpt")
{
#ifdef JP2_FOUND
return std::make_unique<Jp2>(input, Jp2::Type::JPT);
#else
throw std::runtime_error{"Not compiled with JPEG 2000 support"};
#endif
}
else
{
throw std::runtime_error{"Unknown input file format"};
}
break;
#ifdef ZLIB_FOUND
case Args::Force_file::mcmap:
return std::make_unique<MCMap>(input);
break;
#endif
case Args::Force_file::pcx:
return std::make_unique<Pcx>(input);
break;
#ifdef SVG_FOUND
case Args::Force_file::svg:
return std::make_unique<Svg>(input, args.input_filename);
break;
#endif
case Args::Force_file::tga:
return std::make_unique<Tga>(input);
break;
#ifdef XPM_FOUND
case Args::Force_file::xpm:
return std::make_unique<Xpm>(input);
break;
#endif
case Args::Force_file::aoc_2019_sif:
return std::make_unique<Sif>(input);
break;
default:
throw std::runtime_error{"Unhandled file format switch"};
}
}
| 31.997763 | 202 | 0.518807 | [
"vector"
] |
2e9a3cea064263739acff98db3080a2968237d51 | 324 | cpp | C++ | Lab7/main.cpp | SamuelLazurca/oop-2022 | 8c6f56806e20e85014b5ca402e933c3ac85f31aa | [
"MIT"
] | null | null | null | Lab7/main.cpp | SamuelLazurca/oop-2022 | 8c6f56806e20e85014b5ca402e933c3ac85f31aa | [
"MIT"
] | null | null | null | Lab7/main.cpp | SamuelLazurca/oop-2022 | 8c6f56806e20e85014b5ca402e933c3ac85f31aa | [
"MIT"
] | null | null | null | #include <iostream>
#include "vector.h"
using namespace std;
int main()
{
Vector<int> v1;
v1.Push(1);
v1.Push(2);
v1.Set(3, 0);
v1.Insert(4, 0);
v1.Sort();
for(unsigned i=0;i<v1.Count();i++)
std::cout << v1.Get(i)<<" ";
std::cout << std::endl << v1.Count();
cout << endl << v1.firstIndexOf(4);
return 0;
} | 14.727273 | 38 | 0.57716 | [
"vector"
] |
2eaf8c29e5a05eee3dbd5d6f21dd857484459cec | 5,854 | hpp | C++ | examples/red-pitaya/spectrum/spectrum.hpp | Koheron/koheron-sdk | 82b732635f1adf5dd0b04b9290b589c1fc091f29 | [
"MIT"
] | 77 | 2016-09-20T18:44:14.000Z | 2022-03-30T16:04:09.000Z | examples/red-pitaya/spectrum/spectrum.hpp | rsarwar87/koheron-sdk | 02c35bf3c1c29f1029fad18b881dbd193efac5a7 | [
"MIT"
] | 101 | 2016-09-05T15:44:25.000Z | 2022-03-29T09:22:09.000Z | examples/red-pitaya/spectrum/spectrum.hpp | rsarwar87/koheron-sdk | 02c35bf3c1c29f1029fad18b881dbd193efac5a7 | [
"MIT"
] | 34 | 2016-12-12T07:21:57.000Z | 2022-01-12T21:00:52.000Z | /// Spectrum analyzer driver
///
/// (c) Koheron
#ifndef __DRIVERS_SPECTRUM_HPP__
#define __DRIVERS_SPECTRUM_HPP__
#include <context.hpp>
#include <cmath>
constexpr float SAMPLING_RATE = 125E6;
constexpr uint32_t WFM_SIZE = mem::spectrum_range/sizeof(float);
constexpr uint32_t FIFO_BUFF_SIZE = 4096;
// http://www.xilinx.com/support/documentation/ip_documentation/axi_fifo_mm_s/v4_1/pg080-axi-fifo-mm-s.pdf
namespace Fifo_regs {
constexpr uint32_t rdfr = 0x18;
constexpr uint32_t rdfo = 0x1C;
constexpr uint32_t rdfd = 0x20;
constexpr uint32_t rlr = 0x24;
}
class Spectrum
{
public:
Spectrum(Context& ctx_)
: ctx(ctx_)
, ctl(ctx.mm.get<mem::control>())
, sts(ctx.mm.get<mem::status>())
, spectrum_map(ctx.mm.get<mem::spectrum>())
, demod_map(ctx.mm.get<mem::demod>())
, peak_fifo_map(ctx.mm.get<mem::peak_fifo>())
, noise_floor_map(ctx.mm.get<mem::noise_floor>())
, decimated_data(0)
{
raw_data = spectrum_map.get_ptr<float>();
set_average(true);
ctl.write<reg::addr>(19 << 2); // set tvalid delay to 19 * 8 ns
set_address_range(0, WFM_SIZE);
set_period(WFM_SIZE);
set_num_average_min(0);
std::array<uint32_t,WFM_SIZE> demod_buffer;
demod_buffer.fill(0x00003FFF);
set_scale_sch(0);
set_demod_buffer(demod_buffer);
}
// Averaging
auto get_average_status() {
return std::make_tuple(
is_average,
num_average_min,
num_average
);
}
void set_average(bool is_average_) {
is_average = is_average_;
ctl.write_bit<reg::avg, 0>(is_average);
}
uint32_t get_num_average() {
num_average = sts.read<reg::n_avg>();
return num_average;
}
void set_num_average_min(uint32_t num_average_min_) {
num_average_min = (num_average_min_ < 2) ? 0 : num_average_min_ - 2;
ctl.write<reg::n_avg_min>(num_average_min);
}
// Acquisition
void reset_acquisition() {
ctl.clear_bit<reg::addr, 1>();
ctl.set_bit<reg::addr, 1>();
}
void set_scale_sch(uint32_t scale_sch) {
// LSB at 1 for forward FFT
ctl.write<reg::ctl_fft>(1 + 2 * scale_sch);
}
void set_offset(uint32_t offset_real, uint32_t offset_imag) {
ctl.write<reg::substract_mean>(offset_real + 16384 * offset_imag);
}
void set_demod_buffer(const std::array<uint32_t, WFM_SIZE>& arr) {
demod_map.write_array(arr);
}
void set_noise_floor_buffer(const std::array<float, WFM_SIZE>& arr) {
noise_floor_map.write_array(arr);
}
// Read channel and take one point every decim_factor points
std::vector<float>& get_decimated_data(uint32_t decim_factor, uint32_t index_low, uint32_t index_high) {
// Sanity checks
if (index_high <= index_low || index_high >= WFM_SIZE) {
decimated_data.resize(0);
return decimated_data;
}
ctl.set_bit<reg::addr, 1>();
uint32_t n_pts = (index_high - index_low)/decim_factor;
decimated_data.resize(n_pts);
wait_for_acquisition();
if (sts.read<reg::avg_on_out>()) {
float num_average_ = float(get_num_average());
for (unsigned int i=0; i<decimated_data.size(); i++)
decimated_data[i] = raw_data[index_low + decim_factor * i] / num_average_;
} else {
for (unsigned int i=0; i<decimated_data.size(); i++)
decimated_data[i] = raw_data[index_low + decim_factor * i];
}
ctl.clear_bit<reg::addr, 1>();
return decimated_data;
}
// Peak
uint32_t get_peak_address() {return sts.read<reg::peak_address>();}
uint32_t get_peak_maximum() {return sts.read<reg::peak_maximum>();}
void set_address_range(uint32_t address_low, uint32_t address_high) {
ctl.write<reg::peak_address_low>(address_low);
ctl.write<reg::peak_address_high>(address_high);
ctl.write<reg::peak_address_reset>((address_low + WFM_SIZE - 1) % WFM_SIZE);
}
uint32_t read_fifo() {
return peak_fifo_map.read<Fifo_regs::rdfd>();
}
uint32_t get_fifo_length() {
return (peak_fifo_map.read<Fifo_regs::rlr>() & 0x3FFFFF) >> 2;
}
std::vector<uint32_t>& get_peak_fifo_data() {
uint32_t n_pts = get_fifo_length();
peak_fifo_data.resize(n_pts);
for (unsigned int i=0; i < n_pts; i++) {
peak_fifo_data[i] = read_fifo();
}
return peak_fifo_data;
}
private:
bool is_average;
uint32_t num_average_min;
uint32_t num_average;
Context& ctx;
Memory<mem::control>& ctl;
Memory<mem::status>& sts;
Memory<mem::spectrum>& spectrum_map;
Memory<mem::demod>& demod_map;
Memory<mem::peak_fifo>& peak_fifo_map;
Memory<mem::noise_floor>& noise_floor_map;
// Acquired data buffers
float *raw_data;
std::array<float, WFM_SIZE> spectrum_data;
std::vector<float> decimated_data;
std::vector<uint32_t> peak_fifo_data;
// Internal functions
void wait_for_acquisition() {
do {} while (sts.read<reg::avg_ready>() == 0);
}
void set_period(uint32_t period) {
set_dac_period(period, period);
set_average_period(period);
reset();
}
void reset() {
ctl.clear_bit<reg::addr, 0>();
ctl.set_bit<reg::addr, 0>();
}
void set_dac_period(uint32_t dac_period0, uint32_t dac_period1) {
ctl.write<reg::dac_period0>(dac_period0 - 1);
ctl.write<reg::dac_period1>(dac_period1 - 1);
}
void set_average_period(uint32_t average_period) {
ctl.write<reg::avg_period>(average_period - 1);
ctl.write<reg::avg_threshold>(average_period - 6);
}
};
#endif // __DRIVERS_SPECTRUM_HPP__
| 28.837438 | 108 | 0.63478 | [
"vector"
] |
2eb9379eaf5338c306309c10640ef5ebbe58e539 | 4,584 | hpp | C++ | boost/numeric/mtl/io/read_el_matrix.hpp | lit-uriy/mtl4-mirror | 37cf7c2847165d3537cbc3400cb5fde6f80e3d8b | [
"MTLL"
] | 24 | 2019-03-26T15:25:45.000Z | 2022-03-26T10:00:45.000Z | boost/numeric/mtl/io/read_el_matrix.hpp | lit-uriy/mtl4-mirror | 37cf7c2847165d3537cbc3400cb5fde6f80e3d8b | [
"MTLL"
] | 2 | 2020-04-17T12:35:32.000Z | 2021-03-03T15:46:25.000Z | boost/numeric/mtl/io/read_el_matrix.hpp | lit-uriy/mtl4-mirror | 37cf7c2847165d3537cbc3400cb5fde6f80e3d8b | [
"MTLL"
] | 10 | 2019-12-01T13:40:30.000Z | 2022-01-14T08:39:54.000Z | // Software License for MTL
//
// Copyright (c) 2007 The Trustees of Indiana University.
// 2008 Dresden University of Technology and the Trustees of Indiana University.
// 2010 SimuNova UG (haftungsbeschränkt), www.simunova.com.
// All rights reserved.
// Authors: Peter Gottschling and Andrew Lumsdaine
//
// This file is part of the Matrix Template Library
//
// See also license.mtl.txt in the distribution.
//
// Algorithm inspired by Nick Vannieuwenhoven, written by Cornelius Steinhardt
#ifndef MTL_MATRIX_READ_EL_MATRIX
#define MTL_MATRIX_READ_EL_MATRIX
#include <string>
#include <iostream>
#include <istream>
#include <set>
#include <vector>
#include <valarray>
#include <boost/numeric/mtl/interface/vpt.hpp>
#include <boost/numeric/mtl/matrix/element.hpp>
#include <boost/numeric/mtl/matrix/element_structure.hpp>
namespace mtl { namespace mat {
// Read a value from the stream. The stream is advanced.
template <class T, class StreamType>
inline T read_value(StreamType& stream)
{
T value;
stream >> value;
return value;
}
// Reads the element structure from a given file.
//
// It is assumed the nodes are numbered consecutively, i.e. there are no unused
// node numbers.
template < typename StreamType, typename ValueType>
void read_el_matrix(StreamType& file, element_structure<ValueType>& A)
{
// Type definitions
typedef element<ValueType> element_type;
// typedef typename element_type::value_type value_type;
typedef typename element_type::index_type indices;
typedef typename element_type::matrix_type matrix;
vampir_trace<4036> trace;
// Read element type information.
int nb_elements = 0;
file >> nb_elements;
file.ignore(500,'\n');
std::cout << "nb elements: " << nb_elements << "\n";
// Compatibility with older files
file.ignore(500,'\n');
assert(nb_elements >= 0);
element_type* elements = new element_type[nb_elements];
// Read elements from file.
int el_nbr = 0;
int nb_total_vars = 0;
while( el_nbr < nb_elements ) {
// Read the node numbers.
std::string line;
getline(file, line, '\n');
std::stringstream node_line(line), read_node_line(line);
int read_num=0, i=0;
while( !read_node_line.eof() ) {
int idx = 0;
read_node_line >> idx;
++read_num;
}
read_num--;
mtl::dense_vector<int> nodes(read_num, 0);
while( !node_line.eof() ) {
int idx = 0;
node_line >> idx;
if (i<read_num)
nodes[i]=idx;
if(idx > nb_total_vars)
nb_total_vars = idx;
i++;
}
indices index(nodes);
// Read the values.
const int nb_vars = int(size(nodes));
matrix vals(nb_vars, nb_vars);
for(int i = 0; i < nb_vars*nb_vars; ++i)
vals(i / nb_vars, i % nb_vars) = read_value<ValueType>(file);
file.ignore(500,'\n');
file.ignore(500,'\n');
element_type elem(el_nbr, index, vals);
elements[el_nbr] = elem;
if(el_nbr == 0){
std::cout<< "elem=" << elem << "\n";
}
++el_nbr;
}
// Construct mapping.
++nb_total_vars;
assert(nb_total_vars >= 0);
std::vector<int>* node_element_map = new std::vector<int>[nb_total_vars];
for( int i = 0; i < nb_elements; ++i ) {
element_type& el = elements[i];
indices& idx = el.get_indices();
for(std::size_t j = 0; j < el.nb_vars(); ++j)
node_element_map[ idx(j) ].push_back(el.get_id());
}
// Construct neighborhood information.
for( int i = 0; i < nb_elements; ++i ) {
element_type& el = elements[i];
indices& idx = el.get_indices();
std::set<int> neighs;
for(std::size_t j = 0; j < el.nb_vars(); ++j)
neighs.insert(node_element_map[ idx(j) ].begin(),
node_element_map[ idx(j) ].end());
for(std::set<int>::iterator it = neighs.begin(); it != neighs.end(); ++it)
if( *it != el.get_id() )
el.get_neighbors().push_back( elements+(*it) );
// Sort data.
el.sort_indices();
}
delete[] node_element_map;
A.consume(nb_elements, nb_total_vars, elements);
}
template <typename ValueType>
inline void read_el_matrix(std::string& mat_file, element_structure<ValueType>& A)
{ read_el_matrix(mat_file.c_str(), A); }
template <typename ValueType>
void read_el_matrix(const char* mat_file, element_structure<ValueType>& A)
{
std::ifstream file;
file.open( mat_file );
if( !file.is_open() ) {
std::cout << "The file \"" << mat_file << "\" could not be opened." <<
std::endl;
throw "File could not be opened";
}
read_el_matrix(file, A);
file.close();
}
}} // end namespace mtl::matrix
#endif // MTL_MATRIX_READ_EL_MATRIX
| 27.614458 | 94 | 0.664921 | [
"vector"
] |
2eb93f5dbe0057332d3fc0e140b81dabcaad65a7 | 5,652 | cpp | C++ | src/qt/PlotController.cpp | satra/murfi2 | 95d954a8735c107caae2ab4eec2926fafe420402 | [
"Apache-2.0"
] | null | null | null | src/qt/PlotController.cpp | satra/murfi2 | 95d954a8735c107caae2ab4eec2926fafe420402 | [
"Apache-2.0"
] | null | null | null | src/qt/PlotController.cpp | satra/murfi2 | 95d954a8735c107caae2ab4eec2926fafe420402 | [
"Apache-2.0"
] | null | null | null | #include "PlotController.h"
#include "qcustomplot.h"
#include<vnl/vnl_vector.h>
#include "RtActivation.h"
#include "RtData.h"
#include "RtDataIDs.h"
#include "RtDesignMatrix.h"
#include "RtExperiment.h"
#include "RtMotion.h"
using std::pair;
using std::string;
using std::vector;
PlotController::PlotController(QCustomPlot *design_plot,
QCustomPlot *roi_plot,
QCustomPlot *motion_plot)
: design_plot(design_plot)
, design_colormap(Colormap::ColormapType::DESIGN)
, roi_plot(roi_plot)
, roi_colormap(Colormap::ColormapType::ROI)
, motion_plot(motion_plot)
, motion_colormap(Colormap::ColormapType::MOTION)
, design_tr_indicator(new QCPItemLine(design_plot))
, roi_tr_indicator(new QCPItemLine(roi_plot))
, motion_tr_indicator(new QCPItemLine(motion_plot))
, current_tr(0)
{
baseline_box = new QCPItemRect(design_plot);
baseline_box->setPen(QPen(QColor(178, 178, 178)));
baseline_box->setBrush(QBrush(QColor(178, 178, 178)));
baseline_box->topLeft->setCoords(0, 0);
baseline_box->bottomRight->setCoords(0, 0);
design_plot->addItem(baseline_box);
design_plot->addItem(design_tr_indicator);
design_plot->xAxis->setRange(0, 100);
design_plot->yAxis->setRange(0, 1);
roi_plot->xAxis->setRange(0, 100);
roi_plot->yAxis->setRange(0, 1);
motion_plot->xAxis->setRange(0, 100);
motion_plot->yAxis->setRange(0, 1);
roi_plot->yAxis->setRange(0, 1);
roi_plot->addItem(roi_tr_indicator);
roi_plot->yAxis->setRange(-3, 3);
roi_plot->legend->setVisible(true);
motion_plot->addItem(motion_tr_indicator);
motion_plot->yAxis->setRange(-2, 2);
for (int i = 0; i < 6; i++) {
motion_plot->addGraph();
motion_plot->graph(i)->setPen(QPen(motion_colormap.getColor(i)));
}
updateTRIndicators();
}
PlotController::~PlotController() {
}
const QColor& PlotController::getColorForName(const string &name) {
return roi_colormap.getColorForName(name);
}
void PlotController::handleData(QString qid) {
RtDataID id;
id.setFromString(qid.toStdString());
if (id.getDataName() == NAME_DESIGN) {
baseline_box->topLeft->setCoords(0, 10);
baseline_box->bottomRight->setCoords(getNumDataPointsForErrEst(), -10);
RtDesignMatrix *design =
static_cast<RtDesignMatrix*>(getDataStore().getData(id));
updateTRIndicators();
plotDesign(design);
roi_plot->xAxis->setRange(0, design->getNumRows());
roi_plot->replot();
motion_plot->xAxis->setRange(0, design->getNumRows());
motion_plot->replot();
}
else if (id.getModuleID() == ID_ROICOMBINE) {
map<string, int>::const_iterator it = roi_graphs.find(id.getRoiID());
if (it == roi_graphs.end()) {
it = roi_graphs.insert(
pair<string, int>(id.getRoiID(), roi_plot->graphCount())).first;
roi_plot->addGraph();
roi_plot->graph(it->second)->setPen(QPen(roi_colormap.getColorForName(
id.getRoiID())));
roi_plot->graph(it->second)->setName(QString(id.getRoiID().c_str()));
}
RtActivation *val = static_cast<RtActivation*>(getDataStore().getData(id));
roi_plot->graph(roi_graphs[id.getRoiID()])->addData(id.getTimePoint(),
val->getPixel(0));
roi_plot->replot();
}
else if (id.getModuleID() == ID_MOTION) {
plotMotion(static_cast<RtMotion*>(getDataStore().getData(id)));
}
if (id.getTimePoint() != DATAID_NUM_UNSET_VALUE &&
id.getTimePoint() > current_tr) {
current_tr = id.getTimePoint();
updateTRIndicators();
}
}
void PlotController::updateTRIndicators() {
// TODO get ranges automatically
design_tr_indicator->start->setCoords(current_tr, 1000);
design_tr_indicator->end->setCoords(current_tr, -1000);
design_plot->replot();
roi_tr_indicator->start->setCoords(current_tr, 1000);
roi_tr_indicator->end->setCoords(current_tr, -1000);
roi_plot->replot();
motion_tr_indicator->start->setCoords(current_tr, 1000);
motion_tr_indicator->end->setCoords(current_tr, -1000);
motion_plot->replot();
}
void PlotController::plotDesign(RtDesignMatrix* design) {
size_t graph = 0;
for (size_t col_ind = 0; col_ind < design->getNumColumns(); col_ind++) {
if (!design->isColumnOfInterest(col_ind)) {
continue;
}
design_plot->addGraph();
vnl_vector<double> col = design->getColumn(col_ind);
for (size_t tr = 0; tr < col.size(); tr++) {
design_plot->graph(graph)->addData(tr, col[tr]);
design_plot->graph(graph)->setPen(
QPen(design_colormap.getColor(graph)));
}
graph++;
}
design_plot->rescaleAxes();
design_plot->replot();
}
void PlotController::plotMotion(RtMotion* motion) {
motion_plot->graph(TRANSLATION_X)->addData(
motion->getDataID().getTimePoint(),
motion->getMotionDimension(TRANSLATION_X));
motion_plot->graph(TRANSLATION_Y)->addData(
motion->getDataID().getTimePoint(),
motion->getMotionDimension(TRANSLATION_Y));
motion_plot->graph(TRANSLATION_Z)->addData(
motion->getDataID().getTimePoint(),
motion->getMotionDimension(TRANSLATION_Z));
motion_plot->graph(ROTATION_X)->addData(
motion->getDataID().getTimePoint(),
motion->getMotionDimension(ROTATION_X));
motion_plot->graph(ROTATION_Y)->addData(
motion->getDataID().getTimePoint(),
motion->getMotionDimension(ROTATION_Y));
motion_plot->graph(ROTATION_Z)->addData(
motion->getDataID().getTimePoint(),
motion->getMotionDimension(ROTATION_Z));
}
void PlotController::replotDesign(RtDesignMatrix *design) {
design_plot->clearPlottables();
plotDesign(design);
}
| 30.885246 | 79 | 0.689314 | [
"vector"
] |
e485929771d73f7c0f01fde17933c7555d852215 | 3,949 | cpp | C++ | Sources/PSHelix.cpp | Slin/ProjectSteve | 3e94c61e3d114fb4c15f9bcc72b1508d185f7a9c | [
"MIT"
] | null | null | null | Sources/PSHelix.cpp | Slin/ProjectSteve | 3e94c61e3d114fb4c15f9bcc72b1508d185f7a9c | [
"MIT"
] | null | null | null | Sources/PSHelix.cpp | Slin/ProjectSteve | 3e94c61e3d114fb4c15f9bcc72b1508d185f7a9c | [
"MIT"
] | null | null | null | //
// PSHelix.cpp
// ProjectSteve
//
// Copyright 2018 by SlinDev. All rights reserved.
// Unauthorized use is punishable by torture, mutilation, and vivisection.
//
#include "PSHelix.h"
#include "PSWorld.h"
#include "PSSpawner.h"
#include "PSIPad.h"
namespace PS
{
const std::array<RN::Color, 4> GENE_COLORS = { {
{0.5f, 0.5f, 0.5f},
{0.2f, 0.4f, 0.84f},
{0.77f, 0.23f, 0.16f},
{0.92f, 0.38f, 0.f}
} };
const std::array<Gene::Type, 12> DEFAULT_DNA =
{
Gene::Type::C,
Gene::Type::G,
Gene::Type::G,
Gene::Type::G,
Gene::Type::G,
Gene::Type::G,
Gene::Type::G,
Gene::Type::C,
Gene::Type::C,
Gene::Type::T,
Gene::Type::G
};
static std::array<RN::Model*, 4> geneModels;
RNDefineMeta(Helix, RN::Entity)
Helix::Helix(World& _world)
{
//RN::ShaderLibrary *shaderLibrary = World::GetSharedInstance()->GetShaderLibrary();
RN::Model *model = RN::Model::WithName(RNCSTR("models/dna.sgm"))->Copy();
SetModel(model);
geneModels[0] = RN::Model::WithName(RNCSTR("models/dna_blubb.sgm"));
geneModels[0]->GetLODStage(0)->GetMaterialAtIndex(0)->SetDiffuseColor(GENE_COLORS[0]);
for (size_t i = 1; i < geneModels.size(); ++i)
{
geneModels[i] = geneModels[0]->Copy();
geneModels[i]->GetLODStage(0)->ReplaceMaterial(geneModels[1]->GetLODStage(0)->GetMaterialAtIndex(0)->Copy(), 0);
geneModels[i]->GetLODStage(0)->GetMaterialAtIndex(0)->SetDiffuseColor(GENE_COLORS[i]);
}
float currentHeight = 0.04f;
for(int i = 0; i < 12; i++)
{
/*_genes[i] = new Gene(static_cast<Gene::Type>(i % 4));*/
_genes[i] = new Gene(DEFAULT_DNA[i]);
AddChild(_genes[i]);
_world.RegisterGrabbable(_genes[i]);
_genes[i]->SetPosition(RN::Vector3(0.0f, currentHeight, 0.0f));
_genes[i]->SetRotation(RN::Vector3(200.0f/(0.08*12.0f) * currentHeight, 0.0f, 0.0f));
currentHeight += 0.08f;
}
}
void Helix::Update(float deltaTime)
{
Rotate(RN::Vector3(deltaTime * 16.0f, 0.0f, 0.0f));
}
Gene* Helix::PickGene(Gene& gene)
{
if (gene.GetFlags() && RN::SceneNode::Flags::Hidden)
return nullptr;
gene.AddFlags(RN::SceneNode::Flags::Hidden);
World* world = World::GetSharedInstance();
const Gene::Type t = gene.GetType();
Gene& newGene = *new Gene(t);
newGene.SetRotation(gene.GetWorldRotation());
newGene.SetWorldPosition(gene.GetWorldPosition());
world->AddLevelNode(newGene.Autorelease(), true);
newGene.EnablePhysics();
return &newGene;
}
void Helix::PlaceGene(Gene& target, Gene& newGene)
{
target.RemoveFlags(RN::SceneNode::Flags::Hidden);
target.SetType(newGene.GetType());
target.DisablePhysics();
World* world = World::GetSharedInstance();
world->GetIPad()->UpdateAttributes(_genes);
if(newGene.GetSpawner())
{
newGene.GetSpawner()->ReturnToPool(&newGene);
}
else
{
world->RemoveLevelNode(&newGene);
}
}
RNDefineMeta(Gene, Grabbable)
Gene::Gene(Type type)
: Grabbable(geneModels[static_cast<size_t>(type)]),
_physicsBody(nullptr),
_type(type)
{
_spawner = nullptr;
}
void Gene::EnablePhysics()
{
if(_physicsBody) return;
RN::PhysXMaterial *material = new RN::PhysXMaterial();
RN::PhysXShape *shape = RN::PhysXBoxShape::WithHalfExtents(RN::Vector3(0.08f, 0.01f, 0.01f), material->Autorelease());
_physicsBody = RN::PhysXDynamicBody::WithShape(shape, 0.1f);
_physicsBody->SetCollisionFilter(World::CollisionType::Players, World::CollisionType::All);
AddAttachment(_physicsBody);
}
void Gene::DisablePhysics()
{
if(!_physicsBody) return;
RemoveAttachment(_physicsBody);
_physicsBody = nullptr;
}
void Gene::Update(float delta)
{
Grabbable::Update(delta);
if(_physicsBody)
{
_physicsBody->SetEnableKinematic(_isGrabbed);
if(_wantsThrow)
{
_physicsBody->SetLinearVelocity(_currentGrabbedSpeed);
_wantsThrow = false;
}
}
}
void Gene::SetType(Type type)
{
_type = type;
this->SetModel(geneModels[static_cast<size_t>(type)]);
}
}
| 24.226994 | 120 | 0.671056 | [
"shape",
"model"
] |
e48c3b7541f990d3dbcc4f1b073d0487bdad6b48 | 45,969 | cpp | C++ | dev/Code/Sandbox/Editor/Geometry/EdMesh.cpp | santosh90n/lumberyard-1 | 9608bcf905bb60e9f326bd3fe8297381c22d83a6 | [
"AML"
] | 1 | 2019-02-12T06:44:50.000Z | 2019-02-12T06:44:50.000Z | dev/Code/Sandbox/Editor/Geometry/EdMesh.cpp | santosh90n/lumberyard-1 | 9608bcf905bb60e9f326bd3fe8297381c22d83a6 | [
"AML"
] | null | null | null | dev/Code/Sandbox/Editor/Geometry/EdMesh.cpp | santosh90n/lumberyard-1 | 9608bcf905bb60e9f326bd3fe8297381c22d83a6 | [
"AML"
] | null | null | null | /*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
// Original file Copyright Crytek GMBH or its affiliates, used under license.
// Description : Implementation of CEdMesh class.
#include "StdAfx.h"
#include "EdMesh.h"
#include "Objects/DisplayContext.h"
#include "Objects/ObjectLoader.h"
#include "Include/ITransformManipulator.h"
#include "Viewport.h"
#include "ViewManager.h"
#include "Util/PakFile.h"
#include <I3Dengine.h>
#include <IChunkFile.h>
#include <IIndexedMesh.h>
#include <IRenderAuxGeom.h>
#include <CGFContent.h>
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//! Undo object for Editable Mesh.
class CUndoEdMesh
: public IUndoObject
{
public:
CUndoEdMesh(CEdMesh* pEdMesh, int nCopyFlags, const char* undoDescription)
{
// Stores the current state of this object.
assert(pEdMesh != 0);
m_nCopyFlags = nCopyFlags;
m_undoDescription = undoDescription;
m_pEdMesh = pEdMesh;
pEdMesh->CopyToMesh(undoMesh, nCopyFlags);
}
protected:
virtual int GetSize()
{
// sizeof(undoMesh) + sizeof(redoMesh);
return sizeof(*this);
}
virtual QString GetDescription() { return m_undoDescription; };
virtual void Undo(bool bUndo)
{
if (bUndo)
{
m_pEdMesh->CopyToMesh(redoMesh, m_nCopyFlags);
}
// Undo object state.
m_pEdMesh->CopyFromMesh(undoMesh, m_nCopyFlags, bUndo);
}
virtual void Redo()
{
m_pEdMesh->CopyFromMesh(redoMesh, m_nCopyFlags, true);
}
private:
QString m_undoDescription;
int m_nCopyFlags;
_smart_ptr<CEdMesh> m_pEdMesh;
CTriMesh undoMesh;
CTriMesh redoMesh;
};
//////////////////////////////////////////////////////////////////////////
// Static member of CEdMesh.
//////////////////////////////////////////////////////////////////////////
CEdMesh::MeshMap CEdMesh::m_meshMap;
//////////////////////////////////////////////////////////////////////////
CEdMesh::CEdMesh()
{
m_pStatObj = 0;
m_pSubObjCache = 0;
m_nUserCount = 0;
m_bModified = false;
}
//////////////////////////////////////////////////////////////////////////
CEdMesh::CEdMesh(IStatObj* pGeom)
{
assert(pGeom);
if (pGeom)
{
m_pStatObj = pGeom;
m_pStatObj->AddRef();
}
m_pSubObjCache = 0;
m_nUserCount = 0;
m_bModified = false;
}
//////////////////////////////////////////////////////////////////////////
CEdMesh::~CEdMesh()
{
for (auto ppIndexedMeshes = m_tempIndexedMeshes.begin(); ppIndexedMeshes != m_tempIndexedMeshes.end(); ++ppIndexedMeshes)
{
SAFE_RELEASE(*ppIndexedMeshes);
}
SAFE_RELEASE(m_pStatObj);
// Remove this object from map.
m_meshMap.erase(m_filename);
if (m_pSubObjCache)
{
if (m_pSubObjCache->pTriMesh)
{
delete m_pSubObjCache->pTriMesh;
}
delete m_pSubObjCache;
}
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::Serialize(CObjectArchive& ar)
{
if (ar.bUndo)
{
return;
}
if (ar.bLoading)
{
}
else
{
if (m_bModified)
{
CBaseObject* pObj = ar.GetCurrentObject();
if (pObj)
{
QString levelPath = Path::AddPathSlash(GetIEditor()->GetLevelFolder());
CPakFile* pPakFile = ar.GetGeometryPak((levelPath + "\\Geometry.pak").toUtf8().data());
if (pPakFile)
{
SaveToCGF(m_filename.toUtf8().data(), pPakFile);
}
}
SetModified(false);
}
}
}
//////////////////////////////////////////////////////////////////////////
// CEdMesh implementation.
//////////////////////////////////////////////////////////////////////////
CEdMesh* CEdMesh::LoadMesh(const char* filename)
{
if (strlen(filename) == 0)
{
return 0;
}
// If object created see if its not yet registered.
CEdMesh* pMesh = stl::find_in_map(m_meshMap, filename, (CEdMesh*)0);
if (pMesh)
{
// Found, return it.
return pMesh;
}
// Make new.
IStatObj* pGeom = GetIEditor()->Get3DEngine()->LoadStatObjUnsafeManualRef(filename);
if (!pGeom)
{
return 0;
}
// Not found, Make new.
pMesh = new CEdMesh(pGeom);
pMesh->m_filename = filename;
m_meshMap[filename] = pMesh;
return pMesh;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::AddUser()
{
m_nUserCount++;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::RemoveUser()
{
m_nUserCount--;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::ReloadAllGeometries()
{
for (MeshMap::iterator it = m_meshMap.begin(); it != m_meshMap.end(); ++it)
{
CEdMesh* pMesh = it->second;
if (pMesh)
{
pMesh->ReloadGeometry();
}
}
}
void CEdMesh::ReleaseAll()
{
m_meshMap.clear();
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::ReloadGeometry()
{
// Reload mesh.
if (m_pStatObj)
{
m_pStatObj->Refresh(FRO_GEOMETRY);
}
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::IsSameObject(const char* filename)
{
return QString::compare(m_filename, filename, Qt::CaseInsensitive) == 0;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::GetBounds(AABB& box)
{
assert(m_pStatObj);
if (m_pStatObj)
{
box.min = m_pStatObj->GetBoxMin();
box.max = m_pStatObj->GetBoxMax();
}
}
//////////////////////////////////////////////////////////////////////////
CEdGeometry* CEdMesh::Clone()
{
if (m_pStatObj)
{
// Clone StatObj.
IStatObj* pStatObj = m_pStatObj->Clone(true, true, false);
pStatObj->AddRef();
CEdMesh* pNewMesh = new CEdMesh(pStatObj);
return pNewMesh;
}
return NULL;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::SetFilename(const QString& filename)
{
if (!m_filename.isEmpty())
{
m_meshMap.erase(m_filename);
}
m_filename = Path::MakeGamePath(filename);
m_meshMap[m_filename] = this;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::Render(SRendParams& rp, const SRenderingPassInfo& passInfo)
{
if (m_pStatObj)
{
m_pStatObj->Render(rp, passInfo);
}
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::IsDefaultObject()
{
if (m_pStatObj)
{
return m_pStatObj->IsDefaultObject();
}
return false;
}
//////////////////////////////////////////////////////////////////////////
IIndexedMesh* CEdMesh::GetIndexedMesh(size_t idx)
{
if (m_tempIndexedMeshes.size() == 0 && m_pStatObj)
{
if (m_pStatObj->GetIndexedMesh())
{
if (idx == 0)
{
return m_pStatObj->GetIndexedMesh();
}
return nullptr;
}
else
{
// Load from CGF.
QString sFilename = m_pStatObj->GetFilePath();
CContentCGF cgf(sFilename.toUtf8().data());
if (gEnv->p3DEngine->LoadChunkFileContent(&cgf, sFilename.toUtf8().data()))
{
for (int i = 0; i < cgf.GetNodeCount(); ++i)
{
CNodeCGF* pNode = cgf.GetNode(i);
if (pNode->type == CNodeCGF::NODE_MESH)
{
CMesh* pMesh = pNode->pMesh;
if (pMesh)
{
IIndexedMesh* pTempIndexedMesh = GetIEditor()->Get3DEngine()->CreateIndexedMesh();
pTempIndexedMesh->SetMesh(*pMesh);
m_tempIndexedMeshes.push_back(pTempIndexedMesh);
Matrix34 tm = pNode->localTM;
CNodeCGF* pParent = pNode->pParent;
while (pParent)
{
tm = pParent->localTM * tm;
pParent = pParent->pParent;
}
m_tempMatrices.push_back(tm);
}
}
}
}
}
}
if (idx < m_tempIndexedMeshes.size())
{
return m_tempIndexedMeshes[idx];
}
return nullptr;
}
void CEdMesh::GetTM(Matrix34* pTM, size_t idx)
{
if (idx < m_tempMatrices.size())
{
*pTM = m_tempMatrices[idx];
}
else
{
pTM->SetIdentity();
}
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::AcceptModifySelection()
{
// Implement
UpdateIndexedMeshFromCache(true);
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::UpdateIndexedMeshFromCache(bool bFast)
{
// Implement
if (m_pSubObjCache)
{
if (bFast)
{
if (g_SubObjSelOptions.displayType == SO_DISPLAY_GEOMETRY)
{
m_pSubObjCache->pTriMesh->UpdateIndexedMesh(GetIndexedMesh());
if (m_pStatObj)
{
m_pStatObj->Invalidate();
}
}
}
else
{
m_pSubObjCache->pTriMesh->UpdateIndexedMesh(GetIndexedMesh());
if (m_pStatObj)
{
m_pStatObj->Invalidate();
}
}
}
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::StartSubObjSelection(const Matrix34& nodeWorldTM, int elemType, int nFlags)
{
IIndexedMesh* pIndexedMesh = GetIndexedMesh();
if (!pIndexedMesh)
{
return false;
}
CMesh& mesh = *pIndexedMesh->GetMesh();
if (!m_pSubObjCache)
{
m_pSubObjCache = new SubObjCache;
}
m_pSubObjCache->worldTM = nodeWorldTM;
m_pSubObjCache->invWorldTM = nodeWorldTM.GetInverted();
if (!m_pSubObjCache->pTriMesh)
{
m_pSubObjCache->pTriMesh = new CTriMesh;
m_pSubObjCache->pTriMesh->SetFromMesh(mesh);
}
UpdateSubObjCache();
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
triMesh.selectionType = elemType;
m_pSubObjCache->bNoDisplay = false;
return true;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::SetModified(bool bModified)
{
if (m_pSubObjCache && bModified)
{
// Update xformed vertices.
UpdateSubObjCache();
}
m_bModified = bModified;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::UpdateSubObjCache()
{
Matrix34& wtm = m_pSubObjCache->worldTM;
SetWorldTM(wtm);
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::EndSubObjSelection()
{
if (!m_pSubObjCache)
{
return;
}
UpdateIndexedMeshFromCache(false);
if (m_pSubObjCache->pTriMesh)
{
delete m_pSubObjCache->pTriMesh;
}
delete m_pSubObjCache;
m_pSubObjCache = 0;
if (m_pStatObj)
{
if (m_bModified)
{
m_pStatObj->Invalidate(true);
}
// Clear hidden flag from geometry.
m_pStatObj->SetFlags(m_pStatObj->GetFlags() & (~STATIC_OBJECT_HIDDEN));
}
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::Display(DisplayContext& dc)
{
if (!m_pSubObjCache || m_pSubObjCache->bNoDisplay)
{
return;
}
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
if (!triMesh.pWSVertices)
{
return;
}
if (m_pStatObj)
{
int nStatObjFlags = m_pStatObj->GetFlags();
if (g_SubObjSelOptions.displayType == SO_DISPLAY_GEOMETRY)
{
nStatObjFlags &= ~STATIC_OBJECT_HIDDEN;
}
else
{
nStatObjFlags |= STATIC_OBJECT_HIDDEN;
}
m_pStatObj->SetFlags(nStatObjFlags);
}
const Matrix34& worldTM = m_pSubObjCache->worldTM;
Vec3 vWSCameraVector = m_pSubObjCache->worldTM.GetTranslation() - dc.view->GetViewTM().GetTranslation();
Vec3 vOSCameraVector = m_pSubObjCache->invWorldTM.TransformVector(vWSCameraVector).GetNormalized(); // Object space camera vector.
// Render geometry vertices.
uint32 nPrevState = dc.GetState();
//////////////////////////////////////////////////////////////////////////
// Calculate front facing vertices.
//////////////////////////////////////////////////////////////////////////
triMesh.frontFacingVerts.resize(triMesh.GetVertexCount());
triMesh.frontFacingVerts.clear();
for (int i = 0; i < triMesh.GetFacesCount(); i++)
{
CTriFace& face = triMesh.pFaces[i];
if (vOSCameraVector.Dot(face.normal) < 0)
{
triMesh.frontFacingVerts[face.v[0]] = true;
triMesh.frontFacingVerts[face.v[1]] = true;
triMesh.frontFacingVerts[face.v[2]] = true;
}
}
//////////////////////////////////////////////////////////////////////////
// Display flat shaded object.
//////////////////////////////////////////////////////////////////////////
if (g_SubObjSelOptions.displayType == SO_DISPLAY_FLAT)
{
ColorB faceColor(0, 250, 250, 255);
ColorB col = faceColor;
dc.SetDrawInFrontMode(false);
dc.SetFillMode(e_FillModeSolid);
dc.CullOn();
for (int i = 0; i < triMesh.GetFacesCount(); i++)
{
CTriFace& face = triMesh.pFaces[i];
if (triMesh.selectionType != SO_ELEM_FACE || !triMesh.faceSel[i])
{
ColorB col = faceColor;
float dt = -face.normal.Dot(vOSCameraVector);
dt = max(0.4f, dt);
dt = min(1.0f, dt);
col.r = ftoi(faceColor.r * dt);
col.g = ftoi(faceColor.g * dt);
col.b = ftoi(faceColor.b * dt);
col.a = faceColor.a;
dc.pRenderAuxGeom->DrawTriangle(
triMesh.pWSVertices[face.v[0]], col,
triMesh.pWSVertices[face.v[1]], col,
triMesh.pWSVertices[face.v[2]], col
);
}
}
}
// Draw selected triangles.
ColorB edgeColor(255, 255, 255, 155);
if (triMesh.StreamHaveSelection(CTriMesh::FACES))
{
if (g_SubObjSelOptions.bDisplayBackfacing)
{
dc.CullOff();
}
else
{
dc.CullOn();
}
dc.SetDrawInFrontMode(true);
dc.SetFillMode(e_FillModeWireframe);
// Draw triangles.
//dc.pRenderAuxGeom->DrawTriangles( triMesh.pVertices,triMesh.GetVertexCount(), mesh.m_pIndices,mesh.GetIndexCount(),edgeColor );
for (int i = 0; i < triMesh.GetFacesCount(); i++)
{
CTriFace& face = triMesh.pFaces[i];
if (!triMesh.faceSel[i])
{
dc.pRenderAuxGeom->DrawTriangle(
triMesh.pWSVertices[face.v[0]], edgeColor,
triMesh.pWSVertices[face.v[1]], edgeColor,
triMesh.pWSVertices[face.v[2]], edgeColor
);
}
}
}
if (g_SubObjSelOptions.bDisplayNormals)
{
for (int i = 0; i < triMesh.GetFacesCount(); i++)
{
CTriFace& face = triMesh.pFaces[i];
Vec3 p1 = triMesh.pWSVertices[face.v[0]];
Vec3 p2 = triMesh.pWSVertices[face.v[1]];
Vec3 p3 = triMesh.pWSVertices[face.v[2]];
Vec3 midp = (p1 + p2 + p3) * (1.0f / 3.0f);
dc.pRenderAuxGeom->DrawLine(midp, edgeColor, midp + worldTM.TransformVector(face.normal) * g_SubObjSelOptions.fNormalsLength, edgeColor);
}
}
if (triMesh.selectionType == SO_ELEM_VERTEX || triMesh.StreamHaveSelection(CTriMesh::VERTICES))
{
ColorB pointColor(0, 255, 255, 255);
float fClrAdd = (g_SubObjSelOptions.bSoftSelection) ? 0 : 1;
for (int i = 0; i < triMesh.GetVertexCount(); i++)
{
bool bSelected = triMesh.vertSel[i] || triMesh.pWeights[i] != 0;
if (bSelected)
{
int clr = (triMesh.pWeights[i] + fClrAdd) * 255;
dc.pRenderAuxGeom->DrawPoint(triMesh.pWSVertices[i], ColorB(clr, 255 - clr, 255 - clr, 255), 8);
}
else if (!g_SubObjSelOptions.bDisplayBackfacing || triMesh.frontFacingVerts[i])
{
dc.pRenderAuxGeom->DrawPoint(triMesh.pWSVertices[i], pointColor, 5);
}
}
}
// Draw edges.
if (triMesh.selectionType == SO_ELEM_EDGE || triMesh.StreamHaveSelection(CTriMesh::EDGES))
{
ColorB edgeColor(200, 255, 200, 255);
ColorB selEdgeColor(255, 0, 0, 255);
// Draw selected edges.
for (int i = 0; i < triMesh.GetEdgeCount(); i++)
{
CTriEdge& edge = triMesh.pEdges[i];
if (triMesh.edgeSel[i])
{
const Vec3& p1 = triMesh.pWSVertices[edge.v[0]];
const Vec3& p2 = triMesh.pWSVertices[edge.v[1]];
dc.pRenderAuxGeom->DrawLine(p1, selEdgeColor, p2, selEdgeColor, 6);
}
else if (!g_SubObjSelOptions.bDisplayBackfacing || (
triMesh.frontFacingVerts[edge.v[0]] && triMesh.frontFacingVerts[edge.v[1]]))
{
const Vec3& p1 = triMesh.pWSVertices[edge.v[0]];
const Vec3& p2 = triMesh.pWSVertices[edge.v[1]];
dc.pRenderAuxGeom->DrawLine(p1, edgeColor, p2, edgeColor);
}
}
}
if (triMesh.selectionType == SO_ELEM_FACE)
{
ColorB pointColor(0, 255, 255, 255);
ColorB selFaceColor(255, 0, 0, 180);
// Draw selected faces and face points.
dc.CullOff();
dc.SetFillMode(e_FillModeSolid);
for (int i = 0; i < triMesh.GetFacesCount(); i++)
{
CTriFace& face = triMesh.pFaces[i];
const Vec3& p1 = triMesh.pWSVertices[face.v[0]];
const Vec3& p2 = triMesh.pWSVertices[face.v[1]];
const Vec3& p3 = triMesh.pWSVertices[face.v[2]];
if (triMesh.faceSel[i])
{
dc.pRenderAuxGeom->DrawTriangle(p1, selFaceColor, p2, selFaceColor, p3, selFaceColor);
}
if (!g_SubObjSelOptions.bDisplayBackfacing && vOSCameraVector.Dot(face.normal) > 0)
{
continue; // Backfacing.
}
Vec3 midp = (p1 + p2 + p3) * (1.0f / 3.0f);
dc.pRenderAuxGeom->DrawPoint(midp, pointColor, 4);
}
}
else if (triMesh.StreamHaveSelection(CTriMesh::FACES))
{
ColorB pointColor(0, 255, 255, 255);
ColorB selFaceColor(255, 0, 0, 180);
// Draw selected faces and face points.
dc.CullOff();
dc.SetFillMode(e_FillModeSolid);
for (int i = 0; i < triMesh.GetFacesCount(); i++)
{
CTriFace& face = triMesh.pFaces[i];
const Vec3& p1 = triMesh.pWSVertices[face.v[0]];
const Vec3& p2 = triMesh.pWSVertices[face.v[1]];
const Vec3& p3 = triMesh.pWSVertices[face.v[2]];
if (triMesh.faceSel[i])
{
dc.pRenderAuxGeom->DrawTriangle(p1, selFaceColor, p2, selFaceColor, p3, selFaceColor);
}
}
}
dc.SetState(nPrevState); // Restore render state.
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::HitTestVertex(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result)
{
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
// This make sure that bit array size matches num vertices, front facing should be calculated in Display method.
triMesh.frontFacingVerts.resize(triMesh.GetVertexCount());
float minDist = FLT_MAX;
int closestElem = -1;
for (int i = 0; i < triMesh.GetVertexCount(); i++)
{
if (env.bIgnoreBackfacing && !triMesh.frontFacingVerts[i])
{
continue;
}
QPoint p = hit.view->WorldToView(triMesh.pWSVertices[i]);
if (p.x() >= hit.rect.left() && p.x() <= hit.rect.right() &&
p.y() >= hit.rect.top() && p.y() <= hit.rect.bottom())
{
if (env.bHitTestNearest)
{
float dist = env.vWSCameraPos.GetDistance(triMesh.pWSVertices[i]);
if (dist < minDist)
{
closestElem = i;
minDist = dist;
}
}
else
{
result.elems.push_back(i);
}
}
}
//////////////////////////////////////////////////////////////////////////
if (closestElem >= 0)
{
result.minDistance = minDist;
result.elems.push_back(closestElem);
}
return !result.elems.empty();
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::HitTestEdge(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result)
{
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
// This make sure that bit array size matches num vertices, front facing should be calculated in Display method.
triMesh.frontFacingVerts.resize(triMesh.GetVertexCount());
float minDist = FLT_MAX;
int closestElem = -1;
for (int i = 0; i < triMesh.GetEdgeCount(); i++)
{
CTriEdge& edge = triMesh.pEdges[i];
if (!env.bIgnoreBackfacing ||
(triMesh.frontFacingVerts[edge.v[0]] && triMesh.frontFacingVerts[edge.v[1]]))
{
if (hit.view->HitTestLine(triMesh.pWSVertices[edge.v[0]], triMesh.pWSVertices[edge.v[1]], hit.point2d, 5))
{
if (env.bHitTestNearest)
{
float dist = env.vWSCameraPos.GetDistance(triMesh.pWSVertices[edge.v[0]]);
if (dist < minDist)
{
closestElem = i;
minDist = dist;
}
}
else
{
result.elems.push_back(i);
}
}
}
}
//////////////////////////////////////////////////////////////////////////
if (closestElem >= 0)
{
result.minDistance = minDist;
result.elems.push_back(closestElem);
}
return !result.elems.empty();
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::HitTestFace(HitContext& hit, SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result)
{
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
float minDist = FLT_MAX;
int closestElem = -1;
Vec3 vOut(0, 0, 0);
Ray hitRay(hit.raySrc, hit.rayDir);
for (int i = 0; i < triMesh.GetFacesCount(); i++)
{
CTriFace& face = triMesh.pFaces[i];
if (env.bIgnoreBackfacing && env.vOSCameraVector.Dot(face.normal) > 0)
{
continue; // Back facing.
}
Vec3 p1 = triMesh.pWSVertices[face.v[0]];
Vec3 p2 = triMesh.pWSVertices[face.v[1]];
Vec3 p3 = triMesh.pWSVertices[face.v[2]];
if (!env.bHitTestNearest)
{
// Hit test face middle point in rectangle.
Vec3 midp = (p1 + p2 + p3) * (1.0f / 3.0f);
QPoint p = hit.view->WorldToView(midp);
if (p.x() >= hit.rect.left() && p.x() <= hit.rect.right() &&
p.y() >= hit.rect.top() && p.y() <= hit.rect.bottom())
{
result.elems.push_back(i);
}
}
else
{
// Hit test ray/triangle.
if (Intersect::Ray_Triangle(hitRay, p1, p3, p2, vOut))
{
float dist = hitRay.origin.GetSquaredDistance(vOut);
if (dist < minDist)
{
closestElem = i;
minDist = dist;
}
}
}
}
//////////////////////////////////////////////////////////////////////////
if (closestElem >= 0)
{
result.minDistance = (float)sqrt(minDist);
result.elems.push_back(closestElem);
}
return !result.elems.empty();
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::SelectSubObjElements(SSubObjHitTestEnvironment& env, SSubObjHitTestResult& result)
{
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
bool bSelChanged = false;
if (env.bSelectOnHit && !result.elems.empty())
{
CBitArray* streamSel = triMesh.GetStreamSelection(result.stream);
if (streamSel)
{
// Select on hit.
for (int i = 0, num = result.elems.size(); i < num; i++)
{
int elem = result.elems[i];
if ((*streamSel)[elem] != env.bSelectValue)
{
bSelChanged = true;
(*streamSel)[elem] = env.bSelectValue;
}
}
if (bSelChanged)
{
if (env.bSelectValue)
{
triMesh.streamSelMask |= (1 << result.stream);
}
else if (!env.bSelectValue && streamSel->is_zero())
{
triMesh.streamSelMask &= ~(1 << result.stream);
}
}
}
}
return bSelChanged;
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::IsHitTestResultSelected(SSubObjHitTestResult& result)
{
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
if (!result.elems.empty())
{
CBitArray* streamSel = triMesh.GetStreamSelection(result.stream);
if (streamSel)
{
// check if first result element is selected.
if ((*streamSel)[ result.elems[0] ])
{
return true;
}
}
}
return false;
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::HitTest(HitContext& hit)
{
if (hit.nSubObjFlags & SO_HIT_NO_EDIT)
// This is for a 'move-by-face-normal'. Prepare the mesh and set the 'bNoDisplay'to true
// so that the normal rendering happens instead of the edit-mode rendering.
{
StartSubObjSelection(hit.object->GetWorldTM(), SO_ELEM_FACE, 0);
m_pSubObjCache->bNoDisplay = true;
}
if (!m_pSubObjCache)
{
return false;
}
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
SSubObjHitTestEnvironment env;
env.vWSCameraPos = hit.view->GetViewTM().GetTranslation();
env.vWSCameraVector = m_pSubObjCache->worldTM.GetTranslation() - hit.view->GetViewTM().GetTranslation();
env.vOSCameraVector = m_pSubObjCache->invWorldTM.TransformVector(env.vWSCameraVector).GetNormalized(); // Object space camera vector.
env.bHitTestNearest = hit.nSubObjFlags & SO_HIT_POINT;
env.bHitTestSelected = hit.nSubObjFlags & SO_HIT_TEST_SELECTED;
env.bSelectOnHit = hit.nSubObjFlags & SO_HIT_SELECT;
env.bAdd = hit.nSubObjFlags & SO_HIT_SELECT_ADD;
env.bRemove = hit.nSubObjFlags & SO_HIT_SELECT_REMOVE;
env.bSelectValue = !env.bRemove;
env.bHighlightOnly = hit.nSubObjFlags & SO_HIT_HIGHLIGHT_ONLY;
env.bIgnoreBackfacing = g_SubObjSelOptions.bIgnoreBackfacing && !env.bHitTestNearest;
int nHitTestWhat = (hit.nSubObjFlags & SO_HIT_ELEM_ALL);
if (nHitTestWhat == 0)
{
if (g_SubObjSelOptions.bSelectByVertex)
{
nHitTestWhat |= SO_HIT_ELEM_VERTEX;
}
switch (triMesh.selectionType)
{
case SO_ELEM_VERTEX:
nHitTestWhat |= SO_HIT_ELEM_VERTEX;
break;
case SO_ELEM_EDGE:
nHitTestWhat |= SO_HIT_ELEM_EDGE;
break;
case SO_ELEM_FACE:
nHitTestWhat |= SO_HIT_ELEM_FACE;
break;
case SO_ELEM_POLYGON:
nHitTestWhat |= SO_HIT_ELEM_POLYGON;
break;
}
}
IUndoObject* pUndoObj = NULL;
if (env.bSelectOnHit)
{
if (CUndo::IsRecording() && !(hit.nSubObjFlags & SO_HIT_NO_EDIT))
{
switch (triMesh.selectionType)
{
case SO_ELEM_VERTEX:
pUndoObj = new CUndoEdMesh(this, CTriMesh::COPY_VERT_SEL | CTriMesh::COPY_WEIGHTS, "Select Vertex(s)");
break;
case SO_ELEM_EDGE:
pUndoObj = new CUndoEdMesh(this, CTriMesh::COPY_EDGE_SEL | CTriMesh::COPY_WEIGHTS, "Select Edge(s)");
break;
case SO_ELEM_FACE:
pUndoObj = new CUndoEdMesh(this, CTriMesh::COPY_FACE_SEL | CTriMesh::COPY_WEIGHTS, "Select Face(s)");
break;
}
}
}
bool bSelChanged = false;
bool bAnyHit = false;
//////////////////////////////////////////////////////////////////////////
if (env.bSelectOnHit && !env.bAdd && !env.bRemove)
{
bSelChanged = triMesh.ClearSelection();
}
//////////////////////////////////////////////////////////////////////////
SSubObjHitTestResult result[4];
result[0].stream = CTriMesh::VERTICES;
result[1].stream = CTriMesh::EDGES;
result[2].stream = CTriMesh::FACES;
if (nHitTestWhat & SO_HIT_ELEM_VERTEX)
{
if (HitTestVertex(hit, env, result[0]))
{
bAnyHit = true;
}
}
if (nHitTestWhat & SO_HIT_ELEM_EDGE)
{
if (HitTestEdge(hit, env, result[1]))
{
bAnyHit = true;
}
}
if (nHitTestWhat & SO_HIT_ELEM_FACE)
{
if (HitTestFace(hit, env, result[2]))
{
bAnyHit = true;
}
}
if (bAnyHit && !env.bSelectOnHit && !env.bHitTestSelected)
{
// Return distance to the first hit element.
hit.dist = min(min(result[0].minDistance, result[1].minDistance), result[2].minDistance);
return true;
}
if (bAnyHit && !env.bSelectOnHit && env.bHitTestSelected)
{
// check if we hit selected item.
if (IsHitTestResultSelected(result[0]) ||
IsHitTestResultSelected(result[1]) ||
IsHitTestResultSelected(result[2]))
{
hit.dist = min(min(result[0].minDistance, result[1].minDistance), result[2].minDistance);
return true;
}
// If not hit selected.
return false;
}
if (bAnyHit)
{
// Find closest hit.
int n = 0;
if (!result[0].elems.empty())
{
n = 0;
}
else if (!result[1].elems.empty())
{
n = 1;
}
else if (!result[2].elems.empty())
{
n = 2;
}
hit.dist = result[n].minDistance;
if (env.bSelectOnHit &&
g_SubObjSelOptions.bSelectByVertex &&
!result[0].elems.empty() &&
!env.bHighlightOnly &&
triMesh.selectionType != SO_HIT_ELEM_VERTEX)
{
// When selecting elements by vertex.
switch (triMesh.selectionType)
{
case SO_ELEM_EDGE:
n = 1;
triMesh.GetEdgesByVertex(result[0].elems, result[1].elems);
break;
case SO_ELEM_FACE:
n = 2;
triMesh.GetFacesByVertex(result[0].elems, result[2].elems);
break;
case SO_ELEM_POLYGON:
n = 2;
triMesh.GetFacesByVertex(result[0].elems, result[2].elems);
break;
}
}
if (env.bSelectOnHit && SelectSubObjElements(env, result[n]))
{
bSelChanged = true;
}
}
if (bSelChanged)
{
hit.nSubObjFlags |= SO_HIT_SELECTION_CHANGED;
}
else
{
hit.nSubObjFlags &= ~SO_HIT_SELECTION_CHANGED;
}
bool bSelectionNotEmpty = false;
if (env.bSelectOnHit && bSelChanged && !env.bHighlightOnly)
{
if (CUndo::IsRecording() && pUndoObj)
{
CUndo::Record(pUndoObj);
}
bSelectionNotEmpty = triMesh.UpdateSelection();
if (g_SubObjSelOptions.bSoftSelection)
{
triMesh.SoftSelection(g_SubObjSelOptions);
}
OnSelectionChange();
}
else
{
if (pUndoObj)
{
pUndoObj->Release();
}
}
return bSelectionNotEmpty;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::OnSelectionChange()
{
Matrix34 localRefFrame;
if (!GetSelectionReferenceFrame(localRefFrame))
{
GetIEditor()->ShowTransformManipulator(false);
}
else
{
ITransformManipulator* pManipulator = GetIEditor()->ShowTransformManipulator(true);
// In local space orient axis gizmo by first object.
localRefFrame = m_pSubObjCache->worldTM * localRefFrame;
Matrix34 parentTM = m_pSubObjCache->worldTM;
Matrix34 userTM = GetIEditor()->GetViewManager()->GetGrid()->GetMatrix();
parentTM.SetTranslation(localRefFrame.GetTranslation());
userTM.SetTranslation(localRefFrame.GetTranslation());
//tm.SetTranslation( m_selectionCenter );
pManipulator->SetTransformation(COORDS_LOCAL, localRefFrame);
pManipulator->SetTransformation(COORDS_PARENT, parentTM);
pManipulator->SetTransformation(COORDS_USERDEFINED, userTM);
}
}
//////////////////////////////////////////////////////////////////////////
bool CEdMesh::GetSelectionReferenceFrame(Matrix34& refFrame)
{
if (!m_pSubObjCache)
{
return false;
}
bool bAnySelected = false;
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
Vec3 normal(0, 0, 0);
refFrame.SetIdentity();
if (triMesh.selectionType == SO_ELEM_VERTEX)
{
// Average all selected vertex normals.
int numNormals = 0;
int nFaces = triMesh.GetFacesCount();
for (int i = 0; i < triMesh.GetVertexCount(); i++)
{
if (triMesh.vertSel[i])
{
bAnySelected = true;
int nVertexIndex = i;
for (int j = 0; j < nFaces; j++)
{
CTriFace& face = triMesh.pFaces[j];
for (int k = 0; k < 3; k++)
{
if (face.v[k] == nVertexIndex)
{
normal += face.n[k];
numNormals++;
}
}
}
}
}
if (numNormals > 0)
{
normal = normal / numNormals;
if (!normal.IsZero())
{
normal.Normalize();
}
}
}
else if (triMesh.selectionType == SO_ELEM_EDGE)
{
int nNormals = 0;
// Average face normals of a the selected edges.
for (int i = 0; i < triMesh.GetEdgeCount(); i++)
{
if (triMesh.edgeSel[i])
{
bAnySelected = true;
CTriEdge& edge = triMesh.pEdges[i];
for (int j = 0; j < 2; j++)
{
if (edge.face[j] >= 0)
{
normal = normal + triMesh.pFaces[edge.face[j]].normal;
nNormals++;
}
}
}
}
if (nNormals > 0)
{
normal = normal / nNormals;
if (!normal.IsZero())
{
normal.Normalize();
}
}
}
else if (triMesh.selectionType == SO_ELEM_FACE)
{
// Average all face normals.
int nNormals = 0;
for (int i = 0; i < triMesh.GetFacesCount(); i++)
{
if (triMesh.faceSel[i])
{
bAnySelected = true;
CTriFace& face = triMesh.pFaces[i];
normal = normal + face.normal;
nNormals++;
}
}
if (nNormals > 0)
{
normal = normal / nNormals;
if (!normal.IsZero())
{
normal.Normalize();
}
}
}
if (bAnySelected)
{
Vec3 pos(0, 0, 0);
int numSel = 0;
for (int i = 0; i < triMesh.GetVertexCount(); i++)
{
if (triMesh.pWeights[i] == 1.0f)
{
pos = pos + triMesh.pVertices[i].pos;
numSel++;
}
}
if (numSel > 0)
{
pos = pos / numSel; // Average position.
}
refFrame.SetTranslation(pos);
if (!normal.IsZero())
{
Vec3 xAxis(1, 0, 0), yAxis(0, 1, 0), zAxis(0, 0, 1);
if (normal.IsEquivalent(zAxis) || normal.IsEquivalent(-zAxis))
{
zAxis = xAxis;
}
xAxis = normal.Cross(zAxis).GetNormalized();
yAxis = xAxis.Cross(normal).GetNormalized();
refFrame.SetFromVectors(xAxis, yAxis, normal, pos);
}
}
return bAnySelected;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::ModifySelection(SSubObjSelectionModifyContext& modCtx, bool isUndo)
{
if (!m_pSubObjCache)
{
return;
}
IIndexedMesh* pIndexedMesh = GetIndexedMesh();
if (!pIndexedMesh)
{
return;
}
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
if (modCtx.type == SO_MODIFY_UNSELECT)
{
IUndoObject* pUndoObj = NULL;
if (CUndo::IsRecording())
{
pUndoObj = new CUndoEdMesh(this, CTriMesh::COPY_VERT_SEL | CTriMesh::COPY_WEIGHTS, "Move Vertices");
}
bool bChanged = triMesh.ClearSelection();
if (bChanged)
{
OnSelectionChange();
}
if (CUndo::IsRecording() && bChanged)
{
CUndo::Record(pUndoObj);
}
else if (pUndoObj)
{
pUndoObj->Release();
}
return;
}
Matrix34 worldTM = m_pSubObjCache->worldTM;
Matrix34 invTM = worldTM.GetInverted();
// Change modify reference frame to object space.
Matrix34 modRefFrame = invTM * modCtx.worldRefFrame;
Matrix34 modRefFrameInverse = modCtx.worldRefFrame.GetInverted() * worldTM;
if (modCtx.type == SO_MODIFY_MOVE)
{
if (CUndo::IsRecording())
{
CUndo::Record(new CUndoEdMesh(this, CTriMesh::COPY_VERTICES, "Move Vertices"));
}
Vec3 vOffset = modCtx.vValue;
vOffset = modCtx.worldRefFrame.GetInverted().TransformVector(vOffset); // Offset in local space.
for (int i = 0; i < triMesh.GetVertexCount(); i++)
{
CTriVertex& vtx = triMesh.pVertices[i];
if (triMesh.pWeights[i] != 0)
{
Matrix34 tm = modRefFrame * Matrix34::CreateTranslationMat(vOffset * triMesh.pWeights[i]) * modRefFrameInverse;
vtx.pos = tm.TransformPoint(vtx.pos);
}
}
OnSelectionChange();
}
else if (modCtx.type == SO_MODIFY_ROTATE)
{
if (CUndo::IsRecording())
{
CUndo::Record(new CUndoEdMesh(this, CTriMesh::COPY_VERTICES, "Rotate Vertices"));
}
Ang3 angles = Ang3(modCtx.vValue);
for (int i = 0; i < triMesh.GetVertexCount(); i++)
{
CTriVertex& vtx = triMesh.pVertices[i];
if (triMesh.pWeights[i] != 0)
{
Matrix34 tm = modRefFrame * Matrix33::CreateRotationXYZ(angles * triMesh.pWeights[i]) * modRefFrameInverse;
vtx.pos = tm.TransformPoint(vtx.pos);
}
}
}
else if (modCtx.type == SO_MODIFY_SCALE)
{
if (CUndo::IsRecording())
{
CUndo::Record(new CUndoEdMesh(this, CTriMesh::COPY_VERTICES, "Scale Vertices"));
}
Vec3 vScale = modCtx.vValue;
for (int i = 0; i < triMesh.GetVertexCount(); i++)
{
CTriVertex& vtx = triMesh.pVertices[i];
if (triMesh.pWeights[i] != 0)
{
Vec3 scl = Vec3(1.0f, 1.0f, 1.0f) * (1.0f - triMesh.pWeights[i]) + vScale * triMesh.pWeights[i];
Matrix34 tm = modRefFrame * Matrix33::CreateScale(scl) * modRefFrameInverse;
vtx.pos = tm.TransformPoint(vtx.pos);
}
}
}
SetModified();
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::CopyToMesh(CTriMesh& toMesh, int nCopyFlags)
{
if (!m_pSubObjCache)
{
return;
}
toMesh.Copy(*m_pSubObjCache->pTriMesh, nCopyFlags);
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::CopyFromMesh(CTriMesh& fromMesh, int nCopyFlags, bool bUndo)
{
if (m_pSubObjCache)
{
m_pSubObjCache->pTriMesh->Copy(fromMesh, nCopyFlags);
}
else
{
/*
CMesh mesh;
CTriMesh triMesh;
triMesh.Copy( fromMesh );
trimesh.void CopyToMeshFast( CMesh &mesh );
*/
}
if (bUndo)
{
UpdateIndexedMeshFromCache(true);
OnSelectionChange();
}
if (m_pSubObjCache)
{
UpdateSubObjCache();
}
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::SaveToCGF(const char* sFilename, CPakFile* pPakFile, _smart_ptr<IMaterial> pMaterial)
{
if (m_pStatObj)
{
// Save this EdMesh to CGF file.
m_filename = Path::MakeGamePath(sFilename);
_smart_ptr<IMaterial> pOriginalMaterial = m_pStatObj->GetMaterial();
if (pMaterial)
{
m_pStatObj->SetMaterial(pMaterial);
}
if (!pPakFile)
{
m_pStatObj->SaveToCGF(sFilename);
}
else
{
IChunkFile* pChunkFile = NULL;
if (m_pStatObj->SaveToCGF(sFilename, &pChunkFile))
{
void* pMemFile = NULL;
int nFileSize = 0;
pChunkFile->WriteToMemoryBuffer(&pMemFile, &nFileSize);
pPakFile->UpdateFile(sFilename, pMemFile, nFileSize, true, ICryArchive::LEVEL_FASTER);
pChunkFile->Release();
}
}
// Restore original material.
if (pMaterial)
{
m_pStatObj->SetMaterial(pOriginalMaterial);
}
}
}
//////////////////////////////////////////////////////////////////////////
CTriMesh* CEdMesh::GetMesh()
{
if (m_pSubObjCache)
{
return m_pSubObjCache->pTriMesh;
}
return 0;
}
//////////////////////////////////////////////////////////////////////////
CEdMesh* CEdMesh::CreateMesh(const char* name)
{
IStatObj* pStatObj = gEnv->p3DEngine->CreateStatObj();
if (pStatObj)
{
CEdMesh* pEdMesh = new CEdMesh;
pEdMesh->m_pStatObj = pStatObj;
pEdMesh->m_pStatObj->AddRef();
// Force create of indexed mesh.
pEdMesh->m_pStatObj->GetIndexedMesh(true);
// Not found, Make new.
pEdMesh->m_filename = name;
if (!pEdMesh->m_pSubObjCache)
{
pEdMesh->m_pSubObjCache = new SubObjCache;
pEdMesh->m_pSubObjCache->pTriMesh = new CTriMesh;
pEdMesh->m_pSubObjCache->worldTM.SetIdentity();
pEdMesh->m_pSubObjCache->invWorldTM.SetIdentity();
}
return pEdMesh;
}
return NULL;
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::InvalidateMesh()
{
if (m_pSubObjCache)
{
UpdateIndexedMeshFromCache(false);
}
if (m_pStatObj)
{
m_pStatObj->Invalidate(true);
}
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::SetWorldTM(const Matrix34& worldTM)
{
if (!m_pSubObjCache)
{
return;
}
m_pSubObjCache->worldTM = worldTM;
m_pSubObjCache->invWorldTM = worldTM.GetInverted();
//////////////////////////////////////////////////////////////////////////
// Transform vertices and normals to world space and store in cached mesh.
//////////////////////////////////////////////////////////////////////////
CTriMesh& triMesh = *m_pSubObjCache->pTriMesh;
int nVerts = triMesh.GetVertexCount();
triMesh.ReallocStream(CTriMesh::WS_POSITIONS, nVerts);
for (int i = 0; i < nVerts; i++)
{
triMesh.pWSVertices[i] = worldTM.TransformPoint(triMesh.pVertices[i].pos);
}
}
//////////////////////////////////////////////////////////////////////////
void CEdMesh::DebugDraw(const SGeometryDebugDrawInfo& info, float fExtrdueScale)
{
if (m_pStatObj)
{
m_pStatObj->DebugDraw(info, fExtrdueScale);
}
}
| 29.714932 | 149 | 0.497944 | [
"mesh",
"geometry",
"render",
"object",
"vector",
"transform"
] |
e49484554a130f40646f7f19387ef2accdc196de | 58,482 | cpp | C++ | code/deps/tpie/test/unit/test_pipelining.cpp | mbeckem/msc | 93e71ba163a7ffef4eec3e83934fa793f3f50ff6 | [
"MIT"
] | null | null | null | code/deps/tpie/test/unit/test_pipelining.cpp | mbeckem/msc | 93e71ba163a7ffef4eec3e83934fa793f3f50ff6 | [
"MIT"
] | null | null | null | code/deps/tpie/test/unit/test_pipelining.cpp | mbeckem/msc | 93e71ba163a7ffef4eec3e83934fa793f3f50ff6 | [
"MIT"
] | null | null | null | // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*-
// vi:set ts=4 sts=4 sw=4 noet cino+=(0 :
// Copyright 2011, 2012, 2013 The TPIE development team
//
// This file is part of TPIE.
//
// TPIE is free software: you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License as published by the
// Free Software Foundation, either version 3 of the License, or (at your
// option) any later version.
//
// TPIE 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 Lesser General Public
// License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with TPIE. If not, see <http://www.gnu.org/licenses/>
#include "common.h"
#include <tpie/pipelining.h>
#include <tpie/pipelining/subpipeline.h>
#include <tpie/file_stream.h>
#include <algorithm>
#include <cmath>
#include <memory>
#include <tpie/sysinfo.h>
#include <tpie/pipelining/forwarder.h>
#include <tpie/pipelining/virtual.h>
#include <tpie/pipelining/serialization.h>
#include <tpie/progress_indicator_arrow.h>
#include <tpie/pipelining/helpers.h>
#include <tpie/pipelining/split.h>
#include <tpie/resource_manager.h>
using namespace tpie;
using namespace tpie::pipelining;
typedef uint64_t test_t;
template <typename dest_t>
struct multiply_t : public node {
typedef test_t item_type;
inline multiply_t(dest_t dest, uint64_t factor)
: dest(std::move(dest))
, factor(factor)
{
set_minimum_memory(17000000);
add_push_destination(dest);
}
virtual void begin() override {
node::begin();
log_debug() << "multiply begin with memory " << this->get_available_memory() << std::endl;
}
void push(const test_t & item) {
dest.push(factor*item);
}
dest_t dest;
uint64_t factor;
};
typedef pipe_middle<factory<multiply_t, uint64_t> > multiply;
std::vector<test_t> inputvector;
std::vector<test_t> expectvector;
std::vector<test_t> outputvector;
void setup_test_vectors() {
inputvector.resize(0); expectvector.resize(0); outputvector.resize(0);
inputvector.resize(20); expectvector.resize(20);
for (size_t i = 0; i < 20; ++i) {
inputvector[i] = i;
expectvector[i] = i*6;
}
}
bool check_test_vectors() {
if (outputvector != expectvector) {
log_error() << "Output vector does not match expect vector\n"
<< "Expected: " << std::flush;
std::vector<test_t>::iterator expectit = expectvector.begin();
while (expectit != expectvector.end()) {
log_error()<< *expectit << ' ';
++expectit;
}
log_error()<< '\n'
<< "Output: " << std::flush;
std::vector<test_t>::iterator outputit = outputvector.begin();
while (outputit != outputvector.end()) {
log_error()<< *outputit << ' ';
++outputit;
}
log_error()<< std::endl;
return false;
}
return true;
}
bool vector_multiply_test() {
pipeline p = input_vector(inputvector) | multiply(3) | multiply(2) | output_vector(outputvector);
p.plot(log_info());
p();
return check_test_vectors();
}
bool file_stream_test(stream_size_type items) {
tpie::temp_file input_file;
tpie::temp_file output_file;
{
file_stream<test_t> in;
in.open(input_file.path());
for (stream_size_type i = 0; i < items; ++i) {
in.write(i);
}
}
{
file_stream<test_t> in;
in.open(input_file.path());
file_stream<test_t> out;
out.open(output_file.path());
// p is actually an input_t<multiply_t<multiply_t<output_t<test_t> > > >
pipeline p = (input(in) | multiply(3) | multiply(2) | output(out));
p.plot(log_info());
p();
}
{
file_stream<test_t> out;
out.open(output_file.path());
for (stream_size_type i = 0; i < items; ++i) {
if (i*6 != out.read()) return false;
}
}
return true;
}
bool file_stream_pull_test() {
tpie::temp_file input_file;
tpie::temp_file output_file;
{
file_stream<test_t> in;
in.open(input_file.path());
in.write(1);
in.write(2);
in.write(3);
}
{
file_stream<test_t> in;
in.open(input_file.path());
file_stream<test_t> out;
out.open(output_file.path());
pipeline p = (pull_input(in) | pull_output(out));
p.get_node_map()->dump(log_info());
p.plot(log_info());
p();
}
{
file_stream<test_t> out;
out.open(output_file.path());
if (1 != out.read()) return false;
if (2 != out.read()) return false;
if (3 != out.read()) return false;
}
return true;
}
bool file_stream_alt_push_test() {
tpie::temp_file input_file;
tpie::temp_file output_file;
{
file_stream<test_t> in;
in.open(input_file.path());
in.write(1);
in.write(2);
in.write(3);
}
{
file_stream<test_t> in;
in.open(input_file.path());
file_stream<test_t> out;
out.open(output_file.path());
pipeline p = (input(in) | output(out));
p.plot(log_info());
p();
}
{
file_stream<test_t> out;
out.open(output_file.path());
if (1 != out.read()) return false;
if (2 != out.read()) return false;
if (3 != out.read()) return false;
}
return true;
}
bool merge_test() {
tpie::temp_file input_file;
tpie::temp_file output_file;
{
file_stream<test_t> in;
in.open(input_file.path());
pipeline p = input_vector(inputvector) | output(in);
p.plot(log_info());
p();
}
expectvector.resize(2*inputvector.size());
for (int i = 0, j = 0, l = inputvector.size(); i < l; ++i) {
expectvector[j++] = inputvector[i];
expectvector[j++] = inputvector[i];
}
{
file_stream<test_t> in;
in.open(input_file.path());
file_stream<test_t> out;
out.open(output_file.path());
std::vector<test_t> inputvector2 = inputvector;
pipeline p = input_vector(inputvector) | merge(pull_input(in)) | output(out);
p.plot(log_info());
p();
}
{
file_stream<test_t> in;
in.open(output_file.path());
pipeline p = input(in) | output_vector(outputvector);
p.plot(log_info());
p();
}
return check_test_vectors();
}
bool reverse_test() {
pipeline p1 = input_vector(inputvector) | reverser() | output_vector(outputvector);
p1.plot_full(log_info());
p1();
expectvector = inputvector;
std::reverse(expectvector.begin(), expectvector.end());
//reverser<test_t> r(inputvector.size());
//pipeline p1 = input_vector(inputvector) | r.sink();
//pipeline p2 = r.source() | output_vector(outputvector);
//p1.plot(log_info());
//p1();
return check_test_vectors();
}
bool internal_reverse_test() {
pipeline p1 = input_vector(inputvector) | reverser() | output_vector(outputvector);
p1();
expectvector = inputvector;
std::reverse(expectvector.begin(), expectvector.end());
return check_test_vectors();
}
///////////////////////////////////////////////////////////////////////////////
/// \brief Sums the two components of the input pair
///////////////////////////////////////////////////////////////////////////////
template <typename factory_type>
class add_pairs_type {
public:
template <typename dest_t>
class type : public tpie::pipelining::node {
public:
dest_t dest;
typename factory_type::constructed_type pullSource;
typedef uint64_t item_type;
type(dest_t dest, factory_type && factory)
: dest(std::move(dest))
, pullSource(factory.construct())
{
add_push_destination(dest);
add_pull_source(pullSource);
}
void push(const item_type &item) {
dest.push(item + pullSource.pull());
}
};
};
template <typename pipe_type>
tpie::pipelining::pipe_middle<tpie::pipelining::tempfactory<add_pairs_type<typename pipe_type::factory_type>, typename pipe_type::factory_type &&> >
add_pairs(pipe_type && pipe) {
return tpie::pipelining::tempfactory<add_pairs_type<typename pipe_type::factory_type>, typename pipe_type::factory_type &&>(std::move(pipe.factory));
}
///////////////////////////////////////////////////////////////////////////////
/// \brief templated test for the passive reversers
///////////////////////////////////////////////////////////////////////////////
template<typename T>
bool templated_passive_reverse_test(size_t n) {
std::vector<test_t> input;
std::vector<test_t> output;
for(size_t i = 0; i < n; ++i)
input.push_back(i);
T p_reverser;
pipeline p = input_vector(input)
| fork(p_reverser.input())
| buffer()
| add_pairs(p_reverser.output())
| output_vector(output);
p();
TEST_ENSURE_EQUALITY(output.size(), n, "The passive reverser didn't output the correct number of elements");
for(std::vector<test_t>::iterator i = output.begin(); i != output.end(); ++i)
TEST_ENSURE_EQUALITY(*i, n-1, "The passive reverser did not output in the correct order");
return true;
}
bool internal_passive_reverse_test(size_t n) {
return templated_passive_reverse_test<passive_reverser<test_t> >(n);
}
bool passive_reverse_test(size_t n) {
return templated_passive_reverse_test<internal_passive_reverser<test_t> >(n);
}
template <typename dest_t>
struct sequence_generator_type : public node {
typedef size_t item_type;
sequence_generator_type(dest_t dest, size_t elements, bool reverse)
: dest(std::move(dest))
, elements(elements)
, reverse(reverse)
{
add_push_destination(dest);
}
virtual void propagate() override {
forward("items", static_cast<stream_size_type>(elements));
set_steps(elements);
}
virtual void go() override {
if (reverse) {
for (size_t i = elements; i > 0; --i) {
dest.push(i);
step();
}
} else {
for (size_t i = 1; i <= elements; ++i) {
dest.push(i);
step();
}
}
}
private:
dest_t dest;
size_t elements;
bool reverse;
};
typedef pipe_begin<factory<sequence_generator_type, size_t, bool> >
sequence_generator;
struct sequence_verifier_type : public node {
typedef size_t item_type;
sequence_verifier_type(size_t elements, bool * result)
: elements(elements)
, expect(1)
, result(result)
, bad(false)
{
*result = false;
}
virtual void propagate() override {
if (!can_fetch("items")) {
log_error() << "Sorter did not forward number of items" << std::endl;
bad = true;
}
*result = false;
}
inline void push(size_t element) {
if (element != expect) {
(bad ? log_debug() : log_error()) << "Got " << element << ", expected " << expect << std::endl;
bad = true;
}
*result = false;
++expect;
}
virtual void end() override {
if (can_fetch("items")
&& static_cast<stream_size_type>(elements) != fetch<stream_size_type>("items")) {
log_error() << "Sorter did not send as many items as promised" << std::endl;
bad = true;
}
*result = !bad;
}
private:
size_t elements;
size_t expect;
bool * result;
bool bad;
};
typedef pipe_end<termfactory<sequence_verifier_type, size_t, bool *> >
sequence_verifier;
bool sort_test(size_t elements) {
bool result = false;
pipeline p = sequence_generator(elements, true)
| sort().name("Test")
| sequence_verifier(elements, &result);
p.plot(log_info());
p();
return result;
}
bool sort_test_trivial() {
TEST_ENSURE(sort_test(0), "Cannot sort 0 elements");
TEST_ENSURE(sort_test(1), "Cannot sort 1 element");
TEST_ENSURE(sort_test(2), "Cannot sort 2 elements");
return true;
}
bool sort_test_small() {
return sort_test(20);
}
bool sort_test_large() {
return sort_test(300*1024);
}
// This tests that pipe_middle | pipe_middle -> pipe_middle,
// and that pipe_middle | pipe_end -> pipe_end.
// The other tests already test that pipe_begin | pipe_middle -> pipe_middle,
// and that pipe_begin | pipe_end -> pipeline.
bool operator_test() {
expectvector = inputvector;
std::reverse(inputvector.begin(), inputvector.end());
pipeline p = input_vector(inputvector) | ((sort() | sort()) | output_vector(outputvector));
p.plot(log_info());
p();
return check_test_vectors();
}
bool uniq_test() {
const size_t n = 5;
inputvector.resize(n*(n+1)/2);
expectvector.resize(n);
size_t k = 0;
for (size_t i = 0; i < n; ++i) {
for (size_t j = 0; j <= i; ++j) {
inputvector[k++] = i;
}
expectvector[i] = i;
}
pipeline p = input_vector(inputvector) | pipeuniq() | output_vector(outputvector);
p.plot(log_info());
p();
return check_test_vectors();
}
struct memtest {
size_t totalMemory;
size_t minMem1;
size_t maxMem1;
size_t minMem2;
size_t maxMem2;
double frac1;
double frac2;
size_t assigned1;
size_t assigned2;
};
template <typename dest_t>
class memtest_1 : public node {
dest_t dest;
memtest & settings;
public:
memtest_1(dest_t dest, memtest & settings)
: dest(std::move(dest))
, settings(settings)
{
add_push_destination(dest);
}
void prepare() override {
set_minimum_memory(settings.minMem1);
if (settings.maxMem1 > 0)
set_maximum_memory(settings.maxMem1);
set_memory_fraction(settings.frac1);
}
virtual void set_available_memory(memory_size_type m) override {
node::set_available_memory(m);
settings.assigned1 = m;
}
virtual void go() override {
}
};
class memtest_2 : public node {
memtest & settings;
public:
memtest_2(memtest & settings)
: settings(settings)
{
}
void prepare() override {
set_minimum_memory(settings.minMem2);
if (settings.maxMem2 > 0)
set_maximum_memory(settings.maxMem2);
set_memory_fraction(settings.frac2);
}
virtual void set_available_memory(memory_size_type m) override {
node::set_available_memory(m);
settings.assigned2 = m;
}
};
bool memory_test(memtest settings) {
if (settings.minMem1 + settings.minMem2 > settings.totalMemory) {
throw tpie::exception("Memory requirements too high");
}
const memory_size_type NO_MEM = std::numeric_limits<memory_size_type>::max();
settings.assigned1 = settings.assigned2 = NO_MEM;
progress_indicator_null pi;
pipeline p =
make_pipe_begin<memtest_1, memtest &>(settings)
| make_pipe_end<memtest_2, memtest &>(settings);
p(0, pi, settings.totalMemory, TPIE_FSI);
log_debug() << "totalMemory " << settings.totalMemory << '\n'
<< "minMem1 " << settings.minMem1 << '\n'
<< "maxMem1 " << settings.maxMem1 << '\n'
<< "minMem2 " << settings.minMem2 << '\n'
<< "maxMem2 " << settings.maxMem2 << '\n'
<< "frac1 " << settings.frac1 << '\n'
<< "frac2 " << settings.frac2 << '\n'
<< "assigned1 " << settings.assigned1 << '\n'
<< "assigned2 " << settings.assigned2 << std::endl;
if (settings.assigned1 == NO_MEM || settings.assigned2 == NO_MEM) {
log_error() << "No memory assigned" << std::endl;
return false;
}
if (settings.assigned1 + settings.assigned2 > settings.totalMemory) {
log_error() << "Too much memory assigned" << std::endl;
return false;
}
if (settings.assigned1 < settings.minMem1 || settings.assigned2 < settings.minMem2) {
log_error() << "Too little memory assigned" << std::endl;
return false;
}
if ((settings.maxMem1 != 0 && settings.assigned1 > settings.maxMem1)
|| (settings.maxMem2 != 0 && settings.assigned2 > settings.maxMem2)) {
log_error() << "Too much memory assigned" << std::endl;
return false;
}
const double EPS = 1e-9;
const size_t min1 = settings.minMem1;
const size_t max1 = (settings.maxMem1 == 0) ? settings.totalMemory : settings.maxMem1;
const size_t min2 = settings.minMem2;
const size_t max2 = (settings.maxMem2 == 0) ? settings.totalMemory : settings.maxMem2;
const size_t m1 = settings.assigned1;
const size_t m2 = settings.assigned2;
const double f1 = settings.frac1;
const double f2 = settings.frac2;
if ((min1 < m1 && m1 < max1) && (min2 < m2 && m2 < max2)
&& std::abs(m1 * f2 - m2 * f1) > EPS)
{
log_error() << "Fractions not honored" << std::endl;
return false;
}
return true;
}
void memory_test_shorthand(teststream & ts, size_t totalMemory, size_t minMem1, size_t maxMem1, size_t minMem2, size_t maxMem2, double frac1, double frac2) {
ts << "(" << totalMemory << ", " << minMem1 << ", " << maxMem1 << ", " << minMem2 << ", " << maxMem2 << ", " << frac1 << ", " << frac2 << ")";
memtest settings;
settings.totalMemory = totalMemory;
settings.minMem1 = minMem1;
settings.maxMem1 = maxMem1;
settings.minMem2 = minMem2;
settings.maxMem2 = maxMem2;
settings.frac1 = frac1;
settings.frac2 = frac2;
ts << result(memory_test(settings));
}
void memory_test_multi(teststream & ts) {
// total min1 max1 min2 max2 frac1 frac2
memory_test_shorthand(ts, 2000, 0, 0, 0, 0, 1.0, 1.0);
memory_test_shorthand(ts, 2000, 800, 0, 800, 0, 1.0, 1.0);
memory_test_shorthand(ts, 4000, 1000, 0, 1000, 0, 0.0, 0.0);
memory_test_shorthand(ts, 2000, 0, 0, 0, 0, 0.0, 1.0);
memory_test_shorthand(ts, 2000, 500, 0, 0, 0, 0.0, 1.0);
memory_test_shorthand(ts, 2000, 500, 700, 0, 0, 1.0, 1.0);
memory_test_shorthand(ts, 2000, 0, 700, 0, 500, 1.0, 1.0);
memory_test_shorthand(ts, 2000, 0, 2000, 0, 2000, 1.0, 1.0);
memory_test_shorthand(ts, 2000, 200, 2000, 0, 2000, 1.0, 1.0);
}
bool fork_test() {
expectvector = inputvector;
pipeline p = input_vector(inputvector).name("Input vector") | fork(output_vector(outputvector)) | null_sink<test_t>();
p();
return check_test_vectors();
}
template <typename dest_t>
struct buffer_node_t : public node {
typedef typename dest_t::item_type item_type;
inline buffer_node_t(dest_t dest)
: dest(std::move(dest))
{
add_dependency(dest);
}
inline void push(const item_type & item) {
dest.push(item);
}
dest_t dest;
};
typedef pipe_middle<factory<buffer_node_t> > buffer_node;
struct merger_memory : public memory_test {
typedef int test_t;
typedef plain_store::specific<test_t> specific_store_t;
size_t n;
array<file_stream<test_t> > inputs;
merger<specific_store_t, std::less<test_t> > m;
inline merger_memory(size_t n)
: n(n)
, m(std::less<test_t>(), specific_store_t())
{
inputs.resize(n);
for (size_t i = 0; i < n; ++i) {
inputs[i].open();
inputs[i].write(static_cast<test_t>(n-i));
inputs[i].seek(0);
}
}
virtual void alloc() {
m.reset(inputs, 1);
}
virtual void free() {
m.reset();
}
virtual void use() {
test_t prev = m.pull();
for (size_t i = 1; i < n; ++i) {
test_t it = m.pull();
if (prev > it) {
log_error() << "Merger returns items out of order in memory test" << std::endl;
}
prev = it;
}
}
virtual size_type claimed_size() {
return static_cast<size_type>(merger<specific_store_t, std::less<test_t> >::memory_usage(n));
}
};
bool merger_memory_test(size_t n) {
merger_memory m(n);
return m();
}
struct my_item {
my_item() : v1(42), v2(9001) {}
short v1;
int v2;
};
template <typename dest_t>
struct FF1 : public node {
dest_t dest;
FF1(dest_t dest) : dest(std::move(dest)) {
add_push_destination(dest);
}
virtual void propagate() override {
my_item i;
i.v1 = 1;
forward("my_item", i);
}
virtual void go() override {
}
};
template <typename dest_t>
struct FF2 : public node {
dest_t dest;
FF2(dest_t dest) : dest(std::move(dest)) {
add_push_destination(dest);
}
void push(int ) {}
};
bool fetch_forward_result;
struct FF3 : public node {
FF3() {
}
virtual void propagate() override {
if (!can_fetch("my_item")) {
log_error() << "Cannot fetch my_item" << std::endl;
fetch_forward_result = false;
return;
}
my_item i = fetch<my_item>("my_item");
if (i.v1 != 1) {
log_error() << "Wrong answer" << std::endl;
fetch_forward_result = false;
return;
}
}
};
bool fetch_forward_test() {
fetch_forward_result = true;
std::vector<std::pair<std::string, any_noncopyable>> list;
list.emplace_back("test3", any_noncopyable(44));
list.emplace_back("test4", any_noncopyable(45));
pipeline p = make_pipe_begin<FF1>()
| forwarder("test2", 43)
| forwarder(std::move(list))
| make_pipe_middle<FF2>()
| make_pipe_end<FF3>()
;
p.plot(log_info());
p.forward<int>("test", 42);
p();
if (!fetch_forward_result) return false;
if (p.fetch<int>("test") != 42) {
log_error() << "Something went wrong" << std::endl;
return false;
}
if (p.fetch<int>("test2") != 43) {
log_error() << "Something went wrong" << std::endl;
return false;
}
if (p.fetch<int>("test3") != 44) {
log_error() << "Something went wrong" << std::endl;
return false;
}
if (p.fetch<int>("test4") != 45) {
log_error() << "Something went wrong" << std::endl;
return false;
}
return true;
}
template <typename dest_t>
struct FFB1 : public node {
dest_t dest;
FFB1(dest_t dest) : dest(std::move(dest)) {}
virtual void propagate() override {
forward("my_item", 42, 2);
}
virtual void go() override {
}
};
bool bound_fetch_forward_result;
template <typename dest_t>
struct FFB2 : public node {
dest_t dest;
FFB2(dest_t dest) : dest(std::move(dest)) {}
virtual void propagate() override {
if (!can_fetch("my_item")) {
log_error() << "Cannot fetch my_item" << std::endl;
bound_fetch_forward_result = false;
return;
}
int i = fetch<int>("my_item");
if (i != 42) {
log_error() << "Wrong answer" << std::endl;
bound_fetch_forward_result = false;
return;
}
}
};
struct FFB3 : public node {
virtual void propagate() override {
if (can_fetch("my_item")) {
log_error() << "Should not be able to fetch my_item" << std::endl;
bound_fetch_forward_result = false;
return;
}
}
};
bool bound_fetch_forward_test() {
bound_fetch_forward_result = true;
pipeline p = make_pipe_begin<FFB1>()
| make_pipe_middle<FFB2>()
| make_pipe_middle<FFB2>()
| make_pipe_end<FFB3>()
;
p.plot(log_info());
p.forward<int>("test", 7);
p();
if (!bound_fetch_forward_result) return false;
if (p.fetch<int>("test") != 7) {
log_error() << "Something went wrong" << std::endl;
return false;
}
return true;
}
bool forward_unique_ptr_result = true;
template <typename dest_t>
struct FUP1 : public node {
dest_t dest;
FUP1(dest_t dest) : dest(std::move(dest)) {}
virtual void propagate() override {
forward("item", std::unique_ptr<int>(new int(293)));
}
virtual void go() override {
}
};
struct FUP2 : public node {
virtual void propagate() override {
if (!can_fetch("item")) {
log_error() << "Cannot fetch item" << std::endl;
forward_unique_ptr_result = false;
return;
}
auto &p = fetch<std::unique_ptr<int>>("item");
if (*p != 293) {
log_error() << "Expected 293, not " << *p << std::endl;
forward_unique_ptr_result = false;
return;
}
}
};
bool forward_unique_ptr_test() {
std::unique_ptr<int> ptr(new int(1337));
pipeline p = make_pipe_begin<FUP1>()
| make_pipe_end<FUP2>();
p.plot(log_info());
p.forward("ptr", std::move(ptr));
p();
if (!forward_unique_ptr_result) return false;
if (!p.can_fetch("ptr")) {
log_error() << "Cannot fetch ptr" << std::endl;
return false;
}
auto &ptr2 = p.fetch<std::unique_ptr<int>>("ptr");
if (*ptr2 != 1337) {
log_error() << "Expected 1337, not " << *ptr2 << std::endl;
return false;
}
return true;
}
bool forward_multiple_pipelines_test() {
passive_sorter<int> ps;
pipeline p = input_vector(std::vector<int>{3, 2, 1}) | ps.input();
p.forward("test", 8);
pipeline p_ = input_vector(std::vector<int>{5, 6, 7}) | add_pairs(ps.output()) | null_sink<int>();
p();
int val = p_.fetch<int>("test");
return val == 8;
}
bool pipe_base_forward_result = true;
struct PBF_base : public node {
int n;
PBF_base(int n) : n(n) {}
virtual void prepare() override {
for (int i = 1; i <= 3; i++) {
std::string item = "item" + std::to_string(i);
bool fetchable = can_fetch(item);
if (n < i) {
if (fetchable) {
log_error() << "Pipe segment " << n
<< " could fetch item " << i << "." << std::endl;
pipe_base_forward_result = false;
}
} else {
if (!fetchable) {
log_error() << "Pipe segment " << n
<< " couldn't fetch item " << i << "." << std::endl;
pipe_base_forward_result = false;
}
int value = fetch<int>(item);
if (value != i) {
log_error() << "Pipe segment " << n
<< " fetched item " << i
<< " with value " << value << "." << std::endl;
pipe_base_forward_result = false;
}
}
}
}
};
template <typename dest_t>
struct PBF : public PBF_base {
dest_t dest;
PBF(dest_t dest, int n) : PBF_base(n), dest(std::move(dest)) {}
virtual void go() override {
}
};
bool pipe_base_forward_test() {
pipeline p = make_pipe_begin<PBF>(1).forward("item1", 1)
| make_pipe_middle<PBF>(2).forward("item2", 2)
| make_pipe_end<PBF_base>(3).forward("item3", 3);
p();
return pipe_base_forward_result;
}
// Assume that dest_t::item_type is a reference type.
// Push a dereferenced zero pointer to the destination.
template <typename dest_t>
class push_zero_t : public node {
dest_t dest;
public:
typedef typename dest_t::item_type item_type;
private:
// Type of pointer to dereference.
typedef typename std::remove_reference<item_type>::type * ptr_type;
public:
push_zero_t(dest_t dest)
: dest(std::move(dest))
{
add_push_destination(dest);
}
virtual void go() /*override*/ {
dest.push(*static_cast<ptr_type>(0));
}
};
typedef pipe_begin<factory<push_zero_t> > push_zero;
bool virtual_test() {
pipeline p = virtual_chunk_begin<test_t>(input_vector(inputvector))
| virtual_chunk<test_t, test_t>(multiply(3) | multiply(2))
| virtual_chunk<test_t, test_t>()
| virtual_chunk_end<test_t>(output_vector(outputvector));
p.plot(log_info());
p();
return check_test_vectors();
}
bool virtual_fork_test() {
pipeline p = virtual_chunk_begin<test_t>(input_vector(inputvector))
| vfork(virtual_chunk_end<test_t>(output_vector(outputvector)))
| virtual_chunk_end<test_t>(output_vector(outputvector));
p.plot_full(log_info());
p();
expectvector.resize(inputvector.size() * 2);
for (size_t i = 0; i < inputvector.size(); ++i) {
expectvector[2*i] = expectvector[2*i+1] = inputvector[i];
}
return check_test_vectors();
}
struct prepare_result {
prepare_result()
: t(0)
{
}
memory_size_type memWanted1;
memory_size_type memWanted2;
memory_size_type memWanted3;
memory_size_type memGotten1;
memory_size_type memGotten2;
memory_size_type memGotten3;
size_t t;
size_t prep1;
size_t prep2;
size_t prep3;
size_t propagate1;
size_t propagate2;
size_t propagate3;
size_t begin1;
size_t begin2;
size_t begin3;
size_t end1;
size_t end2;
size_t end3;
};
std::ostream & operator<<(std::ostream & os, const prepare_result & r) {
return os
<< "memWanted1: " << r.memWanted1 << '\n'
<< "memWanted2: " << r.memWanted2 << '\n'
<< "memWanted3: " << r.memWanted3 << "\n\n"
<< "memGotten1: " << r.memGotten1 << '\n'
<< "memGotten2: " << r.memGotten2 << '\n'
<< "memGotten3: " << r.memGotten3 << "\n\n"
<< "t: " << r.t << '\n'
<< "prep1: " << r.prep1 << '\n'
<< "prep2: " << r.prep2 << '\n'
<< "prep3: " << r.prep3 << '\n'
<< "begin1: " << r.begin1 << '\n'
<< "begin2: " << r.begin2 << '\n'
<< "begin3: " << r.begin3 << '\n'
<< "end1: " << r.end1 << '\n'
<< "end2: " << r.end2 << '\n'
<< "end3: " << r.end3 << '\n'
;
}
template <typename dest_t>
class prepare_begin_type : public node {
dest_t dest;
prepare_result & r;
public:
typedef void * item_type;
prepare_begin_type(dest_t dest, prepare_result & r)
: dest(std::move(dest))
, r(r)
{
add_push_destination(dest);
}
virtual void prepare() override {
log_debug() << "Prepare 1" << std::endl;
r.prep1 = r.t++;
set_minimum_memory(r.memWanted1);
forward("t", r.t);
}
virtual void propagate() override {
log_debug() << "Propagate 1" << std::endl;
r.propagate1 = r.t++;
r.memGotten1 = get_available_memory();
forward("t", r.t);
}
virtual void begin() override {
log_debug() << "Begin 1" << std::endl;
r.begin1 = r.t++;
}
virtual void go() override {
// We don't test go()/push() in this unit test.
}
virtual void set_available_memory(memory_size_type mem) override {
node::set_available_memory(mem);
log_debug() << "Begin memory " << mem << std::endl;
}
virtual void end() override {
r.end1 = r.t++;
}
};
typedef pipe_begin<factory<prepare_begin_type, prepare_result &> > prepare_begin;
template <typename dest_t>
class prepare_middle_type : public node {
dest_t dest;
prepare_result & r;
public:
typedef void * item_type;
prepare_middle_type(dest_t dest, prepare_result & r)
: dest(std::move(dest))
, r(r)
{
add_push_destination(dest);
}
virtual void prepare() override {
log_debug() << "Prepare 2" << std::endl;
if (!can_fetch("t")) {
log_error() << "Couldn't fetch time variable in middle::prepare" << std::endl;
} else if (fetch<size_t>("t") != r.t) {
log_error() << "Time is wrong" << std::endl;
}
r.prep2 = r.t++;
set_minimum_memory(r.memWanted2);
forward("t", r.t);
}
virtual void propagate() override {
log_debug() << "Propagate 2" << std::endl;
if (!can_fetch("t")) {
log_error() << "Couldn't fetch time variable in middle::propagate" << std::endl;
} else if (fetch<size_t>("t") != r.t) {
log_error() << "Time is wrong" << std::endl;
}
r.propagate2 = r.t++;
r.memGotten2 = get_available_memory();
forward("t", r.t);
}
virtual void begin() override {
log_debug() << "Begin 2" << std::endl;
r.begin2 = r.t++;
}
virtual void end() override {
r.end2 = r.t++;
}
};
typedef pipe_middle<factory<prepare_middle_type, prepare_result &> > prepare_middle;
class prepare_end_type : public node {
prepare_result & r;
public:
typedef void * item_type;
prepare_end_type(prepare_result & r)
: r(r)
{
}
virtual void prepare() override {
log_debug() << "Prepare 3" << std::endl;
if (!can_fetch("t")) {
log_error() << "Couldn't fetch time variable in end::prepare" << std::endl;
} else if (fetch<size_t>("t") != r.t) {
log_error() << "Time is wrong" << std::endl;
}
r.prep3 = r.t++;
set_minimum_memory(r.memWanted3);
}
virtual void propagate() override {
log_debug() << "Propagate 3" << std::endl;
if (!can_fetch("t")) {
log_error() << "Couldn't fetch time variable in end::propagate" << std::endl;
} else if (fetch<size_t>("t") != r.t) {
log_error() << "Time is wrong" << std::endl;
}
r.propagate3 = r.t++;
r.memGotten3 = get_available_memory();
}
virtual void begin() override {
log_debug() << "Begin 3" << std::endl;
r.begin3 = r.t++;
}
virtual void end() override {
r.end3 = r.t++;
}
};
typedef pipe_end<termfactory<prepare_end_type, prepare_result &> > prepare_end;
bool prepare_test() {
prepare_result r;
r.memWanted1 = 23;
r.memWanted2 = 45;
r.memWanted3 = 67;
pipeline p = prepare_begin(r)
| prepare_middle(r)
| prepare_end(r);
p();
log_debug() << r << std::endl;
TEST_ENSURE(r.prep1 == 0, "Prep 1 time is wrong");
TEST_ENSURE(r.prep2 == 1, "Prep 2 time is wrong");
TEST_ENSURE(r.prep3 == 2, "Prep 3 time is wrong");
TEST_ENSURE(r.propagate1 == 3, "Propagate 1 time is wrong");
TEST_ENSURE(r.propagate2 == 4, "Propagate 2 time is wrong");
TEST_ENSURE(r.propagate3 == 5, "Propagate 3 time is wrong");
TEST_ENSURE(r.begin3 == 6, "Begin 3 time is wrong");
TEST_ENSURE(r.begin2 == 7, "Begin 2 time is wrong");
TEST_ENSURE(r.begin1 == 8, "Begin 1 time is wrong");
TEST_ENSURE(r.end1 == 9, "End 1 time is wrong");
TEST_ENSURE(r.end2 == 10, "End 2 time is wrong");
TEST_ENSURE(r.end3 == 11, "End 3 time is wrong");
TEST_ENSURE(r.t == 12, "Time is wrong after execution");
TEST_ENSURE(r.memGotten1 == r.memWanted1, "Memory assigned to 1 is wrong");
TEST_ENSURE(r.memGotten2 == r.memWanted2, "Memory assigned to 2 is wrong");
TEST_ENSURE(r.memGotten3 == r.memWanted3, "Memory assigned to 3 is wrong");
return true;
}
namespace end_time {
struct result {
size_t t;
size_t end1;
size_t end2;
friend std::ostream & operator<<(std::ostream & os, result & r) {
return os
<< "end1 = " << r.end1 << '\n'
<< "end2 = " << r.end2 << '\n'
<< "t = " << r.t << '\n'
<< std::endl;
}
};
class begin_type : public node {
result & r;
public:
begin_type(result & r) : r(r) {
}
virtual void end() override {
r.end1 = r.t++;
}
};
typedef pullpipe_begin<termfactory<begin_type, result &> > begin;
template <typename dest_t>
class end_type : public node {
result & r;
dest_t dest;
public:
end_type(dest_t dest, result & r) : r(r), dest(std::move(dest)) {
add_pull_source(dest);
}
virtual void go() override {
}
virtual void end() override {
r.end2 = r.t++;
}
};
typedef pullpipe_end<factory<end_type, result &> > end;
bool test() {
result r;
r.t = 0;
pipeline p = begin(r) | end(r);
p.plot(log_info());
p();
log_debug() << r;
TEST_ENSURE(r.end2 == 0, "End 2 time wrong");
TEST_ENSURE(r.end1 == 1, "End 1 time wrong");
TEST_ENSURE(r.t == 2, "Time wrong");
return true;
}
} // namespace end_time
bool pull_iterator_test() {
outputvector.resize(inputvector.size());
expectvector = inputvector;
pipeline p =
pull_input_iterator(inputvector.begin(), inputvector.end())
| pull_output_iterator(outputvector.begin());
p.plot(log_info());
p();
return check_test_vectors();
}
bool push_iterator_test() {
outputvector.resize(inputvector.size());
expectvector = inputvector;
pipeline p =
push_input_iterator(inputvector.begin(), inputvector.end())
| push_output_iterator(outputvector.begin());
p.plot(log_info());
p();
return check_test_vectors();
}
template <typename dest_t>
class multiplicative_inverter_type : public node {
dest_t dest;
const size_t p;
public:
typedef size_t item_type;
multiplicative_inverter_type(dest_t dest, size_t p)
: dest(std::move(dest))
, p(p)
{
add_push_destination(dest);
set_steps(p);
}
void push(size_t n) {
size_t i;
for (i = 0; (i*n) % p != 1; ++i);
dest.push(i);
step();
}
};
typedef pipe_middle<factory<multiplicative_inverter_type, size_t> > multiplicative_inverter;
bool parallel_test(size_t modulo) {
bool result = false;
pipeline p = sequence_generator(modulo-1, true)
| parallel(multiplicative_inverter(modulo))
| sort()
| sequence_verifier(modulo-1, &result);
p.plot(log_info());
tpie::progress_indicator_arrow pi("Parallel", 1);
p(modulo-1, pi, TPIE_FSI);
return result;
}
bool parallel_ordered_test(size_t modulo) {
bool result = false;
pipeline p = sequence_generator(modulo-1, false)
| parallel(multiplicative_inverter(modulo) | multiplicative_inverter(modulo), maintain_order)
| sequence_verifier(modulo-1, &result);
p.plot(log_info());
tpie::progress_indicator_arrow pi("Parallel", 1);
p(modulo-1, pi, TPIE_FSI);
return result;
}
template <typename dest_t>
class Monotonic : public node {
dest_t dest;
test_t sum;
test_t chunkSize;
public:
typedef test_t item_type;
Monotonic(dest_t dest, test_t sum, test_t chunkSize)
: dest(std::move(dest))
, sum(sum)
, chunkSize(chunkSize)
{
add_push_destination(dest);
}
virtual void go() override {
while (sum > chunkSize) {
dest.push(chunkSize);
sum -= chunkSize;
}
if (sum > 0) {
dest.push(sum);
sum = 0;
}
}
};
typedef pipe_begin<factory<Monotonic, test_t, test_t> > monotonic;
template <typename dest_t>
class Splitter : public node {
dest_t dest;
public:
typedef test_t item_type;
Splitter(dest_t dest)
: dest(std::move(dest))
{
add_push_destination(dest);
}
void push(test_t item) {
while (item > 0) {
dest.push(1);
--item;
}
}
};
typedef pipe_middle<factory<Splitter> > splitter;
class Summer : public node {
test_t & result;
public:
typedef test_t item_type;
Summer(test_t & result)
: result(result)
{
}
void push(test_t item) {
result += item;
}
};
typedef pipe_end<termfactory<Summer, test_t &> > summer;
bool parallel_multiple_test() {
test_t sumInput = 1000;
test_t sumOutput = 0;
pipeline p = monotonic(sumInput, 5) | parallel(splitter()) | summer(sumOutput);
p.plot();
p();
if (sumInput != sumOutput) {
log_error() << "Expected sum " << sumInput << ", got " << sumOutput << std::endl;
return false;
} else {
return true;
}
}
template <typename dest_t>
class buffering_accumulator_type : public node {
dest_t dest;
test_t inputs;
public:
static const test_t bufferSize = 8;
typedef test_t item_type;
buffering_accumulator_type(dest_t dest)
: dest(std::move(dest))
, inputs(0)
{
add_push_destination(dest);
}
void push(test_t item) {
inputs += item;
if (inputs >= bufferSize) flush_buffer();
}
virtual void end() override {
if (inputs > 0) flush_buffer();
}
private:
void flush_buffer() {
while (inputs > 0) {
dest.push(1);
--inputs;
}
}
};
typedef pipe_middle<factory<buffering_accumulator_type> > buffering_accumulator;
bool parallel_own_buffer_test() {
test_t sumInput = 64;
test_t sumOutput = 0;
pipeline p =
monotonic(sumInput, 1)
| parallel(buffering_accumulator(), arbitrary_order, 1, 2)
| summer(sumOutput);
p.plot();
p();
if (sumInput != sumOutput) {
log_error() << "Expected sum " << sumInput << ", got " << sumOutput << std::endl;
return false;
} else {
return true;
}
}
template <typename dest_t>
class noop_initiator_type : public node {
dest_t dest;
public:
noop_initiator_type(dest_t dest)
: dest(std::move(dest))
{
add_push_destination(dest);
}
virtual void go() override {
// noop
}
};
typedef pipe_begin<factory<noop_initiator_type> > noop_initiator;
template <typename dest_t>
class push_in_end_type : public node {
dest_t dest;
public:
typedef test_t item_type;
push_in_end_type(dest_t dest)
: dest(std::move(dest))
{
add_push_destination(dest);
}
void push(item_type) {
}
virtual void end() override {
for (test_t i = 0; i < 100; ++i) {
dest.push(1);
}
}
};
typedef pipe_middle<factory<push_in_end_type> > push_in_end;
bool parallel_push_in_end_test() {
test_t sumOutput = 0;
pipeline p =
noop_initiator()
| parallel(push_in_end(), arbitrary_order, 1, 10)
| summer(sumOutput);
p.plot(log_info());
p();
if (sumOutput != 100) {
log_error() << "Wrong result, expected 100, got " << sumOutput << std::endl;
return false;
}
return true;
}
template <typename dest_t>
class step_begin_type : public node {
dest_t dest;
static const size_t items = 256*1024*1024;
public:
typedef typename dest_t::item_type item_type;
step_begin_type(dest_t dest)
: dest(std::move(dest))
{
add_push_destination(dest);
}
virtual void propagate() override {
forward<stream_size_type>("items", items);
}
virtual void go() override {
for (size_t i = 0; i < items; ++i) {
dest.push(item_type());
}
}
};
typedef pipe_begin<factory<step_begin_type> > step_begin;
template <typename dest_t>
class step_middle_type : public node {
dest_t dest;
public:
typedef typename dest_t::item_type item_type;
step_middle_type(dest_t dest)
: dest(std::move(dest))
{
add_push_destination(dest);
}
virtual void propagate() override {
if (!can_fetch("items")) throw tpie::exception("Cannot fetch items");
set_steps(fetch<stream_size_type>("items"));
}
void push(item_type i) {
step();
dest.push(i);
}
};
typedef pipe_middle<factory<step_middle_type> > step_middle;
class step_end_type : public node {
public:
typedef size_t item_type;
void push(item_type) {
}
};
typedef pipe_end<termfactory<step_end_type> > step_end;
bool parallel_step_test() {
pipeline p = step_begin() | parallel(step_middle()) | step_end();
progress_indicator_arrow pi("Test", 0);
p(get_memory_manager().available(), pi, TPIE_FSI);
return true;
}
class virtual_cref_item_type_test_helper {
public:
template <typename In, typename Expect>
class t {
typedef typename tpie::pipelining::bits::maybe_add_const_ref<In>::type Out;
public:
typedef typename std::enable_if<std::is_same<Out, Expect>::value, int>::type u;
};
};
bool virtual_cref_item_type_test() {
typedef virtual_cref_item_type_test_helper t;
t::t<int, const int &>::u t1 = 1;
t::t<int *, int *>::u t2 = 2;
t::t<int &, int &>::u t3 = 3;
t::t<const int *, const int *>::u t4 = 4;
t::t<const int &, const int &>::u t5 = 5;
return t1 + t2 + t3 + t4 + t5 > 0;
}
struct no_move_tag {};
class node_map_tester : public node {
friend class node_map_tester_factory;
std::unique_ptr<node_map_tester> dest;
public:
node_map_tester() {
set_name("Node map tester leaf");
}
node_map_tester(node_map_tester copy, no_move_tag)
: dest(new node_map_tester(std::move(copy)))
{
set_name("Node map tester non-leaf");
}
void add(std::vector<node_map_tester *> & v) {
v.push_back(this);
if (dest.get()) dest->add(v);
}
virtual void go() override {
// Nothing to do.
}
};
class node_map_tester_factory : public factory_base {
size_t nodes;
std::string edges;
public:
typedef node_map_tester constructed_type;
node_map_tester_factory(size_t nodes, const std::string & edges)
: nodes(nodes)
, edges(edges)
{
if (edges.size() != nodes*nodes) throw std::invalid_argument("edges has wrong size");
}
node_map_tester construct() {
std::vector<node_map_tester *> nodes;
node_map_tester node;
this->init_node(node);
for (size_t i = 1; i < this->nodes; ++i) {
node_map_tester n2(std::move(node), no_move_tag());
node = std::move(n2);
this->init_node(node);
}
node.add(nodes);
for (size_t i = 0, idx = 0; i < this->nodes; ++i) {
for (size_t j = 0; j < this->nodes; ++j, ++idx) {
switch (edges[idx]) {
case '.':
break;
case '>':
log_debug() << i << " pushes to " << j << std::endl;
nodes[i]->add_push_destination(*nodes[j]);
break;
case '<':
log_debug() << i << " pulls from " << j << std::endl;
nodes[i]->add_pull_source(*nodes[j]);
break;
case '-':
nodes[i]->add_dependency(*nodes[j]);
break;
default:
throw std::invalid_argument("Bad char");
}
}
}
return node;
}
};
bool node_map_test(size_t nodes, bool acyclic, const std::string & edges) {
node_map_tester_factory fact(nodes, edges);
pipeline p =
tpie::pipelining::bits::pipeline_impl<node_map_tester_factory>(fact);
p.plot(log_info());
try {
p();
} catch (const exception &) {
return !acyclic;
}
return acyclic;
}
void node_map_multi_test(teststream & ts) {
ts << "push_basic" << result
(node_map_test
(4, true,
".>.."
"..>."
"...>"
"...."));
ts << "pull_basic" << result
(node_map_test
(4, true,
"...."
"<..."
".<.."
"..<."));
ts << "phase_basic" << result
(node_map_test
(3, true,
"..."
"-.."
".-."));
ts << "self_push" << result
(node_map_test
(1, false,
">"));
ts << "actor_cycle" << result
(node_map_test
(2, false,
".>"
"<."));
ts << "item_cycle" << result
(node_map_test
(3, false,
".><"
"..>"
"..."));
}
bool join_test() {
std::vector<int> i(10);
std::vector<int> o;
for (int j = 0; j < 10; ++j) {
i[j] = j;
}
join<int> j;
pipeline p1 = input_vector(i) | j.sink();
pipeline p2 = input_vector(i) | j.sink();
pipeline p3 = j.source() | output_vector(o);
p3.plot(log_info());
p3();
if (o.size() != 20) {
log_error() << "Wrong output size " << o.size() << " expected 20" << std::endl;
return false;
}
for (int i = 0; i < 20; ++i) {
if (o[i] == i % 10) continue;
log_error() << "Wrong output item got " << o[i] << " expected " << i%10 << std::endl;
return false;
}
return true;
}
bool split_test() {
std::vector<int> i(10);
std::vector<int> o1, o2;
for (int j = 0; j < 10; ++j) {
i[j] = j;
}
split<int> j;
pipeline p1 = input_vector(i) | j.sink();
pipeline p2 = j.source() | output_vector(o1);
pipeline p3 = j.source() | output_vector(o2);
p3.plot(log_info());
p3();
if (o1.size() != 10 || o2.size() != 10) {
log_error() << "Wrong output size " << o1.size() << " " << o2.size() << " expected 10" << std::endl;
return false;
}
for (int i = 0; i < 10; ++i) {
if (o1[i] == i % 10 && o2[i] == i % 10) continue;
log_error() << "Wrong output item got " << o1[i] << " " << o2[i] << " expected " << i%10 << std::endl;
return false;
}
return true;
}
bool copy_ctor_test() {
std::vector<int> i(10);
std::vector<int> j;
pipeline p1 = input_vector(i) | output_vector(j);
pipeline p2 = p1;
p2();
return true;
}
struct datastructuretest {
size_t totalMemory;
size_t minMem1;
size_t maxMem1;
size_t minMem2;
size_t maxMem2;
double frac1;
double frac2;
size_t assigned1;
size_t assigned2;
};
template <typename dest_t>
class datastructuretest_1 : public node {
dest_t dest;
datastructuretest & settings;
public:
datastructuretest_1(dest_t dest, datastructuretest & settings)
: dest(std::move(dest))
, settings(settings)
{
add_push_destination(dest);
}
void prepare() {
register_datastructure_usage("datastructure1", settings.frac1);
register_datastructure_usage("datastructure2", settings.frac2);
if (settings.maxMem1 > 0)
set_datastructure_memory_limits("datastructure1", settings.minMem1, settings.maxMem1);
else
set_datastructure_memory_limits("datastructure1", settings.minMem1);
if (settings.maxMem2 > 0)
set_datastructure_memory_limits("datastructure2", settings.minMem2, settings.maxMem2);
else
set_datastructure_memory_limits("datastructure2", settings.minMem2);
}
virtual void go() {
}
};
class datastructuretest_2 : public node {
datastructuretest & settings;
public:
datastructuretest_2(datastructuretest & settings)
: settings(settings)
{
}
void prepare() {
register_datastructure_usage("datastructure1", settings.frac1);
register_datastructure_usage("datastructure2", settings.frac2);
}
virtual void propagate() {
settings.assigned1 = get_datastructure_memory("datastructure1");
settings.assigned2 = get_datastructure_memory("datastructure2");
}
};
bool datastructure_test(datastructuretest settings) {
if (settings.minMem1 + settings.minMem2 > settings.totalMemory) {
throw tpie::exception("Memory requirements too high");
}
const memory_size_type NO_MEM = std::numeric_limits<memory_size_type>::max();
settings.assigned1 = settings.assigned2 = NO_MEM;
progress_indicator_null pi;
pipeline p =
make_pipe_begin<datastructuretest_1, datastructuretest &>(settings)
| make_pipe_end<datastructuretest_2, datastructuretest &>(settings);
p(0, pi, settings.totalMemory, TPIE_FSI);
log_debug() << "totalMemory " << settings.totalMemory << '\n'
<< "minMem1 " << settings.minMem1 << '\n'
<< "maxMem1 " << settings.maxMem1 << '\n'
<< "minMem2 " << settings.minMem2 << '\n'
<< "maxMem2 " << settings.maxMem2 << '\n'
<< "frac1 " << settings.frac1 << '\n'
<< "frac2 " << settings.frac2 << '\n'
<< "assigned1 " << settings.assigned1 << '\n'
<< "assigned2 " << settings.assigned2 << std::endl;
if (settings.assigned1 == NO_MEM || settings.assigned2 == NO_MEM) {
log_error() << "No memory assigned" << std::endl;
return false;
}
if (settings.assigned1 + settings.assigned2 > settings.totalMemory) {
log_error() << "Too much memory assigned" << std::endl;
return false;
}
if (settings.assigned1 < settings.minMem1 || settings.assigned2 < settings.minMem2) {
log_error() << "Too little memory assigned" << std::endl;
return false;
}
if ((settings.maxMem1 != 0 && settings.assigned1 > settings.maxMem1)
|| (settings.maxMem2 != 0 && settings.assigned2 > settings.maxMem2)) {
log_error() << "Too much memory assigned" << std::endl;
return false;
}
const double EPS = 1e-9;
const size_t min1 = settings.minMem1;
const size_t max1 = (settings.maxMem1 == 0) ? settings.totalMemory : settings.maxMem1;
const size_t min2 = settings.minMem2;
const size_t max2 = (settings.maxMem2 == 0) ? settings.totalMemory : settings.maxMem2;
const size_t m1 = settings.assigned1;
const size_t m2 = settings.assigned2;
const double f1 = settings.frac1;
const double f2 = settings.frac2;
if ((min1 < m1 && m1 < max1) && (min2 < m2 && m2 < max2)
&& std::abs(m1 * f2 - m2 * f1) > EPS)
{
log_error() << "Fractions not honored" << std::endl;
return false;
}
return true;
}
void datastructure_test_shorthand(teststream & ts, size_t totalMemory, size_t minMem1, size_t maxMem1, size_t minMem2, size_t maxMem2, double frac1, double frac2) {
ts << "(" << totalMemory << ", " << minMem1 << ", " << maxMem1 << ", " << minMem2 << ", " << maxMem2 << ", " << frac1 << ", " << frac2 << ")";
datastructuretest settings;
settings.totalMemory = totalMemory;
settings.minMem1 = minMem1;
settings.maxMem1 = maxMem1;
settings.minMem2 = minMem2;
settings.maxMem2 = maxMem2;
settings.frac1 = frac1;
settings.frac2 = frac2;
ts << result(datastructure_test(settings));
}
void datastructure_test_multi(teststream & ts) {
// total min1 max1 min2 max2 frac1 frac2
datastructure_test_shorthand(ts, 2000, 0, 0, 0, 0, 1.0, 1.0);
datastructure_test_shorthand(ts, 2000, 800, 0, 800, 0, 1.0, 1.0);
datastructure_test_shorthand(ts, 4000, 1000, 0, 1000, 0, 0.0, 0.0);
datastructure_test_shorthand(ts, 2000, 0, 0, 0, 0, 0.0, 1.0);
datastructure_test_shorthand(ts, 2000, 500, 0, 0, 0, 0.0, 1.0);
datastructure_test_shorthand(ts, 2000, 500, 700, 0, 0, 1.0, 1.0);
datastructure_test_shorthand(ts, 2000, 0, 700, 0, 500, 1.0, 1.0);
datastructure_test_shorthand(ts, 2000, 0, 2000, 0, 2000, 1.0, 1.0);
datastructure_test_shorthand(ts, 2000, 200, 2000, 0, 2000, 1.0, 1.0);
}
template <typename dest_t>
class subpipe_tester_type: public node {
public:
struct dest_pusher: public node {
dest_pusher(dest_t & dest, int first): first(first), dest(dest) {}
void push(int second) {
dest.push(std::make_pair(first, second));
}
int first;
dest_t & dest;
};
subpipeline<int> sp;
int first;
subpipe_tester_type(dest_t dest): dest(std::move(dest)) {
set_memory_fraction(2);
}
void prepare() override {
first = 1234;
}
void push(std::pair<int, int> i) {
if (i.first != first) {
if (first != 1234)
sp.end();
first = i.first;
sp = sort() | pipe_end<termfactory<dest_pusher, dest_t &, int>>(dest, first);
sp.begin(get_available_memory());
}
sp.push(i.second);
}
void end() override {
if (first != 1234)
sp.end();
}
dest_t dest;
};
typedef pipe_middle<factory<subpipe_tester_type> > subpipe_tester;
bool subpipeline_test() {
constexpr int outer_size = 10;
constexpr int inner_size = 3169; //Must be prime
std::vector<std::pair<int, int> > items;
for (int i=0; i < outer_size; ++i) {
for (int j=0; j < inner_size; ++j)
items.push_back(std::make_pair(i, (j*13) % inner_size));
}
std::vector<std::pair<int, int> > items2;
pipeline p = input_vector(items) | subpipe_tester() | output_vector(items2);
p();
if (items2.size() != items.size()) return false;
int cnt=0;
for (int i=0; i < outer_size; ++i)
for (int j=0; j < inner_size; ++j)
if (items2[cnt++] != std::make_pair(i, j)) return false;
return true;
}
bool file_limit_sort_test() {
int N = 1000000;
int B = 10000;
// Merge sort needs at least 3 open files for binary merge sort
// + 2 open files to store stream_position objects for sorted runs.
int F = 5;
get_memory_manager().set_limit(5000000);
set_block_size(B * sizeof(int));
get_file_manager().set_limit(F);
get_file_manager().set_enforcement(file_manager::ENFORCE_THROW);
std::vector<int> items;
for (int i = 0; i < N; i++) {
items.push_back(N - i);
}
std::vector<int> items2;
pipeline p = input_vector(items) | sort() | output_vector(items2);
p();
return true;
}
template<typename T>
virtual_chunk<int, int> passive_virtual_chunk() {
T passive;
return virtual_chunk<int, int>(fork(passive.input())
| buffer()
| merge(passive.output()));
}
template<typename T>
void passive_virtual_test(teststream & ts, const char * cname, const std::vector<int> & input, const std::vector<int> & expected_output) {
ts << cname;
auto vc = passive_virtual_chunk<T>();
std::vector<int> output;
pipeline p = virtual_chunk_begin<int>(input_vector(input))
| vc
| virtual_chunk_end<int>(output_vector<int>(output));
p();
// Output is interleaved with the input
auto expected = expected_output;
for (size_t i = 0; i < input.size(); i++) {
expected.insert(expected.begin() + i * 2, input[i]);
}
ts << result(output == expected);
}
void passive_virtual_test_multi(teststream & ts) {
std::vector<int> input = {3, 4, 1, 2};
std::vector<int> reversed = {2, 1, 4, 3};
std::vector<int> sorted = {1, 2, 3, 4};
#define TEST(T, expected) passive_virtual_test<T<int>>(ts, #T, input, expected)
TEST(passive_sorter, sorted);
TEST(passive_buffer, input);
TEST(passive_reverser, reversed);
TEST(serialization_passive_sorter, sorted);
TEST(passive_serialization_buffer, input);
TEST(passive_serialization_reverser, reversed);
#undef TEST
}
bool join_split_dealloc_test() {
std::vector<int> v{1, 2, 3};
pipeline p, p1, p2, p3;
{
join<int> j;
split<int> s;
p = input_vector(v) | s.sink();
p1 = s.source() | j.sink();
p2 = s.source() | j.sink();
p3 = j.source() | null_sink<int>();
}
p();
return true;
}
template <typename T>
virtual_chunk <T> virtual_internal_buffer() {
struct C : virtual_container {
std::vector<T> v;
};
C * c = new C();
node_set ns = make_node_set();
auto s = virtual_chunk_end<T>(output_vector(c->v).add_to_set(ns));
auto e = virtual_chunk_begin<T>(input_vector(c->v).add_forwarding_dependencies(ns), c);
return virtual_chunk<T>(s, e);
}
bool nodeset_dealloc_test() {
expectvector = inputvector;
auto vc = virtual_internal_buffer<test_t>();
pipeline p = virtual_chunk_begin<test_t>(input_vector(inputvector))
| vc
| virtual_chunk_end<test_t>(output_vector(outputvector));
p();
return check_test_vectors();
}
bool pipeline_dealloc_test() {
expectvector = inputvector;
split<int> s;
pipeline p = input_vector(inputvector) | s.sink();
{
pipeline p1 = s.source() | output_vector(outputvector);
}
p();
return check_test_vectors();
}
struct parallel_exception_test_exception {
};
struct exception_thrower_end : public node {
int where;
exception_thrower_end(int where) : where(where) {}
#define TPIE_TEST_THROW(func, i) \
void func() override { \
if (where == i) throw parallel_exception_test_exception(); \
}
TPIE_TEST_THROW(prepare, 0);
TPIE_TEST_THROW(propagate, 1);
TPIE_TEST_THROW(begin, 2);
TPIE_TEST_THROW(go, 3);
TPIE_TEST_THROW(end, 4);
#undef TPIE_TEST_THROW
void push(int) {};
};
template <typename dest_t>
struct exception_thrower : public exception_thrower_end {
dest_t dest;
exception_thrower(dest_t dest, int where) : exception_thrower_end(where), dest(std::move(dest)) {}
};
bool parallel_exception_test() {
bool fail = false;
for (int i = 0; i < 5; i++) {
{
pipeline p = make_pipe_begin<exception_thrower>(i)
| parallel(splitter())
| null_sink<int>();
try {
p();
log_error() << "Exception was not thrown (begin): " << i << std::endl;
fail = true;
} catch (parallel_exception_test_exception) {
}
}
if (i == 3) {
// go() is only called on initiator nodes
continue;
}
{
pipeline p = input_vector(inputvector)
| parallel(splitter())
| make_pipe_middle<exception_thrower>(i)
| parallel(splitter())
| null_sink<int>();
try {
p();
log_error() << "Exception was not thrown (middle): " << i << std::endl;
fail = true;
} catch (parallel_exception_test_exception) {
}
}
{
pipeline p = input_vector(inputvector)
| parallel(splitter())
| make_pipe_end<exception_thrower_end>(i);
try {
p();
log_error() << "Exception was not thrown (end): " << i << std::endl;
fail = true;
} catch (parallel_exception_test_exception) {
}
}
}
return !fail;
}
int main(int argc, char ** argv) {
return tpie::tests(argc, argv)
.setup(setup_test_vectors)
.test(vector_multiply_test, "vector")
.test(file_stream_test, "filestream", "n", static_cast<stream_size_type>(3))
.test(file_stream_pull_test, "fspull")
//.test(file_stream_alt_push_test, "fsaltpush")
.test(merge_test, "merge")
.test(reverse_test, "reverse")
.test(internal_reverse_test, "internal_reverse")
.test(passive_reverse_test, "passive_reverse", "n", static_cast<size_t>(50000))
.test(internal_passive_reverse_test, "internal_passive_reverse", "n", static_cast<size_t>(50000))
.test(sort_test_trivial, "sorttrivial")
.test(sort_test_small, "sort")
.test(sort_test_large, "sortbig")
.test(operator_test, "operators")
.test(uniq_test, "uniq")
.multi_test(memory_test_multi, "memory")
.test(fork_test, "fork")
.test(merger_memory_test, "merger_memory", "n", static_cast<size_t>(10))
.test(fetch_forward_test, "fetch_forward")
.test(bound_fetch_forward_test, "bound_fetch_forward")
.test(forward_unique_ptr_test, "forward_unique_ptr")
.test(forward_multiple_pipelines_test, "forward_multiple_pipelines")
.test(pipe_base_forward_test, "pipe_base_forward")
.test(virtual_test, "virtual")
.test(virtual_fork_test, "virtual_fork")
.test(virtual_cref_item_type_test, "virtual_cref_item_type")
.test(prepare_test, "prepare")
.test(end_time::test, "end_time")
.test(pull_iterator_test, "pull_iterator")
.test(push_iterator_test, "push_iterator")
.test(parallel_test, "parallel", "modulo", static_cast<size_t>(20011))
.test(parallel_ordered_test, "parallel_ordered", "modulo", static_cast<size_t>(20011))
.test(parallel_step_test, "parallel_step")
.test(parallel_multiple_test, "parallel_multiple")
.test(parallel_own_buffer_test, "parallel_own_buffer")
.test(parallel_push_in_end_test, "parallel_push_in_end")
.test(join_test, "join")
.test(split_test, "split")
.test(subpipeline_test, "subpipeline")
.multi_test(node_map_multi_test, "node_map")
.test(copy_ctor_test, "copy_ctor")
.multi_test(datastructure_test_multi, "datastructures")
.test(file_limit_sort_test, "file_limit_sort")
.multi_test(passive_virtual_test_multi, "passive_virtual_management")
.test(join_split_dealloc_test, "join_split_dealloc")
.test(nodeset_dealloc_test, "nodeset_dealloc")
.test(pipeline_dealloc_test, "pipeline_dealloc")
.test(parallel_exception_test, "parallel_exception")
;
}
| 25.045824 | 164 | 0.656236 | [
"vector"
] |
e497d1b775bafbe52f55561276ddac813a786b46 | 12,385 | hxx | C++ | private/inet/mshtml/src/site/include/intl.hxx | King0987654/windows2000 | 01f9c2e62c4289194e33244aade34b7d19e7c9b8 | [
"MIT"
] | 11 | 2017-09-02T11:27:08.000Z | 2022-01-02T15:25:24.000Z | private/inet/mshtml/src/site/include/intl.hxx | King0987654/windows2000 | 01f9c2e62c4289194e33244aade34b7d19e7c9b8 | [
"MIT"
] | null | null | null | private/inet/mshtml/src/site/include/intl.hxx | King0987654/windows2000 | 01f9c2e62c4289194e33244aade34b7d19e7c9b8 | [
"MIT"
] | 14 | 2019-01-16T01:01:23.000Z | 2022-02-20T15:54:27.000Z | //+---------------------------------------------------------------------------
//
// Microsoft Forms
// Copyright (C) Microsoft Corporation, 1994-1996
//
// File: intl.hxx
//
// Contents: Internationalization Support Functions
//
//----------------------------------------------------------------------------
#ifndef I_INTL_HXX_
#define I_INTL_HXX_
#pragma INCMSG("--- Beg 'intl.hxx'")
#ifndef X_CODEPAGE_H_
#define X_CODEPAGE_H_
#include "codepage.h"
#endif
#ifndef X_MLANG_H_
#define X_MLANG_H_
#pragma INCMSG("--- Beg <mlang.h>")
#include <mlang.h>
#pragma INCMSG("--- End <mlang.h>")
#endif
// define some other languages until ntdefs.h catches up
#ifndef LANG_KASHMIRI
#define LANG_KASHMIRI 0x60
#endif
#ifndef LANG_MANIPURI
#define LANG_MANIPURI 0x58
#endif
#ifndef LANG_NAPALI
#define LANG_NAPALI 0x61
#endif
#ifndef LANG_SINDHI
#define LANG_SINDHI 0x59
#endif
#ifndef LANG_YIDDISH
#define LANG_YIDDISH 0x3d
#endif
class CDoc;
HRESULT EnsureMultiLanguage(void);
HRESULT QuickMimeGetCodePageInfo(CODEPAGE cp, PMIMECPINFO pMimeCpInfo);
HRESULT QuickMimeGetCSetInfo(LPCTSTR lpszCharset, PMIMECSETINFO pMimeCharsetInfo);
HRESULT SlowMimeGetCodePageInfo(CODEPAGE cp, PMIMECPINFO pMimeCpInfo);
HMENU CreateMimeCSetMenu(CODEPAGE cp, BOOL fDocRTL);
HMENU CreateDocDirMenu(BOOL fDocRTL, HMENU hmenuTarget = NULL);
HMENU GetOrAppendDocDirMenu(CODEPAGE codepage, BOOL fDocRTL,
HMENU hmenuTarget = NULL);
HRESULT ShowMimeCSetMenu(OPTIONSETTINGS *pOS, int * pnIdm, CODEPAGE codepage, LPARAM lParam,
BOOL fDocRTL, BOOL fAutoMode);
HRESULT ShowFontSizeMenu(int * pnIdm, short sFontSize, LPARAM lParam);
HMENU GetEncodingMenu(OPTIONSETTINGS *pOS, CODEPAGE codepage, BOOL fDocRTL, BOOL fAutoMode);
HMENU GetFontSizeMenu(short sFontSize);
HRESULT GetCodePageFromMlangString(LPCTSTR mlangString, CODEPAGE* pCodePage);
HRESULT GetMlangStringFromCodePage(CODEPAGE codepage, LPTSTR pMlangString,
size_t cchMlangString);
CODEPAGE GetCodePageFromMenuID(int nIdm);
UINT DefaultCodePageFromCharSet( BYTE bCharSet, CODEPAGE cpDoc, LCID lcid );
HRESULT DefaultFontInfoFromCodePage( CODEPAGE cp, LOGFONT * lplf );
CODEPAGE CodePageFromString( TCHAR * pchArg, BOOL fLookForWordCharset );
LCID LCIDFromString( TCHAR * pchArg );
UINT WindowsCodePageFromCodePage( CODEPAGE cp );
HRESULT MlangEnumCodePages(DWORD grfFlags, IEnumCodePage **ppEnumCodePage);
HRESULT MlangValidateCodePage(CDoc *pDoc, CODEPAGE cp, HWND hwnd, BOOL fUserSelect);
HRESULT MlangGetDefaultFont( SCRIPT_ID sid, SCRIPTINFO * psi );
// inlines ------------------------------------------------------------------
inline CODEPAGE
CodePageFromAlias( LPCTSTR lpcszAlias )
{
CODEPAGE cp;
IGNORE_HR(GetCodePageFromMlangString(lpcszAlias, &cp));
return cp;
}
inline BOOL
IsAutodetectCodePage( CODEPAGE cp )
{
return cp == CP_AUTO_JP || cp == CP_AUTO;
}
inline BOOL
IsStraightToUnicodeCodePage( CODEPAGE cp )
{
// CP_UCS_2_BIGENDIAN is not correctly handled by MLANG, so we handle it.
return cp == CP_UCS_2 || cp == CP_UTF_8 || cp == CP_UTF_7 || cp == CP_UCS_2_BIGENDIAN;
}
inline CODEPAGE
NavigatableCodePage( CODEPAGE cp )
{
return (cp == CP_UCS_2 || cp == CP_UCS_2_BIGENDIAN) ? CP_UTF_8 : cp;
}
inline BOOL
IsKoreanSelectionMode()
{
#if DBG==1
ExternTag(tagKoreanSelection);
return g_cpDefault == CP_KOR_5601 || IsTagEnabled(tagKoreanSelection);
#else
return g_cpDefault == CP_KOR_5601;
#endif
}
BYTE WindowsCharsetFromCodePage( CODEPAGE cp );
inline BOOL
IsExtTextOutWBuggy( UINT codepage )
{
// g_fExtTextOutWBuggy implies that the system call has problems. In the
// case of TC/PRC, many glyphs render incorrectly
return g_fExtTextOutWBuggy
&& ( codepage == CP_UCS_2
|| codepage == CP_TWN
|| codepage == CP_CHN_GB);
}
// **************************************************************************
// NB (cthrash) From RichEdit (_uwrap/unicwrap) start {
#ifdef MACPORT
#if lidSerbianCyrillic != 0xc1a
#error "lidSerbianCyrillic macro value has changed"
#endif // lidSerbianCyrillic
#else
#define lidSerbianCyrillic 0xc1a
#endif // MACPORT
#define IN_RANGE(n1, b, n2) ((unsigned)((b) - n1) <= n2 - n1)
// index returned by CharSetIndexFromChar()
enum CHARSETINDEX {
ANSI_INDEX = 0,
ARABIC_INDEX = 17,
GREEK_INDEX = 13,
HAN_INDEX = -2,
HANGUL_INDEX = 10,
HEBREW_INDEX = 6,
RUSSIAN_INDEX = 8,
SHIFTJIS_INDEX = 7,
THAI_INDEX = 16,
UNKNOWN_INDEX = -1
};
CHARSETINDEX CharSetIndexFromChar(TCHAR ch);
BOOL CheckDBCInUnicodeStr(TCHAR *ptext);
UINT ConvertLanguageIDtoCodePage(WORD lid);
BOOL IsFELCID(LCID lcid);
BOOL IsFECharset(BYTE bCharSet);
INT In125x(WCHAR ch, BYTE bCharSet);
UINT GetKeyboardCodePage();
LCID GetKeyboardLCID();
UINT GetLocaleCodePage();
LCID GetLocaleLCID();
BOOL IsNarrowCharSet(BYTE bCharSet);
// COMPLEXSCRIPT
BOOL IsRtlLCID(LCID lcid);
BOOL IsRTLLang(LANGID lang);
/*
* IsInArabicBlock(LANGID lang)
*
* @func
* Used to determine if a language is in the Arabic block
*
* @rdesc
* TRUE if in the Arabic block.
*/
inline BOOL IsInArabicBlock(LANGID langid)
{
BOOL fInArabicBock = FALSE;
switch (langid)
{
case LANG_ARABIC:
case LANG_URDU:
case LANG_FARSI:
case LANG_SINDHI:
case LANG_KASHMIRI:
fInArabicBock = TRUE;
break;
}
return fInArabicBock;
}
/*
* IsRTLCodepage(cp)
*
* @func
* Used to determine if a codepage should be considered for RTL menu items.
*
* @rdesc
* TRUE if the codepage might have RTL document layout.
*/
inline BOOL IsRTLCodepage(CODEPAGE cp)
{
BOOL fIsRTL = FALSE;
switch(cp)
{
case CP_UTF_7: // unicode
case CP_UTF_8:
case CP_UCS_2:
case CP_UCS_2_BIGENDIAN:
case CP_UCS_4:
case CP_UCS_4_BIGENDIAN:
case CP_1255: // hebrew
case CP_HEB_862:
// case CP_ISO_8859_8: Visual hebrew is explicitly LTR
case CP_ISO_8859_8_I:
case CP_1256: // arabic
case CP_ASMO_708:
case CP_ASMO_720:
case CP_ISO_8859_6:
fIsRTL = TRUE;
break;
}
return fIsRTL;
}
/*
* IsArabicCodepage(cp)
*
* @func
* Used to determine if a codepage is Arabic.
*
* @rdesc
* TRUE if the codepage is Arabic.
*/
inline BOOL IsArabicCodepage(CODEPAGE cp)
{
BOOL fIsArabic = FALSE;
switch(cp)
{
case CP_1256: // arabic
case CP_ASMO_708:
case CP_ASMO_720:
case CP_ISO_8859_6:
fIsArabic = TRUE;
break;
}
return fIsArabic;
}
/*
* IsRTLCharCore(ch)
*
* @func
* Used to determine if character is a right-to-left character.
*
* @rdesc
* TRUE if the character is used in a right-to-left language.
*
*
*/
inline BOOL
IsRTLCharCore(
TCHAR ch)
{
// Bitmask of RLM, RLE, RLO, based from RLM in the 0 bit.
#define MASK_RTLPUNCT 0x90000001
return ( IN_RANGE(0x0590, ch, 0x08ff) || // In RTL block
( IN_RANGE(0x200f, ch, 0x202e) && // Possible RTL punct char
((MASK_RTLPUNCT >> (ch - 0x200f)) & 1) // Mask of RTL punct chars
)
);
}
/*
* IsRTLChar(ch)
*
* @func
* Used to determine if character is a right-to-left character.
*
* @rdesc
* TRUE if the character is used in a right-to-left language.
*
*
*/
inline BOOL
IsRTLChar(
TCHAR ch)
{
return ( IN_RANGE(0x0590 /* First RTL char */, ch, 0x202e /* RLO */) &&
IsRTLCharCore(ch) );
}
/*
/*
* IsAlef(ch)
*
* @func
* Used to determine if base character is a Arabic-type Alef.
*
* @rdesc
* TRUE iff the base character is an Arabic-type Alef.
*
* @comm
* AlefWithMaddaAbove, AlefWithHamzaAbove, AlefWithHamzaBelow,
* and Alef are valid matches.
*
*/
inline BOOL IsAlef(TCHAR ch)
{
if(InRange(ch, 0x0622, 0x0675))
{
return ((InRange(ch, 0x0622, 0x0627) &&
(ch != 0x0624 && ch != 0x0626)) ||
(InRange(ch, 0x0671, 0x0675) &&
(ch != 0x0674)));
}
return FALSE;
}
/*
* IsThaiTypeChar(ch)
*
* @func Used to determine if character is a Thai type script character.
*
* @rdesc TRUE iff character is a Thai character
*
*/
inline BOOL IsThaiTypeChar(TCHAR ch)
{
// NOTE: This includes Thai, Lao and Khmer
// -- no wordbreak characters between words
return (InRange(ch, 0x0E00, 0x0EFF) ||
InRange(ch, 0x1400, 0x147F));
}
/*
* IsNotThaiTypeChar(ch)
*
* @func Used to determine if character is a Thai type script character.
*
* @rdesc TRUE iff character is not a Thai character used to optimize ASCII cases
*
*/
inline BOOL IsNotThaiTypeChar(TCHAR ch)
{
// NOTE: This excludes Thai, Lao and Khmer
// -- no wordbreak characters between words
return (ch < 0x0E00 ||
ch > 0x147F ||
IN_RANGE(0x0EFF, ch, 0x1400));
}
/*
* IsClusterTypeChar(ch)
*
* @func Used to determine if character is a cluster type character.
*
* @rdesc TRUE iff character is a cluster type character
*
* @comm Requires special handling to navigate from cluster to cluster
*/
inline BOOL IsClusterTypeChar(TCHAR ch)
{
// NOTE: This includes Indic, Thai, Lao; Other langauges normally increment partially
// across clusters. We want to include space types of characters here.
return (InRange(ch, 0x0900, 0x0EFF) ||
InRange(ch, 0x1400, 0x147F));
}
/*
* IsNotClusterTypeChar(ch)
*
* @func Used to determine if character is NOT a cluster type character.
*
* @rdesc TRUE iff character is not a cluster type character
*
* @comm Required for special handling to navigate from cluster to cluster
*/
inline BOOL IsNotClusterTypeChar(TCHAR ch)
{
// NOTE: This excludes Indic, Thai, Lao;
// Other langauges normally increment partially across clusters
return (ch < 0x0900 ||
ch > 0x147F ||
InRange(ch, 0x0EFF, 0x1400));
}
// (_uwrap) end }
// **************************************************************************
class CIntlFont
{
public:
CIntlFont( HDC hdc, CODEPAGE codepage, LCID lcid, SHORT sBaselineFont, const TCHAR * pch );
~CIntlFont();
private:
HDC _hdc;
HFONT _hFont;
HFONT _hOldFont;
BOOL _fIsStock;
};
BOOL CommCtrlNativeFontSupport();
// class CCachedCPInfo - used as a codepage cache for 'encoding' menu
// CPCACHE typedef has to be outside of CCachedCPInfo, because
// we initialize the cache outside the class
typedef struct {
UINT cp;
ULONG ulIdx;
int cUsed;
} CPCACHE;
class CCachedCPInfo
{
public:
static void InitCpCache (OPTIONSETTINGS *pOS, PMIMECPINFO pcp, ULONG ccp);
static void SaveCodePage (UINT codepage, PMIMECPINFO pcp, ULONG ccp);
static UINT GetCodePage(int idx)
{
return idx < ARRAY_SIZE(_CpCache) ? _CpCache[idx].cp: 0;
}
static ULONG GetCcp()
{
return _ccpInfo;
}
static ULONG GetMenuIdx(int idx)
{
return idx < ARRAY_SIZE(_CpCache) ? _CpCache[idx].ulIdx: 0;
}
static void SaveSetting();
static void LoadSetting(OPTIONSETTINGS *pOS);
private:
static void RemoveInvalidCp(void);
static ULONG _ccpInfo;
static CPCACHE _CpCache[5];
static BOOL _fCacheLoaded;
static BOOL _fCacheChanged;
static LPTSTR _pchRegKey;
};
extern const TCHAR s_szPathInternational[];
#pragma INCMSG("--- End 'intl.hxx'")
#else
#pragma INCMSG("*** Dup 'intl.hxx'")
#endif
| 26.520343 | 98 | 0.610981 | [
"render"
] |
e49a5275cf2f5d9bc4be81567a1710b5c09e1fc5 | 2,036 | cpp | C++ | src/reader/xmlReader.cpp | martintb/correlate | b0be89af4e57cc5fe96ec3a5c7a9bb84430d2433 | [
"MIT"
] | 3 | 2018-02-26T19:53:46.000Z | 2021-05-05T10:06:52.000Z | src/reader/xmlReader.cpp | martintb/correlate | b0be89af4e57cc5fe96ec3a5c7a9bb84430d2433 | [
"MIT"
] | 1 | 2018-07-03T14:38:15.000Z | 2018-07-09T19:06:01.000Z | src/reader/xmlReader.cpp | martintb/correlate | b0be89af4e57cc5fe96ec3a5c7a9bb84430d2433 | [
"MIT"
] | 1 | 2019-03-28T03:02:07.000Z | 2019-03-28T03:02:07.000Z | #include <string>
#include <sstream>
#include <vector>
#include <iostream>
#include <fstream>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/xml_parser.hpp>
#include "Reader.hpp"
#include "xmlReader.hpp"
#include "debug.hpp"
using namespace std;
namespace bpt = boost::property_tree;
xmlReader::xmlReader(string fileName) :
Reader("xml",
Reader::MOLECULE | \
Reader::TYPE
)
{
this->fileExists(fileName);
this->fileName = fileName;
bpt::ptree tree;
bpt::read_xml(fileName,tree);
string typeStr = tree.get<std::string>("hoomd_xml.configuration.type");
type = splitStr(typeStr,"\n");
natoms = type.size();
try {
cout << "==> Found optional molecule section in xml file!" << endl;
string molStr = tree.get<std::string>("hoomd_xml.configuration.molecule");
vector<string> molVecStr = splitStr(molStr,"\n");
std::transform(molVecStr.begin(), molVecStr.end(), std::back_inserter(molecule),
[](const std::string& str) { return std::stoi(str); });
} catch( bpt::ptree_bad_path &e) {
cout << "==> No (optional) molecule section found in xml. Adding all beads to the same molecule." << endl;
molecule.assign(natoms,1);
}
if (type.size() != molecule.size()) {
cerr << "Error! Number of type and molecule entries in xml file don't match."<< endl;
cerr << "type size: " << type.size() << endl;
cerr << "molecule size: " << molecule.size() << endl;
exit(EXIT_FAILURE);
}
}
void xmlReader::readFrame(int) {
cerr << "Warning! xml file only has a single frame of data. No other frames to read!" << endl;
}
void xmlReader::printFileInfo() {
cout << "File Name: " << fileName << endl;
cout << "Number of Frames: " << numFrames<< endl;
cout << "Number of Atoms: " << natoms << endl;
}
void xmlReader::getTypes(std::vector<std::string >&type) {
type = this->type;
}
void xmlReader::getMolecules(std::vector<int>&molecule) {
molecule = this->molecule;
}
| 29.085714 | 110 | 0.637033 | [
"vector",
"transform"
] |
e49aa39d1b0822adcaa950824a0b0075b4ed88fa | 1,026 | cpp | C++ | Code/Framework/AzFramework/AzFramework/Logging/StartupLogSinkReporter.cpp | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-07-20T12:39:24.000Z | 2021-07-20T12:39:24.000Z | Code/Framework/AzFramework/AzFramework/Logging/StartupLogSinkReporter.cpp | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | null | null | null | Code/Framework/AzFramework/AzFramework/Logging/StartupLogSinkReporter.cpp | aaarsene/o3de | 37e3b0226958974defd14dd6d808e8557dcd7345 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-07-20T11:07:25.000Z | 2021-07-20T11:07:25.000Z | /*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzFramework/Logging/StartupLogSinkReporter.h>
namespace AZ
{
namespace Debug
{
bool StartupLogSink::OnPreAssert(const char* /*fileName*/, int /*line*/, const char* /*func*/, const char* message)
{
// Don't add zero length messages to error strings it will prematurely consume asserts
// before they can register and gives us no information
if (strlen(message) > 0)
{
m_errorStringsCollected.emplace_back(message);
}
return false;
}
bool StartupLogSink::OnPreError(const char* /*window*/, const char* fileName, int line, const char* func, const char* message)
{
return OnPreAssert(fileName, line, func, message);
}
}
} // namespace AZ
| 33.096774 | 158 | 0.62963 | [
"3d"
] |
e49cbcee1cda5687aef32a6e3ac1ce5754da55c6 | 1,036 | cpp | C++ | Shader.cpp | rbellek/OpenGLTemplate | bbea088af7d89dc0d40136b2b61d7504dfbf4496 | [
"MIT"
] | null | null | null | Shader.cpp | rbellek/OpenGLTemplate | bbea088af7d89dc0d40136b2b61d7504dfbf4496 | [
"MIT"
] | null | null | null | Shader.cpp | rbellek/OpenGLTemplate | bbea088af7d89dc0d40136b2b61d7504dfbf4496 | [
"MIT"
] | null | null | null | #include "Shader.h"
#include <glad/glad.h>
#include <iostream>
std::vector<Shader> Shader::m_shaders;
Shader::Shader(const SHADER_TYPE type) : m_type(type), m_shader(0)
{
}
void Shader::load(std::string code)
{
m_code = code;
}
void Shader::compile()
{
m_shader = glCreateShader(m_type == SHADER_TYPE::VERTEX ? GL_VERTEX_SHADER : GL_FRAGMENT_SHADER);
const char* src = m_code.c_str();
glShaderSource(m_shader, 1, &src, NULL);
glCompileShader(m_shader);
int success;
char infoLog[512];
glGetShaderiv(m_shader, GL_COMPILE_STATUS, &success);
if (!success) {
glGetShaderInfoLog(m_shader, 512, NULL, infoLog);
std::cout << "ERROR::SHADER::" << (m_type == SHADER_TYPE::VERTEX ? "VERTEX" : "FRAGMENT") << "::COMPILATION_FAILED\n" << infoLog << std::endl;
}
}
void Shader::destroy()
{
glDeleteShader(m_shader);
}
void Shader::use()
{
}
GLuint Shader::GetShader() const
{
return m_shader;
}
Shader Shader::CreateShader(const SHADER_TYPE type) {
Shader shader{ type };
m_shaders.push_back(shader);
return shader;
}
| 19.54717 | 144 | 0.703668 | [
"vector"
] |
e49f3c63a54ee20798c6392786086e354dc671b2 | 2,849 | cpp | C++ | modules/spaint/src/fiducials/FiducialPoseEstimator.cpp | GucciPrada/spaint | b09ff1ec0d9e123cf316f2737e1b70b5ecc0beea | [
"Unlicense"
] | 1 | 2019-05-16T06:39:21.000Z | 2019-05-16T06:39:21.000Z | modules/spaint/src/fiducials/FiducialPoseEstimator.cpp | GucciPrada/spaint | b09ff1ec0d9e123cf316f2737e1b70b5ecc0beea | [
"Unlicense"
] | null | null | null | modules/spaint/src/fiducials/FiducialPoseEstimator.cpp | GucciPrada/spaint | b09ff1ec0d9e123cf316f2737e1b70b5ecc0beea | [
"Unlicense"
] | null | null | null | /**
* spaint: FiducialPoseEstimator.cpp
* Copyright (c) Torr Vision Group, University of Oxford, 2016. All rights reserved.
*/
#include "fiducials/FiducialPoseEstimator.h"
#include <itmx/geometry/GeometryUtil.h>
using namespace itmx;
namespace spaint {
//#################### PUBLIC STATIC MEMBER FUNCTIONS ####################
boost::optional<ORUtils::SE3Pose> FiducialPoseEstimator::estimate_pose(const std::map<std::string,Fiducial_Ptr>& fiducials,
const std::map<std::string,FiducialMeasurement>& measurements)
{
// Compute a set of camera pose hypotheses based on the correspondences between the live measurements and the known fiducials.
std::map<std::string,ORUtils::SE3Pose> cameraPoseHypotheses = compute_hypotheses(fiducials, measurements);
// Try to find a best camera pose hypothesis using exhaustive search.
std::vector<ORUtils::SE3Pose> inliersForBestHypothesis;
std::string bestHypothesisID = GeometryUtil::find_best_hypothesis(cameraPoseHypotheses, inliersForBestHypothesis);
// If a best hypothesis was found, return the result of blending its inliers together; if not, return none.
if(bestHypothesisID != "") return GeometryUtil::blend_poses(inliersForBestHypothesis);
else return boost::none;
}
//#################### PRIVATE STATIC MEMBER FUNCTIONS ####################
std::map<std::string,ORUtils::SE3Pose> FiducialPoseEstimator::compute_hypotheses(const std::map<std::string,Fiducial_Ptr>& fiducials,
const std::map<std::string,FiducialMeasurement>& measurements)
{
std::map<std::string,ORUtils::SE3Pose> cameraPoseHypotheses;
// For each measurement:
for(std::map<std::string,FiducialMeasurement>::const_iterator it = measurements.begin(), iend = measurements.end(); it != iend; ++it)
{
// Try to find a stable fiducial corresponding to the measurement. If there isn't one, continue.
std::map<std::string,Fiducial_Ptr>::const_iterator jt = fiducials.find(it->first);
if(jt == fiducials.end() || jt->second->confidence() < Fiducial::stable_confidence()) continue;
// Try to get the pose of the measurement in eye space. If it isn't available, continue.
boost::optional<ORUtils::SE3Pose> fiducialPoseEye = it->second.pose_eye();
if(!fiducialPoseEye) continue;
// Use the eye pose from the measurement and the world pose from the fiducial to compute a camera pose hypothesis.
ORUtils::SE3Pose fiducialPoseWorld = jt->second->pose();
ORUtils::SE3Pose cameraPoseHypothesis(fiducialPoseEye->GetInvM() * fiducialPoseWorld.GetM());
// Add the camera pose hypothesis to the set.
cameraPoseHypotheses.insert(std::make_pair(it->first, cameraPoseHypothesis));
}
return cameraPoseHypotheses;
}
}
| 47.483333 | 143 | 0.697438 | [
"geometry",
"vector"
] |
e4a33340c7a8404e6ccf01b373a8ca9e3c71aede | 3,894 | hpp | C++ | Sources/Machine/rbm_nqs.hpp | stubbi/netket | 7391466077a4694e8f12c649730a81bf634f695e | [
"Apache-2.0"
] | 1 | 2019-11-28T10:26:04.000Z | 2019-11-28T10:26:04.000Z | Sources/Machine/rbm_nqs.hpp | stubbi/nqs | 7391466077a4694e8f12c649730a81bf634f695e | [
"Apache-2.0"
] | null | null | null | Sources/Machine/rbm_nqs.hpp | stubbi/nqs | 7391466077a4694e8f12c649730a81bf634f695e | [
"Apache-2.0"
] | null | null | null | // Copyright 2018 The Simons Foundation, Inc. - All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef NQS_RBM_NQS_HPP
#define NQS_RBM_NQS_HPP
#include <cmath>
#include "Machine/abstract_machine.hpp"
namespace nqs {
/** Restricted Boltzmann machine class with spin 1/2 hidden units.
*
*/
class RbmNQS : public AbstractMachine {
// number of visible units
int nv_;
// number of hidden units
int nh_;
// number of parameters
int npar_;
// weights
MatrixType W_;
// visible units bias
VectorType a_;
// hidden units bias
VectorType b_;
VectorType thetas_;
VectorType lnthetas_;
VectorType thetasnew_;
VectorType lnthetasnew_;
bool usea_;
bool useb_;
public:
RbmNQS(std::shared_ptr<const AbstractHilbert> hilbert, int nhidden = 0,
int alpha = 0, bool usea = true, bool useb = true);
int Nvisible() const override;
int Npar() const override;
int Nhidden() const noexcept { return nh_; }
void addHidden();
void InitRandomPars(int seed, double sigma) override;
void InitLookup(VisibleConstType v, LookupType <) override;
void UpdateLookup(VisibleConstType v, const std::vector<int> &tochange,
const std::vector<double> &newconf,
LookupType <) override;
VectorType DerLog(VisibleConstType v) override;
VectorType DerLog(VisibleConstType v, const LookupType <) override;
Complex LogVal(VisibleConstType v) override;
Complex LogVal(VisibleConstType v, const LookupType <) override;
VectorType GetParameters() override;
void SetParameters(VectorConstRefType pars) override;
// Difference between logarithms of values, when one or more visible variables
// are being flipped
VectorType LogValDiff(
VisibleConstType v, const std::vector<std::vector<int>> &tochange,
const std::vector<std::vector<double>> &newconf) override;
// Difference between logarithms of values, when one or more visible variables
// are being flipped Version using pre-computed look-up tables for efficiency
// on a small number of spin flips
Complex LogValDiff(VisibleConstType v, const std::vector<int> &tochange,
const std::vector<double> &newconf,
const LookupType <) override;
void Save(const std::string &filename) const override;
void Load(const std::string &filename) override;
bool IsHolomorphic() const noexcept override;
static void sigmoid(VectorConstRefType x, VectorType &y) {
assert(y.size() >= x.size());
y = 1.0 / (1.0 + Eigen::exp(-1.0 * x.array()));
}
static void sigmoid(RealVectorConstRefType x, RealVectorType &y) {
assert(y.size() >= x.size());
y = 1.0 / (1.0 + Eigen::exp(-1.0 * x.array()));
}
static double softplus(double x) {
return std::log(1.0 + std::exp(x));
}
// softplus(x) for std::complex argument
static Complex softplus(Complex x) {
return std::log(1.0 + std::exp(x));
}
static void softplus(VectorConstRefType x, VectorType &y) {
assert(y.size() >= x.size());
for (int i = 0; i < x.size(); i++) {
y(i) = softplus(x(i));
}
}
static void softplus(RealVectorConstRefType x, RealVectorType &y) {
assert(y.size() >= x.size());
for (int i = 0; i < x.size(); i++) {
y(i) = softplus(x(i));
}
}
private:
inline void Init();
};
} // namespace nqs
#endif
| 28.844444 | 80 | 0.683359 | [
"vector"
] |
e4aabafde824af39e0f68425d49a6eba98f46552 | 13,192 | cpp | C++ | Random_map_generation/DungeonGenerator/RoomsMapGenerator.cpp | Nadine044/RandomMapGeneration | d85419d38c9ca025ccb950f313c3c2970a81bf60 | [
"MIT"
] | null | null | null | Random_map_generation/DungeonGenerator/RoomsMapGenerator.cpp | Nadine044/RandomMapGeneration | d85419d38c9ca025ccb950f313c3c2970a81bf60 | [
"MIT"
] | null | null | null | Random_map_generation/DungeonGenerator/RoomsMapGenerator.cpp | Nadine044/RandomMapGeneration | d85419d38c9ca025ccb950f313c3c2970a81bf60 | [
"MIT"
] | null | null | null | #include "Defs.h"
#include "Log.h"
#include "j1App.h"
#include "j1Render.h"
#include "j1Textures.h"
#include "RoomsMapGenerator.h"
#include "j1Input.h"
#include "j1Pathfinding.h"
#include "Brofiler\Brofiler.h"
#include <time.h>
#include <algorithm>
#define FLOOR { 0,0,32,16 }
#define WATER { 0,16,32,16 }
#define WALL { 32,0,32,16 }
RoomsMapGenerator::RoomsMapGenerator()
{}
// Destructor
RoomsMapGenerator::~RoomsMapGenerator()
{}
Room::~Room()
{
north.clear();
south.clear();
est.clear();
west.clear();
startPoints.clear();
}
// Called before render is available
bool RoomsMapGenerator::Awake(pugi::xml_node& config)
{
bool ret = true;
return ret;
}
// Called before quitting
bool RoomsMapGenerator::CleanUp()
{
bool ret = true;
return ret;
}
// Get the position of a 1 dimensional container from a 2 dimensional parameter
inline int RoomsMapGenerator::Get(int x, int y) const
{
return (map.gridSize.x * y + x);
}
void RoomsMapGenerator::SetMap(MapInfo& map)
{
this->map = map;
this->map.pathOffset = max(map.pathOffset, 1);
this->map.rooms = max(map.rooms, 1);
this->map.roomsMinMaxSize.x = max(map.roomsMinMaxSize.x, 3);
this->map.roomsMinMaxSize.y = max(map.roomsMinMaxSize.y, 3);
this->map.roomsMinMaxSize.w = max(map.roomsMinMaxSize.w, 3);
this->map.roomsMinMaxSize.h = max(map.roomsMinMaxSize.h, 3);
}
// Get the position of the world from a map pos
iPoint RoomsMapGenerator::MapToWorld(iPoint xy) const
{
iPoint ret;
ret.x = xy.x * map.tileSize;
ret.y = xy.y * map.tileSize;
return ret;
}
// Get the position of the map from the world pos
iPoint RoomsMapGenerator::WorldToMap(int x, int y) const
{
iPoint ret;
ret.x = x / map.tileSize;
ret.y = y / map.tileSize;
return ret;
}
bool RoomsMapGenerator::GenerateDungeon(MapInfo& map)
{
BROFILER_CATEGORY("RoomsMapGeneration", Profiler::Color::Chocolate);
bool ret = true;
SetMap(map);
// Load Texture
texture = App->tex->Load("tilesets/isometricMap.png");
for (int i = 0; i < this->map.gridSize.y; ++i) {
for (int j = 0; j < this->map.gridSize.x; ++j) {
open.push_back(new DungeonNode(iPoint{ j,i }, WATER));
}
}
if (open.size() != this->map.gridSize.x * this->map.gridSize.y)
ret = false;
// Check if the user want to use a seed and start srand()
if (this->map.seed != 0)
srand(this->map.seed);
else
srand(time(NULL));
std::list<DungeonNode*> toCreateRooms;
// Create a list copy from the open vector
for (uint i = 0u; i < open.size() && ret; ++i)
toCreateRooms.push_back(open[i]);
for (int i = 1; i <= this->map.rooms && ret; ++i)
{
// Find a random pos
int x = rand() % toCreateRooms.size();
std::list<DungeonNode*>::iterator it = std::next(toCreateRooms.begin(), x);
toCreateRooms.remove((*it));
iPoint roomSize;
roomSize.x = rand() % (this->map.roomsMinMaxSize.y + 1 - this->map.roomsMinMaxSize.x) + this->map.roomsMinMaxSize.x;
roomSize.y = rand() % (this->map.roomsMinMaxSize.h + 1 - this->map.roomsMinMaxSize.w) + this->map.roomsMinMaxSize.w;
if (!GenerateRoom((*it)->position, roomSize, i))
{
i--;
}
}
toCreateRooms.clear();
for (int i = 0; i < closed.size() - 1 && ret; ++i) {
for (int x = i + 1; x < closed.size(); ++x) {
if (closed[i]->position.x > closed[x]->position.x)
{
Room* aux = closed[i];
closed[i] = closed[x];
closed[x] = aux;
}
}
}
// Set walkability for every element in the closed vector
for (int i = 0; i < closed.size() && ret; ++i)
SetWalkability(closed[i]);
// Generate corridors between every room using A*
if (ret)
ret = GenerateCorridorsBetweenRooms();
// Generate Walls for every room and corridor
if (ret)
ret = GenerateWalls();
return ret;
}
// Check if the position is valid
bool RoomsMapGenerator::CheckBoundaries(const iPoint& pos) const
{
return (pos.x >= 0 && pos.x < (int)map.gridSize.x * map.tileSize &&
pos.y >= 0 && pos.y < (int)map.gridSize.y * map.tileSize);
}
// Set the walkability for a room
bool RoomsMapGenerator::SetWalkability(Room* room)
{
BROFILER_CATEGORY("RoomsMapGeneration -- Set Walkability", Profiler::Color::Chocolate);
int offset = map.pathOffset;
int validNode = rand() % (room->north.size() - 1);
for (int i = 0; i < room->north.size(); ++i) {
for (int j = 1; j <= offset; ++j)
{
if (i == validNode) {
open[Get(room->north[i]->position.x, room->north[i]->position.y - j)]->InvalidWalkability = false;
if (j == 1)
room->startPoints.push_back(open[Get(room->north[i]->position.x, room->north[i]->position.y - 1)]);
}
else
open[Get(room->north[i]->position.x, room->north[i]->position.y - j)]->InvalidWalkability = true;
}
}
for (int i = 1; i <= offset; ++i) {
for (int j = 1; j <= offset; ++j)
{
open[Get(room->north[0]->position.x - j, room->north[0]->position.y - i)]->InvalidWalkability = true;
open[Get(room->north[room->north.size() - 1]->position.x + j, room->north[room->north.size() - 1]->position.y - i)]->InvalidWalkability = true;
}
}
validNode = rand() % (room->south.size() - 1);
for (int i = 0; i < room->south.size(); ++i) {
for (int j = 1; j <= offset; ++j)
{
if (i == validNode) {
open[Get(room->south[i]->position.x, room->south[i]->position.y + j)]->InvalidWalkability = false;
if (j == 1)
room->startPoints.push_back(open[Get(room->south[i]->position.x, room->south[i]->position.y + 1)]);
}
else
open[Get(room->south[i]->position.x, room->south[i]->position.y + j)]->InvalidWalkability = true;
}
}
for (int i = 1; i <= offset; ++i) {
for (int j = 1; j <= offset; ++j)
{
open[Get(room->south[0]->position.x - j, room->south[0]->position.y + i)]->InvalidWalkability = true;
open[Get(room->south[room->south.size() - 1]->position.x + j, room->south[room->south.size() - 1]->position.y + i)]->InvalidWalkability = true;
}
}
validNode = rand() % (room->west.size() - 1);
for (int i = 0; i < room->west.size(); ++i) {
for (int j = 1; j <= offset; ++j)
{
if (i == validNode) {
open[Get(room->west[i]->position.x - j, room->west[i]->position.y)]->InvalidWalkability = false;
if (j == 1)
room->startPoints.push_back(open[Get(room->west[i]->position.x - 1, room->west[i]->position.y)]);
}
else
open[Get(room->west[i]->position.x - j, room->west[i]->position.y)]->InvalidWalkability = true;
}
}
validNode = rand() % (room->est.size() - 1);
for (int i = 0; i < room->est.size(); ++i) {
for (int j = 1; j <= offset; ++j)
{
if (i == validNode) {
open[Get(room->est[i]->position.x + j, room->est[i]->position.y)]->InvalidWalkability = false;
if (j == 1)
room->startPoints.push_back(open[Get(room->est[i]->position.x + 1, room->est[i]->position.y)]);
}
else
open[Get(room->est[i]->position.x + j, room->est[i]->position.y)]->InvalidWalkability = true;
}
}
return true;
}
// Generate walls for every room and corridor
bool RoomsMapGenerator::GenerateWalls()
{
BROFILER_CATEGORY("RoomsMapGeneration -- Walls Generation", Profiler::Color::Chocolate);
for (int i = 0; i < open.size(); ++i)
{
if (SDL_RectEquals((const SDL_Rect*)&open[i]->tileRect, &SDL_Rect(FLOOR)))
{
DungeonNode* node = open[i];
if (SDL_RectEquals((const SDL_Rect*)&open[Get(node->position.x + 1, node->position.y)]->tileRect, &SDL_Rect(WATER)) && CheckBoundaries(MapToWorld({ node->position.x + 1, node->position.y })))
open[Get(node->position.x + 1, node->position.y)]->tileRect = WALL;
if (SDL_RectEquals((const SDL_Rect*)&open[Get(node->position.x - 1, node->position.y)]->tileRect, &SDL_Rect(WATER)) && CheckBoundaries(MapToWorld({ node->position.x - 1, node->position.y })))
open[Get(node->position.x - 1, node->position.y)]->tileRect = WALL;
if (SDL_RectEquals((const SDL_Rect*)&open[Get(node->position.x, node->position.y + 1)]->tileRect, &SDL_Rect(WATER)) && CheckBoundaries(MapToWorld({ node->position.x, node->position.y + 1 })))
open[Get(node->position.x, node->position.y + 1)]->tileRect = WALL;
if (SDL_RectEquals((const SDL_Rect*)&open[Get(node->position.x, node->position.y - 1)]->tileRect, &SDL_Rect(WATER)) && CheckBoundaries(MapToWorld({ node->position.x, node->position.y - 1 })))
open[Get(node->position.x, node->position.y - 1)]->tileRect = WALL;
if (SDL_RectEquals((const SDL_Rect*)&open[Get(node->position.x - 1, node->position.y - 1)]->tileRect, &SDL_Rect(WATER)) && CheckBoundaries(MapToWorld({ node->position.x - 1, node->position.y - 1 })))
open[Get(node->position.x - 1, node->position.y - 1)]->tileRect = WALL;
if (SDL_RectEquals((const SDL_Rect*)&open[Get(node->position.x - 1, node->position.y + 1)]->tileRect, &SDL_Rect(WATER)) && CheckBoundaries(MapToWorld({ node->position.x - 1, node->position.y + 1 })))
open[Get(node->position.x - 1, node->position.y + 1)]->tileRect = WALL;
if (SDL_RectEquals((const SDL_Rect*)&open[Get(node->position.x + 1, node->position.y - 1)]->tileRect, &SDL_Rect(WATER)) && CheckBoundaries(MapToWorld({ node->position.x + 1, node->position.y - 1 })))
open[Get(node->position.x + 1, node->position.y - 1)]->tileRect = WALL;
if (SDL_RectEquals((const SDL_Rect*)&open[Get(node->position.x + 1, node->position.y + 1)]->tileRect, &SDL_Rect(WATER)) && CheckBoundaries(MapToWorld({ node->position.x + 1, node->position.y + 1 })))
open[Get(node->position.x + 1, node->position.y + 1)]->tileRect = WALL;
}
}
return true;
}
// Generate one Room :)
bool RoomsMapGenerator::GenerateRoom(iPoint& pos, iPoint& size, int room)
{
BROFILER_CATEGORY("RoomsMapGeneration -- Rooms Generation", Profiler::Color::Chocolate);
if (CheckBoundaries(MapToWorld({ pos.x, pos.y })))
{
// Check if the pos is valid
for (int i = -map.roomsOffset; i < size.y + map.roomsOffset; ++i)
{
for (int j = -map.roomsOffset; j < size.x + map.roomsOffset; ++j)
{
if (!CheckBoundaries(MapToWorld({ pos.x + j, pos.y + i })) || SDL_RectEquals((const SDL_Rect*)&open[Get(pos.x + j, pos.y + i)]->tileRect, &SDL_Rect(FLOOR)))
return false;
}
}
// Create the room
Room* room = new Room;
for (int i = 0; i < size.y; ++i)
{
for (int j = 0; j < size.x; ++j)
{
DungeonNode* roomNode = open[Get(pos.x + j, pos.y + i)];
if (i == 0 && j == 0)
room->position = roomNode->position;
if (i == 0)
room->north.push_back(roomNode);
else if (i == size.y - 1)
room->south.push_back(roomNode);
else if (j == 0)
room->west.push_back(roomNode);
else if (j == size.x - 1)
room->est.push_back(roomNode);
roomNode->tileRect = FLOOR;
roomNode->InvalidWalkability = true;
}
}
room->est.push_back(open[Get(room->est[0]->position.x, room->est[0]->position.y - 1)]);
room->est.push_back(open[Get(room->south[room->south.size() - 1]->position.x, room->south[room->south.size() - 1]->position.y)]);
room->west.push_back(open[Get(room->west[0]->position.x, room->west[0]->position.y - 1)]);
room->west.push_back(open[Get(room->south[0]->position.x, room->south[0]->position.y)]);
closed.push_back(room);
return true;
}
return false;
}
// Generate Corridors between rooms using A*
bool RoomsMapGenerator::GenerateCorridorsBetweenRooms()
{
BROFILER_CATEGORY("RoomsMapGeneration -- Corridors Generation", Profiler::Color::Chocolate);
bool ret = true;
for (int i = 0; i < closed.size(); ++i) {
if (i != closed.size() - 1) {
int pathPosition = rand() % (closed[i]->startPoints.size() - 1);
int pathPositionEnd = rand() % (closed[i + 1]->startPoints.size() - 1);
App->pathfinding->CreatePath(closed[i]->startPoints[pathPosition]->position, closed[i + 1]->startPoints[pathPositionEnd]->position, DISTANCE_MANHATTAN);
closed[i + 1]->startPoints.erase(closed[i + 1]->startPoints.begin() + pathPositionEnd);
std::vector<iPoint> convert = *App->pathfinding->GetLastPath();
for (int j = 0; j < convert.size(); ++j)
{
iPoint point = convert[j];
open[Get(point.x, point.y)]->tileRect = FLOOR;
}
}
}
return ret;
}
// Clean the Dungeon
bool RoomsMapGenerator::CleanDungeon()
{
BROFILER_CATEGORY("RoomsMapGeneration -- Dungeon Clean Up", Profiler::Color::Chocolate);
bool ret = true;
LOG("Cleaning Dungeon...");
for (int i = 0; i < closed.size(); ++i)
{
delete closed[i];
closed[i] = nullptr;
}
closed.clear();
for (int i = 0; i < open.size(); ++i)
{
delete open[i];
open[i] = nullptr;
}
open.clear();
App->tex->UnLoad(texture);
currentNode = nullptr;
return ret;
}
// Draw the entire map
bool RoomsMapGenerator::Draw()
{
BROFILER_CATEGORY("RoomsMapGeneration -- Draw", Profiler::Color::Chocolate);
bool ret = true;
std::vector<DungeonNode*>::iterator item;
int first, second;
for (item = open.begin(); item != open.end() && ret; ++item)
{
iPoint pos = MapToWorld((*item)->position);
first = (pos.x - pos.y) * 16;
second = (pos.x + pos.y) * 8;
ret = App->render->Blit(texture, first, second, &(*item)->tileRect);
}
/*for (uint i = 0u; i < nodes.size() && ret; ++i)
{
iPoint posToBlit = nodes[i]->pos;
first = (posToBlit.x - posToBlit.y) * 16;
second = (posToBlit.x + posToBlit.y) * 8;
ret = App->render->Blit(mapTexture, first, second, &nodes[i]->whatToBlit);
}*/
return ret;
} | 30.894614 | 202 | 0.639403 | [
"render",
"vector"
] |
e4c69244f707aed13ef3a51ff9fe584c99e49cb1 | 1,065 | cpp | C++ | Array/Multiply_Two_Numbers.cpp | susantabiswas/placementPrep | 22a7574206ddc63eba89517f7b68a3d2f4d467f5 | [
"MIT"
] | 19 | 2018-12-02T05:59:44.000Z | 2021-07-24T14:11:54.000Z | Array/Multiply_Two_Numbers.cpp | susantabiswas/placementPrep | 22a7574206ddc63eba89517f7b68a3d2f4d467f5 | [
"MIT"
] | null | null | null | Array/Multiply_Two_Numbers.cpp | susantabiswas/placementPrep | 22a7574206ddc63eba89517f7b68a3d2f4d467f5 | [
"MIT"
] | 13 | 2019-04-25T16:20:00.000Z | 2021-09-06T19:50:04.000Z | //Multiply two numbers using arrays
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
//for displaying array elements
template <class T>
void disp(T c){
for (int i = 0; i < c.size(); ++i)
{
cout<<c[i]<<" ";
}
cout<<endl;
}
//for multiplying the numbers
vector<int> multiplyNum(vector<int> A,vector<int> B){
int n = A.size();
int m = B.size();
int carry =0,dcarry = 0,digit = 0;
int index = 0;
int ans;
vector<int> C(n+m,0); //for storing the result
for(int i = m-1, k =0 ;i >=0 ,k<m; i--,k++){
index = 0;
dcarry = carry = 0;
for(int j = n-1;j>=0; j--){
digit = carry + A[j]*B[i];
carry = digit/10;
digit = digit%10;
ans = digit + C[index +k] +dcarry;
dcarry = ans / 10;
ans = ans%10;
C[index + k] = ans;
index ++;
}
carry = carry + dcarry;
//cout<<endl;
//digit = dcarry +carry;
if(carry){
C [k +index] = carry;
}
}
reverse(C.begin(),C.end());
return C;
}
main(){
vector<int> A = {9,8,7};
vector<int> B = {1,2,3};
vector<int> C = multiplyNum(A,B);
disp(C);
}
| 17.75 | 53 | 0.564319 | [
"vector"
] |
e4c71aa2b1d81a90c15fbd716386f4dc4a4bd50b | 3,769 | hpp | C++ | server/src/parsing.hpp | courtarro/beefweb | 879f68d8be5339c73b02bf32c9fa39027cd66fab | [
"MIT"
] | 148 | 2017-08-25T13:32:05.000Z | 2022-03-17T18:40:49.000Z | server/src/parsing.hpp | courtarro/beefweb | 879f68d8be5339c73b02bf32c9fa39027cd66fab | [
"MIT"
] | 160 | 2017-08-16T19:58:53.000Z | 2022-02-26T09:57:38.000Z | server/src/parsing.hpp | courtarro/beefweb | 879f68d8be5339c73b02bf32c9fa39027cd66fab | [
"MIT"
] | 24 | 2018-05-23T18:59:47.000Z | 2022-03-23T17:25:01.000Z | #pragma once
#include "string_utils.hpp"
#include <vector>
#include <boost/lexical_cast/try_lexical_convert.hpp>
#include <boost/tokenizer.hpp>
namespace msrv {
template<typename T> struct ValueParser;
template<typename T>
bool tryParseValue(StringView str, T* outVal);
template<typename T>
bool tryParseValueList(StringView str, char sep, std::vector<T>* outVal);
template<typename T>
bool tryParseValueListStrict(StringView str, char sep, char esc, std::vector<T> *outVal);
template<typename T>
T parseValue(StringView str);
template<typename T>
std::vector<T> parseValueList(StringView str, char sep);
template<typename T>
std::vector<T> parseValueListStrict(StringView str, char sep, char esc);
template<typename T>
struct ValueParser
{
static bool tryParse(StringView str, T* outVal)
{
assert(str.data());
assert(outVal);
return boost::conversion::try_lexical_convert(str.data(), str.length(), *outVal);
}
};
template<>
struct ValueParser<std::string>
{
static bool tryParse(StringView str, std::string* outVal)
{
*outVal = str.to_string();
return true;
}
};
template<>
struct ValueParser<bool>
{
static bool tryParse(StringView str, bool* outVal);
};
template<typename T>
struct ValueParser<std::vector<T>>
{
static bool tryParse(StringView str, std::vector<T>* outVal)
{
return tryParseValueListStrict(str, ',', '\\', outVal);
}
};
template<typename T>
bool tryParseValue(StringView str, T* outVal)
{
assert(str.data());
assert(outVal);
return ValueParser<T>::tryParse(str, outVal);
}
template<typename T>
bool tryParseValueList(StringView str, char sep, std::vector<T>* outVal)
{
assert(str.data());
assert(outVal);
auto input = str.to_string();
char sepString[] = { sep, '\0' };
boost::char_separator<char> separator(
sepString,
"",
boost::drop_empty_tokens);
boost::tokenizer<boost::char_separator<char>> tokenizer(input, separator);
std::vector<T> items;
for (const auto& token : tokenizer)
{
T value;
auto trimmedToken = trimWhitespace(token);
if (trimmedToken.empty())
continue;
if (!tryParseValue(trimmedToken, &value))
return false;
items.emplace_back(std::move(value));
}
*outVal = std::move(items);
return true;
}
template<typename T>
bool tryParseValueListStrict(StringView str, char sep, char esc, std::vector<T> *outVal)
{
assert(str.data());
assert(outVal);
auto input = str.to_string();
boost::escaped_list_separator<char> separator(
std::string(1, esc),
std::string(1, sep),
std::string());
boost::tokenizer<boost::escaped_list_separator<char>> tokenizer(input, separator);
std::vector<T> items;
for (const auto& token : tokenizer)
{
T value;
if (!tryParseValue(token, &value))
return false;
items.emplace_back(std::move(value));
}
*outVal = std::move(items);
return true;
}
template<typename T>
T parseValue(StringView str)
{
T result;
if (!tryParseValue(str, &result))
throw std::invalid_argument("invalid value format");
return result;
}
template<typename T>
std::vector<T> parseValueList(StringView str, char sep)
{
std::vector<T> result;
if (!tryParseValueList(str, sep, &result))
throw std::invalid_argument("invalid value format");
return result;
}
template<typename T>
std::vector<T> parseValueListStrict(StringView str, char sep, char esc)
{
std::vector<T> result;
if (!tryParseValueListStrict(str, sep, esc, &result))
throw std::invalid_argument("invalid value format");
return result;
}
}
| 21.174157 | 89 | 0.660653 | [
"vector"
] |
e4d6861c0ac92cbbd8dcd0322f2cdc61259457d0 | 8,232 | cc | C++ | chromium/chrome/browser/safe_browsing/local_database_manager_unittest.cc | wedataintelligence/vivaldi-source | 22a46f2c969f6a0b7ca239a05575d1ea2738768c | [
"BSD-3-Clause"
] | null | null | null | chromium/chrome/browser/safe_browsing/local_database_manager_unittest.cc | wedataintelligence/vivaldi-source | 22a46f2c969f6a0b7ca239a05575d1ea2738768c | [
"BSD-3-Clause"
] | null | null | null | chromium/chrome/browser/safe_browsing/local_database_manager_unittest.cc | wedataintelligence/vivaldi-source | 22a46f2c969f6a0b7ca239a05575d1ea2738768c | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/run_loop.h"
#include "chrome/browser/safe_browsing/local_database_manager.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "content/public/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#include "url/gurl.h"
using content::TestBrowserThreadBundle;
namespace safe_browsing {
namespace {
class TestClient : public SafeBrowsingDatabaseManager::Client {
public:
TestClient() {}
~TestClient() override {}
void OnCheckBrowseUrlResult(const GURL& url,
SBThreatType threat_type,
const std::string& metadata) override {}
void OnCheckDownloadUrlResult(const std::vector<GURL>& url_chain,
SBThreatType threat_type) override {}
private:
DISALLOW_COPY_AND_ASSIGN(TestClient);
};
} // namespace
class SafeBrowsingDatabaseManagerTest : public PlatformTest {
public:
bool RunSBHashTest(const ListType list_type,
const std::vector<SBThreatType>& expected_threats,
const std::string& result_list);
private:
TestBrowserThreadBundle thread_bundle_;
};
bool SafeBrowsingDatabaseManagerTest::RunSBHashTest(
const ListType list_type,
const std::vector<SBThreatType>& expected_threats,
const std::string& result_list) {
scoped_refptr<SafeBrowsingService> sb_service_(
SafeBrowsingService::CreateSafeBrowsingService());
scoped_refptr<LocalSafeBrowsingDatabaseManager> db_manager_(
new LocalSafeBrowsingDatabaseManager(sb_service_));
const SBFullHash same_full_hash = {};
LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck* check =
new LocalSafeBrowsingDatabaseManager::SafeBrowsingCheck(
std::vector<GURL>(), std::vector<SBFullHash>(1, same_full_hash), NULL,
list_type, expected_threats);
db_manager_->checks_.insert(check);
const SBFullHashResult full_hash_result = {same_full_hash,
GetListId(result_list)};
std::vector<SBFullHashResult> fake_results(1, full_hash_result);
bool result = db_manager_->HandleOneCheck(check, fake_results);
db_manager_->checks_.erase(check);
delete check;
return result;
}
TEST_F(SafeBrowsingDatabaseManagerTest, CheckCorrespondsListType) {
std::vector<SBThreatType> malware_threat(1,
SB_THREAT_TYPE_BINARY_MALWARE_URL);
EXPECT_FALSE(RunSBHashTest(BINURL, malware_threat, kMalwareList));
EXPECT_TRUE(RunSBHashTest(BINURL, malware_threat, kBinUrlList));
// Check for multiple threats
std::vector<SBThreatType> multiple_threats;
multiple_threats.push_back(SB_THREAT_TYPE_URL_MALWARE);
multiple_threats.push_back(SB_THREAT_TYPE_URL_PHISHING);
EXPECT_FALSE(RunSBHashTest(MALWARE, multiple_threats, kBinUrlList));
EXPECT_TRUE(RunSBHashTest(MALWARE, multiple_threats, kMalwareList));
}
TEST_F(SafeBrowsingDatabaseManagerTest, GetUrlSeverestThreatType) {
std::vector<SBFullHashResult> full_hashes;
const GURL kMalwareUrl("http://www.malware.com/page.html");
const GURL kPhishingUrl("http://www.phishing.com/page.html");
const GURL kUnwantedUrl("http://www.unwanted.com/page.html");
const GURL kUnwantedAndMalwareUrl(
"http://www.unwantedandmalware.com/page.html");
const GURL kSafeUrl("http://www.safe.com/page.html");
const SBFullHash kMalwareHostHash = SBFullHashForString("malware.com/");
const SBFullHash kPhishingHostHash = SBFullHashForString("phishing.com/");
const SBFullHash kUnwantedHostHash = SBFullHashForString("unwanted.com/");
const SBFullHash kUnwantedAndMalwareHostHash =
SBFullHashForString("unwantedandmalware.com/");
const SBFullHash kSafeHostHash = SBFullHashForString("www.safe.com/");
{
SBFullHashResult full_hash;
full_hash.hash = kMalwareHostHash;
full_hash.list_id = static_cast<int>(MALWARE);
full_hashes.push_back(full_hash);
}
{
SBFullHashResult full_hash;
full_hash.hash = kPhishingHostHash;
full_hash.list_id = static_cast<int>(PHISH);
full_hashes.push_back(full_hash);
}
{
SBFullHashResult full_hash;
full_hash.hash = kUnwantedHostHash;
full_hash.list_id = static_cast<int>(UNWANTEDURL);
full_hashes.push_back(full_hash);
}
{
// Add both MALWARE and UNWANTEDURL list IDs for
// kUnwantedAndMalwareHostHash.
SBFullHashResult full_hash_malware;
full_hash_malware.hash = kUnwantedAndMalwareHostHash;
full_hash_malware.list_id = static_cast<int>(MALWARE);
full_hashes.push_back(full_hash_malware);
SBFullHashResult full_hash_unwanted;
full_hash_unwanted.hash = kUnwantedAndMalwareHostHash;
full_hash_unwanted.list_id = static_cast<int>(UNWANTEDURL);
full_hashes.push_back(full_hash_unwanted);
}
EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE,
LocalSafeBrowsingDatabaseManager::GetHashSeverestThreatType(
kMalwareHostHash, full_hashes));
EXPECT_EQ(SB_THREAT_TYPE_URL_PHISHING,
LocalSafeBrowsingDatabaseManager::GetHashSeverestThreatType(
kPhishingHostHash, full_hashes));
EXPECT_EQ(SB_THREAT_TYPE_URL_UNWANTED,
LocalSafeBrowsingDatabaseManager::GetHashSeverestThreatType(
kUnwantedHostHash, full_hashes));
EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE,
LocalSafeBrowsingDatabaseManager::GetHashSeverestThreatType(
kUnwantedAndMalwareHostHash, full_hashes));
EXPECT_EQ(SB_THREAT_TYPE_SAFE,
LocalSafeBrowsingDatabaseManager::GetHashSeverestThreatType(
kSafeHostHash, full_hashes));
const size_t kArbitraryValue = 123456U;
size_t index = kArbitraryValue;
EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE,
LocalSafeBrowsingDatabaseManager::GetUrlSeverestThreatType(
kMalwareUrl, full_hashes, &index));
EXPECT_EQ(0U, index);
EXPECT_EQ(SB_THREAT_TYPE_URL_PHISHING,
LocalSafeBrowsingDatabaseManager::GetUrlSeverestThreatType(
kPhishingUrl, full_hashes, &index));
EXPECT_EQ(1U, index);
EXPECT_EQ(SB_THREAT_TYPE_URL_UNWANTED,
LocalSafeBrowsingDatabaseManager::GetUrlSeverestThreatType(
kUnwantedUrl, full_hashes, &index));
EXPECT_EQ(2U, index);
EXPECT_EQ(SB_THREAT_TYPE_URL_MALWARE,
LocalSafeBrowsingDatabaseManager::GetUrlSeverestThreatType(
kUnwantedAndMalwareUrl, full_hashes, &index));
EXPECT_EQ(3U, index);
index = kArbitraryValue;
EXPECT_EQ(SB_THREAT_TYPE_SAFE,
LocalSafeBrowsingDatabaseManager::GetUrlSeverestThreatType(
kSafeUrl, full_hashes, &index));
EXPECT_EQ(kArbitraryValue, index);
}
TEST_F(SafeBrowsingDatabaseManagerTest, ServiceStopWithPendingChecks) {
scoped_refptr<SafeBrowsingService> sb_service(
SafeBrowsingService::CreateSafeBrowsingService());
scoped_refptr<LocalSafeBrowsingDatabaseManager> db_manager(
new LocalSafeBrowsingDatabaseManager(sb_service));
TestClient client;
// Start the service and flush tasks to ensure database is made available.
db_manager->StartOnIOThread();
content::RunAllBlockingPoolTasksUntilIdle();
base::RunLoop().RunUntilIdle();
EXPECT_TRUE(db_manager->DatabaseAvailable());
// Start an extension check operation, which is done asynchronously.
std::set<std::string> extension_ids;
extension_ids.insert("testtesttesttesttesttesttesttest");
db_manager->CheckExtensionIDs(extension_ids, &client);
// Stop the service without first flushing above tasks.
db_manager->StopOnIOThread(false);
// Now run posted tasks, whish should include the extension check which has
// been posted to the safe browsing task runner. This should not crash.
content::RunAllBlockingPoolTasksUntilIdle();
base::RunLoop().RunUntilIdle();
}
} // namespace safe_browsing
| 36.586667 | 80 | 0.746234 | [
"vector"
] |
e4e548438a3c827c19c95096a3c9b54da39ec510 | 9,295 | inl | C++ | .src/cppcall.inl | friendlyanon/jluna | 2718f1466c35377fbec8bd2f0011521c7ae93ad5 | [
"MIT"
] | null | null | null | .src/cppcall.inl | friendlyanon/jluna | 2718f1466c35377fbec8bd2f0011521c7ae93ad5 | [
"MIT"
] | null | null | null | .src/cppcall.inl | friendlyanon/jluna | 2718f1466c35377fbec8bd2f0011521c7ae93ad5 | [
"MIT"
] | null | null | null | //
// Copyright 2022 Clemens Cords
// Created on 31.01.22 by clem (mail@clemens-cords.com)
//
#include <include/julia_extension.hpp>
#include <include/exceptions.hpp>
#include <.src/c_adapter.hpp>
namespace jluna
{
namespace detail
{
template<typename Lambda_t, typename Return_t, typename... Args_t, std::enable_if_t<std::is_same_v<Return_t, void>, bool> = true>
jl_value_t* invoke_lambda(const Lambda_t* func, Args_t... args)
{
(*func)(args...);
return jl_nothing;
}
template<typename Lambda_t, typename Return_t, typename... Args_t, std::enable_if_t<not std::is_same_v<Return_t, void>, bool> = true>
jl_value_t* invoke_lambda(const Lambda_t* func, Args_t... args)
{
auto res = (*func)(args...);
return box(res);
}
static inline size_t _unnamed_function_id = 1;
}
template<LambdaType<> Lambda_t>
void register_function(const std::string& name, const Lambda_t& lambda)
{
throw_if_uninitialized();
c_adapter::register_function(name, 0, [lambda](jl_value_t* tuple) -> jl_value_t* {
jl_gc_pause;
auto out = detail::invoke_lambda<Lambda_t, std::invoke_result_t<Lambda_t>>(
&lambda
);
jl_gc_unpause;
return out;
});
}
template<LambdaType<jl_value_t*> Lambda_t>
void register_function(const std::string& name, const Lambda_t& lambda)
{
throw_if_uninitialized();
c_adapter::register_function(name, 1, [lambda](jl_value_t* tuple) -> jl_value_t* {
jl_gc_pause;
auto out = detail::invoke_lambda<Lambda_t, std::invoke_result_t<Lambda_t, jl_value_t*>, jl_value_t*>(
&lambda,
jl_tupleref(tuple, 0)
);
jl_gc_unpause;
return out;
});
}
template<LambdaType<jl_value_t*, jl_value_t*> Lambda_t>
void register_function(const std::string& name, const Lambda_t& lambda)
{
throw_if_uninitialized();
c_adapter::register_function(name, 2, [lambda](jl_value_t* tuple) -> jl_value_t* {
jl_gc_pause;
auto out = detail::invoke_lambda<Lambda_t, std::invoke_result_t<Lambda_t, jl_value_t*, jl_value_t*>, jl_value_t*, jl_value_t*>(
&lambda,
jl_tupleref(tuple, 0),
jl_tupleref(tuple, 1)
);
jl_gc_unpause;
return out;
});
}
template<LambdaType<jl_value_t*, jl_value_t*, jl_value_t*> Lambda_t>
void register_function(const std::string& name, const Lambda_t& lambda)
{
throw_if_uninitialized();
c_adapter::register_function(name, 3, [lambda](jl_value_t* tuple) -> jl_value_t* {
jl_gc_pause;
auto out = detail::invoke_lambda<Lambda_t, std::invoke_result_t<Lambda_t, jl_value_t*, jl_value_t*, jl_value_t*>, jl_value_t*, jl_value_t*, jl_value_t*>(
&lambda,
jl_tupleref(tuple, 0),
jl_tupleref(tuple, 1),
jl_tupleref(tuple, 2)
);
jl_gc_unpause;
return out;
});
}
template<LambdaType<jl_value_t*, jl_value_t*, jl_value_t*, jl_value_t*> Lambda_t>
void register_function(const std::string& name, const Lambda_t& lambda)
{
throw_if_uninitialized();
c_adapter::register_function(name, 4, [lambda](jl_value_t* tuple) -> jl_value_t* {
jl_gc_pause;
auto out = detail::invoke_lambda<Lambda_t, std::invoke_result_t<Lambda_t, jl_value_t*, jl_value_t*, jl_value_t*, jl_value_t*>, jl_value_t*, jl_value_t*, jl_value_t*, jl_value_t*>(
&lambda,
jl_tupleref(tuple, 0),
jl_tupleref(tuple, 1),
jl_tupleref(tuple, 2),
jl_tupleref(tuple, 3)
);
jl_gc_unpause;
return out;
});
}
template<LambdaType<std::vector<jl_value_t*>> Lambda_t>
void register_function(const std::string& name, const Lambda_t& lambda)
{
throw_if_uninitialized();
c_adapter::register_function(name, 1, [lambda](jl_value_t* tuple) -> jl_value_t* {
std::vector<jl_value_t*> wrapped;
for (size_t i = 0; i < jl_tuple_len(tuple); ++i)
wrapped.push_back(jl_tupleref(tuple, i));
jl_gc_pause;
auto out = detail::invoke_lambda<
Lambda_t,
std::invoke_result_t<Lambda_t, std::vector<jl_value_t*>>,
std::vector<jl_value_t*>>(
&lambda, wrapped
);
jl_gc_unpause;
return out;
});
}
template<LambdaType<> Lambda_t>
Function* register_unnamed_function(const Lambda_t& lambda)
{
std::string id = "#" + std::to_string(detail::_unnamed_function_id++);
register_function(id, lambda);
static jl_function_t* new_unnamed_function = jl_find_function("jluna._cppcall", "new_unnamed_function");
jl_gc_pause;
Any* res;
if (std::is_same_v<std::invoke_result_t<Lambda_t>, void>)
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(0), (Any*) jl_nothing_type);
else
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(0), (Any*) jl_any_type);
jl_gc_unpause;
return res;
}
template<LambdaType<Any*> Lambda_t>
Function* register_unnamed_function(const Lambda_t& lambda)
{
std::string id = "#" + std::to_string(detail::_unnamed_function_id++);
register_function(id, lambda);
static jl_function_t* new_unnamed_function = jl_find_function("jluna._cppcall", "new_unnamed_function");
jl_gc_pause;
Any* res;
if (std::is_same_v<std::invoke_result_t<Lambda_t, Any*>, void>)
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(1), (Any*) jl_nothing_type);
else
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(1), (Any*) jl_any_type);
jl_gc_unpause;
return res;
}
template<LambdaType<Any*, Any*> Lambda_t>
Function* register_unnamed_function(const Lambda_t& lambda)
{
std::string id = "#" + std::to_string(detail::_unnamed_function_id++);
register_function(id, lambda);
static jl_function_t* new_unnamed_function = jl_find_function("jluna._cppcall", "new_unnamed_function");
jl_gc_pause;
Any* res;
if (std::is_same_v<std::invoke_result_t<Lambda_t, Any*, Any*>, void>)
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(2), (Any*) jl_nothing_type);
else
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(2), (Any*) jl_any_type);
jl_gc_unpause;
return res;
}
template<LambdaType<Any*, Any*, Any*> Lambda_t>
Function* register_unnamed_function(const Lambda_t& lambda)
{
std::string id = "#" + std::to_string(detail::_unnamed_function_id++);
register_function(id, lambda);
static jl_function_t* new_unnamed_function = jl_find_function("jluna._cppcall", "new_unnamed_function");
jl_gc_pause;
Any* res;
if (std::is_same_v<std::invoke_result_t<Lambda_t, Any*, Any*, Any*>, void>)
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(3), (Any*) jl_nothing_type);
else
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(3), (Any*) jl_any_type);
jl_gc_unpause;
return res;
}
template<LambdaType<Any*, Any*, Any*, Any*> Lambda_t>
Function* register_unnamed_function(const Lambda_t& lambda)
{
std::string id = "#" + std::to_string(detail::_unnamed_function_id++);
register_function(id, lambda);
static jl_function_t* new_unnamed_function = jl_find_function("jluna._cppcall", "new_unnamed_function");
jl_gc_pause;
Any* res;
if (std::is_same_v<std::invoke_result_t<Lambda_t, Any*, Any*, Any*, Any*>, void>)
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(4), (Any*) jl_nothing_type);
else
res = jl_call3(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(4), (Any*) jl_any_type);
jl_gc_unpause;
return res;
}
template<LambdaType<std::vector<Any*>> Lambda_t>
Function* register_unnamed_function(const Lambda_t& lambda)
{
std::string id = "#" + std::to_string(detail::_unnamed_function_id++);
register_function(id, lambda);
static jl_function_t* new_unnamed_function = jl_find_function("jluna._cppcall", "new_unnamed_function");
jl_gc_pause;
auto* res = jl_call2(new_unnamed_function, (jl_value_t*) jl_symbol(id.c_str()), jl_box_int64(-1));
jl_gc_unpause;
return res;
}
}
| 35.888031 | 191 | 0.613986 | [
"vector"
] |
e4e59bc17a33807e43fb72d96e87ed4a9e2833ae | 5,587 | hpp | C++ | kv/allsol-simple.hpp | soonho-tri/kv | 4963be6560d8600cdc9ff22d004b2b965ae7b1df | [
"MIT"
] | 67 | 2017-01-04T15:30:54.000Z | 2022-03-31T05:45:02.000Z | src/interval/kv/allsol-simple.hpp | takafumihoriuchi/HyLaGI | 26b9f32a84611ee62d9cbbd903773d224088c959 | [
"BSL-1.0"
] | 4 | 2017-02-10T02:59:45.000Z | 2019-10-10T14:17:08.000Z | src/interval/kv/allsol-simple.hpp | takafumihoriuchi/HyLaGI | 26b9f32a84611ee62d9cbbd903773d224088c959 | [
"BSL-1.0"
] | 5 | 2021-09-29T02:27:46.000Z | 2022-03-31T05:45:04.000Z | /*
* Copyright (c) 2013-2015 Masahide Kashiwagi (kashi@waseda.jp)
*/
#ifndef ALLSOL_SIMPLE_HPP
#define ALLSOL_SIMPLE_HPP
#include <iostream>
#include <list>
#include <kv/interval.hpp>
#include <kv/rdouble.hpp>
#include <kv/interval-vector.hpp>
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/io.hpp>
#include <kv/matrix-inversion.hpp>
#include <kv/autodif.hpp>
namespace kv {
namespace ub = boost::numeric::ublas;
namespace allsol_simple_sub {
// return index of I_i which has maximum width
template <class T> int search_maxwidth (const ub::vector< interval<T> >& I) {
int s = I.size();
int i, mi;
T m, tmp;
m = 0.;
for (i=0; i<s; i++) {
tmp = width(I(i));
if (tmp > m) {
m = tmp; mi = i;
}
}
return mi;
}
// return max width(I_i) / width(J_i)
template <class T> T widthratio_max (const ub::vector< interval<T> >& I, const ub::vector< interval<T> >& J) {
int s = I.size();
int i;
T tmp, r;
r = 0.;
for (i=0; i<s; i++) {
tmp = width(I(i)) / width(J(i));
if (tmp > r) r = tmp;
}
return r;
}
// return min width(I_i) / width(J_i)
template <class T> T widthratio_min (const ub::vector< interval<T> >& I, const ub::vector< interval<T> >& J) {
int s = I.size();
int i;
T tmp, r;
r = std::numeric_limits<T>::max();
for (i=0; i<s; i++) {
tmp = width(I(i)) / width(J(i));
if (tmp < r) r = tmp;
}
return r;
}
} // namespace allsol_simple_sub
// find all solution of f in I
template <class T, class F> std::list< ub::vector< interval<T> > >
allsol_simple (F f, const ub::vector< interval<T> >& I, int verbose=1)
{
std::list< ub::vector < interval<T> > > targets;
targets.push_back(I);
return allsol_list_simple(f, targets, verbose);
}
// find all solution of f in targets (list of intervals)
template <class T, class F> std::list< ub::vector< interval<T> > >
allsol_list_simple (F f, std::list< ub::vector< interval<T> > > targets, int verbose=1)
{
int s = (targets.front()).size();
ub::vector< interval<T> > I, fc, fi, C, CK, K, mvf, I1, I2;
ub::matrix< interval<T> > fdi, M;
ub::matrix<T> L, R, E;
std::list< ub::vector< interval<T> > > solutions, solutions_big;
typename std::list< ub::vector< interval<T> > >::iterator p, p2;
int i, j, k, mi;
T tmp;
bool r, flag, flag2;
int count_ne_test = 0;
int count_ex_test = 0;
int count_unknown = targets.size();
int count_ne = 0;
int count_ex = 0;
E = ub::identity_matrix<T>(s);
while (!targets.empty()) {
if (verbose >= 2) {
std::cout << "ne_test: " << count_ne_test << ", ex_test: " << count_ex_test << ", unknown: " << count_unknown << ", ne: " << count_ne << ", ex: " << count_ex << " \r" << std::flush;
}
I = targets.front();
targets.pop_front();
count_unknown--;
// non-existence test
count_ne_test++;
try {
fi = f(I);
}
catch (std::domain_error& e) {
goto label;
}
if (!zero_in(fi)) {
count_ne++;
continue;
}
C = mid(I);
try {
fc = f(C);
autodif< interval<T> >::split(f(autodif< interval<T> >::init(I)), fi, fdi);
}
catch (std::domain_error& e) {
goto label;
}
mvf = fc + prod(fdi, I - C);
if (!zero_in(mvf)) {
count_ne++;
continue;
}
// existence test
L = mid(fdi);
count_ex_test++;
r = invert(L, R);
if (!r) goto label;
M = E - prod(R, fdi);
CK = C - prod(R, fc);
K = CK + prod(M, I - C);
if (!overlap(K, I)) {
count_ne++;
continue;
}
if (proper_subset(K, I)) {
// check whether the solution is already found or not
flag = true;
p = solutions.begin();
p2 = solutions_big.begin();
while (p != solutions.end()) {
if (overlap(K, *p)) {
if (subset(K, *p2)||subset(*p, I)) {
flag = false;
break;
}
while (true) {
C = mid(K);
I1 = C - prod(R, f(C)) + prod(M, K - C);
K = intersect(K, I1);
if (subset(K, *p2)) {
flag2 = true;
break;
}
if (!overlap(K, *p)) {
flag2 = false;
break;
}
}
if (flag2 == true) {
flag = false;
break;
} else {
/* never reach? */
std::cout << "two overlap intervals includes different solutions";
}
}
p++;
p2++;
}
if (flag) { // new solution found
if (verbose >= 1) std::cout << I << "(ex)\n";
solutions_big.push_back(I);
// iterative refinement
while (1) {
C = mid(K);
I1 = C - prod(R, f(C)) + prod(M, K - C);
I1 = intersect(K, I1);
tmp = allsol_simple_sub::widthratio_min(I1, K);
K = I1;
if (tmp > 0.9) break;
}
solutions.push_back(K);
count_ex++;
if (verbose >= 1) std::cout << K << "(ex:improved)\n";
}
continue;
}
// check the case that solution may exist near boundary.
// If so, use K as next interval
if (allsol_simple_sub::widthratio_max(K, I) < 0.9) {
targets.push_back(K);
count_unknown++;
continue;
}
I = intersect(I, K);
label:
// divide interval
mi = allsol_simple_sub::search_maxwidth(I);
tmp = mid(I(mi));
if (tmp == I(mi).lower() || tmp == I(mi).upper()) {
std::cout << "too small interval (may be multiple root?):\n" << I << "\n";
continue;
}
I1 = I; I2 = I;
I1(mi).assign(I1(mi).lower(), tmp);
I2(mi).assign(tmp, I2(mi).upper());
targets.push_back(I1);
targets.push_back(I2);
count_unknown += 2;
}
if (verbose >= 1) {
std::cout << "ne_test: " << count_ne_test << ", ex_test: " << count_ex_test << ", ne: " << count_ne << ", ex: " << count_ex << " \n";
}
return solutions;
}
} // namespace kv
#endif // ALLSOL_SIMPLE_HPP
| 21.162879 | 187 | 0.569536 | [
"vector"
] |
e4e821dfe9adfdd59855c8990e32f76b08b407b1 | 1,826 | cpp | C++ | Training/51.msquare.cpp | felikjunvianto/kfile-usaco-submissions | d4afdc0cbde7e19f09afc70c4b02d4bc5992696d | [
"MIT"
] | null | null | null | Training/51.msquare.cpp | felikjunvianto/kfile-usaco-submissions | d4afdc0cbde7e19f09afc70c4b02d4bc5992696d | [
"MIT"
] | null | null | null | Training/51.msquare.cpp | felikjunvianto/kfile-usaco-submissions | d4afdc0cbde7e19f09afc70c4b02d4bc5992696d | [
"MIT"
] | null | null | null | /*
ID: felikju1
PROG: msquare
LANG: C++
*/
#include <cstdio>
#include <cmath>
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pi 2*acos(0.0)
#define eps 1e-9
#define PII pair<int,int>
#define PDD pair<double,double>
#define LL long long
using namespace std;
map<string,bool> vis;
string now,last,next,temp,ans;
int x,y,z;
queue<pair<string,string> > q;
int main()
{
freopen ("msquare.in","r",stdin);
freopen ("msquare.out","w",stdout);
last=ans="";
for(x=0;x<8;x++)
{
scanf("%d",&y);
last+=y+'0';
}
q.push(mp("12345678",""));
vis["12345678"]=true;
while(!q.empty())
{
now=q.front().fi;
temp=q.front().se;
q.pop();
if(now==last)
{
ans=temp;
break;
} else
{
//conf A
next=now;
reverse(next.begin(),next.end());
if(vis.find(next)==vis.end())
{
vis[next]=true;
q.push(mp(next,temp+'A'));
}
//conf B
next=now;
char c=next[3];
for(x=3;x>0;x--) next[x]=next[x-1];
next[0]=c;
c=next[4];
for(x=4;x<7;x++) next[x]=next[x+1];
next[7]=c;
if(vis.find(next)==vis.end())
{
vis[next]=true;
q.push(mp(next,temp+'B'));
}
//conf C
next=now;
swap(next[2],next[5]);
swap(next[2],next[6]);
swap(next[2],next[1]);
if(vis.find(next)==vis.end())
{
vis[next]=true;
q.push(mp(next,temp+'C'));
}
}
}
printf("%d\n",(int)ans.size());
for(x=0;x<ans.size();x++)
{
printf("%c",ans[x]);
if((x%60==59)&&(x+1<ans.size())) printf("\n");
}printf("\n");
fclose(stdin);
fclose(stdout);
return 0;
}
| 16.907407 | 49 | 0.531763 | [
"vector"
] |
e4f1e20733799db46e8eba7081e075d2b7efa89c | 21,125 | cpp | C++ | src/drivers/oreoled/oreoled.cpp | 3drobotics/PX4Firmware | b1cc118ef6408235abda896cc29f5c75ae256de4 | [
"BSD-3-Clause"
] | 30 | 2016-06-25T21:16:54.000Z | 2022-02-22T19:08:17.000Z | src/drivers/oreoled/oreoled.cpp | HackInvent/PX4Firmware | b1cc118ef6408235abda896cc29f5c75ae256de4 | [
"BSD-3-Clause"
] | null | null | null | src/drivers/oreoled/oreoled.cpp | HackInvent/PX4Firmware | b1cc118ef6408235abda896cc29f5c75ae256de4 | [
"BSD-3-Clause"
] | 23 | 2016-06-24T14:08:50.000Z | 2021-12-26T10:16:08.000Z | /****************************************************************************
*
* Copyright (C) 2012, 2013 PX4 Development Team. All rights reserved.
* Author: Randy Mackay <rmackay9@yahoo.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* @file oreoled.cpp
*
* Driver for oreoled ESCs found in solo, connected via I2C.
*
*/
#include <px4_config.h>
#include <drivers/device/i2c.h>
#include <drivers/drv_hrt.h>
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <nuttx/arch.h>
#include <nuttx/wqueue.h>
#include <nuttx/clock.h>
#include <systemlib/perf_counter.h>
#include <systemlib/err.h>
#include <systemlib/systemlib.h>
#include <board_config.h>
#include <drivers/drv_oreoled.h>
#include <drivers/device/ringbuffer.h>
#define OPEOLED_I2C_RETRYCOUNT 2 ///< i2c retry count
#define OREOLED_TIMEOUT_USEC 1000000U ///< timeout looking for oreoleds 1 second after startup
#define OREOLED_GENERALCALL_US 4000000U ///< general call sent every 4 seconds
#define OREOLED_GENERALCALL_CMD 0x00 ///< general call command sent at regular intervals
#define OREOLED_STARTUP_INTERVAL_US (1000000U / 10U) ///< time in microseconds, run at 10hz
#define OREOLED_UPDATE_INTERVAL_US (1000000U / 50U) ///< time in microseconds, run at 50hz
#define OREOLED_CMD_QUEUE_SIZE 10 ///< up to 10 messages can be queued up to send to the LEDs
/* magic number used to verify the software reset is valid */
#define OREOLED_RESET_NONCE 0x2A
class OREOLED : public device::I2C
{
public:
OREOLED(int bus, int i2c_addr);
virtual ~OREOLED();
virtual int init();
virtual int probe();
virtual int info();
virtual int ioctl(struct file *filp, int cmd, unsigned long arg);
/* send general call on I2C bus to syncronise all LEDs */
int send_general_call();
/* send cmd to an LEDs (used for testing only) */
int send_cmd(oreoled_cmd_t sb);
private:
/**
* Start periodic updates to the LEDs
*/
void start();
/**
* Stop periodic updates to the LEDs
*/
void stop();
/**
* static function that is called by worker queue
*/
static void cycle_trampoline(void *arg);
/**
* update the colours displayed by the LEDs
*/
void cycle();
void startup_discovery(void);
uint8_t cmd_add_checksum(oreoled_cmd_t *cmd);
/* internal variables */
work_s _work; ///< work queue for scheduling reads
bool _healthy[OREOLED_NUM_LEDS]; ///< health of each LED
uint8_t _num_healthy; ///< number of healthy LEDs
ringbuffer::RingBuffer *_cmd_queue; ///< buffer of commands to send to LEDs
uint64_t _last_gencall;
uint64_t _start_time; ///< system time we first attempt to communicate with battery
/* performance checking */
perf_counter_t _call_perf;
perf_counter_t _gcall_perf;
perf_counter_t _probe_perf;
perf_counter_t _comms_errors;
perf_counter_t _reply_errors;
};
/* for now, we only support one OREOLED */
namespace
{
OREOLED *g_oreoled = nullptr;
}
void oreoled_usage();
extern "C" __EXPORT int oreoled_main(int argc, char *argv[]);
/* constructor */
OREOLED::OREOLED(int bus, int i2c_addr) :
I2C("oreoled", OREOLED0_DEVICE_PATH, bus, i2c_addr, 100000),
_work{},
_num_healthy(0),
_cmd_queue(nullptr),
_last_gencall(0),
_call_perf(perf_alloc(PC_ELAPSED, "oreoled_call")),
_gcall_perf(perf_alloc(PC_ELAPSED, "oreoled_gcall")),
_probe_perf(perf_alloc(PC_ELAPSED, "oreoled_probe")),
_comms_errors(perf_alloc(PC_COUNT, "oreoled_comms_errors")),
_reply_errors(perf_alloc(PC_COUNT, "oreoled_reply_errors"))
{
/* initialise to unhealthy */
memset(_healthy, 0, sizeof(_healthy));
/* capture startup time */
_start_time = hrt_absolute_time();
}
/* destructor */
OREOLED::~OREOLED()
{
/* make sure we are truly inactive */
stop();
/* clear command queue */
if (_cmd_queue != nullptr) {
delete _cmd_queue;
}
/* free perf counters */
perf_free(_call_perf);
perf_free(_gcall_perf);
perf_free(_probe_perf);
perf_free(_comms_errors);
perf_free(_reply_errors);
}
int
OREOLED::init()
{
int ret;
/* initialise I2C bus */
ret = I2C::init();
if (ret != OK) {
return ret;
}
/* allocate command queue */
_cmd_queue = new ringbuffer::RingBuffer(OREOLED_CMD_QUEUE_SIZE, sizeof(oreoled_cmd_t));
if (_cmd_queue == nullptr) {
return ENOTTY;
} else {
/* start work queue */
start();
}
return OK;
}
int
OREOLED::probe()
{
/* set retry count */
_retries = OPEOLED_I2C_RETRYCOUNT;
/* always return true */
return OK;
}
int
OREOLED::info()
{
/* print health info on each LED */
for (uint8_t i = 0; i < OREOLED_NUM_LEDS; i++) {
if (!_healthy[i]) {
DEVICE_LOG("oreo %u: BAD", (unsigned)i);
} else {
DEVICE_LOG("oreo %u: OK", (unsigned)i);
}
}
/* display perf info */
perf_print_counter(_call_perf);
perf_print_counter(_gcall_perf);
perf_print_counter(_probe_perf);
perf_print_counter(_comms_errors);
perf_print_counter(_reply_errors);
return OK;
}
void
OREOLED::start()
{
/* schedule a cycle to start things */
work_queue(HPWORK, &_work, (worker_t)&OREOLED::cycle_trampoline, this, 1);
}
void
OREOLED::stop()
{
work_cancel(HPWORK, &_work);
}
void
OREOLED::cycle_trampoline(void *arg)
{
OREOLED *dev = (OREOLED *)arg;
/* check global oreoled and cycle */
if (g_oreoled != nullptr) {
dev->cycle();
}
}
void
OREOLED::cycle()
{
/* check time since startup */
uint64_t now = hrt_absolute_time();
bool startup_timeout = (now - _start_time > OREOLED_TIMEOUT_USEC);
/* during startup period keep searching for unhealthy LEDs */
if (!startup_timeout && _num_healthy < OREOLED_NUM_LEDS) {
startup_discovery();
/* schedule another attempt in 0.1 sec */
work_queue(HPWORK, &_work, (worker_t)&OREOLED::cycle_trampoline, this,
USEC2TICK(OREOLED_STARTUP_INTERVAL_US));
return;
}
/* get next command from queue */
oreoled_cmd_t next_cmd;
while (_cmd_queue->get(&next_cmd, sizeof(oreoled_cmd_t))) {
/* send valid messages to healthy LEDs */
if ((next_cmd.led_num < OREOLED_NUM_LEDS) && _healthy[next_cmd.led_num]
&& (next_cmd.num_bytes <= OREOLED_CMD_LENGTH_MAX)) {
/* start performance timer */
perf_begin(_call_perf);
/* set I2C address */
set_address(OREOLED_BASE_I2C_ADDR + next_cmd.led_num);
/* Calculate XOR checksum and append to the i2c write data */
uint8_t next_cmd_xor = cmd_add_checksum(&next_cmd);
/* send I2C command with a retry limit */
uint8_t reply[OREOLED_CMD_READ_LENGTH_MAX];
for (uint8_t retry = OEROLED_COMMAND_RETRIES; retry > 0; retry--) {
if (transfer(next_cmd.buff, next_cmd.num_bytes, reply, 3) == OK) {
if (!(reply[1] == (OREOLED_BASE_I2C_ADDR + next_cmd.led_num) && reply[2] == next_cmd_xor)) {
_healthy[next_cmd.led_num] = false;
_num_healthy--;
perf_count(_reply_errors);
}
} else {
_healthy[next_cmd.led_num] = false;
_num_healthy--;
perf_count(_comms_errors);
}
}
perf_end(_call_perf);
}
}
/* send general call every 4 seconds, if we aren't bootloading*/
if ((now - _last_gencall) > OREOLED_GENERALCALL_US) {
perf_begin(_gcall_perf);
send_general_call();
perf_end(_gcall_perf);
}
/* schedule a fresh cycle call when the command is sent */
work_queue(HPWORK, &_work, (worker_t)&OREOLED::cycle_trampoline, this,
USEC2TICK(OREOLED_UPDATE_INTERVAL_US));
}
void
OREOLED::startup_discovery(void)
{
oreoled_cmd_t cmd;
uint8_t reply[OREOLED_CMD_READ_LENGTH_MAX];
/* attempt to contact each unhealthy LED */
for (uint8_t i = 0; i < OREOLED_NUM_LEDS; i++) {
if (!_healthy[i]) {
perf_begin(_probe_perf);
/* prepare command to turn off LED */
cmd.led_num = i;
cmd.buff[0] = 0xAA;
cmd.buff[1] = 0x55;
cmd.buff[2] = OREOLED_PATTERN_OFF;
cmd.num_bytes = 3;
uint8_t cmd_checksum = cmd_add_checksum(&cmd);
/* set I2C address */
set_address(OREOLED_BASE_I2C_ADDR + cmd.led_num);
/* send I2C command */
if (transfer(cmd.buff, cmd.num_bytes, reply, 3) == OK) {
/* Check for a reply with a checksum offset of 1,
which indicates a response from firmwares >= 1.3 */
if (reply[1] == OREOLED_BASE_I2C_ADDR + cmd.led_num &&
reply[2] == (cmd_checksum + 1)) {
DEVICE_LOG("oreoled %u ok - in application", (unsigned)i);
_healthy[i] = true;
_num_healthy++;
} else {
warnx("startup response ADDR: 0x%x expected 0x%x", reply[1], cmd.led_num);
warnx("startup response CMD: 0x%x expected 0x%x", reply[2], (cmd_checksum + 1));
perf_count(_reply_errors);
}
} else {
perf_count(_comms_errors);
}
perf_end(_probe_perf);
}
}
}
uint8_t
OREOLED::cmd_add_checksum(oreoled_cmd_t *cmd)
{
/* Calculate XOR checksum and append to the command buffer */
cmd->num_bytes++;
uint8_t checksum_idx = cmd->num_bytes - 1;
/* XOR seed */
cmd->buff[checksum_idx] = OREOLED_BASE_I2C_ADDR + cmd->led_num;
/* XOR Calculation */
for (uint8_t i = 0; i < checksum_idx; i++) {
cmd->buff[checksum_idx] ^= cmd->buff[i];
}
return cmd->buff[checksum_idx];
}
int
OREOLED::ioctl(struct file *filp, int cmd, unsigned long arg)
{
int ret = -ENODEV;
oreoled_cmd_t new_cmd;
switch (cmd) {
case OREOLED_SET_RGB:
/* set the specified color */
new_cmd.led_num = ((oreoled_rgbset_t *) arg)->instance;
new_cmd.buff[0] = ((oreoled_rgbset_t *) arg)->pattern;
new_cmd.buff[1] = OREOLED_PARAM_BIAS_RED;
new_cmd.buff[2] = ((oreoled_rgbset_t *) arg)->red;
new_cmd.buff[3] = OREOLED_PARAM_BIAS_GREEN;
new_cmd.buff[4] = ((oreoled_rgbset_t *) arg)->green;
new_cmd.buff[5] = OREOLED_PARAM_BIAS_BLUE;
new_cmd.buff[6] = ((oreoled_rgbset_t *) arg)->blue;
new_cmd.num_bytes = 7;
/* special handling for request to set all instances rgb values */
if (new_cmd.led_num == OREOLED_ALL_INSTANCES) {
for (uint8_t i = 0; i < OREOLED_NUM_LEDS; i++) {
/* add command to queue for all healthy leds */
if (_healthy[i]) {
new_cmd.led_num = i;
_cmd_queue->force(&new_cmd);
ret = OK;
}
}
} else if (new_cmd.led_num < OREOLED_NUM_LEDS) {
/* request to set individual instance's rgb value */
if (_healthy[new_cmd.led_num]) {
_cmd_queue->force(&new_cmd);
ret = OK;
}
}
return ret;
case OREOLED_RUN_MACRO:
/* run a macro */
new_cmd.led_num = ((oreoled_macrorun_t *) arg)->instance;
new_cmd.buff[0] = OREOLED_PATTERN_PARAMUPDATE;
new_cmd.buff[1] = OREOLED_PARAM_MACRO;
new_cmd.buff[2] = ((oreoled_macrorun_t *) arg)->macro;
new_cmd.num_bytes = 3;
/* special handling for request to set all instances */
if (new_cmd.led_num == OREOLED_ALL_INSTANCES) {
for (uint8_t i = 0; i < OREOLED_NUM_LEDS; i++) {
/* add command to queue for all healthy leds */
if (_healthy[i]) {
new_cmd.led_num = i;
_cmd_queue->force(&new_cmd);
ret = OK;
}
}
} else if (new_cmd.led_num < OREOLED_NUM_LEDS) {
/* request to set individual instance's rgb value */
if (_healthy[new_cmd.led_num]) {
_cmd_queue->force(&new_cmd);
ret = OK;
}
}
return ret;
case OREOLED_SEND_RESET:
/* send a reset */
new_cmd.led_num = OREOLED_ALL_INSTANCES;
new_cmd.buff[0] = OREOLED_PATTERN_PARAMUPDATE;
new_cmd.buff[1] = OREOLED_PARAM_RESET;
new_cmd.buff[2] = OREOLED_RESET_NONCE;
new_cmd.num_bytes = 3;
for (uint8_t i = 0; i < OREOLED_NUM_LEDS; i++) {
/* add command to queue for all healthy leds */
if (_healthy[i]) {
new_cmd.led_num = i;
_cmd_queue->force(&new_cmd);
ret = OK;
}
}
return ret;
case OREOLED_SEND_BYTES:
/* send bytes */
new_cmd = *((oreoled_cmd_t *) arg);
/* special handling for request to set all instances */
if (new_cmd.led_num == OREOLED_ALL_INSTANCES) {
for (uint8_t i = 0; i < OREOLED_NUM_LEDS; i++) {
/* add command to queue for all healthy leds */
if (_healthy[i]) {
new_cmd.led_num = i;
_cmd_queue->force(&new_cmd);
ret = OK;
}
}
} else if (new_cmd.led_num < OREOLED_NUM_LEDS) {
/* request to set individual instance's rgb value */
if (_healthy[new_cmd.led_num]) {
_cmd_queue->force(&new_cmd);
ret = OK;
}
}
return ret;
case OREOLED_FORCE_SYNC:
send_general_call();
break;
default:
/* see if the parent class can make any use of it */
ret = CDev::ioctl(filp, cmd, arg);
break;
}
return ret;
}
/* send general call on I2C bus to syncronise all LEDs */
int
OREOLED::send_general_call()
{
int ret = -ENODEV;
/* set I2C address to zero */
set_address(0);
/* prepare command : 0x01 = general hardware call, 0x00 = I2C address of master (but we don't act as a slave so set to zero)*/
uint8_t msg[] = {0x01, 0x00};
/* send I2C command */
if (transfer(msg, sizeof(msg), nullptr, 0) == OK) {
ret = OK;
}
/* record time */
_last_gencall = hrt_absolute_time();
return ret;
}
/* send a cmd to an LEDs (used for testing only) */
int
OREOLED::send_cmd(oreoled_cmd_t new_cmd)
{
int ret = -ENODEV;
/* sanity check led number, health and cmd length */
if ((new_cmd.led_num < OREOLED_NUM_LEDS) && _healthy[new_cmd.led_num] && (new_cmd.num_bytes < OREOLED_CMD_LENGTH_MAX)) {
/* set I2C address */
set_address(OREOLED_BASE_I2C_ADDR + new_cmd.led_num);
/* add to queue */
_cmd_queue->force(&new_cmd);
ret = OK;
}
return ret;
}
void
oreoled_usage()
{
warnx("missing command: try 'start', 'test', 'info', 'off', 'stop', 'reset', 'rgb 30 40 50', 'macro 4', 'gencall', 'bytes <lednum> 7 9 6'");
warnx("options:");
warnx(" -b i2cbus (%d)", PX4_I2C_BUS_LED);
warnx(" -a addr (0x%x)", OREOLED_BASE_I2C_ADDR);
}
int
oreoled_main(int argc, char *argv[])
{
int i2cdevice = -1;
int i2c_addr = OREOLED_BASE_I2C_ADDR; /* 7bit */
int ch;
/* jump over start/off/etc and look at options first */
while ((ch = getopt(argc, argv, "a:b:")) != EOF) {
switch (ch) {
case 'a':
i2c_addr = (int)strtol(optarg, NULL, 0);
break;
case 'b':
i2cdevice = (int)strtol(optarg, NULL, 0);
break;
default:
oreoled_usage();
return 0;
}
}
if (optind >= argc) {
oreoled_usage();
return 1;
}
const char *verb = argv[optind];
int ret;
/* start driver */
if (!strcmp(verb, "start")) {
if (g_oreoled != nullptr) {
errx(1, "already started");
}
/* by default use LED bus */
if (i2cdevice == -1) {
i2cdevice = PX4_I2C_BUS_LED;
}
/* instantiate driver */
g_oreoled = new OREOLED(i2cdevice, i2c_addr);
/* check if object was created */
if (g_oreoled == nullptr) {
errx(1, "failed to allocated memory for driver");
}
/* check object was created successfully */
if (g_oreoled->init() != OK) {
delete g_oreoled;
g_oreoled = nullptr;
errx(1, "failed to start driver");
}
return 0;
}
/* need the driver past this point */
if (g_oreoled == nullptr) {
warnx("not started");
oreoled_usage();
return 1;
}
if (!strcmp(verb, "test")) {
int fd = open(OREOLED0_DEVICE_PATH, O_RDWR);
if (fd == -1) {
errx(1, "Unable to open " OREOLED0_DEVICE_PATH);
}
/* structure to hold desired colour */
oreoled_rgbset_t rgb_set_red = {OREOLED_ALL_INSTANCES, OREOLED_PATTERN_SOLID, 0xFF, 0x0, 0x0};
oreoled_rgbset_t rgb_set_blue = {OREOLED_ALL_INSTANCES, OREOLED_PATTERN_SOLID, 0x0, 0x0, 0xFF};
oreoled_rgbset_t rgb_set_off = {OREOLED_ALL_INSTANCES, OREOLED_PATTERN_OFF, 0x0, 0x0, 0x0};
/* flash red and blue for 3 seconds */
for (uint8_t i = 0; i < 30; i++) {
/* red */
if ((ret = ioctl(fd, OREOLED_SET_RGB, (unsigned long)&rgb_set_red)) != OK) {
errx(1, " failed to update rgb");
}
/* sleep for 0.05 seconds */
usleep(50000);
/* blue */
if ((ret = ioctl(fd, OREOLED_SET_RGB, (unsigned long)&rgb_set_blue)) != OK) {
errx(1, " failed to update rgb");
}
/* sleep for 0.05 seconds */
usleep(50000);
}
/* turn off LED */
if ((ret = ioctl(fd, OREOLED_SET_RGB, (unsigned long)&rgb_set_off)) != OK) {
errx(1, " failed to turn off led");
}
close(fd);
return ret;
}
/* display driver status */
if (!strcmp(verb, "info")) {
g_oreoled->info();
return 0;
}
if (!strcmp(verb, "off") || !strcmp(verb, "stop")) {
int fd = open(OREOLED0_DEVICE_PATH, 0);
if (fd == -1) {
errx(1, "Unable to open " OREOLED0_DEVICE_PATH);
}
/* turn off LED */
oreoled_rgbset_t rgb_set_off = {OREOLED_ALL_INSTANCES, OREOLED_PATTERN_OFF, 0x0, 0x0, 0x0};
ret = ioctl(fd, OREOLED_SET_RGB, (unsigned long)&rgb_set_off);
close(fd);
/* delete the oreoled object if stop was requested, in addition to turning off the LED. */
if (!strcmp(verb, "stop")) {
OREOLED *tmp_oreoled = g_oreoled;
g_oreoled = nullptr;
delete tmp_oreoled;
return 0;
}
return ret;
}
/* send rgb request to all LEDS */
if (!strcmp(verb, "rgb")) {
if (argc < 5) {
errx(1, "Usage: oreoled rgb <red> <green> <blue>");
}
int fd = open(OREOLED0_DEVICE_PATH, 0);
if (fd == -1) {
errx(1, "Unable to open " OREOLED0_DEVICE_PATH);
}
uint8_t red = (uint8_t)strtol(argv[2], NULL, 0);
uint8_t green = (uint8_t)strtol(argv[3], NULL, 0);
uint8_t blue = (uint8_t)strtol(argv[4], NULL, 0);
oreoled_rgbset_t rgb_set = {OREOLED_ALL_INSTANCES, OREOLED_PATTERN_SOLID, red, green, blue};
if ((ret = ioctl(fd, OREOLED_SET_RGB, (unsigned long)&rgb_set)) != OK) {
errx(1, "failed to set rgb");
}
close(fd);
return ret;
}
/* send macro request to all LEDS */
if (!strcmp(verb, "macro")) {
if (argc < 3) {
errx(1, "Usage: oreoled macro <macro_num>");
}
int fd = open(OREOLED0_DEVICE_PATH, 0);
if (fd == -1) {
errx(1, "Unable to open " OREOLED0_DEVICE_PATH);
}
uint8_t macro = (uint8_t)strtol(argv[2], NULL, 0);
/* sanity check macro number */
if (macro > OREOLED_PARAM_MACRO_ENUM_COUNT) {
errx(1, "invalid macro number %d", (int)macro);
return ret;
}
oreoled_macrorun_t macro_run = {OREOLED_ALL_INSTANCES, (enum oreoled_macro)macro};
if ((ret = ioctl(fd, OREOLED_RUN_MACRO, (unsigned long)¯o_run)) != OK) {
errx(1, "failed to run macro");
}
close(fd);
return ret;
}
/* send reset request to all LEDS */
if (!strcmp(verb, "reset")) {
if (argc < 2) {
errx(1, "Usage: oreoled reset");
}
int fd = open(OREOLED0_DEVICE_PATH, 0);
if (fd == -1) {
errx(1, "Unable to open " OREOLED0_DEVICE_PATH);
}
if ((ret = ioctl(fd, OREOLED_SEND_RESET, 0)) != OK) {
errx(1, "failed to run macro");
}
close(fd);
return ret;
}
/* send general hardware call to all LEDS */
if (!strcmp(verb, "gencall")) {
ret = g_oreoled->send_general_call();
warnx("sent general call");
return ret;
}
/* send a string of bytes to an LED using send_bytes function */
if (!strcmp(verb, "bytes")) {
if (argc < 3) {
errx(1, "Usage: oreoled bytes <led_num> <byte1> <byte2> <byte3> ...");
}
/* structure to be sent */
oreoled_cmd_t sendb;
/* maximum of 20 bytes can be sent */
if (argc > 20 + 3) {
errx(1, "Max of 20 bytes can be sent");
}
/* check led num */
sendb.led_num = (uint8_t)strtol(argv[optind + 1], NULL, 0);
if (sendb.led_num > 3) {
errx(1, "led number must be between 0 ~ 3");
}
/* get bytes */
sendb.num_bytes = argc - (optind + 2);
uint8_t byte_count;
for (byte_count = 0; byte_count < sendb.num_bytes; byte_count++) {
sendb.buff[byte_count] = (uint8_t)strtol(argv[byte_count + optind + 2], NULL, 0);
}
/* send bytes */
if ((ret = g_oreoled->send_cmd(sendb)) != OK) {
errx(1, "failed to send command");
} else {
warnx("sent %d bytes", (int)sendb.num_bytes);
}
return ret;
}
oreoled_usage();
return 0;
}
| 25.059312 | 141 | 0.663195 | [
"object"
] |
e4f2363ea4e9cde7aaeccf956ec052e957209b30 | 3,440 | cc | C++ | tests/test_itertools.cc | gerrymanoim/libpy | ffe19d53aa9602893aecc2dd8c9feda90e06b262 | [
"Apache-2.0"
] | 71 | 2020-06-26T00:36:33.000Z | 2021-12-02T13:57:02.000Z | tests/test_itertools.cc | stefan-jansen/libpy | e174ee103db76a9d0fcd29165d54c676ed1f2629 | [
"Apache-2.0"
] | 32 | 2020-06-26T18:59:15.000Z | 2022-03-01T19:02:44.000Z | tests/test_itertools.cc | gerrymanoim/libpy | ffe19d53aa9602893aecc2dd8c9feda90e06b262 | [
"Apache-2.0"
] | 24 | 2020-06-26T17:01:57.000Z | 2022-02-15T00:25:27.000Z | #include <algorithm>
#include <vector>
#include "gtest/gtest.h"
#include "libpy/itertools.h"
namespace test_itertools {
TEST(zip, mismatched_sizes) {
std::vector<int> as(10);
std::vector<int> bs(5);
EXPECT_THROW(py::zip(as, bs), std::invalid_argument);
}
TEST(zip, const_iterator) {
std::size_t size = 10;
int counter = 0;
std::vector<int> as(size);
std::vector<int> bs(size);
std::vector<int> cs(size);
auto gen = [&counter]() { return counter++; };
std::generate(as.begin(), as.end(), gen);
std::generate(bs.begin(), bs.end(), gen);
std::generate(cs.begin(), cs.end(), gen);
std::size_t ix = 0;
for (const auto [a, b, c] : py::zip(as, bs, cs)) {
EXPECT_EQ(a, as[ix]);
EXPECT_EQ(b, bs[ix]);
EXPECT_EQ(c, cs[ix]);
++ix;
}
EXPECT_EQ(ix, size);
}
TEST(zip, mutable_iterator) {
std::size_t size = 10;
int counter = 0;
std::vector<int> as(size);
std::vector<int> bs(size);
std::vector<int> cs(size);
auto gen = [&counter]() { return counter++; };
std::generate(as.begin(), as.end(), gen);
std::generate(bs.begin(), bs.end(), gen);
std::generate(cs.begin(), cs.end(), gen);
std::vector<int> as_original = as;
std::vector<int> bs_original = bs;
std::vector<int> cs_original = cs;
std::size_t ix = 0;
for (auto [a, b, c] : py::zip(as, bs, cs)) {
EXPECT_EQ(a, as[ix]);
EXPECT_EQ(b, bs[ix]);
EXPECT_EQ(c, cs[ix]);
a = -a;
b = -b;
c = -c;
++ix;
}
EXPECT_EQ(ix, size);
for (std::size_t ix = 0; ix < size; ++ix) {
EXPECT_EQ(as[ix], -as_original[ix]);
EXPECT_EQ(bs[ix], -bs_original[ix]);
EXPECT_EQ(cs[ix], -cs_original[ix]);
}
}
TEST(imap, simple_iterator) {
std::vector<int> it = {0, 1, 2, 3, 4};
{
std::vector<int> expected = {0, 2, 4, 6, 8};
std::size_t ix = 0;
for (auto cs : py::imap([](auto i) { return i * 2; }, it)) {
EXPECT_EQ(cs, expected[ix++]);
}
}
{
std::vector<std::string> expected = {"0", "1", "2", "3", "4"};
std::size_t ix = 0;
for (auto cs : py::imap([](auto i) { return std::to_string(i); }, it)) {
EXPECT_EQ(cs, expected[ix++]);
}
}
{
std::vector<int> expected = {5, 6, 7, 8, 9};
int rhs = 5; // test mapping a closure
std::size_t ix = 0;
for (auto cs : py::imap([rhs](auto i) { return i + rhs; }, it)) {
EXPECT_EQ(cs, expected[ix++]);
}
}
}
TEST(imap, const_iterator) {
const std::vector<int> it = {0, 1, 2, 3, 4};
{
std::vector<int> expected = {0, 2, 4, 6, 8};
std::size_t ix = 0;
for (auto cs : py::imap([](auto i) { return i * 2; }, it)) {
EXPECT_EQ(cs, expected[ix++]);
}
}
{
std::vector<std::string> expected = {"0", "1", "2", "3", "4"};
std::size_t ix = 0;
for (auto cs : py::imap([](auto i) { return std::to_string(i); }, it)) {
EXPECT_EQ(cs, expected[ix++]);
}
}
{
std::vector<int> expected = {5, 6, 7, 8, 9};
int rhs = 5; // test mapping a closure
std::size_t ix = 0;
for (auto cs : py::imap([rhs](auto i) { return i + rhs; }, it)) {
EXPECT_EQ(cs, expected[ix++]);
}
}
}
} // namespace test_itertools
| 23.888889 | 80 | 0.49593 | [
"vector"
] |
e4fa101dc1319a4673aa300cbec01d510c29ea55 | 26,950 | cc | C++ | src/IndexletManager.cc | XinzeChi/RAMCloud | fdc56415ca3424b40522d534a77aef0bc4f95c2b | [
"0BSD"
] | null | null | null | src/IndexletManager.cc | XinzeChi/RAMCloud | fdc56415ca3424b40522d534a77aef0bc4f95c2b | [
"0BSD"
] | null | null | null | src/IndexletManager.cc | XinzeChi/RAMCloud | fdc56415ca3424b40522d534a77aef0bc4f95c2b | [
"0BSD"
] | 1 | 2021-05-24T12:32:33.000Z | 2021-05-24T12:32:33.000Z | /* Copyright (c) 2014-2015 Stanford University
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DISCLAIM ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL AUTHORS BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "Cycles.h"
#include "IndexletManager.h"
#include "StringUtil.h"
#include "Util.h"
#include "TimeTrace.h"
namespace RAMCloud {
IndexletManager::IndexletManager(Context* context, ObjectManager* objectManager)
: context(context)
, indexletMap()
, mutex()
, objectManager(objectManager)
{
}
///////////////////////////////////////////////////////////////////////////////
/////////////////////////// Meta-data related functions ///////////////////////
//////////////////////////////////// PUBLIC ///////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/**
* Add an indexlet (index partition) on this server.
* If this indexlet already exists, change state to given state if different.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param backingTableId
* Id of the backing table that will hold objects for this indexlet.
* \param firstKey
* Key blob marking the start of the indexed key range for this indexlet.
* \param firstKeyLength
* Number of bytes in firstKey.
* \param firstNotOwnedKey
* Blob of the smallest key in the given index that is after firstKey
* in the index order but not part of this indexlet.
* \param firstNotOwnedKeyLength
* Length of firstNotOwnedKey.
* \param state
* State of the indexlet, whether it is normal or recovering.
* \param nextNodeId
* The lowest node id that the next node allocated for this indexlet
* is allowed to have. This is used to ensure that we don't
* reuse existing node ids after crash recovery.
*
* \return
* True if indexlet was added, false if it already existed.
*
* \throw InternalError
* If indexlet cannot be added because the range overlaps with one or more
* existing indexlets.
*/
bool
IndexletManager::addIndexlet(
uint64_t tableId, uint8_t indexId, uint64_t backingTableId,
const void *firstKey, uint16_t firstKeyLength,
const void *firstNotOwnedKey, uint16_t firstNotOwnedKeyLength,
IndexletManager::Indexlet::State state, uint64_t nextNodeId)
{
Lock indexletMapLock(mutex);
IndexletMap::iterator it = getIndexlet(tableId, indexId,
firstKey, firstKeyLength, firstNotOwnedKey, firstNotOwnedKeyLength,
indexletMapLock);
if (it != indexletMap.end()) {
// This indexlet already exists.
LOG(NOTICE, "Adding indexlet in tableId %lu indexId %u, "
"but already own.", tableId, indexId);
Indexlet* indexlet = &it->second;
// If its state is different from that provided, change the state.
if (indexlet->state != state) {
LOG(NOTICE, "Changing state of this indexlet from %d to %d.",
indexlet->state, state);
indexlet->state = state;
}
LOG(NOTICE, "Returning success.");
return false;
} else {
// Add a new indexlet.
IndexBtree *bt;
if (nextNodeId == 0)
bt = new IndexBtree(backingTableId, objectManager);
else
bt = new IndexBtree(backingTableId, objectManager, nextNodeId);
indexletMap.insert(std::make_pair(TableAndIndexId{tableId, indexId},
Indexlet(firstKey, firstKeyLength, firstNotOwnedKey,
firstNotOwnedKeyLength, bt, state)));
return true;
}
}
/**
* Transition the state field associated with a given indexlet from a specific
* old state to a given new state. This is typically used when recovery has
* completed and a indexlet is changed from the RECOVERING to NORMAL state.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param firstKey
* Key blob marking the start of the indexed key range for this indexlet.
* \param firstKeyLength
* Length of firstKeyStr.
* \param firstNotOwnedKey
* Blob of the smallest key in the given index that is after firstKey
* in the index order but not part of this indexlet.
* \param firstNotOwnedKeyLength
* Length of firstNotOwnedKey.
* \param oldState
* The state the tablet is expected to be in prior to changing to the new
* value. This helps ensure that the proper transition is made, since
* another thread could modify the indexlet's state between getIndexlet()
* and changeState() calls.
* \param newState
* The state to transition the indexlet to.
*
* \return
* Returns true if the state was updated, otherwise false.
*
* \throw InternalError
* If indexlet was not found because the range overlaps
* with one or more existing indexlets.
*/
bool
IndexletManager::changeState(uint64_t tableId, uint8_t indexId,
const void *firstKey, uint16_t firstKeyLength,
const void *firstNotOwnedKey, uint16_t firstNotOwnedKeyLength,
IndexletManager::Indexlet::State oldState,
IndexletManager::Indexlet::State newState)
{
Lock indexletMapLock(mutex);
IndexletMap::iterator it = getIndexlet(tableId, indexId,
firstKey, firstKeyLength, firstNotOwnedKey, firstNotOwnedKeyLength,
indexletMapLock);
if (it == indexletMap.end()) {
return false;
}
Indexlet* indexlet = &it->second;
if (indexlet->state != oldState) {
return false;
}
indexlet->state = newState;
return true;
}
/**
* Delete an indexlet (stored on this server) and the entries stored in
* that indexlet.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param firstKey
* Key blob marking the start of the indexed key range for this indexlet.
* \param firstKeyLength
* Length of firstKeyStr.
* \param firstNotOwnedKey
* Blob of the smallest key in the given index that is after firstKey
* in the index order but not part of this indexlet.
* \param firstNotOwnedKeyLength
* Length of firstNotOwnedKey.
*
* \throw InternalError
* If indexlet was not found because the range overlaps
* with one or more existing indexlets.
*/
void
IndexletManager::deleteIndexlet(
uint64_t tableId, uint8_t indexId,
const void *firstKey, uint16_t firstKeyLength,
const void *firstNotOwnedKey, uint16_t firstNotOwnedKeyLength)
{
Lock indexletMapLock(mutex);
IndexletMap::iterator it = getIndexlet(tableId, indexId,
firstKey, firstKeyLength, firstNotOwnedKey, firstNotOwnedKeyLength,
indexletMapLock);
if (it == indexletMap.end()) {
RAMCLOUD_LOG(DEBUG, "Unknown indexlet in tableId %lu, indexId %u",
tableId, indexId);
} else {
delete (&it->second)->bt;
indexletMap.erase(it);
}
}
/**
* Given an index key, find the indexlet containing that entry.
* This is a helper for the public methods that need to look up a indexlet.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param key
* The secondary index key used to find a particular indexlet.
* \param keyLength
* Length of key.
*
* \return
* An Indexlet pointer to the indexlet for index indexId for table tableId
* that contains key, or NULL if no such indexlet could be found.
*/
IndexletManager::Indexlet*
IndexletManager::findIndexlet(uint64_t tableId, uint8_t indexId,
const void *key, uint16_t keyLength)
{
Lock indexletMapLock(mutex);
IndexletMap::iterator it =
findIndexlet(tableId, indexId, key, keyLength, indexletMapLock);
if (it == indexletMap.end()) {
return NULL;
}
return &it->second;
}
/**
* Obtain the total number of indexlets this object is managing.
*
* \return
* Total number of indexlets this object is managing.
*/
size_t
IndexletManager::getNumIndexlets()
{
Lock indexletMapLock(mutex);
return indexletMap.size();
}
/**
* Given a secondary key, check if an indexlet containing it exists.
* This function is used to determine whether the indexlet is owned by this
* instance of IndexletManager.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param key
* The secondary index key used to find a particular indexlet.
* \param keyLength
* Length of key blob.
*
* \return
* True if a indexlet was found, otherwise false.
*/
bool
IndexletManager::hasIndexlet(uint64_t tableId, uint8_t indexId,
const void *key, uint16_t keyLength)
{
Lock indexletMapLock(mutex);
IndexletMap::iterator it =
findIndexlet(tableId, indexId, key, keyLength, indexletMapLock);
if (it == indexletMap.end()) {
return false;
}
return true;
}
/**
* Given a RAMCloud key for an object encapsulating an indexlet tree node,
* check if it contains (or points to nodes containing) any entries whose
* key is greater than or equal to compareKey.
*
* \param treeNodeKey
* RAMCloud key for the object encapsulating an indexlet tree node.
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param compareKey
* The secondary index key (contained in index indexId for table tableId)
* to compare against.
* \param compareKeyLength
* Length of compareKey.
*
* \return
* True if treeNodeKey contains (or points to nodes containing)
* any entries whose key is greater than or equal to compareKey;
* false otherwise.
*/
bool
IndexletManager::isGreaterOrEqual(Key& treeNodeKey,
uint64_t tableId, uint8_t indexId,
const void* compareKey, uint16_t compareKeyLength)
{
Lock indexletMapLock(mutex);
IndexletMap::iterator it = findIndexlet(tableId, indexId,
compareKey, compareKeyLength, indexletMapLock);
if (it == indexletMap.end()) {
return false;
}
Indexlet* indexlet = &it->second;
return indexlet->bt->isGreaterOrEqual(treeNodeKey,
BtreeEntry{compareKey, compareKeyLength, 0UL});
}
/**
* For the indexlet containing truncateKey, modify metadata such that the
* firstNotOwnedKey of that indexlet is truncateKey.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param truncateKey
* The secondary index key used to find a particular indexlet and
* the key to which the firstNotOwnedKey of this indexlet will be set to.
* \param truncateKeyLength
* Length of truncateKey blob.
*/
void
IndexletManager::truncateIndexlet(uint64_t tableId, uint8_t indexId,
const void* truncateKey, uint16_t truncateKeyLength)
{
Lock indexletMapLock(mutex);
IndexletMap::iterator it = findIndexlet(tableId, indexId,
truncateKey, truncateKeyLength, indexletMapLock);
if (it == indexletMap.end()) {
RAMCLOUD_LOG(ERROR, "Given indexlet in tableId %lu, indexId %u "
"to be truncated doesn't exist anymore.", tableId, indexId);
throw InternalError(HERE, STATUS_INTERNAL_ERROR);
}
Indexlet* indexlet = &it->second;
indexlet->firstNotOwnedKeyLength = truncateKeyLength;
free(indexlet->firstNotOwnedKey);
indexlet->firstNotOwnedKey = malloc(truncateKeyLength);
memcpy(indexlet->firstNotOwnedKey, truncateKey, truncateKeyLength);
}
/**
* Given a secondary key, find the indexlet that contains it and set its
* nextNodeId to the given nextNodeId if the given nextNodeId is higher than
* the current nextNodeId. If there is no just indexlet, then the function
* does nothing.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param key
* The secondary index key used to find a particular indexlet.
* \param keyLength
* Length of key blob.
* \param nextNodeId
* The nextNodeId to set, if higher than current value.
*/
void
IndexletManager::setNextNodeIdIfHigher(uint64_t tableId, uint8_t indexId,
const void *key, uint16_t keyLength, uint64_t nextNodeId)
{
Lock indexletMapLock(mutex);
IndexletMap::iterator it = findIndexlet(tableId, indexId,
key, keyLength, indexletMapLock);
if (it == indexletMap.end()) {
return;
}
IndexletManager::Indexlet* indexlet = &it->second;
if (indexlet->bt->getNextNodeId() < nextNodeId)
(&it->second)->bt->setNextNodeId(nextNodeId);
}
///////////////////////////////////////////////////////////////////////////////
/////////////////////////// Meta-data related functions ///////////////////////
/////////////////////////////////// PRIVATE ///////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/**
* Given an index key, find the indexlet containing that entry.
* This is a helper for the public methods that need to look up a indexlet.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param key
* The secondary index key used to find a particular indexlet.
* \param keyLength
* Length of key.
* \param indexletMapLock
* This ensures that the caller holds this lock.
* \return
* An iterator to the indexlet for index indexId for table tableId
* that contains key, or indexletMap.end() if no such indexlet could be
* found.
*
* An iterator, rather than a Indexlet pointer is returned to facilitate
* efficient deletion.
*/
IndexletManager::IndexletMap::iterator
IndexletManager::findIndexlet(uint64_t tableId, uint8_t indexId,
const void *key, uint16_t keyLength, Lock& indexletMapLock)
{
// Must iterate over all of the local indexlets for the given index.
auto range = indexletMap.equal_range(TableAndIndexId {tableId, indexId});
IndexletMap::iterator start = range.first;
IndexletMap::iterator end = range.second;
// If key is NULL (and correspondingly, keyLength is 0), then return
// the indexlet with lowest firstKey.
if (keyLength == 0) {
IndexletMap::iterator lowestIter = start;
Indexlet* lowestIndexlet = &lowestIter->second;
for (IndexletMap::iterator it = start; it != end; it++) {
Indexlet* indexlet = &it->second;
if (IndexKey::keyCompare(
indexlet->firstKey, indexlet->firstKeyLength,
lowestIndexlet->firstKey,
lowestIndexlet->firstKeyLength) > 0) {
continue;
} else {
lowestIter = it;
lowestIndexlet = indexlet;
}
}
return lowestIter;
}
for (IndexletMap::iterator it = start; it != end; it++) {
Indexlet* indexlet = &it->second;
if (IndexKey::keyCompare(
indexlet->firstKey, indexlet->firstKeyLength,
key, keyLength) > 0) {
continue;
}
if (indexlet->firstNotOwnedKey != NULL &&
IndexKey::keyCompare(key, keyLength,
indexlet->firstNotOwnedKey,
indexlet->firstNotOwnedKeyLength) >= 0) {
continue;
}
return it;
}
return indexletMap.end();
}
/**
* Given the exact specification of a indexlet's range, obtain the current data
* associated with that indexlet, if it exists. Note that the data returned is a
* snapshot. The IndexletManager's data may be modified at any time by other
* threads.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param firstKey
* Key blob marking the start of the indexed key range for this indexlet.
* \param firstKeyLength
* Length of firstKeyStr.
* \param firstNotOwnedKey
* Blob of the smallest key in the given index that is after firstKey
* in the index order but not part of this indexlet.
* \param firstNotOwnedKeyLength
* Length of firstNotOwnedKey.
* \param indexletMapLock
* This ensures that the caller holds this lock.
*
* \return
* An iterator to the indexlet if the specified indexlet was found,
* indexletMap.end() if no such indexlet could be found.
*
* \throw InternalError
* If indexlet was not found because the range overlaps
* with one or more existing indexlets.
*/
IndexletManager::IndexletMap::iterator
IndexletManager::getIndexlet(uint64_t tableId, uint8_t indexId,
const void *firstKey, uint16_t firstKeyLength,
const void *firstNotOwnedKey, uint16_t firstNotOwnedKeyLength,
Lock& indexletMapLock)
{
// Must iterate over all of the local indexlets for the given index.
auto range = indexletMap.equal_range(TableAndIndexId {tableId, indexId});
IndexletMap::iterator end = range.second;
for (IndexletMap::iterator it = range.first; it != end; it++) {
Indexlet* indexlet = &it->second;
int firstKeyCompare = IndexKey::keyCompare(
firstKey, firstKeyLength,
indexlet->firstKey, indexlet->firstKeyLength);
int firstNotOwnedKeyCompare = IndexKey::keyCompare(
firstNotOwnedKey, firstNotOwnedKeyLength,
indexlet->firstNotOwnedKey,
indexlet->firstNotOwnedKeyLength);
if (firstKeyCompare == 0 && firstNotOwnedKeyCompare == 0) {
return it;
} else if ((firstKeyCompare < 0 && firstNotOwnedKeyCompare < 0) ||
(firstKeyCompare > 0 && firstNotOwnedKeyCompare > 0)) {
continue;
} else {
// Leaving the following in as it is useful for debugging.
// string givenFirstKey((const char*)firstKey, firstKeyLength);
// string givenFirstNotOwnedKey(
// (const char*)firstNotOwnedKey, firstNotOwnedKeyLength);
// string indexletFirstKey(
// (const char*)indexlet->firstKey, indexlet->firstKeyLength);
// string indexletFirstNotOwnedKey(
// (const char*)indexlet->firstNotOwnedKey,
// indexlet->firstNotOwnedKeyLength);
//
// RAMCLOUD_LOG(ERROR, "Given indexlet in tableId %lu, indexId %u "
// "with firstKey '%s' and firstNotOwnedKey '%s' "
// "overlaps with indexlet with "
// "firstKey '%s' and firstNotOwnedKey '%s'.",
// tableId, indexId,
// givenFirstKey.c_str(), givenFirstNotOwnedKey.c_str(),
// indexletFirstKey.c_str(), indexletFirstNotOwnedKey.c_str());
RAMCLOUD_LOG(ERROR, "Given indexlet in tableId %lu, indexId %u "
"overlaps with one or more other ranges.",
tableId, indexId);
throw InternalError(HERE, STATUS_INTERNAL_ERROR);
}
}
return indexletMap.end();
}
///////////////////////////////////////////////////////////////////////////////
////////////////////////// Index data related functions ///////////////////////
///////////////////////////////////////////////////////////////////////////////
/**
* Insert index entry for an object for a given index id.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param key
* Key blob for for the index entry.
* \param keyLength
* Length of key.
* \param pKHash
* Hash of the primary key of the object.
* \return
* Returns STATUS_OK if the insert succeeded.
* Returns STATUS_UNKNOWN_INDEXLET if the server does not own an indexlet
* that could contain this index entry.
*/
Status
IndexletManager::insertEntry(uint64_t tableId, uint8_t indexId,
const void* key, KeyLength keyLength, uint64_t pKHash)
{
Lock indexletMapLock(mutex);
RAMCLOUD_LOG(DEBUG, "Inserting: tableId %lu, indexId %u, hash %lu,\n"
"key: %s", tableId, indexId, pKHash,
Util::hexDump(key, keyLength).c_str());
IndexletMap::iterator it =
findIndexlet(tableId, indexId, key, keyLength, indexletMapLock);
if (it == indexletMap.end()) {
RAMCLOUD_LOG(DEBUG, "Unknown indexlet: tableId %lu, indexId %u, "
"hash %lu,\nkey: %s", tableId, indexId, pKHash,
Util::hexDump(key, keyLength).c_str());
return STATUS_UNKNOWN_INDEXLET;
}
Indexlet* indexlet = &it->second;
Lock indexletLock(indexlet->indexletMutex);
indexletMapLock.unlock();
BtreeEntry entry = BtreeEntry(key, keyLength, pKHash);
indexlet->bt->insert(entry);
return STATUS_OK;
}
/**
* Handle LOOKUP_INDEX_KEYS request.
*
* \copydetails Service::ping
*/
void
IndexletManager::lookupIndexKeys(
const WireFormat::LookupIndexKeys::Request* reqHdr,
WireFormat::LookupIndexKeys::Response* respHdr,
Service::Rpc* rpc)
{
Lock indexletMapLock(mutex);
uint32_t reqOffset = sizeof32(*reqHdr);
uint16_t firstKeyLength = reqHdr->firstKeyLength;
uint16_t lastKeyLength = reqHdr->lastKeyLength;
const void* firstKey =
rpc->requestPayload->getRange(reqOffset, firstKeyLength);
reqOffset += firstKeyLength;
const void* lastKey =
rpc->requestPayload->getRange(reqOffset, lastKeyLength);
if ((firstKey == NULL && firstKeyLength > 0) ||
(lastKey == NULL && lastKeyLength > 0)) {
respHdr->common.status = STATUS_REQUEST_FORMAT_ERROR;
rpc->sendReply();
return;
}
RAMCLOUD_LOG(DEBUG, "Looking up: tableId %lu, indexId %u.\n"
"first key: %s\n last key: %s\n",
reqHdr->tableId, reqHdr->indexId,
Util::hexDump(firstKey, firstKeyLength).c_str(),
Util::hexDump(lastKey, lastKeyLength).c_str());
IndexletMap::iterator mapIter =
findIndexlet(reqHdr->tableId, reqHdr->indexId, firstKey,
firstKeyLength, indexletMapLock);
if (mapIter == indexletMap.end()) {
respHdr->common.status = STATUS_UNKNOWN_INDEXLET;
}
Indexlet* indexlet = &mapIter->second;
Lock indexletLock(indexlet->indexletMutex);
indexletMapLock.unlock();
// We want to use lower_bound() instead of find() because the firstKey
// may not correspond to a key in the indexlet.
auto iter = indexlet->bt->lower_bound(BtreeEntry {
firstKey, firstKeyLength, reqHdr->firstAllowedKeyHash});
auto iterEnd = indexlet->bt->end();
bool rpcMaxedOut = false;
respHdr->numHashes = 0;
while (iter != iterEnd) {
BtreeEntry currEntry = *iter;
// If we have overshot the range to be returned (indicated by lastKey),
// then break. Otherwise continue appending entries to response rpc.
if (IndexKey::keyCompare(currEntry.key, currEntry.keyLength,
lastKey, lastKeyLength) > 0)
{
break;
}
if (respHdr->numHashes < reqHdr->maxNumHashes) {
// Can alternatively use iter.data() instead of iter.key().pKHash,
// but we might want to make data NULL in the future, so might
// as well use the pKHash from key right away.
rpc->replyPayload->emplaceAppend<uint64_t>(currEntry.pKHash);
respHdr->numHashes += 1;
++iter;
} else {
rpcMaxedOut = true;
break;
}
}
if (rpcMaxedOut) {
respHdr->nextKeyLength = uint16_t(iter->keyLength);
respHdr->nextKeyHash = iter->pKHash;
rpc->replyPayload->append(iter->key, uint32_t(iter->keyLength));
} else if (IndexKey::keyCompare(
lastKey, lastKeyLength,
indexlet->firstNotOwnedKey, indexlet->firstNotOwnedKeyLength) > 0) {
respHdr->nextKeyLength = indexlet->firstNotOwnedKeyLength;
respHdr->nextKeyHash = 0;
rpc->replyPayload->append(indexlet->firstNotOwnedKey,
indexlet->firstNotOwnedKeyLength);
} else {
respHdr->nextKeyHash = 0;
respHdr->nextKeyLength = 0;
}
respHdr->common.status = STATUS_OK;
}
/**
* Remove index entry for an object for a given index id.
*
* \param tableId
* Id for a particular table.
* \param indexId
* Id for a particular secondary index associated with tableId.
* \param key
* Key blob for for the index entry.
* \param keyLength
* Length of key.
* \param pKHash
* Hash of the primary key of the object.
*
* \return
* Returns STATUS_OK if the remove succeeded or if the entry did not
* exist.
* Returns STATUS_UNKNOWN_INDEXLET if the server does not own an indexlet
* containing this index entry.
*/
Status
IndexletManager::removeEntry(uint64_t tableId, uint8_t indexId,
const void* key, KeyLength keyLength, uint64_t pKHash)
{
Lock indexletMapLock(mutex);
RAMCLOUD_LOG(DEBUG, "Removing: tableId %lu, indexId %u, hash %lu,\n"
"key: %s", tableId, indexId, pKHash,
Util::hexDump(key, keyLength).c_str());
IndexletMap::iterator it =
findIndexlet(tableId, indexId, key, keyLength, indexletMapLock);
if (it == indexletMap.end())
return STATUS_UNKNOWN_INDEXLET;
Indexlet* indexlet = &it->second;
Lock indexletLock(indexlet->indexletMutex);
indexletMapLock.unlock();
// Note that we don't have to explicitly compare the key hash in value
// since it is also a part of the key that gets compared in the tree
// module.
indexlet->bt->erase(BtreeEntry {key, keyLength, pKHash});
return STATUS_OK;
}
} //namespace
| 35.045514 | 80 | 0.640965 | [
"object"
] |
e4fd93ee44e01f76ec6bb3448cd57b52dac3dfba | 3,555 | cpp | C++ | GraphicsMagick.NET/Profiles/8Bim/EightBimValue.cpp | dlemstra/GraphicsMagick.NET | 332718f2315c3752eaeb84f4a6a30a553441e79e | [
"ImageMagick",
"Apache-2.0"
] | 35 | 2015-10-18T19:49:52.000Z | 2022-01-18T05:30:46.000Z | GraphicsMagick.NET/Profiles/8Bim/EightBimValue.cpp | elyor0529/GraphicsMagick.NET | 332718f2315c3752eaeb84f4a6a30a553441e79e | [
"ImageMagick",
"Apache-2.0"
] | 12 | 2016-07-22T16:05:03.000Z | 2020-02-26T15:21:03.000Z | GraphicsMagick.NET/Profiles/8Bim/EightBimValue.cpp | elyor0529/GraphicsMagick.NET | 332718f2315c3752eaeb84f4a6a30a553441e79e | [
"ImageMagick",
"Apache-2.0"
] | 12 | 2016-02-24T12:11:50.000Z | 2021-07-12T18:20:12.000Z | //=================================================================================================
// Copyright 2014-2015 Dirk Lemstra <https://graphicsmagick.codeplex.com/>
//
// Licensed under the ImageMagick License (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.imagemagick.org/script/license.php
//
// Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
// express or implied. See the License for the specific language governing permissions and
// limitations under the License.
//=================================================================================================
#include "Stdafx.h"
#include "EightBimValue.h"
using namespace System::Globalization;
using namespace System::Text;
namespace GraphicsMagick
{
//==============================================================================================
EightBimValue::EightBimValue(short ID, array<Byte>^ data)
{
_ID = ID;
_Data = data;
}
//==============================================================================================
short EightBimValue::ID::get()
{
return _ID;
}
//==============================================================================================
bool EightBimValue::operator == (EightBimValue^ left, EightBimValue^ right)
{
return Object::Equals(left, right);
}
//==============================================================================================
bool EightBimValue::operator != (EightBimValue^ left, EightBimValue^ right)
{
return !Object::Equals(left, right);
}
//==============================================================================================
bool EightBimValue::Equals(Object^ obj)
{
if (ReferenceEquals(this, obj))
return true;
return Equals(dynamic_cast<EightBimValue^>(obj));
}
//==============================================================================================
bool EightBimValue::Equals(EightBimValue^ other)
{
if (ReferenceEquals(other, nullptr))
return false;
if (ReferenceEquals(this, other))
return true;
if (_ID != other->_ID)
return false;
if (_Data->Length != other->_Data->Length)
return false;
for (int i=0; i<_Data->Length; i++)
{
if (_Data[i] != other->_Data[i])
return false;
}
return true;
}
//==============================================================================================
int EightBimValue::GetHashCode()
{
return _ID.GetHashCode() ^ _Data->GetHashCode();
}
//==============================================================================================
array<Byte>^ EightBimValue::ToByteArray()
{
array<Byte>^ data = gcnew array<Byte>(_Data->Length);
Array::Copy(_Data, 0, data, 0, _Data->Length);
return data;
}
//==============================================================================================
String^ EightBimValue::ToString()
{
return ToString(Encoding::UTF8);
}
//==============================================================================================
String^ EightBimValue::ToString(System::Text::Encoding^ encoding)
{
Throw::IfNull("encoding", encoding);
return encoding->GetString(_Data);
}
//==============================================================================================
} | 35.909091 | 100 | 0.432911 | [
"object"
] |
e4fe1fa82191ed052188488cc71dd761b0557b39 | 34,613 | hpp | C++ | include/afsm/detail/transitions.hpp | galek/afsm | 49181bf52fa2ab8bcea6017d11b3cd321b56c13c | [
"Artistic-2.0"
] | 133 | 2016-11-20T18:23:09.000Z | 2022-03-28T07:25:04.000Z | include/afsm/detail/transitions.hpp | galek/afsm | 49181bf52fa2ab8bcea6017d11b3cd321b56c13c | [
"Artistic-2.0"
] | 24 | 2016-11-14T17:13:50.000Z | 2021-08-31T15:48:48.000Z | include/afsm/detail/transitions.hpp | galek/afsm | 49181bf52fa2ab8bcea6017d11b3cd321b56c13c | [
"Artistic-2.0"
] | 24 | 2019-02-06T22:13:42.000Z | 2022-01-20T05:42:52.000Z | /*
* transitions.hpp
*
* Created on: 29 мая 2016 г.
* Author: sergey.fedorov
*/
#ifndef AFSM_DETAIL_TRANSITIONS_HPP_
#define AFSM_DETAIL_TRANSITIONS_HPP_
#include <afsm/detail/actions.hpp>
#include <afsm/detail/exception_safety_guarantees.hpp>
#include <afsm/detail/event_identity.hpp>
#include <deque>
#include <memory>
#include <algorithm>
#include <iostream>
namespace afsm {
namespace transitions {
namespace detail {
enum class event_handle_type {
none,
transition,
internal_transition,
inner_state,
};
template <event_handle_type V>
using handle_event = ::std::integral_constant<event_handle_type, V>;
template < typename FSM, typename Event >
struct event_handle_selector
: ::std::conditional<
(::psst::meta::find_if<
def::handles_event<Event>::template type,
typename FSM::transitions >::type::size > 0),
handle_event< event_handle_type::transition >,
typename ::std::conditional<
(::psst::meta::find_if<
def::handles_event<Event>::template type,
typename FSM::internal_transitions >::type::size > 0),
handle_event< event_handle_type::internal_transition >,
handle_event< event_handle_type::inner_state >
>::type
>::type{};
template <typename SourceState, typename Event, typename Transition>
struct transits_on_event
: ::std::conditional<
!def::traits::is_internal_transition<Transition>::value &&
::std::is_same< typename Transition::source_state_type, SourceState >::value &&
::std::is_same< typename Transition::event_type, Event >::value,
::std::true_type,
::std::false_type
>::type {};
template < typename State, typename FSM, typename Event >
struct has_on_exit {
private:
static FSM& fsm;
static Event const& event;
template < typename U >
static ::std::true_type
test( decltype( ::std::declval<U>().on_exit(event, fsm) ) const* );
template < typename U >
static ::std::false_type
test(...);
public:
static constexpr bool value = decltype( test<State>(nullptr) )::value;
};
template < typename State, typename FSM, typename Event >
struct has_on_enter {
private:
static FSM& fsm;
static Event& event;
template < typename U >
static ::std::true_type
test( decltype( ::std::declval<U>().on_enter(::std::move(event), fsm) ) const* );
template < typename U >
static ::std::false_type
test(...);
public:
static constexpr bool value = decltype( test<State>(nullptr) )::value;
};
template < typename Activity, typename FSM, typename State >
struct activity_has_start {
private:
static FSM& fsm;
static State& state;
template < typename U >
static ::std::true_type
test( decltype( ::std::declval<U>().start(fsm, state) ) const* );
template < typename U >
static ::std::false_type
test(...);
public:
static constexpr bool value = decltype( test<Activity>(nullptr) )::value;
};
template < typename Activity, typename FSM, typename State >
struct activity_has_stop {
private:
static FSM& fsm;
static State& state;
template < typename U >
static ::std::true_type
test( decltype( ::std::declval<U>().stop(fsm, state) ) const* );
template < typename U >
static ::std::false_type
test(...);
public:
static constexpr bool value = decltype( test<Activity>(nullptr) )::value;
};
template < typename Activity, typename FSM, typename State >
struct is_valid_activity {
static constexpr bool value = activity_has_start<Activity, FSM, State>::value
&& activity_has_stop<Activity, FSM, State>::value;
};
template < typename FSM, typename State >
struct is_valid_activity < void, FSM, State >{
static constexpr bool value = true;
};
template < typename FSM, typename State, typename Event, bool hasExit >
struct state_exit_impl {
void
operator()(State& state, Event const& event, FSM& fsm) const
{
state.state_exit(event, fsm);
state.on_exit(event, fsm);
}
};
template < typename FSM, typename State, typename Event >
struct state_exit_impl< FSM, State, Event, false > {
void
operator()(State& state, Event const& event, FSM& fsm) const
{
state.state_exit(event, fsm);
}
};
// TODO Parameter to allow/disallow empty on_exit function
template < typename FSM, typename State, typename Event >
struct state_exit : state_exit_impl< FSM, State, Event,
has_on_exit<State, FSM, Event>::value > {};
template < typename FSM, typename State, bool hasExit >
struct state_enter_impl {
template < typename Event >
void
operator()(State& state, Event&& event, FSM& fsm) const
{
state.on_enter(::std::forward<Event>(event), fsm);
state.state_enter(::std::forward<Event>(event), fsm);
}
};
template < typename FSM, typename State >
struct state_enter_impl< FSM, State, false > {
template < typename Event >
void
operator()(State& state, Event&& event, FSM& fsm) const
{
state.state_enter(::std::forward<Event>(event), fsm);
}
};
// TODO Parameter to allow/disallow empty enter function
template < typename FSM, typename State, typename Event >
struct state_enter : state_enter_impl<FSM, State,
has_on_enter<State, FSM, Event>::value> {};
template < typename FSM, typename State, bool HasHistory >
struct state_clear_impl {
bool
operator()(FSM& fsm, State& state) const
{
state = State{fsm};
return true;
}
};
template < typename FSM, typename State >
struct state_clear_impl< FSM, State, true > {
bool
operator()(FSM&, State&) const
{ return false; }
};
template < typename FSM, typename State >
struct state_clear : state_clear_impl< FSM, State,
def::traits::has_history< State >::value > {};
template < typename FSM, typename StateTable >
struct no_transition {
template < typename Event >
actions::event_process_result
operator()(StateTable&, Event&&) const
{
return actions::event_process_result::refuse;
}
};
template < typename FSM, typename StateTable, typename Transition >
struct single_transition;
template < typename FSM, typename StateTable,
typename SourceState, typename Event, typename TargetState,
typename Action, typename Guard >
struct single_transition<FSM, StateTable,
::psst::meta::type_tuple< def::transition<SourceState, Event, TargetState, Action, Guard> > > {
using fsm_type = FSM;
using state_table = StateTable;
using source_state_def = SourceState;
using target_state_def = TargetState;
using source_state_type = typename afsm::detail::front_state_type<source_state_def, FSM>::type;
using target_state_type = typename afsm::detail::front_state_type<target_state_def, FSM>::type;
using states_def = typename fsm_type::inner_states_def;
using guard_type = actions::detail::guard_check<FSM, SourceState, Event, Guard>;
using source_exit = state_exit<fsm_type, source_state_type, Event>;
using target_enter = state_enter<fsm_type, target_state_type, Event>;
using action_type = actions::detail::action_invocation<Action, FSM,
SourceState, TargetState>;
using state_clear_type = state_clear<FSM, source_state_type>;
using source_index = ::psst::meta::index_of<source_state_def, states_def>;
using target_index = ::psst::meta::index_of<target_state_def, states_def>;
static_assert(source_index::found, "Failed to find source state index");
static_assert(target_index::found, "Failed to find target state index");
template < typename Evt >
actions::event_process_result
operator()(state_table& states, Evt&& event) const
{
return states.template transit_state< source_state_def, target_state_def >
( ::std::forward<Evt>(event), guard_type{}, action_type{},
source_exit{}, target_enter{}, state_clear_type{});
}
};
template < ::std::size_t N, typename FSM, typename StateTable, typename Transitions >
struct nth_transition {
static_assert(Transitions::size > N, "Transition list is too small");
using transition = typename Transitions::template type<N>;
using event_type = typename transition::event_type;
using previous_transition = nth_transition<N - 1, FSM, StateTable, Transitions>;
using transition_invocation = single_transition<FSM, StateTable, ::psst::meta::type_tuple<transition>>;
template < typename Event >
actions::event_process_result
operator()(StateTable& states, Event&& event) const
{
auto res = previous_transition{}(states, ::std::forward<Event>(event));
if (res == actions::event_process_result::refuse) {
return transition_invocation{}(states, ::std::forward<Event>(event));
}
return res;
}
};
template < typename FSM, typename StateTable, typename Transitions >
struct nth_transition< 0, FSM, StateTable, Transitions > {
static_assert(Transitions::size > 0, "Transition list is too small");
using transition = typename Transitions::template type<0>;
using event_type = typename transition::event_type;
using transition_invocation = single_transition<FSM, StateTable, ::psst::meta::type_tuple<transition>>;
template < typename Event >
actions::event_process_result
operator()(StateTable& states, Event&& event) const
{
return transition_invocation{}(states, ::std::forward<Event>(event));
}
};
template < typename FSM, typename StateTable, typename Transitions >
struct conditional_transition {
static constexpr ::std::size_t size = Transitions::size;
static_assert(Transitions::size > 0, "Transition list is too small");
using last_transition = nth_transition<size - 1, FSM, StateTable, Transitions>;
template < typename Event >
actions::event_process_result
operator()(StateTable& states, Event&& event) const
{
return last_transition{}(states, ::std::forward<Event>(event));
}
};
template < typename FSM, typename StateTable, typename Transitions >
struct transition_action_selector {
using type = typename ::std::conditional<
Transitions::size == 0,
no_transition<FSM, StateTable >,
typename ::std::conditional<
Transitions::size == 1,
single_transition<FSM, StateTable, Transitions>,
conditional_transition<FSM, StateTable, Transitions>
>::type
>::type;
};
template < typename T, ::std::size_t StateIndex >
struct common_base_cast_func {
static constexpr ::std::size_t state_index = StateIndex;
using type = typename ::std::decay<T>::type;
template < typename StateTuple >
type&
operator()(StateTuple& states) const
{
return static_cast< type& >(::std::get< state_index >(states));
}
template < typename StateTuple >
type const&
operator()(StateTuple const& states) const
{
return static_cast< type const& >(::std::get< state_index >(states));
}
};
template < ::std::size_t StateIndex >
struct final_state_exit_func {
static constexpr ::std::size_t state_index = StateIndex;
template < typename StateTuple, typename Event, typename FSM >
void
operator()(StateTuple& states, Event&& event, FSM& fsm)
{
using final_state_type = typename ::std::tuple_element< state_index, StateTuple >::type;
using final_exit = state_exit< FSM, final_state_type, Event >;
auto& final_state = ::std::get<state_index>(states);
final_exit{}(final_state, ::std::forward<Event>(event), fsm);
}
};
template < ::std::size_t StateIndex >
struct get_current_events_func {
static constexpr ::std::size_t state_index = StateIndex;
template < typename StateTuple >
::afsm::detail::event_set
operator()(StateTuple const& states) const
{
auto const& state = ::std::get<state_index>(states);
return state.current_handled_events();
}
};
template < ::std::size_t StateIndex >
struct get_current_deferred_events_func {
static constexpr ::std::size_t state_index = StateIndex;
template < typename StateTuple >
::afsm::detail::event_set
operator()(StateTuple const& states) const
{
auto const& state = ::std::get<state_index>(states);
return state.current_deferrable_events();
}
};
} /* namespace detail */
template < typename FSM, typename FSM_DEF, typename Size >
class state_transition_table {
public:
using fsm_type = FSM;
using state_machine_definition_type = FSM_DEF;
using size_type = Size;
using this_type = state_transition_table<FSM, FSM_DEF, Size>;
using transitions =
typename state_machine_definition_type::transitions;
static_assert(!::std::is_same<transitions, void>::value,
"Transition table is not defined for a state machine");
using transitions_tuple =
typename transitions::transitions;
using initial_state =
typename state_machine_definition_type::initial_state;
using inner_states_def =
typename def::detail::inner_states< transitions >::type;
using inner_states_constructor =
afsm::detail::front_state_tuple< fsm_type, inner_states_def >;
using inner_states_tuple =
typename inner_states_constructor::type;
using dispatch_table =
actions::detail::inner_dispatch_table< inner_states_tuple >;
static constexpr ::std::size_t initial_state_index =
::psst::meta::index_of<initial_state, inner_states_def>::value;
static constexpr ::std::size_t size = inner_states_def::size;
using state_indexes = typename ::psst::meta::index_builder<size>::type;
using event_set = ::afsm::detail::event_set;
template < typename Event >
using transition_table_type = ::std::array<
::std::function< actions::event_process_result(this_type&, Event&&) >, size >;
template < typename Event >
using exit_table_type = ::std::array<
::std::function< void(inner_states_tuple&, Event&&, fsm_type&) >, size >;
using current_events_table = ::std::array<
::std::function< event_set(inner_states_tuple const&) >, size >;
using available_transtions_table = ::std::array< event_set, size >;
template < typename CommonBase, typename StatesTuple >
using cast_table_type = ::std::array< ::std::function<
CommonBase&( StatesTuple& ) >, size >;
public:
state_transition_table(fsm_type& fsm)
: fsm_{&fsm},
current_state_{initial_state_index},
states_{ inner_states_constructor::construct(fsm) }
{}
state_transition_table(fsm_type& fsm, state_transition_table const& rhs)
: fsm_{&fsm},
current_state_{ (::std::size_t)rhs.current_state_ },
states_{ inner_states_constructor::copy_construct(fsm, rhs.states_) }
{}
state_transition_table(fsm_type& fsm, state_transition_table&& rhs)
: fsm_{&fsm},
current_state_{ (::std::size_t)rhs.current_state_ },
states_{ inner_states_constructor::move_construct(fsm, ::std::move(rhs.states_)) }
{}
state_transition_table(state_transition_table const&) = delete;
state_transition_table(state_transition_table&& rhs)
: fsm_{rhs.fsm_},
current_state_{ (::std::size_t)rhs.current_state_ },
states_{ ::std::move(rhs.states_) }
{}
state_transition_table&
operator = (state_transition_table const&) = delete;
state_transition_table&
operator = (state_transition_table&&) = delete;
void
swap(state_transition_table& rhs)
{
using ::std::swap;
swap(current_state_, rhs.current_state_);
swap(states_, rhs.states_);
set_fsm(*fsm_);
rhs.set_fsm(*rhs.fsm_);
}
void
set_fsm(fsm_type& fsm)
{
fsm_ = &fsm;
::afsm::detail::set_enclosing_fsm< size - 1 >::set(fsm, states_);
}
inner_states_tuple&
states()
{ return states_; }
inner_states_tuple const&
states() const
{ return states_; }
template < ::std::size_t N>
typename ::std::tuple_element< N, inner_states_tuple >::type&
get_state()
{ return ::std::get<N>(states_); }
template < ::std::size_t N>
typename ::std::tuple_element< N, inner_states_tuple >::type const&
get_state() const
{ return ::std::get<N>(states_); }
::std::size_t
current_state() const
{ return (::std::size_t)current_state_; }
void
set_current_state(::std::size_t val)
{ current_state_ = val; }
template < typename Event >
actions::event_process_result
process_event(Event&& event)
{
// Try dispatch to inner states
auto res = dispatch_table::process_event(states_, current_state(),
::std::forward<Event>(event));
if (res == actions::event_process_result::refuse) {
// Check if the event can cause a transition and process it
res = process_transition_event(::std::forward<Event>(event));
}
if (res == actions::event_process_result::process) {
check_default_transition();
}
return res;
}
void
check_default_transition()
{
auto const& ttable = transition_table<none>( state_indexes{} );
ttable[current_state()](*this, none{});
}
template < typename Event >
void
enter(Event&& event)
{
using initial_state_type = typename ::std::tuple_element<initial_state_index, inner_states_tuple>::type;
using initial_enter = detail::state_enter< fsm_type, initial_state_type, Event >;
auto& initial = ::std::get< initial_state_index >(states_);
initial_enter{}(initial, ::std::forward<Event>(event), *fsm_);
check_default_transition();
}
template < typename Event >
void
exit(Event&& event)
{
auto const& table = exit_table<Event>( state_indexes{} );
table[current_state()](states_, ::std::forward<Event>(event), *fsm_);
}
template < typename Event >
actions::event_process_result
process_transition_event(Event&& event)
{
auto const& inv_table = transition_table<Event>( state_indexes{} );
return inv_table[current_state()](*this, ::std::forward<Event>(event));
}
template < typename SourceState, typename TargetState,
typename Event, typename Guard, typename Action,
typename SourceExit, typename TargetEnter, typename SourceClear >
actions::event_process_result
transit_state(Event&& event, Guard guard, Action action, SourceExit exit,
TargetEnter enter, SourceClear clear)
{
using source_index = ::psst::meta::index_of<SourceState, inner_states_def>;
using target_index = ::psst::meta::index_of<TargetState, inner_states_def>;
static_assert(source_index::found, "Failed to find source state index");
static_assert(target_index::found, "Failed to find target state index");
auto& source = ::std::get< source_index::value >(states_);
auto& target = ::std::get< target_index::value >(states_);
return transit_state_impl(
::std::forward<Event>(event), source, target,
guard, action, exit, enter, clear,
target_index::value,
typename def::traits::exception_safety<state_machine_definition_type>::type{});
}
template < typename SourceState, typename TargetState,
typename Event, typename Guard, typename Action,
typename SourceExit, typename TargetEnter, typename SourceClear >
actions::event_process_result
transit_state_impl(Event&& event, SourceState& source, TargetState& target,
Guard guard, Action action, SourceExit exit,
TargetEnter enter, SourceClear clear,
::std::size_t target_index,
def::tags::basic_exception_safety const&)
{
if (guard(*fsm_, source, event)) {
auto const& observer = root_machine(*fsm_);
exit(source, ::std::forward<Event>(event), *fsm_);
observer.state_exited(*fsm_, source, event);
action(::std::forward<Event>(event), *fsm_, source, target);
enter(target, ::std::forward<Event>(event), *fsm_);
observer.state_entered(*fsm_, target, event);
if (clear(*fsm_, source))
observer.state_cleared(*fsm_, source);
current_state_ = target_index;
observer.state_changed(*fsm_, source, target, event);
return actions::event_process_result::process;
}
return actions::event_process_result::refuse;
}
template < typename SourceState, typename TargetState,
typename Event, typename Guard, typename Action,
typename SourceExit, typename TargetEnter, typename SourceClear >
actions::event_process_result
transit_state_impl(Event&& event, SourceState& source, TargetState& target,
Guard guard, Action action, SourceExit exit,
TargetEnter enter, SourceClear clear,
::std::size_t target_index,
def::tags::strong_exception_safety const&)
{
SourceState source_backup{source};
TargetState target_backup{target};
try {
return transit_state_impl(
::std::forward<Event>(event), source, target,
guard, action, exit, enter, clear,
target_index,
def::tags::basic_exception_safety{});
} catch (...) {
using ::std::swap;
swap(source, source_backup);
swap(target, target_backup);
throw;
}
}
template < typename SourceState, typename TargetState,
typename Event, typename Guard, typename Action,
typename SourceExit, typename TargetEnter, typename SourceClear >
actions::event_process_result
transit_state_impl(Event&& event, SourceState& source, TargetState& target,
Guard guard, Action action, SourceExit exit,
TargetEnter enter, SourceClear clear,
::std::size_t target_index,
def::tags::nothrow_guarantee const&)
{
SourceState source_backup{source};
TargetState target_backup{target};
try {
return transit_state_impl(
::std::forward<Event>(event), source, target,
guard, action, exit, enter, clear,
target_index,
def::tags::basic_exception_safety{});
} catch (...) {}
using ::std::swap;
swap(source, source_backup);
swap(target, target_backup);
return actions::event_process_result::refuse;
}
event_set
current_handled_events() const
{
auto const& table = get_current_events_table(state_indexes{});
auto res = table[current_state_](states_);
auto const& available_transitions
= get_available_transitions_table(state_indexes{});
auto const& trans = available_transitions[current_state_];
res.insert( trans.begin(), trans.end());
return res;
}
event_set
current_deferrable_events() const
{
auto const& table = get_current_deferred_events_table(state_indexes{});
return table[current_state_](states_);
}
template < typename T >
T&
cast_current_state()
{
using target_type = typename ::std::decay<T>::type;
auto const& ct = get_cast_table<target_type, inner_states_tuple>( state_indexes{} );
return ct[current_state_]( states_ );
}
template < typename T >
T const&
cast_current_state() const
{
using target_type = typename ::std::add_const< typename ::std::decay<T>::type >::type;
auto const& ct = get_cast_table<target_type, inner_states_tuple const>( state_indexes{} );
return ct[current_state_]( states_ );
}
private:
template < typename Event, ::std::size_t ... Indexes >
static transition_table_type< Event > const&
transition_table( ::psst::meta::indexes_tuple< Indexes... > const& )
{
using event_type = typename ::std::decay<Event>::type;
using event_transitions = typename ::psst::meta::find_if<
def::handles_event< event_type >::template type, transitions_tuple >::type;
static transition_table_type< Event > _table {{
typename detail::transition_action_selector< fsm_type, this_type,
typename ::psst::meta::find_if<
def::originates_from<
typename inner_states_def::template type< Indexes >
>::template type,
event_transitions
>::type >::type{} ...
}};
return _table;
}
template < typename Event, ::std::size_t ... Indexes >
static exit_table_type<Event> const&
exit_table( ::psst::meta::indexes_tuple< Indexes... > const& )
{
static exit_table_type<Event> _table {{
detail::final_state_exit_func<Indexes>{} ...
}};
return _table;
}
template < ::std::size_t ... Indexes >
static current_events_table const&
get_current_events_table( ::psst::meta::indexes_tuple< Indexes ... > const& )
{
static current_events_table _table{{
detail::get_current_events_func<Indexes>{} ...
}};
return _table;
}
template < ::std::size_t ... Indexes >
static current_events_table const&
get_current_deferred_events_table( ::psst::meta::indexes_tuple< Indexes ... > const& )
{
static current_events_table _table{{
detail::get_current_deferred_events_func<Indexes>{} ...
}};
return _table;
}
template < ::std::size_t ... Indexes >
static available_transtions_table const&
get_available_transitions_table( ::psst::meta::indexes_tuple< Indexes ...> const& )
{
static available_transtions_table _table{{
::afsm::detail::make_event_set(
typename ::psst::meta::transform<
def::detail::event_type,
typename ::psst::meta::find_if<
def::originates_from<
typename inner_states_def::template type< Indexes >
>:: template type,
transitions_tuple
>::type
> ::type {}
) ...
}};
return _table;
}
template < typename T, typename StateTuple, ::std::size_t ... Indexes >
static cast_table_type<T, StateTuple> const&
get_cast_table( ::psst::meta::indexes_tuple< Indexes... > const& )
{
static cast_table_type<T, StateTuple> _table {{
detail::common_base_cast_func<T, Indexes>{}...
}};
return _table;
}
private:
fsm_type* fsm_;
size_type current_state_;
inner_states_tuple states_;
};
template < typename FSM, typename FSM_DEF, typename Size >
class state_transition_stack {
public:
using state_table_type = state_transition_table<FSM, FSM_DEF, Size>;
using this_type = state_transition_stack<FSM, FSM_DEF, Size>;
using fsm_type = typename state_table_type::fsm_type;
using state_machine_definition_type = typename state_table_type::state_machine_definition_type;
using size_type = typename state_table_type::size_type;
using inner_states_tuple = typename state_table_type::inner_states_tuple;
using event_set = typename state_table_type::event_set;
using stack_constructor_type = afsm::detail::stack_constructor<FSM, state_table_type>;
public:
state_transition_stack(fsm_type& fsm)
: fsm_{&fsm},
state_stack_{ stack_constructor_type::construct(fsm) }
{}
state_transition_stack(fsm_type& fsm, state_transition_stack const& rhs)
: fsm_{&fsm},
state_stack_{ stack_constructor_type::copy_construct(fsm, rhs.state_stack_) }
{}
state_transition_stack(fsm_type& fsm, state_transition_stack&& rhs)
: fsm_{&fsm},
state_stack_{ stack_constructor_type::move_construct(fsm, ::std::move(rhs.state_stack_)) }
{}
state_transition_stack(state_transition_stack const&) = delete;
state_transition_stack(state_transition_stack&&) = delete;
state_transition_stack&
operator = (state_transition_stack const&) = delete;
state_transition_stack&
operator = (state_transition_stack&&) = delete;
void
swap(state_transition_stack& rhs)
{
using ::std::swap;
swap(state_stack_, rhs.state_stack_);
set_fsm(*fsm_);
rhs.set_fsm(*rhs.fsm_);
}
void
set_fsm(fsm_type& fsm)
{
fsm_ = &fsm;
for (auto& item : state_stack_) {
item.set_fsm(fsm);
}
}
inner_states_tuple&
states()
{ return top().states(); }
inner_states_tuple const&
states() const
{ return top().states(); }
template < ::std::size_t N >
typename ::std::tuple_element< N, inner_states_tuple >::type&
get_state()
{ return top().template get_state<N>(); }
template < ::std::size_t N >
typename ::std::tuple_element< N, inner_states_tuple >::type const&
get_state() const
{ return top().template get_state<N>(); }
::std::size_t
current_state() const
{ return top().current_state(); }
template < typename Event >
actions::event_process_result
process_event(Event&& event)
{
return top().process_event(::std::forward<Event>(event));
}
template < typename Event >
void
enter(Event&& event)
{
top().enter(::std::forward<Event>(event));
}
template < typename Event >
void
exit(Event&& event)
{
top().exit(::std::forward<Event>(event));
}
template < typename Event >
void
push(Event&& event)
{
state_stack_.emplace_back( *fsm_ );
enter(::std::forward<Event>(event));
}
template < typename Event >
void
pop(Event&& event)
{
if (state_stack_.size() > 1) {
exit(::std::forward<Event>(event));
state_stack_.pop_back();
}
}
::std::size_t
stack_size() const
{
return state_stack_.size();
}
event_set
current_handled_events() const
{
return top().current_handled_events();
}
event_set
current_deferrable_events() const
{
return top().current_deferrable_events();
}
template < typename T >
T&
cast_current_state()
{
return top().template cast_current_state<T>();
}
template < typename T >
T const&
cast_current_state() const
{
return top().template cast_current_state<T>();
}
private:
using stack_type = typename stack_constructor_type::type;
state_table_type&
top()
{ return state_stack_.back(); }
state_table_type const&
top() const
{ return state_stack_.back(); }
private:
fsm_type* fsm_;
stack_type state_stack_;
};
template < typename FSM, typename FSM_DEF, typename Size, bool HasPusdowns >
struct transition_container_selector {
using type = state_transition_table<FSM, FSM_DEF, Size>;
};
template <typename FSM, typename FSM_DEF, typename Size>
struct transition_container_selector<FSM, FSM_DEF, Size, true> {
using type = state_transition_stack<FSM, FSM_DEF, Size>;
};
namespace detail {
template < typename FSM, typename FSM_DEF, typename Size, bool HasPushdowns >
struct transition_container {
using transitions_tuple = typename transition_container_selector<FSM, FSM_DEF, Size, HasPushdowns>::type;
transition_container(FSM* fsm)
: transitions_{*fsm}
{}
transition_container(FSM* fsm, transition_container const& rhs)
: transitions_{*fsm, rhs.transitions_}
{}
transition_container(FSM* fsm, transition_container&& rhs)
: transitions_{*fsm, ::std::move(rhs.transitions_)}
{}
protected:
transitions_tuple transitions_;
};
template < typename FSM, typename FSM_DEF, typename Size >
struct transition_container< FSM, FSM_DEF, Size, true > {
using transitions_tuple = typename transition_container_selector<FSM, FSM_DEF, Size, true>::type;
transition_container(FSM* fsm)
: transitions_{*fsm}
{}
transition_container(FSM* fsm, transition_container const& rhs)
: transitions_{*fsm, rhs.transitions_}
{}
transition_container(FSM* fsm, transition_container&& rhs)
: transitions_{*fsm, ::std::move(rhs.transitions_)}
{}
::std::size_t
stack_size() const
{
return transitions_.stack_size();
}
protected:
template < typename T >
friend struct ::afsm::detail::pushdown_state;
template < typename T >
friend struct ::afsm::detail::popup_state;
// Push/pop ops
template < typename Event >
void
pushdown(Event&& event)
{
transitions_.push(::std::forward<Event>(event));
}
template < typename Event >
void
popup(Event&& event)
{
transitions_.pop(::std::forward<Event>(event));
}
protected:
transitions_tuple transitions_;
};
} /* namespace detail */
template < typename FSM, typename FSM_DEF, typename Size >
struct transition_container
: detail::transition_container<FSM, FSM_DEF, Size,
def::has_pushdown_stack<FSM_DEF>::value> {
using base_type = detail::transition_container<FSM, FSM_DEF, Size,
def::has_pushdown_stack<FSM_DEF>::value>;
using transitions_tuple = typename base_type::transitions_tuple;
transition_container( FSM* fsm ) : base_type{fsm} {}
transition_container(FSM* fsm, transition_container const& rhs)
: base_type{fsm, rhs} {}
transition_container(FSM* fsm, transition_container&& rhs)
: base_type{fsm, ::std::move(rhs)} {}
protected:
using base_type::transitions_;
};
} /* namespace transitions */
} /* namespace afsm */
#endif /* AFSM_DETAIL_TRANSITIONS_HPP_ */
| 33.967615 | 112 | 0.645769 | [
"transform"
] |
07e7f45b1bef851f3a0302b992ee2f2a2f63140c | 491 | cpp | C++ | Aula 13 - STL-C++11/next_permutation.cpp | EhODavi/INF213 | 2099354f1e8f9eda9a92531e5dc45a736ef3882e | [
"MIT"
] | null | null | null | Aula 13 - STL-C++11/next_permutation.cpp | EhODavi/INF213 | 2099354f1e8f9eda9a92531e5dc45a736ef3882e | [
"MIT"
] | null | null | null | Aula 13 - STL-C++11/next_permutation.cpp | EhODavi/INF213 | 2099354f1e8f9eda9a92531e5dc45a736ef3882e | [
"MIT"
] | null | null | null | #include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <functional>
#include <map>
#include <stack>
#include <queue>
#include <fstream>
#include <memory>
#include <vector>
using namespace std;
int main(int argc, char **argv) {
vector<string> v;
v.push_back("abc");
v.push_back("x");
v.push_back("salles");
sort(v.begin(),v.end());
do {
for(const string &st:v) cout << st << " ";
cout << endl;
} while(next_permutation(v.begin(),v.end()));
}
| 16.366667 | 46 | 0.649695 | [
"vector"
] |
07ea65b14aa99838cc1673987eba58ccdb873a4a | 5,263 | cxx | C++ | src/Cxx/Visualization/MovableAxes.cxx | ajpmaclean/vtk-examples | 1a55fc8c6af67a3c07791807c7d1ec0ab97607a2 | [
"Apache-2.0"
] | 81 | 2020-08-10T01:44:30.000Z | 2022-03-23T06:46:36.000Z | src/Cxx/Visualization/MovableAxes.cxx | ajpmaclean/vtk-examples | 1a55fc8c6af67a3c07791807c7d1ec0ab97607a2 | [
"Apache-2.0"
] | 2 | 2020-09-12T17:33:52.000Z | 2021-04-15T17:33:09.000Z | src/Cxx/Visualization/MovableAxes.cxx | ajpmaclean/vtk-examples | 1a55fc8c6af67a3c07791807c7d1ec0ab97607a2 | [
"Apache-2.0"
] | 27 | 2020-08-17T07:09:30.000Z | 2022-02-15T03:44:58.000Z | #include <vtkActor.h>
#include <vtkAssembly.h>
#include <vtkAssemblyPath.h>
#include <vtkAxesActor.h>
#include <vtkCommand.h>
#include <vtkConeSource.h>
#include <vtkFollower.h>
#include <vtkInteractorStyleTrackballActor.h>
#include <vtkNamedColors.h>
#include <vtkNew.h>
#include <vtkPolyDataMapper.h>
#include <vtkProp3DCollection.h>
#include <vtkProperty.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkTextActor.h>
#include <vtkVectorText.h>
namespace {
//----------------------------------------------------------------------------
class vtkPositionCallback : public vtkCommand
{
public:
static vtkPositionCallback* New()
{
return new vtkPositionCallback;
}
void Execute(vtkObject* vtkNotUsed(caller), unsigned long vtkNotUsed(event),
void* vtkNotUsed(callData))
{
this->Axes->InitPathTraversal();
vtkAssemblyPath* path = 0;
int count = 0;
vtkFollower* followers[3] = {this->XLabel, this->YLabel, this->ZLabel};
int followerId = 0;
while ((path = this->Axes->GetNextPath()) != NULL)
{
if (count++ > 2)
{
vtkProp3D* prop3D =
static_cast<vtkProp3D*>(path->GetLastNode()->GetViewProp());
if (prop3D)
{
prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
followers[followerId]->SetPosition(prop3D->GetCenter());
followerId++;
prop3D->PokeMatrix(NULL);
}
}
}
}
vtkPositionCallback() : XLabel(0), YLabel(0), ZLabel(0), Axes(0)
{
}
vtkFollower* XLabel;
vtkFollower* YLabel;
vtkFollower* ZLabel;
vtkAssembly* Axes;
};
} // namespace
int main(int, char*[])
{
vtkNew<vtkNamedColors> colors;
vtkNew<vtkConeSource> coneSource;
coneSource->Update();
// vtkPolyData* cone = coneSource->GetOutput();
// create a mapper
vtkNew<vtkPolyDataMapper> coneMapper;
coneMapper->SetInputConnection(coneSource->GetOutputPort());
// create an actor
vtkNew<vtkActor> coneActor;
coneActor->SetMapper(coneMapper);
coneActor->GetProperty()->SetColor(colors->GetColor3d("Gold").GetData());
// a renderer and render window
vtkNew<vtkRenderer> renderer;
vtkNew<vtkRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
renderWindow->SetWindowName("MovableAxes");
// an interactor
vtkNew<vtkRenderWindowInteractor> renderWindowInteractor;
renderWindowInteractor->SetRenderWindow(renderWindow);
// add the actors to the scene
renderer->AddActor(coneActor);
renderer->SetBackground(colors->GetColor3d("SlateGray").GetData());
// vtkAxesActor is currently not designed to work with
// vtkInteractorStyleTrackballActor since it is a hybrid object containing
// both vtkProp3D's and vtkActor2D's, the latter of which does not have a 3D
// position that can be manipulated
vtkNew<vtkAxesActor> axes;
// get a copy of the axes' constituent 3D actors and put them into a
// vtkAssembly so they can be manipulated as one prop
vtkNew<vtkPropCollection> collection;
axes->GetActors(collection);
collection->InitTraversal();
vtkNew<vtkAssembly> movableAxes;
for (int i = 0; i < collection->GetNumberOfItems(); ++i)
{
movableAxes->AddPart((vtkProp3D*)collection->GetNextProp());
}
renderer->AddActor(movableAxes);
// create our own labels that will follow and face the camera
vtkNew<vtkFollower> xLabel;
vtkNew<vtkVectorText> xText;
vtkNew<vtkPolyDataMapper> xTextMapper;
xText->SetText("X");
xTextMapper->SetInputConnection(xText->GetOutputPort());
xLabel->SetMapper(xTextMapper);
xLabel->SetScale(0.3);
xLabel->SetCamera(renderer->GetActiveCamera());
xLabel->SetPosition(
((vtkProp3D*)collection->GetItemAsObject(3))->GetCenter()); // XAxisTip
xLabel->PickableOff();
renderer->AddActor(xLabel);
vtkNew<vtkFollower> yLabel;
vtkNew<vtkVectorText> yText;
vtkNew<vtkPolyDataMapper> yTextMapper;
yText->SetText("Y");
yTextMapper->SetInputConnection(yText->GetOutputPort());
yLabel->SetMapper(yTextMapper);
yLabel->SetScale(0.3);
yLabel->SetCamera(renderer->GetActiveCamera());
yLabel->SetPosition(
((vtkProp3D*)collection->GetItemAsObject(4))->GetCenter()); // YAxisTip
yLabel->PickableOff();
renderer->AddActor(yLabel);
vtkNew<vtkFollower> zLabel;
vtkNew<vtkVectorText> zText;
vtkNew<vtkPolyDataMapper> zTextMapper;
zText->SetText("Z");
zTextMapper->SetInputConnection(zText->GetOutputPort());
zLabel->SetMapper(zTextMapper);
zLabel->SetScale(0.3);
zLabel->SetCamera(renderer->GetActiveCamera());
zLabel->SetPosition(
((vtkProp3D*)collection->GetItemAsObject(5))->GetCenter()); // ZAxisTip
zLabel->PickableOff();
renderer->AddActor(zLabel);
// custom callback to set the positions of the labels
vtkNew<vtkPositionCallback> callback;
callback->XLabel = xLabel;
callback->YLabel = yLabel;
callback->ZLabel = zLabel;
callback->Axes = movableAxes;
renderer->ResetCamera();
renderWindow->Render();
vtkNew<vtkInteractorStyleTrackballActor> style;
renderWindowInteractor->SetInteractorStyle(style);
style->AddObserver(vtkCommand::InteractionEvent, callback);
// begin mouse interaction
renderWindowInteractor->Start();
return EXIT_SUCCESS;
}
| 29.077348 | 78 | 0.706251 | [
"render",
"object",
"3d"
] |
07ee69809284787906a50ca6de15f680cc62ec2c | 19,305 | cpp | C++ | net/layer2svc/wlsnp/ccomp.cpp | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | net/layer2svc/wlsnp/ccomp.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | net/layer2svc/wlsnp/ccomp.cpp | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | //----------------------------------------------------------------------------
//
// Microsoft Windows
// Copyright (C) Microsoft Corporation, 2001.
//
// File: ccomp.cpp
//
// Contents:
//
//
// History: TaroonM
// 10/30/01
//
//----------------------------------------------------------------------------
#include "stdafx.h"
#include <atlimpl.cpp>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// contruction/descruction
DEBUG_DECLARE_INSTANCE_COUNTER(CComponentImpl);
CComponentImpl::CComponentImpl()
{
DEBUG_INCREMENT_INSTANCE_COUNTER(CComponentImpl);
Construct();
}
CComponentImpl::~CComponentImpl()
{
#if DBG==1
ASSERT(dbg_cRef == 0);
#endif
DEBUG_DECREMENT_INSTANCE_COUNTER(CComponentImpl);
// Make sure the interfaces have been released
ASSERT(m_pConsole == NULL);
ASSERT(m_pHeader == NULL);
}
void CComponentImpl::Construct()
{
#if DBG==1
dbg_cRef = 0;
#endif
m_pConsole = NULL;
m_pHeader = NULL;
m_pResultData = NULL;
m_pComponentData = NULL;
m_pConsoleVerb = NULL;
m_CustomViewID = VIEW_DEFAULT_LV;
m_dwSortOrder = 0; // default is 0, else RSI_DESCENDING
m_nSortColumn = 0;
}
/////////////////////////////////////////////////////////////////////////////
// CComponentImpl's IComponent multiple view/instance helper functions
STDMETHODIMP CComponentImpl::QueryDataObject(MMC_COOKIE cookie, DATA_OBJECT_TYPES type, LPDATAOBJECT* ppDataObject)
{
OPT_TRACE( _T("CComponentImpl::QueryDataObject this-%p, cookie-%p\n"), this, cookie );
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (ppDataObject == NULL)
{
TRACE(_T("CComponentImpl::QueryDataObject called with ppDataObject==NULL \n"));
return E_UNEXPECTED;
}
if (cookie == NULL)
{
TRACE(_T("CComponentImpl::QueryDataObject called with cookie==NULL \n"));
return E_UNEXPECTED;
}
*ppDataObject = NULL;
IUnknown* pUnk = (IUnknown *) cookie;
#ifdef _DEBUG
HRESULT hr = pUnk->QueryInterface( IID_IDataObject, (void**)ppDataObject );
OPT_TRACE(_T(" QI on cookie-%p -> pDataObj-%p\n"), cookie, *ppDataObject);
return hr;
#else
return pUnk->QueryInterface( IID_IDataObject, (void**)ppDataObject );
#endif //#ifdef _DEBUG
}
void CComponentImpl::SetIComponentData(CComponentDataImpl* pData)
{
ASSERT(pData);
ASSERT(m_pComponentData == NULL);
LPUNKNOWN pUnk = pData->GetUnknown();
HRESULT hr;
// store their IComponentData for later use
hr = pUnk->QueryInterface(IID_IComponentData, reinterpret_cast<void**>(&m_pComponentData));
// store their CComponentData for later use
m_pCComponentData = pData;
}
STDMETHODIMP CComponentImpl::GetResultViewType(MMC_COOKIE cookie, LPOLESTR* ppViewType, long* pViewOptions)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ASSERT (m_CustomViewID == VIEW_DEFAULT_LV);
return S_FALSE;
}
STDMETHODIMP CComponentImpl::Initialize(LPCONSOLE lpConsole)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
HRESULT hr = E_UNEXPECTED;
ASSERT(lpConsole != NULL);
// Save the IConsole pointer
m_pConsole = lpConsole;
m_pConsole->AddRef();
// QI for IHeaderCtrl
hr = m_pConsole->QueryInterface(IID_IHeaderCtrl, reinterpret_cast<void**>(&m_pHeader));
ASSERT (hr == S_OK);
if (hr != S_OK)
{
return hr;
}
// Pass the IHeaderCtrl Interface on to the console
m_pConsole->SetHeader(m_pHeader);
// QI for IResultData
hr = m_pConsole->QueryInterface(IID_IResultData, reinterpret_cast<void**>(&m_pResultData));
ASSERT (hr == S_OK);
if (hr != S_OK)
{
return hr;
}
// m_pCComponentData->SetResultData (m_pResultData);
// get the IControlVerb interface to support enable/disable of verbs (ie CUT/PASTE etc)
hr = m_pConsole->QueryConsoleVerb(&m_pConsoleVerb);
ASSERT(hr == S_OK);
return hr;
}
STDMETHODIMP CComponentImpl::Destroy(MMC_COOKIE cookie)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// Release the interfaces that we QI'ed
if (m_pConsole != NULL)
{
// Tell the console to release the header control interface
m_pConsole->SetHeader(NULL);
SAFE_RELEASE(m_pHeader);
SAFE_RELEASE(m_pResultData);
// Release the IConsole interface last
SAFE_RELEASE(m_pConsole);
SAFE_RELEASE(m_pComponentData); // QI'ed in IComponentDataImpl::CreateComponent
SAFE_RELEASE(m_pConsoleVerb);
}
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
// CComponentImpl's IComponent view/data helper functions
STDMETHODIMP CComponentImpl::GetDisplayInfo(LPRESULTDATAITEM pResult)
{
OPT_TRACE(_T("CComponentImpl::GetDisplayInfo this-%p pUnk-%p\n"), this, pResult->lParam);
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ASSERT(pResult != NULL);
if (NULL == pResult)
// gack!
return E_INVALIDARG;
ASSERT( NULL != pResult->lParam );
if (NULL == pResult->lParam)
{
TRACE(_T("CComponentImpl::GetDisplayInfo RESULTDATAITEM.lParam == NULL\n"));
ASSERT( FALSE );
return E_UNEXPECTED;
}
IUnknown* pUnk = (IUnknown*)pResult->lParam;
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spData( pUnk );
if (spData == NULL)
{
TRACE(_T("CComponentImpl::GetDisplayInfo QI for IWirelessSnapInDataObject FAILED\n"));
return E_UNEXPECTED;
}
return spData->GetResultDisplayInfo( pResult );
}
/////////////////////////////////////////////////////////////////////////////
// CComponentImpl's I????? misc helper functions
// TODO: Some misc functions don't appear to ever be called?
STDMETHODIMP CComponentImpl::GetClassID(CLSID *pClassID)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
ASSERT (0);
// TODO: CComponentDataImpl::GetClassID and CComponentImpl::GetClassID are identical (?)
ASSERT(pClassID != NULL);
// Copy the CLSID for this snapin
*pClassID = CLSID_Snapin;
return E_NOTIMPL;
}
// This compares two data objects to see if they are the same object.
STDMETHODIMP CComponentImpl::CompareObjects(LPDATAOBJECT pDataObjectA, LPDATAOBJECT pDataObjectB)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (NULL == pDataObjectA || NULL == pDataObjectB)
return E_INVALIDARG;
HRESULT res = S_FALSE;
// we need to check to make sure both objects belong to us...
if (m_pCComponentData)
{
HRESULT hr;
GUID guidA;
GUID guidB;
// Obtain GUID for A
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spDataA(pDataObjectA);
if (spDataA == NULL)
{
TRACE(_T("CComponentImpl::CompareObjects - QI for IWirelessSnapInDataObject[A] FAILED\n"));
return E_UNEXPECTED;
}
hr = spDataA->GetGuidForCompare( &guidA );
ASSERT(hr == S_OK);
// Obtain GUID for B
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spDataB(pDataObjectB);
if (spDataB == NULL)
{
TRACE(_T("CComponentImpl::CompareObjects - QI for IWirelessSnapInDataObject[B] FAILED\n"));
return E_UNEXPECTED;
}
hr &= spDataB->GetGuidForCompare( &guidB );
ASSERT(hr == S_OK);
// Compare GUIDs
if (IsEqualGUID( guidA, guidB ))
{
return S_OK;
}
}
// they were not ours, or they couldn't have been ours...
return E_UNEXPECTED;
}
// This Compare is used to sort the item's in the result pane using the C runtime's
// string comparison function.
STDMETHODIMP CComponentImpl::Compare(LPARAM lUserParam, MMC_COOKIE cookieA, MMC_COOKIE cookieB, int* pnResult)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
OPT_TRACE(_T("CComponentImpl::Compare cookieA-%p, cookieB-%p, Column-%i, userParam-%i\n"), cookieA, cookieB, *pnResult, lUserParam );
// Get pDataObject for item A
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spDataA((LPDATAOBJECT)cookieA);
if (spDataA == NULL)
{
TRACE(_T("CComponentImpl::Compare - QI for IWirelessSnapInDataObject[A] FAILED\n"));
return E_UNEXPECTED;
}
// Get pDataObject for item B
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spDataB((LPDATAOBJECT)cookieB);
if (spDataB == NULL)
{
TRACE(_T("CComponentImpl::Compare - QI for IWirelessSnapInDataObject[B] FAILED\n"));
return E_UNEXPECTED;
}
HRESULT hr = S_OK;
do
{
RESULTDATAITEM rdiA;
RESULTDATAITEM rdiB;
// Obtain item A's sort string
rdiA.mask = RDI_STR;
rdiA.nCol = *pnResult; // obtain string for this column
hr = spDataA->GetResultDisplayInfo( &rdiA );
if (hr != S_OK)
{
TRACE(_T("CComponentImpl::Compare - IWirelessSnapInDataObject[A].GetResultDisplayInfo FAILED\n"));
hr = E_UNEXPECTED;
break;
}
// Obtain item B's sort string
rdiB.mask = RDI_STR;
rdiB.nCol = *pnResult; // obtain string for this column
hr = spDataB->GetResultDisplayInfo( &rdiB );
if (hr != S_OK)
{
TRACE(_T("CComponentImpl::Compare - IWirelessSnapInDataObject[B].GetResultDisplayInfo FAILED\n"));
hr = E_UNEXPECTED;
break;
}
// Compare strings for sort
*pnResult = _tcsicmp( rdiA.str, rdiB.str );
} while (0); // simulate try block
return hr;
}
/////////////////////////////////////////////////////////////////////////////
// Event handlers for IFrame::Notify
STDMETHODIMP CComponentImpl::Notify(LPDATAOBJECT pDataObject, MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param)
{
OPT_TRACE(_T("CComponentImpl::Notify pDataObject-%p\n"), pDataObject);
if (pDataObject == NULL)
{
if (MMCN_PROPERTY_CHANGE == event)
{
if (param)
{
IWirelessSnapInDataObject * pData = (IWirelessSnapInDataObject *)param;
//used IComponentData's IIconsole, fix for bug 464858
//pData->Notify(event, arg, param, FALSE, m_pConsole, m_pHeader );
pData->Notify(event, arg, param, FALSE, m_pCComponentData->m_pConsole, m_pHeader );
}
}
if (MMCN_COLUMN_CLICK == event)
{
ASSERT( NULL != m_pCComponentData ); // should always have this
// MMCN_COLUMN_CLICK is specified as having a NULL pDataObject.
ASSERT( NULL != m_pResultData );
if (NULL != m_pResultData)
{
// Save sort request details
m_nSortColumn = arg;
m_dwSortOrder = param;
// Sort all result items
HRESULT hr = m_pResultData->Sort( arg, param, 0 );
return hr;
}
return E_UNEXPECTED;
}
TRACE(_T("CComponentImpl::Notify ERROR(?) called with pDataObject==NULL for event-%i\n"), event);
// If this asserts, look at "event" and determine whether it is normal for
// pDataObject to be NULL. If so add code above to handle event.
ASSERT( FALSE );
return E_UNEXPECTED;
}
if (MMCN_VIEW_CHANGE == event)
{
// Pack info for sorting result view into the hint for this event. Its safe
// to do this because all calls to IConsole::UpdateAllViews from within this
// snap-in do not use the hint.
param = MAKELONG( m_nSortColumn, m_dwSortOrder );
}
// Pass call to result item.
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spData( pDataObject );
if (spData == NULL)
{
// If we are loaded as an extension snapin, let our static node handle this.
if (NULL != m_pCComponentData->GetStaticScopeObject()->GetExtScopeObject())
{
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject>
spExtData( m_pCComponentData->GetStaticScopeObject()->GetExtScopeObject() );
if (spExtData != NULL)
{
HRESULT hr;
hr = spExtData->Notify( event, arg, param, FALSE, m_pConsole, m_pHeader );
return hr;
}
ASSERT( FALSE );
}
TRACE(_T("CComponentImpl::Notify - QI for IWirelessSnapInDataObject FAILED\n"));
ASSERT( FALSE );
return E_UNEXPECTED;
}
return spData->Notify( event, arg, param, FALSE, m_pConsole, m_pHeader );
}
/////////////////////////////////////////////////////////////////////////////
// IExtendPropertySheet Implementation
STDMETHODIMP CComponentImpl::CreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider, LONG_PTR handle, LPDATAOBJECT pDataObject)
{
if (pDataObject == NULL)
{
TRACE(_T("CComponentImpl::CreatePropertyPages called with pDataObject == NULL\n"));
return E_UNEXPECTED;
}
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spData(pDataObject);
if (spData == NULL)
{
TRACE(_T("CComponentImpl::CreatePropertyPages - QI for IWirelessSnapInDataObject FAILED\n"));
ASSERT( FALSE );
return E_UNEXPECTED;
}
return spData->CreatePropertyPages( lpProvider, handle );
}
STDMETHODIMP CComponentImpl::QueryPagesFor(LPDATAOBJECT pDataObject)
{
if (pDataObject == NULL)
{
TRACE(_T("CComponentImpl::QueryPagesFor called with pDataObject == NULL\n"));
return E_UNEXPECTED;
}
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spData(pDataObject);
if (spData == NULL)
{
TRACE(_T("CComponentImpl::QueryPagesFor - QI for IWirelessSnapInDataObject FAILED\n"));
ASSERT( FALSE );
return E_UNEXPECTED;
}
return spData->QueryPagesFor();
}
/////////////////////////////////////////////////////////////////////////////
// IExtendContextMenus Implementation
STDMETHODIMP CComponentImpl::AddMenuItems(LPDATAOBJECT pDataObject, LPCONTEXTMENUCALLBACK pContextMenuCallback, long *pInsertionAllowed)
{
if (pDataObject == NULL)
{
TRACE(_T("CComponentImpl::AddMenuItems called with pDataObject == NULL\n"));
return E_UNEXPECTED;
}
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spData(pDataObject);
if (spData == NULL)
{
TRACE(_T("CComponentImpl::AddMenuItems - QI for IWirelessSnapInDataObject FAILED\n"));
ASSERT( FALSE );
return E_UNEXPECTED;
}
return spData->AddMenuItems( pContextMenuCallback, pInsertionAllowed );
}
STDMETHODIMP CComponentImpl::Command(long nCommandID, LPDATAOBJECT pDataObject)
{
if (pDataObject == NULL)
{
TRACE(_T("CComponentImpl::Command called with pDataObject == NULL\n"));
return E_UNEXPECTED;
}
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spData(pDataObject);
if (spData == NULL)
{
TRACE(_T("CComponentImpl::Command - QI for IWirelessSnapInDataObject FAILED\n"));
ASSERT( FALSE );
return E_UNEXPECTED;
}
return spData->Command( nCommandID, NULL /*IConsoleNameSpace* */ );
}
/////////////////////////////////////////////////////////////////////////////
// IExtendControlbar Implementation
STDMETHODIMP CComponentImpl::SetControlbar( LPCONTROLBAR pControlbar )
{
OPT_TRACE( _T("CComponentImpl::IExtendControlbar::SetControlbar\n") );
// pControlbar was obtained by MMC (MMCNDMGR) from our CComponentImpl by doing
// a QI on IExtendControlbar. Save it so we can use it later.
// Note: Always assign pControlbar to our smart pointer. pControlbar == NULL
// when MMC wants us to release the interface we already have.
m_spControlbar = pControlbar;
return S_OK;
}
STDMETHODIMP CComponentImpl::ControlbarNotify( MMC_NOTIFY_TYPE event, LPARAM arg, LPARAM param )
{
OPT_TRACE( _T("CComponentImpl::IExtendControlbar::ControlbarNotify\n") );
AFX_MANAGE_STATE(AfxGetStaticModuleState());
// Obtain the data obj of the currently selected item.
LPDATAOBJECT pDataObject = NULL;
if (event == MMCN_BTN_CLICK)
{
pDataObject = (LPDATAOBJECT)arg;
}
else if (event == MMCN_SELECT)
{
pDataObject = (LPDATAOBJECT)param;
}
if (NULL == pDataObject)
{
// This can happen on a MMCN_BTN_CLICK if the result pane is clicked, but not
// on a result item, then a scope item toolbar button is pressed. In this case
// check for one of the known scope item toolbar commands.
if (IDM_CREATENEWSECPOL == param )
{
pDataObject = m_pCComponentData->GetStaticScopeObject();
}
else
{
TRACE(_T("CComponentImpl::ControlbarNotify - ERROR no IDataObject available\n"));
return E_UNEXPECTED;
}
}
// Let selected item handle command
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject> spData( pDataObject );
if (spData == NULL)
{
TRACE(_T("CComponentImpl::ControlbarNotify - QI for IWirelessSnapInDataObject FAILED\n"));
ASSERT( FALSE );
return E_UNEXPECTED;
}
HRESULT hr = spData->ControlbarNotify( m_spControlbar, (IExtendControlbar*)this,
event, arg, param );
// If the command was not handled by the selected item, pass it to our static
// scope obj.
if (E_NOTIMPL == hr || S_FALSE == hr)
{
if (m_pCComponentData->GetStaticScopeObject() != pDataObject)
{
CComQIPtr<IWirelessSnapInDataObject, &IID_IWirelessSnapInDataObject>
spScopeData( m_pCComponentData->GetStaticScopeObject() );
if (spScopeData == NULL)
{
TRACE(_T("CComponentImpl::ControlbarNotify - StaticScopeObj.QI for IWirelessSnapInDataObject FAILED\n"));
ASSERT( FALSE );
return E_UNEXPECTED;
}
hr = spScopeData->ControlbarNotify( m_spControlbar, (IExtendControlbar*)this,
event, arg, param );
}
}
return hr;
}
| 33.868421 | 138 | 0.598757 | [
"object"
] |
07f3253db7cdf1686fd02f635e24f1030865b0bb | 32,788 | cpp | C++ | scene-start.cpp | brucehow/CITS3003-Project | 303b5269985bcf588c1dd35961b1a5301bdc90d3 | [
"MIT"
] | 1 | 2020-06-03T07:12:53.000Z | 2020-06-03T07:12:53.000Z | scene-start.cpp | brucehow/CITS3003-Project | 303b5269985bcf588c1dd35961b1a5301bdc90d3 | [
"MIT"
] | null | null | null | scene-start.cpp | brucehow/CITS3003-Project | 303b5269985bcf588c1dd35961b1a5301bdc90d3 | [
"MIT"
] | 4 | 2021-05-14T20:43:54.000Z | 2021-05-18T22:13:52.000Z |
#include "Angel.h"
#include <stdlib.h>
#include <dirent.h>
#include <time.h>
// Open Asset Importer header files (in ../../assimp--3.0.1270/include)
// This is a standard open source library for loading meshes, see gnatidread.h
#include <assimp/cimport.h>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
GLint windowHeight=640, windowWidth=960;
// gnatidread.cpp is the CITS3003 "Graphics n Animation Tool Interface & Data
// Reader" code. This file contains parts of the code that you shouldn't need
// to modify (but, you can).
#include "gnatidread.h"
#include "gnatidread2.h" // PART 2D.B. Include the additional gnatidread file
using namespace std; // Import the C++ standard functions (e.g., min)
// IDs for the GLSL program and GLSL variables.
GLuint shaderProgram; // The number identifying the GLSL shader program
GLuint vPosition, vNormal, vTexCoord; // IDs for vshader input vars (from glGetAttribLocation)
GLuint projectionU, modelViewU; // IDs for uniform variables (from glGetUniformLocation)
// PART 2D.3. Additional globsl variables
GLuint vBoneIDs, vBoneWeights; // IDs for vshader input vars (from glGetAttribLocation)
GLuint boneTransformsU; // IDs for uniform variables (from glGetUniformLocation)
static float viewDist = 1.5; // Distance from the camera to the centre of the scene
static float camRotSidewaysDeg=0; // rotates the camera sideways around the centre
static float camRotUpAndOverDeg=20; // rotates the camera up and over the centre.
mat4 projection; // Projection matrix - set in the reshape function
mat4 view; // View matrix - set in the display function.
// These are used to set the window title
char lab[] = "Project1";
char *programName = NULL; // Set in main
int numDisplayCalls = 0; // Used to calculate the number of frames per second
//------Meshes----------------------------------------------------------------
// Uses the type aiMesh from ../../assimp--3.0.1270/include/assimp/mesh.h
// (numMeshes is defined in gnatidread.h)
aiMesh* meshes[numMeshes]; // For each mesh we have a pointer to the mesh to draw
GLuint vaoIDs[numMeshes]; // and a corresponding VAO ID from glGenVertexArrays
const aiScene* scenes[numMeshes]; // PART 2D.4. Stores extra scene related info for each loaded mesh
// -----Textures--------------------------------------------------------------
// (numTextures is defined in gnatidread.h)
texture* textures[numTextures]; // An array of texture pointers - see gnatidread.h
GLuint textureIDs[numTextures]; // Stores the IDs returned by glGenTextures
//------Scene Objects---------------------------------------------------------
//
// For each object in a scene we store the following
// Note: the following is exactly what the sample solution uses, you can do things differently if you want.
typedef struct {
vec4 loc;
float scale;
float angles[3]; // rotations around X, Y and Z axes.
float diffuse, specular, ambient; // Amount of each light component
float shine;
vec3 rgb;
float brightness; // Multiplies all colours
int meshId;
int texId;
float texScale;
// PART 2D. Animation variables
bool hasAnim; // If the obj has animation
int frames; // The number of frames
} SceneObject;
const int maxObjects = 1024; // Scenes with more than 1024 objects seem unlikely
SceneObject sceneObjs[maxObjects]; // An array storing the objects currently in the scene.
int nObjects = 0; // How many objects are currenly in the scene.
int currObject = -1; // The current object
int toolObj = -1; // The object currently being modified
int delObjects = 0; // How many deleted objects
// PART 2D. Global animation variables
float POSE_TIME = 0.0;
float ANIM_SPEED = 1; // Speed of animation from 0 to 10
bool ANIM_PAUSED = false;
static void makeMenu(); // PART J.2. Selection menu update. Prevent compilation erorr
//----------------------------------------------------------------------------
//
// Loads a texture by number, and binds it for later use.
void loadTextureIfNotAlreadyLoaded(int i) {
if (textures[i] != NULL) return; // The texture is already loaded.
textures[i] = loadTextureNum(i); CheckError();
glActiveTexture(GL_TEXTURE0); CheckError();
// Based on: http://www.opengl.org/wiki/Common_Mistakes
glBindTexture(GL_TEXTURE_2D, textureIDs[i]); CheckError();
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, textures[i]->width, textures[i]->height,
0, GL_RGB, GL_UNSIGNED_BYTE, textures[i]->rgbData); CheckError();
glGenerateMipmap(GL_TEXTURE_2D); CheckError();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); CheckError();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); CheckError();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); CheckError();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); CheckError();
glBindTexture(GL_TEXTURE_2D, 0); CheckError(); // Back to default texture
}
//------Mesh loading----------------------------------------------------------
//
// The following uses the Open Asset Importer library via loadMesh in
// gnatidread.h to load models in .x format, including vertex positions,
// normals, and texture coordinates.
// You shouldn't need to modify this - it's called from drawMesh below.
void loadMeshIfNotAlreadyLoaded(int meshNumber)
{
if (meshNumber>=numMeshes || meshNumber < 0) {
printf("Error - no such model number");
exit(1);
}
if (meshes[meshNumber] != NULL)
return; // Already loaded
// PART 2D.5. Stores the scene for the mesh
const aiScene* scene = loadScene(meshNumber);
scenes[meshNumber] = scene;
aiMesh* mesh = scene->mMeshes[0];
meshes[meshNumber] = mesh;
glBindVertexArrayAPPLE(vaoIDs[meshNumber]);
// Create and initialize a buffer object for positions and texture coordinates, initially empty.
// mesh->mTextureCoords[0] has space for up to 3 dimensions, but we only need 2.
GLuint buffer[1];
glGenBuffers(1, buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer[0]);
glBufferData(GL_ARRAY_BUFFER, sizeof(float)*(3+3+3)*mesh->mNumVertices, NULL, GL_STATIC_DRAW);
int nVerts = mesh->mNumVertices;
// Next, we load the position and texCoord data in parts.
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(float)*3*nVerts, mesh->mVertices);
glBufferSubData(GL_ARRAY_BUFFER, sizeof(float)*3*nVerts, sizeof(float)*3*nVerts, mesh->mTextureCoords[0]);
glBufferSubData(GL_ARRAY_BUFFER, sizeof(float)*6*nVerts, sizeof(float)*3*nVerts, mesh->mNormals);
// Load the element index data
GLuint elements[mesh->mNumFaces*3];
for (GLuint i=0; i < mesh->mNumFaces; i++) {
elements[i*3] = mesh->mFaces[i].mIndices[0];
elements[i*3+1] = mesh->mFaces[i].mIndices[1];
elements[i*3+2] = mesh->mFaces[i].mIndices[2];
}
GLuint elementBufferId[1];
glGenBuffers(1, elementBufferId);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementBufferId[0]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(GLuint) * mesh->mNumFaces * 3, elements, GL_STATIC_DRAW);
// vPosition it actually 4D - the conversion sets the fourth dimension (i.e. w) to 1.0
glVertexAttribPointer(vPosition, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
glEnableVertexAttribArray(vPosition);
// vTexCoord is actually 2D - the third dimension is ignored (it's always 0.0)
glVertexAttribPointer(vTexCoord, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(sizeof(float)*3*mesh->mNumVertices));
glEnableVertexAttribArray(vTexCoord);
glVertexAttribPointer(vNormal, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(sizeof(float)*6*mesh->mNumVertices));
glEnableVertexAttribArray(vNormal);
CheckError();
// PART 2D.6. Get boneIDs and boneWeights for each vertex from the imported mesh data
GLint boneIDs[mesh->mNumVertices][4];
GLfloat boneWeights[mesh->mNumVertices][4];
getBonesAffectingEachVertex(mesh, boneIDs, boneWeights);
GLuint buffers[2];
glGenBuffers(2, buffers); // Add two VBOs
glBindBuffer(GL_ARRAY_BUFFER, buffers[0]); CheckError();
glBufferData(GL_ARRAY_BUFFER, sizeof(int) * 4 * mesh->mNumVertices, boneIDs, GL_STATIC_DRAW); CheckError();
glVertexAttribPointer(vBoneIDs, 4, GL_INT, GL_FALSE, 0, BUFFER_OFFSET(0)); CheckError();
glEnableVertexAttribArray(vBoneIDs); CheckError();
glBindBuffer(GL_ARRAY_BUFFER, buffers[1]);
glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4 * mesh->mNumVertices, boneWeights, GL_STATIC_DRAW);
glVertexAttribPointer(vBoneWeights, 4, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0));
glEnableVertexAttribArray(vBoneWeights); CheckError();
}
//----------------------------------------------------------------------------
static void mouseClickOrScroll(int button, int state, int x, int y)
{
if (button==GLUT_LEFT_BUTTON && state == GLUT_DOWN) {
if (glutGetModifiers()!=GLUT_ACTIVE_SHIFT) activateTool(button);
else activateTool(GLUT_LEFT_BUTTON);
}
else if (button==GLUT_LEFT_BUTTON && state == GLUT_UP) deactivateTool();
else if (button==GLUT_MIDDLE_BUTTON && state==GLUT_DOWN) { activateTool(button); }
else if (button==GLUT_MIDDLE_BUTTON && state==GLUT_UP) deactivateTool();
else if (button == 3) { // scroll up
viewDist = (viewDist < 0.0 ? viewDist : viewDist*0.8) - 0.05;
}
else if (button == 4) { // scroll down
viewDist = (viewDist < 0.0 ? viewDist : viewDist*1.25) + 0.05;
}
}
//----------------------------------------------------------------------------
static void mousePassiveMotion(int x, int y)
{
mouseX=x;
mouseY=y;
}
//----------------------------------------------------------------------------
mat2 camRotZ()
{
return rotZ(-camRotSidewaysDeg) * mat2(10.0, 0, 0, -10.0);
}
//------callback functions for doRotate below and later-----------------------
static void adjustCamrotsideViewdist(vec2 cv)
{
cout << cv << endl;
camRotSidewaysDeg+=cv[0]; viewDist+=cv[1];
}
static void adjustcamSideUp(vec2 su)
{
camRotSidewaysDeg+=su[0]; camRotUpAndOverDeg+=su[1];
}
static void adjustLocXZ(vec2 xz)
{
sceneObjs[toolObj].loc[0]+=xz[0]; sceneObjs[toolObj].loc[2]+=xz[1];
}
static void adjustScaleY(vec2 sy)
{
sceneObjs[toolObj].scale+=sy[0]; sceneObjs[toolObj].loc[1]+=sy[1];
}
//----------------------------------------------------------------------------
//------Set the mouse buttons to rotate the camera----------------------------
//------around the centre of the scene.---------------------------------------
//----------------------------------------------------------------------------
static void doRotate()
{
setToolCallbacks(adjustCamrotsideViewdist, mat2(400,0,0,-2),
adjustcamSideUp, mat2(400, 0, 0,-90));
}
//------Add an object to the scene--------------------------------------------
static void addObject(int id) {
if (nObjects >= maxObjects) return; // Potential fix to the Fatal Error: Out of Memory
vec2 currPos = currMouseXYworld(camRotSidewaysDeg);
sceneObjs[nObjects].loc[0] = currPos[0];
sceneObjs[nObjects].loc[1] = 0.0;
sceneObjs[nObjects].loc[2] = currPos[1];
sceneObjs[nObjects].loc[3] = 1.0;
sceneObjs[nObjects].frames = 1;
sceneObjs[nObjects].hasAnim = false;
if (id != 0 && id != 55)
sceneObjs[nObjects].scale = 0.005;
if (id == 56) {
sceneObjs[nObjects].scale *= 10; // PART 2C. Scale the human models by 10
sceneObjs[nObjects].frames = 300;
sceneObjs[nObjects].hasAnim = true;
}
if (id >= 57) {
sceneObjs[nObjects].scale *= 12; // Custom scaling for more reasonable sizing
sceneObjs[nObjects].frames = 250; // Custom frame rate
sceneObjs[nObjects].hasAnim = true;
}
sceneObjs[nObjects].rgb[0] = 0.7; sceneObjs[nObjects].rgb[1] = 0.7;
sceneObjs[nObjects].rgb[2] = 0.7; sceneObjs[nObjects].brightness = 1.0;
sceneObjs[nObjects].diffuse = 1.0; sceneObjs[nObjects].specular = 0.5;
sceneObjs[nObjects].ambient = 0.7; sceneObjs[nObjects].shine = 10.0;
sceneObjs[nObjects].angles[0] = 0.0;
sceneObjs[nObjects].angles[1] = 180.0;
sceneObjs[nObjects].angles[2] = 0.0;
sceneObjs[nObjects].meshId = id;
sceneObjs[nObjects].texId = rand() % numTextures;
sceneObjs[nObjects].texScale = 2.0;
toolObj = currObject = nObjects++;
setToolCallbacks(adjustLocXZ, camRotZ(),
adjustScaleY, mat2(0.05, 0, 0, 10.0));
glutPostRedisplay();
makeMenu(); // PART J.2. Object selection sub-menu needs to be updated
}
// PART J.3. Duplicate object
static void duplicateObject(int id) {
if (nObjects == maxObjects) {
return;
}
sceneObjs[nObjects] = sceneObjs[id];
toolObj = currObject = nObjects++;
setToolCallbacks(adjustLocXZ, camRotZ(),
adjustScaleY, mat2(0.05, 0, 0, 10.0));
glutPostRedisplay();
makeMenu(); // PART J.2. Required for object selection sub-menu
}
// PART J.4. Delete object
static void deleteObject(int id) {
sceneObjs[currObject].meshId = NULL;
currObject = -1;
delObjects++;
makeMenu(); // PART J.2. Update object selection sub-menu
}
//------The init function-----------------------------------------------------
void init(void) {
srand (time(NULL)); /* initialize random seed - so the starting scene varies */
aiInit();
// for (int i=0; i < numMeshes; i++)
// meshes[i] = NULL;
glGenVertexArraysAPPLE(numMeshes, vaoIDs); CheckError(); // Allocate vertex array objects for meshes
glGenTextures(numTextures, textureIDs); CheckError(); // Allocate texture objects
// Load shaders and use the resulting shader program
shaderProgram = InitShader("vStart.glsl", "fStart.glsl");
glUseProgram(shaderProgram); CheckError();
// Initialize the vertex position attribute from the vertex shader
vPosition = glGetAttribLocation(shaderProgram, "vPosition");
vNormal = glGetAttribLocation(shaderProgram, "vNormal"); CheckError();
// PART 2D.3. Initialize additional variables
vBoneIDs = glGetAttribLocation(shaderProgram, "boneIDs"); CheckError();
vBoneWeights = glGetAttribLocation(shaderProgram, "boneWeights"); CheckError();
// Likewise, initialize the vertex texture coordinates attribute.
vTexCoord = glGetAttribLocation(shaderProgram, "vTexCoord"); CheckError();
projectionU = glGetUniformLocation(shaderProgram, "Projection");
modelViewU = glGetUniformLocation(shaderProgram, "ModelView");
// PART 2D.3. Initialize additional variable
boneTransformsU = glGetUniformLocation(shaderProgram, "boneTransforms");
// Objects 0, 1 and 2 are the ground, first light and second light.
addObject(0); // Square for the ground
sceneObjs[0].loc = vec4(0.0, 0.0, 0.0, 1.0);
sceneObjs[0].scale = 10.0;
sceneObjs[0].angles[0] = 90.0; // Rotate it.
sceneObjs[0].texScale = 5.0; // Repeat the texture.
addObject(55); // Sphere for the first light
sceneObjs[1].loc = vec4(2.0, 1.0, 1.0, 1.0);
sceneObjs[1].scale = 0.1;
sceneObjs[1].texId = 0; // Plain texture
sceneObjs[1].brightness = 0.2; // The light's brightness is 5 times this (below).
// Second light
addObject(55); // Sphere for the second light
sceneObjs[2].loc = vec4(-2.0, 1.0, 1.0, 1.0);
sceneObjs[2].scale = 0.2;
sceneObjs[2].texId = 0; // Plain texture
sceneObjs[2].brightness = 0.2; // The light's brightness is 5 times this (below).
addObject(rand() % numMeshes); // A test mesh
// We need to enable the depth test to discard fragments that
// are behind previously drawn fragments for the same pixel.
glEnable(GL_DEPTH_TEST);
doRotate(); // Start in camera rotate mode.
glClearColor(0.0, 0.0, 0.0, 1.0); /* black background */
}
//----------------------------------------------------------------------------
void drawMesh(SceneObject sceneObj) {
// Activate a texture, loading if needed.
loadTextureIfNotAlreadyLoaded(sceneObj.texId);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, textureIDs[sceneObj.texId]);
// Texture 0 is the only texture type in this program, and is for the rgb
// colour of the surface but there could be separate types for, e.g.,
// specularity and normals.
glUniform1i(glGetUniformLocation(shaderProgram, "texture"), 0);
// Set the texture scale for the shaders
glUniform1f(glGetUniformLocation(shaderProgram, "texScale"), sceneObj.texScale);
// Set the projection matrix for the shaders
glUniformMatrix4fv(projectionU, 1, GL_TRUE, projection);
// Set the model matrix - this should combine translation, rotation and scaling based on what's
// in the sceneObj structure (see near the top of the program).
// PART B. Object rotation
mat4 rotate = RotateX(-sceneObj.angles[0]) * RotateY(sceneObj.angles[1]) * RotateZ(sceneObj.angles[2]);
mat4 model = Translate(sceneObj.loc) * Scale(sceneObj.scale) * rotate;
// Set the model-view matrix for the shaders
glUniformMatrix4fv(modelViewU, 1, GL_TRUE, view * model);
// Activate the VAO for a mesh, loading if needed.
loadMeshIfNotAlreadyLoaded(sceneObj.meshId); CheckError();
glBindVertexArrayAPPLE(vaoIDs[sceneObj.meshId]); CheckError();
// PART 2D. Calculate animation frame
float poseTime = 0.0;
if (sceneObj.hasAnim) {
poseTime = (int) POSE_TIME % sceneObj.frames;
}
// PART 2D.7. Set the new uniform shader variable (pulled from addingAnimation.txt)
int nBones = meshes[sceneObj.meshId]->mNumBones;
if (nBones == 0) nBones = 1; // If no bones, just a single identity matrix is used
// Get boneTransforms for the first (0th) animation at the given time (a float measured in frames)
mat4 boneTransforms[nBones]; // was: mat4 boneTransforms[mesh->mNumBones];
calculateAnimPose(meshes[sceneObj.meshId], scenes[sceneObj.meshId], 0, poseTime, boneTransforms);
glUniformMatrix4fv(boneTransformsU, nBones, GL_TRUE, (const GLfloat *)boneTransforms);
// Set bounds for the animation Speed
if (ANIM_SPEED > 10) ANIM_SPEED = 10;
if (ANIM_SPEED < 0.1) ANIM_SPEED = 0.1;
if (!ANIM_PAUSED) {
POSE_TIME += ANIM_SPEED/10;
}
glDrawElements(GL_TRIANGLES, meshes[sceneObj.meshId]->mNumFaces * 3, GL_UNSIGNED_INT, NULL); CheckError();
}
//----------------------------------------------------------------------------
void display(void) {
numDisplayCalls++;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
CheckError(); // May report a harmless GL_INVALID_OPERATION with GLEW on the first frame
// PART A. Set the view matrix
mat4 rotate = RotateX(camRotUpAndOverDeg) * RotateY(camRotSidewaysDeg);
view = Translate(0.0, 0.0, -viewDist) * rotate;
SceneObject lightObj1 = sceneObjs[1];
vec4 lightPosition = view * lightObj1.loc;
// PART I. Second light
SceneObject lightObj2 = sceneObjs[2];
vec4 lightPosition2 = rotate * lightObj2.loc;
glUniform4fv(glGetUniformLocation(shaderProgram, "LightPosition"), 1, lightPosition); CheckError();
glUniform4fv(glGetUniformLocation(shaderProgram, "LightPosition2"), 1, lightPosition2); CheckError();
// PART J.1. Passing the light locations
glUniform4fv(glGetUniformLocation(shaderProgram, "LightObj"), 1, lightObj1.loc); CheckError();
glUniform4fv(glGetUniformLocation(shaderProgram, "LightObj2"), 1, lightObj2.loc); CheckError();
glUniform3fv(glGetUniformLocation(shaderProgram, "LightColor"), 1, lightObj1.rgb); CheckError();
glUniform3fv(glGetUniformLocation(shaderProgram, "LightColor2"), 1, lightObj2.rgb); CheckError();
// PART H. Shine requires brightness to be passed
glUniform1f(glGetUniformLocation(shaderProgram, "LightBrightness"), lightObj1.brightness); CheckError();
glUniform1f(glGetUniformLocation(shaderProgram, "LightBrightness2"), lightObj2.brightness); CheckError();
for (int i=0; i < nObjects; i++) {
SceneObject so = sceneObjs[i];
vec3 rgb = so.rgb * so.brightness * 4.0; // Increased base brightness, mentioned in the Overview section
glUniform3fv(glGetUniformLocation(shaderProgram, "AmbientProduct"), 1, so.ambient * rgb); CheckError();
glUniform3fv(glGetUniformLocation(shaderProgram, "DiffuseProduct"), 1, so.diffuse * rgb);
glUniform3fv(glGetUniformLocation(shaderProgram, "SpecularProduct"), 1, so.specular * rgb);
glUniform1f(glGetUniformLocation(shaderProgram, "Shininess"), so.shine); CheckError();
drawMesh(sceneObjs[i]);
}
glutSwapBuffers();
}
//----------------------------------------------------------------------------
//------Menus-----------------------------------------------------------------
//----------------------------------------------------------------------------
static void objectMenu(int id) {
deactivateTool();
addObject(id);
}
static void texMenu(int id) {
deactivateTool();
if (currObject>=0) {
sceneObjs[currObject].texId = id;
glutPostRedisplay();
}
makeMenu(); // [Part J] Object selection name update
}
static void groundMenu(int id) {
deactivateTool();
sceneObjs[0].texId = id;
glutPostRedisplay();
}
// PART C. Adjusts the amounts of ambient and diffuse
static void adjustAmbientDiffuse(vec2 am_df) {
sceneObjs[toolObj].ambient += am_df[0];
sceneObjs[toolObj].diffuse += am_df[1];
}
static void adjustBrightnessY(vec2 by) {
sceneObjs[toolObj].brightness+=by[0];
sceneObjs[toolObj].loc[1]+=by[1];
}
static void adjustRedGreen(vec2 rg) {
sceneObjs[toolObj].rgb[0]+=rg[0];
sceneObjs[toolObj].rgb[1]+=rg[1];
}
static void adjustBlueBrightness(vec2 bl_br) {
sceneObjs[toolObj].rgb[2]+=bl_br[0];
sceneObjs[toolObj].brightness+=bl_br[1];
}
// PART C. Adjusts the amounts of specular light and shine
static void adjustSpecularShine(vec2 sp_sh) {
sceneObjs[toolObj].specular += sp_sh[0];
sceneObjs[toolObj].shine += sp_sh[1];
}
// PART 2D. Adjust animation speed
static void adjustAnimSpeed(vec2 an_sp) {
ANIM_SPEED += an_sp[0];
}
static void lightMenu(int id) {
deactivateTool();
if (id == 70) {
toolObj = 1;
setToolCallbacks(adjustLocXZ, camRotZ(),
adjustBrightnessY, mat2(1.0, 0.0, 0.0, 10.0));
} else if (id >= 71 && id <= 74) {
toolObj = 1;
setToolCallbacks(adjustRedGreen, mat2(1.0, 0, 0, 1.0),
adjustBlueBrightness, mat2(1.0, 0, 0, 1.0));
} else if (id == 80) { // Move Light 2
toolObj = 2;
setToolCallbacks(adjustLocXZ, camRotZ(),
adjustBrightnessY, mat2(1.0, 0.0, 0.0, 10.0));
} else if (id >= 81 && id <= 84) { // R/G/B/ALL Light 2
toolObj = 2;
setToolCallbacks(adjustRedGreen, mat2(1.0, 0, 0, 1.0),
adjustBlueBrightness, mat2(1.0, 0, 0, 1.0));
} else {
printf("Error in lightMenu\n");
exit(1);
}
}
static int createArrayMenu(int size, const char menuEntries[][128], void(*menuFn)(int)) {
int nSubMenus = (size-1)/10 + 1;
int subMenus[nSubMenus];
for (int i=0; i < nSubMenus; i++) {
subMenus[i] = glutCreateMenu(menuFn);
for (int j = i*10+1; j <= min(i*10+10, size); j++)
glutAddMenuEntry(menuEntries[j-1] , j);
CheckError();
}
int menuId = glutCreateMenu(menuFn);
for (int i=0; i < nSubMenus; i++) {
char num[6];
sprintf(num, "%d-%d", i*10+1, min(i*10+10, size));
glutAddSubMenu(num,subMenus[i]);
CheckError();
}
return menuId;
}
static void materialMenu(int id) {
deactivateTool();
if (currObject < 0) return;
if (id==10) {
toolObj = currObject;
setToolCallbacks(adjustRedGreen, mat2(1, 0, 0, 1),
adjustBlueBrightness, mat2(1, 0, 0, 1));
} else if (id == 20) { // PART C. Ambient/Diffuse/Specilar/Shine
setToolCallbacks(adjustAmbientDiffuse, mat2(1, 0, 0, 1),
adjustSpecularShine, mat2(1, 0, 0, 1));
}
else {
printf("Error in materialMenu\n");
}
}
// PART J.2. Object selection menu
static void selectObjectMenu(int id) {
int objectId = id - 100; // Object's actual index
toolObj = objectId;
currObject = objectId;
makeMenu();
}
// PART 2D. Animation menu
static void animationMenu(int id) {
if (id == 60) { // Animation resume
ANIM_PAUSED = false;
makeMenu();
}
if (id == 61) { // Animation pause
ANIM_PAUSED = true;
makeMenu();
}
if (id == 62) { // Animation speed
setToolCallbacks(adjustAnimSpeed, mat2(1, 0, 0, 10),
adjustAnimSpeed, mat2(1, 0, 0, 10));
}
}
static void adjustAngleYX(vec2 angle_yx) {
sceneObjs[currObject].angles[1]+=angle_yx[0];
sceneObjs[currObject].angles[0]+=angle_yx[1];
}
static void adjustAngleZTexscale(vec2 az_ts) {
sceneObjs[currObject].angles[2]+=az_ts[0];
sceneObjs[currObject].texScale+=az_ts[1];
}
static void mainmenu(int id) {
deactivateTool();
if (id == 41 && currObject>=0) {
toolObj=currObject;
setToolCallbacks(adjustLocXZ, camRotZ(),
adjustScaleY, mat2(0.05, 0, 0, 10));
}
if (id == 50) {
doRotate();
}
if (id == 51 && currObject >= 0) {
duplicateObject(currObject);
}
if (id == 52 && currObject >= 0) {
deleteObject(currObject);
}
if (id == 55 && currObject>=0) {
setToolCallbacks(adjustAngleYX, mat2(400, 0, 0, -400),
adjustAngleZTexscale, mat2(400, 0, 0, 15));
}
if (id == 99) exit(0);
}
static void makeMenu() {
int objectId = createArrayMenu(numMeshes, objectMenuEntries, objectMenu);
int materialMenuId = glutCreateMenu(materialMenu);
glutAddMenuEntry("R/G/B/All",10);
glutAddMenuEntry("Ambient/Diffuse/Specular/Shine",20);
int texMenuId = createArrayMenu(numTextures, textureMenuEntries, texMenu);
int groundMenuId = createArrayMenu(numTextures, textureMenuEntries, groundMenu);
int lightMenuId = glutCreateMenu(lightMenu);
glutAddMenuEntry("Move Light 1",70);
glutAddMenuEntry("R/G/B/All Light 1",71);
glutAddMenuEntry("Move Light 2",80);
glutAddMenuEntry("R/G/B/All Light 2",81);
// PART J.2. Selection of objects using a sub-menu
int selectObjMenuId = glutCreateMenu(selectObjectMenu);
for (int i = 3; i < nObjects; i++) { // Exclude ground, lightObj1 and lightObj2
char objectName[128]; // Same size used in gnatidread.h
if (sceneObjs[i].meshId != NULL) {
int objectId = 100 + i;
strcpy(objectName, objectMenuEntries[sceneObjs[i].meshId - 1]);
strcat(objectName, " (");
strcat(objectName, textureMenuEntries[sceneObjs[i].texId - 1]);
strcat(objectName, ")");
if (currObject == i) { // Indicate currently selected object
strcat(objectName, " *");
}
glutAddMenuEntry(objectName, objectId);
}
}
// PART 2D. Animation control using a sub-menu
int animationMenuId = glutCreateMenu(animationMenu);
if (ANIM_PAUSED) {
glutAddMenuEntry("Resume Animation", 60);
} else {
glutAddMenuEntry("Pause Animation", 61);
}
glutAddMenuEntry("Animation Speed", 62);
glutCreateMenu(mainmenu);
glutAddMenuEntry("Rotate/Move Camera", 50);
glutAddSubMenu("Add Object", objectId);
// PART J.5. Show sub-menu if an object exists (excluding the ground and lights)
if (nObjects - delObjects - 3 > 0) {
glutAddSubMenu("Select Object", selectObjMenuId);
}
if (currObject != -1) { // PART J.5. Show only when an object is selected
glutAddMenuEntry("Duplicate Object", 51);
glutAddMenuEntry("Delete Object", 52);
glutAddMenuEntry("Position/Scale", 41);
glutAddMenuEntry("Rotation/Texture Scale", 55);
glutAddSubMenu("Material", materialMenuId);
glutAddSubMenu("Texture", texMenuId);
}
glutAddSubMenu("Animation", animationMenuId);
glutAddSubMenu("Ground Texture", groundMenuId);
glutAddSubMenu("Lights", lightMenuId);
glutAddMenuEntry("EXIT", 99);
glutAttachMenu(GLUT_RIGHT_BUTTON);
}
//----------------------------------------------------------------------------
void keyboard(unsigned char key, int x, int y) {
switch (key) {
case 033:
exit(EXIT_SUCCESS);
break;
}
}
//----------------------------------------------------------------------------
void idle(void) {
glutPostRedisplay();
}
//----------------------------------------------------------------------------
void reshape(int width, int height) {
windowWidth = width;
windowHeight = height;
glViewport(0, 0, width, height);
GLfloat nearDist = 0.01; // PART D. Close-up clipping
// PART E. Window reshaping
if (width < height) { // Ensure visibility is unchanged when width < height
projection = Frustum(-nearDist, nearDist, -nearDist*(float)height/(float)width, nearDist*(float)height/(float)width, nearDist, 100.0);
} else {
projection = Frustum(-nearDist*(float)width/(float)height, nearDist*(float)width/(float)height, -nearDist, nearDist, nearDist, 100.0);
}
}
//----------------------------------------------------------------------------
void timer(int unused) {
char title[256];
sprintf(title, "%s %s: %d Frames Per Second @ %d x %d",
lab, programName, numDisplayCalls, windowWidth, windowHeight);
glutSetWindowTitle(title);
numDisplayCalls = 0;
glutTimerFunc(1000, timer, 1);
}
//----------------------------------------------------------------------------
char dirDefault1[] = "models-textures";
char dirDefault3[] = "/tmp/models-textures";
char dirDefault4[] = "/d/models-textures";
char dirDefault2[] = "/cslinux/examples/CITS3003/project-files/models-textures";
void fileErr(char* fileName) {
printf("Error reading file: %s\n", fileName);
printf("When not in the CSSE labs, you will need to include the directory containing\n");
printf("the models on the command line, or put it in the same folder as the exectutable.");
exit(1);
}
//----------------------------------------------------------------------------
int main(int argc, char* argv[]) {
// Get the program name, excluding the directory, for the window title
programName = argv[0];
for (char *cpointer = argv[0]; *cpointer != 0; cpointer++)
if (*cpointer == '/' || *cpointer == '\\') programName = cpointer+1;
// Set the models-textures directory, via the first argument or some handy defaults.
if (argc > 1)
strcpy(dataDir, argv[1]);
else if (opendir(dirDefault1)) strcpy(dataDir, dirDefault1);
else if (opendir(dirDefault2)) strcpy(dataDir, dirDefault2);
else if (opendir(dirDefault3)) strcpy(dataDir, dirDefault3);
else if (opendir(dirDefault4)) strcpy(dataDir, dirDefault4);
else fileErr(dirDefault1);
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
glutInitWindowSize(windowWidth, windowHeight);
glutCreateWindow("Initialising...");
// glewInit(); // With some old hardware yields GL_INVALID_ENUM, if so use glewExperimental.
CheckError(); // This bug is explained at: http://www.opengl.org/wiki/OpenGL_Loading_Library
init();
CheckError();
glutDisplayFunc(display);
glutKeyboardFunc(keyboard);
glutIdleFunc(idle);
glutMouseFunc(mouseClickOrScroll);
glutPassiveMotionFunc(mousePassiveMotion);
glutMotionFunc(doToolUpdateXY);
glutReshapeFunc(reshape);
glutTimerFunc(1000, timer, 1);
CheckError();
makeMenu();
CheckError();
glutMainLoop();
return 0;
}
| 38.214452 | 143 | 0.621538 | [
"mesh",
"object",
"model"
] |
5809d3226a0d29be5da602f07648fd47f9e47a92 | 4,735 | cpp | C++ | velox/dwio/dwrf/test/TestStripeDictionaryCache.cpp | vancexu/velox | fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4 | [
"Apache-2.0"
] | 672 | 2021-09-22T16:45:58.000Z | 2022-03-31T13:42:31.000Z | velox/dwio/dwrf/test/TestStripeDictionaryCache.cpp | vancexu/velox | fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4 | [
"Apache-2.0"
] | 986 | 2021-09-22T17:02:52.000Z | 2022-03-31T23:57:25.000Z | velox/dwio/dwrf/test/TestStripeDictionaryCache.cpp | vancexu/velox | fa076fd9eab6ae4090ed9b9b91c4e7658d4ee1e4 | [
"Apache-2.0"
] | 178 | 2021-09-22T17:27:47.000Z | 2022-03-31T03:18:37.000Z | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "velox/common/memory/Memory.h"
#include "velox/dwio/dwrf/reader/StripeDictionaryCache.h"
#include "velox/dwio/dwrf/test/OrcTest.h"
using namespace ::testing;
namespace facebook::velox::dwrf {
namespace {
folly::Function<BufferPtr(memory::MemoryPool*)> genConsecutiveRangeBuffer(
int64_t begin,
int64_t end) {
return [begin, end](memory::MemoryPool* pool) {
BufferPtr dictionaryBuffer =
AlignedBuffer::allocate<int64_t>(end - begin, pool);
auto data = dictionaryBuffer->asMutable<int64_t>();
for (int64_t i = 0; i < end - begin; ++i) {
data[i] = begin + i;
}
return dictionaryBuffer;
};
}
void verifyRange(BufferPtr bufferPtr, int64_t begin, int64_t end) {
size_t bufferSize = bufferPtr->size() / sizeof(int64_t);
ASSERT_EQ(end - begin, bufferSize);
auto data = bufferPtr->as<int64_t>();
std::vector<int64_t> actualRange{};
for (size_t i = 0; i < bufferSize; ++i) {
actualRange.push_back(data[i]);
}
std::vector<int64_t> expectedRange{};
while (begin < end) {
expectedRange.push_back(begin++);
}
EXPECT_THAT(actualRange, ElementsAreArray(expectedRange));
}
} // namespace
TEST(TestStripeDictionaryCache, RegisterDictionary) {
auto& pool = memory::getProcessDefaultMemoryManager().getRoot();
{
StripeDictionaryCache cache{&pool};
cache.registerIntDictionary({9, 0}, genConsecutiveRangeBuffer(0, 100));
EXPECT_EQ(1, cache.intDictionaryFactories_.size());
EXPECT_EQ(1, cache.intDictionaryFactories_.count({9, 0}));
}
// When a dictionary is registered multiple times, we only honor the
// first invocation. In practice, all params are retrieved from the same
// StripeStream, so it won't matter. For here, we have to test that
// the content is not changed in getDictionaryBuffer tests.
{
StripeDictionaryCache cache{&pool};
cache.registerIntDictionary({9, 0}, genConsecutiveRangeBuffer(0, 100));
cache.registerIntDictionary({9, 0}, genConsecutiveRangeBuffer(100, 200));
EXPECT_EQ(1, cache.intDictionaryFactories_.size());
EXPECT_EQ(1, cache.intDictionaryFactories_.count({9, 0}));
}
{
StripeDictionaryCache cache{&pool};
cache.registerIntDictionary({1, 0}, genConsecutiveRangeBuffer(0, 100));
cache.registerIntDictionary({1, 1}, genConsecutiveRangeBuffer(0, 100));
cache.registerIntDictionary({9, 0}, genConsecutiveRangeBuffer(100, 200));
EXPECT_EQ(3, cache.intDictionaryFactories_.size());
EXPECT_EQ(1, cache.intDictionaryFactories_.count({1, 0}));
EXPECT_EQ(1, cache.intDictionaryFactories_.count({1, 1}));
EXPECT_EQ(1, cache.intDictionaryFactories_.count({9, 0}));
}
}
TEST(TestStripeDictionaryCache, GetDictionaryBuffer) {
auto& pool = memory::getProcessDefaultMemoryManager().getRoot();
{
StripeDictionaryCache cache{&pool};
cache.registerIntDictionary({9, 0}, genConsecutiveRangeBuffer(0, 100));
verifyRange(cache.getIntDictionary({9, 0}), 0, 100);
EXPECT_ANY_THROW(cache.getIntDictionary({7, 0}));
}
// When a dictionary is registered multiple times, we only honor the
// first invocation. In practice, all params are retrieved from the same
// StripeStream, so it won't matter. For here, we have to test that
// the content is not changed.
{
StripeDictionaryCache cache{&pool};
cache.registerIntDictionary({9, 0}, genConsecutiveRangeBuffer(0, 100));
cache.registerIntDictionary({9, 0}, genConsecutiveRangeBuffer(100, 200));
verifyRange(cache.getIntDictionary({9, 0}), 0, 100);
}
{
StripeDictionaryCache cache{&pool};
cache.registerIntDictionary({1, 0}, genConsecutiveRangeBuffer(0, 100));
cache.registerIntDictionary({1, 1}, genConsecutiveRangeBuffer(0, 100));
cache.registerIntDictionary({9, 0}, genConsecutiveRangeBuffer(100, 200));
verifyRange(cache.getIntDictionary({1, 0}), 0, 100);
verifyRange(cache.getIntDictionary({1, 1}), 0, 100);
verifyRange(cache.getIntDictionary({9, 0}), 100, 200);
EXPECT_ANY_THROW(cache.getIntDictionary({2, 0}));
}
}
} // namespace facebook::velox::dwrf
| 36.705426 | 77 | 0.717001 | [
"vector"
] |
5809dd9eb31dc67c3ddf3e8a005dba27053c456d | 2,594 | cpp | C++ | cpp/test/boost/msm_choise.cpp | dvetutnev/fart-checker | bfa6effa2cd6adecb7571728c9498e76d862a1ce | [
"MIT"
] | null | null | null | cpp/test/boost/msm_choise.cpp | dvetutnev/fart-checker | bfa6effa2cd6adecb7571728c9498e76d862a1ce | [
"MIT"
] | null | null | null | cpp/test/boost/msm_choise.cpp | dvetutnev/fart-checker | bfa6effa2cd6adecb7571728c9498e76d862a1ce | [
"MIT"
] | null | null | null | #include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/front/functor_row.hpp>
#include <boost/msm/back/state_machine.hpp>
#include <gmock/gmock.h>
using ::testing::InSequence;
namespace {
struct Mock
{
MOCK_METHOD(void, onEvent, (), ());
MOCK_METHOD(void, onRepeat, (), ());
MOCK_METHOD(void, onDone, (), ());
};
struct Event {};
namespace msmf = boost::msm::front;
struct DefStateMachine : msmf::state_machine_def<DefStateMachine>
{
// States
struct State : msmf::state<> {};
struct Choise : msmf::state<> {};
struct End : msmf::state<> {};
using initial_state = State;
// Actions
struct onEvent
{
template <typename Fsm, typename Event, typename SourceState, typename TargetState>
void operator()(const Event&, Fsm& fsm, SourceState&, TargetState&) {
fsm.count++;
fsm.mock.onEvent();
}
};
struct onRepeat
{
template <class Fsm,class Event, class SourceState, typename TargetState>
void operator()(const Event&, Fsm& fsm, SourceState&, TargetState&) {
fsm.mock.onRepeat();
}
};
struct onDone
{
template <typename Fsm, typename Event, typename SourceState, typename TargetState>
void operator()(const Event&, Fsm& fsm, SourceState&, TargetState&) {
fsm.mock.onDone();
}
};
// Guards
struct Guard
{
template <typename Fsm, typename Event, typename SourceState, typename TargetState>
bool operator()(const Event&, Fsm& fsm, SourceState&, TargetState&) const {
return fsm.count == 2;
}
};
struct transition_table : boost::mpl::vector<
// Start Event Next Action Guard
msmf::Row<State, Event, Choise, onEvent, msmf::none>,
msmf::Row<Choise, msmf::none, State, onRepeat, msmf::none>,
msmf::Row<Choise, msmf::none, End, onDone, Guard>
>{};
int count = 0;
Mock mock;
};
using StateMachine = boost::msm::back::state_machine<DefStateMachine>;
} // Anonymouse namespace
TEST(Boost_MSM_choise, _) {
StateMachine stateMachine;
{
InSequence _;
EXPECT_CALL(stateMachine.mock, onEvent());
EXPECT_CALL(stateMachine.mock, onRepeat());
EXPECT_CALL(stateMachine.mock, onEvent());
EXPECT_CALL(stateMachine.mock, onDone());
}
stateMachine.start();
stateMachine.process_event(Event{});
stateMachine.process_event(Event{});
stateMachine.stop();
}
| 24.018519 | 91 | 0.606785 | [
"vector"
] |
58261da994d4d303466dc43f61ccf2d4074ea3d6 | 33,402 | cpp | C++ | src/ipyopt_module.cpp | py-nonlinopt/ipyopt | 2fba5af041e4ffa3cb25b31e7e563faad055d31f | [
"BSD-3-Clause"
] | 2 | 2021-05-24T21:23:16.000Z | 2022-03-21T01:45:35.000Z | src/ipyopt_module.cpp | py-nonlinopt/ipyopt | 2fba5af041e4ffa3cb25b31e7e563faad055d31f | [
"BSD-3-Clause"
] | 1 | 2021-06-03T14:37:06.000Z | 2021-06-03T14:37:06.000Z | src/ipyopt_module.cpp | py-nonlinopt/ipyopt | 2fba5af041e4ffa3cb25b31e7e563faad055d31f | [
"BSD-3-Clause"
] | null | null | null | #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#define PY_ARRAY_UNIQUE_SYMBOL ipyopt_ARRAY_API
#include "numpy/arrayobject.h"
#include "nlp_builder.hpp"
#include "py_helpers.hpp"
#include "py_nlp.hpp"
static bool _PyDict_Check(const PyObject *obj) {
return PyDict_Check(obj);
} // Macro -> function
static bool check_array_dim(PyArrayObject *arr, unsigned int dim,
const char *name) {
if ((unsigned int)PyArray_NDIM(arr) != 1) {
PyErr_Format(PyExc_ValueError,
"%s has wrong number of dimensions. Expected %d, got %d", name,
1, PyArray_NDIM(arr));
return false;
}
if (PyArray_DIMS(arr)[0] == dim)
return true;
PyErr_Format(PyExc_ValueError,
"%s has wrong shape. Expected (%d,), found (%d,)", name, dim,
PyArray_DIMS(arr)[0]);
return false;
}
static double *optional_array_data(PyArrayObject *arr) {
if (arr == nullptr)
return nullptr;
return (double *)PyArray_DATA(arr);
}
template <class T, bool ALLOW_0>
static bool check_vec_size(const std::vector<T> &vec, unsigned int size,
const char *name) {
if constexpr (ALLOW_0) {
if (vec.empty())
return true;
}
if (vec.size() == size)
return true;
PyErr_Format(PyExc_ValueError, "%s has wrong size %d (expected: %d)", name,
vec.size(), size);
return false;
}
static bool parse_sparsity_indices(PyObject *obj, SparsityIndices &idx) {
PyObject *rows, *cols;
Py_ssize_t n, i;
if (!PyTuple_Check(obj)) {
PyErr_Format(PyExc_TypeError,
"Sparsity info: a tuple of size 2 is needed.");
return false;
}
if (PyTuple_Size(obj) != 2) {
PyErr_Format(
PyExc_TypeError,
"Sparsity info: a tuple of size 2 is needed. Found tuple of size %d",
PyTuple_Size(obj));
return false;
}
rows = PyTuple_GetItem(obj, 0);
cols = PyTuple_GetItem(obj, 1);
n = PyObject_Length(rows);
if (n != PyObject_Length(cols)) {
PyErr_Format(PyExc_TypeError,
"Sparsity info: length of row indices (%d) does not match "
"lenth of column indices (%d)",
n, PyObject_Length(cols));
return false;
}
std::vector<int> row, col;
PyObject *row_iter = PyObject_GetIter(rows);
PyObject *col_iter = PyObject_GetIter(cols);
PyObject *row_item, *col_item;
for (i = 0; i < n; i++) {
row_item = PyIter_Next(row_iter);
col_item = PyIter_Next(col_iter);
if (row_item != nullptr)
row.push_back(PyLong_AsLong(row_item));
if (col_item != nullptr)
col.push_back(PyLong_AsLong(col_item));
if (row_item == nullptr || col_item == nullptr ||
PyErr_Occurred() != nullptr) {
PyErr_Format(PyExc_TypeError,
"Sparsity info: Row an column indices must be integers");
return false;
}
}
idx = std::make_tuple(row, col);
return true;
}
static bool check_non_negative(int n, const char *name) {
if (n >= 0)
return true;
PyErr_Format(PyExc_ValueError, "%s can't be negative", name);
return false;
}
static bool check_kwargs(const PyObject *kwargs) {
if (kwargs == nullptr || PyDict_Check(kwargs))
return true;
PyErr_Format(PyExc_RuntimeError,
"C-API-Level Error: keywords are not of type dict");
return false;
}
static bool check_optional(const PyObject *obj,
bool (*checker)(const PyObject *),
const char *obj_name, const char *type_name) {
if (obj == nullptr || obj == Py_None || checker(obj))
return true;
PyErr_Format(PyExc_TypeError, "Wrong type for %s. Required: %s", obj_name,
type_name);
return false;
}
static bool check_no_args(const char *f_name, PyObject *args) {
if (args == nullptr)
return true;
if (!PyTuple_Check(args)) {
PyErr_Format(PyExc_RuntimeError, "Argument keywords is not a tuple");
return false;
}
unsigned int n = PyTuple_Size(args);
if (n == 0)
return true;
PyErr_Format(PyExc_TypeError,
"%s() takes 0 positional arguments but %d %s given", f_name, n,
n == 1 ? "was" : "were");
return false;
}
template <const char *ArgName, bool ALLOW_0, typename T>
static int parse_vec(PyObject *obj, void *out) {
std::vector<T> &vec = *(std::vector<T> *)out;
if constexpr (ALLOW_0) {
if (obj == Py_None || obj == nullptr) {
vec.clear();
return 1;
}
}
if (!PyArray_Check(obj)) {
PyErr_Format(PyExc_TypeError,
"%s() argument '%s' must be numpy.ndarray, not %s", "%s",
ArgName, Py_TYPE(obj)->tp_name);
return 0;
}
PyArrayObject *arr = (PyArrayObject *)obj;
if ((unsigned int)PyArray_NDIM(arr) != 1) {
PyErr_Format(
PyExc_ValueError,
"%s() argument '%s': numpy.ndarray dimension must be 1, not %d", "%s",
ArgName, PyArray_NDIM(arr));
return 0;
}
vec.resize(PyArray_SIZE(arr));
for (unsigned int i = 0; i < vec.size(); i++) {
vec[i] = ((T *)PyArray_DATA(arr))[i];
}
return 1;
}
template <const char *ArgName, class LLC>
static bool parse_py_capsule(PyObject *obj, LLC &llc) {
const auto name = PyCapsule_GetName(obj);
if (!PyCapsule_IsValid(obj, name)) {
PyErr_Format(PyExc_ValueError,
"%s() argument %s: invalid PyCapsule with name '%s'", "%s",
ArgName, (name != nullptr) ? name : "");
return false;
}
llc.function =
(typename LLC::FunctionType *)(PyCapsule_GetPointer(obj, name));
llc.user_data = PyCapsule_GetContext(obj);
return true;
}
/**
* Parse a `scipy.LowLevelCallable`_ into 2 void pointers.
*
* A `scipy.LowLevelCallable`_ is a sub class of a 3 tuple
* tuple[PyCapsule, Union, Union]
* The actual callback is held in slot 0.
* This PyCapsule also holds the userdata as its context.
*
* See https://github.com/scipy/scipy/blob/master/scipy/_lib/_ccallback.py
* and https://docs.scipy.org/doc/scipy/reference/generated/scipy.LowLevelCallable.html
*/
template <const char *ArgName, class LLC>
static bool parse_scipy_low_level_callable(PyObject *obj, LLC &llc) {
auto capsule = PyTuple_GET_ITEM(obj, 0);
if (capsule == nullptr) {
PyErr_Format(PyExc_SystemError, "%s() argument '%s': invalid tuple", "%s",
ArgName);
}
return parse_py_capsule<ArgName, LLC>(capsule, llc);
}
/// This is for python memory management (parse py object and keep a pointer to the original py object at the same time)
template <class T> struct WithOwnedPyObject {
T callable;
PyObject *owned;
WithOwnedPyObject() : owned{nullptr} {}
};
template <const char *ArgName, class Variant, class PyCallable, class CCallable>
static int parse_callable(PyObject *obj, void *out) {
auto &callable = *(WithOwnedPyObject<Variant> *)out;
callable.owned = obj;
if (PyCapsule_CheckExact(obj)) {
CCallable llc;
if (!parse_py_capsule<ArgName, CCallable>(obj, llc))
return 0;
callable.callable = llc;
return 1;
}
if (PyTuple_Check(obj) && PyTuple_Size(obj) == 3) {
CCallable llc;
if (!parse_scipy_low_level_callable<ArgName, CCallable>(obj, llc))
return 0;
callable.callable = llc;
return 1;
}
if (PyCallable_Check(obj)) {
callable.callable = PyCallable{obj};
return 1;
}
PyErr_Format(PyExc_ValueError,
"%s() argument '%s': must be Union[Callable, PyCapsule, "
"scipy.LowLevelCallable], not %s",
"%s", ArgName, Py_TYPE(obj)->tp_name);
return 0;
}
using PyConverter = int(PyObject *, void *);
template <PyConverter converter>
static int parse_optional(PyObject *obj, void *out) {
if (obj == nullptr || obj == Py_None)
return 1;
return converter(obj, out);
}
static std::optional<IpoptOptionValue> py_unpack(PyObject *obj) {
if (PyLong_Check(obj))
return (int)PyLong_AsLong(obj);
if (PyFloat_Check(obj))
return (double)PyFloat_AsDouble(obj);
if (PyUnicode_Check(obj))
return (char *)PyUnicode_AsUTF8(obj);
return std::nullopt;
}
static bool set_options(NlpBundle &bundle, PyObject *dict) {
PyObject *key, *val;
Py_ssize_t pos = 0;
if (dict == nullptr)
return true;
while (PyDict_Next(dict, &pos, &key, &val)) {
const char *c_key = PyUnicode_AsUTF8(key);
std::optional<IpoptOptionValue> value = py_unpack(val);
if (!value.has_value()) {
PyErr_Format(PyExc_TypeError,
"The value for option %s has unsupported type", c_key);
return false;
}
if (!bundle.set_option(c_key, value.value())) {
PyErr_Format(PyExc_ValueError, "Failed to set the Ipopt option '%s'",
c_key);
return false;
}
}
return true;
}
static void reformat_error(const char *f_name) {
PyObject *ptype, *pvalue, *ptraceback;
PyErr_Fetch(&ptype, &pvalue, &ptraceback);
const char *pStrErrorMessage = PyUnicode_AsUTF8(pvalue);
PyErr_Format(ptype, pStrErrorMessage, f_name);
}
/// Python memory management:
constexpr std::size_t max_owned_py_objects = 6;
extern "C" {
typedef struct {
PyObject_HEAD NlpBundle *bundle;
NlpData *nlp;
// Python memory management:
PyObject *owned_py_objects[max_owned_py_objects];
} PyNlpApp;
static int py_ipopt_problem_clear(PyNlpApp *self) {
for (std::size_t i = 0; i < max_owned_py_objects; i++)
if (self->owned_py_objects[i] != nullptr) {
Py_CLEAR(self->owned_py_objects[i]);
self->owned_py_objects[i] = nullptr;
}
return 0;
}
static void py_ipopt_problem_dealloc(PyObject *self) {
auto obj = (PyNlpApp *)self;
PyObject_GC_UnTrack(self);
py_ipopt_problem_clear(obj);
if (obj->bundle != nullptr) {
delete obj->bundle;
obj->bundle = nullptr;
}
Py_TYPE(self)->tp_free(self);
}
static int py_ipopt_problem_traverse(PyNlpApp *self, visitproc visit,
void *arg) {
for (std::size_t i = 0; i < max_owned_py_objects; i++)
if (self->owned_py_objects[i] != nullptr) {
Py_VISIT(self->owned_py_objects[i]);
}
return 0;
}
// Cannot pass string literals as template args. Therefor use static strings:
constexpr char arg_x_l[] = "x_l";
constexpr char arg_x_u[] = "x_u";
constexpr char arg_g_l[] = "g_l";
constexpr char arg_g_u[] = "g_u";
constexpr char arg_f[] = "eval_f";
constexpr char arg_grad_f[] = "eval_grad_f";
constexpr char arg_g[] = "eval_g";
constexpr char arg_jac_g[] = "eval_jac_g";
constexpr char arg_h[] = "eval_h";
constexpr char arg_intermediate_callback[] = "intermediate_callback";
constexpr char arg_x_scaling[] = "x_scaling";
constexpr char arg_g_scaling[] = "g_scaling";
static char IPYOPT_PROBLEM_DOC[] = R"mdoc(
Ipopt problem type in python
Problem(n: int, x_l: numpy.ndarray[numpy.float64], x_u: numpy.ndarray[numpy.float64], m: int, g_l: numpy.ndarray[numpy.float64], g_u: numpy.ndarray[numpy.float64], sparsity_indices_jac_g: tuple[Sequence[float], Sequence[float]], sparsity_indices_h: tuple[Sequence[float], Sequence[float]], eval_f: Union[Callable[[numpy.ndarray], float], PyCapsule, scipy.LowLevelCallable], eval_grad_f: Union[Callable[[numpy.ndarray, numpy.ndarray], Any], PyCapsule, scipy.LowLevelCallable], eval_g: Union[Callable[[numpy.ndarray, numpy.ndarray], Any], PyCapsule, scipy.LowLevelCallable], eval_jac_g: Union[Callable[[numpy.ndarray, numpy.ndarray], Any], PyCapsule, scipy.LowLevelCallable], eval_h: Optional[Union[Callable[[numpy.ndarray, numpy.ndarray, float, numpy.ndarray], Any], PyCapsule, scipy.LowLevelCallable]] = None, intermediate_callback: Optional[Union[Callable[[int, int, float, float, float, float, float, float, float, float, int], Any], PyCapsule, scipy.LowLevelCallable]] = None, obj_scaling: float = 1., x_scaling: Optional[numpy.ndarray[numpy.float64]] = None, g_scaling: Optional[numpy.ndarray[numpy.float64]] = None, ipopt_options: Optional[dict[str, Union[int, float, str]]] = None) -> Problem
Args:
n: Number of variables (dimension of ``x``)
x_l: Lower bound of ``x`` as bounded constraints
x_u: Upper bound of ``x`` as bounded constraints
both ``x_l``, ``x_u`` should be one 1-dim arrays with length ``n``
m: Number of constraints
g_l: Lower bound of constraints
g_u: Upper bound of constraints
both ``g_l``, ``g_u`` should be one dimension arrays with length ``m``
sparsity_indices_jac_g: Positions of non-zero entries of ``jac_g`` in the form of a tuple of two sequences of the same length (first list are column indices, second column are row indices)
sparsity_indices_h: Positions of non-zero entries of ``hess``
eval_f: Callback function to calculate objective value.
Signature: ``eval_f(x: numpy.ndarray) -> float``. Also accepts a `PyCapsule`_ / `scipy.LowLevelCallable`_ object. In this case, the C function has signature::
bool f(int n, double* x, double *obj_value, void *user_data)
eval_grad_f: calculates gradient for objective function.
Signature: ``eval_grad_f(x: numpy.ndarray, out: numpy.ndarray) -> Any``.
The array ``out`` must be a 1-dim array matching the length of ``x``, i.e. ``n``.
A possible return value will be ignored.
Also accepts a `PyCapsule`_ / `scipy.LowLevelCallable`_ object. In this case, the C function has signature::
bool grad_f(int n, double* x, double *out, void *user_data)
eval_g: calculates the constraint values and return an array
The constraints are defined by ::
g_l <= g(x) <= g_u
Signature: ``eval_g(x: numpy.ndarray, out: numpy.ndarray) -> Any``.
The array ``out`` must be a 1-dim array of length ``m``.
A possible return value will be ignored.
Also accepts a `PyCapsule`_ / `scipy.LowLevelCallable`_ object. In this case, the C function has signature::
bool g(int n, double* x, int m, double *out, void *user_data)
eval_jac_g: calculates the Jacobi matrix.
Signature: ``eval_jac_g(x: numpy.ndarray, out: numpy.ndarray) -> Any``. The array ``out`` must be a 1-dim array whose entries are the entries of the Jacobi matrix `jac_g` listed in ``sparsity_indices_jac_g`` (order matters).
A possible return value will be ignored.
Also accepts a `PyCapsule`_ / `scipy.LowLevelCallable`_ object. In this case, the C function has signature::
bool jac_g(int n,
double* x,
int m,
int nele_jac,
double *out,
void *user_data)
eval_h: calculates the Hessian of the Lagrangian ``L`` (optional).
Signature::
eval_h(x: numpy.ndarray, lagrange: numpy.ndarray,
obj_factor: float, out: numpy.ndarray) -> Any
The array ``out`` must be a 1-dim array and contain the entries of the Hessian of the Lagrangian L::
L = obj_factor * f + lagrange[i] * g[i] (sum over `i`),
listed in ``sparsity_indices_hess`` for given ``obj_factor: float``
and ``lagrange: numpy.ndarray`` of shape ``(m,)``.
A possible return value will be ignored.
If omitted, the parameter ``sparsity_indices_hess`` will be ignored and Ipopt will use approximated hessian
which will make the convergence slower.
Also accepts a `PyCapsule`_ / `scipy.LowLevelCallable`_ object. In this case, the C function has signature::
bool h(int n,
double* x,
double obj_value,
int m,
double *lagrange,
int nele_hess,
double *out,
void *user_data)
intermediate_callback: Intermediate Callback method for the user.
This method is called once per iteration (during the convergence check), and can be used to obtain information about the optimization status while Ipopt solves the problem, and also to request a premature termination (see the Ipopt docs for more details).
Signature::
intermediate_callback(
mode: int, iter: int, obj_value: float,
inf_pr: float, inf_du: float, mu: float,
d_norm: float, regularization_size: float,
alpha_du: float, alpha_pr: float,
ls_trials: int
) -> Any
Also accepts a `PyCapsule`_ / `scipy.LowLevelCallable`_ object. In this case, the C function has signature::
bool intermediate_callback(int algorithm_mode,
int iter,
double obj_value,
double inf_pr,
double inf_du,
double mu,
double d_norm,
double regularization_size,
double alpha_du,
double alpha_pr,
int ls_trails,
const void *ip_data,
void *ip_cq,
void *userdata)
obj_scaling: A scaling factor for the objective value (see ``set_problem_scaling``).
x_scaling: Either ``None`` (no scaling) or a ``numpy.ndarray`` of length ``n``, scaling the ``x`` variables (see :func:`set_problem_scaling`).
g_scaling: Either ``None`` (no scaling) or a ``numpy.ndarray`` of length ``m``, scaling the ``g`` variables (see :func:`set_problem_scaling`).
ipopt_options: A dict of key value pairs, to be passed to Ipopt (use :func:`get_ipopt_options` to get a list of all options available)"
.. _`PyCapsule`: https://docs.python.org/3/c-api/capsule.html
.. _`scipy.LowLevelCallable`: https://docs.scipy.org/doc/scipy/reference/generated/scipy.LowLevelCallable.html?highlight=lowlevelcallable#scipy.LowLevelCallable
)mdoc";
static PyObject *py_ipopt_problem_new(PyTypeObject *type, PyObject *args,
PyObject *keywords) {
auto *self = (PyNlpApp *)type->tp_alloc(type, 0);
for (std::size_t i = 0; i < max_owned_py_objects; i++)
self->owned_py_objects[i] = nullptr;
self->bundle = new NlpBundle{};
if (!*self->bundle) {
delete self->bundle;
self->bundle = nullptr;
type->tp_free(self);
PyErr_SetString(PyExc_MemoryError, "Cannot create IpoptProblem instance");
return nullptr;
}
Ipopt::Index n, m;
Ipopt::Number obj_scaling;
PyObject *py_sparsity_indices_jac_g = nullptr;
PyObject *py_sparsity_indices_h = nullptr;
PyObject *py_ipopt_options = nullptr;
std::vector<double> x_scaling, g_scaling, x_l, x_u, g_l, g_u;
WithOwnedPyObject<FCallable> py_eval_f;
WithOwnedPyObject<GradFCallable> py_eval_grad_f;
WithOwnedPyObject<GCallable> py_eval_g;
WithOwnedPyObject<JacGCallable> py_eval_jac_g;
WithOwnedPyObject<HCallable> py_eval_h;
WithOwnedPyObject<IntermediateCallbackCallable> py_intermediate_callback;
SparsityIndices sparsity_indices_jac_g, sparsity_indices_h;
const char *arg_names[] = {"n",
"x_l",
"x_u",
"m",
"g_l",
"g_u",
"sparsity_indices_jac_g",
"sparsity_indices_h",
"eval_f",
"eval_grad_f",
"eval_g",
"eval_jac_g",
"eval_h",
"intermediate_callback",
"obj_scaling",
"x_scaling",
"g_scaling",
"ipopt_options",
nullptr};
if (!PyArg_ParseTupleAndKeywords(
args, keywords,
"iO&O&iO&O&OOO&O&O&O&|O&O&dO&O&O:%s", // function name will be substituted later
const_cast<char **>(arg_names), &n,
&parse_vec<arg_x_l, false, double>, &x_l,
&parse_vec<arg_x_u, false, double>, &x_u, &m,
&parse_vec<arg_g_l, false, double>, &g_l,
&parse_vec<arg_g_u, false, double>, &g_u, &py_sparsity_indices_jac_g,
&py_sparsity_indices_h,
&parse_callable<arg_f, FCallable, ipyopt::py::F, ipyopt::c::F>,
&py_eval_f,
&parse_callable<arg_grad_f, GradFCallable, ipyopt::py::GradF,
ipyopt::c::GradF>,
&py_eval_grad_f,
&parse_callable<arg_g, GCallable, ipyopt::py::G, ipyopt::c::G>,
&py_eval_g,
&parse_callable<arg_jac_g, JacGCallable, ipyopt::py::JacG,
ipyopt::c::JacG>,
&py_eval_jac_g,
&parse_optional<
parse_callable<arg_h, HCallable, ipyopt::py::H, ipyopt::c::H>>,
&py_eval_h,
&parse_optional<parse_callable<arg_intermediate_callback,
IntermediateCallbackCallable,
ipyopt::py::IntermediateCallback,
ipyopt::c::IntermediateCallback>>,
&py_intermediate_callback, &obj_scaling,
&parse_vec<arg_x_scaling, true, double>, &x_scaling,
&parse_vec<arg_g_scaling, true, double>, &g_scaling,
&py_ipopt_options) ||
!parse_sparsity_indices(py_sparsity_indices_jac_g,
sparsity_indices_jac_g) ||
!check_non_negative(n, "n") || !check_non_negative(m, "m") ||
!check_vec_size<double, false>(x_l, n, "%s() argument x_L") ||
!check_vec_size<double, false>(x_u, n, "%s() argument x_U") ||
!check_vec_size<double, false>(g_l, m, "%s() argument g_L") ||
!check_vec_size<double, false>(g_u, m, "%s() argument g_U") ||
!(is_null(py_eval_h.callable) ||
parse_sparsity_indices(py_sparsity_indices_h, sparsity_indices_h)) ||
!check_optional(py_ipopt_options, _PyDict_Check, "ipopt_options",
"Optional[dict]]") ||
!check_vec_size<double, true>(x_scaling, n, "%s() argument x_scaling") ||
!check_vec_size<double, true>(g_scaling, m, "%s() argument g_scaling") ||
!set_options(*self->bundle, py_ipopt_options)) {
if (self->bundle != nullptr) {
delete self->bundle;
self->bundle = nullptr;
}
Py_CLEAR(self);
reformat_error("ipyopt.Problem");
return nullptr;
}
PyObject *owned_py_objects[max_owned_py_objects] = {
py_eval_f.owned, py_eval_grad_f.owned,
py_eval_g.owned, py_eval_jac_g.owned,
py_eval_h.owned, py_intermediate_callback.owned};
for (std::size_t i = 0; i < max_owned_py_objects; i++) {
self->owned_py_objects[i] = owned_py_objects[i];
if (owned_py_objects[i] != nullptr)
Py_XINCREF(owned_py_objects[i]);
}
Ipopt::TNLP *nlp;
std::tie(nlp, self->nlp) =
build_nlp(py_eval_f.callable, py_eval_grad_f.callable, py_eval_g.callable,
py_eval_jac_g.callable, std::move(sparsity_indices_jac_g),
py_eval_h.callable, std::move(sparsity_indices_h),
py_intermediate_callback.callable, std::move(x_l),
std::move(x_u), std::move(g_l), std::move(g_u));
self->bundle->take_nlp(nlp);
self->nlp->_x_scaling = std::move(x_scaling);
self->nlp->_g_scaling = std::move(g_scaling);
self->nlp->_obj_scaling = obj_scaling;
if (is_null(py_eval_h.callable))
self->bundle->without_hess();
return (PyObject *)self;
}
static char IPYOPT_SOLVE_DOC[] = R"mdoc(
solve(x: numpy.ndarray[numpy.float64], mult_g: Optional[numpy.ndarray[numpy.float64]] = None, mult_x_L: Optional[numpy.ndarray[numpy.float64]] = None, mult_x_U: Optional[numpy.ndarray[numpy.float64]] = None) -> tuple[numpy.ndarray[numpy.float64], float, int]
Call Ipopt to solve problem created before and return
a tuple containing the final solution ``x``, the value of the final objective function
and the return status code of Ipopt.
``mult_g``, ``mult_x_L``, ``mult_x_U`` are optional keyword only arguments
allowing previous values of bound multipliers to be passed in warm
start applications.
If passed, these variables are modified.
)mdoc";
static PyObject *py_solve(PyObject *self, PyObject *args, PyObject *keywords) {
auto *py_problem = (PyNlpApp *)self;
PyArrayObject *py_mult_x_L = nullptr, *py_mult_x_U = nullptr,
*py_mult_g = nullptr;
PyArrayObject *py_x0 = nullptr;
const char *arg_names[] = {"x0", "mult_g", "mult_x_L", "mult_x_U", nullptr};
if (!PyArg_ParseTupleAndKeywords(
args, keywords, "O!|$O!O!O!", const_cast<char **>(arg_names),
&PyArray_Type, &py_x0, &PyArray_Type, &py_mult_g, &PyArray_Type,
&py_mult_x_L, &PyArray_Type, &py_mult_x_U) ||
!check_array_dim(py_x0, py_problem->nlp->n, "x0") ||
(py_mult_g != nullptr &&
!check_array_dim(py_mult_g, py_problem->nlp->m, "mult_g")) ||
(py_mult_x_L != nullptr &&
!check_array_dim(py_mult_x_L, py_problem->nlp->n, "mult_x_L")) ||
(py_mult_x_U != nullptr &&
!check_array_dim(py_mult_x_U, py_problem->nlp->n, "mult_x_U")))
return nullptr;
py_problem->nlp->set_initial_values(
(double *)PyArray_DATA(py_x0), optional_array_data(py_mult_g),
optional_array_data(py_mult_x_L), optional_array_data(py_mult_x_U));
auto status = py_problem->bundle->optimize();
if (PyErr_Occurred())
return nullptr;
return py_tuple((PyObject *)py_x0,
PyFloat_FromDouble(py_problem->nlp->out_obj_value),
PyLong_FromLong(status));
}
static char IPYOPT_SET_OPTION_DOC[] = R"mdoc(
set(**kwargs) -> None
Set one or more Ipopt options. The Python type of the value objects have to match
the corresponding types (i.e. ``str``, ``float`` or ``int``) of the Ipopt options.
Refer to the Ipopt document for more information about Ipopt options, or use :func:`get_ipopt_options`
to see a list of available options.
)mdoc";
static PyObject *py_set(PyObject *self, PyObject *args, PyObject *keywords) {
if (!check_kwargs(keywords) || !check_no_args("set", args) ||
!set_options(*((PyNlpApp *)self)->bundle, keywords))
return nullptr;
Py_RETURN_NONE;
}
static char IPYOPT_SET_PROBLEM_SCALING_DOC[] = R"mdoc(
set_problem_scaling(obj_scaling: float, x_scaling: Optional[numpy.ndarray] = None, g_scaling: Optional[numpy.ndarray] = None) -> None
Set scaling parameters for the NLP.
Attention: Only takes effect if ``nlp_scaling_method="user-scaling"`` is set via :func:`set` or the ``ipopt_options`` argument!
If ``x_scaling`` or ``g_scaling`` is not specified or explicitly are ``None``, then no scaling for ``x`` resp. ``g`` is done.
This corresponds to the `TNLP::get_scaling_parameters`_ method.
.. _`TNLP::get_scaling_parameters`: https://coin-or.github.io/Ipopt/classIpopt_1_1TNLP.html#a3e840dddefbe48a048d213bd02b39854
)mdoc";
static PyObject *py_set_problem_scaling(PyObject *self, PyObject *args,
PyObject *keywords) {
double obj_scaling;
std::vector<double> x_scaling, g_scaling;
const char *arg_names[] = {"obj_scaling", "x_scaling", "g_scaling", nullptr};
NlpData &nlp = *((PyNlpApp *)self)->nlp;
if (!PyArg_ParseTupleAndKeywords(
args, keywords, "d|O&O&:%s", const_cast<char **>(arg_names),
&obj_scaling, &parse_vec<arg_x_scaling, true, double>, &x_scaling,
&parse_vec<arg_g_scaling, true, double>, &g_scaling) ||
!check_vec_size<double, true>(x_scaling, nlp.n,
"%s() argument x_scaling") ||
!check_vec_size<double, true>(g_scaling, nlp.m,
"%s() argument g_scaling")) {
reformat_error("ipyopt.Problem.set_problem_scaling");
return nullptr;
}
nlp._x_scaling = std::move(x_scaling);
nlp._g_scaling = std::move(g_scaling);
nlp._obj_scaling = obj_scaling;
Py_RETURN_NONE;
}
static void dict_add_str(PyObject *dict, const char *key, const char *val) {
auto str = PyUnicode_FromString(val);
PyDict_SetItemString(dict, key, str);
}
static void dict_add_int(PyObject *dict, const char *key, int val) {
auto str = PyLong_FromLong(val);
PyDict_SetItemString(dict, key, str);
}
static PyObject *py_ipopt_type(IpoptOption::Type t) {
switch (t) {
case IpoptOption::Integer:
return (PyObject *)&PyLong_Type;
case IpoptOption::Number:
return (PyObject *)&PyFloat_Type;
case IpoptOption::String:
return (PyObject *)&PyUnicode_Type;
default:
return Py_None;
}
}
static char GET_IPOPT_OPTIONS_DOC[] = R"mdoc(
get_ipopt_options() -> list[dict[str, Any]]
Get a list of all Ipopt options.
The items of the returned list are dicts, containing the fields::
{
"name": str,
"type": Union[Type[int], Type[float], Type[str], None],
"description_short": str,
"description_long": str,
"category": str
}
)mdoc";
static PyObject *py_get_ipopt_options(PyObject *, PyObject *) {
const auto options = get_ipopt_options();
auto lst = PyList_New(options.size());
auto i = std::size_t{0};
for (const auto &opt : options) {
auto dict = PyDict_New();
dict_add_str(dict, "name", opt.name.data());
PyDict_SetItemString(dict, "type", py_ipopt_type(opt.type));
dict_add_str(dict, "description_short", opt.description_short.data());
dict_add_str(dict, "description_long", opt.description_long.data());
dict_add_str(dict, "category", opt.category.data());
PyList_SET_ITEM(lst, i++, dict);
}
Py_XINCREF(lst);
return lst;
}
PyObject *py_get_stats(PyObject *self, void *) {
auto dict = PyDict_New();
auto nlp = ((PyNlpApp *)self)->nlp;
dict_add_int(dict, "n_eval_f", nlp->out_stats.n_eval_f);
dict_add_int(dict, "n_eval_grad_f", nlp->out_stats.n_eval_grad_f);
dict_add_int(dict, "n_eval_g_eq", nlp->out_stats.n_eval_g_eq);
dict_add_int(dict, "n_eval_jac_g_eq", nlp->out_stats.n_eval_jac_g_eq);
dict_add_int(dict, "n_eval_g_ineq", nlp->out_stats.n_eval_g_ineq);
dict_add_int(dict, "n_eval_jac_g_ineq", nlp->out_stats.n_eval_jac_g_ineq);
dict_add_int(dict, "n_eval_h", nlp->out_stats.n_eval_h);
dict_add_int(dict, "n_iter", nlp->out_stats.n_iter);
Py_XINCREF(dict);
return dict;
}
// Begin Python Module code section
static struct PyModuleDef moduledef = {
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "ipyopt",
.m_doc = "Python interface to Ipopt",
.m_size = -1,
.m_methods = (PyMethodDef[]){{"get_ipopt_options", py_get_ipopt_options,
METH_NOARGS, GET_IPOPT_OPTIONS_DOC},
{nullptr, nullptr, 0, nullptr}},
.m_slots = nullptr,
.m_traverse = nullptr,
.m_clear = nullptr,
.m_free = nullptr,
};
PyMethodDef problem_methods[] = {
{"solve", (PyCFunction)py_solve, METH_VARARGS | METH_KEYWORDS,
PyDoc_STR(IPYOPT_SOLVE_DOC)},
{"set", (PyCFunction)py_set, METH_VARARGS | METH_KEYWORDS,
PyDoc_STR(IPYOPT_SET_OPTION_DOC)},
{"set_problem_scaling", (PyCFunction)py_set_problem_scaling,
METH_VARARGS | METH_KEYWORDS, PyDoc_STR(IPYOPT_SET_PROBLEM_SCALING_DOC)},
{nullptr, nullptr, 0, nullptr},
};
PyTypeObject IPyOptProblemType = {
.ob_base = PyVarObject_HEAD_INIT(nullptr, 0).tp_name = "ipyopt.Problem",
.tp_basicsize = sizeof(PyNlpApp),
.tp_itemsize = 0,
.tp_dealloc = (destructor)py_ipopt_problem_dealloc,
.tp_getattr = 0,
.tp_setattr = 0,
.tp_as_async = 0,
.tp_repr = 0,
.tp_as_number = 0,
.tp_as_sequence = 0,
.tp_as_mapping = 0,
.tp_hash = 0,
.tp_call = 0,
.tp_str = 0,
.tp_getattro = 0,
.tp_setattro = 0,
.tp_as_buffer = 0,
.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
.tp_doc = PyDoc_STR(IPYOPT_PROBLEM_DOC),
.tp_traverse = (traverseproc)py_ipopt_problem_traverse,
.tp_clear = (inquiry)py_ipopt_problem_clear,
.tp_richcompare = 0,
.tp_weaklistoffset = 0,
.tp_iter = 0,
.tp_iternext = 0,
.tp_methods = problem_methods,
.tp_members = 0,
.tp_getset =
(PyGetSetDef[]){{"stats", py_get_stats, nullptr,
"dict[str, int]: Stats about an optimization run",
nullptr},
{nullptr, nullptr, nullptr, nullptr, nullptr}},
.tp_base = 0,
.tp_dict = 0,
.tp_descr_get = 0,
.tp_descr_set = 0,
.tp_dictoffset = 0,
.tp_init = 0,
.tp_alloc = 0,
.tp_new = py_ipopt_problem_new};
PyMODINIT_FUNC PyInit_ipyopt(void) {
PyObject *module;
// Finish initialization of the problem type
if (PyType_Ready(&IPyOptProblemType) < 0)
return nullptr;
module = PyModule_Create(&moduledef);
if (module == nullptr)
return nullptr;
Py_INCREF(&IPyOptProblemType);
PyModule_AddObject(module, "Problem", (PyObject *)&IPyOptProblemType);
#ifdef VERSION_INFO
#define STRINGIFY(x) #x
#define MACRO_STRINGIFY(x) STRINGIFY(x)
PyModule_AddUnicodeConstant(module, "__version__",
MACRO_STRINGIFY(VERSION_INFO));
#else
PyModule_AddStringConstant(module, "__version__", "dev");
#endif
// Initialize numpy (a segfault will occur if using numpy array without this)
import_array();
if (PyErr_Occurred())
Py_FatalError("Unable to initialize module ipyopt");
return module;
}
}
| 40.098439 | 1,198 | 0.641908 | [
"object",
"shape",
"vector"
] |
582a3a2112dcae0bfed53b31a153a5c63d00c32c | 2,993 | cxx | C++ | TrophyShelf.cxx | jackytck/topcoder | 5a83ce478d4f05aeb97062f8a30aa1d6fbc969d3 | [
"MIT"
] | null | null | null | TrophyShelf.cxx | jackytck/topcoder | 5a83ce478d4f05aeb97062f8a30aa1d6fbc969d3 | [
"MIT"
] | null | null | null | TrophyShelf.cxx | jackytck/topcoder | 5a83ce478d4f05aeb97062f8a30aa1d6fbc969d3 | [
"MIT"
] | null | null | null | // BEGIN CUT HERE
// PROBLEM STATEMENT
// You have several trophies sitting on a shelf in a straight line. Their heights are given in a vector <int> trophies, from left to right. The shelf is positioned so that whenever people enter your room, they see it directly from the left side. In other words, the leftmost trophy is completely visible to the viewer, the next trophy in line is directly behind it, and so on.
Unfortunately, tall trophies near the left side of the shelf might block the view of other trophies. A trophy is visible only if every trophy in front of it (from the viewer's perspective) is strictly shorter than it is. You wonder if rotating the shelf 180 degrees would increase the number of visible trophies.
Return a vector <int> containing exactly two elements. The first element should be the number of trophies visible when viewing the shelf directly from the left side, and the second element should be the number of trophies visible when viewing the shelf directly from the right side.
DEFINITION
Class:TrophyShelf
Method:countVisible
Parameters:vector <int>
Returns:vector <int>
Method signature:vector <int> countVisible(vector <int> trophies)
CONSTRAINTS
-trophies will contain between 1 and 50 elements, inclusive.
-Each element of trophies will be between 1 and 100, inclusive.
EXAMPLES
0)
{1,2,3,4,5}
Returns: {5, 1 }
When viewed from the left, each trophy is taller than all the trophies in front of it. However, when viewed from the right, the first trophy blocks the view of all the other trophies.
1)
{5,5,5,5}
Returns: {1, 1 }
Since all trophies have the same height, only the first is visible when viewed from each direction.
2)
{1,2,5,2,1}
Returns: {3, 3 }
This trophy shelf is symmetric.
3)
{1,4,2,5,3,7,1}
Returns: {4, 2 }
// END CUT HERE
#line 54 "TrophyShelf.cxx"
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#define sz size()
#define clr(x) memset(x, 0, sizeof(x))
#define forn(i,n) for(__typeof(n) i = 0; i < (n); i++)
#define ford(i,n) for(int i = (n) - 1; i >= 0; i--)
#define For(i, st, en) for(__typeof(en) i = (st); i <= (en); i++)
using namespace std;
class TrophyShelf {
public:
vector <int> countVisible(vector <int> trophies)
{
vector <int> see;
int r = 1, l = 1;
int temp = trophies[0];
forn(i, trophies.sz)
{
if(trophies[i] > temp)
{
r++;
temp = trophies[i];
}
}
temp = trophies[trophies.sz-1];
ford(i, trophies.sz)
{
if(trophies[i] > temp)
{
l++;
temp = trophies[i];
}
}
see.push_back(r);
see.push_back(l);
return see;
}
};
| 27.209091 | 380 | 0.673906 | [
"vector"
] |
582ed73c6aa88845caef66d6cc68e3c04b78d37b | 789 | cpp | C++ | Modules/CGALVMTKMeshingKernel/ExtensionPoint/ui/MeshingKernelUI.cpp | carthurs/CRIMSONGUI | 1464df9c4d04cf3ba131ca90b91988a06845c68e | [
"BSD-3-Clause"
] | 10 | 2020-09-17T18:55:31.000Z | 2022-02-23T02:52:38.000Z | Modules/CGALVMTKMeshingKernel/ExtensionPoint/ui/MeshingKernelUI.cpp | carthurs/CRIMSONGUI | 1464df9c4d04cf3ba131ca90b91988a06845c68e | [
"BSD-3-Clause"
] | null | null | null | Modules/CGALVMTKMeshingKernel/ExtensionPoint/ui/MeshingKernelUI.cpp | carthurs/CRIMSONGUI | 1464df9c4d04cf3ba131ca90b91988a06845c68e | [
"BSD-3-Clause"
] | 3 | 2021-05-19T09:02:21.000Z | 2021-07-26T17:39:57.000Z | #include <ui/MeshingKernelUI.h>
#include <ui/GlobalMeshingParametersWidget.h>
#include <ui/LocalMeshingParametersDialog.h>
namespace crimson
{
QWidget* MeshingKernelUI::createGlobalMeshingParameterWidget(IMeshingKernel::GlobalMeshingParameters& params, QWidget* parent /*= nullptr*/) {
return new GlobalMeshingParametersWidget(params, parent);
}
QDialog* MeshingKernelUI::createLocalMeshingParametersDialog(
const std::vector<IMeshingKernel::LocalMeshingParameters*>& params,
bool editingGlobal,
IMeshingKernel::LocalMeshingParameters& defaultLocalParameters,
QWidget* parent /*= nullptr*/
) {
return new LocalMeshingParametersDialog(params, editingGlobal, defaultLocalParameters, parent);
}
} // namespace crimson
| 34.304348 | 146 | 0.752852 | [
"vector"
] |
5836ff6901b53ee431b11a9a3fa5c3ca629e2bb8 | 514 | cpp | C++ | kickstart/2020b2.cpp | sogapalag/problems | 0ea7d65448e1177f8b3f81124a82d187980d659c | [
"MIT"
] | 1 | 2020-04-04T14:56:12.000Z | 2020-04-04T14:56:12.000Z | kickstart/2020b2.cpp | sogapalag/problems | 0ea7d65448e1177f8b3f81124a82d187980d659c | [
"MIT"
] | null | null | null | kickstart/2020b2.cpp | sogapalag/problems | 0ea7d65448e1177f8b3f81124a82d187980d659c | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
void solve() {
int n; ll D;
cin >> n >> D;
ll d = D;
vector<ll> a(n);
for (auto& x: a) {
cin >> x;
}
for (int i = n-1; i >= 0; i--) {
ll x = a[i];
d = d/x*x;
}
cout << d << "\n";
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T; cin >> T;
for (int t = 1; t <= T; t++) {
cout << "Case #" << t << ": ";
solve();
}
return 0;
}
| 16.580645 | 38 | 0.404669 | [
"vector"
] |
58396f04b0c3d16aaa5565575982402526f26df5 | 1,455 | cpp | C++ | tests/threadpool_test.cpp | topin89/threadpool | 06e635dff22c9d359dfb93bc535a460774dc7319 | [
"MIT"
] | 41 | 2018-07-30T08:50:32.000Z | 2022-02-19T23:58:46.000Z | tests/threadpool_test.cpp | topin89/threadpool | 06e635dff22c9d359dfb93bc535a460774dc7319 | [
"MIT"
] | 3 | 2019-12-06T21:38:59.000Z | 2021-12-31T15:58:56.000Z | tests/threadpool_test.cpp | topin89/threadpool | 06e635dff22c9d359dfb93bc535a460774dc7319 | [
"MIT"
] | 5 | 2019-02-15T03:54:37.000Z | 2020-01-13T10:03:44.000Z | #include "threadpool_test.hpp"
TEST_F(ThreadPoolTest, SingleThreadStartStop)
{
ASSERT_FALSE(single_thread_pool->is_stopped());
single_thread_pool->stop();
ASSERT_TRUE(single_thread_pool->is_stopped());
}
TEST_F(ThreadPoolTest, SingleThreadSingleTask)
{
std::future<bool> result;
result = single_thread_pool->run([]() -> bool { return true; });
ASSERT_TRUE(result.valid());
ASSERT_TRUE(result.get());
}
TEST_F(ThreadPoolTest, SingleThreadMultipleTask)
{
std::size_t nb_tests = 10;
std::vector<std::future<bool>> results;
for (std::size_t i = 0; i < nb_tests; i++)
results.push_back(single_thread_pool->run([]() -> bool { return true; }));
for (std::size_t i = 0; i < nb_tests; i++)
ASSERT_TRUE(results[i].get());
}
TEST_F(ThreadPoolTest, MultipleThreadStartStop)
{
ASSERT_FALSE(multiple_thread_pool->is_stopped());
multiple_thread_pool->stop();
ASSERT_TRUE(multiple_thread_pool->is_stopped());
}
TEST_F(ThreadPoolTest, MultipleThreadSingleTask)
{
std::future<bool> result;
result = multiple_thread_pool->run([]() -> bool { return true; });
ASSERT_TRUE(result.get());
}
TEST_F(ThreadPoolTest, MultipleThreadMultipleTask)
{
std::size_t nb_tests = 2;
std::vector<std::future<bool>> results;
for (std::size_t i = 0; i < nb_tests; i++)
results.push_back(multiple_thread_pool->run([]() -> bool { return true; }));
for (std::size_t i = 0; i < nb_tests; i++)
ASSERT_TRUE(results[i].get());
}
| 24.661017 | 80 | 0.698282 | [
"vector"
] |
583bf917e42fb42fdd85cc21b5aa9f15a3767f08 | 583 | hpp | C++ | tsl/test/include/tsl_tests/io/obj_load.hpp | jeffrey-cochran/tsl | a9ae6fb2755fcbd1311c16e9faff87445419f7f0 | [
"Apache-2.0",
"MIT"
] | null | null | null | tsl/test/include/tsl_tests/io/obj_load.hpp | jeffrey-cochran/tsl | a9ae6fb2755fcbd1311c16e9faff87445419f7f0 | [
"Apache-2.0",
"MIT"
] | null | null | null | tsl/test/include/tsl_tests/io/obj_load.hpp | jeffrey-cochran/tsl | a9ae6fb2755fcbd1311c16e9faff87445419f7f0 | [
"Apache-2.0",
"MIT"
] | 1 | 2020-11-06T21:45:02.000Z | 2020-11-06T21:45:02.000Z | #ifndef TEST_INCLUDE_TSL_TESTS_IO_OBJ_LOAD_HPP
#define TEST_INCLUDE_TSL_TESTS_IO_OBJ_LOAD_HPP
#include <string>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "tsl/geometry/tmesh/tmesh.hpp"
#include "tsl/io/obj.hpp"
using std::string;
using namespace tsl;
namespace tsl_tests {
class TmeshLoadSingleFace : public ::testing::Test {
protected:
void SetUp() override;
tmesh mesh;
};
class TmeshLoad3x3InterpolatoryPatch : public ::testing::Test {
protected:
void SetUp() override;
tmesh mesh;
};
}
#endif //TEST_INCLUDE_TSL_TESTS_IO_OBJ_LOAD_HPP
| 16.657143 | 63 | 0.756432 | [
"mesh",
"geometry"
] |
5840bde16b9f672fb8ab42faf9b8223c67c3d5b7 | 4,673 | hpp | C++ | include/dca/phys/models/analytic_hamiltonians/cubic_lattice.hpp | PMDee/DCA | a8196ec3c88d07944e0499ff00358ea3c830b329 | [
"BSD-3-Clause"
] | 2 | 2019-12-18T17:13:00.000Z | 2021-07-30T01:45:30.000Z | include/dca/phys/models/analytic_hamiltonians/cubic_lattice.hpp | PMDee/DCA | a8196ec3c88d07944e0499ff00358ea3c830b329 | [
"BSD-3-Clause"
] | 1 | 2020-08-13T11:03:54.000Z | 2020-08-13T11:03:54.000Z | include/dca/phys/models/analytic_hamiltonians/cubic_lattice.hpp | PMDee/DCA | a8196ec3c88d07944e0499ff00358ea3c830b329 | [
"BSD-3-Clause"
] | 1 | 2019-11-15T16:06:32.000Z | 2019-11-15T16:06:32.000Z | // Copyright (C) 2018 ETH Zurich
// Copyright (C) 2018 UT-Battelle, LLC
// All rights reserved.
//
// See LICENSE for terms of usage.
// See CITATION.md for citation guidelines, if DCA++ is used for scientific publications.
//
// Author: Peter Staar (taa@zurich.ibm.com)
//
// Cubic lattice.
//
// TODO: - Replace get_LDA_Hamiltonians with intialize_H_0 function (see e.g. square_lattice.hpp).
// - Use correct index of origin in initialize_H_interaction (see e.g. square_lattice.hpp).
#ifndef DCA_PHYS_MODELS_ANALYTIC_HAMILTONIANS_CUBIC_LATTICE_HPP
#define DCA_PHYS_MODELS_ANALYTIC_HAMILTONIANS_CUBIC_LATTICE_HPP
#include <complex>
#include <utility>
#include <vector>
#include "dca/function/function.hpp"
#include "dca/phys/domains/cluster/symmetries/point_groups/no_symmetry.hpp"
namespace dca {
namespace phys {
namespace models {
// dca::phys::models::
template <typename point_group_type>
class cubic_lattice {
public:
typedef domains::no_symmetry<3> LDA_point_group;
typedef point_group_type DCA_point_group;
const static int DIMENSION = 3;
const static int BANDS = 1;
static double* initialize_r_DCA_basis();
static double* initialize_r_LDA_basis();
static std::vector<int> get_flavors();
static std::vector<std::vector<double>> get_a_vectors();
static std::vector<std::pair<std::pair<int, int>, std::pair<int, int>>> get_orbital_permutations();
template <class domain, class parameters_type>
static void initialize_H_interaction(func::function<double, domain>& H_interaction,
parameters_type& parameters);
template <class domain>
static void initialize_H_symmetry(func::function<int, domain>& H_symmetry);
template <class parameters_type>
static std::complex<double> get_LDA_Hamiltonians(parameters_type& parameters, std::vector<double> k,
int b1, int s1, int b2, int s2);
};
template <typename point_group_type>
double* cubic_lattice<point_group_type>::initialize_r_DCA_basis() {
static double* r_DCA = new double[9];
r_DCA[0] = 1.;
r_DCA[3] = 0.;
r_DCA[6] = 0.;
r_DCA[1] = 0.;
r_DCA[4] = 1.;
r_DCA[7] = 0.;
r_DCA[2] = 0.;
r_DCA[5] = 0.;
r_DCA[8] = 1.;
return r_DCA;
}
template <typename point_group_type>
double* cubic_lattice<point_group_type>::initialize_r_LDA_basis() {
static double* r_LDA = new double[9];
r_LDA[0] = 1.;
r_LDA[3] = 0.;
r_LDA[6] = 0.;
r_LDA[1] = 0.;
r_LDA[4] = 1.;
r_LDA[7] = 0.;
r_LDA[2] = 0.;
r_LDA[5] = 0.;
r_LDA[8] = 1.;
return r_LDA;
}
template <typename point_group_type>
std::vector<int> cubic_lattice<point_group_type>::get_flavors() {
static std::vector<int> flavors(BANDS);
for (int i = 0; i < BANDS; i++)
flavors[i] = i;
return flavors;
}
template <typename point_group_type>
std::vector<std::vector<double>> cubic_lattice<point_group_type>::get_a_vectors() {
static std::vector<std::vector<double>> a_vecs(BANDS, std::vector<double>(DIMENSION, 0.));
return a_vecs;
}
template <typename point_group_type>
std::vector<std::pair<std::pair<int, int>, std::pair<int, int>>> cubic_lattice<
point_group_type>::get_orbital_permutations() {
static std::vector<std::pair<std::pair<int, int>, std::pair<int, int>>> permutations(0);
return permutations;
}
template <typename point_group_type>
template <class domain, class parameters_type>
void cubic_lattice<point_group_type>::initialize_H_interaction(
func::function<double, domain>& H_interaction, parameters_type& parameters) {
double U = parameters.get_U();
H_interaction(0, 0, 0) = 0;
H_interaction(0, 1, 0) = U;
H_interaction(1, 0, 0) = U;
H_interaction(1, 1, 0) = 0;
}
template <typename point_group_type>
template <class domain>
void cubic_lattice<point_group_type>::initialize_H_symmetry(func::function<int, domain>& H_symmetries) {
H_symmetries(0, 0) = 0;
H_symmetries(0, 1) = -1;
H_symmetries(1, 0) = -1;
H_symmetries(1, 1) = 0;
}
template <typename point_group_type>
template <class parameters_type>
std::complex<double> cubic_lattice<point_group_type>::get_LDA_Hamiltonians(
parameters_type& parameters, std::vector<double> k, int b1, int s1, int b2, int s2) {
assert(k.size() == DIMENSION);
std::complex<double> H_LDA = 0.;
double t = parameters.get_t();
double t_prime = parameters.get_t_prime();
if ((b1 == 0 && b2 == 0) && ((s1 == 0 && s2 == 0) || (s1 == 1 && s2 == 1)))
H_LDA = -2. * t * (cos(k[0]) + cos(k[1]) + cos(k[2])) -
4. * t_prime * cos(k[0]) * cos(k[1]) * cos(k[2]);
return H_LDA;
}
} // models
} // phys
} // dca
#endif // DCA_PHYS_MODELS_ANALYTIC_HAMILTONIANS_CUBIC_LATTICE_HPP
| 29.20625 | 104 | 0.690135 | [
"vector"
] |
5847ce7c29bd1b1067a88c91b650bb962b9a37c4 | 4,358 | cpp | C++ | src/solvers/prop/minimize.cpp | quiveringlemon/pfl | 615a4036ddd61b996a778a402d70148667261475 | [
"BSD-4-Clause"
] | null | null | null | src/solvers/prop/minimize.cpp | quiveringlemon/pfl | 615a4036ddd61b996a778a402d70148667261475 | [
"BSD-4-Clause"
] | null | null | null | src/solvers/prop/minimize.cpp | quiveringlemon/pfl | 615a4036ddd61b996a778a402d70148667261475 | [
"BSD-4-Clause"
] | null | null | null | /*******************************************************************\
Module: Minimize some target function incrementally
Author: Daniel Kroening, kroening@kroening.com
\*******************************************************************/
#include <util/threeval.h>
#include "literal_expr.h"
#include "minimize.h"
/*******************************************************************\
Function: prop_minimizet::objective
Inputs:
Outputs:
Purpose: Add an objective
\*******************************************************************/
void prop_minimizet::objective(
const literalt condition,
const weightt weight)
{
if(weight>0)
{
objectives[weight].push_back(objectivet(condition));
_number_objectives++;
}
else if(weight<0)
{
objectives[-weight].push_back(objectivet(!condition));
_number_objectives++;
}
}
/*******************************************************************\
Function: prop_minimizet::fix
Inputs:
Outputs:
Purpose: Fix objectives that are satisfied
\*******************************************************************/
void prop_minimizet::fix_objectives()
{
std::vector<objectivet> &entry=current->second;
bool found=false;
for(std::vector<objectivet>::iterator
o_it=entry.begin();
o_it!=entry.end();
++o_it)
{
if(!o_it->fixed &&
prop_conv.l_get(o_it->condition).is_false())
{
_number_satisfied++;
_value+=current->first;
prop_conv.set_to(literal_exprt(o_it->condition), false); // fix it
o_it->fixed=true;
found=true;
}
}
assert(found);
}
/*******************************************************************\
Function: prop_minimizet::constaint
Inputs:
Outputs:
Purpose: Build constraints that require us to improve on
at least one goal, greedily.
\*******************************************************************/
literalt prop_minimizet::constraint()
{
std::vector<objectivet> &entry=current->second;
bvt or_clause;
for(std::vector<objectivet>::iterator
o_it=entry.begin();
o_it!=entry.end();
++o_it)
{
if(!o_it->fixed)
or_clause.push_back(!o_it->condition);
}
// This returns false if the clause is empty,
// i.e., no further improvement possible.
if(or_clause.empty())
return const_literal(false);
else if(or_clause.size()==1)
return or_clause.front();
else
{
or_exprt or_expr;
forall_literals(it, or_clause)
or_expr.copy_to_operands(literal_exprt(*it));
return prop_conv.convert(or_expr);
}
}
/*******************************************************************\
Function: prop_minimizet::operator()
Inputs:
Outputs:
Purpose: Try to cover all objectives
\*******************************************************************/
void prop_minimizet::operator()()
{
// we need to use assumptions
assert(prop_conv.has_set_assumptions());
_iterations=_number_satisfied=0;
_value=0;
bool last_was_SAT=false;
// go from high weights to low ones
for(current=objectives.rbegin();
current!=objectives.rend();
current++)
{
status() << "weight " << current->first << eom;
decision_proceduret::resultt dec_result;
do
{
// We want to improve on one of the objectives, please!
literalt c=constraint();
if(c.is_false())
dec_result=decision_proceduret::D_UNSATISFIABLE;
else
{
_iterations++;
bvt assumptions;
assumptions.push_back(c);
prop_conv.set_assumptions(assumptions);
dec_result=prop_conv.dec_solve();
switch(dec_result)
{
case decision_proceduret::D_UNSATISFIABLE:
last_was_SAT=false;
break;
case decision_proceduret::D_SATISFIABLE:
last_was_SAT=true;
fix_objectives(); // fix the ones we got
break;
default:
error() << "decision procedure failed" << eom;
last_was_SAT=false;
return;
}
}
}
while(dec_result!=decision_proceduret::D_UNSATISFIABLE);
}
if(!last_was_SAT)
{
// We don't have a satisfying assignment to work with.
// Run solver again to get one.
bvt assumptions; // no assumptions
prop_conv.set_assumptions(assumptions);
prop_conv.dec_solve();
}
}
| 21.899497 | 72 | 0.54291 | [
"vector"
] |
5849838657fdddac68f6f60d074a6fdf72435878 | 8,888 | cpp | C++ | src/cuboid.cpp | KPO-2020-2021/zad5_2-Olszowy21 | 4201e3d399387c4286cbf6a8d57bc59ca0dd68fb | [
"Unlicense"
] | null | null | null | src/cuboid.cpp | KPO-2020-2021/zad5_2-Olszowy21 | 4201e3d399387c4286cbf6a8d57bc59ca0dd68fb | [
"Unlicense"
] | null | null | null | src/cuboid.cpp | KPO-2020-2021/zad5_2-Olszowy21 | 4201e3d399387c4286cbf6a8d57bc59ca0dd68fb | [
"Unlicense"
] | null | null | null | #include "cuboid.hpp"
/*!
* Konstruktor dla prostopadłościanu z przypadkowymi wartościami.
*
*
*
*/
Cuboid::Cuboid(){
kat_do_globalnego = 0;
skala = Vector3D(1, 1, 1);
}
/*!
* Przeciazenie operatora [] dla danych chronionych prostokata.
* \param[in] index - pomocniczy unsigned int ktory zwroci odpowiedni dla
* liczby czesc tablicy wiechrzolkow.
*
*/
Vector<double, SIZE>& Cuboid::operator [] (unsigned int index){
return top[index];
}
/*!
* Przeciazenie operatora [] const dla danych chronionych prostokata.
* \param[in] index - pomocniczy unsidned int ktory zwroci odpowiedni dla
* liczby czesc tablicy wiechrzolkow.
*
*/
const Vector<double, SIZE>& Cuboid::operator [] (unsigned int index) const{
return top[index];
}
void Cuboid::inicjuj_cuboida(std::string Filename_oryginal , Vector3D &skala, Vector3D &Polozenie ){
Vector3D broker;
std::ifstream oryginal;
this->Polozenie = Polozenie;
set_skala(skala);
oryginal.open(Filename_oryginal.c_str(), std::ios::in );
if(oryginal.is_open()){
int licznik = 1; // zmienna pomagająca poprawnie dodać dane do wiechrzołków
for(int j = 0; j < 4; ++j){
oryginal >> broker;
if (oryginal.eof()) return;
broker = skaluj(broker);
top[0] = broker;
for(int i = 0; i < 2; ++i){
oryginal >> broker;
broker = skaluj(broker);
top[licznik] = broker;
++licznik;
}
oryginal >> broker;
broker = skaluj(broker);
top[9] = broker;
}
}
oryginal.close();
}
/*!
* Metoda sprawdzania dlugosci przeciwleglych bokow aktualnej figury
* znajdujacej sie w klasie cuboid ( prostopadłościanu ).
*
* \retval pozytywne lub negatywne emotki z wiadomością o długościach boków.
*/
void Cuboid::length_of_the_sides(int index){
double side1; //
//
double side2; // side7
// top7 ---> *------------------------------* <--- top5 ----|
double side3; // | | |
// || || |
double side4; // | | <--- side9 | | | <--- side12
// side4 ---> | | side3 ---> | | |
double side5; // | | side5 | | |
// top1 -|--> *-------------------------|----* <--- top3 ----|
double side6; // | | side8 | |
// top8 ---> *----|-------------------------* <--|- top6 ----|
double side7; // | | <--- side1 | | <--- side2 |
// side10 ---> | | | | | <--- side11
double side8; // | | | | |
// || || |
double side9; // top2 ---> *------------------------------* <--- top4 ----|
// side6
double side10; //
//
double side11; //
//
double side12; //
std::cout << index; // TYLKO DLA UNIKNIĘCIA BŁĘDU UNUSED
side1 = sqrt( pow( std::abs(top[1][0] - top[0][0]),2) + pow( std::abs(top[1][1] - top[0][1]),2) + pow( std::abs(top[1][2] - top[0][2]),2));
side2 = sqrt( pow( std::abs(top[3][0] - top[2][0]),2) + pow( std::abs(top[3][1] - top[2][1]),2) + pow( std::abs(top[3][2] - top[2][2]),2));
side3 = sqrt( pow( std::abs(top[5][0] - top[4][0]),2) + pow( std::abs(top[5][1] - top[4][1]),2) + pow( std::abs(top[5][2] - top[4][2]),2));
side4 = sqrt( pow( std::abs(top[7][0] - top[6][0]),2) + pow( std::abs(top[7][1] - top[6][1]),2) + pow( std::abs(top[7][2] - top[6][2]),2));
side5 = sqrt( pow( std::abs(top[2][0] - top[0][0]),2) + pow( std::abs(top[2][1] - top[0][1]),2) + pow( std::abs(top[2][2] - top[0][2]),2));
side6 = sqrt( pow( std::abs(top[3][0] - top[1][0]),2) + pow( std::abs(top[3][1] - top[1][1]),2) + pow( std::abs(top[3][2] - top[1][2]),2));
side7 = sqrt( pow( std::abs(top[6][0] - top[4][0]),2) + pow( std::abs(top[6][1] - top[4][1]),2) + pow( std::abs(top[6][2] - top[4][2]),2));
side8 = sqrt( pow( std::abs(top[7][0] - top[5][0]),2) + pow( std::abs(top[7][1] - top[5][1]),2) + pow( std::abs(top[7][2] - top[5][2]),2));
side9 = sqrt( pow( std::abs(top[6][0] - top[0][0]),2) + pow( std::abs(top[6][1] - top[0][1]),2) + pow( std::abs(top[6][2] - top[0][2]),2));
side10 = sqrt( pow( std::abs(top[7][0] - top[1][0]),2) + pow( std::abs(top[7][1] - top[1][1]),2) + pow( std::abs(top[7][2] - top[1][2]),2));
side11 = sqrt( pow( std::abs(top[5][0] - top[3][0]),2) + pow( std::abs(top[5][1] - top[3][1]),2) + pow( std::abs(top[5][2] - top[3][2]),2));
side12 = sqrt( pow( std::abs(top[4][0] - top[2][0]),2) + pow( std::abs(top[4][1] - top[2][1]),2) + pow( std::abs(top[4][2] - top[2][2]),2));
if((std::abs(side5 - side8) <= MIN_DIFF) && (std::abs(side6 - side7) <= MIN_DIFF)){
std::cout <<"\n :) Krotsze przeciwlegle boki sa sobie rowne" << std::endl;
std::cout <<"Dlugosc pierwszego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side5 << std::endl;
std::cout <<"Dlugosc drugiego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side6 << std::endl;
std::cout <<"Dlugosc trzeciego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side7 << std::endl;
std::cout <<"Dlugosc czwartego boku: "<< std::setw(16) << std::fixed << std::setprecision(10) << side8 << std::endl;
}
else{
std::cout <<"\n :/ Krotsze przeciwlegle boki nie sa sobie rowne!!!" << std::endl;
std::cout <<"Dlugosc pierwszego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side5 << std::endl;
std::cout <<"Dlugosc drugiego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side6 << std::endl;
std::cout <<"Dlugosc trzeciego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side7 << std::endl;
std::cout <<"Dlugosc czwartego boku: "<< std::setw(16) << std::fixed << std::setprecision(10) << side8 << std::endl;
}
if((std::abs(side1 - side3) <= MIN_DIFF) && (std::abs(side2 - side4) <= MIN_DIFF)){
std::cout <<"\n :) Poprzeczne przeciwlegle boki sa sobie rowne" << std::endl;
std::cout <<"Dlugosc pierwszego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side1 << std::endl;
std::cout <<"Dlugosc drugiego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side2 << std::endl;
std::cout <<"Dlugosc trzeciego boku: " << std::setw(16) << std::fixed << std::setprecision(10) << side3 << std::endl;
std::cout <<"Dlugosc czwartego boku: "<< std::setw(16) << std::fixed << std::setprecision(10) << side4 << std::endl;
}
else{
std::cout <<"\n :/ Poprzeczne przeciwlegle boki nie sa sobie rowne!!!" << std::endl;
std::cout <<"Dlugosc pierwszego boku: " << side1 << std::endl;
std::cout <<"Dlugosc drugiego boku: " << side2 << std::endl;
std::cout <<"Dlugosc trzeciego boku: " << side3 << std::endl;
std::cout <<"Dlugosc czwartego boku: "<< side4 << std::endl;
}
if((std::abs(side9 - side11) <= MIN_DIFF) && (std::abs(side10 - side12) <= MIN_DIFF)){
std::cout <<"\n :) Dluzsze przeciwlegle boki sa sobie rowne" << std::endl;
std::cout <<"Dlugosc pierwszego boku: " << side9 << std::endl;
std::cout <<"Dlugosc drugiego boku: " << side10 << std::endl;
std::cout <<"Dlugosc trzeciego boku: " << side11 << std::endl;
std::cout <<"Dlugosc czwartego boku: "<< side12 << std::endl;
}
else{
std::cout <<"\n :/ Dluzsze przeciwlegle boki nie sa sobie rowne!!!" << std::endl;
std::cout <<"Dlugosc pierwszego boku: " << side9 << std::endl;
std::cout <<"Dlugosc drugiego boku: " << side10 << std::endl;
std::cout <<"Dlugosc trzeciego boku: " << side11 << std::endl;
std::cout <<"Dlugosc czwartego boku: "<< side12 << std::endl;
}
}
| 48.304348 | 146 | 0.464109 | [
"vector"
] |
584e245d479decb8f8cf96cd44f7b67e2637f856 | 5,128 | cpp | C++ | Sources/Elastos/LibCore/src/org/apache/http/impl/cookie/RFC2109DomainHandler.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 7 | 2017-07-13T10:34:54.000Z | 2021-04-16T05:40:35.000Z | Sources/Elastos/LibCore/src/org/apache/http/impl/cookie/RFC2109DomainHandler.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | null | null | null | Sources/Elastos/LibCore/src/org/apache/http/impl/cookie/RFC2109DomainHandler.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 9 | 2017-07-13T12:33:20.000Z | 2021-06-19T02:46:48.000Z | //=========================================================================
// Copyright (C) 2012 The Elastos Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//=========================================================================
#include "org/apache/http/impl/cookie/RFC2109DomainHandler.h"
#include "elastos/utility/logging/Logger.h"
using Elastos::Utility::ILocale;
using Elastos::Utility::Logging::Logger;
using Org::Apache::Http::Cookie::EIID_ICookieAttributeHandler;
using Org::Apache::Http::Cookie::Params::ICookieSpecPNames;
namespace Org {
namespace Apache {
namespace Http {
namespace Impl {
namespace Cookie {
CAR_INTERFACE_IMPL(RFC2109DomainHandler, Object, ICookieAttributeHandler)
ECode RFC2109DomainHandler::Parse(
/* [in] */ ISetCookie* cookie,
/* [in] */ const String& value)
{
if (cookie == NULL) {
Logger::E("RFC2109DomainHandler", "Cookie may not be null");
return E_ILLEGAL_ARGUMENT_EXCEPTION;
}
if (value.IsNull()) {
Logger::E("RFC2109DomainHandler", "Missing value for domain attribute");
return E_MALFORMED_COOKIE_EXCEPTION;
}
if (value.Trim().GetLength() == 0) {
Logger::E("RFC2109DomainHandler", "Blank value for domain attribute");
return E_MALFORMED_COOKIE_EXCEPTION;
}
return cookie->SetDomain(value);
}
ECode RFC2109DomainHandler::Validate(
/* [in] */ ICookie* cookie,
/* [in] */ ICookieOrigin* origin)
{
if (cookie == NULL) {
Logger::E("RFC2109DomainHandler", "Cookie may not be null");
return E_ILLEGAL_ARGUMENT_EXCEPTION;
}
if (origin == NULL) {
Logger::E("RFC2109DomainHandler", "Cookie origin not be null");
return E_ILLEGAL_ARGUMENT_EXCEPTION;
}
String host, domain;
origin->GetHost(&host);
cookie->GetDomain(&domain);
if (domain.IsNull()) {
Logger::E("RFC2109DomainHandler", "Cookie domain may not be null");
return E_MALFORMED_COOKIE_EXCEPTION;
}
if (!domain.Equals(host)) {
Int32 dotIndex = domain.IndexOf('.');
if (dotIndex == -1) {
Logger::E("RFC2109DomainHandler", "Domain attribute \"%s\" does not match the host \"%s\""
, domain.string(), host.string());
return E_MALFORMED_COOKIE_EXCEPTION;
}
// domain must start with dot
if (!domain.StartWith(".")) {
Logger::E("RFC2109DomainHandler", "Domain attribute \"%s\" violates RFC 2109: domain must start with a dot"
, domain.string());
return E_MALFORMED_COOKIE_EXCEPTION;
}
// domain must have at least one embedded dot
dotIndex = domain.IndexOf('.', 1);
if (dotIndex < 0 || dotIndex == domain.GetLength() - 1) {
Logger::E("RFC2109DomainHandler", "Domain attribute \"%s\" violates RFC 2109: domain must contain an embedded dot"
, domain.string());
return E_MALFORMED_COOKIE_EXCEPTION;
}
host = host.ToLowerCase(/*ILocale::ENGLISH*/);
if (!host.EndWith(domain)) {
Logger::E("RFC2109DomainHandler", "Illegal domain attribute \"%s\". Domain of origin: \"%s\""
, domain.string(), host.string());
return E_MALFORMED_COOKIE_EXCEPTION;
}
// host minus domain may not contain any dots
String hostWithoutDomain = host.Substring(0, host.GetLength() - domain.GetLength());
if (hostWithoutDomain.IndexOf('.') != -1) {
Logger::E("RFC2109DomainHandler", "Domain attribute \"%s\" violates RFC 2109: host minus domain may not contain any dots"
, domain.string());
return E_MALFORMED_COOKIE_EXCEPTION;
}
}
return NOERROR;
}
ECode RFC2109DomainHandler::Match(
/* [in] */ ICookie* cookie,
/* [in] */ ICookieOrigin* origin,
/* [out] */ Boolean* result)
{
VALIDATE_NOT_NULL(result)
*result = FALSE;
if (cookie == NULL) {
Logger::E("RFC2109DomainHandler", "Cookie may not be null");
return E_ILLEGAL_ARGUMENT_EXCEPTION;
}
if (origin == NULL) {
Logger::E("RFC2109DomainHandler", "Cookie origin may not be null");
return E_ILLEGAL_ARGUMENT_EXCEPTION;
}
String host, domain;
origin->GetHost(&host);
cookie->GetDomain(&domain);
if (domain.IsNull()) {
return NOERROR;
}
*result = host.Equals(domain) || (domain.StartWith(".") && host.EndWith(domain));
return NOERROR;
}
} // namespace Cookie
} // namespace Impl
} // namespace Http
} // namespace Apache
} // namespace Org | 37.15942 | 133 | 0.61954 | [
"object"
] |
58534df1703e627f6c511565d0f5cf12231c3580 | 1,601 | cpp | C++ | Data Structure/Stack/Next_Greater_Element.cpp | rajatjha28/CPP-Questions-and-Solutions | fc5bae0da3dc7aed69e663e93128cd899b7bb263 | [
"MIT"
] | 42 | 2021-09-26T18:02:52.000Z | 2022-03-15T01:52:15.000Z | Data Structure/Stack/Next_Greater_Element.cpp | rajatjha28/CPP-Questions-and-Solutions | fc5bae0da3dc7aed69e663e93128cd899b7bb263 | [
"MIT"
] | 404 | 2021-09-24T19:55:10.000Z | 2021-11-03T05:47:47.000Z | Data Structure/Stack/Next_Greater_Element.cpp | rajatjha28/CPP-Questions-and-Solutions | fc5bae0da3dc7aed69e663e93128cd899b7bb263 | [
"MIT"
] | 140 | 2021-09-22T20:50:04.000Z | 2022-01-22T16:59:09.000Z | // GFG Link to question - https://practice.geeksforgeeks.org/problems/next-larger-element-1587115620/1
// This Code is Contributed by RAKSHIT PANDEY (Username-----> Master-Helix)
// Function to print the Next Greater Element using Stack
vector<long long> nextLargerElement(vector<long long> arr, int n){
vector<long long>v; // to store the output
v.push_back(-1); // for rightmost element . no right element present
stack<long long>s;
s.push(arr[n-1]); //rightmost at top
for(int i=n-2;i>=0;i--) // iterating backwards
{
if(arr[i]<s.top()) // here the top will be nearest right neighbour which is greater so push in vector
{
v.push_back(s.top());
s.push(arr[i]); // update the stack top
}
else
{
while(!s.empty() && s.top()<=arr[i]) // if stack is empty, them no next greater present, so push -1 in vector
{
s.pop(); // if nearest greater found, push that in vector
}
if(s.empty())
{
v.push_back(-1);
}
else
{
v.push_back(s.top());
}
s.push(arr[i]); // update the top at each traversal
}
}
reverse(v.begin(),v.end()); // to print output from left to right , reversing of output vector is done
return v; // return the output vector
}
| 37.232558 | 126 | 0.494691 | [
"vector"
] |
585e2f94f774de1ae6060cd926fd5d7ed8e4a537 | 1,209 | cpp | C++ | src/event.cpp | Kvitrafn/Aspen | 0c98633d3d0fbe21e0bbb14edd7d19203711a3a2 | [
"MIT"
] | null | null | null | src/event.cpp | Kvitrafn/Aspen | 0c98633d3d0fbe21e0bbb14edd7d19203711a3a2 | [
"MIT"
] | null | null | null | src/event.cpp | Kvitrafn/Aspen | 0c98633d3d0fbe21e0bbb14edd7d19203711a3a2 | [
"MIT"
] | null | null | null | #include <sys/time.h>
#include <string>
#include <vector>
#include <functional>
#include "event.h"
#include "exception.h"
Event::Event():
_id(0)
{
}
Event::~Event()
{
for (auto it: _callbacks)
{
delete it;
}
}
BOOL Event::operator +=(const EVENTFUNC cb)
{
Add(cb);
return true;
}
UINT Event::Add(const EVENTFUNC cb)
{
EventContainer* c = new EventContainer();
_id++;
c->id = _id;
c->cb = cb;
_callbacks.push_back(c);
return c->id;
}
BOOL Event::operator -=(UINT id)
{
Remove(id);
return true;
}
BOOL Event::Remove(UINT id)
{
std::vector<EventContainer*>::iterator it, itEnd;
itEnd = _callbacks.end();
for (it = _callbacks.begin(); it != itEnd; ++it)
{
if (id == (*it)->id)
{
_callbacks.erase(it);
return true;
}
}
return false;
}
#ifdef MODULE_SCRIPTING
UINT Event::AddScriptCallback(Entity* obj, int func)
{
/** @todo fix this for scripting. */
return 0;
}
#endif
void Event::Invoke(EventArgs* args, void* caller)
{
for (auto it: _callbacks)
{
it->cb(args,caller);
}
}
| 16.791667 | 53 | 0.539289 | [
"vector"
] |
5868bd7b7dd3cd0400f3cdfbb100171310ab24fc | 12,637 | cpp | C++ | path_calculator_node.cpp | josezy/path_calculator_node | 3067325e3352ac3ac062b2c9de9d5723fd180cda | [
"MIT"
] | null | null | null | path_calculator_node.cpp | josezy/path_calculator_node | 3067325e3352ac3ac062b2c9de9d5723fd180cda | [
"MIT"
] | null | null | null | path_calculator_node.cpp | josezy/path_calculator_node | 3067325e3352ac3ac062b2c9de9d5723fd180cda | [
"MIT"
] | null | null | null | /*===============================================================================
|*Author: Jose Benitez
|*Date: October 2016
|*Description: Calculate the shortest path between two points on a map using the
|* A* algorithm.
\*===============================================================================*/
#include <iostream>
#include "ros/ros.h"
#include "navig_msgs/CalculatePath.h"
#include "nav_msgs/Path.h"
#include "geometry_msgs/PoseStamped.h"
#include <climits>
#include <ctime>
#include <vector>
#define abs(x) (x<0?-x:x)
#define max(a,b) (a>b?a:b)
#define CONECTIVIDAD 8
#define MAX_DILATE 6
#define ALPHA 0.1 //Difference weight (Original path)
#define BETA 0.9 //Distance weight (straight line)
#define DELTA 0.05
#define TOL 0.001
//Main functions declaration
bool dilatar(nav_msgs::OccupancyGrid mapa, nav_msgs::OccupancyGrid * mapa_dilatado);
bool calculatePath(geometry_msgs::Pose start, geometry_msgs::Pose goal,
nav_msgs::OccupancyGrid& mapa, nav_msgs::Path * ruta);
bool suavizar(nav_msgs::Path ruta, nav_msgs::Path * ruta_suavizada);
//A* functions
unsigned int xy2idx(unsigned int x, unsigned int y, unsigned int w);
unsigned int heuristics(unsigned int current, unsigned int goal, unsigned int W);
void calculateVecinos(int* vecinos, unsigned int idx, unsigned int W, unsigned int H);
int idxOfmin(int* f_vals);
//Smoothing functions
bool deltaV(nav_msgs::Path pathP, nav_msgs::Path pathQ, float dV[][2]);
float norm2(float m[][2], int n);
//This is what we want :D
nav_msgs::Path solved_path;
std::vector<int> open_list;
//Callback from the service
bool calculate_path(navig_msgs::CalculatePath::Request &req,
navig_msgs::CalculatePath::Response &res){
std::cout << "Executing service..." << std::endl;
//Useful info
float x_i, y_i, x_f, y_f;
x_i = req.start_pose.position.x; y_i = req.start_pose.position.y;
x_f = req.goal_pose.position.x; y_f = req.goal_pose.position.y;
std::cout << "Start pose: " << x_i << " " << y_i << std::endl;
std::cout << "Goal pose: " << x_f << " " << y_f << std::endl;
//Main functions
nav_msgs::OccupancyGrid mapa_dilatado;
if(!dilatar(req.map, &mapa_dilatado)){
std::cout << "ERROR: Could not dilate the map" << std::endl;
return false;
}
nav_msgs::Path ruta_cruda;
if(!calculatePath(req.start_pose,req.goal_pose,mapa_dilatado,&ruta_cruda)){
std::cout << "ERROR: Could not calculate path" << std::endl;
return false;
}
if(!suavizar(ruta_cruda, &solved_path)){
std::cout << "ERROR: Could not smooth path" << std::endl;
return false;
}
res.path = solved_path;
std::cout << "Ready" << std::endl;
return true;
}
//Funcion para dilatar
bool dilatar(nav_msgs::OccupancyGrid mapa, nav_msgs::OccupancyGrid * mapa_dilatado){
std::cout << "Dilating... ";
*mapa_dilatado = mapa;
unsigned int W = mapa.info.width;
for(int j=1; j<= MAX_DILATE; j++){
for(int i=0;i<W*mapa.info.height; i++){
if(int(mapa.data[i]) == 100){
(*mapa_dilatado).data[i+1] = int(100);
(*mapa_dilatado).data[i+W+1] = int(100);
(*mapa_dilatado).data[i+W] = int(100);
(*mapa_dilatado).data[i+W-1] = int(100);
(*mapa_dilatado).data[i-1] = int(100);
(*mapa_dilatado).data[i-W-1] = int(100);
(*mapa_dilatado).data[i-W] = int(100);
(*mapa_dilatado).data[i-W+1] = int(100);
}
}
mapa = *mapa_dilatado;
}
std::cout << "Map dilated!" << std::endl;
return true;
}
//Funcion para calcular la ruta mas corta usando A*
bool calculatePath(geometry_msgs::Pose start, geometry_msgs::Pose goal,
nav_msgs::OccupancyGrid& mapa, nav_msgs::Path * ruta){
std::cout << "Calculating path... " << std::endl;
unsigned int W = mapa.info.width;
unsigned int H = mapa.info.height;
const float res = mapa.info.resolution;
const int oriX = mapa.info.origin.position.x/res; //-999
const int oriY = mapa.info.origin.position.y/res; //-399
const unsigned int max_idx = W*H;
unsigned int attempts = 0;
const unsigned int max_attempts = max_idx;
int* g_values = new int[max_idx];
bool* isknown = new bool[max_idx];
int* previous = new int[max_idx];
int* f_values = new int[max_idx];
unsigned int g_temp;
for(int i=0; i<max_idx; i++){
g_values[i] = UINT_MAX;
isknown[i] = false;
previous[i] = -1;
f_values[i] = UINT_MAX;
}
unsigned int start_cell = xy2idx(start.position.x/res-oriX, start.position.y/res-oriY, W);
unsigned int goal_cell = xy2idx(goal.position.x/res-oriX, goal.position.y/res-oriY, W);
if(int(mapa.data[start_cell])!=0){
std::cout << "ERROR: Robot cant start from that point on the dilated map." << std::endl;
return false;
}
if(int(mapa.data[goal_cell])!=0){
std::cout << "ERROR: Robot cant reach that point on the dilated map." << std::endl;
return false;
}
int current_cell = start_cell;
g_values[current_cell] = 0;
f_values[current_cell] = 0 + heuristics(current_cell, goal_cell, W);
isknown[current_cell] = true;
clock_t begin = clock();
//AQUI VIENE EL PEZ GORDO
int vecinos[CONECTIVIDAD];
while(current_cell != goal_cell && attempts < max_attempts){
attempts++;
calculateVecinos(vecinos, current_cell, W, H);
for(int n = 0; n < CONECTIVIDAD; n++){
if(!isknown[vecinos[n]] && int(mapa.data[vecinos[n]])==0){
if(CONECTIVIDAD == 8 && n >= 4)
g_temp = g_values[current_cell] + 14;
else
g_temp = g_values[current_cell] + 10;
if(g_temp < g_values[vecinos[n]]){
g_values[vecinos[n]] = g_temp;
f_values[vecinos[n]] = g_temp + heuristics(vecinos[n], goal_cell, W);
previous[vecinos[n]] = current_cell;
open_list.push_back(vecinos[n]);
}
}//if a valid neighbor
}//for all neighbors
current_cell = idxOfmin(f_values);
if(current_cell == -2){
std::cout << "ERROR: Could not find min value on f_values!" << std::endl;
std::cout << "(Maybe there is no way, or robot too fat)" << std::endl;
delete[] g_values; delete[] isknown;
delete[] previous; delete[] f_values;
return false;
}
isknown[current_cell] = true;
}
if(attempts >= max_attempts){
std::cout << "ERROR: Max attempts reached (Path not found)" << std::endl;
delete[] g_values; delete[] isknown;
delete[] previous; delete[] f_values;
return false;
}
std::cout << "Elapsed time: " << float(clock() - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "Attempts: " << attempts << std::endl;
geometry_msgs::PoseStamped myNewPose;
while(current_cell != -1){
myNewPose.pose.position.x = int((current_cell % W)+oriX)*res;
myNewPose.pose.position.y = int((current_cell / W)+oriY)*res;
myNewPose.pose.orientation.w = 1;//Just in case
myNewPose.header.frame_id = "map";
(*ruta).poses.push_back(myNewPose);
current_cell = previous[current_cell];
}
(*ruta).header.frame_id = "map";
delete[] g_values; delete[] isknown;
delete[] previous; delete[] f_values;
std::cout << "Path calculated successfully" << std::endl;
return true;
}
unsigned int xy2idx(unsigned int x, unsigned int y, unsigned int w){
return (w*(y+1)) - (w-x);
}
unsigned int heuristics(unsigned int current, unsigned int goal, unsigned int W){
//return abs(goal % W - current % W)+abs(goal / W - current / W);
return max(abs(goal % W - current % W), abs(goal / W - current / W));
}
void calculateVecinos(int* vecinos, unsigned int idx, unsigned int W, unsigned int H){
if(idx >= W*H) return;
vecinos[0] = idx - W; //Upper neighbor
vecinos[1] = idx + 1; //Rigth neighbor
vecinos[2] = idx + W; //Lower neighbor
vecinos[3] = idx - 1; //Left neighbor
#if CONECTIVIDAD == 8
vecinos[4] = idx - W + 1; //
vecinos[5] = idx - W - 1; //
vecinos[6] = idx + W + 1; //
vecinos[7] = idx + W - 1; //
#endif
}
int idxOfmin(int* f_vals){
int pos=-2, lastj = -1;
unsigned int min=UINT_MAX;
for(int j=0;j<int(open_list.size());j++){
int i = open_list.at(j);
if(f_vals[i]<min){
pos=i;
lastj=j;
min=f_vals[i];
}
}
open_list.erase(open_list.begin()+lastj);
return pos;
}
//Funcion para suavizar la ruta
bool suavizar(nav_msgs::Path ruta, nav_msgs::Path * ruta_suavizada){
std::cout << "Smoothing...";
*ruta_suavizada = ruta;
///////////////////////[UNDER CONSTRUCTION]///////////////////////
int n = int(ruta.poses.size());
float dV[n][2];
deltaV(*ruta_suavizada, ruta, dV); //Aqui ambas rutas son iguales
clock_t begin = clock();
while(norm2(dV, n) > TOL){
for(int i=0; i<n; i++){
(*ruta_suavizada).poses[i].pose.position.x += (-DELTA*dV[i][0]);
(*ruta_suavizada).poses[i].pose.position.y += (-DELTA*dV[i][1]);
}
deltaV(*ruta_suavizada, ruta, dV);
}
///////////////////////[END OF CONSTRUCTION]///////////////////////
std::cout << "Elapsed time: " << float(clock() - begin) / CLOCKS_PER_SEC << std::endl;
std::cout << "Path smoothed" << std::endl;
return true;
}
bool deltaV(nav_msgs::Path pathP, nav_msgs::Path pathQ, float dV[][2]){
///////////////////////[UNDER CONSTRUCTION]///////////////////////
float px, py, qx, qy, pxl, pxn, pyl, pyn;
int n = int(pathQ.poses.size());
for(int i=1; i<n-1; i++){
px = pathP.poses[i].pose.position.x;
py = pathP.poses[i].pose.position.y;
qx = pathQ.poses[i].pose.position.x;
qy = pathQ.poses[i].pose.position.y;
pxl = pathP.poses[i-1].pose.position.x;
pxn = pathP.poses[i+1].pose.position.x;
pyl = pathP.poses[i-1].pose.position.y;
pyn = pathP.poses[i+1].pose.position.y;
dV[i][0] = ALPHA*(px-qx)+BETA*(2*px-pxl-pxn);
dV[i][1] = ALPHA*(py-qy)+BETA*(2*py-pyl-pyn);
}
//First term
px = pathP.poses[0].pose.position.x;
py = pathP.poses[0].pose.position.y;
qx = pathQ.poses[0].pose.position.x;
qy = pathQ.poses[0].pose.position.y;
pxn = pathP.poses[1].pose.position.x;
pyn = pathP.poses[1].pose.position.y;
dV[0][0] = ALPHA*(px-qx)+BETA*(px-pxn);
dV[0][1] = ALPHA*(py-qy)+BETA*(py-pyn);
//Last term
px = pathP.poses[n-1].pose.position.x;
py = pathP.poses[n-1].pose.position.y;
qx = pathQ.poses[n-1].pose.position.x;
qy = pathQ.poses[n-1].pose.position.y;
pxl = pathP.poses[n-2].pose.position.x;
pyl = pathP.poses[n-2].pose.position.y;
dV[n-1][0] = ALPHA*(px-qx)+BETA*(px-pxl);
dV[n-1][1] = ALPHA*(py-qy)+BETA*(py-pyl);
///////////////////////[END OF CONSTRUCTION]///////////////////////
return true;
}
float norm2(float m[][2], int n){
float sum = 0;
for(int i=0; i<n; i++){
sum += (m[i][0]*m[i][0] + m[i][1]*m[i][1]);
}
return sqrt(sum);
}
int main (int argc, char ** argv){
std::cout<<">Initializing path calculator node..." <<std::endl;
ros::init(argc,argv,"path_calculator");
ros::NodeHandle n;
ros::Publisher pubPath;
ros::Rate loop(10);
ros::ServiceServer srvAstar = n.advertiseService("navigation/a_star", calculate_path);
pubPath = n.advertise<nav_msgs::Path>("/navigation/a_star_path",1);
while(ros::ok()){
pubPath.publish(solved_path);
ros::spinOnce();
loop.sleep();
}
return 0;
}
/*
geometry_msgs/Pose start_pose
geometry_msgs/Point position
float64 x
float64 y
float64 z
geometry_msgs/Quaternion orientation
float64 x
float64 y
float64 z
float64 w
geometry_msgs/Pose goal_pose
geometry_msgs/Point position
float64 x
float64 y
float64 z
geometry_msgs/Quaternion orientation
float64 x
float64 y
float64 z
float64 w
nav_msgs/OccupancyGrid map
std_msgs/Header header
uint32 seq
time stamp
string frame_id
nav_msgs/MapMetaData info
time map_load_time
float32 resolution
uint32 width
uint32 height
geometry_msgs/Pose origin
geometry_msgs/Point position
float64 x
float64 y
float64 z
geometry_msgs/Quaternion orientation
float64 x
float64 y
float64 z
float64 w
int8[] data
---
nav_msgs/Path path
std_msgs/Header header
uint32 seq
time stamp
string frame_id
geometry_msgs/PoseStamped[] poses
std_msgs/Header header
uint32 seq
time stamp
string frame_id
geometry_msgs/Pose pose
geometry_msgs/Point position
float64 x
float64 y
float64 z
geometry_msgs/Quaternion orientation
float64 x
float64 y
float64 z
float64 w
//==========================
*/
| 29.945498 | 92 | 0.616048 | [
"vector"
] |
5873f8594b5349352faf374232278c867f0e3035 | 5,604 | cpp | C++ | Gems/Atom/RPI/Code/Tests/Material/MaterialVersionUpdateTests.cpp | BreakerOfThings/o3de | f4c59f868c726470ec910623facd836047d059c3 | [
"Apache-2.0",
"MIT"
] | null | null | null | Gems/Atom/RPI/Code/Tests/Material/MaterialVersionUpdateTests.cpp | BreakerOfThings/o3de | f4c59f868c726470ec910623facd836047d059c3 | [
"Apache-2.0",
"MIT"
] | null | null | null | Gems/Atom/RPI/Code/Tests/Material/MaterialVersionUpdateTests.cpp | BreakerOfThings/o3de | f4c59f868c726470ec910623facd836047d059c3 | [
"Apache-2.0",
"MIT"
] | null | null | null | /*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <Common/RPITestFixture.h>
#include <Common/ErrorMessageFinder.h>
#include <Atom/RPI.Reflect/Material/MaterialVersionUpdate.h>
namespace UnitTest
{
using namespace AZ;
using namespace RPI;
//! Test suite for the internal components of MaterialVersionUpdates.
//! Testing full update functionality in combination with MaterialTypeAssets
//! and MaterialAssets is performed in their respective test suites.
class MaterialVersionUpdateTests
: public RPITestFixture
{
protected:
const MaterialPropertyValue m_invalidValue = MaterialVersionUpdate::Action::s_invalidValue;
const AZ::Name m_invalidName = MaterialVersionUpdate::MaterialPropertyValueWrapper::s_invalidName;
};
TEST_F(MaterialVersionUpdateTests, MaterialPropertyValueWrapper)
{
const MaterialPropertyValue intValue(123);
MaterialVersionUpdate::MaterialPropertyValueWrapper intWrapper(intValue);
EXPECT_EQ(intWrapper.Get(), intValue);
const MaterialPropertyValue strValue(AZStd::string("myString"));
MaterialVersionUpdate::MaterialPropertyValueWrapper strWrapper(strValue);
EXPECT_EQ(strWrapper.Get(), strValue);
EXPECT_EQ(strWrapper.GetAsName(), AZ::Name(strValue.GetValue<AZStd::string>()));
}
TEST_F(MaterialVersionUpdateTests, MaterialPropertyValueWrapper_Error_GetAsName)
{
// Empty string should not trigger error
const MaterialPropertyValue strValue(AZStd::string(""));
MaterialVersionUpdate::MaterialPropertyValueWrapper strWrapper(strValue);
EXPECT_EQ(strWrapper.GetAsName(), AZ::Name(strValue.GetValue<AZStd::string>()));
// Non-string value should trigger error
ErrorMessageFinder errorMessageFinder;
errorMessageFinder.AddExpectedErrorMessage("GetAsName() expects a valid string value");
const MaterialPropertyValue intValue(123);
MaterialVersionUpdate::MaterialPropertyValueWrapper intWrapper(intValue);
EXPECT_EQ(intWrapper.GetAsName(), m_invalidName);
errorMessageFinder.CheckExpectedErrorsFound();
}
TEST_F(MaterialVersionUpdateTests, Action_Rename)
{
// Test alternative ways of creating the same action
const AZStd::string fromStr = "oldName";
const AZStd::string toStr = "newName";
MaterialVersionUpdate::Action action(
AZ::Name{ "rename" },
{
{ Name{ "from" }, fromStr },
{ Name{ "to" }, toStr }
} );
MaterialVersionUpdate::Action action2(
{
{ AZStd::string("op"), AZStd::string("rename") },
{ AZStd::string("from"), fromStr },
{ AZStd::string("to"), toStr }
} );
MaterialVersionUpdate::Action action3(AZ::Name("rename"), {});
action3.AddArg(Name{ "from" }, fromStr);
action3.AddArg(Name{ "to" }, toStr);
EXPECT_EQ(action, action2);
EXPECT_EQ(action, action3);
EXPECT_TRUE(action.Validate());
// Test properties
EXPECT_EQ(action.GetArgCount(), 2);
EXPECT_EQ(action.GetArg(Name{ "from" }), fromStr);
EXPECT_EQ(action.GetArg(Name{ "to" }), toStr);
EXPECT_EQ(action.GetArgAsName(Name{ "from" }), AZ::Name(fromStr));
EXPECT_EQ(action.GetArgAsName(Name{ "to" }), AZ::Name(toStr));
}
TEST_F(MaterialVersionUpdateTests, Action_SetValue)
{
// Test alternative ways of creating the same action
const AZStd::string nameStr = "myInt";
const MaterialPropertyValue theValue(123);
MaterialVersionUpdate::Action action(
AZ::Name{ "setValue" },
{
{ Name{ "name" }, nameStr },
{ Name{ "value" }, theValue }
} );
MaterialVersionUpdate::Action action2(
{
{ AZStd::string("op"), AZStd::string("setValue") },
{ AZStd::string("name"), nameStr },
{ AZStd::string("value"), theValue }
} );
MaterialVersionUpdate::Action action3(AZ::Name("setValue"), {});
action3.AddArg(Name{ "name" }, nameStr);
action3.AddArg(Name{ "value" }, theValue);
EXPECT_EQ(action, action2);
EXPECT_EQ(action, action3);
EXPECT_TRUE(action.Validate());
// Test properties
EXPECT_EQ(action.GetArgCount(), 2);
EXPECT_EQ(action.GetArg(Name{ "name" }), nameStr);
EXPECT_EQ(action.GetArg(Name{ "value" }), theValue);
EXPECT_EQ(action.GetArgAsName(Name{ "name" }), AZ::Name(nameStr));
}
TEST_F(MaterialVersionUpdateTests, Action_Error_GetArg)
{
const AZStd::string nameStr = "myInt";
const MaterialPropertyValue theValue(123);
MaterialVersionUpdate::Action action(
AZ::Name{ "setValue" },
{
{ Name{ "name" }, nameStr },
{ Name{ "value" }, theValue }
} );
// Non-existent key
EXPECT_EQ(action.GetArg(AZ::Name("invalidKey")), m_invalidValue);
// GetArgAsName with non-string value
ErrorMessageFinder errorMessageFinder;
errorMessageFinder.AddExpectedErrorMessage("expects a valid string value");
EXPECT_EQ(action.GetArgAsName(AZ::Name("value")), m_invalidName);
}
}
| 37.864865 | 106 | 0.63419 | [
"3d"
] |
587ffb6104d76e9366ed02eab4d02a699721d988 | 4,926 | cpp | C++ | blast/src/app/blastdb/blastdb_path.cpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | null | null | null | blast/src/app/blastdb/blastdb_path.cpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | null | null | null | blast/src/app/blastdb/blastdb_path.cpp | mycolab/ncbi-blast | e59746cec78044d2bf6d65de644717c42f80b098 | [
"Apache-2.0"
] | null | null | null | /* $Id: blastdb_path.cpp 574775 2018-11-19 15:21:37Z zaretska $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Author: Irena Zaretskaya
*
*/
/** @file blastdb_path.cpp
* Command line tool to determine the path to BLAST databases.
*/
#include <ncbi_pch.hpp>
#include <corelib/ncbiapp.hpp>
#include <algo/blast/api/version.hpp>
#include <objtools/blast/seqdb_reader/seqdbexpert.hpp>
#include <algo/blast/blastinput/blast_input.hpp>
#include "../blast/blast_app_util.hpp"
#include <iomanip>
#ifndef SKIP_DOXYGEN_PROCESSING
USING_NCBI_SCOPE;
USING_SCOPE(blast);
#endif
/// The application class
class CBlastDBCmdApp : public CNcbiApplication
{
public:
/** @inheritDoc */
CBlastDBCmdApp() {
CRef<CVersion> version(new CVersion());
version->SetVersionInfo(new CBlastVersion());
SetFullVersion(version);
}
private:
/** @inheritDoc */
virtual void Init();
/** @inheritDoc */
virtual int Run();
};
void CBlastDBCmdApp::Init()
{
HideStdArgs(fHideConffile | fHideFullVersion | fHideXmlHelp | fHideDryRun);
auto_ptr<CArgDescriptions> arg_desc(new CArgDescriptions);
// Specify USAGE context
arg_desc->SetUsageContext(GetArguments().GetProgramBasename(),
"BLAST database client, version " + CBlastVersion().Print());
arg_desc->SetCurrentGroup("BLAST database options");
arg_desc->AddDefaultKey(kArgDb, "dbname", "BLAST database name",
CArgDescriptions::eString, "nr");
arg_desc->AddDefaultKey(kArgDbType, "molecule_type",
"Molecule type stored in BLAST database",
CArgDescriptions::eString, "nucl");
arg_desc->SetConstraint(kArgDbType, &(*new CArgAllow_Strings,
"nucl", "prot"));
arg_desc->AddFlag("getvolumespath", "Get .[np]in adn .[np]sq volumes paths", true);
arg_desc->SetCurrentGroup("Output configuration options");
arg_desc->AddDefaultKey(kArgOutput, "output_file", "Output file name",
CArgDescriptions::eOutputFile, "-");
SetupArgDescriptions(arg_desc.release());
}
int CBlastDBCmdApp::Run(void)
{
int status = 0;
const CArgs& args = GetArgs();
try {
CNcbiOstream& out = args["out"].AsOutputFile();
string dbtype = args[kArgDbType].AsString();
if (args["getvolumespath"]) {
CSeqDB::ESeqType seqType = (dbtype == "nucl" ) ? CSeqDB::eNucleotide : CSeqDB::eProtein ;
vector<string> paths;
//CSeqDB::FindVolumePaths(args[kArgDb].AsString(),seqType,paths,&alias_paths,true);
CSeqDB::FindVolumePaths(args[kArgDb].AsString(),seqType,paths);
for( size_t i = 0; i < paths.size();i++) {
out << paths[i] << "." << dbtype.at(0) << "in " << paths[i] << "." << dbtype.at(0) << "sq";
if(i < paths.size() - 1) out << " ";
}
}
else {
string dbLocation = SeqDB_ResolveDbPathNoExtension(args[kArgDb].AsString(),dbtype.at(0));
if(dbLocation.empty()) {
status = 1;
}
out << dbLocation << NcbiEndl;
}
}
catch (const CException& e) {
ERR_POST(Error << e.GetMsg());
status = 1;
} catch (...) {
ERR_POST(Error << "Failed to retrieve requested item");
status = 1;
}
return status;
}
#ifndef SKIP_DOXYGEN_PROCESSING
int main(int argc, const char* argv[] /*, const char* envp[]*/)
{
return CBlastDBCmdApp().AppMain(argc, argv);
}
#endif /* SKIP_DOXYGEN_PROCESSING */
| 34.93617 | 121 | 0.604953 | [
"vector"
] |
58870a279bed0ea603e8914cc9c09f1a74a1baed | 3,463 | cpp | C++ | algorithms-and-data-structures/strings/h_substring_quantity.cpp | nothingelsematters/university | 5561969b1b11678228aaf7e6660e8b1a93d10294 | [
"WTFPL"
] | 1 | 2018-06-03T17:48:50.000Z | 2018-06-03T17:48:50.000Z | algorithms-and-data-structures/strings/h_substring_quantity.cpp | nothingelsematters/University | b1e188cb59e5a436731b92c914494626a99e1ae0 | [
"WTFPL"
] | null | null | null | algorithms-and-data-structures/strings/h_substring_quantity.cpp | nothingelsematters/University | b1e188cb59e5a436731b92c914494626a99e1ae0 | [
"WTFPL"
] | 14 | 2019-04-07T21:27:09.000Z | 2021-12-05T13:37:25.000Z | #include <fstream>
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <algorithm>
struct Vertex {
Vertex(size_t parent, char c) : parent(parent), parent_char(c) {}
size_t operator[](char c) const {
auto it = travel.find(c);
if (it == travel.end()) {
return -1;
}
return it->second;
}
size_t parent;
char parent_char;
size_t suf_link = -1;
size_t com_link = -1;
int visited = 0;
std::map<char, int> travel;
std::map<char, int> son;
};
struct Forest {
Forest() {
vertex.push_back(Vertex(-1, '\0'));
}
void add(std::string const& str) {
size_t current = 0;
for (auto c: str) {
size_t to = vertex[current][c];
if (to != -1) {
current = to;
continue;
}
vertex[current].travel[c] = vertex.size();
vertex[current].son[c] = vertex.size();
vertex.push_back(Vertex(current, c));
current = vertex.size() - 1;
}
terminals.push_back(current);
}
int* quantity(std::string const& text) {
size_t current = 0;
for (auto c: text) {
current = get_link(current, c);
vertex[current].visited++;
}
for (auto i: order_bfs()) {
vertex[get_suf_link(i)].visited += vertex[i].visited;
}
int* result = new int[terminals.size()];
std::fill(result, result + terminals.size(), 0);
for (int i = 0; i < terminals.size(); ++i) {
result[i] = vertex[terminals[i]].visited;
}
return result;
}
private:
size_t get_suf_link(size_t index) {
if (vertex[index].suf_link != -1) {
return vertex[index].suf_link;
}
if (vertex[index].parent == -1 || vertex[index].parent == 0) {
vertex[index].suf_link = 0;
} else {
vertex[index].suf_link = get_link(get_suf_link(vertex[index].parent),
vertex[index].parent_char);
}
return vertex[index].suf_link;
}
size_t get_link(size_t index, char c) {
size_t res = vertex[index][c];
if (res != -1) {
return res;
}
size_t trans = vertex[index][c];
if (index == 0) {
vertex[index].travel[c] = 0;
} else {
vertex[index].travel[c] = get_link(get_suf_link(index), c);
}
return vertex[index].travel[c];
}
std::list<size_t> order_bfs() {
std::list<size_t> result = {0};
for (auto i = result.begin(); i != result.end(); ++i) {
for (auto j: vertex[*i].son) {
result.push_back(j.second);
}
}
std::reverse(result.begin(), result.end());
return std::move(result);
}
std::vector<Vertex> vertex;
std::vector<size_t> terminals;
};
int main() {
std::ifstream fin("search5.in");
Forest f;
size_t size;
fin >> size;
for (size_t i = 0; i < size; ++i) {
std::string str;
fin >> str;
f.add(std::move(str));
}
std::string text;
fin >> text;
fin.close();
int* quantity = f.quantity(std::move(text));
std::ofstream fout("search5.out");
for (size_t i = 0; i < size; ++i) {
fout << quantity[i] << '\n';
}
fout.close();
delete[] quantity;
return 0;
}
| 24.387324 | 81 | 0.505342 | [
"vector"
] |
588ab5946cb53070a56ea2e2676270e7bf39e2be | 10,614 | cpp | C++ | src/app/voltdb/voltdb_src/tests/ee/common/undolog_test.cpp | OpenMPDK/SMDK | 8f19d32d999731242cb1ab116a4cb445d9993b15 | [
"BSD-3-Clause"
] | 44 | 2022-03-16T08:32:31.000Z | 2022-03-31T16:02:35.000Z | src/app/voltdb/voltdb_src/tests/ee/common/undolog_test.cpp | H2O0Lee/SMDK | eff49bc17a55a83ea968112feb2e2f2ea18c4ff5 | [
"BSD-3-Clause"
] | 1 | 2022-03-29T02:30:28.000Z | 2022-03-30T03:40:46.000Z | src/app/voltdb/voltdb_src/tests/ee/common/undolog_test.cpp | H2O0Lee/SMDK | eff49bc17a55a83ea968112feb2e2f2ea18c4ff5 | [
"BSD-3-Clause"
] | 18 | 2022-03-19T04:41:04.000Z | 2022-03-31T03:32:12.000Z | /* This file is part of VoltDB.
* Copyright (C) 2008-2020 VoltDB Inc.
*
* 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 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 "harness.h"
#include "common/UndoReleaseAction.h"
#include "common/UndoLog.h"
#include "common/UndoQuantum.h"
#include "common/Pool.hpp"
#include <vector>
#include <stdint.h>
static int staticReleaseIndex = 0;
static int staticUndoneIndex = 0;
class MockUndoActionHistory {
public:
MockUndoActionHistory() : m_released(false), m_undone(false), m_releasedIndex(-1), m_undoneIndex(-1) {}
bool m_released;
bool m_undone;
int m_releasedIndex;
int m_undoneIndex;
};
class MockUndoAction : public voltdb::UndoReleaseAction {
public:
MockUndoAction(MockUndoActionHistory *history) : m_history(history) {}
void undo() {
m_history->m_undone = true;
m_history->m_undoneIndex = staticUndoneIndex++;
}
void release() {
m_history->m_released = true;
m_history->m_releasedIndex = staticReleaseIndex++;
}
bool isReplicatedTable() {
return false;
}
private:
MockUndoActionHistory *m_history;
};
class UndoLogTest : public Test {
public:
UndoLogTest() {
m_undoLog = new voltdb::UndoLog();
staticReleaseIndex = 0;
staticUndoneIndex = 0;
}
std::vector<int64_t> generateQuantumsAndActions(int numUndoQuantums, int numUndoActions) {
std::vector<int64_t> undoTokens;
for (int ii = 0; ii < numUndoQuantums; ii++) {
const int64_t undoToken = (INT64_MIN + 1) + (ii * 3);
undoTokens.push_back(undoToken);
voltdb::UndoQuantum *quantum = m_undoLog->generateUndoQuantum(undoToken);
std::vector<MockUndoActionHistory*> histories;
for (int qq = 0; qq < numUndoActions; qq++) {
MockUndoActionHistory *history = new MockUndoActionHistory();
histories.push_back(history);
quantum->registerUndoAction(new (*quantum) MockUndoAction(history));
}
m_undoActionHistoryByQuantum.push_back(histories);
}
return undoTokens;
}
~UndoLogTest() {
delete m_undoLog;
for(std::vector<std::vector<MockUndoActionHistory*> >::iterator i = m_undoActionHistoryByQuantum.begin();
i != m_undoActionHistoryByQuantum.end(); i++) {
for(std::vector<MockUndoActionHistory*>::iterator q = (*i).begin();
q != (*i).end(); q++) {
delete (*q);
}
}
}
/*
* Confirm all actions were undone in FILO order.
*/
void confirmUndoneActionHistoryOrder(std::vector<MockUndoActionHistory*> histories, int &expectedStartingIndex) {
for (std::vector<MockUndoActionHistory*>::reverse_iterator i = histories.rbegin();
i != histories.rend();
i++) {
const MockUndoActionHistory *history = *i;
ASSERT_TRUE(history->m_undone);
ASSERT_FALSE(history->m_released);
ASSERT_EQ(history->m_undoneIndex, expectedStartingIndex);
expectedStartingIndex++;
}
}
/*
* Confirm all actions were released in FIFO order.
*/
void confirmReleaseActionHistoryOrder(std::vector<MockUndoActionHistory*> histories, int &expectedStartingIndex) {
for (std::vector<MockUndoActionHistory*>::iterator i = histories.begin();
i != histories.end();
i++) {
const MockUndoActionHistory *history = *i;
ASSERT_TRUE(history->m_released);
ASSERT_FALSE(history->m_undone);
ASSERT_EQ(history->m_releasedIndex, expectedStartingIndex);
expectedStartingIndex++;
}
}
voltdb::UndoLog *m_undoLog;
std::vector<std::vector<MockUndoActionHistory*> > m_undoActionHistoryByQuantum;
};
/*
* A series of tests to make sure the UndoLog and such can construct and destruct successfully without leaking memory.
*/
TEST_F(UndoLogTest, TestZeroQuantumZeroAction) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 0, 0);
ASSERT_EQ( 0, undoTokens.size());
}
TEST_F(UndoLogTest, TestOneQuantumZeroAction) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 1, 0);
ASSERT_EQ( 1, undoTokens.size());
}
TEST_F(UndoLogTest, TestOneQuantumOneAction) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 1, 1);
ASSERT_EQ( 1, undoTokens.size());
}
TEST_F(UndoLogTest, TestOneQuantumTenAction) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 1, 10);
ASSERT_EQ( 1, undoTokens.size());
}
TEST_F(UndoLogTest, TestTenQuantumOneAction) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 10, 1);
ASSERT_EQ( 10, undoTokens.size());
}
TEST_F(UndoLogTest, TestTenQuantumTenAction) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 10, 10);
ASSERT_EQ( 10, undoTokens.size());
}
TEST_F(UndoLogTest, TestOneQuantumOneActionRelease) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 1, 1);
ASSERT_EQ( 1, undoTokens.size());
m_undoLog->release(undoTokens[0]);
const MockUndoActionHistory *undoActionHistory = m_undoActionHistoryByQuantum[0][0];
ASSERT_TRUE(undoActionHistory->m_released);
ASSERT_FALSE(undoActionHistory->m_undone);
ASSERT_EQ(undoActionHistory->m_releasedIndex, 0);
}
TEST_F(UndoLogTest, TestOneQuantumOneActionUndo) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 1, 1);
ASSERT_EQ( 1, undoTokens.size());
m_undoLog->undo(undoTokens[0]);
const MockUndoActionHistory *undoActionHistory = m_undoActionHistoryByQuantum[0][0];
ASSERT_FALSE(undoActionHistory->m_released);
ASSERT_TRUE(undoActionHistory->m_undone);
ASSERT_EQ(undoActionHistory->m_undoneIndex, 0);
}
/*
* Check that the three actions are undone in the correct reverse order for a single quantum.
*/
TEST_F(UndoLogTest, TestOneQuantumThreeActionUndoOrdering) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 1, 3);
ASSERT_EQ( 1, undoTokens.size());
m_undoLog->undo(undoTokens[0]);
std::vector<MockUndoActionHistory*> histories = m_undoActionHistoryByQuantum[0];
int startingIndex = 0;
confirmUndoneActionHistoryOrder(histories, startingIndex);
}
TEST_F(UndoLogTest, TestOneQuantumThreeActionReleaseOrdering) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 1, 3);
ASSERT_EQ( 1, undoTokens.size());
m_undoLog->release(undoTokens[0]);
std::vector<MockUndoActionHistory*> histories = m_undoActionHistoryByQuantum[0];
int startingIndex = 0;
confirmReleaseActionHistoryOrder(histories, startingIndex);
}
/*
* Now do the same for three quantums.
*/
TEST_F(UndoLogTest, TestThreeQuantumThreeActionUndoOrdering) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 3, 3);
ASSERT_EQ( 3, undoTokens.size());
m_undoLog->undo(undoTokens[0]);
int startingIndex = 0;
for (int ii = 2; ii >= 0; ii--) {
confirmUndoneActionHistoryOrder(m_undoActionHistoryByQuantum[ii], startingIndex);
}
}
/*
* The order of releasing doesn't really matter unlike undo, assume it goes forward through the quantums
*/
TEST_F(UndoLogTest, TestThreeQuantumThreeActionReleaseOrdering) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 3, 3);
ASSERT_EQ( 3, undoTokens.size());
m_undoLog->release(undoTokens[2]);
int startingIndex = 0;
for (int ii = 0; ii < 3; ii++) {
confirmReleaseActionHistoryOrder(m_undoActionHistoryByQuantum[ii], startingIndex);
}
}
TEST_F(UndoLogTest, TestThreeQuantumThreeActionReleaseOneUndoOne) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 3, 3);
ASSERT_EQ( 3, undoTokens.size());
m_undoLog->release(undoTokens[0]);
int startingIndex = 0;
confirmReleaseActionHistoryOrder(m_undoActionHistoryByQuantum[0], startingIndex);
m_undoLog->undo(undoTokens[2]);
startingIndex = 0;
confirmUndoneActionHistoryOrder(m_undoActionHistoryByQuantum[2], startingIndex);
}
TEST_F(UndoLogTest, TestThreeQuantumThreeActionUndoOneReleaseOne) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 3, 3);
ASSERT_EQ( 3, undoTokens.size());
m_undoLog->undo(undoTokens[2]);
int startingIndex = 0;
confirmUndoneActionHistoryOrder(m_undoActionHistoryByQuantum[2], startingIndex);
m_undoLog->release(undoTokens[0]);
startingIndex = 0;
confirmReleaseActionHistoryOrder(m_undoActionHistoryByQuantum[0], startingIndex);
}
TEST_F(UndoLogTest, TestTwoQuantumTwoActionReleaseOneUndoOne) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 2, 2);
ASSERT_EQ( 2, undoTokens.size());
m_undoLog->release(undoTokens[0]);
int startingIndex = 0;
confirmReleaseActionHistoryOrder(m_undoActionHistoryByQuantum[0], startingIndex);
m_undoLog->undo(undoTokens[1]);
startingIndex = 0;
confirmUndoneActionHistoryOrder(m_undoActionHistoryByQuantum[1], startingIndex);
}
TEST_F(UndoLogTest, TestTwoQuantumTwoActionUndoOneReleaseOne) {
std::vector<int64_t> undoTokens = generateQuantumsAndActions( 2, 2);
ASSERT_EQ( 2, undoTokens.size());
m_undoLog->undo(undoTokens[1]);
int startingIndex = 0;
confirmUndoneActionHistoryOrder(m_undoActionHistoryByQuantum[1], startingIndex);
m_undoLog->release(undoTokens[0]);
startingIndex = 0;
confirmReleaseActionHistoryOrder(m_undoActionHistoryByQuantum[0], startingIndex);
}
int main() {
return TestSuite::globalInstance()->runAll();
}
| 35.61745 | 118 | 0.708121 | [
"vector"
] |
588eecceab48160795550a0deffcc84de8893a73 | 3,081 | cpp | C++ | MegamanX3/MegamanX3/DoorShurikein.cpp | quangnghiauit/game | 3c0537f96342c6fcb89cf5f3541acfef75b558f1 | [
"MIT"
] | null | null | null | MegamanX3/MegamanX3/DoorShurikein.cpp | quangnghiauit/game | 3c0537f96342c6fcb89cf5f3541acfef75b558f1 | [
"MIT"
] | null | null | null | MegamanX3/MegamanX3/DoorShurikein.cpp | quangnghiauit/game | 3c0537f96342c6fcb89cf5f3541acfef75b558f1 | [
"MIT"
] | null | null | null | #include"DoorShurikein.h"
DoorShurikein* DoorShurikein::instance;
DoorShurikein::DoorShurikein(float top, float left, float w, float h)
{
this->nameObject = DOOR;
this->x = left;
this->y = top;
this->width = w;
this->height = h;
this->actived = false;
this->moving_megaman = false;
this->locked = true;
this->allow_open = true;
this->nameObject = DOOR;
MyTexture* texture = TXT::Instance()->GetTexture(TDOOR);
vector<RECT*> list_source_rect_open = TXT::Instance()->GetListSourceRect(SDOORSHURIKEINOPEN);
animation->listSprite[State::DOOROPEN] = new Sprite(texture, list_source_rect_open, 5);
vector<RECT*> list_source_rect_close = TXT::Instance()->GetListSourceRect(SDOORSHURIKEINCLOSE);
animation->listSprite[State::DOORCLOSE] = new Sprite(texture, list_source_rect_close, 5);
this->state = DOOROPEN;
}
DoorShurikein * DoorShurikein::Instance()
{
if(!instance)
instance = new DoorShurikein((878 + G_ADDITIONS_TO_BECOME_THE_SQUARE)*G_Scale.y, 2300 * G_Scale.x, 0, 0);
return instance;
}
void DoorShurikein::Update(DWORD dt, vector<Object*>* List_object_can_col)
{
//===========when door opened -> move megaman thought door==============
if (this->moving_megaman)
{
float x_megaman, y_megman;
Megaman::Instance()->GetPosition(x_megaman, y_megman);
if (abs(x_megaman - x_start_megaman) > 153)
{
this->moving_megaman = false;
this->SetState(DOORCLOSE);
this->x += 40;
Megaman::Instance()->SetAutoMoving(false);
return;
}
Megaman::Instance()->SetPosition(x_megaman + 3, y_megman);
return;
}
//==========when door start completely open==================================
if (this->state == DOOROPEN && this->animation->listSprite[this->state]->IsFinalFrame())
{
this->moving_megaman = true;
Camera::Instance()->SetAutoMovingX(true);
}
if (this->state == DOORCLOSE && this->animation->listSprite[DOORCLOSE]->IsFinalFrame())
{
this->actived = false;
Genjibo::Instance()->SetActived(true);
}
}
void DoorShurikein::Render()
{
if (this->moving_megaman)
return;
if (!this->actived)
{
this->animation->listSprite[DOOROPEN]->Set_current_frame(0);
if(this->state==DOORCLOSE)
this->animation->listSprite[DOORCLOSE]->Set_current_frame(16);
}
ActionObject::Render();
}
BoundingBox DoorShurikein::GetBoundingBox()
{
BoundingBox bound;
if (this->locked)
{
bound.x = x - DOORSHURIKEIN_WIDTH / 2;
bound.y = y - DOORSHURIKEIN_HEIGHT / 2;
bound.w = DOORSHURIKEIN_WIDTH;
bound.h = DOORSHURIKEIN_HEIGHT;
bound.vx = 0;
bound.vy = 0;
}
else
{
bound.x = x - DOORSHURIKEIN_WIDTH / 2;
bound.y = y + DOORSHURIKEIN_HEIGHT / 2; //change possition to avoid colli
bound.w = DOORSHURIKEIN_WIDTH;
bound.h = DOORSHURIKEIN_HEIGHT;
bound.vx = 0;
bound.vy = 0;
}
return bound;
}
void DoorShurikein::SetActived(bool active)
{
if (!this->allow_open)
return;
this->actived = active;
this->allow_open = false;
float x_megaman, y_megman;
Megaman::Instance()->GetPosition(x_megaman, y_megman);
Megaman::Instance()->SetAutoMoving(true);
this->x_start_megaman = x_megaman;
}
| 24.070313 | 107 | 0.691334 | [
"render",
"object",
"vector"
] |
5894f82f79f954cd50926507b9c0fc8f75437ed7 | 2,579 | cpp | C++ | DSAA2/Polynomial.cpp | crosslife/DSAA | 03472db6e61582187192073b6ea4649b6195222b | [
"MIT"
] | 5 | 2017-03-30T23:23:08.000Z | 2020-11-08T00:34:46.000Z | DSAA2/Polynomial.cpp | crosslife/DSAA | 03472db6e61582187192073b6ea4649b6195222b | [
"MIT"
] | null | null | null | DSAA2/Polynomial.cpp | crosslife/DSAA | 03472db6e61582187192073b6ea4649b6195222b | [
"MIT"
] | 1 | 2019-04-12T13:17:31.000Z | 2019-04-12T13:17:31.000Z | /*
* This code doesn't really do much, and abstraction is not built in.
* Thus, I haven't bothered testing it exhaustively.
*/
#include <iostream.h>
#include "vector.h"
class Polynomial
{
enum { MAX_DEGREE = 100 };
friend int main( ); // So I can do a quick test.
public:
Polynomial( );
void zeroPolynomial( );
Polynomial operator+( const Polynomial & rhs ) const;
Polynomial operator*( const Polynomial & rhs ) const;
void print( ostream & out ) const;
private:
vector<int> coeffArray;
int highPower;
};
int max( int a, int b )
{
return a > b ? a : b;
}
Polynomial::Polynomial( ) : coeffArray( MAX_DEGREE + 1 )
{
zeroPolynomial( );
}
void Polynomial::zeroPolynomial( )
{
for( int i = 0; i <= MAX_DEGREE; i++ )
coeffArray[ i ] = 0;
highPower = 0;
}
Polynomial Polynomial::operator+( const Polynomial & rhs ) const
{
Polynomial sum;
sum.highPower = max( highPower, rhs.highPower );
for( int i = sum.highPower; i >= 0; i-- )
sum.coeffArray[ i ] = coeffArray[ i ] + rhs.coeffArray[ i ];
return sum;
}
Polynomial Polynomial::operator*( const Polynomial & rhs ) const
{
Polynomial product;
product.highPower = highPower + rhs.highPower;
if( product.highPower > MAX_DEGREE )
cerr << "operator* exceeded MAX_DEGREE" << endl;
for( int i = 0; i <= highPower; i++ )
for( int j = 0; j <= rhs.highPower; j++ )
product.coeffArray[ i + j ] +=
coeffArray[ i ] * rhs.coeffArray[ j ];
return product;
}
void Polynomial::print( ostream & out ) const
{
for( int i = highPower; i > 0; i-- )
out << coeffArray[ i ] << "x^" << i << " + ";
out << coeffArray[ 0 ] << endl;
}
ostream & operator<<( ostream & out, const Polynomial & rhs )
{
rhs.print( out );
return out;
}
int main( )
{
Polynomial p;
Polynomial q;
p.highPower = 1; p.coeffArray[ 0 ] = 1; p.coeffArray[ 1 ] = 1;
q = p + p;
p = q * q;
q = p + p;
cout << q << endl;
return 0;
} | 27.731183 | 76 | 0.460644 | [
"vector"
] |
5895a0726d1a2162ede4c555c4fa9b2df3774d42 | 614 | cpp | C++ | CPP/500 problems pepcoding/Equilibrium in Array.cpp | kratikasinghal/OJ-problems | fc5365cb4db9da780779e9912aeb2a751fe4517c | [
"MIT"
] | null | null | null | CPP/500 problems pepcoding/Equilibrium in Array.cpp | kratikasinghal/OJ-problems | fc5365cb4db9da780779e9912aeb2a751fe4517c | [
"MIT"
] | null | null | null | CPP/500 problems pepcoding/Equilibrium in Array.cpp | kratikasinghal/OJ-problems | fc5365cb4db9da780779e9912aeb2a751fe4517c | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
#define ll long long int
#define vi vector<int>
using namespace std;
int main() {
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
vi A(n+1);
for(int i = 0 ; i < n; i++) cin >> A[i];
ll prev = 0, next = 0;
for(int i = 0 ; i < n; i++) next += A[i];
int flag = 0;
for(int i = 0; i < n; i++)
{
next -= A[i];
if(i != 0)
prev += A[i-1];
if(prev == next) {cout << i+1 << "\n"; flag = 1; break; }
}
if(flag == 0)cout << "-1\n";
}
return 0;
} | 16.594595 | 66 | 0.376221 | [
"vector"
] |
5895db7a02f97e6f1dec4bce24908a5ddb1217f9 | 475,374 | cpp | C++ | App/Il2CppOutputProject/Source/il2cppOutput/Bulk_Microsoft.MixedReality.Toolkit.Services.InputSystem_1.cpp | bij51247/HandBroomProject | 6131a77cc4a505e872f82ab63629b8068f5843ee | [
"MIT"
] | null | null | null | App/Il2CppOutputProject/Source/il2cppOutput/Bulk_Microsoft.MixedReality.Toolkit.Services.InputSystem_1.cpp | bij51247/HandBroomProject | 6131a77cc4a505e872f82ab63629b8068f5843ee | [
"MIT"
] | null | null | null | App/Il2CppOutputProject/Source/il2cppOutput/Bulk_Microsoft.MixedReality.Toolkit.Services.InputSystem_1.cpp | bij51247/HandBroomProject | 6131a77cc4a505e872f82ab63629b8068f5843ee | [
"MIT"
] | null | null | null | #include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
template <typename R>
struct VirtFuncInvoker0
{
typedef R (*Func)(void*, const RuntimeMethod*);
static inline R Invoke (Il2CppMethodSlot slot, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj);
return ((Func)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename T1>
struct InterfaceActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj, T1 p1)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
template <typename R>
struct InterfaceFuncInvoker0
{
typedef R (*Func)(void*, const RuntimeMethod*);
static inline R Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface);
return ((Func)invokeData.methodPtr)(obj, invokeData.method);
}
};
// Microsoft.MixedReality.Toolkit.Input.BaseNearInteractionTouchable
struct BaseNearInteractionTouchable_t98D072EC4C522792850CE5A09BEE5F1CF9BFA19F;
// Microsoft.MixedReality.Toolkit.Input.DictationEventData
struct DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386;
// Microsoft.MixedReality.Toolkit.Input.FocusEventData
struct FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC;
// Microsoft.MixedReality.Toolkit.Input.HandMeshInfo
struct HandMeshInfo_t97CE256FABE551C015BE36E467AA7EFC57254084;
// Microsoft.MixedReality.Toolkit.Input.HandTrackingInputEventData
struct HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityBaseInputHandler
struct IMixedRealityBaseInputHandler_tC15FEFD562A0C7B791169CE168BE8A6FD805F79C;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityController
struct IMixedRealityController_tE328C8BD991056668984D67A323E3143DDD5CD31;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler
struct IMixedRealityDictationHandler_tC156B03CBBD750CD43DAC73314712738C02FE1AC;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusChangedHandler
struct IMixedRealityFocusChangedHandler_tEFE5BD28A43ED634A0CA784F2CF2E78725C869FB;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusHandler
struct IMixedRealityFocusHandler_tCB9C57FA1C39CAB596EC45CF4163E48BDCA34135;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler
struct IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>
struct IMixedRealityGestureHandler_1_tD98BED3AB9B32BFC28ED8AC1A27CFD8AC87D6C39;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Quaternion>
struct IMixedRealityGestureHandler_1_t4230FCC1C3B93C15652754F51E8E8B08E78E4B3A;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector2>
struct IMixedRealityGestureHandler_1_tE038FADEC9B3422DF9CA5EE5628C2097D40A5BE6;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector3>
struct IMixedRealityGestureHandler_1_t84808B3F44C67F8EF43032EAB4F599002F835DE3;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityHandJointHandler
struct IMixedRealityHandJointHandler_tA87827F6B3EB628AE0B274E3401D8B768EE1B548;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityHandMeshHandler
struct IMixedRealityHandMeshHandler_tC40BC662BA372AEFB8F9D6060184D4A283F9F367;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler
struct IMixedRealityInputHandler_t076C5BE3EA668A55178CC4F28F1B7950F2E6333F;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>
struct IMixedRealityInputHandler_1_t36D2117DF01BEA07C13A66885FAD6275DDD0C2BD;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<System.Single>
struct IMixedRealityInputHandler_1_tAD1B7DC731C61121E6B57E0298DAF20A61646468;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Quaternion>
struct IMixedRealityInputHandler_1_t3AD268F517E91D4C46AEEB59CA60E64585A5F463;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Vector2>
struct IMixedRealityInputHandler_1_tFC3F8D3B3CE2CCA4F25E275054FDF81C8A22E4E5;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Vector3>
struct IMixedRealityInputHandler_1_tEE6677D865F3622772E229A3654B306832BF6557;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource
struct IMixedRealityInputSource_tAA20C112E0AFFD46BA331685ACADCB90DC9D13E9;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem
struct IMixedRealityInputSystem_t142023776CCC57DFC5696BEA994C4F369CB5806E;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer
struct IMixedRealityPointer_tA64958356FC4ABDCB3CF2CFC334E3DA65A885D78;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler
struct IMixedRealityPointerHandler_tAB30AF314323490DC19B42E9E12F67CFFE976BF3;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler
struct IMixedRealitySourcePoseHandler_tDB93DF305A730CF23F8B3242543DEB5CB87AFCD9;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler
struct IMixedRealitySourceStateHandler_t9DE7047E18BC3F01BF168CF09230297A16073459;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealitySpeechHandler
struct IMixedRealitySpeechHandler_t1B6B16EA91E1FC515CB0DD0B0A2A2EAA0D4B283A;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler
struct IMixedRealityTouchHandler_t535F16165926DDD86909EC59D30EF36156785594;
// Microsoft.MixedReality.Toolkit.Input.InputEventData
struct InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896;
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<Microsoft.MixedReality.Toolkit.Input.HandMeshInfo>
struct InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF;
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>
struct InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190;
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<System.Collections.Generic.IDictionary`2<Microsoft.MixedReality.Toolkit.Utilities.TrackedHandJoint,Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>>
struct InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A;
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<System.Single>
struct InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08;
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Quaternion>
struct InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F;
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Vector2>
struct InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B;
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Vector3>
struct InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7;
// Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem/<>c
struct U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080;
// Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData
struct MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964;
// Microsoft.MixedReality.Toolkit.Input.NearInteractionGrabbable
struct NearInteractionGrabbable_tD81A6B243534FF858FAEC2C510FF3072A9FB3900;
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable
struct NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6;
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable/<>c
struct U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F;
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableSurface
struct NearInteractionTouchableSurface_tA76CE06BC3E03D9BEAA234C28E2388D9F980D22C;
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI
struct NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70;
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI[]
struct NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234;
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume
struct NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC;
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<Microsoft.MixedReality.Toolkit.TrackingState>
struct SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0;
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>
struct SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49;
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Quaternion>
struct SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03;
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Vector2>
struct SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D;
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Vector3>
struct SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C;
// Microsoft.MixedReality.Toolkit.Input.SourceStateEventData
struct SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8;
// Microsoft.MixedReality.Toolkit.Input.SpeechEventData
struct SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D;
// Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility
struct CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8;
// Microsoft.MixedReality.Toolkit.Input.Utilities.ScaleMeshEffect
struct ScaleMeshEffect_t7A2D331EF3DD56FFA4816FAC032438EBA1C77ADB;
// System.AsyncCallback
struct AsyncCallback_t3F3DA3BEDAEE81DD1D24125DF8EB30E85EE14DA4;
// System.Char[]
struct CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2;
// System.Collections.Generic.IDictionary`2<Microsoft.MixedReality.Toolkit.Utilities.TrackedHandJoint,Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>
struct IDictionary_2_t462A918F987721F85D0C5B544D8109BD0B499565;
// System.Collections.Generic.IEnumerable`1<System.Object>
struct IEnumerable_1_t2F75FCBEC68AFE08982DA43985F9D04056E2BE73;
// System.Collections.Generic.IEnumerable`1<UnityEngine.Transform>
struct IEnumerable_1_t42472AE9C2FE699C57A3900EDE1B2D22194D9D0D;
// System.Collections.Generic.IReadOnlyList`1<Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI>
struct IReadOnlyList_1_t6E979802BD92EE70ED3ABA1F1D37A90AFDA12852;
// System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI>
struct List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698;
// System.Collections.Generic.List`1<System.Int32>
struct List_1_tE1526161A558A17A39A8B69D8EEF3801393B6226;
// System.Collections.Generic.List`1<System.Object>
struct List_1_t05CC3C859AB5E6024394EF9A42E3E696628CA02D;
// System.Collections.Generic.List`1<UnityEngine.Color32>
struct List_1_t749ADA5233D9B421293A000DCB83608A24C3D5D5;
// System.Collections.Generic.List`1<UnityEngine.EventSystems.BaseInputModule>
struct List_1_t1B3F60982C3189AF70B204EF3F19940A645EA02E;
// System.Collections.Generic.List`1<UnityEngine.EventSystems.EventSystem>
struct List_1_tE4E9EE9F348ABAD1007C663DD77A14907CCD9A79;
// System.Collections.Generic.List`1<UnityEngine.Vector2>
struct List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB;
// System.Collections.Generic.List`1<UnityEngine.Vector3>
struct List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5;
// System.Collections.Generic.List`1<UnityEngine.Vector4>
struct List_1_tFF4005B40E5BA433006DA11C56DB086B1E2FC955;
// System.Comparison`1<UnityEngine.EventSystems.RaycastResult>
struct Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133;
// System.DelegateData
struct DelegateData_t1BF9F691B56DAE5F8C28C5E084FDE94F15F27BBE;
// System.Delegate[]
struct DelegateU5BU5D_tDFCDEE2A6322F96C0FE49AF47E9ADB8C4B294E86;
// System.Func`1<System.Object>
struct Func_1_t59BE545225A69AFD7B2056D169D0083051F6D386;
// System.Func`1<UnityEngine.RectTransform>
struct Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC;
// System.Func`3<System.Object,System.Object,System.Object>
struct Func_3_t0875D079514B9064DE951B01B4AE82F6C7436F64;
// System.Func`3<System.String,UnityEngine.Transform,System.String>
struct Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875;
// System.IAsyncResult
struct IAsyncResult_t8E194308510B375B42432981AE5E7488C458D598;
// System.Int32[]
struct Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83;
// System.Lazy`1<System.Object>
struct Lazy_1_t92A126CCE029B74D0EEE290FE6903CF042F9BA1C;
// System.Lazy`1<UnityEngine.RectTransform>
struct Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4;
// System.Object[]
struct ObjectU5BU5D_t3C9242B5C88A48B2A5BD9FDA6CD0024E792AF08A;
// System.Reflection.MethodInfo
struct MethodInfo_t;
// System.String
struct String_t;
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017;
// UnityEngine.AudioClip
struct AudioClip_tCC3C35F579203CE2601243585AB3D6953C3BA051;
// UnityEngine.BoxCollider
struct BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA;
// UnityEngine.Camera
struct Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34;
// UnityEngine.Camera/CameraCallback
struct CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0;
// UnityEngine.Canvas
struct Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591;
// UnityEngine.Canvas/WillRenderCanvases
struct WillRenderCanvases_tBD5AD090B5938021DEAA679A5AEEA790F60A8BEE;
// UnityEngine.Collider
struct Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF;
// UnityEngine.Collider[]
struct ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252;
// UnityEngine.Component
struct Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621;
// UnityEngine.EventSystems.BaseEventData
struct BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5;
// UnityEngine.EventSystems.BaseInputModule
struct BaseInputModule_t904837FCFA79B6C3CED862FF85C9C5F8D6F32939;
// UnityEngine.EventSystems.EventSystem
struct EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77;
// UnityEngine.EventSystems.UIBehaviour
struct UIBehaviour_t3C3C339CD5677BA7FC27C352FED8B78052A3FE70;
// UnityEngine.GameObject
struct GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F;
// UnityEngine.MeshCollider
struct MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE;
// UnityEngine.MonoBehaviour
struct MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429;
// UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0;
// UnityEngine.RectTransform
struct RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20;
// UnityEngine.RectTransform/ReapplyDrivenProperties
struct ReapplyDrivenProperties_t431F4FBD9C59AE097FE33C4354CC6251B01B527D;
// UnityEngine.Transform
struct Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA;
// UnityEngine.UI.BaseMeshEffect
struct BaseMeshEffect_t72759F31F9D204D7EFB6B45097873809D4524BA5;
// UnityEngine.UI.Graphic
struct Graphic_tBA2C3EF11D3DAEBB57F6879AB0BB4F8BD40D00D8;
// UnityEngine.UI.VertexHelper
struct VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F;
extern RuntimeClass* BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_il2cpp_TypeInfo_var;
extern RuntimeClass* CapsuleCollider_t5FD15B9E7BEEC4FFA8A2071E9FD2B8DEB3A826D1_il2cpp_TypeInfo_var;
extern RuntimeClass* CoreServices_tA2DBA57F1E594300C810E84EDC2DF4EDBD58B6F4_il2cpp_TypeInfo_var;
extern RuntimeClass* Debug_t7B5FCB117E2FD63B6838BC52821B252E2BFB61C4_il2cpp_TypeInfo_var;
extern RuntimeClass* EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_il2cpp_TypeInfo_var;
extern RuntimeClass* ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var;
extern RuntimeClass* Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC_il2cpp_TypeInfo_var;
extern RuntimeClass* Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityController_tE328C8BD991056668984D67A323E3143DDD5CD31_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityDictationHandler_tC156B03CBBD750CD43DAC73314712738C02FE1AC_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityFocusChangedHandler_tEFE5BD28A43ED634A0CA784F2CF2E78725C869FB_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityFocusHandler_tCB9C57FA1C39CAB596EC45CF4163E48BDCA34135_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityFocusProvider_t3C6B1347D19105108BE262BB34EC68451F456832_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityGestureHandler_1_t4230FCC1C3B93C15652754F51E8E8B08E78E4B3A_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityGestureHandler_1_t84808B3F44C67F8EF43032EAB4F599002F835DE3_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityGestureHandler_1_tD98BED3AB9B32BFC28ED8AC1A27CFD8AC87D6C39_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityGestureHandler_1_tE038FADEC9B3422DF9CA5EE5628C2097D40A5BE6_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityHandJointHandler_tA87827F6B3EB628AE0B274E3401D8B768EE1B548_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityHandMeshHandler_tC40BC662BA372AEFB8F9D6060184D4A283F9F367_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityInputHandler_1_t36D2117DF01BEA07C13A66885FAD6275DDD0C2BD_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityInputHandler_1_t3AD268F517E91D4C46AEEB59CA60E64585A5F463_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityInputHandler_1_tAD1B7DC731C61121E6B57E0298DAF20A61646468_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityInputHandler_1_tEE6677D865F3622772E229A3654B306832BF6557_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityInputHandler_1_tFC3F8D3B3CE2CCA4F25E275054FDF81C8A22E4E5_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityInputHandler_t076C5BE3EA668A55178CC4F28F1B7950F2E6333F_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityInputSystem_t142023776CCC57DFC5696BEA994C4F369CB5806E_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityNearPointer_tB665EBD82EC998B15BE414DABA497042271E128A_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityPointerHandler_tAB30AF314323490DC19B42E9E12F67CFFE976BF3_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityPointer_tA64958356FC4ABDCB3CF2CFC334E3DA65A885D78_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealitySourcePoseHandler_tDB93DF305A730CF23F8B3242543DEB5CB87AFCD9_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealitySourceStateHandler_t9DE7047E18BC3F01BF168CF09230297A16073459_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealitySpeechHandler_t1B6B16EA91E1FC515CB0DD0B0A2A2EAA0D4B283A_il2cpp_TypeInfo_var;
extern RuntimeClass* IMixedRealityTouchHandler_t535F16165926DDD86909EC59D30EF36156785594_il2cpp_TypeInfo_var;
extern RuntimeClass* Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4_il2cpp_TypeInfo_var;
extern RuntimeClass* List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698_il2cpp_TypeInfo_var;
extern RuntimeClass* Math_tFB388E53C7FDC6FCCF9A19ABF5A4E521FBD52E19_il2cpp_TypeInfo_var;
extern RuntimeClass* Mathf_tFBDE6467D269BFE410605C7D806FD9991D4A89CB_il2cpp_TypeInfo_var;
extern RuntimeClass* MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE_il2cpp_TypeInfo_var;
extern RuntimeClass* NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_il2cpp_TypeInfo_var;
extern RuntimeClass* Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var;
extern RuntimeClass* RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20_il2cpp_TypeInfo_var;
extern RuntimeClass* SphereCollider_tAC3E5E20B385DF1C0B17F3EA5C7214F71367706F_il2cpp_TypeInfo_var;
extern RuntimeClass* U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_il2cpp_TypeInfo_var;
extern RuntimeClass* U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_il2cpp_TypeInfo_var;
extern RuntimeClass* Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_il2cpp_TypeInfo_var;
extern RuntimeClass* Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var;
extern String_t* _stringLiteral052FB1FE0D021FB4E5F4B88C36D37951996FBFCB;
extern String_t* _stringLiteral13D394CBB2224799347CFC4EA600A656E4673514;
extern String_t* _stringLiteral2246D0EE3F64AE2FE0E32B485F0D449C421DE949;
extern String_t* _stringLiteral4D2A116113E32BCCEAF300821EDE7A9665B3F990;
extern String_t* _stringLiteralDA39A3EE5E6B4B0D3255BFEF95601890AFD80709;
extern String_t* _stringLiteralF8063269B3AD7E1E22E65A00A5927927EA6711A7;
extern const RuntimeMethod* Component_GetComponentInParent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_mD91B8112B5688783ACAEA46BB2C82C6EC4C4B33B_RuntimeMethod_var;
extern const RuntimeMethod* Component_GetComponent_TisBoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_m81892AA8DC35D8BB06288E5A4C16CF366174953E_RuntimeMethod_var;
extern const RuntimeMethod* Component_GetComponent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_m72658F06C13B44ECAE973DE1E20B4BA8A247DBBD_RuntimeMethod_var;
extern const RuntimeMethod* Component_GetComponent_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m6B8E8E0E0AF6B08652B81B7950FC5AF63EAD40C6_RuntimeMethod_var;
extern const RuntimeMethod* Component_GetComponent_TisRectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20_m751D9E690C55EAC53AB8C54812EFEAA238E52575_RuntimeMethod_var;
extern const RuntimeMethod* Enumerable_Aggregate_TisTransform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA_TisString_t_mDBB0A69F0AC196B0AE6D937BDDE7DE0543598AAF_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisHandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71_m3D0E4D7521F0B7FFF71F919CEC166F6090896203_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisInputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08_m732B746D0B59264901C76698B24E9F4FC6507D60_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisInputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A_m3664034B4BB2FCF6FE77D0592A334D57A9E704E0_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisInputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF_mB181D6A143D8E73CA2CA55F794B9C3D30F65ED9F_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisInputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7_m097E52341D124B63ACF286F3B3DA74AFE301578D_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisInputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_mE0EAE75FDABCF1F6D6CA42B92EB601C5AFB734AC_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisInputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190_mE6BDBCA0445EA7137E8EF7AD8EA49F4BD2335E01_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisInputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F_m81B085BAD6E32F7D0F68DD7866400B8B63586937_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D_m44A4310CBC45912A0D3E0A63483F35FB60650D81_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49_m88CC794B89C460471E5AE81E6830AE54263E9EE6_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0_m4B7AD1B7B87D73F1188C157F57AE9B4E94EBFAF9_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C_m3317F6C9A5A5ABDA63707BC2DA6CE9F26BC3CFA8_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03_m72C57EC69E981C3576A50280BE05CFF1DCF317FD_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisSourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8_m5D5A6C5E00218E6FC96B27734982739E5249A511_RuntimeMethod_var;
extern const RuntimeMethod* ExecuteEvents_ValidateEventData_TisSpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D_m3E405F175CBD8D8F021FDCC766B6153A42F14FED_RuntimeMethod_var;
extern const RuntimeMethod* Func_1__ctor_m9CD37EDF32B1025161B21189308A89FBCB3D31D0_RuntimeMethod_var;
extern const RuntimeMethod* Func_3__ctor_m0D8C1007F600903496B78C6ECE280BA3B092E0AB_RuntimeMethod_var;
extern const RuntimeMethod* GameObject_GetComponents_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m64C7FCDEB0A941ED4C9306B2F467C13D69BBF8C1_RuntimeMethod_var;
extern const RuntimeMethod* Lazy_1__ctor_mB678E6E7BEB0C87364A66EF9597E7546BAC3632B_RuntimeMethod_var;
extern const RuntimeMethod* Lazy_1_get_Value_m14285D8A1AD14C080ED2D95FACA7366ED99FE4F2_RuntimeMethod_var;
extern const RuntimeMethod* List_1_Add_m51E390D6AAE28EDE48EB34922D24A6486E79301E_RuntimeMethod_var;
extern const RuntimeMethod* List_1_Remove_mF5E9EF3C7DDB6497E7DD976562DCAAB5D04B7009_RuntimeMethod_var;
extern const RuntimeMethod* List_1__ctor_m74736E94D5684A6D227C7CD74E8C331636A65A5A_RuntimeMethod_var;
extern const RuntimeMethod* U3CU3Ec_U3COnValidateU3Eb__25_0_m13C96469FB6E22E845F6847319ED4D577723868F_RuntimeMethod_var;
extern const uint32_t CanvasUtility_OnPointerDown_m761E4517FB5D57F8916182816CD916108CA23DD8_MetadataUsageId;
extern const uint32_t CanvasUtility_OnPointerUp_m83D2379164AE65222923317B6FFF411A8C19F469_MetadataUsageId;
extern const uint32_t CanvasUtility_Start_m4B42439ECDC01E0055136DF641290575F51947F5_MetadataUsageId;
extern const uint32_t NearInteractionGrabbable_OnEnable_m86A7FA282A54ED2E7017FEB3C5446D1D03393F62_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI_DistanceToTouchable_m59B08E19DDBB7CABCEC0A50C4821303EB75C3506_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI_OnDisable_m67341F4AA3F7BA72DD73D099D6036EEC1DEF1822_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI_OnEnable_m48775AAAFEBF81B07ADD1ABE677361924C579A85_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI__cctor_m0C36EE5FF226A16F3992B3FC30FC991D55410183_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI__ctor_mB8ECCCECC0F29FAD6BBB04097B40E34E44DF7E34_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI_get_Bounds_mF40A324E41E7F0E9A8D61CD31BD0C977C0F8F80E_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI_get_Instances_m976EAEBDEB44DBD1450CA6852F291DECC91E81FF_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI_get_LocalCenter_m1185B40128671E37C1D0BE4E5E443F86A753A0F6_MetadataUsageId;
extern const uint32_t NearInteractionTouchableUnityUI_get_LocalPressDirection_mA28883F1E6FD19B60C4B28B71E93DC0290EF7120_MetadataUsageId;
extern const uint32_t NearInteractionTouchableVolume_DistanceToTouchable_m590325E87878586081EB1605A01F611A6D77A35E_MetadataUsageId;
extern const uint32_t NearInteractionTouchableVolume_OnValidate_m002F953D9325C419B21B9282A5C27DAD7982EB0A_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_DistanceToTouchable_m5F9A142552464723354ECB9D6D52FAA9948C5D1A_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_OnEnable_m6845EF2554645D479BB0D339043B14D7011552E5_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_OnValidate_m047380B61B41024739C6CE9E42E719ECAECC1D53_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_SetLocalForward_mFFEFB910719A23348845F464101E0B58C4D074A2_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_SetLocalUp_m71BA25ADBE848DD133CBC866015CCBEE99BA3E7D_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_SetTouchableCollider_mB65CD4B430EC4A349EBB784B880A1B74338EFA7C_MetadataUsageId;
extern const uint32_t NearInteractionTouchable__ctor_m7708FA2DCE88B56F007C018396790FB945EDA284_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_get_AreLocalVectorsOrthogonal_mFD41DA35A8E313621330B211EC80C6500C4357C7_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_get_LocalPressDirection_mF68CB6CF973220E71A9D2CA6E8A63444ABA63952_MetadataUsageId;
extern const uint32_t NearInteractionTouchable_get_LocalRight_mFC9863CB3DE0A6D313338A0EE41C55FEDE62CAFA_MetadataUsageId;
extern const uint32_t ScaleMeshEffect_Awake_mA5A71A64ED9921B169829E9005D1C2C66522FB43_MetadataUsageId;
extern const uint32_t ScaleMeshEffect_ModifyMesh_m4E457F3706EB1CADCED31A119F1C472A974FEA65_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3COnValidateU3Eb__25_0_m13C96469FB6E22E845F6847319ED4D577723868F_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_0_m40CB23F53DC2F0BA43F731CADE60F38FAA5FE34D_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_10_mA91F2156D9A933D390D34B78115E197260DAA07D_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_11_mA1E99C74C79FA79FD72769415A74E34F1847C6BE_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_12_m9CC2DB94334E10FF8DB01AA9583F95A63B5AC474_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_13_mA889B2852E8F247218D8E56E89583B2ADF43F396_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_14_m16FC41DC01540F30D9A3394880CE4919E15091CA_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_15_mA2CEA5E3DE8AE20DEF77E27BC287258359E7F62F_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_16_m25CCD286BF98B6E5E3D066AF8153F4EAD48E59AF_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_17_mF6A01546BDA8D894F98B7A69E89EF5BC10A6C9D4_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_18_m86AC1B64C5F08A197190B8E88ADF1DAF66D2A5DE_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_19_m27A33B0E883D40224C6F396134DEAF2B7B32EDE0_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_1_m2EBF111E58F3B274F24225917F959C53369A6D10_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_20_m1439BAE6A672A301B52BC06F642A17A116B7B408_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_21_mB60E47591A81D6CDF20BCE66091D24F3E45F228C_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_22_mB13DD28AFA57C6B5048A8945EBCB305861C757B8_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_23_mF17EEB9DA600D7509F155482F6F638772B740598_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_24_m7C094E6969FFE76EF2248361B57B4D2ABFC232DD_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_25_mAB5E2741E80A14A33EBB11D53093C8F381F62481_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_26_m1944A9BBA2408514CCFD7FBCC36D6B8ED59828A2_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_27_mAD38D365EC560CC781AD21F59FB9496EA2560311_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_28_m3414B57CCA89FC0E3606D2EE3428B66D8CDC4134_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_29_mB38F9FA952B0DCF1C377829C9B768F1B457F6481_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_2_mAE17DD940CB3321E1BBEA64112D7D5E4020A72F7_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_30_m86B92926AF1320AB65A7672C4A35F6B74AB4AB04_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_31_m8DCDC647C8173946E4C5DF32D718B2D3BA946B75_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_32_m23F1AC0C67557C87D75CDE6F957FE4DFE34EF1BE_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_33_m41489A400EF9F89A2DF953B3B98FEBD952FDF929_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_34_m88BE20F400043CC926999448F767420AFC6E764A_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_35_m3B3451CD52AA432C3B4FBCD2A8A65BE54CD5BC07_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_36_m35B38F9B286CBCA4A3C1EB50963876C6A8963411_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_37_m8A7AD87C215D44800037E134A4371C61848D77D9_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_38_mC55566D86148803D8B231049D0B8B83DA0C6263C_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_39_mECD46ABB762655693E516CC9CF2CC6B20CA08773_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_3_m2C52088758B0957BE22E967CDECA5FF5AE7E8589_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_40_mD47D65F59F5428C3894F07F3350193E870E59650_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_41_m1F9FB29E660E895D6F494FA9906C46CC5F47B95B_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_42_mEAD470183EEDBA26582CDBE962C129DF07364889_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_43_m37A8DEFC8A5297A336B10346622499FCD6E4CAD9_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_44_m49932BEEBB1B771E48EB7E959E371080BBA988D5_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_45_mB0AA4EB87DC8045D4FB9FF86C5A3A7BB7D0146EE_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_46_mB7086147EA6A12483CAD1F72D302CEF54CDCCCBA_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_47_m9867CB58D178BECC36FF2D12D6ECB6D345883234_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_48_m24D4870359909390387C8103BCC9C4000BF2077F_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_4_m715A4BF14E1F6C928F0F4380C2AFCE7BFBC4D024_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_5_mCB5E02489087D48680DE837F97A360AE98747F3E_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_6_m8C3702924F896EE314C71D3C8CCAC43109612009_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_7_m7F70758BBA53CDC11D02EC9E55A5CBF15F9C6CAD_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_8_mFE07C0E3A49B6D1FE22695A3543F8EED3805150C_MetadataUsageId;
extern const uint32_t U3CU3Ec_U3C_cctorU3Eb__240_9_m4833819F2E9A4CDDD4DAB7200976F9D8A848AAA8_MetadataUsageId;
extern const uint32_t U3CU3Ec__cctor_m003368C9B58B32767FC77CD6604865020B42F39B_MetadataUsageId;
extern const uint32_t U3CU3Ec__cctor_mFE4341382B1F2DD340B05B741812B34B419A3AF9_MetadataUsageId;
struct Delegate_t_marshaled_com;
struct Delegate_t_marshaled_pinvoke;
struct ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252;
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
#ifndef U3CU3EC_TCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_H
#define U3CU3EC_TCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c
struct U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 : public RuntimeObject
{
public:
public:
};
struct U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_StaticFields
{
public:
// Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<>9
U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * ___U3CU3E9_0;
public:
inline static int32_t get_offset_of_U3CU3E9_0() { return static_cast<int32_t>(offsetof(U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_StaticFields, ___U3CU3E9_0)); }
inline U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * get_U3CU3E9_0() const { return ___U3CU3E9_0; }
inline U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 ** get_address_of_U3CU3E9_0() { return &___U3CU3E9_0; }
inline void set_U3CU3E9_0(U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * value)
{
___U3CU3E9_0 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3E9_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CU3EC_TCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_H
#ifndef U3CU3EC_T9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_H
#define U3CU3EC_T9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable_<>c
struct U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F : public RuntimeObject
{
public:
public:
};
struct U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_StaticFields
{
public:
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable_<>c Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable_<>c::<>9
U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F * ___U3CU3E9_0;
// System.Func`3<System.String,UnityEngine.Transform,System.String> Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable_<>c::<>9__25_0
Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * ___U3CU3E9__25_0_1;
public:
inline static int32_t get_offset_of_U3CU3E9_0() { return static_cast<int32_t>(offsetof(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_StaticFields, ___U3CU3E9_0)); }
inline U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F * get_U3CU3E9_0() const { return ___U3CU3E9_0; }
inline U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F ** get_address_of_U3CU3E9_0() { return &___U3CU3E9_0; }
inline void set_U3CU3E9_0(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F * value)
{
___U3CU3E9_0 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3E9_0), value);
}
inline static int32_t get_offset_of_U3CU3E9__25_0_1() { return static_cast<int32_t>(offsetof(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_StaticFields, ___U3CU3E9__25_0_1)); }
inline Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * get_U3CU3E9__25_0_1() const { return ___U3CU3E9__25_0_1; }
inline Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 ** get_address_of_U3CU3E9__25_0_1() { return &___U3CU3E9__25_0_1; }
inline void set_U3CU3E9__25_0_1(Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * value)
{
___U3CU3E9__25_0_1 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3E9__25_0_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CU3EC_T9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifndef LIST_1_T9CAB2FC61807CF1A2D26904B169E6F6198A47698_H
#define LIST_1_T9CAB2FC61807CF1A2D26904B169E6F6198A47698_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI>
struct List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698, ____items_1)); }
inline NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234* get__items_1() const { return ____items_1; }
inline NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((&____syncRoot_4), value);
}
};
struct List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698_StaticFields, ____emptyArray_5)); }
inline NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234* get__emptyArray_5() const { return ____emptyArray_5; }
inline NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(NearInteractionTouchableUnityUIU5BU5D_t5DB5109760B814493A660A5ACF62D73A69DC4234* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((&____emptyArray_5), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T9CAB2FC61807CF1A2D26904B169E6F6198A47698_H
#ifndef LAZY_1_TD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4_H
#define LAZY_1_TD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Lazy`1<UnityEngine.RectTransform>
struct Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 : public RuntimeObject
{
public:
// System.Object System.Lazy`1::m_boxed
RuntimeObject * ___m_boxed_1;
// System.Func`1<T> System.Lazy`1::m_valueFactory
Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * ___m_valueFactory_2;
// System.Object System.Lazy`1::m_threadSafeObj
RuntimeObject * ___m_threadSafeObj_3;
public:
inline static int32_t get_offset_of_m_boxed_1() { return static_cast<int32_t>(offsetof(Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4, ___m_boxed_1)); }
inline RuntimeObject * get_m_boxed_1() const { return ___m_boxed_1; }
inline RuntimeObject ** get_address_of_m_boxed_1() { return &___m_boxed_1; }
inline void set_m_boxed_1(RuntimeObject * value)
{
___m_boxed_1 = value;
Il2CppCodeGenWriteBarrier((&___m_boxed_1), value);
}
inline static int32_t get_offset_of_m_valueFactory_2() { return static_cast<int32_t>(offsetof(Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4, ___m_valueFactory_2)); }
inline Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * get_m_valueFactory_2() const { return ___m_valueFactory_2; }
inline Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC ** get_address_of_m_valueFactory_2() { return &___m_valueFactory_2; }
inline void set_m_valueFactory_2(Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * value)
{
___m_valueFactory_2 = value;
Il2CppCodeGenWriteBarrier((&___m_valueFactory_2), value);
}
inline static int32_t get_offset_of_m_threadSafeObj_3() { return static_cast<int32_t>(offsetof(Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4, ___m_threadSafeObj_3)); }
inline RuntimeObject * get_m_threadSafeObj_3() const { return ___m_threadSafeObj_3; }
inline RuntimeObject ** get_address_of_m_threadSafeObj_3() { return &___m_threadSafeObj_3; }
inline void set_m_threadSafeObj_3(RuntimeObject * value)
{
___m_threadSafeObj_3 = value;
Il2CppCodeGenWriteBarrier((&___m_threadSafeObj_3), value);
}
};
struct Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4_StaticFields
{
public:
// System.Func`1<T> System.Lazy`1::ALREADY_INVOKED_SENTINEL
Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * ___ALREADY_INVOKED_SENTINEL_0;
public:
inline static int32_t get_offset_of_ALREADY_INVOKED_SENTINEL_0() { return static_cast<int32_t>(offsetof(Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4_StaticFields, ___ALREADY_INVOKED_SENTINEL_0)); }
inline Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * get_ALREADY_INVOKED_SENTINEL_0() const { return ___ALREADY_INVOKED_SENTINEL_0; }
inline Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC ** get_address_of_ALREADY_INVOKED_SENTINEL_0() { return &___ALREADY_INVOKED_SENTINEL_0; }
inline void set_ALREADY_INVOKED_SENTINEL_0(Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * value)
{
___ALREADY_INVOKED_SENTINEL_0 = value;
Il2CppCodeGenWriteBarrier((&___ALREADY_INVOKED_SENTINEL_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LAZY_1_TD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4_H
#ifndef STRING_T_H
#define STRING_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.String
struct String_t : public RuntimeObject
{
public:
// System.Int32 System.String::m_stringLength
int32_t ___m_stringLength_0;
// System.Char System.String::m_firstChar
Il2CppChar ___m_firstChar_1;
public:
inline static int32_t get_offset_of_m_stringLength_0() { return static_cast<int32_t>(offsetof(String_t, ___m_stringLength_0)); }
inline int32_t get_m_stringLength_0() const { return ___m_stringLength_0; }
inline int32_t* get_address_of_m_stringLength_0() { return &___m_stringLength_0; }
inline void set_m_stringLength_0(int32_t value)
{
___m_stringLength_0 = value;
}
inline static int32_t get_offset_of_m_firstChar_1() { return static_cast<int32_t>(offsetof(String_t, ___m_firstChar_1)); }
inline Il2CppChar get_m_firstChar_1() const { return ___m_firstChar_1; }
inline Il2CppChar* get_address_of_m_firstChar_1() { return &___m_firstChar_1; }
inline void set_m_firstChar_1(Il2CppChar value)
{
___m_firstChar_1 = value;
}
};
struct String_t_StaticFields
{
public:
// System.String System.String::Empty
String_t* ___Empty_5;
public:
inline static int32_t get_offset_of_Empty_5() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_5)); }
inline String_t* get_Empty_5() const { return ___Empty_5; }
inline String_t** get_address_of_Empty_5() { return &___Empty_5; }
inline void set_Empty_5(String_t* value)
{
___Empty_5 = value;
Il2CppCodeGenWriteBarrier((&___Empty_5), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // STRING_T_H
#ifndef VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#define VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_marshaled_com
{
};
#endif // VALUETYPE_T4D0C27076F7C36E76190FB3328E232BCB1CD1FFF_H
#ifndef ABSTRACTEVENTDATA_T636F385820C291DAE25897BCEB4FBCADDA3B75F6_H
#define ABSTRACTEVENTDATA_T636F385820C291DAE25897BCEB4FBCADDA3B75F6_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.EventSystems.AbstractEventData
struct AbstractEventData_t636F385820C291DAE25897BCEB4FBCADDA3B75F6 : public RuntimeObject
{
public:
// System.Boolean UnityEngine.EventSystems.AbstractEventData::m_Used
bool ___m_Used_0;
public:
inline static int32_t get_offset_of_m_Used_0() { return static_cast<int32_t>(offsetof(AbstractEventData_t636F385820C291DAE25897BCEB4FBCADDA3B75F6, ___m_Used_0)); }
inline bool get_m_Used_0() const { return ___m_Used_0; }
inline bool* get_address_of_m_Used_0() { return &___m_Used_0; }
inline void set_m_Used_0(bool value)
{
___m_Used_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ABSTRACTEVENTDATA_T636F385820C291DAE25897BCEB4FBCADDA3B75F6_H
#ifndef BOOLEAN_TB53F6830F670160873277339AA58F15CAED4399C_H
#define BOOLEAN_TB53F6830F670160873277339AA58F15CAED4399C_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Boolean
struct Boolean_tB53F6830F670160873277339AA58F15CAED4399C
{
public:
// System.Boolean System.Boolean::m_value
bool ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Boolean_tB53F6830F670160873277339AA58F15CAED4399C, ___m_value_0)); }
inline bool get_m_value_0() const { return ___m_value_0; }
inline bool* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(bool value)
{
___m_value_0 = value;
}
};
struct Boolean_tB53F6830F670160873277339AA58F15CAED4399C_StaticFields
{
public:
// System.String System.Boolean::TrueString
String_t* ___TrueString_5;
// System.String System.Boolean::FalseString
String_t* ___FalseString_6;
public:
inline static int32_t get_offset_of_TrueString_5() { return static_cast<int32_t>(offsetof(Boolean_tB53F6830F670160873277339AA58F15CAED4399C_StaticFields, ___TrueString_5)); }
inline String_t* get_TrueString_5() const { return ___TrueString_5; }
inline String_t** get_address_of_TrueString_5() { return &___TrueString_5; }
inline void set_TrueString_5(String_t* value)
{
___TrueString_5 = value;
Il2CppCodeGenWriteBarrier((&___TrueString_5), value);
}
inline static int32_t get_offset_of_FalseString_6() { return static_cast<int32_t>(offsetof(Boolean_tB53F6830F670160873277339AA58F15CAED4399C_StaticFields, ___FalseString_6)); }
inline String_t* get_FalseString_6() const { return ___FalseString_6; }
inline String_t** get_address_of_FalseString_6() { return &___FalseString_6; }
inline void set_FalseString_6(String_t* value)
{
___FalseString_6 = value;
Il2CppCodeGenWriteBarrier((&___FalseString_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOOLEAN_TB53F6830F670160873277339AA58F15CAED4399C_H
#ifndef DATETIME_T349B7449FBAAFF4192636E2B7A07694DA9236132_H
#define DATETIME_T349B7449FBAAFF4192636E2B7A07694DA9236132_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.DateTime
struct DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132
{
public:
// System.UInt64 System.DateTime::dateData
uint64_t ___dateData_44;
public:
inline static int32_t get_offset_of_dateData_44() { return static_cast<int32_t>(offsetof(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132, ___dateData_44)); }
inline uint64_t get_dateData_44() const { return ___dateData_44; }
inline uint64_t* get_address_of_dateData_44() { return &___dateData_44; }
inline void set_dateData_44(uint64_t value)
{
___dateData_44 = value;
}
};
struct DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132_StaticFields
{
public:
// System.Int32[] System.DateTime::DaysToMonth365
Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* ___DaysToMonth365_29;
// System.Int32[] System.DateTime::DaysToMonth366
Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* ___DaysToMonth366_30;
// System.DateTime System.DateTime::MinValue
DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 ___MinValue_31;
// System.DateTime System.DateTime::MaxValue
DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 ___MaxValue_32;
public:
inline static int32_t get_offset_of_DaysToMonth365_29() { return static_cast<int32_t>(offsetof(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132_StaticFields, ___DaysToMonth365_29)); }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* get_DaysToMonth365_29() const { return ___DaysToMonth365_29; }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83** get_address_of_DaysToMonth365_29() { return &___DaysToMonth365_29; }
inline void set_DaysToMonth365_29(Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* value)
{
___DaysToMonth365_29 = value;
Il2CppCodeGenWriteBarrier((&___DaysToMonth365_29), value);
}
inline static int32_t get_offset_of_DaysToMonth366_30() { return static_cast<int32_t>(offsetof(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132_StaticFields, ___DaysToMonth366_30)); }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* get_DaysToMonth366_30() const { return ___DaysToMonth366_30; }
inline Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83** get_address_of_DaysToMonth366_30() { return &___DaysToMonth366_30; }
inline void set_DaysToMonth366_30(Int32U5BU5D_t2B9E4FDDDB9F0A00EC0AC631BA2DA915EB1ECF83* value)
{
___DaysToMonth366_30 = value;
Il2CppCodeGenWriteBarrier((&___DaysToMonth366_30), value);
}
inline static int32_t get_offset_of_MinValue_31() { return static_cast<int32_t>(offsetof(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132_StaticFields, ___MinValue_31)); }
inline DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 get_MinValue_31() const { return ___MinValue_31; }
inline DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 * get_address_of_MinValue_31() { return &___MinValue_31; }
inline void set_MinValue_31(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 value)
{
___MinValue_31 = value;
}
inline static int32_t get_offset_of_MaxValue_32() { return static_cast<int32_t>(offsetof(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132_StaticFields, ___MaxValue_32)); }
inline DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 get_MaxValue_32() const { return ___MaxValue_32; }
inline DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 * get_address_of_MaxValue_32() { return &___MaxValue_32; }
inline void set_MaxValue_32(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 value)
{
___MaxValue_32 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DATETIME_T349B7449FBAAFF4192636E2B7A07694DA9236132_H
#ifndef ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#define ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521 : public ValueType_t4D0C27076F7C36E76190FB3328E232BCB1CD1FFF
{
public:
public:
};
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_StaticFields
{
public:
// System.Char[] System.Enum::enumSeperatorCharArray
CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* ___enumSeperatorCharArray_0;
public:
inline static int32_t get_offset_of_enumSeperatorCharArray_0() { return static_cast<int32_t>(offsetof(Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_StaticFields, ___enumSeperatorCharArray_0)); }
inline CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* get_enumSeperatorCharArray_0() const { return ___enumSeperatorCharArray_0; }
inline CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2** get_address_of_enumSeperatorCharArray_0() { return &___enumSeperatorCharArray_0; }
inline void set_enumSeperatorCharArray_0(CharU5BU5D_t4CC6ABF0AD71BEC97E3C2F1E9C5677E46D3A75C2* value)
{
___enumSeperatorCharArray_0 = value;
Il2CppCodeGenWriteBarrier((&___enumSeperatorCharArray_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t2AF27C02B8653AE29442467390005ABC74D8F521_marshaled_com
{
};
#endif // ENUM_T2AF27C02B8653AE29442467390005ABC74D8F521_H
#ifndef INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#define INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Int32
struct Int32_t585191389E07734F19F3156FF88FB3EF4800D102
{
public:
// System.Int32 System.Int32::m_value
int32_t ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Int32_t585191389E07734F19F3156FF88FB3EF4800D102, ___m_value_0)); }
inline int32_t get_m_value_0() const { return ___m_value_0; }
inline int32_t* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(int32_t value)
{
___m_value_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INT32_T585191389E07734F19F3156FF88FB3EF4800D102_H
#ifndef INTPTR_T_H
#define INTPTR_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.IntPtr
struct IntPtr_t
{
public:
// System.Void* System.IntPtr::m_value
void* ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); }
inline void* get_m_value_0() const { return ___m_value_0; }
inline void** get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(void* value)
{
___m_value_0 = value;
}
};
struct IntPtr_t_StaticFields
{
public:
// System.IntPtr System.IntPtr::Zero
intptr_t ___Zero_1;
public:
inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); }
inline intptr_t get_Zero_1() const { return ___Zero_1; }
inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; }
inline void set_Zero_1(intptr_t value)
{
___Zero_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INTPTR_T_H
#ifndef SINGLE_TDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1_H
#define SINGLE_TDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Single
struct Single_tDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1
{
public:
// System.Single System.Single::m_value
float ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(Single_tDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1, ___m_value_0)); }
inline float get_m_value_0() const { return ___m_value_0; }
inline float* get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(float value)
{
___m_value_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SINGLE_TDDDA9169C4E4E308AC6D7A824F9B28DC82204AE1_H
#ifndef VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#define VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void
struct Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017
{
public:
union
{
struct
{
};
uint8_t Void_t22962CB4C05B1D89B55A6E1139F0E87A90987017__padding[1];
};
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VOID_T22962CB4C05B1D89B55A6E1139F0E87A90987017_H
#ifndef COLOR32_T23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23_H
#define COLOR32_T23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Color32
struct Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23
{
public:
union
{
#pragma pack(push, tp, 1)
struct
{
// System.Int32 UnityEngine.Color32::rgba
int32_t ___rgba_0;
};
#pragma pack(pop, tp)
struct
{
int32_t ___rgba_0_forAlignmentOnly;
};
#pragma pack(push, tp, 1)
struct
{
// System.Byte UnityEngine.Color32::r
uint8_t ___r_1;
};
#pragma pack(pop, tp)
struct
{
uint8_t ___r_1_forAlignmentOnly;
};
#pragma pack(push, tp, 1)
struct
{
char ___g_2_OffsetPadding[1];
// System.Byte UnityEngine.Color32::g
uint8_t ___g_2;
};
#pragma pack(pop, tp)
struct
{
char ___g_2_OffsetPadding_forAlignmentOnly[1];
uint8_t ___g_2_forAlignmentOnly;
};
#pragma pack(push, tp, 1)
struct
{
char ___b_3_OffsetPadding[2];
// System.Byte UnityEngine.Color32::b
uint8_t ___b_3;
};
#pragma pack(pop, tp)
struct
{
char ___b_3_OffsetPadding_forAlignmentOnly[2];
uint8_t ___b_3_forAlignmentOnly;
};
#pragma pack(push, tp, 1)
struct
{
char ___a_4_OffsetPadding[3];
// System.Byte UnityEngine.Color32::a
uint8_t ___a_4;
};
#pragma pack(pop, tp)
struct
{
char ___a_4_OffsetPadding_forAlignmentOnly[3];
uint8_t ___a_4_forAlignmentOnly;
};
};
public:
inline static int32_t get_offset_of_rgba_0() { return static_cast<int32_t>(offsetof(Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23, ___rgba_0)); }
inline int32_t get_rgba_0() const { return ___rgba_0; }
inline int32_t* get_address_of_rgba_0() { return &___rgba_0; }
inline void set_rgba_0(int32_t value)
{
___rgba_0 = value;
}
inline static int32_t get_offset_of_r_1() { return static_cast<int32_t>(offsetof(Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23, ___r_1)); }
inline uint8_t get_r_1() const { return ___r_1; }
inline uint8_t* get_address_of_r_1() { return &___r_1; }
inline void set_r_1(uint8_t value)
{
___r_1 = value;
}
inline static int32_t get_offset_of_g_2() { return static_cast<int32_t>(offsetof(Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23, ___g_2)); }
inline uint8_t get_g_2() const { return ___g_2; }
inline uint8_t* get_address_of_g_2() { return &___g_2; }
inline void set_g_2(uint8_t value)
{
___g_2 = value;
}
inline static int32_t get_offset_of_b_3() { return static_cast<int32_t>(offsetof(Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23, ___b_3)); }
inline uint8_t get_b_3() const { return ___b_3; }
inline uint8_t* get_address_of_b_3() { return &___b_3; }
inline void set_b_3(uint8_t value)
{
___b_3 = value;
}
inline static int32_t get_offset_of_a_4() { return static_cast<int32_t>(offsetof(Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23, ___a_4)); }
inline uint8_t get_a_4() const { return ___a_4; }
inline uint8_t* get_address_of_a_4() { return &___a_4; }
inline void set_a_4(uint8_t value)
{
___a_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLOR32_T23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23_H
#ifndef BASEEVENTDATA_T46C9D2AE3183A742EDE89944AF64A23DBF1B80A5_H
#define BASEEVENTDATA_T46C9D2AE3183A742EDE89944AF64A23DBF1B80A5_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.EventSystems.BaseEventData
struct BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 : public AbstractEventData_t636F385820C291DAE25897BCEB4FBCADDA3B75F6
{
public:
// UnityEngine.EventSystems.EventSystem UnityEngine.EventSystems.BaseEventData::m_EventSystem
EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77 * ___m_EventSystem_1;
public:
inline static int32_t get_offset_of_m_EventSystem_1() { return static_cast<int32_t>(offsetof(BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5, ___m_EventSystem_1)); }
inline EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77 * get_m_EventSystem_1() const { return ___m_EventSystem_1; }
inline EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77 ** get_address_of_m_EventSystem_1() { return &___m_EventSystem_1; }
inline void set_m_EventSystem_1(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77 * value)
{
___m_EventSystem_1 = value;
Il2CppCodeGenWriteBarrier((&___m_EventSystem_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BASEEVENTDATA_T46C9D2AE3183A742EDE89944AF64A23DBF1B80A5_H
#ifndef QUATERNION_T319F3319A7D43FFA5D819AD6C0A98851F0095357_H
#define QUATERNION_T319F3319A7D43FFA5D819AD6C0A98851F0095357_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Quaternion
struct Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357
{
public:
// System.Single UnityEngine.Quaternion::x
float ___x_0;
// System.Single UnityEngine.Quaternion::y
float ___y_1;
// System.Single UnityEngine.Quaternion::z
float ___z_2;
// System.Single UnityEngine.Quaternion::w
float ___w_3;
public:
inline static int32_t get_offset_of_x_0() { return static_cast<int32_t>(offsetof(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357, ___x_0)); }
inline float get_x_0() const { return ___x_0; }
inline float* get_address_of_x_0() { return &___x_0; }
inline void set_x_0(float value)
{
___x_0 = value;
}
inline static int32_t get_offset_of_y_1() { return static_cast<int32_t>(offsetof(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357, ___y_1)); }
inline float get_y_1() const { return ___y_1; }
inline float* get_address_of_y_1() { return &___y_1; }
inline void set_y_1(float value)
{
___y_1 = value;
}
inline static int32_t get_offset_of_z_2() { return static_cast<int32_t>(offsetof(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357, ___z_2)); }
inline float get_z_2() const { return ___z_2; }
inline float* get_address_of_z_2() { return &___z_2; }
inline void set_z_2(float value)
{
___z_2 = value;
}
inline static int32_t get_offset_of_w_3() { return static_cast<int32_t>(offsetof(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357, ___w_3)); }
inline float get_w_3() const { return ___w_3; }
inline float* get_address_of_w_3() { return &___w_3; }
inline void set_w_3(float value)
{
___w_3 = value;
}
};
struct Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357_StaticFields
{
public:
// UnityEngine.Quaternion UnityEngine.Quaternion::identityQuaternion
Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 ___identityQuaternion_4;
public:
inline static int32_t get_offset_of_identityQuaternion_4() { return static_cast<int32_t>(offsetof(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357_StaticFields, ___identityQuaternion_4)); }
inline Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 get_identityQuaternion_4() const { return ___identityQuaternion_4; }
inline Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 * get_address_of_identityQuaternion_4() { return &___identityQuaternion_4; }
inline void set_identityQuaternion_4(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 value)
{
___identityQuaternion_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // QUATERNION_T319F3319A7D43FFA5D819AD6C0A98851F0095357_H
#ifndef RECT_T35B976DE901B5423C11705E156938EA27AB402CE_H
#define RECT_T35B976DE901B5423C11705E156938EA27AB402CE_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rect
struct Rect_t35B976DE901B5423C11705E156938EA27AB402CE
{
public:
// System.Single UnityEngine.Rect::m_XMin
float ___m_XMin_0;
// System.Single UnityEngine.Rect::m_YMin
float ___m_YMin_1;
// System.Single UnityEngine.Rect::m_Width
float ___m_Width_2;
// System.Single UnityEngine.Rect::m_Height
float ___m_Height_3;
public:
inline static int32_t get_offset_of_m_XMin_0() { return static_cast<int32_t>(offsetof(Rect_t35B976DE901B5423C11705E156938EA27AB402CE, ___m_XMin_0)); }
inline float get_m_XMin_0() const { return ___m_XMin_0; }
inline float* get_address_of_m_XMin_0() { return &___m_XMin_0; }
inline void set_m_XMin_0(float value)
{
___m_XMin_0 = value;
}
inline static int32_t get_offset_of_m_YMin_1() { return static_cast<int32_t>(offsetof(Rect_t35B976DE901B5423C11705E156938EA27AB402CE, ___m_YMin_1)); }
inline float get_m_YMin_1() const { return ___m_YMin_1; }
inline float* get_address_of_m_YMin_1() { return &___m_YMin_1; }
inline void set_m_YMin_1(float value)
{
___m_YMin_1 = value;
}
inline static int32_t get_offset_of_m_Width_2() { return static_cast<int32_t>(offsetof(Rect_t35B976DE901B5423C11705E156938EA27AB402CE, ___m_Width_2)); }
inline float get_m_Width_2() const { return ___m_Width_2; }
inline float* get_address_of_m_Width_2() { return &___m_Width_2; }
inline void set_m_Width_2(float value)
{
___m_Width_2 = value;
}
inline static int32_t get_offset_of_m_Height_3() { return static_cast<int32_t>(offsetof(Rect_t35B976DE901B5423C11705E156938EA27AB402CE, ___m_Height_3)); }
inline float get_m_Height_3() const { return ___m_Height_3; }
inline float* get_address_of_m_Height_3() { return &___m_Height_3; }
inline void set_m_Height_3(float value)
{
___m_Height_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECT_T35B976DE901B5423C11705E156938EA27AB402CE_H
#ifndef VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#define VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector2
struct Vector2_tA85D2DD88578276CA8A8796756458277E72D073D
{
public:
// System.Single UnityEngine.Vector2::x
float ___x_0;
// System.Single UnityEngine.Vector2::y
float ___y_1;
public:
inline static int32_t get_offset_of_x_0() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D, ___x_0)); }
inline float get_x_0() const { return ___x_0; }
inline float* get_address_of_x_0() { return &___x_0; }
inline void set_x_0(float value)
{
___x_0 = value;
}
inline static int32_t get_offset_of_y_1() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D, ___y_1)); }
inline float get_y_1() const { return ___y_1; }
inline float* get_address_of_y_1() { return &___y_1; }
inline void set_y_1(float value)
{
___y_1 = value;
}
};
struct Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields
{
public:
// UnityEngine.Vector2 UnityEngine.Vector2::zeroVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___zeroVector_2;
// UnityEngine.Vector2 UnityEngine.Vector2::oneVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___oneVector_3;
// UnityEngine.Vector2 UnityEngine.Vector2::upVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___upVector_4;
// UnityEngine.Vector2 UnityEngine.Vector2::downVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___downVector_5;
// UnityEngine.Vector2 UnityEngine.Vector2::leftVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___leftVector_6;
// UnityEngine.Vector2 UnityEngine.Vector2::rightVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___rightVector_7;
// UnityEngine.Vector2 UnityEngine.Vector2::positiveInfinityVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___positiveInfinityVector_8;
// UnityEngine.Vector2 UnityEngine.Vector2::negativeInfinityVector
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___negativeInfinityVector_9;
public:
inline static int32_t get_offset_of_zeroVector_2() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___zeroVector_2)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_zeroVector_2() const { return ___zeroVector_2; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_zeroVector_2() { return &___zeroVector_2; }
inline void set_zeroVector_2(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___zeroVector_2 = value;
}
inline static int32_t get_offset_of_oneVector_3() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___oneVector_3)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_oneVector_3() const { return ___oneVector_3; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_oneVector_3() { return &___oneVector_3; }
inline void set_oneVector_3(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___oneVector_3 = value;
}
inline static int32_t get_offset_of_upVector_4() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___upVector_4)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_upVector_4() const { return ___upVector_4; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_upVector_4() { return &___upVector_4; }
inline void set_upVector_4(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___upVector_4 = value;
}
inline static int32_t get_offset_of_downVector_5() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___downVector_5)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_downVector_5() const { return ___downVector_5; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_downVector_5() { return &___downVector_5; }
inline void set_downVector_5(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___downVector_5 = value;
}
inline static int32_t get_offset_of_leftVector_6() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___leftVector_6)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_leftVector_6() const { return ___leftVector_6; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_leftVector_6() { return &___leftVector_6; }
inline void set_leftVector_6(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___leftVector_6 = value;
}
inline static int32_t get_offset_of_rightVector_7() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___rightVector_7)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_rightVector_7() const { return ___rightVector_7; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_rightVector_7() { return &___rightVector_7; }
inline void set_rightVector_7(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___rightVector_7 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___positiveInfinityVector_8)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_positiveInfinityVector_8() const { return ___positiveInfinityVector_8; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_positiveInfinityVector_8() { return &___positiveInfinityVector_8; }
inline void set_positiveInfinityVector_8(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___positiveInfinityVector_8 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_9() { return static_cast<int32_t>(offsetof(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_StaticFields, ___negativeInfinityVector_9)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_negativeInfinityVector_9() const { return ___negativeInfinityVector_9; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_negativeInfinityVector_9() { return &___negativeInfinityVector_9; }
inline void set_negativeInfinityVector_9(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___negativeInfinityVector_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR2_TA85D2DD88578276CA8A8796756458277E72D073D_H
#ifndef VECTOR3_TDCF05E21F632FE2BA260C06E0D10CA81513E6720_H
#define VECTOR3_TDCF05E21F632FE2BA260C06E0D10CA81513E6720_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector3
struct Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720
{
public:
// System.Single UnityEngine.Vector3::x
float ___x_2;
// System.Single UnityEngine.Vector3::y
float ___y_3;
// System.Single UnityEngine.Vector3::z
float ___z_4;
public:
inline static int32_t get_offset_of_x_2() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720, ___x_2)); }
inline float get_x_2() const { return ___x_2; }
inline float* get_address_of_x_2() { return &___x_2; }
inline void set_x_2(float value)
{
___x_2 = value;
}
inline static int32_t get_offset_of_y_3() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720, ___y_3)); }
inline float get_y_3() const { return ___y_3; }
inline float* get_address_of_y_3() { return &___y_3; }
inline void set_y_3(float value)
{
___y_3 = value;
}
inline static int32_t get_offset_of_z_4() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720, ___z_4)); }
inline float get_z_4() const { return ___z_4; }
inline float* get_address_of_z_4() { return &___z_4; }
inline void set_z_4(float value)
{
___z_4 = value;
}
};
struct Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields
{
public:
// UnityEngine.Vector3 UnityEngine.Vector3::zeroVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___zeroVector_5;
// UnityEngine.Vector3 UnityEngine.Vector3::oneVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___oneVector_6;
// UnityEngine.Vector3 UnityEngine.Vector3::upVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___upVector_7;
// UnityEngine.Vector3 UnityEngine.Vector3::downVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___downVector_8;
// UnityEngine.Vector3 UnityEngine.Vector3::leftVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___leftVector_9;
// UnityEngine.Vector3 UnityEngine.Vector3::rightVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___rightVector_10;
// UnityEngine.Vector3 UnityEngine.Vector3::forwardVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___forwardVector_11;
// UnityEngine.Vector3 UnityEngine.Vector3::backVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___backVector_12;
// UnityEngine.Vector3 UnityEngine.Vector3::positiveInfinityVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___positiveInfinityVector_13;
// UnityEngine.Vector3 UnityEngine.Vector3::negativeInfinityVector
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___negativeInfinityVector_14;
public:
inline static int32_t get_offset_of_zeroVector_5() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___zeroVector_5)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_zeroVector_5() const { return ___zeroVector_5; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_zeroVector_5() { return &___zeroVector_5; }
inline void set_zeroVector_5(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___zeroVector_5 = value;
}
inline static int32_t get_offset_of_oneVector_6() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___oneVector_6)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_oneVector_6() const { return ___oneVector_6; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_oneVector_6() { return &___oneVector_6; }
inline void set_oneVector_6(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___oneVector_6 = value;
}
inline static int32_t get_offset_of_upVector_7() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___upVector_7)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_upVector_7() const { return ___upVector_7; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_upVector_7() { return &___upVector_7; }
inline void set_upVector_7(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___upVector_7 = value;
}
inline static int32_t get_offset_of_downVector_8() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___downVector_8)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_downVector_8() const { return ___downVector_8; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_downVector_8() { return &___downVector_8; }
inline void set_downVector_8(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___downVector_8 = value;
}
inline static int32_t get_offset_of_leftVector_9() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___leftVector_9)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_leftVector_9() const { return ___leftVector_9; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_leftVector_9() { return &___leftVector_9; }
inline void set_leftVector_9(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___leftVector_9 = value;
}
inline static int32_t get_offset_of_rightVector_10() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___rightVector_10)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_rightVector_10() const { return ___rightVector_10; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_rightVector_10() { return &___rightVector_10; }
inline void set_rightVector_10(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___rightVector_10 = value;
}
inline static int32_t get_offset_of_forwardVector_11() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___forwardVector_11)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_forwardVector_11() const { return ___forwardVector_11; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_forwardVector_11() { return &___forwardVector_11; }
inline void set_forwardVector_11(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___forwardVector_11 = value;
}
inline static int32_t get_offset_of_backVector_12() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___backVector_12)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_backVector_12() const { return ___backVector_12; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_backVector_12() { return &___backVector_12; }
inline void set_backVector_12(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___backVector_12 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_13() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___positiveInfinityVector_13)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_positiveInfinityVector_13() const { return ___positiveInfinityVector_13; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_positiveInfinityVector_13() { return &___positiveInfinityVector_13; }
inline void set_positiveInfinityVector_13(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___positiveInfinityVector_13 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_14() { return static_cast<int32_t>(offsetof(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_StaticFields, ___negativeInfinityVector_14)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_negativeInfinityVector_14() const { return ___negativeInfinityVector_14; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_negativeInfinityVector_14() { return &___negativeInfinityVector_14; }
inline void set_negativeInfinityVector_14(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___negativeInfinityVector_14 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR3_TDCF05E21F632FE2BA260C06E0D10CA81513E6720_H
#ifndef VECTOR4_TD148D6428C3F8FF6CD998F82090113C2B490B76E_H
#define VECTOR4_TD148D6428C3F8FF6CD998F82090113C2B490B76E_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector4
struct Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E
{
public:
// System.Single UnityEngine.Vector4::x
float ___x_1;
// System.Single UnityEngine.Vector4::y
float ___y_2;
// System.Single UnityEngine.Vector4::z
float ___z_3;
// System.Single UnityEngine.Vector4::w
float ___w_4;
public:
inline static int32_t get_offset_of_x_1() { return static_cast<int32_t>(offsetof(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E, ___x_1)); }
inline float get_x_1() const { return ___x_1; }
inline float* get_address_of_x_1() { return &___x_1; }
inline void set_x_1(float value)
{
___x_1 = value;
}
inline static int32_t get_offset_of_y_2() { return static_cast<int32_t>(offsetof(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E, ___y_2)); }
inline float get_y_2() const { return ___y_2; }
inline float* get_address_of_y_2() { return &___y_2; }
inline void set_y_2(float value)
{
___y_2 = value;
}
inline static int32_t get_offset_of_z_3() { return static_cast<int32_t>(offsetof(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E, ___z_3)); }
inline float get_z_3() const { return ___z_3; }
inline float* get_address_of_z_3() { return &___z_3; }
inline void set_z_3(float value)
{
___z_3 = value;
}
inline static int32_t get_offset_of_w_4() { return static_cast<int32_t>(offsetof(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E, ___w_4)); }
inline float get_w_4() const { return ___w_4; }
inline float* get_address_of_w_4() { return &___w_4; }
inline void set_w_4(float value)
{
___w_4 = value;
}
};
struct Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E_StaticFields
{
public:
// UnityEngine.Vector4 UnityEngine.Vector4::zeroVector
Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E ___zeroVector_5;
// UnityEngine.Vector4 UnityEngine.Vector4::oneVector
Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E ___oneVector_6;
// UnityEngine.Vector4 UnityEngine.Vector4::positiveInfinityVector
Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E ___positiveInfinityVector_7;
// UnityEngine.Vector4 UnityEngine.Vector4::negativeInfinityVector
Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E ___negativeInfinityVector_8;
public:
inline static int32_t get_offset_of_zeroVector_5() { return static_cast<int32_t>(offsetof(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E_StaticFields, ___zeroVector_5)); }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E get_zeroVector_5() const { return ___zeroVector_5; }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E * get_address_of_zeroVector_5() { return &___zeroVector_5; }
inline void set_zeroVector_5(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E value)
{
___zeroVector_5 = value;
}
inline static int32_t get_offset_of_oneVector_6() { return static_cast<int32_t>(offsetof(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E_StaticFields, ___oneVector_6)); }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E get_oneVector_6() const { return ___oneVector_6; }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E * get_address_of_oneVector_6() { return &___oneVector_6; }
inline void set_oneVector_6(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E value)
{
___oneVector_6 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_7() { return static_cast<int32_t>(offsetof(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E_StaticFields, ___positiveInfinityVector_7)); }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E get_positiveInfinityVector_7() const { return ___positiveInfinityVector_7; }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E * get_address_of_positiveInfinityVector_7() { return &___positiveInfinityVector_7; }
inline void set_positiveInfinityVector_7(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E value)
{
___positiveInfinityVector_7 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E_StaticFields, ___negativeInfinityVector_8)); }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E get_negativeInfinityVector_8() const { return ___negativeInfinityVector_8; }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E * get_address_of_negativeInfinityVector_8() { return &___negativeInfinityVector_8; }
inline void set_negativeInfinityVector_8(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E value)
{
___negativeInfinityVector_8 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR4_TD148D6428C3F8FF6CD998F82090113C2B490B76E_H
#ifndef FOCUSEVENTDATA_T165B6996DC03D17E60B71BC989542EEABA048DCC_H
#define FOCUSEVENTDATA_T165B6996DC03D17E60B71BC989542EEABA048DCC_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.FocusEventData
struct FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC : public BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5
{
public:
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer Microsoft.MixedReality.Toolkit.Input.FocusEventData::<Pointer>k__BackingField
RuntimeObject* ___U3CPointerU3Ek__BackingField_2;
// UnityEngine.GameObject Microsoft.MixedReality.Toolkit.Input.FocusEventData::<OldFocusedObject>k__BackingField
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * ___U3COldFocusedObjectU3Ek__BackingField_3;
// UnityEngine.GameObject Microsoft.MixedReality.Toolkit.Input.FocusEventData::<NewFocusedObject>k__BackingField
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * ___U3CNewFocusedObjectU3Ek__BackingField_4;
public:
inline static int32_t get_offset_of_U3CPointerU3Ek__BackingField_2() { return static_cast<int32_t>(offsetof(FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC, ___U3CPointerU3Ek__BackingField_2)); }
inline RuntimeObject* get_U3CPointerU3Ek__BackingField_2() const { return ___U3CPointerU3Ek__BackingField_2; }
inline RuntimeObject** get_address_of_U3CPointerU3Ek__BackingField_2() { return &___U3CPointerU3Ek__BackingField_2; }
inline void set_U3CPointerU3Ek__BackingField_2(RuntimeObject* value)
{
___U3CPointerU3Ek__BackingField_2 = value;
Il2CppCodeGenWriteBarrier((&___U3CPointerU3Ek__BackingField_2), value);
}
inline static int32_t get_offset_of_U3COldFocusedObjectU3Ek__BackingField_3() { return static_cast<int32_t>(offsetof(FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC, ___U3COldFocusedObjectU3Ek__BackingField_3)); }
inline GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * get_U3COldFocusedObjectU3Ek__BackingField_3() const { return ___U3COldFocusedObjectU3Ek__BackingField_3; }
inline GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F ** get_address_of_U3COldFocusedObjectU3Ek__BackingField_3() { return &___U3COldFocusedObjectU3Ek__BackingField_3; }
inline void set_U3COldFocusedObjectU3Ek__BackingField_3(GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * value)
{
___U3COldFocusedObjectU3Ek__BackingField_3 = value;
Il2CppCodeGenWriteBarrier((&___U3COldFocusedObjectU3Ek__BackingField_3), value);
}
inline static int32_t get_offset_of_U3CNewFocusedObjectU3Ek__BackingField_4() { return static_cast<int32_t>(offsetof(FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC, ___U3CNewFocusedObjectU3Ek__BackingField_4)); }
inline GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * get_U3CNewFocusedObjectU3Ek__BackingField_4() const { return ___U3CNewFocusedObjectU3Ek__BackingField_4; }
inline GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F ** get_address_of_U3CNewFocusedObjectU3Ek__BackingField_4() { return &___U3CNewFocusedObjectU3Ek__BackingField_4; }
inline void set_U3CNewFocusedObjectU3Ek__BackingField_4(GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * value)
{
___U3CNewFocusedObjectU3Ek__BackingField_4 = value;
Il2CppCodeGenWriteBarrier((&___U3CNewFocusedObjectU3Ek__BackingField_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // FOCUSEVENTDATA_T165B6996DC03D17E60B71BC989542EEABA048DCC_H
#ifndef TOUCHABLEEVENTTYPE_T12096B88D4E8B7065965BCD10B6A07BB200D6E1B_H
#define TOUCHABLEEVENTTYPE_T12096B88D4E8B7065965BCD10B6A07BB200D6E1B_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.TouchableEventType
struct TouchableEventType_t12096B88D4E8B7065965BCD10B6A07BB200D6E1B
{
public:
// System.Int32 Microsoft.MixedReality.Toolkit.Input.TouchableEventType::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(TouchableEventType_t12096B88D4E8B7065965BCD10B6A07BB200D6E1B, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOUCHABLEEVENTTYPE_T12096B88D4E8B7065965BCD10B6A07BB200D6E1B_H
#ifndef TRACKINGSTATE_TFD5B53FC090A64D5FC767B3D21152A4E02EEED42_H
#define TRACKINGSTATE_TFD5B53FC090A64D5FC767B3D21152A4E02EEED42_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.TrackingState
struct TrackingState_tFD5B53FC090A64D5FC767B3D21152A4E02EEED42
{
public:
// System.Int32 Microsoft.MixedReality.Toolkit.TrackingState::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(TrackingState_tFD5B53FC090A64D5FC767B3D21152A4E02EEED42, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TRACKINGSTATE_TFD5B53FC090A64D5FC767B3D21152A4E02EEED42_H
#ifndef AXISTYPE_TE7ED1B123C90BB4C1B3FA2FE3FAB9CEE1CA048D6_H
#define AXISTYPE_TE7ED1B123C90BB4C1B3FA2FE3FAB9CEE1CA048D6_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Utilities.AxisType
struct AxisType_tE7ED1B123C90BB4C1B3FA2FE3FAB9CEE1CA048D6
{
public:
// System.Int32 Microsoft.MixedReality.Toolkit.Utilities.AxisType::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(AxisType_tE7ED1B123C90BB4C1B3FA2FE3FAB9CEE1CA048D6, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AXISTYPE_TE7ED1B123C90BB4C1B3FA2FE3FAB9CEE1CA048D6_H
#ifndef HANDEDNESS_TD3ED068B44260B32491F1573A4414A876A30EC27_H
#define HANDEDNESS_TD3ED068B44260B32491F1573A4414A876A30EC27_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Utilities.Handedness
struct Handedness_tD3ED068B44260B32491F1573A4414A876A30EC27
{
public:
// System.Byte Microsoft.MixedReality.Toolkit.Utilities.Handedness::value__
uint8_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(Handedness_tD3ED068B44260B32491F1573A4414A876A30EC27, ___value___2)); }
inline uint8_t get_value___2() const { return ___value___2; }
inline uint8_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(uint8_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // HANDEDNESS_TD3ED068B44260B32491F1573A4414A876A30EC27_H
#ifndef MIXEDREALITYPOSE_T2DE3778479212DFF574AD14924DB9E7BA40BC9C0_H
#define MIXEDREALITYPOSE_T2DE3778479212DFF574AD14924DB9E7BA40BC9C0_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose
struct MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0
{
public:
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose::position
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___position_1;
// UnityEngine.Quaternion Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose::rotation
Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 ___rotation_2;
public:
inline static int32_t get_offset_of_position_1() { return static_cast<int32_t>(offsetof(MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0, ___position_1)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_position_1() const { return ___position_1; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_position_1() { return &___position_1; }
inline void set_position_1(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___position_1 = value;
}
inline static int32_t get_offset_of_rotation_2() { return static_cast<int32_t>(offsetof(MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0, ___rotation_2)); }
inline Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 get_rotation_2() const { return ___rotation_2; }
inline Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 * get_address_of_rotation_2() { return &___rotation_2; }
inline void set_rotation_2(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 value)
{
___rotation_2 = value;
}
};
struct MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0_StaticFields
{
public:
// Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose::<ZeroIdentity>k__BackingField
MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 ___U3CZeroIdentityU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CZeroIdentityU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0_StaticFields, ___U3CZeroIdentityU3Ek__BackingField_0)); }
inline MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 get_U3CZeroIdentityU3Ek__BackingField_0() const { return ___U3CZeroIdentityU3Ek__BackingField_0; }
inline MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 * get_address_of_U3CZeroIdentityU3Ek__BackingField_0() { return &___U3CZeroIdentityU3Ek__BackingField_0; }
inline void set_U3CZeroIdentityU3Ek__BackingField_0(MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 value)
{
___U3CZeroIdentityU3Ek__BackingField_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MIXEDREALITYPOSE_T2DE3778479212DFF574AD14924DB9E7BA40BC9C0_H
#ifndef RECOGNITIONCONFIDENCELEVEL_T7F641BEA135B93B8560393EB922AED99AED5C983_H
#define RECOGNITIONCONFIDENCELEVEL_T7F641BEA135B93B8560393EB922AED99AED5C983_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Utilities.RecognitionConfidenceLevel
struct RecognitionConfidenceLevel_t7F641BEA135B93B8560393EB922AED99AED5C983
{
public:
// System.Int32 Microsoft.MixedReality.Toolkit.Utilities.RecognitionConfidenceLevel::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(RecognitionConfidenceLevel_t7F641BEA135B93B8560393EB922AED99AED5C983, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECOGNITIONCONFIDENCELEVEL_T7F641BEA135B93B8560393EB922AED99AED5C983_H
#ifndef DELEGATE_T_H
#define DELEGATE_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Delegate
struct Delegate_t : public RuntimeObject
{
public:
// System.IntPtr System.Delegate::method_ptr
Il2CppMethodPointer ___method_ptr_0;
// System.IntPtr System.Delegate::invoke_impl
intptr_t ___invoke_impl_1;
// System.Object System.Delegate::m_target
RuntimeObject * ___m_target_2;
// System.IntPtr System.Delegate::method
intptr_t ___method_3;
// System.IntPtr System.Delegate::delegate_trampoline
intptr_t ___delegate_trampoline_4;
// System.IntPtr System.Delegate::extra_arg
intptr_t ___extra_arg_5;
// System.IntPtr System.Delegate::method_code
intptr_t ___method_code_6;
// System.Reflection.MethodInfo System.Delegate::method_info
MethodInfo_t * ___method_info_7;
// System.Reflection.MethodInfo System.Delegate::original_method_info
MethodInfo_t * ___original_method_info_8;
// System.DelegateData System.Delegate::data
DelegateData_t1BF9F691B56DAE5F8C28C5E084FDE94F15F27BBE * ___data_9;
// System.Boolean System.Delegate::method_is_virtual
bool ___method_is_virtual_10;
public:
inline static int32_t get_offset_of_method_ptr_0() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_ptr_0)); }
inline Il2CppMethodPointer get_method_ptr_0() const { return ___method_ptr_0; }
inline Il2CppMethodPointer* get_address_of_method_ptr_0() { return &___method_ptr_0; }
inline void set_method_ptr_0(Il2CppMethodPointer value)
{
___method_ptr_0 = value;
}
inline static int32_t get_offset_of_invoke_impl_1() { return static_cast<int32_t>(offsetof(Delegate_t, ___invoke_impl_1)); }
inline intptr_t get_invoke_impl_1() const { return ___invoke_impl_1; }
inline intptr_t* get_address_of_invoke_impl_1() { return &___invoke_impl_1; }
inline void set_invoke_impl_1(intptr_t value)
{
___invoke_impl_1 = value;
}
inline static int32_t get_offset_of_m_target_2() { return static_cast<int32_t>(offsetof(Delegate_t, ___m_target_2)); }
inline RuntimeObject * get_m_target_2() const { return ___m_target_2; }
inline RuntimeObject ** get_address_of_m_target_2() { return &___m_target_2; }
inline void set_m_target_2(RuntimeObject * value)
{
___m_target_2 = value;
Il2CppCodeGenWriteBarrier((&___m_target_2), value);
}
inline static int32_t get_offset_of_method_3() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_3)); }
inline intptr_t get_method_3() const { return ___method_3; }
inline intptr_t* get_address_of_method_3() { return &___method_3; }
inline void set_method_3(intptr_t value)
{
___method_3 = value;
}
inline static int32_t get_offset_of_delegate_trampoline_4() { return static_cast<int32_t>(offsetof(Delegate_t, ___delegate_trampoline_4)); }
inline intptr_t get_delegate_trampoline_4() const { return ___delegate_trampoline_4; }
inline intptr_t* get_address_of_delegate_trampoline_4() { return &___delegate_trampoline_4; }
inline void set_delegate_trampoline_4(intptr_t value)
{
___delegate_trampoline_4 = value;
}
inline static int32_t get_offset_of_extra_arg_5() { return static_cast<int32_t>(offsetof(Delegate_t, ___extra_arg_5)); }
inline intptr_t get_extra_arg_5() const { return ___extra_arg_5; }
inline intptr_t* get_address_of_extra_arg_5() { return &___extra_arg_5; }
inline void set_extra_arg_5(intptr_t value)
{
___extra_arg_5 = value;
}
inline static int32_t get_offset_of_method_code_6() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_code_6)); }
inline intptr_t get_method_code_6() const { return ___method_code_6; }
inline intptr_t* get_address_of_method_code_6() { return &___method_code_6; }
inline void set_method_code_6(intptr_t value)
{
___method_code_6 = value;
}
inline static int32_t get_offset_of_method_info_7() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_info_7)); }
inline MethodInfo_t * get_method_info_7() const { return ___method_info_7; }
inline MethodInfo_t ** get_address_of_method_info_7() { return &___method_info_7; }
inline void set_method_info_7(MethodInfo_t * value)
{
___method_info_7 = value;
Il2CppCodeGenWriteBarrier((&___method_info_7), value);
}
inline static int32_t get_offset_of_original_method_info_8() { return static_cast<int32_t>(offsetof(Delegate_t, ___original_method_info_8)); }
inline MethodInfo_t * get_original_method_info_8() const { return ___original_method_info_8; }
inline MethodInfo_t ** get_address_of_original_method_info_8() { return &___original_method_info_8; }
inline void set_original_method_info_8(MethodInfo_t * value)
{
___original_method_info_8 = value;
Il2CppCodeGenWriteBarrier((&___original_method_info_8), value);
}
inline static int32_t get_offset_of_data_9() { return static_cast<int32_t>(offsetof(Delegate_t, ___data_9)); }
inline DelegateData_t1BF9F691B56DAE5F8C28C5E084FDE94F15F27BBE * get_data_9() const { return ___data_9; }
inline DelegateData_t1BF9F691B56DAE5F8C28C5E084FDE94F15F27BBE ** get_address_of_data_9() { return &___data_9; }
inline void set_data_9(DelegateData_t1BF9F691B56DAE5F8C28C5E084FDE94F15F27BBE * value)
{
___data_9 = value;
Il2CppCodeGenWriteBarrier((&___data_9), value);
}
inline static int32_t get_offset_of_method_is_virtual_10() { return static_cast<int32_t>(offsetof(Delegate_t, ___method_is_virtual_10)); }
inline bool get_method_is_virtual_10() const { return ___method_is_virtual_10; }
inline bool* get_address_of_method_is_virtual_10() { return &___method_is_virtual_10; }
inline void set_method_is_virtual_10(bool value)
{
___method_is_virtual_10 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.Delegate
struct Delegate_t_marshaled_pinvoke
{
intptr_t ___method_ptr_0;
intptr_t ___invoke_impl_1;
Il2CppIUnknown* ___m_target_2;
intptr_t ___method_3;
intptr_t ___delegate_trampoline_4;
intptr_t ___extra_arg_5;
intptr_t ___method_code_6;
MethodInfo_t * ___method_info_7;
MethodInfo_t * ___original_method_info_8;
DelegateData_t1BF9F691B56DAE5F8C28C5E084FDE94F15F27BBE * ___data_9;
int32_t ___method_is_virtual_10;
};
// Native definition for COM marshalling of System.Delegate
struct Delegate_t_marshaled_com
{
intptr_t ___method_ptr_0;
intptr_t ___invoke_impl_1;
Il2CppIUnknown* ___m_target_2;
intptr_t ___method_3;
intptr_t ___delegate_trampoline_4;
intptr_t ___extra_arg_5;
intptr_t ___method_code_6;
MethodInfo_t * ___method_info_7;
MethodInfo_t * ___original_method_info_8;
DelegateData_t1BF9F691B56DAE5F8C28C5E084FDE94F15F27BBE * ___data_9;
int32_t ___method_is_virtual_10;
};
#endif // DELEGATE_T_H
#ifndef TIMESPAN_TA8069278ACE8A74D6DF7D514A9CD4432433F64C4_H
#define TIMESPAN_TA8069278ACE8A74D6DF7D514A9CD4432433F64C4_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.TimeSpan
struct TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4
{
public:
// System.Int64 System.TimeSpan::_ticks
int64_t ____ticks_3;
public:
inline static int32_t get_offset_of__ticks_3() { return static_cast<int32_t>(offsetof(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4, ____ticks_3)); }
inline int64_t get__ticks_3() const { return ____ticks_3; }
inline int64_t* get_address_of__ticks_3() { return &____ticks_3; }
inline void set__ticks_3(int64_t value)
{
____ticks_3 = value;
}
};
struct TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4_StaticFields
{
public:
// System.TimeSpan System.TimeSpan::Zero
TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 ___Zero_0;
// System.TimeSpan System.TimeSpan::MaxValue
TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 ___MaxValue_1;
// System.TimeSpan System.TimeSpan::MinValue
TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 ___MinValue_2;
// System.Boolean modreq(System.Runtime.CompilerServices.IsVolatile) System.TimeSpan::_legacyConfigChecked
bool ____legacyConfigChecked_4;
// System.Boolean modreq(System.Runtime.CompilerServices.IsVolatile) System.TimeSpan::_legacyMode
bool ____legacyMode_5;
public:
inline static int32_t get_offset_of_Zero_0() { return static_cast<int32_t>(offsetof(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4_StaticFields, ___Zero_0)); }
inline TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 get_Zero_0() const { return ___Zero_0; }
inline TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 * get_address_of_Zero_0() { return &___Zero_0; }
inline void set_Zero_0(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 value)
{
___Zero_0 = value;
}
inline static int32_t get_offset_of_MaxValue_1() { return static_cast<int32_t>(offsetof(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4_StaticFields, ___MaxValue_1)); }
inline TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 get_MaxValue_1() const { return ___MaxValue_1; }
inline TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 * get_address_of_MaxValue_1() { return &___MaxValue_1; }
inline void set_MaxValue_1(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 value)
{
___MaxValue_1 = value;
}
inline static int32_t get_offset_of_MinValue_2() { return static_cast<int32_t>(offsetof(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4_StaticFields, ___MinValue_2)); }
inline TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 get_MinValue_2() const { return ___MinValue_2; }
inline TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 * get_address_of_MinValue_2() { return &___MinValue_2; }
inline void set_MinValue_2(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 value)
{
___MinValue_2 = value;
}
inline static int32_t get_offset_of__legacyConfigChecked_4() { return static_cast<int32_t>(offsetof(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4_StaticFields, ____legacyConfigChecked_4)); }
inline bool get__legacyConfigChecked_4() const { return ____legacyConfigChecked_4; }
inline bool* get_address_of__legacyConfigChecked_4() { return &____legacyConfigChecked_4; }
inline void set__legacyConfigChecked_4(bool value)
{
____legacyConfigChecked_4 = value;
}
inline static int32_t get_offset_of__legacyMode_5() { return static_cast<int32_t>(offsetof(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4_StaticFields, ____legacyMode_5)); }
inline bool get__legacyMode_5() const { return ____legacyMode_5; }
inline bool* get_address_of__legacyMode_5() { return &____legacyMode_5; }
inline void set__legacyMode_5(bool value)
{
____legacyMode_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TIMESPAN_TA8069278ACE8A74D6DF7D514A9CD4432433F64C4_H
#ifndef ADDITIONALCANVASSHADERCHANNELS_T2576909EF4884007D0786E0FEEB894B54C61107E_H
#define ADDITIONALCANVASSHADERCHANNELS_T2576909EF4884007D0786E0FEEB894B54C61107E_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AdditionalCanvasShaderChannels
struct AdditionalCanvasShaderChannels_t2576909EF4884007D0786E0FEEB894B54C61107E
{
public:
// System.Int32 UnityEngine.AdditionalCanvasShaderChannels::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(AdditionalCanvasShaderChannels_t2576909EF4884007D0786E0FEEB894B54C61107E, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ADDITIONALCANVASSHADERCHANNELS_T2576909EF4884007D0786E0FEEB894B54C61107E_H
#ifndef BOUNDS_TA2716F5212749C61B0E7B7B77E0CD3D79B742890_H
#define BOUNDS_TA2716F5212749C61B0E7B7B77E0CD3D79B742890_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Bounds
struct Bounds_tA2716F5212749C61B0E7B7B77E0CD3D79B742890
{
public:
// UnityEngine.Vector3 UnityEngine.Bounds::m_Center
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___m_Center_0;
// UnityEngine.Vector3 UnityEngine.Bounds::m_Extents
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___m_Extents_1;
public:
inline static int32_t get_offset_of_m_Center_0() { return static_cast<int32_t>(offsetof(Bounds_tA2716F5212749C61B0E7B7B77E0CD3D79B742890, ___m_Center_0)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_m_Center_0() const { return ___m_Center_0; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_m_Center_0() { return &___m_Center_0; }
inline void set_m_Center_0(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___m_Center_0 = value;
}
inline static int32_t get_offset_of_m_Extents_1() { return static_cast<int32_t>(offsetof(Bounds_tA2716F5212749C61B0E7B7B77E0CD3D79B742890, ___m_Extents_1)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_m_Extents_1() const { return ___m_Extents_1; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_m_Extents_1() { return &___m_Extents_1; }
inline void set_m_Extents_1(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___m_Extents_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOUNDS_TA2716F5212749C61B0E7B7B77E0CD3D79B742890_H
#ifndef KEYCODE_TC93EA87C5A6901160B583ADFCD3EF6726570DC3C_H
#define KEYCODE_TC93EA87C5A6901160B583ADFCD3EF6726570DC3C_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.KeyCode
struct KeyCode_tC93EA87C5A6901160B583ADFCD3EF6726570DC3C
{
public:
// System.Int32 UnityEngine.KeyCode::value__
int32_t ___value___2;
public:
inline static int32_t get_offset_of_value___2() { return static_cast<int32_t>(offsetof(KeyCode_tC93EA87C5A6901160B583ADFCD3EF6726570DC3C, ___value___2)); }
inline int32_t get_value___2() const { return ___value___2; }
inline int32_t* get_address_of_value___2() { return &___value___2; }
inline void set_value___2(int32_t value)
{
___value___2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // KEYCODE_TC93EA87C5A6901160B583ADFCD3EF6726570DC3C_H
#ifndef OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#define OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Object::m_CachedPtr
intptr_t ___m_CachedPtr_0;
public:
inline static int32_t get_offset_of_m_CachedPtr_0() { return static_cast<int32_t>(offsetof(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0, ___m_CachedPtr_0)); }
inline intptr_t get_m_CachedPtr_0() const { return ___m_CachedPtr_0; }
inline intptr_t* get_address_of_m_CachedPtr_0() { return &___m_CachedPtr_0; }
inline void set_m_CachedPtr_0(intptr_t value)
{
___m_CachedPtr_0 = value;
}
};
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_StaticFields
{
public:
// System.Int32 UnityEngine.Object::OffsetOfInstanceIDInCPlusPlusObject
int32_t ___OffsetOfInstanceIDInCPlusPlusObject_1;
public:
inline static int32_t get_offset_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return static_cast<int32_t>(offsetof(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_StaticFields, ___OffsetOfInstanceIDInCPlusPlusObject_1)); }
inline int32_t get_OffsetOfInstanceIDInCPlusPlusObject_1() const { return ___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline int32_t* get_address_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return &___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline void set_OffsetOfInstanceIDInCPlusPlusObject_1(int32_t value)
{
___OffsetOfInstanceIDInCPlusPlusObject_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_marshaled_pinvoke
{
intptr_t ___m_CachedPtr_0;
};
// Native definition for COM marshalling of UnityEngine.Object
struct Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_marshaled_com
{
intptr_t ___m_CachedPtr_0;
};
#endif // OBJECT_TAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_H
#ifndef VERTEXHELPER_T27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F_H
#define VERTEXHELPER_T27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.VertexHelper
struct VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F : public RuntimeObject
{
public:
// System.Collections.Generic.List`1<UnityEngine.Vector3> UnityEngine.UI.VertexHelper::m_Positions
List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5 * ___m_Positions_0;
// System.Collections.Generic.List`1<UnityEngine.Color32> UnityEngine.UI.VertexHelper::m_Colors
List_1_t749ADA5233D9B421293A000DCB83608A24C3D5D5 * ___m_Colors_1;
// System.Collections.Generic.List`1<UnityEngine.Vector2> UnityEngine.UI.VertexHelper::m_Uv0S
List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * ___m_Uv0S_2;
// System.Collections.Generic.List`1<UnityEngine.Vector2> UnityEngine.UI.VertexHelper::m_Uv1S
List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * ___m_Uv1S_3;
// System.Collections.Generic.List`1<UnityEngine.Vector2> UnityEngine.UI.VertexHelper::m_Uv2S
List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * ___m_Uv2S_4;
// System.Collections.Generic.List`1<UnityEngine.Vector2> UnityEngine.UI.VertexHelper::m_Uv3S
List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * ___m_Uv3S_5;
// System.Collections.Generic.List`1<UnityEngine.Vector3> UnityEngine.UI.VertexHelper::m_Normals
List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5 * ___m_Normals_6;
// System.Collections.Generic.List`1<UnityEngine.Vector4> UnityEngine.UI.VertexHelper::m_Tangents
List_1_tFF4005B40E5BA433006DA11C56DB086B1E2FC955 * ___m_Tangents_7;
// System.Collections.Generic.List`1<System.Int32> UnityEngine.UI.VertexHelper::m_Indices
List_1_tE1526161A558A17A39A8B69D8EEF3801393B6226 * ___m_Indices_8;
// System.Boolean UnityEngine.UI.VertexHelper::m_ListsInitalized
bool ___m_ListsInitalized_11;
public:
inline static int32_t get_offset_of_m_Positions_0() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Positions_0)); }
inline List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5 * get_m_Positions_0() const { return ___m_Positions_0; }
inline List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5 ** get_address_of_m_Positions_0() { return &___m_Positions_0; }
inline void set_m_Positions_0(List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5 * value)
{
___m_Positions_0 = value;
Il2CppCodeGenWriteBarrier((&___m_Positions_0), value);
}
inline static int32_t get_offset_of_m_Colors_1() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Colors_1)); }
inline List_1_t749ADA5233D9B421293A000DCB83608A24C3D5D5 * get_m_Colors_1() const { return ___m_Colors_1; }
inline List_1_t749ADA5233D9B421293A000DCB83608A24C3D5D5 ** get_address_of_m_Colors_1() { return &___m_Colors_1; }
inline void set_m_Colors_1(List_1_t749ADA5233D9B421293A000DCB83608A24C3D5D5 * value)
{
___m_Colors_1 = value;
Il2CppCodeGenWriteBarrier((&___m_Colors_1), value);
}
inline static int32_t get_offset_of_m_Uv0S_2() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Uv0S_2)); }
inline List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * get_m_Uv0S_2() const { return ___m_Uv0S_2; }
inline List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB ** get_address_of_m_Uv0S_2() { return &___m_Uv0S_2; }
inline void set_m_Uv0S_2(List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * value)
{
___m_Uv0S_2 = value;
Il2CppCodeGenWriteBarrier((&___m_Uv0S_2), value);
}
inline static int32_t get_offset_of_m_Uv1S_3() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Uv1S_3)); }
inline List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * get_m_Uv1S_3() const { return ___m_Uv1S_3; }
inline List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB ** get_address_of_m_Uv1S_3() { return &___m_Uv1S_3; }
inline void set_m_Uv1S_3(List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * value)
{
___m_Uv1S_3 = value;
Il2CppCodeGenWriteBarrier((&___m_Uv1S_3), value);
}
inline static int32_t get_offset_of_m_Uv2S_4() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Uv2S_4)); }
inline List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * get_m_Uv2S_4() const { return ___m_Uv2S_4; }
inline List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB ** get_address_of_m_Uv2S_4() { return &___m_Uv2S_4; }
inline void set_m_Uv2S_4(List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * value)
{
___m_Uv2S_4 = value;
Il2CppCodeGenWriteBarrier((&___m_Uv2S_4), value);
}
inline static int32_t get_offset_of_m_Uv3S_5() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Uv3S_5)); }
inline List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * get_m_Uv3S_5() const { return ___m_Uv3S_5; }
inline List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB ** get_address_of_m_Uv3S_5() { return &___m_Uv3S_5; }
inline void set_m_Uv3S_5(List_1_t0737D51EB43DAAA1BDC9C2B83B393A4B9B9BE8EB * value)
{
___m_Uv3S_5 = value;
Il2CppCodeGenWriteBarrier((&___m_Uv3S_5), value);
}
inline static int32_t get_offset_of_m_Normals_6() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Normals_6)); }
inline List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5 * get_m_Normals_6() const { return ___m_Normals_6; }
inline List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5 ** get_address_of_m_Normals_6() { return &___m_Normals_6; }
inline void set_m_Normals_6(List_1_tFCCBEDAA56D8F7598520FB136A9F8D713033D6B5 * value)
{
___m_Normals_6 = value;
Il2CppCodeGenWriteBarrier((&___m_Normals_6), value);
}
inline static int32_t get_offset_of_m_Tangents_7() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Tangents_7)); }
inline List_1_tFF4005B40E5BA433006DA11C56DB086B1E2FC955 * get_m_Tangents_7() const { return ___m_Tangents_7; }
inline List_1_tFF4005B40E5BA433006DA11C56DB086B1E2FC955 ** get_address_of_m_Tangents_7() { return &___m_Tangents_7; }
inline void set_m_Tangents_7(List_1_tFF4005B40E5BA433006DA11C56DB086B1E2FC955 * value)
{
___m_Tangents_7 = value;
Il2CppCodeGenWriteBarrier((&___m_Tangents_7), value);
}
inline static int32_t get_offset_of_m_Indices_8() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_Indices_8)); }
inline List_1_tE1526161A558A17A39A8B69D8EEF3801393B6226 * get_m_Indices_8() const { return ___m_Indices_8; }
inline List_1_tE1526161A558A17A39A8B69D8EEF3801393B6226 ** get_address_of_m_Indices_8() { return &___m_Indices_8; }
inline void set_m_Indices_8(List_1_tE1526161A558A17A39A8B69D8EEF3801393B6226 * value)
{
___m_Indices_8 = value;
Il2CppCodeGenWriteBarrier((&___m_Indices_8), value);
}
inline static int32_t get_offset_of_m_ListsInitalized_11() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F, ___m_ListsInitalized_11)); }
inline bool get_m_ListsInitalized_11() const { return ___m_ListsInitalized_11; }
inline bool* get_address_of_m_ListsInitalized_11() { return &___m_ListsInitalized_11; }
inline void set_m_ListsInitalized_11(bool value)
{
___m_ListsInitalized_11 = value;
}
};
struct VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F_StaticFields
{
public:
// UnityEngine.Vector4 UnityEngine.UI.VertexHelper::s_DefaultTangent
Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E ___s_DefaultTangent_9;
// UnityEngine.Vector3 UnityEngine.UI.VertexHelper::s_DefaultNormal
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___s_DefaultNormal_10;
public:
inline static int32_t get_offset_of_s_DefaultTangent_9() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F_StaticFields, ___s_DefaultTangent_9)); }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E get_s_DefaultTangent_9() const { return ___s_DefaultTangent_9; }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E * get_address_of_s_DefaultTangent_9() { return &___s_DefaultTangent_9; }
inline void set_s_DefaultTangent_9(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E value)
{
___s_DefaultTangent_9 = value;
}
inline static int32_t get_offset_of_s_DefaultNormal_10() { return static_cast<int32_t>(offsetof(VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F_StaticFields, ___s_DefaultNormal_10)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_s_DefaultNormal_10() const { return ___s_DefaultNormal_10; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_s_DefaultNormal_10() { return &___s_DefaultNormal_10; }
inline void set_s_DefaultNormal_10(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___s_DefaultNormal_10 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VERTEXHELPER_T27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F_H
#ifndef UIVERTEX_T0583C35B730B218B542E80203F5F4BC6F1E9E577_H
#define UIVERTEX_T0583C35B730B218B542E80203F5F4BC6F1E9E577_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UIVertex
struct UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577
{
public:
// UnityEngine.Vector3 UnityEngine.UIVertex::position
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___position_0;
// UnityEngine.Vector3 UnityEngine.UIVertex::normal
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___normal_1;
// UnityEngine.Vector4 UnityEngine.UIVertex::tangent
Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E ___tangent_2;
// UnityEngine.Color32 UnityEngine.UIVertex::color
Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23 ___color_3;
// UnityEngine.Vector2 UnityEngine.UIVertex::uv0
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___uv0_4;
// UnityEngine.Vector2 UnityEngine.UIVertex::uv1
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___uv1_5;
// UnityEngine.Vector2 UnityEngine.UIVertex::uv2
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___uv2_6;
// UnityEngine.Vector2 UnityEngine.UIVertex::uv3
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___uv3_7;
public:
inline static int32_t get_offset_of_position_0() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577, ___position_0)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_position_0() const { return ___position_0; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_position_0() { return &___position_0; }
inline void set_position_0(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___position_0 = value;
}
inline static int32_t get_offset_of_normal_1() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577, ___normal_1)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_normal_1() const { return ___normal_1; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_normal_1() { return &___normal_1; }
inline void set_normal_1(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___normal_1 = value;
}
inline static int32_t get_offset_of_tangent_2() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577, ___tangent_2)); }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E get_tangent_2() const { return ___tangent_2; }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E * get_address_of_tangent_2() { return &___tangent_2; }
inline void set_tangent_2(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E value)
{
___tangent_2 = value;
}
inline static int32_t get_offset_of_color_3() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577, ___color_3)); }
inline Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23 get_color_3() const { return ___color_3; }
inline Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23 * get_address_of_color_3() { return &___color_3; }
inline void set_color_3(Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23 value)
{
___color_3 = value;
}
inline static int32_t get_offset_of_uv0_4() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577, ___uv0_4)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_uv0_4() const { return ___uv0_4; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_uv0_4() { return &___uv0_4; }
inline void set_uv0_4(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___uv0_4 = value;
}
inline static int32_t get_offset_of_uv1_5() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577, ___uv1_5)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_uv1_5() const { return ___uv1_5; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_uv1_5() { return &___uv1_5; }
inline void set_uv1_5(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___uv1_5 = value;
}
inline static int32_t get_offset_of_uv2_6() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577, ___uv2_6)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_uv2_6() const { return ___uv2_6; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_uv2_6() { return &___uv2_6; }
inline void set_uv2_6(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___uv2_6 = value;
}
inline static int32_t get_offset_of_uv3_7() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577, ___uv3_7)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_uv3_7() const { return ___uv3_7; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_uv3_7() { return &___uv3_7; }
inline void set_uv3_7(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___uv3_7 = value;
}
};
struct UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577_StaticFields
{
public:
// UnityEngine.Color32 UnityEngine.UIVertex::s_DefaultColor
Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23 ___s_DefaultColor_8;
// UnityEngine.Vector4 UnityEngine.UIVertex::s_DefaultTangent
Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E ___s_DefaultTangent_9;
// UnityEngine.UIVertex UnityEngine.UIVertex::simpleVert
UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 ___simpleVert_10;
public:
inline static int32_t get_offset_of_s_DefaultColor_8() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577_StaticFields, ___s_DefaultColor_8)); }
inline Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23 get_s_DefaultColor_8() const { return ___s_DefaultColor_8; }
inline Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23 * get_address_of_s_DefaultColor_8() { return &___s_DefaultColor_8; }
inline void set_s_DefaultColor_8(Color32_t23ABC4AE0E0BDFD2E22EE1FA0DA3904FFE5F6E23 value)
{
___s_DefaultColor_8 = value;
}
inline static int32_t get_offset_of_s_DefaultTangent_9() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577_StaticFields, ___s_DefaultTangent_9)); }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E get_s_DefaultTangent_9() const { return ___s_DefaultTangent_9; }
inline Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E * get_address_of_s_DefaultTangent_9() { return &___s_DefaultTangent_9; }
inline void set_s_DefaultTangent_9(Vector4_tD148D6428C3F8FF6CD998F82090113C2B490B76E value)
{
___s_DefaultTangent_9 = value;
}
inline static int32_t get_offset_of_simpleVert_10() { return static_cast<int32_t>(offsetof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577_StaticFields, ___simpleVert_10)); }
inline UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 get_simpleVert_10() const { return ___simpleVert_10; }
inline UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 * get_address_of_simpleVert_10() { return &___simpleVert_10; }
inline void set_simpleVert_10(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 value)
{
___simpleVert_10 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UIVERTEX_T0583C35B730B218B542E80203F5F4BC6F1E9E577_H
#ifndef MIXEDREALITYINPUTACTION_T21FA9287AC97D00262CA87C0AEF9F92E67203970_H
#define MIXEDREALITYINPUTACTION_T21FA9287AC97D00262CA87C0AEF9F92E67203970_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction
struct MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970
{
public:
// System.UInt32 Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction::id
uint32_t ___id_1;
// System.String Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction::description
String_t* ___description_2;
// Microsoft.MixedReality.Toolkit.Utilities.AxisType Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction::axisConstraint
int32_t ___axisConstraint_3;
public:
inline static int32_t get_offset_of_id_1() { return static_cast<int32_t>(offsetof(MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970, ___id_1)); }
inline uint32_t get_id_1() const { return ___id_1; }
inline uint32_t* get_address_of_id_1() { return &___id_1; }
inline void set_id_1(uint32_t value)
{
___id_1 = value;
}
inline static int32_t get_offset_of_description_2() { return static_cast<int32_t>(offsetof(MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970, ___description_2)); }
inline String_t* get_description_2() const { return ___description_2; }
inline String_t** get_address_of_description_2() { return &___description_2; }
inline void set_description_2(String_t* value)
{
___description_2 = value;
Il2CppCodeGenWriteBarrier((&___description_2), value);
}
inline static int32_t get_offset_of_axisConstraint_3() { return static_cast<int32_t>(offsetof(MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970, ___axisConstraint_3)); }
inline int32_t get_axisConstraint_3() const { return ___axisConstraint_3; }
inline int32_t* get_address_of_axisConstraint_3() { return &___axisConstraint_3; }
inline void set_axisConstraint_3(int32_t value)
{
___axisConstraint_3 = value;
}
};
struct MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970_StaticFields
{
public:
// Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction::<None>k__BackingField
MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 ___U3CNoneU3Ek__BackingField_0;
public:
inline static int32_t get_offset_of_U3CNoneU3Ek__BackingField_0() { return static_cast<int32_t>(offsetof(MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970_StaticFields, ___U3CNoneU3Ek__BackingField_0)); }
inline MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 get_U3CNoneU3Ek__BackingField_0() const { return ___U3CNoneU3Ek__BackingField_0; }
inline MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 * get_address_of_U3CNoneU3Ek__BackingField_0() { return &___U3CNoneU3Ek__BackingField_0; }
inline void set_U3CNoneU3Ek__BackingField_0(MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 value)
{
___U3CNoneU3Ek__BackingField_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction
struct MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970_marshaled_pinvoke
{
uint32_t ___id_1;
char* ___description_2;
int32_t ___axisConstraint_3;
};
// Native definition for COM marshalling of Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction
struct MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970_marshaled_com
{
uint32_t ___id_1;
Il2CppChar* ___description_2;
int32_t ___axisConstraint_3;
};
#endif // MIXEDREALITYINPUTACTION_T21FA9287AC97D00262CA87C0AEF9F92E67203970_H
#ifndef MULTICASTDELEGATE_T_H
#define MULTICASTDELEGATE_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.MulticastDelegate
struct MulticastDelegate_t : public Delegate_t
{
public:
// System.Delegate[] System.MulticastDelegate::delegates
DelegateU5BU5D_tDFCDEE2A6322F96C0FE49AF47E9ADB8C4B294E86* ___delegates_11;
public:
inline static int32_t get_offset_of_delegates_11() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___delegates_11)); }
inline DelegateU5BU5D_tDFCDEE2A6322F96C0FE49AF47E9ADB8C4B294E86* get_delegates_11() const { return ___delegates_11; }
inline DelegateU5BU5D_tDFCDEE2A6322F96C0FE49AF47E9ADB8C4B294E86** get_address_of_delegates_11() { return &___delegates_11; }
inline void set_delegates_11(DelegateU5BU5D_tDFCDEE2A6322F96C0FE49AF47E9ADB8C4B294E86* value)
{
___delegates_11 = value;
Il2CppCodeGenWriteBarrier((&___delegates_11), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.MulticastDelegate
struct MulticastDelegate_t_marshaled_pinvoke : public Delegate_t_marshaled_pinvoke
{
Delegate_t_marshaled_pinvoke** ___delegates_11;
};
// Native definition for COM marshalling of System.MulticastDelegate
struct MulticastDelegate_t_marshaled_com : public Delegate_t_marshaled_com
{
Delegate_t_marshaled_com** ___delegates_11;
};
#endif // MULTICASTDELEGATE_T_H
#ifndef COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#define COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Component
struct Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 : public Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COMPONENT_T05064EF382ABCAF4B8C94F8A350EA85184C26621_H
#ifndef GAMEOBJECT_TBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F_H
#define GAMEOBJECT_TBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.GameObject
struct GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F : public Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GAMEOBJECT_TBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F_H
#ifndef BASEINPUTEVENTDATA_TBB63D9BEE1678B2CD47272D16449017A2AC4B04A_H
#define BASEINPUTEVENTDATA_TBB63D9BEE1678B2CD47272D16449017A2AC4B04A_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.BaseInputEventData
struct BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A : public BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5
{
public:
// System.DateTime Microsoft.MixedReality.Toolkit.Input.BaseInputEventData::<EventTime>k__BackingField
DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 ___U3CEventTimeU3Ek__BackingField_2;
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSource Microsoft.MixedReality.Toolkit.Input.BaseInputEventData::<InputSource>k__BackingField
RuntimeObject* ___U3CInputSourceU3Ek__BackingField_3;
// Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction Microsoft.MixedReality.Toolkit.Input.BaseInputEventData::<MixedRealityInputAction>k__BackingField
MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 ___U3CMixedRealityInputActionU3Ek__BackingField_4;
public:
inline static int32_t get_offset_of_U3CEventTimeU3Ek__BackingField_2() { return static_cast<int32_t>(offsetof(BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A, ___U3CEventTimeU3Ek__BackingField_2)); }
inline DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 get_U3CEventTimeU3Ek__BackingField_2() const { return ___U3CEventTimeU3Ek__BackingField_2; }
inline DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 * get_address_of_U3CEventTimeU3Ek__BackingField_2() { return &___U3CEventTimeU3Ek__BackingField_2; }
inline void set_U3CEventTimeU3Ek__BackingField_2(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 value)
{
___U3CEventTimeU3Ek__BackingField_2 = value;
}
inline static int32_t get_offset_of_U3CInputSourceU3Ek__BackingField_3() { return static_cast<int32_t>(offsetof(BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A, ___U3CInputSourceU3Ek__BackingField_3)); }
inline RuntimeObject* get_U3CInputSourceU3Ek__BackingField_3() const { return ___U3CInputSourceU3Ek__BackingField_3; }
inline RuntimeObject** get_address_of_U3CInputSourceU3Ek__BackingField_3() { return &___U3CInputSourceU3Ek__BackingField_3; }
inline void set_U3CInputSourceU3Ek__BackingField_3(RuntimeObject* value)
{
___U3CInputSourceU3Ek__BackingField_3 = value;
Il2CppCodeGenWriteBarrier((&___U3CInputSourceU3Ek__BackingField_3), value);
}
inline static int32_t get_offset_of_U3CMixedRealityInputActionU3Ek__BackingField_4() { return static_cast<int32_t>(offsetof(BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A, ___U3CMixedRealityInputActionU3Ek__BackingField_4)); }
inline MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 get_U3CMixedRealityInputActionU3Ek__BackingField_4() const { return ___U3CMixedRealityInputActionU3Ek__BackingField_4; }
inline MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 * get_address_of_U3CMixedRealityInputActionU3Ek__BackingField_4() { return &___U3CMixedRealityInputActionU3Ek__BackingField_4; }
inline void set_U3CMixedRealityInputActionU3Ek__BackingField_4(MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 value)
{
___U3CMixedRealityInputActionU3Ek__BackingField_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BASEINPUTEVENTDATA_TBB63D9BEE1678B2CD47272D16449017A2AC4B04A_H
#ifndef SPEECHCOMMANDS_TE961AB304147A56B09655E7BFC563B1B24173AD7_H
#define SPEECHCOMMANDS_TE961AB304147A56B09655E7BFC563B1B24173AD7_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.SpeechCommands
struct SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7
{
public:
// System.String Microsoft.MixedReality.Toolkit.Input.SpeechCommands::localizationKey
String_t* ___localizationKey_0;
// System.String Microsoft.MixedReality.Toolkit.Input.SpeechCommands::localizedKeyword
String_t* ___localizedKeyword_1;
// System.String Microsoft.MixedReality.Toolkit.Input.SpeechCommands::keyword
String_t* ___keyword_2;
// UnityEngine.KeyCode Microsoft.MixedReality.Toolkit.Input.SpeechCommands::keyCode
int32_t ___keyCode_3;
// Microsoft.MixedReality.Toolkit.Input.MixedRealityInputAction Microsoft.MixedReality.Toolkit.Input.SpeechCommands::action
MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 ___action_4;
public:
inline static int32_t get_offset_of_localizationKey_0() { return static_cast<int32_t>(offsetof(SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7, ___localizationKey_0)); }
inline String_t* get_localizationKey_0() const { return ___localizationKey_0; }
inline String_t** get_address_of_localizationKey_0() { return &___localizationKey_0; }
inline void set_localizationKey_0(String_t* value)
{
___localizationKey_0 = value;
Il2CppCodeGenWriteBarrier((&___localizationKey_0), value);
}
inline static int32_t get_offset_of_localizedKeyword_1() { return static_cast<int32_t>(offsetof(SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7, ___localizedKeyword_1)); }
inline String_t* get_localizedKeyword_1() const { return ___localizedKeyword_1; }
inline String_t** get_address_of_localizedKeyword_1() { return &___localizedKeyword_1; }
inline void set_localizedKeyword_1(String_t* value)
{
___localizedKeyword_1 = value;
Il2CppCodeGenWriteBarrier((&___localizedKeyword_1), value);
}
inline static int32_t get_offset_of_keyword_2() { return static_cast<int32_t>(offsetof(SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7, ___keyword_2)); }
inline String_t* get_keyword_2() const { return ___keyword_2; }
inline String_t** get_address_of_keyword_2() { return &___keyword_2; }
inline void set_keyword_2(String_t* value)
{
___keyword_2 = value;
Il2CppCodeGenWriteBarrier((&___keyword_2), value);
}
inline static int32_t get_offset_of_keyCode_3() { return static_cast<int32_t>(offsetof(SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7, ___keyCode_3)); }
inline int32_t get_keyCode_3() const { return ___keyCode_3; }
inline int32_t* get_address_of_keyCode_3() { return &___keyCode_3; }
inline void set_keyCode_3(int32_t value)
{
___keyCode_3 = value;
}
inline static int32_t get_offset_of_action_4() { return static_cast<int32_t>(offsetof(SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7, ___action_4)); }
inline MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 get_action_4() const { return ___action_4; }
inline MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 * get_address_of_action_4() { return &___action_4; }
inline void set_action_4(MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970 value)
{
___action_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of Microsoft.MixedReality.Toolkit.Input.SpeechCommands
struct SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7_marshaled_pinvoke
{
char* ___localizationKey_0;
char* ___localizedKeyword_1;
char* ___keyword_2;
int32_t ___keyCode_3;
MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970_marshaled_pinvoke ___action_4;
};
// Native definition for COM marshalling of Microsoft.MixedReality.Toolkit.Input.SpeechCommands
struct SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7_marshaled_com
{
Il2CppChar* ___localizationKey_0;
Il2CppChar* ___localizedKeyword_1;
Il2CppChar* ___keyword_2;
int32_t ___keyCode_3;
MixedRealityInputAction_t21FA9287AC97D00262CA87C0AEF9F92E67203970_marshaled_com ___action_4;
};
#endif // SPEECHCOMMANDS_TE961AB304147A56B09655E7BFC563B1B24173AD7_H
#ifndef FUNC_1_T3AE1617AFFCE3777C6509180026C803D862960EC_H
#define FUNC_1_T3AE1617AFFCE3777C6509180026C803D862960EC_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Func`1<UnityEngine.RectTransform>
struct Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // FUNC_1_T3AE1617AFFCE3777C6509180026C803D862960EC_H
#ifndef FUNC_3_TFE37AA67AECF512EC6C360214537ED447EC86875_H
#define FUNC_3_TFE37AA67AECF512EC6C360214537ED447EC86875_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Func`3<System.String,UnityEngine.Transform,System.String>
struct Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // FUNC_3_TFE37AA67AECF512EC6C360214537ED447EC86875_H
#ifndef BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#define BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Behaviour
struct Behaviour_tBDC7E9C3C898AD8348891B82D3E345801D920CA8 : public Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BEHAVIOUR_TBDC7E9C3C898AD8348891B82D3E345801D920CA8_H
#ifndef COLLIDER_T0FEEB36760860AD21B3B1F0509C365B393EC4BDF_H
#define COLLIDER_T0FEEB36760860AD21B3B1F0509C365B393EC4BDF_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Collider
struct Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF : public Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLLIDER_T0FEEB36760860AD21B3B1F0509C365B393EC4BDF_H
#ifndef TRANSFORM_TBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA_H
#define TRANSFORM_TBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Transform
struct Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA : public Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TRANSFORM_TBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA_H
#ifndef DICTATIONEVENTDATA_TC8FD1EF5C792D258465216EC3962AF21F534F386_H
#define DICTATIONEVENTDATA_TC8FD1EF5C792D258465216EC3962AF21F534F386_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.DictationEventData
struct DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 : public BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A
{
public:
// System.String Microsoft.MixedReality.Toolkit.Input.DictationEventData::<DictationResult>k__BackingField
String_t* ___U3CDictationResultU3Ek__BackingField_5;
// UnityEngine.AudioClip Microsoft.MixedReality.Toolkit.Input.DictationEventData::<DictationAudioClip>k__BackingField
AudioClip_tCC3C35F579203CE2601243585AB3D6953C3BA051 * ___U3CDictationAudioClipU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CDictationResultU3Ek__BackingField_5() { return static_cast<int32_t>(offsetof(DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386, ___U3CDictationResultU3Ek__BackingField_5)); }
inline String_t* get_U3CDictationResultU3Ek__BackingField_5() const { return ___U3CDictationResultU3Ek__BackingField_5; }
inline String_t** get_address_of_U3CDictationResultU3Ek__BackingField_5() { return &___U3CDictationResultU3Ek__BackingField_5; }
inline void set_U3CDictationResultU3Ek__BackingField_5(String_t* value)
{
___U3CDictationResultU3Ek__BackingField_5 = value;
Il2CppCodeGenWriteBarrier((&___U3CDictationResultU3Ek__BackingField_5), value);
}
inline static int32_t get_offset_of_U3CDictationAudioClipU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386, ___U3CDictationAudioClipU3Ek__BackingField_6)); }
inline AudioClip_tCC3C35F579203CE2601243585AB3D6953C3BA051 * get_U3CDictationAudioClipU3Ek__BackingField_6() const { return ___U3CDictationAudioClipU3Ek__BackingField_6; }
inline AudioClip_tCC3C35F579203CE2601243585AB3D6953C3BA051 ** get_address_of_U3CDictationAudioClipU3Ek__BackingField_6() { return &___U3CDictationAudioClipU3Ek__BackingField_6; }
inline void set_U3CDictationAudioClipU3Ek__BackingField_6(AudioClip_tCC3C35F579203CE2601243585AB3D6953C3BA051 * value)
{
___U3CDictationAudioClipU3Ek__BackingField_6 = value;
Il2CppCodeGenWriteBarrier((&___U3CDictationAudioClipU3Ek__BackingField_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DICTATIONEVENTDATA_TC8FD1EF5C792D258465216EC3962AF21F534F386_H
#ifndef INPUTEVENTDATA_T4448A1ECF70018591A9050CEC5582EEF07663896_H
#define INPUTEVENTDATA_T4448A1ECF70018591A9050CEC5582EEF07663896_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.InputEventData
struct InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 : public BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A
{
public:
// Microsoft.MixedReality.Toolkit.Utilities.Handedness Microsoft.MixedReality.Toolkit.Input.InputEventData::<Handedness>k__BackingField
uint8_t ___U3CHandednessU3Ek__BackingField_5;
public:
inline static int32_t get_offset_of_U3CHandednessU3Ek__BackingField_5() { return static_cast<int32_t>(offsetof(InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896, ___U3CHandednessU3Ek__BackingField_5)); }
inline uint8_t get_U3CHandednessU3Ek__BackingField_5() const { return ___U3CHandednessU3Ek__BackingField_5; }
inline uint8_t* get_address_of_U3CHandednessU3Ek__BackingField_5() { return &___U3CHandednessU3Ek__BackingField_5; }
inline void set_U3CHandednessU3Ek__BackingField_5(uint8_t value)
{
___U3CHandednessU3Ek__BackingField_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTEVENTDATA_T4448A1ECF70018591A9050CEC5582EEF07663896_H
#ifndef SOURCESTATEEVENTDATA_TC9A28F0D7D80ABE5DAE50745B36588F4240006D8_H
#define SOURCESTATEEVENTDATA_TC9A28F0D7D80ABE5DAE50745B36588F4240006D8_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.SourceStateEventData
struct SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 : public BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A
{
public:
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityController Microsoft.MixedReality.Toolkit.Input.SourceStateEventData::<Controller>k__BackingField
RuntimeObject* ___U3CControllerU3Ek__BackingField_5;
public:
inline static int32_t get_offset_of_U3CControllerU3Ek__BackingField_5() { return static_cast<int32_t>(offsetof(SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8, ___U3CControllerU3Ek__BackingField_5)); }
inline RuntimeObject* get_U3CControllerU3Ek__BackingField_5() const { return ___U3CControllerU3Ek__BackingField_5; }
inline RuntimeObject** get_address_of_U3CControllerU3Ek__BackingField_5() { return &___U3CControllerU3Ek__BackingField_5; }
inline void set_U3CControllerU3Ek__BackingField_5(RuntimeObject* value)
{
___U3CControllerU3Ek__BackingField_5 = value;
Il2CppCodeGenWriteBarrier((&___U3CControllerU3Ek__BackingField_5), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SOURCESTATEEVENTDATA_TC9A28F0D7D80ABE5DAE50745B36588F4240006D8_H
#ifndef SPEECHEVENTDATA_T49EB0455EC1109189A6976157FB609BC0426D61D_H
#define SPEECHEVENTDATA_T49EB0455EC1109189A6976157FB609BC0426D61D_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.SpeechEventData
struct SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D : public BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A
{
public:
// System.TimeSpan Microsoft.MixedReality.Toolkit.Input.SpeechEventData::<PhraseDuration>k__BackingField
TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 ___U3CPhraseDurationU3Ek__BackingField_5;
// System.DateTime Microsoft.MixedReality.Toolkit.Input.SpeechEventData::<PhraseStartTime>k__BackingField
DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 ___U3CPhraseStartTimeU3Ek__BackingField_6;
// Microsoft.MixedReality.Toolkit.Input.SpeechCommands Microsoft.MixedReality.Toolkit.Input.SpeechEventData::<Command>k__BackingField
SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7 ___U3CCommandU3Ek__BackingField_7;
// Microsoft.MixedReality.Toolkit.Utilities.RecognitionConfidenceLevel Microsoft.MixedReality.Toolkit.Input.SpeechEventData::<Confidence>k__BackingField
int32_t ___U3CConfidenceU3Ek__BackingField_8;
public:
inline static int32_t get_offset_of_U3CPhraseDurationU3Ek__BackingField_5() { return static_cast<int32_t>(offsetof(SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D, ___U3CPhraseDurationU3Ek__BackingField_5)); }
inline TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 get_U3CPhraseDurationU3Ek__BackingField_5() const { return ___U3CPhraseDurationU3Ek__BackingField_5; }
inline TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 * get_address_of_U3CPhraseDurationU3Ek__BackingField_5() { return &___U3CPhraseDurationU3Ek__BackingField_5; }
inline void set_U3CPhraseDurationU3Ek__BackingField_5(TimeSpan_tA8069278ACE8A74D6DF7D514A9CD4432433F64C4 value)
{
___U3CPhraseDurationU3Ek__BackingField_5 = value;
}
inline static int32_t get_offset_of_U3CPhraseStartTimeU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D, ___U3CPhraseStartTimeU3Ek__BackingField_6)); }
inline DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 get_U3CPhraseStartTimeU3Ek__BackingField_6() const { return ___U3CPhraseStartTimeU3Ek__BackingField_6; }
inline DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 * get_address_of_U3CPhraseStartTimeU3Ek__BackingField_6() { return &___U3CPhraseStartTimeU3Ek__BackingField_6; }
inline void set_U3CPhraseStartTimeU3Ek__BackingField_6(DateTime_t349B7449FBAAFF4192636E2B7A07694DA9236132 value)
{
___U3CPhraseStartTimeU3Ek__BackingField_6 = value;
}
inline static int32_t get_offset_of_U3CCommandU3Ek__BackingField_7() { return static_cast<int32_t>(offsetof(SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D, ___U3CCommandU3Ek__BackingField_7)); }
inline SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7 get_U3CCommandU3Ek__BackingField_7() const { return ___U3CCommandU3Ek__BackingField_7; }
inline SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7 * get_address_of_U3CCommandU3Ek__BackingField_7() { return &___U3CCommandU3Ek__BackingField_7; }
inline void set_U3CCommandU3Ek__BackingField_7(SpeechCommands_tE961AB304147A56B09655E7BFC563B1B24173AD7 value)
{
___U3CCommandU3Ek__BackingField_7 = value;
}
inline static int32_t get_offset_of_U3CConfidenceU3Ek__BackingField_8() { return static_cast<int32_t>(offsetof(SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D, ___U3CConfidenceU3Ek__BackingField_8)); }
inline int32_t get_U3CConfidenceU3Ek__BackingField_8() const { return ___U3CConfidenceU3Ek__BackingField_8; }
inline int32_t* get_address_of_U3CConfidenceU3Ek__BackingField_8() { return &___U3CConfidenceU3Ek__BackingField_8; }
inline void set_U3CConfidenceU3Ek__BackingField_8(int32_t value)
{
___U3CConfidenceU3Ek__BackingField_8 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SPEECHEVENTDATA_T49EB0455EC1109189A6976157FB609BC0426D61D_H
#ifndef BOXCOLLIDER_T2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_H
#define BOXCOLLIDER_T2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.BoxCollider
struct BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA : public Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOXCOLLIDER_T2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_H
#ifndef CAMERA_T48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34_H
#define CAMERA_T48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Camera
struct Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 : public Behaviour_tBDC7E9C3C898AD8348891B82D3E345801D920CA8
{
public:
public:
};
struct Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34_StaticFields
{
public:
// UnityEngine.Camera_CameraCallback UnityEngine.Camera::onPreCull
CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * ___onPreCull_4;
// UnityEngine.Camera_CameraCallback UnityEngine.Camera::onPreRender
CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * ___onPreRender_5;
// UnityEngine.Camera_CameraCallback UnityEngine.Camera::onPostRender
CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * ___onPostRender_6;
public:
inline static int32_t get_offset_of_onPreCull_4() { return static_cast<int32_t>(offsetof(Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34_StaticFields, ___onPreCull_4)); }
inline CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * get_onPreCull_4() const { return ___onPreCull_4; }
inline CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 ** get_address_of_onPreCull_4() { return &___onPreCull_4; }
inline void set_onPreCull_4(CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * value)
{
___onPreCull_4 = value;
Il2CppCodeGenWriteBarrier((&___onPreCull_4), value);
}
inline static int32_t get_offset_of_onPreRender_5() { return static_cast<int32_t>(offsetof(Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34_StaticFields, ___onPreRender_5)); }
inline CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * get_onPreRender_5() const { return ___onPreRender_5; }
inline CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 ** get_address_of_onPreRender_5() { return &___onPreRender_5; }
inline void set_onPreRender_5(CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * value)
{
___onPreRender_5 = value;
Il2CppCodeGenWriteBarrier((&___onPreRender_5), value);
}
inline static int32_t get_offset_of_onPostRender_6() { return static_cast<int32_t>(offsetof(Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34_StaticFields, ___onPostRender_6)); }
inline CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * get_onPostRender_6() const { return ___onPostRender_6; }
inline CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 ** get_address_of_onPostRender_6() { return &___onPostRender_6; }
inline void set_onPostRender_6(CameraCallback_t8BBB42AA08D7498DFC11F4128117055BC7F0B9D0 * value)
{
___onPostRender_6 = value;
Il2CppCodeGenWriteBarrier((&___onPostRender_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CAMERA_T48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34_H
#ifndef CANVAS_TBC28BF1DD8D8499A89B5781505833D3728CF8591_H
#define CANVAS_TBC28BF1DD8D8499A89B5781505833D3728CF8591_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Canvas
struct Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 : public Behaviour_tBDC7E9C3C898AD8348891B82D3E345801D920CA8
{
public:
public:
};
struct Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_StaticFields
{
public:
// UnityEngine.Canvas_WillRenderCanvases UnityEngine.Canvas::willRenderCanvases
WillRenderCanvases_tBD5AD090B5938021DEAA679A5AEEA790F60A8BEE * ___willRenderCanvases_4;
public:
inline static int32_t get_offset_of_willRenderCanvases_4() { return static_cast<int32_t>(offsetof(Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_StaticFields, ___willRenderCanvases_4)); }
inline WillRenderCanvases_tBD5AD090B5938021DEAA679A5AEEA790F60A8BEE * get_willRenderCanvases_4() const { return ___willRenderCanvases_4; }
inline WillRenderCanvases_tBD5AD090B5938021DEAA679A5AEEA790F60A8BEE ** get_address_of_willRenderCanvases_4() { return &___willRenderCanvases_4; }
inline void set_willRenderCanvases_4(WillRenderCanvases_tBD5AD090B5938021DEAA679A5AEEA790F60A8BEE * value)
{
___willRenderCanvases_4 = value;
Il2CppCodeGenWriteBarrier((&___willRenderCanvases_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CANVAS_TBC28BF1DD8D8499A89B5781505833D3728CF8591_H
#ifndef CAPSULECOLLIDER_T5FD15B9E7BEEC4FFA8A2071E9FD2B8DEB3A826D1_H
#define CAPSULECOLLIDER_T5FD15B9E7BEEC4FFA8A2071E9FD2B8DEB3A826D1_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.CapsuleCollider
struct CapsuleCollider_t5FD15B9E7BEEC4FFA8A2071E9FD2B8DEB3A826D1 : public Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CAPSULECOLLIDER_T5FD15B9E7BEEC4FFA8A2071E9FD2B8DEB3A826D1_H
#ifndef MESHCOLLIDER_T60EB55ADE92499FE8D1AA206D2BD96E65B2766DE_H
#define MESHCOLLIDER_T60EB55ADE92499FE8D1AA206D2BD96E65B2766DE_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.MeshCollider
struct MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE : public Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MESHCOLLIDER_T60EB55ADE92499FE8D1AA206D2BD96E65B2766DE_H
#ifndef MONOBEHAVIOUR_T4A60845CF505405AF8BE8C61CC07F75CADEF6429_H
#define MONOBEHAVIOUR_T4A60845CF505405AF8BE8C61CC07F75CADEF6429_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.MonoBehaviour
struct MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429 : public Behaviour_tBDC7E9C3C898AD8348891B82D3E345801D920CA8
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MONOBEHAVIOUR_T4A60845CF505405AF8BE8C61CC07F75CADEF6429_H
#ifndef RECTTRANSFORM_T285CBD8775B25174B75164F10618F8B9728E1B20_H
#define RECTTRANSFORM_T285CBD8775B25174B75164F10618F8B9728E1B20_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RectTransform
struct RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 : public Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA
{
public:
public:
};
struct RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20_StaticFields
{
public:
// UnityEngine.RectTransform_ReapplyDrivenProperties UnityEngine.RectTransform::reapplyDrivenProperties
ReapplyDrivenProperties_t431F4FBD9C59AE097FE33C4354CC6251B01B527D * ___reapplyDrivenProperties_4;
public:
inline static int32_t get_offset_of_reapplyDrivenProperties_4() { return static_cast<int32_t>(offsetof(RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20_StaticFields, ___reapplyDrivenProperties_4)); }
inline ReapplyDrivenProperties_t431F4FBD9C59AE097FE33C4354CC6251B01B527D * get_reapplyDrivenProperties_4() const { return ___reapplyDrivenProperties_4; }
inline ReapplyDrivenProperties_t431F4FBD9C59AE097FE33C4354CC6251B01B527D ** get_address_of_reapplyDrivenProperties_4() { return &___reapplyDrivenProperties_4; }
inline void set_reapplyDrivenProperties_4(ReapplyDrivenProperties_t431F4FBD9C59AE097FE33C4354CC6251B01B527D * value)
{
___reapplyDrivenProperties_4 = value;
Il2CppCodeGenWriteBarrier((&___reapplyDrivenProperties_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECTTRANSFORM_T285CBD8775B25174B75164F10618F8B9728E1B20_H
#ifndef SPHERECOLLIDER_TAC3E5E20B385DF1C0B17F3EA5C7214F71367706F_H
#define SPHERECOLLIDER_TAC3E5E20B385DF1C0B17F3EA5C7214F71367706F_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.SphereCollider
struct SphereCollider_tAC3E5E20B385DF1C0B17F3EA5C7214F71367706F : public Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SPHERECOLLIDER_TAC3E5E20B385DF1C0B17F3EA5C7214F71367706F_H
#ifndef BASENEARINTERACTIONTOUCHABLE_T98D072EC4C522792850CE5A09BEE5F1CF9BFA19F_H
#define BASENEARINTERACTIONTOUCHABLE_T98D072EC4C522792850CE5A09BEE5F1CF9BFA19F_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.BaseNearInteractionTouchable
struct BaseNearInteractionTouchable_t98D072EC4C522792850CE5A09BEE5F1CF9BFA19F : public MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429
{
public:
// Microsoft.MixedReality.Toolkit.Input.TouchableEventType Microsoft.MixedReality.Toolkit.Input.BaseNearInteractionTouchable::eventsToReceive
int32_t ___eventsToReceive_4;
// System.Single Microsoft.MixedReality.Toolkit.Input.BaseNearInteractionTouchable::debounceThreshold
float ___debounceThreshold_5;
public:
inline static int32_t get_offset_of_eventsToReceive_4() { return static_cast<int32_t>(offsetof(BaseNearInteractionTouchable_t98D072EC4C522792850CE5A09BEE5F1CF9BFA19F, ___eventsToReceive_4)); }
inline int32_t get_eventsToReceive_4() const { return ___eventsToReceive_4; }
inline int32_t* get_address_of_eventsToReceive_4() { return &___eventsToReceive_4; }
inline void set_eventsToReceive_4(int32_t value)
{
___eventsToReceive_4 = value;
}
inline static int32_t get_offset_of_debounceThreshold_5() { return static_cast<int32_t>(offsetof(BaseNearInteractionTouchable_t98D072EC4C522792850CE5A09BEE5F1CF9BFA19F, ___debounceThreshold_5)); }
inline float get_debounceThreshold_5() const { return ___debounceThreshold_5; }
inline float* get_address_of_debounceThreshold_5() { return &___debounceThreshold_5; }
inline void set_debounceThreshold_5(float value)
{
___debounceThreshold_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BASENEARINTERACTIONTOUCHABLE_T98D072EC4C522792850CE5A09BEE5F1CF9BFA19F_H
#ifndef INPUTEVENTDATA_1_T705DA55E914E795A9CB96BCE2866C0FF8F93D1CF_H
#define INPUTEVENTDATA_1_T705DA55E914E795A9CB96BCE2866C0FF8F93D1CF_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<Microsoft.MixedReality.Toolkit.Input.HandMeshInfo>
struct InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF : public InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896
{
public:
// T Microsoft.MixedReality.Toolkit.Input.InputEventData`1::<InputData>k__BackingField
HandMeshInfo_t97CE256FABE551C015BE36E467AA7EFC57254084 * ___U3CInputDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CInputDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF, ___U3CInputDataU3Ek__BackingField_6)); }
inline HandMeshInfo_t97CE256FABE551C015BE36E467AA7EFC57254084 * get_U3CInputDataU3Ek__BackingField_6() const { return ___U3CInputDataU3Ek__BackingField_6; }
inline HandMeshInfo_t97CE256FABE551C015BE36E467AA7EFC57254084 ** get_address_of_U3CInputDataU3Ek__BackingField_6() { return &___U3CInputDataU3Ek__BackingField_6; }
inline void set_U3CInputDataU3Ek__BackingField_6(HandMeshInfo_t97CE256FABE551C015BE36E467AA7EFC57254084 * value)
{
___U3CInputDataU3Ek__BackingField_6 = value;
Il2CppCodeGenWriteBarrier((&___U3CInputDataU3Ek__BackingField_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTEVENTDATA_1_T705DA55E914E795A9CB96BCE2866C0FF8F93D1CF_H
#ifndef INPUTEVENTDATA_1_TED5D68194AE7B6B769F9EFCDB373BA9401676190_H
#define INPUTEVENTDATA_1_TED5D68194AE7B6B769F9EFCDB373BA9401676190_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>
struct InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 : public InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896
{
public:
// T Microsoft.MixedReality.Toolkit.Input.InputEventData`1::<InputData>k__BackingField
MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 ___U3CInputDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CInputDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190, ___U3CInputDataU3Ek__BackingField_6)); }
inline MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 get_U3CInputDataU3Ek__BackingField_6() const { return ___U3CInputDataU3Ek__BackingField_6; }
inline MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 * get_address_of_U3CInputDataU3Ek__BackingField_6() { return &___U3CInputDataU3Ek__BackingField_6; }
inline void set_U3CInputDataU3Ek__BackingField_6(MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 value)
{
___U3CInputDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTEVENTDATA_1_TED5D68194AE7B6B769F9EFCDB373BA9401676190_H
#ifndef INPUTEVENTDATA_1_T1AC45F3C33BF832864FC5562B48A8132A2AD207A_H
#define INPUTEVENTDATA_1_T1AC45F3C33BF832864FC5562B48A8132A2AD207A_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<System.Collections.Generic.IDictionary`2<Microsoft.MixedReality.Toolkit.Utilities.TrackedHandJoint,Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>>
struct InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A : public InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896
{
public:
// T Microsoft.MixedReality.Toolkit.Input.InputEventData`1::<InputData>k__BackingField
RuntimeObject* ___U3CInputDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CInputDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A, ___U3CInputDataU3Ek__BackingField_6)); }
inline RuntimeObject* get_U3CInputDataU3Ek__BackingField_6() const { return ___U3CInputDataU3Ek__BackingField_6; }
inline RuntimeObject** get_address_of_U3CInputDataU3Ek__BackingField_6() { return &___U3CInputDataU3Ek__BackingField_6; }
inline void set_U3CInputDataU3Ek__BackingField_6(RuntimeObject* value)
{
___U3CInputDataU3Ek__BackingField_6 = value;
Il2CppCodeGenWriteBarrier((&___U3CInputDataU3Ek__BackingField_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTEVENTDATA_1_T1AC45F3C33BF832864FC5562B48A8132A2AD207A_H
#ifndef INPUTEVENTDATA_1_T0068A19074FE312CE222C151A2EB6D127A167E08_H
#define INPUTEVENTDATA_1_T0068A19074FE312CE222C151A2EB6D127A167E08_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<System.Single>
struct InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08 : public InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896
{
public:
// T Microsoft.MixedReality.Toolkit.Input.InputEventData`1::<InputData>k__BackingField
float ___U3CInputDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CInputDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08, ___U3CInputDataU3Ek__BackingField_6)); }
inline float get_U3CInputDataU3Ek__BackingField_6() const { return ___U3CInputDataU3Ek__BackingField_6; }
inline float* get_address_of_U3CInputDataU3Ek__BackingField_6() { return &___U3CInputDataU3Ek__BackingField_6; }
inline void set_U3CInputDataU3Ek__BackingField_6(float value)
{
___U3CInputDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTEVENTDATA_1_T0068A19074FE312CE222C151A2EB6D127A167E08_H
#ifndef INPUTEVENTDATA_1_TFD411C2CE816CA54B409FC51522DD2C5186F8B9F_H
#define INPUTEVENTDATA_1_TFD411C2CE816CA54B409FC51522DD2C5186F8B9F_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Quaternion>
struct InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F : public InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896
{
public:
// T Microsoft.MixedReality.Toolkit.Input.InputEventData`1::<InputData>k__BackingField
Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 ___U3CInputDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CInputDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F, ___U3CInputDataU3Ek__BackingField_6)); }
inline Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 get_U3CInputDataU3Ek__BackingField_6() const { return ___U3CInputDataU3Ek__BackingField_6; }
inline Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 * get_address_of_U3CInputDataU3Ek__BackingField_6() { return &___U3CInputDataU3Ek__BackingField_6; }
inline void set_U3CInputDataU3Ek__BackingField_6(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 value)
{
___U3CInputDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTEVENTDATA_1_TFD411C2CE816CA54B409FC51522DD2C5186F8B9F_H
#ifndef INPUTEVENTDATA_1_T815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_H
#define INPUTEVENTDATA_1_T815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Vector2>
struct InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B : public InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896
{
public:
// T Microsoft.MixedReality.Toolkit.Input.InputEventData`1::<InputData>k__BackingField
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___U3CInputDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CInputDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B, ___U3CInputDataU3Ek__BackingField_6)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_U3CInputDataU3Ek__BackingField_6() const { return ___U3CInputDataU3Ek__BackingField_6; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_U3CInputDataU3Ek__BackingField_6() { return &___U3CInputDataU3Ek__BackingField_6; }
inline void set_U3CInputDataU3Ek__BackingField_6(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___U3CInputDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTEVENTDATA_1_T815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_H
#ifndef INPUTEVENTDATA_1_T7B09E7020518DF25CC38B52C7C6C5D94070835E7_H
#define INPUTEVENTDATA_1_T7B09E7020518DF25CC38B52C7C6C5D94070835E7_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Vector3>
struct InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 : public InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896
{
public:
// T Microsoft.MixedReality.Toolkit.Input.InputEventData`1::<InputData>k__BackingField
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___U3CInputDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CInputDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7, ___U3CInputDataU3Ek__BackingField_6)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_U3CInputDataU3Ek__BackingField_6() const { return ___U3CInputDataU3Ek__BackingField_6; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_U3CInputDataU3Ek__BackingField_6() { return &___U3CInputDataU3Ek__BackingField_6; }
inline void set_U3CInputDataU3Ek__BackingField_6(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___U3CInputDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTEVENTDATA_1_T7B09E7020518DF25CC38B52C7C6C5D94070835E7_H
#ifndef MIXEDREALITYPOINTEREVENTDATA_TCC4301DD4183C547A2CEE152E344ED2FDE096964_H
#define MIXEDREALITYPOINTEREVENTDATA_TCC4301DD4183C547A2CEE152E344ED2FDE096964_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData
struct MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 : public InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896
{
public:
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData::<Pointer>k__BackingField
RuntimeObject* ___U3CPointerU3Ek__BackingField_6;
// System.Int32 Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData::<Count>k__BackingField
int32_t ___U3CCountU3Ek__BackingField_7;
public:
inline static int32_t get_offset_of_U3CPointerU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964, ___U3CPointerU3Ek__BackingField_6)); }
inline RuntimeObject* get_U3CPointerU3Ek__BackingField_6() const { return ___U3CPointerU3Ek__BackingField_6; }
inline RuntimeObject** get_address_of_U3CPointerU3Ek__BackingField_6() { return &___U3CPointerU3Ek__BackingField_6; }
inline void set_U3CPointerU3Ek__BackingField_6(RuntimeObject* value)
{
___U3CPointerU3Ek__BackingField_6 = value;
Il2CppCodeGenWriteBarrier((&___U3CPointerU3Ek__BackingField_6), value);
}
inline static int32_t get_offset_of_U3CCountU3Ek__BackingField_7() { return static_cast<int32_t>(offsetof(MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964, ___U3CCountU3Ek__BackingField_7)); }
inline int32_t get_U3CCountU3Ek__BackingField_7() const { return ___U3CCountU3Ek__BackingField_7; }
inline int32_t* get_address_of_U3CCountU3Ek__BackingField_7() { return &___U3CCountU3Ek__BackingField_7; }
inline void set_U3CCountU3Ek__BackingField_7(int32_t value)
{
___U3CCountU3Ek__BackingField_7 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MIXEDREALITYPOINTEREVENTDATA_TCC4301DD4183C547A2CEE152E344ED2FDE096964_H
#ifndef NEARINTERACTIONGRABBABLE_TD81A6B243534FF858FAEC2C510FF3072A9FB3900_H
#define NEARINTERACTIONGRABBABLE_TD81A6B243534FF858FAEC2C510FF3072A9FB3900_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.NearInteractionGrabbable
struct NearInteractionGrabbable_tD81A6B243534FF858FAEC2C510FF3072A9FB3900 : public MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429
{
public:
// System.Boolean Microsoft.MixedReality.Toolkit.Input.NearInteractionGrabbable::ShowTetherWhenManipulating
bool ___ShowTetherWhenManipulating_4;
public:
inline static int32_t get_offset_of_ShowTetherWhenManipulating_4() { return static_cast<int32_t>(offsetof(NearInteractionGrabbable_tD81A6B243534FF858FAEC2C510FF3072A9FB3900, ___ShowTetherWhenManipulating_4)); }
inline bool get_ShowTetherWhenManipulating_4() const { return ___ShowTetherWhenManipulating_4; }
inline bool* get_address_of_ShowTetherWhenManipulating_4() { return &___ShowTetherWhenManipulating_4; }
inline void set_ShowTetherWhenManipulating_4(bool value)
{
___ShowTetherWhenManipulating_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // NEARINTERACTIONGRABBABLE_TD81A6B243534FF858FAEC2C510FF3072A9FB3900_H
#ifndef SOURCEPOSEEVENTDATA_1_T4C0643D03C79FCACA7860F5CAD92D8DA685226A0_H
#define SOURCEPOSEEVENTDATA_1_T4C0643D03C79FCACA7860F5CAD92D8DA685226A0_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<Microsoft.MixedReality.Toolkit.TrackingState>
struct SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0 : public SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8
{
public:
// T Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1::<SourceData>k__BackingField
int32_t ___U3CSourceDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CSourceDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0, ___U3CSourceDataU3Ek__BackingField_6)); }
inline int32_t get_U3CSourceDataU3Ek__BackingField_6() const { return ___U3CSourceDataU3Ek__BackingField_6; }
inline int32_t* get_address_of_U3CSourceDataU3Ek__BackingField_6() { return &___U3CSourceDataU3Ek__BackingField_6; }
inline void set_U3CSourceDataU3Ek__BackingField_6(int32_t value)
{
___U3CSourceDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SOURCEPOSEEVENTDATA_1_T4C0643D03C79FCACA7860F5CAD92D8DA685226A0_H
#ifndef SOURCEPOSEEVENTDATA_1_T39109913E164F919B842401327DB9DED6E44AD49_H
#define SOURCEPOSEEVENTDATA_1_T39109913E164F919B842401327DB9DED6E44AD49_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>
struct SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49 : public SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8
{
public:
// T Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1::<SourceData>k__BackingField
MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 ___U3CSourceDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CSourceDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49, ___U3CSourceDataU3Ek__BackingField_6)); }
inline MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 get_U3CSourceDataU3Ek__BackingField_6() const { return ___U3CSourceDataU3Ek__BackingField_6; }
inline MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 * get_address_of_U3CSourceDataU3Ek__BackingField_6() { return &___U3CSourceDataU3Ek__BackingField_6; }
inline void set_U3CSourceDataU3Ek__BackingField_6(MixedRealityPose_t2DE3778479212DFF574AD14924DB9E7BA40BC9C0 value)
{
___U3CSourceDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SOURCEPOSEEVENTDATA_1_T39109913E164F919B842401327DB9DED6E44AD49_H
#ifndef SOURCEPOSEEVENTDATA_1_T6895A17818B45A4DB85DC17136AC2A38CAD40A03_H
#define SOURCEPOSEEVENTDATA_1_T6895A17818B45A4DB85DC17136AC2A38CAD40A03_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Quaternion>
struct SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03 : public SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8
{
public:
// T Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1::<SourceData>k__BackingField
Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 ___U3CSourceDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CSourceDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03, ___U3CSourceDataU3Ek__BackingField_6)); }
inline Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 get_U3CSourceDataU3Ek__BackingField_6() const { return ___U3CSourceDataU3Ek__BackingField_6; }
inline Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 * get_address_of_U3CSourceDataU3Ek__BackingField_6() { return &___U3CSourceDataU3Ek__BackingField_6; }
inline void set_U3CSourceDataU3Ek__BackingField_6(Quaternion_t319F3319A7D43FFA5D819AD6C0A98851F0095357 value)
{
___U3CSourceDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SOURCEPOSEEVENTDATA_1_T6895A17818B45A4DB85DC17136AC2A38CAD40A03_H
#ifndef SOURCEPOSEEVENTDATA_1_T1D77F21430CF5501B2A52F112FC979B403F84D5D_H
#define SOURCEPOSEEVENTDATA_1_T1D77F21430CF5501B2A52F112FC979B403F84D5D_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Vector2>
struct SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D : public SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8
{
public:
// T Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1::<SourceData>k__BackingField
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___U3CSourceDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CSourceDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D, ___U3CSourceDataU3Ek__BackingField_6)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_U3CSourceDataU3Ek__BackingField_6() const { return ___U3CSourceDataU3Ek__BackingField_6; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_U3CSourceDataU3Ek__BackingField_6() { return &___U3CSourceDataU3Ek__BackingField_6; }
inline void set_U3CSourceDataU3Ek__BackingField_6(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___U3CSourceDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SOURCEPOSEEVENTDATA_1_T1D77F21430CF5501B2A52F112FC979B403F84D5D_H
#ifndef SOURCEPOSEEVENTDATA_1_T5569ABB4A47BEDF1B4695B67855FDFABF090CF5C_H
#define SOURCEPOSEEVENTDATA_1_T5569ABB4A47BEDF1B4695B67855FDFABF090CF5C_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Vector3>
struct SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C : public SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8
{
public:
// T Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1::<SourceData>k__BackingField
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___U3CSourceDataU3Ek__BackingField_6;
public:
inline static int32_t get_offset_of_U3CSourceDataU3Ek__BackingField_6() { return static_cast<int32_t>(offsetof(SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C, ___U3CSourceDataU3Ek__BackingField_6)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_U3CSourceDataU3Ek__BackingField_6() const { return ___U3CSourceDataU3Ek__BackingField_6; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_U3CSourceDataU3Ek__BackingField_6() { return &___U3CSourceDataU3Ek__BackingField_6; }
inline void set_U3CSourceDataU3Ek__BackingField_6(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___U3CSourceDataU3Ek__BackingField_6 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SOURCEPOSEEVENTDATA_1_T5569ABB4A47BEDF1B4695B67855FDFABF090CF5C_H
#ifndef CANVASUTILITY_T508A947581A03B2B794E44C962978E95878694B8_H
#define CANVASUTILITY_T508A947581A03B2B794E44C962978E95878694B8_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility
struct CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8 : public MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429
{
public:
// System.Boolean Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility::oldIsTargetPositionLockedOnFocusLock
bool ___oldIsTargetPositionLockedOnFocusLock_4;
public:
inline static int32_t get_offset_of_oldIsTargetPositionLockedOnFocusLock_4() { return static_cast<int32_t>(offsetof(CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8, ___oldIsTargetPositionLockedOnFocusLock_4)); }
inline bool get_oldIsTargetPositionLockedOnFocusLock_4() const { return ___oldIsTargetPositionLockedOnFocusLock_4; }
inline bool* get_address_of_oldIsTargetPositionLockedOnFocusLock_4() { return &___oldIsTargetPositionLockedOnFocusLock_4; }
inline void set_oldIsTargetPositionLockedOnFocusLock_4(bool value)
{
___oldIsTargetPositionLockedOnFocusLock_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CANVASUTILITY_T508A947581A03B2B794E44C962978E95878694B8_H
#ifndef UIBEHAVIOUR_T3C3C339CD5677BA7FC27C352FED8B78052A3FE70_H
#define UIBEHAVIOUR_T3C3C339CD5677BA7FC27C352FED8B78052A3FE70_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.EventSystems.UIBehaviour
struct UIBehaviour_t3C3C339CD5677BA7FC27C352FED8B78052A3FE70 : public MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UIBEHAVIOUR_T3C3C339CD5677BA7FC27C352FED8B78052A3FE70_H
#ifndef HANDTRACKINGINPUTEVENTDATA_T90865462B8D5CBCCB3FD44D2E0548394F8002C71_H
#define HANDTRACKINGINPUTEVENTDATA_T90865462B8D5CBCCB3FD44D2E0548394F8002C71_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.HandTrackingInputEventData
struct HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 : public InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7
{
public:
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityController Microsoft.MixedReality.Toolkit.Input.HandTrackingInputEventData::<Controller>k__BackingField
RuntimeObject* ___U3CControllerU3Ek__BackingField_7;
public:
inline static int32_t get_offset_of_U3CControllerU3Ek__BackingField_7() { return static_cast<int32_t>(offsetof(HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71, ___U3CControllerU3Ek__BackingField_7)); }
inline RuntimeObject* get_U3CControllerU3Ek__BackingField_7() const { return ___U3CControllerU3Ek__BackingField_7; }
inline RuntimeObject** get_address_of_U3CControllerU3Ek__BackingField_7() { return &___U3CControllerU3Ek__BackingField_7; }
inline void set_U3CControllerU3Ek__BackingField_7(RuntimeObject* value)
{
___U3CControllerU3Ek__BackingField_7 = value;
Il2CppCodeGenWriteBarrier((&___U3CControllerU3Ek__BackingField_7), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // HANDTRACKINGINPUTEVENTDATA_T90865462B8D5CBCCB3FD44D2E0548394F8002C71_H
#ifndef NEARINTERACTIONTOUCHABLESURFACE_TA76CE06BC3E03D9BEAA234C28E2388D9F980D22C_H
#define NEARINTERACTIONTOUCHABLESURFACE_TA76CE06BC3E03D9BEAA234C28E2388D9F980D22C_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableSurface
struct NearInteractionTouchableSurface_tA76CE06BC3E03D9BEAA234C28E2388D9F980D22C : public BaseNearInteractionTouchable_t98D072EC4C522792850CE5A09BEE5F1CF9BFA19F
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // NEARINTERACTIONTOUCHABLESURFACE_TA76CE06BC3E03D9BEAA234C28E2388D9F980D22C_H
#ifndef NEARINTERACTIONTOUCHABLEVOLUME_T19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC_H
#define NEARINTERACTIONTOUCHABLEVOLUME_T19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume
struct NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC : public BaseNearInteractionTouchable_t98D072EC4C522792850CE5A09BEE5F1CF9BFA19F
{
public:
// UnityEngine.Collider Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume::touchableCollider
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * ___touchableCollider_6;
public:
inline static int32_t get_offset_of_touchableCollider_6() { return static_cast<int32_t>(offsetof(NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC, ___touchableCollider_6)); }
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * get_touchableCollider_6() const { return ___touchableCollider_6; }
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF ** get_address_of_touchableCollider_6() { return &___touchableCollider_6; }
inline void set_touchableCollider_6(Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * value)
{
___touchableCollider_6 = value;
Il2CppCodeGenWriteBarrier((&___touchableCollider_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // NEARINTERACTIONTOUCHABLEVOLUME_T19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC_H
#ifndef EVENTSYSTEM_T06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_H
#define EVENTSYSTEM_T06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.EventSystems.EventSystem
struct EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77 : public UIBehaviour_t3C3C339CD5677BA7FC27C352FED8B78052A3FE70
{
public:
// System.Collections.Generic.List`1<UnityEngine.EventSystems.BaseInputModule> UnityEngine.EventSystems.EventSystem::m_SystemInputModules
List_1_t1B3F60982C3189AF70B204EF3F19940A645EA02E * ___m_SystemInputModules_4;
// UnityEngine.EventSystems.BaseInputModule UnityEngine.EventSystems.EventSystem::m_CurrentInputModule
BaseInputModule_t904837FCFA79B6C3CED862FF85C9C5F8D6F32939 * ___m_CurrentInputModule_5;
// UnityEngine.GameObject UnityEngine.EventSystems.EventSystem::m_FirstSelected
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * ___m_FirstSelected_7;
// System.Boolean UnityEngine.EventSystems.EventSystem::m_sendNavigationEvents
bool ___m_sendNavigationEvents_8;
// System.Int32 UnityEngine.EventSystems.EventSystem::m_DragThreshold
int32_t ___m_DragThreshold_9;
// UnityEngine.GameObject UnityEngine.EventSystems.EventSystem::m_CurrentSelected
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * ___m_CurrentSelected_10;
// System.Boolean UnityEngine.EventSystems.EventSystem::m_HasFocus
bool ___m_HasFocus_11;
// System.Boolean UnityEngine.EventSystems.EventSystem::m_SelectionGuard
bool ___m_SelectionGuard_12;
// UnityEngine.EventSystems.BaseEventData UnityEngine.EventSystems.EventSystem::m_DummyData
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___m_DummyData_13;
public:
inline static int32_t get_offset_of_m_SystemInputModules_4() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_SystemInputModules_4)); }
inline List_1_t1B3F60982C3189AF70B204EF3F19940A645EA02E * get_m_SystemInputModules_4() const { return ___m_SystemInputModules_4; }
inline List_1_t1B3F60982C3189AF70B204EF3F19940A645EA02E ** get_address_of_m_SystemInputModules_4() { return &___m_SystemInputModules_4; }
inline void set_m_SystemInputModules_4(List_1_t1B3F60982C3189AF70B204EF3F19940A645EA02E * value)
{
___m_SystemInputModules_4 = value;
Il2CppCodeGenWriteBarrier((&___m_SystemInputModules_4), value);
}
inline static int32_t get_offset_of_m_CurrentInputModule_5() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_CurrentInputModule_5)); }
inline BaseInputModule_t904837FCFA79B6C3CED862FF85C9C5F8D6F32939 * get_m_CurrentInputModule_5() const { return ___m_CurrentInputModule_5; }
inline BaseInputModule_t904837FCFA79B6C3CED862FF85C9C5F8D6F32939 ** get_address_of_m_CurrentInputModule_5() { return &___m_CurrentInputModule_5; }
inline void set_m_CurrentInputModule_5(BaseInputModule_t904837FCFA79B6C3CED862FF85C9C5F8D6F32939 * value)
{
___m_CurrentInputModule_5 = value;
Il2CppCodeGenWriteBarrier((&___m_CurrentInputModule_5), value);
}
inline static int32_t get_offset_of_m_FirstSelected_7() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_FirstSelected_7)); }
inline GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * get_m_FirstSelected_7() const { return ___m_FirstSelected_7; }
inline GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F ** get_address_of_m_FirstSelected_7() { return &___m_FirstSelected_7; }
inline void set_m_FirstSelected_7(GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * value)
{
___m_FirstSelected_7 = value;
Il2CppCodeGenWriteBarrier((&___m_FirstSelected_7), value);
}
inline static int32_t get_offset_of_m_sendNavigationEvents_8() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_sendNavigationEvents_8)); }
inline bool get_m_sendNavigationEvents_8() const { return ___m_sendNavigationEvents_8; }
inline bool* get_address_of_m_sendNavigationEvents_8() { return &___m_sendNavigationEvents_8; }
inline void set_m_sendNavigationEvents_8(bool value)
{
___m_sendNavigationEvents_8 = value;
}
inline static int32_t get_offset_of_m_DragThreshold_9() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_DragThreshold_9)); }
inline int32_t get_m_DragThreshold_9() const { return ___m_DragThreshold_9; }
inline int32_t* get_address_of_m_DragThreshold_9() { return &___m_DragThreshold_9; }
inline void set_m_DragThreshold_9(int32_t value)
{
___m_DragThreshold_9 = value;
}
inline static int32_t get_offset_of_m_CurrentSelected_10() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_CurrentSelected_10)); }
inline GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * get_m_CurrentSelected_10() const { return ___m_CurrentSelected_10; }
inline GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F ** get_address_of_m_CurrentSelected_10() { return &___m_CurrentSelected_10; }
inline void set_m_CurrentSelected_10(GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * value)
{
___m_CurrentSelected_10 = value;
Il2CppCodeGenWriteBarrier((&___m_CurrentSelected_10), value);
}
inline static int32_t get_offset_of_m_HasFocus_11() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_HasFocus_11)); }
inline bool get_m_HasFocus_11() const { return ___m_HasFocus_11; }
inline bool* get_address_of_m_HasFocus_11() { return &___m_HasFocus_11; }
inline void set_m_HasFocus_11(bool value)
{
___m_HasFocus_11 = value;
}
inline static int32_t get_offset_of_m_SelectionGuard_12() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_SelectionGuard_12)); }
inline bool get_m_SelectionGuard_12() const { return ___m_SelectionGuard_12; }
inline bool* get_address_of_m_SelectionGuard_12() { return &___m_SelectionGuard_12; }
inline void set_m_SelectionGuard_12(bool value)
{
___m_SelectionGuard_12 = value;
}
inline static int32_t get_offset_of_m_DummyData_13() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77, ___m_DummyData_13)); }
inline BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * get_m_DummyData_13() const { return ___m_DummyData_13; }
inline BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 ** get_address_of_m_DummyData_13() { return &___m_DummyData_13; }
inline void set_m_DummyData_13(BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * value)
{
___m_DummyData_13 = value;
Il2CppCodeGenWriteBarrier((&___m_DummyData_13), value);
}
};
struct EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_StaticFields
{
public:
// System.Collections.Generic.List`1<UnityEngine.EventSystems.EventSystem> UnityEngine.EventSystems.EventSystem::m_EventSystems
List_1_tE4E9EE9F348ABAD1007C663DD77A14907CCD9A79 * ___m_EventSystems_6;
// System.Comparison`1<UnityEngine.EventSystems.RaycastResult> UnityEngine.EventSystems.EventSystem::s_RaycastComparer
Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133 * ___s_RaycastComparer_14;
// System.Comparison`1<UnityEngine.EventSystems.RaycastResult> UnityEngine.EventSystems.EventSystem::<>f__mgU24cache0
Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133 * ___U3CU3Ef__mgU24cache0_15;
public:
inline static int32_t get_offset_of_m_EventSystems_6() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_StaticFields, ___m_EventSystems_6)); }
inline List_1_tE4E9EE9F348ABAD1007C663DD77A14907CCD9A79 * get_m_EventSystems_6() const { return ___m_EventSystems_6; }
inline List_1_tE4E9EE9F348ABAD1007C663DD77A14907CCD9A79 ** get_address_of_m_EventSystems_6() { return &___m_EventSystems_6; }
inline void set_m_EventSystems_6(List_1_tE4E9EE9F348ABAD1007C663DD77A14907CCD9A79 * value)
{
___m_EventSystems_6 = value;
Il2CppCodeGenWriteBarrier((&___m_EventSystems_6), value);
}
inline static int32_t get_offset_of_s_RaycastComparer_14() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_StaticFields, ___s_RaycastComparer_14)); }
inline Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133 * get_s_RaycastComparer_14() const { return ___s_RaycastComparer_14; }
inline Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133 ** get_address_of_s_RaycastComparer_14() { return &___s_RaycastComparer_14; }
inline void set_s_RaycastComparer_14(Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133 * value)
{
___s_RaycastComparer_14 = value;
Il2CppCodeGenWriteBarrier((&___s_RaycastComparer_14), value);
}
inline static int32_t get_offset_of_U3CU3Ef__mgU24cache0_15() { return static_cast<int32_t>(offsetof(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_StaticFields, ___U3CU3Ef__mgU24cache0_15)); }
inline Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133 * get_U3CU3Ef__mgU24cache0_15() const { return ___U3CU3Ef__mgU24cache0_15; }
inline Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133 ** get_address_of_U3CU3Ef__mgU24cache0_15() { return &___U3CU3Ef__mgU24cache0_15; }
inline void set_U3CU3Ef__mgU24cache0_15(Comparison_1_t4D475DF6B74D5F54D62457E778F621F81C595133 * value)
{
___U3CU3Ef__mgU24cache0_15 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__mgU24cache0_15), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // EVENTSYSTEM_T06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_H
#ifndef BASEMESHEFFECT_T72759F31F9D204D7EFB6B45097873809D4524BA5_H
#define BASEMESHEFFECT_T72759F31F9D204D7EFB6B45097873809D4524BA5_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.BaseMeshEffect
struct BaseMeshEffect_t72759F31F9D204D7EFB6B45097873809D4524BA5 : public UIBehaviour_t3C3C339CD5677BA7FC27C352FED8B78052A3FE70
{
public:
// UnityEngine.UI.Graphic UnityEngine.UI.BaseMeshEffect::m_Graphic
Graphic_tBA2C3EF11D3DAEBB57F6879AB0BB4F8BD40D00D8 * ___m_Graphic_4;
public:
inline static int32_t get_offset_of_m_Graphic_4() { return static_cast<int32_t>(offsetof(BaseMeshEffect_t72759F31F9D204D7EFB6B45097873809D4524BA5, ___m_Graphic_4)); }
inline Graphic_tBA2C3EF11D3DAEBB57F6879AB0BB4F8BD40D00D8 * get_m_Graphic_4() const { return ___m_Graphic_4; }
inline Graphic_tBA2C3EF11D3DAEBB57F6879AB0BB4F8BD40D00D8 ** get_address_of_m_Graphic_4() { return &___m_Graphic_4; }
inline void set_m_Graphic_4(Graphic_tBA2C3EF11D3DAEBB57F6879AB0BB4F8BD40D00D8 * value)
{
___m_Graphic_4 = value;
Il2CppCodeGenWriteBarrier((&___m_Graphic_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BASEMESHEFFECT_T72759F31F9D204D7EFB6B45097873809D4524BA5_H
#ifndef NEARINTERACTIONTOUCHABLE_TD54B757F38E2975DC793EC712A2D6A9AC1DB02C6_H
#define NEARINTERACTIONTOUCHABLE_TD54B757F38E2975DC793EC712A2D6A9AC1DB02C6_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable
struct NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 : public NearInteractionTouchableSurface_tA76CE06BC3E03D9BEAA234C28E2388D9F980D22C
{
public:
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::localForward
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___localForward_6;
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::localUp
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___localUp_7;
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::localCenter
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___localCenter_8;
// UnityEngine.Vector2 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::bounds
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___bounds_9;
// UnityEngine.Collider Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::touchableCollider
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * ___touchableCollider_10;
public:
inline static int32_t get_offset_of_localForward_6() { return static_cast<int32_t>(offsetof(NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6, ___localForward_6)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_localForward_6() const { return ___localForward_6; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_localForward_6() { return &___localForward_6; }
inline void set_localForward_6(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___localForward_6 = value;
}
inline static int32_t get_offset_of_localUp_7() { return static_cast<int32_t>(offsetof(NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6, ___localUp_7)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_localUp_7() const { return ___localUp_7; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_localUp_7() { return &___localUp_7; }
inline void set_localUp_7(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___localUp_7 = value;
}
inline static int32_t get_offset_of_localCenter_8() { return static_cast<int32_t>(offsetof(NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6, ___localCenter_8)); }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 get_localCenter_8() const { return ___localCenter_8; }
inline Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * get_address_of_localCenter_8() { return &___localCenter_8; }
inline void set_localCenter_8(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 value)
{
___localCenter_8 = value;
}
inline static int32_t get_offset_of_bounds_9() { return static_cast<int32_t>(offsetof(NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6, ___bounds_9)); }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D get_bounds_9() const { return ___bounds_9; }
inline Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * get_address_of_bounds_9() { return &___bounds_9; }
inline void set_bounds_9(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D value)
{
___bounds_9 = value;
}
inline static int32_t get_offset_of_touchableCollider_10() { return static_cast<int32_t>(offsetof(NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6, ___touchableCollider_10)); }
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * get_touchableCollider_10() const { return ___touchableCollider_10; }
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF ** get_address_of_touchableCollider_10() { return &___touchableCollider_10; }
inline void set_touchableCollider_10(Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * value)
{
___touchableCollider_10 = value;
Il2CppCodeGenWriteBarrier((&___touchableCollider_10), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // NEARINTERACTIONTOUCHABLE_TD54B757F38E2975DC793EC712A2D6A9AC1DB02C6_H
#ifndef NEARINTERACTIONTOUCHABLEUNITYUI_T30E293F7578C91E816E53312344277043BF22B70_H
#define NEARINTERACTIONTOUCHABLEUNITYUI_T30E293F7578C91E816E53312344277043BF22B70_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI
struct NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 : public NearInteractionTouchableSurface_tA76CE06BC3E03D9BEAA234C28E2388D9F980D22C
{
public:
// System.Lazy`1<UnityEngine.RectTransform> Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::rectTransform
Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 * ___rectTransform_6;
public:
inline static int32_t get_offset_of_rectTransform_6() { return static_cast<int32_t>(offsetof(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70, ___rectTransform_6)); }
inline Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 * get_rectTransform_6() const { return ___rectTransform_6; }
inline Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 ** get_address_of_rectTransform_6() { return &___rectTransform_6; }
inline void set_rectTransform_6(Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 * value)
{
___rectTransform_6 = value;
Il2CppCodeGenWriteBarrier((&___rectTransform_6), value);
}
};
struct NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_StaticFields
{
public:
// System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI> Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::instances
List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * ___instances_7;
public:
inline static int32_t get_offset_of_instances_7() { return static_cast<int32_t>(offsetof(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_StaticFields, ___instances_7)); }
inline List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * get_instances_7() const { return ___instances_7; }
inline List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 ** get_address_of_instances_7() { return &___instances_7; }
inline void set_instances_7(List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * value)
{
___instances_7 = value;
Il2CppCodeGenWriteBarrier((&___instances_7), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // NEARINTERACTIONTOUCHABLEUNITYUI_T30E293F7578C91E816E53312344277043BF22B70_H
#ifndef SCALEMESHEFFECT_T7A2D331EF3DD56FFA4816FAC032438EBA1C77ADB_H
#define SCALEMESHEFFECT_T7A2D331EF3DD56FFA4816FAC032438EBA1C77ADB_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Microsoft.MixedReality.Toolkit.Input.Utilities.ScaleMeshEffect
struct ScaleMeshEffect_t7A2D331EF3DD56FFA4816FAC032438EBA1C77ADB : public BaseMeshEffect_t72759F31F9D204D7EFB6B45097873809D4524BA5
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCALEMESHEFFECT_T7A2D331EF3DD56FFA4816FAC032438EBA1C77ADB_H
// UnityEngine.Collider[]
struct ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252 : public RuntimeArray
{
public:
ALIGN_FIELD (8) Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * m_Items[1];
public:
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF ** GetAddressAt(il2cpp_array_size_t index)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items + index;
}
inline void SetAt(il2cpp_array_size_t index, Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
Il2CppCodeGenWriteBarrier(m_Items + index, value);
}
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF ** GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * value)
{
m_Items[index] = value;
Il2CppCodeGenWriteBarrier(m_Items + index, value);
}
};
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<System.Object>(UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR RuntimeObject * ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method);
// !!0[] UnityEngine.GameObject::GetComponents<System.Object>()
extern "C" IL2CPP_METHOD_ATTR ObjectU5BU5D_t3C9242B5C88A48B2A5BD9FDA6CD0024E792AF08A* GameObject_GetComponents_TisRuntimeObject_mAB5B62A0C9EF4405B4E20D13F3CD7BC06A96FD40_gshared (GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * __this, const RuntimeMethod* method);
// !!0 UnityEngine.Component::GetComponent<System.Object>()
extern "C" IL2CPP_METHOD_ATTR RuntimeObject * Component_GetComponent_TisRuntimeObject_m3FED1FF44F93EF1C3A07526800331B638EF4105B_gshared (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 * __this, const RuntimeMethod* method);
// System.Void System.Func`3<System.Object,System.Object,System.Object>::.ctor(System.Object,System.IntPtr)
extern "C" IL2CPP_METHOD_ATTR void Func_3__ctor_mDCF191A98C4C31CEBD4FAD60551C0B4EA244E1A8_gshared (Func_3_t0875D079514B9064DE951B01B4AE82F6C7436F64 * __this, RuntimeObject * p0, intptr_t p1, const RuntimeMethod* method);
// !!1 System.Linq.Enumerable::Aggregate<System.Object,System.Object>(System.Collections.Generic.IEnumerable`1<!!0>,!!1,System.Func`3<!!1,!!0,!!1>)
extern "C" IL2CPP_METHOD_ATTR RuntimeObject * Enumerable_Aggregate_TisRuntimeObject_TisRuntimeObject_m02A8F6B86926DB4F23EC36B2784F1FB1BD71E152_gshared (RuntimeObject* p0, RuntimeObject * p1, Func_3_t0875D079514B9064DE951B01B4AE82F6C7436F64 * p2, const RuntimeMethod* method);
// !0 System.Lazy`1<System.Object>::get_Value()
extern "C" IL2CPP_METHOD_ATTR RuntimeObject * Lazy_1_get_Value_m4504005FE52CBECE0030A1F7128DE56DB39A039B_gshared (Lazy_1_t92A126CCE029B74D0EEE290FE6903CF042F9BA1C * __this, const RuntimeMethod* method);
// System.Void System.Func`1<System.Object>::.ctor(System.Object,System.IntPtr)
extern "C" IL2CPP_METHOD_ATTR void Func_1__ctor_mE02699FC76D830943069F8FC19D16C3B72A98A1F_gshared (Func_1_t59BE545225A69AFD7B2056D169D0083051F6D386 * __this, RuntimeObject * p0, intptr_t p1, const RuntimeMethod* method);
// System.Void System.Lazy`1<System.Object>::.ctor(System.Func`1<!0>)
extern "C" IL2CPP_METHOD_ATTR void Lazy_1__ctor_m88DC17B8635C8B9D758DA9E2FCC60EBC085F54D3_gshared (Lazy_1_t92A126CCE029B74D0EEE290FE6903CF042F9BA1C * __this, Func_1_t59BE545225A69AFD7B2056D169D0083051F6D386 * p0, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<System.Object>::Add(!0)
extern "C" IL2CPP_METHOD_ATTR void List_1_Add_m6930161974C7504C80F52EC379EF012387D43138_gshared (List_1_t05CC3C859AB5E6024394EF9A42E3E696628CA02D * __this, RuntimeObject * p0, const RuntimeMethod* method);
// System.Boolean System.Collections.Generic.List`1<System.Object>::Remove(!0)
extern "C" IL2CPP_METHOD_ATTR bool List_1_Remove_m908B647BB9F807676DACE34E3E73475C3C3751D4_gshared (List_1_t05CC3C859AB5E6024394EF9A42E3E696628CA02D * __this, RuntimeObject * p0, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<System.Object>::.ctor()
extern "C" IL2CPP_METHOD_ATTR void List_1__ctor_mC832F1AC0F814BAEB19175F5D7972A7507508BC3_gshared (List_1_t05CC3C859AB5E6024394EF9A42E3E696628CA02D * __this, const RuntimeMethod* method);
// !!0 UnityEngine.Component::GetComponentInParent<System.Object>()
extern "C" IL2CPP_METHOD_ATTR RuntimeObject * Component_GetComponentInParent_TisRuntimeObject_m36052D294AB8C1574678FEF9A9749145A073E8E3_gshared (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 * __this, const RuntimeMethod* method);
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem/<>c::.ctor()
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec__ctor_m5B9C0A2C0759CED7E65E89CC46B6F9F5A286E819 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, const RuntimeMethod* method);
// System.Void System.Object::.ctor()
extern "C" IL2CPP_METHOD_ATTR void Object__ctor_m925ECA5E85CA100E3FB86A4F9E15C120E9A184C0 (RuntimeObject * __this, const RuntimeMethod* method);
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.SourceStateEventData>(UnityEngine.EventSystems.BaseEventData)
inline SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * ExecuteEvents_ValidateEventData_TisSourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8_m5D5A6C5E00218E6FC96B27734982739E5249A511 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<Microsoft.MixedReality.Toolkit.TrackingState>>(UnityEngine.EventSystems.BaseEventData)
inline SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0 * ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0_m4B7AD1B7B87D73F1188C157F57AE9B4E94EBFAF9 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Vector2>>(UnityEngine.EventSystems.BaseEventData)
inline SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D * ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D_m44A4310CBC45912A0D3E0A63483F35FB60650D81 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Vector3>>(UnityEngine.EventSystems.BaseEventData)
inline SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C * ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C_m3317F6C9A5A5ABDA63707BC2DA6CE9F26BC3CFA8 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Quaternion>>(UnityEngine.EventSystems.BaseEventData)
inline SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03 * ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03_m72C57EC69E981C3576A50280BE05CFF1DCF317FD (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>>(UnityEngine.EventSystems.BaseEventData)
inline SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49 * ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49_m88CC794B89C460471E5AE81E6830AE54263E9EE6 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.FocusEventData>(UnityEngine.EventSystems.BaseEventData)
inline FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData>(UnityEngine.EventSystems.BaseEventData)
inline MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.InputEventData>(UnityEngine.EventSystems.BaseEventData)
inline InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.InputEventData`1<System.Single>>(UnityEngine.EventSystems.BaseEventData)
inline InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08 * ExecuteEvents_ValidateEventData_TisInputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08_m732B746D0B59264901C76698B24E9F4FC6507D60 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Vector2>>(UnityEngine.EventSystems.BaseEventData)
inline InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * ExecuteEvents_ValidateEventData_TisInputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_mE0EAE75FDABCF1F6D6CA42B92EB601C5AFB734AC (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Vector3>>(UnityEngine.EventSystems.BaseEventData)
inline InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * ExecuteEvents_ValidateEventData_TisInputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7_m097E52341D124B63ACF286F3B3DA74AFE301578D (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.InputEventData`1<UnityEngine.Quaternion>>(UnityEngine.EventSystems.BaseEventData)
inline InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * ExecuteEvents_ValidateEventData_TisInputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F_m81B085BAD6E32F7D0F68DD7866400B8B63586937 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.InputEventData`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>>(UnityEngine.EventSystems.BaseEventData)
inline InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * ExecuteEvents_ValidateEventData_TisInputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190_mE6BDBCA0445EA7137E8EF7AD8EA49F4BD2335E01 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.SpeechEventData>(UnityEngine.EventSystems.BaseEventData)
inline SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * ExecuteEvents_ValidateEventData_TisSpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D_m3E405F175CBD8D8F021FDCC766B6153A42F14FED (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.DictationEventData>(UnityEngine.EventSystems.BaseEventData)
inline DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.InputEventData`1<System.Collections.Generic.IDictionary`2<Microsoft.MixedReality.Toolkit.Utilities.TrackedHandJoint,Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>>>(UnityEngine.EventSystems.BaseEventData)
inline InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A * ExecuteEvents_ValidateEventData_TisInputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A_m3664034B4BB2FCF6FE77D0592A334D57A9E704E0 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.InputEventData`1<Microsoft.MixedReality.Toolkit.Input.HandMeshInfo>>(UnityEngine.EventSystems.BaseEventData)
inline InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF * ExecuteEvents_ValidateEventData_TisInputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF_mB181D6A143D8E73CA2CA55F794B9C3D30F65ED9F (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// !!0 UnityEngine.EventSystems.ExecuteEvents::ValidateEventData<Microsoft.MixedReality.Toolkit.Input.HandTrackingInputEventData>(UnityEngine.EventSystems.BaseEventData)
inline HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * ExecuteEvents_ValidateEventData_TisHandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71_m3D0E4D7521F0B7FFF71F919CEC166F6090896203 (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * p0, const RuntimeMethod* method)
{
return (( HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * (*) (BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 *, const RuntimeMethod*))ExecuteEvents_ValidateEventData_TisRuntimeObject_m5B436B848D80B3DA7931E611A9AAE2428E5DA8DA_gshared)(p0, method);
}
// UnityEngine.GameObject UnityEngine.Component::get_gameObject()
extern "C" IL2CPP_METHOD_ATTR GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * Component_get_gameObject_m0B0570BA8DDD3CD78A9DB568EA18D7317686603C (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 * __this, const RuntimeMethod* method);
// !!0[] UnityEngine.GameObject::GetComponents<UnityEngine.Collider>()
inline ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252* GameObject_GetComponents_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m64C7FCDEB0A941ED4C9306B2F467C13D69BBF8C1 (GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * __this, const RuntimeMethod* method)
{
return (( ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252* (*) (GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F *, const RuntimeMethod*))GameObject_GetComponents_TisRuntimeObject_mAB5B62A0C9EF4405B4E20D13F3CD7BC06A96FD40_gshared)(__this, method);
}
// System.Boolean UnityEngine.MeshCollider::get_convex()
extern "C" IL2CPP_METHOD_ATTR bool MeshCollider_get_convex_mAA9801A31A512288CE0705E56596D836FC73E64A (MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Debug::LogError(System.Object)
extern "C" IL2CPP_METHOD_ATTR void Debug_LogError_m3BCF9B78263152261565DCA9DB7D55F0C391ED29 (RuntimeObject * p0, const RuntimeMethod* method);
// System.Void UnityEngine.MonoBehaviour::.ctor()
extern "C" IL2CPP_METHOD_ATTR void MonoBehaviour__ctor_mEAEC84B222C60319D593E456D769B3311DFCEF97 (MonoBehaviour_t4A60845CF505405AF8BE8C61CC07F75CADEF6429 * __this, const RuntimeMethod* method);
// System.Single UnityEngine.Vector3::Dot(UnityEngine.Vector3,UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR float Vector3_Dot_m0C530E1C51278DE28B77906D56356506232272C1 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p1, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::Cross(UnityEngine.Vector3,UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_Cross_m3E9DBC445228FDB850BDBB4B01D6F61AC0111887 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p1, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::get_zero()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_get_zero_m3CDDCAE94581DF3BB16C4B40A100E28E9C6649C2 (const RuntimeMethod* method);
// System.Boolean UnityEngine.Vector3::op_Equality(UnityEngine.Vector3,UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR bool Vector3_op_Equality_mA9E2F96E98E71AE7ACCE74766D700D41F0404806 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p1, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::get_right()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_get_right_m6DD9559CA0C75BBA42D9140021C4C2A9AAA9B3F5 (const RuntimeMethod* method);
// UnityEngine.Transform UnityEngine.Component::get_transform()
extern "C" IL2CPP_METHOD_ATTR Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9 (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Transform::TransformDirection(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Transform_TransformDirection_m85FC1D7E1322E94F65DA59AEF3B1166850B183EF (Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::op_UnaryNegation(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_op_UnaryNegation_m2AFBBF22801F9BCA5A4EBE642A29F433FE1339C2 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, const RuntimeMethod* method);
// System.Boolean UnityEngine.Collider::get_enabled()
extern "C" IL2CPP_METHOD_ATTR bool Collider_get_enabled_mED644D98C6AC2DF95BD86145E8D31AD7081C76EB (Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.GameObject::get_activeInHierarchy()
extern "C" IL2CPP_METHOD_ATTR bool GameObject_get_activeInHierarchy_mDEE60F1B28281974BA9880EC448682F3DAABB1EF (GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.Application::get_isPlaying()
extern "C" IL2CPP_METHOD_ATTR bool Application_get_isPlaying_mF43B519662E7433DD90D883E5AE22EC3CFB65CA5 (const RuntimeMethod* method);
// System.Void Microsoft.MixedReality.Toolkit.Input.BaseNearInteractionTouchable::OnValidate()
extern "C" IL2CPP_METHOD_ATTR void BaseNearInteractionTouchable_OnValidate_mB0870F6834D1D27AF40A4ABA88A9908421FA0D86 (BaseNearInteractionTouchable_t98D072EC4C522792850CE5A09BEE5F1CF9BFA19F * __this, const RuntimeMethod* method);
// !!0 UnityEngine.Component::GetComponent<UnityEngine.Collider>()
inline Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * Component_GetComponent_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m6B8E8E0E0AF6B08652B81B7950FC5AF63EAD40C6 (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 * __this, const RuntimeMethod* method)
{
return (( Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * (*) (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 *, const RuntimeMethod*))Component_GetComponent_TisRuntimeObject_m3FED1FF44F93EF1C3A07526800331B638EF4105B_gshared)(__this, method);
}
// UnityEngine.Transform UnityEngine.GameObject::get_transform()
extern "C" IL2CPP_METHOD_ATTR Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * GameObject_get_transform_mA5C38857137F137CB96C69FAA624199EB1C2FB2C (GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * __this, const RuntimeMethod* method);
// System.Collections.Generic.IEnumerable`1<UnityEngine.Transform> Microsoft.MixedReality.Toolkit.TransformExtensions::EnumerateAncestors(UnityEngine.Transform,System.Boolean)
extern "C" IL2CPP_METHOD_ATTR RuntimeObject* TransformExtensions_EnumerateAncestors_m0BBFB95BF7AD93230EDB9861754A7B2161DF7EF8 (Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * p0, bool p1, const RuntimeMethod* method);
// System.Void System.Func`3<System.String,UnityEngine.Transform,System.String>::.ctor(System.Object,System.IntPtr)
inline void Func_3__ctor_m0D8C1007F600903496B78C6ECE280BA3B092E0AB (Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * __this, RuntimeObject * p0, intptr_t p1, const RuntimeMethod* method)
{
(( void (*) (Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 *, RuntimeObject *, intptr_t, const RuntimeMethod*))Func_3__ctor_mDCF191A98C4C31CEBD4FAD60551C0B4EA244E1A8_gshared)(__this, p0, p1, method);
}
// !!1 System.Linq.Enumerable::Aggregate<UnityEngine.Transform,System.String>(System.Collections.Generic.IEnumerable`1<!!0>,!!1,System.Func`3<!!1,!!0,!!1>)
inline String_t* Enumerable_Aggregate_TisTransform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA_TisString_t_mDBB0A69F0AC196B0AE6D937BDDE7DE0543598AAF (RuntimeObject* p0, String_t* p1, Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * p2, const RuntimeMethod* method)
{
return (( String_t* (*) (RuntimeObject*, String_t*, Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 *, const RuntimeMethod*))Enumerable_Aggregate_TisRuntimeObject_TisRuntimeObject_m02A8F6B86926DB4F23EC36B2784F1FB1BD71E152_gshared)(p0, p1, p2, method);
}
// System.Single UnityEngine.Vector3::get_sqrMagnitude()
extern "C" IL2CPP_METHOD_ATTR float Vector3_get_sqrMagnitude_m1C6E190B4A933A183B308736DEC0DD64B0588968 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::get_normalized()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_get_normalized_mE20796F1D2D36244FACD4D14DADB245BE579849B (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * __this, const RuntimeMethod* method);
// System.Single UnityEngine.Mathf::Max(System.Single,System.Single)
extern "C" IL2CPP_METHOD_ATTR float Mathf_Max_m670AE0EC1B09ED1A56FF9606B0F954670319CB65 (float p0, float p1, const RuntimeMethod* method);
// System.Boolean UnityEngine.Object::op_Equality(UnityEngine.Object,UnityEngine.Object)
extern "C" IL2CPP_METHOD_ATTR bool Object_op_Equality_mBC2401774F3BE33E8CF6F0A8148E66C95D6CFF1C (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 * p0, Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 * p1, const RuntimeMethod* method);
// !!0 UnityEngine.Component::GetComponent<UnityEngine.BoxCollider>()
inline BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * Component_GetComponent_TisBoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_m81892AA8DC35D8BB06288E5A4C16CF366174953E (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 * __this, const RuntimeMethod* method)
{
return (( BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * (*) (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 *, const RuntimeMethod*))Component_GetComponent_TisRuntimeObject_m3FED1FF44F93EF1C3A07526800331B638EF4105B_gshared)(__this, method);
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetTouchableCollider(UnityEngine.BoxCollider)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetTouchableCollider_mB65CD4B430EC4A349EBB784B880A1B74338EFA7C (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * ___newCollider0, const RuntimeMethod* method);
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_LocalRight()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_LocalRight_mFC9863CB3DE0A6D313338A0EE41C55FEDE62CAFA (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.Object::op_Inequality(UnityEngine.Object,UnityEngine.Object)
extern "C" IL2CPP_METHOD_ATTR bool Object_op_Inequality_m31EF58E217E8F4BDD3E409DEF79E1AEE95874FC1 (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 * p0, Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 * p1, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::get_forward()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_get_forward_m3E2E192B3302130098738C308FA1EE1439449D0D (const RuntimeMethod* method);
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetLocalForward(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetLocalForward_mFFEFB910719A23348845F464101E0B58C4D074A2 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___newLocalForward0, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.BoxCollider::get_size()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 BoxCollider_get_size_m1C7DA815D3BA9DDB3D92A58BEEFE2FCBA5206FE2 (BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_LocalUp()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_LocalUp_mA12848F9601BFEF5CEE01600C128A5496FF3D91E (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Vector2::.ctor(System.Single,System.Single)
extern "C" IL2CPP_METHOD_ATTR void Vector2__ctor_mEE8FB117AB1F8DB746FB8B3EB4C0DA3BF2A230D0 (Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * __this, float p0, float p1, const RuntimeMethod* method);
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetBounds(UnityEngine.Vector2)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetBounds_mE28573D386ACCF366D119BE293A48198C42894BC (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___newBounds0, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.BoxCollider::get_center()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 BoxCollider_get_center_mA9164B9949F419A35CC949685F1DC14588BC6402 (BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::op_Division(UnityEngine.Vector3,System.Single)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_op_Division_mDF34F1CC445981B4D1137765BC6277419E561624 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, float p1, const RuntimeMethod* method);
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_LocalForward()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_LocalForward_m051017BDD802785A576C5DAD40D69919945D68C6 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::Scale(UnityEngine.Vector3,UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_Scale_m77004B226483C7644B3F4A46B950589EE8F88775 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p1, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::op_Addition(UnityEngine.Vector3,UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_op_Addition_m929F9C17E5D11B94D50B4AFF1D730B70CB59B50E (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p1, const RuntimeMethod* method);
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetLocalCenter(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetLocalCenter_mEA407BD05175F0BDA1F437D2D30EC9EAC659D99F (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___newLocalCenter0, const RuntimeMethod* method);
// System.Void UnityEngine.BoxCollider::set_size(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR void BoxCollider_set_size_m65F9B4BD610D3094313EC8D1C5CE58D1D345A176 (BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, const RuntimeMethod* method);
// System.Void UnityEngine.BoxCollider::set_center(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR void BoxCollider_set_center_m8A871056CA383C9932A7694FE396A1EFA247FC69 (BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, const RuntimeMethod* method);
// System.Void UnityEngine.Debug::LogWarning(System.Object)
extern "C" IL2CPP_METHOD_ATTR void Debug_LogWarning_m37338644DC81F640CCDFEAE35A223F0E965F0568 (RuntimeObject * p0, const RuntimeMethod* method);
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_Forward()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_Forward_m5CEE4412F619AAF894FAF4129E29029BDDD653E7 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Transform::InverseTransformPoint(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Transform_InverseTransformPoint_mB6E3145F20B531B4A781C194BAC43A8255C96C47 (Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::op_Subtraction(UnityEngine.Vector3,UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_op_Subtraction_mF9846B723A5034F8B9F5F5DCB78E3D67649143D3 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p1, const RuntimeMethod* method);
// System.Void UnityEngine.Vector3::.ctor(System.Single,System.Single,System.Single)
extern "C" IL2CPP_METHOD_ATTR void Vector3__ctor_m08F61F548AA5836D8789843ACB4A81E4963D2EE1 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * __this, float p0, float p1, float p2, const RuntimeMethod* method);
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.TransformExtensions::TransformSize(UnityEngine.Transform,UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 TransformExtensions_TransformSize_m7D4944A998F0328A3C481C4CB7D4071B66C6C9FC (Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * p0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p1, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Vector3::get_up()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Vector3_get_up_m6309EBC4E42D6D0B3D28056BD23D0331275306F7 (const RuntimeMethod* method);
// UnityEngine.Vector2 UnityEngine.Vector2::get_zero()
extern "C" IL2CPP_METHOD_ATTR Vector2_tA85D2DD88578276CA8A8796756458277E72D073D Vector2_get_zero_mFE0C3213BB698130D6C5247AB4B887A59074D0A8 (const RuntimeMethod* method);
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableSurface::.ctor()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchableSurface__ctor_m0652A9DE8ABF997A9B54E152DE88CC6B236B7467 (NearInteractionTouchableSurface_tA76CE06BC3E03D9BEAA234C28E2388D9F980D22C * __this, const RuntimeMethod* method);
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable/<>c::.ctor()
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec__ctor_m99D33C029D09150A6801E738B35164BD71094240 (U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F * __this, const RuntimeMethod* method);
// System.String UnityEngine.Object::get_name()
extern "C" IL2CPP_METHOD_ATTR String_t* Object_get_name_mA2D400141CB3C991C87A2556429781DE961A83CE (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 * __this, const RuntimeMethod* method);
// System.String System.String::Concat(System.String,System.String,System.String)
extern "C" IL2CPP_METHOD_ATTR String_t* String_Concat_mF4626905368D6558695A823466A1AF65EADB9923 (String_t* p0, String_t* p1, String_t* p2, const RuntimeMethod* method);
// System.Void Microsoft.MixedReality.Toolkit.Input.BaseNearInteractionTouchable::.ctor()
extern "C" IL2CPP_METHOD_ATTR void BaseNearInteractionTouchable__ctor_m635FAE023CB66064C86C6B0B48CE5D1B3869D5E9 (BaseNearInteractionTouchable_t98D072EC4C522792850CE5A09BEE5F1CF9BFA19F * __this, const RuntimeMethod* method);
// !0 System.Lazy`1<UnityEngine.RectTransform>::get_Value()
inline RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * Lazy_1_get_Value_m14285D8A1AD14C080ED2D95FACA7366ED99FE4F2 (Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 * __this, const RuntimeMethod* method)
{
return (( RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * (*) (Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 *, const RuntimeMethod*))Lazy_1_get_Value_m4504005FE52CBECE0030A1F7128DE56DB39A039B_gshared)(__this, method);
}
// UnityEngine.Rect UnityEngine.RectTransform::get_rect()
extern "C" IL2CPP_METHOD_ATTR Rect_t35B976DE901B5423C11705E156938EA27AB402CE RectTransform_get_rect_mE5F283FCB99A66403AC1F0607CA49C156D73A15E (RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * __this, const RuntimeMethod* method);
// UnityEngine.Vector2 UnityEngine.Rect::get_size()
extern "C" IL2CPP_METHOD_ATTR Vector2_tA85D2DD88578276CA8A8796756458277E72D073D Rect_get_size_m731642B8F03F6CE372A2C9E2E4A925450630606C (Rect_t35B976DE901B5423C11705E156938EA27AB402CE * __this, const RuntimeMethod* method);
// System.Void System.Func`1<UnityEngine.RectTransform>::.ctor(System.Object,System.IntPtr)
inline void Func_1__ctor_m9CD37EDF32B1025161B21189308A89FBCB3D31D0 (Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * __this, RuntimeObject * p0, intptr_t p1, const RuntimeMethod* method)
{
(( void (*) (Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC *, RuntimeObject *, intptr_t, const RuntimeMethod*))Func_1__ctor_mE02699FC76D830943069F8FC19D16C3B72A98A1F_gshared)(__this, p0, p1, method);
}
// System.Void System.Lazy`1<UnityEngine.RectTransform>::.ctor(System.Func`1<!0>)
inline void Lazy_1__ctor_mB678E6E7BEB0C87364A66EF9597E7546BAC3632B (Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 * __this, Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * p0, const RuntimeMethod* method)
{
(( void (*) (Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 *, Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC *, const RuntimeMethod*))Lazy_1__ctor_m88DC17B8635C8B9D758DA9E2FCC60EBC085F54D3_gshared)(__this, p0, method);
}
// System.Boolean UnityEngine.Rect::Contains(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR bool Rect_Contains_m5072228CE6251E7C754F227BA330F9ADA95C1495 (Rect_t35B976DE901B5423C11705E156938EA27AB402CE * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI>::Add(!0)
inline void List_1_Add_m51E390D6AAE28EDE48EB34922D24A6486E79301E (List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * __this, NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * p0, const RuntimeMethod* method)
{
(( void (*) (List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 *, NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 *, const RuntimeMethod*))List_1_Add_m6930161974C7504C80F52EC379EF012387D43138_gshared)(__this, p0, method);
}
// System.Boolean System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI>::Remove(!0)
inline bool List_1_Remove_mF5E9EF3C7DDB6497E7DD976562DCAAB5D04B7009 (List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * __this, NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * p0, const RuntimeMethod* method)
{
return (( bool (*) (List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 *, NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 *, const RuntimeMethod*))List_1_Remove_m908B647BB9F807676DACE34E3E73475C3C3751D4_gshared)(__this, p0, method);
}
// System.Void System.Collections.Generic.List`1<Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI>::.ctor()
inline void List_1__ctor_m74736E94D5684A6D227C7CD74E8C331636A65A5A (List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * __this, const RuntimeMethod* method)
{
(( void (*) (List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 *, const RuntimeMethod*))List_1__ctor_mC832F1AC0F814BAEB19175F5D7972A7507508BC3_gshared)(__this, method);
}
// UnityEngine.Collider Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume::get_TouchableCollider()
extern "C" IL2CPP_METHOD_ATTR Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * NearInteractionTouchableVolume_get_TouchableCollider_mC7B24E276AE648A232360ADC24F9CD1FE04A37D3 (NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Collider::ClosestPoint(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Collider_ClosestPoint_mA3CF53B6EE9CEEDB3BF2BCCE19E511CA659672B7 (Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 p0, const RuntimeMethod* method);
// UnityEngine.Bounds UnityEngine.Collider::get_bounds()
extern "C" IL2CPP_METHOD_ATTR Bounds_tA2716F5212749C61B0E7B7B77E0CD3D79B742890 Collider_get_bounds_mD3CB68E38FB998406193A88D18C01F510272058A (Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Bounds::get_center()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Bounds_get_center_m4FB6E99F0533EE2D432988B08474D6DC9B8B744B (Bounds_tA2716F5212749C61B0E7B7B77E0CD3D79B742890 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Vector3::Normalize()
extern "C" IL2CPP_METHOD_ATTR void Vector3_Normalize_m174460238EC6322B9095A378AA8624B1DD9000F3 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * __this, const RuntimeMethod* method);
// System.Single UnityEngine.Vector3::get_magnitude()
extern "C" IL2CPP_METHOD_ATTR float Vector3_get_magnitude_m9A750659B60C5FE0C30438A7F9681775D5DB1274 (Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * __this, const RuntimeMethod* method);
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData::get_Pointer()
extern "C" IL2CPP_METHOD_ATTR RuntimeObject* MixedRealityPointerEventData_get_Pointer_mF45EB1233706B50689E78E576D49149F583A8657 (MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * __this, const RuntimeMethod* method);
// !!0 UnityEngine.Component::GetComponent<UnityEngine.Canvas>()
inline Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * Component_GetComponent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_m72658F06C13B44ECAE973DE1E20B4BA8A247DBBD (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 * __this, const RuntimeMethod* method)
{
return (( Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * (*) (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 *, const RuntimeMethod*))Component_GetComponent_TisRuntimeObject_m3FED1FF44F93EF1C3A07526800331B638EF4105B_gshared)(__this, method);
}
// UnityEngine.Camera UnityEngine.Canvas::get_worldCamera()
extern "C" IL2CPP_METHOD_ATTR Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 * Canvas_get_worldCamera_m36F1A8DBFC4AB34278125DA017CACDC873F53409 (Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * __this, const RuntimeMethod* method);
// Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem Microsoft.MixedReality.Toolkit.CoreServices::get_InputSystem()
extern "C" IL2CPP_METHOD_ATTR RuntimeObject* CoreServices_get_InputSystem_mDECB23C7E4062E1903E48F5E40550D9EA24D29C1 (const RuntimeMethod* method);
// System.Void UnityEngine.Canvas::set_worldCamera(UnityEngine.Camera)
extern "C" IL2CPP_METHOD_ATTR void Canvas_set_worldCamera_m020A4A35425707F2403E6EBA6AD73F448557F776 (Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * __this, Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 * p0, const RuntimeMethod* method);
// UnityEngine.EventSystems.EventSystem UnityEngine.EventSystems.EventSystem::get_current()
extern "C" IL2CPP_METHOD_ATTR EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77 * EventSystem_get_current_m3151477735829089F66A3E46AD6DAB14CFDDE7BD (const RuntimeMethod* method);
// System.Void UnityEngine.EventSystems.UIBehaviour::Awake()
extern "C" IL2CPP_METHOD_ATTR void UIBehaviour_Awake_mCCC65A98E4219648D4BEFA7CD23E2426CAEF1DE2 (UIBehaviour_t3C3C339CD5677BA7FC27C352FED8B78052A3FE70 * __this, const RuntimeMethod* method);
// !!0 UnityEngine.Component::GetComponentInParent<UnityEngine.Canvas>()
inline Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * Component_GetComponentInParent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_mD91B8112B5688783ACAEA46BB2C82C6EC4C4B33B (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 * __this, const RuntimeMethod* method)
{
return (( Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * (*) (Component_t05064EF382ABCAF4B8C94F8A350EA85184C26621 *, const RuntimeMethod*))Component_GetComponentInParent_TisRuntimeObject_m36052D294AB8C1574678FEF9A9749145A073E8E3_gshared)(__this, method);
}
// UnityEngine.AdditionalCanvasShaderChannels UnityEngine.Canvas::get_additionalShaderChannels()
extern "C" IL2CPP_METHOD_ATTR int32_t Canvas_get_additionalShaderChannels_m703769513A111C46DC0F0B32864A69E54C085BEC (Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Canvas::set_additionalShaderChannels(UnityEngine.AdditionalCanvasShaderChannels)
extern "C" IL2CPP_METHOD_ATTR void Canvas_set_additionalShaderChannels_m0A3CB0D3137C41915E293268BA95920404921FE2 (Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * __this, int32_t p0, const RuntimeMethod* method);
// System.Single UnityEngine.Rect::get_width()
extern "C" IL2CPP_METHOD_ATTR float Rect_get_width_m54FF69FC2C086E2DC349ED091FD0D6576BFB1484 (Rect_t35B976DE901B5423C11705E156938EA27AB402CE * __this, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Transform::get_localScale()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Transform_get_localScale_mD8F631021C2D62B7C341B1A17FA75491F64E13DA (Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * __this, const RuntimeMethod* method);
// System.Single UnityEngine.Rect::get_height()
extern "C" IL2CPP_METHOD_ATTR float Rect_get_height_m088C36990E0A255C5D7DCE36575DCE23ABB364B5 (Rect_t35B976DE901B5423C11705E156938EA27AB402CE * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.Object::op_Implicit(UnityEngine.Object)
extern "C" IL2CPP_METHOD_ATTR bool Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534 (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 * p0, const RuntimeMethod* method);
// UnityEngine.Vector3 UnityEngine.Transform::get_lossyScale()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 Transform_get_lossyScale_m9C2597B28BE066FC061B7D7508750E5D5EA9850F (Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * __this, const RuntimeMethod* method);
// System.Void UnityEngine.UI.VertexHelper::PopulateUIVertex(UnityEngine.UIVertex&,System.Int32)
extern "C" IL2CPP_METHOD_ATTR void VertexHelper_PopulateUIVertex_m72B419E337C302E1307A90517561746425989160 (VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F * __this, UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 * p0, int32_t p1, const RuntimeMethod* method);
// System.Void UnityEngine.UI.VertexHelper::SetUIVertex(UnityEngine.UIVertex,System.Int32)
extern "C" IL2CPP_METHOD_ATTR void VertexHelper_SetUIVertex_m34A2517745A635BBBD0F95AAFC3CF275D73AC4D3 (VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F * __this, UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 p0, int32_t p1, const RuntimeMethod* method);
// System.Int32 UnityEngine.UI.VertexHelper::get_currentVertCount()
extern "C" IL2CPP_METHOD_ATTR int32_t VertexHelper_get_currentVertCount_m48ADC86AE4361D491966D86AD6D1CD9D22FD69B6 (VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F * __this, const RuntimeMethod* method);
// System.Void UnityEngine.UI.BaseMeshEffect::.ctor()
extern "C" IL2CPP_METHOD_ATTR void BaseMeshEffect__ctor_mDAF9031F104E899963B63B3157E2F9CFF9A67B53 (BaseMeshEffect_t72759F31F9D204D7EFB6B45097873809D4524BA5 * __this, const RuntimeMethod* method);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::.cctor()
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec__cctor_m003368C9B58B32767FC77CD6604865020B42F39B (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec__cctor_m003368C9B58B32767FC77CD6604865020B42F39B_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * L_0 = (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 *)il2cpp_codegen_object_new(U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_il2cpp_TypeInfo_var);
U3CU3Ec__ctor_m5B9C0A2C0759CED7E65E89CC46B6F9F5A286E819(L_0, /*hidden argument*/NULL);
((U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_StaticFields*)il2cpp_codegen_static_fields_for(U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080_il2cpp_TypeInfo_var))->set_U3CU3E9_0(L_0);
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::.ctor()
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec__ctor_m5B9C0A2C0759CED7E65E89CC46B6F9F5A286E819 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, const RuntimeMethod* method)
{
{
Object__ctor_m925ECA5E85CA100E3FB86A4F9E15C120E9A184C0(__this, /*hidden argument*/NULL);
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_0(Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_0_m40CB23F53DC2F0BA43F731CADE60F38FAA5FE34D (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_0_m40CB23F53DC2F0BA43F731CADE60F38FAA5FE34D_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<SourceStateEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * L_1 = ExecuteEvents_ValidateEventData_TisSourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8_m5D5A6C5E00218E6FC96B27734982739E5249A511(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8_m5D5A6C5E00218E6FC96B27734982739E5249A511_RuntimeMethod_var);
V_0 = L_1;
// handler.OnSourceDetected(casted);
RuntimeObject* L_2 = ___handler0;
SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler::OnSourceDetected(Microsoft.MixedReality.Toolkit.Input.SourceStateEventData) */, IMixedRealitySourceStateHandler_t9DE7047E18BC3F01BF168CF09230297A16073459_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_1(Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_1_m2EBF111E58F3B274F24225917F959C53369A6D10 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_1_m2EBF111E58F3B274F24225917F959C53369A6D10_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<SourceStateEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * L_1 = ExecuteEvents_ValidateEventData_TisSourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8_m5D5A6C5E00218E6FC96B27734982739E5249A511(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8_m5D5A6C5E00218E6FC96B27734982739E5249A511_RuntimeMethod_var);
V_0 = L_1;
// handler.OnSourceLost(casted);
RuntimeObject* L_2 = ___handler0;
SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< SourceStateEventData_tC9A28F0D7D80ABE5DAE50745B36588F4240006D8 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourceStateHandler::OnSourceLost(Microsoft.MixedReality.Toolkit.Input.SourceStateEventData) */, IMixedRealitySourceStateHandler_t9DE7047E18BC3F01BF168CF09230297A16073459_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_2(Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_2_mAE17DD940CB3321E1BBEA64112D7D5E4020A72F7 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_2_mAE17DD940CB3321E1BBEA64112D7D5E4020A72F7_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<SourcePoseEventData<TrackingState>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0 * L_1 = ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0_m4B7AD1B7B87D73F1188C157F57AE9B4E94EBFAF9(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0_m4B7AD1B7B87D73F1188C157F57AE9B4E94EBFAF9_RuntimeMethod_var);
V_0 = L_1;
// handler.OnSourcePoseChanged(casted);
RuntimeObject* L_2 = ___handler0;
SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< SourcePoseEventData_1_t4C0643D03C79FCACA7860F5CAD92D8DA685226A0 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler::OnSourcePoseChanged(Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<Microsoft.MixedReality.Toolkit.TrackingState>) */, IMixedRealitySourcePoseHandler_tDB93DF305A730CF23F8B3242543DEB5CB87AFCD9_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_3(Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_3_m2C52088758B0957BE22E967CDECA5FF5AE7E8589 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_3_m2C52088758B0957BE22E967CDECA5FF5AE7E8589_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<SourcePoseEventData<Vector2>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D * L_1 = ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D_m44A4310CBC45912A0D3E0A63483F35FB60650D81(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D_m44A4310CBC45912A0D3E0A63483F35FB60650D81_RuntimeMethod_var);
V_0 = L_1;
// handler.OnSourcePoseChanged(casted);
RuntimeObject* L_2 = ___handler0;
SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< SourcePoseEventData_1_t1D77F21430CF5501B2A52F112FC979B403F84D5D * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler::OnSourcePoseChanged(Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Vector2>) */, IMixedRealitySourcePoseHandler_tDB93DF305A730CF23F8B3242543DEB5CB87AFCD9_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_4(Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_4_m715A4BF14E1F6C928F0F4380C2AFCE7BFBC4D024 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_4_m715A4BF14E1F6C928F0F4380C2AFCE7BFBC4D024_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<SourcePoseEventData<Vector3>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C * L_1 = ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C_m3317F6C9A5A5ABDA63707BC2DA6CE9F26BC3CFA8(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C_m3317F6C9A5A5ABDA63707BC2DA6CE9F26BC3CFA8_RuntimeMethod_var);
V_0 = L_1;
// handler.OnSourcePoseChanged(casted);
RuntimeObject* L_2 = ___handler0;
SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< SourcePoseEventData_1_t5569ABB4A47BEDF1B4695B67855FDFABF090CF5C * >::Invoke(2 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler::OnSourcePoseChanged(Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Vector3>) */, IMixedRealitySourcePoseHandler_tDB93DF305A730CF23F8B3242543DEB5CB87AFCD9_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_5(Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_5_mCB5E02489087D48680DE837F97A360AE98747F3E (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_5_mCB5E02489087D48680DE837F97A360AE98747F3E_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<SourcePoseEventData<Quaternion>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03 * L_1 = ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03_m72C57EC69E981C3576A50280BE05CFF1DCF317FD(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03_m72C57EC69E981C3576A50280BE05CFF1DCF317FD_RuntimeMethod_var);
V_0 = L_1;
// handler.OnSourcePoseChanged(casted);
RuntimeObject* L_2 = ___handler0;
SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< SourcePoseEventData_1_t6895A17818B45A4DB85DC17136AC2A38CAD40A03 * >::Invoke(3 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler::OnSourcePoseChanged(Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<UnityEngine.Quaternion>) */, IMixedRealitySourcePoseHandler_tDB93DF305A730CF23F8B3242543DEB5CB87AFCD9_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_6(Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_6_m8C3702924F896EE314C71D3C8CCAC43109612009 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_6_m8C3702924F896EE314C71D3C8CCAC43109612009_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<SourcePoseEventData<MixedRealityPose>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49 * L_1 = ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49_m88CC794B89C460471E5AE81E6830AE54263E9EE6(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49_m88CC794B89C460471E5AE81E6830AE54263E9EE6_RuntimeMethod_var);
V_0 = L_1;
// handler.OnSourcePoseChanged(casted);
RuntimeObject* L_2 = ___handler0;
SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< SourcePoseEventData_1_t39109913E164F919B842401327DB9DED6E44AD49 * >::Invoke(4 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySourcePoseHandler::OnSourcePoseChanged(Microsoft.MixedReality.Toolkit.Input.SourcePoseEventData`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>) */, IMixedRealitySourcePoseHandler_tDB93DF305A730CF23F8B3242543DEB5CB87AFCD9_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_7(Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusChangedHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_7_m7F70758BBA53CDC11D02EC9E55A5CBF15F9C6CAD (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_7_m7F70758BBA53CDC11D02EC9E55A5CBF15F9C6CAD_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<FocusEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * L_1 = ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275_RuntimeMethod_var);
V_0 = L_1;
// handler.OnBeforeFocusChange(casted);
RuntimeObject* L_2 = ___handler0;
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusChangedHandler::OnBeforeFocusChange(Microsoft.MixedReality.Toolkit.Input.FocusEventData) */, IMixedRealityFocusChangedHandler_tEFE5BD28A43ED634A0CA784F2CF2E78725C869FB_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_8(Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusChangedHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_8_mFE07C0E3A49B6D1FE22695A3543F8EED3805150C (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_8_mFE07C0E3A49B6D1FE22695A3543F8EED3805150C_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<FocusEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * L_1 = ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275_RuntimeMethod_var);
V_0 = L_1;
// handler.OnFocusChanged(casted);
RuntimeObject* L_2 = ___handler0;
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusChangedHandler::OnFocusChanged(Microsoft.MixedReality.Toolkit.Input.FocusEventData) */, IMixedRealityFocusChangedHandler_tEFE5BD28A43ED634A0CA784F2CF2E78725C869FB_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_9(Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_9_m4833819F2E9A4CDDD4DAB7200976F9D8A848AAA8 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_9_m4833819F2E9A4CDDD4DAB7200976F9D8A848AAA8_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<FocusEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * L_1 = ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275_RuntimeMethod_var);
V_0 = L_1;
// handler.OnFocusEnter(casted);
RuntimeObject* L_2 = ___handler0;
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusHandler::OnFocusEnter(Microsoft.MixedReality.Toolkit.Input.FocusEventData) */, IMixedRealityFocusHandler_tCB9C57FA1C39CAB596EC45CF4163E48BDCA34135_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_10(Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_10_mA91F2156D9A933D390D34B78115E197260DAA07D (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_10_mA91F2156D9A933D390D34B78115E197260DAA07D_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<FocusEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * L_1 = ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisFocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC_mE74FC5177983EF66CE553EB7C1F84F16B7E91275_RuntimeMethod_var);
V_0 = L_1;
// handler.OnFocusExit(casted);
RuntimeObject* L_2 = ___handler0;
FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< FocusEventData_t165B6996DC03D17E60B71BC989542EEABA048DCC * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusHandler::OnFocusExit(Microsoft.MixedReality.Toolkit.Input.FocusEventData) */, IMixedRealityFocusHandler_tCB9C57FA1C39CAB596EC45CF4163E48BDCA34135_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_11(Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_11_mA1E99C74C79FA79FD72769415A74E34F1847C6BE (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_11_mA1E99C74C79FA79FD72769415A74E34F1847C6BE_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<MixedRealityPointerEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_1 = ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB_RuntimeMethod_var);
V_0 = L_1;
// handler.OnPointerDown(casted);
RuntimeObject* L_2 = ___handler0;
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler::OnPointerDown(Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData) */, IMixedRealityPointerHandler_tAB30AF314323490DC19B42E9E12F67CFFE976BF3_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_12(Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_12_m9CC2DB94334E10FF8DB01AA9583F95A63B5AC474 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_12_m9CC2DB94334E10FF8DB01AA9583F95A63B5AC474_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<MixedRealityPointerEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_1 = ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB_RuntimeMethod_var);
V_0 = L_1;
// handler.OnPointerDragged(casted);
RuntimeObject* L_2 = ___handler0;
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler::OnPointerDragged(Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData) */, IMixedRealityPointerHandler_tAB30AF314323490DC19B42E9E12F67CFFE976BF3_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_13(Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_13_mA889B2852E8F247218D8E56E89583B2ADF43F396 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_13_mA889B2852E8F247218D8E56E89583B2ADF43F396_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<MixedRealityPointerEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_1 = ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB_RuntimeMethod_var);
V_0 = L_1;
// handler.OnPointerClicked(casted);
RuntimeObject* L_2 = ___handler0;
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * >::Invoke(3 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler::OnPointerClicked(Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData) */, IMixedRealityPointerHandler_tAB30AF314323490DC19B42E9E12F67CFFE976BF3_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_14(Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_14_m16FC41DC01540F30D9A3394880CE4919E15091CA (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_14_m16FC41DC01540F30D9A3394880CE4919E15091CA_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<MixedRealityPointerEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_1 = ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisMixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964_m4D7D28FC610CA473F80E9CBB3F7B2445EB874BDB_RuntimeMethod_var);
V_0 = L_1;
// handler.OnPointerUp(casted);
RuntimeObject* L_2 = ___handler0;
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * >::Invoke(2 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointerHandler::OnPointerUp(Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData) */, IMixedRealityPointerHandler_tAB30AF314323490DC19B42E9E12F67CFFE976BF3_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_15(Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_15_mA2CEA5E3DE8AE20DEF77E27BC287258359E7F62F (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_15_mA2CEA5E3DE8AE20DEF77E27BC287258359E7F62F_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// handler.OnInputDown(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler::OnInputDown(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityInputHandler_t076C5BE3EA668A55178CC4F28F1B7950F2E6333F_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_16(Microsoft.MixedReality.Toolkit.Input.IMixedRealityBaseInputHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_16_m25CCD286BF98B6E5E3D066AF8153F4EAD48E59AF (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_16_m25CCD286BF98B6E5E3D066AF8153F4EAD48E59AF_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
RuntimeObject* V_1 = NULL;
RuntimeObject* V_2 = NULL;
{
// var inputData = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// var inputHandler = handler as IMixedRealityInputHandler;
RuntimeObject* L_2 = ___handler0;
V_1 = ((RuntimeObject*)IsInst((RuntimeObject*)L_2, IMixedRealityInputHandler_t076C5BE3EA668A55178CC4F28F1B7950F2E6333F_il2cpp_TypeInfo_var));
// if (inputHandler != null)
RuntimeObject* L_3 = V_1;
if (!L_3)
{
goto IL_0018;
}
}
{
// inputHandler.OnInputDown(inputData);
RuntimeObject* L_4 = V_1;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_5 = V_0;
NullCheck(L_4);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler::OnInputDown(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityInputHandler_t076C5BE3EA668A55178CC4F28F1B7950F2E6333F_il2cpp_TypeInfo_var, L_4, L_5);
}
IL_0018:
{
// var actionHandler = handler as IMixedRealityInputActionHandler;
RuntimeObject* L_6 = ___handler0;
V_2 = ((RuntimeObject*)IsInst((RuntimeObject*)L_6, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var));
// if (actionHandler != null)
RuntimeObject* L_7 = V_2;
if (!L_7)
{
goto IL_0029;
}
}
{
// actionHandler.OnActionStarted(inputData);
RuntimeObject* L_8 = V_2;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_9 = V_0;
NullCheck(L_8);
InterfaceActionInvoker1< BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputActionHandler::OnActionStarted(Microsoft.MixedReality.Toolkit.Input.BaseInputEventData) */, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var, L_8, L_9);
}
IL_0029:
{
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_17(Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_17_mF6A01546BDA8D894F98B7A69E89EF5BC10A6C9D4 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_17_mF6A01546BDA8D894F98B7A69E89EF5BC10A6C9D4_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// handler.OnInputUp(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler::OnInputUp(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityInputHandler_t076C5BE3EA668A55178CC4F28F1B7950F2E6333F_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_18(Microsoft.MixedReality.Toolkit.Input.IMixedRealityBaseInputHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_18_m86AC1B64C5F08A197190B8E88ADF1DAF66D2A5DE (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_18_m86AC1B64C5F08A197190B8E88ADF1DAF66D2A5DE_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
RuntimeObject* V_1 = NULL;
RuntimeObject* V_2 = NULL;
{
// var inputData = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// var inputHandler = handler as IMixedRealityInputHandler;
RuntimeObject* L_2 = ___handler0;
V_1 = ((RuntimeObject*)IsInst((RuntimeObject*)L_2, IMixedRealityInputHandler_t076C5BE3EA668A55178CC4F28F1B7950F2E6333F_il2cpp_TypeInfo_var));
// if (inputHandler != null)
RuntimeObject* L_3 = V_1;
if (!L_3)
{
goto IL_0018;
}
}
{
// inputHandler.OnInputUp(inputData);
RuntimeObject* L_4 = V_1;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_5 = V_0;
NullCheck(L_4);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler::OnInputUp(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityInputHandler_t076C5BE3EA668A55178CC4F28F1B7950F2E6333F_il2cpp_TypeInfo_var, L_4, L_5);
}
IL_0018:
{
// var actionHandler = handler as IMixedRealityInputActionHandler;
RuntimeObject* L_6 = ___handler0;
V_2 = ((RuntimeObject*)IsInst((RuntimeObject*)L_6, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var));
// if (actionHandler != null)
RuntimeObject* L_7 = V_2;
if (!L_7)
{
goto IL_0029;
}
}
{
// actionHandler.OnActionEnded(inputData);
RuntimeObject* L_8 = V_2;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_9 = V_0;
NullCheck(L_8);
InterfaceActionInvoker1< BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputActionHandler::OnActionEnded(Microsoft.MixedReality.Toolkit.Input.BaseInputEventData) */, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var, L_8, L_9);
}
IL_0029:
{
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_19(Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<System.Single>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_19_m27A33B0E883D40224C6F396134DEAF2B7B32EDE0 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_19_m27A33B0E883D40224C6F396134DEAF2B7B32EDE0_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<float>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08_m732B746D0B59264901C76698B24E9F4FC6507D60(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08_m732B746D0B59264901C76698B24E9F4FC6507D60_RuntimeMethod_var);
V_0 = L_1;
// handler.OnInputChanged(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t0068A19074FE312CE222C151A2EB6D127A167E08 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<System.Single>::OnInputChanged(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityInputHandler_1_tAD1B7DC731C61121E6B57E0298DAF20A61646468_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_20(Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Vector2>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_20_m1439BAE6A672A301B52BC06F642A17A116B7B408 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_20_m1439BAE6A672A301B52BC06F642A17A116B7B408_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Vector2>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_mE0EAE75FDABCF1F6D6CA42B92EB601C5AFB734AC(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_mE0EAE75FDABCF1F6D6CA42B92EB601C5AFB734AC_RuntimeMethod_var);
V_0 = L_1;
// handler.OnInputChanged(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Vector2>::OnInputChanged(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityInputHandler_1_tFC3F8D3B3CE2CCA4F25E275054FDF81C8A22E4E5_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_21(Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Vector3>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_21_mB60E47591A81D6CDF20BCE66091D24F3E45F228C (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_21_mB60E47591A81D6CDF20BCE66091D24F3E45F228C_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Vector3>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7_m097E52341D124B63ACF286F3B3DA74AFE301578D(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7_m097E52341D124B63ACF286F3B3DA74AFE301578D_RuntimeMethod_var);
V_0 = L_1;
// handler.OnInputChanged(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Vector3>::OnInputChanged(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityInputHandler_1_tEE6677D865F3622772E229A3654B306832BF6557_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_22(Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Quaternion>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_22_mB13DD28AFA57C6B5048A8945EBCB305861C757B8 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_22_mB13DD28AFA57C6B5048A8945EBCB305861C757B8_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Quaternion>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F_m81B085BAD6E32F7D0F68DD7866400B8B63586937(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F_m81B085BAD6E32F7D0F68DD7866400B8B63586937_RuntimeMethod_var);
V_0 = L_1;
// handler.OnInputChanged(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<UnityEngine.Quaternion>::OnInputChanged(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityInputHandler_1_t3AD268F517E91D4C46AEEB59CA60E64585A5F463_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_23(Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_23_mF17EEB9DA600D7509F155482F6F638772B740598 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_23_mF17EEB9DA600D7509F155482F6F638772B740598_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<MixedRealityPose>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190_mE6BDBCA0445EA7137E8EF7AD8EA49F4BD2335E01(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190_mE6BDBCA0445EA7137E8EF7AD8EA49F4BD2335E01_RuntimeMethod_var);
V_0 = L_1;
// handler.OnInputChanged(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputHandler`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>::OnInputChanged(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityInputHandler_1_t36D2117DF01BEA07C13A66885FAD6275DDD0C2BD_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_24(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_24_m7C094E6969FFE76EF2248361B57B4D2ABFC232DD (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_24_m7C094E6969FFE76EF2248361B57B4D2ABFC232DD_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureStarted(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler::OnGestureStarted(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_25(Microsoft.MixedReality.Toolkit.Input.IMixedRealityBaseInputHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_25_mAB5E2741E80A14A33EBB11D53093C8F381F62481 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_25_mAB5E2741E80A14A33EBB11D53093C8F381F62481_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
RuntimeObject* V_1 = NULL;
RuntimeObject* V_2 = NULL;
{
// var inputData = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// var gestureHandler = handler as IMixedRealityGestureHandler;
RuntimeObject* L_2 = ___handler0;
V_1 = ((RuntimeObject*)IsInst((RuntimeObject*)L_2, IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var));
// if (gestureHandler != null)
RuntimeObject* L_3 = V_1;
if (!L_3)
{
goto IL_0018;
}
}
{
// gestureHandler.OnGestureStarted(inputData);
RuntimeObject* L_4 = V_1;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_5 = V_0;
NullCheck(L_4);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler::OnGestureStarted(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var, L_4, L_5);
}
IL_0018:
{
// var actionHandler = handler as IMixedRealityInputActionHandler;
RuntimeObject* L_6 = ___handler0;
V_2 = ((RuntimeObject*)IsInst((RuntimeObject*)L_6, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var));
// if (actionHandler != null)
RuntimeObject* L_7 = V_2;
if (!L_7)
{
goto IL_0029;
}
}
{
// actionHandler.OnActionStarted(inputData);
RuntimeObject* L_8 = V_2;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_9 = V_0;
NullCheck(L_8);
InterfaceActionInvoker1< BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputActionHandler::OnActionStarted(Microsoft.MixedReality.Toolkit.Input.BaseInputEventData) */, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var, L_8, L_9);
}
IL_0029:
{
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_26(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_26_m1944A9BBA2408514CCFD7FBCC36D6B8ED59828A2 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_26_m1944A9BBA2408514CCFD7FBCC36D6B8ED59828A2_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureUpdated(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler::OnGestureUpdated(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_27(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector2>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_27_mAD38D365EC560CC781AD21F59FB9496EA2560311 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_27_mAD38D365EC560CC781AD21F59FB9496EA2560311_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Vector2>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_mE0EAE75FDABCF1F6D6CA42B92EB601C5AFB734AC(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_mE0EAE75FDABCF1F6D6CA42B92EB601C5AFB734AC_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureUpdated(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector2>::OnGestureUpdated(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityGestureHandler_1_tE038FADEC9B3422DF9CA5EE5628C2097D40A5BE6_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_28(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector3>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_28_m3414B57CCA89FC0E3606D2EE3428B66D8CDC4134 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_28_m3414B57CCA89FC0E3606D2EE3428B66D8CDC4134_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Vector3>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7_m097E52341D124B63ACF286F3B3DA74AFE301578D(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7_m097E52341D124B63ACF286F3B3DA74AFE301578D_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureUpdated(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector3>::OnGestureUpdated(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityGestureHandler_1_t84808B3F44C67F8EF43032EAB4F599002F835DE3_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_29(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Quaternion>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_29_mB38F9FA952B0DCF1C377829C9B768F1B457F6481 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_29_mB38F9FA952B0DCF1C377829C9B768F1B457F6481_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Quaternion>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F_m81B085BAD6E32F7D0F68DD7866400B8B63586937(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F_m81B085BAD6E32F7D0F68DD7866400B8B63586937_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureUpdated(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Quaternion>::OnGestureUpdated(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityGestureHandler_1_t4230FCC1C3B93C15652754F51E8E8B08E78E4B3A_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_30(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_30_m86B92926AF1320AB65A7672C4A35F6B74AB4AB04 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_30_m86B92926AF1320AB65A7672C4A35F6B74AB4AB04_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<MixedRealityPose>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190_mE6BDBCA0445EA7137E8EF7AD8EA49F4BD2335E01(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190_mE6BDBCA0445EA7137E8EF7AD8EA49F4BD2335E01_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureUpdated(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>::OnGestureUpdated(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityGestureHandler_1_tD98BED3AB9B32BFC28ED8AC1A27CFD8AC87D6C39_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_31(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_31_m8DCDC647C8173946E4C5DF32D718B2D3BA946B75 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_31_m8DCDC647C8173946E4C5DF32D718B2D3BA946B75_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureCompleted(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(2 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler::OnGestureCompleted(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_32(Microsoft.MixedReality.Toolkit.Input.IMixedRealityBaseInputHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_32_m23F1AC0C67557C87D75CDE6F957FE4DFE34EF1BE (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_32_m23F1AC0C67557C87D75CDE6F957FE4DFE34EF1BE_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
RuntimeObject* V_1 = NULL;
RuntimeObject* V_2 = NULL;
{
// var inputData = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// var gestureHandler = handler as IMixedRealityGestureHandler;
RuntimeObject* L_2 = ___handler0;
V_1 = ((RuntimeObject*)IsInst((RuntimeObject*)L_2, IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var));
// if (gestureHandler != null)
RuntimeObject* L_3 = V_1;
if (!L_3)
{
goto IL_0018;
}
}
{
// gestureHandler.OnGestureCompleted(inputData);
RuntimeObject* L_4 = V_1;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_5 = V_0;
NullCheck(L_4);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(2 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler::OnGestureCompleted(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var, L_4, L_5);
}
IL_0018:
{
// var actionHandler = handler as IMixedRealityInputActionHandler;
RuntimeObject* L_6 = ___handler0;
V_2 = ((RuntimeObject*)IsInst((RuntimeObject*)L_6, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var));
// if (actionHandler != null)
RuntimeObject* L_7 = V_2;
if (!L_7)
{
goto IL_0029;
}
}
{
// actionHandler.OnActionEnded(inputData);
RuntimeObject* L_8 = V_2;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_9 = V_0;
NullCheck(L_8);
InterfaceActionInvoker1< BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputActionHandler::OnActionEnded(Microsoft.MixedReality.Toolkit.Input.BaseInputEventData) */, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var, L_8, L_9);
}
IL_0029:
{
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_33(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector2>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_33_m41489A400EF9F89A2DF953B3B98FEBD952FDF929 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_33_m41489A400EF9F89A2DF953B3B98FEBD952FDF929_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Vector2>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_mE0EAE75FDABCF1F6D6CA42B92EB601C5AFB734AC(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B_mE0EAE75FDABCF1F6D6CA42B92EB601C5AFB734AC_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureCompleted(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t815CDEC6DAB737BC7E2642B2967AD51CDCF0E26B * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector2>::OnGestureCompleted(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityGestureHandler_1_tE038FADEC9B3422DF9CA5EE5628C2097D40A5BE6_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_34(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector3>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_34_m88BE20F400043CC926999448F767420AFC6E764A (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_34_m88BE20F400043CC926999448F767420AFC6E764A_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Vector3>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7_m097E52341D124B63ACF286F3B3DA74AFE301578D(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7_m097E52341D124B63ACF286F3B3DA74AFE301578D_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureCompleted(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t7B09E7020518DF25CC38B52C7C6C5D94070835E7 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Vector3>::OnGestureCompleted(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityGestureHandler_1_t84808B3F44C67F8EF43032EAB4F599002F835DE3_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_35(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Quaternion>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_35_m3B3451CD52AA432C3B4FBCD2A8A65BE54CD5BC07 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_35_m3B3451CD52AA432C3B4FBCD2A8A65BE54CD5BC07_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<Quaternion>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F_m81B085BAD6E32F7D0F68DD7866400B8B63586937(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F_m81B085BAD6E32F7D0F68DD7866400B8B63586937_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureCompleted(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_tFD411C2CE816CA54B409FC51522DD2C5186F8B9F * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<UnityEngine.Quaternion>::OnGestureCompleted(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityGestureHandler_1_t4230FCC1C3B93C15652754F51E8E8B08E78E4B3A_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_36(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_36_m35B38F9B286CBCA4A3C1EB50963876C6A8963411 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_36_m35B38F9B286CBCA4A3C1EB50963876C6A8963411_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<MixedRealityPose>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190_mE6BDBCA0445EA7137E8EF7AD8EA49F4BD2335E01(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190_mE6BDBCA0445EA7137E8EF7AD8EA49F4BD2335E01_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureCompleted(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_tED5D68194AE7B6B769F9EFCDB373BA9401676190 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler`1<Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>::OnGestureCompleted(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<!0>) */, IMixedRealityGestureHandler_1_tD98BED3AB9B32BFC28ED8AC1A27CFD8AC87D6C39_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_37(Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_37_m8A7AD87C215D44800037E134A4371C61848D77D9 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_37_m8A7AD87C215D44800037E134A4371C61848D77D9_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896_m11136AB6E3116FF4BBAFD1009E867E1BA8C4D9C3_RuntimeMethod_var);
V_0 = L_1;
// handler.OnGestureCanceled(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_t4448A1ECF70018591A9050CEC5582EEF07663896 * >::Invoke(3 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityGestureHandler::OnGestureCanceled(Microsoft.MixedReality.Toolkit.Input.InputEventData) */, IMixedRealityGestureHandler_t7D9D88C5C7F61150B6FA73C6CC54704EDCAC8E3F_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_38(Microsoft.MixedReality.Toolkit.Input.IMixedRealitySpeechHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_38_mC55566D86148803D8B231049D0B8B83DA0C6263C (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_38_mC55566D86148803D8B231049D0B8B83DA0C6263C_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<SpeechEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * L_1 = ExecuteEvents_ValidateEventData_TisSpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D_m3E405F175CBD8D8F021FDCC766B6153A42F14FED(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D_m3E405F175CBD8D8F021FDCC766B6153A42F14FED_RuntimeMethod_var);
V_0 = L_1;
// handler.OnSpeechKeywordRecognized(casted);
RuntimeObject* L_2 = ___handler0;
SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySpeechHandler::OnSpeechKeywordRecognized(Microsoft.MixedReality.Toolkit.Input.SpeechEventData) */, IMixedRealitySpeechHandler_t1B6B16EA91E1FC515CB0DD0B0A2A2EAA0D4B283A_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_39(Microsoft.MixedReality.Toolkit.Input.IMixedRealityBaseInputHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_39_mECD46ABB762655693E516CC9CF2CC6B20CA08773 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_39_mECD46ABB762655693E516CC9CF2CC6B20CA08773_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * V_0 = NULL;
RuntimeObject* V_1 = NULL;
RuntimeObject* V_2 = NULL;
{
// var speechData = ExecuteEvents.ValidateEventData<SpeechEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * L_1 = ExecuteEvents_ValidateEventData_TisSpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D_m3E405F175CBD8D8F021FDCC766B6153A42F14FED(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisSpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D_m3E405F175CBD8D8F021FDCC766B6153A42F14FED_RuntimeMethod_var);
V_0 = L_1;
// var speechHandler = handler as IMixedRealitySpeechHandler;
RuntimeObject* L_2 = ___handler0;
V_1 = ((RuntimeObject*)IsInst((RuntimeObject*)L_2, IMixedRealitySpeechHandler_t1B6B16EA91E1FC515CB0DD0B0A2A2EAA0D4B283A_il2cpp_TypeInfo_var));
// if (speechHandler != null)
RuntimeObject* L_3 = V_1;
if (!L_3)
{
goto IL_0018;
}
}
{
// speechHandler.OnSpeechKeywordRecognized(speechData);
RuntimeObject* L_4 = V_1;
SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * L_5 = V_0;
NullCheck(L_4);
InterfaceActionInvoker1< SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealitySpeechHandler::OnSpeechKeywordRecognized(Microsoft.MixedReality.Toolkit.Input.SpeechEventData) */, IMixedRealitySpeechHandler_t1B6B16EA91E1FC515CB0DD0B0A2A2EAA0D4B283A_il2cpp_TypeInfo_var, L_4, L_5);
}
IL_0018:
{
// var actionHandler = handler as IMixedRealityInputActionHandler;
RuntimeObject* L_6 = ___handler0;
V_2 = ((RuntimeObject*)IsInst((RuntimeObject*)L_6, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var));
// if (actionHandler != null)
RuntimeObject* L_7 = V_2;
if (!L_7)
{
goto IL_0030;
}
}
{
// actionHandler.OnActionStarted(speechData);
RuntimeObject* L_8 = V_2;
SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * L_9 = V_0;
NullCheck(L_8);
InterfaceActionInvoker1< BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputActionHandler::OnActionStarted(Microsoft.MixedReality.Toolkit.Input.BaseInputEventData) */, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var, L_8, L_9);
// actionHandler.OnActionEnded(speechData);
RuntimeObject* L_10 = V_2;
SpeechEventData_t49EB0455EC1109189A6976157FB609BC0426D61D * L_11 = V_0;
NullCheck(L_10);
InterfaceActionInvoker1< BaseInputEventData_tBB63D9BEE1678B2CD47272D16449017A2AC4B04A * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputActionHandler::OnActionEnded(Microsoft.MixedReality.Toolkit.Input.BaseInputEventData) */, IMixedRealityInputActionHandler_t49D3A3CD4B1B0CF106B6A399484E76A246B3BFE1_il2cpp_TypeInfo_var, L_10, L_11);
}
IL_0030:
{
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_40(Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_40_mD47D65F59F5428C3894F07F3350193E870E59650 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_40_mD47D65F59F5428C3894F07F3350193E870E59650_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<DictationEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * L_1 = ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449_RuntimeMethod_var);
V_0 = L_1;
// handler.OnDictationHypothesis(casted);
RuntimeObject* L_2 = ___handler0;
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler::OnDictationHypothesis(Microsoft.MixedReality.Toolkit.Input.DictationEventData) */, IMixedRealityDictationHandler_tC156B03CBBD750CD43DAC73314712738C02FE1AC_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_41(Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_41_m1F9FB29E660E895D6F494FA9906C46CC5F47B95B (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_41_m1F9FB29E660E895D6F494FA9906C46CC5F47B95B_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<DictationEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * L_1 = ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449_RuntimeMethod_var);
V_0 = L_1;
// handler.OnDictationResult(casted);
RuntimeObject* L_2 = ___handler0;
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler::OnDictationResult(Microsoft.MixedReality.Toolkit.Input.DictationEventData) */, IMixedRealityDictationHandler_tC156B03CBBD750CD43DAC73314712738C02FE1AC_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_42(Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_42_mEAD470183EEDBA26582CDBE962C129DF07364889 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_42_mEAD470183EEDBA26582CDBE962C129DF07364889_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<DictationEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * L_1 = ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449_RuntimeMethod_var);
V_0 = L_1;
// handler.OnDictationComplete(casted);
RuntimeObject* L_2 = ___handler0;
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * >::Invoke(2 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler::OnDictationComplete(Microsoft.MixedReality.Toolkit.Input.DictationEventData) */, IMixedRealityDictationHandler_tC156B03CBBD750CD43DAC73314712738C02FE1AC_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_43(Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_43_m37A8DEFC8A5297A336B10346622499FCD6E4CAD9 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_43_m37A8DEFC8A5297A336B10346622499FCD6E4CAD9_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<DictationEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * L_1 = ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisDictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386_mBFF58F03475CD15CE3615C8978D7493534B88449_RuntimeMethod_var);
V_0 = L_1;
// handler.OnDictationError(casted);
RuntimeObject* L_2 = ___handler0;
DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< DictationEventData_tC8FD1EF5C792D258465216EC3962AF21F534F386 * >::Invoke(3 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityDictationHandler::OnDictationError(Microsoft.MixedReality.Toolkit.Input.DictationEventData) */, IMixedRealityDictationHandler_tC156B03CBBD750CD43DAC73314712738C02FE1AC_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_44(Microsoft.MixedReality.Toolkit.Input.IMixedRealityHandJointHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_44_m49932BEEBB1B771E48EB7E959E371080BBA988D5 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_44_m49932BEEBB1B771E48EB7E959E371080BBA988D5_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<IDictionary<TrackedHandJoint, MixedRealityPose>>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A_m3664034B4BB2FCF6FE77D0592A334D57A9E704E0(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A_m3664034B4BB2FCF6FE77D0592A334D57A9E704E0_RuntimeMethod_var);
V_0 = L_1;
// handler.OnHandJointsUpdated(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t1AC45F3C33BF832864FC5562B48A8132A2AD207A * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityHandJointHandler::OnHandJointsUpdated(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<System.Collections.Generic.IDictionary`2<Microsoft.MixedReality.Toolkit.Utilities.TrackedHandJoint,Microsoft.MixedReality.Toolkit.Utilities.MixedRealityPose>>) */, IMixedRealityHandJointHandler_tA87827F6B3EB628AE0B274E3401D8B768EE1B548_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_45(Microsoft.MixedReality.Toolkit.Input.IMixedRealityHandMeshHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_45_mB0AA4EB87DC8045D4FB9FF86C5A3A7BB7D0146EE (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_45_mB0AA4EB87DC8045D4FB9FF86C5A3A7BB7D0146EE_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<InputEventData<HandMeshInfo>>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF * L_1 = ExecuteEvents_ValidateEventData_TisInputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF_mB181D6A143D8E73CA2CA55F794B9C3D30F65ED9F(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisInputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF_mB181D6A143D8E73CA2CA55F794B9C3D30F65ED9F_RuntimeMethod_var);
V_0 = L_1;
// handler.OnHandMeshUpdated(casted);
RuntimeObject* L_2 = ___handler0;
InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< InputEventData_1_t705DA55E914E795A9CB96BCE2866C0FF8F93D1CF * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityHandMeshHandler::OnHandMeshUpdated(Microsoft.MixedReality.Toolkit.Input.InputEventData`1<Microsoft.MixedReality.Toolkit.Input.HandMeshInfo>) */, IMixedRealityHandMeshHandler_tC40BC662BA372AEFB8F9D6060184D4A283F9F367_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_46(Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_46_mB7086147EA6A12483CAD1F72D302CEF54CDCCCBA (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_46_mB7086147EA6A12483CAD1F72D302CEF54CDCCCBA_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<HandTrackingInputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * L_1 = ExecuteEvents_ValidateEventData_TisHandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71_m3D0E4D7521F0B7FFF71F919CEC166F6090896203(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisHandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71_m3D0E4D7521F0B7FFF71F919CEC166F6090896203_RuntimeMethod_var);
V_0 = L_1;
// handler.OnTouchStarted(casted);
RuntimeObject* L_2 = ___handler0;
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * >::Invoke(0 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler::OnTouchStarted(Microsoft.MixedReality.Toolkit.Input.HandTrackingInputEventData) */, IMixedRealityTouchHandler_t535F16165926DDD86909EC59D30EF36156785594_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_47(Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_47_m9867CB58D178BECC36FF2D12D6ECB6D345883234 (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_47_m9867CB58D178BECC36FF2D12D6ECB6D345883234_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<HandTrackingInputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * L_1 = ExecuteEvents_ValidateEventData_TisHandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71_m3D0E4D7521F0B7FFF71F919CEC166F6090896203(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisHandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71_m3D0E4D7521F0B7FFF71F919CEC166F6090896203_RuntimeMethod_var);
V_0 = L_1;
// handler.OnTouchCompleted(casted);
RuntimeObject* L_2 = ___handler0;
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * >::Invoke(1 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler::OnTouchCompleted(Microsoft.MixedReality.Toolkit.Input.HandTrackingInputEventData) */, IMixedRealityTouchHandler_t535F16165926DDD86909EC59D30EF36156785594_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.MixedRealityInputSystem_<>c::<.cctor>b__240_48(Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler,UnityEngine.EventSystems.BaseEventData)
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec_U3C_cctorU3Eb__240_48_m24D4870359909390387C8103BCC9C4000BF2077F (U3CU3Ec_tCB1D8CA4BE09C4207199A2A0C520429E5ACC3080 * __this, RuntimeObject* ___handler0, BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * ___eventData1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3C_cctorU3Eb__240_48_m24D4870359909390387C8103BCC9C4000BF2077F_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * V_0 = NULL;
{
// var casted = ExecuteEvents.ValidateEventData<HandTrackingInputEventData>(eventData);
BaseEventData_t46C9D2AE3183A742EDE89944AF64A23DBF1B80A5 * L_0 = ___eventData1;
IL2CPP_RUNTIME_CLASS_INIT(ExecuteEvents_t622B95FF46A568C8205B76C1D4111049FC265985_il2cpp_TypeInfo_var);
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * L_1 = ExecuteEvents_ValidateEventData_TisHandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71_m3D0E4D7521F0B7FFF71F919CEC166F6090896203(L_0, /*hidden argument*/ExecuteEvents_ValidateEventData_TisHandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71_m3D0E4D7521F0B7FFF71F919CEC166F6090896203_RuntimeMethod_var);
V_0 = L_1;
// handler.OnTouchUpdated(casted);
RuntimeObject* L_2 = ___handler0;
HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * L_3 = V_0;
NullCheck(L_2);
InterfaceActionInvoker1< HandTrackingInputEventData_t90865462B8D5CBCCB3FD44D2E0548394F8002C71 * >::Invoke(2 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityTouchHandler::OnTouchUpdated(Microsoft.MixedReality.Toolkit.Input.HandTrackingInputEventData) */, IMixedRealityTouchHandler_t535F16165926DDD86909EC59D30EF36156785594_il2cpp_TypeInfo_var, L_2, L_3);
// };
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionGrabbable::OnEnable()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionGrabbable_OnEnable_m86A7FA282A54ED2E7017FEB3C5446D1D03393F62 (NearInteractionGrabbable_tD81A6B243534FF858FAEC2C510FF3072A9FB3900 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionGrabbable_OnEnable_m86A7FA282A54ED2E7017FEB3C5446D1D03393F62_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252* V_0 = NULL;
bool V_1 = false;
int32_t V_2 = 0;
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * V_3 = NULL;
int32_t G_B8_0 = 0;
{
// Collider[] colliders = gameObject.GetComponents<Collider>();
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * L_0 = Component_get_gameObject_m0B0570BA8DDD3CD78A9DB568EA18D7317686603C(__this, /*hidden argument*/NULL);
NullCheck(L_0);
ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252* L_1 = GameObject_GetComponents_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m64C7FCDEB0A941ED4C9306B2F467C13D69BBF8C1(L_0, /*hidden argument*/GameObject_GetComponents_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m64C7FCDEB0A941ED4C9306B2F467C13D69BBF8C1_RuntimeMethod_var);
V_0 = L_1;
// bool containsValidCollider = false;
V_1 = (bool)0;
// for (int i = 0; i < colliders.Length && !containsValidCollider; i++)
V_2 = 0;
goto IL_004c;
}
IL_0012:
{
// Collider collider = colliders[i];
ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252* L_2 = V_0;
int32_t L_3 = V_2;
NullCheck(L_2);
int32_t L_4 = L_3;
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_5 = (L_2)->GetAt(static_cast<il2cpp_array_size_t>(L_4));
V_3 = L_5;
// containsValidCollider =
// (collider is BoxCollider) ||
// (collider is CapsuleCollider) ||
// (collider is SphereCollider) ||
// (collider is MeshCollider && (collider as MeshCollider).convex);
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_6 = V_3;
if (((BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA *)IsInstClass((RuntimeObject*)L_6, BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_il2cpp_TypeInfo_var)))
{
goto IL_0046;
}
}
{
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_7 = V_3;
if (((CapsuleCollider_t5FD15B9E7BEEC4FFA8A2071E9FD2B8DEB3A826D1 *)IsInstClass((RuntimeObject*)L_7, CapsuleCollider_t5FD15B9E7BEEC4FFA8A2071E9FD2B8DEB3A826D1_il2cpp_TypeInfo_var)))
{
goto IL_0046;
}
}
{
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_8 = V_3;
if (((SphereCollider_tAC3E5E20B385DF1C0B17F3EA5C7214F71367706F *)IsInstClass((RuntimeObject*)L_8, SphereCollider_tAC3E5E20B385DF1C0B17F3EA5C7214F71367706F_il2cpp_TypeInfo_var)))
{
goto IL_0046;
}
}
{
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_9 = V_3;
if (!((MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE *)IsInstClass((RuntimeObject*)L_9, MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE_il2cpp_TypeInfo_var)))
{
goto IL_0043;
}
}
{
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_10 = V_3;
NullCheck(((MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE *)IsInstClass((RuntimeObject*)L_10, MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE_il2cpp_TypeInfo_var)));
bool L_11 = MeshCollider_get_convex_mAA9801A31A512288CE0705E56596D836FC73E64A(((MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE *)IsInstClass((RuntimeObject*)L_10, MeshCollider_t60EB55ADE92499FE8D1AA206D2BD96E65B2766DE_il2cpp_TypeInfo_var)), /*hidden argument*/NULL);
G_B8_0 = ((int32_t)(L_11));
goto IL_0047;
}
IL_0043:
{
G_B8_0 = 0;
goto IL_0047;
}
IL_0046:
{
G_B8_0 = 1;
}
IL_0047:
{
V_1 = (bool)G_B8_0;
// for (int i = 0; i < colliders.Length && !containsValidCollider; i++)
int32_t L_12 = V_2;
V_2 = ((int32_t)il2cpp_codegen_add((int32_t)L_12, (int32_t)1));
}
IL_004c:
{
// for (int i = 0; i < colliders.Length && !containsValidCollider; i++)
int32_t L_13 = V_2;
ColliderU5BU5D_t70D1FDAE17E4359298B2BAA828048D1B7CFFE252* L_14 = V_0;
NullCheck(L_14);
if ((((int32_t)L_13) >= ((int32_t)(((int32_t)((int32_t)(((RuntimeArray *)L_14)->max_length)))))))
{
goto IL_0055;
}
}
{
bool L_15 = V_1;
if (!L_15)
{
goto IL_0012;
}
}
IL_0055:
{
// if (!containsValidCollider)
bool L_16 = V_1;
if (L_16)
{
goto IL_0062;
}
}
{
// Debug.LogError("NearInteractionGrabbable requires a " +
// "BoxCollider, SphereCollider, CapsuleCollider or a convex MeshCollider on an object. " +
// "Otherwise grab interaction will not work correctly.");
IL2CPP_RUNTIME_CLASS_INIT(Debug_t7B5FCB117E2FD63B6838BC52821B252E2BFB61C4_il2cpp_TypeInfo_var);
Debug_LogError_m3BCF9B78263152261565DCA9DB7D55F0C391ED29(_stringLiteral13D394CBB2224799347CFC4EA600A656E4673514, /*hidden argument*/NULL);
}
IL_0062:
{
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionGrabbable::.ctor()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionGrabbable__ctor_m5506E78D4AE97A15A55EDF635046163CDF171A48 (NearInteractionGrabbable_tD81A6B243534FF858FAEC2C510FF3072A9FB3900 * __this, const RuntimeMethod* method)
{
{
MonoBehaviour__ctor_mEAEC84B222C60319D593E456D769B3311DFCEF97(__this, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_LocalForward()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_LocalForward_m051017BDD802785A576C5DAD40D69919945D68C6 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
{
// public Vector3 LocalForward { get => localForward; }
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = __this->get_localForward_6();
return L_0;
}
}
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_LocalUp()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_LocalUp_mA12848F9601BFEF5CEE01600C128A5496FF3D91E (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
{
// public Vector3 LocalUp { get => localUp; }
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = __this->get_localUp_7();
return L_0;
}
}
// System.Boolean Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_AreLocalVectorsOrthogonal()
extern "C" IL2CPP_METHOD_ATTR bool NearInteractionTouchable_get_AreLocalVectorsOrthogonal_mFD41DA35A8E313621330B211EC80C6500C4357C7 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_get_AreLocalVectorsOrthogonal_mFD41DA35A8E313621330B211EC80C6500C4357C7_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// public bool AreLocalVectorsOrthogonal => Vector3.Dot(localForward, localUp) == 0;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = __this->get_localForward_6();
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = __this->get_localUp_7();
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
float L_2 = Vector3_Dot_m0C530E1C51278DE28B77906D56356506232272C1(L_0, L_1, /*hidden argument*/NULL);
return (bool)((((float)L_2) == ((float)(0.0f)))? 1 : 0);
}
}
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_LocalCenter()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_LocalCenter_m2EB960616E1942A7F84A3DF41510E850FA1DAB07 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
{
// public override Vector3 LocalCenter { get => localCenter; }
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = __this->get_localCenter_8();
return L_0;
}
}
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_LocalRight()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_LocalRight_mFC9863CB3DE0A6D313338A0EE41C55FEDE62CAFA (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_get_LocalRight_mFC9863CB3DE0A6D313338A0EE41C55FEDE62CAFA_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 V_0;
memset(&V_0, 0, sizeof(V_0));
{
// Vector3 cross = Vector3.Cross(localUp, localForward);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = __this->get_localUp_7();
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = __this->get_localForward_6();
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_2 = Vector3_Cross_m3E9DBC445228FDB850BDBB4B01D6F61AC0111887(L_0, L_1, /*hidden argument*/NULL);
V_0 = L_2;
// if (cross == Vector3.zero)
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_3 = V_0;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_4 = Vector3_get_zero_m3CDDCAE94581DF3BB16C4B40A100E28E9C6649C2(/*hidden argument*/NULL);
bool L_5 = Vector3_op_Equality_mA9E2F96E98E71AE7ACCE74766D700D41F0404806(L_3, L_4, /*hidden argument*/NULL);
if (!L_5)
{
goto IL_0025;
}
}
{
// return Vector3.right;
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_6 = Vector3_get_right_m6DD9559CA0C75BBA42D9140021C4C2A9AAA9B3F5(/*hidden argument*/NULL);
return L_6;
}
IL_0025:
{
// return cross;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_7 = V_0;
return L_7;
}
}
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_Forward()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_Forward_m5CEE4412F619AAF894FAF4129E29029BDDD653E7 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
{
// public Vector3 Forward => transform.TransformDirection(localForward);
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_0 = Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = __this->get_localForward_6();
NullCheck(L_0);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_2 = Transform_TransformDirection_m85FC1D7E1322E94F65DA59AEF3B1166850B183EF(L_0, L_1, /*hidden argument*/NULL);
return L_2;
}
}
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_LocalPressDirection()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchable_get_LocalPressDirection_mF68CB6CF973220E71A9D2CA6E8A63444ABA63952 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_get_LocalPressDirection_mF68CB6CF973220E71A9D2CA6E8A63444ABA63952_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// public override Vector3 LocalPressDirection => -localForward;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = __this->get_localForward_6();
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = Vector3_op_UnaryNegation_m2AFBBF22801F9BCA5A4EBE642A29F433FE1339C2(L_0, /*hidden argument*/NULL);
return L_1;
}
}
// UnityEngine.Vector2 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_Bounds()
extern "C" IL2CPP_METHOD_ATTR Vector2_tA85D2DD88578276CA8A8796756458277E72D073D NearInteractionTouchable_get_Bounds_mD5D12ECBF23FCB04809F26A27FE5B84B6E0A197D (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
{
// public override Vector2 Bounds { get => bounds; }
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_0 = __this->get_bounds_9();
return L_0;
}
}
// System.Boolean Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_ColliderEnabled()
extern "C" IL2CPP_METHOD_ATTR bool NearInteractionTouchable_get_ColliderEnabled_mBF16A833EAE1E030F67BD1970D7B8DE1DF946839 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
{
// public bool ColliderEnabled { get { return touchableCollider.enabled && touchableCollider.gameObject.activeInHierarchy; } }
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_0 = __this->get_touchableCollider_10();
NullCheck(L_0);
bool L_1 = Collider_get_enabled_mED644D98C6AC2DF95BD86145E8D31AD7081C76EB(L_0, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_001e;
}
}
{
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_2 = __this->get_touchableCollider_10();
NullCheck(L_2);
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * L_3 = Component_get_gameObject_m0B0570BA8DDD3CD78A9DB568EA18D7317686603C(L_2, /*hidden argument*/NULL);
NullCheck(L_3);
bool L_4 = GameObject_get_activeInHierarchy_mDEE60F1B28281974BA9880EC448682F3DAABB1EF(L_3, /*hidden argument*/NULL);
return L_4;
}
IL_001e:
{
return (bool)0;
}
}
// UnityEngine.Collider Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::get_TouchableCollider()
extern "C" IL2CPP_METHOD_ATTR Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * NearInteractionTouchable_get_TouchableCollider_mA14466F379CFB48FB44E6560D0373BECB2D7B843 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
{
// public Collider TouchableCollider => touchableCollider;
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_0 = __this->get_touchableCollider_10();
return L_0;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::OnValidate()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_OnValidate_m047380B61B41024739C6CE9E42E719ECAECC1D53 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_OnValidate_m047380B61B41024739C6CE9E42E719ECAECC1D53_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * G_B4_0 = NULL;
String_t* G_B4_1 = NULL;
RuntimeObject* G_B4_2 = NULL;
Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * G_B3_0 = NULL;
String_t* G_B3_1 = NULL;
RuntimeObject* G_B3_2 = NULL;
{
// if (Application.isPlaying)
bool L_0 = Application_get_isPlaying_mF43B519662E7433DD90D883E5AE22EC3CFB65CA5(/*hidden argument*/NULL);
if (!L_0)
{
goto IL_0008;
}
}
{
// return;
return;
}
IL_0008:
{
// base.OnValidate();
BaseNearInteractionTouchable_OnValidate_mB0870F6834D1D27AF40A4ABA88A9908421FA0D86(__this, /*hidden argument*/NULL);
// touchableCollider = GetComponent<Collider>();
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_1 = Component_GetComponent_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m6B8E8E0E0AF6B08652B81B7950FC5AF63EAD40C6(__this, /*hidden argument*/Component_GetComponent_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m6B8E8E0E0AF6B08652B81B7950FC5AF63EAD40C6_RuntimeMethod_var);
__this->set_touchableCollider_10(L_1);
// string hierarchy = gameObject.transform.EnumerateAncestors(true).Aggregate("", (result, next) => next.gameObject.name + "=>" + result);
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * L_2 = Component_get_gameObject_m0B0570BA8DDD3CD78A9DB568EA18D7317686603C(__this, /*hidden argument*/NULL);
NullCheck(L_2);
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_3 = GameObject_get_transform_mA5C38857137F137CB96C69FAA624199EB1C2FB2C(L_2, /*hidden argument*/NULL);
RuntimeObject* L_4 = TransformExtensions_EnumerateAncestors_m0BBFB95BF7AD93230EDB9861754A7B2161DF7EF8(L_3, (bool)1, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_il2cpp_TypeInfo_var);
Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * L_5 = ((U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_StaticFields*)il2cpp_codegen_static_fields_for(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_il2cpp_TypeInfo_var))->get_U3CU3E9__25_0_1();
Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * L_6 = L_5;
G_B3_0 = L_6;
G_B3_1 = _stringLiteralDA39A3EE5E6B4B0D3255BFEF95601890AFD80709;
G_B3_2 = L_4;
if (L_6)
{
G_B4_0 = L_6;
G_B4_1 = _stringLiteralDA39A3EE5E6B4B0D3255BFEF95601890AFD80709;
G_B4_2 = L_4;
goto IL_004f;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_il2cpp_TypeInfo_var);
U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F * L_7 = ((U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_StaticFields*)il2cpp_codegen_static_fields_for(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_il2cpp_TypeInfo_var))->get_U3CU3E9_0();
Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * L_8 = (Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 *)il2cpp_codegen_object_new(Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875_il2cpp_TypeInfo_var);
Func_3__ctor_m0D8C1007F600903496B78C6ECE280BA3B092E0AB(L_8, L_7, (intptr_t)((intptr_t)U3CU3Ec_U3COnValidateU3Eb__25_0_m13C96469FB6E22E845F6847319ED4D577723868F_RuntimeMethod_var), /*hidden argument*/Func_3__ctor_m0D8C1007F600903496B78C6ECE280BA3B092E0AB_RuntimeMethod_var);
Func_3_tFE37AA67AECF512EC6C360214537ED447EC86875 * L_9 = L_8;
((U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_StaticFields*)il2cpp_codegen_static_fields_for(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_il2cpp_TypeInfo_var))->set_U3CU3E9__25_0_1(L_9);
G_B4_0 = L_9;
G_B4_1 = G_B3_1;
G_B4_2 = G_B3_2;
}
IL_004f:
{
Enumerable_Aggregate_TisTransform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA_TisString_t_mDBB0A69F0AC196B0AE6D937BDDE7DE0543598AAF(G_B4_2, G_B4_1, G_B4_0, /*hidden argument*/Enumerable_Aggregate_TisTransform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA_TisString_t_mDBB0A69F0AC196B0AE6D937BDDE7DE0543598AAF_RuntimeMethod_var);
// if (localUp.sqrMagnitude == 1 && localForward.sqrMagnitude == 1)
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_10 = __this->get_address_of_localUp_7();
float L_11 = Vector3_get_sqrMagnitude_m1C6E190B4A933A183B308736DEC0DD64B0588968((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_10, /*hidden argument*/NULL);
if ((!(((float)L_11) == ((float)(1.0f)))))
{
goto IL_0079;
}
}
{
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_12 = __this->get_address_of_localForward_6();
float L_13 = Vector3_get_sqrMagnitude_m1C6E190B4A933A183B308736DEC0DD64B0588968((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_12, /*hidden argument*/NULL);
}
IL_0079:
{
// localForward = localForward.normalized;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_14 = __this->get_address_of_localForward_6();
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_15 = Vector3_get_normalized_mE20796F1D2D36244FACD4D14DADB245BE579849B((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_14, /*hidden argument*/NULL);
__this->set_localForward_6(L_15);
// localUp = localUp.normalized;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_16 = __this->get_address_of_localUp_7();
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_17 = Vector3_get_normalized_mE20796F1D2D36244FACD4D14DADB245BE579849B((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_16, /*hidden argument*/NULL);
__this->set_localUp_7(L_17);
// bounds.x = Mathf.Max(bounds.x, 0);
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * L_18 = __this->get_address_of_bounds_9();
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * L_19 = __this->get_address_of_bounds_9();
float L_20 = L_19->get_x_0();
IL2CPP_RUNTIME_CLASS_INIT(Mathf_tFBDE6467D269BFE410605C7D806FD9991D4A89CB_il2cpp_TypeInfo_var);
float L_21 = Mathf_Max_m670AE0EC1B09ED1A56FF9606B0F954670319CB65(L_20, (0.0f), /*hidden argument*/NULL);
L_18->set_x_0(L_21);
// bounds.y = Mathf.Max(bounds.y, 0);
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * L_22 = __this->get_address_of_bounds_9();
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * L_23 = __this->get_address_of_bounds_9();
float L_24 = L_23->get_y_1();
float L_25 = Mathf_Max_m670AE0EC1B09ED1A56FF9606B0F954670319CB65(L_24, (0.0f), /*hidden argument*/NULL);
L_22->set_y_1(L_25);
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::OnEnable()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_OnEnable_m6845EF2554645D479BB0D339043B14D7011552E5 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_OnEnable_m6845EF2554645D479BB0D339043B14D7011552E5_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// if (touchableCollider == null)
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_0 = __this->get_touchableCollider_10();
IL2CPP_RUNTIME_CLASS_INIT(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Equality_mBC2401774F3BE33E8CF6F0A8148E66C95D6CFF1C(L_0, (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_001a;
}
}
{
// SetTouchableCollider(GetComponent<BoxCollider>());
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_2 = Component_GetComponent_TisBoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_m81892AA8DC35D8BB06288E5A4C16CF366174953E(__this, /*hidden argument*/Component_GetComponent_TisBoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_m81892AA8DC35D8BB06288E5A4C16CF366174953E_RuntimeMethod_var);
NearInteractionTouchable_SetTouchableCollider_mB65CD4B430EC4A349EBB784B880A1B74338EFA7C(__this, L_2, /*hidden argument*/NULL);
}
IL_001a:
{
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetLocalForward(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetLocalForward_mFFEFB910719A23348845F464101E0B58C4D074A2 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___newLocalForward0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_SetLocalForward_mFFEFB910719A23348845F464101E0B58C4D074A2_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 V_0;
memset(&V_0, 0, sizeof(V_0));
{
// localForward = newLocalForward;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = ___newLocalForward0;
__this->set_localForward_6(L_0);
// localUp = Vector3.Cross(localForward, LocalRight).normalized;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = __this->get_localForward_6();
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_2 = NearInteractionTouchable_get_LocalRight_mFC9863CB3DE0A6D313338A0EE41C55FEDE62CAFA(__this, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_3 = Vector3_Cross_m3E9DBC445228FDB850BDBB4B01D6F61AC0111887(L_1, L_2, /*hidden argument*/NULL);
V_0 = L_3;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_4 = Vector3_get_normalized_mE20796F1D2D36244FACD4D14DADB245BE579849B((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)(&V_0), /*hidden argument*/NULL);
__this->set_localUp_7(L_4);
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetLocalUp(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetLocalUp_m71BA25ADBE848DD133CBC866015CCBEE99BA3E7D (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___newLocalUp0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_SetLocalUp_m71BA25ADBE848DD133CBC866015CCBEE99BA3E7D_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 V_0;
memset(&V_0, 0, sizeof(V_0));
{
// localUp = newLocalUp;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = ___newLocalUp0;
__this->set_localUp_7(L_0);
// localForward = Vector3.Cross(LocalRight, localUp).normalized;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = NearInteractionTouchable_get_LocalRight_mFC9863CB3DE0A6D313338A0EE41C55FEDE62CAFA(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_2 = __this->get_localUp_7();
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_3 = Vector3_Cross_m3E9DBC445228FDB850BDBB4B01D6F61AC0111887(L_1, L_2, /*hidden argument*/NULL);
V_0 = L_3;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_4 = Vector3_get_normalized_mE20796F1D2D36244FACD4D14DADB245BE579849B((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)(&V_0), /*hidden argument*/NULL);
__this->set_localForward_6(L_4);
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetLocalCenter(UnityEngine.Vector3)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetLocalCenter_mEA407BD05175F0BDA1F437D2D30EC9EAC659D99F (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___newLocalCenter0, const RuntimeMethod* method)
{
{
// localCenter = newLocalCenter;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = ___newLocalCenter0;
__this->set_localCenter_8(L_0);
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetBounds(UnityEngine.Vector2)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetBounds_mE28573D386ACCF366D119BE293A48198C42894BC (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, Vector2_tA85D2DD88578276CA8A8796756458277E72D073D ___newBounds0, const RuntimeMethod* method)
{
{
// bounds = newBounds;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_0 = ___newBounds0;
__this->set_bounds_9(L_0);
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::SetTouchableCollider(UnityEngine.BoxCollider)
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable_SetTouchableCollider_mB65CD4B430EC4A349EBB784B880A1B74338EFA7C (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * ___newCollider0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_SetTouchableCollider_mB65CD4B430EC4A349EBB784B880A1B74338EFA7C_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D V_0;
memset(&V_0, 0, sizeof(V_0));
{
// if (newCollider != null)
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_0 = ___newCollider0;
IL2CPP_RUNTIME_CLASS_INIT(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Inequality_m31EF58E217E8F4BDD3E409DEF79E1AEE95874FC1(L_0, (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_00a7;
}
}
{
// touchableCollider = newCollider;
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_2 = ___newCollider0;
__this->set_touchableCollider_10(L_2);
// SetLocalForward(-Vector3.forward);
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_3 = Vector3_get_forward_m3E2E192B3302130098738C308FA1EE1439449D0D(/*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_4 = Vector3_op_UnaryNegation_m2AFBBF22801F9BCA5A4EBE642A29F433FE1339C2(L_3, /*hidden argument*/NULL);
NearInteractionTouchable_SetLocalForward_mFFEFB910719A23348845F464101E0B58C4D074A2(__this, L_4, /*hidden argument*/NULL);
// Vector2 adjustedSize = new Vector2(
// Math.Abs(Vector3.Dot(newCollider.size, LocalRight)),
// Math.Abs(Vector3.Dot(newCollider.size, LocalUp)));
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_5 = ___newCollider0;
NullCheck(L_5);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_6 = BoxCollider_get_size_m1C7DA815D3BA9DDB3D92A58BEEFE2FCBA5206FE2(L_5, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_7 = NearInteractionTouchable_get_LocalRight_mFC9863CB3DE0A6D313338A0EE41C55FEDE62CAFA(__this, /*hidden argument*/NULL);
float L_8 = Vector3_Dot_m0C530E1C51278DE28B77906D56356506232272C1(L_6, L_7, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Math_tFB388E53C7FDC6FCCF9A19ABF5A4E521FBD52E19_il2cpp_TypeInfo_var);
float L_9 = fabsf(L_8);
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_10 = ___newCollider0;
NullCheck(L_10);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_11 = BoxCollider_get_size_m1C7DA815D3BA9DDB3D92A58BEEFE2FCBA5206FE2(L_10, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_12 = NearInteractionTouchable_get_LocalUp_mA12848F9601BFEF5CEE01600C128A5496FF3D91E(__this, /*hidden argument*/NULL);
float L_13 = Vector3_Dot_m0C530E1C51278DE28B77906D56356506232272C1(L_11, L_12, /*hidden argument*/NULL);
float L_14 = fabsf(L_13);
Vector2__ctor_mEE8FB117AB1F8DB746FB8B3EB4C0DA3BF2A230D0((Vector2_tA85D2DD88578276CA8A8796756458277E72D073D *)(&V_0), L_9, L_14, /*hidden argument*/NULL);
// SetBounds(adjustedSize);
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_15 = V_0;
NearInteractionTouchable_SetBounds_mE28573D386ACCF366D119BE293A48198C42894BC(__this, L_15, /*hidden argument*/NULL);
// SetLocalCenter(newCollider.center + Vector3.Scale(newCollider.size / 2.0f, LocalForward));
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_16 = ___newCollider0;
NullCheck(L_16);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_17 = BoxCollider_get_center_mA9164B9949F419A35CC949685F1DC14588BC6402(L_16, /*hidden argument*/NULL);
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_18 = ___newCollider0;
NullCheck(L_18);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_19 = BoxCollider_get_size_m1C7DA815D3BA9DDB3D92A58BEEFE2FCBA5206FE2(L_18, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_20 = Vector3_op_Division_mDF34F1CC445981B4D1137765BC6277419E561624(L_19, (2.0f), /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_21 = NearInteractionTouchable_get_LocalForward_m051017BDD802785A576C5DAD40D69919945D68C6(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_22 = Vector3_Scale_m77004B226483C7644B3F4A46B950589EE8F88775(L_20, L_21, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_23 = Vector3_op_Addition_m929F9C17E5D11B94D50B4AFF1D730B70CB59B50E(L_17, L_22, /*hidden argument*/NULL);
NearInteractionTouchable_SetLocalCenter_mEA407BD05175F0BDA1F437D2D30EC9EAC659D99F(__this, L_23, /*hidden argument*/NULL);
// BoxCollider attachedBoxCollider = GetComponent<BoxCollider>();
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_24 = Component_GetComponent_TisBoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_m81892AA8DC35D8BB06288E5A4C16CF366174953E(__this, /*hidden argument*/Component_GetComponent_TisBoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA_m81892AA8DC35D8BB06288E5A4C16CF366174953E_RuntimeMethod_var);
// attachedBoxCollider.size = newCollider.size;
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_25 = L_24;
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_26 = ___newCollider0;
NullCheck(L_26);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_27 = BoxCollider_get_size_m1C7DA815D3BA9DDB3D92A58BEEFE2FCBA5206FE2(L_26, /*hidden argument*/NULL);
NullCheck(L_25);
BoxCollider_set_size_m65F9B4BD610D3094313EC8D1C5CE58D1D345A176(L_25, L_27, /*hidden argument*/NULL);
// attachedBoxCollider.center = newCollider.center;
BoxCollider_t2DF257BBBFCABE0B9D78B21D238298D1942BFBAA * L_28 = ___newCollider0;
NullCheck(L_28);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_29 = BoxCollider_get_center_mA9164B9949F419A35CC949685F1DC14588BC6402(L_28, /*hidden argument*/NULL);
NullCheck(L_25);
BoxCollider_set_center_m8A871056CA383C9932A7694FE396A1EFA247FC69(L_25, L_29, /*hidden argument*/NULL);
// }
return;
}
IL_00a7:
{
// Debug.LogWarning("BoxCollider is null, cannot set bounds of NearInteractionTouchable plane");
IL2CPP_RUNTIME_CLASS_INIT(Debug_t7B5FCB117E2FD63B6838BC52821B252E2BFB61C4_il2cpp_TypeInfo_var);
Debug_LogWarning_m37338644DC81F640CCDFEAE35A223F0E965F0568(_stringLiteralF8063269B3AD7E1E22E65A00A5927927EA6711A7, /*hidden argument*/NULL);
// }
return;
}
}
// System.Single Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::DistanceToTouchable(UnityEngine.Vector3,UnityEngine.Vector3U26)
extern "C" IL2CPP_METHOD_ATTR float NearInteractionTouchable_DistanceToTouchable_m5F9A142552464723354ECB9D6D52FAA9948C5D1A (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___samplePoint0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * ___normal1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable_DistanceToTouchable_m5F9A142552464723354ECB9D6D52FAA9948C5D1A_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 V_0;
memset(&V_0, 0, sizeof(V_0));
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 V_1;
memset(&V_1, 0, sizeof(V_1));
{
// normal = Forward;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_0 = ___normal1;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = NearInteractionTouchable_get_Forward_m5CEE4412F619AAF894FAF4129E29029BDDD653E7(__this, /*hidden argument*/NULL);
*(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_0 = L_1;
// Vector3 localPoint = transform.InverseTransformPoint(samplePoint) - localCenter;
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_2 = Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_3 = ___samplePoint0;
NullCheck(L_2);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_4 = Transform_InverseTransformPoint_mB6E3145F20B531B4A781C194BAC43A8255C96C47(L_2, L_3, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_5 = __this->get_localCenter_8();
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_6 = Vector3_op_Subtraction_mF9846B723A5034F8B9F5F5DCB78E3D67649143D3(L_4, L_5, /*hidden argument*/NULL);
V_0 = L_6;
// Vector3 planeSpacePoint = new Vector3(
// Vector3.Dot(localPoint, LocalRight),
// Vector3.Dot(localPoint, localUp),
// Vector3.Dot(localPoint, localForward));
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_7 = V_0;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_8 = NearInteractionTouchable_get_LocalRight_mFC9863CB3DE0A6D313338A0EE41C55FEDE62CAFA(__this, /*hidden argument*/NULL);
float L_9 = Vector3_Dot_m0C530E1C51278DE28B77906D56356506232272C1(L_7, L_8, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_10 = V_0;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_11 = __this->get_localUp_7();
float L_12 = Vector3_Dot_m0C530E1C51278DE28B77906D56356506232272C1(L_10, L_11, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_13 = V_0;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_14 = __this->get_localForward_6();
float L_15 = Vector3_Dot_m0C530E1C51278DE28B77906D56356506232272C1(L_13, L_14, /*hidden argument*/NULL);
Vector3__ctor_m08F61F548AA5836D8789843ACB4A81E4963D2EE1((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)(&V_1), L_9, L_12, L_15, /*hidden argument*/NULL);
// if (planeSpacePoint.x < -bounds.x / 2 ||
// planeSpacePoint.x > bounds.x / 2 ||
// planeSpacePoint.y < -bounds.y / 2 ||
// planeSpacePoint.y > bounds.y / 2)
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_16 = V_1;
float L_17 = L_16.get_x_2();
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * L_18 = __this->get_address_of_bounds_9();
float L_19 = L_18->get_x_0();
if ((((float)L_17) < ((float)((float)((float)((-L_19))/(float)(2.0f))))))
{
goto IL_00b5;
}
}
{
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_20 = V_1;
float L_21 = L_20.get_x_2();
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * L_22 = __this->get_address_of_bounds_9();
float L_23 = L_22->get_x_0();
if ((((float)L_21) > ((float)((float)((float)L_23/(float)(2.0f))))))
{
goto IL_00b5;
}
}
{
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_24 = V_1;
float L_25 = L_24.get_y_3();
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * L_26 = __this->get_address_of_bounds_9();
float L_27 = L_26->get_y_1();
if ((((float)L_25) < ((float)((float)((float)((-L_27))/(float)(2.0f))))))
{
goto IL_00b5;
}
}
{
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_28 = V_1;
float L_29 = L_28.get_y_3();
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * L_30 = __this->get_address_of_bounds_9();
float L_31 = L_30->get_y_1();
if ((!(((float)L_29) > ((float)((float)((float)L_31/(float)(2.0f)))))))
{
goto IL_00bb;
}
}
IL_00b5:
{
// return float.PositiveInfinity;
return (std::numeric_limits<float>::infinity());
}
IL_00bb:
{
// planeSpacePoint = transform.TransformSize(planeSpacePoint);
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_32 = Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_33 = V_1;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_34 = TransformExtensions_TransformSize_m7D4944A998F0328A3C481C4CB7D4071B66C6C9FC(L_32, L_33, /*hidden argument*/NULL);
V_1 = L_34;
// return Math.Abs(planeSpacePoint.z);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_35 = V_1;
float L_36 = L_35.get_z_4();
IL2CPP_RUNTIME_CLASS_INIT(Math_tFB388E53C7FDC6FCCF9A19ABF5A4E521FBD52E19_il2cpp_TypeInfo_var);
float L_37 = fabsf(L_36);
return L_37;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable::.ctor()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchable__ctor_m7708FA2DCE88B56F007C018396790FB945EDA284 (NearInteractionTouchable_tD54B757F38E2975DC793EC712A2D6A9AC1DB02C6 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchable__ctor_m7708FA2DCE88B56F007C018396790FB945EDA284_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// protected Vector3 localForward = -Vector3.forward;
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = Vector3_get_forward_m3E2E192B3302130098738C308FA1EE1439449D0D(/*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = Vector3_op_UnaryNegation_m2AFBBF22801F9BCA5A4EBE642A29F433FE1339C2(L_0, /*hidden argument*/NULL);
__this->set_localForward_6(L_1);
// protected Vector3 localUp = Vector3.up;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_2 = Vector3_get_up_m6309EBC4E42D6D0B3D28056BD23D0331275306F7(/*hidden argument*/NULL);
__this->set_localUp_7(L_2);
// protected Vector3 localCenter = Vector3.zero;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_3 = Vector3_get_zero_m3CDDCAE94581DF3BB16C4B40A100E28E9C6649C2(/*hidden argument*/NULL);
__this->set_localCenter_8(L_3);
// protected Vector2 bounds = Vector2.zero;
IL2CPP_RUNTIME_CLASS_INIT(Vector2_tA85D2DD88578276CA8A8796756458277E72D073D_il2cpp_TypeInfo_var);
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_4 = Vector2_get_zero_mFE0C3213BB698130D6C5247AB4B887A59074D0A8(/*hidden argument*/NULL);
__this->set_bounds_9(L_4);
NearInteractionTouchableSurface__ctor_m0652A9DE8ABF997A9B54E152DE88CC6B236B7467(__this, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable_<>c::.cctor()
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec__cctor_mFE4341382B1F2DD340B05B741812B34B419A3AF9 (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec__cctor_mFE4341382B1F2DD340B05B741812B34B419A3AF9_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F * L_0 = (U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F *)il2cpp_codegen_object_new(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_il2cpp_TypeInfo_var);
U3CU3Ec__ctor_m99D33C029D09150A6801E738B35164BD71094240(L_0, /*hidden argument*/NULL);
((U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_StaticFields*)il2cpp_codegen_static_fields_for(U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F_il2cpp_TypeInfo_var))->set_U3CU3E9_0(L_0);
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable_<>c::.ctor()
extern "C" IL2CPP_METHOD_ATTR void U3CU3Ec__ctor_m99D33C029D09150A6801E738B35164BD71094240 (U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F * __this, const RuntimeMethod* method)
{
{
Object__ctor_m925ECA5E85CA100E3FB86A4F9E15C120E9A184C0(__this, /*hidden argument*/NULL);
return;
}
}
// System.String Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchable_<>c::<OnValidate>b__25_0(System.String,UnityEngine.Transform)
extern "C" IL2CPP_METHOD_ATTR String_t* U3CU3Ec_U3COnValidateU3Eb__25_0_m13C96469FB6E22E845F6847319ED4D577723868F (U3CU3Ec_t9CDAA3EB31D259A66BE3D31038C7A28827A52C1F * __this, String_t* ___result0, Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * ___next1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (U3CU3Ec_U3COnValidateU3Eb__25_0_m13C96469FB6E22E845F6847319ED4D577723868F_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// string hierarchy = gameObject.transform.EnumerateAncestors(true).Aggregate("", (result, next) => next.gameObject.name + "=>" + result);
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_0 = ___next1;
NullCheck(L_0);
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * L_1 = Component_get_gameObject_m0B0570BA8DDD3CD78A9DB568EA18D7317686603C(L_0, /*hidden argument*/NULL);
NullCheck(L_1);
String_t* L_2 = Object_get_name_mA2D400141CB3C991C87A2556429781DE961A83CE(L_1, /*hidden argument*/NULL);
String_t* L_3 = ___result0;
String_t* L_4 = String_Concat_mF4626905368D6558695A823466A1AF65EADB9923(L_2, _stringLiteral4D2A116113E32BCCEAF300821EDE7A9665B3F990, L_3, /*hidden argument*/NULL);
return L_4;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableSurface::.ctor()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchableSurface__ctor_m0652A9DE8ABF997A9B54E152DE88CC6B236B7467 (NearInteractionTouchableSurface_tA76CE06BC3E03D9BEAA234C28E2388D9F980D22C * __this, const RuntimeMethod* method)
{
{
BaseNearInteractionTouchable__ctor_m635FAE023CB66064C86C6B0B48CE5D1B3869D5E9(__this, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.IReadOnlyList`1<Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI> Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::get_Instances()
extern "C" IL2CPP_METHOD_ATTR RuntimeObject* NearInteractionTouchableUnityUI_get_Instances_m976EAEBDEB44DBD1450CA6852F291DECC91E81FF (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI_get_Instances_m976EAEBDEB44DBD1450CA6852F291DECC91E81FF_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// public static IReadOnlyList<NearInteractionTouchableUnityUI> Instances => instances;
IL2CPP_RUNTIME_CLASS_INIT(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_il2cpp_TypeInfo_var);
List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * L_0 = ((NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_StaticFields*)il2cpp_codegen_static_fields_for(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_il2cpp_TypeInfo_var))->get_instances_7();
return L_0;
}
}
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::get_LocalCenter()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchableUnityUI_get_LocalCenter_m1185B40128671E37C1D0BE4E5E443F86A753A0F6 (NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI_get_LocalCenter_m1185B40128671E37C1D0BE4E5E443F86A753A0F6_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// public override Vector3 LocalCenter => Vector3.zero;
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = Vector3_get_zero_m3CDDCAE94581DF3BB16C4B40A100E28E9C6649C2(/*hidden argument*/NULL);
return L_0;
}
}
// UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::get_LocalPressDirection()
extern "C" IL2CPP_METHOD_ATTR Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 NearInteractionTouchableUnityUI_get_LocalPressDirection_mA28883F1E6FD19B60C4B28B71E93DC0290EF7120 (NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI_get_LocalPressDirection_mA28883F1E6FD19B60C4B28B71E93DC0290EF7120_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// public override Vector3 LocalPressDirection => Vector3.forward;
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_0 = Vector3_get_forward_m3E2E192B3302130098738C308FA1EE1439449D0D(/*hidden argument*/NULL);
return L_0;
}
}
// UnityEngine.Vector2 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::get_Bounds()
extern "C" IL2CPP_METHOD_ATTR Vector2_tA85D2DD88578276CA8A8796756458277E72D073D NearInteractionTouchableUnityUI_get_Bounds_mF40A324E41E7F0E9A8D61CD31BD0C977C0F8F80E (NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI_get_Bounds_mF40A324E41E7F0E9A8D61CD31BD0C977C0F8F80E_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Rect_t35B976DE901B5423C11705E156938EA27AB402CE V_0;
memset(&V_0, 0, sizeof(V_0));
{
// public override Vector2 Bounds => rectTransform.Value.rect.size;
Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 * L_0 = __this->get_rectTransform_6();
NullCheck(L_0);
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * L_1 = Lazy_1_get_Value_m14285D8A1AD14C080ED2D95FACA7366ED99FE4F2(L_0, /*hidden argument*/Lazy_1_get_Value_m14285D8A1AD14C080ED2D95FACA7366ED99FE4F2_RuntimeMethod_var);
NullCheck(L_1);
Rect_t35B976DE901B5423C11705E156938EA27AB402CE L_2 = RectTransform_get_rect_mE5F283FCB99A66403AC1F0607CA49C156D73A15E(L_1, /*hidden argument*/NULL);
V_0 = L_2;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_3 = Rect_get_size_m731642B8F03F6CE372A2C9E2E4A925450630606C((Rect_t35B976DE901B5423C11705E156938EA27AB402CE *)(&V_0), /*hidden argument*/NULL);
return L_3;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::.ctor()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchableUnityUI__ctor_mB8ECCCECC0F29FAD6BBB04097B40E34E44DF7E34 (NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI__ctor_mB8ECCCECC0F29FAD6BBB04097B40E34E44DF7E34_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// public NearInteractionTouchableUnityUI()
NearInteractionTouchableSurface__ctor_m0652A9DE8ABF997A9B54E152DE88CC6B236B7467(__this, /*hidden argument*/NULL);
// rectTransform = new Lazy<RectTransform>(GetComponent<RectTransform>);
Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC * L_0 = (Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC *)il2cpp_codegen_object_new(Func_1_t3AE1617AFFCE3777C6509180026C803D862960EC_il2cpp_TypeInfo_var);
Func_1__ctor_m9CD37EDF32B1025161B21189308A89FBCB3D31D0(L_0, __this, (intptr_t)((intptr_t)Component_GetComponent_TisRectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20_m751D9E690C55EAC53AB8C54812EFEAA238E52575_RuntimeMethod_var), /*hidden argument*/Func_1__ctor_m9CD37EDF32B1025161B21189308A89FBCB3D31D0_RuntimeMethod_var);
Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 * L_1 = (Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 *)il2cpp_codegen_object_new(Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4_il2cpp_TypeInfo_var);
Lazy_1__ctor_mB678E6E7BEB0C87364A66EF9597E7546BAC3632B(L_1, L_0, /*hidden argument*/Lazy_1__ctor_mB678E6E7BEB0C87364A66EF9597E7546BAC3632B_RuntimeMethod_var);
__this->set_rectTransform_6(L_1);
// }
return;
}
}
// System.Single Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::DistanceToTouchable(UnityEngine.Vector3,UnityEngine.Vector3U26)
extern "C" IL2CPP_METHOD_ATTR float NearInteractionTouchableUnityUI_DistanceToTouchable_m59B08E19DDBB7CABCEC0A50C4821303EB75C3506 (NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___samplePoint0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * ___normal1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI_DistanceToTouchable_m59B08E19DDBB7CABCEC0A50C4821303EB75C3506_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 V_0;
memset(&V_0, 0, sizeof(V_0));
Rect_t35B976DE901B5423C11705E156938EA27AB402CE V_1;
memset(&V_1, 0, sizeof(V_1));
{
// normal = transform.TransformDirection(-LocalPressDirection);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_0 = ___normal1;
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_1 = Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_2 = VirtFuncInvoker0< Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 >::Invoke(7 /* UnityEngine.Vector3 Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableSurface::get_LocalPressDirection() */, __this);
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_3 = Vector3_op_UnaryNegation_m2AFBBF22801F9BCA5A4EBE642A29F433FE1339C2(L_2, /*hidden argument*/NULL);
NullCheck(L_1);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_4 = Transform_TransformDirection_m85FC1D7E1322E94F65DA59AEF3B1166850B183EF(L_1, L_3, /*hidden argument*/NULL);
*(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_0 = L_4;
// Vector3 localPoint = transform.InverseTransformPoint(samplePoint);
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_5 = Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_6 = ___samplePoint0;
NullCheck(L_5);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_7 = Transform_InverseTransformPoint_mB6E3145F20B531B4A781C194BAC43A8255C96C47(L_5, L_6, /*hidden argument*/NULL);
V_0 = L_7;
// if (!rectTransform.Value.rect.Contains(localPoint))
Lazy_1_tD2C2BE8F758DC9A6D241E6920D8A6D441B86EDF4 * L_8 = __this->get_rectTransform_6();
NullCheck(L_8);
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * L_9 = Lazy_1_get_Value_m14285D8A1AD14C080ED2D95FACA7366ED99FE4F2(L_8, /*hidden argument*/Lazy_1_get_Value_m14285D8A1AD14C080ED2D95FACA7366ED99FE4F2_RuntimeMethod_var);
NullCheck(L_9);
Rect_t35B976DE901B5423C11705E156938EA27AB402CE L_10 = RectTransform_get_rect_mE5F283FCB99A66403AC1F0607CA49C156D73A15E(L_9, /*hidden argument*/NULL);
V_1 = L_10;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_11 = V_0;
bool L_12 = Rect_Contains_m5072228CE6251E7C754F227BA330F9ADA95C1495((Rect_t35B976DE901B5423C11705E156938EA27AB402CE *)(&V_1), L_11, /*hidden argument*/NULL);
if (L_12)
{
goto IL_004a;
}
}
{
// return float.PositiveInfinity;
return (std::numeric_limits<float>::infinity());
}
IL_004a:
{
// localPoint = transform.TransformSize(localPoint);
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_13 = Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_14 = V_0;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_15 = TransformExtensions_TransformSize_m7D4944A998F0328A3C481C4CB7D4071B66C6C9FC(L_13, L_14, /*hidden argument*/NULL);
V_0 = L_15;
// return Math.Abs(localPoint.z);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_16 = V_0;
float L_17 = L_16.get_z_4();
IL2CPP_RUNTIME_CLASS_INIT(Math_tFB388E53C7FDC6FCCF9A19ABF5A4E521FBD52E19_il2cpp_TypeInfo_var);
float L_18 = fabsf(L_17);
return L_18;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::OnEnable()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchableUnityUI_OnEnable_m48775AAAFEBF81B07ADD1ABE677361924C579A85 (NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI_OnEnable_m48775AAAFEBF81B07ADD1ABE677361924C579A85_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// instances.Add(this);
IL2CPP_RUNTIME_CLASS_INIT(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_il2cpp_TypeInfo_var);
List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * L_0 = ((NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_StaticFields*)il2cpp_codegen_static_fields_for(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_il2cpp_TypeInfo_var))->get_instances_7();
NullCheck(L_0);
List_1_Add_m51E390D6AAE28EDE48EB34922D24A6486E79301E(L_0, __this, /*hidden argument*/List_1_Add_m51E390D6AAE28EDE48EB34922D24A6486E79301E_RuntimeMethod_var);
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::OnDisable()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchableUnityUI_OnDisable_m67341F4AA3F7BA72DD73D099D6036EEC1DEF1822 (NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI_OnDisable_m67341F4AA3F7BA72DD73D099D6036EEC1DEF1822_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// instances.Remove(this);
IL2CPP_RUNTIME_CLASS_INIT(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_il2cpp_TypeInfo_var);
List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * L_0 = ((NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_StaticFields*)il2cpp_codegen_static_fields_for(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_il2cpp_TypeInfo_var))->get_instances_7();
NullCheck(L_0);
List_1_Remove_mF5E9EF3C7DDB6497E7DD976562DCAAB5D04B7009(L_0, __this, /*hidden argument*/List_1_Remove_mF5E9EF3C7DDB6497E7DD976562DCAAB5D04B7009_RuntimeMethod_var);
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableUnityUI::.cctor()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchableUnityUI__cctor_m0C36EE5FF226A16F3992B3FC30FC991D55410183 (const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableUnityUI__cctor_m0C36EE5FF226A16F3992B3FC30FC991D55410183_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// private static readonly List<NearInteractionTouchableUnityUI> instances = new List<NearInteractionTouchableUnityUI>();
List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 * L_0 = (List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698 *)il2cpp_codegen_object_new(List_1_t9CAB2FC61807CF1A2D26904B169E6F6198A47698_il2cpp_TypeInfo_var);
List_1__ctor_m74736E94D5684A6D227C7CD74E8C331636A65A5A(L_0, /*hidden argument*/List_1__ctor_m74736E94D5684A6D227C7CD74E8C331636A65A5A_RuntimeMethod_var);
((NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_StaticFields*)il2cpp_codegen_static_fields_for(NearInteractionTouchableUnityUI_t30E293F7578C91E816E53312344277043BF22B70_il2cpp_TypeInfo_var))->set_instances_7(L_0);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Boolean Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume::get_ColliderEnabled()
extern "C" IL2CPP_METHOD_ATTR bool NearInteractionTouchableVolume_get_ColliderEnabled_m0EC00C297DD9D7EC6C5EC566BCC7BB7C1D7BDED4 (NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC * __this, const RuntimeMethod* method)
{
{
// public bool ColliderEnabled { get { return touchableCollider.enabled && touchableCollider.gameObject.activeInHierarchy; } }
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_0 = __this->get_touchableCollider_6();
NullCheck(L_0);
bool L_1 = Collider_get_enabled_mED644D98C6AC2DF95BD86145E8D31AD7081C76EB(L_0, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_001e;
}
}
{
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_2 = __this->get_touchableCollider_6();
NullCheck(L_2);
GameObject_tBD1244AD56B4E59AAD76E5E7C9282EC5CE434F0F * L_3 = Component_get_gameObject_m0B0570BA8DDD3CD78A9DB568EA18D7317686603C(L_2, /*hidden argument*/NULL);
NullCheck(L_3);
bool L_4 = GameObject_get_activeInHierarchy_mDEE60F1B28281974BA9880EC448682F3DAABB1EF(L_3, /*hidden argument*/NULL);
return L_4;
}
IL_001e:
{
return (bool)0;
}
}
// UnityEngine.Collider Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume::get_TouchableCollider()
extern "C" IL2CPP_METHOD_ATTR Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * NearInteractionTouchableVolume_get_TouchableCollider_mC7B24E276AE648A232360ADC24F9CD1FE04A37D3 (NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC * __this, const RuntimeMethod* method)
{
{
// public Collider TouchableCollider => touchableCollider;
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_0 = __this->get_touchableCollider_6();
return L_0;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume::OnValidate()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchableVolume_OnValidate_m002F953D9325C419B21B9282A5C27DAD7982EB0A (NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableVolume_OnValidate_m002F953D9325C419B21B9282A5C27DAD7982EB0A_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// base.OnValidate();
BaseNearInteractionTouchable_OnValidate_mB0870F6834D1D27AF40A4ABA88A9908421FA0D86(__this, /*hidden argument*/NULL);
// touchableCollider = GetComponent<Collider>();
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_0 = Component_GetComponent_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m6B8E8E0E0AF6B08652B81B7950FC5AF63EAD40C6(__this, /*hidden argument*/Component_GetComponent_TisCollider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF_m6B8E8E0E0AF6B08652B81B7950FC5AF63EAD40C6_RuntimeMethod_var);
__this->set_touchableCollider_6(L_0);
// }
return;
}
}
// System.Single Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume::DistanceToTouchable(UnityEngine.Vector3,UnityEngine.Vector3U26)
extern "C" IL2CPP_METHOD_ATTR float NearInteractionTouchableVolume_DistanceToTouchable_m590325E87878586081EB1605A01F611A6D77A35E (NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC * __this, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 ___samplePoint0, Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * ___normal1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (NearInteractionTouchableVolume_DistanceToTouchable_m590325E87878586081EB1605A01F611A6D77A35E_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 V_0;
memset(&V_0, 0, sizeof(V_0));
Bounds_tA2716F5212749C61B0E7B7B77E0CD3D79B742890 V_1;
memset(&V_1, 0, sizeof(V_1));
{
// Vector3 closest = TouchableCollider.ClosestPoint(samplePoint);
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_0 = NearInteractionTouchableVolume_get_TouchableCollider_mC7B24E276AE648A232360ADC24F9CD1FE04A37D3(__this, /*hidden argument*/NULL);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_1 = ___samplePoint0;
NullCheck(L_0);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_2 = Collider_ClosestPoint_mA3CF53B6EE9CEEDB3BF2BCCE19E511CA659672B7(L_0, L_1, /*hidden argument*/NULL);
V_0 = L_2;
// normal = (samplePoint - closest);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_3 = ___normal1;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_4 = ___samplePoint0;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_5 = V_0;
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_6 = Vector3_op_Subtraction_mF9846B723A5034F8B9F5F5DCB78E3D67649143D3(L_4, L_5, /*hidden argument*/NULL);
*(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_3 = L_6;
// if (normal == Vector3.zero)
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_7 = ___normal1;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_8 = (*(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_7);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_9 = Vector3_get_zero_m3CDDCAE94581DF3BB16C4B40A100E28E9C6649C2(/*hidden argument*/NULL);
bool L_10 = Vector3_op_Equality_mA9E2F96E98E71AE7ACCE74766D700D41F0404806(L_8, L_9, /*hidden argument*/NULL);
if (!L_10)
{
goto IL_0057;
}
}
{
// normal = samplePoint - TouchableCollider.bounds.center;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_11 = ___normal1;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_12 = ___samplePoint0;
Collider_t0FEEB36760860AD21B3B1F0509C365B393EC4BDF * L_13 = NearInteractionTouchableVolume_get_TouchableCollider_mC7B24E276AE648A232360ADC24F9CD1FE04A37D3(__this, /*hidden argument*/NULL);
NullCheck(L_13);
Bounds_tA2716F5212749C61B0E7B7B77E0CD3D79B742890 L_14 = Collider_get_bounds_mD3CB68E38FB998406193A88D18C01F510272058A(L_13, /*hidden argument*/NULL);
V_1 = L_14;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_15 = Bounds_get_center_m4FB6E99F0533EE2D432988B08474D6DC9B8B744B((Bounds_tA2716F5212749C61B0E7B7B77E0CD3D79B742890 *)(&V_1), /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720_il2cpp_TypeInfo_var);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_16 = Vector3_op_Subtraction_mF9846B723A5034F8B9F5F5DCB78E3D67649143D3(L_12, L_15, /*hidden argument*/NULL);
*(Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_11 = L_16;
// normal.Normalize();
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_17 = ___normal1;
Vector3_Normalize_m174460238EC6322B9095A378AA8624B1DD9000F3((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_17, /*hidden argument*/NULL);
// return -1;
return (-1.0f);
}
IL_0057:
{
// float dist = normal.magnitude;
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_18 = ___normal1;
float L_19 = Vector3_get_magnitude_m9A750659B60C5FE0C30438A7F9681775D5DB1274((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_18, /*hidden argument*/NULL);
// normal.Normalize();
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 * L_20 = ___normal1;
Vector3_Normalize_m174460238EC6322B9095A378AA8624B1DD9000F3((Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 *)L_20, /*hidden argument*/NULL);
// return dist;
return L_19;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.NearInteractionTouchableVolume::.ctor()
extern "C" IL2CPP_METHOD_ATTR void NearInteractionTouchableVolume__ctor_m1770DC2EF71B539D0FE1E2F7F87D62759682F999 (NearInteractionTouchableVolume_t19D0C93D4ADE3ED2FBF1ED020C8727F2E76C75CC * __this, const RuntimeMethod* method)
{
{
BaseNearInteractionTouchable__ctor_m635FAE023CB66064C86C6B0B48CE5D1B3869D5E9(__this, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility::OnPointerClicked(Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData)
extern "C" IL2CPP_METHOD_ATTR void CanvasUtility_OnPointerClicked_m6F787A07A2EA3CBFBBF75CEABE8A559C7523D240 (CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8 * __this, MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * ___eventData0, const RuntimeMethod* method)
{
{
// public void OnPointerClicked(MixedRealityPointerEventData eventData) {}
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility::OnPointerDown(Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData)
extern "C" IL2CPP_METHOD_ATTR void CanvasUtility_OnPointerDown_m761E4517FB5D57F8916182816CD916108CA23DD8 (CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8 * __this, MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * ___eventData0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (CanvasUtility_OnPointerDown_m761E4517FB5D57F8916182816CD916108CA23DD8_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// oldIsTargetPositionLockedOnFocusLock = eventData.Pointer.IsTargetPositionLockedOnFocusLock;
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_0 = ___eventData0;
NullCheck(L_0);
RuntimeObject* L_1 = MixedRealityPointerEventData_get_Pointer_mF45EB1233706B50689E78E576D49149F583A8657(L_0, /*hidden argument*/NULL);
NullCheck(L_1);
bool L_2 = InterfaceFuncInvoker0< bool >::Invoke(15 /* System.Boolean Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer::get_IsTargetPositionLockedOnFocusLock() */, IMixedRealityPointer_tA64958356FC4ABDCB3CF2CFC334E3DA65A885D78_il2cpp_TypeInfo_var, L_1);
__this->set_oldIsTargetPositionLockedOnFocusLock_4(L_2);
// if (!(eventData.Pointer is IMixedRealityNearPointer) && eventData.Pointer.Controller.IsRotationAvailable)
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_3 = ___eventData0;
NullCheck(L_3);
RuntimeObject* L_4 = MixedRealityPointerEventData_get_Pointer_mF45EB1233706B50689E78E576D49149F583A8657(L_3, /*hidden argument*/NULL);
if (((RuntimeObject*)IsInst((RuntimeObject*)L_4, IMixedRealityNearPointer_tB665EBD82EC998B15BE414DABA497042271E128A_il2cpp_TypeInfo_var)))
{
goto IL_003c;
}
}
{
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_5 = ___eventData0;
NullCheck(L_5);
RuntimeObject* L_6 = MixedRealityPointerEventData_get_Pointer_mF45EB1233706B50689E78E576D49149F583A8657(L_5, /*hidden argument*/NULL);
NullCheck(L_6);
RuntimeObject* L_7 = InterfaceFuncInvoker0< RuntimeObject* >::Invoke(0 /* Microsoft.MixedReality.Toolkit.Input.IMixedRealityController Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer::get_Controller() */, IMixedRealityPointer_tA64958356FC4ABDCB3CF2CFC334E3DA65A885D78_il2cpp_TypeInfo_var, L_6);
NullCheck(L_7);
bool L_8 = InterfaceFuncInvoker0< bool >::Invoke(8 /* System.Boolean Microsoft.MixedReality.Toolkit.Input.IMixedRealityController::get_IsRotationAvailable() */, IMixedRealityController_tE328C8BD991056668984D67A323E3143DDD5CD31_il2cpp_TypeInfo_var, L_7);
if (!L_8)
{
goto IL_003c;
}
}
{
// eventData.Pointer.IsTargetPositionLockedOnFocusLock = false;
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_9 = ___eventData0;
NullCheck(L_9);
RuntimeObject* L_10 = MixedRealityPointerEventData_get_Pointer_mF45EB1233706B50689E78E576D49149F583A8657(L_9, /*hidden argument*/NULL);
NullCheck(L_10);
InterfaceActionInvoker1< bool >::Invoke(16 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer::set_IsTargetPositionLockedOnFocusLock(System.Boolean) */, IMixedRealityPointer_tA64958356FC4ABDCB3CF2CFC334E3DA65A885D78_il2cpp_TypeInfo_var, L_10, (bool)0);
}
IL_003c:
{
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility::OnPointerDragged(Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData)
extern "C" IL2CPP_METHOD_ATTR void CanvasUtility_OnPointerDragged_m9E58FB96F4EACF310B4B53C92A753F34652ACA39 (CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8 * __this, MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * ___eventData0, const RuntimeMethod* method)
{
{
// public void OnPointerDragged(MixedRealityPointerEventData eventData) { }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility::OnPointerUp(Microsoft.MixedReality.Toolkit.Input.MixedRealityPointerEventData)
extern "C" IL2CPP_METHOD_ATTR void CanvasUtility_OnPointerUp_m83D2379164AE65222923317B6FFF411A8C19F469 (CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8 * __this, MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * ___eventData0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (CanvasUtility_OnPointerUp_m83D2379164AE65222923317B6FFF411A8C19F469_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
// eventData.Pointer.IsTargetPositionLockedOnFocusLock = oldIsTargetPositionLockedOnFocusLock;
MixedRealityPointerEventData_tCC4301DD4183C547A2CEE152E344ED2FDE096964 * L_0 = ___eventData0;
NullCheck(L_0);
RuntimeObject* L_1 = MixedRealityPointerEventData_get_Pointer_mF45EB1233706B50689E78E576D49149F583A8657(L_0, /*hidden argument*/NULL);
bool L_2 = __this->get_oldIsTargetPositionLockedOnFocusLock_4();
NullCheck(L_1);
InterfaceActionInvoker1< bool >::Invoke(16 /* System.Void Microsoft.MixedReality.Toolkit.Input.IMixedRealityPointer::set_IsTargetPositionLockedOnFocusLock(System.Boolean) */, IMixedRealityPointer_tA64958356FC4ABDCB3CF2CFC334E3DA65A885D78_il2cpp_TypeInfo_var, L_1, L_2);
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility::Start()
extern "C" IL2CPP_METHOD_ATTR void CanvasUtility_Start_m4B42439ECDC01E0055136DF641290575F51947F5 (CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (CanvasUtility_Start_m4B42439ECDC01E0055136DF641290575F51947F5_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * V_0 = NULL;
RuntimeObject* G_B3_0 = NULL;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * G_B3_1 = NULL;
RuntimeObject* G_B2_0 = NULL;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * G_B2_1 = NULL;
Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 * G_B6_0 = NULL;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * G_B6_1 = NULL;
RuntimeObject* G_B5_0 = NULL;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * G_B5_1 = NULL;
RuntimeObject* G_B4_0 = NULL;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * G_B4_1 = NULL;
{
// Canvas canvas = GetComponent<Canvas>();
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_0 = Component_GetComponent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_m72658F06C13B44ECAE973DE1E20B4BA8A247DBBD(__this, /*hidden argument*/Component_GetComponent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_m72658F06C13B44ECAE973DE1E20B4BA8A247DBBD_RuntimeMethod_var);
V_0 = L_0;
// if (canvas.worldCamera == null)
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_1 = V_0;
NullCheck(L_1);
Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 * L_2 = Canvas_get_worldCamera_m36F1A8DBFC4AB34278125DA017CACDC873F53409(L_1, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var);
bool L_3 = Object_op_Equality_mBC2401774F3BE33E8CF6F0A8148E66C95D6CFF1C(L_2, (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *)NULL, /*hidden argument*/NULL);
if (!L_3)
{
goto IL_0050;
}
}
{
// canvas.worldCamera = CoreServices.InputSystem?.FocusProvider?.UIRaycastCamera;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_4 = V_0;
IL2CPP_RUNTIME_CLASS_INIT(CoreServices_tA2DBA57F1E594300C810E84EDC2DF4EDBD58B6F4_il2cpp_TypeInfo_var);
RuntimeObject* L_5 = CoreServices_get_InputSystem_mDECB23C7E4062E1903E48F5E40550D9EA24D29C1(/*hidden argument*/NULL);
RuntimeObject* L_6 = L_5;
G_B2_0 = L_6;
G_B2_1 = L_4;
if (L_6)
{
G_B3_0 = L_6;
G_B3_1 = L_4;
goto IL_0022;
}
}
{
G_B6_0 = ((Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 *)(NULL));
G_B6_1 = G_B2_1;
goto IL_0033;
}
IL_0022:
{
NullCheck(G_B3_0);
RuntimeObject* L_7 = InterfaceFuncInvoker0< RuntimeObject* >::Invoke(7 /* Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusProvider Microsoft.MixedReality.Toolkit.Input.IMixedRealityInputSystem::get_FocusProvider() */, IMixedRealityInputSystem_t142023776CCC57DFC5696BEA994C4F369CB5806E_il2cpp_TypeInfo_var, G_B3_0);
RuntimeObject* L_8 = L_7;
G_B4_0 = L_8;
G_B4_1 = G_B3_1;
if (L_8)
{
G_B5_0 = L_8;
G_B5_1 = G_B3_1;
goto IL_002e;
}
}
{
G_B6_0 = ((Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 *)(NULL));
G_B6_1 = G_B4_1;
goto IL_0033;
}
IL_002e:
{
NullCheck(G_B5_0);
Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 * L_9 = InterfaceFuncInvoker0< Camera_t48B2B9ECB3CE6108A98BF949A1CECF0FE3421F34 * >::Invoke(2 /* UnityEngine.Camera Microsoft.MixedReality.Toolkit.Input.IMixedRealityFocusProvider::get_UIRaycastCamera() */, IMixedRealityFocusProvider_t3C6B1347D19105108BE262BB34EC68451F456832_il2cpp_TypeInfo_var, G_B5_0);
G_B6_0 = L_9;
G_B6_1 = G_B5_1;
}
IL_0033:
{
NullCheck(G_B6_1);
Canvas_set_worldCamera_m020A4A35425707F2403E6EBA6AD73F448557F776(G_B6_1, G_B6_0, /*hidden argument*/NULL);
// if (EventSystem.current == null)
IL2CPP_RUNTIME_CLASS_INIT(EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77_il2cpp_TypeInfo_var);
EventSystem_t06ACEF1C8D95D44D3A7F57ED4BAA577101B4EA77 * L_10 = EventSystem_get_current_m3151477735829089F66A3E46AD6DAB14CFDDE7BD(/*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var);
bool L_11 = Object_op_Equality_mBC2401774F3BE33E8CF6F0A8148E66C95D6CFF1C(L_10, (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *)NULL, /*hidden argument*/NULL);
if (!L_11)
{
goto IL_005a;
}
}
{
// Debug.LogError("No EventSystem detected. UI events will not be propagated to Unity UI.");
IL2CPP_RUNTIME_CLASS_INIT(Debug_t7B5FCB117E2FD63B6838BC52821B252E2BFB61C4_il2cpp_TypeInfo_var);
Debug_LogError_m3BCF9B78263152261565DCA9DB7D55F0C391ED29(_stringLiteral052FB1FE0D021FB4E5F4B88C36D37951996FBFCB, /*hidden argument*/NULL);
// }
return;
}
IL_0050:
{
// Debug.LogError("World Space Canvas should have no camera set to work properly with Mixed Reality Toolkit. At runtime, they'll get their camera set automatically.");
IL2CPP_RUNTIME_CLASS_INIT(Debug_t7B5FCB117E2FD63B6838BC52821B252E2BFB61C4_il2cpp_TypeInfo_var);
Debug_LogError_m3BCF9B78263152261565DCA9DB7D55F0C391ED29(_stringLiteral2246D0EE3F64AE2FE0E32B485F0D449C421DE949, /*hidden argument*/NULL);
}
IL_005a:
{
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.CanvasUtility::.ctor()
extern "C" IL2CPP_METHOD_ATTR void CanvasUtility__ctor_mDC11CD653CF3A19CBBAAB7AE78A29727C540C63D (CanvasUtility_t508A947581A03B2B794E44C962978E95878694B8 * __this, const RuntimeMethod* method)
{
{
MonoBehaviour__ctor_mEAEC84B222C60319D593E456D769B3311DFCEF97(__this, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.ScaleMeshEffect::Awake()
extern "C" IL2CPP_METHOD_ATTR void ScaleMeshEffect_Awake_mA5A71A64ED9921B169829E9005D1C2C66522FB43 (ScaleMeshEffect_t7A2D331EF3DD56FFA4816FAC032438EBA1C77ADB * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (ScaleMeshEffect_Awake_mA5A71A64ED9921B169829E9005D1C2C66522FB43_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * V_0 = NULL;
{
// base.Awake();
UIBehaviour_Awake_mCCC65A98E4219648D4BEFA7CD23E2426CAEF1DE2(__this, /*hidden argument*/NULL);
// var canvas = GetComponentInParent<Canvas>();
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_0 = Component_GetComponentInParent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_mD91B8112B5688783ACAEA46BB2C82C6EC4C4B33B(__this, /*hidden argument*/Component_GetComponentInParent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_mD91B8112B5688783ACAEA46BB2C82C6EC4C4B33B_RuntimeMethod_var);
V_0 = L_0;
// if (canvas != null)
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_1 = V_0;
IL2CPP_RUNTIME_CLASS_INIT(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var);
bool L_2 = Object_op_Inequality_m31EF58E217E8F4BDD3E409DEF79E1AEE95874FC1(L_1, (Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0 *)NULL, /*hidden argument*/NULL);
if (!L_2)
{
goto IL_0032;
}
}
{
// canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord2;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_3 = V_0;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_4 = L_3;
NullCheck(L_4);
int32_t L_5 = Canvas_get_additionalShaderChannels_m703769513A111C46DC0F0B32864A69E54C085BEC(L_4, /*hidden argument*/NULL);
NullCheck(L_4);
Canvas_set_additionalShaderChannels_m0A3CB0D3137C41915E293268BA95920404921FE2(L_4, ((int32_t)((int32_t)L_5|(int32_t)2)), /*hidden argument*/NULL);
// canvas.additionalShaderChannels |= AdditionalCanvasShaderChannels.TexCoord3;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_6 = V_0;
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_7 = L_6;
NullCheck(L_7);
int32_t L_8 = Canvas_get_additionalShaderChannels_m703769513A111C46DC0F0B32864A69E54C085BEC(L_7, /*hidden argument*/NULL);
NullCheck(L_7);
Canvas_set_additionalShaderChannels_m0A3CB0D3137C41915E293268BA95920404921FE2(L_7, ((int32_t)((int32_t)L_8|(int32_t)4)), /*hidden argument*/NULL);
}
IL_0032:
{
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.ScaleMeshEffect::ModifyMesh(UnityEngine.UI.VertexHelper)
extern "C" IL2CPP_METHOD_ATTR void ScaleMeshEffect_ModifyMesh_m4E457F3706EB1CADCED31A119F1C472A974FEA65 (ScaleMeshEffect_t7A2D331EF3DD56FFA4816FAC032438EBA1C77ADB * __this, VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F * ___vh0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (ScaleMeshEffect_ModifyMesh_m4E457F3706EB1CADCED31A119F1C472A974FEA65_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * V_0 = NULL;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D V_1;
memset(&V_1, 0, sizeof(V_1));
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * V_2 = NULL;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D V_3;
memset(&V_3, 0, sizeof(V_3));
UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 V_4;
memset(&V_4, 0, sizeof(V_4));
Rect_t35B976DE901B5423C11705E156938EA27AB402CE V_5;
memset(&V_5, 0, sizeof(V_5));
int32_t V_6 = 0;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * G_B2_0 = NULL;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * G_B1_0 = NULL;
float G_B3_0 = 0.0f;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D * G_B3_1 = NULL;
{
// var rectTransform = transform as RectTransform;
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_0 = Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9(__this, /*hidden argument*/NULL);
V_0 = ((RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 *)IsInstSealed((RuntimeObject*)L_0, RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20_il2cpp_TypeInfo_var));
// var scale = new Vector2(rectTransform.rect.width * rectTransform.localScale.x,
// rectTransform.rect.height * rectTransform.localScale.y);
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * L_1 = V_0;
NullCheck(L_1);
Rect_t35B976DE901B5423C11705E156938EA27AB402CE L_2 = RectTransform_get_rect_mE5F283FCB99A66403AC1F0607CA49C156D73A15E(L_1, /*hidden argument*/NULL);
V_5 = L_2;
float L_3 = Rect_get_width_m54FF69FC2C086E2DC349ED091FD0D6576BFB1484((Rect_t35B976DE901B5423C11705E156938EA27AB402CE *)(&V_5), /*hidden argument*/NULL);
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * L_4 = V_0;
NullCheck(L_4);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_5 = Transform_get_localScale_mD8F631021C2D62B7C341B1A17FA75491F64E13DA(L_4, /*hidden argument*/NULL);
float L_6 = L_5.get_x_2();
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * L_7 = V_0;
NullCheck(L_7);
Rect_t35B976DE901B5423C11705E156938EA27AB402CE L_8 = RectTransform_get_rect_mE5F283FCB99A66403AC1F0607CA49C156D73A15E(L_7, /*hidden argument*/NULL);
V_5 = L_8;
float L_9 = Rect_get_height_m088C36990E0A255C5D7DCE36575DCE23ABB364B5((Rect_t35B976DE901B5423C11705E156938EA27AB402CE *)(&V_5), /*hidden argument*/NULL);
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * L_10 = V_0;
NullCheck(L_10);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_11 = Transform_get_localScale_mD8F631021C2D62B7C341B1A17FA75491F64E13DA(L_10, /*hidden argument*/NULL);
float L_12 = L_11.get_y_3();
Vector2__ctor_mEE8FB117AB1F8DB746FB8B3EB4C0DA3BF2A230D0((Vector2_tA85D2DD88578276CA8A8796756458277E72D073D *)(&V_1), ((float)il2cpp_codegen_multiply((float)L_3, (float)L_6)), ((float)il2cpp_codegen_multiply((float)L_9, (float)L_12)), /*hidden argument*/NULL);
// var canvas = GetComponentInParent<Canvas>();
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_13 = Component_GetComponentInParent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_mD91B8112B5688783ACAEA46BB2C82C6EC4C4B33B(__this, /*hidden argument*/Component_GetComponentInParent_TisCanvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591_mD91B8112B5688783ACAEA46BB2C82C6EC4C4B33B_RuntimeMethod_var);
V_2 = L_13;
// var depth = new Vector2((canvas ? (1.0f / canvas.transform.lossyScale.z) : 1.0f) * rectTransform.localScale.z,
// -1.0f);
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_14 = V_2;
IL2CPP_RUNTIME_CLASS_INIT(Object_tAE11E5E46CD5C37C9F3E8950C00CD8B45666A2D0_il2cpp_TypeInfo_var);
bool L_15 = Object_op_Implicit_m8B2A44B4B1406ED346D1AE6D962294FD58D0D534(L_14, /*hidden argument*/NULL);
G_B1_0 = (&V_3);
if (L_15)
{
G_B2_0 = (&V_3);
goto IL_0061;
}
}
{
G_B3_0 = (1.0f);
G_B3_1 = G_B1_0;
goto IL_0077;
}
IL_0061:
{
Canvas_tBC28BF1DD8D8499A89B5781505833D3728CF8591 * L_16 = V_2;
NullCheck(L_16);
Transform_tBB9E78A2766C3C83599A8F66EDE7D1FCAFC66EDA * L_17 = Component_get_transform_m00F05BD782F920C301A7EBA480F3B7A904C07EC9(L_16, /*hidden argument*/NULL);
NullCheck(L_17);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_18 = Transform_get_lossyScale_m9C2597B28BE066FC061B7D7508750E5D5EA9850F(L_17, /*hidden argument*/NULL);
float L_19 = L_18.get_z_4();
G_B3_0 = ((float)((float)(1.0f)/(float)L_19));
G_B3_1 = G_B2_0;
}
IL_0077:
{
RectTransform_t285CBD8775B25174B75164F10618F8B9728E1B20 * L_20 = V_0;
NullCheck(L_20);
Vector3_tDCF05E21F632FE2BA260C06E0D10CA81513E6720 L_21 = Transform_get_localScale_mD8F631021C2D62B7C341B1A17FA75491F64E13DA(L_20, /*hidden argument*/NULL);
float L_22 = L_21.get_z_4();
Vector2__ctor_mEE8FB117AB1F8DB746FB8B3EB4C0DA3BF2A230D0((Vector2_tA85D2DD88578276CA8A8796756458277E72D073D *)G_B3_1, ((float)il2cpp_codegen_multiply((float)G_B3_0, (float)L_22)), (-1.0f), /*hidden argument*/NULL);
// var vertex = new UIVertex();
il2cpp_codegen_initobj((&V_4), sizeof(UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 ));
// for (var i = 0; i < vh.currentVertCount; ++i)
V_6 = 0;
goto IL_00c4;
}
IL_009a:
{
// vh.PopulateUIVertex(ref vertex, i);
VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F * L_23 = ___vh0;
int32_t L_24 = V_6;
NullCheck(L_23);
VertexHelper_PopulateUIVertex_m72B419E337C302E1307A90517561746425989160(L_23, (UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 *)(&V_4), L_24, /*hidden argument*/NULL);
// vertex.uv2 = scale;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_25 = V_1;
(&V_4)->set_uv2_6(L_25);
// vertex.uv3 = depth;
Vector2_tA85D2DD88578276CA8A8796756458277E72D073D L_26 = V_3;
(&V_4)->set_uv3_7(L_26);
// vh.SetUIVertex(vertex, i);
VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F * L_27 = ___vh0;
UIVertex_t0583C35B730B218B542E80203F5F4BC6F1E9E577 L_28 = V_4;
int32_t L_29 = V_6;
NullCheck(L_27);
VertexHelper_SetUIVertex_m34A2517745A635BBBD0F95AAFC3CF275D73AC4D3(L_27, L_28, L_29, /*hidden argument*/NULL);
// for (var i = 0; i < vh.currentVertCount; ++i)
int32_t L_30 = V_6;
V_6 = ((int32_t)il2cpp_codegen_add((int32_t)L_30, (int32_t)1));
}
IL_00c4:
{
// for (var i = 0; i < vh.currentVertCount; ++i)
int32_t L_31 = V_6;
VertexHelper_t27373EA2CF0F5810EC8CF873D0A6D6C0B23DAC3F * L_32 = ___vh0;
NullCheck(L_32);
int32_t L_33 = VertexHelper_get_currentVertCount_m48ADC86AE4361D491966D86AD6D1CD9D22FD69B6(L_32, /*hidden argument*/NULL);
if ((((int32_t)L_31) < ((int32_t)L_33)))
{
goto IL_009a;
}
}
{
// }
return;
}
}
// System.Void Microsoft.MixedReality.Toolkit.Input.Utilities.ScaleMeshEffect::.ctor()
extern "C" IL2CPP_METHOD_ATTR void ScaleMeshEffect__ctor_mC8154DCA008A47C850553A394223BE552D9AC7F4 (ScaleMeshEffect_t7A2D331EF3DD56FFA4816FAC032438EBA1C77ADB * __this, const RuntimeMethod* method)
{
{
BaseMeshEffect__ctor_mDAF9031F104E899963B63B3157E2F9CFF9A67B53(__this, /*hidden argument*/NULL);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| 60.234921 | 524 | 0.864368 | [
"object",
"transform"
] |
58962a113dd9e8b2d87f52e41a2241f2114bea1c | 1,739 | hpp | C++ | src/graph-theory/adjacency_matrix.hpp | roma-zelinskyi/algorithms | cfc8a1a678186b00a47e7a33b9b6a78b7225c8c0 | [
"MIT"
] | null | null | null | src/graph-theory/adjacency_matrix.hpp | roma-zelinskyi/algorithms | cfc8a1a678186b00a47e7a33b9b6a78b7225c8c0 | [
"MIT"
] | null | null | null | src/graph-theory/adjacency_matrix.hpp | roma-zelinskyi/algorithms | cfc8a1a678186b00a47e7a33b9b6a78b7225c8c0 | [
"MIT"
] | null | null | null | /**
* Project Graph Theory
*
* @author Roman Zelinskyi <lord.zelinskyi@gmail.com>
*/
#pragma once
#include <cstdint>
#include <iostream>
#include <limits>
#include <optional>
#include <unordered_map>
#include <vector>
namespace cppgraph {
template<class _NodeDescriptor>
class AdjacencyMatrix
{
public:
AdjacencyMatrix()
: _nVertix{0}
, _prevAddedNode{std::nullopt}
, _matrix{}
{
}
const std::unordered_map<_NodeDescriptor, std::unordered_map<_NodeDescriptor, double>>&
data() const noexcept
{
return _matrix;
}
std::size_t size() const noexcept
{
return _matrix.size();
}
void addNode(const _NodeDescriptor& node)
{
if (_prevAddedNode)
_matrix[node] = _matrix.at(_prevAddedNode.value());
else
_matrix[node] = {};
for (auto& it : _matrix)
it.second[node] = std::numeric_limits<double>::infinity();
for (auto& it : _matrix.at(node))
it.second = std::numeric_limits<double>::infinity();
_matrix[node][node] = 0;
_prevAddedNode = node;
}
void addEdge(
const _NodeDescriptor& from,
const _NodeDescriptor& to,
const double weight = std::numeric_limits<double>::infinity())
{
auto& row = _matrix.at(from);
if (!row.count(to))
throw std::invalid_argument{
"No destination node descriptor exist in adjacency matrix."};
row[to] = weight;
}
private:
std::uint32_t _nVertix;
std::optional<_NodeDescriptor> _prevAddedNode;
std::unordered_map<_NodeDescriptor, std::unordered_map<_NodeDescriptor, double>> _matrix;
};
} // namespace cppgraph
| 22.012658 | 93 | 0.614721 | [
"vector"
] |
58a8929d7c5460717128b3402146e3e0eea1e85f | 3,590 | hpp | C++ | src/kokkos_omp/block_pool.hpp | lanl/Ethon | 95ea508b51a59c83c154b7f80594b64d71fd0a55 | [
"BSD-3-Clause"
] | null | null | null | src/kokkos_omp/block_pool.hpp | lanl/Ethon | 95ea508b51a59c83c154b7f80594b64d71fd0a55 | [
"BSD-3-Clause"
] | null | null | null | src/kokkos_omp/block_pool.hpp | lanl/Ethon | 95ea508b51a59c83c154b7f80594b64d71fd0a55 | [
"BSD-3-Clause"
] | null | null | null | //========================================================================================
// Copyright (c) 2020. Triad National Security, LLC. All rights reserved.
//
// This program was produced under U.S. Government contract 89233218CNA000001 for Los
// Alamos National Laboratory (LANL), which is operated by Triad National Security, LLC
// for the U.S. Department of Energy/National Nuclear Security Administration. All rights
// in the program are reserved by Triad National Security, LLC, and the U.S. Department
// of Energy/National Nuclear Security Administration. The Government is granted for
// itself and others acting on its behalf a nonexclusive, paid-up, irrevocable worldwide
// license in this material to reproduce, prepare derivative works, distribute copies to
// the public, perform publicly and display publicly, and to permit others to do so.
//
// This program is open source under the BSD-3 License. See LICENSE file for details.
//========================================================================================
#ifndef ETHON_KOKKOS_OMP_BLOCK_POOL_HPP_
#define ETHON_KOKKOS_OMP_BLOCK_POOL_HPP_
#include <mutex>
#include <stack>
#include <vector>
#include <Kokkos_Core.hpp>
#include "kokkos_omp/block.hpp"
#include "state.hpp"
template <typename Block_t>
class BlockPool {
public:
constexpr static int N_blocks = Block_t::N_blocks;
using CellData_t = typename Block_t::CellData_t;
using FluxData_t = typename Block_t::FluxData_t;
BlockPool()
: blocks_(N_blocks),
refinement_flags_("Refinement flags"),
cell_data("cell_data"),
x_fluxes("x_fluxes"),
y_fluxes("y_fluxes"),
z_fluxes("z_fluxes"),
lower_boundary("lower_boundary"),
upper_boundary("upper_boundary") {
std::lock_guard<std::mutex> lock(mutex_);
// push from back to front, so that we'll use the chunk from beginning to end (not that it
// matters...)
for (int i = 0; i < N_blocks; ++i) {
free_ids_.push(N_blocks - 1 - i);
}
}
int size() const {
std::lock_guard<std::mutex> lock(mutex_);
return N_blocks - free_ids_.size();
}
auto refinement_flags() { return refinement_flags_; }
auto refinement_flag(int b_id) const {
return refinement_flags_(b_id);
}
Block_t *Allocate(const Kokkos::Array<double, 3> lower_bounds,
const Kokkos::Array<double, 3> cell_size,
const int level) {
std::lock_guard<std::mutex> lock(mutex_);
if (free_ids_.size() == 0)
throw std::out_of_range("Requested more blocks than there are available");
auto b_id = free_ids_.top();
free_ids_.pop();
blocks_[b_id].Init(b_id, lower_bounds, cell_size, level);
refinement_flags_(b_id) = 0;
return &blocks_[b_id];
}
void Free(int bid) {
std::lock_guard<std::mutex> lock(mutex_);
free_ids_.push(bid);
}
private:
std::vector<Block_t> blocks_;
// stack of pointers to free blocks
std::stack<int> free_ids_;
// refinement flags
Kokkos::View<int[N_blocks], Kokkos::HostSpace> refinement_flags_;
// mutex to serialize access to the pool
mutable std::mutex mutex_;
public:
// [0] mass density in g cm^{-3}
// [1,2,3] momentum density (mu_i = rho * u_i, where u_i is fluid velocity) in g cm^{-2} s^{-1}
// [4] total energy density (rho * e + 1/2 * rho * u_i u^i, where e is the internal specific
// energy) in erg cm^{-3} = g cm^{-1} s^{-2}
CellData_t cell_data;
CellData_t x_fluxes, y_fluxes, z_fluxes;
FluxData_t lower_boundary, upper_boundary;
};
#endif // ETHON_KOKKOS_OMP_BLOCK_POOL_HPP_
| 33.551402 | 99 | 0.662117 | [
"vector"
] |
58bb27bd85e1081ce54a252e0aebf8559b9e9a37 | 2,046 | hpp | C++ | source/game.hpp | llGuy/saska | a478a28c162a136aeb19f70dddd7c6be4de9bd78 | [
"MIT"
] | null | null | null | source/game.hpp | llGuy/saska | a478a28c162a136aeb19f70dddd7c6be4de9bd78 | [
"MIT"
] | null | null | null | source/game.hpp | llGuy/saska | a478a28c162a136aeb19f70dddd7c6be4de9bd78 | [
"MIT"
] | null | null | null | #pragma once
#include "raw_input.hpp"
#include "vulkan.hpp"
#include "graphics.hpp"
#include "ui.hpp"
#include "script.hpp"
#include "net.hpp"
#include "event_system.hpp"
// This just decides whether the game should be run with a console, or with graphics. For servers, it would be better (if not debugging, to use console instead of having to initialize a vulkan context, graphics state, ui, etc...)
// The client will always use WINDOW_APPLICATION_MODE
enum application_type_t { WINDOW_APPLICATION_MODE, CONSOLE_APPLICATION_MODE };
enum element_focus_t { WORLD_3D_ELEMENT_FOCUS, UI_ELEMENT_CONSOLE, UI_ELEMENT_MENU, UI_ELEMENT_INPUT };
struct focus_stack_t {
int32_t current_foci = -1;
element_focus_t foci [ 10 ];
void pop_focus(void) {
--current_foci;
}
void push_focus(element_focus_t focus) {
foci[++current_foci] = focus;
}
element_focus_t get_current_focus(void) {
return foci[current_foci];
}
};
struct game_memory_t {
graphics_t graphics_state;
graphics_context_t graphics_context;
user_interface_t user_interface_state;
// If in CONSOLE_MODE, don't render anything, don't create window, don't create graphics context
application_type_t app_type;
// Which screen has the focus (3D scene screen, ui console screen, ui menu screen, ...)
focus_stack_t focus_stack;
event_dispatcher_t event_dispatcher;
};
void load_game(game_memory_t *memory);
void initialize_game(game_memory_t *memory, raw_input_t *raw_input, create_vulkan_surface *create_surface_proc, application_mode_t app_mode, application_type_t app_type);
void destroy_game(game_memory_t *memory);
void game_tick(game_memory_t *memory, raw_input_t *raw_input, float32_t dt);
gpu_command_queue_pool_t *get_global_command_pool(void);
application_type_t get_app_type(void);
application_mode_t get_app_mode(void);
void clear_and_request_focus(element_focus_t focus);
void request_focus(element_focus_t focus);
| 33 | 230 | 0.745357 | [
"render",
"3d"
] |
58bd3488e78a7fa3b397d3b86f543d5491a0a8c3 | 5,849 | cpp | C++ | Code/Engine/GameEngine/VisualScript/Nodes/VisualScriptObjectNodes.cpp | autoint/ezEngine | 4fcd72172791d2eeae1146428f3032e0da499f81 | [
"MIT"
] | null | null | null | Code/Engine/GameEngine/VisualScript/Nodes/VisualScriptObjectNodes.cpp | autoint/ezEngine | 4fcd72172791d2eeae1146428f3032e0da499f81 | [
"MIT"
] | null | null | null | Code/Engine/GameEngine/VisualScript/Nodes/VisualScriptObjectNodes.cpp | autoint/ezEngine | 4fcd72172791d2eeae1146428f3032e0da499f81 | [
"MIT"
] | 1 | 2022-03-28T15:57:46.000Z | 2022-03-28T15:57:46.000Z | #include <GameEnginePCH.h>
#include <Core/World/GameObject.h>
#include <Core/World/World.h>
#include <GameEngine/VisualScript/Nodes/VisualScriptObjectNodes.h>
#include <GameEngine/VisualScript/VisualScriptInstance.h>
//////////////////////////////////////////////////////////////////////////
// clang-format off
EZ_BEGIN_DYNAMIC_REFLECTED_TYPE(ezVisualScriptNode_DeleteObject, 1, ezRTTIDefaultAllocator<ezVisualScriptNode_DeleteObject>)
{
EZ_BEGIN_ATTRIBUTES
{
new ezCategoryAttribute("Objects")
}
EZ_END_ATTRIBUTES;
EZ_BEGIN_PROPERTIES
{
// Execution Pins (Input)
EZ_INPUT_EXECUTION_PIN("run", 0),
// Execution Pins (Output)
EZ_OUTPUT_EXECUTION_PIN("then", 0),
// Data Pins (Input)
EZ_INPUT_DATA_PIN("Object", 0, ezVisualScriptDataPinType::GameObjectHandle),
}
EZ_END_PROPERTIES;
}
EZ_END_DYNAMIC_REFLECTED_TYPE;
// clang-format on
ezVisualScriptNode_DeleteObject::ezVisualScriptNode_DeleteObject() {}
void ezVisualScriptNode_DeleteObject::Execute(ezVisualScriptInstance* pInstance, ezUInt8 uiExecPin)
{
if (!m_hObject.IsInvalidated())
{
pInstance->GetWorld()->DeleteObjectDelayed(m_hObject);
}
else
{
pInstance->GetWorld()->DeleteObjectDelayed(pInstance->GetOwner());
}
pInstance->ExecuteConnectedNodes(this, 0);
}
void* ezVisualScriptNode_DeleteObject::GetInputPinDataPointer(ezUInt8 uiPin)
{
switch (uiPin)
{
case 0:
return &m_hObject;
}
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
// clang-format off
EZ_BEGIN_DYNAMIC_REFLECTED_TYPE(ezVisualScriptNode_ActivateObject, 1, ezRTTIDefaultAllocator<ezVisualScriptNode_ActivateObject>)
{
EZ_BEGIN_ATTRIBUTES
{
new ezCategoryAttribute("Objects")
}
EZ_END_ATTRIBUTES;
EZ_BEGIN_PROPERTIES
{
// Execution Pins (Input)
EZ_INPUT_EXECUTION_PIN("Activate", 0),
EZ_INPUT_EXECUTION_PIN("Deactivate", 1),
// Execution Pins (Output)
EZ_OUTPUT_EXECUTION_PIN("then", 0),
// Data Pins (Input)
EZ_INPUT_DATA_PIN("Object", 0, ezVisualScriptDataPinType::GameObjectHandle),
}
EZ_END_PROPERTIES;
}
EZ_END_DYNAMIC_REFLECTED_TYPE;
// clang-format on
ezVisualScriptNode_ActivateObject::ezVisualScriptNode_ActivateObject() = default;
void ezVisualScriptNode_ActivateObject::Execute(ezVisualScriptInstance* pInstance, ezUInt8 uiExecPin)
{
ezGameObject* pObject = nullptr;
if (pInstance->GetWorld()->TryGetObject(m_hObject, pObject))
{
if (uiExecPin == 0)
{
pObject->SetActiveFlag(true);
}
else
{
pObject->SetActiveFlag(false);
}
}
pInstance->ExecuteConnectedNodes(this, 0);
}
void* ezVisualScriptNode_ActivateObject::GetInputPinDataPointer(ezUInt8 uiPin)
{
return &m_hObject;
}
//////////////////////////////////////////////////////////////////////////
// clang-format off
EZ_BEGIN_DYNAMIC_REFLECTED_TYPE(ezVisualScriptNode_ActivateComponent, 1, ezRTTIDefaultAllocator<ezVisualScriptNode_ActivateComponent>)
{
EZ_BEGIN_ATTRIBUTES
{
new ezCategoryAttribute("Components")
}
EZ_END_ATTRIBUTES;
EZ_BEGIN_PROPERTIES
{
// Execution Pins (Input)
EZ_INPUT_EXECUTION_PIN("Activate", 0),
EZ_INPUT_EXECUTION_PIN("Deactivate", 1),
// Execution Pins (Output)
EZ_OUTPUT_EXECUTION_PIN("then", 0),
// Data Pins (Input)
EZ_INPUT_DATA_PIN("Component", 0, ezVisualScriptDataPinType::ComponentHandle),
}
EZ_END_PROPERTIES;
}
EZ_END_DYNAMIC_REFLECTED_TYPE;
// clang-format on
ezVisualScriptNode_ActivateComponent::ezVisualScriptNode_ActivateComponent() {}
void ezVisualScriptNode_ActivateComponent::Execute(ezVisualScriptInstance* pInstance, ezUInt8 uiExecPin)
{
if (!m_hComponent.IsInvalidated())
{
ezComponent* pComponent = nullptr;
if (pInstance->GetWorld()->TryGetComponent(m_hComponent, pComponent))
{
if (uiExecPin == 0)
{
pComponent->SetActiveFlag(true);
}
else
{
pComponent->SetActiveFlag(false);
}
}
}
pInstance->ExecuteConnectedNodes(this, 0);
}
void* ezVisualScriptNode_ActivateComponent::GetInputPinDataPointer(ezUInt8 uiPin)
{
return &m_hComponent;
}
//////////////////////////////////////////////////////////////////////////
// clang-format off
EZ_BEGIN_DYNAMIC_REFLECTED_TYPE(ezVisualScriptNode_HasName, 1, ezRTTIDefaultAllocator<ezVisualScriptNode_HasName>)
{
EZ_BEGIN_ATTRIBUTES
{
new ezCategoryAttribute("Objects"),
new ezTitleAttribute("HasName '{ObjectName}'")
}
EZ_END_ATTRIBUTES;
EZ_BEGIN_PROPERTIES
{
// Execution Pins
EZ_INPUT_EXECUTION_PIN("run", 0),
EZ_OUTPUT_EXECUTION_PIN("OnTrue", 0),
EZ_OUTPUT_EXECUTION_PIN("OnFalse", 1),
// Data Pins (Input)
EZ_INPUT_DATA_PIN("Object", 0, ezVisualScriptDataPinType::GameObjectHandle),
EZ_INPUT_DATA_PIN_AND_PROPERTY("ObjectName", 1, ezVisualScriptDataPinType::String, m_sObjectName)
}
EZ_END_PROPERTIES;
}
EZ_END_DYNAMIC_REFLECTED_TYPE;
// clang-format on
ezVisualScriptNode_HasName::ezVisualScriptNode_HasName() {}
void ezVisualScriptNode_HasName::Execute(ezVisualScriptInstance* pInstance, ezUInt8 uiExecPin)
{
ezGameObjectHandle hObject = m_hObject.IsInvalidated() ? pInstance->GetOwner() : m_hObject;
ezGameObject* pObject = nullptr;
if (pInstance->GetWorld()->TryGetObject(hObject, pObject))
{
if (m_sObjectName == pObject->GetName())
{
pInstance->ExecuteConnectedNodes(this, 0);
return;
}
}
pInstance->ExecuteConnectedNodes(this, 1);
}
void* ezVisualScriptNode_HasName::GetInputPinDataPointer(ezUInt8 uiPin)
{
switch (uiPin)
{
case 0:
return &m_hObject;
case 1:
return &m_sObjectName;
}
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
EZ_STATICLINK_FILE(GameEngine, GameEngine_VisualScript_Nodes_VisualScriptObjectNodes);
| 25.995556 | 134 | 0.697897 | [
"object"
] |
58c52d02f5f03210913d9513b2f887edeb8b6a96 | 16,146 | cpp | C++ | src/ControllerCommons.cpp | iit-DLSLab/dwl-msgs | 68b286cfdc3f80481dea4e106d84183edfe6ba20 | [
"BSD-3-Clause"
] | null | null | null | src/ControllerCommons.cpp | iit-DLSLab/dwl-msgs | 68b286cfdc3f80481dea4e106d84183edfe6ba20 | [
"BSD-3-Clause"
] | null | null | null | src/ControllerCommons.cpp | iit-DLSLab/dwl-msgs | 68b286cfdc3f80481dea4e106d84183edfe6ba20 | [
"BSD-3-Clause"
] | 2 | 2018-03-15T10:27:31.000Z | 2019-09-23T14:16:19.000Z | #include <dwl_msgs/ControllerCommons.h>
namespace dwl_msgs
{
ControllerCommons::ControllerCommons() : init_base_state_(false), new_plan_(false),
num_traj_points_(0), trajectory_counter_(0), controller_publish_rate_(250),
robot_publish_rate_(250), odom_publish_rate_(250), imu_publish_rate_(250),
init_controller_state_pub_(false), init_robot_state_pub_(false),
init_odom_state_pub_(false), init_imu_state_pub_(false)
{
}
ControllerCommons::~ControllerCommons()
{
}
void ControllerCommons::initControllerStatePublisher(ros::NodeHandle node,
dwl::model::FloatingBaseSystem& system)
{
// Getting the publish period
if (!node.getParam("publish_rate", controller_publish_rate_)) {
ROS_WARN("Parameter of ControllerState publisher 'publish_rate' not set"
" (default value is 250). It has to be defined in"
" %s/publish_rate", node.getNamespace().c_str());
}
// Setting the floating-base system info
system_ = system;
wb_iface_.reset(system_);
// Initializing the real-time publisher
controller_state_pub_.reset(new
realtime_tools::RealtimePublisher<dwl_msgs::WholeBodyController> (node, "state", 1));
controller_state_pub_->lock();
controller_state_pub_->msg_.desired.base.resize(6);
controller_state_pub_->msg_.actual.base.resize(6);
controller_state_pub_->msg_.error.base.resize(6);
controller_state_pub_->msg_.desired.joints.resize(system_.getJointDoF());
controller_state_pub_->msg_.actual.joints.resize(system_.getJointDoF());
controller_state_pub_->msg_.error.joints.resize(system_.getJointDoF());
controller_state_pub_->msg_.desired.contacts.resize(system_.getNumberOfEndEffectors());
controller_state_pub_->msg_.actual.contacts.resize(system_.getNumberOfEndEffectors());
controller_state_pub_->msg_.error.contacts.resize(system_.getNumberOfEndEffectors());
controller_state_pub_->msg_.command.resize(system_.getJointDoF());
controller_state_pub_->unlock();
init_controller_state_pub_ = true;
}
void ControllerCommons::initWholeBodyStatePublisher(ros::NodeHandle node,
dwl::model::FloatingBaseSystem& system)
{
// Getting the publish period
if (!node.getParam("publish_rate", robot_publish_rate_)) {
ROS_WARN("Parameter of WholeBodyState publisher 'publish_rate' not set"
" (default value is 250). It has to be defined in"
" %s/publish_rate", node.getNamespace().c_str());
}
// Setting the floating-base system info
system_ = system;
wb_iface_.reset(system_);
// Getting the robot namespace. Note that this node is deploy in robot_ns/controller_ns
std::string robot_namespace = ros::names::parentNamespace(node.getNamespace());
ros::NodeHandle robot_node(robot_namespace);
// Initializing the real-time publisher
robot_state_pub_.reset(new
realtime_tools::RealtimePublisher<dwl_msgs::WholeBodyState> (robot_node, "robot_states", 1));
robot_state_pub_->lock();
robot_state_pub_->msg_.base.resize(6);
robot_state_pub_->msg_.joints.resize(system_.getJointDoF());
robot_state_pub_->msg_.contacts.resize(system_.getNumberOfEndEffectors());
robot_state_pub_->unlock();
init_robot_state_pub_ = true;
}
void ControllerCommons::initStateEstimationPublisher(ros::NodeHandle node)
{
// Getting the publish period
if (!node.getParam("publish_rate", odom_publish_rate_)) {
ROS_WARN("Parameter of StateEstimation publisher 'publish_rate' not set"
" (default value is 250). It has to be defined in"
" %s/publish_rate", node.getNamespace().c_str());
}
// Initializing the real-time publisher
ros::NodeHandle nh; //Nodehandle without prefix
base_state_pub_.reset(new
realtime_tools::RealtimePublisher<nav_msgs::Odometry> (node, "odom", 1));
pose_covariance_pub_.reset(new
realtime_tools::RealtimePublisher<geometry_msgs::PoseWithCovarianceStamped> (node, "pose", 1));
tf_pub_.reset(new
realtime_tools::RealtimePublisher<tf2_msgs::TFMessage> (nh, "tf", 100));
init_odom_state_pub_ = true;
}
void ControllerCommons::initImuPublisher(ros::NodeHandle node,
std::string imu_frame)
{
imu_state_pub_.reset(new realtime_tools::RealtimePublisher<sensor_msgs::Imu> (node, "imu", 1));
imu_state_pub_->lock();
imu_state_pub_->msg_.header.frame_id = imu_frame;
imu_state_pub_->unlock();
init_imu_state_pub_ = true;
}
void ControllerCommons::initStateEstimationSubscriber(ros::NodeHandle node)
{
base_state_sub_ = node.subscribe<nav_msgs::Odometry> ("odom", 1,
&ControllerCommons::setBaseStateCB, this, ros::TransportHints().tcpNoDelay());
}
void ControllerCommons::initMotionPlanSubscriber(ros::NodeHandle node,
dwl::model::FloatingBaseSystem& system)
{
plan_sub_ = node.subscribe<dwl_msgs::WholeBodyTrajectory> ("plan", 1,
&ControllerCommons::setPlanCB, this, ros::TransportHints().tcpNoDelay());
// Setting the floating-base system info
system_ = system;
wb_iface_.reset(system_);
}
void ControllerCommons::publishControllerState(const ros::Time& time,
const dwl::WholeBodyState& current_state,
const dwl::WholeBodyState& desired_state,
const dwl::WholeBodyState& error_state,
const Eigen::VectorXd& feedforward_cmd,
const Eigen::VectorXd& feedback_cmd,
const Eigen::VectorXd& command_eff)
{
// Sanity check of the publisher initialization
if (!init_controller_state_pub_) {
ROS_WARN("Could not published the controller state because it was not initialized");
return;
}
// limit rate of publishing
if (controller_publish_rate_ > 0.0 && last_controller_publish_time_ +
ros::Duration(1.0 / controller_publish_rate_) < time) {
// try to publish
if (controller_state_pub_->trylock()) {
// we're actually publishing, so increment time
last_controller_publish_time_ += ros::Duration(1.0 / controller_publish_rate_);
controller_state_pub_->msg_.header.stamp = time;
// Converting the desired, actual and error whole-body statees
wb_iface_.writeToMessage(controller_state_pub_->msg_.desired, desired_state);
wb_iface_.writeToMessage(controller_state_pub_->msg_.actual, current_state);
wb_iface_.writeToMessage(controller_state_pub_->msg_.error, error_state);
// Populating joint command messages
dwl::urdf_model::JointID joint_links = system_.getJoints();
for (dwl::urdf_model::JointID::const_iterator joint_it = joint_links.begin();
joint_it != joint_links.end(); joint_it++) {
std::string name = joint_it->first;
unsigned int id = joint_it->second;
controller_state_pub_->msg_.command[id].name = name;
controller_state_pub_->msg_.command[id].total = command_eff(id);
controller_state_pub_->msg_.command[id].feedforward = feedforward_cmd(id);
controller_state_pub_->msg_.command[id].feedback = feedback_cmd(id);
}
controller_state_pub_->unlockAndPublish();
}
}
}
void ControllerCommons::publishWholeBodyState(const ros::Time& time,
const dwl::WholeBodyState& state)
{
// Sanity check of the publisher initialization
if (!init_robot_state_pub_) {
ROS_WARN("Could not published the whole-body state because it was not initialized");
return;
}
// limit rate of publishing
if (robot_publish_rate_ > 0.0 && last_robot_publish_time_ +
ros::Duration(1.0 / robot_publish_rate_) < time) {
// try to publish
if (robot_state_pub_->trylock()) {
// we're actually publishing, so increment time
last_robot_publish_time_ += ros::Duration(1.0 / robot_publish_rate_);
robot_state_pub_->msg_.header.stamp = time;
robot_state_pub_->msg_.header.frame_id = system_.getFloatingBaseBody();
wb_iface_.writeToMessage(robot_state_pub_->msg_, state);
robot_state_pub_->unlockAndPublish();
}
}
}
void ControllerCommons::publishStateEstimation(const ros::Time& time,
const dwl::rbd::Vector6d& base_pos,
const dwl::rbd::Vector6d& base_vel)
{
// Sanity check of the publisher initialization
if (!init_odom_state_pub_) {
ROS_WARN("Could not published the state estimation because it was not initialized");
return;
}
// limit rate of publishing
if (odom_publish_rate_ > 0.0 && last_odom_publish_time_ +
ros::Duration(1.0 / odom_publish_rate_) < time) {
// Computing the orientation in quaternion
Eigen::Vector3d rpy;
rpy << base_pos(dwl::rbd::AX), base_pos(dwl::rbd::AY), base_pos(dwl::rbd::AZ);
Eigen::Quaterniond base_quat = dwl::math::getQuaternion(rpy);
// try to publish
if (base_state_pub_->trylock()) {
// we're actually publishing, so increment time
last_odom_publish_time_ += ros::Duration(1.0 / odom_publish_rate_);
base_state_pub_->msg_.header.stamp = time;
base_state_pub_->msg_.header.frame_id = "world";
base_state_pub_->msg_.pose.pose.position.x = base_pos(dwl::rbd::LX);
base_state_pub_->msg_.pose.pose.position.y = base_pos(dwl::rbd::LY);
base_state_pub_->msg_.pose.pose.position.z = base_pos(dwl::rbd::LZ);
base_state_pub_->msg_.pose.pose.orientation.x = base_quat.x();
base_state_pub_->msg_.pose.pose.orientation.y = base_quat.y();
base_state_pub_->msg_.pose.pose.orientation.z = base_quat.z();
base_state_pub_->msg_.pose.pose.orientation.w = base_quat.w();
base_state_pub_->msg_.twist.twist.linear.x = base_vel(dwl::rbd::LX);
base_state_pub_->msg_.twist.twist.linear.y = base_vel(dwl::rbd::LY);
base_state_pub_->msg_.twist.twist.linear.z = base_vel(dwl::rbd::LZ);
base_state_pub_->msg_.twist.twist.angular.x = base_vel(dwl::rbd::AX);
base_state_pub_->msg_.twist.twist.angular.y = base_vel(dwl::rbd::AY);
base_state_pub_->msg_.twist.twist.angular.z = base_vel(dwl::rbd::AZ);
base_state_pub_->unlockAndPublish();
}
// try to publish
if (pose_covariance_pub_->trylock()) {
// we're actually publishing, so increment time
last_odom_publish_time_ += ros::Duration(1.0 / odom_publish_rate_);
pose_covariance_pub_->msg_.header.stamp = time;
pose_covariance_pub_->msg_.header.frame_id = "world";
pose_covariance_pub_->msg_.pose.pose.position.x = base_pos(dwl::rbd::LX);
pose_covariance_pub_->msg_.pose.pose.position.y = base_pos(dwl::rbd::LY);
pose_covariance_pub_->msg_.pose.pose.position.z = base_pos(dwl::rbd::LZ);
pose_covariance_pub_->msg_.pose.pose.orientation.x = base_quat.x();
pose_covariance_pub_->msg_.pose.pose.orientation.y = base_quat.y();
pose_covariance_pub_->msg_.pose.pose.orientation.z = base_quat.z();
pose_covariance_pub_->msg_.pose.pose.orientation.w = base_quat.w();
pose_covariance_pub_->unlockAndPublish();
}
// TF message
geometry_msgs::TransformStamped tf_msg;
tf_msg.header.stamp = time;
tf_msg.child_frame_id = "base_link";
tf_msg.header.frame_id = "world";
tf_msg.transform.translation.x = base_pos(dwl::rbd::LX);
tf_msg.transform.translation.y = base_pos(dwl::rbd::LY);
tf_msg.transform.translation.z = base_pos(dwl::rbd::LZ);
tf_msg.transform.rotation.x = base_quat.x();
tf_msg.transform.rotation.y = base_quat.y();
tf_msg.transform.rotation.z = base_quat.z();
tf_msg.transform.rotation.w = base_quat.w();
tf2_msgs::TFMessage tf2_msg;
tf2_msg.transforms.push_back(tf_msg);
if (tf_pub_->trylock()) {
tf_pub_->msg_ = tf2_msg;
tf_pub_->unlockAndPublish();
}
}
}
void ControllerCommons::publishImuState(const ros::Time& time,
const struct ImuData& imu)
{
// Sanity check of the publisher initialization
if (!init_imu_state_pub_) {
ROS_WARN("Could not published the imu state because it was not initialized");
return;
}
// limit rate of publishing
if (imu_publish_rate_ > 0.0 && last_imu_publish_time_ +
ros::Duration(1.0 / imu_publish_rate_) < time) {
// try to publish
if (imu_state_pub_->trylock()) {
// we're actually publishing, so increment time
last_imu_publish_time_ += ros::Duration(1.0 / odom_publish_rate_);
imu_state_pub_->msg_.header.stamp = time;
imu_state_pub_->msg_.orientation.x = imu.orientation.x();
imu_state_pub_->msg_.orientation.y = imu.orientation.y();
imu_state_pub_->msg_.orientation.z = imu.orientation.z();
imu_state_pub_->msg_.orientation.w = imu.orientation.w();
imu_state_pub_->msg_.angular_velocity.x = imu.angular_velocity(dwl::rbd::X);
imu_state_pub_->msg_.angular_velocity.y = imu.angular_velocity(dwl::rbd::Y);
imu_state_pub_->msg_.angular_velocity.z = imu.angular_velocity(dwl::rbd::Z);
imu_state_pub_->msg_.linear_acceleration.x = imu.linear_acceleration(dwl::rbd::X);
imu_state_pub_->msg_.linear_acceleration.y = imu.linear_acceleration(dwl::rbd::Y);
imu_state_pub_->msg_.linear_acceleration.z = imu.linear_acceleration(dwl::rbd::Z);
imu_state_pub_->unlockAndPublish();
}
}
}
void ControllerCommons::updateStateEstimationSubscription(dwl::rbd::Vector6d& base_pos,
dwl::rbd::Vector6d& base_vel)
{
// Updating the base positions
geometry_msgs::Quaternion q = base_state_.pose.pose.orientation;
Eigen::Quaterniond base_quat(q.w, q.x, q.y, q.z);
Eigen::Vector3d base_rpy = dwl::math::getRPY(base_quat);
// The Roll Pitch Yaw convention defines a rotation about x0 (Roll) + a rotation about
// y0 (Pitch) + a rotation about z0 (Yaw). So, RPY XYZ (gamma,beta,alpha) is equal to
// Euler ZYX (alpha, beta, gamma)
base_pos(dwl::rbd::AX) = base_rpy(0);
base_pos(dwl::rbd::AY) = base_rpy(1);
base_pos(dwl::rbd::AZ) = base_rpy(2);
base_pos(dwl::rbd::LX) = base_state_.pose.pose.position.x;
base_pos(dwl::rbd::LY) = base_state_.pose.pose.position.y;
base_pos(dwl::rbd::LZ) = base_state_.pose.pose.position.z;
// Updating the base velocities
base_vel(dwl::rbd::AX) = base_state_.twist.twist.angular.x;
base_vel(dwl::rbd::AY) = base_state_.twist.twist.angular.y;
base_vel(dwl::rbd::AZ) = base_state_.twist.twist.angular.z;
base_vel(dwl::rbd::LX) = base_state_.twist.twist.linear.x;
base_vel(dwl::rbd::LY) = base_state_.twist.twist.linear.y;
base_vel(dwl::rbd::LZ) = base_state_.twist.twist.linear.z;
}
void ControllerCommons::updateMotionPlanSubscription(dwl::WholeBodyState& state)
{
// Checks if there is a new plan message
if (new_plan_) {
// Setting the plan to be updated
plan_ = *plan_buffer_.readFromRT();
setPlan(plan_);
new_plan_ = false;
}
// Updates the motion plan
updatePlan(state);
}
void ControllerCommons::setPlan(const dwl_msgs::WholeBodyTrajectory& plan)
{
// Getting the number of points in the trajectory
num_traj_points_ = plan.trajectory.size();
// This is a sanity check. If there is not trajectory information, we go out immediately
if (num_traj_points_ == 0)
return;
// Setting the motion plan
plan_ = plan;
// Resetting the trajectory counter
trajectory_counter_ = 0;
}
void ControllerCommons::updatePlan(dwl::WholeBodyState& state)
{
// This is a sanity check. If there is not trajectory information, we go out immediately
if (num_traj_points_ == 0)
return;
// Getting the actual desired whole-body state
dwl_msgs::WholeBodyState msg = plan_.trajectory[trajectory_counter_];
// Converting the WholeBodyState msg
wb_iface_.writeFromMessage(state, msg);
// The trajectory counter is set to zero once the trajectory is finished
trajectory_counter_++;
if (trajectory_counter_ >= num_traj_points_) {
// Resetting values
num_traj_points_ = 0;
trajectory_counter_ = 0;
}
}
void ControllerCommons::setBaseStateCB(const nav_msgs::OdometryConstPtr& msg)
{
// the writeFromNonRT can be used in RT, if you have the guarantee that
// no non-rt thread is calling the same function (we're not subscribing to ros callbacks)
// there is only one single rt thread
base_state_buffer_.writeFromNonRT(*msg);
base_state_ = *base_state_buffer_.readFromNonRT();
if (!init_base_state_)
init_base_state_ = true;
}
void ControllerCommons::setPlanCB(const dwl_msgs::WholeBodyTrajectoryConstPtr& msg)
{
// the writeFromNonRT can be used in RT, if you have the guarantee that
// no non-rt thread is calling the same function (we're not subscribing to ros callbacks)
// there is only one single rt thread
plan_buffer_.writeFromNonRT(*msg);
new_plan_ = true;
}
} //@namespace dwl_msgs
| 36.612245 | 107 | 0.736467 | [
"model",
"transform"
] |
58d7185c3b5ad0e0c3ad8c94ef90b26458179be1 | 9,382 | cc | C++ | spot/spot/twa/bdddict.cc | mcc-petrinets/formulas | 10f835d67c7deedfe98fbbd55a56bd549a5bae9b | [
"MIT"
] | 1 | 2018-03-02T14:29:57.000Z | 2018-03-02T14:29:57.000Z | spot/spot/twa/bdddict.cc | mcc-petrinets/formulas | 10f835d67c7deedfe98fbbd55a56bd549a5bae9b | [
"MIT"
] | null | null | null | spot/spot/twa/bdddict.cc | mcc-petrinets/formulas | 10f835d67c7deedfe98fbbd55a56bd549a5bae9b | [
"MIT"
] | 1 | 2015-06-05T12:42:07.000Z | 2015-06-05T12:42:07.000Z | // -*- coding: utf-8 -*-
// Copyright (C) 2009, 2012-2017 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2003, 2004, 2005, 2006 Laboratoire d'Informatique de
// Paris 6 (LIP6), département Systèmes Répartis Coopératifs (SRC),
// Université Pierre et Marie Curie.
//
// This file is part of Spot, a model checking library.
//
// Spot 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.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <ostream>
#include <sstream>
#include <cassert>
#include <spot/tl/print.hh>
#include <spot/tl/formula.hh>
#include <spot/tl/defaultenv.hh>
#include "spot/priv/bddalloc.hh"
#include <spot/twa/bdddict.hh>
namespace spot
{
// Empty anonymous namespace so that the style checker does no
// complain about bdd_dict_priv (which should not be in an anonymous
// namespace).
namespace
{
}
class bdd_dict_priv final: public bdd_allocator
{
public:
class anon_free_list : public spot::free_list
{
public:
// WARNING: We need a default constructor so this can be used in
// a hash; but we should ensure that no object in the hash is
// constructed with p==0.
anon_free_list(bdd_dict_priv* p = nullptr)
: priv_(p)
{
}
virtual int
extend(int n) override
{
assert(priv_);
int b = priv_->allocate_variables(n);
free_anonymous_list_of_type::iterator i;
for (i = priv_->free_anonymous_list_of.begin();
i != priv_->free_anonymous_list_of.end(); ++i)
if (&i->second != this)
i->second.insert(b, n);
return b;
}
private:
bdd_dict_priv* priv_;
};
bdd_dict_priv()
{
free_anonymous_list_of[nullptr] = anon_free_list(this);
}
/// List of unused anonymous variable number for each automaton.
typedef std::map<const void*, anon_free_list> free_anonymous_list_of_type;
free_anonymous_list_of_type free_anonymous_list_of;
};
bdd_dict::bdd_dict()
// Initialize priv_ first, because it also initializes BuDDy
: priv_(new bdd_dict_priv()),
bdd_map(bdd_varnum())
{
}
bdd_dict::~bdd_dict()
{
assert_emptiness();
delete priv_;
}
int
bdd_dict::register_proposition(formula f, const void* for_me)
{
int num;
// Do not build a variable that already exists.
fv_map::iterator sii = var_map.find(f);
if (sii != var_map.end())
{
num = sii->second;
}
else
{
num = priv_->allocate_variables(1);
var_map[f] = num;
bdd_map.resize(bdd_varnum());
bdd_map[num].type = var;
bdd_map[num].f = f;
}
bdd_map[num].refs.insert(for_me);
return num;
}
int
bdd_dict::has_registered_proposition(formula f,
const void* me)
{
auto ssi = var_map.find(f);
if (ssi == var_map.end())
return -1;
int num = ssi->second;
auto& r = bdd_map[num].refs;
if (r.find(me) == r.end())
return -1;
return num;
}
int
bdd_dict::register_acceptance_variable(formula f,
const void* for_me)
{
int num;
// Do not build an acceptance variable that already exists.
fv_map::iterator sii = acc_map.find(f);
if (sii != acc_map.end())
{
num = sii->second;
}
else
{
num = priv_->allocate_variables(1);
acc_map[f] = num;
bdd_map.resize(bdd_varnum());
bdd_info& i = bdd_map[num];
i.type = acc;
i.f = f;
}
bdd_map[num].refs.insert(for_me);
return num;
}
int
bdd_dict::register_anonymous_variables(int n, const void* for_me)
{
typedef bdd_dict_priv::free_anonymous_list_of_type fal;
fal::iterator i = priv_->free_anonymous_list_of.find(for_me);
if (i == priv_->free_anonymous_list_of.end())
{
i = (priv_->free_anonymous_list_of.insert
(fal::value_type(for_me,
priv_->free_anonymous_list_of[nullptr]))).first;
}
int res = i->second.register_n(n);
bdd_map.resize(bdd_varnum());
while (n--)
{
bdd_map[res + n].type = anon;
bdd_map[res + n].refs.insert(for_me);
}
return res;
}
void
bdd_dict::register_all_variables_of(const void* from_other,
const void* for_me)
{
auto j = priv_->free_anonymous_list_of.find(from_other);
if (j != priv_->free_anonymous_list_of.end())
priv_->free_anonymous_list_of[for_me] = j->second;
for (auto& i: bdd_map)
{
ref_set& s = i.refs;
if (s.find(from_other) != s.end())
s.insert(for_me);
}
}
void
bdd_dict::unregister_variable(int v, const void* me)
{
assert(unsigned(v) < bdd_map.size());
ref_set& s = bdd_map[v].refs;
// If the variable is not owned by me, ignore it.
ref_set::iterator si = s.find(me);
if (si == s.end())
return;
s.erase(si);
// If var is anonymous, we should reinsert it into the free list
// of ME's anonymous variables.
if (bdd_map[v].type == anon)
priv_->free_anonymous_list_of[me].release_n(v, 1);
if (!s.empty())
return;
// ME was the last user of this variable.
// Let's free it. First, we need to find
// if this is a Var or an Acc variable.
formula f = nullptr;
switch (bdd_map[v].type)
{
case var:
f = bdd_map[v].f;
var_map.erase(f);
break;
case acc:
f = bdd_map[v].f;
acc_map.erase(f);
break;
case anon:
{
// Nobody use this variable as an anonymous variable
// anymore, so remove it entirely from the anonymous
// free list so it can be used for something else.
for (auto& fal: priv_->free_anonymous_list_of)
fal.second.remove(v, 1);
break;
}
}
// Actually release the associated BDD variables, and the
// formula itself.
priv_->release_variables(v, 1);
bdd_map[v].type = anon;
bdd_map[v].f = nullptr;
}
void
bdd_dict::unregister_all_my_variables(const void* me)
{
unsigned s = bdd_map.size();
for (unsigned i = 0; i < s; ++i)
unregister_variable(i, me);
priv_->free_anonymous_list_of.erase(me);
}
std::ostream&
bdd_dict::dump(std::ostream& os) const
{
os << "Variable Map:\n";
unsigned s = bdd_map.size();
for (unsigned i = 0; i < s; ++i)
{
os << ' ' << i << ' ';
const bdd_info& r = bdd_map[i];
switch (r.type)
{
case anon:
os << (r.refs.empty() ? "Free" : "Anon");
break;
case acc:
os << "Acc[";
print_psl(os, r.f) << ']';
break;
case var:
os << "Var[";
print_psl(os, r.f) << ']';
break;
}
if (!r.refs.empty())
{
os << " x" << r.refs.size() << " {";
for (ref_set::const_iterator si = r.refs.begin();
si != r.refs.end(); ++si)
os << ' ' << *si;
os << " }";
}
os << '\n';
}
os << "Anonymous lists:\n";
bdd_dict_priv::free_anonymous_list_of_type::const_iterator ai;
for (ai = priv_->free_anonymous_list_of.begin();
ai != priv_->free_anonymous_list_of.end(); ++ai)
{
os << " [" << ai->first << "] ";
ai->second.dump_free_list(os) << std::endl;
}
os << "Free list:\n";
priv_->dump_free_list(os);
os << '\n';
return os;
}
void
bdd_dict::assert_emptiness() const
{
bool fail = false;
bool var_seen = false;
bool acc_seen = false;
bool refs_seen = false;
unsigned s = bdd_map.size();
for (unsigned i = 0; i < s; ++i)
{
switch (bdd_map[i].type)
{
case var:
var_seen = true;
break;
case acc:
acc_seen = true;
break;
case anon:
break;
}
refs_seen |= !bdd_map[i].refs.empty();
}
if (var_map.empty() && acc_map.empty())
{
if (var_seen)
{
std::cerr << "var_map is empty but Var in map" << std::endl;
fail = true;
}
if (acc_seen)
{
std::cerr << "acc_map is empty but Acc in map" << std::endl;
fail = true;
}
if (refs_seen)
{
std::cerr << "maps are empty but var_refs is not" << std::endl;
fail = true;
}
if (!fail)
return;
}
else
{
std::cerr << "some maps are not empty" << std::endl;
}
dump(std::cerr);
abort();
}
}
| 25.917127 | 78 | 0.556918 | [
"object",
"model"
] |
58dbb223d799323e314b730801e40e767beca157 | 20,109 | cpp | C++ | src/geometry/base/CBaseMesh.cpp | SindenDev/3dimviewer | e23a3147edc35034ef4b75eae9ccdcbc7192b1a1 | [
"Apache-2.0"
] | 6 | 2020-04-14T16:10:55.000Z | 2021-05-21T07:13:55.000Z | src/geometry/base/CBaseMesh.cpp | SindenDev/3dimviewer | e23a3147edc35034ef4b75eae9ccdcbc7192b1a1 | [
"Apache-2.0"
] | null | null | null | src/geometry/base/CBaseMesh.cpp | SindenDev/3dimviewer | e23a3147edc35034ef4b75eae9ccdcbc7192b1a1 | [
"Apache-2.0"
] | 2 | 2020-07-24T16:25:38.000Z | 2021-01-19T09:23:18.000Z | ///////////////////////////////////////////////////////////////////////////////
//
// 3DimViewer
// Lightweight 3D DICOM viewer.
//
// Copyright 2014-2016 3Dim Laboratory s.r.o.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////
#ifdef _OPENMP
#include <omp.h> // has to be included first, don't ask me why
#endif
#include <geometry/base/CBaseMesh.h>
namespace geometry
{
////////////////////////////////////////////////////////////
/*!
* Triangular mesh
*/
//! Ctor
CBaseMesh::CBaseMesh()
{ }
//! Copy constructor
CBaseMesh::CBaseMesh(const CBaseMesh &mesh) : OMMesh(mesh)
{
}
CBaseMesh::CBaseMesh(const geometry::OMMesh &mesh) : OMMesh(mesh)
{
}
//! Assignment operator
CBaseMesh &CBaseMesh::operator=(const CBaseMesh &mesh)
{
if (&mesh == this)
{
return *this;
}
OMMesh::operator=(mesh);
return *this;
}
//! Dtor
CBaseMesh::~CBaseMesh()
{
}
int CBaseMesh::boundaryCount()
{
int nBounds = 0;
OpenMesh::HPropHandleT< bool > visited;
add_property(visited);
// set to false for all half edges
for (HalfedgeIter he_it = halfedges_begin(); he_it != halfedges_end() ; ++he_it )
property(visited,he_it) = false;
// go through all half edges
for (HalfedgeIter he_it = halfedges_begin(); he_it != halfedges_end() ; ++he_it )
{
if ( property(visited,he_it) )
continue;
if( !is_boundary(he_it ) )
continue;
property(visited,he_it) = true;
// go along boundary half edges
HalfedgeHandle he = next_halfedge_handle(he_it);
while( is_boundary(he) && ! property(visited,he) )
{
property(visited,he) = true;
he = next_halfedge_handle(he);
}
nBounds++;
}
remove_property(visited);
return nBounds;
}
int CBaseMesh::componentCount()
{
int nComponents = 0;
OpenMesh::VPropHandleT< bool > visited;
add_property(visited);
VertexIter v_it, v_end = vertices_end();
// iterate over all vertices
for (v_it = vertices_begin(); v_it != v_end; ++v_it)
property(visited, v_it) = false;
VertexIter current_pos = vertices_begin();
while( true )
{
// find an unvisited vertex
VertexHandle vh;
for (v_it = current_pos ; v_it != v_end; ++v_it)
{
if ( !property(visited, v_it) )
{
property(visited, v_it) = true;
current_pos = v_it;
vh = v_it.handle();
break;
}
}
// none was found -> done
if (!vh.is_valid()) break;
nComponents++;
std::vector<VertexHandle> handles;
handles.push_back( vh );
// go from found vertex
while( handles.size() > 0 )
{
VertexHandle current = handles.back();
handles.pop_back();
for (VertexVertexIter vv_it = vv_iter( current ); vv_it; ++vv_it)
{
if ( !property(visited, vv_it) )
{
property(visited, vv_it) = true;
handles.push_back( vv_it.handle() );
}
}
}
}
remove_property(visited);
return nComponents;
}
bool CBaseMesh::isClosed() const
{
CBaseMesh::ConstEdgeIter e_it, e_end = edges_end();
for (e_it = edges_begin(); e_it != e_end; ++e_it)
{
if (!status(e_it).deleted())
{
if (is_boundary(e_it.handle()))
return false;
}
}
return true;
}
bool CBaseMesh::isTwoManifold() const
{
// check whether is 2-manifold
CBaseMesh::ConstVertexIter ve_it = vertices_end();
for (CBaseMesh::ConstVertexIter v_it = vertices_begin(); v_it!=ve_it; ++v_it)
{
if (!is_manifold(v_it))
return false;
}
return true;
}
double CBaseMesh::meshVolume() const
{
double volume = 0;
ConstFaceIter f_end = faces_end();
std::vector<FaceHandle> facesList;
for (ConstFaceIter f_it = faces_begin(); f_it != faces_end(); ++f_it)
facesList.push_back(f_it.handle());
const int nFaces = facesList.size();
#pragma omp parallel for
for(int i=0; i<nFaces; i++)
{
FaceHandle f_it = facesList[i];
std::vector<CBaseMesh::Point> pts;
for (CBaseMesh::ConstFaceVertexIter fvit = cfv_begin(f_it); fvit != cfv_end(f_it); ++fvit)
pts.push_back(point(fvit.handle()));
double v = (1.0/6)*(
- pts[2][0]*pts[1][1]*pts[0][2]
+ pts[1][0]*pts[2][1]*pts[0][2]
+ pts[2][0]*pts[0][1]*pts[1][2]
- pts[0][0]*pts[2][1]*pts[1][2]
- pts[1][0]*pts[0][1]*pts[2][2]
+ pts[0][0]*pts[1][1]*pts[2][2]
);
#pragma omp atomic
volume += v;
}
return volume;
}
void CBaseMesh::invertNormals()
{
// get all faces, remove them and reinsert with reverse vertex order
std::vector< std::vector<VertexHandle> > facesList;
std::vector<FaceHandle> removed;
for (FaceIter f_it = faces_begin(); f_it != faces_end(); ++f_it)
{
std::vector<VertexHandle> pts;
for (CBaseMesh::FaceVertexIter fvit = fv_begin(f_it); fvit != fv_end(f_it); ++fvit)
pts.push_back(fvit.handle());
facesList.push_back(pts);
removed.push_back(f_it.handle());
}
int nFaces = removed.size();
for(int i=0; i<nFaces; i++)
delete_face(removed[i],false);
garbage_collection();
for(int i=0; i<nFaces; i++)
add_face(facesList[i][0],facesList[i][2],facesList[i][1]);
garbage_collection();
}
int CBaseMesh::fixOpenComponents()
{
int nDropped = 0;
std::vector<std::vector<CBaseMesh::Point> > badTriangleList;
// extract all open triangles
if (componentCount()>0)
{
OpenMesh::VPropHandleT< bool > visited;
add_property(visited);
VertexIter v_it, v_end = vertices_end();
//iterate over all vertices
for (v_it = vertices_begin(); v_it != v_end; ++v_it)
property(visited, v_it) = false;
VertexIter current_pos = vertices_begin();
while( true )
{
//find an unvisited vertex
VertexHandle vh;
for (v_it = current_pos ; v_it != v_end; ++v_it)
{
if ( !property(visited, v_it) )
{
property(visited, v_it) = true;
current_pos = v_it;
vh = v_it.handle();
break;
}
}
//if none was found -> finished
if (!vh.is_valid()) break;
std::vector<VertexHandle> handles;
handles.push_back( vh );
std::vector<VertexHandle> handlesX;
handlesX.push_back( vh );
bool bIsOpen = false;
//grow from found vertex
while( handles.size() > 0 )
{
VertexHandle current = handles.back();
handles.pop_back();
for (VertexVertexIter vv_it = vv_iter( current ); vv_it; ++vv_it)
{
if ( !property(visited, vv_it) )
{
property(visited, vv_it) = true;
handles.push_back( vv_it.handle() );
handlesX.push_back( vv_it.handle() );
if (is_boundary(vv_it.handle()))
bIsOpen = true;
}
}
}
if (bIsOpen)
{
if (handlesX.size()<=3) // a lost triangle
{
nDropped++;
std::vector<CBaseMesh::Point> ptslst;
// delete existing vertexes but store them in a list of lost triangles
for(std::vector<VertexHandle>::iterator it = handlesX.begin(); it != handlesX.end(); ++it)
{
ptslst.push_back(this->point(*it));
this->delete_vertex(*it);
}
if (3==ptslst.size())
badTriangleList.push_back(ptslst);
}
}
}
remove_property(visited);
}
garbage_collection();
// for every lost triangle search for an open position in the model
if (badTriangleList.size()>0)
{
omerr().disable();
std::vector<VertexHandle> boundaryVertices;
for (VertexIter v_it = vertices_begin(); v_it != vertices_end(); ++v_it)
{
if (status(v_it).deleted()) continue;
if (is_boundary(v_it.handle()))
boundaryVertices.push_back(v_it.handle());
}
int nBadTriangles;
do // as long as we are successfully adding triangles to model
{
std::cout << ".";
nBadTriangles = badTriangleList.size();
for(int i=0;i<badTriangleList.size();i++)
{
std::vector<CBaseMesh::Point> &ptslst = badTriangleList[i];
assert(ptslst.size()==3);
std::vector<VertexHandle> ptshndls;
ptshndls.push_back(VertexHandle());
ptshndls.push_back(VertexHandle());
ptshndls.push_back(VertexHandle());
int nValid = 0;
// for every triangle point find the nearest one
#pragma omp parallel for
for(int j=0;j<3;j++)
{
const Point pts = ptslst[j];
VertexHandle hBest;
double dist = DBL_MAX;
//for (VertexIter v_it = vertices_begin(); v_it != vertices_end(); ++v_it)
const int nCandidateVertices = boundaryVertices.size();
for(int vi = 0; vi < nCandidateVertices; vi++)
{
VertexHandle vih = boundaryVertices[vi];
if (status(vih).deleted()) continue;
if (is_boundary(vih))
{
double d = (point(vih)-pts).length();
if (d<dist)
{
dist = d;
hBest = vih;
}
}
}
if (hBest.is_valid() && dist<0.001)
{
ptshndls[j]=hBest;
#pragma omp atomic
nValid++;
}
}
std::vector<VertexHandle> newhandles;
if (2==nValid) // if only one vertex doesn't fit in, add it
{
for(int m=0;m<3;m++)
{
if (!ptshndls[m].is_valid())
{
ptshndls[m]=add_vertex(ptslst[m]);
newhandles.push_back(ptshndls[m]);
nValid++;
}
}
}
bool bFaceAdded = false;
if (3==nValid)
{
// add face
if (ptshndls[0]==ptshndls[1] || ptshndls[1]==ptshndls[2] || ptshndls[0]==ptshndls[2])
{
//std::cout << "bad luck";
}
else
{
FaceHandle fh = this->add_face(ptshndls[2],ptshndls[1],ptshndls[0]);
if (!fh.is_valid())
{
fh = this->add_face(ptshndls[0],ptshndls[1],ptshndls[2]);
}
bFaceAdded = fh.is_valid();
}
}
if (bFaceAdded)
{
badTriangleList.erase(badTriangleList.begin() + i);
i--;
for(int k = 0; k < newhandles.size(); k++)
if (is_boundary(newhandles[k]))
boundaryVertices.push_back(newhandles[k]);
}
else
{
// we failed - remove newly created vertices
for(int k = 0; k < newhandles.size(); k++)
delete_vertex(newhandles[k]);
// call garbage_collection(); or check status(v_it).deleted() on every vertex access
}
}
} while (nBadTriangles != badTriangleList.size());
// perform cleanup
garbage_collection();
// reinsert all bad triangles that we were not able to connect with other parts
nBadTriangles = badTriangleList.size();
for(int i = 0 ; i < nBadTriangles; i++)
{
std::vector<CBaseMesh::Point> &ptslst = badTriangleList[i];
if (3==ptslst.size())
{
#if(0)
VertexHandle vh0 = add_vertex(ptslst[0]);
VertexHandle vh1 = add_vertex(ptslst[1]);
VertexHandle vh2 = add_vertex(ptslst[2]);
FaceHandle fh = this->add_face(vh0,vh1,vh2);
assert(fh.is_valid());
#else
std::vector<VertexHandle> ptshndls;
ptshndls.push_back(VertexHandle());
ptshndls.push_back(VertexHandle());
ptshndls.push_back(VertexHandle());
int nValid = 0;
// for every triangle point find the nearest one
#pragma omp parallel for
for(int j=0;j<3;j++)
{
const Point pts = ptslst[j];
VertexHandle hBest;
double dist = DBL_MAX;
const int nCandidateVertices = boundaryVertices.size();
for(int vi = 0; vi < nCandidateVertices; vi++)
{
VertexHandle vih = boundaryVertices[vi];
if (vih.idx()>=n_vertices())
continue;
if (status(vih).deleted()) continue;
if (is_boundary(vih))
{
double d = (point(vih)-pts).length();
if (d<dist)
{
dist = d;
hBest = vih;
}
}
}
if (hBest.is_valid() && dist<0.001)
{
ptshndls[j]=hBest;
#pragma omp atomic
nValid++;
}
}
if (ptshndls[0]==ptshndls[1] || ptshndls[1]==ptshndls[2] || ptshndls[0]==ptshndls[2])
{
ptshndls.clear();
ptshndls.push_back(VertexHandle());
ptshndls.push_back(VertexHandle());
ptshndls.push_back(VertexHandle());
}
std::vector<VertexHandle> newhandles;
// replace missing vertices with new ones
for(int m=0;m<3;m++)
{
if (!ptshndls[m].is_valid())
{
ptshndls[m]=add_vertex(ptslst[m]);
newhandles.push_back(ptshndls[m]);
nValid++;
}
}
bool bFaceAdded = false;
if (3==nValid)
{
FaceHandle fh = this->add_face(ptshndls[0],ptshndls[1],ptshndls[2]);
if (!fh.is_valid())
{
fh = this->add_face(ptshndls[2],ptshndls[1],ptshndls[0]);
}
bFaceAdded = fh.is_valid();
}
if (!bFaceAdded)
{
// we failed - remove newly created vertices
for(int k = 0; k < newhandles.size(); k++)
delete_vertex(newhandles[k]);
VertexHandle vh0 = add_vertex(ptslst[0]);
VertexHandle vh1 = add_vertex(ptslst[1]);
VertexHandle vh2 = add_vertex(ptslst[2]);
FaceHandle fh = this->add_face(vh0,vh1,vh2);
assert(fh.is_valid());
boundaryVertices.push_back(vh0);
boundaryVertices.push_back(vh1);
boundaryVertices.push_back(vh2);
}
else
{
for(int k = 0; k < newhandles.size(); k++)
if (is_boundary(newhandles[k]))
boundaryVertices.push_back(newhandles[k]);
}
#endif
}
}
// perform cleanup
garbage_collection();
omerr().enable();
}
// add faces to boundaries that consist of three vertices
/*
int cm=0;
bool bAdded;
do
{
bAdded = false;
for (HalfedgeIter he_it = halfedges_begin(); he_it != halfedges_end() ; ++he_it )
{
if (is_boundary(he_it.handle()))
{
HalfedgeHandle hnext = next_halfedge_handle(next_halfedge_handle(next_halfedge_handle(he_it)));
assert(hnext.is_valid());
if (he_it.handle()==hnext)
{
HalfedgeHandle hnext = next_halfedge_handle(he_it);
VertexHandle v0=from_vertex_handle(he_it);
VertexHandle v1=to_vertex_handle(he_it);
VertexHandle v2=to_vertex_handle(hnext);
assert(v0!=v1 && v1!=v2 && v2!=v0);
assert(is_boundary(v0) && is_boundary(v1) && is_boundary(v2));
FaceHandle fh = add_face(v0,v1,v2);
if (!fh.is_valid())
{
fh = add_face(v1,v0,v2);
if (fh.is_valid())
{
bAdded = true;
cm++;
}
}
}
}
}
} while (bAdded);
std::cout << cm; */
/* m_nComponents = -1;
m_nBoundaries = -1;
boundaryCount();
componentCount();*/
return nDropped;
}
} // namespace data
| 33.853535 | 112 | 0.442936 | [
"mesh",
"geometry",
"vector",
"model",
"3d"
] |
58dcf53ab52cb81b26d287bae2b81cdb17583e3d | 4,684 | cpp | C++ | Code/Qt_C++_OpenCV_Projeto_TCII/configinputs.cpp | aabling2/projeto_tcc_2017 | d276ddb40c49eb75271977953502d3a08e4f4fe5 | [
"MIT"
] | null | null | null | Code/Qt_C++_OpenCV_Projeto_TCII/configinputs.cpp | aabling2/projeto_tcc_2017 | d276ddb40c49eb75271977953502d3a08e4f4fe5 | [
"MIT"
] | null | null | null | Code/Qt_C++_OpenCV_Projeto_TCII/configinputs.cpp | aabling2/projeto_tcc_2017 | d276ddb40c49eb75271977953502d3a08e4f4fe5 | [
"MIT"
] | null | null | null | #include "configinputs.h"
#include "ui_configinputs.h"
/*
#define num_max_parts 10 //Maximum number of parts to register in image
#define size_part 53 //Real diameter of the part(millimeters)
#define mask_angle 73.5 //Angle to make the lines in camera2 to align the conveyor
#define offset_line 26 //Offset from the side of the image (pixels)
#define width_conveyor 297 //Width of the conveyor to use on reading at second camera (millimeters)
#define length_conveyor 510 //Length of the conveyor to use on reading at second camera (millimeters)
#define dist_ref 420 //Distance between camera2 and end of length conveyor (millimeters)
#define dist_h 360 //Height distance between camera2 and conveyor (millimeters)
#define f_correct 1.0 //Correction factor to apply at the distance between camera2 and object
#define h_correct 35 //Height of the object to correct distance
*/
//Variables to compare changes
int C_size_part;
float C_mask_angle;
int C_offset_line;
int C_width_conveyor;
int C_length_conveyor;
int C_dist_ref;
int C_dist_h;
bool C_bot_ok;
ConfigInputs::ConfigInputs(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConfigInputs)
{
ui->setupUi(this);
FILE *readConfigIn;
readConfigIn = fopen("config/inputs.txt", "r");
fscanf(readConfigIn, "size_part = %d;\n", &size_part);
fscanf(readConfigIn, "mask_angle = %f;\n", &mask_angle);
fscanf(readConfigIn, "offset_line = %d;\n", &offset_line);
fscanf(readConfigIn, "width_conveyor = %d;\n", &width_conveyor);
fscanf(readConfigIn, "length_conveyor = %d;\n", &length_conveyor);
fscanf(readConfigIn, "dist_ref = %d;\n", &dist_ref);
fscanf(readConfigIn, "dist_h = %d;\n", &dist_h);
fclose(readConfigIn);
ui->lineEdit_size_part->setText(QString::number(size_part));
ui->lineEdit_angle->setText(QString::number(mask_angle));
ui->lineEdit_offset->setText(QString::number(offset_line));
ui->lineEdit_width->setText(QString::number(width_conveyor));
ui->lineEdit_length->setText(QString::number(length_conveyor));
ui->lineEdit_dist_ref->setText(QString::number(dist_ref));
ui->lineEdit_height->setText(QString::number(dist_h));
//Save data to compare
C_size_part = size_part;
C_mask_angle = mask_angle;
C_offset_line = offset_line;
C_width_conveyor = width_conveyor;
C_length_conveyor = length_conveyor;
C_dist_ref = dist_ref;
C_dist_h = dist_h;
}
ConfigInputs::~ConfigInputs()
{
delete ui;
}
void ConfigInputs::on_buttonBox_accepted()
{
size_part = ui->lineEdit_size_part->text().toInt();
mask_angle = ui->lineEdit_angle->text().toFloat();
offset_line = ui->lineEdit_offset->text().toInt();
width_conveyor = ui->lineEdit_width->text().toInt();
length_conveyor = ui->lineEdit_length->text().toInt();
dist_ref = ui->lineEdit_dist_ref->text().toInt();
dist_h = ui->lineEdit_height->text().toInt();
if(size_part!=C_size_part || mask_angle!=C_mask_angle
|| offset_line!=C_offset_line || width_conveyor!=C_width_conveyor
|| length_conveyor!=C_length_conveyor || dist_ref!=C_dist_ref
|| dist_h!= C_dist_h)
bot_ok = 1;
else
bot_ok = 0;
if(bot_ok == 1){
FILE *saveConfigIn;
saveConfigIn = fopen("config/inputs.txt", "w");
fprintf(saveConfigIn, "size_part = %d;\n", size_part);
fprintf(saveConfigIn, "mask_angle = %.2f;\n", mask_angle);
fprintf(saveConfigIn, "offset_line = %d;\n", offset_line);
fprintf(saveConfigIn, "width_conveyor = %d;\n", width_conveyor);
fprintf(saveConfigIn, "length_conveyor = %d;\n", length_conveyor);
fprintf(saveConfigIn, "dist_ref = %d;\n", dist_ref);
fprintf(saveConfigIn, "dist_h = %d;\n", dist_h);
fclose(saveConfigIn);
}
}
void ConfigInputs::on_pushButton_2_clicked()
{
size_part = 53;
mask_angle = 73.5;
offset_line = 26;
width_conveyor = 297;
length_conveyor = 510;
dist_ref = 420;
dist_h = 360;
ui->lineEdit_size_part->setText(QString::number(size_part));
ui->lineEdit_angle->setText(QString::number(mask_angle));
ui->lineEdit_offset->setText(QString::number(offset_line));
ui->lineEdit_width->setText(QString::number(width_conveyor));
ui->lineEdit_length->setText(QString::number(length_conveyor));
ui->lineEdit_dist_ref->setText(QString::number(dist_ref));
ui->lineEdit_height->setText(QString::number(dist_h));
}
void ConfigInputs::on_buttonBox_rejected()
{
bot_ok = 0;
}
| 38.081301 | 113 | 0.678053 | [
"object"
] |
58e62ed93043fef921fa6755874059f1553a6694 | 220 | cpp | C++ | oop2_ex4/Shape.cpp | MatanelAbayof/6-Colors | b7aaff310dfa582ac4fa9cce5190a2d1dee82fe9 | [
"Apache-2.0"
] | null | null | null | oop2_ex4/Shape.cpp | MatanelAbayof/6-Colors | b7aaff310dfa582ac4fa9cce5190a2d1dee82fe9 | [
"Apache-2.0"
] | null | null | null | oop2_ex4/Shape.cpp | MatanelAbayof/6-Colors | b7aaff310dfa582ac4fa9cce5190a2d1dee82fe9 | [
"Apache-2.0"
] | 2 | 2020-10-06T09:11:35.000Z | 2020-12-24T11:05:19.000Z | #include "Shape.h"
string Shape::toString() const
{
return "Shape: { Width = " + std::to_string(getWidth()) + ", Height: " + std::to_string(getHeight()) + ", Num of edges: " + std::to_string(getNumOfEdges()) + " }";
}
| 31.428571 | 164 | 0.613636 | [
"shape"
] |
58fd6150640d68607166635ad4babe31b4dc93d1 | 8,493 | cpp | C++ | meta/sai_extra_acl.cpp | volodymyrsamotiy/sonic-sairedis | ffb2f43054bacbe00d161866753e95977e9cd47d | [
"Apache-2.0"
] | 1 | 2020-09-04T02:07:25.000Z | 2020-09-04T02:07:25.000Z | meta/sai_extra_acl.cpp | volodymyrsamotiy/sonic-sairedis | ffb2f43054bacbe00d161866753e95977e9cd47d | [
"Apache-2.0"
] | 2 | 2018-06-13T06:44:20.000Z | 2018-07-05T08:12:04.000Z | meta/sai_extra_acl.cpp | barefootnetworks/sonic-sairedis | 7b11204eaacff026efb01580700966f378227747 | [
"Apache-2.0"
] | null | null | null | #include "sai_meta.h"
#include "sai_extra.h"
sai_status_t meta_pre_create_acl_table(
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list)
{
SWSS_LOG_ENTER();
const sai_attribute_t* attr_priority = get_attribute_by_id(SAI_ACL_TABLE_ATTR_PRIORITY, attr_count, attr_list);
if (attr_priority != NULL)
{
uint32_t priority = attr_priority->value.u32;
// TODO range is in
// SAI_SWITCH_ATTR_ACL_TABLE_MINIMUM_PRIORITY .. SAI_SWITCH_ATTR_ACL_TABLE_MAXIMUM_PRIORITY
// extra validation will be needed here and snoop
SWSS_LOG_DEBUG("acl priority: %d", priority);
}
const sai_attribute_t* attr_size = get_attribute_by_id(SAI_ACL_TABLE_ATTR_SIZE, attr_count, attr_list);
if (attr_size != NULL)
{
uint32_t size = attr_size->value.u32; // default value is zero
SWSS_LOG_DEBUG("size %u", size);
// TODO this attribute is special, since it can change dynamically, but it can be
// set on creation time and grow when entries are added
}
// TODO group ID is special, since when not specified it's created automatically
// by switch and user can obtain it via GET api and group tables.
// This behaviour should be changed and so no object would be created internally
// there is a tricky way to track this object usage
int fields = 0;
for (uint32_t i = 0; i < attr_count; ++i)
{
if (attr_list[i].id >= SAI_ACL_TABLE_ATTR_FIELD_START &&
attr_list[i].id <= SAI_ACL_TABLE_ATTR_FIELD_END)
{
fields++;
}
}
if (fields == 0)
{
SWSS_LOG_ERROR("at least one acl table field must present");
return SAI_STATUS_INVALID_PARAMETER;
}
// TODO another special attribute depending on switch SAI_SWITCH_ATTR_ACL_CAPABILITY
// it may be mandatory on create, why we need to query attributes and then pass them here?
// sdk logic can figure this out anyway
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_remove_acl_table(
_In_ sai_object_id_t acl_table_id)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_set_acl_table_attribute(
_In_ sai_object_id_t acl_table_id,
_In_ const sai_attribute_t *attr)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_get_acl_table_attribute(
_In_ sai_object_id_t acl_table_id,
_In_ uint32_t attr_count,
_Out_ sai_attribute_t *attr_list)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_create_acl_entry(
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list)
{
SWSS_LOG_ENTER();
const sai_attribute_t* attr_priority = get_attribute_by_id(SAI_ACL_ENTRY_ATTR_PRIORITY, attr_count, attr_list);
if (attr_priority != NULL)
{
SWSS_LOG_DEBUG("priority %u", attr_priority->value.u32);
// TODO special, range in SAI_SWITCH_ATTR_ACL_ENTRY_MINIMUM_PRIORITY .. SAI_SWITCH_ATTR_ACL_ENTRY_MAXIMUM_PRIORITY
// TODO we need to check if priority was snooped and saved so we could validate it here
}
// FIELDS
int fields = 0;
for (uint32_t i = 0; i < attr_count; ++i)
{
if (attr_list[i].id >= SAI_ACL_ENTRY_ATTR_FIELD_START &&
attr_list[i].id <= SAI_ACL_ENTRY_ATTR_FIELD_END)
{
fields++;
}
}
if (fields == 0)
{
SWSS_LOG_ERROR("at least one acl entry field must present");
return SAI_STATUS_INVALID_PARAMETER;
}
// PORTS, some fields here may be CPU_PORT
// TODO where we use port also lag or tunnel ?
// TODO are actions read/write?
// TODO extra validation is needed since we must check if type of mirror session is ingress
// TODO extra validation is needed since we must check if type of mirror session is egress
// TODO extra validation may be needed in policer
// TODO extra validation may be needed on of sample packet
// TODO extra validation may be needed on CPU_QUEUE
// TODO extra validation may be needed on EGRESS_BLOCK_PORT_LIST
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_delete_acl_entry(
_In_ sai_object_id_t acl_entry_id)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_set_acl_entry_attribute(
_In_ sai_object_id_t acl_entry_id,
_In_ const sai_attribute_t *attr)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_get_acl_entry_attribute(
_In_ sai_object_id_t acl_entry_id,
_In_ uint32_t attr_count,
_Out_ sai_attribute_t *attr_list)
{
SWSS_LOG_ENTER();
// TODO for get we need to check if attrib was set previously ?
// like field or action, or can we get action that was not set?
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_create_acl_counter(
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_remove_acl_counter(
_In_ sai_object_id_t acl_counter_id)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_set_acl_counter_attribute(
_In_ sai_object_id_t acl_counter_id,
_In_ const sai_attribute_t *attr)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_get_acl_counter_attribute(
_In_ sai_object_id_t acl_counter_id,
_In_ uint32_t attr_count,
_Out_ sai_attribute_t *attr_list)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_create_acl_range(
_In_ uint32_t attr_count,
_In_ const sai_attribute_t *attr_list)
{
SWSS_LOG_ENTER();
const sai_attribute_t* attr_type = get_attribute_by_id(SAI_ACL_RANGE_ATTR_TYPE, attr_count, attr_list);
const sai_attribute_t* attr_limit = get_attribute_by_id(SAI_ACL_RANGE_ATTR_LIMIT, attr_count, attr_list);
sai_acl_range_type_t type = (sai_acl_range_type_t)attr_type->value.s32;
sai_u32_range_t range = attr_limit->value.u32range;
SWSS_LOG_DEBUG("acl range <%u..%u> of type %d", range.min, range.max, type);
switch (type)
{
// layer 4 port range
case SAI_ACL_RANGE_L4_SRC_PORT_RANGE:
case SAI_ACL_RANGE_L4_DST_PORT_RANGE:
// we allow 0
if (range.min >= range.max ||
//range.min < MINIMUM_L4_PORT_NUMBER ||
//range.max < MINIMUM_L4_PORT_NUMBER ||
range.min > MAXIMUM_L4_PORT_NUMBER ||
range.max > MAXIMUM_L4_PORT_NUMBER)
{
SWSS_LOG_ERROR("invalid acl port range <%u..%u> in <%u..%u>", range.min, range.max, MINIMUM_L4_PORT_NUMBER, MAXIMUM_L4_PORT_NUMBER);
return SAI_STATUS_INVALID_PARAMETER;
}
break;
case SAI_ACL_RANGE_OUTER_VLAN:
case SAI_ACL_RANGE_INNER_VLAN:
if (range.min >= range.max ||
range.min < MINIMUM_VLAN_NUMBER ||
range.min > MAXIMUM_VLAN_NUMBER ||
range.max < MINIMUM_VLAN_NUMBER ||
range.max > MAXIMUM_VLAN_NUMBER)
{
SWSS_LOG_ERROR("invalid acl vlan range <%u..%u> in <%u..%u>", range.min, range.max, MINIMUM_VLAN_NUMBER, MAXIMUM_VLAN_NUMBER);
return SAI_STATUS_INVALID_PARAMETER;
}
break;
case SAI_ACL_RANGE_PACKET_LENGTH:
if (range.min >= range.max ||
range.min > MAXIMUM_PACKET_SIZE ||
range.max > MAXIMUM_PACKET_SIZE)
{
SWSS_LOG_ERROR("invalid acl vlan range <%u..%u> in <%u..%u>", range.min, range.max, MINIMUM_PACKET_SIZE, MAXIMUM_PACKET_SIZE);
return SAI_STATUS_INVALID_PARAMETER;
}
break;
default:
SWSS_LOG_ERROR("FATAL: inalid type %d", type);
return SAI_STATUS_FAILURE;
}
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_remove_acl_range(
_In_ sai_object_id_t acl_range_id)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_set_acl_range_attribute(
_In_ sai_object_id_t acl_range_id,
_In_ const sai_attribute_t *attr)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
sai_status_t meta_pre_get_acl_range_attribute(
_In_ sai_object_id_t acl_range_id,
_In_ uint32_t attr_count,
_Out_ sai_attribute_t *attr_list)
{
SWSS_LOG_ENTER();
return SAI_STATUS_SUCCESS;
}
| 27.754902 | 148 | 0.684211 | [
"object"
] |
450442806fb06c56f2ac10d208817c5ef1fe69af | 6,910 | cpp | C++ | apps/hubo-sim.cpp | mxgrey/protoHuboGUI | 3384c5e40c544bd472199da9cd6e90e28321a77f | [
"BSD-2-Clause"
] | null | null | null | apps/hubo-sim.cpp | mxgrey/protoHuboGUI | 3384c5e40c544bd472199da9cd6e90e28321a77f | [
"BSD-2-Clause"
] | null | null | null | apps/hubo-sim.cpp | mxgrey/protoHuboGUI | 3384c5e40c544bd472199da9cd6e90e28321a77f | [
"BSD-2-Clause"
] | null | null | null | /*
* Copyright (c) 2015, Georgia Tech Research Corporation
* All rights reserved.
*
* Author(s): Michael X. Grey <mxgrey@gatech.edu>
*
* This file is provided under the following "BSD-style" License:
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <memory>
#include <dart/dart.h>
#include <osgDart/osgDart.h>
#include <HuboCan/HuboDescription.hpp>
#include <HuboCan/VirtualPump.hpp>
#include <HuboCmd/Aggregator.hpp>
#include <HuboState/State.hpp>
#include <osg/Timer>
using namespace dart::dynamics;
using namespace dart::simulation;
using namespace osgDart;
using namespace HuboCan;
class SimulationWorld : public osgDart::WorldNode
{
public:
SimulationWorld(WorldPtr world)
: osgDart::WorldNode(world)
{
mHubo = world->getSkeleton("drchubo");
mDesc.parseFile("/opt/hubo/devices/DrcHubo.dd");
mDesc.broadcastInfo();
for(size_t i=0; i < mDesc.getJointCount(); ++i)
{
const hubo_joint_info_t& info = mDesc.joints[i]->info;
DegreeOfFreedom* dof = mHubo->getDof(info.name);
if(dof)
mIndexMapping.push_back(dof->getIndexInSkeleton());
else
mIndexMapping.push_back(dart::dynamics::INVALID_INDEX);
}
mState = std::unique_ptr<HuboState::State>(new HuboState::State(mDesc));
mAgg = std::unique_ptr<HuboCmd::Aggregator>(new HuboCmd::Aggregator(mDesc));
if(!mState->initialized())
{
std::cout << "State was not initialized correctly, so we are quitting.\n"
<< " -- Either your ach channels are not open"
<< " or your HuboDescription was not valid!\n" << std::endl;
return;
}
mAgg->run();
mNumTicks = 0;
mTimer.setStartTick();
}
void customPreStep() override
{
const HuboCmd::JointCmdArray& commands = mAgg->update();
assert(commands.size() == mDesc.getJointCount());
for(size_t i=0; i < commands.size(); ++i)
{
size_t index = mIndexMapping[i];
if(dart::dynamics::INVALID_INDEX == index)
continue;
const hubo_joint_cmd_t& cmd = commands[i];
DegreeOfFreedom* dof = mHubo->getDof(index);
double velocity = cmd.position - dof->getPosition();
velocity /= mHubo->getTimeStep();
dof->setCommand(velocity);
hubo_joint_state_t& state = mState->joints[i];
state.duty = dof->getCommand();
state.current = velocity;
}
}
void customPostStep() override
{
// double time = mTimer.time_s();
double time = mWorld->getTime();
double nextTickTime = (double)(mNumTicks)/mDesc.params.frequency;
if(time < nextTickTime)
return;
++mNumTicks;
const HuboCmd::JointCmdArray& commands = mAgg->last_commands();
for(size_t i=0; i < mState->joints.size(); ++i)
{
size_t index = mIndexMapping[i];
if(dart::dynamics::INVALID_INDEX == index)
continue;
const hubo_joint_cmd_t& cmd = commands[i];
hubo_joint_state_t& state = mState->joints[i];
const DegreeOfFreedom* dof = mHubo->getDof(index);
state.reference = cmd.position;
state.position = dof->getPosition();
}
mState->publish();
}
protected:
SkeletonPtr mHubo;
HuboDescription mDesc;
std::vector<size_t> mIndexMapping;
std::unique_ptr<HuboState::State> mState;
std::unique_ptr<HuboCmd::Aggregator> mAgg;
osg::Timer mTimer;
size_t mNumTicks;
};
SkeletonPtr createHubo()
{
dart::utils::DartLoader loader;
loader.addPackageDirectory("drchubo", DART_DATA_PATH"/urdf/drchubo");
SkeletonPtr hubo =
loader.parseSkeleton(DART_DATA_PATH"/urdf/drchubo/drchubo.urdf");
hubo->setPosition(5, 0.97);
for(size_t i=1; i < hubo->getNumJoints(); ++i)
{
hubo->getJoint(i)->setActuatorType(Joint::VELOCITY);
}
for(size_t i=0; i < hubo->getNumBodyNodes(); ++i)
{
BodyNode* bn = hubo->getBodyNode(i);
for(size_t j=0; j < bn->getNumVisualizationShapes(); ++j)
{
const ShapePtr& shape = bn->getVisualizationShape(j);
shape->setColor(Eigen::Vector3d(0.2, 0.2, 0.2));
if(MeshShapePtr mesh = std::dynamic_pointer_cast<MeshShape>(shape))
mesh->setColorMode(MeshShape::SHAPE_COLOR);
}
}
hubo->setName("drchubo");
return hubo;
}
SkeletonPtr createGround()
{
// Create a Skeleton to represent the ground
SkeletonPtr ground = Skeleton::create("ground");
Eigen::Isometry3d tf(Eigen::Isometry3d::Identity());
double thickness = 0.01;
tf.translation() = Eigen::Vector3d(0,0,-thickness/2.0);
WeldJoint::Properties joint;
joint.mT_ParentBodyToJoint = tf;
ground->createJointAndBodyNodePair<WeldJoint>(nullptr, joint);
ShapePtr groundShape =
std::make_shared<BoxShape>(Eigen::Vector3d(10,10,thickness));
groundShape->setColor(dart::Color::Blue(0.2));
ground->getBodyNode(0)->addVisualizationShape(groundShape);
ground->getBodyNode(0)->addCollisionShape(groundShape);
return ground;
}
int main()
{
WorldPtr world(new dart::simulation::World);
world->addSkeleton(createHubo());
world->addSkeleton(createGround());
osg::ref_ptr<SimulationWorld> node = new SimulationWorld(world);
node->setNumStepsPerCycle(30);
osgDart::Viewer viewer;
viewer.addWorldNode(node);
viewer.simulate(true);
viewer.setUpViewInWindow(0, 0, 640, 480);
// Set up the default viewing position
viewer.getCameraManipulator()->setHomePosition(osg::Vec3( 5.34, 3.00, 1.91),
osg::Vec3( 0.00, 0.00, 0.50),
osg::Vec3(-0.20, -0.08, 0.98));
viewer.setCameraManipulator(viewer.getCameraManipulator());
viewer.run();
}
| 30.174672 | 80 | 0.677713 | [
"mesh",
"shape",
"vector"
] |
4509020f6d27c526b093bb8144ca4dcff66329ad | 4,109 | cpp | C++ | DiscoveringModernCpp/c++20/ranges_niebler.cpp | SebastianTirado/Cpp-Learning-Archive | fb83379d0cc3f9b2390cef00119464ec946753f4 | [
"MIT"
] | 19 | 2019-09-15T12:23:51.000Z | 2020-06-18T08:31:26.000Z | DiscoveringModernCpp/c++20/ranges_niebler.cpp | SebastianTirado/Cpp-Learning-Archive | fb83379d0cc3f9b2390cef00119464ec946753f4 | [
"MIT"
] | 15 | 2021-12-07T06:46:03.000Z | 2022-01-31T07:55:32.000Z | DiscoveringModernCpp/c++20/ranges_niebler.cpp | SebastianTirado/Cpp-Learning-Archive | fb83379d0cc3f9b2390cef00119464ec946753f4 | [
"MIT"
] | 13 | 2019-06-29T02:58:27.000Z | 2020-05-07T08:52:22.000Z | // Example program for Discovering Modern C++
//
// File: ranges_niebler.cpp
// Date: 2020-01-30
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string_view>
#include <string>
#include <typeinfo>
#ifdef DMC2_WITH_NIEBLER
# include <range/v3/range.hpp>
# include <range/v3/range/conversion.hpp>
# include <range/v3/functional/comparisons.hpp>
# include <range/v3/algorithm.hpp>
# include <range/v3/algorithm/copy.hpp>
# include <range/v3/view/filter.hpp>
# include <range/v3/view/transform.hpp>
# include <range/v3/view/reverse.hpp>
# include <range/v3/view/all.hpp>
# include <range/v3/view/join.hpp>
#endif
using namespace std;
namespace dmc
{
} // namespace dmc
int main()
{
using namespace dmc;
#ifdef DMC2_WITH_NIEBLER
using namespace ::ranges;
vector<int> numbers{3, 9, 2, 8, 4};
ostream_iterator<int> osi{cout, ", "};
// ::ranges::sort(numbers);
// std::copy(std::begin(numbers), std::end(numbers), osi); cout << endl;
auto is_even= [](int n){ return n % 2 == 0; };
auto square= [](int n){ return n * n; };
// auto even_numbers= ::ranges::view::filter(numbers, [](int n){ return n % 2 == 0; });
auto even_numbers= numbers | view::filter(is_even)
| view::transform(square);
// deprecated, should use conversion.hpp
// vector<int> even_number_pairs= numbers | view::filter(is_even)
// | view::transform(square);
// better like this:
auto even_number_converted= ::ranges::to<vector<int>>(numbers | view::filter(is_even));
// ambiguous without std::
std::copy(std::begin(even_numbers), std::end(even_numbers), osi); cout << endl;
// copy(even_numbers, osi); cout << endl; // ambiguous
// ::ranges::copy(even_numbers, osi); cout << endl; // not found
// copy(even_number_pairs, osi); cout << endl; // ambiguous
// ::ranges::copy(even_number_pairs, osi); cout << endl; // not found
// ::ranges::filter_view<vector<int>, decltype(is_even)> fv{numbers, is_even};
// for (int i : fv)
// cout << i << endl;
// for (int i : filter_view{numbers, is_even})
// cout << i << endl;
for (int i : view::filter(numbers, is_even))
cout << i << endl;
// for (int i : transform_view{filter_view{numbers, is_even}, square})
// cout << i << endl;
for (int i : view::transform(view::filter(numbers, is_even), square))
cout << i << endl;
for (int i : numbers | view::filter(is_even) | view::transform(square))
cout << i << endl;
// for (int i : numbers | ::ranges::sort | view::filter(is_even) | view::transform(square))
// cout << i << endl;
std::pair<int, std::string_view> pairs[] = {{2, "foo"}, {1, "bar"}, {0, "baz"}},
more_pairs[] = {{3, "ding"}, {4, "bums"}, {1, "bar"}};
// sort ints only, projection 15.3.18
::ranges::sort(pairs, ::ranges::less{}, [](auto const& p) { return p.first; });
::ranges::sort(pairs, ::ranges::less{}); // sort pairs
// less is a class template in std and a class with a template operator() in range
::ranges::sort(pairs, std::less<int>{}, [](auto const& p) { return p.first; });
for (auto [num, sv] : pairs)
cout << num << ": " << sv << endl;
for (auto [num, sv] : pairs | view::reverse)
cout << num << ": " << sv << endl;
vector<string> ss{"hello", " ", "world", "!"};
cout << "Type of joined ss = " << typeid(ss | view::join).name() << '\n';
cout << "joined ss = " << (ss | view::join) << endl;
// string s= ss | view::join; // deprecated, should use conversion.hpp
string s= ::ranges::to<string>(ss | view::join);
cout << "String is " << s << endl;
#else
cout << "ranges_niebler: Eric Niebler's library is not enabled.\n";
#endif
return 0;
}
| 34.529412 | 95 | 0.556096 | [
"vector",
"transform"
] |
4513f15b527a49ea40110d179fd230edcf12a400 | 10,291 | cpp | C++ | apps/tests/test_davidson.cpp | manhin321/SIRIUS | f4f9fb7b7cb0f0907094337a58ed9eb8928a8193 | [
"BSD-2-Clause"
] | null | null | null | apps/tests/test_davidson.cpp | manhin321/SIRIUS | f4f9fb7b7cb0f0907094337a58ed9eb8928a8193 | [
"BSD-2-Clause"
] | null | null | null | apps/tests/test_davidson.cpp | manhin321/SIRIUS | f4f9fb7b7cb0f0907094337a58ed9eb8928a8193 | [
"BSD-2-Clause"
] | null | null | null | #include <sirius.hpp>
#include "band/davidson.hpp"
using namespace sirius;
template <typename T>
void init_wf(K_point<T>* kp__, Wave_functions<T>& phi__, int num_bands__, int num_mag_dims__)
{
std::vector<double> tmp(0xFFFF);
for (int i = 0; i < 0xFFFF; i++) {
tmp[i] = utils::random<double>();
}
phi__.pw_coeffs(0).prime().zero();
//#pragma omp parallel for schedule(static)
for (int i = 0; i < num_bands__; i++) {
for (int igk_loc = 0; igk_loc < kp__->num_gkvec_loc(); igk_loc++) {
/* global index of G+k vector */
int igk = kp__->idxgk(igk_loc);
if (igk == 0) {
phi__.pw_coeffs(0).prime(igk_loc, i) = 1.0;
}
if (igk == i + 1) {
phi__.pw_coeffs(0).prime(igk_loc, i) = 0.5;
}
if (igk == i + 2) {
phi__.pw_coeffs(0).prime(igk_loc, i) = 0.25;
}
if (igk == i + 3) {
phi__.pw_coeffs(0).prime(igk_loc, i) = 0.125;
}
phi__.pw_coeffs(0).prime(igk_loc, i) += tmp[(igk + i) & 0xFFFF] * 1e-5;
}
}
if (num_mag_dims__ == 3) {
/* make pure spinor up- and dn- wave functions */
phi__.copy_from(device_t::CPU, num_bands__, phi__, 0, 0, 1, num_bands__);
}
}
template <typename T>
void
diagonalize(Simulation_context& ctx__, std::array<double, 3> vk__, Potential& pot__, double res_tol__,
double eval_tol__, bool only_kin__)
{
K_point<T> kp(ctx__, &vk__[0], 1.0, 0);
kp.initialize();
std::cout << "num_gkvec=" << kp.num_gkvec() << "\n";
for (int i = 0; i < ctx__.num_bands(); i++) {
kp.band_occupancy(i, 0, 2);
}
Hamiltonian0<T> H0(pot__);
auto Hk = H0(kp);
Band(ctx__).initialize_subspace<std::complex<T>>(Hk, ctx__.unit_cell().num_ps_atomic_wf());
for (int i = 0; i < ctx__.num_bands(); i++) {
kp.band_energy(i, 0, 0);
}
init_wf(&kp, kp.spinor_wave_functions(), ctx__.num_bands(), 0);
///*
// * debug kinetic energy Hamiltonian (single MPI rank only)
// */
//const int bs = ctx__.cyclic_block_size();
const int num_bands = ctx__.num_bands();
//auto& gv = kp.gkvec();
//auto& phi = kp.spinor_wave_functions();
//sddk::dmatrix<std::complex<T>> hmlt(num_bands, num_bands, ctx__.blacs_grid(), bs, bs);
//hmlt.zero();
//for (int i = 0; i < num_bands; i++) {
// for (int j = 0; j < num_bands; j++) {
// for (int ig = 0; ig < gv.num_gvec(); ig++) {
// auto gvc = gv.template gkvec_cart<index_domain_t::global>(ig);
// T ekin = 0.5 * dot(gvc, gvc);
// hmlt(i, j) += std::conj(phi.pw_coeffs(0).prime(ig, i)) * ekin * phi.pw_coeffs(0).prime(ig, j);
// }
// }
//}
//auto max_diff = check_hermitian(hmlt, num_bands);
//std::cout << "Simple kinetic Hamiltonian: error in hermiticity: " << std::setw(24) << std::scientific << max_diff << std::endl;
//hmlt.serialize("hmlt", num_bands);
auto result = davidson<std::complex<T>>(Hk, num_bands, ctx__.num_mag_dims(), kp.spinor_wave_functions(),
[](int i, int ispn){return 1.0;}, [&](int i, int ispn){return eval_tol__;}, res_tol__, 60);
if (Communicator::world().rank() == 0 && only_kin__) {
std::vector<double> ekin(kp.num_gkvec());
for (int i = 0; i < kp.num_gkvec(); i++) {
ekin[i] = 0.5 * kp.gkvec().template gkvec_cart<index_domain_t::global>(i).length2();
}
std::sort(ekin.begin(), ekin.end());
double max_diff{0};
for (int i = 0; i < ctx__.num_bands(); i++) {
max_diff = std::max(max_diff, std::abs(ekin[i] - result.eval(i, 0)));
printf("%20.16f %20.16f %20.16e\n", ekin[i], result.eval(i, 0), std::abs(ekin[i] - result.eval(i, 0)));
}
printf("maximum eigen-value difference: %20.16e\n", max_diff);
}
}
void test_davidson(cmd_args const& args__)
{
auto pw_cutoff = args__.value<double>("pw_cutoff", 30);
auto gk_cutoff = args__.value<double>("gk_cutoff", 10);
auto N = args__.value<int>("N", 1);
auto mpi_grid = args__.value("mpi_grid", std::vector<int>({1, 1}));
auto solver = args__.value<std::string>("solver", "lapack");
auto fp32 = args__.exist("fp32");
auto res_tol = args__.value<double>("res_tol", fp32 ? 1e-3 : 1e-6);
auto eval_tol = args__.value<double>("eval_tol", fp32 ? 1e-6 : 1e-12);
auto only_kin = args__.exist("only_kin");
bool add_dion{!only_kin};
bool add_vloc{!only_kin};
PROFILE_START("test_davidson|setup")
/* create simulation context */
Simulation_context ctx(
"{"
" \"parameters\" : {"
" \"electronic_structure_method\" : \"pseudopotential\""
" },"
" \"control\" : {"
" \"verification\" : 0"
" }"
"}");
/* add a new atom type to the unit cell */
auto& atype = ctx.unit_cell().add_atom_type("Cu");
/* set pseudo charge */
atype.zn(11);
/* set radial grid */
atype.set_radial_grid(radial_grid_t::lin_exp, 1000, 0.0, 100.0, 6);
/* cutoff at ~1 a.u. */
int icut = atype.radial_grid().index_of(1.0);
double rcut = atype.radial_grid(icut);
/* create beta radial function */
std::vector<double> beta(icut + 1);
std::vector<double> beta1(icut + 1);
for (int l = 0; l <= 2; l++) {
for (int i = 0; i <= icut; i++) {
double x = atype.radial_grid(i);
beta[i] = utils::confined_polynomial(x, rcut, l, l + 1, 0);
beta1[i] = utils::confined_polynomial(x, rcut, l, l + 2, 0);
}
/* add radial function for l */
atype.add_beta_radial_function(l, beta);
atype.add_beta_radial_function(l, beta1);
}
std::vector<double> ps_wf(atype.radial_grid().num_points());
for (int l = 0; l <= 2; l++) {
for (int i = 0; i < atype.radial_grid().num_points(); i++) {
double x = atype.radial_grid(i);
ps_wf[i] = std::exp(-x) * std::pow(x, l);
}
/* add radial function for l */
atype.add_ps_atomic_wf(3, sirius::experimental::angular_momentum(l), ps_wf);
}
/* set local part of potential */
std::vector<double> vloc(atype.radial_grid().num_points(), 0);
if (add_vloc) {
for (int i = 0; i < atype.radial_grid().num_points(); i++) {
double x = atype.radial_grid(i);
vloc[i] = -atype.zn() / (std::exp(-x * (x + 1)) + x);
}
}
atype.local_potential(vloc);
/* set Dion matrix */
int nbf = atype.num_beta_radial_functions();
matrix<double> dion(nbf, nbf);
dion.zero();
if (add_dion) {
for (int i = 0; i < nbf; i++) {
dion(i, i) = -10.0;
}
}
atype.d_mtrx_ion(dion);
/* set atomic density */
std::vector<double> arho(atype.radial_grid().num_points());
for (int i = 0; i < atype.radial_grid().num_points(); i++) {
double x = atype.radial_grid(i);
arho[i] = 2 * atype.zn() * std::exp(-x * x) * x;
}
atype.ps_total_charge_density(arho);
/* lattice constant */
double a{5};
/* set lattice vectors */
ctx.unit_cell().set_lattice_vectors({{a * N, 0, 0},
{0, a * N, 0},
{0, 0, a * N}});
/* add atoms */
double p = 1.0 / N;
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
for (int k = 0; k < N; k++) {
ctx.unit_cell().add_atom("Cu", {i * p, j * p, k * p});
}
}
}
/* initialize the context */
ctx.verbosity(4);
ctx.pw_cutoff(pw_cutoff);
ctx.gk_cutoff(gk_cutoff);
ctx.processing_unit(args__.value<std::string>("device", "CPU"));
ctx.mpi_grid_dims(mpi_grid);
ctx.gen_evp_solver_name(solver);
ctx.std_evp_solver_name(solver);
PROFILE_STOP("test_davidson|setup")
//ctx.cfg().iterative_solver().type("exact");
ctx.cfg().iterative_solver().num_steps(40);
ctx.cfg().iterative_solver().locking(false);
/* initialize simulation context */
ctx.initialize();
ctx.iterative_solver_tolerance(1e-12);
std::cout << "number of atomic orbitals: " << ctx.unit_cell().num_ps_atomic_wf() << "\n";
Density rho(ctx);
rho.initial_density();
rho.zero();
Potential pot(ctx);
pot.generate(rho, ctx.use_symmetry(), true);
pot.zero();
/* repeat several times for the accurate performance measurment */
for (int r = 0; r < 1; r++) {
std::array<double, 3> vk({0.1, 0.1, 0.1});
if (fp32) {
#ifdef USE_FP32
diagonalize<float>(ctx, vk, pot, res_tol, eval_tol, only_kin);
#else
RTE_THROW("not compiled with FP32 support");
#endif
} else {
diagonalize<double>(ctx, vk, pot, res_tol, eval_tol, only_kin);
}
}
}
int main(int argn, char** argv)
{
cmd_args args(argn, argv, {{"device=", "(string) CPU or GPU"},
{"pw_cutoff=", "(double) plane-wave cutoff for density and potential"},
{"gk_cutoff=", "(double) plane-wave cutoff for wave-functions"},
{"N=", "(int) cell multiplicity"},
{"mpi_grid=", "(int[2]) dimensions of the MPI grid for band diagonalization"},
{"solver=", "(string) eigen-value solver"},
{"res_tol=", "(double) residual L2-norm tolerance"},
{"eval_tol=", "(double) eigan-value tolerance"},
{"fp32", "use FP32 arithmetics"},
{"only_kin", "use kinetic-operator only"}
});
if (args.exist("help")) {
printf("Usage: %s [options]\n", argv[0]);
args.print_help();
return 0;
}
sirius::initialize(1);
test_davidson(args);
int rank = Communicator::world().rank();
sirius::finalize();
if (rank == 0) {
const auto timing_result = ::utils::global_rtgraph_timer.process();
std::cout<< timing_result.print();
}
}
| 35.857143 | 133 | 0.536488 | [
"vector"
] |
45165a075bf96b4a8bcde1e6f86d3dd425192bc4 | 990 | hpp | C++ | libelement/src/object_model/constraints/constraint.hpp | ultraleap/Element | 6fe9ab800a9152482e719a7dc17d296bad464eb6 | [
"Apache-2.0"
] | 12 | 2019-12-17T18:27:04.000Z | 2021-06-04T08:46:05.000Z | libelement/src/object_model/constraints/constraint.hpp | ultraleap/Element | 6fe9ab800a9152482e719a7dc17d296bad464eb6 | [
"Apache-2.0"
] | 12 | 2020-10-27T14:30:37.000Z | 2022-01-05T16:50:53.000Z | libelement/src/object_model/constraints/constraint.hpp | ultraleap/Element | 6fe9ab800a9152482e719a7dc17d296bad464eb6 | [
"Apache-2.0"
] | 6 | 2020-01-10T23:45:48.000Z | 2021-07-01T22:58:01.000Z | #pragma once
//SELF
#include "typeutil.hpp"
#include "object_model/object_internal.hpp"
namespace element
{
class constraint : public object, public rtti_type<constraint>
{
public:
static const constraint_const_unique_ptr any;
//todo: what is a function constraint and what uses it? not something a user has access to, so something internal?
static const constraint_const_unique_ptr function;
constraint(element_type_id id, const declaration* declarer)
: rtti_type(id)
, declarer(declarer)
{}
[[nodiscard]] bool matches_constraint(const compilation_context& context, const constraint* constraint) const override;
[[nodiscard]] const constraint* get_constraint() const override { return this; }
[[nodiscard]] std::string typeof_info() const override;
[[nodiscard]] std::string to_code(const int depth) const override;
[[nodiscard]] std::string get_name() const override;
const declaration* declarer;
};
} // namespace element | 33 | 123 | 0.737374 | [
"object"
] |
931c10d209296300e91ca2c9fb8415c06fd1abdf | 2,538 | cpp | C++ | Fusion/src/Fusion/Audio/wave_reader.cpp | WhoseTheNerd/Fusion | 35ab536388392b3ba2e14f288eecbc292abd7dea | [
"Apache-2.0"
] | 4 | 2018-11-12T18:43:02.000Z | 2020-02-02T10:18:56.000Z | Fusion/src/Fusion/Audio/wave_reader.cpp | WhoseTheNerd/Fusion | 35ab536388392b3ba2e14f288eecbc292abd7dea | [
"Apache-2.0"
] | 2 | 2018-12-22T13:18:05.000Z | 2019-07-24T20:15:45.000Z | Fusion/src/Fusion/Audio/wave_reader.cpp | WhoseTheNerd/Fusion | 35ab536388392b3ba2e14f288eecbc292abd7dea | [
"Apache-2.0"
] | null | null | null | #include "fpch.h"
#include "wave_reader.hpp"
#include <cstdlib>
#include <cstring>
#include <iostream>
#include "Buffer.hpp"
namespace Fusion {
WaveReader::WaveReader(const char* filepath)
{
ReadWaveFile(filepath);
const double total_duration = m_Header.data_size / m_Header.fmt.byte_rate;
const uint32_t minutes = static_cast<uint32_t>(total_duration / 60);
m_Duration.Hours = static_cast<uint8_t>(minutes / 60);
m_Duration.Seconds = static_cast<uint8_t>(total_duration - (minutes * 60));
m_Duration.Minutes = static_cast<uint8_t>(minutes % 60);
m_Format = Audio::ToFormat(static_cast<uint8_t>(m_Header.fmt.num_channels), static_cast<uint8_t>(m_Header.fmt.bits_per_sample)).value_or(Audio::Format::Stereo16);
}
WaveReader::~WaveReader()
{
fclose(m_File);
}
void WaveReader::ReadWaveFile(const char* filepath)
{
m_File = fopen(filepath, "rb");
if (!m_File) {
fprintf(stderr, "Couldn't open '%s' file!\n", filepath);
return;
}
while (!feof(m_File)) {
RIFF::chunk chunk;
fread(&chunk, sizeof(RIFF::chunk), 1, m_File);
if (strncmp(chunk.ID, "RIFF", 4) == 0) {
RIFF::riff_chunk riff;
riff.chunk = chunk;
fread(&riff.format, sizeof(char), 4, m_File);
m_Header.riff = riff;
}
else if (strncmp(chunk.ID, "fmt ", 4) == 0) {
RIFF::fmt_chunk fmt;
fmt.chunk = chunk;
fread(&fmt.format_type, sizeof(char), fmt.chunk.length, m_File);
m_Header.fmt = fmt;
}
else if (strncmp(chunk.ID, "data", 4) == 0) {
m_Header.data_size = chunk.length;
m_FileSize = chunk.length;
break;
}
else {
// Read variable length chunk to avoid problems with finding data chunk
char* buf = new char[chunk.length];
fread(buf, sizeof(char), chunk.length, m_File);
delete[] buf;
}
}
}
std::optional<std::vector<uint8_t>> WaveReader::Read(const uint32_t length)
{
std::vector<uint8_t> data(length);
size_t read = fread(&data[0], sizeof(uint8_t), length, m_File);
m_FileIndex += length;
if (read != length) {
fprintf(stderr, "Requested to read %d but read %zd\n", length, read);
return {};
}
return std::move(data);
}
std::unique_ptr<Audio::Buffer> LoadWaveToBuffer(const char* filepath)
{
WaveReader reader(filepath);
const std::vector<uint8_t> data = reader.Read(reader.GetHeader().data_size).value_or(std::vector<uint8_t>{});
std::unique_ptr<Audio::Buffer> buffer = std::make_unique<Audio::Buffer>();
buffer->SetData(reader.GetAudioFormat(), reader.GetSampleRate(), data);
return buffer;
}
}
| 25.636364 | 164 | 0.676123 | [
"vector"
] |
931db19e53109a3d4b4686bceaee185643d06f89 | 2,281 | cc | C++ | 13_ThreadsExceptions/OpenMP/OpenMP.cc | j3l4ck0ut/UdemyCpp | ed3b75cedbf9cad211a205195605cfd3c9280efc | [
"MIT"
] | null | null | null | 13_ThreadsExceptions/OpenMP/OpenMP.cc | j3l4ck0ut/UdemyCpp | ed3b75cedbf9cad211a205195605cfd3c9280efc | [
"MIT"
] | null | null | null | 13_ThreadsExceptions/OpenMP/OpenMP.cc | j3l4ck0ut/UdemyCpp | ed3b75cedbf9cad211a205195605cfd3c9280efc | [
"MIT"
] | null | null | null | #include <algorithm>
#include <chrono>
#include <iostream>
#include <random>
#include <vector>
#include <thread>
#include "omp.h"
long long serial_sum(std::vector<int> &vec)
{
long long sum = 0;
for (int i = 0; i != vec.size(); ++i)
{
sum = sum + vec[i];
}
return sum;
}
template <typename T>
long long adder(std::vector<T> vec, std::size_t begin, std::size_t end)
{
long long sum = 0;
for (std::size_t i = begin; i != end; ++i)
{
sum += vec[i];
}
return sum;
}
/*
Serial time in ms: 4.0918
2: OpenMP time in ms: 2.93575
4: OpenMP time in ms: 2.48717
6: OpenMP time in ms: 2.3313
8: OpenMP time in ms: 2.25205
*/
long long parallel_sum_omp(std::vector<int> &vec)
{
long long final_sum = 0;
long long sum = 0;
std::size_t i = 0;
std::size_t n = vec.size();
const unsigned int NUM_THREADS = 2;
#pragma omp parallel for reduction(+ : sum) num_threads(NUM_THREADS)
for (i = 0; i < n; ++i)
{
sum = sum + vec[i];
}
#pragma omp critical
{
final_sum += sum;
}
return final_sum;
}
int main()
{
// SETUP
const unsigned int NUM_RUNS = 100;
long long sum_vector = 0L;
std::random_device gen;
std::uniform_int_distribution<int> dist(-10, 10);
std::vector<int> vector_a(10'000'000, 0);
std::generate(vector_a.begin(), vector_a.end(), [&]() { return dist(gen); });
// SERIELL
auto start = std::chrono::high_resolution_clock::now();
for (unsigned int i = 0; i < NUM_RUNS; ++i)
{
sum_vector = serial_sum(vector_a);
}
auto end = std::chrono::high_resolution_clock::now();
std::chrono::duration<double, std::milli> ms = end - start;
std::cout << std::endl << "Serial time in ms: " << ms.count() / NUM_RUNS;
std::cout << std::endl << "Serial Sum: " << sum_vector << std::endl;
// OPENMP
start = std::chrono::high_resolution_clock::now();
for (unsigned int i = 0; i < NUM_RUNS; ++i)
{
sum_vector = parallel_sum_omp(vector_a);
}
end = std::chrono::high_resolution_clock::now();
ms = end - start;
std::cout << std::endl << "OpenMP time in ms: " << ms.count() / NUM_RUNS;
std::cout << std::endl << "OpenMP Sum: " << sum_vector << std::endl;
return 0;
} | 23.760417 | 81 | 0.586585 | [
"vector"
] |
931de618e625f88506d83141805fc0bd47edc160 | 556 | cpp | C++ | Sorting/main.cpp | LegendaryyDoc/Constructors-and-Decuns | d3469ad46ff88a7d33dee1f50a5f49ee4b99f208 | [
"MIT"
] | null | null | null | Sorting/main.cpp | LegendaryyDoc/Constructors-and-Decuns | d3469ad46ff88a7d33dee1f50a5f49ee4b99f208 | [
"MIT"
] | null | null | null | Sorting/main.cpp | LegendaryyDoc/Constructors-and-Decuns | d3469ad46ff88a7d33dee1f50a5f49ee4b99f208 | [
"MIT"
] | null | null | null | #include <iostream>
#include "HighScoreTable.h"
#include <vector>
int main() {
//Instantiate and initialize the whole highscore table
HighScoreTable hst("highScores.txt");
int scoreSize = 10;
//retrieve the top 10 scores
std::vector<HighScoreEntry> topScores = hst.topNNScores(scoreSize);
//todo: cycle through the scores and output them
//prune the bottom 3 scores from the table
hst.pruneBottomNNScores(3);
std::cout << "\n\n\n\n";
topScores = hst.topNNScores(10);
//hst.hsTableSave("highScores.txt");
system("pause");
return 0;
} | 19.172414 | 68 | 0.717626 | [
"vector"
] |
93225cdb300a27c2cc6b1eba889ccaec26f1f30e | 6,818 | cpp | C++ | tests/doctests/example_token_action_tests.cpp | JackDiSalvatore/eosio.contracts-token-exchange | 5b78a49629d0fd2bf94d4f5cebffcd596b70c174 | [
"MIT"
] | 1 | 2022-01-07T09:51:17.000Z | 2022-01-07T09:51:17.000Z | tests/doctests/example_token_action_tests.cpp | JackDiSalvatore/eosio.contracts-token-exchange | 5b78a49629d0fd2bf94d4f5cebffcd596b70c174 | [
"MIT"
] | null | null | null | tests/doctests/example_token_action_tests.cpp | JackDiSalvatore/eosio.contracts-token-exchange | 5b78a49629d0fd2bf94d4f5cebffcd596b70c174 | [
"MIT"
] | null | null | null | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include "doctest.h"
#include <eosio/testing/tester.hpp>
#include <eosio/chain/abi_serializer.hpp>
#include <eosio/chain/resource_limits.hpp>
#include "../contracts.hpp"
using namespace eosio::chain;
using namespace eosio::testing;
using namespace fc;
using mvo = fc::mutable_variant_object;
#ifndef TESTER
#ifdef NON_VALIDATING_TEST
#define TESTER tester
#else
#define TESTER validating_tester
#endif
#endif
#define CONTRACT_ACCOUNT N(exampletoken)
namespace eosio_system {
class ex_token_tester : public TESTER {
public:
static name token_account;
ex_token_tester() {
deploy_contract();
}
abi_serializer deploy_code(name account, const std::vector<uint8_t>& wasm, const std::vector<char>& abiname) {
set_code(account, wasm);
set_abi(account, abiname.data());
produce_blocks();
const auto& accnt = control->db().get<account_object, by_name>(account);
abi_serializer abi_ser;
abi_def abi;
REQUIRE(abi_serializer::to_abi(accnt.abi, abi));
abi_ser.set_abi(abi, abi_serializer_max_time);
return abi_ser;
}
void deploy_contract() {
create_account(token_account);
produce_blocks(2);
deploy_code(token_account, contracts::token_wasm(), contracts::token_abi());
add_code_permission(token_account);
}
action_result push_action_ex(account_name actor, const name& code, const action_name& acttype, const variant_object& data) {
return base_tester::push_action(get_action(code, acttype, {permission_level{actor, config::active_name}}, data), uint64_t(actor));
}
action_result push_action_ex(const std::vector<permission_level>& perms,
const name& code,
const action_name& acttype,
const variant_object& data,
const std::vector<permission_level>& signers) {
signed_transaction trx;
trx.actions.emplace_back(get_action(code, acttype, perms, data));
set_transaction_headers(trx);
for (const auto& auth : signers) {
trx.sign(get_private_key(auth.actor, auth.permission.to_string()), control->get_chain_id());
}
try {
// print_action_console(push_transaction(trx));
push_transaction(trx);
} catch (const fc::exception& ex) {
edump((ex.to_detail_string()));
return error(ex.top_message()); // top_message() is assumed by many tests; otherwise they fail
// return error(ex.to_detail_string());
}
produce_block();
REQUIRE(true == chain_has_transaction(trx.id()));
return success();
}
void add_code_permission(name account) {
const auto priv_key = this->get_private_key(account.to_string(), "active");
const auto pub_key = priv_key.get_public_key();
this->set_authority(account, N(active), authority(1, {key_weight{pub_key, 1}}, {{permission_level{account, N(eosio.code)}, 1}}),
"owner");
}
transaction make_transaction(const fc::variants& actions) {
variant pretty_trx = fc::mutable_variant_object()("expiration", "2020-01-01T00:30")("ref_block_num", 2)("ref_block_prefix", 3)(
"max_net_usage_words", 0)("max_cpu_usage_ms", 0)("delay_sec", 0)("actions", actions);
transaction trx;
abi_serializer::from_variant(pretty_trx, trx, get_resolver(), abi_serializer_max_time);
return trx;
}
transaction make_transaction(vector<action>&& actions) {
transaction trx;
trx.actions = std::move(actions);
set_transaction_headers(trx);
return trx;
}
transaction
make_transaction_with_data(account_name code, name action, const vector<permission_level>& perms, const fc::variant& data) {
return make_transaction({fc::mutable_variant_object()("account", code)("name", action)("authorization", perms)("data", data)});
}
/*
* ACTIONS
*/
action_result create(name issuer,
asset maximum_supply) {
return push_action_ex(issuer, CONTRACT_ACCOUNT, N(create),
mutable_variant_object()("issuer", issuer)("maximum_supply", maximum_supply));
}
action_result issue(name to, const asset& quantity, std::string memo) {
return push_action_ex(CONTRACT_ACCOUNT, CONTRACT_ACCOUNT, N(issue),
mutable_variant_object()("to", to)("quantity", quantity)("memo", memo));
}
action_result transfer(name from, name to, const asset& quantity, std::string memo) {
return push_action_ex(from, CONTRACT_ACCOUNT, N(transfer),
mutable_variant_object()("from", from)("to", to)("quantity", quantity)("memo", memo));
}
/*
* TABLES
*/
abi_serializer get_serializer() {
const auto& acnt = control->get_account(CONTRACT_ACCOUNT);
auto abi = acnt.get_abi();
return abi_serializer(abi, abi_serializer_max_time);
}
asset get_account_balance(account_name acc, symbol sym) {
auto symbol_code = sym.to_symbol_code().value;
vector<char> data = get_row_by_account(CONTRACT_ACCOUNT, acc, N(accounts), symbol_code);
return data.empty() ? asset(0, sym)
: get_serializer().binary_to_variant("account", data, abi_serializer_max_time)["balance"].as<asset>();
}
asset get_supply(symbol sym) {
auto symbol_code = sym.to_symbol_code().value;
vector<char> data = get_row_by_account(CONTRACT_ACCOUNT, symbol_code, N(stat), symbol_code);
return data.empty() ? asset(0, sym)
: get_serializer().binary_to_variant("currency_stats", data, abi_serializer_max_time)["supply"].as<asset>();
}
};
name ex_token_tester::token_account = CONTRACT_ACCOUNT;
} // namespace eosio_system
TEST_CASE_FIXTURE(eosio_system::ex_token_tester, "make some cash") try {
create_account(N(alice));
create_account(N(bob));
create(token_account, asset(1000000000, symbol(4,"TEST")));
issue(token_account, asset(100000, symbol(4,"TEST")), "issuance");
CHECK(get_supply(symbol(4,"TEST")) == asset(100000, symbol(4,"TEST")));
transfer(token_account, N(alice), asset(50000, symbol(4,"TEST")), "memo");
CHECK(get_account_balance(N(alice),symbol(4,"TEST")) == asset(50000, symbol(4,"TEST")));
} FC_LOG_AND_RETHROW()
| 38.96 | 139 | 0.625257 | [
"vector"
] |
9325e6338ec3dcb2124fec4235b2892c0d7c60b8 | 711 | cpp | C++ | leetcode/1382. Balance a Binary Search Tree/s1.cpp | zhuohuwu0603/leetcode_cpp_lzl124631x | 6a579328810ef4651de00fde0505934d3028d9c7 | [
"Fair"
] | 787 | 2017-05-12T05:19:57.000Z | 2022-03-30T12:19:52.000Z | leetcode/1382. Balance a Binary Search Tree/s1.cpp | aerlokesh494/LeetCode | 0f2cbb28d5a9825b51a8d3b3a0ae0c30d7ff155f | [
"Fair"
] | 8 | 2020-03-16T05:55:38.000Z | 2022-03-09T17:19:17.000Z | leetcode/1382. Balance a Binary Search Tree/s1.cpp | aerlokesh494/LeetCode | 0f2cbb28d5a9825b51a8d3b3a0ae0c30d7ff155f | [
"Fair"
] | 247 | 2017-04-30T15:07:50.000Z | 2022-03-30T09:58:57.000Z | // OJ: https://leetcode.com/problems/balance-a-binary-search-tree/
// Author: github.com/lzl124631x
// Time: O(H)
// Space: O(N)
class Solution {
vector<int> v;
void inorder(TreeNode *root) {
if (!root) return;
inorder(root->left);
v.push_back(root->val);
inorder(root->right);
}
TreeNode *build(int start, int end) {
if (start >= end) return NULL;
int mid = (start + end) / 2;
auto node = new TreeNode(v[mid]);
node->left = build(start, mid);
node->right = build(mid + 1, end);
return node;
}
public:
TreeNode* balanceBST(TreeNode* root) {
inorder(root);
return build(0, v.size());
}
}; | 27.346154 | 66 | 0.555556 | [
"vector"
] |
9325f52e1b61de7454fe6bc7d9756ebb3bb4012a | 4,340 | cpp | C++ | src/python/pml/matrix_parameter.cpp | s3a-spatialaudio/VISR | 55f6289bc5058d4898106f3520e1a60644ffb3ab | [
"ISC"
] | 17 | 2019-03-12T14:52:22.000Z | 2021-11-09T01:16:23.000Z | src/python/pml/matrix_parameter.cpp | s3a-spatialaudio/VISR | 55f6289bc5058d4898106f3520e1a60644ffb3ab | [
"ISC"
] | null | null | null | src/python/pml/matrix_parameter.cpp | s3a-spatialaudio/VISR | 55f6289bc5058d4898106f3520e1a60644ffb3ab | [
"ISC"
] | 2 | 2019-08-11T12:53:07.000Z | 2021-06-22T10:08:08.000Z | /* Copyright Institute of Sound and Vibration Research - All rights reserved */
#include <libpml/matrix_parameter.hpp>
#include <libpml/matrix_parameter_config.hpp>
#include <libefl/basic_matrix.hpp>
#include <libvisr/constants.hpp>
#include <libvisr/parameter_base.hpp>
#include <pybind11/pybind11.h>
#include <pybind11/numpy.h>
#include <complex>
namespace visr
{
using pml::MatrixParameter;
using pml::MatrixParameterConfig;
namespace python
{
namespace pml
{
template<typename DataType>
void exportMatrixParameter( pybind11::module & m, char const * className )
{
pybind11::class_<MatrixParameter<DataType >, efl::BasicMatrix<DataType>, ParameterBase >(m, className, pybind11::buffer_protocol() )
.def_buffer([](MatrixParameter<DataType> &mp) -> pybind11::buffer_info
{
return pybind11::buffer_info( mp.data(),
sizeof( DataType ),
pybind11::format_descriptor<DataType>::format(),
2,
{ mp.numberOfRows(), mp.numberOfColumns() },
{ sizeof( DataType ) * mp.stride(), sizeof( DataType ) } );
}
)
.def( pybind11::init<std::size_t>(), pybind11::arg("alignment") = visr::cVectorAlignmentSamples )
.def( pybind11::init<std::size_t, std::size_t, std::size_t>(), pybind11::arg( "numberOfRows" ), pybind11::arg( "numberOfColumns" ), pybind11::arg( "alignment" ) = visr::cVectorAlignmentSamples )
// Note: See pybind11 documentation for the way the implicit 'self' argument is stripped by using a lambda function.
.def_property_readonly_static( "staticType", [](pybind11::object /*self*/) {return MatrixParameter<DataType>::staticType(); } )
.def( pybind11::init( []( pybind11::array const & data, std::size_t alignment)
{
if( data.ndim() != 2 )
{
throw std::invalid_argument( "MatrixParameter from numpy ndarray: Input array must be 2D" );
}
if( not data.dtype().is( pybind11::dtype::of<DataType>() ) )
{
throw std::invalid_argument( "MatrixParameter from numpy ndarray: Input matrix has a different data type (dtype)." );
}
std::size_t const numRows = static_cast<pybind11::ssize_t>(data.shape()[0]);
std::size_t const numCols = static_cast<pybind11::ssize_t>(data.shape()[1]);
MatrixParameter<DataType> * inst = new MatrixParameter<DataType>( numRows, numCols, alignment);
for( std::size_t rowIdx(0); rowIdx < numRows; ++rowIdx )
{
for( std::size_t colIdx(0); colIdx < numCols; ++colIdx )
{
inst->at( rowIdx, colIdx ) = *static_cast<DataType const *>(data.data( rowIdx, colIdx ));
}
}
return inst;
}), pybind11::arg("data"), pybind11::arg("alignment") = visr::cVectorAlignmentSamples )
.def_static( "fromAudioFile", &MatrixParameter<DataType>::fromAudioFile, pybind11::arg("file"), pybind11::arg("alignment") = visr::cVectorAlignmentSamples )
.def_static( "fromTextFile", &MatrixParameter<DataType>::fromTextFile, pybind11::arg( "file" ), pybind11::arg( "alignment" ) = visr::cVectorAlignmentSamples )
;
}
void exportMatrixParameters( pybind11::module & m)
{
pybind11::class_<MatrixParameterConfig, ParameterConfigBase >( m, "MatrixParameterConfig" )
.def( pybind11::init<std::size_t, std::size_t>(), pybind11::arg("numberOfRows" ), pybind11::arg("numberOfColumns") )
.def_property_readonly( "numberOfRows", &MatrixParameterConfig::numberOfRows )
.def_property_readonly( "numberOfColumns", &MatrixParameterConfig::numberOfColumns )
.def( "compare", static_cast<bool(MatrixParameterConfig::*)(MatrixParameterConfig const&) const>(&MatrixParameterConfig::compare), pybind11::arg("rhs") )
.def( "compare", static_cast<bool(MatrixParameterConfig::*)(ParameterConfigBase const&) const>(&MatrixParameterConfig::compare), pybind11::arg("rhs") )
;
exportMatrixParameter<float>( m, "MatrixParameterFloat" );
exportMatrixParameter<double>( m, "MatrixParameterDouble" );
exportMatrixParameter<std::complex<float>>( m, "MatrixParameterComplexFloat" );
exportMatrixParameter<std::complex<double>>( m, "MatrixParameterComplexDouble" );
}
} // namepace pml
} // namespace python
} // namespace visr
| 47.692308 | 196 | 0.669585 | [
"object",
"shape"
] |
932c951fdae19d4fabb636dfe23f1ff9759fa897 | 24,286 | cpp | C++ | FM/Schweighofer.cpp | dnsampaio/PFME | 7136612ffa643bfff795adce774f28cc3a5184be | [
"MIT"
] | null | null | null | FM/Schweighofer.cpp | dnsampaio/PFME | 7136612ffa643bfff795adce774f28cc3a5184be | [
"MIT"
] | null | null | null | FM/Schweighofer.cpp | dnsampaio/PFME | 7136612ffa643bfff795adce774f28cc3a5184be | [
"MIT"
] | null | null | null | #include "Schweighofer.hpp"
#include "debug.hpp"
#include <cmath>
#include <iostream>
using namespace std;
using namespace GiNaC;
template <typename T> using gexmap = map<ex, T, ex_is_less>;
SchweighoferTester::SchweighoferTester(exset ineqs, unsigned d)
: numSrcs(ineqs.size()), problem(nullptr), monomPos({}), ineqPos({}),
order(0), MAX_ORDER(std::max(1u, d)) {
// We do a very basic test to avoid doing work for the obvious systems
if (numSrcs == 0) {
DEBUG(5, "Empty system == true\n");
return;
}
for (exset::iterator i = ineqs.begin(), iEnd = ineqs.end(); i != iEnd;) {
const ex &e = *i;
if (is_a<numeric>(e)) {
if (e < 0) {
DEBUG(5, e << u8" ≥ 0 ⇒ false\n");
clear();
return;
}
DEBUG(5, e << u8" ≥ 0 ⇒ true; ignoring\n");
auto ni = std::next(i);
ineqs.erase(i);
iEnd = ineqs.end();
i = ni;
numSrcs--;
}
i++;
DEBUG(5, e << " == added new constraint\n");
}
idx_map indexes;
expandSrcs(ineqs, indexes);
DEBUG(4, indexes.size() << " number of distinct inequalities\n");
ineqs.clear();
buildProblem(indexes);
indexes.clear();
glp_term_out(GLP_OFF);
DEBUGIF(8, "Enabling glpk output\n") { glp_term_out(GLP_ON); }
}
SchweighoferTester::SchweighoferTester(const sysType &ineqs, unsigned d)
: numSrcs(ineqs.size()), problem(nullptr), monomPos({}), ineqPos({}),
order(0), MAX_ORDER(std::max(1u, d)) {
exset ns;
for (const auto i : ineqs)
ns.insert(i.first);
for (exset::iterator i = ns.begin(), iEnd = ns.end(); i != iEnd;) {
const ex &e = *i;
if (is_a<numeric>(e)) {
if (e < 0) {
DEBUG(5, e << u8" ≥ 0 ⇒ false\n");
clear();
return;
}
DEBUG(5, e << u8" ≥ 0 ⇒ true; ignoring\n");
auto ni = std::next(i);
ns.erase(i);
iEnd = ns.end();
i = ni;
numSrcs--;
}
i++;
DEBUG(5, e << " == added new constraint\n");
}
idx_map indexes;
expandSrcs(ns, indexes);
DEBUG(4, indexes.size() << " number of distinct inequalities\n");
ns.clear();
buildProblem(indexes);
indexes.clear();
glp_term_out(GLP_OFF);
DEBUGIF(7, "Enabling glpk output\n") { glp_term_out(GLP_ON); }
}
SchweighoferTester::~SchweighoferTester() { clear(); }
bool SchweighoferTester::goodNumbers(const ex &compareTo) const {
if (glp_get_col_prim(problem, 1) < -0.990 - MAX_ERROR) {
DEBUG(4, "FIXME!!! GLP getting col_prim[1] < -0.990");
return false;
}
for (int s = 2, e = glp_get_num_cols(problem); s <= e; s++) {
if (glp_get_col_prim(problem, s) < -MAX_ERROR) {
DEBUG(4, "FIXME!!! GLP getting col_prim["
<< s << "] == " << glp_get_col_prim(problem, s) << NL);
return false;
}
}
ex res = 0;
for (const auto &col : ineqPos) {
double c = glp_get_col_prim(problem, col.second);
if ((c < -MAX_ERROR) or (c > MAX_ERROR)) {
DEBUG(6, res << " += " << col.first << "* (" << c << ")\n");
}
res += col.first * c;
}
res = expand(res);
DEBUG(5, res << NL);
ex final = expand(compareTo - res);
if (is_a<numeric>(final)) {
if ((final < MAX_ERROR) && (final > -MAX_ERROR))
return true;
} else if (is_a<add>(final)) {
bool ok = true;
for (const ex &op : final) {
numeric coeff = op.integer_content();
if (!((coeff < MAX_ERROR) && (coeff > -MAX_ERROR))) {
ok = false;
break;
}
}
if (ok)
return true;
} else {
numeric c = final.integer_content();
if ((c < MAX_ERROR) && (c > -MAX_ERROR))
return true;
}
// cerr << __FILENAME__ << "::" << __func__ << "::" << __LINE__ << "::FIX
// ME!!!\n\tTesting if " << compareTo << GE << "0, we got that " << res << GE
// << "0; difference is: " << final
// << " that has error bigger than " << MAX_ERROR << NL;
/* TODO: If here, it means glpk did solve the problem but there is possibly:
* 1) Error in formulation of the problem or
* 2) glpk is in a error state
* 3) Did call this function with bad arguments
*/
return false;
}
bool SchweighoferTester::isProved(int o, bool isExact,
const ex &compareTo) const {
if (o != 0) {
switch (o) {
case GLP_EBADB:
DEBUG(8, "GLP_EBADB: Unable to start the search, because the "
"initial\nbasis specified in the problem object is invalid—the "
"number of\nbasic (auxiliary and structural) variables is not "
"the same as\nthe number of rows in the problem object.\n");
break;
case GLP_ESING:
DEBUG(8,
"GLP_ESING: Unable to start the search, because the basis\nmatrix "
"corresponding to the initial basis is exactly singular.\n");
break;
case GLP_EBOUND:
DEBUG(8, "GLP_EBOUND: Unable to start the search, because some "
"double-bounded\n(auxiliary or structural) variables have "
"incorrect bounds.\n");
break;
case GLP_EFAIL: {
DEBUG(8, "GLP_EFAIL The problem instance has no rows/columns.\n");
if (!isExact)
return true; // Hack to handle GLPK bug:
// https://lists.gnu.org/archive/html/bug-glpk/2016-02/msg00002.html
assertM(false, "Why???\n");
break;
}
case GLP_EITLIM:
DEBUG(8, "GLP_EITLIM: The search was prematurely terminated, "
"because\nthe simplex iteration limit has been exceeded.\n");
return goodNumbers(compareTo);
break;
case GLP_ETMLIM:
DEBUG(8, "The search was prematurely terminated, because the time "
"limit\nhas been exceeded.\n");
return goodNumbers(compareTo);
break;
default:
break;
}
return false;
}
o = glp_get_status(problem);
if (not((o == GLP_FEAS) or (o == GLP_OPT))) {
switch (o) {
case GLP_INFEAS: {
DEBUG(8, "GLP_INFEAS — solution is infeasible\n");
break;
}
case GLP_NOFEAS: {
DEBUG(8, "GLP_NOFEAS — problem has no feasible solution\n");
break;
}
case GLP_UNBND: {
DEBUG(8, "GLP_UNBND — problem has unbounded solution\n");
break;
}
case GLP_UNDEF: {
DEBUG(8, "GLP_UNDEF\n");
break;
}
default:
break;
}
return false;
}
o = glp_get_prim_stat(problem);
if (o != GLP_FEAS) {
switch (o) {
case GLP_UNDEF: {
DEBUG(8, "GLP_UNDEF — primal solution is undefined \n");
break;
}
case GLP_FEAS: {
DEBUG(8, "GLP_FEAS — primal solution is feasible \n");
break;
}
case GLP_INFEAS: {
DEBUG(8, "GLP_INFEAS — primal solution is infeasible \n");
break;
}
case GLP_NOFEAS: {
DEBUG(8, "GLP_NOFEAS — no primal feasible solution exists\n");
break;
}
default:
break;
}
return false;
}
if (!isExact)
return true;
return goodNumbers(compareTo);
}
testResult SchweighoferTester::test_factorized(ex ineq) {
DEBUG(6, "Factorizing " << ineq << " for obtaining sign\n");
assertM(not is_a<numeric>(ineq), "Can't factorize a number");
if (is_a<power>(ineq)) {
power p = ex_to<power>(ineq);
assertM(is_a<numeric>(p.op(1)),
"Power " << p << " has non numeric exponent!!\n");
numeric exp = ex_to<numeric>(p.op(1));
assertM(exp.is_integer(),
"Power " << p << " has non integer exponent " << exp << "!!\n");
assertM(exp.is_nonneg_integer(),
"Power " << p << " has negative integer exponent " << exp
<< "!!\n");
testResult sub = test(p.op(0));
switch (sub.sign) {
case SIGN::ZERO:
case SIGN::ABSURD:
case SIGN::GEZ:
return sub;
case SIGN::UNKNOWN:
case SIGN::LEZ: {
if (exp.is_even())
return {SIGN::GEZ, 0.0};
return sub;
}
case SIGN::LTZ: {
if (exp.is_even())
return {SIGN::GTZ, pow(sub.distance, exp.to_double())};
return {SIGN::LTZ, pow(sub.distance, exp.to_double())};
}
case SIGN::GTZ: {
return {SIGN::GTZ, pow(sub.distance, exp.to_double())};
}
}
}
if (is_a<power>(expand(-ineq))) {
ineq = expand(-ineq);
power p = ex_to<power>(ineq);
assertM(is_a<numeric>(p.op(1)),
"Power " << p << " has non numeric exponent!!\n");
numeric exp = ex_to<numeric>(p.op(1));
assertM(exp.is_integer(),
"Power " << p << " has non integer exponent " << exp << "!!\n");
assertM(exp.is_nonneg_integer(),
"Power " << p << " has negative integer exponent " << exp
<< "!!\n");
testResult sub = test(p.op(0));
switch (sub.sign) {
case SIGN::ZERO:
case SIGN::ABSURD:
return sub;
case SIGN::UNKNOWN:
if (exp.is_even())
return {SIGN::LEZ, 0.0};
return sub;
case SIGN::GEZ:
return {SIGN::LEZ, 0.0};
case SIGN::LEZ: {
if (exp.is_even())
return {SIGN::LEZ, 0.0};
return {SIGN::GEZ, 0.0};
}
case SIGN::LTZ: {
if (exp.is_even())
return {SIGN::LTZ, pow(sub.distance, exp.to_double())};
return {SIGN::GTZ, pow(sub.distance, exp.to_double())};
}
case SIGN::GTZ: {
return {SIGN::LTZ, pow(sub.distance, exp.to_double())};
}
}
}
ineq = factor(ineq);
if (is_a<mul>(ineq)) {
bool positive = true;
double distance = 1.0;
for (const ex &op : ineq) {
testResult t = test(op);
switch (t.sign) {
case SIGN::ABSURD:
case SIGN::UNKNOWN:
case SIGN::ZERO:
return t;
case SIGN::LTZ: {
positive = not positive;
distance *= t.distance;
break;
}
case SIGN::LEZ: {
positive = not positive;
distance = 0.0;
break;
}
case SIGN::GTZ: {
distance *= t.distance;
break;
}
case SIGN::GEZ:
distance = 0.0;
}
}
if (positive) {
if (distance > 0.0)
return {SIGN::GTZ, distance};
return {SIGN::GEZ, 0.0};
}
if (distance > 0.0)
return {SIGN::LTZ, distance};
return {SIGN::LEZ, 0.0};
}
return {SIGN::UNKNOWN, 0.0};
}
testResult SchweighoferTester::test(ex ineq, bool testPosAndNeg) {
DEBUG(6, "Testing " << ineq << NL);
testResult result = {SIGN::UNKNOWN, 0.0};
ineq = expand(ineq);
glp_set_col_bnds(problem, 1, GLP_DB, -0.9990, 1.0e6);
glp_set_obj_coef(problem, 1, 1);
for (int i = 2; i <= glp_get_num_cols(problem); i++)
glp_set_col_bnds(problem, i, GLP_LO, 0.0, 0.0);
for (int i = 1, iEnd = monomPos.size(); i <= iEnd; i++)
glp_set_row_bnds(problem, i, GLP_FX, 0.0, 0.0);
bool isNumeric = false;
if (is_a<numeric>(ineq)) {
DEBUG(6, "It is a numeric constant\n");
double max = ex_to<numeric>(ineq).to_double();
max = std::abs(max);
max += 5.0;
glp_set_col_bnds(problem, 1, GLP_DB, 0.0, max);
DEBUG(7, ineq << " is a numeric value\n");
isNumeric = true;
if (ineq < 0.0000000001 && ineq > -0.0000000001) {
DEBUG(6, "It is zero");
DEBUG(7, ineq << " is 0\n");
return {SIGN::ZERO, 0.0};
} else if (ineq < 0) {
glp_set_col_bnds(problem, 1, GLP_FX, 0.0, 0.0);
result = {SIGN::LTZ, -(ex_to<numeric>(ineq).to_double())};
DEBUG(7, ineq << " is negative number\n");
} else {
DEBUG(7, ineq << " is positive number\n");
return {SIGN::GTZ, (ex_to<numeric>(ineq).to_double())};
}
} else {
DEBUG(6, "Testing if we have the expression being tested, by a different "
"constant\n");
bool gez = false, lez = false;
double gtz = 0.0, ltz = 0.0;
for (const auto &toTest : ineqPos) {
DEBUG(9, "Testing if " << toTest.first << " implies " << ineq << NL);
ex pos_test = expand(ineq - toTest.first);
bool this_gez = is_a<numeric>(pos_test) and (pos_test >= 0.0);
if (this_gez) {
gez = true;
gtz = max(gtz, (gez ? ex_to<numeric>(pos_test).to_double() : 0.0));
}
DEBUG(9, "gez? " << gez << "; gtz? " << gtz << NL);
if (testPosAndNeg) {
ex neg_test = expand(ineq + toTest.first);
bool this_lez = is_a<numeric>(neg_test) and (neg_test <= 0.0);
if (this_lez) {
lez = true;
ltz = max(ltz, (lez ? -ex_to<numeric>(neg_test).to_double() : 0.0));
}
DEBUG(9, "lez? " << lez << "; ltz? " << ltz << NL);
}
}
if (gez or lez) {
if (((ltz > 0.0) and gez) or ((gtz > 0.0) and lez)) {
DEBUG(6, "Linear test returning absurd for ineq " << ineq << NL)
return {SIGN::ABSURD, 0.0};
}
if (lez and gez) {
result = {SIGN::ZERO, 0.0};
DEBUG(6, "Linear test making sign of " << ineq << result << NL)
}
if (gez) {
if (gtz > 0.0) {
result = {SIGN::GTZ, gtz};
DEBUG(6, "Linear test making sign of " << ineq << result << NL)
} else {
result = {SIGN::GEZ, 0.0};
DEBUG(6, "Linear test making sign of " << ineq << result << NL)
}
} else {
if (ltz > 0.0) {
result = {SIGN::LTZ, ltz};
DEBUG(6, "Linear test making sign of " << ineq << result << NL)
} else {
result = {SIGN::LEZ, 0.0};
DEBUG(6, "Linear test making sign of " << ineq << result << NL)
}
}
}
}
gexmap<double> monomialsCoeffs;
gatherMonomials(ineq, monomialsCoeffs);
for (const auto &mon : monomialsCoeffs) {
auto it = monomPos.find(mon.first);
if (it == monomPos.end()) {
DEBUG(3, "Monomial: " << mon.first << " is not in the st system.\n");
monomialsCoeffs.clear();
return {SIGN::UNKNOWN, 0};
}
glp_set_row_bnds(problem, it->second, GLP_FX, mon.second, mon.second);
DEBUG(7, "glp_set_row_bnds: " << it->second << '(' << it->first
<< ") == " << mon.second << "\n");
}
if (!testPosAndNeg)
monomialsCoeffs.clear();
glp_smcp config;
glp_init_smcp(&config);
// config.tol_bnd = 1.0e-9; //Tolerance used to check if the basic solution
// is primal feasible. config.tol_piv = 1.0e-11; //Tolerance used to choose
// eligble pivotal elements of the simplex table.
config.it_lim = 10000;
config.tm_lim = 600;
// glp_write_prob(problem, 0, "problem.txt");
int o = glp_simplex(problem, &config);
if (!isProved(o)) {
if (!testPosAndNeg) {
if (result.sign == SIGN::UNKNOWN)
return test_factorized(ineq);
return result;
}
} else {
// glp_write_prob(problem, 0, "problem.txt");
o = glp_exact(problem, &config);
if (!isProved(o, true, ineq)) {
if (!testPosAndNeg) {
if (result.sign == SIGN::UNKNOWN)
return test_factorized(ineq);
return result;
}
} else {
double colPrim = glp_get_col_prim(problem, 1);
if (0.0000001 < colPrim) {
result.sign = SIGN::GTZ;
result.distance = colPrim;
} else if (-0.99999999 < colPrim) {
if (result.sign != SIGN::ZERO) {
result.sign = SIGN::GEZ;
result.distance = colPrim;
}
} else
assert(false); //??? Forced it to be >= -0.9999999
if (isNumeric) { // If it was proved E >= 0, and E is a numeric, then
// distance == E, else it is an absurd! (or bug???)
if (colPrim != result.distance) {
cerr << __FILENAME__ << "::" << __func__ << "::" << __LINE__
<< ":: Proved that" << ineq << " is " << result << NL;
printResult(cerr, true);
return {SIGN::ABSURD, 0.0};
}
}
}
}
// Test -E >= 0? Must not test a -E >= 0, obvious response no?
if ((!testPosAndNeg) or
isNumeric) { // It was requested to verify E >= 0 and -E >= 0?
if (result.sign == SIGN::UNKNOWN)
return test_factorized(ineq);
return result;
}
for (int i = 1, iEnd = monomPos.size(); i <= iEnd; i++)
glp_set_row_bnds(problem, i, GLP_FX, 0.0, 0.0);
for (const auto &mon : monomialsCoeffs) {
auto it = monomPos.find(mon.first);
glp_set_row_bnds(problem, it->second, GLP_FX, -mon.second, -mon.second);
DEBUG(7, "glp_set_row_bnds: " << it->second << '(' << it->first
<< ") == " << -mon.second << "\n");
}
monomialsCoeffs.clear();
// glp_write_prob(problem, 0, "problem.txt");
o = glp_simplex(problem, &config);
if (!isProved(o)) {
if (result.sign == SIGN::UNKNOWN)
return test_factorized(ineq);
return result;
}
// glp_write_prob(problem, 0, "problem.txt");
o = glp_exact(problem, &config);
if (!isProved(o, true, expand(-ineq))) {
if (result.sign == SIGN::UNKNOWN)
return test_factorized(ineq);
return result;
}
double colPrim = glp_get_col_prim(problem, 1);
switch (result.sign) {
case SIGN::ZERO:
case SIGN::GEZ:
if (colPrim < 1.0)
return result;
break;
case SIGN::GTZ:
return {SIGN::ABSURD, 0.0};
break;
case SIGN::LTZ:
if (result.distance != colPrim)
return {SIGN::ABSURD, 0.0};
break;
default:
break;
}
if (colPrim >= 1.0)
return {SIGN::LTZ, colPrim};
else if (-0.99999999 < colPrim)
return {SIGN::LEZ, colPrim};
else
assert(false); //??? Forced it to be >= -0.9999999
if (result.sign == SIGN::UNKNOWN)
return test_factorized(ineq);
return result;
}
void SchweighoferTester::gatherMonomials(const ex &ineq,
gexmap<double> &coeffs) {
if (is_a<numeric>(ineq)) {
DEBUG(9, ineq << " is integer number " << ex_to<numeric>(ineq).to_double()
<< "\n");
coeffs[1] = ex_to<numeric>(ineq).to_double();
return;
}
if (is_a<symbol>(ineq) or is_a<power>(ineq)) {
DEBUG(9, ineq << " is a symbol/power, thus 1 * " << ineq << "\n");
coeffs[ineq] = 1;
return;
}
if (is_a<mul>(ineq)) {
numeric c = 1;
for (const ex &op : ineq) {
if (is_a<numeric>(op)) {
assert(c == 1);
c = ex_to<numeric>(op);
}
}
ex monomial;
if (!divide(ineq, c, monomial))
assert(false);
coeffs[monomial] = c.to_double();
DEBUG(9, ineq << " is a monomial " << c.to_double() << " * " << monomial
<< "\n");
return;
}
assert(is_a<add>(ineq));
DEBUG(9, ineq << " is a add expression\n");
for (const ex &op : ineq)
gatherMonomials(op, coeffs);
DEBUGFOR(9, const auto &sub
: coeffs, ineq << " is a add monomial " << sub.second << " * "
<< sub.first << "\n");
}
// TODO: 1: Remove constant from ineq map, ex: 4x + 3yz -2 >= 0; remove the
// numerical [ -2 ] value. 2: Keep map of these new expressions to their
// relative numeric value: map[4x + 3yz] = -2 3: When testing 4x + 3yz -1, we
// also decompose as [4x + 3yz][-1]. As the tester has that map[[4x + 3yz] = -2
// < -1, our starting test value is already {GTZ, 1}.
void SchweighoferTester::expandSrcs(const exset &root, idx_map &indexes) {
map<int, exset> expanded;
// Order 0: S^0 = { 1 } ; Is fixed and constant
// Order 1: S^1 = S ; Is just the input system
// Order 2: S^2 = S * S; ; Multiply the system by it self
// Order N: S^N = S * S ^ (N-1); Multiply the system by the last generated
// degree to obtain the next one
expanded[0] = {ex(1)};
monomPos[1] = 1;
ineqPos[1] = 1;
indexes[1][1] = 1;
for (unsigned order = 1; order <= MAX_ORDER; order++) {
DEBUG(8, "Inserting constraints at order " << order << NL);
for (const ex &rootExp : root) {
DEBUG(8, "rootExp: " << rootExp << NL);
for (const ex &prevOrd : expanded[order - 1]) {
DEBUG(8, "prevOrd = " << prevOrd << NL);
ex expanExp = expand(rootExp * prevOrd, 15);
bool skip = false;
for (const auto atOrder : expanded) {
if (atOrder.second.find(expanExp) != atOrder.second.end()) {
DEBUG(8, expanExp << " is already existent at degree "
<< atOrder.first)
skip = true;
break;
}
}
if (skip)
continue;
DEBUG(7, "Adding constraint " << expanExp << NL);
expanded[order].insert(expanExp);
unsigned column = indexes.size() + 1;
DEBUG(7, "\t" << expanExp << " is at column " << column << NL);
ineqPos[expanExp] = column;
gexmap<double> monomialsCoeffs;
gatherMonomials(expanExp, monomialsCoeffs);
assert(monomialsCoeffs.size());
for (const auto &coefficient : monomialsCoeffs) {
size_t row = monomPos[coefficient.first];
if (row == 0) {
row = monomPos.size();
monomPos[coefficient.first] = row;
}
indexes[column][row] = coefficient.second;
}
monomialsCoeffs.clear();
if (column >= 2500)
return;
}
}
}
}
void SchweighoferTester::buildProblem(const idx_map &indexes) {
if (problem != nullptr) {
clear();
problem = nullptr;
}
problem = glp_create_prob();
assert(nullptr != problem);
assert((indexes.size()) == ineqPos.size()); // glpk starts vectors from 1
assert(indexes.size());
const size_t nCols = ineqPos.size(), nRows = monomPos.size();
glp_add_cols(problem, nCols);
glp_add_rows(problem, nRows);
for (const auto &mono : monomPos) {
stringstream ss;
ss << mono.first;
glp_set_row_name(problem, mono.second, ss.str().c_str());
}
for (const auto &ineq : ineqPos) {
// stringstream ss;
// ss << ineq.first;
// glp_set_col_name(problem, ineq.second, ss.str().c_str());
size_t nCoeffs = indexes.find(ineq.second)->second.size();
vector<int> is;
vector<double> vs;
is.push_back(0); // glpk ignores element [0]
vs.push_back(0); // glpk ignores element [0]
for (const auto &monomCoeff : indexes.find(ineq.second)->second) {
is.push_back(monomCoeff.first);
vs.push_back((double)monomCoeff.second);
}
glp_set_mat_col(problem, ineq.second, nCoeffs, is.data(), vs.data());
glp_set_col_bnds(problem, ineq.second, GLP_LO, 0.0000, 0);
glp_set_obj_coef(problem, ineq.second, 0);
is.clear();
vs.clear();
}
glp_set_obj_dir(problem, GLP_MAX);
glp_set_obj_coef(problem, 1, 1);
// glp_set_col_bnds(problem, 1, GLP_DB, -0.99999990, 1.85e18);
}
void SchweighoferTester::clear() {
numSrcs = 0;
monomPos.clear();
ineqPos.clear();
if (problem) {
glp_delete_prob(problem);
problem = nullptr;
}
}
ostream &SchweighoferTester::printResult(ostream &o,
const bool printSteps) const {
ex res = 0;
string front = " ";
for (const auto &col : ineqPos) {
double c = glp_get_col_prim(problem, col.second);
if (c != 0.0) {
res += col.first * c;
if (printSteps) {
o << front << '(' << std::setprecision(19) << c << ")*(" << col.first
<< ")\n";
front = " + ";
} else {
DEBUG(4, res << " += " << col.first << "* (" << c << ")\n");
}
}
}
res = expand(res);
DEBUG(5, res << NL);
ex final = 0;
if (is_a<symbol>(res)) {
final = res;
} else if (is_a<numeric>(res)) {
if ((res > MAX_ERROR) or (res < -MAX_ERROR))
final = res;
} else if (is_a<add>(res)) {
for (const ex &op : res) {
numeric coeff = op.integer_content();
if ((coeff > -MAX_ERROR) && (coeff < MAX_ERROR))
continue;
final += op;
}
} else {
numeric coeff = res.integer_content();
if (!(coeff > -MAX_ERROR) && (coeff < MAX_ERROR))
final = res;
}
if (printSteps)
return o << " = " << final << NL;
return o << final << NL;
}
namespace std {
ostream &operator<<(ostream &out, const SIGN &s) {
switch (s) {
case SIGN::ABSURD:
out << "ABSURD";
break;
case SIGN::GEZ:
out << "GEZ";
break;
case SIGN::GTZ:
out << "GTZ";
break;
case SIGN::LEZ:
out << "LEZ";
break;
case SIGN::LTZ:
out << "LTZ";
break;
case SIGN::UNKNOWN:
out << "UNKNOWN";
break;
case SIGN::ZERO:
out << "ZERO";
break;
}
return out;
}
ostream &operator<<(ostream &out, const testResult &r) {
return out << '{' << r.sign << ", " << r.distance << "}";
}
} // namespace std
| 30.281796 | 89 | 0.551676 | [
"object",
"vector"
] |
93366f86932d744e539e1bfbb17991811693d580 | 7,646 | cpp | C++ | src/xray/test_animations/sources/test_animations_application.cpp | ixray-team/ixray-2.0 | 85c3a544175842323fc82f42efd96c66f0fc5abb | [
"Linux-OpenIB"
] | 3 | 2021-10-30T09:36:14.000Z | 2022-03-26T17:00:06.000Z | src/xray/test_animations/sources/test_animations_application.cpp | acidicMercury8/ixray-2.0 | 85c3a544175842323fc82f42efd96c66f0fc5abb | [
"Linux-OpenIB"
] | null | null | null | src/xray/test_animations/sources/test_animations_application.cpp | acidicMercury8/ixray-2.0 | 85c3a544175842323fc82f42efd96c66f0fc5abb | [
"Linux-OpenIB"
] | 1 | 2022-03-26T17:00:08.000Z | 2022-03-26T17:00:08.000Z | ////////////////////////////////////////////////////////////////////////////
// Created : 07.12.2009
// Author : Dmitriy Iassenev
// Copyright (C) GSC Game World - 2009
////////////////////////////////////////////////////////////////////////////
#include "pch.h"
#include "test_animations_application.h"
pcstr test_animations::application::get_resource_path ( ) const
{
UNREACHABLE_CODE(return 0);
}
pcstr test_animations::application::get_underscore_G_path ( ) const
{
UNREACHABLE_CODE(return 0);
}
#if 0
# include "skeleton.h"
# include "../../animation/sources/animation_data.h"
# include <xray/resources_queries_result.h>
# include <xray/configs_lua_config.h>
# include <xray/resources_fs.h>
# include <xray/os_include.h>
# include "maya_animation_data.h"
# define DELETE( pointer ) XRAY_DELETE_IMPL( ::xray::animation::g_allocator, pointer )
using test_animations::application;
using xray::float4x4;
using xray::animation::animation_data;
using xray::animation::animation_data_discret;
using xray::animation::test_skeleton;
using xray::animation::animation_data_hermite;
#ifdef DEBUG
using xray::static_cast_checked;
#endif
xray::memory::doug_lea_allocator_type xray::animation::g_allocator;
namespace xray {
namespace animation {
struct test_skeleton
{
xray::animation::vector<float4x4> m_bones;
};
} // namespace animation
} // namespace xray
void application::initialize ( )
{
m_exit_code = 0;
xray::core::preinitialize ( this, GetCommandLine( ), xray::command_line::contains_application_true, "test_animations" );
xray::animation::g_allocator.do_register ( 500*1024*1024, "test animation allocator" );
xray::memory::allocate_region ( );
xray::core::initialize ( "main", xray::core::no_log, xray::core::perform_debug_initialization );
for( u32 i= 0; i< num_data ; ++i )
{
m_data[i] = NEW (animation_data) ();
m_data_discret[i] = NEW(animation_data_discret)();
m_data_hermite[i] = NEW(animation_data_hermite)();
}
m_skel = NEW (test_skeleton) ();
}
void application::finalize ( )
{
for( u32 i= 0; i< num_data ; ++i )
DELETE( m_data[i] );
for( u32 i= 0; i< num_data ; ++i )
DELETE( m_data_discret[i] );
DELETE ( m_skel );
xray::core::finalize ( );
}
static void on_skeleton_loaded ( xray::resources::queries_result& data )
{
R_ASSERT ( !data.is_failed() );
xray::configs::lua_config_ptr config_ptr = static_cast_checked<xray::configs::lua_config*>(data[0].get_unmanaged_resource().get());
xray::animation::skeleton skeleton = xray::animation::skeleton( *config_ptr );
}
static void on_mounted_disk ( bool const result )
{
XRAY_UNREFERENCED_PARAMETER ( result );
R_ASSERT ( result );
}
template<class data_type>
void application::test_anim(data_type* data[num_data], pcstr name )
{
u32 bone_cnt = data[0]->anim_bone_count();
m_skel->m_bones.resize( bone_cnt , float4x4().identity() );
const float min_time = m_data[0]->min_time();
const float max_time = m_data[0]->max_time();
const float interval = max_time - min_time;
const u32 frame_count = 2000;
const u32 path_count = num_data;
const float dt = interval/frame_count;
xray::timing::timer t;
t.start ( );
for(u32 k =0; k < path_count; ++k )
{
for(u32 i =0; i < frame_count; ++i )
{
float time = min_time + i * dt;
for( u32 j=0; j < bone_cnt; ++j )
data[k]->bone_pose( m_skel->m_bones[j], j, time );
}
}
float time = t.get_elapsed_sec();
float per_frame = time/frame_count/path_count;
float ms_per_frame = per_frame * 1000;
const u32 bones_per_obj = 100;
const u32 num_objects = 100;
const u32 num_frames = 33;
float empiric_cost = ms_per_frame * bones_per_obj * num_objects / bone_cnt * num_frames;
LOG_INFO("empiric_cost %s %f", name, empiric_cost );
LOG_INFO("ms_per_frame %s %f", name, ms_per_frame );
}
//template < typename T, int capacity >
//class spsc_queue {
//public:
// inline bool empty ( ) const
// {
// return !m_buffer[m_consumer_index];
// }
//
// inline bool push_back ( T const value )
// {
// if ( m_buffer[m_producer_index] )
// wait_while_full ( );
//
// m_producer_event.set (false);
// m_buffer[m_producer_index] = value;
// bool result = m_producer_index == m_consumer_index;
// m_producer_index = (m_producer_index + 1) % capacity;
// return result;
// }
//
// inline T pop_front ( )
// {
// R_ASSERT ( !empty() );
// if ( !m_buffer[m_producer_index] ) {
// }
// else {
// m_producer_event.set (true);
// }
//
// int value = m_buffer[m_consumer_index];
// m_buffer[m_consumer_index] = 0;
// m_consumer_index = (m_consumer_index + 1) % capacity;
// return value;
// }
//
//private:
// void __declspec(noinline) wait_while_full ( )
// {
// for ( u32 i=0; i < 1000; ++i ) {
// if ( !m_buffer[m_producer_index] )
// break;
// }
//
// m_producer_event.wait ( 0 );
// }
//
//private:
// XRAY_MAX_CACHE_LINE_PAD;
// xray::threading::event m_producer_event;
// int m_producer_index;
// XRAY_MAX_CACHE_LINE_PAD;
// int m_consumer_index;
// XRAY_MAX_CACHE_LINE_PAD;
// int m_buffer[capacity];
//};
struct base {
base* mega_next;
}; // struct base
#include <xray/intrusive_spsc_queue.h>
void application::execute ( )
{
xray::resources::start_mount_transaction ( );
xray::resources::query_mount_disk (
"resources",
"../../resources",
on_mounted_disk,
&xray::animation::g_allocator
);
xray::resources::end_mount_transaction ( );
{
xray::intrusive_spsc_queue<base,base,&base::mega_next> queue;
queue.set_push_thread_id( );
queue.set_pop_thread_id ( );
queue.push_null_node ( NEW(base) );
queue.push_back ( NEW(base) );
queue.push_back ( NEW(base) );
queue.push_back ( NEW(base) );
queue.push_back ( NEW(base) );
base* value, *to_delete = 0;
value = queue.pop_front( to_delete );
DELETE ( to_delete );
value = queue.pop_front( to_delete );
DELETE ( to_delete );
value = queue.pop_front( to_delete );
DELETE ( to_delete );
value = queue.pop_front( to_delete );
DELETE ( to_delete );
value = queue.pop_null_node();
DELETE ( value );
}
for ( u32 i=0; i < num_data; ++i )
for( u32 i=0; i < num_data; ++i )
{
ASSERT (m_data[i]);
if ( m_data[i]->load( "supper_test.track") )
//if ( m_data[i]->load( "walk_tect_2000_01.track") )
//if ( m_data[i]->load( "walk_tect_joint_animation_2000_01.track") )
//if ( m_data[i]->load( "stancia_2_05_07_per.track") )
{
m_data_discret[i]->build( *m_data[i] );
m_data_hermite[i]->build( *m_data[i] );
}
}
m_data_discret_channels.load( "1.dschtrack.track" );
for( u32 i = 0; i < 100 ; ++i)
{
test_anim( m_data, "polinomial" );
test_anim( m_data_discret, "linear" );
test_anim( m_data_hermite, "hermite" );
}
xray::resources::query_resource(
"resources/animation/skeletons/human.lua",
xray::resources::config_lua_class,
&on_skeleton_loaded,
&xray::animation::g_allocator
);
//for ( ;; ) {
// xray::resources::dispatch_callbacks ( );
// xray::threading::yield ( 10 );
//}
}
void application::exit ( int exit_code )
{
std::exit ( exit_code );
}
void application::set_exit_code ( int exit_code )
{
m_exit_code = exit_code;
}
int application::get_exit_code ( ) const
{
return m_exit_code;
}
#endif | 26.006803 | 133 | 0.627518 | [
"vector"
] |
9339eb37e69a60a4de9a6591a4a8816b6a2e9a38 | 25,323 | cpp | C++ | src/pyjion/pyjit.cpp | mfkiwl/Pyjion | ed4bc1a37c1d384f9c4b68241029eb87ae712119 | [
"MIT"
] | null | null | null | src/pyjion/pyjit.cpp | mfkiwl/Pyjion | ed4bc1a37c1d384f9c4b68241029eb87ae712119 | [
"MIT"
] | null | null | null | src/pyjion/pyjit.cpp | mfkiwl/Pyjion | ed4bc1a37c1d384f9c4b68241029eb87ae712119 | [
"MIT"
] | null | null | null | /*
* The MIT License (MIT)
*
* Copyright (c) Microsoft 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.
*
*/
#include <Python.h>
#include "pyjit.h"
#include "pycomp.h"
#ifdef WINDOWS
#define BUFSIZE 65535
#include <libloaderapi.h>
#include <processenv.h>
typedef ICorJitCompiler*(__cdecl* GETJIT)();
typedef void(__cdecl* JITSTARTUP)(ICorJitHost*);
#endif
#define MAX_UINT8_T 255
#define MAX_UINT16_T 65535
PyjionSettings g_pyjionSettings;
AttributeTable* g_attrTable;
extern BaseModule g_module;
#define SET_OPT(opt, actualLevel, minLevel) \
if ((actualLevel) >= (minLevel)) { \
g_pyjionSettings.optimizations = g_pyjionSettings.optimizations | (opt); \
}
void setOptimizationLevel(unsigned short level) {
g_pyjionSettings.optimizationLevel = level;
g_pyjionSettings.optimizations = OptimizationFlags();
SET_OPT(InlineIs, level, 1);
SET_OPT(InlineDecref, level, 1);
SET_OPT(InternRichCompare, level, 1);
SET_OPT(InlineFramePushPop, level, 1);
SET_OPT(KnownStoreSubscr, level, 1);
SET_OPT(KnownBinarySubscr, level, 1);
SET_OPT(InlineIterators, level, 1);
SET_OPT(HashedNames, level, 1);
SET_OPT(BuiltinMethods, level, 1);
SET_OPT(TypeSlotLookups, level, 1);
SET_OPT(FunctionCalls, level, 1);
SET_OPT(LoadAttr, level, 1);
SET_OPT(Unboxing, level, 1);
SET_OPT(AttrTypeTable, level, 1);
SET_OPT(IntegerUnboxingMultiply, level, 2);
SET_OPT(OptimisticIntegers, level, 2);
}
PyjionJittedCode::~PyjionJittedCode() {
delete j_profile;
}
int Pyjit_CheckRecursiveCall(PyThreadState* tstate, const char* where) {
int recursion_limit = g_pyjionSettings.recursionLimit;
if (tstate->recursion_headroom) {
if (tstate->recursion_depth > recursion_limit + 50) {
/* Overflowing while handling an overflow. Give up. */
Py_FatalError("Cannot recover from stack overflow.");
}
} else {
if (tstate->recursion_depth > recursion_limit) {
tstate->recursion_headroom++;
PyErr_Format(PyExc_RecursionError,
"maximum recursion depth exceeded%s",
where);
tstate->recursion_headroom--;
--tstate->recursion_depth;
return -1;
}
}
return 0;
}
static inline int Pyjit_EnterRecursiveCall(const char* where) {
PyThreadState* tstate = PyThreadState_GET();
return ((++tstate->recursion_depth > g_pyjionSettings.recursionLimit) && Pyjit_CheckRecursiveCall(tstate, where));
}
static inline void Pyjit_LeaveRecursiveCall() {
PyThreadState* tstate = PyThreadState_GET();
tstate->recursion_depth--;
}
static inline PyObject*
PyJit_CheckFunctionResult(PyThreadState* tstate, PyObject* result, PyFrameObject* frame) {
if (result == nullptr) {
if (!PyErr_Occurred()) {
PyErr_Format(PyExc_SystemError,
"%s returned NULL without setting an exception",
PyUnicode_AsUTF8(frame->f_code->co_name));
return nullptr;
}
} else {
if (PyErr_Occurred()) {
Py_DECREF(result);
_PyErr_FormatFromCause(PyExc_SystemError,
"%s returned a result with an exception set", PyUnicode_AsUTF8(frame->f_code->co_name));
return nullptr;
}
}
return result;
}
static inline PyObject* PyJit_ExecuteJittedFrame(void* state, PyFrameObject* frame, PyThreadState* tstate, PyjionJittedCode* jitted) {
if (Pyjit_EnterRecursiveCall("")) {
return nullptr;
}
PyTraceInfo trace_info;
/* Mark trace_info as uninitialized */
trace_info.code = nullptr;
CFrame* prev_cframe = tstate->cframe;
trace_info.cframe.use_tracing = prev_cframe->use_tracing;
trace_info.cframe.previous = prev_cframe;
tstate->cframe = &trace_info.cframe;
if (frame->f_state != PY_FRAME_SUSPENDED)
frame->f_stackdepth = -1;
frame->f_state = PY_FRAME_EXECUTING;
try {
auto res = ((Py_EvalFunc) state)(nullptr, frame, tstate, jitted->j_profile, &trace_info);
tstate->cframe = trace_info.cframe.previous;
tstate->cframe->use_tracing = trace_info.cframe.use_tracing;
Pyjit_LeaveRecursiveCall();
return PyJit_CheckFunctionResult(tstate, res, frame);
} catch (const std::exception& e) {
#ifdef DEBUG_VERBOSE
printf("Caught exception on execution of frame %s\n", e.what());
#endif
PyErr_SetString(PyExc_RuntimeError, e.what());
Pyjit_LeaveRecursiveCall();
return nullptr;
}
}
static Py_tss_t* g_extraSlot;
#ifdef WINDOWS
HMODULE GetClrJit() {
return LoadLibrary(g_pyjionSettings.clrjitpath);
}
#endif
bool JitInit(const wchar_t* path) {
g_pyjionSettings = PyjionSettings();
g_pyjionSettings.recursionLimit = Py_GetRecursionLimit();
g_pyjionSettings.clrjitpath = path;
g_attrTable = new AttributeTable();
g_extraSlot = PyThread_tss_alloc();
PyThread_tss_create(g_extraSlot);
#ifdef WINDOWS
auto clrJitHandle = GetClrJit();
if (clrJitHandle == nullptr) {
PyErr_SetString(PyExc_RuntimeError, "Failed to load .NET CLR JIT.");
return false;
}
auto jitStartup = (JITSTARTUP) GetProcAddress(clrJitHandle, "jitStartup");
if (jitStartup != nullptr)
jitStartup(&g_jitHost);
else {
PyErr_SetString(PyExc_RuntimeError, "Failed to load jitStartup().");
return false;
}
auto getJit = (GETJIT) GetProcAddress(clrJitHandle, "getJit");
if (getJit == nullptr) {
PyErr_SetString(PyExc_RuntimeError, "Failed to load clrjit.dll::getJit(), check that the correct version of .NET is installed.");
return false;
}
#else
jitStartup(&g_jitHost);
#endif
g_jit = getJit();
if (PyType_Ready(&PyJitMethodLocation_Type) < 0)
return false;
g_emptyTuple = PyTuple_New(0);
setOptimizationLevel(1);
return true;
}
PyObject* PyJit_ExecuteAndCompileFrame(PyjionJittedCode* state, PyFrameObject* frame, PyThreadState* tstate, PyjionCodeProfile* profile) {
// Compile and run the now compiled code...
PythonCompiler jitter((PyCodeObject*) state->j_code);
AbstractInterpreter interp((PyCodeObject*) state->j_code, &jitter);
int argCount = frame->f_code->co_argcount + frame->f_code->co_kwonlyargcount;
// provide the interpreter information about the specialized types
for (int i = 0; i < argCount; i++) {
interp.setLocalType(i, frame->f_localsplus[i]);
}
if (tstate->cframe->use_tracing && tstate->c_tracefunc) {
interp.enableTracing();
state->j_tracingHooks = true;
} else {
interp.disableTracing();
state->j_tracingHooks = false;
}
if (tstate->cframe->use_tracing && tstate->c_profilefunc) {
interp.enableProfiling();
state->j_profilingHooks = true;
} else {
interp.disableProfiling();
state->j_profilingHooks = false;
}
auto res = interp.compile(frame->f_builtins, frame->f_globals, profile, state->j_pgc_status);
state->j_compile_result = res.result;
state->j_optimizations = res.optimizations;
if (g_pyjionSettings.graph) {
if (state->j_graph != nullptr)
Py_DECREF(state->j_graph);
state->j_graph = res.instructionGraph;
}
if (res.compiledCode == nullptr || res.result != Success) {
state->j_failed = true;
state->j_addr = nullptr;// TODO : Raise specific warning when it used to compile and then it didnt the second time.
return _PyEval_EvalFrameDefault(tstate, frame, 0);
}
// Update the jitted information for this tree node
state->j_addr = (Py_EvalFunc) res.compiledCode->get_code_addr();
assert(state->j_addr != nullptr);
state->j_il = res.compiledCode->get_il();
state->j_ilLen = res.compiledCode->get_il_len();
state->j_nativeSize = res.compiledCode->get_native_size();
state->j_profile = profile;
state->j_symbols = res.compiledCode->get_symbol_table();
state->j_sequencePoints = res.compiledCode->get_sequence_points();
state->j_sequencePointsLen = res.compiledCode->get_sequence_points_length();
state->j_callPoints = res.compiledCode->get_call_points();
state->j_callPointsLen = res.compiledCode->get_call_points_length();
#ifdef DUMP_SEQUENCE_POINTS
printf("Method disassembly for %s\n", PyUnicode_AsUTF8(frame->f_code->co_name));
auto code = (_Py_CODEUNIT*) PyBytes_AS_STRING(frame->f_code->co_code);
for (size_t i = 0; i < state->j_sequencePointsLen; i++) {
printf(" %016llX (IL_%04X): %d %s %d\n",
((uint64_t) state->j_addr + (uint64_t) state->j_sequencePoints[i].nativeOffset),
state->j_sequencePoints[i].ilOffset,
state->j_sequencePoints[i].pythonOpcodeIndex,
opcodeName(_Py_OPCODE(code[(state->j_sequencePoints[i].pythonOpcodeIndex) / sizeof(_Py_CODEUNIT)])),
_Py_OPARG(code[(state->j_sequencePoints[i].pythonOpcodeIndex) / sizeof(_Py_CODEUNIT)]));
}
#endif
// Execute it now.
return PyJit_ExecuteJittedFrame((void*) state->j_addr, frame, tstate, state);
}
PyjionJittedCode* PyJit_EnsureExtra(PyObject* codeObject) {
auto index = (ssize_t) PyThread_tss_get(g_extraSlot);
if (index == 0) {
index = _PyEval_RequestCodeExtraIndex(PyjionJitFree);
if (index == -1) {
return nullptr;
}
PyThread_tss_set(g_extraSlot, (void*) ((index << 1) | 0x01));
} else {
index = index >> 1;
}
PyjionJittedCode* jitted = nullptr;
if (_PyCode_GetExtra(codeObject, index, (void**) &jitted)) {
PyErr_Clear();
return nullptr;
}
if (jitted == nullptr) {
jitted = new PyjionJittedCode(codeObject);
if (jitted != nullptr) {
if (_PyCode_SetExtra(codeObject, index, jitted)) {
PyErr_Clear();
delete jitted;
return nullptr;
}
}
}
return jitted;
}
// This is our replacement evaluation function. We lookup our corresponding jitted code
// and dispatch to it if it's already compiled. If it hasn't yet been compiled we'll
// eventually compile it and invoke it. If it's not time to compile it yet then we'll
// invoke the default evaluation function.
PyObject* PyJit_EvalFrame(PyThreadState* ts, PyFrameObject* f, int throwflag) {
auto jitted = PyJit_EnsureExtra((PyObject*) f->f_code);
if (jitted != nullptr && !throwflag) {
if (jitted->j_addr != nullptr && !jitted->j_failed && (!g_pyjionSettings.pgc || jitted->j_pgc_status == Optimized)) {
jitted->j_run_count++;
return PyJit_ExecuteJittedFrame((void*) jitted->j_addr, f, ts, jitted);
} else if (!jitted->j_failed && jitted->j_run_count++ >= jitted->j_specialization_threshold) {
auto result = PyJit_ExecuteAndCompileFrame(jitted, f, ts, jitted->j_profile);
jitted->j_pgc_status = nextPgcStatus(jitted->j_pgc_status);
return result;
}
}
return _PyEval_EvalFrameDefault(ts, f, throwflag);
}
void PyjionJitFree(void* obj) {
if (obj == nullptr)
return;
auto* code_obj = static_cast<PyjionJittedCode*>(obj);
Py_XDECREF(code_obj->j_code);
free(code_obj->j_il);
code_obj->j_il = nullptr;
delete code_obj->j_profile;
Py_XDECREF(code_obj->j_graph);
}
static PyInterpreterState* inter() {
return PyInterpreterState_Main();
}
static PyObject* pyjion_enable(PyObject* self, PyObject* args) {
auto prev = _PyInterpreterState_GetEvalFrameFunc(inter());
_PyInterpreterState_SetEvalFrameFunc(inter(), PyJit_EvalFrame);
if (prev == PyJit_EvalFrame) {
Py_RETURN_FALSE;
}
Py_RETURN_TRUE;
}
static PyObject* pyjion_disable(PyObject* self, PyObject* args) {
auto prev = _PyInterpreterState_GetEvalFrameFunc(inter());
_PyInterpreterState_SetEvalFrameFunc(inter(), _PyEval_EvalFrameDefault);
if (prev == PyJit_EvalFrame) {
Py_RETURN_TRUE;
}
Py_RETURN_FALSE;
}
static PyObject* pyjion_info(PyObject* self, PyObject* func) {
PyObject* code;
if (PyFunction_Check(func)) {
code = ((PyFunctionObject*) func)->func_code;
} else if (PyCode_Check(func)) {
code = func;
} else {
PyErr_SetString(PyExc_TypeError, "Expected function or code");
return nullptr;
}
auto res = PyDict_New();
if (res == nullptr) {
return nullptr;
}
PyjionJittedCode* jitted = PyJit_EnsureExtra(code);
PyDict_SetItemString(res, "failed", jitted->j_failed ? Py_True : Py_False);
PyDict_SetItemString(res, "tracing", jitted->j_tracingHooks ? Py_True : Py_False);
PyDict_SetItemString(res, "profiling", jitted->j_profilingHooks ? Py_True : Py_False);
PyDict_SetItemString(res, "compile_result", PyLong_FromLong(jitted->j_compile_result));
PyDict_SetItemString(res, "compiled", jitted->j_addr != nullptr ? Py_True : Py_False);
PyDict_SetItemString(res, "optimizations", PyLong_FromLong(jitted->j_optimizations));
PyDict_SetItemString(res, "pgc", PyLong_FromLong(jitted->j_pgc_status));
auto runCount = PyLong_FromUnsignedLongLong(jitted->j_run_count);
PyDict_SetItemString(res, "run_count", runCount);
Py_DECREF(runCount);
return res;
}
static PyObject* pyjion_dump_il(PyObject* self, PyObject* func) {
PyObject* code;
if (PyFunction_Check(func)) {
code = ((PyFunctionObject*) func)->func_code;
} else if (PyCode_Check(func)) {
code = func;
} else {
PyErr_SetString(PyExc_TypeError, "Expected function or code");
return nullptr;
}
PyjionJittedCode* jitted = PyJit_EnsureExtra(code);
if (jitted->j_failed || jitted->j_addr == nullptr)
Py_RETURN_NONE;
auto res = PyByteArray_FromStringAndSize(reinterpret_cast<const char*>(jitted->j_il), jitted->j_ilLen);
if (res == nullptr) {
return nullptr;
}
return res;
}
static PyObject* pyjion_dump_native(PyObject* self, PyObject* func) {
PyObject* code;
if (PyFunction_Check(func)) {
code = ((PyFunctionObject*) func)->func_code;
} else if (PyCode_Check(func)) {
code = func;
} else {
PyErr_SetString(PyExc_TypeError, "Expected function or code");
return nullptr;
}
PyjionJittedCode* jitted = PyJit_EnsureExtra(code);
if (jitted->j_failed || jitted->j_addr == nullptr)
Py_RETURN_NONE;
auto result_t = PyTuple_New(3);
if (result_t == nullptr)
return nullptr;
auto res = PyByteArray_FromStringAndSize(reinterpret_cast<const char*>(jitted->j_addr), jitted->j_nativeSize);
if (res == nullptr)
return nullptr;
PyTuple_SET_ITEM(result_t, 0, res);
Py_INCREF(res);
auto codeLen = PyLong_FromUnsignedLong(jitted->j_nativeSize);
if (codeLen == nullptr)
return nullptr;
PyTuple_SET_ITEM(result_t, 1, codeLen);
Py_INCREF(codeLen);
auto codePosition = PyLong_FromUnsignedLongLong(reinterpret_cast<unsigned long long>(&jitted->j_addr));
if (codePosition == nullptr)
return nullptr;
PyTuple_SET_ITEM(result_t, 2, codePosition);
Py_INCREF(codePosition);
return result_t;
}
static PyObject* pyjion_get_offsets(PyObject* self, PyObject* func) {
PyObject* code;
if (PyFunction_Check(func)) {
code = ((PyFunctionObject*) func)->func_code;
} else if (PyCode_Check(func)) {
code = func;
} else {
PyErr_SetString(PyExc_TypeError, "Expected function or code");
return nullptr;
}
PyjionJittedCode* jitted = PyJit_EnsureExtra(code);
if (jitted->j_failed || jitted->j_addr == nullptr)
Py_RETURN_NONE;
auto offsets = PyTuple_New(jitted->j_sequencePointsLen + jitted->j_callPointsLen);
if (offsets == nullptr)
return nullptr;
size_t idx = 0;
for (size_t i = 0; i < jitted->j_sequencePointsLen; i++, idx++) {
auto offset = PyTuple_New(4);
PyTuple_SET_ITEM(offset, 0, PyLong_FromSize_t(jitted->j_sequencePoints[i].pythonOpcodeIndex));
PyTuple_SET_ITEM(offset, 1, PyLong_FromSize_t(jitted->j_sequencePoints[i].ilOffset));
PyTuple_SET_ITEM(offset, 2, PyLong_FromSize_t(jitted->j_sequencePoints[i].nativeOffset));
PyTuple_SET_ITEM(offset, 3, PyUnicode_FromString("instruction"));
PyTuple_SET_ITEM(offsets, idx, offset);
Py_INCREF(offset);
}
for (size_t i = 0; i < jitted->j_callPointsLen; i++, idx++) {
auto offset = PyTuple_New(4);
PyTuple_SET_ITEM(offset, 0, PyLong_FromLong(jitted->j_callPoints[i].tokenId));
PyTuple_SET_ITEM(offset, 1, PyLong_FromSize_t(jitted->j_callPoints[i].ilOffset));
PyTuple_SET_ITEM(offset, 2, PyLong_FromSize_t(jitted->j_callPoints[i].nativeOffset));
PyTuple_SET_ITEM(offset, 3, PyUnicode_FromString("call"));
PyTuple_SET_ITEM(offsets, idx, offset);
Py_INCREF(offset);
}
return offsets;
}
static PyObject* pyjion_get_graph(PyObject* self, PyObject* func) {
PyObject* code;
if (PyFunction_Check(func)) {
code = ((PyFunctionObject*) func)->func_code;
} else if (PyCode_Check(func)) {
code = func;
} else {
PyErr_SetString(PyExc_TypeError, "Expected function or code");
return nullptr;
}
PyjionJittedCode* jitted = PyJit_EnsureExtra(code);
if (jitted->j_failed) {
PyErr_SetString(PyExc_ValueError, "Function failed to compile so it has no graph.");
return nullptr;
}
if (jitted->j_graph == nullptr) {
PyErr_SetString(PyExc_ValueError, "Compiled function has no graph, graphing was not enabled when it was compiled");
return nullptr;
}
Py_INCREF(jitted->j_graph);
return jitted->j_graph;
}
static PyObject* pyjion_symbols(PyObject* self, PyObject* func) {
PyObject* code;
if (PyFunction_Check(func)) {
code = ((PyFunctionObject*) func)->func_code;
} else if (PyCode_Check(func)) {
code = func;
} else {
PyErr_SetString(PyExc_TypeError, "Expected function or code");
return nullptr;
}
PyjionJittedCode* jitted = PyJit_EnsureExtra(code);
auto table = PyDict_New();
if (table == nullptr)
return nullptr;
for (auto& entry : jitted->j_symbols) {
PyDict_SetItem(table, PyLong_FromUnsignedLong(entry.first), PyUnicode_FromString(entry.second));
}
return table;
}
static PyObject* pyjion_init(PyObject* self, PyObject* args) {
if (!PyUnicode_Check(args)) {
PyErr_SetString(PyExc_TypeError, "Expected str for new clrjit");
return nullptr;
}
auto path = PyUnicode_AsWideCharString(args, nullptr);
if (JitInit(path)) {
Py_RETURN_NONE;
} else {
return nullptr;
}
}
static PyObject*
pyjion_config(PyObject* self, PyObject* args, PyObject* kwargs) {
Py_ssize_t nargs = PyTuple_GET_SIZE(args);
PyObject *pgc = nullptr, *level = nullptr, *debug = nullptr, *graph = nullptr, *threshold = nullptr;
if (kwargs == nullptr) {
goto return_result;
}
pgc = PyDict_GetItemString(kwargs, "pgc");
if (pgc != nullptr) {
// pgc
if (!PyBool_Check(pgc)) {
PyErr_SetString(PyExc_TypeError, "Expected bool for pgc flag");
return nullptr;
}
g_pyjionSettings.pgc = pgc == Py_True ? true : false;
}
level = PyDict_GetItemString(kwargs, "level");
if (level != nullptr) {
// optimization level
if (!PyLong_Check(level)) {
PyErr_SetString(PyExc_TypeError, "Expected int for optimization level");
return nullptr;
}
auto newLevel = PyLong_AsLong(level);
if (newLevel < 0 || newLevel > 2) {
PyErr_SetString(PyExc_ValueError, "Level not in range of 0-2");
return nullptr;
}
setOptimizationLevel(newLevel);
}
debug = PyDict_GetItemString(kwargs, "debug");
if (debug != nullptr) {
// debug
if (!PyBool_Check(debug)) {
PyErr_SetString(PyExc_TypeError, "Expected bool for debug flag");
return nullptr;
}
g_pyjionSettings.debug = debug == Py_True ? true : false;
}
graph = PyDict_GetItemString(kwargs, "graph");
if (graph) {
// graph
if (!PyBool_Check(graph)) {
PyErr_SetString(PyExc_TypeError, "Expected bool for graph flag");
return nullptr;
}
g_pyjionSettings.graph = graph == Py_True ? true : false;
}
threshold = PyDict_GetItemString(kwargs, "threshold");
if (threshold) {
// threshold
if (!PyLong_Check(threshold)) {
PyErr_SetString(PyExc_TypeError, "Expected int for threshold level");
return nullptr;
}
auto newThreshold = PyLong_AsLong(threshold);
if (newThreshold < 0 || newThreshold > MAX_UINT8_T) {
PyErr_SetString(PyExc_ValueError, "Threshold cannot be negative or exceed 255");
return nullptr;
}
g_pyjionSettings.threshold = newThreshold;
}
return_result:
auto res = PyDict_New();
if (res == nullptr) {
return nullptr;
}
PyDict_SetItemString(res, "clrjitpath", PyUnicode_FromWideChar(g_pyjionSettings.clrjitpath, -1));
PyDict_SetItemString(res, "pgc", g_pyjionSettings.pgc ? Py_True : Py_False);
PyDict_SetItemString(res, "graph", g_pyjionSettings.graph ? Py_True : Py_False);
PyDict_SetItemString(res, "debug", g_pyjionSettings.debug ? Py_True : Py_False);
PyDict_SetItemString(res, "level", PyLong_FromLong(g_pyjionSettings.optimizationLevel));
PyDict_SetItemString(res, "threshold", PyLong_FromLong(g_pyjionSettings.threshold));
return res;
}
static PyMethodDef PyjionMethods[] = {
{"enable",
pyjion_enable,
METH_NOARGS,
"Enable the JIT. Returns True if the JIT was enabled, False if it was already enabled."},
{"disable",
pyjion_disable,
METH_NOARGS,
"Disable the JIT. Returns True if the JIT was disabled, False if it was already disabled."},
{"info",
pyjion_info,
METH_O,
"Returns a dictionary describing information about a function or code objects current JIT status."},
{"config",
reinterpret_cast<PyCFunction>(pyjion_config),
METH_VARARGS | METH_KEYWORDS,
"Configure Pyjion runtime settings."},
{"il",
pyjion_dump_il,
METH_O,
"Outputs the IL for the compiled code object."},
{"native",
pyjion_dump_native,
METH_O,
"Outputs the machine code for the compiled code object."},
{"offsets",
pyjion_get_offsets,
METH_O,
"Get the sequence of offsets for IL and machine code for given python bytecodes."},
{"graph",
pyjion_get_graph,
METH_O,
"Fetch instruction graph for code object."},
{"init",
pyjion_init,
METH_O,
"Initialize JIT."},
{"symbols",
pyjion_symbols,
METH_O,
"Return a list of global symbols."
},
{nullptr, nullptr, 0, nullptr} /* Sentinel */
};
static struct PyModuleDef pyjionmodule = {
PyModuleDef_HEAD_INIT,
"_pyjion", /* name of module */
"Pyjion - A Just-in-Time Compiler for CPython", /* module documentation, may be NULL */
-1, /* size of per-interpreter state of the module,
or -1 if the module keeps state in global variables. */
PyjionMethods};
PyObject* PyjionUnboxingError;
PyMODINIT_FUNC PyInit__pyjion(void) {
// Install our frame evaluation function
auto mod = PyModule_Create(&pyjionmodule);
if (mod == nullptr)
return nullptr;
PyjionUnboxingError = PyErr_NewException("pyjion.PyjionUnboxingError", PyExc_ValueError, nullptr);
int ret = PyModule_AddObject(mod, "PyjionUnboxingError", PyjionUnboxingError);
if (ret != 0)
return nullptr;
return mod;
}
| 35.868272 | 138 | 0.65869 | [
"object"
] |
933d0ab2ad46deba1c119411a149e0391d6e6441 | 31,948 | cxx | C++ | src/AutoTractDerivedWindow.cxx | NIRALUser/AutoTract | 37517dd923b497e41249c3653e8e8e513c7eed74 | [
"Apache-2.0"
] | 2 | 2020-06-16T15:24:52.000Z | 2020-09-14T17:50:53.000Z | src/AutoTractDerivedWindow.cxx | NIRALUser/AutoTract | 37517dd923b497e41249c3653e8e8e513c7eed74 | [
"Apache-2.0"
] | 2 | 2019-02-15T22:45:18.000Z | 2022-02-04T17:13:19.000Z | src/AutoTractDerivedWindow.cxx | NIRALUser/AutoTract | 37517dd923b497e41249c3653e8e8e513c7eed74 | [
"Apache-2.0"
] | 4 | 2015-08-14T15:47:54.000Z | 2018-12-04T23:19:25.000Z | #include "AutoTractDerivedWindow.h"
/* Management of software tab: https://github.com/marie-cherel2013/NeosegPipeline*/
AutoTractDerivedWindow::AutoTractDerivedWindow()
{
m_thread = new MainScriptThread();
m_pipeline = new Pipeline();
log_textEdit->setReadOnly(true);
connect( this->actionSave_Parameter_Configuration, SIGNAL( triggered() ), SLOT( SaveParaConfigFile() ) );
connect( this->actionLoad_Parameter_Configuration, SIGNAL( triggered() ), SLOT( LoadParaConfigFile() ) );
connect( this->actionSave_Software_Configuration, SIGNAL( triggered() ), SLOT( SaveSoftConfigFile() ) );
connect( this->actionLoad_Software_Configuration, SIGNAL( triggered() ), SLOT( LoadSoftConfigFile() ) );
/*1st tab: Inputs*/
// Select Parameters Signal Mapper
QSignalMapper* selectParameters_signalMapper = new QSignalMapper(this);
connect(selectParameters_signalMapper, SIGNAL(mapped(QString)), this, SLOT(selectParameters(QString)));
// Enter Parameters Signal Mapper
QSignalMapper* enterParameters_signalMapper = new QSignalMapper(this);
connect(enterParameters_signalMapper, SIGNAL(mapped(QString)), this, SLOT(enterParameters(QString)));
initializeParametersMap();
QMap<QString, Parameters>::iterator it_parameters;
for(it_parameters = m_parameters_map.begin(); it_parameters != m_parameters_map.end(); ++it_parameters)
{
QString name = it_parameters.key();
Parameters parameters = it_parameters.value();
selectParameters_signalMapper->setMapping(parameters.select_button, name);
connect(parameters.select_button, SIGNAL(clicked()), selectParameters_signalMapper, SLOT(map()));
enterParameters_signalMapper->setMapping(parameters.enter_lineEdit, name);
connect(parameters.enter_lineEdit, SIGNAL(editingFinished()), enterParameters_signalMapper, SLOT(map()));
}
connect(output_dir_pushButton, SIGNAL(clicked()), this, SLOT(selectOutputDirectory()));
connect(para_output_dir_lineEdit, SIGNAL(editingFinished()), this, SLOT(enterOutputDirectory()));
/*2nd tab: reference tracts*/
connect(tracts_dir_pushButton, SIGNAL(clicked()), this, SLOT(selectTractsPopulationDirectory()));
connect(para_tracts_dir_lineEdit, SIGNAL(editingFinished()), this, SLOT(enterTractPopulationDirectory()));
connect(para_ref_tracts_listWidget,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(selectTracts(QListWidgetItem*)));
connect(check_all_tracts_pushButton, SIGNAL(clicked()), this, SLOT(checkAllTracts()));
connect(uncheck_all_tracts_pushButton, SIGNAL(clicked()), this, SLOT(uncheckAllTracts()));
/*3rd tab: software*/
// Select Executable Signal Mapper
QSignalMapper* selectExecutable_signalMapper = new QSignalMapper(this);
connect(selectExecutable_signalMapper, SIGNAL(mapped(QString)), this, SLOT(selectExecutable(QString)));
// Enter Executable Signal Mapper
QSignalMapper* enterExecutable_signalMapper = new QSignalMapper(this);
connect(enterExecutable_signalMapper, SIGNAL(mapped(QString)), this, SLOT(enterExecutable(QString)));
// Reset Executable Signal Mapper
QSignalMapper* resetExecutable_signalMapper = new QSignalMapper(this);
connect(resetExecutable_signalMapper, SIGNAL(mapped(QString)), this, SLOT(resetExecutable(QString)));
initializeExecutablesMap();
QMap<QString, Executable>::iterator it_exec;
for(it_exec = m_executables_map.begin(); it_exec != m_executables_map.end(); ++it_exec)
{
QString name = it_exec.key();
Executable executable = it_exec.value();
selectExecutable_signalMapper->setMapping(executable.select_button, name);
connect(executable.select_button, SIGNAL(clicked()), selectExecutable_signalMapper, SLOT(map()));
enterExecutable_signalMapper->setMapping(executable.enter_lineEdit, name);
connect(executable.enter_lineEdit, SIGNAL(editingFinished()), enterExecutable_signalMapper, SLOT(map()));
resetExecutable_signalMapper->setMapping(executable.reset_button, name);
connect(executable.reset_button, SIGNAL(clicked()), resetExecutable_signalMapper, SLOT(map()));
}
/*4th tab: Registration*/
connect(para_registration_type_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_transformation_step_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_iterations_lineEdit, SIGNAL(editingFinished()), this, SLOT(SyncUiToModelStructure()));
connect(para_similarity_metric_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_similarity_parameter_spinBox, SIGNAL(valueChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_gaussian_sigma_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
/*5th tab: Tractography*/
connect(para_dilation_radius_spinBox, SIGNAL(valueChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_seedspacing_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_linearmeasure_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_minpathlength_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_maxpathlength_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_stoppingvalue_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_integrationsteplength_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_stoppingcurvature_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
/*6th tab: Tract Processing Parameters*/
connect(para_thresholdCSFmask_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_tractOverlapRatio_spinBox, SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
connect(para_tractMaxDistThreshold_spinBox,SIGNAL(valueChanged(double)), this, SLOT(SyncUiToModelStructure()));
/*7th tab: Classification*/
connect(trafic_model_dir_pushButton, SIGNAL(clicked()), this, SLOT(selectTraficModelDirectory()));
connect(para_trafic_model_dir_lineEdit, SIGNAL(editingFinished()), this, SLOT(enterTraficModelDirectory()));
connect(para_enable_trafic_checkBox, SIGNAL(stateChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_no_tract_output_trafic_checkBox, SIGNAL(stateChanged(int)), this, SLOT(SyncUiToModelStructure()));
/*8th tab: Execution*/
connect(runPipeline_pushButton, SIGNAL(clicked()), this, SLOT(runPipeline()));
connect(stopPipeline_pushButton, SIGNAL(clicked()), this, SLOT(stopPipeline()));
//connect(para_all_radioButton, SIGNAL(clicked()), this, SLOT(SyncUiToModelStructure()));
//connect(para_singletract_radioButton, SIGNAL(clicked()), this, SLOT(SyncUiToModelStructure()));
//connect(para_cleanup_checkBox, SIGNAL(clicked()), this, SLOT(SyncUiToModelStructure()));
//connect(para_overwrite_checkBox, SIGNAL(clicked()), this, SLOT(SyncUiToModelStructure()));
connect(para_nb_threads_spinBox, SIGNAL(valueChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_nb_memory_registration_spinBox, SIGNAL(valueChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_computingSystem_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeComputingSystem()));
connect(para_nbTractsProcessed_spinBox, SIGNAL(valueChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_nb_memory_spinBox, SIGNAL(valueChanged(int)), this, SLOT(SyncUiToModelStructure()));
connect(para_nbCores_spinBox, SIGNAL(valueChanged(int)), this, SLOT(SyncUiToModelStructure()));
}
void AutoTractDerivedWindow::closeEvent(QCloseEvent *event)
{
QMessageBox::StandardButton resBtn = QMessageBox::question( this, "AutoTract",
tr("Do you want to kill the processes running?\n"),
QMessageBox::Cancel | QMessageBox::No | QMessageBox::Yes, QMessageBox::Yes);
if(resBtn == QMessageBox::Cancel)
{
event->ignore();
}
else if (resBtn == QMessageBox::Yes)
{
if(m_thread->isRunning())
{
m_thread->terminate();
}
event->accept();
}
else
{
event->accept();
}
}
void AutoTractDerivedWindow::initSoftware(std::string commandDirectory)
{
std::vector<std::string> hints;
hints.push_back(commandDirectory);
#ifdef Slicer_CLIMODULES_BIN_DIR
hints.push_back(commandDirectory + "/../../../../ResampleDTIlogEuclidean/" + std::string(Slicer_CLIMODULES_BIN_DIR));
hints.push_back(commandDirectory + "/../../../../DTIAtlasFiberAnalyzer/" + std::string(Slicer_CLIMODULES_BIN_DIR));
hints.push_back(commandDirectory + "/../../../../DTIAtlasBuilder/" + std::string(Slicer_CLIMODULES_BIN_DIR));
hints.push_back(commandDirectory + "/../../../../DTI-Reg/" + std::string(Slicer_CLIMODULES_BIN_DIR));
hints.push_back(commandDirectory + "/../../../../DTIProcess/" + std::string(Slicer_CLIMODULES_BIN_DIR));
hints.push_back(commandDirectory + "/../../../../TractographyLabelMapSeeding/" + std::string(Slicer_CLIMODULES_BIN_DIR));
hints.push_back(commandDirectory + "/../ExternalBin/");
// This path is used when is built as Slicer extension and in debug/build directory
hints.push_back(commandDirectory + "/../../../ResampleDTIlogEuclidean-build/" + std::string(Slicer_CLIMODULES_BIN_DIR));
hints.push_back(commandDirectory + "/../../../DTIProcess-build/niral_utilities-install/bin");
hints.push_back(commandDirectory + "/../../../DTIProcess-build/DTIProcess-inner-build/bin");
hints.push_back(commandDirectory + "/../../../DTI-Reg-build/ANTs-install/bin");
hints.push_back(commandDirectory + "/../../../DTI-Reg-build/DTI-Reg-inner-build/bin");
hints.push_back(commandDirectory + "/../../../DTI-Reg-build/ITKTransformTools-build");
hints.push_back(commandDirectory + "/../../../DTIAtlasFiberAnalyzer-build/DTIAtlasFiberAnalyzer-inner-build/bin");
hints.push_back(commandDirectory + "/../../../DTIProcess-build/niral_utilities-install/Slicer.app/Contents/" + std::string(Slicer_CLIMODULES_BIN_DIR));
//For Slicer executable
hints.push_back(commandDirectory + "/../../../../../");//LINUX
hints.push_back(commandDirectory + "/../../../../../MacOS");//MAC
#endif
// This paths are used when is built as standalone and testing
hints.push_back(commandDirectory + "/../../niral_utilities-install/bin");
hints.push_back(commandDirectory + "/../../ResampleDTIlogEuclidean-install/bin");
hints.push_back(commandDirectory + "/../../DTIAtlasFiberAnalyzer-install/bin/");
hints.push_back(commandDirectory + "/../../DTIAtlasBuilder-install/bin/");
hints.push_back(commandDirectory + "/../../DTI-Reg-install/bin/");
hints.push_back(commandDirectory + "/../../ITKTransformTools-install/bin/");
hints.push_back(commandDirectory + "/../../DTIProcess-install/bin/");
hints.push_back(commandDirectory + "/../../Teem-install/bin");
hints.push_back(commandDirectory + "/../../");
std::string soft = "dtiprocess";
m_soft_m->setsoft_dtiprocess_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "DTI-Reg";
m_soft_m->setsoft_DTIReg_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "FiberPostProcess";
m_soft_m->setsoft_FiberPostProcess_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "fiberprocess";
m_soft_m->setsoft_fiberprocess_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "ImageMath";
m_soft_m->setsoft_ImageMath_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "ResampleDTIlogEuclidean";
m_soft_m->setsoft_ResampleDTIlogEuclidean_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "MaurerDistanceTransform";
m_soft_m->setsoft_MDT_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "polydatatransform";
m_soft_m->setsoft_polydatatransform_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "python3";
m_soft_m->setsoft_python_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str() ) ) ) ;
soft = "Slicer";
m_soft_m->setsoft_slicer_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "TractographyLabelMapSeeding";
m_soft_m->setsoft_TractographyLabelMapSeeding_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "unu";
m_soft_m->setsoft_unu_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "ANTS";
m_soft_m->setsoft_ANTS_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "ITKTransformTools";
m_soft_m->setsoft_ITKTransformTools_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) ) ;
soft = "docker";
m_soft_m->setsoft_docker_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str(), hints, true ) ) );
soft = "Trafic";
m_soft_m->setsoft_Trafic_lineEdit(QString::fromStdString( itksys::SystemTools::FindDirectory( soft.c_str(), hints, true ) ) );
}
void AutoTractDerivedWindow::checkAllTracts()
{
std::map<std::pair<unsigned long,QString>,bool> map = m_para_m->getpara_ref_tracts_listWidget();
std::map<std::pair<unsigned long,QString>,bool>::iterator it = map.begin();
for( int count = 0 ; it != map.end() ; count++ , it++ )
{
map[it->first] = true;
}
m_para_m->setpara_ref_tracts_listWidget( map );
SyncModelStructureToUi();
}
void AutoTractDerivedWindow::uncheckAllTracts()
{
std::map<std::pair<unsigned long,QString>,bool> map = m_para_m->getpara_ref_tracts_listWidget();
std::map<std::pair<unsigned long,QString>,bool>::iterator it = map.begin();
for( int count = 0 ; it != map.end() ; count++ , it++ )
{
map[it->first] = false;
}
m_para_m->setpara_ref_tracts_listWidget( map );
SyncModelStructureToUi();
}
void AutoTractDerivedWindow::runPipeline()
{
runPipeline_pushButton->setEnabled(false);
stopPipeline_pushButton->setEnabled(true);
SyncUiToModelStructure();
m_pipeline->setPipelineParameters(m_para_m);
m_pipeline->setPipelineSoftwares(m_soft_m);
initializePipelineLogging();
m_pipeline->writePipeline();
m_thread->setPipeline(m_pipeline);
m_thread->start();
//runPipeline_pushButton->setEnabled(true);
//stopPipeline_pushButton->setEnabled(false);
}
void AutoTractDerivedWindow::stopPipeline()
{
m_thread->terminate();
runPipeline_pushButton->setEnabled(true);
runPipeline_action->setEnabled(true);
stopPipeline_pushButton->setEnabled(false);
stopPipeline_action->setEnabled(false);
}
void AutoTractDerivedWindow::initializePipelineLogging()
{
log_textEdit->show();
log_textEdit->clear();
log_textEdit->setMaximumBlockCount(500);
// Log path
QDir* output_dir = new QDir(m_para_m->getpara_output_dir_lineEdit());
QFileInfo fi(m_para_m->getpara_output_dir_lineEdit());
QString base = fi.baseName();
QString log_path = output_dir->filePath(base + ".log");
// Log File
QFile* log_file = new::QFile(log_path);
log_file->open(QIODevice::ReadWrite);
m_log_textStream = new::QTextStream(log_file);
// QFileSystemWatcher
QFileSystemWatcher* log_watcher = new::QFileSystemWatcher(this);
log_watcher->addPath(log_path);
connect(log_watcher, SIGNAL(fileChanged(QString)), this, SLOT(printPipelineLog()));
}
void AutoTractDerivedWindow::printPipelineLog()
{
QScrollBar *scrollBar = log_textEdit->verticalScrollBar();
QString line = m_log_textStream->readAll();
if(scrollBar->value() == scrollBar->maximum())
{
log_textEdit->insertPlainText(line);
scrollBar->setValue(scrollBar->maximum());
}
else
{
log_textEdit->insertPlainText(line);
}
}
void AutoTractDerivedWindow::SaveParaConfigFile()
{
QString m_DialogDir;
QString filename = QFileDialog::getSaveFileName( this , "Save Parameter Configuration File" , m_DialogDir , "XML files (*.xml)" );
if( filename != "" )
{
QFileInfo fi( filename ) ;
m_DialogDir = fi.dir().absolutePath() ;
Save_Parameter_Configuration( filename.toStdString() );
}
}
void AutoTractDerivedWindow::LoadParaConfigFile()
{
QString m_DialogDir;
QString filename = QFileDialog::getOpenFileName( this , "Open Parameter Configuration File" , m_DialogDir , "XML files (*.xml)" );
if( filename != "" )
{
QFileInfo fi( filename ) ;
m_DialogDir = fi.dir().absolutePath() ;
Load_Parameter_Configuration( filename.toStdString() );
}
}
void AutoTractDerivedWindow::SaveSoftConfigFile()
{
QString m_DialogDir;
QString filename = QFileDialog::getSaveFileName( this , "Save Software Configuration File" , m_DialogDir , "XML files (*.xml)" );
if( filename != "" )
{
QFileInfo fi( filename ) ;
m_DialogDir = fi.dir().absolutePath() ;
Save_Software_Configuration( filename.toStdString() );
}
}
void AutoTractDerivedWindow::LoadSoftConfigFile()
{
QString m_DialogDir;
QString filename = QFileDialog::getOpenFileName( this , "Open Software Configuration File" , m_DialogDir , "XML files (*.xml)" );
if( filename != "" )
{
QFileInfo fi( filename ) ;
m_DialogDir = fi.dir().absolutePath() ;
Load_Software_Configuration( filename.toStdString() );
}
}
void AutoTractDerivedWindow::initializeExecutablesMap()
{
Executable DTIReg = {DTIReg_pushButton, soft_DTIReg_lineEdit, reset_DTIReg_pushButton};
m_executables_map.insert("DTIReg", DTIReg);
Executable fiberprocess = {fiberprocess_pushButton, soft_fiberprocess_lineEdit, reset_fiberprocess_pushButton};
m_executables_map.insert("fiberprocess", fiberprocess);
Executable ResampleDTIlogEuclidean = {ResampleDTIlogEuclidean_pushButton, soft_ResampleDTIlogEuclidean_lineEdit, reset_ResampleDTIlogEuclidean_pushButton};
m_executables_map.insert("ResampleDTIlogEuclidean", ResampleDTIlogEuclidean);
Executable ImageMath = {ImageMath_pushButton, soft_ImageMath_lineEdit, reset_ImageMath_pushButton};
m_executables_map.insert("ImageMath", ImageMath);
Executable TractographyLabelMapSeeding = {TractographyLabelMapSeeding_pushButton, soft_TractographyLabelMapSeeding_lineEdit, reset_TractographyLabelMapSeeding_pushButton};
m_executables_map.insert("TractographyLabelMapSeeding", TractographyLabelMapSeeding);
Executable FiberPostProcess = {FiberPostProcess_pushButton, soft_FiberPostProcess_lineEdit, reset_FiberPostProcess_pushButton};
m_executables_map.insert("FiberPostProcess", FiberPostProcess);
Executable polydatatransform = {polydatattransform_pushButton, soft_polydatatransform_lineEdit, reset_polydatatransform_pushButton};
m_executables_map.insert("polydatatransform", polydatatransform);
Executable unu = {unu_pushButton, soft_unu_lineEdit, reset_unu_pushButton};
m_executables_map.insert("unu", unu);
Executable MDT = {MDT_pushButton, soft_MDT_lineEdit, reset_MDT_pushButton};
m_executables_map.insert("MDT", MDT);
Executable python = {python_pushButton, soft_python_lineEdit, reset_python_pushButton};
m_executables_map.insert("python", python);
Executable dtiprocess = {dtiprocess_pushButton, soft_dtiprocess_lineEdit, reset_dtiprocess_pushButton};
m_executables_map.insert("dtiprocess", dtiprocess);
Executable Slicer = {slicer_pushButton, soft_slicer_lineEdit, reset_slicer_pushButton};
m_executables_map.insert("Slicer", Slicer);
Executable ANTS = {ANTS_pushButton, soft_ANTS_lineEdit, reset_ANTS_pushButton};
m_executables_map.insert("ANTS", ANTS);
Executable ITKTransformTools = {ITKTransformTools_pushButton, soft_ITKTransformTools_lineEdit, reset_ITKTransformTools_pushButton};
m_executables_map.insert("ITKTransformTools", ITKTransformTools);
Executable Docker = {docker_pushButton, soft_docker_lineEdit, reset_docker_pushButton};
m_executables_map.insert("docker", Docker);
}
void AutoTractDerivedWindow::selectExecutable(QString executable_name)
{
Executable executable = m_executables_map[executable_name];
QString executable_path = (executable.enter_lineEdit)->text();
QString dir_path = "";
if(!(executable_path.isEmpty()))
{
dir_path = (QFileInfo(executable_path).dir()).absolutePath();
}
executable_path = QFileDialog::getOpenFileName(this, tr("Select executable"), dir_path);
if(!executable_path.isEmpty())
{
(executable.enter_lineEdit)->setText(executable_path) ;
}
SyncUiToModelStructure();
}
void AutoTractDerivedWindow::enterExecutable(QString executable_name)
{
Executable executable = m_executables_map[executable_name];
QString executable_path = (executable.enter_lineEdit)->text();
(executable.enter_lineEdit)->setText(executable_path) ;
SyncUiToModelStructure();
}
void AutoTractDerivedWindow::resetExecutable(QString executable_name)
{
if(executable_name == "dtiprocess")
{
m_soft_m->setsoft_dtiprocess_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "DTIReg")
{
std::string soft = "DTI-Reg";
m_soft_m->setsoft_DTIReg_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str() ) ) ) ;
}
if(executable_name == "FiberPostProcess")
{
m_soft_m->setsoft_FiberPostProcess_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "fiberprocess")
{
m_soft_m->setsoft_fiberprocess_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "ImageMath")
{
m_soft_m->setsoft_ImageMath_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "ResampleDTIlogEuclidean")
{
m_soft_m->setsoft_ResampleDTIlogEuclidean_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "MDT")
{
std::string soft = "MaurerDistanceTransform";
m_soft_m->setsoft_MDT_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( soft.c_str() ) ) ) ;
}
if(executable_name == "polydatatransform")
{
m_soft_m->setsoft_polydatatransform_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "python")
{
m_soft_m->setsoft_python_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "TractographyLabelMapSeeding")
{
m_soft_m->setsoft_TractographyLabelMapSeeding_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "unu")
{
m_soft_m->setsoft_unu_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "Slicer")
{
m_soft_m->setsoft_slicer_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "ANTS")
{
m_soft_m->setsoft_ANTS_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "ITKTransformTools")
{
m_soft_m->setsoft_ITKTransformTools_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "docker")
{
m_soft_m->setsoft_docker_lineEdit(QString::fromStdString( itksys::SystemTools::FindProgram( executable_name.toStdString().c_str() ) ) ) ;
}
if(executable_name == "Trafic")
{
m_soft_m->setsoft_Trafic_lineEdit(QString::fromStdString( itksys::SystemTools::FindDirectory( executable_name.toStdString().c_str() ) ) ) ;
}
SyncModelStructureToUi("soft");
}
void AutoTractDerivedWindow::initializeParametersMap()
{
Parameters inputDTIatlas_dir = { inputDTIatlas_pushButton, para_inputDTIatlas_lineEdit};
m_parameters_map.insert("inputDTIatlas_dir", inputDTIatlas_dir);
Parameters inputWMmask_dir = {inputWMmask_pushButton, para_inputWMmask_lineEdit};
m_parameters_map.insert("inputWMmask_dir", inputWMmask_dir);
Parameters inputCSFmask_dir = {inputCSFmask_pushButton, para_inputCSFmask_lineEdit};
m_parameters_map.insert("inputCSFmask_dir", inputCSFmask_dir);
Parameters refDTIatlas_dir = {refDTIatlas_pushButton, para_refDTIatlas_lineEdit};
m_parameters_map.insert("refDTIatlas_dir", refDTIatlas_dir);
Parameters displacementField_dir = {inputdisplacementField_pushButton, para_displacementField_lineEdit};
m_parameters_map.insert("displacementField", displacementField_dir);
}
void AutoTractDerivedWindow::selectParameters(QString parameters_name)
{
Parameters parameters = m_parameters_map[parameters_name];
QString parameters_path = (parameters.enter_lineEdit)->text();
QString dir_path = "";
if(!(parameters_path.isEmpty()))
{
dir_path = (QFileInfo(parameters_path).dir()).absolutePath();
}
parameters_path = QFileDialog::getOpenFileName(this, tr("Select path"), dir_path);
if(!parameters_path.isEmpty())
{
(parameters.enter_lineEdit)->setText(parameters_path) ;
}
SyncUiToModelStructure();
}
void AutoTractDerivedWindow::enterParameters(QString parameters_name)
{
Parameters parameters = m_parameters_map[parameters_name];
QString parameters_path = (parameters.enter_lineEdit)->text();
(parameters.enter_lineEdit)->setText(parameters_path) ;
SyncUiToModelStructure();
}
void AutoTractDerivedWindow::selectTractsPopulationDirectory()
{
QString tractsPopulationDirectory = QFileDialog::getExistingDirectory (this, tr("Open Directory"), para_tracts_dir_lineEdit->text(), QFileDialog::ShowDirsOnly);
para_tracts_dir_lineEdit->setText(tractsPopulationDirectory);
m_tractPopulationDirectory = tractsPopulationDirectory;
UpdateTractPopulationDirectoryDisplay() ;
SyncUiToModelStructure();
}
//***** Select/Unselect Tracts *****//
void AutoTractDerivedWindow::selectTracts(QListWidgetItem* item)
{
if(item->checkState())
{
m_selectedTracts << item->text();
}
else
{
m_selectedTracts.removeAt(m_selectedTracts.indexOf(item->text()));
}
SyncUiToModelStructure();
}
void AutoTractDerivedWindow::UpdateTractPopulationDirectoryDisplay()
{
checkTracts() ;
displayTracts() ;
checkSelectedTracts() ;
}
//***** Display Tracts *****//
void AutoTractDerivedWindow::displayTracts()
{
para_ref_tracts_listWidget->clear();
QStringList::const_iterator it;
int count = 0;
for (it = m_selectedTracts.constBegin(); it != m_selectedTracts.constEnd(); ++it)
{
QListWidgetItem* item = new QListWidgetItem(*it, para_ref_tracts_listWidget);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsSelectable);
item->setCheckState(Qt::Unchecked);count++;
}
}
void AutoTractDerivedWindow::enterTractPopulationDirectory()
{
QString tractPopulationDirectory = para_tracts_dir_lineEdit->text();
if(!tractPopulationDirectory.isEmpty())
{
m_tractPopulationDirectory = para_tracts_dir_lineEdit->text() ;
}
UpdateTractPopulationDirectoryDisplay() ;
SyncUiToModelStructure();
}
void AutoTractDerivedWindow::selectTraficModelDirectory()
{
// QString traficModelDirectory = QFileDialog::getExistingDirectory (this, tr("Open Directory"), para_trafic_model_dir_lineEdit->text(), QFileDialog::ShowDirsOnly);
QString traficModelDirectory = QFileDialog::getOpenFileName (this, tr("Open File"), para_trafic_model_dir_lineEdit->text());
para_trafic_model_dir_lineEdit->setText(traficModelDirectory);
m_traficModelDirectory = traficModelDirectory;
SyncUiToModelStructure();
}
void AutoTractDerivedWindow::enterTraficModelDirectory()
{
QString traficModelDirectory = para_trafic_model_dir_lineEdit->text();
if(!traficModelDirectory.isEmpty())
{
m_traficModelDirectory = para_trafic_model_dir_lineEdit->text() ;
}
SyncUiToModelStructure();
}
void AutoTractDerivedWindow::checkSelectedTracts()
{
QStringList::const_iterator it;
for (it = m_selectedTracts.constBegin(); it != m_selectedTracts.constEnd(); ++it)
{
QList<QListWidgetItem *> items = para_ref_tracts_listWidget->findItems(*it, Qt::MatchExactly);
QList<QListWidgetItem *>::iterator item;
for(item=items.begin(); item!=items.end(); ++item)
{
(*item)->setCheckState(Qt::Checked);
}
}
}
//***** Checking Tracts *****//
void AutoTractDerivedWindow::checkTracts()
{
QDir* m_tractPopulation_dir = new QDir(para_tracts_dir_lineEdit ->text());
QStringList tractPopulation_list = m_tractPopulation_dir->entryList( QDir::Files | QDir::NoSymLinks);
QStringList::const_iterator it;
for (it = tractPopulation_list.constBegin(); it != tractPopulation_list.constEnd(); ++it)
{
if((*it).endsWith(".vtk") || (*it).endsWith(".vtp"))
{
m_selectedTracts << *it;
}
}
}
void AutoTractDerivedWindow::selectOutputDirectory()
{
QString outputDirectory = QFileDialog::getExistingDirectory (this, tr("Open Directory"), para_output_dir_lineEdit->text(), QFileDialog::ShowDirsOnly);
m_para_m->setpara_output_dir_lineEdit( outputDirectory );
SyncModelStructureToUi();
}
void AutoTractDerivedWindow::enterOutputDirectory()
{
QString outputDirectory = para_output_dir_lineEdit->text();
if(!outputDirectory.isEmpty())
{
SyncUiToModelStructure();
}
}
void AutoTractDerivedWindow::changeComputingSystem()
{
SyncUiToModelStructure();
std::vector<QString> ref_tracts;
std::map<std::pair<unsigned long,QString>,bool> ref_tracts_list = m_para_m->getpara_ref_tracts_listWidget();
std::map<std::pair<unsigned long,QString>,bool>::iterator it;
for (it = ref_tracts_list.begin(); it!= ref_tracts_list.end(); it++)
{
if(it->second == 1)
{
ref_tracts.push_back( it->first.second );
}
}
int nb_tracts = ref_tracts.size();
if(m_para_m->getpara_computingSystem_comboBox() == "killdevil")
{
para_nbTractsProcessed_spinBox->setValue(nb_tracts);
para_nbTractsProcessed_spinBox->setDisabled(true);
}
else if(m_para_m->getpara_computingSystem_comboBox() == "local")
{
para_nbTractsProcessed_spinBox->setEnabled(true);
}
}
| 43.884615 | 175 | 0.727589 | [
"vector"
] |
93407cb72ddf3804c7ab36dd3566cd7ea6607023 | 39,010 | cpp | C++ | src/viewer/ImageX.cpp | serserar/ModelConverter | 23e6237a347dc959de191d4cc378defb0a9d044b | [
"MIT"
] | null | null | null | src/viewer/ImageX.cpp | serserar/ModelConverter | 23e6237a347dc959de191d4cc378defb0a9d044b | [
"MIT"
] | null | null | null | src/viewer/ImageX.cpp | serserar/ModelConverter | 23e6237a347dc959de191d4cc378defb0a9d044b | [
"MIT"
] | null | null | null | /* -*- c++ -*- */
/////////////////////////////////////////////////////////////////////////////
//
// Image.cpp -- Copyright (c) 2006 David Henry
// last modification: mar. 2, 2006
//
// This code is licenced under the MIT license.
//
// This software is provided "as is" without express or implied
// warranties. You may freely copy and compile this source into
// applications you distribute provided that the copyright text
// below is included in the resulting source code.
//
// Implementation of image loader classes for DDS, TGA, PCX, JPEG
// and PNG image formats.
//
/////////////////////////////////////////////////////////////////////////////
#include "ImageX.h"
/////////////////////////////////////////////////////////////////////////////
//
// class ImageBuffer implementation.
//
/////////////////////////////////////////////////////////////////////////////
// --------------------------------------------------------------------------
// ImageBuffer::ImageBuffer
//
// Constructor. Load a file into memory buffer.
// --------------------------------------------------------------------------
ImageBuffer::ImageBuffer (const string &filename)
: _filename (filename), _data (NULL), _length (0)
{
// Open file
std::ifstream ifs (filename.c_str(), std::ios::in | std::ios::binary);
if (ifs.fail ())
throw ImageException ("Couldn't open file", filename);
// Get file length
ifs.seekg (0, std::ios::end);
_length = ifs.tellg ();
ifs.seekg (0, std::ios::beg);
try
{
// Allocate memory for holding file data
_data = new GLubyte[_length];
// Read whole file data
ifs.read (reinterpret_cast<char *> (_data), _length);
ifs.close ();
}
catch (...)
{
delete [] _data;
throw;
}
}
// --------------------------------------------------------------------------
// ImageBuffer::~ImageBuffer
//
// Destructor. Free memory buffer.
// --------------------------------------------------------------------------
ImageBuffer::~ImageBuffer ()
{
delete [] _data;
_data = NULL;
}
/////////////////////////////////////////////////////////////////////////////
//
// class Image implementation.
//
/////////////////////////////////////////////////////////////////////////////
// --------------------------------------------------------------------------
// Image::Image
//
// Constructors. Create an image from a pixel buffer. It allows to
// create an image from an other source of data than an ImageBuffer.
// This is also the copy constructor to use if you want pixel data
// to be copied, since the Image(const Image&) constructor is protected.
// --------------------------------------------------------------------------
ImageX::ImageX (const string &name, GLsizei w, GLsizei h, GLint numMipMaps,
GLenum format, GLint components, const GLubyte *pixels,
bool stdCoordSystem)
: _width (w), _height (h), _numMipmaps (numMipMaps),
_format (format), _components (components), _name (name),
_standardCoordSystem (stdCoordSystem)
{
// NOTE: pixels should be a valid pointer. w, h and components
// have to be non-zero positive values.
long size = _width * _height * _components;
if (size <= 0)
throw std::invalid_argument
("Image::Image: Invalid width, height or component value");
if (!pixels)
throw std::invalid_argument
("Image::Image: Invalid pixel data source");
// allocate memory for pixel data
_pixels = new GLubyte[size];
// Copy pixel data from buffer
memcpy (_pixels, pixels, size);
}
// --------------------------------------------------------------------------
// Image::~Image
//
// Destructor. Delete all memory allocated for this object, i.e. pixel
// data.
// --------------------------------------------------------------------------
ImageX::~ImageX ()
{
delete [] _pixels;
_pixels = NULL;
}
// --------------------------------------------------------------------------
// Image::isCompressed
//
// Check if the image is using S3TC compression (this is the case for
// DDS image only).
// --------------------------------------------------------------------------
bool
ImageX::isCompressed () const
{
switch (_format)
{
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
return true;
default:
return false;
}
}
// --------------------------------------------------------------------------
// Image::isPowerOfTwo
//
// Check if the image dimensions are powers of two.
// --------------------------------------------------------------------------
bool
ImageX::isPowerOfTwo () const
{
GLsizei m;
for (m = 1; m < _width; m *= 2)
;
if (m != _width)
return false;
for (m = 1; m < _height; m *= 2)
;
if (m != _height)
return false;
return true;
}
/////////////////////////////////////////////////////////////////////////////
//
// class ImageDDS implementation.
//
/////////////////////////////////////////////////////////////////////////////
// FourCC auto generation with templates
template <char ch0, char ch1, char ch2, char ch3>
struct MakeFourCC
{
enum {
Val =(((ch3 << 24) & 0xFF000000) |
((ch2 << 16) & 0x00FF0000) |
((ch1 << 8) & 0x0000FF00) |
(ch0 & 0x000000FF))
};
};
const unsigned int FOURCC_DXT1 = MakeFourCC<'D', 'X', 'T', '1'>::Val;
const unsigned int FOURCC_DXT3 = MakeFourCC<'D', 'X', 'T', '3'>::Val;
const unsigned int FOURCC_DXT5 = MakeFourCC<'D', 'X', 'T', '5'>::Val;
// --------------------------------------------------------------------------
// ImageDDS::ImageDDS
//
// Constructor. Read a DDS image from memory.
// --------------------------------------------------------------------------
ImageDDS::ImageDDS (const ImageBuffer &ibuff)
: _ddsd (NULL)
{
_name = ibuff.filename ();
// DDS images use the GDI+ coordinate system (starts upper-left corner)
_standardCoordSystem = false;
// There are extensions required for handling compressed DDS
// images as textures
if (!GLEW_ARB_texture_compression)
throw ImageException ("missing GL_ARB_texture_compression"
" extension", _name);
if (!GLEW_EXT_texture_compression_s3tc)
throw ImageException ("missing GL_EXT_texture_compression_s3tc"
" extension", _name);
try
{
// Get pointer on file data
const GLubyte *data_ptr = ibuff.data ();
int bufferSize = ibuff.length ();
// Check if is a valid DDS file
string magic;
magic.assign (reinterpret_cast<const char *>(data_ptr), 4);
if (magic.compare (0, 4, "DDS ") != 0)
throw ImageException ("Not a valid DDS file", _name);
// Eat 4 bytes magic number
data_ptr += 4;
bufferSize -= 4;
// Read the surface descriptor and init some member variables
_ddsd = reinterpret_cast<const DDSurfaceDesc*>(data_ptr);
data_ptr += sizeof (DDSurfaceDesc);
bufferSize -= sizeof (DDSurfaceDesc);
_width = _ddsd->width;
_height = _ddsd->height;
_numMipmaps = _ddsd->mipMapLevels;
switch (_ddsd->format.fourCC)
{
case FOURCC_DXT1:
// DXT1's compression ratio is 8:1
_format = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
_components = 3;
break;
case FOURCC_DXT3:
// DXT3's compression ratio is 4:1
_format = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
_components = 4;
break;
case FOURCC_DXT5:
// DXT5's compression ratio is 4:1
_format = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
_components = 4;
break;
default:
// Bad fourCC, unsupported or bad format
throw ImageException ("Unsupported DXT format", _name);
}
// Read pixel data with mipmaps
_pixels = new GLubyte[bufferSize];
memcpy (_pixels, data_ptr, bufferSize);
}
catch (...)
{
delete [] _pixels;
throw;
}
}
/////////////////////////////////////////////////////////////////////////////
//
// class ImageTGA implementation.
//
/////////////////////////////////////////////////////////////////////////////
// Pixel's component table access
int ImageTGA::rgbaTable[4] = { 2, 1, 0, 3 };
int ImageTGA::bgraTable[4] = { 0, 1, 2, 3 };
// --------------------------------------------------------------------------
// ImageTGA::ImageTGA
//
// Constructor. Read a TGA image from memory.
// --------------------------------------------------------------------------
ImageTGA::ImageTGA (const ImageBuffer &ibuff)
: _header (NULL)
{
const GLubyte *colormap = NULL;
const GLubyte *data_ptr;
try
{
_name = ibuff.filename ();
data_ptr = ibuff.data ();
_standardCoordSystem = true;
// Read TGA header
_header = reinterpret_cast<const TGA_Header *>(data_ptr);
data_ptr += sizeof (TGA_Header) + _header->id_lenght;
// Get image information
getTextureInfo ();
// Memory allocation for pixel data
_pixels = new GLubyte[_width * _height * _components];
// Read color map, if present
if (_header->colormap_type)
{
// NOTE: color map is stored in BGR
colormap = data_ptr;
data_ptr += _header->cm_length * (_header->cm_size >> 3);
}
// Decode image data
switch (_header->image_type)
{
case 0:
// No data
break;
case 1:
// Uncompressed 8 bits color index
readTGA8bits (data_ptr, colormap);
break;
case 2:
// Uncompressed 16-24-32 bits
switch (_header->pixel_depth)
{
case 16:
readTGA16bits (data_ptr);
break;
case 24:
readTGA24bits (data_ptr);
break;
case 32:
readTGA32bits (data_ptr);
break;
}
break;
case 3:
// Uncompressed 8 or 16 bits grayscale
if (_header->pixel_depth == 8)
readTGAgray8bits (data_ptr);
else // 16 bits
readTGAgray16bits (data_ptr);
break;
case 9:
// RLE compressed 8 bits color index
readTGA8bitsRLE (data_ptr, colormap);
break;
case 10:
// RLE compressed 16-24-32 bits
switch (_header->pixel_depth)
{
case 16:
readTGA16bitsRLE (data_ptr);
break;
case 24:
readTGA24bitsRLE (data_ptr);
break;
case 32:
readTGA32bitsRLE (data_ptr);
break;
}
break;
case 11:
// RLE compressed 8 or 16 bits grayscale
if (_header->pixel_depth == 8)
readTGAgray8bitsRLE (data_ptr);
else // 16 bits
readTGAgray16bitsRLE (data_ptr);
break;
default:
// Image type is not correct, free memory and quit
throw ImageException ("Unknown TGA image type", _name);
}
}
catch (...)
{
delete [] _pixels;
throw;
}
}
// --------------------------------------------------------------------------
// ImageTGA::getTextureInfo
//
// Extract OpenGL texture informations from TGA header.
// --------------------------------------------------------------------------
void
ImageTGA::getTextureInfo ()
{
_width = _header->width;
_height = _header->height;
switch (_header->image_type)
{
case 3: // grayscale 8 bits
case 11: // grayscale 8 bits (RLE)
{
if (_header->pixel_depth == 8)
{
_format = GL_LUMINANCE;
_components = 1;
}
else // 16 bits
{
_format = GL_LUMINANCE_ALPHA;
_components = 2;
}
break;
}
case 1: // 8 bits color index
case 2: // BGR 16-24-32 bits
case 9: // 8 bits color index (RLE)
case 10: // BGR 16-24-32 bits (RLE)
{
// 8 bits and 16 bits images will be converted to 24 bits
if (_header->pixel_depth <= 24)
{
_format = GLEW_EXT_bgra ? GL_BGR : GL_RGB;
_components = 3;
}
else // 32 bits
{
_format = GLEW_EXT_bgra ? GL_BGRA : GL_RGBA;
_components = 4;
}
break;
}
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGA8bits
//
// Read 8 bits pixel data from TGA file.
// --------------------------------------------------------------------------
void
ImageTGA::readTGA8bits (const GLubyte *data, const GLubyte *colormap)
{
const GLubyte *pData = data;
int *compTable = GLEW_EXT_bgra ? bgraTable : rgbaTable;
for (int i = 0; i < _width * _height; ++i)
{
// Read index color byte
GLubyte color = *(pData++);
// Convert to BGR/RGB 24 bits
_pixels[(i * 3) + compTable[0]] = colormap[(color * 3) + 0];
_pixels[(i * 3) + compTable[1]] = colormap[(color * 3) + 1];
_pixels[(i * 3) + compTable[2]] = colormap[(color * 3) + 2];
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGA16bits
//
// Read 16 bits pixel data from TGA file.
// --------------------------------------------------------------------------
void
ImageTGA::readTGA16bits (const GLubyte *data)
{
const GLubyte *pData = data;
int *compTable = GLEW_EXT_bgra ? bgraTable : rgbaTable;
for (int i = 0; i < _width * _height; ++i, pData += 2)
{
// Read color word
unsigned short color = pData[0] + (pData[1] << 8);
// convert to BGR/RGB 24 bits
_pixels[(i * 3) + compTable[2]] = (((color & 0x7C00) >> 10) << 3);
_pixels[(i * 3) + compTable[1]] = (((color & 0x03E0) >> 5) << 3);
_pixels[(i * 3) + compTable[0]] = (((color & 0x001F) >> 0) << 3);
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGA24bits
//
// Read 24 bits pixel data from TGA file.
// --------------------------------------------------------------------------
void
ImageTGA::readTGA24bits (const GLubyte *data)
{
if (GLEW_EXT_bgra)
{
memcpy (_pixels, data, _width * _height * 3);
}
else
{
const GLubyte *pData = data;
for (int i = 0; i < _width * _height; ++i)
{
// Read RGB 24 bits pixel
_pixels[(i * 3) + rgbaTable[0]] = *(pData++);
_pixels[(i * 3) + rgbaTable[1]] = *(pData++);
_pixels[(i * 3) + rgbaTable[2]] = *(pData++);
}
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGA32bits
//
// Read 32 bits pixel data from TGA file.
// --------------------------------------------------------------------------
void
ImageTGA::readTGA32bits (const GLubyte *data)
{
if (GLEW_EXT_bgra)
{
memcpy (_pixels, data, _width * _height * 4);
}
else
{
const GLubyte *pData = data;
for (int i = 0; i < _width * _height; ++i)
{
// Read RGB 32 bits pixel
_pixels[(i * 4) + rgbaTable[0]] = *(pData++);
_pixels[(i * 4) + rgbaTable[1]] = *(pData++);
_pixels[(i * 4) + rgbaTable[2]] = *(pData++);
_pixels[(i * 4) + rgbaTable[3]] = *(pData++);
}
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGAgray8bits
//
// Read grey 8 bits pixel data from TGA file.
// --------------------------------------------------------------------------
void
ImageTGA::readTGAgray8bits (const GLubyte *data)
{
memcpy (_pixels, data, _width * _height);
}
// --------------------------------------------------------------------------
// ImageTGA::readTGAgray16bits
//
// Read grey 16 bits pixel data from TGA file.
// --------------------------------------------------------------------------
void
ImageTGA::readTGAgray16bits (const GLubyte *data)
{
memcpy (_pixels, data, _width * _height * 2);
}
// --------------------------------------------------------------------------
// ImageTGA::readTGA8bitsRLE
//
// Read 8 bits pixel data from TGA file with RLE compression.
// --------------------------------------------------------------------------
void
ImageTGA::readTGA8bitsRLE (const GLubyte *data, const GLubyte *colormap)
{
GLubyte *ptr = _pixels;
const GLubyte *pData = data;
int *compTable = GLEW_EXT_bgra ? bgraTable : rgbaTable;
while (ptr < _pixels + (_width * _height) * 3)
{
// Read first byte
GLubyte packet_header = *(pData++);
int size = 1 + (packet_header & 0x7f);
if (packet_header & 0x80)
{
// Run-length packet
GLubyte color = *(pData++);
for (int i = 0; i < size; ++i, ptr += 3)
{
ptr[0] = colormap[(color * 3) + compTable[0]];
ptr[1] = colormap[(color * 3) + compTable[1]];
ptr[2] = colormap[(color * 3) + compTable[2]];
}
}
else
{
// Non run-length packet
for (int i = 0; i < size; ++i, ptr += 3)
{
GLubyte color = *(pData++);
ptr[0] = colormap[(color * 3) + compTable[0]];
ptr[1] = colormap[(color * 3) + compTable[1]];
ptr[2] = colormap[(color * 3) + compTable[2]];
}
}
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGA16bitsRLE
//
// Read 16 bits pixel data from TGA file with RLE compression.
// --------------------------------------------------------------------------
void
ImageTGA::readTGA16bitsRLE (const GLubyte *data)
{
const GLubyte *pData = data;
GLubyte *ptr = _pixels;
int *compTable = GLEW_EXT_bgra ? bgraTable : rgbaTable;
while (ptr < _pixels + (_width * _height) * 3)
{
// Read first byte
GLubyte packet_header = *(pData++);
int size = 1 + (packet_header & 0x7f);
if (packet_header & 0x80)
{
// Run-length packet
unsigned short color = pData[0] + (pData[1] << 8);
pData += 2;
for (int i = 0; i < size; ++i, ptr += 3)
{
ptr[compTable[2]] = (((color & 0x7C00) >> 10) << 3);
ptr[compTable[1]] = (((color & 0x03E0) >> 5) << 3);
ptr[compTable[0]] = (((color & 0x001F) >> 0) << 3);
}
}
else
{
// Non run-length packet
for (int i = 0; i < size; ++i, ptr += 3)
{
unsigned short color = pData[0] + (pData[1] << 8);
pData += 2;
ptr[compTable[2]] = (((color & 0x7C00) >> 10) << 3);
ptr[compTable[1]] = (((color & 0x03E0) >> 5) << 3);
ptr[compTable[0]] = (((color & 0x001F) >> 0) << 3);
}
}
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGA24bitsRLE
//
// Read 24 bits pixel data from TGA file with RLE compression.
// --------------------------------------------------------------------------
void
ImageTGA::readTGA24bitsRLE (const GLubyte *data)
{
const GLubyte *pData = data;
GLubyte *ptr = _pixels;
int *compTable = GLEW_EXT_bgra ? bgraTable : rgbaTable;
while (ptr < _pixels + (_width * _height) * 3)
{
// Read first byte
GLubyte packet_header = *(pData++);
int size = 1 + (packet_header & 0x7f);
if (packet_header & 0x80)
{
// Run-length packet
for (int i = 0; i < size; ++i, ptr += 3)
{
ptr[0] = pData[compTable[0]];
ptr[1] = pData[compTable[1]];
ptr[2] = pData[compTable[2]];
}
pData += 3;
}
else
{
// Non run-length packet
for (int i = 0; i < size; ++i, ptr += 3)
{
ptr[0] = pData[compTable[0]];
ptr[1] = pData[compTable[1]];
ptr[2] = pData[compTable[2]];
pData += 3;
}
}
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGA32bitsRLE
//
// Read 32 bits pixel data from TGA file with RLE compression.
// --------------------------------------------------------------------------
void
ImageTGA::readTGA32bitsRLE (const GLubyte *data)
{
const GLubyte *pData = data;
GLubyte *ptr = _pixels;
int *compTable = GLEW_EXT_bgra ? bgraTable : rgbaTable;
while (ptr < _pixels + (_width * _height) * 4)
{
// Read first byte
GLubyte packet_header = *(pData++);
int size = 1 + (packet_header & 0x7f);
if (packet_header & 0x80)
{
// Run-length packet */
for (int i = 0; i < size; ++i, ptr += 4)
{
ptr[0] = pData[compTable[0]];
ptr[1] = pData[compTable[1]];
ptr[2] = pData[compTable[2]];
ptr[3] = pData[compTable[3]];
}
pData += 4;
}
else
{
// Non run-length packet
for (int i = 0; i < size; ++i, ptr += 4)
{
ptr[0] = pData[compTable[0]];
ptr[1] = pData[compTable[1]];
ptr[2] = pData[compTable[2]];
ptr[3] = pData[compTable[3]];
pData += 4;
}
}
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGAgray8bitsRLE
//
// Read grey 8 bits pixel data from TGA file with RLE compression.
// --------------------------------------------------------------------------
void
ImageTGA::readTGAgray8bitsRLE (const GLubyte *data)
{
const GLubyte *pData = data;
GLubyte *ptr = _pixels;
while (ptr < _pixels + (_width * _height))
{
// Read first byte
GLubyte packet_header = *(pData++);
int size = 1 + (packet_header & 0x7f);
if (packet_header & 0x80)
{
// Run-length packet
GLubyte color = *(pData++);
memset (ptr, color, size);
ptr += size;
}
else
{
// Non run-length packet
memcpy (ptr, pData, size);
ptr += size;
pData += size;
}
}
}
// --------------------------------------------------------------------------
// ImageTGA::readTGAgray16bitsRLE
//
// Read grey 16 bits pixel data from TGA file with RLE compression.
// --------------------------------------------------------------------------
void
ImageTGA::readTGAgray16bitsRLE (const GLubyte *data)
{
const GLubyte *pData = data;
GLubyte *ptr = _pixels;
while (ptr < _pixels + (_width * _height) * 2)
{
// Read first byte
GLubyte packet_header = *(pData++);
int size = 1 + (packet_header & 0x7f);
if (packet_header & 0x80)
{
// Run-length packet
GLubyte color = *(pData++);
GLubyte alpha = *(pData++);
for (int i = 0; i < size; ++i, ptr += 2)
{
ptr[0] = color;
ptr[1] = alpha;
}
}
else
{
// Non run-length packet
memcpy (ptr, pData, size * 2);
ptr += size * 2;
pData += size * 2;
}
}
}
/////////////////////////////////////////////////////////////////////////////
//
// class ImagePCX implementation.
//
/////////////////////////////////////////////////////////////////////////////
// Pixel's component table access
int ImagePCX::rgbTable[3] = { 0, 1, 2 };
int ImagePCX::bgrTable[3] = { 2, 1, 0 };
// --------------------------------------------------------------------------
// ImagePCX::ImagePCX
//
// Constructor. Read a PCX image from memory.
// --------------------------------------------------------------------------
ImagePCX::ImagePCX (const ImageBuffer &ibuff)
: _header (NULL)
{
const GLubyte *data_ptr;
try
{
_name = ibuff.filename ();
_standardCoordSystem = true;
// Get pointer on file data
data_ptr = ibuff.data ();
// Read PCX header
_header = reinterpret_cast<const PCX_Header *>(data_ptr);
data_ptr += sizeof (PCX_Header);
// Check if is valid PCX file
if (_header->manufacturer != 0x0a)
throw ImageException ("Bad version number", _name);
// Initialize image variables
_width = _header->xmax - _header->xmin + 1;
_height = _header->ymax - _header->ymin + 1;
_format = GLEW_EXT_bgra ? GL_BGR : GL_RGB;
_components = 3;
_pixels = new GLubyte[_width * _height * _components];
int bitcount = _header->bitsPerPixel * _header->numColorPlanes;
int palette_pos = ibuff.length () - 768;
// Read image data
switch (bitcount)
{
case 1:
// 1 bit color index
readPCX1bit (data_ptr);
break;
case 4:
// 4 bits color index
readPCX4bits (data_ptr);
break;
case 8:
// 8 bits color index
readPCX8bits (data_ptr, ibuff.data () + palette_pos);
break;
case 24:
// 24 bits
readPCX24bits (data_ptr);
break;
default:
// Unsupported
throw ImageException ("Unhandled PCX format (bad bitcount)", _name);
}
}
catch (...)
{
delete [] _pixels;
throw;
}
}
// --------------------------------------------------------------------------
// ImagePCX::readPCX1bit
//
// Read 1 bit PCX image.
// --------------------------------------------------------------------------
void
ImagePCX::readPCX1bit (const GLubyte *data)
{
int rle_count = 0, rle_value = 0;
const GLubyte *pData = data;
GLubyte *ptr = _pixels;
int *compTable = GLEW_EXT_bgra ? bgrTable : rgbTable;
for (int y = 0; y < _height; ++y)
{
ptr = &_pixels[(_height - (y + 1)) * _width * 3];
int bytes = _header->bytesPerScanLine;
// Decode line number y
while (bytes--)
{
if (rle_count == 0)
{
if ( (rle_value = *(pData++)) < 0xc0)
{
rle_count = 1;
}
else
{
rle_count = rle_value - 0xc0;
rle_value = *(pData++);
}
}
rle_count--;
// Fill height pixels chunk
for (int i = 7; i >= 0; --i, ptr += 3)
{
int colorIndex = ((rle_value & (1 << i)) > 0);
ptr[0] = _header->palette[colorIndex * 3 + compTable[0]];
ptr[1] = _header->palette[colorIndex * 3 + compTable[1]];
ptr[2] = _header->palette[colorIndex * 3 + compTable[2]];
}
}
}
}
// --------------------------------------------------------------------------
// ImagePCX::readPCX4bits
//
// Read 4 bits PCX image.
// --------------------------------------------------------------------------
void
ImagePCX::readPCX4bits (const GLubyte *data)
{
const GLubyte *pData = data;
GLubyte *colorIndex = NULL;
GLubyte *line = NULL;
GLubyte *ptr;
int rle_count = 0, rle_value = 0;
int *compTable = GLEW_EXT_bgra ? bgrTable : rgbTable;
try
{
// Memory allocation for temporary buffers
colorIndex = new GLubyte[_width];
line = new GLubyte[_header->bytesPerScanLine];
}
catch (std::bad_alloc &err)
{
delete [] colorIndex;
delete [] line;
throw;
}
for (int y = 0; y < _height; ++y)
{
ptr = &_pixels[(_height - (y + 1)) * _width * 3];
memset (colorIndex, 0, _width);
for (int c = 0; c < 4; ++c)
{
GLubyte *pLine = line;
int bytes = _header->bytesPerScanLine;
// Decode line number y
while (bytes--)
{
if (rle_count == 0)
{
if ( (rle_value = *(pData++)) < 0xc0)
{
rle_count = 1;
}
else
{
rle_count = rle_value - 0xc0;
rle_value = *(pData++);
}
}
rle_count--;
*(pLine++) = rle_value;
}
// Compute line's color indexes
for (int x = 0; x < _width; ++x)
{
if (line[x / 8] & (128 >> (x % 8)))
colorIndex[x] += (1 << c);
}
}
// Decode scanline. color index => rgb
for (int x = 0; x < _width; ++x, ptr += 3)
{
ptr[0] = _header->palette[colorIndex[x] * 3 + compTable[0]];
ptr[1] = _header->palette[colorIndex[x] * 3 + compTable[1]];
ptr[2] = _header->palette[colorIndex[x] * 3 + compTable[2]];
}
}
// Release memory
delete [] colorIndex;
delete [] line;
}
// --------------------------------------------------------------------------
// ImagePCX::readPCX8bits
//
// Read 8 bits PCX image.
// --------------------------------------------------------------------------
void
ImagePCX::readPCX8bits (const GLubyte *data, const GLubyte *palette)
{
const GLubyte *pData = data;
int rle_count = 0, rle_value = 0;
GLubyte *ptr;
int *compTable = GLEW_EXT_bgra ? bgrTable : rgbTable;
// Palette should be preceded by a value of 0x0c (12)...
GLubyte magic = palette[-1];
if (magic != 0x0c)
{
// ... but sometimes it is not
std::cerr << "Warning: PCX palette should start with "
<< "a value of 0x0c (12)!" << std::endl;
}
// Read pixel data
for (int y = 0; y < _height; ++y)
{
ptr = &_pixels[(_height - (y + 1)) * _width * 3];
int bytes = _header->bytesPerScanLine;
// Decode line number y
while (bytes--)
{
if (rle_count == 0)
{
if( (rle_value = *(pData++)) < 0xc0)
{
rle_count = 1;
}
else
{
rle_count = rle_value - 0xc0;
rle_value = *(pData++);
}
}
rle_count--;
ptr[0] = palette[rle_value * 3 + compTable[0]];
ptr[1] = palette[rle_value * 3 + compTable[1]];
ptr[2] = palette[rle_value * 3 + compTable[2]];
ptr += 3;
}
}
}
// --------------------------------------------------------------------------
// ImagePCX::readPCX24bits
//
// Read 24 bits PCX image.
// --------------------------------------------------------------------------
void
ImagePCX::readPCX24bits (const GLubyte *data)
{
const GLubyte *pData = data;
GLubyte *ptr;
int rle_count = 0, rle_value = 0;
int *compTable = GLEW_EXT_bgra ? bgrTable : rgbTable;
for (int y = 0; y < _height; ++y)
{
// For each color plane
for (int c = 0; c < 3; ++c)
{
ptr = &_pixels[(_height - (y + 1)) * _width * 3];
int bytes = _header->bytesPerScanLine;
// Decode line number y
while (bytes--)
{
if (rle_count == 0)
{
if( (rle_value = *(pData++)) < 0xc0)
{
rle_count = 1;
}
else
{
rle_count = rle_value - 0xc0;
rle_value = *(pData++);
}
}
rle_count--;
ptr[compTable[c]] = static_cast<GLubyte>(rle_value);
ptr += 3;
}
}
}
}
/////////////////////////////////////////////////////////////////////////////
//
// class ImageJPEG implementation.
//
/////////////////////////////////////////////////////////////////////////////
// --------------------------------------------------------------------------
// ImageJPEG::ImageJPEG
//
// Constructor. Read a JPEG image from memory, using libjpeg.
// --------------------------------------------------------------------------
ImageJPEG::ImageJPEG (const ImageBuffer &ibuff)
{
jpeg_decompress_struct cinfo;
my_error_mgr jerr;
jpeg_source_mgr jsrc;
JSAMPROW j;
try
{
_name = ibuff.filename ();
_standardCoordSystem = true;
// Create and configure decompress object
jpeg_create_decompress (&cinfo);
cinfo.err = jpeg_std_error (&jerr.pub);
cinfo.src = &jsrc;
// Configure error manager
jerr.pub.error_exit = errorExit_callback;
jerr.pub.output_message = outputMessage_callback;
if (setjmp (jerr.setjmp_buffer))
throw ImageException (jerr.errorMsg, _name);
// Configure source manager
jsrc.next_input_byte = ibuff.data ();
jsrc.bytes_in_buffer = ibuff.length ();
jsrc.init_source = initSource_callback;
jsrc.fill_input_buffer = fillInputBuffer_callback;
jsrc.skip_input_data = skipInputData_callback;
jsrc.resync_to_restart = jpeg_resync_to_restart;
jsrc.term_source = termSource_callback;
// Read file's header and prepare for decompression
jpeg_read_header (&cinfo, TRUE);
jpeg_start_decompress (&cinfo);
// Initialize image's member variables
_width = cinfo.image_width;
_height = cinfo.image_height;
_components = cinfo.num_components;
_format = (cinfo.num_components == 1) ? GL_LUMINANCE : GL_RGB;
_pixels = new GLubyte[_width * _height * _components];
// Read scanlines
for (int i = 0; i < _height; ++i)
{
//j = &_pixels[_width * i * _components];
j = (_pixels + ((_height - (i + 1)) * _width * _components));
jpeg_read_scanlines (&cinfo, &j, 1);
}
// Finish decompression and release memory
jpeg_finish_decompress (&cinfo);
jpeg_destroy_decompress (&cinfo);
}
catch (...)
{
delete [] _pixels;
jpeg_destroy_decompress (&cinfo);
throw;
}
}
// --------------------------------------------------------------------------
// ImageJPEG::initSource_callback
// ImageJPEG::fillInputBuffer_callback
// ImageJPEG::skipInputData_callback
// ImageJPEG::termSource_callback
//
// Callback functions used by libjpeg for reading data from memory.
// --------------------------------------------------------------------------
void
ImageJPEG::initSource_callback (j_decompress_ptr cinfo)
{
// Nothing to do here
}
boolean
ImageJPEG::fillInputBuffer_callback (j_decompress_ptr cinfo)
{
JOCTET eoi_buffer[2] = { 0xFF, JPEG_EOI };
struct jpeg_source_mgr *jsrc = cinfo->src;
// Create a fake EOI marker
jsrc->next_input_byte = eoi_buffer;
jsrc->bytes_in_buffer = 2;
return TRUE;
}
void
ImageJPEG::skipInputData_callback (j_decompress_ptr cinfo, long num_bytes)
{
struct jpeg_source_mgr *jsrc = cinfo->src;
if (num_bytes > 0)
{
while (num_bytes > static_cast<long>(jsrc->bytes_in_buffer))
{
num_bytes -= static_cast<long>(jsrc->bytes_in_buffer);
fillInputBuffer_callback (cinfo);
}
jsrc->next_input_byte += num_bytes;
jsrc->bytes_in_buffer -= num_bytes;
}
}
void
ImageJPEG::termSource_callback (j_decompress_ptr cinfo)
{
// Nothing to do here
}
// --------------------------------------------------------------------------
// ImageJPEG::errorExit
// ImageJPEG::outputMessage
//
// Callback functions used by libjpeg for error handling.
// --------------------------------------------------------------------------
void
ImageJPEG::errorExit_callback (j_common_ptr cinfo)
{
my_error_ptr jerr = reinterpret_cast<my_error_ptr>(cinfo->err);
// Create the error message
char message[JMSG_LENGTH_MAX];
(*cinfo->err->format_message) (cinfo, message);
jerr->errorMsg.assign (message);
// Return control to the setjmp point
longjmp (jerr->setjmp_buffer, 1);
}
void
ImageJPEG::outputMessage_callback (j_common_ptr cinfo)
{
my_error_ptr jerr = reinterpret_cast<my_error_ptr>(cinfo->err);
// Create the error message
char message[JMSG_LENGTH_MAX];
(*cinfo->err->format_message) (cinfo, message);
jerr->errorMsg.assign (message);
// Send it to stderr, adding a newline
std::cerr << "libjpeg: " << jerr->errorMsg << std::endl;
}
/////////////////////////////////////////////////////////////////////////////
//
// class ImagePNG implementation.
//
/////////////////////////////////////////////////////////////////////////////
// --------------------------------------------------------------------------
// ImagePNG::ImagePNG
//
// Constructor. Read a PNG image from memory, using libpng.
// --------------------------------------------------------------------------
ImagePNG::ImagePNG (const ImageBuffer &ibuff)
{
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
png_bytep *row_pointers = NULL;
int bit_depth, color_type;
my_source_mgr src_mgr (ibuff);
try
{
_name = ibuff.filename ();
_standardCoordSystem = true;
png_byte sig[8];
memcpy (sig, reinterpret_cast<const png_byte*>(ibuff.data ()), 8);
// Check for valid magic number
if (!png_check_sig (sig, 8))
throw ImageException ("Not a valid PNG file", _name);
// Create PNG read struct
png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, &errorMsg,
error_callback, warning_callback);
if (!png_ptr)
throw ImageException ("Failed to create png read struct", _name);
if (setjmp (png_jmpbuf (png_ptr)))
throw ImageException (errorMsg, _name);
// Create PNG info struct
info_ptr = png_create_info_struct (png_ptr);
if (!info_ptr)
throw ImageException ("Failed to create png info struct", _name);
// Set "read" callback function and give source of data
png_set_read_fn (png_ptr, &src_mgr, read_callback);
// Read png info
png_read_info (png_ptr, info_ptr);
// Get some usefull information from header
bit_depth = png_get_bit_depth (png_ptr, info_ptr);
color_type = png_get_color_type (png_ptr, info_ptr);
// Convert index color images to RGB images
if (color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb (png_ptr);
// Convert 1-2-4 bits grayscale images to 8 bits
// grayscale.
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_expand_gray_1_2_4_to_8 (png_ptr);
if (png_get_valid (png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_tRNS_to_alpha (png_ptr);
if (bit_depth == 16)
png_set_strip_16 (png_ptr);
else if (bit_depth < 8)
png_set_packing (png_ptr);
// Update info structure to apply transformations
png_read_update_info (png_ptr, info_ptr);
// Get updated information
png_get_IHDR (png_ptr, info_ptr,
reinterpret_cast<png_uint_32*>(&_width),
reinterpret_cast<png_uint_32*>(&_height),
&bit_depth, &color_type,
NULL, NULL, NULL);
// Get image format and components per pixel
getTextureInfo (color_type);
// Memory allocation for storing pixel data
_pixels = new GLubyte[_width * _height * _components];
// Pointer array. Each one points at the begening of a row.
row_pointers = new png_bytep[_height];
for (int i = 0; i < _height; ++i)
{
row_pointers[i] = (png_bytep)(_pixels +
((_height - (i + 1)) * _width * _components));
}
// Read pixel data using row pointers
png_read_image (png_ptr, row_pointers);
// Finish decompression and release memory
png_read_end (png_ptr, NULL);
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
delete [] row_pointers;
}
catch (...)
{
delete [] _pixels;
delete [] row_pointers;
if (png_ptr)
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
throw;
}
}
// --------------------------------------------------------------------------
// ImagePNG::getTextureInfo
//
// Extract OpenGL texture informations from PNG info.
// --------------------------------------------------------------------------
void
ImagePNG::getTextureInfo (int color_type)
{
switch (color_type)
{
case PNG_COLOR_TYPE_GRAY:
_format = GL_LUMINANCE;
_components = 1;
break;
case PNG_COLOR_TYPE_GRAY_ALPHA:
_format = GL_LUMINANCE_ALPHA;
_components = 2;
break;
case PNG_COLOR_TYPE_RGB:
_format = GL_RGB;
_components = 3;
break;
case PNG_COLOR_TYPE_RGB_ALPHA:
_format = GL_RGBA;
_components = 4;
break;
default:
// Badness
throw ImageException ("Bad PNG color type", _name);
}
}
// --------------------------------------------------------------------------
// ImagePNG::read_callback
// ImagePNG::error_callback
// ImagePNG::warning_callback
//
// Callback functions used by libpng for reading data from memory
// and error handling.
// --------------------------------------------------------------------------
void
ImagePNG::read_callback (png_structp png_ptr, png_bytep data, png_size_t length)
{
my_source_ptr src = static_cast<my_source_ptr>(png_get_io_ptr(png_ptr));
// Copy data from image buffer
memcpy (data, src->pibuff->data () + src->offset, length);
// Advance in the file
src->offset += length;
}
void
ImagePNG::error_callback (png_structp png_ptr, png_const_charp error_msg)
{
static_cast<string *>(png_get_error_ptr(png_ptr))->assign (error_msg);
longjmp (png_jmpbuf (png_ptr), 1);
}
void
ImagePNG::warning_callback (png_structp png_ptr, png_const_charp warning_msg)
{
std::cerr << "libpng: " << warning_msg << std::endl;
}
| 24.894703 | 80 | 0.516483 | [
"object"
] |
934369725360f86236bf78d66024d7230618ade0 | 2,690 | hpp | C++ | Extensions/ZilchShaders/BaseShaderTranslator.hpp | RachelWilSingh/ZeroCore | e9a2f82d395e5c89fb98eceac44ce60d016dbff3 | [
"MIT"
] | 52 | 2018-09-11T17:18:35.000Z | 2022-03-13T15:28:21.000Z | Extensions/ZilchShaders/BaseShaderTranslator.hpp | RachelWilSingh/ZeroCore | e9a2f82d395e5c89fb98eceac44ce60d016dbff3 | [
"MIT"
] | 1,409 | 2018-09-19T18:03:43.000Z | 2021-06-09T08:33:33.000Z | Extensions/ZilchShaders/BaseShaderTranslator.hpp | RachelWilSingh/ZeroCore | e9a2f82d395e5c89fb98eceac44ce60d016dbff3 | [
"MIT"
] | 26 | 2018-09-11T17:16:32.000Z | 2021-11-22T06:21:19.000Z | ///////////////////////////////////////////////////////////////////////////////
///
/// Authors: Joshua Davis
/// Copyright 2015, DigiPen Institute of Technology
///
///////////////////////////////////////////////////////////////////////////////
#pragma once
namespace Zero
{
//-------------------------------------------------------------------BaseShaderTranslator
// Base shader translator class so other translators can be implemented.
// @JoshD: Make this interface better!
class BaseShaderTranslator
{
public:
virtual ~BaseShaderTranslator() {};
// Tell the translator what settings to use for translation (Names, render targets, etc...)
virtual void SetSettings(ZilchShaderSettingsRef& settings) = 0;
virtual void Setup() = 0;
// A string to describe the target language. Used currently just for unit tests.
virtual String GetFullLanguageString() = 0;
// Parse a native and generate type information (mainly shader types) to populate the ShaderLibrary with.
virtual void ParseNativeLibrary(ZilchShaderLibrary* shaderLibrary) = 0;
// Translate a given project (and it's syntax tree) into the passed in library. Each ShaderType in the
// library will contain translated pieces of the target language. These pieces can be put together into a final shader with "BuildFinalShader".
virtual bool Translate(Zilch::SyntaxTree& syntaxTree, ZilchShaderProject* project, ZilchShaderLibraryRef& libraryRef) = 0;
// Determines if this shader type is supported for translation (such as geometry shaders).
virtual bool SupportsFragmentType(ShaderType* shaderType) = 0;
// Given a ShaderType, build the string for the shader that results from calling the given type's [Main] function.
// This can also build range mappings from the final shader back to each zilch script to help display the source of errors,
// but this is off by default for performance reasons. When an error occurs a shader type can be re-translated to this time
// with line number mappings (errors are exceptional cases after all). Also for debugging this can choose to only translate
// the type and not all dependencies.
virtual void BuildFinalShader(ShaderType* type, ShaderTypeTranslation& shaderResult, bool generatedCodeRangeMappings = false, bool walkDependencies = true) = 0;
// Returns the language version of the translator. Used to conditionally write code.
virtual int GetLanguageVersionNumber() = 0;
// Returns the name of the language that this translator is for
virtual String GetLanguageName() = 0;
// An intrusive reference count for memory handling
ZilchRefLink(BaseShaderTranslator);
};
}//namespace Zero
| 54.897959 | 163 | 0.693309 | [
"geometry",
"render"
] |
93439307ca0cc1448946aa4bb64491e513d5d54a | 2,730 | hpp | C++ | paperbird/src/applicationui.hpp | BerryTrucks/PaperBird | 7ab14b7c473085d15429a30d2dc6b107aea2b633 | [
"MIT"
] | null | null | null | paperbird/src/applicationui.hpp | BerryTrucks/PaperBird | 7ab14b7c473085d15429a30d2dc6b107aea2b633 | [
"MIT"
] | null | null | null | paperbird/src/applicationui.hpp | BerryTrucks/PaperBird | 7ab14b7c473085d15429a30d2dc6b107aea2b633 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2011-2015 BlackBerry Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_
#include <QObject>
#include <bb/data/SqlConnection>
#include <QtSql/QtSql>
#include <QDate>
#include <bb/cascades/InvokeQuery>
#include <bb/cascades/Invocation>
#include <bb/system/InvokeRequest>
#include <bb/system/InvokeManager>
namespace bb
{
namespace cascades
{
class LocaleHandler;
}
}
using namespace bb::data;
class QTranslator;
/*!
* @brief Application UI object
*
* Use this object to create and init app UI, to create context objects, to register the new meta types etc.
*/
class ApplicationUI : public QObject
{
Q_OBJECT
public:
Q_INVOKABLE static void setv(const QString &objectName, const QString &inputValue);
Q_INVOKABLE static QString getv(const QString &objectName, const QString &defaultValue);
Q_INVOKABLE void appendHistory(const QString &title, const QString &uri);
Q_INVOKABLE void updateHistoryByURI(const QString &title, const QString &uri);
Q_INVOKABLE bool clearHistories();
Q_INVOKABLE QString getAbPath();
Q_INVOKABLE void deleteHistoryBySet(QString historyIDs);
Q_INVOKABLE void shareText(QString text);
Q_INVOKABLE void openWith(QString text);
Q_INVOKABLE bool removeBookmarkBySet(const QString &ids);
Q_INVOKABLE bool clearBookmarks();
Q_INVOKABLE bool clearSettings();
Q_INVOKABLE bool addBookmark(const QString &title, const QString &uri);
Q_INVOKABLE bool updateBookmarkByID(const QString &bid, const QString &title, const QString &uri);
Q_INVOKABLE QString getClipboard();
ApplicationUI();
~ApplicationUI();
Q_SLOT void onInvoke(const bb::system::InvokeRequest& invoke);
Q_SIGNAL void open_a_new_tab_for_me(QString target);
private slots:
void onSystemLanguageChanged();
void onArmed();
void onFinished();
void onOPENArmed();
private:
QTranslator* m_pTranslator;
bb::cascades::LocaleHandler* m_pLocaleHandler;
// The connection to the SQL database
bb::data::SqlConnection* m_sqlConnection;
bool db_ready;
bool initDatabase();
bool initTables();
};
#endif /* ApplicationUI_HPP_ */
| 33.292683 | 108 | 0.743223 | [
"object"
] |
934544240451ac3e2cc795965c020a57362f8e96 | 7,118 | cpp | C++ | robot/src/vision_to_mavros/src/t265_fisheye_undistort.cpp | mikobski/Robot-Inspekcyjny | 925491fc43b71bdaa54dccf60d38da59d244181d | [
"Apache-2.0"
] | null | null | null | robot/src/vision_to_mavros/src/t265_fisheye_undistort.cpp | mikobski/Robot-Inspekcyjny | 925491fc43b71bdaa54dccf60d38da59d244181d | [
"Apache-2.0"
] | 6 | 2020-08-19T21:21:58.000Z | 2020-10-05T13:33:19.000Z | robot/src/vision_to_mavros/src/t265_fisheye_undistort.cpp | mikobski/Critbot | 925491fc43b71bdaa54dccf60d38da59d244181d | [
"Apache-2.0"
] | null | null | null | #include <ros/ros.h>
#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
enum class CameraSide { LEFT, RIGHT };
//////////////////////////////////////////////////
// Declare all the calibration matrices as Mat variables.
//////////////////////////////////////////////////
Mat lmapx, lmapy, rmapx, rmapy;
image_transport::Publisher pub_img_rect_left, pub_img_rect_right;
sensor_msgs::CameraInfo output_camera_info_left, output_camera_info_right;
ros::Publisher left_camera_info_output_pub, right_camera_info_output_pub;
//////////////////////////////////////////////////
// This function computes all the projection matrices and the rectification transformations
// using the stereoRectify and initUndistortRectifyMap functions respectively.
// See documentation for stereoRectify: https://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html#stereorectify
//////////////////////////////////////////////////
void init_rectification_map(string param_file_path)
{
Mat Q, P1, P2;
Mat R1, R2, K1, K2, D1, D2, R;
Vec3d T;
Vec2d size_input, size_output;
FileStorage param_file = FileStorage(param_file_path, FileStorage::READ);
param_file["K1"] >> K1;
param_file["D1"] >> D1;
param_file["K2"] >> K2;
param_file["D2"] >> D2;
param_file["R"] >> R;
param_file["T"] >> T;
param_file["input"] >> size_input;
param_file["output"] >> size_output;
// The resolution of the input images used for stereo calibration.
Size input_img_size(size_input[0], size_input[1]);
// The resolution of the output rectified images. Lower resolution images require less computation time.
Size output_img_size(size_output[0], size_output[1]);
double alpha = 0.0;
stereoRectify(K1, D1, K2, D2,
input_img_size,
R, T,
R1, R2, P1, P2,
Q,
CV_CALIB_ZERO_DISPARITY,
alpha,
output_img_size);
fisheye::initUndistortRectifyMap(K1, D1, R1, P1, output_img_size, CV_32FC1, lmapx, lmapy);
fisheye::initUndistortRectifyMap(K2, D2, R2, P2, output_img_size, CV_32FC1, rmapx, rmapy);
// Copy the parameters for rectified images to the camera_info messages
output_camera_info_left.width = size_output[0];
output_camera_info_left.height = size_output[1];
output_camera_info_left.D = vector<double>(5, 0);
output_camera_info_right.width = size_output[0];
output_camera_info_right.height = size_output[1];
output_camera_info_right.D = vector<double>(5, 0);
for (int i = 0; i < 9; i++)
{
output_camera_info_left.K[i] = K1.at<double>(i);
output_camera_info_right.K[i] = K2.at<double>(i);
output_camera_info_left.R[i] = R1.at<double>(i);
output_camera_info_right.R[i] = R2.at<double>(i);
}
for (int i = 0; i < 12; i++)
{
output_camera_info_left.P[i] = P1.at<double>(i);
output_camera_info_right.P[i] = P2.at<double>(i);
}
ROS_INFO("Initialization complete. Publishing rectified images and camera_info when raw images arrive...");
}
//////////////////////////////////////////////////
// This function undistorts and rectifies the src image into dst.
// The homographic mappings lmapx, lmapy, rmapx, and rmapy are found from OpenCV’s initUndistortRectifyMap function.
//////////////////////////////////////////////////
void undistort_rectify_image(Mat& src, Mat& dst, const CameraSide& side)
{
if (side == CameraSide::LEFT)
{
remap(src, dst, lmapx, lmapy, cv::INTER_LINEAR);
}
else
{
remap(src, dst, rmapx, rmapy, cv::INTER_LINEAR);
}
}
//////////////////////////////////////////////////
// This callback function takes a pair of raw stereo images as inputs,
// then undistorts and rectifies the images using the undistort_rectify_image function
// defined above and publishes on the rectified image topic using pub_img_left/right.
//////////////////////////////////////////////////
void synched_img_callback(const sensor_msgs::ImageConstPtr& msg_left, const sensor_msgs::ImageConstPtr& msg_right)
{
Mat tmp_left = cv_bridge::toCvShare(msg_left, "bgr8")->image;
Mat tmp_right = cv_bridge::toCvShare(msg_right, "bgr8")->image;
Mat dst_left, dst_right;
undistort_rectify_image(tmp_left, dst_left, CameraSide::LEFT);
undistort_rectify_image(tmp_right, dst_right, CameraSide::RIGHT);
sensor_msgs::ImagePtr rect_img_left = cv_bridge::CvImage(msg_left->header, "bgr8", dst_left).toImageMsg();
sensor_msgs::ImagePtr rect_img_right = cv_bridge::CvImage(msg_right->header, "bgr8", dst_right).toImageMsg();
pub_img_rect_left.publish(rect_img_left);
pub_img_rect_right.publish(rect_img_right);
std_msgs::Header header = msg_left->header;
output_camera_info_left.header = header;
output_camera_info_right.header = header;
left_camera_info_output_pub.publish(output_camera_info_left);
right_camera_info_output_pub.publish(output_camera_info_right);
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "camera_fisheye_undistort");
ros::NodeHandle nh("~");
string param_file_path;
if(nh.getParam("param_file_path", param_file_path))
{
ROS_WARN("Using parameter file: %s", param_file_path.c_str());
}
else
{
ROS_ERROR("Failed to get param file path. Please check and try again.");
ros::shutdown();
return 0;
}
// Read the input parameters and perform initialization
init_rectification_map(param_file_path);
// The raw stereo images should be published as type sensor_msgs/Image
image_transport::ImageTransport it(nh);
message_filters::Subscriber<sensor_msgs::Image> sub_img_left(nh, "/camera/fisheye1/image_raw", 1);
message_filters::Subscriber<sensor_msgs::Image> sub_img_right(nh, "/camera/fisheye2/image_raw", 1);
// Having time synced stereo images might be important for other purposes, say generating accurate disparity maps.
// To sync the left and right image messages by their header time stamps, ApproximateTime is used.
// More info here: http://wiki.ros.org/message_filters#Time_Synchronizer
typedef message_filters::sync_policies::ApproximateTime<sensor_msgs::Image, sensor_msgs::Image> SyncPolicy;
message_filters::Synchronizer<SyncPolicy> sync(SyncPolicy(10), sub_img_left, sub_img_right);
sync.registerCallback(boost::bind(&synched_img_callback, _1, _2));
// The output data include rectified images and their corresponding camera info
pub_img_rect_left = it.advertise("/camera/fisheye1/rect/image", 1);
pub_img_rect_right = it.advertise("/camera/fisheye2/rect/image", 1);
left_camera_info_output_pub = nh.advertise<sensor_msgs::CameraInfo>("/camera/fisheye1/rect/camera_info", 1);
right_camera_info_output_pub = nh.advertise<sensor_msgs::CameraInfo>("/camera/fisheye2/rect/camera_info", 1);
// Processing start
ros::spin();
} | 39.544444 | 147 | 0.69528 | [
"vector"
] |
934642846899f922c72cb284bfc0e167b0911447 | 13,522 | cc | C++ | src/BPELearner.cc | filips123/Tokenizer | ab75cac0bb4f69c03734262400b6fa3afdc89c2f | [
"MIT"
] | null | null | null | src/BPELearner.cc | filips123/Tokenizer | ab75cac0bb4f69c03734262400b6fa3afdc89c2f | [
"MIT"
] | null | null | null | src/BPELearner.cc | filips123/Tokenizer | ab75cac0bb4f69c03734262400b6fa3afdc89c2f | [
"MIT"
] | 1 | 2020-12-25T12:06:27.000Z | 2020-12-25T12:06:27.000Z | /*
Use byte pair encoding (BPE) to learn a variable-length encoding of the vocabulary in a text.
Unlike the original BPE, it does not compress the plain text, but can be used to reduce the vocabulary
of a text to a configurable number of symbols, with only a small increase in the number of tokens.
Reference:
Rico Sennrich, Barry Haddow and Alexandra Birch (2016). Neural Machine Translation of Rare Words with Subword Units.
Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (ACL 2016). Berlin, Germany.
The code is converted from bpe_learn.py (https://github.com/rsennrich/subword-nmts) - version #6e67561
*/
#include "onmt/BPELearner.h"
#include <algorithm>
#include <limits>
#include <unordered_set>
#include "onmt/unicode/Unicode.h"
namespace onmt
{
typedef std::pair<std::string, std::string> bigram;
typedef std::vector<std::string> sequence;
BPELearner::BPELearner(bool verbose,
int symbols,
int min_frequency,
bool dict_input,
bool total_symbols)
: SubwordLearner(verbose, new Tokenizer(Tokenizer::Mode::Space))
, _symbols(symbols)
, _min_frequency(min_frequency)
, _dict_input(dict_input)
, _total_symbols(total_symbols)
{
}
void BPELearner::load_from_dictionary(std::istream& is)
{
std::string line;
while (std::getline(is, line))
{
if (line.empty())
continue;
size_t p = line.find(" ");
if (p == std::string::npos || line.find(" ", p + 1) != std::string::npos)
throw std::runtime_error("Failed reading vocabulary file");
_vocab[line.substr(0, p)] += std::stoi(line.substr(p + 1));
}
}
void BPELearner::ingest_token_impl(const std::string& token)
{
_vocab[token]++;
}
void BPELearner::ingest(std::istream& is, const Tokenizer* tokenizer)
{
if (_dict_input)
load_from_dictionary(is);
else
SubwordLearner::ingest(is, tokenizer);
}
struct Change {
Change(int j_,
const sequence& word_,
sequence&& old_word_,
int freq_)
: j(j_)
, word(word_)
, old_word(old_word_)
, freq(freq_) {
}
int j;
const sequence& word;
sequence old_word;
int freq;
};
struct pair_hash {
template <typename T1, typename T2>
std::size_t operator () (const std::pair<T1, T2>& pair) const {
const std::size_t h1 = std::hash<T1>()(pair.first);
const std::size_t h2 = std::hash<T2>()(pair.second);
return h1 ^ h2;
}
};
using bigram_collection = std::unordered_set<bigram, pair_hash>;
static const bigram*
get_bigram(bigram_collection& collection,
const std::string& a,
const std::string& b) {
return &(*collection.emplace(a, b).first);
}
static void
update_pair_statistics(bigram_collection& collection,
const bigram* pair,
const std::vector<Change>& changed,
std::unordered_map<const bigram*, int>& stats,
std::unordered_map<const bigram*, std::unordered_map<int, int>>& indices) {
/* Minimally update the indices and frequency of symbol pairs
if we merge a pair of symbols, only pairs that overlap with occurrences
of this pair are affected, and need to be updated.
*/
stats[pair] = 0;
indices[pair] = std::unordered_map<int, int>();
const std::string &first = pair->first;
const std::string &second = pair->second;
std::string new_pair = first + second;
for(const auto& change : changed) {
const int j = change.j;
const sequence& word = change.word;
const sequence& old_word = change.old_word;
const int freq = change.freq;
// find all instances of pair, and update frequency/indices around it
size_t i = 0;
while (true) {
// find first symbol
auto it = std::find(old_word.begin() + i, old_word.end(), first);
if (it == old_word.end())
break;
i = it - old_word.begin();
// if first symbol is followed by second symbol, we've found an occurrence of pair (old_word[i:i+2])
if (i < old_word.size()-1 && old_word[i+1] == second) {
// assuming a symbol sequence "A B C", if "B C" is merged, reduce the frequency of "A B"
if (i > 0) {
const bigram* prev = get_bigram(collection, old_word[i-1], old_word[i]);
stats[prev] -= freq;
indices[prev][j] -= 1;
}
if (i < old_word.size()-2) {
// assuming a symbol sequence "A B C B", if "B C" is merged, reduce the frequency of "C B".
// however, skip this if the sequence is A B C B C, because the frequency of "C B" will be reduced by the previous code block
if (old_word[i+2] != first || i >= old_word.size()-3 || old_word[i+3] != second) {
const bigram* nex = get_bigram(collection, old_word[i+1], old_word[i+2]);
stats[nex] -= freq;
indices[nex][j] -= 1;
}
}
i += 2;
}
else
i += 1;
}
i = 0;
while (true) {
// find new pair
auto it = std::find(word.begin() + i, word.end(), new_pair);
if (it == word.end())
break;
i = it - word.begin();
// assuming a symbol sequence "A BC D", if "B C" is merged, increase the frequency of "A BC"
if (i) {
const bigram* prev = get_bigram(collection, word[i-1], word[i]);
stats[prev] += freq;
indices[prev][j] += 1;
}
// assuming a symbol sequence "A BC B", if "B C" is merged, increase the frequency of "BC B"
// however, if the sequence is A BC BC, skip this step because the count of "BC BC" will be incremented by the previous code block
if (i < word.size()-1 && word[i+1] != new_pair) {
const bigram* nex = get_bigram(collection, word[i], word[i+1]);
stats[nex] += freq;
indices[nex][j] += 1;
}
i += 1;
}
}
}
static void
get_pair_statistics(bigram_collection& collection,
const std::vector<std::pair<int, sequence>>& sorted_vocab,
std::unordered_map<const bigram*, int>& stats,
std::unordered_map<const bigram*, std::unordered_map<int, int>>& indices) {
/* Count frequency of all symbol pairs, and create index */
int max = 0;
for(size_t i = 0; i < sorted_vocab.size(); i++) {
const int freq = sorted_vocab[i].first;
const sequence &word = sorted_vocab[i].second;
for(size_t j = 1; j < word.size(); j++) {
const bigram* pair = get_bigram(collection, word[j-1], word[j]);
stats[pair] += freq;
max = std::max(stats[pair], max);
indices[pair][i] += 1;
}
}
}
static std::vector<Change>
replace_pair(const bigram* pair,
std::vector<std::pair<int, sequence>>& sorted_vocab,
std::unordered_map<const bigram*, std::unordered_map<int, int>>& indices) {
/* Replace all occurrences of a symbol pair ('A', 'B') with a new symbol 'AB' */
const std::string &A = pair->first;
const std::string &B = pair->second;
const auto& pair_indices = indices[pair];
std::vector<Change> changes;
changes.reserve(pair_indices.size());
for (const auto& index : pair_indices) {
if (index.second < 1)
continue;
const int j = index.first;
sequence &word = sorted_vocab[j].second;
int freq = sorted_vocab[j].first;
sequence wordcopy = word;
for(size_t h=0; h < word.size()-1; h++)
if (word[h] == A && word[h+1] == B) {
word[h] += B;
word.erase(word.begin()+h+1);
}
changes.emplace_back(j, word, std::move(wordcopy), freq);
}
return changes;
}
static void prune_stats(std::unordered_map<const bigram*, int>& stats,
std::unordered_map<const bigram*, int>& big_stats,
float threshold) {
/* Prune statistics dict for efficiency of max()
The frequency of a symbol pair never increases, so pruning is generally safe
(until we the most frequent pair is less frequent than a pair we previously pruned)
big_stats keeps full statistics for when we need to access pruned items
*/
std::unordered_map<const bigram*, int> pruned_stats;
for (auto& stat : stats) {
const int freq = stat.second;
if (freq < threshold) {
const bigram* item = stat.first;
if (freq < 0)
big_stats[item] += freq;
else
big_stats[item] = freq;
} else {
pruned_stats.emplace(std::move(stat));
}
}
stats = std::move(pruned_stats);
}
static std::vector<std::pair<int, sequence>>
get_inv_char_frequency(const std::unordered_map<std::string, int>& vocab) {
/* convert vocab into character sequence+</w> and sort by inv frequency */
std::multimap<int, sequence> char_vocab;
for (const auto& pair : vocab) {
const std::string& token = pair.first;
const int frequency = pair.second;
sequence chars;
unicode::explode_utf8_with_marks(token, chars);
chars.back().append("</w>");
char_vocab.emplace(-frequency, std::move(chars));
}
std::vector<std::pair<int, sequence>> sorted_vocab;
sorted_vocab.reserve(char_vocab.size());
for (auto& pair : char_vocab) {
const int inv_frequency = pair.first;
sequence& chars = pair.second;
sorted_vocab.emplace_back(-inv_frequency, std::move(chars));
}
return sorted_vocab;
}
static std::pair<const bigram*, int>
get_most_frequent(const std::unordered_map<const bigram*, int>& stats) {
// The comparison on the bigram is to have the same priority as previous
// versions of this code that iterates on a std::map.
return *std::max_element(stats.begin(), stats.end(),
[](const std::pair<const bigram*, int>& a,
const std::pair<const bigram*, int>& b) {
return (a.second < b.second
|| (a.second == b.second && *a.first > *b.first));
});
}
void BPELearner::learn(std::ostream &os, const char *description, bool verbose) {
verbose = verbose || _verbose;
os << "#version: 0.2\n";
if (description) {
std::string desc = std::string("# ") + description;
size_t p = desc.find("\n");
while (p != std::string::npos) {
desc.replace(p, 1, "\n# ");
p = desc.find("\n", p+1);
}
os << desc << std::endl;
}
std::vector<std::pair<int, sequence>> sorted_vocab = get_inv_char_frequency(_vocab);
bigram_collection collection;
std::unordered_map<const bigram*, int> stats;
std::unordered_map<const bigram*, std::unordered_map<int, int>> indices;
get_pair_statistics(collection, sorted_vocab, stats, indices);
std::unordered_map<const bigram*, int> big_stats(stats);
if (_total_symbols) {
std::unordered_set<std::string> uniq_char_internal;
std::unordered_set<std::string> uniq_char_final;
for(size_t i = 0; i < sorted_vocab.size(); i++) {
const sequence &word = sorted_vocab[i].second;
for(size_t j = 1; j < word.size(); j++) {
uniq_char_internal.insert(word[j-1]);
}
uniq_char_final.insert(word.back());
}
std::cerr << "Number of word-internal characters: " << uniq_char_internal.size() << std::endl;
std::cerr << "Number of word-final characters: " << uniq_char_final.size() << std::endl;
std::cerr << "Reducing number of merge operations by " <<
uniq_char_internal.size() + uniq_char_final.size() << std::endl;
_symbols -= uniq_char_internal.size() + uniq_char_final.size();
}
const int max = stats.empty() ? -1: get_most_frequent(stats).second;
float threshold = max / 10.;
for(int i = 0; i < _symbols; i++) {
const bigram* most_frequent = nullptr;
int max_freq = -1;
if (!stats.empty())
std::tie(most_frequent, max_freq) = get_most_frequent(stats);
if (stats.empty() || (i && max_freq < threshold)) {
prune_stats(stats, big_stats, threshold);
stats = big_stats;
std::tie(most_frequent, max_freq) = get_most_frequent(stats);
// threshold is inspired by Zipfian assumption, but should only affect speed
threshold = max_freq * i/(i+10000.0);
prune_stats(stats, big_stats, threshold);
}
if (max_freq < _min_frequency) {
std::cerr << "no pair has frequency >= " << _min_frequency << ". Stopping\n";
break;
}
if (verbose)
std::cerr << "pair " << i << ": " << most_frequent->first << " " << most_frequent->second <<
" -> " << most_frequent->first << most_frequent->second <<
" (frequency " << max_freq << ")\n";
os << most_frequent->first << " " << most_frequent->second << "\n";
const std::vector<Change> changes = replace_pair(most_frequent, sorted_vocab, indices);
update_pair_statistics(collection, most_frequent, changes, stats, indices);
stats[most_frequent] = 0;
if (i % 100 == 0)
prune_stats(stats, big_stats, threshold);
}
}
}
| 36.744565 | 138 | 0.591111 | [
"vector"
] |
934750f89660e29122ac5b502ef9c5bc2f8c1ef2 | 458 | cpp | C++ | IncrementalEngine/TextureBase.cpp | Thendplayer/IncrementalEngine | 44c96e312431118586c00f030548d5a00524efeb | [
"MIT"
] | 1 | 2021-05-19T13:19:05.000Z | 2021-05-19T13:19:05.000Z | IncrementalEngine/TextureBase.cpp | Thendplayer/IncrementalEngine | 44c96e312431118586c00f030548d5a00524efeb | [
"MIT"
] | null | null | null | IncrementalEngine/TextureBase.cpp | Thendplayer/IncrementalEngine | 44c96e312431118586c00f030548d5a00524efeb | [
"MIT"
] | null | null | null | #include "TextureBase.h"
namespace IncrementalEngine
{
TextureBase::TextureBase() :
_texture(NULL)
{
_transform = Transform();
_bounds = { 0, 0, 0, 0 };
}
TextureBase::~TextureBase()
{
}
void TextureBase::Update(Transform transform, FloatRect bounds)
{
_transform = transform;
_bounds = bounds;
}
Texture* TextureBase::GetTexture()
{
return _texture;
}
D3DXVECTOR2 TextureBase::GetSize()
{
return _texture->GetSize();
}
}
| 14.3125 | 64 | 0.674672 | [
"transform"
] |
934b6a08d4e2e6086bd385acfaac5cb09ef08708 | 9,420 | hpp | C++ | src/math/linear/vector/rotate.hpp | dmilos/math | 977cb171d8d582411cfab73a23ce85a8ccf3b132 | [
"Apache-2.0"
] | 3 | 2020-07-02T12:44:32.000Z | 2021-04-07T20:31:41.000Z | src/math/linear/vector/rotate.hpp | dmilos/math | 977cb171d8d582411cfab73a23ce85a8ccf3b132 | [
"Apache-2.0"
] | null | null | null | src/math/linear/vector/rotate.hpp | dmilos/math | 977cb171d8d582411cfab73a23ce85a8ccf3b132 | [
"Apache-2.0"
] | 1 | 2020-09-04T11:01:28.000Z | 2020-09-04T11:01:28.000Z | #ifndef math_library_linear_algebra__vector_rotate_HPP_
#define math_library_linear_algebra__vector_rotate_HPP_
// math::linear::vector::rotate( r, alpha, point )
// math::linear::vector::rotate( r, alpha, point, pivot )
// math::linear::vector::rotateX( r, alpha, point )
// math::linear::vector::rotateY( r, alpha, point )
// math::linear::vector::rotateZ( r, alpha, point )
#include "./structure.hpp"
namespace math
{
namespace linear
{
namespace vector
{
template< typename scalar_name, typename value_name >
inline
void
rotate
(
::math::linear::vector::structure< scalar_name, 2 > & result_param
, value_name const& angle_param
,::math::linear::vector::structure< scalar_name, 2 > const& point_param
)
{
result_param[0] = point_param[0] * cos( angle_param ) - point_param[1] * sin( angle_param );
result_param[1] = point_param[0] * sin( angle_param ) + point_param[1] * cos( angle_param );
}
template< typename scalar_name, typename value_name >
inline
void
rotate
(
::math::linear::vector::structure< scalar_name, 2 > & result_param
, value_name const& angle_param
,::math::linear::vector::structure< scalar_name, 2 > const& point_param
,::math::linear::vector::structure< scalar_name, 2 > const& pivot_param
)
{
result_param[0] = (point_param[0] - pivot_param[0]) * cos( angle_param ) - ( point_param[1] - pivot_param[1] ) * sin( angle_param ) + pivot_param[0];
result_param[1] = (point_param[0] - pivot_param[0]) * sin( angle_param ) + ( point_param[1] - pivot_param[1] ) * cos( angle_param ) + pivot_param[1];
}
template< typename scalar_name, typename value_name >
inline
void
rotate
(
::math::linear::vector::structure< scalar_name, 2 > & result_param
, value_name const& angle_param
)
{
::math::linear::vector::structure< scalar_name, 2 > temp;
::math::linear::vector::rotate( temp, angle_param, result_param );
result_param = temp;
}
template< typename scalar_name, typename value_name >
inline
void
rotateX
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param
,::math::linear::vector::structure< scalar_name, 3 > const& point_param
,::math::linear::vector::structure< scalar_name, 3 > const& pivot_param
)
{
::math::linear::vector::structure< scalar_name, 3 > local;
::math::linear::vector::subtraction( local, point_param, pivot_param );
result_param[0] = 1 * local[0] + 0 * local[1] + 0 * local[2] + pivot_param[0];
result_param[1] = 0 * local[0] + cos( angle_param )* local[1] - sin( angle_param ) * local[2] + pivot_param[1];
result_param[2] = 0 * local[0] + sin( angle_param )* local[1] + cos( angle_param ) * local[2] + pivot_param[2];
}
template< typename scalar_name, typename value_name >
inline
void
rotateX
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param
,::math::linear::vector::structure< scalar_name, 3 > const& point_param
)
{
result_param[0] = 1 * point_param[0] + 0 * point_param[1] + 0 * point_param[2];
result_param[1] = 0 * point_param[0] + cos( angle_param )* point_param[1] - sin( angle_param ) * point_param[2];
result_param[2] = 0 * point_param[0] + sin( angle_param )* point_param[1] + cos( angle_param ) * point_param[2];
}
template< typename scalar_name, typename value_name >
inline
void
rotateX
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param
)
{
::math::linear::vector::structure< scalar_name, 3 > temp;
::math::linear::vector::rotateX( temp, angle_param, result_param );
result_param = temp;
}
template< typename scalar_name, typename value_name >
inline
void
rotateY
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param
,::math::linear::vector::structure< scalar_name, 3 > const& point_param
,::math::linear::vector::structure< scalar_name, 3 > const& pivot_param
)
{
::math::linear::vector::structure< scalar_name, 3 > local;
::math::linear::vector::subtraction( local, point_param, pivot_param );
result_param[0] = cos( angle_param ) * local[0] + 0 * local[1] + sin( angle_param )* local[2] + pivot_param[0];
result_param[1] = 0 * local[0] + 1 * local[1] + 0 * local[2] + pivot_param[1];
result_param[2] = -sin( angle_param ) * local[0] + 0 * local[1] + cos( angle_param )* local[2] + pivot_param[2];
}
template< typename scalar_name, typename value_name >
inline
void
rotateY
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param
,::math::linear::vector::structure< scalar_name, 3 > const& point_param
)
{
result_param[0] = cos( angle_param ) * point_param[0] + 0 * point_param[1] + sin( angle_param )* point_param[2];
result_param[1] = 0 * point_param[0] + 1 * point_param[1] + 0 * point_param[2];
result_param[2] = -sin( angle_param ) * point_param[0] + 0 * point_param[1] + cos( angle_param )* point_param[2];
}
template< typename scalar_name, typename value_name >
inline
void
rotateY
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param
)
{
::math::linear::vector::structure< scalar_name, 3 > temp;
::math::linear::vector::rotateY( temp, angle_param, result_param );
result_param = temp;
}
template< typename scalar_name, typename value_name >
inline
void
rotateZ
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param
,::math::linear::vector::structure< scalar_name, 3 > const& point_param
,::math::linear::vector::structure< scalar_name, 3 > const& pivot_param
)
{
::math::linear::vector::structure< scalar_name, 3 > local;
::math::linear::vector::subtraction( local, point_param, pivot_param );
result_param[0] = cos( angle_param ) * local[0] - sin( angle_param ) * local[1] - 0 * local[2] + pivot_param[0];
result_param[1] = sin( angle_param ) * local[0] + cos( angle_param ) * local[1] + 0 * local[2] + pivot_param[1];
result_param[2] = 0 * local[0] + 0 * local[1] + 1 * local[2] + pivot_param[2];
}
template< typename scalar_name, typename value_name >
inline
void
rotateZ
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param,
::math::linear::vector::structure< scalar_name, 3 > const& point_param
)
{
result_param[0] = cos( angle_param ) * point_param[0] - sin( angle_param ) * point_param[1] + 0 * point_param[2];
result_param[1] = sin( angle_param ) * point_param[0] + cos( angle_param ) * point_param[1] + 0 * point_param[2];
result_param[2] = 0 * point_param[0] + 0 * point_param[1] + 1 * point_param[2];
}
template< typename scalar_name, typename value_name >
inline
void
rotateZ
(
::math::linear::vector::structure< scalar_name, 3 > & result_param
, value_name const& angle_param
)
{
::math::linear::vector::structure< scalar_name, 3 > temp;
::math::linear::vector::rotateZ( temp, angle_param, result_param );
result_param = temp;
}
}
}
}
#endif
| 43.813953 | 160 | 0.516348 | [
"vector"
] |
93510f1f013088b74e5b3ace310687b59f06033c | 2,486 | cc | C++ | src/modular/bin/sessionmgr/puppet_master/make_production_impl.cc | casey/fuchsia | 2b965e9a1e8f2ea346db540f3611a5be16bb4d6b | [
"BSD-3-Clause"
] | null | null | null | src/modular/bin/sessionmgr/puppet_master/make_production_impl.cc | casey/fuchsia | 2b965e9a1e8f2ea346db540f3611a5be16bb4d6b | [
"BSD-3-Clause"
] | null | null | null | src/modular/bin/sessionmgr/puppet_master/make_production_impl.cc | casey/fuchsia | 2b965e9a1e8f2ea346db540f3611a5be16bb4d6b | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/modular/bin/sessionmgr/puppet_master/make_production_impl.h"
#include <memory>
#include "src/modular/bin/sessionmgr/puppet_master/command_runners/add_mod_command_runner.h"
#include "src/modular/bin/sessionmgr/puppet_master/command_runners/focus_mod_command_runner.h"
#include "src/modular/bin/sessionmgr/puppet_master/command_runners/no_op_command_runner.h"
#include "src/modular/bin/sessionmgr/puppet_master/command_runners/remove_mod_command_runner.h"
#include "src/modular/bin/sessionmgr/puppet_master/command_runners/set_focus_state_command_runner.h"
#include "src/modular/bin/sessionmgr/puppet_master/dispatch_story_command_executor.h"
namespace modular {
class PuppetMasterImpl;
using StoryControllerFactory =
fit::function<fuchsia::modular::StoryControllerPtr(fidl::StringPtr story_id)>;
std::unique_ptr<StoryCommandExecutor> MakeProductionStoryCommandExecutor(
SessionStorage* const session_storage, fuchsia::modular::FocusProviderPtr focus_provider,
// TODO(miguelfrde): we shouldn't create this dependency here. Instead
// an interface similar to StoryStorage should be created for Runtime
// use cases.
fit::function<void(std::string, std::vector<std::string>)> module_focuser) {
std::map<fuchsia::modular::StoryCommand::Tag, std::unique_ptr<CommandRunner>> command_runners;
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kSetFocusState,
new SetFocusStateCommandRunner(std::move(focus_provider)));
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kAddMod, new AddModCommandRunner());
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kSetLinkValue,
new NoOpCommandRunner());
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kFocusMod,
new FocusModCommandRunner(std::move(module_focuser)));
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kRemoveMod,
new RemoveModCommandRunner());
command_runners.emplace(fuchsia::modular::StoryCommand::Tag::kSetKindOfProtoStoryOption,
new NoOpCommandRunner());
auto executor =
std::make_unique<DispatchStoryCommandExecutor>(session_storage, std::move(command_runners));
return executor;
}
} // namespace modular
| 51.791667 | 100 | 0.766291 | [
"vector"
] |
9355fd43e4b573165ed7b69492c568db88828867 | 4,084 | cpp | C++ | spine/MultiLanguageStringArray.cpp | fmidev/smartmet-library-spine | f770171149fdaa78c5b7c7ba463218a9fd63bd68 | [
"MIT"
] | 1 | 2017-03-13T03:34:32.000Z | 2017-03-13T03:34:32.000Z | spine/MultiLanguageStringArray.cpp | fmidev/smartmet-library-spine | f770171149fdaa78c5b7c7ba463218a9fd63bd68 | [
"MIT"
] | 3 | 2017-11-02T16:30:29.000Z | 2020-05-27T13:46:14.000Z | spine/MultiLanguageStringArray.cpp | fmidev/smartmet-library-spine | f770171149fdaa78c5b7c7ba463218a9fd63bd68 | [
"MIT"
] | 1 | 2017-05-15T09:04:13.000Z | 2017-05-15T09:04:13.000Z | #include "MultiLanguageStringArray.h"
#include "ConfigBase.h"
#include <macgyver/Exception.h>
#include <macgyver/StringConversion.h>
using SmartMet::Spine::MultiLanguageStringArray;
/**
@page SPINE_CFG_MULTI_LANGUAGE_STRING_ARRAY cfgMultiLanguageStringArray
This configuration object contains values of string array in several langugaes.
The default language is specified when reading multilanguage string array rom
libconfig type configuration file. A translation to the default language
is required to be present. The size of the array is required to be identical for
all provided languages.
An example:
@verbatim
numbers:
{
eng: [ "one", "two", "three", "four" ];
fin: [ "yksi", "kaksi", "kolme", "neljä" ];
lav: [ "viens", "divi", "trīs", "četri" ];
};
@endverbatim
One can alternatively specify a single string array like:
@verbatim
numbers: [ "one", "two", "three", "four" ];
@endverbatim
In this case it is assumed that strings are provided for the default language.
*/
MultiLanguageStringArray::MultiLanguageStringArray(const std::string& default_language,
libconfig::Setting& setting)
: default_language(default_language)
{
try
{
parse_content(setting);
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
std::shared_ptr<MultiLanguageStringArray> MultiLanguageStringArray::create(
const std::string& default_language, libconfig::Setting& setting)
{
try
{
std::shared_ptr<MultiLanguageStringArray> result(
new MultiLanguageStringArray(default_language, setting));
return result;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
MultiLanguageStringArray::~MultiLanguageStringArray() = default;
const std::vector<std::string>& MultiLanguageStringArray::get(const std::string& language) const
{
try
{
auto pos = data.find(Fmi::ascii_tolower_copy(language));
if (pos == data.end())
return get(default_language);
return pos->second;
}
catch (...)
{
throw Fmi::Exception::Trace(BCP, "Operation failed!");
}
}
void MultiLanguageStringArray::parse_content(libconfig::Setting& setting)
{
int size = -1;
bool found_default = false;
if (setting.getType() != libconfig::Setting::TypeGroup)
{
std::ostringstream msg;
msg << "Libconfig group expected instead of '";
SmartMet::Spine::ConfigBase::dump_setting(msg, setting);
msg << "'";
throw Fmi::Exception(BCP, msg.str());
}
const int num_items = setting.getLength();
for (int i = 0; i < num_items; i++)
{
libconfig::Setting& item = setting[i];
if (item.getType() != libconfig::Setting::TypeArray)
{
std::ostringstream msg;
msg << "Libconfig array expected instead of '";
SmartMet::Spine::ConfigBase::dump_setting(msg, item);
msg << "' while reading item '";
SmartMet::Spine::ConfigBase::dump_setting(msg, setting);
msg << "'";
throw Fmi::Exception(BCP, msg.str());
}
std::vector<std::string> value;
const int num_strings = item.getLength();
for (int i = 0; i < num_strings; i++)
{
const std::string v = item[i];
value.push_back(v);
}
if (i == 0)
{
size = num_strings;
}
else if (size != num_strings)
{
std::ostringstream msg;
msg << "All language versions of string array are expected to have the same size"
<< " in '";
SmartMet::Spine::ConfigBase::dump_setting(msg, setting);
msg << '\'';
throw Fmi::Exception(BCP, msg.str());
}
const std::string tmp = item.getName();
const std::string name = Fmi::ascii_tolower_copy(tmp);
if (name == this->default_language)
found_default = true;
data[name] = value;
}
if (not found_default)
{
std::ostringstream msg;
msg << "The string array for the default language '" << this->default_language
<< "' is not found in '";
SmartMet::Spine::ConfigBase::dump_setting(msg, setting);
throw Fmi::Exception(BCP, msg.str());
}
}
| 26.348387 | 96 | 0.65573 | [
"object",
"vector"
] |
93599a4df5083aef61bc2b880799de0ef29d8fdb | 15,656 | cpp | C++ | src/render/shader.cpp | fiddleplum/ve | 1e45de0488d593069032714ebe67725f468054f8 | [
"MIT"
] | null | null | null | src/render/shader.cpp | fiddleplum/ve | 1e45de0488d593069032714ebe67725f468054f8 | [
"MIT"
] | 16 | 2016-12-27T16:57:09.000Z | 2017-04-30T23:34:58.000Z | src/render/shader.cpp | fiddleplum/ve | 1e45de0488d593069032714ebe67725f468054f8 | [
"MIT"
] | null | null | null | #include "render/shader.hpp"
#include "render/open_gl.hpp"
#include "render/mesh.hpp"
#include "util/stringutil.hpp"
// TODO: Make the shader use specific attribute locations chosen by an enum based on the attribute names.
// This allows multiple shaders to be used with a single vbo and all be compatible.
// A vbo is separate from the shaders, so that the same vbo can use multiple shaders and multiple vbos can use the same shader,
// so the attributes need to be set by an enum that both vbos and shaders use
// A material, on the other hand, uses uniforms. uniforms can be any sort of name and type so that there can't really be a list of uniform ids
// that both materials and shaders use. so a material must have a shader reference and whenever it is assigned a new shader, repopulate the
// uniform ids. this makes sense, since it has to repopulate the uniform values anyway
// There SHOULD be a shared material, since many objects might want to use the same material, and it would be wasteful not to. then the objects
// could be sorted by material (shader and then texture) when rendering. then a scene object would contain a mesh and a material, as shared resources.
// the camera, when it needs to set the proj mat, would do so when the material is changed when rendering
// the material would have some basic preset uniforms (proj, worldview, lights, etc) and their locations, and then the rest would be material properties
// I should put vbo inside of mesh, and have logic to keep the vertex/index data in memory or to get rid of it.
namespace ve
{
namespace render
{
unsigned int currentProgram = 0; // the current open gl shader program
Shader::Blending currentBlending = Shader::Blending::NONE; // the current blending state
bool currentDepthWrite = true;
Shader::DepthTest currentDepthTest = Shader::DepthTest::LESS_OR_EQUAL;
Shader::Shader(Config const & shaderConfig)
{
unsigned int vertexObject = compileShaderObject(Vertex, shaderConfig.vertexCode);
unsigned int fragmentObject = compileShaderObject(Fragment, shaderConfig.fragmentCode);
blending = shaderConfig.blending;
depthWrite = shaderConfig.depthWrite;
depthTest = shaderConfig.depthTest;
program = linkShaderProgram({vertexObject, fragmentObject});
glDetachShader(program, vertexObject);
glDeleteShader(vertexObject);
glDetachShader(program, fragmentObject);
glDeleteShader(fragmentObject);
populateUniformInfos();
}
Shader::Shader(ve::Config const & config)
{
Config shaderConfig;
std::vector<unsigned int> shaderObjects;
try
{
auto vertexValueOpt = config["vertex"];
if (vertexValueOpt)
{
if (vertexValueOpt->type == ve::Config::List)
{
auto vertexValue = vertexValueOpt.value();
for (auto pair : vertexValue.children)
{
std::string code;
if (endsWith(pair.second.text, ".vert"))
{
auto filename = pair.second.text;
code = readFile(filename);
}
else
{
code = pair.second.text;
}
shaderObjects.push_back(compileShaderObject(Vertex, code));
}
}
else if (vertexValueOpt->type == ve::Config::String)
{
std::string code;
if (endsWith(vertexValueOpt->text, ".vert"))
{
auto filename = vertexValueOpt->text;
code = readFile(filename);
}
else
{
code = vertexValueOpt->text;
}
shaderObjects.push_back(compileShaderObject(Vertex, code));
}
}
else
{
throw std::runtime_error("Shader definition does not have a vertex section. ");
}
auto fragmentValueOpt = config["fragment"];
if (fragmentValueOpt)
{
if (fragmentValueOpt->type == ve::Config::List)
{
auto fragmentValue = fragmentValueOpt.value();
for (auto pair : fragmentValue.children)
{
std::string code;
if (endsWith(pair.second.text, ".frag"))
{
auto filename = pair.second.text;
code = readFile(filename);
}
else
{
code = pair.second.text;
}
shaderObjects.push_back(compileShaderObject(Fragment, code));
}
}
else if (fragmentValueOpt->type == ve::Config::String)
{
std::string code;
if (endsWith(fragmentValueOpt->text, ".frag"))
{
auto filename = fragmentValueOpt->text;
code = readFile(filename);
}
else
{
code = fragmentValueOpt->text;
}
shaderObjects.push_back(compileShaderObject(Fragment, code));
}
}
else
{
throw std::runtime_error("Shader definition does not have a fragment section. ");
}
blending = Blending::NONE;
auto blendingOptValue = config["blending"];
if (blendingOptValue && blendingOptValue->type == ve::Config::String)
{
if (blendingOptValue->text == "additive")
{
blending = Blending::ADDITIVE;
}
else if (blendingOptValue->text == "alpha")
{
blending = Blending::ALPHA;
}
}
depthWrite = config.getChildAs<bool>("depthWrite", false);
depthTest = DepthTest::LESS_OR_EQUAL;
auto depthTestValue = config.getChildAs<std::string>("depthTest", "lessOrEqual");
if (depthTestValue == "never")
{
depthTest = DepthTest::NEVER;
}
else if (depthTestValue == "always")
{
depthTest = DepthTest::ALWAYS;
}
else if (depthTestValue == "less")
{
depthTest = DepthTest::LESS;
}
else if (depthTestValue == "greater")
{
depthTest = DepthTest::GREATER;
}
else if (depthTestValue == "equal")
{
depthTest = DepthTest::EQUAL;
}
else if (depthTestValue == "notEqual")
{
depthTest = DepthTest::NOT_EQUAL;
}
else if (depthTestValue == "lessOrEqual")
{
depthTest = DepthTest::LESS_OR_EQUAL;
}
else if (depthTestValue == "greaterOrEqual")
{
depthTest = DepthTest::GREATER_OR_EQUAL;
}
}
catch (...)
{
for (unsigned int shaderObject : shaderObjects)
{
glDeleteShader(shaderObject);
}
throw;
}
program = linkShaderProgram(shaderObjects); // delete shader objects as well
for (unsigned int shaderObject : shaderObjects)
{
glDetachShader(program, shaderObject);
glDeleteShader(shaderObject);
}
populateUniformInfos();
}
Shader::Shader(std::string const & filename)
: Shader(ve::Config {filename})
{
}
Shader::~Shader()
{
glDeleteProgram(program);
}
std::map<std::string, Shader::UniformInfo> const & Shader::getUniformInfos() const
{
return uniformInfos;
}
Shader::UniformInfo Shader::getUniformInfo(std::string const & name) const
{
auto iter = uniformInfos.find(name);
if (iter != uniformInfos.end())
{
return iter->second;
}
else // If not found, it returns -1 for the location.
{
return UniformInfo {-1, INT};
}
}
Shader::Blending Shader::getBlending() const
{
return blending;
}
// Sets the blending state.
void Shader::setBlending(Blending blending_)
{
blending = blending_;
}
bool Shader::activate()
{
if (currentBlending != blending)
{
if (blending == Blending::NONE)
{
glDisable(GL_BLEND);
}
else if (blending == Blending::ADDITIVE)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
}
else if (blending == Blending::ALPHA)
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
currentBlending = blending;
}
if (currentDepthWrite != depthWrite)
{
glDepthMask(depthWrite);
currentDepthWrite = depthWrite;
}
if (currentDepthTest != depthTest)
{
switch (depthTest)
{
case NEVER: glDepthFunc(GL_NEVER); break;
case ALWAYS: glDepthFunc(GL_ALWAYS); break;
case LESS: glDepthFunc(GL_LESS); break;
case GREATER: glDepthFunc(GL_GREATER); break;
case EQUAL: glDepthFunc(GL_EQUAL); break;
case NOT_EQUAL: glDepthFunc(GL_NOTEQUAL); break;
case LESS_OR_EQUAL: glDepthFunc(GL_LEQUAL); break;
case GREATER_OR_EQUAL: glDepthFunc(GL_GEQUAL); break;
}
}
if (currentProgram != program)
{
currentProgram = program;
glUseProgram(program);
return true;
}
return false;
}
void Shader::deactivate()
{
currentProgram = 0;
glUseProgram(0);
}
unsigned int Shader::compileShaderObject(Type type, std::string const & code)
{
unsigned int glType = 0;
if (type == Shader::Vertex)
{
glType = GL_VERTEX_SHADER;
}
else if (type == Shader::Fragment)
{
glType = GL_FRAGMENT_SHADER;
}
else
{
throw std::runtime_error("Unknown shader object type '" + std::to_string(type) + "', with code:\n" + code + "\n");
}
unsigned int handle;
handle = glCreateShader(glType);
char const * shaderCode = code.c_str();
GLint shaderCodeSize = (GLint)code.size();
glShaderSource(handle, 1, &shaderCode, &shaderCodeSize);
glCompileShader(handle);
GLint good;
glGetShaderiv(handle, GL_COMPILE_STATUS, &good);
if (good == GL_FALSE)
{
GLint logLength;
std::string log;
glGetShaderiv(handle, GL_INFO_LOG_LENGTH, &logLength);
log.resize(logLength);
glGetShaderInfoLog(handle, logLength, 0, &log[0]);
log.pop_back(); // get rid of \0
std::string typeString;
glDeleteShader(handle);
throw std::runtime_error("Error compiling shader: " + log + "Code:\n" + code + "\n");
}
return handle;
}
unsigned int Shader::linkShaderProgram(std::vector<unsigned int> const & shaderObjects)
{
unsigned int program = glCreateProgram();
for (unsigned int shaderObject : shaderObjects)
{
glAttachShader(program, shaderObject);
}
glLinkProgram(program);
GLint good;
glGetProgramiv(program, GL_LINK_STATUS, &good);
if (good == GL_FALSE)
{
GLint logLength;
std::string log;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &logLength);
log.resize(logLength);
glGetProgramInfoLog(program, logLength, 0, &log[0]);
glDeleteProgram(program);
throw std::runtime_error("Error linking shader: " + log);
}
return program;
}
void Shader::populateUniformInfos()
{
GLint numVariables;
GLint maxNameSize;
std::string name;
glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &numVariables);
glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &maxNameSize);
for (int i = 0; i < numVariables; i++)
{
GLsizei nameSize;
GLint glSize;
GLenum glType;
name.resize(maxNameSize);
glGetActiveUniform(program, i, maxNameSize, &nameSize, &glSize, &glType, &name[0]);
name.resize(nameSize);
int location = glGetUniformLocation(program, name.c_str());
UniformType type;
switch (glType)
{
case GL_INT: type = UniformType::INT; break;
case GL_FLOAT: type = UniformType::FLOAT; break;
case GL_INT_VEC2: type = UniformType::COORD_2I; break;
case GL_FLOAT_VEC2: type = UniformType::COORD_2F; break;
case GL_INT_VEC3: type = UniformType::COORD_3I; break;
case GL_FLOAT_VEC3: type = UniformType::COORD_3F; break;
case GL_INT_VEC4: type = UniformType::COORD_4I; break;
case GL_FLOAT_VEC4: type = UniformType::COORD_4F; break;
case GL_FLOAT_MAT3: type = UniformType::MATRIX_33F; break;
case GL_FLOAT_MAT4: type = UniformType::MATRIX_44F; break;
case GL_SAMPLER_2D: type = UniformType::TEXTURE_2D; break;
default: throw std::runtime_error("Invalid type of uniform for '" + name + "'. "); break;
}
uniformInfos[name] = UniformInfo {location, type};
}
}
template <> void Shader::setUniformValue(int location, int const & value)
{
glUniform1i(location, value);
}
template <> void Shader::setUniformValue(int location, float const & value)
{
glUniform1f(location, value);
}
template <> void Shader::setUniformValue(int location, Vector2i const & value)
{
glUniform2iv(location, 1, value.ptr());
}
template <> void Shader::setUniformValue(int location, Vector3i const & value)
{
glUniform3iv(location, 1, value.ptr());
}
template <> void Shader::setUniformValue(int location, Vector4i const & value)
{
glUniform4iv(location, 1, value.ptr());
}
template <> void Shader::setUniformValue(int location, Vector2f const & value)
{
glUniform2fv(location, 1, value.ptr());
}
template <> void Shader::setUniformValue(int location, Vector3f const & value)
{
glUniform3fv(location, 1, value.ptr());
}
template <> void Shader::setUniformValue(int location, Vector4f const & value)
{
glUniform4fv(location, 1, value.ptr());
}
template <> void Shader::setUniformValue(int location, Matrix22f const & value)
{
glUniformMatrix2fv(location, 1, false, value.ptr());
}
template <> void Shader::setUniformValue(int location, Matrix33f const & value)
{
glUniformMatrix3fv(location, 1, false, value.ptr());
}
template <> void Shader::setUniformValue(int location, Matrix44f const & value)
{
glUniformMatrix4fv(location, 1, false, value.ptr());
}
template <> void Shader::setUniformValue(char const * location, int const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, float const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Vector2i const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Vector3i const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Vector4i const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Vector2f const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Vector3f const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Vector4f const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Matrix22f const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Matrix33f const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
template <> void Shader::setUniformValue(char const * location, Matrix44f const & value)
{
auto it = uniformInfos.find(location);
if (it != uniformInfos.end())
{
setUniformValue(it->second.location, value);
}
}
}
} | 28.621572 | 154 | 0.663196 | [
"mesh",
"render",
"object",
"vector"
] |
935c7d2fdbf22689c99344513d66a3ccc5995d4c | 3,352 | cpp | C++ | interpreter-for-cpp/src/Base/ErrorLogger.cpp | Jenocn/PeakScript | 444ba5f9d0062989d8beca0d76415961f1ae2922 | [
"MIT"
] | 1 | 2020-05-21T09:02:19.000Z | 2020-05-21T09:02:19.000Z | interpreter-for-cpp/src/Base/ErrorLogger.cpp | Jenocn/PeakScript | 444ba5f9d0062989d8beca0d76415961f1ae2922 | [
"MIT"
] | 8 | 2020-05-29T14:12:00.000Z | 2022-01-22T09:08:47.000Z | interpreter-for-cpp/src/Base/ErrorLogger.cpp | Jenocn/PeakScript | 444ba5f9d0062989d8beca0d76415961f1ae2922 | [
"MIT"
] | null | null | null | #include "ErrorLogger.h"
using namespace peak::interpreter;
std::function<void(const std::string&)> ErrorLogger::_logger = [](const std::string& message) {
std::cout << message << std::endl;
};
std::map<ErrorRuntimeCode, std::string> ErrorLogger::_errorCodeNameMap = {
{ErrorRuntimeCode::Space, "Space"},
{ErrorRuntimeCode::Variable, "Variable"},
{ErrorRuntimeCode::Block, "Block, \"{ }\""},
{ErrorRuntimeCode::Condition, "Condition, \"if-else\""},
{ErrorRuntimeCode::DoWhile, "DoWhile, \"do-while\""},
{ErrorRuntimeCode::Echo, "Echo, \"echo\""},
{ErrorRuntimeCode::Expression, "Expression"},
{ErrorRuntimeCode::ExpressionDouble, "ExpressionDouble, \"++\",\"--\""},
{ErrorRuntimeCode::FunctionCall, "FunctionCall, \"function()\""},
{ErrorRuntimeCode::Math, "Math, \"math expression\""},
{ErrorRuntimeCode::ExpressionNot, "ExpressionNot, \"!\""},
{ErrorRuntimeCode::SelfAssign, "SelfAssign, \"+=, -=, *=, /=, %= ...\""},
{ErrorRuntimeCode::Array, "Array, \"[ ]\""},
{ErrorRuntimeCode::ExpressionVariable, "ExpressionVariable, \"variable\""},
{ErrorRuntimeCode::For, "For, \"for(;;)\""},
{ErrorRuntimeCode::Foreach, "Foreach, \"foreach\",\"for-in\""},
{ErrorRuntimeCode::FunctionDefine, "FunctionDefine, \"function { }\""},
{ErrorRuntimeCode::Loop, "Loop, \"loop\""},
{ErrorRuntimeCode::Return, "Return, \"return\""},
{ErrorRuntimeCode::TryCatchFinally, "TryCatchFinally, \"try-catch-finally\""},
{ErrorRuntimeCode::VariableAssign, "VariableAssign, \"=\""},
{ErrorRuntimeCode::VariableDefine, "VariableDefine, \"var, the, const\""},
{ErrorRuntimeCode::VariableSet, "VariableSet, \"set\""},
{ErrorRuntimeCode::While, "While, \"while\""},
{ErrorRuntimeCode::VariableNameAnalysis, "VariableNameAnalysis, \"variable-name\""},
{ErrorRuntimeCode::VariableArrayItemAnalysis, "VariableArrayItemAnalysis, \"array [ ]\""},
{ErrorRuntimeCode::VariableInsideAnalysis, "VariableInsideAnalysis, \"inside.value\""},
{ErrorRuntimeCode::New, "New, \"new\""},
{ErrorRuntimeCode::ObjectDefine, "ObjectDefine, \"object\""},
{ErrorRuntimeCode::Inside, "Inside, \"inside.value\""},
{ErrorRuntimeCode::EnumDefine, "EnumDefine, \"enum\""},
{ErrorRuntimeCode::Import, "Import, \"import\""},
{ErrorRuntimeCode::Export, "Export, \"export\""},
};
void ErrorLogger::Locate(std::function<void(const std::string&)> logger) {
_logger = logger;
}
void ErrorLogger::Log(const std::string& message) {
_logger("[!]error: " + message);
}
void ErrorLogger::LogParseError(const std::string& src, std::size_t size, std::size_t pos) {
std::size_t lineNum = 0;
std::size_t save0 = 0;
std::size_t save1 = 0;
for (std::size_t i = 0; i < size; ++i) {
if ((src[i] == '\n') || (i == size - 1)) {
++lineNum;
if (i >= pos) {
save1 = i + 1;
break;
}
save0 = i + 1;
save1 = save0;
}
}
Log("[" + std::to_string(lineNum) + "," + std::to_string(save1 - save0) + "]: " + src.substr(save0, save1 - save0));
}
void ErrorLogger::LogRuntimeError(ErrorRuntimeCode code, const std::string& desc) {
auto ite = _errorCodeNameMap.find(code);
if (ite != _errorCodeNameMap.end()) {
LogRuntimeError(ite->second + ": " + desc);
} else {
LogRuntimeError(desc);
}
}
void ErrorLogger::LogRuntimeError(const std::string& desc) {
Log("[runtime]: " + desc);
}
| 40.385542 | 118 | 0.65185 | [
"object"
] |
93612e9a71c4c9e6241090c63a8d9ea2a58c991a | 5,972 | cpp | C++ | SPQSP_IO/SP_QSP_shared/ABM_Base/ParamBase.cpp | popellab/SPQSP_IO | eca3ea55ec2f75b0db5d58da09500ddffabc001d | [
"MIT"
] | null | null | null | SPQSP_IO/SP_QSP_shared/ABM_Base/ParamBase.cpp | popellab/SPQSP_IO | eca3ea55ec2f75b0db5d58da09500ddffabc001d | [
"MIT"
] | null | null | null | SPQSP_IO/SP_QSP_shared/ABM_Base/ParamBase.cpp | popellab/SPQSP_IO | eca3ea55ec2f75b0db5d58da09500ddffabc001d | [
"MIT"
] | null | null | null | #include "ParamBase.h"
#include <boost/property_tree/xml_parser.hpp>
#include <boost/foreach.hpp>
#include <iostream>
namespace SP_QSP_IO{
namespace pt = boost::property_tree;
ParamBase::ParamBase()
:_paramDesc()
, _paramFloat()
, _paramInt()
, _paramBool()
, _paramFloatInternal()
, _paramIntInternal()
, _paramBoolInternal()
{
}
/*! initializae parameter object
\param [in] inFileName: parameter file name.
*/
void ParamBase::initializeParams(std::string inFileName){
bool res = readParamsFromXml(inFileName);
if (!res)
{
// reading paramter not successful
std::cerr << "Error reading paramters, exiting" << std::endl;
exit(1);
}
//process internal paramters/*
processInternalParams();
}
/*! read xml paramter file, save in a boost property tree.
process float, int, and boolean parameters sequntially
\param [in] inFileName: parameter file name.
*/
bool ParamBase::readParamsFromXml( std::string inFileName){
pt::ptree tree;
//reading xml
try{
pt::read_xml(inFileName, tree, boost::property_tree::xml_parser::trim_whitespace);
bool res = true;
for (size_t i = 0; i < _paramFloat.size(); i++)
{
res &= processEntryFloat(i, tree);
}
for (size_t i = 0; i < _paramInt.size(); i++)
{
res &= processEntryInt(i, tree);
}
for (size_t i = 0; i < _paramBool.size(); i++)
{
res &= processEntryBool(i, tree);
}
return res;
}
catch(std::exception& e){
std::cerr << "Error reading " << e.what() << std::endl;
return false;
}
}
/*! extract float type parameters from property tree.
\param [in] i: idx in the float-type parameter enumerator
\param [in] tree: property tree constructed from xml file
from path determined in _description, get leaf element's
content and save as parameter value.
Verify parameters values according to tags: "pos" for positive;
"pr" for probability, [0, 1].
attribute of element is reserved for paramter space sweep.
*/
bool ParamBase::processEntryFloat(unsigned int i, boost::property_tree::ptree & tree){
try{
double temp = tree.get<double>(_paramDesc[i][0]);
if ((_paramDesc[i][2] == "pos" && temp < 0) ||
(_paramDesc[i][2] == "pr" && (temp < 0 || temp > 1)))
{
std::cerr << "\"" << _paramDesc[i][0] << "\" out of range" << std::endl;
return false;
}
else{
//std::cout << "\"" << _paramDesc[i][0] << "\", value: " << temp << std::endl;
_paramFloat[i] = temp;
return true;
}
}
catch (pt::ptree_bad_path){
std::cerr << "(double type) \"" << _paramDesc[i][0] << "\"not found" << std::endl;
}
catch (pt::ptree_bad_data){
std::cerr << "(double type) \"" << _paramDesc[i][0] << "\"wrong format" << std::endl;
}
catch(std::exception& e){
std::cerr << _paramDesc[i][0] << "Error: " << e.what() << std::endl;
}
return false;
}
/*! extract int type parameters from property tree.
\param [in] i: idx in the int type parameter enumerator
\param [in] tree: property tree constructed from xml file
from path determined in _description, get leaf element's
content and save as parameter value.
Verify parameters values according to tags: "pos" for positive
attribute of element is reserved for paramter space sweep.
*/
bool ParamBase::processEntryInt(unsigned int i, boost::property_tree::ptree & tree){
//unsigned int j = PARAM_FLOAT_COUNT + i;
size_t nrFloatParam = _paramFloat.size();
unsigned int j = i + nrFloatParam;
try{
int temp = tree.get<int>(_paramDesc[j][0]);
if ((_paramDesc[j][2] == "pos" && temp < 0)){
std::cerr << "\"" << _paramDesc[j][0] << "\" out of range" << std::endl;
return false;
}
else{
_paramInt[i] = temp;
return true;
}
}
catch (pt::ptree_bad_path){
std::cerr << "(int type) \"" << _paramDesc[j][0] << "\" not found" << std::endl;
}
catch (pt::ptree_bad_data){
std::cerr << "(int type)\"" << _paramDesc[j][0] << "\" wrong format" << std::endl;
}
catch(std::exception& e){
std::cerr << _paramDesc[j][0] << "Error: " << e.what() << std::endl;
}
return false;
}
/*! extract bool type parameters from property tree.
\param [in] i: idx in the bool type parameter enumerator
\param [in] tree: property tree constructed from xml file
from path determined in _description, get leaf element's
content and save as parameter value.
attribute of element is reserved for paramter space sweep.
*/
bool ParamBase::processEntryBool(unsigned int i, boost::property_tree::ptree & tree){
//unsigned int j = PARAM_FLOAT_COUNT + PARAM_INT_COUNT + i;
size_t nrFloatParam = _paramFloat.size();
size_t nrIntParam = _paramInt.size();
unsigned int j = i + nrFloatParam + nrIntParam;
try{
bool temp = tree.get<bool>(_paramDesc[j][0]);
//std::cout << "\"" << _paramDesc[j][0] << "\", value: "<< temp << std::endl;
_paramBool[i] = temp;
return true;
}
catch (pt::ptree_bad_path){
std::cerr << "(bool type)\"" << _paramDesc[j][0] << "\" not found" << std::endl;
}
catch (pt::ptree_bad_data){
std::cerr << "(bool type)\"" << _paramDesc[j][0] << "\" wrong format" << std::endl;
}
catch(std::exception& e){
std::cerr << _paramDesc[j][0] << "Error: " << e.what() << std::endl;
}
return false;
}
/*! save parameters values to a xml file
construct a property tree with the path saved in in _description and add
parameter values to elements.
Then write property tree to xml file.
*/
void ParamBase::writeParamsToXml(std::string outFileName){
pt::ptree tree;
size_t nrFloatParam = _paramFloat.size();
size_t nrIntParam = _paramInt.size();
size_t nrBoolParam = _paramBool.size();
for (size_t i = 0; i < nrFloatParam; i++)
{
tree.put(_paramDesc[i][0], _paramFloat[i]);
}
for (size_t i = 0; i < nrIntParam; i++)
{
tree.put(_paramDesc[nrFloatParam+i][0], _paramInt[i]);
}
for (size_t i = 0; i < nrBoolParam; i++)
{
tree.put(_paramDesc[nrFloatParam + nrIntParam +i][0], _paramBool[i]);
}
pt::xml_writer_settings<std::string> settings('\t', 1);
pt::write_xml(outFileName, tree, std::locale(), settings);
}
};
| 27.269406 | 87 | 0.655224 | [
"object"
] |
9365e8cc4ff82da66ee4656b42a6f94a80591bfc | 2,926 | hpp | C++ | include/epiworld/entity-meat.hpp | UofUEpi/epiworld | a510644b05803f8c617dfcb7a909805649da3eb2 | [
"MIT"
] | null | null | null | include/epiworld/entity-meat.hpp | UofUEpi/epiworld | a510644b05803f8c617dfcb7a909805649da3eb2 | [
"MIT"
] | null | null | null | include/epiworld/entity-meat.hpp | UofUEpi/epiworld | a510644b05803f8c617dfcb7a909805649da3eb2 | [
"MIT"
] | null | null | null | #ifndef EPIWORLD_ENTITY_MEAT_HPP
#define EPIWORLD_ENTITY_MEAT_HPP
template<typename TSeq>
inline void Entity<TSeq>::add_agent(Agent<TSeq> & p)
{
// Need to add it to the actions, through the individual
p.add_entity(*this);
}
template<typename TSeq>
inline void Entity<TSeq>::add_agent(Agent<TSeq> * p)
{
p->add_entity(*this);
}
template<typename TSeq>
inline void Entity<TSeq>::rm_agent(size_t idx)
{
if (idx >= n_agents)
throw std::out_of_range(
"Trying to remove agent "+ std::to_string(idx) +
" out of " + std::to_string(n_agents)
);
agents[idx]->rm_entity(*this);
return;
}
template<typename TSeq>
inline size_t Entity<TSeq>::size() const noexcept
{
return n_agents;
}
template<typename TSeq>
inline void Entity<TSeq>::set_location(std::vector< epiworld_double > loc)
{
location = loc;
}
template<typename TSeq>
inline std::vector< epiworld_double > & Entity<TSeq>::get_location()
{
return location;
}
template<typename TSeq>
inline typename std::vector< Agent<TSeq> * >::iterator Entity<TSeq>::begin()
{
if (n_agents == 0)
return agents.end();
return agents.begin();
}
template<typename TSeq>
inline typename std::vector< Agent<TSeq> * >::iterator Entity<TSeq>::end()
{
return agents.begin() + n_agents;
}
template<typename TSeq>
inline typename std::vector< Agent<TSeq> * >::const_iterator Entity<TSeq>::begin() const
{
if (n_agents == 0)
return agents.end();
return agents.begin();
}
template<typename TSeq>
inline typename std::vector< Agent<TSeq> * >::const_iterator Entity<TSeq>::end() const
{
return agents.begin() + n_agents;
}
template<typename TSeq>
inline Agent<TSeq> * Entity<TSeq>::operator[](size_t i)
{
if (n_agents <= i)
throw std::logic_error("There are not that many agents in this entity.");
return agents[i];
}
template<typename TSeq>
inline int Entity<TSeq>::get_id() const noexcept
{
return id;
}
template<typename TSeq>
inline const std::string & Entity<TSeq>::get_name() const noexcept
{
return entity_name;
}
template<typename TSeq>
inline void Entity<TSeq>::set_status(
epiworld_fast_int init,
epiworld_fast_int end
)
{
status_init = init;
status_post = end;
}
template<typename TSeq>
inline void Entity<TSeq>::set_queue(
epiworld_fast_int init,
epiworld_fast_int end
)
{
queue_init = init;
queue_post = end;
}
template<typename TSeq>
inline void Entity<TSeq>::get_status(
epiworld_fast_int * init,
epiworld_fast_int * post
)
{
if (init != nullptr)
*init = status_init;
if (post != nullptr)
*post = status_post;
}
template<typename TSeq>
inline void Entity<TSeq>::get_queue(
epiworld_fast_int * init,
epiworld_fast_int * post
)
{
if (init != nullptr)
*init = queue_init;
if (post != nullptr)
*post = queue_post;
}
#endif | 19.124183 | 88 | 0.669856 | [
"vector"
] |
9373bbf2802d5b1513f93e9972e54dbe0ed3e5ab | 4,036 | cpp | C++ | heavenLi_pyopengl/hliGLutils/buttonUtils/drawPrim.cpp | iyr/heavenli | 90f2786b0a8934302910f2214e71ee851e678baa | [
"BSD-3-Clause"
] | null | null | null | heavenLi_pyopengl/hliGLutils/buttonUtils/drawPrim.cpp | iyr/heavenli | 90f2786b0a8934302910f2214e71ee851e678baa | [
"BSD-3-Clause"
] | null | null | null | heavenLi_pyopengl/hliGLutils/buttonUtils/drawPrim.cpp | iyr/heavenli | 90f2786b0a8934302910f2214e71ee851e678baa | [
"BSD-3-Clause"
] | null | null | null | using namespace std;
GLuint extraPrimVerts;
PyObject* drawPrim_hliGLutils(PyObject* self, PyObject *args) {
PyObject *faceColorPyTup;
PyObject *extraColorPyTup;
PyObject *detailColorPyTup;
float gx, gy, ao, scale, w2h;
//float faceColor[4];
//float extraColor[4];
//float detailColor[4];
GLuint primVerts;
// Parse Inputs
if ( !PyArg_ParseTuple(args,
"fffffOOO",
&gx, &gy,
&scale,
&ao,
&w2h,
&faceColorPyTup,
&extraColorPyTup,
&detailColorPyTup) )
{
Py_RETURN_NONE;
}
if (drawCalls.count("primButton") <= 0)
drawCalls.insert(std::make_pair("primButton", drawCall()));
drawCall* primButton = &drawCalls["primButton"];
//faceColor[0] = float(PyFloat_AsDouble(PyTuple_GetItem(faceColorPyTup, 0)));
//faceColor[1] = float(PyFloat_AsDouble(PyTuple_GetItem(faceColorPyTup, 1)));
//faceColor[2] = float(PyFloat_AsDouble(PyTuple_GetItem(faceColorPyTup, 2)));
//faceColor[3] = float(PyFloat_AsDouble(PyTuple_GetItem(faceColorPyTup, 3)));
//extraColor[0] = float(PyFloat_AsDouble(PyTuple_GetItem(extraColorPyTup, 0)));
//extraColor[1] = float(PyFloat_AsDouble(PyTuple_GetItem(extraColorPyTup, 1)));
//extraColor[2] = float(PyFloat_AsDouble(PyTuple_GetItem(extraColorPyTup, 2)));
//extraColor[3] = float(PyFloat_AsDouble(PyTuple_GetItem(extraColorPyTup, 3)));
//detailColor[0] = float(PyFloat_AsDouble(PyTuple_GetItem(detailColorPyTup, 0)));
//detailColor[1] = float(PyFloat_AsDouble(PyTuple_GetItem(detailColorPyTup, 1)));
//detailColor[2] = float(PyFloat_AsDouble(PyTuple_GetItem(detailColorPyTup, 2)));
//detailColor[3] = float(PyFloat_AsDouble(PyTuple_GetItem(detailColorPyTup, 3)));
//int circleSegments = 60;
if (primButton->numVerts == 0){
printf("Initializing Geometry for Prim Button\n");
vector<GLfloat> verts;
vector<GLfloat> colrs;
//float px, py, qx, qy, radius;
/*
float colors[18] = {
1.0f, 1.0f, 0.0f,
1.0f, 0.0f, 1.0f,
0.0f, 1.0f, 1.0f,
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f};
*/
//defineRoundRect(-0.25f, 0.25f, 0.55f, -0.05f, 0.02f, 15, detailColor, verts, colrs);
/*
defineQuad2pt(
-0.25f, -0.25f,
-0.5f, -0.5f,
faceColor,
verts, colrs);
defineQuad2pt(
0.25f, -0.25f,
0.5f, -0.5f,
faceColor,
verts, colrs);
defineQuad2pt(
-0.25f, 0.25f,
-0.5f, 0.5f,
faceColor,
verts, colrs);
defineQuad2pt(
0.25f, 0.25f,
0.5f, 0.5f,
faceColor,
verts, colrs);
*/
primVerts = verts.size()/2;
map<string, attribCache> attributeData;
attributeData[VAS.coordData] = attribCache(VAS.coordData, 2, 0, 0);
attributeData[VAS.colorData] = attribCache(VAS.colorData, 4, 2, 1);
attributeData[VAS.coordData].writeCache(verts.data(), verts.size());
attributeData[VAS.colorData].writeCache(colrs.data(), colrs.size());
primButton->buildCache(primVerts, attributeData);
printf("primVerts: %d, primButton->numVerts: %d\n", primVerts, primButton->numVerts);
}
/*
int index = 0;
GLboolean updateCache = GL_FALSE;
// Update Color, if needed
for (int i = 0; i < 4; i++) {
if ( (GLfloat *)primButton->getAttribCache(VAS.colorData)[extraPrimVerts*4+i] != extraColor[i] ) {
for (unsigned int k = extraPrimVerts; k < primButton->numVerts; k++) {
(GLfloat *)primButton->getAttribCache(VAS.colorData)[k*4 + i] = extraColor[i];
}
updateCache = GL_TRUE;
}
}
// Update colors, if needed
if ( updateCache ){
primButton->updateBuffer(VAS.colorData);
}
*/
primButton->updateMVP(gx, gy, scale, scale, ao, w2h);
primButton->draw();
Py_RETURN_NONE;
}
| 30.575758 | 104 | 0.600347 | [
"geometry",
"vector"
] |
937717e57d624c8033e3fd49656af082d8917a6a | 2,687 | cpp | C++ | src/main/main.cpp | tobyndax/AdventOfCode2021 | 298f73ca1b1323a6a9ad27d612bd3699ee0b07ce | [
"MIT"
] | null | null | null | src/main/main.cpp | tobyndax/AdventOfCode2021 | 298f73ca1b1323a6a9ad27d612bd3699ee0b07ce | [
"MIT"
] | 9 | 2021-12-01T19:58:35.000Z | 2021-12-12T14:25:35.000Z | src/main/main.cpp | tobyndax/AdventOfCode2021 | 298f73ca1b1323a6a9ad27d612bd3699ee0b07ce | [
"MIT"
] | null | null | null | #include "src/lib/cpplib.h"
#include "src/lib/day1solver.h"
#include "src/lib/day2solver.h"
#include "src/lib/day3solver.h"
#include "src/lib/day4solver.h"
#include "src/lib/day5solver.h"
#include "src/lib/day6solver.h"
#include "src/lib/day7solver.h"
#include "src/lib/util.h"
#include <iostream>
int main() {
int day = 7;
if (day == 7) {
FileReader fileReader("src/main/day7/input.txt");
auto data = fileReader.getAsIntegers(',');
Day7Solver solver(data);
int pos, fuel;
solver.solve(pos, fuel);
std::cout << fuel << std::endl;
} else if (day == 6) {
FileReader fileReader("src/main/day6/input.txt");
auto data = fileReader.getAsIntegers(',');
Day6Solver solver(data);
long long int numFish = solver.solve(256);
std::cout << numFish << std::endl;
} else if (day == 5) {
std::string path = "src/main/day5/input.txt";
FileReader fileReader(path);
std::vector<std::pair<Point3D, Point3D>> data =
fileReader.getAsLineCoordinates();
Day5Solver solver(data);
int dangerSum = solver.solve(false);
std::cout << dangerSum << std::endl;
} else if (day == 4) {
std::string path = "src/main/day4/input.txt";
FileReader fileReader(path);
std::vector<int> bingoNumbers;
std::vector<BingoTile> bingoTiles;
fileReader.getBingoTiles(bingoNumbers, bingoTiles);
Day4Solver solver;
int winnerScore;
int currentNumber;
int tileSum;
solver.solveWorstTile(bingoNumbers, bingoTiles, winnerScore, currentNumber,
tileSum);
std::cout << winnerScore << std::endl;
} else if (day == 3) {
std::string path = "src/main/day3/input.txt";
FileReader fileReader(path);
std::vector<std::string> data = fileReader.getAsStrings();
Day3Solver solver(data);
int gamma = 0;
int epsilon = 0;
int ogr = 0;
int csr = 0;
solver.solve(gamma, epsilon, ogr, csr);
int multGE = gamma * epsilon;
std::cout << multGE << std::endl;
int multOC = ogr * csr;
std::cout << multOC << std::endl;
} else if (day == 2) {
std::string path = "src/main/day2/input.txt";
FileReader fileReader(path);
std::vector<std::pair<Point3D, int>> data = fileReader.getDirectionValue();
Day2Solver solver(data);
Point3D position = solver.solveWithAim();
int res = position.x * position.z;
std::cout << res << std::endl;
} else if (day == 1) {
std::string path = "src/main/day1/input.txt";
FileReader fileReader(path);
auto ints = fileReader.getAsIntegers();
Day1Solver solver(ints);
int count = solver.countIncreases(3);
std::cout << count << std::endl;
}
return 0;
}
| 26.60396 | 79 | 0.634909 | [
"vector"
] |
9386c5182053bc9da5a44524212f51faf3befcc4 | 6,646 | hpp | C++ | ql/experimental/templatemodels/auxilliaries/integratorsT.hpp | sschlenkrich/quantlib | ff39ad2cd03d06d185044976b2e26ce34dca470c | [
"BSD-3-Clause"
] | null | null | null | ql/experimental/templatemodels/auxilliaries/integratorsT.hpp | sschlenkrich/quantlib | ff39ad2cd03d06d185044976b2e26ce34dca470c | [
"BSD-3-Clause"
] | null | null | null | ql/experimental/templatemodels/auxilliaries/integratorsT.hpp | sschlenkrich/quantlib | ff39ad2cd03d06d185044976b2e26ce34dca470c | [
"BSD-3-Clause"
] | null | null | null | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Copyright (C) 2010 Sebastian Schlenkrich
*/
/*! \file integratorsT.hpp
\brief provide template functions for numerical integration
*/
#ifndef quantlib_templateintegrators_hpp
#define quantlib_templateintegrators_hpp
#include <boost/function.hpp>
//#include <boost/math/special_functions/erf.hpp>
//#include <ql/experimental/template/auxilliaries/MinimADVariable2.hpp>
namespace TemplateAuxilliaries {
// evaluate \int_a^b v(t) f(t) dt = \sum v_i [F(t_i) - F(t_i-1)] with
// v(t) piece-wise left-constant,
// F'(t) = f(t)
template <typename PassiveType, typename ActiveType, typename FuncType>
class PieceWiseConstantIntegral {
private:
std::vector<PassiveType> t_;
std::vector<ActiveType> v_;
FuncType F_;
public:
PieceWiseConstantIntegral(const std::vector<PassiveType>& t, const std::vector<ActiveType>& v, const FuncType& F) : t_(t), v_(v), F_(F) {}
ActiveType operator()(PassiveType startTime, PassiveType endTime) {
int sgn = 1;
if (startTime>endTime) { // we want to ensure startTime <= endTime
PassiveType t = startTime;
startTime = endTime;
endTime = t;
sgn = -1;
}
// organising indices
size_t idx_min = 0;
size_t idx_max = std::min(t_.size(),v_.size())-1;
size_t idx_last = idx_max;
// enforce a < t_min <= t_max < b or special treatment
while ((startTime>=t_[idx_min])&&(idx_min<idx_last)) ++idx_min;
while ((endTime <=t_[idx_max])&&(idx_max>0 )) --idx_max;
ActiveType tmp = sgn * ( F_(endTime) - F_(startTime) );
if (endTime<=t_[0]) return v_[0] * tmp; // short end
if (idx_min==idx_last) return v_[idx_last] * tmp; // long end
if (idx_min> idx_max) return v_[idx_min] * tmp; // integration within grid interval
// integral a ... x_min
tmp = v_[idx_min] * ( F_(t_[idx_min]) - F_(startTime) );
// integral x_min ... x_max
for (size_t i=idx_min; i<idx_max; ++i) tmp += v_[i+1] * ( F_(t_[i+1]) - F_(t_[i]) );
// integral x_max ... b
if (idx_max<idx_last) tmp += v_[idx_max+1] * ( F_(endTime) - F_(t_[idx_max]) );
else tmp += v_[idx_max] * ( F_(endTime) - F_(t_[idx_max]) );
// finished
return sgn * tmp;
}
};
// evaluate \int_x(0)^x(n) v(x) f(x) dx via trapezoidal rule
// v(x) interpolated values on variable x-grid
// f(x) scalar function as functor
class TrapezoidalIntegral {
public:
template <typename PassiveType, typename ActiveType, typename FuncType>
ActiveType operator()(const std::vector<PassiveType>& x, const std::vector<ActiveType>& v, const FuncType& f) {
size_t n=std::min(x.size(),v.size());
if (n<2) return (ActiveType)0.0;
ActiveType sum=0;
for (size_t i=0; i<n-1; ++i) sum += 0.5*(v[i]*f(x[i]) + v[i+1]*f(x[i+1]))*(x[i+1] - x[i]);
return sum;
}
};
// evaluate \int_x[0]^x[n-1] v(x) f(x) dx via Gau�-Tschebyschow-Integration
// x[0] left boundary, x[n-1] right boundary
// x[1], ..., x[n-2] Gauss-Tschebyschow grid points
// v(x) interpolated values on x-grid
// f(x) scalar function as functor
class GaussTschebyschowIntegral {
public:
template <typename PassiveType>
std::vector<PassiveType> getGrid(PassiveType a, PassiveType b, size_t n) {
std::vector<PassiveType> x(n);
if (n==0) return x;
if (n==1) { x[0] = 0.5*(a+b); return x; }
x[0] = a;
x[n-1] = b;
if (n==2) return x;
// n>2
for (size_t k=1; k<n-1; ++k) {
x[k] = -cos( (2.0*k-1.0) / (2.0*(n-2.0)) * M_PI ); // x \in (-1, 1)
x[k] = 0.5*(b-a)*(x[k]+1) + a; // x \in ( a, b)
}
return x;
}
template <typename PassiveType, typename ActiveType, typename FuncType>
ActiveType operator()(const std::vector<PassiveType>& x, const std::vector<ActiveType>& v, const FuncType& f) {
size_t n=std::min(x.size(),v.size());
if (n<3) return TrapezoidalIntegral()(x,v,f);
ActiveType sum=0;
for (size_t k=1; k<n-1; ++k) {
sum += v[k] * f(x[k]) * sin( (2*k-1)/(2*(n-2))*M_PI );
}
sum *= M_PI / (n-2);
return sum;
}
};
// 4th order Runge Kutta step for y' = f(t,y)
// via y1 = y0 + b^T k dt
// k_i = f(t+c_i dt, y0 + a_i^T k dt)
template <typename DateType, typename ActiveType>
void rungeKuttaStep( const std::vector<ActiveType>& y0,
const DateType t,
const boost::function< void (const DateType, const std::vector<ActiveType>&, std::vector<ActiveType>&) >& f,
const DateType dt,
std::vector<ActiveType>& y1 ) {
std::vector<ActiveType> k1(y0.size()), k2(y0.size()), k3(y0.size()), k4(y0.size());
y1 = y0;
// we add an epsilon in case we are at a boundary of piecewise constant parameters
DateType eps = 1.0e-8*dt;
// k1 = f(t,y0)
f( t+eps, y0, k1);
for (size_t i=0; i<y0.size(); ++i) y1[i] += 1.0/6.0 * dt * k1[i];
// k2 = f(t + 0.5dt, y0 + 0.5 k1)
for (size_t i=0; i<y0.size(); ++i) k1[i] = y0[i] + 0.5 * dt * k1[i];
f( t+0.5*dt, k1, k2);
for (size_t i=0; i<y0.size(); ++i) y1[i] += 1.0/3.0 * dt * k2[i];
// k3 = f(t + 0.5dt, y0 + 0.5 k2)
for (size_t i=0; i<y0.size(); ++i) k2[i] = y0[i] + 0.5 * dt * k2[i];
f( t+0.5*dt, k2, k3);
for (size_t i=0; i<y0.size(); ++i) y1[i] += 1.0/3.0 * dt * k3[i];
// k4 = f(t + dt, y0 + k3)
for (size_t i=0; i<y0.size(); ++i) k3[i] = y0[i] + dt * k3[i];
f( t+1.0*dt-eps, k3, k4);
for (size_t i=0; i<y0.size(); ++i) y1[i] += 1.0/6.0 * dt * k4[i];
return;
}
}
#endif /* quantlib_templateintegrators_hpp */
| 44.306667 | 146 | 0.494583 | [
"vector"
] |
9386e0ff883a8927a6adc1c6d67c0791e5c132b1 | 3,719 | hpp | C++ | dart/gui/osg/ImGuiHandler.hpp | fowzan123/Dart-Humanoid- | 03b24a7cd2ecfa5ac20e38460b6564ae65a5ad7a | [
"BSD-2-Clause"
] | 1 | 2020-01-14T09:37:25.000Z | 2020-01-14T09:37:25.000Z | dart/gui/osg/ImGuiHandler.hpp | fowzan123/Dart-Humanoid- | 03b24a7cd2ecfa5ac20e38460b6564ae65a5ad7a | [
"BSD-2-Clause"
] | null | null | null | dart/gui/osg/ImGuiHandler.hpp | fowzan123/Dart-Humanoid- | 03b24a7cd2ecfa5ac20e38460b6564ae65a5ad7a | [
"BSD-2-Clause"
] | null | null | null | /*
* Copyright (c) 2011-2019, The DART development contributors
* All rights reserved.
*
* The list of contributors can be found at:
* https://github.com/dartsim/dart/blob/master/LICENSE
*
* This file is provided under the following "BSD-style" License:
* 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 code incorporates portions of Open Dynamics Engine
* (Copyright (c) 2001-2004, Russell L. Smith. All rights
* reserved.) and portions of FCL (Copyright (c) 2011, Willow
* Garage, Inc. All rights reserved.), which were released under
* the same BSD license as below
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DART_GUI_OSG_IMGUIHANDLER_HPP_
#define DART_GUI_OSG_IMGUIHANDLER_HPP_
#include <array>
#include <memory>
#include <vector>
#include <osg/GraphicsContext>
#include <osgGA/GUIActionAdapter>
#include <osgGA/GUIEventAdapter>
#include <osgGA/GUIEventHandler>
namespace dart {
namespace gui {
namespace osg {
class ImGuiWidget;
class ImGuiHandler : public osgGA::GUIEventHandler
{
public:
/// Constructor
ImGuiHandler();
void init();
void newFrame(::osg::RenderInfo& renderInfo);
void render(::osg::RenderInfo& renderInfo);
void setCameraCallbacks(::osg::Camera* camera);
//----------------------------------------------------------------------------
/// \{ \name Widget management
//----------------------------------------------------------------------------
/// Returns true if this Viewer contains given widget.
bool hasWidget(const std::shared_ptr<ImGuiWidget>& widget) const;
/// Adds given Widget to this Viewer.
void addWidget(const std::shared_ptr<ImGuiWidget>& widget,
bool visible = true);
/// Removes given Widget from this Viewer.
void removeWidget(const std::shared_ptr<ImGuiWidget>& widget);
/// Removes all the widgets in this Viewer.
void removeAllWidget();
/// \}
// Documentation inherited.
bool handle(const osgGA::GUIEventAdapter& eventAdapter,
osgGA::GUIActionAdapter& actionAdapter,
::osg::Object* object,
::osg::NodeVisitor* nodeVisitor) override;
protected:
double mTime;
/// Mouse buttons: left, right, middle.
std::array<bool, 3> mMousePressed;
float mMouseWheel;
GLuint mFontTexture;
std::vector<std::shared_ptr<ImGuiWidget>> mWidgets;
};
} // namespace osg
} // namespace gui
} // namespace dart
#endif // DART_GUI_OSG_IMGUIHANDLER_HPP_
| 32.622807 | 80 | 0.690777 | [
"render",
"object",
"vector"
] |
9393c4568ed30cffd1a144d0a60048bfbc5804f0 | 2,208 | cpp | C++ | scripts/plot_pid.cpp | cannontwo/cannon | 4be79f3a6200d1a3cd26c28c8f2250dbdf08f267 | [
"MIT"
] | null | null | null | scripts/plot_pid.cpp | cannontwo/cannon | 4be79f3a6200d1a3cd26c28c8f2250dbdf08f267 | [
"MIT"
] | 46 | 2021-01-12T23:03:52.000Z | 2021-10-01T17:29:01.000Z | scripts/plot_pid.cpp | cannontwo/cannon | 4be79f3a6200d1a3cd26c28c8f2250dbdf08f267 | [
"MIT"
] | null | null | null | #ifdef CANNON_BUILD_GRAPHICS
#include <imgui.h>
#include <cannon/control/pid.hpp>
#include <cannon/log/registry.hpp>
#include <cannon/physics/rk4_integrator.hpp>
#include <cannon/plot/plotter.hpp>
using namespace cannon::plot;
using namespace cannon::log;
using namespace cannon::control;
static const double m = 1;
static const double b = 10;
static const double k = 20;
void step(VectorXd& s, double u, double timestep) {
VectorXd old_s = s;
s[2] = (u - k*old_s[0] - b*old_s[1]) / m;
s[1] += timestep * old_s[2];
s[0] += timestep * old_s[1];
}
std::vector<Vector2d> plot_pid_traj(double ref, double kp, double ki, double kd, double timestep) {
PidController pid(1, 1, timestep);
pid.ref()[0] = ref;
pid.proportional_gain()(0, 0) = kp;
pid.integral_gain()(0, 0) = ki;
pid.derivative_gain()(0, 0) = kd;
double time = 0.0;
VectorXd state = VectorXd::Zero(3);
std::vector<Vector2d> pts;
for (unsigned int i = 0; i < 2.0 / timestep; ++i) {
Vector2d pt;
pt << time,
state[0];
pts.push_back(pt);
VectorXd pid_state(1);
pid_state[0] = state[0];
VectorXd pid_control = pid.get_control(pid_state);
step(state, pid_control[0], timestep);
time += timestep;
}
return pts;
}
int main() {
Plotter plotter;
plotter.render([&]() {
static float ref = 1.0;
static float kp = 0.0;
static float ki = 0.0;
static float kd = 0.0;
static float timestep = 0.01;
bool changed = false;
if (ImGui::BeginMainMenuBar()) {
if (ImGui::BeginMenu("PID")) {
changed = changed || ImGui::InputFloat("Reference", &ref);
changed = changed || ImGui::InputFloat("Integration Timestep", ×tep);
changed = changed || ImGui::SliderFloat("Proportional Gain", &kp, 0.0, 1000.0);
changed = changed || ImGui::SliderFloat("Integral Gain", &ki, 0.0, 1000.0);
changed = changed || ImGui::SliderFloat("Derivative Gain", &kd, 0.0, 1000.0);
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
}
if (changed) {
plotter.clear();
auto pts = plot_pid_traj(ref, kp, ki, kd, timestep);
plotter.plot(pts);
}
});
}
#else
int main() {}
#endif
| 24.533333 | 99 | 0.619565 | [
"render",
"vector"
] |
93967f6ab767e51159af657b2dd949338ba966eb | 3,224 | cpp | C++ | src/haloray-core/opengl/textureRenderer.cpp | naavis/haloray | 628583d17fc56446dd9bb169652425ce298bd6d3 | [
"MIT"
] | 19 | 2019-06-16T22:01:57.000Z | 2022-03-26T01:09:16.000Z | src/haloray-core/opengl/textureRenderer.cpp | naavis/haloray | 628583d17fc56446dd9bb169652425ce298bd6d3 | [
"MIT"
] | 5 | 2019-06-17T09:27:06.000Z | 2020-02-02T08:35:28.000Z | src/haloray-core/opengl/textureRenderer.cpp | naavis/haloray | 628583d17fc56446dd9bb169652425ce298bd6d3 | [
"MIT"
] | 2 | 2019-06-16T22:01:59.000Z | 2019-07-15T18:31:05.000Z | #include "textureRenderer.h"
#include <memory>
#include <string>
#include <QtGlobal>
#include <stdexcept>
namespace OpenGL
{
std::unique_ptr<QOpenGLShaderProgram> TextureRenderer::initializeTexDrawShaderProgram()
{
qInfo("Initializing texture renderer vertex shader");
auto program = std::make_unique<QOpenGLShaderProgram>();
bool vertexShaderReadSucceeded = program->addCacheableShaderFromSourceFile(QOpenGLShader::ShaderTypeBit::Vertex, ":/shaders/renderer.vert");
if (vertexShaderReadSucceeded == false)
{
qWarning("Texture renderer vertex shader read failed");
throw std::runtime_error(program->log().toUtf8());
}
qInfo("Texture renderer vertex shader successfully initialized");
qInfo("Initializing texture renderer fragment shader");
bool fragmentShaderReadSucceeded = program->addCacheableShaderFromSourceFile(QOpenGLShader::ShaderTypeBit::Fragment, ":/shaders/renderer.frag");
if (fragmentShaderReadSucceeded == false)
{
qWarning("Texture renderer fragment shader read failed");
throw std::runtime_error(program->log().toUtf8());
}
qInfo("Texture renderer fragment shader successfully initialized");
if (program->link() == false)
{
qWarning("Texture renderer shader compilation and linking failed");
throw std::runtime_error(program->log().toUtf8());
}
qInfo("Texture renderer shader program compilation and linking successful");
return program;
}
TextureRenderer::TextureRenderer()
{
initialize();
}
void TextureRenderer::initialize()
{
initializeOpenGLFunctions();
float points[] = {
-1.0f,
-1.0f,
-1.0f,
1.0f,
1.0f,
-1.0f,
1.0f,
1.0f,
};
glGenVertexArrays(1, &m_quadVao);
glBindVertexArray(m_quadVao);
glEnableVertexAttribArray(0);
glGenBuffers(1, &m_quadVbo);
glBindBuffer(GL_ARRAY_BUFFER, m_quadVbo);
glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(float), points, GL_STATIC_DRAW);
glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, NULL);
m_texDrawProgram = initializeTexDrawShaderProgram();
}
void TextureRenderer::render(unsigned int haloTextureHandle, unsigned int backgroundTextureHandle, unsigned int guideTextureHandle)
{
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
/* Render simulation result texture */
m_texDrawProgram->bind();
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
glBindVertexArray(m_quadVao);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, haloTextureHandle);
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, backgroundTextureHandle);
glActiveTexture(GL_TEXTURE2);
glBindTexture(GL_TEXTURE_2D, guideTextureHandle);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glActiveTexture(GL_TEXTURE0);
}
void TextureRenderer::setUniformFloat(std::string name, float value)
{
m_texDrawProgram->bind();
m_texDrawProgram->setUniformValue(name.c_str(), value);
}
TextureRenderer::~TextureRenderer()
{
glBindVertexArray(0);
glDeleteVertexArrays(1, &m_quadVao);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glDeleteBuffers(1, &m_quadVbo);
}
}
| 28.034783 | 148 | 0.716811 | [
"render"
] |
9399eeac26c150c285a428e86cb101990ee0c8bc | 4,841 | cpp | C++ | Tracing/Preprocessing/CurveletFiltering/fdct_wrapping_cpp/src/fdct_wrapping_param.cpp | tostathaina/farsight | 7e9d6d15688735f34f7ca272e4e715acd11473ff | [
"Apache-2.0"
] | 21 | 2017-11-02T21:17:05.000Z | 2022-02-17T17:48:47.000Z | Tracing/Preprocessing/CurveletFiltering/fdct_wrapping_cpp/src/fdct_wrapping_param.cpp | YanXuHappygela/Farsight | 1711b2a1458c7e035edd21fe0019a1f7d23fcafa | [
"Apache-2.0"
] | 2 | 2017-11-02T23:39:21.000Z | 2018-01-19T23:15:46.000Z | Tracing/Preprocessing/CurveletFiltering/fdct_wrapping_cpp/src/fdct_wrapping_param.cpp | YanXuHappygela/Farsight | 1711b2a1458c7e035edd21fe0019a1f7d23fcafa | [
"Apache-2.0"
] | 12 | 2017-11-02T21:17:11.000Z | 2022-03-23T16:14:42.000Z | /*
Copyright (C) 2004 Caltech
Written by Lexing Ying
*/
#include "fdct_wrapping.hpp"
#include "fdct_wrapping_inline.hpp"
FDCT_WRAPPING_NS_BEGIN_NAMESPACE
int fdct_wrapping_param_sepangle(double XL1, double XL2, int nbangle,
vector<double>& sx, vector<double>& sy,
vector<double>& fx, vector<double>& fy,
vector<int>& nx, vector<int>& ny);
int fdct_wrapping_param_wavelet(int N1, int N2,
vector<double>& sx, vector<double>& sy,
vector<double>& fx, vector<double>& fy,
vector<int>& nx, vector<int>& ny);
//--------------------------------------------------
int fdct_wrapping_param(int N1, int N2, int nbscales, int nbangles_coarse, int allcurvelets,
vector< vector<double> >& sx, vector< vector<double> >& sy,
vector< vector<double> >& fx, vector< vector<double> >& fy,
vector< vector<int> >& nx, vector< vector<int> >& ny)
{
//sx, sy, step in spatial domain
//fx, fy, position in frequency domain
//nx, ny, size of the grid
sx.resize(nbscales); sy.resize(nbscales);
fx.resize(nbscales); fy.resize(nbscales);
nx.resize(nbscales); ny.resize(nbscales);
vector<int> nbangles(nbscales);
if(allcurvelets==1) {
//nbangles
nbangles[0] = 1;
for(int sc=1; sc<nbscales; sc++) nbangles[sc] = nbangles_coarse * pow2( int(ceil(double(sc-1)/2)) );
//high freq levels
double XL1 = 4.0*N1/3.0; double XL2 = 4.0*N2/3.0; //range
for(int sc=nbscales-1; sc>0; sc--) {
fdct_wrapping_param_sepangle(XL1, XL2, nbangles[sc], sx[sc], sy[sc], fx[sc], fy[sc], nx[sc], ny[sc]);
XL1 /= 2; XL2 /= 2;
}
//coarsest level
int XS1, XS2; int XF1, XF2; double XR1, XR2; fdct_wrapping_rangecompute(XL1, XL2, XS1, XS2, XF1, XF2, XR1, XR2);
fdct_wrapping_param_wavelet(XS1, XS2, sx[0], sy[0], fx[0], fy[0], nx[0], ny[0]);
} else {
//nbangles
nbangles[0] = 1;
for(int sc=1; sc<nbscales-1; sc++) nbangles[sc] = nbangles_coarse * pow2( int(ceil(double(sc-1)/2)) );
nbangles[nbscales-1] = 1;
//top level
fdct_wrapping_param_wavelet(N1, N2, sx[nbscales-1], sy[nbscales-1], fx[nbscales-1], fy[nbscales-1], nx[nbscales-1], ny[nbscales-1]);
//next levels
double XL1 = 2.0*N1/3.0; double XL2 = 2.0*N2/3.0; //range
for(int sc=nbscales-2; sc>0; sc--) {
fdct_wrapping_param_sepangle(XL1, XL2, nbangles[sc], sx[sc], sy[sc], fx[sc], fy[sc], nx[sc], ny[sc]);
XL1 /= 2; XL2 /= 2;
}
//coarsest level
int XS1, XS2; int XF1, XF2; double XR1, XR2; fdct_wrapping_rangecompute(XL1, XL2, XS1, XS2, XF1, XF2, XR1, XR2);
fdct_wrapping_param_wavelet(XS1, XS2, sx[0], sy[0], fx[0], fy[0], nx[0], ny[0]);
}
return 0;
}
//--------------------------------------------------
int fdct_wrapping_param_sepangle(double XL1, double XL2, int nbangle,
vector<double>& sx, vector<double>& sy,
vector<double>& fx, vector<double>& fy,
vector<int>& nx, vector<int>& ny)
{
fx.resize(nbangle); fy.resize(nbangle);
nx.resize(nbangle); ny.resize(nbangle);
sx.resize(nbangle); sy.resize(nbangle);
int nbquadrants = 4;
int nd = nbangle / 4; //int nbangles_perquad = nbangles[sc] / 4;
int wcnt = 0;
//backup
double XL1b = XL1; double XL2b = XL2;
int qvec[] = {2,1,0,3};
for(int qi=0; qi<nbquadrants; qi++) {
int q = qvec[qi];
fdct_wrapping_rotate_forward(q, XL1b, XL2b, XL1, XL2); XL1 = abs(XL1); XL2 = abs(XL2);
double XW1 = XL1/nd; double XW2 = XL2/nd;
int XS1, XS2; int XF1, XF2; double XR1, XR2; fdct_wrapping_rangecompute(XL1, XL2, XS1, XS2, XF1, XF2, XR1, XR2);
for(int w=nd-1; w>=0; w--) {
//get size
double xs = XR1/4 - (XW1/2)/4;
double xe = XR1;
double ys = -XR2 + (w-0.5)*XW2;
double ye = -XR2 + (w+1.5)*XW2; //x range
int xn = int(ceil(xe-xs)); int yn = int(ceil(ye-ys));
//MAKE THEM ODD
if(xn%2==0) xn++; if(yn%2==0) yn++;
double tx; double ty;
//fx,fy
tx = XR1/2; ty = (-XR2 + (w+0.5)*XW2)/2; //center, NOTE: need /2
fdct_wrapping_rotate_backward(q, tx, ty, fx[wcnt], fy[wcnt]);
//sx, sy;
tx = 1.0/xn; ty = 1.0/yn;
fdct_wrapping_rotate_backward(q, xn, yn, nx[wcnt], ny[wcnt]); nx[wcnt] = abs(nx[wcnt]); ny[wcnt] = abs(ny[wcnt]);
fdct_wrapping_rotate_backward(q, tx, ty, sx[wcnt], sy[wcnt]); sx[wcnt] = abs(sx[wcnt]); sy[wcnt] = abs(sy[wcnt]);
wcnt++;
}
}
return 0;
}
//--------------------------------------------------
int fdct_wrapping_param_wavelet(int S1, int S2,
vector<double>& sx, vector<double>& sy,
vector<double>& fx, vector<double>& fy,
vector<int>& nx, vector<int>& ny)
{
fx.resize(1); fx[0] = 0;
fy.resize(1); fy[0] = 0;
nx.resize(1); nx[0] = S1;
ny.resize(1); ny[0] = S2;
double dx = 1.0/S1; double dy = 1.0/S2;
sx.resize(1); sx[0] = dx;
sy.resize(1); sy[0] = dy;
return 0;
}
FDCT_WRAPPING_NS_END_NAMESPACE
| 36.954198 | 134 | 0.595538 | [
"vector"
] |
4d33e35bd53d8d47e1f8997051109a2eda99fe4c | 1,292 | hpp | C++ | src/renderer.hpp | nagaunv/rt | c96b74ed645c6f534c4d41f8e1e767fd56aad4f3 | [
"MIT"
] | null | null | null | src/renderer.hpp | nagaunv/rt | c96b74ed645c6f534c4d41f8e1e767fd56aad4f3 | [
"MIT"
] | null | null | null | src/renderer.hpp | nagaunv/rt | c96b74ed645c6f534c4d41f8e1e767fd56aad4f3 | [
"MIT"
] | null | null | null | #pragma once
#include <type_traits>
#include "image.hpp"
namespace naga::rt {
/// Renderer
class Renderer {
public:
/// Render image
virtual void render(Image& img) const = 0;
/// Dtor
virtual ~Renderer() {}
protected:
Renderer() = default;
};
/// PixelRenderer
template <class T>
class PixelRenderer {
protected:
PixelRenderer() = default;
private:
/// Check if T has valid constructor
void _check_constructor() {
static_assert(
std::is_same_v<
T, decltype(
T(std::shared_ptr<Scene>(),
std::shared_ptr<Camera>(),
PixelLength(),
PixelLength()))>,
"T does not satisfy PixelRenderer requirements");
}
/// Check if T has valid render()
void _check_render() {
// Pixel render(PixelIndex x, PixelIndex y) const;
static_assert(
std::is_same_v<
Pixel,
decltype(std::declval<const T>().render(PixelIndex(), PixelIndex()))>,
"T does not satisfy PixelRenderer requirements");
}
template <auto _T>
struct _concept_check {};
using _render_concept_check = _concept_check<&_check_render>;
using _constructor_concept_check = _concept_check<&_check_constructor>;
};
} | 24.377358 | 80 | 0.604489 | [
"render"
] |
4d38ad465fa8a6c061cb59cb82b7c72f91766ddb | 875 | cpp | C++ | CppMonoMain/source/Log.cpp | BartoszJakubZielonka/Cpp_Mono_Example | 8dffab580d6c9a5eca01555a34f6dbe946817b07 | [
"MIT"
] | null | null | null | CppMonoMain/source/Log.cpp | BartoszJakubZielonka/Cpp_Mono_Example | 8dffab580d6c9a5eca01555a34f6dbe946817b07 | [
"MIT"
] | null | null | null | CppMonoMain/source/Log.cpp | BartoszJakubZielonka/Cpp_Mono_Example | 8dffab580d6c9a5eca01555a34f6dbe946817b07 | [
"MIT"
] | null | null | null | #include "Log.h"
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/basic_file_sink.h>
std::shared_ptr<spdlog::logger> Log::coreLogger;
std::shared_ptr<spdlog::logger> Log::clientLogger;
void Log::init()
{
std::vector<spdlog::sink_ptr> logSinks;
logSinks.emplace_back(std::make_shared<spdlog::sinks::stdout_color_sink_mt>());
logSinks[0]->set_pattern("%^[%T] %n: %v%$");
coreLogger = std::make_shared<spdlog::logger>("Viking", begin(logSinks), end(logSinks));
spdlog::register_logger(coreLogger);
coreLogger->set_level(spdlog::level::trace);
coreLogger->flush_on(spdlog::level::trace);
clientLogger = std::make_shared<spdlog::logger>("APP", begin(logSinks), end(logSinks));
spdlog::register_logger(clientLogger);
clientLogger->set_level(spdlog::level::trace);
clientLogger->flush_on(spdlog::level::trace);
}
| 33.653846 | 92 | 0.716571 | [
"vector"
] |
4d3ead80f589e56721233a89129dfe8975c3b71e | 11,272 | cpp | C++ | source/laplace/platform/linux/linux_window.cpp | automainint/laplace | 66956df506918d48d79527e524ff606bb197d8af | [
"MIT"
] | 3 | 2021-05-17T21:15:28.000Z | 2021-09-06T23:01:52.000Z | source/laplace/platform/linux/linux_window.cpp | automainint/laplace | 66956df506918d48d79527e524ff606bb197d8af | [
"MIT"
] | 33 | 2021-10-20T10:47:07.000Z | 2022-02-26T02:24:20.000Z | source/laplace/platform/linux/linux_window.cpp | automainint/laplace | 66956df506918d48d79527e524ff606bb197d8af | [
"MIT"
] | null | null | null | /* laplace/platform/linux/linux_window.cpp
*
* Copyright (c) 2021 Mitya Selivanov
*
* This file is part of the Laplace project.
*
* Laplace 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 MIT License for more details.
*/
#include "window.h"
#include "../../core/string.h"
#include "glx.h"
#include <chrono>
namespace laplace::linux {
using std::chrono::steady_clock, std::chrono::milliseconds,
std::chrono::duration_cast;
sl::vector<window *> window::windows;
char const window::default_name[] = "Laplace Application";
bool const window::default_is_visible = true;
sl::whole const window::default_frame_width = 960;
sl::whole const window::default_frame_height = 720;
sl::whole const window::default_frame_rate = 24;
sl::whole window::xevent_mask = KeyPressMask | KeyReleaseMask |
ButtonPressMask |
ButtonReleaseMask |
EnterWindowMask | LeaveWindowMask |
PointerMotionMask |
VisibilityChangeMask |
FocusChangeMask |
StructureNotifyMask |
SubstructureNotifyMask;
window::window() noexcept {
init();
}
window::window(native_handle) noexcept {
init();
}
window::~window() noexcept {
cleanup();
}
void window::on_init(event_init ev) noexcept {
m_on_init = std::move(ev);
}
void window::on_cleanup(event_cleanup ev) noexcept {
m_on_cleanup = std::move(ev);
}
void window::on_frame(event_frame ev) noexcept {
m_on_frame = std::move(ev);
}
void window::on_size(event_size ev) noexcept {
m_on_size = std::move(ev);
}
void window::on_focus(event_focus ev) noexcept {
m_on_focus = std::move(ev);
}
void window::on_drop_file(event_drop_file ev) noexcept {
m_on_drop_file = std::move(ev);
}
void window::set_name(std::string_view name) noexcept {
m_name = name;
if (m_ok) {
XStoreName(m_display, m_handle, m_name.c_str());
}
}
void window::set_name(std::wstring_view name) noexcept {
set_name(to_string(name));
}
void window::set_visible(bool is_visible) noexcept {
if (m_is_visible != is_visible) {
m_is_visible = is_visible;
if (m_ok) {
if (is_visible)
XMapWindow(m_display, m_handle);
else
XUnmapWindow(m_display, m_handle);
}
}
}
void window::set_fullscreen(bool) noexcept { }
void window::set_centered() noexcept { }
void window::set_position(sl::index, sl::index) noexcept { }
void window::set_size(sl::whole frame_width,
sl::whole frame_height) noexcept {
m_width = frame_width;
m_height = frame_height;
}
void window::set_fullscreen_windowed() noexcept { }
void window::set_fullscreen_mode(sl::whole frame_width,
sl::whole frame_height,
sl::whole frame_rate) noexcept { }
void window::set_input(std::shared_ptr<input> in) noexcept {
m_input = std::move(in);
if (m_display != nullptr)
m_input->init_keymap(m_display);
}
void window::set_parent(native_handle) noexcept { }
void window::reset_parent() noexcept { }
auto window::message_loop() noexcept -> int {
using clock = steady_clock;
if (!m_ok)
return 0;
auto wm_delete = XInternAtom(m_display, "WM_DELETE_WINDOW",
False);
XSetWMProtocols(m_display, m_handle, &wm_delete, 1);
auto ev = XEvent {};
auto window_attributes = XWindowAttributes {};
if (m_on_init)
m_on_init();
if (m_on_size)
m_on_size(get_frame_width(), get_frame_height());
auto time = clock::now();
while (!m_done) {
sl::index count = XEventsQueued(m_display, QueuedAlready);
if (count == 0)
XFlush(m_display);
while (count-- > 0) {
XNextEvent(m_display, &ev);
switch (ev.type) {
case DestroyNotify: m_done = true; break;
case MotionNotify:
if (m_input)
m_input->update_cursor(ev.xmotion.x, ev.xmotion.y);
break;
case ButtonPress:
if (m_input) {
m_input->update_cursor(ev.xbutton.x, ev.xbutton.y);
if (ev.xbutton.button <= Button3) {
m_input->update_button(ev.xbutton.button, true);
} else if (ev.xbutton.button == Button4) {
m_input->update_wheel(1);
} else if (ev.xbutton.button == Button5) {
m_input->update_wheel(-1);
}
}
break;
case ButtonRelease:
if (m_input) {
m_input->update_cursor(ev.xbutton.x, ev.xbutton.y);
if (ev.xbutton.button <= Button3)
m_input->update_button(ev.xbutton.button, false);
}
break;
case KeyPress:
if (m_input) {
m_input->update_cursor(ev.xkey.x, ev.xkey.y);
m_input->update_controls(ev.xkey.keycode, true);
m_input->update_key(ev.xkey.keycode, true);
}
break;
case KeyRelease:
if (m_input) {
m_input->update_cursor(ev.xkey.x, ev.xkey.y);
m_input->update_controls(ev.xkey.keycode, false);
m_input->update_key(ev.xkey.keycode, false);
}
break;
case EnterNotify: m_has_cursor = true; break;
case LeaveNotify: m_has_cursor = false; break;
case FocusIn:
m_has_focus = true;
if (m_on_focus)
m_on_focus(true);
break;
case FocusOut:
m_has_focus = false;
if (m_on_focus)
m_on_focus(false);
if (m_input)
m_input->reset_keyboard();
break;
case ClientMessage:
if (ev.xclient.data.l[0] == wm_delete)
m_done = true;
break;
}
}
XGetWindowAttributes(m_display, m_handle, &window_attributes);
update_position(window_attributes.x, window_attributes.y);
update_frame_size(window_attributes.width,
window_attributes.height);
auto delta = duration_cast<milliseconds>(clock::now() - time);
auto delta_msec = static_cast<sl::whole>(delta.count());
if (m_input)
m_input->tick(delta_msec);
if (m_on_frame)
m_on_frame(delta_msec);
if (m_input)
m_input->refresh();
time += delta;
}
if (m_on_cleanup)
m_on_cleanup();
return m_code;
}
void window::quit(int code) noexcept {
m_code = code;
m_done = true;
}
auto window::get_screen_width() const noexcept -> sl::whole {
return 0;
}
auto window::get_screen_height() const noexcept -> sl::whole {
return 0;
}
auto window::get_fullscreen_width() const noexcept -> sl::whole {
return 0;
}
auto window::get_fullscreen_height() const noexcept -> sl::whole {
return 0;
}
auto window::get_x() const noexcept -> sl::index {
return m_x;
}
auto window::get_y() const noexcept -> sl::index {
return m_y;
}
auto window::get_width() const noexcept -> sl::whole {
return m_width;
}
auto window::get_height() const noexcept -> sl::whole {
return m_height;
}
auto window::get_frame_width() const noexcept -> sl::whole {
return m_frame_width;
}
auto window::get_frame_height() const noexcept -> sl::whole {
return m_frame_height;
}
auto window::is_visible() const noexcept -> bool {
return m_is_visible;
}
auto window::is_fullscreen() const noexcept -> bool {
return false;
}
auto window::is_fullscreen_windowed() const noexcept -> bool {
return false;
}
auto window::has_focus() const noexcept -> bool {
return m_has_focus;
}
auto window::has_cursor() const noexcept -> bool {
return m_has_cursor;
}
auto window::get_display() const noexcept -> Display * {
return m_display;
}
auto window::get_native_handle() const noexcept -> native_handle {
return m_handle;
}
auto window::xlib_error(Display *display,
XErrorEvent *error) noexcept -> int {
for (auto *win : windows) {
if (win->m_display != display)
continue;
if (error->type == BadWindow) {
win->m_done = true;
win->m_ok = false;
}
break;
}
return 0;
}
void window::init() noexcept {
if (!gl_load_library())
return;
windows.emplace_back(this);
XSetErrorHandler(xlib_error);
m_display = XOpenDisplay(nullptr);
if (m_display == nullptr) {
error_("XOpenDisplay failed.", __FUNCTION__);
return;
}
auto root = DefaultRootWindow(m_display);
int attributes[] = { GLX_RGBA, GLX_DEPTH_SIZE, 24,
GLX_DOUBLEBUFFER, 0 };
auto *visual = glXChooseVisual(m_display, 0, attributes);
if (visual == nullptr) {
error_("glXChooseVisual failed.", __FUNCTION__);
return;
}
auto colormap = XCreateColormap(m_display, root, visual->visual,
AllocNone);
auto window_attributes = XSetWindowAttributes {
.event_mask = xevent_mask, .colormap = colormap
};
m_handle = XCreateWindow(
m_display, root, get_x(), get_y(), get_width(), get_height(),
0, visual->depth, InputOutput, visual->visual,
CWColormap | CWEventMask, &window_attributes);
XStoreName(m_display, m_handle, m_name.c_str());
if (is_visible())
XMapWindow(m_display, m_handle);
m_context = glXCreateContext(m_display, visual, nullptr, 1);
if (m_context == nullptr) {
error_("glXCreateContext failed.", __FUNCTION__);
XDestroyWindow(m_display, m_handle);
return;
}
glXMakeCurrent(m_display, m_handle, m_context);
if (m_input)
m_input->init_keymap(m_display);
m_ok = true;
}
void window::cleanup() noexcept {
if (m_context != nullptr) {
glXMakeCurrent(m_display, 0, nullptr);
glXDestroyContext(m_display, m_context);
m_context = nullptr;
}
if (m_ok)
XDestroyWindow(m_display, m_handle);
if (m_display != nullptr) {
XCloseDisplay(m_display);
m_display = nullptr;
}
gl_free_library();
if (auto i = std::find(windows.begin(), windows.end(), this);
i != windows.end())
windows.erase(i);
m_ok = false;
}
void window::update_position(sl::index x, sl::index y) noexcept {
m_x = x;
m_y = y;
}
void window::update_frame_size(sl::whole width,
sl::whole height) noexcept {
if (m_frame_width == width && m_frame_height == height)
return;
m_frame_width = width;
m_frame_height = height;
if (m_on_size)
m_on_size(width, height);
}
}
| 24.938053 | 70 | 0.587651 | [
"vector"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.