hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 109 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 48.5k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
283f125f75ca57221c0982dd442be2f568ce0c75 | 1,217 | cpp | C++ | examples/lernfahrer/carfactory.cpp | eidelen/EidNN | 80999b1228eda4cab70b060bdaa6d257f8143bb1 | [
"MIT"
] | 3 | 2021-05-14T15:03:03.000Z | 2021-12-05T08:31:38.000Z | examples/lernfahrer/carfactory.cpp | eidelen/EidNN | 80999b1228eda4cab70b060bdaa6d257f8143bb1 | [
"MIT"
] | null | null | null | examples/lernfahrer/carfactory.cpp | eidelen/EidNN | 80999b1228eda4cab70b060bdaa6d257f8143bb1 | [
"MIT"
] | 3 | 2020-08-13T15:44:05.000Z | 2021-06-07T16:16:53.000Z | //
// Created by Adrian Schneider on 2019-03-13.
//
#include "carfactory.h"
#include "car.h"
#include "genetic.h"
#include "layer.h"
#include "trackmap.h"
CarFactory::CarFactory(std::shared_ptr<TrackMap> map)
{
m_map = map;
}
CarFactory::~CarFactory()
{
}
std::shared_ptr<Simulation> CarFactory::createRandomSimulation()
{
std::shared_ptr<Car> car( new Car( ) );
car->setMap(m_map);
car->setPosition(Eigen::Vector2d(400,345) );
car->setDirection(Eigen::Vector2d(1,0));
setAllBiasToZero(car->getNetwork());
return car;
}
SimulationPtr CarFactory::createCrossover(SimulationPtr a, SimulationPtr b, double mutationRate)
{
NetworkPtr cr = Genetic::crossover(a->getNetwork(), b->getNetwork(), Genetic::CrossoverMethod::Uniform, mutationRate);
setAllBiasToZero(cr);
SimulationPtr crs = createRandomSimulation();
crs->setNetwork(cr);
return crs;
}
void CarFactory::setAllBiasToZero(NetworkPtr net)
{
for( unsigned int i = 0; i < net->getNumberOfLayer(); i++ )
net->getLayer(i)->setBias(0.0);
}
SimulationPtr CarFactory::copy( SimulationPtr a )
{
SimulationPtr crs = createRandomSimulation();
crs->setNetwork(a->getNetwork());
return crs;
}
| 21.732143 | 122 | 0.691865 | eidelen |
283f463c36c78c53b672b4927f915b7bfc868930 | 21,192 | cc | C++ | binding/egl_context_wrapper.cc | propellerfactory/node-gles | fc893afa177e05397b8e02e8b48121106c7cea99 | [
"Apache-2.0"
] | 308 | 2018-10-30T18:35:15.000Z | 2022-01-20T13:56:42.000Z | binding/egl_context_wrapper.cc | propellerfactory/node-gles | fc893afa177e05397b8e02e8b48121106c7cea99 | [
"Apache-2.0"
] | 36 | 2018-11-01T19:31:24.000Z | 2021-08-31T17:40:05.000Z | binding/egl_context_wrapper.cc | chances/node-gles | b4cb488f580888d13c603cba38f692441ec4fc69 | [
"Apache-2.0"
] | 29 | 2018-11-01T02:59:47.000Z | 2021-06-27T15:36:34.000Z | /**
* @license
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================================
*/
#include "egl_context_wrapper.h"
#include "utils.h"
#include "angle/include/EGL/egl.h"
#include "angle/include/EGL/eglext.h"
#include <vector>
namespace nodejsgl {
EGLContextWrapper::EGLContextWrapper(napi_env env,
const GLContextOptions& context_options) {
InitEGL(env, context_options);
BindProcAddresses();
RefreshGLExtensions();
#if DEBUG
std::cerr << "** GL_EXTENSIONS:" << std::endl;
gl_extensions->LogExtensions();
std::cerr << std::endl;
std::cerr << "** REQUESTABLE_EXTENSIONS:" << std::endl;
angle_requestable_extensions->LogExtensions();
std::cerr << std::endl;
#endif
}
void EGLContextWrapper::InitEGL(napi_env env,
const GLContextOptions& context_options) {
std::vector<EGLAttrib> display_attributes;
display_attributes.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
// Most NVIDIA drivers will not work properly with
// EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE, only enable this option on ARM
// devices for now:
#if defined(__arm__)
display_attributes.push_back(EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE);
#else
display_attributes.push_back(EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
#endif
display_attributes.push_back(EGL_NONE);
display = eglGetPlatformDisplay(EGL_PLATFORM_ANGLE_ANGLE, nullptr,
&display_attributes[0]);
if (display == EGL_NO_DISPLAY) {
// TODO(kreeger): This is the default path for Mac OS. Determine why egl has
// to be initialized this way on Mac OS.
display = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (display == EGL_NO_DISPLAY) {
NAPI_THROW_ERROR(env, "No display");
return;
}
}
EGLint major;
EGLint minor;
if (!eglInitialize(display, &major, &minor)) {
NAPI_THROW_ERROR(env, "Could not initialize display");
return;
}
egl_extensions = std::unique_ptr<GLExtensionsWrapper>(
new GLExtensionsWrapper(eglQueryString(display, EGL_EXTENSIONS)));
#if DEBUG
std::cerr << "** EGL_EXTENSIONS:" << std::endl;
egl_extensions->LogExtensions();
std::cerr << std::endl;
#endif
EGLint attrib_list[] = {EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_DEPTH_SIZE, 24,
EGL_STENCIL_SIZE, 8,
EGL_NONE};
EGLint num_config;
if (!eglChooseConfig(display, attrib_list, &config, 1, &num_config)) {
NAPI_THROW_ERROR(env, "Failed creating a config");
return;
}
eglBindAPI(EGL_OPENGL_ES_API);
if (eglGetError() != EGL_SUCCESS) {
NAPI_THROW_ERROR(env, "Failed to set OpenGL ES API");
return;
}
EGLint config_renderable_type;
if (!eglGetConfigAttrib(display, config, EGL_RENDERABLE_TYPE,
&config_renderable_type)) {
NAPI_THROW_ERROR(env, "Failed to get EGL_RENDERABLE_TYPE");
return;
}
// If the requested context is ES3 but the config cannot support ES3, request
// ES2 instead.
EGLint major_version = context_options.client_major_es_version;
EGLint minor_version = context_options.client_minor_es_version;
if ((config_renderable_type & EGL_OPENGL_ES3_BIT) == 0 &&
major_version >= 3) {
major_version = 2;
minor_version = 0;
}
// Append attributes based on available features
std::vector<EGLint> context_attributes;
context_attributes.push_back(EGL_CONTEXT_MAJOR_VERSION_KHR);
context_attributes.push_back(major_version);
context_attributes.push_back(EGL_CONTEXT_MINOR_VERSION_KHR);
context_attributes.push_back(minor_version);
if (context_options.webgl_compatibility) {
context_attributes.push_back(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE);
context_attributes.push_back(EGL_TRUE);
}
// TODO(kreeger): This is only needed to avoid validation.
// This is needed for OES_TEXTURE_HALF_FLOAT textures uploading as FLOAT
context_attributes.push_back(EGL_CONTEXT_OPENGL_NO_ERROR_KHR);
context_attributes.push_back(EGL_TRUE);
context_attributes.push_back(EGL_NONE);
context = eglCreateContext(display, config, EGL_NO_CONTEXT,
context_attributes.data());
if (context == EGL_NO_CONTEXT) {
NAPI_THROW_ERROR(env, "Could not create context");
return;
}
EGLint surface_attribs[] = {EGL_WIDTH, (EGLint)context_options.width,
EGL_HEIGHT, (EGLint)context_options.height,
EGL_NONE};
surface = eglCreatePbufferSurface(display, config, surface_attribs);
if (surface == EGL_NO_SURFACE) {
NAPI_THROW_ERROR(env, "Could not create surface");
return;
}
if (!eglMakeCurrent(display, surface, surface, context)) {
NAPI_THROW_ERROR(env, "Could not make context current");
return;
}
}
void EGLContextWrapper::BindProcAddresses() {
// Bind runtime function pointers.
glActiveTexture = reinterpret_cast<PFNGLACTIVETEXTUREPROC>(
eglGetProcAddress("glActiveTexture"));
glAttachShader = reinterpret_cast<PFNGLATTACHSHADERPROC>(
eglGetProcAddress("glAttachShader"));
glBindAttribLocation = reinterpret_cast<PFNGLBINDATTRIBLOCATIONPROC>(
eglGetProcAddress("glBindAttribLocation"));
glBindBuffer =
reinterpret_cast<PFNGLBINDBUFFERPROC>(eglGetProcAddress("glBindBuffer"));
glBindFramebuffer = reinterpret_cast<PFNGLBINDFRAMEBUFFERPROC>(
eglGetProcAddress("glBindFramebuffer"));
glBindRenderbuffer = reinterpret_cast<PFNGLBINDRENDERBUFFERPROC>(
eglGetProcAddress("glBindRenderbuffer"));
glBindTexture = reinterpret_cast<PFNGLBINDTEXTUREPROC>(
eglGetProcAddress("glBindTexture"));
glBlendColor =
reinterpret_cast<PFNGLBLENDCOLORPROC>(eglGetProcAddress("glBlendColor"));
glBlendEquation = reinterpret_cast<PFNGLBLENDEQUATIONPROC>(
eglGetProcAddress("glBlendEquation"));
glBlendEquationSeparate = reinterpret_cast<PFNGLBLENDEQUATIONSEPARATEPROC>(
eglGetProcAddress("glBlendEquationSeparate"));
glBlendFunc =
reinterpret_cast<PFNGLBLENDFUNCPROC>(eglGetProcAddress("glBlendFunc"));
glBlendFuncSeparate = reinterpret_cast<PFNGLBLENDFUNCSEPARATEPROC>(
eglGetProcAddress("glBlendFuncSeparate"));
glBufferData =
reinterpret_cast<PFNGLBUFFERDATAPROC>(eglGetProcAddress("glBufferData"));
glBufferSubData = reinterpret_cast<PFNGLBUFFERSUBDATAPROC>(
eglGetProcAddress("glBufferSubData"));
glCheckFramebufferStatus = reinterpret_cast<PFNGLCHECKFRAMEBUFFERSTATUSPROC>(
eglGetProcAddress("glCheckFramebufferStatus"));
glClear = reinterpret_cast<PFNGLCLEARPROC>(eglGetProcAddress("glClear"));
glClearColor =
reinterpret_cast<PFNGLCLEARCOLORPROC>(eglGetProcAddress("glClearColor"));
glClearDepthf = reinterpret_cast<PFNGLCLEARDEPTHFPROC>(
eglGetProcAddress("glClearDepthf"));
glClearStencil = reinterpret_cast<PFNGLCLEARSTENCILPROC>(
eglGetProcAddress("glClearStencil"));
glClientWaitSync = reinterpret_cast<PFNGLCLIENTWAITSYNCPROC>(
eglGetProcAddress("glClientWaitSync"));
glColorMask =
reinterpret_cast<PFNGLCOLORMASKPROC>(eglGetProcAddress("glColorMask"));
glCompileShader = reinterpret_cast<PFNGLCOMPILESHADERPROC>(
eglGetProcAddress("glCompileShader"));
glCompressedTexImage2D = reinterpret_cast<PFNGLCOMPRESSEDTEXIMAGE2DPROC>(
eglGetProcAddress("glCompressedTexImage2D"));
glCompressedTexSubImage2D =
reinterpret_cast<PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC>(
eglGetProcAddress("glCompressedTexSubImage2D"));
glCopyTexImage2D = reinterpret_cast<PFNGLCOPYTEXIMAGE2DPROC>(
eglGetProcAddress("glCopyTexImage2D"));
glCopyTexSubImage2D = reinterpret_cast<PFNGLCOPYTEXSUBIMAGE2DPROC>(
eglGetProcAddress("glCopyTexSubImage2D"));
glCreateProgram = reinterpret_cast<PFNGLCREATEPROGRAMPROC>(
eglGetProcAddress("glCreateProgram"));
glCreateShader = reinterpret_cast<PFNGLCREATESHADERPROC>(
eglGetProcAddress("glCreateShader"));
glCullFace =
reinterpret_cast<PFNGLCULLFACEPROC>(eglGetProcAddress("glCullFace"));
glDeleteBuffers = reinterpret_cast<PFNGLDELETEBUFFERSPROC>(
eglGetProcAddress("glDeleteBuffers"));
glDeleteFramebuffers = reinterpret_cast<PFNGLDELETEFRAMEBUFFERSPROC>(
eglGetProcAddress("glDeleteFramebuffers"));
glDeleteRenderbuffers = reinterpret_cast<PFNGLDELETERENDERBUFFERSPROC>(
eglGetProcAddress("glDeleteRenderbuffers"));
glDeleteProgram = reinterpret_cast<PFNGLDELETEPROGRAMPROC>(
eglGetProcAddress("glDeleteProgram"));
glDeleteShader = reinterpret_cast<PFNGLDELETESHADERPROC>(
eglGetProcAddress("glDeleteShader"));
glDeleteSync =
reinterpret_cast<PFNGLDELETESYNCPROC>(eglGetProcAddress("glDeleteSync"));
glDeleteTextures = reinterpret_cast<PFNGLDELETETEXTURESPROC>(
eglGetProcAddress("glDeleteTextures"));
glDepthFunc =
reinterpret_cast<PFNGLDEPTHFUNCPROC>(eglGetProcAddress("glDepthFunc"));
glDepthMask =
reinterpret_cast<PFNGLDEPTHMASKPROC>(eglGetProcAddress("glDepthMask"));
glDepthRangef = reinterpret_cast<PFNGLDEPTHRANGEFPROC>(
eglGetProcAddress("glDepthRangef"));
glDrawArrays =
reinterpret_cast<PFNGLDRAWARRAYSPROC>(eglGetProcAddress("glDrawArrays"));
glDrawElements = reinterpret_cast<PFNGLDRAWELEMENTSPROC>(
eglGetProcAddress("glDrawElements"));
glDetachShader = reinterpret_cast<PFNGLDETACHSHADERPROC>(
eglGetProcAddress("glDetachShader"));
glDisable =
reinterpret_cast<PFNGLDISABLEPROC>(eglGetProcAddress("glDisable"));
glDisableVertexAttribArray =
reinterpret_cast<PFNGLDISABLEVERTEXATTRIBARRAYPROC>(
eglGetProcAddress("glDisableVertexAttribArray"));
glEnable = reinterpret_cast<PFNGLENABLEPROC>(eglGetProcAddress("glEnable"));
glEnableVertexAttribArray =
reinterpret_cast<PFNGLENABLEVERTEXATTRIBARRAYPROC>(
eglGetProcAddress("glEnableVertexAttribArray"));
glFenceSync =
reinterpret_cast<PFNGLFENCESYNCPROC>(eglGetProcAddress("glFenceSync"));
glFinish = reinterpret_cast<PFNGLFINISHPROC>(eglGetProcAddress("glFinish"));
glFlush = reinterpret_cast<PFNGLFLUSHPROC>(eglGetProcAddress("glFlush"));
glFramebufferRenderbuffer =
reinterpret_cast<PFNGLFRAMEBUFFERRENDERBUFFERPROC>(
eglGetProcAddress("glFramebufferRenderbuffer"));
glFramebufferTexture2D = reinterpret_cast<PFNGLFRAMEBUFFERTEXTURE2DPROC>(
eglGetProcAddress("glFramebufferTexture2D"));
glFrontFace =
reinterpret_cast<PFNGLFRONTFACEPROC>(eglGetProcAddress("glFrontFace"));
glGenerateMipmap = reinterpret_cast<PFNGLGENERATEMIPMAPPROC>(
eglGetProcAddress("glGenerateMipmap"));
glGenBuffers =
reinterpret_cast<PFNGLGENBUFFERSPROC>(eglGetProcAddress("glGenBuffers"));
glGenFramebuffers = reinterpret_cast<PFNGLGENFRAMEBUFFERSPROC>(
eglGetProcAddress("glGenFramebuffers"));
glGenRenderbuffers = reinterpret_cast<PFNGLGENRENDERBUFFERSPROC>(
eglGetProcAddress("glGenRenderbuffers"));
glGetAttribLocation = reinterpret_cast<PFNGLGETATTRIBLOCATIONPROC>(
eglGetProcAddress("glGetAttribLocation"));
glGetBufferParameteriv = reinterpret_cast<PFNGLGETBUFFERPARAMETERIVPROC>(
eglGetProcAddress("glGetBufferParameteriv"));
glGetError =
reinterpret_cast<PFNGLGETERRORPROC>(eglGetProcAddress("glGetError"));
glGetFramebufferAttachmentParameteriv =
reinterpret_cast<PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC>(
eglGetProcAddress("glGetFramebufferAttachmentParameteriv"));
glGetIntegerv = reinterpret_cast<PFNGLGETINTEGERVPROC>(
eglGetProcAddress("glGetIntegerv"));
glGenTextures = reinterpret_cast<PFNGLGENTEXTURESPROC>(
eglGetProcAddress("glGenTextures"));
glGetActiveAttrib = reinterpret_cast<PFNGLGETACTIVEATTRIBPROC>(
eglGetProcAddress("glGetActiveAttrib"));
glGetActiveUniform = reinterpret_cast<PFNGLGETACTIVEUNIFORMPROC>(
eglGetProcAddress("glGetActiveUniform"));
glGetAttachedShaders = reinterpret_cast<PFNGLGETATTACHEDSHADERSPROC>(
eglGetProcAddress("glGetAttachedShaders"));
glGetProgramiv = reinterpret_cast<PFNGLGETPROGRAMIVPROC>(
eglGetProcAddress("glGetProgramiv"));
glGetProgramInfoLog = reinterpret_cast<PFNGLGETPROGRAMINFOLOGPROC>(
eglGetProcAddress("glGetProgramInfoLog"));
glGetRenderbufferParameteriv =
reinterpret_cast<PFNGLGETRENDERBUFFERPARAMETERIVPROC>(
eglGetProcAddress("glGetRenderbufferParameteriv"));
glGetShaderiv = reinterpret_cast<PFNGLGETSHADERIVPROC>(
eglGetProcAddress("glGetShaderiv"));
glGetShaderInfoLog = reinterpret_cast<PFNGLGETSHADERINFOLOGPROC>(
eglGetProcAddress("glGetShaderInfoLog"));
glGetShaderPrecisionFormat =
reinterpret_cast<PFNGLGETSHADERPRECISIONFORMATPROC>(
eglGetProcAddress("glGetShaderPrecisionFormat"));
glGetString =
reinterpret_cast<PFNGLGETSTRINGPROC>(eglGetProcAddress("glGetString"));
glGetTexParameterfv = reinterpret_cast<PFNGLGETTEXPARAMETERFVPROC>(
eglGetProcAddress("glGetTexParameterfv"));
glGetTexParameteriv = reinterpret_cast<PFNGLGETTEXPARAMETERIVPROC>(
eglGetProcAddress("glGetTexParameteriv"));
glGetUniformLocation = reinterpret_cast<PFNGLGETUNIFORMLOCATIONPROC>(
eglGetProcAddress("glGetUniformLocation"));
glHint = reinterpret_cast<PFNGLHINTPROC>(eglGetProcAddress("glHint"));
glIsBuffer =
reinterpret_cast<PFNGLISBUFFERPROC>(eglGetProcAddress("glIsBuffer"));
glIsEnabled =
reinterpret_cast<PFNGLISENABLEDPROC>(eglGetProcAddress("glIsEnabled"));
glIsFramebuffer = reinterpret_cast<PFNGLISFRAMEBUFFERPROC>(
eglGetProcAddress("glIsFramebuffer"));
glIsProgram =
reinterpret_cast<PFNGLISPROGRAMPROC>(eglGetProcAddress("glIsProgram"));
glIsRenderbuffer = reinterpret_cast<PFNGLISRENDERBUFFERPROC>(
eglGetProcAddress("glIsRenderbuffer"));
glIsShader =
reinterpret_cast<PFNGLISSHADERPROC>(eglGetProcAddress("glIsShader"));
glIsTexture =
reinterpret_cast<PFNGLISTEXTUREPROC>(eglGetProcAddress("glIsTexture"));
glLineWidth =
reinterpret_cast<PFNGLLINEWIDTHPROC>(eglGetProcAddress("glLineWidth"));
glLinkProgram = reinterpret_cast<PFNGLLINKPROGRAMPROC>(
eglGetProcAddress("glLinkProgram"));
glMapBufferRange = reinterpret_cast<PFNGLMAPBUFFERRANGEPROC>(
eglGetProcAddress("glMapBufferRange"));
glPixelStorei = reinterpret_cast<PFNGLPIXELSTOREIPROC>(
eglGetProcAddress("glPixelStorei"));
glPolygonOffset = reinterpret_cast<PFNGLPOLYGONOFFSETPROC>(
eglGetProcAddress("glPolygonOffset"));
glReadPixels =
reinterpret_cast<PFNGLREADPIXELSPROC>(eglGetProcAddress("glReadPixels"));
glRenderbufferStorage = reinterpret_cast<PFNGLRENDERBUFFERSTORAGEPROC>(
eglGetProcAddress("glRenderbufferStorage"));
glSampleCoverage = reinterpret_cast<PFNGLSAMPLECOVERAGEPROC>(
eglGetProcAddress("glSampleCoverage"));
glScissor =
reinterpret_cast<PFNGLSCISSORPROC>(eglGetProcAddress("glScissor"));
glShaderSource = reinterpret_cast<PFNGLSHADERSOURCEPROC>(
eglGetProcAddress("glShaderSource"));
glStencilMask = reinterpret_cast<PFNGLSTENCILMASKPROC>(
eglGetProcAddress("glStencilMask"));
glStencilMaskSeparate = reinterpret_cast<PFNGLSTENCILMASKSEPARATEPROC>(
eglGetProcAddress("glStencilMaskSeparate"));
glStencilFunc = reinterpret_cast<PFNGLSTENCILFUNCPROC>(
eglGetProcAddress("glStencilFunc"));
glStencilFuncSeparate = reinterpret_cast<PFNGLSTENCILFUNCSEPARATEPROC>(
eglGetProcAddress("glStencilFuncSeparate"));
glStencilOp =
reinterpret_cast<PFNGLSTENCILOPPROC>(eglGetProcAddress("glStencilOp"));
glStencilOpSeparate = reinterpret_cast<PFNGLSTENCILOPSEPARATEPROC>(
eglGetProcAddress("glStencilOpSeparate"));
glTexImage2D =
reinterpret_cast<PFNGLTEXIMAGE2DPROC>(eglGetProcAddress("glTexImage2D"));
glTexParameteri = reinterpret_cast<PFNGLTEXPARAMETERIPROC>(
eglGetProcAddress("glTexParameteri"));
glTexParameterf = reinterpret_cast<PFNGLTEXPARAMETERFPROC>(
eglGetProcAddress("glTexParameterf"));
glTexSubImage2D = reinterpret_cast<PFNGLTEXSUBIMAGE2DPROC>(
eglGetProcAddress("glTexSubImage2D"));
glUniform1f =
reinterpret_cast<PFNGLUNIFORM1FPROC>(eglGetProcAddress("glUniform1f"));
glUniform1fv =
reinterpret_cast<PFNGLUNIFORM1FVPROC>(eglGetProcAddress("glUniform1fv"));
glUniform1i =
reinterpret_cast<PFNGLUNIFORM1IPROC>(eglGetProcAddress("glUniform1i"));
glUniform1iv =
reinterpret_cast<PFNGLUNIFORM1IVPROC>(eglGetProcAddress("glUniform1iv"));
glUniform2f =
reinterpret_cast<PFNGLUNIFORM2FPROC>(eglGetProcAddress("glUniform2f"));
glUniform2fv =
reinterpret_cast<PFNGLUNIFORM2FVPROC>(eglGetProcAddress("glUniform2fv"));
glUniform2i =
reinterpret_cast<PFNGLUNIFORM2IPROC>(eglGetProcAddress("glUniform2i"));
glUniform2iv =
reinterpret_cast<PFNGLUNIFORM2IVPROC>(eglGetProcAddress("glUniform2iv"));
glUniform3f =
reinterpret_cast<PFNGLUNIFORM3FPROC>(eglGetProcAddress("glUniform3f"));
glUniform3fv =
reinterpret_cast<PFNGLUNIFORM3FVPROC>(eglGetProcAddress("glUniform3fv"));
glUniform3i =
reinterpret_cast<PFNGLUNIFORM3IPROC>(eglGetProcAddress("glUniform3i"));
glUniform3iv =
reinterpret_cast<PFNGLUNIFORM3IVPROC>(eglGetProcAddress("glUniform3iv"));
glUniform4f =
reinterpret_cast<PFNGLUNIFORM4FPROC>(eglGetProcAddress("glUniform4f"));
glUniform4fv =
reinterpret_cast<PFNGLUNIFORM4FVPROC>(eglGetProcAddress("glUniform4fv"));
glUniform4i =
reinterpret_cast<PFNGLUNIFORM4IPROC>(eglGetProcAddress("glUniform4i"));
glUniform4iv =
reinterpret_cast<PFNGLUNIFORM4IVPROC>(eglGetProcAddress("glUniform4iv"));
glUniformMatrix2fv = reinterpret_cast<PFNGLUNIFORMMATRIX2FVPROC>(
eglGetProcAddress("glUniformMatrix2fv"));
glUniformMatrix3fv = reinterpret_cast<PFNGLUNIFORMMATRIX3FVPROC>(
eglGetProcAddress("glUniformMatrix3fv"));
glUniformMatrix4fv = reinterpret_cast<PFNGLUNIFORMMATRIX4FVPROC>(
eglGetProcAddress("glUniformMatrix4fv"));
glUnmapBuffer = reinterpret_cast<PFNGLUNMAPBUFFERPROC>(
eglGetProcAddress("glUnmapBuffer"));
glUseProgram =
reinterpret_cast<PFNGLUSEPROGRAMPROC>(eglGetProcAddress("glUseProgram"));
glValidateProgram = reinterpret_cast<PFNGLVALIDATEPROGRAMPROC>(
eglGetProcAddress("glValidateProgram"));
glVertexAttrib1f = reinterpret_cast<PFNGLVERTEXATTRIB1FPROC>(
eglGetProcAddress("glVertexAttrib1f"));
glVertexAttrib1fv = reinterpret_cast<PFNGLVERTEXATTRIB1FVPROC>(
eglGetProcAddress("glVertexAttrib1fv"));
glVertexAttrib2f = reinterpret_cast<PFNGLVERTEXATTRIB2FPROC>(
eglGetProcAddress("glVertexAttrib2f"));
glVertexAttrib2fv = reinterpret_cast<PFNGLVERTEXATTRIB2FVPROC>(
eglGetProcAddress("glVertexAttrib2fv"));
glVertexAttrib3f = reinterpret_cast<PFNGLVERTEXATTRIB3FPROC>(
eglGetProcAddress("glVertexAttrib3f"));
glVertexAttrib3fv = reinterpret_cast<PFNGLVERTEXATTRIB3FVPROC>(
eglGetProcAddress("glVertexAttrib3fv"));
glVertexAttrib4f = reinterpret_cast<PFNGLVERTEXATTRIB4FPROC>(
eglGetProcAddress("glVertexAttrib4f"));
glVertexAttrib4fv = reinterpret_cast<PFNGLVERTEXATTRIB4FVPROC>(
eglGetProcAddress("glVertexAttrib4fv"));
glVertexAttribPointer = reinterpret_cast<PFNGLVERTEXATTRIBPOINTERPROC>(
eglGetProcAddress("glVertexAttribPointer"));
glViewport =
reinterpret_cast<PFNGLVIEWPORTPROC>(eglGetProcAddress("glViewport"));
// ANGLE specific
glRequestExtensionANGLE = reinterpret_cast<PFNGLREQUESTEXTENSIONANGLEPROC>(
eglGetProcAddress("glRequestExtensionANGLE"));
}
void EGLContextWrapper::RefreshGLExtensions() {
gl_extensions = std::unique_ptr<GLExtensionsWrapper>(new GLExtensionsWrapper(
reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))));
angle_requestable_extensions = std::unique_ptr<GLExtensionsWrapper>(
new GLExtensionsWrapper(reinterpret_cast<const char*>(
glGetString(GL_REQUESTABLE_EXTENSIONS_ANGLE))));
}
EGLContextWrapper::~EGLContextWrapper() {
if (context) {
if (!eglDestroyContext(display, context)) {
std::cerr << "Failed to delete EGL context: " << std::endl;
}
context = nullptr;
}
// TODO(kreeger): Close context attributes.
// TODO(kreeger): Cleanup global objects.
}
EGLContextWrapper* EGLContextWrapper::Create(
napi_env env, const GLContextOptions& context_options) {
return new EGLContextWrapper(env, context_options);
}
} // namespace nodejsgl
| 44.521008 | 80 | 0.762741 | propellerfactory |
283fa9dd9a79219c36748a64bb712638fe7dcdcd | 486 | cpp | C++ | iterator/cpp/self-made/arrayconcreteiterator.cpp | LoLei/design-patterns-examples | 213241ab94c8a5e74a3faa9c5f554d557e60b753 | [
"MIT"
] | 3 | 2020-02-11T20:37:13.000Z | 2020-07-31T14:16:51.000Z | iterator/cpp/self-made/arrayconcreteiterator.cpp | LoLei/design-patterns-examples | 213241ab94c8a5e74a3faa9c5f554d557e60b753 | [
"MIT"
] | null | null | null | iterator/cpp/self-made/arrayconcreteiterator.cpp | LoLei/design-patterns-examples | 213241ab94c8a5e74a3faa9c5f554d557e60b753 | [
"MIT"
] | null | null | null | #include "arrayconcreteiterator.h"
/*
* Concrete iterator
*/
ArrayConcreteIterator::ArrayConcreteIterator(const ArrayConcreteCollection* c)
{
reset();
collection_ = c;
}
void ArrayConcreteIterator::next()
{
current_index_++;
}
void ArrayConcreteIterator::reset()
{
current_index_ = 0;
}
bool ArrayConcreteIterator::isDone()
{
return current_index_ == collection_->getSize();
}
int ArrayConcreteIterator::currentItem()
{
return collection_->getItem(current_index_);
}
| 15.677419 | 78 | 0.746914 | LoLei |
284061a4ca659473939fcb10a23cfe4bc3c940a8 | 32,018 | cpp | C++ | modules/optflow/src/deepflow.cpp | AntoninARBERET/opencv_contrib-3.1.0 | 041d298e61656a3989b344e2a099a5dbbd3bd6b1 | [
"BSD-3-Clause"
] | 16 | 2016-07-04T10:32:22.000Z | 2021-11-10T11:26:45.000Z | modules/optflow/src/deepflow.cpp | AntoninARBERET/opencv_contrib-3.1.0 | 041d298e61656a3989b344e2a099a5dbbd3bd6b1 | [
"BSD-3-Clause"
] | null | null | null | modules/optflow/src/deepflow.cpp | AntoninARBERET/opencv_contrib-3.1.0 | 041d298e61656a3989b344e2a099a5dbbd3bd6b1 | [
"BSD-3-Clause"
] | 22 | 2015-10-23T19:36:18.000Z | 2021-02-02T12:20:32.000Z | /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's 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.
//
// * The name of the copyright holders may not 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 Intel Corporation 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.
//
//M*/
#include "precomp.hpp"
#include <opencv2/highgui.hpp>
namespace cv
{
namespace optflow
{
class OpticalFlowDeepFlow: public DenseOpticalFlow
{
public:
OpticalFlowDeepFlow();
void calc( InputArray I0, InputArray I1, InputOutputArray flow );
void collectGarbage();
protected:
float sigma; // Gaussian smoothing parameter
int minSize; // minimal dimension of an image in the pyramid
float downscaleFactor; // scaling factor in the pyramid
int fixedPointIterations; // during each level of the pyramid
int sorIterations; // iterations of SOR
float alpha; // smoothness assumption weight
float delta; // color constancy weight
float gamma; // gradient constancy weight
float omega; // relaxation factor in SOR
float zeta; // added to the denomimnator of theta_0 (normaliation of the data term)
float epsilon; // robust penalizer const
int maxLayers; // max amount of layers in the pyramid
private:
void calcOneLevel( const Mat I0, const Mat I1, Mat W );
Mat warpImage( const Mat input, const Mat flow );
void dataTerm( const Mat W, const Mat dW, const Mat Ix, const Mat Iy, const Mat Iz,
const Mat Ixx, const Mat Ixy, const Mat Iyy, const Mat Ixz, const Mat Iyz,
Mat a11, Mat a12, Mat a22, Mat b1, Mat b2 );
void smoothnessWeights( const Mat W, Mat weightsX, Mat weightsY );
void smoothnessTerm( const Mat W, const Mat weightsX, const Mat weightsY, Mat b1, Mat b2 );
void sorSolve( const Mat a11, const Mat a12, const Mat a22, const Mat b1, const Mat b2,
const Mat smoothX, const Mat smoothY, Mat dW );
void sorUnfolded( const Mat a11, const Mat a12, const Mat a22, const Mat b1, const Mat b2,
const Mat smoothX, const Mat smoothY, Mat dW );
std::vector<Mat> buildPyramid( const Mat& src );
int interpolationType;
};
OpticalFlowDeepFlow::OpticalFlowDeepFlow()
{
// parameters
sigma = 0.6f;
minSize = 25;
downscaleFactor = 0.95f;
fixedPointIterations = 5;
sorIterations = 25;
alpha = 1.0f;
delta = 0.5f;
gamma = 5.0f;
omega = 1.6f;
//consts
interpolationType = INTER_LINEAR;
zeta = 0.1f;
epsilon = 0.001f;
maxLayers = 200;
}
std::vector<Mat> OpticalFlowDeepFlow::buildPyramid( const Mat& src )
{
std::vector<Mat> pyramid;
pyramid.push_back(src);
Mat prev = pyramid[0];
int i = 0;
while ( i < this->maxLayers )
{
Mat next; //TODO: filtering at each level?
Size nextSize((int) (prev.cols * downscaleFactor + 0.5f),
(int) (prev.rows * downscaleFactor + 0.5f));
if( nextSize.height <= minSize || nextSize.width <= minSize)
break;
resize(prev, next,
nextSize, 0, 0,
interpolationType);
pyramid.push_back(next);
prev = next;
}
return pyramid;
}
Mat OpticalFlowDeepFlow::warpImage( const Mat input, const Mat flow )
{
// warps the image "backwards"
// if flow = computeFlow( I0, I1 ), then
// I0 = warpImage( I1, flow ) - approx.
Mat output;
Mat mapX = Mat(flow.size(), CV_32FC1);
Mat mapY = Mat(flow.size(), CV_32FC1);
const float *pFlow;
float *pMapX, *pMapY;
for ( int j = 0; j < flow.rows; ++j )
{
pFlow = flow.ptr<float>(j);
pMapX = mapX.ptr<float>(j);
pMapY = mapY.ptr<float>(j);
for ( int i = 0; i < flow.cols; ++i )
{
pMapX[i] = i + pFlow[2 * i];
pMapY[i] = j + pFlow[2 * i + 1];
}
}
remap(input, output, mapX, mapY, interpolationType);
return output;
}
void OpticalFlowDeepFlow::calc( InputArray _I0, InputArray _I1, InputOutputArray _flow )
{
Mat I0temp = _I0.getMat();
Mat I1temp = _I1.getMat();
CV_Assert(I0temp.size() == I1temp.size());
CV_Assert(I0temp.type() == I1temp.type());
CV_Assert(I0temp.channels() == 1);
// TODO: currently only grayscale - data term could be computed in color version as well...
Mat I0, I1;
I0temp.convertTo(I0, CV_32F);
I1temp.convertTo(I1, CV_32F);
_flow.create(I0.size(), CV_32FC2);
Mat W = _flow.getMat(); // if any data present - will be discarded
// pre-smooth images
int kernelLen = ((int)floor(3 * sigma) * 2) + 1;
Size kernelSize(kernelLen, kernelLen);
GaussianBlur(I0, I0, kernelSize, sigma);
GaussianBlur(I1, I1, kernelSize, sigma);
// build down-sized pyramids
std::vector<Mat> pyramid_I0 = buildPyramid(I0);
std::vector<Mat> pyramid_I1 = buildPyramid(I1);
int levelCount = (int) pyramid_I0.size();
// initialize the first version of flow estimate to zeros
Size smallestSize = pyramid_I0[levelCount - 1].size();
W = Mat::zeros(smallestSize, CV_32FC2);
for ( int level = levelCount - 1; level >= 0; --level )
{ //iterate through all levels, beginning with the most coarse
calcOneLevel(pyramid_I0[level], pyramid_I1[level], W);
if ( level > 0 ) //not the last level
{
Mat temp;
Size newSize = pyramid_I0[level - 1].size();
resize(W, temp, newSize, 0, 0, interpolationType); //resize calculated flow
W = temp * (1.0f / downscaleFactor); //scale values
}
}
W.copyTo(_flow);
}
void OpticalFlowDeepFlow::calcOneLevel( const Mat I0, const Mat I1, Mat W )
{
CV_DbgAssert( I0.size() == I1.size() );CV_DbgAssert( I0.type() == I1.type() );CV_DbgAssert( W.size() == I0.size() );
// linear equation systems
Size s = I0.size();
int t = CV_32F; // data type
Mat a11, a12, a22, b1, b2;
a11.create(s, t);
a12.create(s, t);
a22.create(s, t);
b1.create(s, t);
b2.create(s, t);
// diffusivity coeffs
Mat weightsX, weightsY;
weightsX.create(s, t);
weightsY.create(s, t);
Mat warpedI1 = warpImage(I1, W); // warped second image
Mat averageFrame = 0.5 * (I0 + warpedI1); // mean value of 2 frames - to compute derivatives on
//computing derivatives, notation as in Brox's paper
Mat Ix, Iy, Iz, Ixx, Ixy, Iyy, Ixz, Iyz;
int ddepth = -1; //as source image
int kernel_size = 1;
Sobel(averageFrame, Ix, ddepth, 1, 0, kernel_size, 1, 0.00, BORDER_REPLICATE);
Sobel(averageFrame, Iy, ddepth, 0, 1, kernel_size, 1, 0.00, BORDER_REPLICATE);
Iz.create(I1.size(), I1.type());
Iz = warpedI1 - I0;
Sobel(Ix, Ixx, ddepth, 1, 0, kernel_size, 1, 0.00, BORDER_REPLICATE);
Sobel(Ix, Ixy, ddepth, 0, 1, kernel_size, 1, 0.00, BORDER_REPLICATE);
Sobel(Iy, Iyy, ddepth, 0, 1, kernel_size, 1, 0.00, BORDER_REPLICATE);
Sobel(Iz, Ixz, ddepth, 1, 0, kernel_size, 1, 0.00, BORDER_REPLICATE);
Sobel(Iz, Iyz, ddepth, 0, 1, kernel_size, 1, 0.00, BORDER_REPLICATE);
Mat tempW = W.clone(); // flow version to be modified in each iteration
Mat dW = Mat::zeros(W.size(), W.type()); // flow increment
//fixed-point iterations
for ( int i = 0; i < fixedPointIterations; ++i )
{
dataTerm(W, dW, Ix, Iy, Iz, Ixx, Ixy, Iyy, Ixz, Iyz, a11, a12, a22, b1, b2);
smoothnessWeights(tempW, weightsX, weightsY);
smoothnessTerm(W, weightsX, weightsY, b1, b2);
sorSolve(a11, a12, a22, b1, b2, weightsX, weightsY, dW);
tempW = W + dW;
}
tempW.copyTo(W);
}
void OpticalFlowDeepFlow::dataTerm( const Mat W, const Mat dW, const Mat Ix, const Mat Iy,
const Mat Iz, const Mat Ixx, const Mat Ixy, const Mat Iyy, const Mat Ixz,
const Mat Iyz, Mat a11, Mat a12, Mat a22, Mat b1, Mat b2 )
{
const float zeta_squared = zeta * zeta; // added in normalization factor to be non-zero
const float epsilon_squared = epsilon * epsilon;
const float *pIx, *pIy, *pIz;
const float *pIxx, *pIxy, *pIyy, *pIxz, *pIyz;
const float *pdU, *pdV; // accessing 2 layers of dW. Succesive columns interleave u and v
float *pa11, *pa12, *pa22, *pb1, *pb2; // linear equation sys. coeffs for each pixel
float derivNorm; //denominator of the spatial-derivative normalizing factor (theta_0)
float derivNorm2;
float Ik1z, Ik1zx, Ik1zy; // approximations of I^(k+1) values by Taylor expansions
float temp;
for ( int j = 0; j < W.rows; j++ ) //for each row
{
pIx = Ix.ptr<float>(j);
pIy = Iy.ptr<float>(j);
pIz = Iz.ptr<float>(j);
pIxx = Ixx.ptr<float>(j);
pIxy = Ixy.ptr<float>(j);
pIyy = Iyy.ptr<float>(j);
pIxz = Ixz.ptr<float>(j);
pIyz = Iyz.ptr<float>(j);
pa11 = a11.ptr<float>(j);
pa12 = a12.ptr<float>(j);
pa22 = a22.ptr<float>(j);
pb1 = b1.ptr<float>(j);
pb2 = b2.ptr<float>(j);
pdU = dW.ptr<float>(j);
pdV = pdU + 1;
for ( int i = 0; i < W.cols; i++ ) //for each pixel in the row
{ // TODO: implement masking of points warped out of the image
//color constancy component
derivNorm = (*pIx) * (*pIx) + (*pIy) * (*pIy) + zeta_squared;
Ik1z = *pIz + (*pIx * *pdU) + (*pIy * *pdV);
temp = (0.5f*delta/3) / sqrt(Ik1z * Ik1z / derivNorm + epsilon_squared);
*pa11 = *pIx * *pIx * temp / derivNorm;
*pa12 = *pIx * *pIy * temp / derivNorm;
*pa22 = *pIy * *pIy * temp / derivNorm;
*pb1 = -*pIz * *pIx * temp / derivNorm;
*pb2 = -*pIz * *pIy * temp / derivNorm;
// gradient constancy component
derivNorm = *pIxx * *pIxx + *pIxy * *pIxy + zeta_squared;
derivNorm2 = *pIyy * *pIyy + *pIxy * *pIxy + zeta_squared;
Ik1zx = *pIxz + *pIxx * *pdU + *pIxy * *pdV;
Ik1zy = *pIyz + *pIxy * *pdU + *pIyy * *pdV;
temp = (0.5f*gamma/3)
/ sqrt(
Ik1zx * Ik1zx / derivNorm + Ik1zy * Ik1zy / derivNorm2
+ epsilon_squared);
*pa11 += temp * (*pIxx * *pIxx / derivNorm + *pIxy * *pIxy / derivNorm2);
*pa12 += temp * (*pIxx * *pIxy / derivNorm + *pIxy * *pIyy / derivNorm2);
*pa22 += temp * (*pIxy * *pIxy / derivNorm + *pIyy * *pIyy / derivNorm2);
*pb1 += -temp * (*pIxx * *pIxz / derivNorm + *pIxy * *pIyz / derivNorm2);
*pb2 += -temp * (*pIxy * *pIxz / derivNorm + *pIyy * *pIyz / derivNorm2);
++pIx;
++pIy;
++pIz;
++pIxx;
++pIxy;
++pIyy;
++pIxz;
++pIyz;
pdU += 2;
pdV += 2;
++pa11;
++pa12;
++pa22;
++pb1;
++pb2;
}
}
}
void OpticalFlowDeepFlow::smoothnessWeights( const Mat W, Mat weightsX, Mat weightsY )
{
float k[] = { -0.5, 0, 0.5 };
const float epsilon_squared = epsilon * epsilon;
Mat kernel_h = Mat(1, 3, CV_32FC1, k);
Mat kernel_v = Mat(3, 1, CV_32FC1, k);
Mat Wx, Wy; // partial derivatives of the flow
Mat S = Mat(W.size(), CV_32FC1); // sum of squared derivatives
weightsX = Mat::zeros(W.size(), CV_32FC1); //output - weights of smoothness terms in x and y directions
weightsY = Mat::zeros(W.size(), CV_32FC1);
filter2D(W, Wx, CV_32FC2, kernel_h);
filter2D(W, Wy, CV_32FC2, kernel_v);
const float * ux, *uy, *vx, *vy;
float * pS, *pWeight, *temp;
for ( int j = 0; j < S.rows; ++j )
{
ux = Wx.ptr<float>(j);
vx = ux + 1;
uy = Wy.ptr<float>(j);
vy = uy + 1;
pS = S.ptr<float>(j);
for ( int i = 0; i < S.cols; ++i )
{
*pS = alpha / sqrt(*ux * *ux + *vx * *vx + *uy * *uy + *vy * *vy + epsilon_squared);
ux += 2;
vx += 2;
uy += 2;
vy += 2;
++pS;
}
}
// horizontal weights
for ( int j = 0; j < S.rows; ++j )
{
pWeight = weightsX.ptr<float>(j);
pS = S.ptr<float>(j);
for ( int i = 0; i < S.cols - 1; ++i )
{
*pWeight = *pS + *(pS + 1);
++pS;
++pWeight;
}
}
//vertical weights
for ( int j = 0; j < S.rows - 1; ++j )
{
pWeight = weightsY.ptr<float>(j);
pS = S.ptr<float>(j);
temp = S.ptr<float>(j + 1); // next row pointer for easy access
for ( int i = 0; i < S.cols; ++i )
{
*pWeight = *(pS++) + *(temp++);
++pWeight;
}
}
}
void OpticalFlowDeepFlow::smoothnessTerm( const Mat W, const Mat weightsX, const Mat weightsY,
Mat b1, Mat b2 )
{
float *pB1, *pB2;
const float *pU, *pV, *pWeight;
float iB1, iB2; // increments of b1 and b2
//horizontal direction - both U and V (b1 and b2)
for ( int j = 0; j < W.rows; j++ )
{
pB1 = b1.ptr<float>(j);
pB2 = b2.ptr<float>(j);
pU = W.ptr<float>(j);
pV = pU + 1;
pWeight = weightsX.ptr<float>(j);
for ( int i = 0; i < W.cols - 1; i++ )
{
iB1 = (*(pU + 2) - *pU) * *pWeight;
iB2 = (*(pV + 2) - *pV) * *pWeight;
*pB1 += iB1;
*(pB1 + 1) -= iB1;
*pB2 += iB2;
*(pB2 + 1) -= iB2;
pB1++;
pB2++;
pU += 2;
pV += 2;
pWeight++;
}
}
const float *pUnext, *pVnext; // temp pointers for next row
float *pB1next, *pB2next;
//vertical direction - both U and V
for ( int j = 0; j < W.rows - 1; j++ )
{
pB1 = b1.ptr<float>(j);
pB2 = b2.ptr<float>(j);
pU = W.ptr<float>(j);
pV = pU + 1;
pUnext = W.ptr<float>(j + 1);
pVnext = pUnext + 1;
pB1next = b1.ptr<float>(j + 1);
pB2next = b2.ptr<float>(j + 1);
pWeight = weightsY.ptr<float>(j);
for ( int i = 0; i < W.cols; i++ )
{
iB1 = (*pUnext - *pU) * *pWeight;
iB2 = (*pVnext - *pV) * *pWeight;
*pB1 += iB1;
*pB1next -= iB1;
*pB2 += iB2;
*pB2next -= iB2;
pB1++;
pB2++;
pU += 2;
pV += 2;
pWeight++;
pUnext += 2;
pVnext += 2;
pB1next++;
pB2next++;
}
}
}
void OpticalFlowDeepFlow::sorSolve( const Mat a11, const Mat a12, const Mat a22, const Mat b1,
const Mat b2, const Mat smoothX, const Mat smoothY, Mat dW )
{
CV_Assert(a11.isContinuous());
CV_Assert(a12.isContinuous());
CV_Assert(a22.isContinuous());
CV_Assert(b1.isContinuous());
CV_Assert(b2.isContinuous());
CV_Assert(smoothX.isContinuous());
CV_Assert(smoothY.isContinuous());
if(dW.cols > 2 && dW.rows > 2)
{
sorUnfolded(a11, a12, a22, b1, b2, smoothX, smoothY, dW );
//more efficient version - this one is mostly for future reference and readability
return;
}
std::vector<Mat> dWChannels(2);
split(dW, dWChannels);
Mat *du = &(dWChannels[0]);
Mat *dv = &(dWChannels[1]);
CV_Assert(du->isContinuous());
CV_Assert(dv->isContinuous());
const float *pa11, *pa12, *pa22, *pb1, *pb2, *psmoothX, *psmoothY;
float *pdu, *pdv;
psmoothX = smoothX.ptr<float>(0);
psmoothY = smoothY.ptr<float>(0);
pdu = du->ptr<float>(0);
pdv = dv->ptr<float>(0);
float sigmaU, sigmaV, dPsi, A11, A22, A12, B1, B2, det;
int cols = dW.cols;
int rows = dW.rows;
int s = dW.cols; // step between rows
for ( int iter = 0; iter < sorIterations; ++iter )
{
pa11 = a11.ptr<float>(0);
pa12 = a12.ptr<float>(0);
pa22 = a22.ptr<float>(0);
pb1 = b1.ptr<float>(0);
pb2 = b2.ptr<float>(0);
for ( int j = 0; j < rows; ++j )
{
for ( int i = 0; i < cols; ++i )
{
int o = j * s + i;
if ( i == 0 && j == 0 )
{
dPsi = psmoothX[o] + psmoothY[o];
sigmaU = psmoothX[o] * pdu[o + 1] + psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o] * pdv[o + 1] + psmoothY[o] * pdv[o + s];
} else if ( i == cols - 1 && j == 0 )
{
dPsi = psmoothX[o - 1] + psmoothY[o];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothY[o] * pdv[o + s];
} else if ( j == 0 )
{
dPsi = psmoothX[o - 1] + psmoothX[o] + psmoothY[o];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothX[o] * pdu[o + 1] + psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothX[o] * pdv[o + 1] + psmoothY[o] * pdv[o + s];
} else if ( i == 0 && j == rows - 1 )
{
dPsi = psmoothX[o] + psmoothY[o - s];
sigmaU = psmoothX[o] * pdu[o + 1]
+ psmoothY[o - s] * pdu[o - s];
sigmaV = psmoothX[o] * pdv[o + 1]
+ psmoothY[o - s] * pdv[o - s];
} else if ( i == cols - 1 && j == rows - 1 )
{
dPsi = psmoothX[o - 1] + psmoothY[o - s];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothY[o - s] * pdu[o - s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothY[o - s] * pdv[o - s];
} else if ( j == rows - 1 )
{
dPsi = psmoothX[o - 1] + psmoothX[o] + psmoothY[o - s];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothX[o] * pdu[o + 1]
+ psmoothY[o - s] * pdu[o - s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothX[o] * pdv[o + 1]
+ psmoothY[o - s] * pdv[o - s];
} else if ( i == 0 )
{
dPsi = psmoothX[o] + psmoothY[o - s] + psmoothY[o];
sigmaU = psmoothX[o] * pdu[o + 1]
+ psmoothY[o - s] * pdu[o - s]
+ psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o] * pdv[o + 1]
+ psmoothY[o - s] * pdv[o - s]
+ psmoothY[o] * pdv[o + s];
} else if ( i == cols - 1 )
{
dPsi = psmoothX[o - 1] + psmoothY[o - s] + psmoothY[o];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothY[o - s] * pdu[o - s]
+ psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothY[o - s] * pdv[o - s]
+ psmoothY[o] * pdv[o + s];
} else
{
dPsi = psmoothX[o - 1] + psmoothX[o] + psmoothY[o - s]
+ psmoothY[o];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothX[o] * pdu[o + 1]
+ psmoothY[o - s] * pdu[o - s]
+ psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothX[o] * pdv[o + 1]
+ psmoothY[o - s] * pdv[o - s]
+ psmoothY[o] * pdv[o + s];
}
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
}
}
}
merge(dWChannels, dW);
}
void OpticalFlowDeepFlow::sorUnfolded( const Mat a11, const Mat a12, const Mat a22, const Mat b1, const Mat b2,
const Mat smoothX, const Mat smoothY, Mat dW )
{
// the same effect as sorSolve(), but written more efficiently
std::vector<Mat> dWChannels(2);
split(dW, dWChannels);
Mat *du = &(dWChannels[0]);
Mat *dv = &(dWChannels[1]);
CV_Assert(du->isContinuous());
CV_Assert(dv->isContinuous());
const float *pa11, *pa12, *pa22, *pb1, *pb2, *psmoothX, *psmoothY;
float *pdu, *pdv;
float sigmaU, sigmaV, dPsi, A11, A22, A12, B1, B2, det;
int cols = dW.cols;
int rows = dW.rows;
int s = dW.cols; // step between rows
int j, i, o; //row, column, offset
for ( int iter = 0; iter < sorIterations; ++iter )
{
pa11 = a11.ptr<float>(0);
pa12 = a12.ptr<float>(0);
pa22 = a22.ptr<float>(0);
pb1 = b1.ptr<float>(0);
pb2 = b2.ptr<float>(0);
psmoothX = smoothX.ptr<float>(0);
psmoothY = smoothY.ptr<float>(0);
pdu = du->ptr<float>(0);
pdv = dv->ptr<float>(0);
// first row
// first column
o=0;
dPsi = psmoothX[o] + psmoothY[o];
sigmaU = psmoothX[o] * pdu[o + 1] + psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o] * pdv[o + 1] + psmoothY[o] * pdv[o + s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
// middle rows
for ( o = 1; o < cols-1; ++o )
{
dPsi = psmoothX[o - 1] + psmoothX[o] + psmoothY[o];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothX[o] * pdu[o + 1] + psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothX[o] * pdv[o + 1] + psmoothY[o] * pdv[o + s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
}
// last column
dPsi = psmoothX[o - 1] + psmoothY[o];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothY[o] * pdv[o + s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
++o;
//middle rows
for ( j = 1; j < rows - 1; ++j)
{
// first column
dPsi = psmoothX[o] + psmoothY[o - s] + psmoothY[o];
sigmaU = psmoothX[o] * pdu[o + 1]
+ psmoothY[o - s] * pdu[o - s]
+ psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o] * pdv[o + 1]
+ psmoothY[o - s] * pdv[o - s]
+ psmoothY[o] * pdv[o + s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
++o;
// middle columns
for ( i = 1; i < cols - 1; ++i)
{
dPsi = psmoothX[o - 1] + psmoothX[o] + psmoothY[o - s]
+ psmoothY[o];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothX[o] * pdu[o + 1]
+ psmoothY[o - s] * pdu[o - s]
+ psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothX[o] * pdv[o + 1]
+ psmoothY[o - s] * pdv[o - s]
+ psmoothY[o] * pdv[o + s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
++o;
}
//last column
dPsi = psmoothX[o - 1] + psmoothY[o - s] + psmoothY[o];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothY[o - s] * pdu[o - s]
+ psmoothY[o] * pdu[o + s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothY[o - s] * pdv[o - s]
+ psmoothY[o] * pdv[o + s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
++o;
}
//last row
//first column
dPsi = psmoothX[o] + psmoothY[o - s];
sigmaU = psmoothX[o] * pdu[o + 1]
+ psmoothY[o - s] * pdu[o - s];
sigmaV = psmoothX[o] * pdv[o + 1]
+ psmoothY[o - s] * pdv[o - s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
++o;
//middle columns
for ( i = 1; i < cols - 1; ++i)
{
dPsi = psmoothX[o - 1] + psmoothX[o] + psmoothY[o - s];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothX[o] * pdu[o + 1]
+ psmoothY[o - s] * pdu[o - s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothX[o] * pdv[o + 1]
+ psmoothY[o - s] * pdv[o - s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
++o;
}
//last column
dPsi = psmoothX[o - 1] + psmoothY[o - s];
sigmaU = psmoothX[o - 1] * pdu[o - 1]
+ psmoothY[o - s] * pdu[o - s];
sigmaV = psmoothX[o - 1] * pdv[o - 1]
+ psmoothY[o - s] * pdv[o - s];
A11 = *pa22 + dPsi;
A12 = -*pa12;
A22 = *pa11 + dPsi;
det = A11 * A22 - A12 * A12;
A11 /= det;
A12 /= det;
A22 /= det;
B1 = *pb1 + sigmaU;
B2 = *pb2 + sigmaV;
pdu[o] += omega * (A11 * B1 + A12 * B2 - pdu[o]);
pdv[o] += omega * (A12 * B1 + A22 * B2 - pdv[o]);
++pa11; ++pa12; ++pa22; ++pb1; ++pb2;
}
merge(dWChannels, dW);
}
void OpticalFlowDeepFlow::collectGarbage()
{
}
//
//CV_INIT_ALGORITHM(OpticalFlowDeepFlow, "DenseOpticalFlow.DeepFlow",
// obj.info()->addParam(obj, "sigma", obj.sigma, false, 0, 0, "Gaussian blur parameter");
// obj.info()->addParam(obj, "alpha", obj.alpha, false, 0, 0, "Smoothness assumption weight");
// obj.info()->addParam(obj, "delta", obj.delta, false, 0, 0, "Color constancy weight");
// obj.info()->addParam(obj, "gamma", obj.gamma, false, 0, 0, "Gradient constancy weight");
// obj.info()->addParam(obj, "omega", obj.omega, false, 0, 0, "Relaxation factor in SOR");
// obj.info()->addParam(obj, "minSize", obj.minSize, false, 0, 0, "Min. image size in the pyramid");
// obj.info()->addParam(obj, "fixedPointIterations", obj.fixedPointIterations, false, 0, 0, "Fixed point iterations");
// obj.info()->addParam(obj, "sorIterations", obj.sorIterations, false, 0, 0, "SOR iterations");
// obj.info()->addParam(obj, "downscaleFactor", obj.downscaleFactor, false, 0, 0,"Downscale factor"))
Ptr<DenseOpticalFlow> createOptFlow_DeepFlow()
{
return makePtr<OpticalFlowDeepFlow>();
}
}//optflow
}//cv
| 36.929642 | 125 | 0.485165 | AntoninARBERET |
28460a9000b2ba8a62c8050cef2fcc70ecd74e87 | 2,322 | cpp | C++ | tuan_2/source.cpp | thuanpham2311/thuc-hanh-nhap-mon-cau-truc-du-lieu | 04f73c98895e88b1c36b6cfc48da49cb7cec8cf4 | [
"Unlicense"
] | null | null | null | tuan_2/source.cpp | thuanpham2311/thuc-hanh-nhap-mon-cau-truc-du-lieu | 04f73c98895e88b1c36b6cfc48da49cb7cec8cf4 | [
"Unlicense"
] | 1 | 2021-11-29T04:37:17.000Z | 2021-11-29T04:37:17.000Z | tuan_2/source.cpp | thuanpham2311/thuc-hanh-nhap-mon-cau-truc-du-lieu | 04f73c98895e88b1c36b6cfc48da49cb7cec8cf4 | [
"Unlicense"
] | null | null | null | #include "header.h"
void khoiTao(DaySo &x) { x.n = 0; }
int isEmpty(DaySo x) { return (x.n == 0 ? 1 : 0); }
int isFull(DaySo x) { return (x.n == MAX ? 1 : 0); }
void doc_DanhSach(DaySo &x) {
cout << "\n Nhap vao so phan tu cua DS:";
cin >> x.n;
for (int i = 0; i < x.n; i++) {
cout << "\n Nhap vao phan tu thu " << i + 1 << ":";
cin >> x.ds[i];
}
}
void xuat_DanhSach(DaySo x) {
cout << "\n Phan tu trong DS:";
for (int i = 0; i < x.n; i++) cout << x.ds[i] << " ";
}
void chen_ViTri(DaySo &x, int pos, int a) {
if (pos < 0 || pos > x.n)
cout << "\n Vi tri " << pos << " khong hop le";
else if (isEmpty(x) == 1) {
if (pos == 0) {
x.ds[0] = a;
x.n++;
} else
cout << "\n Vi tri khong hop le";
} else if (isFull(x) == 1)
cout << "\n Danh sach day";
else {
for (int i = x.n - 1; i >= pos; i--) x.ds[i + 1] = x.ds[i];
x.ds[pos] = a;
x.n++;
}
}
void xoa_ViTri(DaySo &x, int pos) {
int i;
if (pos < 0 || pos > x.n - 1)
cout << "Vi tri" << pos << "khong hop le !";
else if (isEmpty(x))
cout << "DS bi rong";
else {
for (i = pos + 1; i <= x.n; i++) x.ds[i - 1] = x.ds[i];
x.n--;
}
}
int timKiem_TuanTu(DaySo x, int a) {
int i = 0;
while (i < x.n && x.ds[i] != a) i++;
if (i == x.n) return -1;
return i;
}
int timKiemNhiPhan(DaySo x, int k) {
int top = x.n - 1, bot = 0, mid;
do {
mid = (top + bot) / 2;
if (x.ds[mid] == k) {
return mid;
} else if (k < x.ds[mid]) {
top = mid - 1;
} else {
bot = mid + 1;
}
} while (bot <= top);
return -1;
}
void sapXep(DaySo &x) {
for (int i = 0; i < x.n - 1; i++)
for (int j = i + 1; j < x.n; j++)
if (x.ds[j] < x.ds[i]) {
int tam = x.ds[i];
x.ds[i] = x.ds[j];
x.ds[j] = tam;
}
}
void xoa_GiaTri_K(DaySo &x, int k) {
for (int i = 0; i < x.n; i++) {
if (x.ds[i] == k) {
for (int j = i; j < x.n - 1; j++) x.ds[j] = x.ds[j + 1];
x.n--;
}
}
}
int diemSoLanXuatHienX(DaySo array, int x) {
int count = 0;
for (int i = 0; i < array.n; i++) {
if (array.ds[i] == x) {
count++;
}
}
return count;
}
void xuatLanLuotCacViTriX(DaySo array, int x) {
for (int i = 0; i < array.n; i++) {
if (array.ds[i] == x) {
cout << i << "\t";
}
}
}
| 20.732143 | 63 | 0.445306 | thuanpham2311 |
284863c2fcb0f8a1d554cd03f43db15c21b1963e | 856 | cpp | C++ | Threading/ThreadPool.cpp | sakex/NEAT-GRU | 2d96ff50415f38a8cf0ea7f3921c294b5766fc49 | [
"MIT"
] | 1 | 2021-05-21T21:40:11.000Z | 2021-05-21T21:40:11.000Z | Threading/ThreadPool.cpp | sakex/NEAT-GRU | 2d96ff50415f38a8cf0ea7f3921c294b5766fc49 | [
"MIT"
] | 9 | 2020-06-01T14:33:32.000Z | 2020-06-01T16:38:28.000Z | Threading/ThreadPool.cpp | sakex/NEAT-GRU | 2d96ff50415f38a8cf0ea7f3921c294b5766fc49 | [
"MIT"
] | null | null | null | /*
* ThreadPool.cpp
*
* Created on: Aug 8, 2019
* Author: sakex
*/
#include "ThreadPool.h"
namespace Threading {
ThreadPool::ThreadPool(int const _max_threads) :
working_threads(0) {
max_threads = _max_threads;
}
ThreadPool::~ThreadPool() {
// TODO Auto-generated destructor stub
}
void ThreadPool::add_task(std::function<void()> & func) {
queue.push(func);
}
void ThreadPool::thread_callback() {
working_threads--;
}
void ThreadPool::run() {
while (!queue.empty()) {
if (max_threads >= working_threads) {
std::function<void()> func = queue.front();
auto lambda = [this, func]() -> void {
func();
this->thread_callback();
};
queue.pop();
working_threads++;
std::thread t(lambda);
t.detach();
}
}
while (working_threads)
continue; // wait for threads to terminate
}
} /* namespace Threading */
| 17.833333 | 57 | 0.649533 | sakex |
284aa4f106e0fe2ed977ce272a7e4613cf83a841 | 13,054 | cpp | C++ | MathLibTest/Source/TrapezoidQuadrature_TEST.cpp | bgin/MissileSimulation | 90adcbf1c049daafb939f3fe9f9dfe792f26d5df | [
"MIT"
] | 23 | 2016-08-28T23:20:12.000Z | 2021-12-15T14:43:58.000Z | MathLibTest/Source/TrapezoidQuadrature_TEST.cpp | bgin/MissileSimulation | 90adcbf1c049daafb939f3fe9f9dfe792f26d5df | [
"MIT"
] | 1 | 2018-06-02T21:29:51.000Z | 2018-06-05T05:59:31.000Z | MathLibTest/Source/TrapezoidQuadrature_TEST.cpp | bgin/MissileSimulation | 90adcbf1c049daafb939f3fe9f9dfe792f26d5df | [
"MIT"
] | 1 | 2019-07-04T22:38:22.000Z | 2019-07-04T22:38:22.000Z | #include "TrapezoidQuadrature_TEST.h"
void test::TrapezoidQuadratureTest::Test_Trapezoid_Quadrature()
{
std::printf("Beginning test of Trapezoid Quadrature\n");
std::printf("First Run: Numerical Quadrature of polynomial based Integrals...\n\n");
const double a = 0.0L, b = 1.0L;
const int num_steps = 1024;
std::printf("Test #1\n");
std::printf("Test of Integral type: Int [x dx]\n");
std::printf("abscissas: a=%.15f,b=%.15f\n", a, b);
std::printf("Number of steps=%d\n", num_steps);
std::printf("Actual value=%.15f\n", (Integral([](const double arg)->double
{
return 0.5L * (arg * arg);
}, b) - Integral([](const double arg)->double
{
return 0.5L * (arg * arg);
},a)));
auto result1 = mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return arg;
}, a, b, num_steps);
std::printf("Result from TrapezoidRule::integrate=%.15f\n\n", result1.get_integral());
std::printf("Test #2\n");
std::printf("Test of Integral type: Int [x^2 dx]\n");
std::printf("abscissas: a=%.15f,b=%.15f\n", a, b);
std::printf("Number of steps=%d\n", num_steps);
double reference_value = Integral([](const double arg)->double
{
return 0.3L * (arg * arg * arg);
}, b) - Integral([](const double arg)->double
{
return 0.3L * (arg * arg * arg);
}, a);
std::printf("Actual value=%.15f\n", reference_value);
auto result2 = mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return arg * arg;
}, a, b, num_steps);
std::printf("Result from TrapezoidRule::integrate=%.15f\n", result2.get_integral());
std::printf("Results Delta=%.15f\n\n", std::fabs(result2.get_integral()) - std::fabs(reference_value));
std::printf("Test #3\n");
std::printf("Test of Integral type: Int [x^3/3 dx]\n");
std::printf("abscissas: a=%.15f,b=%.15f\n", a, b);
std::printf("Number of steps=%d\n", num_steps);
auto reference_value2 = Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, b) - Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, a);
std::printf("Actual value=%.15f\n", reference_value2);
auto result3 = mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.33333333333333333L * (arg * arg * arg);
}, a, b, num_steps);
std::printf("Result from TrapezoidRule::integrate=%.15f\n", result3.get_integral());
std::printf("Results Delta=%.15f\n\n", std::fabs(result3.get_integral()) - std::fabs(reference_value2));
std::printf("Test #4\n");
std::printf("Test of Integral of type: Int [x^5/3 dx]\n");
std::printf("abscissas: a=%.15f,b=%.15f\n", a, b);
std::printf("Number of steps=%d\n", num_steps);
auto reference_value3 = Integral([](const double arg)->double
{
return 0.055555555555555L * (arg * arg * arg * arg * arg * arg);
}, b) - Integral([](const double arg)->double
{
return 0.055555555555555L * (arg * arg * arg * arg * arg * arg);
}, a);
std::printf("Actual value=%.15f\n", reference_value3);
auto result4 = mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.33333333333333333L * (arg * arg * arg * arg * arg);
}, a, b, num_steps);
std::printf("Result from TrapezoidRule::integrate=%.15f\n", result4.get_integral());
std::printf("Results Delta=%.15f\n\n", std::fabs(result4.get_integral()) - std::fabs(reference_value3));
}
void test::TrapezoidQuadratureTest::Test_Trapezoid_Quadrature_Varying_Abscissas()
{
std::printf("Beginning test of Trapezoid Quadrature\n");
std::printf("First Run: Numerical Quadrature of polynomial based Integrals...\n");
std::printf("Testing convergence on varying abscissa, with fixed number of steps\n\n");
const int num_steps = 1024,num_iters = 100;
std::vector<double> ref_values;
std::vector<double> qdrtr_values;
std::vector<std::pair<double, double>> abscissa_values;
std::vector<double> qdrtr_error;
double a = 0.0L, b = 1.0L;
double incr_a = 0.1L; double incr_b = 0.4L;
std::printf("Test #1\n");
std::printf("Test of Integral of type:[x^3/3 dx]\n\n");
std::printf("Number of loop iterations=%d\n", num_iters);
std::printf("Number of steps=%d\n", num_steps);
std::printf("abscissa a=%.15f, increment by: %.15f\n", a, incr_a);
std::printf("abscissa b=%.15f, increment by: %.15f\n", b, incr_b);
for (auto i = 0; i != num_iters; ++i)
{
b += incr_b;
a += incr_a;
ref_values.push_back((Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, b) - Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, a)));
qdrtr_values.push_back(mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.33333333333333333L * (arg * arg * arg);
}, a, b, num_steps).get_integral() );
qdrtr_error.push_back(mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.33333333333333333L * (arg * arg * arg);
}, a, b, num_steps).get_error());
abscissa_values.push_back(std::pair<double,double>(a, b));
}
std::printf("Dumping the results...\n\n");
std::printf("Ref_value: Quadrature approx: Delta: Error: \n");
for (auto i = 0; i != num_iters; ++i)
{
std::printf("#%d, %.15f %.15f %.15f %.15f\n",i, ref_values.operator[](i), qdrtr_values.operator[](i),
(qdrtr_values.operator[](i) - ref_values.operator[](i)),qdrtr_error.operator[](i));
std::printf("abscissa a=%.9f b=%.9f\n", abscissa_values.operator[](i).first, abscissa_values.operator[](i).second);
}
std::printf("Finished Test\n\n");
}
void test::TrapezoidQuadratureTest::Test_Trapezoid_Quadrature_Varying_Steps(double a, double b)
{
std::printf("Beginning test of Trapezoid Quadrature\n");
std::printf("First Run: Numerical Quadrature of polynomial based Integrals...\n");
std::printf("Testing quadrature convergence, varying interval, varying number of steps\n\n");
const int num_iters = 20;
std::vector<double> ref_values;
std::vector<double> qdrtr_values;
std::vector<double> qdrtr_err;
unsigned int num_steps = 2;
unsigned int steps_vals[20];
std::printf("Test #1\n");
std::printf("Test of Integral of type:[x^3/3 dx]\n");
std::printf("Number of loop iterations=%d\n", num_iters);
std::printf("Starting abscissa(varying) a=%.15f,b=%.15f\n", a, b);
for (auto i = 0; i != num_iters; ++i)
{
num_steps <<= 1;
steps_vals[i] = num_steps;
ref_values.push_back((Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, b) - Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, a)));
qdrtr_values.push_back(mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.333333333333333L * (arg * arg * arg);
}, a, b, num_steps).get_integral());
qdrtr_err.push_back(mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.333333333333333L * (arg * arg * arg);
}, a, b, num_steps).get_error());
}
std::printf("Dumping the results...\n\n");
std::printf("#Steps: Ref_value: Quadrature_approx: Delta: Error: \n");
for (auto i = 0; i != num_iters; ++i)
{
std::printf("#%d, %.15f %.15f %.15f %.15f\n", steps_vals[i], ref_values.operator[](i), qdrtr_values.operator[](i),
(qdrtr_values.operator[](i) - ref_values.operator[](i)), qdrtr_err.operator[](i));
}
std::printf("Finished Test\n\n");
}
void test::TrapezoidQuadratureTest::Test_Trapezoid_Quadrature_Varying_Steps()
{
std::printf("Beginning test of Trapezoid Quadrature\n");
std::printf("First Run: Numerical Quadrature of polynomial based Integrals...\n");
std::printf("Testing quadrature convergence, fixed abscissa, varying number of steps\n\n");
const double a = 0.0L, b = 1.0L;
const int num_iters = 20;
std::vector<double> ref_values;
std::vector<double> qdrtr_values;
std::vector<double> qdrtr_err;
unsigned int num_steps = 2;
unsigned int steps_vals[20];
std::printf("Test #1\n");
std::printf("Test of Integral of type:[x^3/3 dx]\n");
std::printf("Number of loop iterations=%d\n", num_iters);
std::printf("Starting abscissa(fixed) a=%.15f,b=%.15f\n", a, b);
for (auto i = 0; i != num_iters; ++i)
{
num_steps <<= 1;
steps_vals[i] = num_steps;
ref_values.push_back((Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, b) - Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, a)));
qdrtr_values.push_back(mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.333333333333333L * (arg * arg * arg);
}, a, b, num_steps).get_integral());
qdrtr_err.push_back(mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.333333333333333L * (arg * arg * arg);
}, a, b, num_steps).get_error());
}
std::printf("Dumping the results...\n\n");
std::printf("#Steps: Ref_value: Quadrature_approx: Delta: Error: \n");
for (auto i = 0; i != num_iters; ++i)
{
std::printf("#%d, %.15f %.15f %.15f %.15f\n", steps_vals[i], ref_values.operator[](i), qdrtr_values.operator[](i),
(qdrtr_values.operator[](i) - ref_values.operator[](i)), qdrtr_err.operator[](i));
}
std::printf("Finished Test\n\n");
}
// To be used only with small step size because of int overflow.
void test::TrapezoidQuadratureTest::Test_Trapezoid_Quadrature_Varying_Abscissa_Steps()
{
std::printf("Beginning test of Trapezoid Quadrature\n");
std::printf("First Run: Numerical Quadrature of polynomial based Integrals...\n");
std::printf("Testing Quadrature convergence, varying steps, varying abscissa range\n\n");
const int num_iters_range = 10;
const int num_iters_step = 10;
double a = 0.0L, b = 1.0L;
double incra = 0.5L, incrb = 0.5L;
unsigned int num_steps = 2;
unsigned int steps_values[num_iters_step * 10];
std::vector<double> ref_values;
std::vector<double> qdrtr_values;
std::vector<double> qdrtr_err;
std::vector<std::pair<double, double>> abscssa_values;
std::printf("Test #1\n");
std::printf("Test of Integral of type:[x^3/3 dx]\n");
std::printf("Number of abscissa range iterations=%d\n", num_iters_range);
std::printf("Number of steps per abscissa range=%d\n", num_iters_step);
std::printf("Starting abscissa range: a=%.15f increment by:%.15f\n", a,incra);
std::printf("Starting abscissa range: b=%.15f increment by:%.15f\n", b, incrb);
for (auto i = 0; i != num_iters_range; ++i)
{
a += incra;
b += incrb;
abscssa_values.push_back(std::pair<double, double>(a, b));
for (auto j = 0; j != num_iters_step; ++j)
{
num_steps <<= 1;
std::printf("num_steps=%d\n", num_steps);
steps_values[j] = num_steps;
ref_values.push_back((Integral([](const double arg)->double{
return 0.083333333333333L * (arg * arg * arg * arg);
}, b) - Integral([](const double arg)->double
{
return 0.083333333333333L * (arg * arg * arg * arg);
}, a)));
qdrtr_values.push_back(mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.333333333333333L * (arg * arg * arg);
}, a, b, num_steps).get_integral());
qdrtr_err.push_back(mathlib::TrapezoidRule<double>::integrate([](double arg)->double
{
return 0.333333333333333L * (arg * arg * arg);
}, a, b, num_steps).get_error());
}
}
std::printf("Dumping results...\n\n");
std::printf("Interval: Ref_Value: Quadrature_approx: Delta: Error: \n");
for (auto i = 0; i != num_iters_range; ++i)
{
std::printf("%.9f-%.9f\n", abscssa_values.operator[](i).first, abscssa_values.operator[](i).second);
for (auto j = 0; j != num_iters_step; ++j)
{
std::printf("%d,%.15f,%.15f,%.15f,%.15f\n",steps_values[j], ref_values.operator[](j), qdrtr_values.operator[](j),
(qdrtr_values.operator[](j) - ref_values.operator[](j)), qdrtr_err.operator[](j));
}
}
}
void test::TrapezoidQuadratureTest::Test_Trapezoid_Quadrature_Transc()
{
std::printf("Begin Test of Trapezoid Quadrature\n");
std::printf("Second Run: Numerical Quadrature of Transcendental Functions\n");
std::printf("Testing Quadrature convergence, fixed interval, fixed steps number\n");
const double a = 0.0L, b = 1.0L;
const int num_steps = 1 << 20;
std::printf("Test #1\n");
std::printf("Quadrature approximation of PDF function\n");
std::printf("abscissa: a=%.15f, b=%.15f\n", a, b);
std::printf("Number of quadrature steps=%d\n", num_steps);
}
void test::TrapezoidQuadratureTest::Run_Trapezoid_Quadrature_Tests()
{
Test_Trapezoid_Quadrature();
}
void test::TrapezoidQuadratureTest::Run_Trapezoid_Varying_Abscissa_Tests()
{
Test_Trapezoid_Quadrature_Varying_Abscissas();
}
void test::TrapezoidQuadratureTest::Run_Trapezoid_Varying_Step_Tests()
{
Test_Trapezoid_Quadrature_Varying_Steps();
}
void test::TrapezoidQuadratureTest::Run_Trapezoid_Varying_Abscissa_Step_Tests()
{
unsigned int num_iters_range = 10;
double a = 0.0L, b = 1.0L, incr = 0.5L;
for (auto i = 0; i != num_iters_range; ++i)
{
a += incr;
b += incr;
Test_Trapezoid_Quadrature_Varying_Steps(a, b);
}
} | 38.735905 | 119 | 0.672131 | bgin |
284d189c7b9b5ca8b4c41bb5c507e91b71246f49 | 62,947 | cpp | C++ | include/jdialogs.cpp | Perchik71/jDialogs | 8d8d46df7eb7f7e7e6437faa39a6949392ec447e | [
"MIT"
] | null | null | null | include/jdialogs.cpp | Perchik71/jDialogs | 8d8d46df7eb7f7e7e6437faa39a6949392ec447e | [
"MIT"
] | null | null | null | include/jdialogs.cpp | Perchik71/jDialogs | 8d8d46df7eb7f7e7e6437faa39a6949392ec447e | [
"MIT"
] | null | null | null | /*
Generating Windows dialogs in JSON for C++
Version 0.4.1
https://github.com/Perchik71/jDialogs
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
SPDX-License-Identifier: MIT
Copyright (c) 2021 Alex (Perchik71).
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 <fstream>
#include <filesystem>
#include <map>
#include "jdialogs.h"
// Need for InitCommonControlsEx
#include <CommCtrl.h>
#pragma comment (lib, "Comctl32.lib")
#ifndef JDIALOG_NO_MANIFEST_LINKER_COMMCTRL
#pragma comment (linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' ""version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif // !JDIALOG_NO_MANIFEST_LINKER_COMMCTRL
#define JSON_USE_IMPLICIT_CONVERSIONS 0
/*
__ _____ _____ _____
__| | __| | | | JSON for Modern C++
| | |__ | | | | | | version 3.9.1
|_____|_____|_____|_|___| https://github.com/nlohmann/json
Licensed under the MIT License <http://opensource.org/licenses/MIT>.
SPDX-License-Identifier: MIT
Copyright (c) 2013-2019 Niels Lohmann <http://nlohmann.me>.
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 "..\json\single_include\nlohmann\json.hpp"
#define EXSTYLE_DEFAULT (0)
#define STYLE_DEFAULT (WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | DS_SETFONT | DS_SETFOREGROUND | DS_3DLOOK)
#define JDialogCreateCommControlA(_titled, _classd) CreateControlA(_ex_style, _titled, _classd, _style, _x, _y, _cx, _cy, _uid, _dialog)
#define JDialogCreateCommControlW(_titled, _classd) CreateControlW(_ex_style, _titled, _classd, _style, _x, _y, _cx, _cy, _uid, _dialog)
#define USES_STD_LEN
#ifndef USES_STD_LEN
#define JDialogStrLengthByteA(str) ((strlen(str.c_str())) << 1)
#define JDialogStrLengthByteW(str) ((wcslen(str.c_str())) << 1)
#else
#define JDialogStrLengthByteA(str) ((str.length()) << 1)
#define JDialogStrLengthByteW(str) JDialogStrLengthByteA(str)
#endif // !USES_STD_LEN
namespace perchik71
{
namespace jDialogs
{
bool g_comm_init = false;
using json = nlohmann::json;
namespace fs = filesystem;
typedef uint8_t* lpuint8_t;
typedef uint16_t* lpuint16_t;
typedef uint32_t* lpuint32_t;
typedef struct map_item_styles_tag
{
uint32_t style;
uint32_t ex_style;
} map_item_styles, *pmap_item_styles, *lpmap_item_styles;
/*
If the first element is 0xFFFF, the array has one additional element that specifies the ordinal value of a predefined system class.
The ordinal can be one of the following atom values.
*/
const map<string, uint16_t> mapSysClassA = {
{ "BUTTON", 0x0080 },
{ "EDIT", 0x0081 },
{ "STATIC", 0x0082 },
{ "LISTBOX", 0x0083 },
{ "SCROLLBAR", 0x0084 },
{ "COMBOBOX", 0x0085 }
};
const map<wstring, uint16_t> mapSysClassW = {
{ L"BUTTON", 0x0080 },
{ L"EDIT", 0x0081 },
{ L"STATIC", 0x0082 },
{ L"LISTBOX", 0x0083 },
{ L"SCROLLBAR", 0x0084 },
{ L"COMBOBOX", 0x0085 }
};
const map<string, map_item_styles> mapStdControlType = {
{ "TEXT", { JDialogDefaultTextStyle, 0 } },
{ "LTEXT", { JDialogDefaultLeftTextStyle, 0 } },
{ "CTEXT", { JDialogDefaultCenterTextStyle, 0 } },
{ "RTEXT", { JDialogDefaultRightTextStyle, 0 } },
{ "EDITTEXT", { JDialogDefaultEditTextStyle, 0 } },
{ "DEFPUSHBUTTON", { JDialogDefaultDefPushButtonStyle, 0 } },
{ "PUSHBUTTON", { JDialogDefaultPushButtonStyle, 0 } },
{ "LISTBOX", { JDialogDefaultListBoxStyle, 0 } },
{ "COMBOBOX", { JDialogDefaultComboBoxStyle, 0 } },
{ "COMBOBOXEX", { JDialogDefaultComboBoxStyle, 0 } },
{ "RADIOBUTTON", { JDialogDefaultRadioButtonStyle, 0 } },
{ "CHECKBUTTON", { JDialogDefaultCheckButtonStyle, 0 } },
{ "AUTORADIOBUTTON", { JDialogDefaultAutoRadioButtonStyle, 0 } },
{ "AUTOCHECKBUTTON", { JDialogDefaultAutoCheckButtonStyle, 0 } },
{ "GROUPBOX", { JDialogDefaultGroupBoxStyle, WS_EX_TRANSPARENT } },
{ "LISTVIEW", { JDialogDefaultListViewStyle, LVS_EX_DOUBLEBUFFER } },
{ "TREEVIEW", { JDialogDefaultTreeViewStyle, TVS_EX_DOUBLEBUFFER } },
{ "TABVIEW", { JDialogDefaultTabViewStyle, 0 } },
{ "BITMAP", { JDialogDefaultBitmapStyle, WS_EX_TRANSPARENT } },
{ "ICON", { JDialogDefaultIconStyle, WS_EX_TRANSPARENT } },
{ "BITMAPEX", { JDialogDefaultBitmapExStyle, WS_EX_TRANSPARENT } },
{ "ICONEX", { JDialogDefaultIconExStyle, WS_EX_TRANSPARENT } },
{ "SCROLLBAR", { JDialogDefaultScrollBarStyle, 0 } },
{ "REBAR", { JDialogDefaultReBarStyle, 0 } },
{ "HOTKEY", { JDialogDefaultHotKeyStyle, 0 } },
{ "IPADDRESS", { JDialogDefaultIPAdressStyle, 0 } },
{ "MONTHCAL", { JDialogDefaultMonthCalStyle, 0 } },
{ "STATUSBAR", { JDialogDefaultStatusBarStyle, 0 } },
{ "PROGRESSBAR", { JDialogDefaultProgressBarStyle, 0 } },
{ "ANIMATE", { JDialogDefaultAnimateStyle, 0 } },
{ "HEADER", { JDialogDefaultHeaderStyle, 0 } },
{ "RICHEDIT", { JDialogDefaultRichEditStyle, 0 } },
{ "DATETIMEPICKER", { JDialogDefaultDateTimePickerStyle, 0 } }
};
const map<string, string> mapStdControlType2A = {
{ "TEXT", "STATIC" },
{ "LTEXT", "STATIC" },
{ "CTEXT", "STATIC" },
{ "RTEXT", "STATIC" },
{ "EDITTEXT", "EDIT" },
{ "DEFPUSHBUTTON", "BUTTON" },
{ "PUSHBUTTON", "BUTTON" },
{ "LISTBOX", "LISTBOX" },
{ "COMBOBOX", "COMBOBOX" },
{ "COMBOBOXEX", "COMBOBOX" },
{ "RADIOBUTTON", "BUTTON" },
{ "CHECKBUTTON", "BUTTON" },
{ "AUTORADIOBUTTON", "BUTTON" },
{ "AUTOCHECKBUTTON", "BUTTON" },
{ "GROUPBOX", "BUTTON" },
{ "LISTVIEW", "SysListView32" },
{ "TREEVIEW", "SysTreeView32" },
{ "TABVIEW", "SysTabControl32" },
{ "BITMAP", "STATIC" },
{ "ICON", "STATIC" },
{ "BITMAPEX", "STATIC" },
{ "ICONEX", "STATIC" },
{ "SCROLLBAR", "SCROLLBAR" },
{ "REBAR", "ReBarWindow32" },
{ "HOTKEY", "msctls_hotkey32" },
{ "IPADDRESS", "SysIPAddress32" },
{ "MONTHCAL", "SysMonthCal32" },
{ "STATUSBAR", "msctls_statusbar32" },
{ "PROGRESSBAR", "msctls_progress32" },
{ "ANIMATE", "SysAnimate32" },
{ "HEADER", "SysHeader32" },
{ "RICHEDIT", "RichEdit20A" },
{ "DATETIMEPICKER", "SysDateTimePick32" }
};
const map<string, wstring> mapStdControlType2W = {
{ "TEXT", L"STATIC" },
{ "LTEXT", L"STATIC" },
{ "CTEXT", L"STATIC" },
{ "RTEXT", L"STATIC" },
{ "EDITTEXT", L"EDIT" },
{ "DEFPUSHBUTTON", L"BUTTON" },
{ "PUSHBUTTON", L"BUTTON" },
{ "LISTBOX", L"LISTBOX" },
{ "COMBOBOX", L"COMBOBOX" },
{ "COMBOBOXEX", L"COMBOBOX" },
{ "RADIOBUTTON", L"BUTTON" },
{ "CHECKBUTTON", L"BUTTON" },
{ "AUTORADIOBUTTON", L"BUTTON" },
{ "AUTOCHECKBUTTON", L"BUTTON" },
{ "GROUPBOX", L"BUTTON" },
{ "LISTVIEW", L"SysListView32" },
{ "TREEVIEW", L"SysTreeView32" },
{ "TABVIEW", L"SysTabControl32" },
{ "BITMAP", L"STATIC" },
{ "ICON", L"STATIC" },
{ "BITMAPEX", L"STATIC" },
{ "ICONEX", L"STATIC" },
{ "SCROLLBAR", L"SCROLLBAR" },
{ "REBAR", L"ReBarWindow32" },
{ "HOTKEY", L"msctls_hotkey32" },
{ "IPADDRESS", L"SysIPAddress32" },
{ "MONTHCAL", L"SysMonthCal32" },
{ "STATUSBAR", L"msctls_statusbar32" },
{ "PROGRESSBAR", L"msctls_progress32" },
{ "ANIMATE", L"SysAnimate32" },
{ "HEADER", L"SysHeader32" },
{ "RICHEDIT", L"RichEdit20W" },
{ "DATETIMEPICKER", L"SysDateTimePick32" }
};
const map<string, uint32_t> mapControlStyle = {
{ "DS_ABSALIGN", DS_ABSALIGN },
{ "DS_CENTER", DS_CENTER },
{ "DS_CENTERMOUSE", DS_CENTERMOUSE },
{ "DS_CONTEXTHELP", DS_CONTEXTHELP },
{ "DS_CONTROL", DS_CONTROL },
{ "DS_FIXEDSYS", DS_FIXEDSYS },
{ "DS_LOCALEDIT", DS_LOCALEDIT },
{ "DS_MODALFRAME", DS_MODALFRAME },
{ "DS_NOFAILCREATE", DS_NOFAILCREATE },
{ "DS_SETFONT", DS_SETFONT },
{ "DS_SETFOREGROUND", DS_SETFOREGROUND },
{ "DS_SHELLFONT", DS_SHELLFONT },
{ "DS_SYSMODAL", DS_SYSMODAL },
{ "WS_POPUP", WS_POPUP },
{ "WS_POPUPWINDOW", WS_POPUPWINDOW },
{ "WS_CHILD", WS_CHILD },
{ "WS_CHILDWINDOW", WS_CHILDWINDOW },
{ "WS_OVERLAPPED", WS_OVERLAPPED },
{ "WS_OVERLAPPEDWINDOW", WS_OVERLAPPEDWINDOW },
{ "WS_BORDER", WS_BORDER },
{ "WS_DISABLED", WS_DISABLED },
{ "WS_HSCROLL", WS_HSCROLL },
{ "WS_VSCROLL", WS_VSCROLL },
{ "WS_CAPTION", WS_CAPTION },
{ "WS_GROUP", WS_GROUP },
{ "WS_VISIBLE", WS_VISIBLE },
{ "WS_TABSTOP", WS_TABSTOP },
{ "WS_THICKFRAME", WS_THICKFRAME },
{ "WS_CLIPCHILDREN", WS_CLIPCHILDREN },
{ "WS_CLIPSIBLINGS", WS_CLIPSIBLINGS },
{ "WS_DLGFRAME", WS_DLGFRAME },
{ "WS_SYSMENU", WS_SYSMENU },
{ "WS_MAXIMIZEBOX", WS_MAXIMIZEBOX },
{ "WS_MINIMIZEBOX", WS_MINIMIZEBOX },
{ "WS_EX_COMPOSITED", WS_EX_COMPOSITED },
{ "WS_EX_NOPARENTNOTIFY", WS_EX_NOPARENTNOTIFY },
{ "WS_EX_NOACTIVATE", WS_EX_NOACTIVATE },
{ "WS_EX_ACCEPTFILES", WS_EX_ACCEPTFILES },
{ "WS_EX_CLIENTEDGE", WS_EX_CLIENTEDGE },
{ "WS_EX_TRANSPARENT", WS_EX_TRANSPARENT },
{ "WS_EX_STATICEDGE", WS_EX_STATICEDGE },
{ "WS_EX_WINDOWEDGE", WS_EX_WINDOWEDGE },
{ "WS_EX_RIGHT", WS_EX_RIGHT },
{ "WS_EX_RIGHTSCROLLBAR", WS_EX_RIGHTSCROLLBAR },
{ "WS_EX_LEFT", WS_EX_LEFT },
{ "WS_EX_LEFTSCROLLBAR", WS_EX_LEFTSCROLLBAR },
{ "WS_EX_LTRREADING", WS_EX_LTRREADING },
{ "WS_EX_RTLREADING", WS_EX_RTLREADING },
{ "WS_EX_NOINHERITLAYOUT", WS_EX_NOINHERITLAYOUT },
{ "SS_BITMAP", SS_BITMAP },
{ "SS_BLACKFRAME", SS_BLACKFRAME },
{ "SS_BLACKRECT", SS_BLACKRECT },
{ "SS_CENTER", SS_CENTER },
{ "SS_CENTERIMAGE", SS_CENTERIMAGE },
{ "SS_ENDELLIPSIS", SS_ENDELLIPSIS },
{ "SS_PATHELLIPSIS", SS_PATHELLIPSIS },
{ "SS_ELLIPSISMASK", SS_ELLIPSISMASK },
{ "SS_ENHMETAFILE", SS_ENHMETAFILE },
{ "SS_EDITCONTROL", SS_EDITCONTROL },
{ "SS_GRAYFRAME", SS_GRAYFRAME },
{ "SS_GRAYRECT", SS_GRAYRECT },
{ "SS_ICON", SS_ICON },
{ "SS_LEFT", SS_LEFT },
{ "SS_RIGHT", SS_RIGHT },
{ "SS_RIGHTJUST", SS_RIGHTJUST },
{ "SS_REALSIZEIMAGE", SS_REALSIZEIMAGE },
{ "SS_NOPREFIX", SS_NOPREFIX },
{ "SS_OWNERDRAW", SS_OWNERDRAW },
{ "SS_NOTIFY", SS_NOTIFY },
{ "SS_REALSIZECONTROL", SS_REALSIZECONTROL },
{ "SS_SUNKEN", SS_SUNKEN },
{ "SS_WHITEFRAME", SS_WHITEFRAME },
{ "SS_WHITERECT", SS_WHITERECT },
{ "SS_WORDELLIPSIS", SS_WORDELLIPSIS },
{ "ES_AUTOHSCROLL", ES_AUTOHSCROLL },
{ "ES_AUTOVSCROLL", ES_AUTOVSCROLL },
{ "ES_CENTER", ES_CENTER },
{ "ES_LEFT", ES_LEFT },
{ "ES_LOWERCASE", ES_LOWERCASE },
{ "ES_MULTILINE", ES_MULTILINE },
{ "ES_NOHIDESEL", ES_NOHIDESEL },
{ "ES_NUMBER", ES_NUMBER },
{ "ES_OEMCONVERT", ES_OEMCONVERT },
{ "ES_PASSWORD", ES_PASSWORD },
{ "ES_READONLY", ES_READONLY },
{ "ES_RIGHT", ES_RIGHT },
{ "ES_UPPERCASE", ES_UPPERCASE },
{ "ES_WANTRETURN", ES_WANTRETURN },
{ "BS_AUTORADIOBUTTON", BS_AUTORADIOBUTTON },
{ "BS_AUTOCHECKBOX", BS_AUTOCHECKBOX },
{ "BS_CHECKBOX", BS_CHECKBOX },
{ "BS_RADIOBUTTON", BS_RADIOBUTTON },
{ "BS_GROUPBOX", BS_GROUPBOX },
{ "BS_PUSHBOX", BS_PUSHBOX },
{ "BS_USERBUTTON", BS_USERBUTTON },
{ "BS_BITMAP", BS_BITMAP },
{ "BS_BOTTOM", BS_BOTTOM },
{ "BS_CENTER", BS_CENTER },
{ "BS_COMMANDLINK", BS_COMMANDLINK },
{ "BS_DEFPUSHBUTTON", BS_DEFPUSHBUTTON },
{ "BS_DEFCOMMANDLINK", BS_DEFCOMMANDLINK },
{ "BS_DEFSPLITBUTTON", BS_DEFSPLITBUTTON },
{ "BS_FLAT", BS_FLAT },
{ "BS_ICON", BS_ICON },
{ "BS_OWNERDRAW", BS_OWNERDRAW },
{ "BS_TOP", BS_TOP },
{ "BS_VCENTER", BS_VCENTER },
{ "BS_PUSHLIKE", BS_PUSHLIKE },
{ "BS_NOTIFY", BS_NOTIFY },
{ "BS_MULTILINE", BS_MULTILINE },
{ "BS_TYPEMASK", BS_TYPEMASK },
{ "BS_LEFTTEXT", BS_LEFTTEXT },
{ "LVS_EDITLABELS", LVS_EDITLABELS },
{ "LVS_ICON", LVS_ICON },
{ "LVS_LIST", LVS_LIST },
{ "LVS_OWNERDATA", LVS_OWNERDATA },
{ "LVS_NOCOLUMNHEADER", LVS_NOCOLUMNHEADER },
{ "LVS_NOSCROLL", LVS_NOSCROLL },
{ "LVS_REPORT", LVS_REPORT },
{ "LVS_NOSORTHEADER", LVS_NOSORTHEADER },
{ "LVS_ALIGNLEFT", LVS_ALIGNLEFT },
{ "LVS_OWNERDRAWFIXED", LVS_OWNERDRAWFIXED },
{ "LVS_AUTOARRANGE", LVS_AUTOARRANGE },
{ "LVS_SMALLICON", LVS_SMALLICON },
{ "LVS_SINGLESEL", LVS_SINGLESEL },
{ "LVS_SORTASCENDING", LVS_SORTASCENDING },
{ "LVS_SORTDESCENDING", LVS_SORTDESCENDING },
{ "LVS_SHAREIMAGELISTS", LVS_SHAREIMAGELISTS },
{ "LVS_NOLABELWRAP", LVS_NOLABELWRAP },
{ "LVS_SHOWSELALWAYS", LVS_SHOWSELALWAYS },
{ "LVS_EX_CHECKBOXES", LVS_EX_CHECKBOXES },
{ "LVS_EX_DOUBLEBUFFER", LVS_EX_DOUBLEBUFFER },
{ "LVS_EX_AUTOSIZECOLUMNS", LVS_EX_AUTOSIZECOLUMNS },
{ "LVS_EX_FULLROWSELECT", LVS_EX_FULLROWSELECT },
{ "LVS_EX_TRACKSELECT", LVS_EX_TRACKSELECT },
{ "LVS_EX_SINGLEROW", LVS_EX_SINGLEROW },
{ "LVS_EX_AUTOCHECKSELECT", LVS_EX_AUTOCHECKSELECT },
{ "LVS_EX_AUTOAUTOARRANGE", LVS_EX_AUTOAUTOARRANGE },
{ "LVS_EX_BORDERSELECT", LVS_EX_BORDERSELECT },
{ "LVS_EX_COLUMNOVERFLOW", LVS_EX_COLUMNOVERFLOW },
{ "LVS_EX_INFOTIP", LVS_EX_INFOTIP },
{ "LVS_EX_GRIDLINES", LVS_EX_GRIDLINES },
{ "LVS_EX_TWOCLICKACTIVATE", LVS_EX_TWOCLICKACTIVATE },
{ "LVS_EX_JUSTIFYCOLUMNS", LVS_EX_JUSTIFYCOLUMNS },
{ "LVS_EX_LABELTIP", LVS_EX_LABELTIP },
{ "LVS_EX_FLATSB", LVS_EX_FLATSB },
{ "LVS_EX_SNAPTOGRID", LVS_EX_SNAPTOGRID },
{ "CBS_AUTOHSCROLL", CBS_AUTOHSCROLL },
{ "CBS_DISABLENOSCROLL", CBS_DISABLENOSCROLL },
{ "CBS_DROPDOWN", CBS_DROPDOWN },
{ "CBS_DROPDOWNLIST", CBS_DROPDOWNLIST },
{ "CBS_HASSTRINGS", CBS_HASSTRINGS },
{ "CBS_LOWERCASE", CBS_LOWERCASE },
{ "CBS_UPPERCASE", CBS_UPPERCASE },
{ "CBS_OEMCONVERT", CBS_OEMCONVERT },
{ "CBS_SORT", CBS_SORT },
{ "CBS_OWNERDRAWFIXED", CBS_OWNERDRAWFIXED },
{ "CBS_OWNERDRAWVARIABLE", CBS_OWNERDRAWVARIABLE },
{ "CBS_NOINTEGRALHEIGHT", CBS_NOINTEGRALHEIGHT },
{ "LBS_NOTIFY", LBS_NOTIFY },
{ "LBS_NOINTEGRALHEIGHT", LBS_NOINTEGRALHEIGHT },
{ "LBS_HASSTRINGS", LBS_HASSTRINGS },
{ "LBS_MULTICOLUMN", LBS_MULTICOLUMN },
{ "LBS_MULTIPLESEL", LBS_MULTIPLESEL },
{ "LBS_EXTENDEDSEL", LBS_EXTENDEDSEL },
{ "LBS_DISABLENOSCROLL", LBS_DISABLENOSCROLL },
{ "LBS_COMBOBOX", LBS_COMBOBOX },
{ "LBS_NOREDRAW", LBS_NOREDRAW },
{ "LBS_NOSEL", LBS_NOSEL },
{ "LBS_OWNERDRAWFIXED", LBS_OWNERDRAWFIXED },
{ "LBS_OWNERDRAWVARIABLE", LBS_OWNERDRAWVARIABLE },
{ "LBS_SORT", LBS_SORT },
{ "LBS_STANDARD", LBS_STANDARD },
{ "LBS_WANTKEYBOARDINPUT", LBS_WANTKEYBOARDINPUT },
{ "LBS_NODATA", LBS_NODATA },
{ "LBS_USETABSTOPS", LBS_USETABSTOPS },
{ "TVS_CHECKBOXES", TVS_CHECKBOXES },
{ "TVS_DISABLEDRAGDROP", TVS_DISABLEDRAGDROP },
{ "TVS_EDITLABELS", TVS_EDITLABELS },
{ "TVS_FULLROWSELECT", TVS_FULLROWSELECT },
{ "TVS_HASBUTTONS", TVS_HASBUTTONS },
{ "TVS_HASLINES", TVS_HASLINES },
{ "TVS_INFOTIP", TVS_INFOTIP },
{ "TVS_LINESATROOT", TVS_LINESATROOT },
{ "TVS_NOHSCROLL", TVS_NOHSCROLL },
{ "TVS_NONEVENHEIGHT", TVS_NONEVENHEIGHT },
{ "TVS_SINGLEEXPAND", TVS_SINGLEEXPAND },
{ "TVS_SHOWSELALWAYS", TVS_SHOWSELALWAYS },
{ "TVS_NOSCROLL", TVS_NOSCROLL },
{ "TVS_RTLREADING", TVS_RTLREADING },
{ "TVS_NOTOOLTIPS", TVS_NOTOOLTIPS },
{ "TVS_TRACKSELECT", TVS_TRACKSELECT },
{ "TVS_EX_AUTOHSCROLL", TVS_EX_AUTOHSCROLL },
{ "TVS_EX_DOUBLEBUFFER", TVS_EX_DOUBLEBUFFER },
{ "TVS_EX_DRAWIMAGEASYNC", TVS_EX_DRAWIMAGEASYNC },
{ "TVS_EX_DIMMEDCHECKBOXES", TVS_EX_DIMMEDCHECKBOXES },
{ "TVS_EX_EXCLUSIONCHECKBOXES", TVS_EX_EXCLUSIONCHECKBOXES },
{ "TVS_EX_FADEINOUTEXPANDOS", TVS_EX_FADEINOUTEXPANDOS },
{ "TVS_EX_MULTISELECT", TVS_EX_MULTISELECT },
{ "TVS_EX_RICHTOOLTIP", TVS_EX_RICHTOOLTIP },
{ "TVS_EX_NOSINGLECOLLAPSE", TVS_EX_NOSINGLECOLLAPSE },
{ "TVS_EX_NOINDENTSTATE", TVS_EX_NOINDENTSTATE },
{ "TVS_EX_PARTIALCHECKBOXES", TVS_EX_PARTIALCHECKBOXES },
{ "CBS_AUTOHSCROLL", CBS_AUTOHSCROLL },
{ "CBS_DISABLENOSCROLL", CBS_DISABLENOSCROLL },
{ "CBS_DROPDOWN", CBS_DROPDOWN },
{ "CBS_DROPDOWNLIST", CBS_DROPDOWNLIST },
{ "CBS_HASSTRINGS", CBS_HASSTRINGS },
{ "CBS_LOWERCASE", CBS_LOWERCASE },
{ "CBS_NOINTEGRALHEIGHT", CBS_NOINTEGRALHEIGHT },
{ "CBS_OEMCONVERT", CBS_OEMCONVERT },
{ "CBS_OWNERDRAWFIXED", CBS_OWNERDRAWFIXED },
{ "CBS_OWNERDRAWVARIABLE", CBS_OWNERDRAWVARIABLE },
{ "CBS_SIMPLE", CBS_SIMPLE },
{ "CBS_SORT", CBS_SORT },
{ "CBS_UPPERCASE", CBS_UPPERCASE },
{ "SBS_BOTTOMALIGN", SBS_BOTTOMALIGN },
{ "SBS_HORZ", SBS_HORZ },
{ "SBS_LEFTALIGN", SBS_LEFTALIGN },
{ "SBS_RIGHTALIGN", SBS_RIGHTALIGN },
{ "SBS_SIZEBOX", SBS_SIZEBOX },
{ "SBS_SIZEBOXBOTTOMRIGHTALIGN", SBS_SIZEBOXBOTTOMRIGHTALIGN },
{ "SBS_SIZEBOXTOPLEFTALIGN", SBS_SIZEBOXTOPLEFTALIGN },
{ "SBS_SIZEGRIP", SBS_SIZEGRIP },
{ "SBS_TOPALIGN", SBS_TOPALIGN },
{ "SBS_VERT", SBS_VERT },
{ "PBS_SMOOTH", PBS_SMOOTH },
{ "PBS_SMOOTHREVERSE", PBS_SMOOTHREVERSE },
{ "PBS_VERTICAL", PBS_VERTICAL },
{ "PBS_MARQUEE", PBS_MARQUEE }
};
DWORD WINAPI jGetStyleFromString(const string& str, lpuint32_t _styles = NULL)
{
if (!str.length())
return 0;
DWORD dwRes = 0;
// hex
if (size_t pos = str.find_first_of("0x"); pos == 0)
{
string shex = str.substr(2);
dwRes = (DWORD)strtoull(shex.c_str(), NULL, 16);
goto style_return_label;
}
CHAR szBuf[64] = { 0 };
strcpy_s(szBuf, str.c_str());
_strupr_s(szBuf);
if (auto it = mapControlStyle.find(szBuf); it != mapControlStyle.end())
{
dwRes = (DWORD)it->second;
goto style_return_label;
}
// decimal
dwRes = (DWORD)strtoull(str.c_str(), NULL, 10);
style_return_label:
if (dwRes && _styles)
return ((*_styles & dwRes) == dwRes) ? 0 : dwRes;
return dwRes;
}
/*
Each DLGITEMTEMPLATEEX structure must be aligned on a DWORD boundary.
The variable-length windowClass and title arrays must be aligned on WORD boundaries.
The creation data array, if any, must be aligned on a WORD boundary.
*/
template<typename T>
T WINAPI jAlign(T lpIn, int32_t n)
{
uint64_t ul = (uint64_t)lpIn;
ul += n - 1;
ul &= -n;
return (T)ul;
}
class jMemoryManager
{
private:
static uint32_t roundUp(uint32_t numToRound, uint32_t multiple)
{
if (multiple == 0)
return numToRound;
uint32_t remainder = numToRound % multiple;
if (remainder == 0)
return numToRound;
return numToRound + multiple - remainder;
}
public:
static LPVOID Alloc(uint32_t _size) {
return calloc(1, (uint32_t)roundUp(_size, 4));
}
static LPVOID Realloc(LPVOID & _ptr, uint32_t _size) {
_ptr = _recalloc(_ptr, 1, (uint32_t)roundUp(_size, 4));
return _ptr;
}
static void Free(LPVOID _ptr) {
free(_ptr);
}
};
void WINAPI jGetDialogUnitsA(const string& _face, uint32_t _fsize, BOOL _italic, uint16_t _weight, uint16_t& x, uint16_t& y)
{
if (_face.empty() || !_face.length())
{
def_uints:
LONG l = GetDialogBaseUnits();
x = LOWORD(l);
y = HIWORD(l);
}
else
{
HDC hDC = GetDC(GetDesktopWindow());
HFONT hFont = CreateFontA(
-MulDiv(_fsize, GetDeviceCaps(hDC, LOGPIXELSY), 72),
0, 0, 0, _weight, _italic, 0, 0, DEFAULT_CHARSET,
0, 0, CLEARTYPE_QUALITY, DEFAULT_PITCH,
_face.c_str());
if (!hFont)
{
ReleaseDC(GetDesktopWindow(), hDC);
goto def_uints;
}
HFONT hOldFont = (HFONT)SelectObject(hDC, (HGDIOBJ)hFont);
SIZE s;
if (!GetTextExtentPoint32A(hDC, "A", 1, &s))
{
SelectObject(hDC, (HGDIOBJ)hOldFont);
DeleteObject((HGDIOBJ)hFont);
ReleaseDC(GetDesktopWindow(), hDC);
goto def_uints;
}
x = jAlign(s.cx, 2) >> 1;
y = jAlign(s.cy, 2) >> 1;
SelectObject(hDC, (HGDIOBJ)hOldFont);
DeleteObject((HGDIOBJ)hFont);
ReleaseDC(GetDesktopWindow(), hDC);
}
}
void WINAPI jGetDialogUnitsW(const wstring& _face, uint32_t _fsize, BOOL _italic, uint16_t _weight, uint16_t& x, uint16_t& y)
{
if (_face.empty() || !_face.length())
{
def_uints:
LONG l = GetDialogBaseUnits();
x = LOWORD(l);
y = HIWORD(l);
}
else
{
HDC hDC = GetDC(GetDesktopWindow());
HFONT hFont = CreateFontW(
-MulDiv(_fsize, GetDeviceCaps(hDC, LOGPIXELSY), 72),
0, 0, 0, _weight, _italic, 0, 0, DEFAULT_CHARSET,
0, 0, CLEARTYPE_QUALITY, DEFAULT_PITCH,
_face.c_str());
if (!hFont)
{
ReleaseDC(GetDesktopWindow(), hDC);
goto def_uints;
}
HFONT hOldFont = (HFONT)SelectObject(hDC, (HGDIOBJ)hFont);
SIZE s;
if (!GetTextExtentPoint32W(hDC, L"A", 1, &s))
{
SelectObject(hDC, (HGDIOBJ)hOldFont);
DeleteObject((HGDIOBJ)hFont);
ReleaseDC(GetDesktopWindow(), hDC);
goto def_uints;
}
x = jAlign(s.cx, 2) >> 1;
y = jAlign(s.cy, 2) >> 1;
SelectObject(hDC, (HGDIOBJ)hOldFont);
DeleteObject((HGDIOBJ)hFont);
ReleaseDC(GetDesktopWindow(), hDC);
}
}
typedef struct DLGTEMPLATEEX
{
uint16_t dlgVer;
uint16_t signature;
uint32_t helpID;
uint32_t exStyle;
uint32_t style;
uint16_t cDlgItems;
int16_t x;
int16_t y;
int16_t cx;
int16_t cy;
} *LPDLGTEMPLATEEX;
typedef struct DLGITEMTEMPLATEEX {
uint32_t helpID;
uint32_t exStyle;
uint32_t style;
int16_t x;
int16_t y;
int16_t cx;
int16_t cy;
uint32_t id;
} *LPDLGITEMTEMPLATEEX;
typedef struct DLGUINTS
{
uint16_t x;
uint16_t y;
} *LPDLGUINTS;
void WINAPI jAppendStringQuoteA(lpuint16_t& lpAddr, const string& _text)
{
LPWSTR lpwsz = (LPWSTR)lpAddr;
if (_text.length())
{
int32_t nSize = MultiByteToWideChar(CP_ACP, 0, _text.c_str(), -1, NULL, 0);
if (nSize)
{
MultiByteToWideChar(CP_ACP, 0, _text.c_str(), -1, lpwsz, nSize);
lpAddr = (lpuint16_t)(lpwsz + nSize);
}
else
goto empty_add_str;
}
else
{
empty_add_str:
*lpwsz = '\0';
lpAddr = (lpuint16_t)++lpwsz;
}
}
void WINAPI jAppendStringQuoteW(lpuint16_t& lpAddr, const wstring& _text)
{
LPWSTR lpwsz = (LPWSTR)lpAddr;
if (_text.length())
{
wcscpy(lpwsz, _text.c_str());
lpAddr = (lpuint16_t)(lpwsz + _text.length() + 1);
}
else
{
*lpwsz = '\0';
lpAddr = (lpuint16_t)++lpwsz;
}
}
uint32_t WINAPI jGetMemSizeForDialogTemplateA(const string& _title, const string& _classname, const string& _face, const jControls* _cntrs)
{
uint32_t u32res = 40 + JDialogStrLengthByteA(_title) + JDialogStrLengthByteA(_classname) + JDialogStrLengthByteA(_face);
CHAR szBuf[256];
jCustomControlA* control;
for each (auto cntr in *_cntrs)
{
u32res = jAlign(u32res, 4);
control = (jCustomControlA*)cntr;
uint32_t title_len = JDialogStrLengthByteA(control->Title);
uint32_t class_len = JDialogStrLengthByteA(control->Class);
strcpy(szBuf, control->Class.c_str());
_strupr_s(szBuf);
if (mapSysClassA.find(szBuf) != mapSysClassA.end())
u32res += 32 + title_len;
else
u32res += 30 + title_len + class_len;
}
return u32res;
}
uint32_t WINAPI jGetMemSizeForDialogTemplateW(const wstring& _title, const wstring& _classname, const wstring& _face, const jControls* _cntrs)
{
uint32_t u32res = 40 + JDialogStrLengthByteW(_title) + JDialogStrLengthByteW(_classname) + JDialogStrLengthByteW(_face);
WCHAR szBuf[256];
jCustomControlW* control;
for each (auto cntr in *_cntrs)
{
u32res = jAlign(u32res, 4);
control = (jCustomControlW*)cntr;
uint32_t title_len = JDialogStrLengthByteW(control->Title);
uint32_t class_len = JDialogStrLengthByteW(control->Class);
wcscpy(szBuf, control->Class.c_str());
_wcsupr_s(szBuf);
if (mapSysClassW.find(szBuf) != mapSysClassW.end())
u32res += 32 + title_len;
else
u32res += 30 + title_len + class_len;
}
return u32res;
}
void WINAPI jInitDialogTemplateA(DLGTEMPLATEEX& _template, DLGUINTS& _units, uint32_t _ex_style, const string& _title, const string& _classname,
const string& _face, uint16_t _fsize, BOOL _italic, uint16_t _weight, uint32_t _style, int32_t x, int32_t y, int32_t cx, int32_t cy, const jControls* _cntrs)
{
_template.dlgVer = 1;
_template.signature = JDialogChunkResource;
_template.helpID = 0;
_template.exStyle = _ex_style | EXSTYLE_DEFAULT;
_template.style = _style | STYLE_DEFAULT;
_template.cDlgItems = _cntrs->size();
// position and size window (convert to dialog units)
jGetDialogUnitsA(_face, _fsize, _italic, _weight, _units.x, _units.y);
#ifndef JDIALOG_4x4_DIALOG_UINT_SET
_template.x = (int16_t)MulDiv(x, 4, _units.x);
_template.y = (int16_t)MulDiv(y, 8, _units.y);
_template.cx = (int16_t)MulDiv(cx, 4, _units.x);
_template.cy = (int16_t)MulDiv(cy, 8, _units.y);
#else
_template.x = (int16_t)MulDiv(x, 4, _units.x);
_template.y = (int16_t)MulDiv(y, 4, _units.y);
_template.cx = (int16_t)MulDiv(cx, 4, _units.x);
_template.cy = (int16_t)MulDiv(cy, 4, _units.y);
#endif
lpuint16_t lpw = (lpuint16_t)(((lpuint8_t)&_template) + 26);
// no support menu
*lpw++ = 0;
// classname
jAppendStringQuoteA(lpw, _classname);
// title
jAppendStringQuoteA(lpw, _title);
// font size
*lpw++ = _fsize;
// font weight
*lpw++ = _weight;
lpuint8_t lpb = (lpuint8_t)lpw;
// font italic
*lpb++ = (int8_t)_italic;
// font charset (set default)
*lpb++ = (int8_t)DEFAULT_CHARSET;
lpw = (lpuint16_t)lpb;
// font name
jAppendStringQuoteA(lpw, _face);
CHAR szBuf[256];
jCustomControlA* control;
LPDLGITEMTEMPLATEEX _itemtemplate;
for each (auto cntr in *_cntrs)
{
lpw = jAlign(lpw, 4);
control = (jCustomControlA*)cntr;
_itemtemplate = (LPDLGITEMTEMPLATEEX)lpw;
_itemtemplate->helpID = 0;
_itemtemplate->exStyle = control->ExStyle;
_itemtemplate->style = control->Style | WS_CHILD;
#ifndef JDIALOG_4x4_DIALOG_UINT_SET
_itemtemplate->x = (int16_t)MulDiv(control->X, 4, _units.x);
_itemtemplate->y = (int16_t)MulDiv(control->Y, 8, _units.y);
_itemtemplate->cx = (int16_t)MulDiv(control->Width, 4, _units.x);
_itemtemplate->cy = (int16_t)MulDiv(control->Height, 8, _units.y);
#else
_itemtemplate->x = (int16_t)MulDiv(control->X, 4, _units.x);
_itemtemplate->y = (int16_t)MulDiv(control->Y, 4, _units.y);
_itemtemplate->cx = (int16_t)MulDiv(control->Width, 4, _units.x);
_itemtemplate->cy = (int16_t)MulDiv(control->Height, 4, _units.y);
#endif
_itemtemplate->id = (JDialogIncorrectCheckUId(control->UserId) ? JDialogInvalidUId : control->UserId);
lpw += 12;
// classname
strcpy(szBuf, control->Class.c_str());
_strupr_s(szBuf);
auto it = mapSysClassA.find(szBuf);
if (it == mapSysClassA.end())
jAppendStringQuoteA(lpw, control->Class);
else
{
*lpw++ = JDialogChunkResource;
*lpw++ = it->second;
}
// title
if ((it != mapSysClassA.end()) && (it->second == 0x0082) &&
(((_itemtemplate->style & SS_BITMAP) == SS_BITMAP) || ((_itemtemplate->style & SS_ICON) == SS_ICON)))
{
*lpw++ = JDialogChunkResource;
*lpw++ = strtoul(control->Title.c_str(), NULL, 10);
}
else
jAppendStringQuoteA(lpw, control->Title);
*lpw++ = 0;
}
}
void WINAPI jInitDialogTemplateW(DLGTEMPLATEEX& _template, DLGUINTS& _units, uint32_t _ex_style, const wstring& _title, const wstring& _classname,
const wstring& _face, uint16_t _fsize, BOOL _italic, uint16_t _weight, uint32_t _style, int32_t x, int32_t y, int32_t cx, int32_t cy, const jControls* _cntrs)
{
_template.dlgVer = 1;
_template.signature = JDialogChunkResource;
_template.helpID = 0;
_template.exStyle = _ex_style | EXSTYLE_DEFAULT;
_template.style = _style | STYLE_DEFAULT;
_template.cDlgItems = _cntrs->size();
// position and size window (convert to dialog units)
jGetDialogUnitsW(_face, _fsize, _italic, _weight, _units.x, _units.y);
#ifndef JDIALOG_4x4_DIALOG_UINT_SET
_template.x = (int16_t)MulDiv(x, 4, _units.x);
_template.y = (int16_t)MulDiv(y, 8, _units.y);
_template.cx = (int16_t)MulDiv(cx, 4, _units.x);
_template.cy = (int16_t)MulDiv(cy, 8, _units.y);
#else
_template.x = (int16_t)MulDiv(x, 4, _units.x);
_template.y = (int16_t)MulDiv(y, 4, _units.y);
_template.cx = (int16_t)MulDiv(cx, 4, _units.x);
_template.cy = (int16_t)MulDiv(cy, 4, _units.y);
#endif
lpuint16_t lpw = (lpuint16_t)(((lpuint8_t)&_template) + 26);
// no support menu
*lpw++ = 0;
// classname
jAppendStringQuoteW(lpw, _classname);
// title
jAppendStringQuoteW(lpw, _title);
// font size
*lpw++ = _fsize;
// font weight
*lpw++ = _weight;
lpuint8_t lpb = (lpuint8_t)lpw;
// font italic
*lpb++ = (int8_t)_italic;
// font charset (set default)
*lpb++ = (int8_t)DEFAULT_CHARSET;
lpw = (lpuint16_t)lpb;
// font name
jAppendStringQuoteW(lpw, _face);
WCHAR szBuf[256];
jCustomControlW* control;
LPDLGITEMTEMPLATEEX _itemtemplate;
for each (auto cntr in *_cntrs)
{
lpw = jAlign(lpw, 4);
control = (jCustomControlW*)cntr;
_itemtemplate = (LPDLGITEMTEMPLATEEX)lpw;
_itemtemplate->helpID = 0;
_itemtemplate->exStyle = control->ExStyle;
_itemtemplate->style = control->Style | WS_CHILD;
#ifndef JDIALOG_4x4_DIALOG_UINT_SET
_itemtemplate->x = (int16_t)MulDiv(control->X, 4, _units.x);
_itemtemplate->y = (int16_t)MulDiv(control->Y, 8, _units.y);
_itemtemplate->cx = (int16_t)MulDiv(control->Width, 4, _units.x);
_itemtemplate->cy = (int16_t)MulDiv(control->Height, 8, _units.y);
#else
_itemtemplate->x = (int16_t)MulDiv(control->X, 4, _units.x);
_itemtemplate->y = (int16_t)MulDiv(control->Y, 4, _units.y);
_itemtemplate->cx = (int16_t)MulDiv(control->Width, 4, _units.x);
_itemtemplate->cy = (int16_t)MulDiv(control->Height, 4, _units.y);
#endif
_itemtemplate->id = (JDialogIncorrectCheckUId(control->UserId) ? JDialogInvalidUId : control->UserId);
lpw += 12;
// classname
wcscpy(szBuf, control->Class.c_str());
_wcsupr_s(szBuf);
auto it = mapSysClassW.find(szBuf);
if (it == mapSysClassW.end())
jAppendStringQuoteW(lpw, control->Class);
else
{
*lpw++ = JDialogChunkResource;
*lpw++ = it->second;
}
// title
if ((it != mapSysClassW.end()) && (it->second == 0x0082) &&
(((_itemtemplate->style & SS_BITMAP) == SS_BITMAP) || ((_itemtemplate->style & SS_ICON) == SS_ICON)))
{
*lpw++ = JDialogChunkResource;
*lpw++ = wcstoul(control->Title.c_str(), NULL, 10);
}
else
jAppendStringQuoteW(lpw, control->Title);
*lpw++ = 0;
}
}
template<typename T>
void WINAPI jGetValueFromJSON(json* _j, T& _v, const string& _fieldname, const T _defv)
{
if (_j->contains(_fieldname))
_j->at(_fieldname).get_to(_v);
else
_v = _defv;
}
template<typename T>
void WINAPI jGetStyleFromJSON(json* _j, T& _v, const string& _fieldname, const T _defv)
{
if (_j->contains(_fieldname))
{
_v = 0;
auto j_array = _j->at(_fieldname);
if (!j_array.is_array())
{
j_array.get_to(_v);
return;
}
_v |= _defv;
for (auto& element : j_array)
{
if (element.is_string())
{
string str;
element.get_to(str);
if (!str.find("NOT ") || !str.find("not "))
_v &= ~jGetStyleFromString(str.substr(4));
else
_v |= jGetStyleFromString(str, &_v);
}
else if(element.is_number_integer())
{
int32_t integer;
_v |= element.get_to(integer);
}
else if (element.is_number_unsigned())
{
uint32_t _unsigned;
_v |= element.get_to(_unsigned);
}
}
}
else
_v = _defv;
}
wstring WINAPI jUtf8ToWide(const string& _t)
{
int32_t nSize = MultiByteToWideChar(CP_UTF8, 0, _t.c_str(), -1, NULL, 0);
if (nSize > 0)
{
WCHAR* szBuf = new WCHAR[nSize + 1];
MultiByteToWideChar(CP_UTF8, 0, _t.c_str(), -1, szBuf, nSize);
szBuf[nSize] = L'\0';
wstring ws = szBuf;
delete[] szBuf;
return ws;
}
return L"";
}
#ifndef JDIALOG_NO_FUNCTIONS_CREATE_CONTROLS
//////////////////////////////////////
//
// creates function
//
//////////////////////////////////////
bool WINAPI CreateControlA(uint32_t _ex_style, const string& _title, const string& _classname, uint32_t _style,
int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
if (!_dialog)
return false;
jCustomControlA* control = new jCustomControlA(_dialog);
if (!control)
return false;
control->ExStyle = _ex_style;
control->Title = _title;
control->Class = _classname;
control->Style = _style;
control->X = _x;
control->Y = _y;
control->Width = _cx;
control->Height = _cy;
control->UserId = _uid;
bool bRes = _dialog->AppendControl(control);
if (!bRes)
delete control;
return bRes;
}
bool WINAPI CreateControlW(uint32_t _ex_style, const wstring& _title, const wstring& _classname, uint32_t _style,
int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
if (!_dialog)
return false;
jCustomControlW* control = new jCustomControlW(_dialog);
if (!control)
return false;
control->ExStyle = _ex_style;
control->Title = _title;
control->Class = _classname;
control->Style = _style;
control->X = _x;
control->Y = _y;
control->Width = _cx;
control->Height = _cy;
control->UserId = _uid;
bool bRes = _dialog->AppendControl(control);
if (!bRes)
delete control;
return bRes;
}
bool WINAPI CreateTextA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA(_title, "STATIC");
}
bool WINAPI CreateTextW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(_title, L"STATIC");
}
bool WINAPI CreateLTextA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return CreateTextA(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateLTextW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return CreateTextW(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateCTextA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return CreateTextA(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateCTextW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return CreateTextW(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateRTextA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return CreateTextA(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateRTextW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return CreateTextW(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateEditTextA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA(_title, "EDIT");
}
bool WINAPI CreateEditTextW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(_title, L"EDIT");
}
bool WINAPI CreateDefPushButtonA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA(_title, "BUTTON");
}
bool WINAPI CreateDefPushButtonW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(_title, L"BUTTON");
}
bool WINAPI CreateListBoxA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "LISTBOX");
}
bool WINAPI CreateListBoxW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"LISTBOX");
}
bool WINAPI CreateComboBoxA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "COMBOBOX");
}
bool WINAPI CreateComboBoxW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"COMBOBOX");
}
bool WINAPI CreateAutoRadioButtonA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return CreateDefPushButtonA(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateAutoRadioButtonW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return CreateDefPushButtonW(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateAutoCheckButtonA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return CreateDefPushButtonA(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateAutoCheckButtonW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return CreateDefPushButtonW(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateGroupBoxA(uint32_t _ex_style, const string& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return CreateDefPushButtonA(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateGroupBoxW(uint32_t _ex_style, const wstring& _title,
uint32_t _style, int32_t _x, int32_t _y, int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return CreateDefPushButtonW(_ex_style, _title, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateListViewA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SysListView32");
}
bool WINAPI CreateListViewW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SysListView32");
}
bool WINAPI CreateTreeViewA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SysTreeView32");
}
bool WINAPI CreateTreeViewW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SysTreeView32");
}
bool WINAPI CreateTabViewA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SysTabControl32");
}
bool WINAPI CreateTabViewW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SysTabControl32");
}
bool WINAPI CreateBitmapA(uint32_t _ex_style, uint32_t _style, uint32_t _resource, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
CHAR szBuf[64] = { 0 };
return CreateTextA(_ex_style, ultoa(_resource, szBuf, 10), _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateBitmapW(uint32_t _ex_style, uint32_t _style, uint32_t _resource, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
WCHAR szBuf[64] = { 0 };
return CreateTextW(_ex_style, _ultow(_resource, szBuf, 10), _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateIconA(uint32_t _ex_style, uint32_t _style, uint32_t _resource, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
CHAR szBuf[64] = { 0 };
return CreateTextA(_ex_style, ultoa(_resource, szBuf, 10), _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateIconW(uint32_t _ex_style, uint32_t _style, uint32_t _resource, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
WCHAR szBuf[64] = { 0 };
return CreateTextW(_ex_style, _ultow(_resource, szBuf, 10), _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateBitmapExA(uint32_t _ex_style, uint32_t _style, uint32_t _resource, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return CreateBitmapA(_ex_style, _resource, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateBitmapExW(uint32_t _ex_style, uint32_t _style, uint32_t _resource, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return CreateBitmapW(_ex_style, _resource, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateIconExA(uint32_t _ex_style, uint32_t _style, uint32_t _resource, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return CreateIconA(_ex_style, _resource, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateIconExW(uint32_t _ex_style, uint32_t _style, uint32_t _resource, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return CreateIconW(_ex_style, _resource, _style, _x, _y, _cx, _cy, _uid, _dialog);
}
bool WINAPI CreateScrollBarA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SCROLLBAR");
}
bool WINAPI CreateScrollBarW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SCROLLBAR");
}
bool WINAPI CreateReBarA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "ReBarWindow32");
}
bool WINAPI CreateReBarW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"ReBarWindow32");
}
bool WINAPI CreateHotKeyA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "msctls_hotkey32");
}
bool WINAPI CreateHotKeyW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"msctls_hotkey32");
}
bool WINAPI CreateIPAdressA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SysIPAddress32");
}
bool WINAPI CreateIPAdressW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SysIPAddress32");
}
bool WINAPI CreateMonthCalA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SysMonthCal32");
}
bool WINAPI CreateMonthCalW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SysMonthCal32");
}
bool WINAPI CreateStatusBarA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "msctls_statusbar32");
}
bool WINAPI CreateStatusBarW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"msctls_statusbar32");
}
bool WINAPI CreateProgressBarA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "msctls_progress32");
}
bool WINAPI CreateProgressBarW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"msctls_progress32");
}
bool WINAPI CreateAnimateA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SysAnimate32");
}
bool WINAPI CreateAnimateW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SysAnimate32");
}
bool WINAPI CreateHeaderA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SysHeader32");
}
bool WINAPI CreateHeaderW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SysHeader32");
}
bool WINAPI CreateRichEditA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "RichEdit20A");
}
bool WINAPI CreateRichEditW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"RichEdit20W");
}
bool WINAPI CreateDateTimePickerA(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogA* _dialog)
{
return JDialogCreateCommControlA("", "SysDateTimePick32");
}
bool WINAPI CreateDateTimePickerW(uint32_t _ex_style, uint32_t _style, int32_t _x, int32_t _y,
int32_t _cx, int32_t _cy, uint32_t _uid, jDialogW* _dialog)
{
return JDialogCreateCommControlW(L"", L"SysDateTimePick32");
}
#endif // !JDIALOG_NO_FUNCTIONS_CREATE_CONTROLS
//////////////////////////////////////
//
// class jComponent
//
//////////////////////////////////////
jComponent::jComponent(void) : m_ex_style(0), m_style(0), m_x(0), m_y(0), m_cx(0), m_cy(0)
{}
jComponent::jComponent(const jComponent& _component) : m_ex_style(_component.m_ex_style), m_style(_component.m_style),
m_x(_component.m_x), m_y(_component.m_y), m_cx(_component.m_cx), m_cy(_component.m_cy)
{}
jComponent::~jComponent(void)
{}
//////////////////////////////////////
//
// class jCustomControl
//
//////////////////////////////////////
void jCustomControl::doChanged(void)
{
if (m_lpDialog)
m_lpDialog->HappenUpdate();
}
jCustomDialog* jCustomControl::GetDialog(void) const
{
return m_lpDialog;
}
bool jCustomControl::_lowlevel_LoadFromJSONLayout(LPARAM lParam)
{
json* jData = (json*)lParam;
if (!jData->size())
return false;
string stype;
jGetValueFromJSON<string>(jData, stype, "Type", "CONTROL");
CHAR szBuf[64] = { 0 };
strcpy_s(szBuf, stype.c_str());
_strupr_s(szBuf);
if (auto it = mapStdControlType.find(szBuf); it != mapStdControlType.end())
{
jGetStyleFromJSON<uint32_t>(jData, m_style, "Style", it->second.style);
jGetStyleFromJSON<uint32_t>(jData, m_ex_style, "ExStyle", it->second.ex_style);
}
else
{
jGetStyleFromJSON<uint32_t>(jData, m_style, "Style", JDialogDefaultControlStyle);
jGetStyleFromJSON<uint32_t>(jData, m_ex_style, "ExStyle", 0);
}
jGetValueFromJSON<int32_t>(jData, m_x, "x", 0);
jGetValueFromJSON<int32_t>(jData, m_y, "y", 0);
jGetValueFromJSON<int32_t>(jData, m_cx, "Width", 100);
jGetValueFromJSON<int32_t>(jData, m_cy, "Height", 100);
jGetValueFromJSON<uint32_t>(jData, m_uid, "Id", JDialogInvalidUId);
if (JDialogIncorrectCheckUId(m_uid))
m_uid = JDialogInvalidUId;
return true;
}
jCustomControl::jCustomControl(jCustomDialog* _dialog) : m_lpDialog(_dialog)
{}
jCustomControl::jCustomControl(const jCustomControl& _control) : m_lpDialog(_control.m_lpDialog)
{}
//////////////////////////////////////
//
// class jCustomControlA
//
//////////////////////////////////////
bool jCustomControlA::ParseJSONObject(const LPVOID _data)
{
if (!_lowlevel_LoadFromJSONLayout((LPARAM)_data))
return false;
json* jData = (json*)_data;
jGetValueFromJSON<string>(jData, m_title, "Title", "");
string stype;
jGetValueFromJSON<string>(jData, stype, "Type", "CONTROL");
CHAR szBuf[64] = { 0 };
strcpy_s(szBuf, stype.c_str());
_strupr_s(szBuf);
if (auto it = mapStdControlType2A.find(szBuf); it != mapStdControlType2A.end())
m_classname = it->second;
else
jGetValueFromJSON<string>(jData, m_classname, "ClassName", "");
return true;
}
jCustomControlA::jCustomControlA(jCustomDialog* _dialog) : jCustomControl(_dialog)
{}
jCustomControlA::jCustomControlA(const jCustomControlA& _control) : jCustomControl(_control)
{}
//////////////////////////////////////
//
// class jCustomControlW
//
//////////////////////////////////////
bool jCustomControlW::ParseJSONObject(const LPVOID _data)
{
if (!_lowlevel_LoadFromJSONLayout((LPARAM)_data))
return false;
json* jData = (json*)_data;
string tmp;
jGetValueFromJSON<string>(jData, tmp, "Title", "");
m_title = jUtf8ToWide(tmp);
string stype;
jGetValueFromJSON<string>(jData, stype, "Type", "CONTROL");
CHAR szBuf[64] = { 0 };
strcpy_s(szBuf, stype.c_str());
_strupr_s(szBuf);
if (auto it = mapStdControlType2W.find(szBuf); it != mapStdControlType2W.end())
m_classname = it->second;
else
{
jGetValueFromJSON<string>(jData, tmp, "ClassName", "");
m_classname = jUtf8ToWide(tmp);
}
return true;
}
jCustomControlW::jCustomControlW(jCustomDialog* _dialog) : jCustomControl(_dialog)
{}
jCustomControlW::jCustomControlW(const jCustomControlW& _control) : jCustomControl(_control)
{}
//////////////////////////////////////
//
// class jCustomDialog
//
//////////////////////////////////////
bool jCustomDialog::GenerateBinary(void)
{
if (!IsNeedGenerate())
return false;
Release();
m_NeedGenerate = !DoGenerateBinary();
return !m_NeedGenerate;
}
bool jCustomDialog::AppendControl(jCustomControl* _control)
{
if (!_control)
return false;
m_items.push_back(_control);
doChanged();
return true;
}
void jCustomDialog::Release(void)
{
if (m_lpData)
{
jMemoryManager::Free(m_lpData);
m_lpData = NULL;
m_nSize = 0;
m_NeedGenerate = true;
}
}
bool jCustomDialog::SaveToFile(const string& _fname)
{
if (IsNeedGenerate() && !GenerateBinary())
return false;
ofstream ofs(_fname, ios::binary | ios::out);
ofs.write((LPSTR)m_lpData, m_nSize);
ofs.close();
return true;
}
bool jCustomDialog::_lowlevel_LoadFromJSONLayout(LPARAM lParam)
{
json* jData = (json*)lParam;
if (!jData->size())
return false;
jGetStyleFromJSON<uint32_t>(jData, m_ex_style, "ExStyle", 0);
jGetStyleFromJSON<uint32_t>(jData, m_style, "Style", 0);
jGetValueFromJSON<uint16_t>(jData, m_fsize, "FontSize", 8);
jGetValueFromJSON<uint16_t>(jData, m_weight, "FontWeight", FW_NORMAL);
jGetValueFromJSON<int32_t>(jData, m_x, "x", 0);
jGetValueFromJSON<int32_t>(jData, m_y, "y", 0);
jGetValueFromJSON<int32_t>(jData, m_cx, "Width", 100);
jGetValueFromJSON<int32_t>(jData, m_cy, "Height", 100);
uint8_t n8temp = 0;
jGetValueFromJSON<uint8_t>(jData, n8temp, "FontItalic", false);
m_italic = n8temp > 0;
return true;
}
jCustomDialog::jCustomDialog(void) : jComponent(), m_fsize(0), m_italic(false),
m_weight(FW_NORMAL), m_NeedGenerate(true), m_lpData(NULL), m_nSize(0)
{
//#ifndef JDIALOG_NO_MANIFEST_LINKER_COMMCTRL
if (!g_comm_init)
{
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(INITCOMMONCONTROLSEX);
InitCtrls.dwICC = ICC_LISTVIEW_CLASSES | ICC_TREEVIEW_CLASSES | ICC_BAR_CLASSES | ICC_TAB_CLASSES |
ICC_UPDOWN_CLASS | ICC_PROGRESS_CLASS | ICC_HOTKEY_CLASS | ICC_ANIMATE_CLASS | ICC_DATE_CLASSES |
ICC_USEREX_CLASSES | ICC_COOL_CLASSES | ICC_PAGESCROLLER_CLASS | ICC_NATIVEFNTCTL_CLASS |
ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES | ICC_LINK_CLASS;
g_comm_init = InitCommonControlsEx(&InitCtrls);
}
//#endif // !JDIALOG_NO_MANIFEST_LINKER_COMMCTRL
}
jCustomDialog::jCustomDialog(const jCustomDialog& _dialog) : jComponent(_dialog), m_fsize(_dialog.m_fsize),
m_italic(_dialog.m_italic), m_weight(_dialog.m_weight), m_NeedGenerate(true), m_lpData(NULL), m_nSize(0)
{}
jCustomDialog::~jCustomDialog(void)
{
Release();
}
//////////////////////////////////////
//
// class jDialogA
//
//////////////////////////////////////
bool jDialogA::LoadFromJSONLayout(LPARAM lParam)
{
if (!_lowlevel_LoadFromJSONLayout(lParam))
return false;
json* jData = (json*)lParam;
jGetValueFromJSON<string>(jData, m_title, "Title", "Dialog");
jGetValueFromJSON<string>(jData, m_classname, "ClassName", "");
jGetValueFromJSON<string>(jData, m_face, "FontName", "MS Sans Serif");
if (jData->contains("Controls"))
{
auto j_array = jData->at("Controls");
if (j_array.is_array())
{
for (auto& elem : j_array)
{
jCustomControlA* control = new jCustomControlA(this);
if (!control)
return false;
control->ParseJSONObject(&elem);
bool bRes = AppendControl(control);
if (!bRes)
{
delete control;
return false;
}
}
}
}
return true;
}
HWND jDialogA::Show(HWND _parent, DLGPROC _dlgproc, LPARAM _initparam, HINSTANCE hInst)
{
if (IsNeedGenerate() && !GenerateBinary())
return NULL;
return CreateDialogIndirectParamA(hInst, (LPCDLGTEMPLATEA)m_lpData, _parent, _dlgproc, _initparam);
}
INT_PTR jDialogA::ShowModal(HWND _parent, DLGPROC _dlgproc, LPARAM _initparam, HINSTANCE hInst)
{
if (IsNeedGenerate() && !GenerateBinary())
return S_FALSE;
return DialogBoxIndirectParamA(hInst, (LPCDLGTEMPLATEA)m_lpData, _parent, _dlgproc, _initparam);
}
bool jDialogA::DoGenerateBinary(void)
{
uint32_t nSize = jGetMemSizeForDialogTemplateA(m_title, m_classname, m_face, &m_items);
LPVOID lpData = jMemoryManager::Alloc(nSize);
if (lpData)
{
DLGUINTS dlgUnits = { 0 };
jInitDialogTemplateA(*((LPDLGTEMPLATEEX)lpData), dlgUnits, m_ex_style, m_title, m_classname, m_face, m_fsize,
m_italic, m_weight, m_style, m_x, m_y, m_cx, m_cy, &m_items);
m_lpData = lpData;
m_nSize = nSize;
return true;
}
return false;
}
bool jDialogA::ParseJSON(const string& _data)
{
json j = json::parse(_data);
return LoadFromJSONLayout((LPARAM)&j);
}
bool jDialogA::LoadFromFile(const string& _fname)
{
if (fs::exists(_fname))
{
// read a JSON file
ifstream ios(_fname);
json j;
ios >> j;
ios.close();
return LoadFromJSONLayout((LPARAM)&j);
}
return false;
}
jDialogA jDialogA::FromFile(const string& _fname)
{
jDialogA dialog;
dialog.LoadFromFile(_fname);
return dialog;
}
jDialogA::jDialogA(void) : jCustomDialog(), m_title("Dialog"), m_classname(""), m_face("MS Sans Serif")
{}
jDialogA::jDialogA(const string& _json) : jDialogA()
{
ParseJSON(_json);
}
jDialogA::jDialogA(const jDialogA& _dialog) : jCustomDialog(_dialog), m_title(_dialog.m_title),
m_classname(_dialog.m_classname), m_face(_dialog.m_face)
{
jCustomControlA* dublicate;
for each (auto component in _dialog.m_items)
{
dublicate = new jCustomControlA(*(jCustomControlA*)component);
if (dublicate)
m_items.push_back(dublicate);
}
}
jDialogA::~jDialogA(void)
{
for each (auto component in m_items)
delete (jCustomControlA*)component;
m_items.clear();
}
//////////////////////////////////////
//
// class jDialogW
//
//////////////////////////////////////
bool jDialogW::LoadFromJSONLayout(LPARAM lParam)
{
if (!_lowlevel_LoadFromJSONLayout(lParam))
return false;
json* jData = (json*)lParam;
string tmp;
jGetValueFromJSON<string>(jData, tmp, "Title", "Dialog");
m_title = jUtf8ToWide(tmp);
jGetValueFromJSON<string>(jData, tmp, "ClassName", "");
m_classname = jUtf8ToWide(tmp);
jGetValueFromJSON<string>(jData, tmp, "FontName", "MS Sans Serif");
m_face = jUtf8ToWide(tmp);
if (jData->contains("Controls"))
{
auto j_array = jData->at("Controls");
if (j_array.is_array())
{
for (auto& elem : j_array)
{
jCustomControlW* control = new jCustomControlW(this);
if (!control)
return false;
control->ParseJSONObject(&elem);
bool bRes = AppendControl(control);
if (!bRes)
{
delete control;
return false;
}
}
}
}
return true;
}
HWND jDialogW::Show(HWND _parent, DLGPROC _dlgproc, LPARAM _initparam, HINSTANCE hInst)
{
if (IsNeedGenerate() && !GenerateBinary())
return NULL;
return CreateDialogIndirectParamW(hInst, (LPCDLGTEMPLATEW)m_lpData, _parent, _dlgproc, _initparam);
}
INT_PTR jDialogW::ShowModal(HWND _parent, DLGPROC _dlgproc, LPARAM _initparam, HINSTANCE hInst)
{
if (IsNeedGenerate() && !GenerateBinary())
return S_FALSE;
return DialogBoxIndirectParamW(hInst, (LPCDLGTEMPLATEW)m_lpData, _parent, _dlgproc, _initparam);
}
bool jDialogW::DoGenerateBinary(void)
{
uint32_t nSize = jGetMemSizeForDialogTemplateW(m_title, m_classname, m_face, &m_items);
LPVOID lpData = jMemoryManager::Alloc(nSize);
if (lpData)
{
DLGUINTS dlgUnits = { 0 };
jInitDialogTemplateW(*((LPDLGTEMPLATEEX)lpData), dlgUnits, m_ex_style, m_title, m_classname, m_face, m_fsize,
m_italic, m_weight, m_style, m_x, m_y, m_cx, m_cy, &m_items);
m_lpData = lpData;
m_nSize = nSize;
return true;
}
return false;
}
bool jDialogW::ParseJSON(const string& _data)
{
json j = json::parse(_data);
return LoadFromJSONLayout((LPARAM)&j);
}
bool jDialogW::LoadFromFile(const wstring& _fname)
{
if (fs::exists(_fname))
{
// read a JSON file
ifstream ios(_fname);
json j;
ios >> j;
ios.close();
return LoadFromJSONLayout((LPARAM)&j);
}
return false;
}
jDialogW jDialogW::FromFile(const wstring& _fname)
{
jDialogW dialog;
dialog.LoadFromFile(_fname);
return dialog;
}
jDialogW::jDialogW(void) : jCustomDialog(), m_title(L"Dialog"), m_classname(L""), m_face(L"MS Sans Serif")
{}
jDialogW::jDialogW(const string& _json) : jDialogW()
{
ParseJSON(_json);
}
jDialogW::jDialogW(const jDialogW& _dialog) : jCustomDialog(_dialog), m_title(_dialog.m_title),
m_classname(_dialog.m_classname), m_face(_dialog.m_face)
{
jCustomControlW* dublicate;
for each (auto component in _dialog.m_items)
{
dublicate = new jCustomControlW(*(jCustomControlW*)component);
if (dublicate)
m_items.push_back(dublicate);
}
}
jDialogW::~jDialogW(void)
{
for each (auto component in m_items)
delete (jCustomControlW*)component;
m_items.clear();
}
}
}
| 31.985264 | 198 | 0.679778 | Perchik71 |
284d3213bfddfe4c6fbadf8dc13a5d3bcd577721 | 8,405 | cpp | C++ | src/rastersymbolmanager.cpp | jusirkka/qutenav | 09024f4506f12bfecdfe39cd9155583d71233e66 | [
"ISC",
"X11",
"MIT"
] | 2 | 2021-07-09T14:13:55.000Z | 2022-02-11T06:41:03.000Z | src/rastersymbolmanager.cpp | jusirkka/qutenav | 09024f4506f12bfecdfe39cd9155583d71233e66 | [
"ISC",
"X11",
"MIT"
] | null | null | null | src/rastersymbolmanager.cpp | jusirkka/qutenav | 09024f4506f12bfecdfe39cd9155583d71233e66 | [
"ISC",
"X11",
"MIT"
] | 2 | 2022-02-11T06:41:05.000Z | 2022-03-17T09:29:46.000Z | /* -*- coding: utf-8-unix -*-
*
* File: src/rastersymbolmanager.cpp
*
* Copyright (C) 2021 Jukka Sirkka
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "rastersymbolmanager.h"
#include <QOpenGLTexture>
#include "s52presentation.h"
#include "s52names.h"
#include <QFile>
#include <QXmlStreamReader>
#include "logging.h"
#include "settings.h"
#include <QPainter>
#include <QOpenGLExtraFunctions>
RasterSymbolManager::RasterSymbolManager()
: QObject()
, m_invalid()
, m_coordBuffer(QOpenGLBuffer::VertexBuffer)
, m_indexBuffer(QOpenGLBuffer::IndexBuffer)
, m_symbolTexture(nullptr)
, m_symbolAtlas()
, m_pixmapCache(100 * sizeof(QPixmap))
{}
RasterSymbolManager* RasterSymbolManager::instance() {
static RasterSymbolManager* m = new RasterSymbolManager();
return m;
}
RasterSymbolManager::~RasterSymbolManager() {
delete m_symbolTexture;
}
SymbolData RasterSymbolManager::symbolData(quint32 index, S52::SymbolType type) const {
const SymbolKey key(index, type);
if (m_symbolMap.contains(key)) return m_symbolMap[key];
return m_invalid;
}
void RasterSymbolManager::bind() {
m_coordBuffer.bind();
m_indexBuffer.bind();
m_symbolTexture->bind();
}
void RasterSymbolManager::changeSymbolAtlas() {
auto rname = S52::GetRasterFileName();
if (rname == m_symbolAtlas) return;
m_symbolAtlas = rname;
if (m_symbolTexture != nullptr) {
// bare delete without destroying underlying resources first leads to a segfault in
// sfos/qt5.6. A bug?
qCDebug(CDPY) << "destroy texture";
m_symbolTexture->destroy();
qCDebug(CDPY) << "delete texture";
delete m_symbolTexture;
}
qCDebug(CDPY) << "new texture";
m_symbolTexture = new QOpenGLTexture(QImage(m_symbolAtlas), QOpenGLTexture::DontGenerateMipMaps);
m_symbolTexture->setWrapMode(QOpenGLTexture::ClampToEdge);
m_symbolTexture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear);
}
void RasterSymbolManager::createSymbols() {
changeSymbolAtlas();
QFile file(S52::FindPath("chartsymbols.xml"));
file.open(QFile::ReadOnly);
QXmlStreamReader reader(&file);
reader.readNextStartElement();
Q_ASSERT(reader.name() == "chartsymbols");
GL::VertexVector vertices;
GL::IndexVector indices;
// Note: there exists no raster line styles
while (reader.readNextStartElement()) {
if (reader.name() == "patterns") {
parseSymbols(reader, vertices, indices, S52::SymbolType::Pattern);
} else if (reader.name() == "symbols") {
parseSymbols(reader, vertices, indices, S52::SymbolType::Single);
} else {
reader.skipCurrentElement();
}
}
file.close();
// fill in vertex buffer
m_coordBuffer.create();
m_coordBuffer.bind();
m_coordBuffer.setUsagePattern(QOpenGLBuffer::StaticDraw);
m_coordBuffer.allocate(vertices.constData(), sizeof(GLfloat) * vertices.size());
// fill in index buffer
m_indexBuffer.create();
m_indexBuffer.bind();
m_indexBuffer.setUsagePattern(QOpenGLBuffer::StaticDraw);
m_indexBuffer.allocate(indices.constData(), sizeof(GLuint) * indices.size());
}
void RasterSymbolManager::parseSymbols(QXmlStreamReader &reader,
GL::VertexVector &vertices,
GL::IndexVector &indices,
S52::SymbolType t) {
const QString itemName = t == S52::SymbolType::Single ? "symbol" : "pattern";
while (reader.readNextStartElement()) {
Q_ASSERT(reader.name() == itemName);
QString symbolName;
ParseData d;
bool staggered = false;
bool skip = false;
while (reader.readNextStartElement()) {
if (reader.name() == "name") {
symbolName = reader.readElementText();
} else if (reader.name() == "filltype") {
staggered = reader.readElementText() != "L";
} else if (reader.name() == "bitmap") {
parseSymbolData(reader, d, vertices, indices);
} else if (reader.name() == "prefer-bitmap") {
skip = reader.readElementText() == "no";
} else {
reader.skipCurrentElement();
}
}
if (skip || !d.size.isValid()) continue;
if (d.maxDist < d.minDist) {
qCWarning(CS52) << "maxdist larger than mindist in" << symbolName;
}
SymbolData s(d.offset, d.size, d.minDist, staggered, d.elements);
const SymbolKey key(S52::FindIndex(symbolName), t);
if (m_symbolMap.contains(key) && s != m_symbolMap[key]) {
qCWarning(CS52) << "multiple raster symbol/pattern definitions for"
<< symbolName << ", skipping earlier";
}
m_symbolMap.insert(key, s);
m_painterData.insert(key, PainterData(d.graphicsLocation, d.graphicsOffset));
}
}
void RasterSymbolManager::parseSymbolData(QXmlStreamReader &reader,
ParseData &d,
GL::VertexVector &vertices,
GL::IndexVector &indices) {
Q_ASSERT(reader.name() == "bitmap");
int w = reader.attributes().value("width").toInt();
int h = reader.attributes().value("height").toInt();
d.size = QSizeF(w / dots_per_mm_x(), h / dots_per_mm_y());
QPoint p;
QPoint o;
QPointF t0;
const qreal W = m_symbolTexture->width();
const qreal H = m_symbolTexture->height();
while (reader.readNextStartElement()) {
if (reader.name() == "distance") {
d.minDist = reader.attributes().value("min").toInt() / dots_per_mm_x();
d.maxDist = reader.attributes().value("max").toInt() / dots_per_mm_x();
reader.skipCurrentElement();
} else if (reader.name() == "pivot") {
p = QPoint(reader.attributes().value("x").toInt(),
reader.attributes().value("y").toInt());
d.graphicsOffset = p;
reader.skipCurrentElement();
} else if (reader.name() == "origin") {
o = QPoint(reader.attributes().value("x").toInt(),
reader.attributes().value("y").toInt());
reader.skipCurrentElement();
} else if (reader.name() == "graphics-location") {
const auto x = reader.attributes().value("x").toInt();
const auto y = reader.attributes().value("y").toInt();
t0 = QPointF(x / W, y / H);
d.graphicsLocation = QRect(x, y, w, h);
reader.skipCurrentElement();
} else {
reader.skipCurrentElement();
}
}
// offset of the upper left corner
d.offset = QPointF((o.x() - p.x()) / dots_per_mm_x(),
(p.y() - o.y()) / dots_per_mm_y());
d.elements = S57::ElementData {GL_TRIANGLES, indices.size() * sizeof(GLuint), 6};
const GLuint ioff = vertices.size() / 4;
indices << 0 + ioff << 1 + ioff << 2 + ioff << 0 + ioff << 2 + ioff << 3 + ioff;
// upper left
const QPointF p0(0., 0.);
// lower right
const QPointF p1 = p0 + QPointF(w / dots_per_mm_x(), - h / dots_per_mm_y());
const QPointF t1 = t0 + QPointF(w / W, h / H);
vertices << p0.x() << p0.y() << t0.x() << t0.y();
vertices << p1.x() << p0.y() << t1.x() << t0.y();
vertices << p1.x() << p1.y() << t1.x() << t1.y();
vertices << p0.x() << p1.y() << t0.x() << t1.y();
}
bool RasterSymbolManager::paintIcon(QPainter& painter, quint32 index, S52::SymbolType type) {
const SymbolKey key(index, type);
if (!m_pixmapCache.contains(key)) {
if (!m_painterData.contains(key)) return false;
auto pix = new QPixmap;
int h = 2 * m_painterData[key].graphicsLocation.height();
*pix = QPixmap(m_symbolAtlas).copy(m_painterData[key].graphicsLocation).scaledToHeight(h);
m_pixmapCache.insert(key, pix);
}
const auto ox = qMax(0, painter.device()->width() / 6 + m_painterData[key].offset.x());
const auto oy = qMax(0, painter.device()->height() / 6 + m_painterData[key].offset.y());
painter.drawPixmap(ox, oy, *m_pixmapCache[key]);
return true;
}
| 34.166667 | 99 | 0.647948 | jusirkka |
284deeda4f06f9ddbace5bc8932a4df2db63b863 | 526 | cpp | C++ | Variables/src/Variables.cpp | Annihilator708/cpp_adventure | b5d1cf470068d23ff238f16ba7e4ced476b1d0f9 | [
"MIT"
] | null | null | null | Variables/src/Variables.cpp | Annihilator708/cpp_adventure | b5d1cf470068d23ff238f16ba7e4ced476b1d0f9 | [
"MIT"
] | null | null | null | Variables/src/Variables.cpp | Annihilator708/cpp_adventure | b5d1cf470068d23ff238f16ba7e4ced476b1d0f9 | [
"MIT"
] | null | null | null | #include <iostream>
using namespace std;
int main() {
int numberCats = 5;
int numberDogs = 7;
cout << "Number of cats: " << numberCats << endl;
cout << "Number of dogs: " << numberDogs << endl;
cout << "Total number of animals: " << numberCats + numberDogs << endl;
cout << "New dogs arrived!" << endl;
numberDogs += 4;
cout << "Four dogs are new to the kennel!" << endl;
cout << "New total number of dogs: " << numberDogs << endl;
cout << "New total of animals: " << numberCats + numberDogs << endl;
return 0;
}
| 29.222222 | 72 | 0.629278 | Annihilator708 |
284e2ca968f834cff69beffcc04f792a98d0d464 | 33,785 | cpp | C++ | src/core/kext/Classes/EventInputQueue.cpp | gkb/Karabiner | f47307d4fc89a4c421d10157d059293c508f721a | [
"Unlicense"
] | null | null | null | src/core/kext/Classes/EventInputQueue.cpp | gkb/Karabiner | f47307d4fc89a4c421d10157d059293c508f721a | [
"Unlicense"
] | null | null | null | src/core/kext/Classes/EventInputQueue.cpp | gkb/Karabiner | f47307d4fc89a4c421d10157d059293c508f721a | [
"Unlicense"
] | null | null | null | #include "ButtonStatus.hpp"
#include "CommonData.hpp"
#include "Config.hpp"
#include "Core.hpp"
#include "EventInputQueue.hpp"
#include "EventWatcher.hpp"
#include "FlagStatus.hpp"
#include "GlobalLock.hpp"
#include "IOLogWrapper.hpp"
#include "ListHookedConsumer.hpp"
#include "ListHookedKeyboard.hpp"
#include "ListHookedPointing.hpp"
#include "PressingPhysicalKeys.hpp"
#include "RemapClass.hpp"
namespace org_pqrs_Karabiner {
List EventInputQueue::queue_;
IntervalChecker EventInputQueue::ic_;
TimerWrapper EventInputQueue::fire_timer_;
uint64_t EventInputQueue::serialNumber_;
List EventInputQueue::BlockUntilKeyUpHander::blockedQueue_;
List EventInputQueue::BlockUntilKeyUpHander::pressingEvents_;
TimerWrapper EventInputQueue::BlockUntilKeyUpHander::blockingTimeOut_timer_;
void
EventInputQueue::initialize(IOWorkLoop& workloop) {
ic_.begin();
fire_timer_.initialize(&workloop, NULL, EventInputQueue::fire_timer_callback);
serialNumber_ = 0;
BlockUntilKeyUpHander::initialize(workloop);
}
void
EventInputQueue::terminate(void) {
fire_timer_.terminate();
queue_.clear();
BlockUntilKeyUpHander::terminate();
}
void
EventInputQueue::enqueue_(const Params_KeyboardEventCallBack& p,
bool retainFlagStatusTemporaryCount,
const DeviceIdentifier& deviceIdentifier,
bool push_back) {
// Because we handle the key repeat ourself, drop the key repeat.
if (p.repeat) return;
Item* item = new Item(p, retainFlagStatusTemporaryCount, deviceIdentifier);
if (push_back) {
queue_.push_back(item);
} else {
queue_.push_front(item);
}
}
void
EventInputQueue::enqueue_(const Params_KeyboardSpecialEventCallback& p,
bool retainFlagStatusTemporaryCount,
const DeviceIdentifier& deviceIdentifier) {
// Because we handle the key repeat ourself, drop the key repeat.
if (p.repeat) return;
queue_.push_back(new Item(p, retainFlagStatusTemporaryCount, deviceIdentifier));
}
void
EventInputQueue::enqueue_(const Params_RelativePointerEventCallback& p,
bool retainFlagStatusTemporaryCount,
const DeviceIdentifier& deviceIdentifier) {
queue_.push_back(new Item(p, retainFlagStatusTemporaryCount, deviceIdentifier));
}
void
EventInputQueue::enqueue_(const Params_ScrollWheelEventCallback& p,
bool retainFlagStatusTemporaryCount,
const DeviceIdentifier& deviceIdentifier) {
queue_.push_back(new Item(p, retainFlagStatusTemporaryCount, deviceIdentifier));
}
namespace {
unsigned int maxThreshold(unsigned int v1, unsigned int v2) {
if (v1 > v2) {
return v1;
} else {
return v2;
}
}
}
void
EventInputQueue::setTimer(void) {
Item* front = static_cast<Item*>(queue_.safe_front());
if (!front) return;
// ----------------------------------------
uint32_t timeoutMS = 0;
if (RemapClassManager::isSimultaneousKeyPressesEnabled() ||
Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_ignore_bouncing_events)) {
// ----------------------------------------
// Calculate threshold
uint32_t threshold = 0;
const Params_Base& paramsBase = front->getParamsBase();
bool is_key = false;
bool is_pointingbutton = false;
if (paramsBase.get_Params_KeyboardEventCallBack() ||
paramsBase.get_Params_KeyboardSpecialEventCallback()) {
is_key = true;
}
{
auto p = paramsBase.get_Params_RelativePointerEventCallback();
if (p) {
if (p->ex_button != PointingButton::NONE) {
is_pointingbutton = true;
}
}
}
if (RemapClassManager::isSimultaneousKeyPressesEnabled()) {
if (is_key) {
threshold = maxThreshold(threshold, Config::get_simultaneouskeypresses_delay());
}
if (is_pointingbutton) {
threshold = maxThreshold(threshold, Config::get_simultaneouskeypresses_pointingbutton_delay());
}
}
if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_ignore_bouncing_events)) {
if (is_key) {
threshold = maxThreshold(threshold, Config::get_ignore_bouncing_threshold_for_keyboard());
}
if (is_pointingbutton) {
threshold = maxThreshold(threshold, Config::get_ignore_bouncing_threshold_for_mice());
}
}
// ----------------------------------------
// Calculate timeoutMS (== threshold - ic.getmillisec())
uint32_t ms = (front->ic).getmillisec();
if (ms < threshold) {
timeoutMS = threshold - ms;
}
// Ignore rounding error
if (timeoutMS > 0) {
--timeoutMS;
}
}
fire_timer_.setTimeoutMS(timeoutMS, false);
}
// ======================================================================
void
EventInputQueue::push_KeyboardEventCallback(OSObject* target,
unsigned int eventType,
unsigned int flags,
unsigned int key,
unsigned int charCode,
unsigned int charSet,
unsigned int origCharCode,
unsigned int origCharSet,
unsigned int keyboardType,
bool repeat,
AbsoluteTime ts,
OSObject* sender,
void* refcon) {
GlobalLock::ScopedLock lk;
if (!lk) return;
Params_KeyboardEventCallBack::log(true, EventType(eventType), Flags(flags), KeyCode(key), KeyboardType(keyboardType), repeat);
// ------------------------------------------------------------
// Ignore unknown modifiers
//
// You can confirm an unknown modifier by setting key code to 255 on Seil.
// This event also will be sent by Fn key on Leopold FC660M.
//
// KeyboardEventCallback [ caught]: eventType 12, flags 0x80000000, key 0x00ff, kbdType 43, repeat = 0
//
// This key sends the same event at key pressing and key releasing.
// Therefore, we cannot recognize whether key is pressed or key is released.
// So, we have to ignore this key for PressingPhysicalKeys.
//
if (EventType::MODIFY == EventType(eventType)) {
if (KeyCode(key).getModifierFlag() == ModifierFlag::ZERO) {
IOLOG_DEBUG("An unknown modifier is pressed (KeyCode:0x%x, Flags:0x%x). Ignore it.\n", key, flags);
return;
}
}
// ------------------------------------------------------------
KeyboardType newkeyboardtype(keyboardType);
RemapClassManager::remap_setkeyboardtype(newkeyboardtype);
KeyCode newkey(key);
Flags newflags(flags);
KeyCode::normalizeKey(newkey, newflags, EventType(eventType), newkeyboardtype);
// ------------------------------------------------------------
Params_KeyboardEventCallBack params(EventType(eventType),
newflags,
newkey,
CharCode(charCode),
CharSet(charSet),
OrigCharCode(origCharCode),
OrigCharSet(origCharSet),
newkeyboardtype,
repeat);
// ------------------------------------------------------------
IOHIKeyboard* device = OSDynamicCast(IOHIKeyboard, sender);
if (!device) return;
ListHookedKeyboard::Item* item = static_cast<ListHookedKeyboard::Item*>(ListHookedKeyboard::instance().get(device));
if (!item) return;
// ------------------------------------------------------------
// Device Hacks
// Drop events if "Disable an internal keyboard while external keyboards are connected" is enabled.
if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_disable_internal_keyboard_if_external_keyboard_exsits)) {
if (item->isInternalDevice() &&
ListHookedKeyboard::instance().isExternalDevicesConnected()) {
return;
}
}
// Logitech Cordless Presenter (LCP) Hack
//
// When an LCP is first plugged in, it will send a CONTROL_L down event
// when the first pageup/pagedown key is pressed without sending a corresponding
// up event -- effectively rendering the device (and the Mac) useless until it is
// unplugged from the system.
//
// Similarly, when the volume keys are first pressed, a SHIFT_L down event
// is generated, with now up event.
//
// This code effectively throws these events away if they are received from an LCP.
//
// *** LCP has 6 keys (Page Up, Page Down, a 'B' key, an 'Esc' key, and volume up / down keys). ***
// *** So, we can drop CONTROL_L and SHIFT_L without a problem. ***
if ((item->getDeviceIdentifier()).isEqualVendorProduct(DeviceVendor::LOGITECH,
DeviceProduct::LOGITECH_CORDLESS_PRESENTER)) {
if (params.key == KeyCode::CONTROL_L) return;
if (params.key == KeyCode::SHIFT_L) return;
}
// ------------------------------------------------------------
// NumLock Hacks
//
// As for some keypads, NumLock is off when it was connected.
// We need to call setAlphaLock(true) to activate a device.
RemapClassManager::remap_forcenumlockon(item);
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
// ------------------------------------------------------------
// Because we handle the key repeat ourself, drop the key repeat by hardware.
if (repeat) return;
// ------------------------------------------------------------
bool retainFlagStatusTemporaryCount = false;
bool push_back = true;
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier(), push_back);
setTimer();
}
void
EventInputQueue::push_UpdateEventFlagsCallback(OSObject* target,
unsigned flags,
OSObject* sender,
void* refcon) {
GlobalLock::ScopedLock lk;
if (!lk) return;
Params_UpdateEventFlagsCallback::log(true, Flags(flags));
// ------------------------------------------------------------
// update device priority by calling ListHookedKeyboard::instance().get(kbd).
IOHIKeyboard* device = OSDynamicCast(IOHIKeyboard, sender);
if (!device) return;
ListHookedKeyboard::Item* item = static_cast<ListHookedKeyboard::Item*>(ListHookedKeyboard::instance().get(device));
if (!item) return;
// Don't push_back for UpdateEventFlagsCallback.
}
// ----------------------------------------------------------------------
void
EventInputQueue::push_KeyboardSpecialEventCallback(OSObject* target,
unsigned int eventType,
unsigned int flags,
unsigned int key,
unsigned int flavor,
UInt64 guid,
bool repeat,
AbsoluteTime ts,
OSObject* sender,
void* refcon) {
GlobalLock::ScopedLock lk;
if (!lk) return;
Params_KeyboardSpecialEventCallback::log(true, EventType(eventType), Flags(flags), ConsumerKeyCode(key), flavor, guid, repeat);
// ------------------------------------------------------------
Params_KeyboardSpecialEventCallback params(EventType(eventType),
Flags(flags),
ConsumerKeyCode(key),
flavor, guid, repeat);
// ------------------------------------------------------------
IOHIKeyboard* device = OSDynamicCast(IOHIKeyboard, sender);
if (!device) return;
ListHookedConsumer::Item* item = static_cast<ListHookedConsumer::Item*>(ListHookedConsumer::instance().get(device));
if (!item) return;
// ------------------------------------------------------------
// Device Hacks
// Drop events if "Disable an internal keyboard while external keyboards are connected" is enabled.
if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_disable_internal_keyboard_if_external_keyboard_exsits)) {
if (item->isInternalDevice() &&
ListHookedKeyboard::instance().isExternalDevicesConnected()) {
return;
}
}
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
// ------------------------------------------------------------
// Because we handle the key repeat ourself, drop the key repeat by hardware.
if (repeat) return;
// ------------------------------------------------------------
bool retainFlagStatusTemporaryCount = false;
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
setTimer();
}
// ----------------------------------------------------------------------
void
EventInputQueue::push_RelativePointerEventCallback(OSObject* target,
int buttons_raw,
int dx,
int dy,
AbsoluteTime ts,
OSObject* sender,
void* refcon) {
GlobalLock::ScopedLock lk;
if (!lk) return;
Params_RelativePointerEventCallback::log(true, Buttons(buttons_raw), dx, dy);
// ------------------------------------------------------------
Buttons buttons(buttons_raw);
Buttons justPressed;
Buttons justReleased;
IOHIPointing* device = OSDynamicCast(IOHIPointing, sender);
if (!device) return;
ListHookedPointing::Item* item = static_cast<ListHookedPointing::Item*>(ListHookedPointing::instance().get(device));
if (!item) return;
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
// ------------------------------------------------------------
justPressed = buttons.justPressed(item->get_previousbuttons());
justReleased = buttons.justReleased(item->get_previousbuttons());
item->set_previousbuttons(buttons);
// ------------------------------------------------------------
// divide an event into button and cursormove events.
for (int i = 0; i < ButtonStatus::MAXNUM; ++i) {
PointingButton btn(1 << i);
if (justPressed.isOn(btn)) {
Params_RelativePointerEventCallback params(buttons, 0, 0, btn, true);
bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
}
if (justReleased.isOn(btn)) {
Params_RelativePointerEventCallback params(buttons, 0, 0, btn, false);
bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
}
}
// If (dx == 0 && dy == 0), the event is either needless event or just pressing/releasing buttons event.
// About just pressing/releasing buttons event, we handled these in the above processes.
// So, we can drop (dx == 0 && dy == 0) events in here.
if (dx != 0 || dy != 0) {
Params_RelativePointerEventCallback params(buttons, dx, dy, PointingButton::NONE, false);
bool retainFlagStatusTemporaryCount = true;
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
}
setTimer();
}
void
EventInputQueue::push_ScrollWheelEventCallback(OSObject* target,
short deltaAxis1,
short deltaAxis2,
short deltaAxis3,
IOFixed fixedDelta1,
IOFixed fixedDelta2,
IOFixed fixedDelta3,
SInt32 pointDelta1,
SInt32 pointDelta2,
SInt32 pointDelta3,
SInt32 options,
AbsoluteTime ts,
OSObject* sender,
void* refcon) {
GlobalLock::ScopedLock lk;
if (!lk) return;
Params_ScrollWheelEventCallback::log(true,
deltaAxis1,
deltaAxis2,
deltaAxis3,
fixedDelta1,
fixedDelta2,
fixedDelta3,
pointDelta1,
pointDelta2,
pointDelta3,
options);
// ------------------------------------------------------------
Params_ScrollWheelEventCallback params(deltaAxis1, deltaAxis2, deltaAxis3,
fixedDelta1, fixedDelta2, fixedDelta3,
pointDelta1, pointDelta2, pointDelta3,
options);
// ------------------------------------------------------------
IOHIPointing* device = OSDynamicCast(IOHIPointing, sender);
if (!device) return;
ListHookedPointing::Item* item = static_cast<ListHookedPointing::Item*>(ListHookedPointing::instance().get(device));
if (!item) return;
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
// ------------------------------------------------------------
bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
setTimer();
}
// ======================================================================
void
EventInputQueue::fire_timer_callback(OSObject* /*notuse_owner*/, IOTimerEventSource* /*notuse_sender*/) {
// IOLOG_DEVEL("EventInputQueue::fire queue_.size = %d\n", static_cast<int>(queue_.size()));
// ------------------------------------------------------------
// Ignore key bouncing (chattering).
if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_ignore_bouncing_events)) {
retry:
for (Item* p = static_cast<Item*>(queue_.safe_front()); p; p = static_cast<Item*>(p->getnext())) {
// Search key up, key down event.
bool iskeydown;
if (p->getParamsBase().iskeydown(iskeydown) && !iskeydown) {
Item* keyUpEvent = p;
FromEvent fromEvent(p->getParamsBase());
for (Item* q = static_cast<Item*>(p->getnext()); q; q = static_cast<Item*>(q->getnext())) {
if (fromEvent.isTargetUpEvent(q->getParamsBase())) {
break;
} else if (fromEvent.isTargetDownEvent(q->getParamsBase())) {
Item* keyDownEvent = q;
uint32_t ms1 = (keyUpEvent->ic).getmillisec();
uint32_t ms2 = (keyDownEvent->ic).getmillisec();
uint32_t interval = ms1 - ms2;
uint32_t threshold = 0;
switch (fromEvent.getType()) {
case FromEvent::Type::KEY:
case FromEvent::Type::CONSUMER_KEY:
threshold = Config::get_ignore_bouncing_threshold_for_keyboard();
break;
case FromEvent::Type::POINTING_BUTTON:
threshold = Config::get_ignore_bouncing_threshold_for_mice();
break;
case FromEvent::Type::NONE:
break;
}
if (interval < threshold) {
IOLOG_INFO("Bouncing events are removed. (interval: %d, threshold: %d)\n", interval, threshold);
queue_.erase_and_delete(keyUpEvent);
queue_.erase_and_delete(keyDownEvent);
goto retry;
} else {
IOLOG_INFO("Bouncing events? (interval: %d, threshold: %d)\n", interval, threshold);
}
}
}
}
}
}
// ------------------------------------------------------------
// handle SimultaneousKeyPresses
while (true) {
Item* front = static_cast<Item*>(queue_.safe_front());
if (!front) return;
// ------------------------------------------------------------
// clear temporary_count_
//
// Don't call FlagStatus::set(key, flags) here.
// If SimultaneousKeyPresses is enabled, keys may be dropped.
// For example, Shift_L+Shift_R to Space is enabled, Shift_L and Shift_R may be dropped.
// If we call FlagStatus::set(key, flags) here, dropped keys are kept as pushed status.
// So, call FlagStatus::set(key, flags) after EventInputQueue.
// ------------------------------------------------------------
if (!front->retainFlagStatusTemporaryCount) {
FlagStatus::globalFlagStatus().set();
}
CommonData::setcurrent_deviceIdentifier(front->deviceIdentifier);
{
auto params = (front->getParamsBase()).get_Params_KeyboardEventCallBack();
if (params) {
CommonData::setcurrent_keyboardType(params->keyboardType);
}
}
bool iskeydown = false;
if (!(front->getParamsBase()).iskeydown(iskeydown)) {
iskeydown = true;
}
if (!RemapClassManager::remap_simultaneouskeypresses(iskeydown)) {
break;
}
}
// ------------------------------------------------------------
// handle BlockUntilKeyUp
//
// Note:
// We need to handle BlockUntilKeyUp after SimultaneousKeyPresses
// in order to avoid unintended modification by SimultaneousKeyPresses.
bool needToFire = BlockUntilKeyUpHander::doBlockUntilKeyUp();
if (needToFire) {
doFire();
}
setTimer();
}
void
EventInputQueue::doFire(void) {
Item* p = static_cast<Item*>(queue_.safe_front());
if (!p) return;
{
auto params = (p->getParamsBase()).get_Params_KeyboardEventCallBack();
if (params) {
if (params->ex_iskeydown) {
EventWatcher::on();
FlagStatus::globalFlagStatus().lazy_enable();
} else {
FlagStatus::globalFlagStatus().lazy_disable_if_off();
}
// ------------------------------------------------------------
// We must call PressingPhysicalKeys after inputqueue. (Not before queuing)
// For example, when we type Command_L+S.
//
// (1) Command_L down (queued)
// (2) KeyCode::S down (Command_L+S)
// (1') dequeue Command_L down
// (3) Command_L up
// (4) KeyCode::S up
// (2') dequeue KeyCode::S down
//
// if PressingPhysicalKeys called when (4), Command_L state is reset.
// Then (2') send KeyCode::S without Modifiers.
//
// ------------------------------------------------------------
// When we press&release CapsLock, key event is fired only once.
// (down or up depending on the state of CapsLock)
// If we use Virtual CapsLock (remapped CapsLock) like "Change A to CapsLock",
// the PressingPhysicalKeys state is increase illegally.
// So, we ignore Hardware CapsLock at PressingPhysicalKeys.
//
// (1) Press Hardware CapsLock (EventType::DOWN is fired.)
// (2) Press A (EventType::DOWN is fired.)
// (2') (A is changed to CapsLock.)
// (3) Release A (EventType::UP is fired.)
// (3') (A is changed to CapsLock.)
// (4) Press Hardware CapsLock (EventType::DOWN is fired.)
//
// Both (1) and (4) fire DOWN event.
if (params->key != KeyCode::CAPSLOCK) {
PressingPhysicalKeys::update(p->getParamsBase());
}
Core::remap_KeyboardEventCallback(p->getParamsBase());
}
}
{
auto params = (p->getParamsBase()).get_Params_KeyboardSpecialEventCallback();
if (params) {
if (params->ex_iskeydown) {
EventWatcher::on();
FlagStatus::globalFlagStatus().lazy_enable();
} else {
FlagStatus::globalFlagStatus().lazy_disable_if_off();
}
// ------------------------------------------------------------
PressingPhysicalKeys::update(p->getParamsBase());
Core::remap_KeyboardSpecialEventCallback(p->getParamsBase());
}
}
{
auto params = (p->getParamsBase()).get_Params_RelativePointerEventCallback();
if (params) {
// ------------------------------------------------------------
// We set EventWatcher::on only when Buttons pressed.
// ------------------------------
// About PointingRelativeToScroll:
//
// If PointingRelativeToScroll is applied, we should call EventWatcher::on. (== canceling KeyOverlaidModifier)
// When the following settings are activated,
// Fn_Lock should not be fired if the RelativePointerEvent is happened.
//
// - Fn+CursorMove to ScrollWheel
// - Fn to Fn (+ When you type Fn only, send Fn_Lock)
//
// But, if we call EventWatcher::on every CursorMove event, unexpected cancel occurs.
// It's more terrible than above problem.
//
// Therefore, we call EventWatcher::on in PointingRelativeToScroll::remap.
// So we don't need to call EventWatcher::on unless just buttons are pressed.
if (params->ex_button != PointingButton::NONE &&
params->ex_isbuttondown) {
EventWatcher::on();
}
if (params->ex_button == PointingButton::NONE ||
params->ex_isbuttondown) {
FlagStatus::globalFlagStatus().lazy_enable();
} else {
FlagStatus::globalFlagStatus().lazy_disable_if_off();
}
// ------------------------------------------------------------
if (params->ex_button != PointingButton::NONE) {
PressingPhysicalKeys::update(p->getParamsBase());
}
Core::remap_RelativePointerEventCallback(p->getParamsBase());
}
}
{
auto params = (p->getParamsBase()).get_Params_ScrollWheelEventCallback();
if (params) {
// When "Space to Command (+ When you type Space only, send Space)" is activated,
// user press Space and scroll wheel to input Command+ScrollWheel.
// Then release Space, user don't intend to send Space.
// So, we need to set EventWatcher::on here.
EventWatcher::on();
FlagStatus::globalFlagStatus().lazy_enable();
Core::remap_ScrollWheelEventCallback(p->getParamsBase());
}
}
CommonData::setcurrent_lastpressedphysicalkey(p->getParamsBase());
queue_.pop_front();
++serialNumber_;
}
void
EventInputQueue::BlockUntilKeyUpHander::initialize(IOWorkLoop& workloop) {
blockingTimeOut_timer_.initialize(&workloop, NULL, EventInputQueue::BlockUntilKeyUpHander::blockingTimeOut_timer_callback);
}
void
EventInputQueue::BlockUntilKeyUpHander::terminate(void) {
blockingTimeOut_timer_.terminate();
blockedQueue_.clear();
pressingEvents_.clear();
}
bool
EventInputQueue::BlockUntilKeyUpHander::doBlockUntilKeyUp(void) {
Item* front = static_cast<Item*>(queue_.safe_front());
if (!front) return true;
// Ignore events enqueued from blockedQueue_.
if (front->enqueuedFrom == Item::ENQUEUED_FROM_BLOCKEDQUEUE) return true;
// Ignore events that are not down/up events.
// (For example, mouse cursor move events.)
bool iskeydown = false;
if (!(front->getParamsBase()).iskeydown(iskeydown)) return true;
// ----------------------------------------
// Modify pressingEvents_.
//
// Remove existing events.
{
PressingEvent* p = static_cast<PressingEvent*>(pressingEvents_.safe_front());
for (;;) {
if (!p) break;
if ((p->getFromEvent()).isTargetDownEvent(front->getParamsBase()) ||
(p->getFromEvent()).isTargetUpEvent(front->getParamsBase())) {
p = static_cast<PressingEvent*>(pressingEvents_.erase_and_delete(p));
} else {
p = static_cast<PressingEvent*>(p->getnext());
}
}
}
// Add to list.
if (iskeydown) {
pressingEvents_.push_back(new PressingEvent(front->getParamsBase()));
}
// ----------------------------------------
// Test whether pressingEvents_ are a target event of BlockUntilKeyUp.
//
for (PressingEvent* p = static_cast<PressingEvent*>(pressingEvents_.safe_front()); p; p = static_cast<PressingEvent*>(p->getnext())) {
if (p->ignore()) continue;
if (RemapClassManager::isTargetEventForBlockUntilKeyUp(p->getParamsBase())) {
goto needToBlock;
}
}
// If current event is target event, we need to block it.
if (RemapClassManager::isTargetEventForBlockUntilKeyUp(front->getParamsBase())) {
goto needToBlock;
}
endBlocking();
return true;
needToBlock:
// Set timeout at first.
{
int timeout = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_parameter_blockuntilkeyup_timeout);
blockingTimeOut_timer_.setTimeoutMS(timeout);
}
// When <autogen>__BlockUntilKeyUp__ KeyCode::SPACE</autogen> is enabled:
//
// Case 1:
// * Space down
// * T down
// * T up <- up event and event != Space
//
// => Enqueue "Space down, T down, T up".
//
// Note:
// If there is an orphan key up event,
// user is typing fast and we should change key events order in Case 2.
// So, we keep blocking.
//
// * M down
// * Space down (start blocking)
// * M up (orphan key up event)
// * T down
// * T up
//
// Case 2:
// * Space down
// * T down
// * Space up <- up event and event == Space
//
// => Move "Space up" after "Space down".
// Then, Enqueue "Space down, Space up, T down".
//
if (!iskeydown && RemapClassManager::isTargetEventForBlockUntilKeyUp(front->getParamsBase())) {
// Case2
// Do not call setIgnoreToAllPressingEvents here.
//
// We do not need to call that here because front->p_ is already removed from pressingEvents_.
// And if multiple __BlockUntilKeyUp__ are enabled,
// setIgnoreToAllPressingEvents breaks other __BlockUntilKeyUp__.
// Move up event after down event.
FromEvent fromEvent(front->getParamsBase());
for (Item* p = static_cast<Item*>(blockedQueue_.safe_back()); p; p = static_cast<Item*>(p->getprev())) {
if (fromEvent.isTargetDownEvent(p->getParamsBase())) {
if (p->getnext()) {
blockedQueue_.insert(p->getnext(), new Item(*front));
} else {
blockedQueue_.push_back(new Item(*front));
}
goto endBlocking;
}
}
// corresponded event is not found.
blockedQueue_.push_front(new Item(*front));
goto endBlocking;
} else if (!iskeydown &&
!isOrphanKeyUpEventExistsInBlockedQueue() &&
isTargetDownEventInBlockedQueue(*front)) {
// Case 1
setIgnoreToAllPressingEvents();
blockedQueue_.push_back(new Item(*front));
goto endBlocking;
}
blockedQueue_.push_back(new Item(*front));
queue_.pop_front();
// Do not call doFire.
return false;
endBlocking:
queue_.pop_front();
endBlocking();
return true;
}
bool
EventInputQueue::BlockUntilKeyUpHander::isTargetDownEventInBlockedQueue(const Item& front) {
FromEvent fromEvent(front.getParamsBase());
for (Item* p = static_cast<Item*>(blockedQueue_.safe_front()); p; p = static_cast<Item*>(p->getnext())) {
if (fromEvent.isTargetDownEvent(p->getParamsBase())) {
return true;
}
}
return false;
}
bool
EventInputQueue::BlockUntilKeyUpHander::isOrphanKeyUpEventExistsInBlockedQueue(void) {
for (Item* p = static_cast<Item*>(blockedQueue_.safe_front()); p; p = static_cast<Item*>(p->getnext())) {
bool iskeydown;
if ((p->getParamsBase()).iskeydown(iskeydown) && !iskeydown) {
FromEvent fromEvent(p->getParamsBase());
bool found = false;
for (Item* q = p; q; q = static_cast<Item*>(q->getprev())) {
if (fromEvent.isTargetDownEvent(q->getParamsBase())) {
found = true;
}
}
if (!found) {
return true;
}
}
}
return false;
}
void
EventInputQueue::BlockUntilKeyUpHander::endBlocking(void) {
if (blockedQueue_.size() > 0) {
// restore queue_
for (;;) {
Item* p = static_cast<Item*>(blockedQueue_.safe_back());
if (!p) break;
p->enqueuedFrom = Item::ENQUEUED_FROM_BLOCKEDQUEUE;
queue_.push_front(new Item(*p));
blockedQueue_.pop_back();
}
}
blockingTimeOut_timer_.cancelTimeout();
}
void
EventInputQueue::BlockUntilKeyUpHander::setIgnoreToAllPressingEvents(void) {
// Ignore pressingEvents_ from next.
for (PressingEvent* p = static_cast<PressingEvent*>(pressingEvents_.safe_front()); p; p = static_cast<PressingEvent*>(p->getnext())) {
p->setIgnore();
}
}
void
EventInputQueue::BlockUntilKeyUpHander::blockingTimeOut_timer_callback(OSObject* owner, IOTimerEventSource* sender) {
endBlocking();
setIgnoreToAllPressingEvents();
setTimer();
}
}
| 36.524324 | 144 | 0.570579 | gkb |
284eebac8764a8e90f3e34a0d7a967135a03cdcc | 41,739 | cpp | C++ | src/c_api.cpp | CeasarLee/ncnn | 178825d14a16c4059820d9f054a8d857df671027 | [
"BSD-3-Clause"
] | null | null | null | src/c_api.cpp | CeasarLee/ncnn | 178825d14a16c4059820d9f054a8d857df671027 | [
"BSD-3-Clause"
] | null | null | null | src/c_api.cpp | CeasarLee/ncnn | 178825d14a16c4059820d9f054a8d857df671027 | [
"BSD-3-Clause"
] | null | null | null | /* Tencent is pleased to support the open source community by making ncnn available.
*
* Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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 "c_api.h"
#include <stdlib.h>
#include "allocator.h"
#include "blob.h"
#include "datareader.h"
#include "layer.h"
#include "mat.h"
#include "modelbin.h"
#include "net.h"
#include "option.h"
#include "paramdict.h"
using ncnn::Allocator;
using ncnn::Blob;
using ncnn::DataReader;
using ncnn::Extractor;
using ncnn::Layer;
using ncnn::Mat;
using ncnn::ModelBin;
using ncnn::Net;
using ncnn::Option;
using ncnn::ParamDict;
#ifdef __cplusplus
extern "C" {
#endif
const char* ncnn_version()
{
return NCNN_VERSION_STRING;
}
/* allocator api */
class PoolAllocator_c_api : public ncnn::PoolAllocator
{
public:
PoolAllocator_c_api(ncnn_allocator_t _allocator)
: ncnn::PoolAllocator()
{
allocator = _allocator;
}
virtual void* fastMalloc(size_t size)
{
return allocator->fast_malloc(allocator, size);
}
virtual void fastFree(void* ptr)
{
return allocator->fast_free(allocator, ptr);
}
public:
ncnn_allocator_t allocator;
};
static void* __ncnn_PoolAllocator_fast_malloc(ncnn_allocator_t allocator, size_t size)
{
return ((ncnn::PoolAllocator*)allocator->pthis)->ncnn::PoolAllocator::fastMalloc(size);
}
static void __ncnn_PoolAllocator_fast_free(ncnn_allocator_t allocator, void* ptr)
{
((ncnn::PoolAllocator*)allocator->pthis)->ncnn::PoolAllocator::fastFree(ptr);
}
class UnlockedPoolAllocator_c_api : public ncnn::UnlockedPoolAllocator
{
public:
UnlockedPoolAllocator_c_api(ncnn_allocator_t _allocator)
: ncnn::UnlockedPoolAllocator()
{
allocator = _allocator;
}
virtual void* fastMalloc(size_t size)
{
return allocator->fast_malloc(allocator, size);
}
virtual void fastFree(void* ptr)
{
return allocator->fast_free(allocator, ptr);
}
public:
ncnn_allocator_t allocator;
};
static void* __ncnn_UnlockedPoolAllocator_fast_malloc(ncnn_allocator_t allocator, size_t size)
{
return ((ncnn::UnlockedPoolAllocator*)allocator->pthis)->ncnn::UnlockedPoolAllocator::fastMalloc(size);
}
static void __ncnn_UnlockedPoolAllocator_fast_free(ncnn_allocator_t allocator, void* ptr)
{
((ncnn::UnlockedPoolAllocator*)allocator->pthis)->ncnn::UnlockedPoolAllocator::fastFree(ptr);
}
ncnn_allocator_t ncnn_allocator_create_pool_allocator()
{
ncnn_allocator_t allocator = (ncnn_allocator_t)malloc(sizeof(struct __ncnn_allocator_t));
allocator->pthis = (void*)(new PoolAllocator_c_api(allocator));
allocator->fast_malloc = __ncnn_PoolAllocator_fast_malloc;
allocator->fast_free = __ncnn_PoolAllocator_fast_free;
return allocator;
}
ncnn_allocator_t ncnn_allocator_create_unlocked_pool_allocator()
{
ncnn_allocator_t allocator = (ncnn_allocator_t)malloc(sizeof(struct __ncnn_allocator_t));
allocator->pthis = (void*)(new UnlockedPoolAllocator_c_api(allocator));
allocator->fast_malloc = __ncnn_UnlockedPoolAllocator_fast_malloc;
allocator->fast_free = __ncnn_UnlockedPoolAllocator_fast_free;
return allocator;
}
void ncnn_allocator_destroy(ncnn_allocator_t allocator)
{
delete (Allocator*)allocator->pthis;
free(allocator);
}
/* option api */
ncnn_option_t ncnn_option_create()
{
return (ncnn_option_t)(new Option());
}
void ncnn_option_destroy(ncnn_option_t opt)
{
delete (Option*)opt;
}
int ncnn_option_get_num_threads(const ncnn_option_t opt)
{
return ((const Option*)opt)->num_threads;
}
void ncnn_option_set_num_threads(ncnn_option_t opt, int num_threads)
{
((Option*)opt)->num_threads = num_threads;
}
int ncnn_option_get_use_vulkan_compute(const ncnn_option_t opt)
{
#if NCNN_VULKAN
return ((const Option*)opt)->use_vulkan_compute;
#else
(void)opt;
return 0;
#endif
}
void ncnn_option_set_use_vulkan_compute(ncnn_option_t opt, int use_vulkan_compute)
{
#if NCNN_VULKAN
((Option*)opt)->use_vulkan_compute = use_vulkan_compute;
#else
(void)opt;
(void)use_vulkan_compute;
#endif
}
/* mat api */
ncnn_mat_t ncnn_mat_create_1d(int w, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, (size_t)4u, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_2d(int w, int h, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, (size_t)4u, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_3d(int w, int h, int c, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, c, (size_t)4u, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_4d(int w, int h, int d, int c, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, d, c, (size_t)4u, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_external_1d(int w, void* data, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, data, (size_t)4u, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_external_2d(int w, int h, void* data, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, data, (size_t)4u, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_external_3d(int w, int h, int c, void* data, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, c, data, (size_t)4u, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_external_4d(int w, int h, int d, int c, void* data, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, d, c, data, (size_t)4u, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_1d_elem(int w, size_t elemsize, int elempack, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, elemsize, elempack, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_2d_elem(int w, int h, size_t elemsize, int elempack, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, elemsize, elempack, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_3d_elem(int w, int h, int c, size_t elemsize, int elempack, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, c, elemsize, elempack, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_4d_elem(int w, int h, int d, int c, size_t elemsize, int elempack, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, d, c, elemsize, elempack, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_external_1d_elem(int w, void* data, size_t elemsize, int elempack, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, data, elemsize, elempack, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_external_2d_elem(int w, int h, void* data, size_t elemsize, int elempack, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, data, elemsize, elempack, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_external_3d_elem(int w, int h, int c, void* data, size_t elemsize, int elempack, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, c, data, elemsize, elempack, (Allocator*)allocator));
}
ncnn_mat_t ncnn_mat_create_external_4d_elem(int w, int h, int d, int c, void* data, size_t elemsize, int elempack, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(w, h, d, c, data, elemsize, elempack, (Allocator*)allocator));
}
void ncnn_mat_destroy(ncnn_mat_t mat)
{
delete (Mat*)mat;
}
void ncnn_mat_fill_float(ncnn_mat_t mat, float v)
{
((Mat*)mat)->fill(v);
}
ncnn_mat_t ncnn_mat_clone(const ncnn_mat_t mat, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(((const Mat*)mat)->clone((Allocator*)allocator)));
}
ncnn_mat_t ncnn_mat_reshape_1d(const ncnn_mat_t mat, int w, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(((const Mat*)mat)->reshape(w, (Allocator*)allocator)));
}
ncnn_mat_t ncnn_mat_reshape_2d(const ncnn_mat_t mat, int w, int h, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(((const Mat*)mat)->reshape(w, h, (Allocator*)allocator)));
}
ncnn_mat_t ncnn_mat_reshape_3d(const ncnn_mat_t mat, int w, int h, int c, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(((const Mat*)mat)->reshape(w, h, c, (Allocator*)allocator)));
}
ncnn_mat_t ncnn_mat_reshape_4d(const ncnn_mat_t mat, int w, int h, int d, int c, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(((const Mat*)mat)->reshape(w, h, d, c, (Allocator*)allocator)));
}
int ncnn_mat_get_dims(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->dims;
}
int ncnn_mat_get_w(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->w;
}
int ncnn_mat_get_h(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->h;
}
int ncnn_mat_get_d(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->d;
}
int ncnn_mat_get_c(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->c;
}
size_t ncnn_mat_get_elemsize(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->elemsize;
}
int ncnn_mat_get_elempack(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->elempack;
}
size_t ncnn_mat_get_cstep(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->cstep;
}
void* ncnn_mat_get_data(const ncnn_mat_t mat)
{
return ((const Mat*)mat)->data;
}
void* ncnn_mat_get_channel_data(const ncnn_mat_t mat, int c)
{
return ((const Mat*)mat)->channel(c).data;
}
#if NCNN_PIXEL
/* mat pixel api */
ncnn_mat_t ncnn_mat_from_pixels(const unsigned char* pixels, int type, int w, int h, int stride, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(Mat::from_pixels(pixels, type, w, h, stride, (Allocator*)allocator)));
}
ncnn_mat_t ncnn_mat_from_pixels_resize(const unsigned char* pixels, int type, int w, int h, int stride, int target_width, int target_height, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(Mat::from_pixels_resize(pixels, type, w, h, stride, target_width, target_height, (Allocator*)allocator)));
}
ncnn_mat_t ncnn_mat_from_pixels_roi(const unsigned char* pixels, int type, int w, int h, int stride, int roix, int roiy, int roiw, int roih, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(Mat::from_pixels_roi(pixels, type, w, h, stride, roix, roiy, roiw, roih, (Allocator*)allocator)));
}
ncnn_mat_t ncnn_mat_from_pixels_roi_resize(const unsigned char* pixels, int type, int w, int h, int stride, int roix, int roiy, int roiw, int roih, int target_width, int target_height, ncnn_allocator_t allocator)
{
return (ncnn_mat_t)(new Mat(Mat::from_pixels_roi_resize(pixels, type, w, h, stride, roix, roiy, roiw, roih, target_width, target_height, (Allocator*)allocator)));
}
void ncnn_mat_to_pixels(const ncnn_mat_t mat, unsigned char* pixels, int type, int stride)
{
((const Mat*)mat)->to_pixels(pixels, type, stride);
}
void ncnn_mat_to_pixels_resize(const ncnn_mat_t mat, unsigned char* pixels, int type, int target_width, int target_height, int target_stride)
{
((const Mat*)mat)->to_pixels_resize(pixels, type, target_width, target_height, target_stride);
}
#endif /* NCNN_PIXEL */
void ncnn_mat_substract_mean_normalize(ncnn_mat_t mat, const float* mean_vals, const float* norm_vals)
{
((Mat*)mat)->substract_mean_normalize(mean_vals, norm_vals);
}
void ncnn_convert_packing(const ncnn_mat_t src, ncnn_mat_t* dst, int elempack, const ncnn_option_t opt)
{
Mat _dst;
ncnn::convert_packing(*(const Mat*)src, _dst, elempack, *(Option*)opt);
*dst = (ncnn_mat_t)(new Mat(_dst));
}
void ncnn_flatten(const ncnn_mat_t src, ncnn_mat_t* dst, const ncnn_option_t opt)
{
Mat _dst;
ncnn::flatten(*(const Mat*)src, _dst, *(Option*)opt);
*dst = (ncnn_mat_t)(new Mat(_dst));
}
/* blob api */
#if NCNN_STRING
const char* ncnn_blob_get_name(const ncnn_blob_t blob)
{
return ((const Blob*)blob)->name.c_str();
}
#endif /* NCNN_STRING */
int ncnn_blob_get_producer(const ncnn_blob_t blob)
{
return ((const Blob*)blob)->producer;
}
int ncnn_blob_get_consumer(const ncnn_blob_t blob)
{
return ((const Blob*)blob)->consumer;
}
void ncnn_blob_get_shape(const ncnn_blob_t blob, int* dims, int* w, int* h, int* c)
{
const Mat& shape = ((const Blob*)blob)->shape;
*dims = shape.dims;
*w = shape.w;
*h = shape.h;
*c = shape.c;
}
/* paramdict api */
ncnn_paramdict_t ncnn_paramdict_create()
{
return (ncnn_paramdict_t)(new ParamDict());
}
void ncnn_paramdict_destroy(ncnn_paramdict_t pd)
{
delete (ParamDict*)pd;
}
int ncnn_paramdict_get_type(const ncnn_paramdict_t pd, int id)
{
return ((const ParamDict*)pd)->type(id);
}
int ncnn_paramdict_get_int(const ncnn_paramdict_t pd, int id, int def)
{
return ((const ParamDict*)pd)->get(id, def);
}
float ncnn_paramdict_get_float(const ncnn_paramdict_t pd, int id, float def)
{
return ((const ParamDict*)pd)->get(id, def);
}
ncnn_mat_t ncnn_paramdict_get_array(ncnn_paramdict_t pd, int id, const ncnn_mat_t def)
{
return (ncnn_mat_t)(new Mat(((const ParamDict*)pd)->get(id, *(const Mat*)def)));
}
void ncnn_paramdict_set_int(ncnn_paramdict_t pd, int id, int i)
{
return ((ParamDict*)pd)->set(id, i);
}
void ncnn_paramdict_set_float(ncnn_paramdict_t pd, int id, float f)
{
return ((ParamDict*)pd)->set(id, f);
}
void ncnn_paramdict_set_array(ncnn_paramdict_t pd, int id, ncnn_mat_t v)
{
return ((ParamDict*)pd)->set(id, *(const Mat*)v);
}
/* datareader api */
class DataReader_c_api : public ncnn::DataReader
{
public:
DataReader_c_api(ncnn_datareader_t _dr)
: ncnn::DataReader()
{
dr = _dr;
}
#if NCNN_STRING
virtual int scan(const char* format, void* p) const
{
return dr->scan(dr, format, p);
}
#endif /* NCNN_STRING */
virtual size_t read(void* buf, size_t size) const
{
return dr->read(dr, buf, size);
}
public:
ncnn_datareader_t dr;
};
#if NCNN_STRING
static int __ncnn_DataReader_scan(ncnn_datareader_t dr, const char* format, void* p)
{
return ((ncnn::DataReader*)dr->pthis)->ncnn::DataReader::scan(format, p);
}
#endif /* NCNN_STRING */
static size_t __ncnn_DataReader_read(ncnn_datareader_t dr, void* buf, size_t size)
{
return ((ncnn::DataReader*)dr->pthis)->ncnn::DataReader::read(buf, size);
}
#if NCNN_STDIO
class DataReaderFromStdio_c_api : public ncnn::DataReaderFromStdio
{
public:
DataReaderFromStdio_c_api(FILE* fp, ncnn_datareader_t _dr)
: ncnn::DataReaderFromStdio(fp)
{
dr = _dr;
}
#if NCNN_STRING
virtual int scan(const char* format, void* p) const
{
return dr->scan(dr, format, p);
}
#endif /* NCNN_STRING */
virtual size_t read(void* buf, size_t size) const
{
return dr->read(dr, buf, size);
}
public:
ncnn_datareader_t dr;
};
#if NCNN_STRING
static int __ncnn_DataReaderFromStdio_scan(ncnn_datareader_t dr, const char* format, void* p)
{
return ((ncnn::DataReaderFromStdio*)dr->pthis)->ncnn::DataReaderFromStdio::scan(format, p);
}
#endif /* NCNN_STRING */
static size_t __ncnn_DataReaderFromStdio_read(ncnn_datareader_t dr, void* buf, size_t size)
{
return ((ncnn::DataReaderFromStdio*)dr->pthis)->ncnn::DataReaderFromStdio::read(buf, size);
}
#endif /* NCNN_STDIO */
class DataReaderFromMemory_c_api : public ncnn::DataReaderFromMemory
{
public:
DataReaderFromMemory_c_api(const unsigned char*& mem, ncnn_datareader_t _dr)
: ncnn::DataReaderFromMemory(mem)
{
dr = _dr;
}
#if NCNN_STRING
virtual int scan(const char* format, void* p) const
{
return dr->scan(dr, format, p);
}
#endif /* NCNN_STRING */
virtual size_t read(void* buf, size_t size) const
{
return dr->read(dr, buf, size);
}
public:
ncnn_datareader_t dr;
};
#if NCNN_STRING
static int __ncnn_DataReaderFromMemory_scan(ncnn_datareader_t dr, const char* format, void* p)
{
return ((ncnn::DataReaderFromMemory*)dr->pthis)->ncnn::DataReaderFromMemory::scan(format, p);
}
#endif /* NCNN_STRING */
static size_t __ncnn_DataReaderFromMemory_read(ncnn_datareader_t dr, void* buf, size_t size)
{
return ((ncnn::DataReaderFromMemory*)dr->pthis)->ncnn::DataReaderFromMemory::read(buf, size);
}
ncnn_datareader_t ncnn_datareader_create()
{
ncnn_datareader_t dr = (ncnn_datareader_t)malloc(sizeof(struct __ncnn_datareader_t));
dr->pthis = (void*)(new DataReader_c_api(dr));
#if NCNN_STRING
dr->scan = __ncnn_DataReader_scan;
#endif /* NCNN_STRING */
dr->read = __ncnn_DataReader_read;
return dr;
}
#if NCNN_STDIO
ncnn_datareader_t ncnn_datareader_create_from_stdio(FILE* fp)
{
ncnn_datareader_t dr = (ncnn_datareader_t)malloc(sizeof(struct __ncnn_datareader_t));
dr->pthis = (void*)(new DataReaderFromStdio_c_api(fp, dr));
#if NCNN_STRING
dr->scan = __ncnn_DataReaderFromStdio_scan;
#endif /* NCNN_STRING */
dr->read = __ncnn_DataReaderFromStdio_read;
return dr;
}
#endif /* NCNN_STDIO */
ncnn_datareader_t ncnn_datareader_create_from_memory(const unsigned char** mem)
{
ncnn_datareader_t dr = (ncnn_datareader_t)malloc(sizeof(struct __ncnn_datareader_t));
dr->pthis = (void*)(new DataReaderFromMemory_c_api(*mem, dr));
#if NCNN_STRING
dr->scan = __ncnn_DataReaderFromMemory_scan;
#endif /* NCNN_STRING */
dr->read = __ncnn_DataReaderFromMemory_read;
return dr;
}
void ncnn_datareader_destroy(ncnn_datareader_t dr)
{
delete (DataReader*)dr->pthis;
free(dr);
}
/* modelbin api */
class ModelBinFromDataReader_c_api : public ncnn::ModelBinFromDataReader
{
public:
ModelBinFromDataReader_c_api(ncnn_modelbin_t _mb, const DataReader& dr)
: ncnn::ModelBinFromDataReader(dr)
{
mb = _mb;
}
virtual Mat load(int w, int type) const
{
ncnn_mat_t m = mb->load_1d(mb, w, type);
Mat m2 = *(Mat*)m;
ncnn_mat_destroy(m);
return m2;
}
virtual Mat load(int w, int h, int type) const
{
ncnn_mat_t m = mb->load_2d(mb, w, h, type);
Mat m2 = *(Mat*)m;
ncnn_mat_destroy(m);
return m2;
}
virtual Mat load(int w, int h, int c, int type) const
{
ncnn_mat_t m = mb->load_3d(mb, w, h, c, type);
Mat m2 = *(Mat*)m;
ncnn_mat_destroy(m);
return m2;
}
public:
ncnn_modelbin_t mb;
};
static ncnn_mat_t __ncnn_ModelBinFromDataReader_load_1d(const ncnn_modelbin_t mb, int w, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBinFromDataReader*)mb->pthis)->ncnn::ModelBinFromDataReader::load(w, type)));
}
static ncnn_mat_t __ncnn_ModelBinFromDataReader_load_2d(const ncnn_modelbin_t mb, int w, int h, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBinFromDataReader*)mb->pthis)->ncnn::ModelBin::load(w, h, type)));
}
static ncnn_mat_t __ncnn_ModelBinFromDataReader_load_3d(const ncnn_modelbin_t mb, int w, int h, int c, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBinFromDataReader*)mb->pthis)->ncnn::ModelBin::load(w, h, c, type)));
}
class ModelBinFromMatArray_c_api : public ncnn::ModelBinFromMatArray
{
public:
ModelBinFromMatArray_c_api(ncnn_modelbin_t _mb, const Mat* weights)
: ncnn::ModelBinFromMatArray(weights)
{
mb = _mb;
}
virtual Mat load(int w, int type) const
{
ncnn_mat_t m = mb->load_1d(mb, w, type);
Mat m2 = *(Mat*)m;
ncnn_mat_destroy(m);
return m2;
}
virtual Mat load(int w, int h, int type) const
{
ncnn_mat_t m = mb->load_2d(mb, w, h, type);
Mat m2 = *(Mat*)m;
ncnn_mat_destroy(m);
return m2;
}
virtual Mat load(int w, int h, int c, int type) const
{
ncnn_mat_t m = mb->load_3d(mb, w, h, c, type);
Mat m2 = *(Mat*)m;
ncnn_mat_destroy(m);
return m2;
}
public:
ncnn_modelbin_t mb;
};
static ncnn_mat_t __ncnn_ModelBinFromMatArray_load_1d(const ncnn_modelbin_t mb, int w, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBinFromMatArray*)mb->pthis)->ncnn::ModelBinFromMatArray::load(w, type)));
}
static ncnn_mat_t __ncnn_ModelBinFromMatArray_load_2d(const ncnn_modelbin_t mb, int w, int h, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBinFromMatArray*)mb->pthis)->ncnn::ModelBin::load(w, h, type)));
}
static ncnn_mat_t __ncnn_ModelBinFromMatArray_load_3d(const ncnn_modelbin_t mb, int w, int h, int c, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBinFromMatArray*)mb->pthis)->ncnn::ModelBin::load(w, h, c, type)));
}
ncnn_modelbin_t ncnn_modelbin_create_from_datareader(const ncnn_datareader_t dr)
{
ncnn_modelbin_t mb = (ncnn_modelbin_t)malloc(sizeof(struct __ncnn_modelbin_t));
mb->pthis = (void*)(new ModelBinFromDataReader_c_api(mb, *(const DataReader*)dr->pthis));
mb->load_1d = __ncnn_ModelBinFromDataReader_load_1d;
mb->load_2d = __ncnn_ModelBinFromDataReader_load_2d;
mb->load_3d = __ncnn_ModelBinFromDataReader_load_3d;
return mb;
}
ncnn_modelbin_t ncnn_modelbin_create_from_mat_array(const ncnn_mat_t* weights, int n)
{
std::vector<Mat> matarray(n);
for (int i = 0; i < n; i++)
{
matarray[i] = *(const Mat*)weights[i];
}
ncnn_modelbin_t mb = (ncnn_modelbin_t)malloc(sizeof(struct __ncnn_modelbin_t));
mb->pthis = (void*)(new ModelBinFromMatArray_c_api(mb, &matarray[0]));
mb->load_1d = __ncnn_ModelBinFromMatArray_load_1d;
mb->load_2d = __ncnn_ModelBinFromMatArray_load_2d;
mb->load_3d = __ncnn_ModelBinFromMatArray_load_3d;
return mb;
}
void ncnn_modelbin_destroy(ncnn_modelbin_t mb)
{
delete (ModelBin*)mb->pthis;
free(mb);
}
static ncnn_mat_t __ncnn_modelbin_load_1d(const ncnn_modelbin_t mb, int w, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBin*)mb->pthis)->load(w, type)));
}
static ncnn_mat_t __ncnn_modelbin_load_2d(const ncnn_modelbin_t mb, int w, int h, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBin*)mb->pthis)->load(w, h, type)));
}
static ncnn_mat_t __ncnn_modelbin_load_3d(const ncnn_modelbin_t mb, int w, int h, int c, int type)
{
return (ncnn_mat_t)(new Mat(((const ncnn::ModelBin*)mb->pthis)->load(w, h, c, type)));
}
/* layer api */
class Layer_c_api : public Layer
{
public:
Layer_c_api(ncnn_layer_t _layer)
: Layer()
{
layer = _layer;
}
virtual int load_param(const ParamDict& pd)
{
return layer->load_param(layer, (ncnn_paramdict_t)&pd);
}
virtual int load_model(const ModelBin& mb)
{
struct __ncnn_modelbin_t mb0;
mb0.pthis = (void*)&mb;
mb0.load_1d = __ncnn_modelbin_load_1d;
mb0.load_2d = __ncnn_modelbin_load_2d;
mb0.load_3d = __ncnn_modelbin_load_3d;
return layer->load_model(layer, &mb0);
}
virtual int create_pipeline(const Option& opt)
{
return layer->create_pipeline(layer, (ncnn_option_t)&opt);
}
virtual int destroy_pipeline(const Option& opt)
{
return layer->destroy_pipeline(layer, (ncnn_option_t)&opt);
}
virtual int forward(const std::vector<Mat>& bottom_blobs, std::vector<Mat>& top_blobs, const Option& opt) const
{
const int n = bottom_blobs.size();
const int n2 = top_blobs.size();
std::vector<ncnn_mat_t> bottom_blobs0(n);
for (int i = 0; i < n; i++)
{
bottom_blobs0[i] = (ncnn_mat_t)&bottom_blobs[i];
}
std::vector<ncnn_mat_t*> top_blobs0(n2, (ncnn_mat_t*)0);
int ret = layer->forward_n(layer, bottom_blobs0.data(), n, top_blobs0.data(), n2, (ncnn_option_t)&opt);
for (int i = 0; i < n2; i++)
{
top_blobs[i] = *(Mat*)*top_blobs0[i];
ncnn_mat_destroy(*top_blobs0[i]);
}
return ret;
}
virtual int forward(const Mat& bottom_blob, Mat& top_blob, const Option& opt) const
{
ncnn_mat_t top_blob0 = 0;
int ret = layer->forward_1(layer, (ncnn_mat_t)&bottom_blob, &top_blob0, (ncnn_option_t)&opt);
top_blob = *(Mat*)top_blob0;
ncnn_mat_destroy(top_blob0);
return ret;
}
virtual int forward_inplace(std::vector<Mat>& bottom_top_blobs, const Option& opt) const
{
const int n = bottom_top_blobs.size();
std::vector<ncnn_mat_t> bottom_top_blobs0(n);
for (int i = 0; i < n; i++)
{
bottom_top_blobs0[i] = (ncnn_mat_t)&bottom_top_blobs[i];
}
return layer->forward_inplace_n(layer, bottom_top_blobs0.data(), n, (ncnn_option_t)&opt);
}
virtual int forward_inplace(Mat& bottom_top_blob, const Option& opt) const
{
return layer->forward_inplace_1(layer, (ncnn_mat_t)&bottom_top_blob, (ncnn_option_t)&opt);
}
public:
ncnn_layer_t layer;
};
static int __ncnn_Layer_load_param(ncnn_layer_t layer, const ncnn_paramdict_t pd)
{
return ((Layer*)layer->pthis)->Layer::load_param(*(const ParamDict*)pd);
}
static int __ncnn_Layer_load_model(ncnn_layer_t layer, const ncnn_modelbin_t mb)
{
return ((Layer*)layer->pthis)->Layer::load_model(*(const ModelBin*)mb);
}
static int __ncnn_Layer_create_pipeline(ncnn_layer_t layer, const ncnn_option_t opt)
{
return ((Layer*)layer->pthis)->Layer::create_pipeline(*(const Option*)opt);
}
static int __ncnn_Layer_destroy_pipeline(ncnn_layer_t layer, const ncnn_option_t opt)
{
return ((Layer*)layer->pthis)->Layer::destroy_pipeline(*(const Option*)opt);
}
static int __ncnn_Layer_forward_1(const ncnn_layer_t layer, const ncnn_mat_t bottom_blob, ncnn_mat_t* top_blob, const ncnn_option_t opt)
{
Mat _top_blob;
int ret = ((const Layer*)layer->pthis)->Layer::forward(*(const Mat*)bottom_blob, _top_blob, *(const Option*)opt);
*top_blob = (ncnn_mat_t)(new Mat(_top_blob));
return ret;
}
static int __ncnn_Layer_forward_n(const ncnn_layer_t layer, const ncnn_mat_t* bottom_blobs, int n, ncnn_mat_t** top_blobs, int n2, const ncnn_option_t opt)
{
std::vector<Mat> _bottom_blobs(n);
std::vector<Mat> _top_blobs(n2);
for (int i = 0; i < n; i++)
{
_bottom_blobs[i] = *(Mat*)bottom_blobs[i];
}
int ret = ((const Layer*)layer->pthis)->Layer::forward(_bottom_blobs, _top_blobs, *(const Option*)opt);
for (int i = 0; i < n2; i++)
{
*top_blobs[i] = (ncnn_mat_t)(new Mat(_top_blobs[i]));
}
return ret;
}
static int __ncnn_Layer_forward_inplace_1(const ncnn_layer_t layer, ncnn_mat_t bottom_top_blob, const ncnn_option_t opt)
{
return ((const Layer*)layer->pthis)->Layer::forward_inplace(*(Mat*)bottom_top_blob, *(const Option*)opt);
}
static int __ncnn_Layer_forward_inplace_n(const ncnn_layer_t layer, ncnn_mat_t* bottom_top_blobs, int n, const ncnn_option_t opt)
{
std::vector<Mat> _bottom_top_blobs(n);
for (int i = 0; i < n; i++)
{
_bottom_top_blobs[i] = *(Mat*)bottom_top_blobs[i];
}
return ((const Layer*)layer->pthis)->Layer::forward_inplace(_bottom_top_blobs, *(const Option*)opt);
}
static int __ncnn_layer_load_param(ncnn_layer_t layer, const ncnn_paramdict_t pd)
{
return ((Layer*)layer->pthis)->load_param(*(const ParamDict*)pd);
}
static int __ncnn_layer_load_model(ncnn_layer_t layer, const ncnn_modelbin_t mb)
{
return ((Layer*)layer->pthis)->load_model(*(const ModelBin*)mb);
}
static int __ncnn_layer_create_pipeline(ncnn_layer_t layer, const ncnn_option_t opt)
{
return ((Layer*)layer->pthis)->create_pipeline(*(const Option*)opt);
}
static int __ncnn_layer_destroy_pipeline(ncnn_layer_t layer, const ncnn_option_t opt)
{
return ((Layer*)layer->pthis)->destroy_pipeline(*(const Option*)opt);
}
static int __ncnn_layer_forward_1(const ncnn_layer_t layer, const ncnn_mat_t bottom_blob, ncnn_mat_t* top_blob, const ncnn_option_t opt)
{
Mat _top_blob;
int ret = ((const Layer*)layer->pthis)->forward(*(const Mat*)bottom_blob, _top_blob, *(const Option*)opt);
*top_blob = (ncnn_mat_t)(new Mat(_top_blob));
return ret;
}
static int __ncnn_layer_forward_n(const ncnn_layer_t layer, const ncnn_mat_t* bottom_blobs, int n, ncnn_mat_t** top_blobs, int n2, const ncnn_option_t opt)
{
std::vector<Mat> _bottom_blobs(n);
std::vector<Mat> _top_blobs(n2);
for (int i = 0; i < n; i++)
{
_bottom_blobs[i] = *(Mat*)bottom_blobs[i];
}
int ret = ((const Layer*)layer->pthis)->forward(_bottom_blobs, _top_blobs, *(const Option*)opt);
for (int i = 0; i < n2; i++)
{
*top_blobs[i] = (ncnn_mat_t)(new Mat(_top_blobs[i]));
}
return ret;
}
static int __ncnn_layer_forward_inplace_1(const ncnn_layer_t layer, ncnn_mat_t bottom_top_blob, const ncnn_option_t opt)
{
return ((const Layer*)layer->pthis)->forward_inplace(*(Mat*)bottom_top_blob, *(const Option*)opt);
}
static int __ncnn_layer_forward_inplace_n(const ncnn_layer_t layer, ncnn_mat_t* bottom_top_blobs, int n, const ncnn_option_t opt)
{
std::vector<Mat> _bottom_top_blobs(n);
for (int i = 0; i < n; i++)
{
_bottom_top_blobs[i] = *(Mat*)bottom_top_blobs[i];
}
return ((const Layer*)layer->pthis)->forward_inplace(_bottom_top_blobs, *(const Option*)opt);
}
ncnn_layer_t ncnn_layer_create()
{
ncnn_layer_t layer = (ncnn_layer_t)malloc(sizeof(__ncnn_layer_t));
layer->pthis = (void*)(new Layer_c_api(layer));
layer->load_param = __ncnn_Layer_load_param;
layer->load_model = __ncnn_Layer_load_model;
layer->create_pipeline = __ncnn_Layer_create_pipeline;
layer->destroy_pipeline = __ncnn_Layer_destroy_pipeline;
layer->forward_1 = __ncnn_Layer_forward_1;
layer->forward_n = __ncnn_Layer_forward_n;
layer->forward_inplace_1 = __ncnn_Layer_forward_inplace_1;
layer->forward_inplace_n = __ncnn_Layer_forward_inplace_n;
return layer;
}
ncnn_layer_t ncnn_layer_create_by_typeindex(int typeindex)
{
ncnn_layer_t layer = (ncnn_layer_t)malloc(sizeof(__ncnn_layer_t));
layer->pthis = (void*)(ncnn::create_layer(typeindex));
layer->load_param = __ncnn_layer_load_param;
layer->load_model = __ncnn_layer_load_model;
layer->create_pipeline = __ncnn_layer_create_pipeline;
layer->destroy_pipeline = __ncnn_layer_destroy_pipeline;
layer->forward_1 = __ncnn_layer_forward_1;
layer->forward_n = __ncnn_layer_forward_n;
layer->forward_inplace_1 = __ncnn_layer_forward_inplace_1;
layer->forward_inplace_n = __ncnn_layer_forward_inplace_n;
return layer;
}
#if NCNN_STRING
ncnn_layer_t ncnn_layer_create_by_type(const char* type)
{
ncnn_layer_t layer = (ncnn_layer_t)malloc(sizeof(__ncnn_layer_t));
layer->pthis = (void*)(ncnn::create_layer(type));
layer->load_param = __ncnn_layer_load_param;
layer->load_model = __ncnn_layer_load_model;
layer->create_pipeline = __ncnn_layer_create_pipeline;
layer->destroy_pipeline = __ncnn_layer_destroy_pipeline;
layer->forward_1 = __ncnn_layer_forward_1;
layer->forward_n = __ncnn_layer_forward_n;
layer->forward_inplace_1 = __ncnn_layer_forward_inplace_1;
layer->forward_inplace_n = __ncnn_layer_forward_inplace_n;
return layer;
}
#endif /* NCNN_STRING */
void ncnn_layer_destroy(ncnn_layer_t layer)
{
delete (Layer*)layer->pthis;
free(layer);
}
#if NCNN_STRING
const char* ncnn_layer_get_name(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->name.c_str();
}
#endif /* NCNN_STRING */
int ncnn_layer_get_typeindex(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->typeindex;
}
#if NCNN_STRING
const char* ncnn_layer_get_type(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->type.c_str();
}
#endif /* NCNN_STRING */
int ncnn_layer_get_one_blob_only(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->one_blob_only;
}
int ncnn_layer_get_support_inplace(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->support_inplace;
}
int ncnn_layer_get_support_vulkan(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->support_vulkan;
}
int ncnn_layer_get_support_packing(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->support_packing;
}
int ncnn_layer_get_support_bf16_storage(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->support_bf16_storage;
}
int ncnn_layer_get_support_fp16_storage(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->support_fp16_storage;
}
int ncnn_layer_get_support_image_storage(const ncnn_layer_t layer)
{
return ((const Layer*)layer->pthis)->support_image_storage;
}
void ncnn_layer_set_one_blob_only(ncnn_layer_t layer, int enable)
{
((Layer*)layer->pthis)->one_blob_only = enable;
}
void ncnn_layer_set_support_inplace(ncnn_layer_t layer, int enable)
{
((Layer*)layer->pthis)->support_inplace = enable;
}
void ncnn_layer_set_support_vulkan(ncnn_layer_t layer, int enable)
{
((Layer*)layer->pthis)->support_vulkan = enable;
}
void ncnn_layer_set_support_packing(ncnn_layer_t layer, int enable)
{
((Layer*)layer->pthis)->support_packing = enable;
}
void ncnn_layer_set_support_bf16_storage(ncnn_layer_t layer, int enable)
{
((Layer*)layer->pthis)->support_bf16_storage = enable;
}
void ncnn_layer_set_support_fp16_storage(ncnn_layer_t layer, int enable)
{
((Layer*)layer->pthis)->support_fp16_storage = enable;
}
void ncnn_layer_set_support_image_storage(ncnn_layer_t layer, int enable)
{
((Layer*)layer->pthis)->support_image_storage = enable;
}
int ncnn_layer_get_bottom_count(const ncnn_layer_t layer)
{
return (int)((const Layer*)layer->pthis)->bottoms.size();
}
int ncnn_layer_get_bottom(const ncnn_layer_t layer, int i)
{
return ((const Layer*)layer->pthis)->bottoms[i];
}
int ncnn_layer_get_top_count(const ncnn_layer_t layer)
{
return (int)((const Layer*)layer->pthis)->tops.size();
}
int ncnn_layer_get_top(const ncnn_layer_t layer, int i)
{
return ((const Layer*)layer->pthis)->tops[i];
}
void ncnn_blob_get_bottom_shape(const ncnn_layer_t layer, int i, int* dims, int* w, int* h, int* c)
{
const Mat& shape = ((const Layer*)layer->pthis)->bottom_shapes[i];
*dims = shape.dims;
*w = shape.w;
*h = shape.h;
*c = shape.c;
}
void ncnn_blob_get_top_shape(const ncnn_layer_t layer, int i, int* dims, int* w, int* h, int* c)
{
const Mat& shape = ((const Layer*)layer->pthis)->top_shapes[i];
*dims = shape.dims;
*w = shape.w;
*h = shape.h;
*c = shape.c;
}
/* net api */
ncnn_net_t ncnn_net_create()
{
ncnn_net_t net = (ncnn_net_t)malloc(sizeof(struct __ncnn_net_t));
net->pthis = (void*)(new Net());
net->custom_layer_factory = 0;
return net;
}
void ncnn_net_destroy(ncnn_net_t net)
{
delete (Net*)net->pthis;
ncnn_net_custom_layer_factory_t ud = net->custom_layer_factory;
while (ud)
{
ncnn_net_custom_layer_factory_t ud_next = ud->next;
free(ud);
ud = ud_next;
}
free(net);
}
void ncnn_net_set_option(ncnn_net_t net, ncnn_option_t opt)
{
((Net*)net->pthis)->opt = *((Option*)opt);
}
static ::ncnn::Layer* __Layer_c_api_layer_creator(void* userdata)
{
ncnn_net_custom_layer_factory_t ud = (ncnn_net_custom_layer_factory_t)userdata;
ncnn_layer_t layer0 = ud->creator(ud->userdata);
::ncnn::Layer* layer = (::ncnn::Layer*)layer0->pthis;
layer->userdata = (void*)layer0;
layer->one_blob_only = ncnn_layer_get_one_blob_only(layer0);
layer->support_inplace = ncnn_layer_get_support_inplace(layer0);
layer->support_vulkan = ncnn_layer_get_support_vulkan(layer0);
layer->support_packing = ncnn_layer_get_support_packing(layer0);
layer->support_bf16_storage = ncnn_layer_get_support_bf16_storage(layer0);
layer->support_fp16_storage = ncnn_layer_get_support_fp16_storage(layer0);
layer->support_image_storage = ncnn_layer_get_support_image_storage(layer0);
return layer;
}
static void __Layer_c_api_layer_destroyer(::ncnn::Layer* layer, void* userdata)
{
ncnn_net_custom_layer_factory_t ud = (ncnn_net_custom_layer_factory_t)userdata;
ncnn_layer_t layer0 = (ncnn_layer_t)layer->userdata;
ud->destroyer(layer0, ud->userdata);
}
#if NCNN_STRING
void ncnn_net_register_custom_layer_by_type(ncnn_net_t net, const char* type, ncnn_layer_creator_t creator, ncnn_layer_destroyer_t destroyer, void* userdata)
{
ncnn_net_custom_layer_factory_t ud = (ncnn_net_custom_layer_factory_t)malloc(sizeof(struct __ncnn_net_custom_layer_factory_t));
ud->creator = creator;
ud->destroyer = destroyer;
ud->userdata = userdata;
ud->next = net->custom_layer_factory;
net->custom_layer_factory = ud;
((Net*)net->pthis)->register_custom_layer(type, __Layer_c_api_layer_creator, __Layer_c_api_layer_destroyer, (void*)ud);
}
#endif /* NCNN_STRING */
void ncnn_net_register_custom_layer_by_typeindex(ncnn_net_t net, int typeindex, ncnn_layer_creator_t creator, ncnn_layer_destroyer_t destroyer, void* userdata)
{
ncnn_net_custom_layer_factory_t ud = (ncnn_net_custom_layer_factory_t)malloc(sizeof(struct __ncnn_net_custom_layer_factory_t));
ud->creator = creator;
ud->destroyer = destroyer;
ud->userdata = userdata;
ud->next = net->custom_layer_factory;
net->custom_layer_factory = ud;
((Net*)net->pthis)->register_custom_layer(typeindex, __Layer_c_api_layer_creator, __Layer_c_api_layer_destroyer, (void*)ud);
}
#if NCNN_STDIO
#if NCNN_STRING
int ncnn_net_load_param(ncnn_net_t net, const char* path)
{
return ((Net*)net->pthis)->load_param(path);
}
#endif /* NCNN_STRING */
int ncnn_net_load_param_bin(ncnn_net_t net, const char* path)
{
return ((Net*)net->pthis)->load_param_bin(path);
}
int ncnn_net_load_model(ncnn_net_t net, const char* path)
{
return ((Net*)net->pthis)->load_model(path);
}
#endif /* NCNN_STDIO */
#if NCNN_STDIO
#if NCNN_STRING
int ncnn_net_load_param_memory(ncnn_net_t net, const char* mem)
{
return ((Net*)net->pthis)->load_param_mem(mem);
}
#endif /* NCNN_STRING */
#endif /* NCNN_STDIO */
int ncnn_net_load_param_bin_memory(ncnn_net_t net, const unsigned char* mem)
{
return ((Net*)net->pthis)->load_param(mem);
}
int ncnn_net_load_model_memory(ncnn_net_t net, const unsigned char* mem)
{
return ((Net*)net->pthis)->load_model(mem);
}
#if NCNN_STRING
int ncnn_net_load_param_datareader(ncnn_net_t net, const ncnn_datareader_t dr)
{
return ((Net*)net->pthis)->load_param(*(const DataReader*)dr->pthis);
}
#endif /* NCNN_STRING */
int ncnn_net_load_param_bin_datareader(ncnn_net_t net, const ncnn_datareader_t dr)
{
return ((Net*)net->pthis)->load_param_bin(*(const DataReader*)dr->pthis);
}
int ncnn_net_load_model_datareader(ncnn_net_t net, const ncnn_datareader_t dr)
{
return ((Net*)net->pthis)->load_model(*(const DataReader*)dr->pthis);
}
void ncnn_net_clear(ncnn_net_t net)
{
return ((Net*)net->pthis)->clear();
}
/* extractor api */
ncnn_extractor_t ncnn_extractor_create(ncnn_net_t net)
{
return (ncnn_extractor_t)(new Extractor(((Net*)net->pthis)->create_extractor()));
}
void ncnn_extractor_destroy(ncnn_extractor_t ex)
{
delete (Extractor*)ex;
}
void ncnn_extractor_set_option(ncnn_extractor_t ex, const ncnn_option_t opt)
{
((Extractor*)ex)->set_num_threads(((const Option*)opt)->num_threads);
#if NCNN_VULKAN
((Extractor*)ex)->set_vulkan_compute(((const Option*)opt)->use_vulkan_compute);
#endif
}
#if NCNN_STRING
int ncnn_extractor_input(ncnn_extractor_t ex, const char* name, const ncnn_mat_t mat)
{
return ((Extractor*)ex)->input(name, *((const Mat*)mat));
}
int ncnn_extractor_extract(ncnn_extractor_t ex, const char* name, ncnn_mat_t* mat)
{
Mat mat0;
int ret = ((Extractor*)ex)->extract(name, mat0);
*mat = (ncnn_mat_t)(new Mat(mat0));
return ret;
}
#endif /* NCNN_STRING */
int ncnn_extractor_input_index(ncnn_extractor_t ex, int index, const ncnn_mat_t mat)
{
return ((Extractor*)ex)->input(index, *((const Mat*)mat));
}
int ncnn_extractor_extract_index(ncnn_extractor_t ex, int index, ncnn_mat_t* mat)
{
Mat mat0;
int ret = ((Extractor*)ex)->extract(index, mat0);
*mat = (ncnn_mat_t)(new Mat(mat0));
return ret;
}
#ifdef __cplusplus
} /* extern "C" */
#endif
| 30.82644 | 213 | 0.693524 | CeasarLee |
2850c0eae061788bfa30aca160c646fe449210d2 | 6,781 | cc | C++ | braids/bootloader/bootloader.cc | oscillating-gate/eurorack | 35bf03aa35b01a7a4a9b0a0ca2898677cd3a9f6a | [
"MIT"
] | 233 | 2018-07-02T16:49:36.000Z | 2022-02-27T21:45:39.000Z | braids/bootloader/bootloader.cc | oscillating-gate/eurorack | 35bf03aa35b01a7a4a9b0a0ca2898677cd3a9f6a | [
"MIT"
] | 24 | 2018-07-09T11:32:15.000Z | 2022-01-07T01:45:43.000Z | braids/bootloader/bootloader.cc | oscillating-gate/eurorack | 35bf03aa35b01a7a4a9b0a0ca2898677cd3a9f6a | [
"MIT"
] | 24 | 2018-07-14T21:55:30.000Z | 2021-05-04T04:20:34.000Z | // Copyright 2012 Olivier Gillet.
//
// Author: Olivier Gillet (ol.gillet@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// See http://creativecommons.org/licenses/MIT/ for more information.
#include <stm32f10x_conf.h>
#include <string.h>
#include "stmlib/utils/dsp.h"
#include "stmlib/utils/ring_buffer.h"
#include "stmlib/system/bootloader_utils.h"
#include "stmlib/system/flash_programming.h"
#include "stmlib/system/system_clock.h"
#include "stm_audio_bootloader/qpsk/packet_decoder.h"
#include "stm_audio_bootloader/qpsk/demodulator.h"
#include "braids/drivers/adc.h"
#include "braids/drivers/display.h"
#include "braids/drivers/encoder.h"
#include "braids/drivers/system.h"
using namespace braids;
using namespace stmlib;
using namespace stm_audio_bootloader;
const double kSampleRate = 48000.0;
const double kModulationRate = 6000.0;
const double kBitRate = 12000.0;
const uint32_t kStartAddress = 0x08004000;
Adc adc;
System sys;
Display display;
Encoder encoder;
PacketDecoder decoder;
Demodulator demodulator;
extern "C" {
void HardFault_Handler(void) { while (1); }
void MemManage_Handler(void) { while (1); }
void BusFault_Handler(void) { while (1); }
void UsageFault_Handler(void) { while (1); }
void NMI_Handler(void) { }
void SVC_Handler(void) { }
void DebugMon_Handler(void) { }
void PendSV_Handler(void) { }
}
extern "C" {
volatile uint8_t packet_inspector_byte = 0;
volatile bool encoder_released = false;
void SysTick_Handler() {
system_clock.Tick(); // Tick global ms counter.
encoder.Debounce();
encoder_released = encoder_released | encoder.released();
packet_inspector_byte += encoder.increment();
uint32_t ms_clock = system_clock.milliseconds();
if ((ms_clock & 0x3f) == 0 && display.mutable_buffer()[0] >= '\x98') {
display.mutable_buffer()[0] = '\x98' + ((ms_clock >> 6) & 7);
}
display.Refresh();
}
uint16_t discard_samples = 8000;
void TIM1_UP_IRQHandler(void) {
if (TIM_GetITStatus(TIM1, TIM_IT_Update) == RESET) {
return;
}
TIM_ClearITPendingBit(TIM1, TIM_IT_Update);
if (adc.PipelinedRead(3)) {
if (!discard_samples) {
int16_t sample = adc.channel(3);
demodulator.PushSample(sample);
} else {
--discard_samples;
}
}
}
}
static uint32_t current_address;
static uint16_t packet_index;
void ProgramPage(const uint8_t* data, size_t size) {
FLASH_Unlock();
FLASH_ErasePage(current_address);
const uint32_t* words = static_cast<const uint32_t*>(
static_cast<const void*>(data));
for (size_t written = 0; written < size; written += 4) {
FLASH_ProgramWord(current_address, *words++);
current_address += 4;
}
}
void PrintPageNumber(uint16_t page_number, bool error) {
char string[5];
string[0] = '\x98';
string[1] = error ? 'X' : '0' + page_number / 100;
string[2] = '0' + (page_number / 10) % 10;
string[3] = '0' + page_number % 10;
string[4] = '\0';
display.Print(string);
}
const char kHexChar[] = "0123456789ABCDEF";
void PacketInspector() {
while (1) {
char string[5];
string[0] = kHexChar[packet_inspector_byte >> 4];
string[1] = kHexChar[packet_inspector_byte & 0xf];
string[2] = kHexChar[decoder.packet_data()[packet_inspector_byte] >> 4];
string[3] = kHexChar[decoder.packet_data()[packet_inspector_byte] & 0xf];
string[4] = '\0';
display.Print(string);
}
}
void Init() {
sys.Init(F_CPU / (3 * kSampleRate) - 1, false);
system_clock.Init();
adc.Init(3 * kSampleRate > 96000);
encoder.Init();
display.Init();
sys.StartTimers();
}
void InitializeReception() {
decoder.Init();
demodulator.Init(
kModulationRate / kSampleRate * 4294967296.0,
kSampleRate / kModulationRate,
2.0 * kSampleRate / kBitRate);
demodulator.SyncCarrier(true);
decoder.Reset();
current_address = kStartAddress;
packet_index = 0;
display.Print("\x98RDY");
}
uint8_t rx_buffer[PAGE_SIZE];
const uint16_t kPacketsPerPage = PAGE_SIZE / kPacketSize;
const char* kErrorStrings[2] = { "@SYN", "@CRC", };
int main(void) {
Init();
InitializeReception();
bool exit_updater = !encoder.pressed_immediate();
while (!exit_updater) {
bool error = false;
if (demodulator.state() == DEMODULATOR_STATE_OVERFLOW) {
display.Print("@OVF");
error = true;
} else {
demodulator.ProcessAtLeast(32);
}
while (demodulator.available() && !error && !exit_updater) {
uint8_t symbol = demodulator.NextSymbol();
PacketDecoderState state = decoder.ProcessSymbol(symbol);
switch (state) {
case PACKET_DECODER_STATE_OK:
{
memcpy(
rx_buffer + (packet_index % kPacketsPerPage) * kPacketSize,
decoder.packet_data(),
kPacketSize);
++packet_index;
if ((packet_index % kPacketsPerPage) == 0) {
PrintPageNumber(packet_index / kPacketsPerPage, false);
ProgramPage(rx_buffer, PAGE_SIZE);
decoder.Reset();
demodulator.SyncCarrier(false);
} else {
decoder.Reset();
demodulator.SyncDecision();
}
}
break;
case PACKET_DECODER_STATE_ERROR_SYNC:
case PACKET_DECODER_STATE_ERROR_CRC:
display.Print(kErrorStrings[state - PACKET_DECODER_STATE_ERROR_SYNC]);
error = true;
break;
case PACKET_DECODER_STATE_END_OF_TRANSMISSION:
exit_updater = true;
break;
default:
break;
}
}
if (error) {
encoder_released = false;
while (!encoder_released); // Polled in ISR
InitializeReception();
}
}
Uninitialize();
JumpTo(kStartAddress);
while (1) { }
}
| 29.228448 | 80 | 0.678366 | oscillating-gate |
2851066a59f4a88f719e716db8305634c35abe53 | 35,009 | cpp | C++ | visa/G4Verifier.cpp | scott-snyder/intel-graphics-compiler | 0977554d5aecf93b4a777f38e6c2e73e4dea313e | [
"MIT"
] | null | null | null | visa/G4Verifier.cpp | scott-snyder/intel-graphics-compiler | 0977554d5aecf93b4a777f38e6c2e73e4dea313e | [
"MIT"
] | null | null | null | visa/G4Verifier.cpp | scott-snyder/intel-graphics-compiler | 0977554d5aecf93b4a777f38e6c2e73e4dea313e | [
"MIT"
] | null | null | null | /*===================== begin_copyright_notice ==================================
Copyright (c) 2017 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
======================= end_copyright_notice ==================================*/
#include "G4Verifier.h"
using namespace vISA;
void verifyG4Kernel(G4_Kernel &k, Optimizer::PassIndex index, bool alwaysOn, G4Verifier::VerifyControl ctrl)
{
if (alwaysOn || k.fg.builder->getOption(VISA_FullIRVerify))
{
G4Verifier verifier(k, ctrl, index);
verifier.verify();
}
}
void verifyG4Inst(G4_Kernel &kernel, G4_INST *inst, Optimizer::PassIndex index)
{
G4Verifier verifier(kernel, G4Verifier::VC_ASSERT, index);
verifier.verifyInst(inst);
}
std::atomic<int> G4Verifier::index(0);
G4Verifier::G4Verifier(G4_Kernel &k, VerifyControl ctrl, Optimizer::PassIndex index)
: kernel(k), verifyCtrl(ctrl), passIndex(index)
{
if (ctrl == VC_AppendDump || ctrl == VC_NewDump)
{
const char* buf = nullptr;
k.getOptions()->getOption(VISA_AsmFileName, buf);
std::string dumpName;
if (buf != nullptr)
{
dumpName = std::string(buf);
}
dumpName += ".g4verify.dump.txt";
if (ctrl == VC_AppendDump)
dumpText.open(dumpName, std::ofstream::app);
else
dumpText.open(dumpName, std::ofstream::trunc);
}
}
void G4Verifier::verify()
{
// For each instruction do verification.
for (auto BBI = kernel.fg.cbegin(), BBE = kernel.fg.cend(); BBI != BBE; ++BBI)
{
auto bb = *BBI;
for (auto I = bb->begin(), E = bb->end(); I != E; ++I)
{
G4_INST *inst = *I;
verifyInst(inst);
}
}
}
bool G4Verifier::verifyInst(G4_INST *inst)
{
ASSERT_USER(inst != NULL, "null instruction upexpected");
verifyOpcode(inst);
verifyOpnd(inst->getDst(), inst);
verifyOpnd(inst->getSrc(0), inst);
verifyOpnd(inst->getSrc(1), inst);
verifyOpnd(inst->getSrc(2), inst);
verifyOpnd(inst->getPredicate(), inst);
verifyOpnd(inst->getCondMod(), inst);
verifyOpnd(inst->getImplAccDst(), inst);
verifyOpnd(inst->getImplAccSrc(), inst);
if (inst->isSend())
{
verifySend(inst);
}
verifyDstSrcOverlap(inst);
if (passIndex == Optimizer::PI_cleanMessageHeader ||
passIndex == Optimizer::PI_renameRegister ||
passIndex == Optimizer::PI_newLocalDefHoisting ||
passIndex == Optimizer::PI_newLocalCopyPropagation ||
passIndex == Optimizer::PI_splitVariables ||
passIndex == Optimizer::PI_cselPeepHoleOpt)
{
// def-use chain should be valid after these passes
return verifyDefUseChain(inst);
}
return true;
}
// Returns true if this use is defined by the defInst (dst, condMod, or acc)
// Otherwise returns false.
static bool checkDefUse(G4_INST* defInst, G4_Operand *use)
{
if (!use)
return false;
G4_Operand *dst = defInst->getOperand(Opnd_dst);
G4_Operand *condMod = defInst->getOperand(Opnd_condMod);
if (use->isAccReg())
{
// use is acc
// ToDo: we should check if acc is re-defined in between as well
if (defInst->getImplAccDst() != NULL || dst->isAccReg())
{
return true;
}
}
if (dst && Rel_disjoint != use->compareOperand(dst))
return true;
if (condMod && Rel_disjoint != use->compareOperand(condMod))
return true;
return false;
}
bool G4Verifier::verifyDefUseChain(G4_INST *inst)
{
bool isValid = true;
for (auto I = inst->use_begin(), E = inst->use_end(); I != E; ++I)
{
auto DU = *I;
// A valid def-use satisfies
//
// inst[dst/condMod] defines DU.first[DU.second]
//
G4_Operand *use = (DU.first)->getOperand(DU.second);
if (!checkDefUse(inst, use))
{
isValid = false;
printDefUse(inst, DU.first, DU.second);
assertIfEnable();
}
}
for (auto I = inst->def_begin(), E = inst->def_end(); I != E; ++I)
{
auto UD = *I;
// A valid use-def satisfies
//
// UD.first[dst/condMod] defines inst[UD.second]
//
G4_Operand *use = inst->getOperand(UD.second);
if (!checkDefUse(UD.first, use))
{
isValid = false;
printDefUse(UD.first, inst, UD.second);
assertIfEnable();
}
}
return isValid;
}
void G4Verifier::printDefUseImpl(std::ostream &os, G4_INST *def, G4_INST *use,
Gen4_Operand_Number pos)
{
os << "\n def: ";
def->emit(os);
os << "\n user: ";
use->emit(os);
os << "\n opnd: ";
use->getOperand(pos)->emit(os);
}
/// Dump or warn def-use.
void G4Verifier::printDefUse(G4_INST *def, G4_INST *use, Gen4_Operand_Number pos)
{
if (dumpText.is_open() && dumpText.good())
{
dumpText << "\n\nIndex: " << index++;
printDefUseImpl(dumpText, def, use, pos);
}
else if (verifyCtrl == VC_WARN)
{
std::cerr << "\n\nInvalid def-use pair detected!!\n";
printDefUseImpl(std::cerr, def, use, pos);
}
}
void G4Verifier::assertIfEnable() const
{
#ifdef _DEBUG
if (verifyCtrl == VC_ASSERT)
{
int *ptr = 0;
*ptr = 0;
}
#endif
}
bool G4Verifier::dataHazardCheck(G4_Operand *dst, G4_Operand *src)
{
G4_RegVar* dstVar = static_cast<G4_RegVar*>(dst->asDstRegRegion()->getBase());
G4_RegVar* srcVar = static_cast<G4_RegVar*>(src->asSrcRegRegion()->getBase());
if (!dstVar->isRegVar() || !dstVar->isGreg() || !srcVar->isRegVar() || !srcVar->isGreg())
{
return false;
}
int dstStart = dst->getLinearizedStart();
int dstEnd = dst->getLinearizedEnd();
int srcStart = src->getLinearizedStart();
int srcEnd = src->getLinearizedEnd();
if (dstEnd < srcStart ||
srcEnd < dstStart)
{
return false;
}
int dstReg = dstStart / GENX_GRF_REG_SIZ;
int dstRegNum = (dstEnd - dstStart + GENX_GRF_REG_SIZ) / GENX_GRF_REG_SIZ;
int srcReg = srcStart / GENX_GRF_REG_SIZ;
int srcRegNum = (srcEnd - srcStart + GENX_GRF_REG_SIZ) / GENX_GRF_REG_SIZ;
int srcReg2 = -1;
if (srcRegNum > 1)
{
srcReg2 = srcReg + 1;
}
if (dstRegNum >= 2 && srcRegNum == 1)
{
srcReg2 = srcReg;
}
if (dstReg == srcReg2)
{
return true;
}
return false;
}
void G4Verifier::verifyDstSrcOverlap(G4_INST* inst)
{
if (passIndex == Optimizer::PI_regAlloc && kernel.fg.builder->avoidDstSrcOverlap())
{
G4_DstRegRegion* dst = inst->getDst();
if (inst->isSend() || dst == NULL || dst->isNullReg() || inst->opcode() == G4_madm)
{
return;
}
if (!inst->isComprInst())
{
return;
}
int dstStart = dst->getLinearizedStart() / GENX_GRF_REG_SIZ;
int dstEnd = dst->getLinearizedEnd() / GENX_GRF_REG_SIZ;
for (int i = 0; i < inst->getNumSrc(); i++)
{
G4_Operand* src = inst->getSrc(i);
if (src != NULL && !src->isNullReg() && src->getTopDcl() &&
(src->getTopDcl()->getRegFile() == G4_GRF || src->getTopDcl()->getRegFile() == G4_INPUT))
{
bool noOverlap = dataHazardCheck(dst, src);
int srcStart = src->getLinearizedStart() / GENX_GRF_REG_SIZ;
int srcEnd = src->getLinearizedEnd() / GENX_GRF_REG_SIZ;
if (dstEnd != dstStart ||
srcStart != srcEnd) //Any operand is more than 2 GRF
{
MUST_BE_TRUE(!noOverlap, "dst and src0 overlap");
}
}
}
}
}
void G4Verifier::verifySend(G4_INST* inst)
{
MUST_BE_TRUE(inst->isSend(), "expect send inst");
if (passIndex == Optimizer::PI_regAlloc)
{
G4_DstRegRegion* dst = inst->getDst();
G4_SrcRegRegion* src0 = inst->getSrc(0)->asSrcRegRegion();
G4_SrcRegRegion* src1 = inst->isSplitSend() ? inst->getSrc(1)->asSrcRegRegion() : nullptr;
if (inst->isEOT() && kernel.fg.builder->hasEOTGRFBinding())
{
auto checkEOTSrc = [](G4_SrcRegRegion* src) {
const unsigned int EOTStart = 112 * GENX_GRF_REG_SIZ;
if (src->isNullReg())
{
return true;
}
return src->getLinearizedStart() >= EOTStart;
};
if (kernel.getNumRegTotal() >= 128)
{
MUST_BE_TRUE(checkEOTSrc(src0), "src0 for EOT send is not in r112-r127");
if (src1 != nullptr)
{
MUST_BE_TRUE(checkEOTSrc(src1), "src1 for EOT sends is not in r112-r127");
}
}
}
if (inst->isSplitSend())
{
if (src0->getBase()->isGreg() && src1 && src1->getBase()->isGreg())
{
int src0Start = src0->getLinearizedStart() / GENX_GRF_REG_SIZ;
int src0End = src0Start + inst->getMsgDesc()->MessageLength() - 1;
int src1Start = src1->getLinearizedStart() / GENX_GRF_REG_SIZ;
int src1End = src1Start + inst->getMsgDesc()->extMessageLength() - 1;
bool noOverlap = src0End < src1Start ||
src1End < src0Start;
MUST_BE_TRUE(noOverlap, "split send src0 and src1 overlap");
}
}
if (kernel.fg.builder->WaDisableSendSrcDstOverlap())
{
if (!dst->isNullReg())
{
if (src0->getBase()->isGreg())
{
bool noOverlap = dst->getLinearizedEnd() < src0->getLinearizedStart() ||
src0->getLinearizedEnd() < dst->getLinearizedStart();
MUST_BE_TRUE(noOverlap, "send dst and src0 overlap");
}
if (src1 && !src1->isNullReg())
{
bool noOverlap = dst->getLinearizedEnd() < src1->getLinearizedStart() ||
src1->getLinearizedEnd() < dst->getLinearizedStart();
MUST_BE_TRUE(noOverlap, "split send dst and src1 overlap");
}
}
}
}
}
void G4Verifier::verifyOpnd(G4_Operand* opnd, G4_INST* inst)
{
uint8_t execSize = inst->getExecSize();
if (opnd == NULL)
{
return;
}
if (inst->opcode() == G4_sel && opnd->isCondMod())
{
// conditional modifier for sel is a don't care, so we can skip verification
return;
}
// FIXME: If isImm() condition is removed then some assertions are hit.
// This means somewhere in Jitter operand sharing is happening for
// immediate type operands. This should be fixed.
// For Imm, AddrExp, AddrExpList, Labels, hashtable lookup is
// performed at creation time unline SrcRegion, DstRegion,
// Predicate, CondMod. This means former type of operands
// can be shared across instructions.
if (opnd->getInst() != inst &&
opnd->isLabel() == false &&
opnd->isImm() == false &&
opnd->isNullReg() == false &&
opnd->isAddrExp() == false)
{
DEBUG_VERBOSE("Inst not set correctly for opnd ");
std::cerr << "operand: ";
opnd->emit(std::cerr);
std::cerr << " in instruction:\n ";
inst->emit(std::cerr);
std::cerr << "\n";
if (opnd->getInst() == NULL)
{
DEBUG_VERBOSE("Inst set to NULL");
MUST_BE_TRUE(false, "Inst pointer set to NULL in opnd");
}
else
{
opnd->getInst()->emit(std::cerr);
std::cerr << "\n";
DEBUG_VERBOSE("Inst ptr set to incorrect inst");
MUST_BE_TRUE(false, "Inst pointer incorrectly set in opnd");
}
DEBUG_VERBOSE(std::endl);
}
if (inst->isSend())
{
// send dst/src may not be GRF-aligned before HW conformity,
// so we only check their bound in RA
if (passIndex != Optimizer::PI_regAlloc)
{
return;
}
if (opnd == inst->getDst())
{
if (opnd->isRightBoundSet() && !opnd->isNullReg())
{
unsigned int correctRB = ((inst->getMsgDesc()->ResponseLength() + opnd->asDstRegRegion()->getRegOff()) * G4_GRF_REG_NBYTES) - 1;
if (inst->getMsgDesc()->isScratchRW() == false &&
inst->getMsgDesc()->isOwordLoad() &&
inst->getMsgDesc()->isValidFuncCtrl() &&
(inst->getMsgDesc()->getFuncCtrl() & 0x700) == 0)
{
correctRB = opnd->getLeftBound() + 15;
}
else if (opnd->getTopDcl()->getByteSize() < G4_GRF_REG_NBYTES)
{
correctRB = opnd->getLeftBound() + opnd->getTopDcl()->getByteSize() - 1;
}
G4_Declare* parentDcl = opnd->getBase()->asRegVar()->getDeclare();
while (parentDcl != NULL)
{
correctRB += parentDcl->getAliasOffset();
parentDcl = parentDcl->getAliasDeclare();
}
correctRB = std::min(correctRB, opnd->getTopDcl()->getByteSize() - 1);
if (opnd->getRightBound() != correctRB)
{
DEBUG_VERBOSE("Right bound mismatch for send inst dst. Orig rb = " <<
opnd->getRightBound() << ", correct rb = " << correctRB << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Right bound mismatch!");
}
}
}
else if (opnd == inst->getSrc(0) || opnd == inst->getSrc(1))
{
if (opnd->isRightBoundSet())
{
int msgLength = (opnd == inst->getSrc(0)) ? inst->getMsgDesc()->MessageLength() : inst->getMsgDesc()->extMessageLength();
unsigned int numBytes = opnd->getTopDcl()->getByteSize();
unsigned int correctRB = 0;
if (numBytes < G4_GRF_REG_NBYTES)
{
correctRB = opnd->asSrcRegRegion()->getRegOff() * G4_GRF_REG_NBYTES + numBytes - 1;
}
else
{
correctRB = ((msgLength + opnd->asSrcRegRegion()->getRegOff()) * G4_GRF_REG_NBYTES) - 1;
}
G4_Declare* parentDcl = opnd->getBase()->asRegVar()->getDeclare();
while (parentDcl != NULL)
{
correctRB += parentDcl->getAliasOffset();
parentDcl = parentDcl->getAliasDeclare();
}
correctRB = std::min(correctRB, opnd->getTopDcl()->getByteSize() - 1);
if (opnd->getRightBound() != correctRB)
{
DEBUG_VERBOSE("Right bound mismatch for send inst src0. Orig rb = " <<
opnd->getRightBound() << ", correct rb = " << correctRB << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Right bound mismatch!");
}
}
}
}
else
{
if (opnd->isSrcRegRegion() && opnd->isRightBoundSet())
{
G4_SrcRegRegion newRgn(*(opnd->asSrcRegRegion()));
newRgn.setInst(inst);
newRgn.computeLeftBound();
newRgn.computeRightBound(execSize);
if (inst->isPseudoUse())
{
G4_Declare* topdcl = newRgn.getBase()->asRegVar()->getDeclare();
while (topdcl->getAliasDeclare() != NULL)
{
topdcl = topdcl->getAliasDeclare();
}
newRgn.setLeftBound(0);
newRgn.setRightBound(topdcl->getByteSize() - 1);
}
if ((opnd->getRightBound() - opnd->getLeftBound()) > (2u * G4_GRF_REG_NBYTES) &&
(inst->isPseudoUse() == false))
{
if (!(inst->opcode() == G4_pln && inst->getSrc(1) == opnd))
{
DEBUG_VERBOSE("Difference between left/right bound is greater than 2 GRF for src region. Single non-send opnd cannot span 2 GRFs. lb = " <<
opnd->getLeftBound() << ", rb = " << opnd->getRightBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Left/right bound span incorrect!");
}
}
if (inst->opcode() == G4_pln &&
inst->getSrc(1) == opnd)
{
// For pln, src1 uses 2 GRFs if exec size <= 8
// and 4 GRFs if exec size == 16
newRgn.computeRightBound(inst->getExecSize() > 8 ? inst->getExecSize() : inst->getExecSize() * 2);
if (inst->getExecSize() > 8)
{
newRgn.setRightBound(newRgn.getRightBound() * 2 - newRgn.getLeftBound() + 1);
}
}
if (inst->getMaskOffset() > 0 &&
opnd == inst->getImplAccSrc())
{
// Update left/right bound as per inst mask offset, eg Q2
// has offset 8
G4_Type extype;
int extypesize;
unsigned int multiplicationFactor = 1;
if (opnd->isAccReg())
{
// Right bound granularity is in terms of
// bytes for Acc registers
multiplicationFactor = 4;
}
extype = inst->getOpExecType(extypesize);
if ((IS_WTYPE(extype) || IS_DTYPE(extype)))
{
// This condition is a result of HW Conformity requirement
// that for exec type = D/DW, only acc0 is used even when
// qtr control is set to Q2/H2
newRgn.setLeftBound(0);
newRgn.setRightBound(31);
}
else
{
newRgn.setLeftBound(newRgn.getLeftBound() + (inst->getMaskOffset() * multiplicationFactor));
newRgn.setRightBound(newRgn.getRightBound() + (inst->getMaskOffset() * multiplicationFactor));
}
}
if (opnd->getLeftBound() != newRgn.getLeftBound())
{
DEBUG_VERBOSE("Left bound mismatch for src opnd for following inst. Orig lb = " <<
opnd->getLeftBound() << ", recomputed lb = " << newRgn.getLeftBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Left bound mismatch!");
}
if (opnd->getRightBound() != newRgn.getRightBound())
{
DEBUG_VERBOSE("Right bound mismatch for src opnd for following inst. Orig rb = " <<
opnd->getRightBound() << ", recomputed rb = " << newRgn.getRightBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Right bound mismatch!");
}
}
else if (opnd->isDstRegRegion() && opnd->isRightBoundSet() && !opnd->isNullReg())
{
G4_DstRegRegion newRgn(*(opnd->asDstRegRegion()));
newRgn.setInst(inst);
newRgn.computeLeftBound();
newRgn.computeRightBound(execSize);
if (inst->isPseudoKill())
{
G4_Declare* topdcl = newRgn.getBase()->asRegVar()->getDeclare();
while (topdcl->getAliasDeclare() != NULL)
{
topdcl = topdcl->getAliasDeclare();
}
newRgn.setLeftBound(0);
newRgn.setRightBound(topdcl->getByteSize() - 1);
}
if ((opnd->getRightBound() - opnd->getLeftBound()) > (2u * G4_GRF_REG_NBYTES) &&
(inst->isPseudoKill() == false))
{
DEBUG_VERBOSE("Difference between left/right bound is greater than 2 GRF for dst region. Single non-send opnd cannot span 2 GRFs. lb = " <<
opnd->getLeftBound() << ", rb = " << opnd->getRightBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Left/right bound span incorrect!");
}
if (inst->getMaskOffset() > 0 &&
opnd == inst->getImplAccDst())
{
// Update left/right bound as per inst mask offset, eg Q2
// has offset 8
G4_Type extype;
int extypesize;
unsigned int multiplicationFactor = 1;
if (opnd->isAccReg())
{
// Right bound granularity is in terms of
// bytes for Acc registers
multiplicationFactor = 4;
}
extype = inst->getOpExecType(extypesize);
if ((IS_WTYPE(extype) || IS_DTYPE(extype)))
{
// This condition is a result of HW Conformity requirement
// that for exec type = D/DW, only acc0 is used even when
// qtr control is set to Q2/H2
newRgn.setLeftBound(0);
newRgn.setRightBound(31);
}
else
{
newRgn.setLeftBound(newRgn.getLeftBound() + (inst->getMaskOffset() * multiplicationFactor));
newRgn.setRightBound(newRgn.getRightBound() + (inst->getMaskOffset() * multiplicationFactor));
}
}
if (opnd->getLeftBound() != newRgn.getLeftBound())
{
DEBUG_VERBOSE("Left bound mismatch for dst opnd for following inst. Orig lb = " <<
opnd->getLeftBound() << ", recomputed lb = " << newRgn.getLeftBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Left bound mismatch");
}
if (opnd->getRightBound() != newRgn.getRightBound())
{
DEBUG_VERBOSE("Right bound mismatch for dst opnd for following inst. Orig rb = " <<
opnd->getRightBound() << ", recomputed rb = " << newRgn.getRightBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Right bound mismatch!");
}
}
else if (opnd->isPredicate() && opnd->isRightBoundSet())
{
G4_Predicate newRgn(*(opnd->asPredicate()));
newRgn.setLeftBound(0);
newRgn.computeRightBound(execSize);
if (inst->getMaskOffset() > 0)
{
// Update left/right bound as per inst mask offset, eg Q2
// has offset 8
newRgn.setLeftBound(newRgn.getLeftBound() + inst->getMaskOffset());
newRgn.setRightBound(newRgn.getRightBound() + inst->getMaskOffset());
}
if (opnd->getLeftBound() != newRgn.getLeftBound())
{
DEBUG_VERBOSE("Left bound mismatch for pred opnd for following inst. Orig lb = " <<
opnd->getLeftBound() << ", recomputed lb = " << newRgn.getLeftBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Left bound mismatch");
}
if (opnd->getRightBound() != newRgn.getRightBound())
{
DEBUG_VERBOSE("Right bound mismatch for pred opnd for following inst. Orig rb = " <<
opnd->getRightBound() << ", recomputed rb = " << newRgn.getRightBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Right bound mismatch!");
}
}
else if (opnd->isCondMod() && opnd->isRightBoundSet())
{
G4_CondMod newRgn(*(opnd->asCondMod()));
newRgn.setLeftBound(0);
newRgn.computeRightBound(execSize);
if (inst->getMaskOffset() > 0)
{
// Update left/right bound as per inst mask offset, eg Q2
// has offset 8
newRgn.setLeftBound(newRgn.getLeftBound() + inst->getMaskOffset());
newRgn.setRightBound(newRgn.getRightBound() + inst->getMaskOffset());
}
if (opnd->getLeftBound() != newRgn.getLeftBound())
{
DEBUG_VERBOSE("Left bound mismatch for cond mod opnd for following inst. Orig lb = " <<
opnd->getLeftBound() << ", recomputed lb = " << newRgn.getLeftBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Left bound mismatch");
}
if (opnd->getRightBound() != newRgn.getRightBound())
{
DEBUG_VERBOSE("Right bound mismatch for cond mod opnd for following inst. Orig rb = " <<
opnd->getRightBound() << ", recomputed rb = " << newRgn.getRightBound() << std::endl);
inst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
MUST_BE_TRUE(false, "Right bound mismatch!");
}
}
else
{
// Not implemented
}
if (passIndex == Optimizer::PI_regAlloc)
{
// alignment checks that can only be performed post RA
bool threeSrcAlign16 = (inst->getNumSrc() == 3) && !inst->isSend() && !kernel.fg.builder->hasAlign1Ternary();
bool nonScalar = (opnd->isSrcRegRegion() && !opnd->asSrcRegRegion()->isScalar()) ||
(opnd->isDstRegRegion() && inst->getExecSize() > 2);
bool isAssigned = opnd->isRegRegion() && opnd->getBase()->isRegVar() &&
opnd->getBase()->asRegVar()->isPhyRegAssigned();
// allow replicated DF source opnd with <2;2,0> region
bool isReplicated = (opnd->getType() == Type_DF) &&
opnd->isSrcRegRegion() &&
(opnd->asSrcRegRegion()->getRegion()->width == 2) &&
(opnd->asSrcRegRegion()->getRegion()->horzStride == 0) &&
(opnd->asSrcRegRegion()->getRegion()->vertStride == 2);
if (threeSrcAlign16 && nonScalar && isAssigned &&
opnd->getLinearizedStart() % 16 != 0 &&
!isReplicated)
{
MUST_BE_TRUE(false, "dp2/dp3/dp4/dph and non-scalar 3src op must be align16!");
}
// check acc source alignment
// for explicit acc source, it and the inst's dst should both be oword-aligned
// for implicit acc source, its subreg offset should be identical to that of the dst
if (opnd->isAccReg())
{
uint32_t offset = opnd->getLinearizedStart() % 32;
if (inst->getDst())
{
uint32_t dstOffset = inst->getDst()->getLinearizedStart() % 32;
if (opnd == inst->getImplAccSrc())
{
assert(offset == dstOffset && "implicit acc source must have identical offset as dst");
}
else if (opnd->isSrcRegRegion())
{
assert((offset % 16 == 0 && dstOffset % 16 == 0) &&
"explicit acc source and its dst must be oword-aligned");
}
}
}
}
}
}
void verifyLifetimeConsistency(G4_BB* bb)
{
// Verify whether misplaced pseudo_kill/lifetime.end is seen in BB
// Following code patterns are incorrect:
// mov (1) A,
// ...
// pseudo_kill A
// As per VISA spec, we allow a single instance of pseudo_kill per
// variable. Later RA's liveness may insert multiple. This will
// not be invoked after RA anyway. As a precaution, we return
// if no unassigned register is found.
//
// Similarly for lifetime.end
// lifetime.end A
// ...
// mov (1) A,
// This is illegal because lifetime.end appears before last use
// in BB
bool unassignedFound = false;
for (INST_LIST_ITER it = bb->begin(), end = bb->end();
it != end;
it++)
{
G4_INST* curInst = (*it);
std::stack<G4_Operand*> opnds;
opnds.push(curInst->getDst());
opnds.push(curInst->getSrc(0));
opnds.push(curInst->getSrc(1));
opnds.push(curInst->getSrc(2));
opnds.push(curInst->getPredicate());
opnds.push(curInst->getCondMod());
while (!opnds.empty())
{
G4_Operand* curOpnd = opnds.top();
opnds.pop();
if (curOpnd != NULL && curOpnd->getTopDcl() != NULL)
{
G4_Declare* topdcl = curOpnd->getTopDcl();
if (topdcl->getRegVar() &&
!topdcl->getRegVar()->isPhyRegAssigned())
{
unassignedFound = true;
}
}
}
}
if (unassignedFound == true)
{
typedef std::map<G4_Declare*, std::pair<G4_INST*, unsigned int>> dclInstMap;
typedef dclInstMap::iterator dclInstMapIter;
dclInstMap pseudoKills;
dclInstMap lifetimeEnd;
unsigned int instId = 0;
// First populate all pseudo_kills and lifetime.end instructions
// in BB's inst list. Later run second loop to check whether
// lifetime rules are flouted.
for (INST_LIST_ITER it = bb->begin(), end = bb->end();
it != end;
it++, instId++)
{
G4_INST* curInst = (*it);
std::pair<G4_INST*, unsigned int> instPair;
instPair.first = curInst;
instPair.second = instId;
if (curInst->isPseudoKill())
{
pseudoKills.insert(make_pair(GetTopDclFromRegRegion(curInst->getDst()), instPair));
}
if (curInst->isLifeTimeEnd())
{
lifetimeEnd.insert(make_pair(GetTopDclFromRegRegion(curInst->getSrc(0)), instPair));
}
}
instId = 0;
for (INST_LIST_ITER it = bb->begin(), end = bb->end();
it != end;
it++, instId++)
{
G4_INST* curInst = (*it);
if (curInst->isPseudoKill() ||
curInst->isLifeTimeEnd())
{
continue;
}
std::stack<G4_Operand*> opnds;
opnds.push(curInst->getDst());
opnds.push(curInst->getSrc(0));
opnds.push(curInst->getSrc(1));
opnds.push(curInst->getSrc(2));
opnds.push(curInst->getPredicate());
opnds.push(curInst->getCondMod());
while (!opnds.empty())
{
G4_Operand* curOpnd = opnds.top();
opnds.pop();
if (curOpnd != NULL && curOpnd->getTopDcl() != NULL)
{
G4_Declare* topdcl = curOpnd->getTopDcl();
// Check whether topdcl has been written to map
dclInstMapIter killsIt = pseudoKills.find(topdcl);
if (killsIt != pseudoKills.end())
{
unsigned int foundAtId = (*killsIt).second.second;
if (foundAtId > instId)
{
DEBUG_VERBOSE("Found a definition before pseudo_kill.");
(*killsIt).second.first->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
curInst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
}
}
dclInstMapIter lifetimeEndIter = lifetimeEnd.find(topdcl);
if (lifetimeEndIter != lifetimeEnd.end())
{
unsigned int foundAtId = (*lifetimeEndIter).second.second;
if (foundAtId < instId)
{
DEBUG_VERBOSE("Found a use after lifetime.end.");
(*lifetimeEndIter).second.first->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
curInst->emit(std::cerr);
DEBUG_VERBOSE(std::endl);
}
}
}
}
}
}
}
void G4Verifier::verifyOpcode(G4_INST* inst)
{
switch (inst->opcode())
{
case G4_dp2:
case G4_dp3:
case G4_dp4:
assert(kernel.fg.builder->hasDotProductInst() && "unsupported opcode");
break;
case G4_lrp:
assert(kernel.fg.builder->hasLRP() && "unsupported opcode");
break;
case G4_madm:
assert(kernel.fg.builder->hasMadm() && "unsupported opcode");
break;
default:
break;
}
if (passIndex == Optimizer::PI_regAlloc)
{
//ToDo: add more checks for psuedo inst after RA
assert(!inst->isPseudoLogic() && "pseudo logic inst should be lowered before RA");
}
}
| 35.578252 | 159 | 0.518638 | scott-snyder |
285203d45ff7f01e117ec67132496122c2c47f9f | 244 | hh | C++ | include/HandleMenus.hh | freddyox/word_search | d6db6b2e584025064209fadea7029ba72b1acfff | [
"MIT"
] | null | null | null | include/HandleMenus.hh | freddyox/word_search | d6db6b2e584025064209fadea7029ba72b1acfff | [
"MIT"
] | null | null | null | include/HandleMenus.hh | freddyox/word_search | d6db6b2e584025064209fadea7029ba72b1acfff | [
"MIT"
] | null | null | null | #ifndef HANDLEMENUS_HH
#define HANDLEMENUS_HH
#include <SFML/Graphics.hpp>
class HandleMenus : public sf::Drawable{
private:
public:
HandleMenus();
~HandleMenus();
void draw(sf::RenderTarget&, sf::RenderStates) const;
};
#endif
| 13.555556 | 55 | 0.717213 | freddyox |
2852da1f39635955a32b5ff6b4c11e02e032b428 | 5,902 | cpp | C++ | CubeEngine/Application/CubeGame/PartSurfaceMgr.cpp | tangziwen/Cube-Engine | c79b878dcc7e2e382f4463ca63519627d6220afd | [
"MIT"
] | 360 | 2015-01-26T08:15:01.000Z | 2021-07-11T16:30:58.000Z | CubeEngine/Application/CubeGame/PartSurfaceMgr.cpp | tangziwen/Cube-Engine | c79b878dcc7e2e382f4463ca63519627d6220afd | [
"MIT"
] | 6 | 2015-03-09T09:15:07.000Z | 2020-07-06T01:34:00.000Z | CubeEngine/Application/CubeGame/PartSurfaceMgr.cpp | tangziwen/CubeMiniGame | 90bffa66d4beba5fddc39fc642a8fb36703cf32d | [
"MIT"
] | 41 | 2015-03-10T03:17:46.000Z | 2021-07-13T06:26:26.000Z | #include "PartSurfaceMgr.h"
#include "3D/Primitive/CubePrimitive.h"
#include <algorithm>
#include "BulletCollision/CollisionShapes/btCompoundShape.h"
#include "Scene/SceneMgr.h"
#include "Collision/PhysicsCompoundShape.h"
#include "Collision/PhysicsMgr.h"
#include "CylinderPart.h"
#include "3D/Primitive/CylinderPrimitive.h"
#include <utility>
#include <rapidjson/rapidjson.h>
#include <rapidjson/document.h>
#include "Utility/log/Log.h"
#include "Utility/file/Tfile.h"
#include "Engine/WorkerThreadSystem.h"
namespace tzw
{
const float bearingGap = 0.00;
PartSurfaceMgr::PartSurfaceMgr()
{
//load from Json
}
void PartSurfaceMgr::loadFromFile(std::string filePath)
{
addItem("scuffed-plastic-1", new PartSurface("Texture/scuffed-plastic-1/scuffed-plastic2-alb.png",
"Texture/scuffed-plastic-1/scuffed-plastic-rough.png",
"Texture/scuffed-plastic-1/scuffed-plastic-metal.png",
"Texture/scuffed-plastic-1/scuffed-plastic-normal.png"));
//Metal
addItem("Metal Grid3", new PartSurface("Texture/metalgrid3-ue/metalgrid3_basecolor.png",
"Texture/metalgrid3-ue/metalgrid3_roughness.png",
"Texture/metalgrid3-ue/metalgrid3_metallic.png",
"Texture/metalgrid3-ue/metalgrid3_normal-dx.png"));
//Metal
addItem("Metal Grid2", new PartSurface("Texture/metalgrid2-dx/metalgrid2_basecolor.png",
"Texture/metalgrid2-dx/metalgrid2_roughness.png",
"Texture/metalgrid2-dx/metalgrid2_metallic.png",
"Texture/metalgrid2-dx/metalgrid2_normal-dx.png"));
//scifi
addItem("SCIFI", new PartSurface("Texture/military-panel1-ue/military-panel1-albedo.png",
"Texture/military-panel1-ue/military-panel1-rough.png",
"Texture/military-panel1-ue/military-panel1-metalness.png",
"Texture/military-panel1-ue/military-panel1-nmap-dx.png"));
//foam grip
addItem("foam grip", new PartSurface("Texture/foam-grip1-ue/foam-grip1-albedo.png",
"Texture/foam-grip1-ue/foam-grip1-roughness.png",
"Texture/foam-grip1-ue/foam-grip1-metallic.png",
"Texture/foam-grip1-ue/foam-grip1-normal-dx1.png"));
//modern-tile1-ue
addItem("Modern tile1", new PartSurface("Texture/modern-tile1-ue/modern-tile1-albedo.png",
"Texture/modern-tile1-ue/modern-tile1-roughness.png",
"Texture/modern-tile1-ue/modern-tile1-metallic.png",
"Texture/modern-tile1-ue/modern-tile1-normal-dx.png"));
//modern-tile1-ue
addItem("Bamboo", new PartSurface(
"Texture/bamboo-wood-semigloss-Unreal-Engine/bamboo-wood-semigloss-albedo.png",
"Texture/bamboo-wood-semigloss-Unreal-Engine/bamboo-wood-semigloss-roughness.png",
"Texture/bamboo-wood-semigloss-Unreal-Engine/bamboo-wood-semigloss-metal.png",
"Texture/bamboo-wood-semigloss-Unreal-Engine/bamboo-wood-semigloss-normal.png"));
//RustedIron
addItem("Rusted Iron", new PartSurface(
"Texture/RustedIron/rustediron2_basecolor.png",
"Texture/RustedIron/rustediron2_roughness.png",
"Texture/RustedIron/rustediron2_metallic.png",
"Texture/RustedIron/rustediron2_normal.png"));
//Flat
addItem("Flat", new PartSurface(
"Texture/BuiltInTexture/defaultBaseColor.png",
"Texture/BuiltInTexture/defaultRoughnessMap.png",
"Texture/BuiltInTexture/defaultMetallic.png",
"Texture/BuiltInTexture/defaultNormalMap.png"));
//stepping stones
addItem("SteppingStone", new PartSurface(
"Texture/steppingstones1_ogl/steppingstones1_albedo.png",
"Texture/BuiltInTexture/defaultRoughnessMap.png",
"Texture/BuiltInTexture/defaultMetallic.png",
"Texture/steppingstones1_ogl/steppingstones1_normal-ogl.png"));
//Brick
addItem("Brick", new PartSurface(
"Texture/redbricks2b-Unreal-Engine/redbricks2b-albedo.png",
"Texture/redbricks2b-Unreal-Engine/redbricks2b-rough.png",
"Texture/redbricks2b-Unreal-Engine/redbricks2b-metalness.png",
"Texture/redbricks2b-Unreal-Engine/redbricks2b-normal.png"));
//Iron-scuffed
addItem("IronScuffed", new PartSurface(
"Texture/Iron-Scuffed_Unreal-Engine/Iron-Scuffed_basecolor.png",
"Texture/Iron-Scuffed_Unreal-Engine/Iron-Scuffed_roughness.png",
"Texture/Iron-Scuffed_Unreal-Engine/Iron-Scuffed_metallic.png",
"Texture/Iron-Scuffed_Unreal-Engine/Iron-Scuffed_normal.png"));
//oakfloor_fb1-Unreal-Engine
addItem("OakFloor", new PartSurface(
"Texture/oakfloor_fb1-Unreal-Engine/oakfloor_basecolor.png",
"Texture/oakfloor_fb1-Unreal-Engine/oakfloor_roughness.png",
"Texture/BuiltInTexture/defaultMetallic.png",
"Texture/oakfloor_fb1-Unreal-Engine/oakfloor_normal.png"));
//Patchy
addItem("Patchy", new PartSurface(
"Texture/patchy_cement1_Unreal-Engine/patchy_cement1_Base_Color.png",
"Texture/patchy_cement1_Unreal-Engine/patchy_cement1_Roughness.png",
"Texture/patchy_cement1_Unreal-Engine/patchy_cement1_Metallic.png",
"Texture/patchy_cement1_Unreal-Engine/patchy_cement1_Normal.png"));
//concrete3-Unity2-1
addItem("Concrete", new PartSurface(
"Texture/concrete3-Unity2-1/concrete3-albedo.png",
"Texture/BuiltInTexture/defaultRoughnessMap.png",
"Texture/BuiltInTexture/defaultMetallic.png",
"Texture/concrete3-Unity2-1/concrete3-Normal-ogl.png"));
addItem("Glass", new PartSurface(
"Texture/concrete3-Unity2-1/concrete3-albedo.png",
"Texture/BuiltInTexture/defaultRoughnessMap.png",
"Texture/BuiltInTexture/defaultMetallic.png",
"Texture/concrete3-Unity2-1/concrete3-Normal-ogl.png", true));
for(auto iter :m_itemList)
{
char titleTips[128];
sprintf(titleTips, "Part Surface# %s",iter->getName().c_str());
WorkerThreadSystem::shared()->pushMainThreadOrderWithLoading(titleTips, WorkerJob([iter]
{
iter->cache();
}));
}
}
PartSurface * PartSurfaceMgr::getItem(std::string name)
{
return m_itemMap[name];
}
int PartSurfaceMgr::getItemAmount()
{
return m_itemList.size();
}
PartSurface* PartSurfaceMgr::getItemByIndex(int index)
{
return m_itemList[index];
}
void PartSurfaceMgr::addItem(std::string name, PartSurface* item)
{
item->setName(name);
m_itemList.push_back(item);
m_itemMap[name] = item;
}
}
| 37.35443 | 100 | 0.774483 | tangziwen |
285325eb1dc0a24f2e90f778317a5949b9cadadc | 2,773 | hpp | C++ | webots_ros2_control/include/webots_ros2_control/Ros2ControlSystem.hpp | TaoYibo1866/webots_ros2 | a72c164825663cebbfd27e0649ea51d3abf9bbed | [
"Apache-2.0"
] | null | null | null | webots_ros2_control/include/webots_ros2_control/Ros2ControlSystem.hpp | TaoYibo1866/webots_ros2 | a72c164825663cebbfd27e0649ea51d3abf9bbed | [
"Apache-2.0"
] | null | null | null | webots_ros2_control/include/webots_ros2_control/Ros2ControlSystem.hpp | TaoYibo1866/webots_ros2 | a72c164825663cebbfd27e0649ea51d3abf9bbed | [
"Apache-2.0"
] | null | null | null | // Copyright 1996-2021 Cyberbotics Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#ifndef ROS2_CONTROL_HPP
#define ROS2_CONTROL_HPP
#include <memory>
#include <string>
#include <vector>
#if FOXY
#include "hardware_interface/base_interface.hpp"
#include "hardware_interface/types/hardware_interface_status_values.hpp"
#endif
#include "hardware_interface/system_interface.hpp"
#include "hardware_interface/handle.hpp"
#include "hardware_interface/hardware_info.hpp"
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "rclcpp/macros.hpp"
#include "webots_ros2_driver/PluginInterface.hpp"
#include "webots_ros2_driver/WebotsNode.hpp"
#include "webots_ros2_control/Ros2ControlSystemInterface.hpp"
#include "webots/Motor.hpp"
#include "webots/PositionSensor.hpp"
namespace webots_ros2_control
{
struct Joint {
double positionCommand;
double position;
double velocityCommand;
double velocity;
double effortCommand;
double effort;
bool controlPosition;
bool controlVelocity;
bool controlEffort;
std::string name;
webots::Motor* motor;
webots::PositionSensor* sensor;
};
class Ros2ControlSystem : public Ros2ControlSystemInterface
{
public:
void init(webots_ros2_driver::WebotsNode *node, const hardware_interface::HardwareInfo &info) override;
#if FOXY
hardware_interface::return_type configure(const hardware_interface::HardwareInfo &info) override;
hardware_interface::return_type start() override;
hardware_interface::return_type stop() override;
#else
CallbackReturn on_init(const hardware_interface::HardwareInfo &info) override;
CallbackReturn on_activate(const rclcpp_lifecycle::State & /*previous_state*/) override;
CallbackReturn on_deactivate(const rclcpp_lifecycle::State & /*previous_state*/) override;
#endif
std::vector<hardware_interface::StateInterface> export_state_interfaces() override;
std::vector<hardware_interface::CommandInterface> export_command_interfaces() override;
hardware_interface::return_type read() override;
hardware_interface::return_type write() override;
private:
webots_ros2_driver::WebotsNode *mNode;
std::vector<Joint> mJoints;
};
}
#endif
| 33.409639 | 107 | 0.769564 | TaoYibo1866 |
28537da8e5973dfc0f2607e146a7b26f07bba5bd | 1,631 | cc | C++ | codebase/qe/qetest_08.cc | debatrimitra02/DBMS | 943faeb8fe542f29b35bd4bd1443ea405d42a4ab | [
"MIT"
] | null | null | null | codebase/qe/qetest_08.cc | debatrimitra02/DBMS | 943faeb8fe542f29b35bd4bd1443ea405d42a4ab | [
"MIT"
] | null | null | null | codebase/qe/qetest_08.cc | debatrimitra02/DBMS | 943faeb8fe542f29b35bd4bd1443ea405d42a4ab | [
"MIT"
] | null | null | null | #include <fstream>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include "qetest_util.h"
RC testCase_8() {
// Mandatory for the grad teams
// Optional for the other teams - grad solo, undergrad team, and undergrad solo
// (+5 extra credit points will be given based on the results of the basic aggregation related tests)
// 1. Basic aggregation - max
// SELECT max(left.B) from left
cout << "***** In QE Test Case 8 *****" << endl;
RC rc = success;
// Create TableScan
TableScan *input = new TableScan(*rm, "left");
// Create Aggregate
Attribute aggAttr;
aggAttr.name = "left.B";
aggAttr.type = TypeInt;
aggAttr.length = 4;
Aggregate *agg = new Aggregate(input, aggAttr, MAX);
int count = 0;
void *data = malloc(bufSize);
// An aggregation returns a float value
float maxVal = 0.0;
while(agg->getNextTuple(data) != QE_EOF)
{
maxVal = *(float *) ((char *) data + 1);
cout << "MAX(left.B) " << maxVal << endl;
memset(data, 0, sizeof(int));
count++;
if (count > 1) {
cout << "***** The number of returned tuple is not correct. *****" << endl;
rc = fail;
break;
}
}
if (maxVal != 109.0) {
rc = fail;
}
delete agg;
delete input;
free(data);
return rc;
}
int main() {
if (testCase_8() != success) {
cout << "***** [FAIL] QE Test Case 7 failed. *****" << endl;
return fail;
} else {
cout << "***** QE Test Case 7 finished. The result will be examined. *****" << endl;
return success;
}
}
| 22.342466 | 102 | 0.574494 | debatrimitra02 |
2855288850a14e7af04f7a10e250f1c856dfeb6c | 9,703 | cc | C++ | src/base/password_manager.cc | phoepsilonix/mozc | 3b9135b76247a9fe464cadd1a3c8ea5a07032e0c | [
"BSD-3-Clause"
] | 1 | 2021-04-03T10:08:21.000Z | 2021-04-03T10:08:21.000Z | src/base/password_manager.cc | phoepsilonix/mozc | 3b9135b76247a9fe464cadd1a3c8ea5a07032e0c | [
"BSD-3-Clause"
] | null | null | null | src/base/password_manager.cc | phoepsilonix/mozc | 3b9135b76247a9fe464cadd1a3c8ea5a07032e0c | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2010-2021, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * 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.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "base/password_manager.h"
#include <stddef.h>
#ifdef OS_WIN
#include <windows.h>
#else
#include <sys/stat.h>
#endif // OS_WIN
#include <cstdlib>
#include <string>
#include "base/const.h"
#include "base/encryptor.h"
#include "base/file_stream.h"
#include "base/file_util.h"
#include "base/logging.h"
#include "base/mmap.h"
#include "base/mutex.h"
#include "base/singleton.h"
#include "base/system_util.h"
#include "base/util.h"
namespace mozc {
namespace {
#ifdef OS_WIN
const char kPasswordFile[] = "encrypt_key.db";
#else
const char kPasswordFile[] = ".encrypt_key.db"; // dot-file (hidden file)
#endif
const size_t kPasswordSize = 32;
std::string CreateRandomPassword() {
char buf[kPasswordSize];
Util::GetRandomSequence(buf, sizeof(buf));
return std::string(buf, sizeof(buf));
}
// RAII class to make a given file writable/read-only
class ScopedReadWriteFile {
public:
explicit ScopedReadWriteFile(const std::string &filename)
: filename_(filename) {
if (!FileUtil::FileExists(filename_)) {
LOG(WARNING) << "file not found: " << filename;
return;
}
#ifdef OS_WIN
std::wstring wfilename;
Util::UTF8ToWide(filename_, &wfilename);
if (!::SetFileAttributesW(wfilename.c_str(), FILE_ATTRIBUTE_NORMAL)) {
LOG(ERROR) << "Cannot make writable: " << filename_;
}
#else
chmod(filename_.c_str(), 0600); // write temporary
#endif
}
~ScopedReadWriteFile() {
if (!FileUtil::FileExists(filename_)) {
LOG(WARNING) << "file not found: " << filename_;
return;
}
#ifdef OS_WIN
if (!FileUtil::HideFileWithExtraAttributes(filename_,
FILE_ATTRIBUTE_READONLY)) {
LOG(ERROR) << "Cannot make readonly: " << filename_;
}
#else
chmod(filename_.c_str(), 0400); // read only
#endif
}
private:
std::string filename_;
};
std::string GetFileName() {
return FileUtil::JoinPath(SystemUtil::GetUserProfileDirectory(),
kPasswordFile);
}
bool SavePassword(const std::string &password) {
const std::string filename = GetFileName();
ScopedReadWriteFile l(filename);
{
OutputFileStream ofs(filename.c_str(), std::ios::out | std::ios::binary);
if (!ofs) {
LOG(ERROR) << "cannot open: " << filename;
return false;
}
ofs.write(password.data(), password.size());
}
return true;
}
bool LoadPassword(std::string *password) {
const std::string filename = GetFileName();
Mmap mmap;
if (!mmap.Open(filename.c_str(), "r")) {
LOG(ERROR) << "cannot open: " << filename;
return false;
}
// Seems that the size of DPAPI-encrypted-mesage
// becomes bigger than the original message.
// Typical file size is 32 * 5 = 160byte.
// We just set the maximum file size to be 4096byte just in case.
if (mmap.size() == 0 || mmap.size() > 4096) {
LOG(ERROR) << "Invalid password is saved";
return false;
}
password->assign(mmap.begin(), mmap.size());
return true;
}
bool RemovePasswordFile() {
const std::string filename = GetFileName();
ScopedReadWriteFile l(filename);
return FileUtil::Unlink(filename);
}
} // namespace
//////////////////////////////////////////////////////////////////
// PlainPasswordManager
class PlainPasswordManager : public PasswordManagerInterface {
public:
bool SetPassword(const std::string &password) const override;
bool GetPassword(std::string *password) const override;
bool RemovePassword() const override;
};
bool PlainPasswordManager::SetPassword(const std::string &password) const {
if (password.size() != kPasswordSize) {
LOG(ERROR) << "Invalid password given";
return false;
}
if (!SavePassword(password)) {
LOG(ERROR) << "SavePassword failed";
return false;
}
return true;
}
bool PlainPasswordManager::GetPassword(std::string *password) const {
if (password == nullptr) {
LOG(ERROR) << "password is nullptr";
return false;
}
password->clear();
if (!LoadPassword(password)) {
LOG(ERROR) << "LoadPassword failed";
return false;
}
if (password->size() != kPasswordSize) {
LOG(ERROR) << "Password size is invalid";
return false;
}
return true;
}
bool PlainPasswordManager::RemovePassword() const {
return RemovePasswordFile();
}
//////////////////////////////////////////////////////////////////
// WinPasswordManager
// We use this manager with both Windows and Mac
#if (defined(OS_WIN) || defined(__APPLE__))
class WinMacPasswordManager : public PasswordManagerInterface {
public:
virtual bool SetPassword(const string &password) const;
virtual bool GetPassword(string *password) const;
virtual bool RemovePassword() const;
};
bool WinMacPasswordManager::SetPassword(const string &password) const {
if (password.size() != kPasswordSize) {
LOG(ERROR) << "password size is invalid";
return false;
}
string enc_password;
if (!Encryptor::ProtectData(password, &enc_password)) {
LOG(ERROR) << "ProtectData failed";
return false;
}
return SavePassword(enc_password);
}
bool WinMacPasswordManager::GetPassword(string *password) const {
if (password == nullptr) {
LOG(ERROR) << "password is nullptr";
return false;
}
string enc_password;
if (!LoadPassword(&enc_password)) {
LOG(ERROR) << "LoadPassword failed";
return false;
}
password->clear();
if (!Encryptor::UnprotectData(enc_password, password)) {
LOG(ERROR) << "UnprotectData failed";
return false;
}
if (password->size() != kPasswordSize) {
LOG(ERROR) << "password size is invalid";
return false;
}
return true;
}
bool WinMacPasswordManager::RemovePassword() const {
return RemovePasswordFile();
}
#endif // OS_WIN | __APPLE__
// We use plain text file for password storage on Linux. If you port this module
// to other Linux distro, you might want to implement a new password manager
// which adopts some secure mechanism such like gnome-keyring.
#if defined(OS_LINUX) || defined(OS_ANDROID) || defined(OS_NACL) || \
defined(OS_WASM)
typedef PlainPasswordManager DefaultPasswordManager;
#endif // OS_LINUX || OS_ANDROID || OS_NACL
// Windows or Mac
#if (defined(OS_WIN) || defined(__APPLE__))
typedef WinMacPasswordManager DefaultPasswordManager;
#endif
namespace {
class PasswordManagerImpl {
public:
PasswordManagerImpl() {
password_manager_ = Singleton<DefaultPasswordManager>::get();
DCHECK(password_manager_ != nullptr);
}
bool InitPassword() {
std::string password;
if (password_manager_->GetPassword(&password)) {
return true;
}
password = CreateRandomPassword();
scoped_lock l(&mutex_);
return password_manager_->SetPassword(password);
}
bool GetPassword(std::string *password) {
scoped_lock l(&mutex_);
if (password_manager_->GetPassword(password)) {
return true;
}
LOG(WARNING) << "Cannot get password. call InitPassword";
if (!InitPassword()) {
LOG(ERROR) << "InitPassword failed";
return false;
}
if (!password_manager_->GetPassword(password)) {
LOG(ERROR) << "Cannot get password.";
return false;
}
return true;
}
bool RemovePassword() {
scoped_lock l(&mutex_);
return password_manager_->RemovePassword();
}
void SetPasswordManagerHandler(PasswordManagerInterface *handler) {
scoped_lock l(&mutex_);
password_manager_ = handler;
}
public:
PasswordManagerInterface *password_manager_;
Mutex mutex_;
};
} // namespace
bool PasswordManager::InitPassword() {
return Singleton<PasswordManagerImpl>::get()->InitPassword();
}
bool PasswordManager::GetPassword(std::string *password) {
return Singleton<PasswordManagerImpl>::get()->GetPassword(password);
}
// remove current password
bool PasswordManager::RemovePassword() {
return Singleton<PasswordManagerImpl>::get()->RemovePassword();
}
// set internal interface for unittesting
void PasswordManager::SetPasswordManagerHandler(
PasswordManagerInterface *handler) {
Singleton<PasswordManagerImpl>::get()->SetPasswordManagerHandler(handler);
}
} // namespace mozc
| 27.643875 | 80 | 0.689271 | phoepsilonix |
2856cd525fcb9285e315a85cc5738e993afb0a5e | 148 | cpp | C++ | src/engine/main_abilities.cpp | eXl-Nic/eXl | a5a0f77f47db3179365c107a184bb38b80280279 | [
"MIT"
] | null | null | null | src/engine/main_abilities.cpp | eXl-Nic/eXl | a5a0f77f47db3179365c107a184bb38b80280279 | [
"MIT"
] | null | null | null | src/engine/main_abilities.cpp | eXl-Nic/eXl | a5a0f77f47db3179365c107a184bb38b80280279 | [
"MIT"
] | null | null | null | #include <engine/eXl_Main.hpp>
#include "abilityroom.hpp"
EXL_MAIN_WITH_SCENARIO_AND_PROJECT(AbilityRoom, "eXlTestProject/TestProject.eXlProject") | 29.6 | 88 | 0.844595 | eXl-Nic |
2858bf4cc8b1f35610ff946f808ee8ec4d4fec6f | 1,746 | cpp | C++ | src/apps/sequencer/model/Curve.cpp | forestcaver/performer | 17750bc8e6fa23cd806d58a9c519fac25a52473f | [
"MIT"
] | 1 | 2019-04-19T01:34:03.000Z | 2019-04-19T01:34:03.000Z | src/apps/sequencer/model/Curve.cpp | forestcaver/performer | 17750bc8e6fa23cd806d58a9c519fac25a52473f | [
"MIT"
] | null | null | null | src/apps/sequencer/model/Curve.cpp | forestcaver/performer | 17750bc8e6fa23cd806d58a9c519fac25a52473f | [
"MIT"
] | null | null | null | #include "Curve.h"
#include <algorithm>
#include <cmath>
static const float Pi = 3.1415926536f;
static const float TwoPi = 2.f * Pi;
static float high(float x) {
return 1.f;
}
static float low(float x) {
return 0.f;
}
static float stepUp(float x) {
return x < 0.5f ? 0.f : 1.f;
}
static float stepDown(float x) {
return x < 0.5f ? 1.f : 0.f;
}
static float rampUp(float x) {
return x;
}
static float rampDown(float x) {
return 1.f - x;
}
static float expUp(float x) {
return x * x;
}
static float expDown(float x) {
return (1.f - x) * (1.f - x);
}
static float logUp(float x) {
return std::sqrt(x);
}
static float logDown(float x) {
return std::sqrt(1.f - x);
}
static float smoothUp(float x) {
return x * x * (3.f - 2.f * x);
}
static float smoothDown(float x) {
return 1.f - x * x * (3.f - 2.f * x);
}
static float triangle(float x) {
return (x < 0.5f ? x : 1.f - x) * 2.f;
}
static float bell(float x) {
return 0.5f - 0.5f * std::cos(x * TwoPi);
}
static float expDown2x(float x) {
return x < 1.f ? expDown(std::fmod(x * 2.f, 1.f)) : 0.f;
}
static float expDown3x(float x) {
return x < 1.f ? expDown(std::fmod(x * 3.f, 1.f)) : 0.f;
}
static float expDown4x(float x) {
return x < 1.f ? expDown(std::fmod(x * 4.f, 1.f)) : 0.f;
}
static Curve::Function functions[] = {
&high,
&low,
&stepUp,
&stepDown,
&rampUp,
&rampDown,
&expUp,
&expDown,
&logUp,
&logDown,
&smoothUp,
&smoothDown,
&triangle,
&bell,
&expDown2x,
&expDown3x,
&expDown4x,
};
Curve::Function Curve::function(Type type) {
return functions[type];
}
float Curve::eval(Type type, float x) {
return functions[type](x);
}
| 16.628571 | 60 | 0.580756 | forestcaver |
2858f56557099b22852e658db429959bbb257c36 | 296 | hpp | C++ | lib/Core/Providers/RuntimeProvider.hpp | psiberx/cp2077-archive-xl | 5e476978d3128980099c2a2aea5258b38b5f3558 | [
"MIT"
] | 7 | 2021-12-03T08:34:26.000Z | 2022-01-29T20:22:59.000Z | lib/Core/Providers/RuntimeProvider.hpp | psiberx/cp2077-archivexl | 5e476978d3128980099c2a2aea5258b38b5f3558 | [
"MIT"
] | null | null | null | lib/Core/Providers/RuntimeProvider.hpp | psiberx/cp2077-archivexl | 5e476978d3128980099c2a2aea5258b38b5f3558 | [
"MIT"
] | null | null | null | #pragma once
#include "Core/Win.hpp"
#include "Core/Foundation/Feature.hpp"
namespace Core
{
class RuntimeProvider : public Feature
{
public:
struct Options
{
HMODULE handle = nullptr;
int exePathDepth = 0;
};
explicit RuntimeProvider(Options&& aOptions);
};
}
| 14.8 | 49 | 0.665541 | psiberx |
285beee1a9928177a91e106c9ed2ceef7d7275e9 | 1,776 | cpp | C++ | Basic Programming 1/basicprogramming1.cpp | austenjs/kattis | dcc3101e866e302bbf46f5b6ecfcd4a4cb453825 | [
"MIT"
] | null | null | null | Basic Programming 1/basicprogramming1.cpp | austenjs/kattis | dcc3101e866e302bbf46f5b6ecfcd4a4cb453825 | [
"MIT"
] | null | null | null | Basic Programming 1/basicprogramming1.cpp | austenjs/kattis | dcc3101e866e302bbf46f5b6ecfcd4a4cb453825 | [
"MIT"
] | null | null | null | #include <string>
#include <iostream>
#include <vector>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <string.h>
#include <cmath>
using namespace std;
bool inside(unsigned long long int num, vector<unsigned long long int>k) {
for (int i = 0; i < k.size(); i++) {
if (num == k[i]) {
return true;
}
}
return false;
}
int main() {
unsigned long long int N, t; cin >> N >> t;
vector<unsigned long long int>A;
for (int i = 0; i < N; i++) {
unsigned long long int k; cin >> k;
A.push_back(k);
}
if (t == 1) {
cout << 7;
return 0;
}
else if(t == 2) {
if (A[0] > A[1]) {
cout << "Bigger";
}
else if (A[0] == A[1]) {
cout << "Equal";
}
else {
cout << "Smaller";
}
}
else if (t == 3) {
vector<unsigned long long int>k;
k.push_back(A[0]); k.push_back(A[1]); k.push_back(A[2]);
sort(k.begin(), k.end());
cout << k[1];
}
else if (t == 4) {
unsigned long long int sum = 0;
for (int i = 0; i < A.size(); i++) {
sum += A[i];
}
cout << sum;
}
else if (t == 5) {
unsigned long long int sum = 0;
for (int i = 0; i < A.size(); i++) {
if (A[i] % 2 == 0) {
sum += A[i];
}
}
cout << sum;
}
else if (t == 6) {
for (int i = 0; i < A.size(); i++) {
A[i] = A[i] % 26;
}
for (int i = 0; i < A.size(); i++) {
cout << char(A[i] + 97);
}
}
else if (t == 7) {
vector<unsigned long long int>visited; unsigned long long int index = 0;
while (true) {
index = A[index];
if (index > N-1 || index< 0) {
cout << "Out";
return 0;
}
else if (index == N - 1) {
cout << "Done";
return 0;
}
else if (visited.size() >=N && inside(index, visited)) {
cout << "Cyclic";
return 0;
}
visited.push_back(index);
index = A[index];
}
}
}
| 18.893617 | 74 | 0.508446 | austenjs |
285c9e2d9248f70e5957c18adefd7c8d350960ab | 1,184 | cpp | C++ | plugins/d3d9/src/state/convert/light/parameters.cpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | 2 | 2016-01-27T13:18:14.000Z | 2018-05-11T01:11:32.000Z | plugins/d3d9/src/state/convert/light/parameters.cpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | null | null | null | plugins/d3d9/src/state/convert/light/parameters.cpp | cpreh/spacegameengine | 313a1c34160b42a5135f8223ffaa3a31bc075a01 | [
"BSL-1.0"
] | 3 | 2018-05-11T01:11:34.000Z | 2021-04-24T19:47:45.000Z | // Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <sge/d3d9/d3dinclude.hpp>
#include <sge/d3d9/convert/to_color_value.hpp>
#include <sge/d3d9/state/convert/light/parameters.hpp>
#include <sge/d3d9/state/convert/light/visitor.hpp>
#include <sge/renderer/state/ffp/lighting/light/parameters.hpp>
#include <fcppt/variant/apply.hpp>
#include <fcppt/config/external_begin.hpp>
#include <cfloat>
#include <cmath>
#include <fcppt/config/external_end.hpp>
D3DLIGHT9 const sge::d3d9::state::convert::light::parameters(
sge::renderer::state::ffp::lighting::light::parameters const &_light)
{
D3DLIGHT9 ret;
fcppt::variant::apply(sge::d3d9::state::convert::light::visitor(ret), _light.variant());
ret.Diffuse = sge::d3d9::convert::to_color_value(_light.diffuse().get());
ret.Specular = sge::d3d9::convert::to_color_value(_light.specular().get());
ret.Ambient = sge::d3d9::convert::to_color_value(_light.ambient().get());
ret.Range = std::sqrt(FLT_MAX);
ret.Falloff = 1.0f;
return ret;
}
| 32.888889 | 90 | 0.722973 | cpreh |
285d09beb363d4d85bb6d49b2cb85276da921958 | 13,234 | cpp | C++ | tests/Unit/ParallelAlgorithms/LinearSolver/ConjugateGradient/Test_ResidualMonitorActions.cpp | nilsvu/spectre | 1455b9a8d7e92db8ad600c66f54795c29c3052ee | [
"MIT"
] | 1 | 2022-01-11T00:17:33.000Z | 2022-01-11T00:17:33.000Z | tests/Unit/ParallelAlgorithms/LinearSolver/ConjugateGradient/Test_ResidualMonitorActions.cpp | nilsvu/spectre | 1455b9a8d7e92db8ad600c66f54795c29c3052ee | [
"MIT"
] | null | null | null | tests/Unit/ParallelAlgorithms/LinearSolver/ConjugateGradient/Test_ResidualMonitorActions.cpp | nilsvu/spectre | 1455b9a8d7e92db8ad600c66f54795c29c3052ee | [
"MIT"
] | null | null | null | // Distributed under the MIT License.
// See LICENSE.txt for details.
#include "Framework/TestingFramework.hpp"
#include <cstddef>
#include <limits>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#include "DataStructures/DataBox/DataBox.hpp"
#include "DataStructures/DataBox/Tag.hpp"
#include "DataStructures/DynamicVector.hpp"
#include "Framework/ActionTesting.hpp"
#include "Helpers/ParallelAlgorithms/LinearSolver/ResidualMonitorActionsTestHelpers.hpp"
#include "IO/Logging/Verbosity.hpp"
#include "IO/Observer/ObservationId.hpp"
#include "NumericalAlgorithms/Convergence/Criteria.hpp"
#include "NumericalAlgorithms/Convergence/HasConverged.hpp"
#include "NumericalAlgorithms/Convergence/Reason.hpp"
#include "Parallel/Actions/SetupDataBox.hpp"
#include "ParallelAlgorithms/LinearSolver/ConjugateGradient/ResidualMonitor.hpp"
#include "ParallelAlgorithms/LinearSolver/ConjugateGradient/ResidualMonitorActions.hpp"
#include "ParallelAlgorithms/LinearSolver/Observe.hpp"
#include "ParallelAlgorithms/LinearSolver/Tags.hpp"
#include "Utilities/Gsl.hpp"
#include "Utilities/Literals.hpp"
#include "Utilities/TMPL.hpp"
#include "Utilities/TaggedTuple.hpp"
namespace Parallel {
template <typename Metavariables>
class GlobalCache;
} // namespace Parallel
namespace helpers = ResidualMonitorActionsTestHelpers;
namespace {
struct TestLinearSolver {};
struct VectorTag : db::SimpleTag {
using type = blaze::DynamicVector<double>;
};
using fields_tag = VectorTag;
using residual_square_tag = LinearSolver::Tags::MagnitudeSquare<
LinearSolver::Tags::Residual<fields_tag>>;
using initial_residual_magnitude_tag = ::Tags::Initial<
LinearSolver::Tags::Magnitude<LinearSolver::Tags::Residual<fields_tag>>>;
template <typename Metavariables>
struct MockResidualMonitor {
using component_being_mocked =
LinearSolver::cg::detail::ResidualMonitor<Metavariables, fields_tag,
TestLinearSolver>;
using metavariables = Metavariables;
using chare_type = ActionTesting::MockSingletonChare;
using array_index = int;
using const_global_cache_tags =
typename LinearSolver::cg::detail::ResidualMonitor<
Metavariables, fields_tag, TestLinearSolver>::const_global_cache_tags;
using phase_dependent_action_list = tmpl::list<Parallel::PhaseActions<
typename Metavariables::Phase, Metavariables::Phase::Initialization,
tmpl::list<Actions::SetupDataBox,
LinearSolver::cg::detail::InitializeResidualMonitor<
fields_tag, TestLinearSolver>>>>;
};
// This is used to receive action calls from the residual monitor
template <typename Metavariables>
struct MockElementArray {
using component_being_mocked = void;
using metavariables = Metavariables;
using chare_type = ActionTesting::MockArrayChare;
using array_index = int;
using phase_dependent_action_list =
tmpl::list<Parallel::PhaseActions<typename Metavariables::Phase,
Metavariables::Phase::Initialization,
tmpl::list<>>>;
using inbox_tags = tmpl::list<
LinearSolver::cg::detail::Tags::InitialHasConverged<TestLinearSolver>,
LinearSolver::cg::detail::Tags::Alpha<TestLinearSolver>,
LinearSolver::cg::detail::Tags::ResidualRatioAndHasConverged<
TestLinearSolver>>;
};
struct Metavariables {
using component_list = tmpl::list<MockResidualMonitor<Metavariables>,
MockElementArray<Metavariables>,
helpers::MockObserverWriter<Metavariables>>;
enum class Phase { Initialization, RegisterWithObserver, Testing, Exit };
};
} // namespace
SPECTRE_TEST_CASE(
"Unit.Parallel.LinearSolver.ConjugateGradient.ResidualMonitorActions",
"[Unit][ParallelAlgorithms][LinearSolver][Actions]") {
using residual_monitor = MockResidualMonitor<Metavariables>;
using element_array = MockElementArray<Metavariables>;
using observer_writer = helpers::MockObserverWriter<Metavariables>;
const Convergence::Criteria convergence_criteria{2, 0., 0.5};
ActionTesting::MockRuntimeSystem<Metavariables> runner{
{::Verbosity::Verbose, convergence_criteria}};
// Setup mock residual monitor
ActionTesting::emplace_component<residual_monitor>(&runner, 0);
for (size_t i = 0; i < 2; ++i) {
ActionTesting::next_action<residual_monitor>(make_not_null(&runner), 0);
}
// Setup mock element array
ActionTesting::emplace_component<element_array>(&runner, 0);
// Setup mock observer writer
ActionTesting::emplace_component_and_initialize<observer_writer>(
&runner, 0,
{observers::ObservationId{}, std::string{}, std::vector<std::string>{},
std::tuple<size_t, double>{
0, std::numeric_limits<double>::signaling_NaN()}});
// DataBox shortcuts
const auto get_residual_monitor_tag =
[&runner](auto tag_v) -> decltype(auto) {
using tag = std::decay_t<decltype(tag_v)>;
return ActionTesting::get_databox_tag<residual_monitor, tag>(runner, 0);
};
const auto get_element_inbox_tag = [&runner](auto tag_v) -> decltype(auto) {
using tag = std::decay_t<decltype(tag_v)>;
return ActionTesting::get_inbox_tag<element_array, tag>(runner, 0);
};
const auto get_observer_writer_tag = [&runner](auto tag_v) -> decltype(auto) {
using tag = std::decay_t<decltype(tag_v)>;
return ActionTesting::get_databox_tag<observer_writer, tag>(runner, 0);
};
ActionTesting::set_phase(make_not_null(&runner),
Metavariables::Phase::Testing);
SECTION("InitializeResidual") {
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::InitializeResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 4.);
ActionTesting::invoke_queued_threaded_action<observer_writer>(
make_not_null(&runner), 0);
// Test residual monitor state
CHECK(get_residual_monitor_tag(residual_square_tag{}) == 4.);
CHECK(get_residual_monitor_tag(initial_residual_magnitude_tag{}) == 2.);
// Test element state
CHECK_FALSE(get_element_inbox_tag(
LinearSolver::cg::detail::Tags::InitialHasConverged<
TestLinearSolver>{})
.at(0));
// Test observer writer state
CHECK(get_observer_writer_tag(helpers::CheckSubfileNameTag{}) ==
"/TestLinearSolverResiduals");
CHECK(get_observer_writer_tag(helpers::CheckReductionNamesTag{}) ==
std::vector<std::string>{"Iteration", "Residual"});
CHECK(get<0>(get_observer_writer_tag(helpers::CheckReductionDataTag{})) ==
0);
CHECK(get<1>(get_observer_writer_tag(helpers::CheckReductionDataTag{})) ==
approx(2.));
}
SECTION("InitializeResidualAndConverge") {
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::InitializeResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 0.);
// Test residual monitor state
CHECK(get_residual_monitor_tag(residual_square_tag{}) == 0.);
CHECK(get_residual_monitor_tag(initial_residual_magnitude_tag{}) == 0.);
// Test element state
CHECK(get_element_inbox_tag(
LinearSolver::cg::detail::Tags::InitialHasConverged<
TestLinearSolver>{})
.at(0));
}
SECTION("ComputeAlpha") {
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::InitializeResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 1.);
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::ComputeAlpha<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 0_st, 2.);
// Test residual monitor state
CHECK(get_residual_monitor_tag(residual_square_tag{}) == 1.);
// Test element state
CHECK(get_element_inbox_tag(
LinearSolver::cg::detail::Tags::Alpha<TestLinearSolver>{})
.at(0) == 0.5);
}
SECTION("UpdateResidual") {
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::InitializeResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 9.);
ActionTesting::invoke_queued_threaded_action<observer_writer>(
make_not_null(&runner), 0);
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::UpdateResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 0_st, 4.);
ActionTesting::invoke_queued_threaded_action<observer_writer>(
make_not_null(&runner), 0);
// Test residual monitor state
CHECK(get_residual_monitor_tag(residual_square_tag{}) == 4.);
CHECK(get_residual_monitor_tag(initial_residual_magnitude_tag{}) == 3.);
// Test element state
const auto& element_inbox =
get_element_inbox_tag(
LinearSolver::cg::detail::Tags::ResidualRatioAndHasConverged<
TestLinearSolver>{})
.at(0);
CHECK(get<0>(element_inbox) == approx(4. / 9.));
const auto& has_converged = get<1>(element_inbox);
CHECK_FALSE(has_converged);
// Test observer writer state
CHECK(get_observer_writer_tag(helpers::CheckSubfileNameTag{}) ==
"/TestLinearSolverResiduals");
CHECK(get_observer_writer_tag(helpers::CheckReductionNamesTag{}) ==
std::vector<std::string>{"Iteration", "Residual"});
CHECK(get<0>(get_observer_writer_tag(helpers::CheckReductionDataTag{})) ==
1);
CHECK(get<1>(get_observer_writer_tag(helpers::CheckReductionDataTag{})) ==
approx(2.));
}
SECTION("ConvergeByAbsoluteResidual") {
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::InitializeResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 1.);
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::UpdateResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 0_st, 0.);
// Test residual monitor state
CHECK(get_residual_monitor_tag(residual_square_tag{}) == 0.);
CHECK(get_residual_monitor_tag(initial_residual_magnitude_tag{}) == 1.);
// Test element state
const auto& element_inbox =
get_element_inbox_tag(
LinearSolver::cg::detail::Tags::ResidualRatioAndHasConverged<
TestLinearSolver>{})
.at(0);
CHECK(get<0>(element_inbox) == 0.);
const auto& has_converged = get<1>(element_inbox);
REQUIRE(has_converged);
CHECK(has_converged.reason() == Convergence::Reason::AbsoluteResidual);
}
SECTION("ConvergeByMaxIterations") {
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::InitializeResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 1.);
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::UpdateResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 1_st, 1.);
// Test residual monitor state
CHECK(get_residual_monitor_tag(residual_square_tag{}) == 1.);
CHECK(get_residual_monitor_tag(initial_residual_magnitude_tag{}) == 1.);
// Test element state
const auto& element_inbox =
get_element_inbox_tag(
LinearSolver::cg::detail::Tags::ResidualRatioAndHasConverged<
TestLinearSolver>{})
.at(1);
CHECK(get<0>(element_inbox) == 1.);
const auto& has_converged = get<1>(element_inbox);
REQUIRE(has_converged);
CHECK(has_converged.reason() == Convergence::Reason::MaxIterations);
}
SECTION("ConvergeByRelativeResidual") {
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::InitializeResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 1.);
ActionTesting::simple_action<
residual_monitor, LinearSolver::cg::detail::UpdateResidual<
fields_tag, TestLinearSolver, element_array>>(
make_not_null(&runner), 0, 0_st, 0.25);
// Test residual monitor state
CHECK(get_residual_monitor_tag(residual_square_tag{}) == 0.25);
CHECK(get_residual_monitor_tag(initial_residual_magnitude_tag{}) == 1.);
// Test element state
const auto& element_inbox =
get_element_inbox_tag(
LinearSolver::cg::detail::Tags::ResidualRatioAndHasConverged<
TestLinearSolver>{})
.at(0);
CHECK(get<0>(element_inbox) == 0.25);
const auto& has_converged = get<1>(element_inbox);
REQUIRE(has_converged);
CHECK(has_converged.reason() == Convergence::Reason::RelativeResidual);
}
}
| 42.690323 | 88 | 0.688076 | nilsvu |
2861aa259f317924e1cfdd1e51a5e0a6d474dab0 | 299 | cpp | C++ | project_template/src/BotController.cpp | JeanMarcZimmer/libDiscordBot | dadd68a15b89f1577fd43a56b6fcf90330f1e1e8 | [
"MIT"
] | 11 | 2020-05-16T08:41:15.000Z | 2022-03-19T23:03:42.000Z | project_template/src/BotController.cpp | JeanMarcZimmer/libDiscordBot | dadd68a15b89f1577fd43a56b6fcf90330f1e1e8 | [
"MIT"
] | 4 | 2020-05-15T06:59:01.000Z | 2020-10-06T18:13:23.000Z | project_template/src/BotController.cpp | JeanMarcZimmer/libDiscordBot | dadd68a15b89f1577fd43a56b6fcf90330f1e1e8 | [
"MIT"
] | 5 | 2020-05-16T09:06:39.000Z | 2021-02-23T21:12:46.000Z | #include <BotController.hpp>
#include <HelloCommand.hpp>
void CBotController::OnReady()
{
//Registers a new command, with description for the builtin help command.
RegisterCommand<CHelloCommand>({"hello", "Writes \"Hello World!\" into the channel", 0, "", AccessMode::EVERYBODY}, Client);
} | 37.375 | 128 | 0.729097 | JeanMarcZimmer |
2863b0ff63c71fd80a33401bda46e097992bf67f | 9,068 | cpp | C++ | .vim/sourceCode/ogre_src_v1-8-1/RenderSystems/Direct3D11/src/OgreD3D11VertexDeclaration.cpp | lakehui/Vim_config | 6cab80dc1209b34bf6379f42b1a92790bd0c146b | [
"MIT"
] | null | null | null | .vim/sourceCode/ogre_src_v1-8-1/RenderSystems/Direct3D11/src/OgreD3D11VertexDeclaration.cpp | lakehui/Vim_config | 6cab80dc1209b34bf6379f42b1a92790bd0c146b | [
"MIT"
] | null | null | null | .vim/sourceCode/ogre_src_v1-8-1/RenderSystems/Direct3D11/src/OgreD3D11VertexDeclaration.cpp | lakehui/Vim_config | 6cab80dc1209b34bf6379f42b1a92790bd0c146b | [
"MIT"
] | 2 | 2019-05-16T08:19:45.000Z | 2021-01-24T21:02:43.000Z | /*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2012 Torus Knot Software Ltd
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 "OgreD3D11VertexDeclaration.h"
#include "OgreD3D11Mappings.h"
#include "OgreD3D11HLSLProgram.h"
#include "OgreD3D11Device.h"
namespace Ogre {
//-----------------------------------------------------------------------
D3D11VertexDeclaration::D3D11VertexDeclaration(D3D11Device & device)
:
mlpD3DDevice(device)
, mNeedsRebuild(true)
{
}
//-----------------------------------------------------------------------
D3D11VertexDeclaration::~D3D11VertexDeclaration()
{
{
ShaderToILayoutMapIterator iter = mShaderToILayoutMap.begin();
ShaderToILayoutMapIterator iterE = mShaderToILayoutMap.end();
for ( ; iter != iterE ; iter++)
{
iter->second->Release();
}
}
{
ShaderToInputDescIterator iter = mD3delems.begin();
ShaderToInputDescIterator iterE = mD3delems.end();
for( ; iter != iterE ; iter++ )
{
SAFE_DELETE_ARRAY(iter->second);
}
}
}
//-----------------------------------------------------------------------
const VertexElement& D3D11VertexDeclaration::addElement(unsigned short source,
size_t offset, VertexElementType theType,
VertexElementSemantic semantic, unsigned short index)
{
mNeedsRebuild = true;
return VertexDeclaration::addElement(source, offset, theType, semantic, index);
}
//-----------------------------------------------------------------------------
const VertexElement& D3D11VertexDeclaration::insertElement(unsigned short atPosition,
unsigned short source, size_t offset, VertexElementType theType,
VertexElementSemantic semantic, unsigned short index)
{
mNeedsRebuild = true;
return VertexDeclaration::insertElement(atPosition, source, offset, theType, semantic, index);
}
//-----------------------------------------------------------------------
void D3D11VertexDeclaration::removeElement(unsigned short elem_index)
{
VertexDeclaration::removeElement(elem_index);
mNeedsRebuild = true;
}
//-----------------------------------------------------------------------
void D3D11VertexDeclaration::removeElement(VertexElementSemantic semantic, unsigned short index)
{
VertexDeclaration::removeElement(semantic, index);
mNeedsRebuild = true;
}
//-----------------------------------------------------------------------
void D3D11VertexDeclaration::removeAllElements(void)
{
VertexDeclaration::removeAllElements();
mNeedsRebuild = true;
}
//-----------------------------------------------------------------------
void D3D11VertexDeclaration::modifyElement(unsigned short elem_index,
unsigned short source, size_t offset, VertexElementType theType,
VertexElementSemantic semantic, unsigned short index)
{
VertexDeclaration::modifyElement(elem_index, source, offset, theType, semantic, index);
mNeedsRebuild = true;
}
//-----------------------------------------------------------------------
D3D11_INPUT_ELEMENT_DESC * D3D11VertexDeclaration::getD3DVertexDeclaration(D3D11HLSLProgram* boundVertexProgram, VertexBufferBinding* binding)
{
// Create D3D elements
size_t iNumElements = boundVertexProgram->getNumInputs();
if (mD3delems.find(boundVertexProgram) == mD3delems.end())
{
D3D11_INPUT_ELEMENT_DESC* D3delems = new D3D11_INPUT_ELEMENT_DESC[iNumElements];
ZeroMemory(D3delems, sizeof(D3D11_INPUT_ELEMENT_DESC) * iNumElements);
unsigned int idx;
for (unsigned int idx = 0; idx < iNumElements; ++idx)
{
D3D11_SIGNATURE_PARAMETER_DESC inputDesc = boundVertexProgram->getInputParamDesc(idx);
VertexElementList::const_iterator i, iend;
iend = mElementList.end();
bool found = false;
for (i = mElementList.begin(); i != iend; ++i)
{
LPCSTR semanticName = D3D11Mappings::get(i->getSemantic());
UINT semanticIndex = i->getIndex();
if(
strcmp(semanticName, inputDesc.SemanticName) == 0
&& semanticIndex == inputDesc.SemanticIndex
)
{
found = true;
break;
}
}
if(!found)
{
// find by pos
i = mElementList.begin();
for (int count = 0; count < idx && i != iend; count++, ++i)
{
}
if (i != iend)
{
found = true;
}
}
if(!found)
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Unable to set D3D11 vertex declaration" ,
"D3D11VertexDeclaration::getILayoutByShader");
}
D3delems[idx].SemanticName = inputDesc.SemanticName;
D3delems[idx].SemanticIndex = inputDesc.SemanticIndex;
D3delems[idx].Format = D3D11Mappings::get(i->getType());
D3delems[idx].InputSlot = i->getSource();
D3delems[idx].AlignedByteOffset = static_cast<WORD>(i->getOffset());
D3delems[idx].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
D3delems[idx].InstanceDataStepRate = 0;
VertexBufferBinding::VertexBufferBindingMap::const_iterator foundIter;
foundIter = binding->getBindings().find(i->getSource());
if ( foundIter != binding->getBindings().end() )
{
HardwareVertexBufferSharedPtr bufAtSlot = foundIter->second;
if ( bufAtSlot->getIsInstanceData() )
{
D3delems[idx].InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA;
D3delems[idx].InstanceDataStepRate = bufAtSlot->getInstanceDataStepRate();
}
}
else
{
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR,
"Unable to found a bound vertex for a slot that is used in the vertex declaration." ,
"D3D11VertexDeclaration::getD3DVertexDeclaration");
}
}
mD3delems[boundVertexProgram] = D3delems;
}
return mD3delems[boundVertexProgram];
}
//-----------------------------------------------------------------------
ID3D11InputLayout* D3D11VertexDeclaration::getILayoutByShader(D3D11HLSLProgram* boundVertexProgram, VertexBufferBinding* binding)
{
ShaderToILayoutMapIterator foundIter = mShaderToILayoutMap.find(boundVertexProgram);
ID3D11InputLayout* pVertexLayout = 0;
if (foundIter == mShaderToILayoutMap.end())
{
// if not found - create
DWORD dwShaderFlags = 0;
const MicroCode & vSBuf = boundVertexProgram->getMicroCode();
D3D11_INPUT_ELEMENT_DESC * pVertexDecl=getD3DVertexDeclaration(boundVertexProgram, binding);
HRESULT hr = mlpD3DDevice->CreateInputLayout(
pVertexDecl,
boundVertexProgram->getNumInputs(),
&vSBuf[0],
vSBuf.size(),
&pVertexLayout );
if (FAILED(hr)|| mlpD3DDevice.isError())
{
String errorDescription = mlpD3DDevice.getErrorDescription();
OGRE_EXCEPT(Exception::ERR_RENDERINGAPI_ERROR, "Unable to set D3D11 vertex declaration"+errorDescription ,
"D3D11VertexDeclaration::getILayoutByShader");
}
mShaderToILayoutMap[boundVertexProgram] = pVertexLayout;
}
else
{
pVertexLayout = foundIter->second;
}
return pVertexLayout;
}
//-----------------------------------------------------------------------
void D3D11VertexDeclaration::bindToShader(D3D11HLSLProgram* boundVertexProgram, VertexBufferBinding* binding)
{
ID3D11InputLayout* pVertexLayout = getILayoutByShader(boundVertexProgram, binding);
// Set the input layout
mlpD3DDevice.GetImmediateContext()->IASetInputLayout( pVertexLayout);
}
}
| 36.712551 | 143 | 0.609285 | lakehui |
28648de02bca155caafac0e6842abfe1053e83c0 | 1,742 | hpp | C++ | include/private/coherence/component/net/extend/protocol/cache/SizeRequest.hpp | chpatel3/coherence-cpp-extend-client | 4ea5267eae32064dff1e73339aa3fbc9347ef0f6 | [
"UPL-1.0",
"Apache-2.0"
] | 6 | 2020-07-01T21:38:30.000Z | 2021-11-03T01:35:11.000Z | include/private/coherence/component/net/extend/protocol/cache/SizeRequest.hpp | chpatel3/coherence-cpp-extend-client | 4ea5267eae32064dff1e73339aa3fbc9347ef0f6 | [
"UPL-1.0",
"Apache-2.0"
] | 1 | 2020-07-24T17:29:22.000Z | 2020-07-24T18:29:04.000Z | include/private/coherence/component/net/extend/protocol/cache/SizeRequest.hpp | chpatel3/coherence-cpp-extend-client | 4ea5267eae32064dff1e73339aa3fbc9347ef0f6 | [
"UPL-1.0",
"Apache-2.0"
] | 6 | 2020-07-10T18:40:58.000Z | 2022-02-18T01:23:40.000Z | /*
* Copyright (c) 2000, 2020, Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at
* http://oss.oracle.com/licenses/upl.
*/
#ifndef COH_SIZE_REQUEST_HPP
#define COH_SIZE_REQUEST_HPP
#include "coherence/lang.ns"
#include "private/coherence/component/net/extend/AbstractPofResponse.hpp"
#include "private/coherence/component/net/extend/protocol/cache/NamedCacheRequest.hpp"
COH_OPEN_NAMESPACE6(coherence,component,net,extend,protocol,cache)
using coherence::component::net::extend::AbstractPofResponse;
/**
* Map::size() Request message.
*
* @author jh 2008.02.18
*/
class COH_EXPORT SizeRequest
: public class_spec<SizeRequest,
extends<NamedCacheRequest> >
{
friend class factory<SizeRequest>;
// ----- constructors ---------------------------------------------------
protected:
/**
* Create a new SizeRequest instance.
*/
SizeRequest();
private:
/**
* Blocked copy constructor.
*/
SizeRequest(const SizeRequest&);
// ----- Message interface ----------------------------------------------
public:
/**
* {@inheritDoc}
*/
virtual int32_t getTypeId() const;
// ----- internal methods -----------------------------------------------
protected:
/**
* {@inheritDoc}
*/
virtual void onRun(AbstractPofResponse::Handle hResponse);
// ----- constants ------------------------------------------------------
public:
/**
* The type identifier of this Message class.
*/
static const int32_t type_id = 1;
};
COH_CLOSE_NAMESPACE6
#endif // COH_SIZE_REQUEST_HPP
| 22.921053 | 86 | 0.556257 | chpatel3 |
286551dad47c0ad11ec44ab801f38281a492af76 | 857 | hpp | C++ | src/backend/opencl/program.hpp | ckeitz/arrayfire | a1a1bbbc8487a032eb27a6c894b1b3dfb19d123b | [
"BSD-3-Clause"
] | 4 | 2015-12-16T09:41:32.000Z | 2018-10-29T10:38:53.000Z | src/backend/opencl/program.hpp | ckeitz/arrayfire | a1a1bbbc8487a032eb27a6c894b1b3dfb19d123b | [
"BSD-3-Clause"
] | 3 | 2015-11-15T18:43:47.000Z | 2015-12-16T09:43:14.000Z | src/backend/opencl/program.hpp | pavanky/arrayfire | f983a79c7d402450bd2a704bbc1015b89f0cd504 | [
"BSD-3-Clause"
] | null | null | null | /*******************************************************
* Copyright (c) 2014, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#pragma once
#include <cl.hpp>
#include <string>
#include <mutex>
using cl::Buffer;
using cl::Program;
using cl::Kernel;
using cl::make_kernel;
using cl::EnqueueArgs;
using cl::NDRange;
using std::string;
namespace opencl
{
void buildProgram(cl::Program &prog,
const char *ker_str, const int ker_len, std::string options);
void buildProgram(cl::Program &prog,
const int num_files,
const char **ker_str, const int *ker_len, std::string options);
}
| 26.78125 | 85 | 0.576429 | ckeitz |
2869c0b3245e4843422e0ded7c563b50e74bd872 | 354,938 | cpp | C++ | My Project Log/Classes/Native/Il2CppCompilerCalculateTypeValues_17Table.cpp | 2Dkun/My-Quest-Log | c2d7f17670631c2f58333ae81527b7bed82b1c57 | [
"Apache-2.0"
] | null | null | null | My Project Log/Classes/Native/Il2CppCompilerCalculateTypeValues_17Table.cpp | 2Dkun/My-Quest-Log | c2d7f17670631c2f58333ae81527b7bed82b1c57 | [
"Apache-2.0"
] | null | null | null | My Project Log/Classes/Native/Il2CppCompilerCalculateTypeValues_17Table.cpp | 2Dkun/My-Quest-Log | c2d7f17670631c2f58333ae81527b7bed82b1c57 | [
"Apache-2.0"
] | 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 "class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "object-internals.h"
// System.Collections.Generic.List`1<UnityEngine.UI.StencilMaterial/MatEntry>
struct List_1_t978059096;
// UnityEngine.UI.Collections.IndexedSet`1<UnityEngine.UI.IClipper>
struct IndexedSet_1_t1847997905;
// UnityEngine.Vector3[]
struct Vector3U5BU5D_t2251457841;
// UnityEngine.EventSystems.PointerEventData
struct PointerEventData_t164029711;
// UnityEngine.UI.Scrollbar
struct Scrollbar_t3517713769;
// UnityEngine.Events.InvokableCallList
struct InvokableCallList_t2018023274;
// UnityEngine.Events.PersistentCallGroup
struct PersistentCallGroup_t312359780;
// System.String
struct String_t;
// UnityEngine.UI.InputField
struct InputField_t3950490122;
// UnityEngine.RectTransform
struct RectTransform_t3700156813;
// UnityEngine.UI.ObjectPool`1<UnityEngine.UI.LayoutRebuilder>
struct ObjectPool_1_t960346694;
// UnityEngine.RectTransform/ReapplyDrivenProperties
struct ReapplyDrivenProperties_t2885473943;
// System.Predicate`1<UnityEngine.Component>
struct Predicate_1_t2905866299;
// UnityEngine.Events.UnityAction`1<UnityEngine.Component>
struct UnityAction_1_t2003765821;
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single>
struct Func_2_t3786485805;
// UnityEngine.UI.ReflectionMethodsCache/Raycast3DCallback
struct Raycast3DCallback_t3731579633;
// UnityEngine.UI.ReflectionMethodsCache/RaycastAllCallback
struct RaycastAllCallback_t1653149632;
// UnityEngine.UI.ReflectionMethodsCache/Raycast2DCallback
struct Raycast2DCallback_t890783784;
// UnityEngine.UI.ReflectionMethodsCache/GetRayIntersectionAllCallback
struct GetRayIntersectionAllCallback_t3143667439;
// System.Collections.Generic.Dictionary`2<UnityEngine.Canvas,UnityEngine.UI.Collections.IndexedSet`1<UnityEngine.UI.Graphic>>
struct Dictionary_2_t136510004;
// System.Collections.Generic.List`1<UnityEngine.UI.Graphic>
struct List_1_t4053678182;
// System.Byte
struct Byte_t3448579160;
// System.Double
struct Double_t2492335957;
// System.UInt16
struct UInt16_t3344081709;
// System.Object[]
struct ObjectU5BU5D_t3885370135;
// UnityEngine.Sprite
struct Sprite_t3419621700;
// System.Char[]
struct CharU5BU5D_t1522321484;
// System.Void
struct Void_t1901624353;
// System.Collections.Generic.List`1<UnityEngine.Vector3>
struct List_1_t3585477728;
// System.Collections.Generic.List`1<UnityEngine.Color32>
struct List_1_t1617812587;
// System.Collections.Generic.List`1<UnityEngine.Vector2>
struct List_1_t3076900357;
// System.Collections.Generic.List`1<UnityEngine.Vector4>
struct List_1_t3331801177;
// System.Collections.Generic.List`1<System.Int32>
struct List_1_t1408133244;
// UnityEngine.Collider
struct Collider_t3058509131;
// UnityEngine.Collider2D
struct Collider2D_t2180151806;
// System.Reflection.MethodInfo
struct MethodInfo_t;
// System.DelegateData
struct DelegateData_t3352901259;
// UnityEngine.Material
struct Material_t3939796247;
// UnityEngine.UI.Selectable
struct Selectable_t3916939825;
// UnityEngine.RaycastHit[]
struct RaycastHitU5BU5D_t1627239092;
// System.IAsyncResult
struct IAsyncResult_t2851905845;
// System.AsyncCallback
struct AsyncCallback_t2537533359;
// UnityEngine.RaycastHit2D[]
struct RaycastHit2DU5BU5D_t384320170;
// UnityEngine.Canvas
struct Canvas_t2948613984;
// UnityEngine.RectOffset
struct RectOffset_t3582970358;
// System.Collections.Generic.List`1<UnityEngine.RectTransform>
struct List_1_t2923042653;
// UnityEngine.UI.Graphic
struct Graphic_t535825046;
// UnityEngine.UI.RectangularVertexClipper
struct RectangularVertexClipper_t3760579564;
// System.Collections.Generic.HashSet`1<UnityEngine.UI.IClippable>
struct HashSet_1_t3635898901;
// System.Collections.Generic.List`1<UnityEngine.UI.RectMask2D>
struct List_1_t1622370054;
// System.Collections.Generic.List`1<UnityEngine.UI.Toggle>
struct List_1_t3773614295;
// System.Predicate`1<UnityEngine.UI.Toggle>
struct Predicate_1_t2571060369;
// System.Func`2<UnityEngine.UI.Toggle,System.Boolean>
struct Func_2_t4116566899;
// UnityEngine.Texture2D
struct Texture2D_t1384570725;
// UnityEngine.CanvasRenderer
struct CanvasRenderer_t4042724174;
// UnityEngine.Events.UnityAction
struct UnityAction_t516660186;
// UnityEngine.Mesh
struct Mesh_t3666751399;
// UnityEngine.UI.VertexHelper
struct VertexHelper_t122899649;
// UnityEngine.UI.CoroutineTween.TweenRunner`1<UnityEngine.UI.CoroutineTween.ColorTween>
struct TweenRunner_1_t812855407;
// UnityEngine.UI.ScrollRect/ScrollRectEvent
struct ScrollRectEvent_t1918886797;
// System.Collections.Generic.List`1<UnityEngine.UI.Selectable>
struct List_1_t3139825665;
// UnityEngine.UI.AnimationTriggers
struct AnimationTriggers_t3098459444;
// System.Collections.Generic.List`1<UnityEngine.CanvasGroup>
struct List_1_t554132179;
// UnityEngine.TouchScreenKeyboard
struct TouchScreenKeyboard_t1595360201;
// UnityEngine.UI.Text
struct Text_t2925720878;
// UnityEngine.UI.InputField/SubmitEvent
struct SubmitEvent_t2550651048;
// UnityEngine.UI.InputField/OnChangeEvent
struct OnChangeEvent_t970128749;
// UnityEngine.UI.InputField/OnValidateInput
struct OnValidateInput_t977755270;
// UnityEngine.UIVertex[]
struct UIVertexU5BU5D_t2534070687;
// UnityEngine.TextGenerator
struct TextGenerator_t1838611233;
// UnityEngine.Coroutine
struct Coroutine_t3331234651;
// UnityEngine.Event
struct Event_t1644639841;
// UnityEngine.UI.RectMask2D
struct RectMask2D_t2399484214;
// UnityEngine.UI.MaskableGraphic/CullStateChangedEvent
struct CullStateChangedEvent_t2536871658;
// UnityEngine.UI.Scrollbar/ScrollEvent
struct ScrollEvent_t2334911764;
// System.Comparison`1<UnityEngine.UI.Graphic>
struct Comparison_1_t466931136;
// UnityEngine.UI.ToggleGroup
struct ToggleGroup_t171083327;
// UnityEngine.UI.Toggle/ToggleEvent
struct ToggleEvent_t538146237;
// UnityEngine.UI.Slider/SliderEvent
struct SliderEvent_t260680582;
// UnityEngine.UI.Image
struct Image_t2917938530;
// UnityEngine.Transform
struct Transform_t2468616896;
// UnityEngine.Texture
struct Texture_t2354860603;
// UnityEngine.Vector2[]
struct Vector2U5BU5D_t572702552;
// UnityEngine.UI.FontData
struct FontData_t3568634606;
#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 STENCILMATERIAL_T3060600715_H
#define STENCILMATERIAL_T3060600715_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.StencilMaterial
struct StencilMaterial_t3060600715 : public RuntimeObject
{
public:
public:
};
struct StencilMaterial_t3060600715_StaticFields
{
public:
// System.Collections.Generic.List`1<UnityEngine.UI.StencilMaterial/MatEntry> UnityEngine.UI.StencilMaterial::m_List
List_1_t978059096 * ___m_List_0;
public:
inline static int32_t get_offset_of_m_List_0() { return static_cast<int32_t>(offsetof(StencilMaterial_t3060600715_StaticFields, ___m_List_0)); }
inline List_1_t978059096 * get_m_List_0() const { return ___m_List_0; }
inline List_1_t978059096 ** get_address_of_m_List_0() { return &___m_List_0; }
inline void set_m_List_0(List_1_t978059096 * value)
{
___m_List_0 = value;
Il2CppCodeGenWriteBarrier((&___m_List_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // STENCILMATERIAL_T3060600715_H
#ifndef CLIPPERREGISTRY_T406775284_H
#define CLIPPERREGISTRY_T406775284_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ClipperRegistry
struct ClipperRegistry_t406775284 : public RuntimeObject
{
public:
// UnityEngine.UI.Collections.IndexedSet`1<UnityEngine.UI.IClipper> UnityEngine.UI.ClipperRegistry::m_Clippers
IndexedSet_1_t1847997905 * ___m_Clippers_1;
public:
inline static int32_t get_offset_of_m_Clippers_1() { return static_cast<int32_t>(offsetof(ClipperRegistry_t406775284, ___m_Clippers_1)); }
inline IndexedSet_1_t1847997905 * get_m_Clippers_1() const { return ___m_Clippers_1; }
inline IndexedSet_1_t1847997905 ** get_address_of_m_Clippers_1() { return &___m_Clippers_1; }
inline void set_m_Clippers_1(IndexedSet_1_t1847997905 * value)
{
___m_Clippers_1 = value;
Il2CppCodeGenWriteBarrier((&___m_Clippers_1), value);
}
};
struct ClipperRegistry_t406775284_StaticFields
{
public:
// UnityEngine.UI.ClipperRegistry UnityEngine.UI.ClipperRegistry::s_Instance
ClipperRegistry_t406775284 * ___s_Instance_0;
public:
inline static int32_t get_offset_of_s_Instance_0() { return static_cast<int32_t>(offsetof(ClipperRegistry_t406775284_StaticFields, ___s_Instance_0)); }
inline ClipperRegistry_t406775284 * get_s_Instance_0() const { return ___s_Instance_0; }
inline ClipperRegistry_t406775284 ** get_address_of_s_Instance_0() { return &___s_Instance_0; }
inline void set_s_Instance_0(ClipperRegistry_t406775284 * value)
{
___s_Instance_0 = value;
Il2CppCodeGenWriteBarrier((&___s_Instance_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CLIPPERREGISTRY_T406775284_H
#ifndef CLIPPING_T759274911_H
#define CLIPPING_T759274911_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Clipping
struct Clipping_t759274911 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CLIPPING_T759274911_H
#ifndef RECTANGULARVERTEXCLIPPER_T3760579564_H
#define RECTANGULARVERTEXCLIPPER_T3760579564_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.RectangularVertexClipper
struct RectangularVertexClipper_t3760579564 : public RuntimeObject
{
public:
// UnityEngine.Vector3[] UnityEngine.UI.RectangularVertexClipper::m_WorldCorners
Vector3U5BU5D_t2251457841* ___m_WorldCorners_0;
// UnityEngine.Vector3[] UnityEngine.UI.RectangularVertexClipper::m_CanvasCorners
Vector3U5BU5D_t2251457841* ___m_CanvasCorners_1;
public:
inline static int32_t get_offset_of_m_WorldCorners_0() { return static_cast<int32_t>(offsetof(RectangularVertexClipper_t3760579564, ___m_WorldCorners_0)); }
inline Vector3U5BU5D_t2251457841* get_m_WorldCorners_0() const { return ___m_WorldCorners_0; }
inline Vector3U5BU5D_t2251457841** get_address_of_m_WorldCorners_0() { return &___m_WorldCorners_0; }
inline void set_m_WorldCorners_0(Vector3U5BU5D_t2251457841* value)
{
___m_WorldCorners_0 = value;
Il2CppCodeGenWriteBarrier((&___m_WorldCorners_0), value);
}
inline static int32_t get_offset_of_m_CanvasCorners_1() { return static_cast<int32_t>(offsetof(RectangularVertexClipper_t3760579564, ___m_CanvasCorners_1)); }
inline Vector3U5BU5D_t2251457841* get_m_CanvasCorners_1() const { return ___m_CanvasCorners_1; }
inline Vector3U5BU5D_t2251457841** get_address_of_m_CanvasCorners_1() { return &___m_CanvasCorners_1; }
inline void set_m_CanvasCorners_1(Vector3U5BU5D_t2251457841* value)
{
___m_CanvasCorners_1 = value;
Il2CppCodeGenWriteBarrier((&___m_CanvasCorners_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECTANGULARVERTEXCLIPPER_T3760579564_H
#ifndef SETPROPERTYUTILITY_T18317635_H
#define SETPROPERTYUTILITY_T18317635_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.SetPropertyUtility
struct SetPropertyUtility_t18317635 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SETPROPERTYUTILITY_T18317635_H
#ifndef U3CCLICKREPEATU3EC__ITERATOR0_T2092823809_H
#define U3CCLICKREPEATU3EC__ITERATOR0_T2092823809_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Scrollbar/<ClickRepeat>c__Iterator0
struct U3CClickRepeatU3Ec__Iterator0_t2092823809 : public RuntimeObject
{
public:
// UnityEngine.EventSystems.PointerEventData UnityEngine.UI.Scrollbar/<ClickRepeat>c__Iterator0::eventData
PointerEventData_t164029711 * ___eventData_0;
// UnityEngine.UI.Scrollbar UnityEngine.UI.Scrollbar/<ClickRepeat>c__Iterator0::$this
Scrollbar_t3517713769 * ___U24this_1;
// System.Object UnityEngine.UI.Scrollbar/<ClickRepeat>c__Iterator0::$current
RuntimeObject * ___U24current_2;
// System.Boolean UnityEngine.UI.Scrollbar/<ClickRepeat>c__Iterator0::$disposing
bool ___U24disposing_3;
// System.Int32 UnityEngine.UI.Scrollbar/<ClickRepeat>c__Iterator0::$PC
int32_t ___U24PC_4;
public:
inline static int32_t get_offset_of_eventData_0() { return static_cast<int32_t>(offsetof(U3CClickRepeatU3Ec__Iterator0_t2092823809, ___eventData_0)); }
inline PointerEventData_t164029711 * get_eventData_0() const { return ___eventData_0; }
inline PointerEventData_t164029711 ** get_address_of_eventData_0() { return &___eventData_0; }
inline void set_eventData_0(PointerEventData_t164029711 * value)
{
___eventData_0 = value;
Il2CppCodeGenWriteBarrier((&___eventData_0), value);
}
inline static int32_t get_offset_of_U24this_1() { return static_cast<int32_t>(offsetof(U3CClickRepeatU3Ec__Iterator0_t2092823809, ___U24this_1)); }
inline Scrollbar_t3517713769 * get_U24this_1() const { return ___U24this_1; }
inline Scrollbar_t3517713769 ** get_address_of_U24this_1() { return &___U24this_1; }
inline void set_U24this_1(Scrollbar_t3517713769 * value)
{
___U24this_1 = value;
Il2CppCodeGenWriteBarrier((&___U24this_1), value);
}
inline static int32_t get_offset_of_U24current_2() { return static_cast<int32_t>(offsetof(U3CClickRepeatU3Ec__Iterator0_t2092823809, ___U24current_2)); }
inline RuntimeObject * get_U24current_2() const { return ___U24current_2; }
inline RuntimeObject ** get_address_of_U24current_2() { return &___U24current_2; }
inline void set_U24current_2(RuntimeObject * value)
{
___U24current_2 = value;
Il2CppCodeGenWriteBarrier((&___U24current_2), value);
}
inline static int32_t get_offset_of_U24disposing_3() { return static_cast<int32_t>(offsetof(U3CClickRepeatU3Ec__Iterator0_t2092823809, ___U24disposing_3)); }
inline bool get_U24disposing_3() const { return ___U24disposing_3; }
inline bool* get_address_of_U24disposing_3() { return &___U24disposing_3; }
inline void set_U24disposing_3(bool value)
{
___U24disposing_3 = value;
}
inline static int32_t get_offset_of_U24PC_4() { return static_cast<int32_t>(offsetof(U3CClickRepeatU3Ec__Iterator0_t2092823809, ___U24PC_4)); }
inline int32_t get_U24PC_4() const { return ___U24PC_4; }
inline int32_t* get_address_of_U24PC_4() { return &___U24PC_4; }
inline void set_U24PC_4(int32_t value)
{
___U24PC_4 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CCLICKREPEATU3EC__ITERATOR0_T2092823809_H
#ifndef MISC_T1087338646_H
#define MISC_T1087338646_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Misc
struct Misc_t1087338646 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MISC_T1087338646_H
#ifndef UNITYEVENTBASE_T1200889892_H
#define UNITYEVENTBASE_T1200889892_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Events.UnityEventBase
struct UnityEventBase_t1200889892 : public RuntimeObject
{
public:
// UnityEngine.Events.InvokableCallList UnityEngine.Events.UnityEventBase::m_Calls
InvokableCallList_t2018023274 * ___m_Calls_0;
// UnityEngine.Events.PersistentCallGroup UnityEngine.Events.UnityEventBase::m_PersistentCalls
PersistentCallGroup_t312359780 * ___m_PersistentCalls_1;
// System.String UnityEngine.Events.UnityEventBase::m_TypeName
String_t* ___m_TypeName_2;
// System.Boolean UnityEngine.Events.UnityEventBase::m_CallsDirty
bool ___m_CallsDirty_3;
public:
inline static int32_t get_offset_of_m_Calls_0() { return static_cast<int32_t>(offsetof(UnityEventBase_t1200889892, ___m_Calls_0)); }
inline InvokableCallList_t2018023274 * get_m_Calls_0() const { return ___m_Calls_0; }
inline InvokableCallList_t2018023274 ** get_address_of_m_Calls_0() { return &___m_Calls_0; }
inline void set_m_Calls_0(InvokableCallList_t2018023274 * value)
{
___m_Calls_0 = value;
Il2CppCodeGenWriteBarrier((&___m_Calls_0), value);
}
inline static int32_t get_offset_of_m_PersistentCalls_1() { return static_cast<int32_t>(offsetof(UnityEventBase_t1200889892, ___m_PersistentCalls_1)); }
inline PersistentCallGroup_t312359780 * get_m_PersistentCalls_1() const { return ___m_PersistentCalls_1; }
inline PersistentCallGroup_t312359780 ** get_address_of_m_PersistentCalls_1() { return &___m_PersistentCalls_1; }
inline void set_m_PersistentCalls_1(PersistentCallGroup_t312359780 * value)
{
___m_PersistentCalls_1 = value;
Il2CppCodeGenWriteBarrier((&___m_PersistentCalls_1), value);
}
inline static int32_t get_offset_of_m_TypeName_2() { return static_cast<int32_t>(offsetof(UnityEventBase_t1200889892, ___m_TypeName_2)); }
inline String_t* get_m_TypeName_2() const { return ___m_TypeName_2; }
inline String_t** get_address_of_m_TypeName_2() { return &___m_TypeName_2; }
inline void set_m_TypeName_2(String_t* value)
{
___m_TypeName_2 = value;
Il2CppCodeGenWriteBarrier((&___m_TypeName_2), value);
}
inline static int32_t get_offset_of_m_CallsDirty_3() { return static_cast<int32_t>(offsetof(UnityEventBase_t1200889892, ___m_CallsDirty_3)); }
inline bool get_m_CallsDirty_3() const { return ___m_CallsDirty_3; }
inline bool* get_address_of_m_CallsDirty_3() { return &___m_CallsDirty_3; }
inline void set_m_CallsDirty_3(bool value)
{
___m_CallsDirty_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNITYEVENTBASE_T1200889892_H
#ifndef U3CCARETBLINKU3EC__ITERATOR0_T1813892813_H
#define U3CCARETBLINKU3EC__ITERATOR0_T1813892813_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/<CaretBlink>c__Iterator0
struct U3CCaretBlinkU3Ec__Iterator0_t1813892813 : public RuntimeObject
{
public:
// System.Single UnityEngine.UI.InputField/<CaretBlink>c__Iterator0::<blinkPeriod>__1
float ___U3CblinkPeriodU3E__1_0;
// System.Boolean UnityEngine.UI.InputField/<CaretBlink>c__Iterator0::<blinkState>__1
bool ___U3CblinkStateU3E__1_1;
// UnityEngine.UI.InputField UnityEngine.UI.InputField/<CaretBlink>c__Iterator0::$this
InputField_t3950490122 * ___U24this_2;
// System.Object UnityEngine.UI.InputField/<CaretBlink>c__Iterator0::$current
RuntimeObject * ___U24current_3;
// System.Boolean UnityEngine.UI.InputField/<CaretBlink>c__Iterator0::$disposing
bool ___U24disposing_4;
// System.Int32 UnityEngine.UI.InputField/<CaretBlink>c__Iterator0::$PC
int32_t ___U24PC_5;
public:
inline static int32_t get_offset_of_U3CblinkPeriodU3E__1_0() { return static_cast<int32_t>(offsetof(U3CCaretBlinkU3Ec__Iterator0_t1813892813, ___U3CblinkPeriodU3E__1_0)); }
inline float get_U3CblinkPeriodU3E__1_0() const { return ___U3CblinkPeriodU3E__1_0; }
inline float* get_address_of_U3CblinkPeriodU3E__1_0() { return &___U3CblinkPeriodU3E__1_0; }
inline void set_U3CblinkPeriodU3E__1_0(float value)
{
___U3CblinkPeriodU3E__1_0 = value;
}
inline static int32_t get_offset_of_U3CblinkStateU3E__1_1() { return static_cast<int32_t>(offsetof(U3CCaretBlinkU3Ec__Iterator0_t1813892813, ___U3CblinkStateU3E__1_1)); }
inline bool get_U3CblinkStateU3E__1_1() const { return ___U3CblinkStateU3E__1_1; }
inline bool* get_address_of_U3CblinkStateU3E__1_1() { return &___U3CblinkStateU3E__1_1; }
inline void set_U3CblinkStateU3E__1_1(bool value)
{
___U3CblinkStateU3E__1_1 = value;
}
inline static int32_t get_offset_of_U24this_2() { return static_cast<int32_t>(offsetof(U3CCaretBlinkU3Ec__Iterator0_t1813892813, ___U24this_2)); }
inline InputField_t3950490122 * get_U24this_2() const { return ___U24this_2; }
inline InputField_t3950490122 ** get_address_of_U24this_2() { return &___U24this_2; }
inline void set_U24this_2(InputField_t3950490122 * value)
{
___U24this_2 = value;
Il2CppCodeGenWriteBarrier((&___U24this_2), value);
}
inline static int32_t get_offset_of_U24current_3() { return static_cast<int32_t>(offsetof(U3CCaretBlinkU3Ec__Iterator0_t1813892813, ___U24current_3)); }
inline RuntimeObject * get_U24current_3() const { return ___U24current_3; }
inline RuntimeObject ** get_address_of_U24current_3() { return &___U24current_3; }
inline void set_U24current_3(RuntimeObject * value)
{
___U24current_3 = value;
Il2CppCodeGenWriteBarrier((&___U24current_3), value);
}
inline static int32_t get_offset_of_U24disposing_4() { return static_cast<int32_t>(offsetof(U3CCaretBlinkU3Ec__Iterator0_t1813892813, ___U24disposing_4)); }
inline bool get_U24disposing_4() const { return ___U24disposing_4; }
inline bool* get_address_of_U24disposing_4() { return &___U24disposing_4; }
inline void set_U24disposing_4(bool value)
{
___U24disposing_4 = value;
}
inline static int32_t get_offset_of_U24PC_5() { return static_cast<int32_t>(offsetof(U3CCaretBlinkU3Ec__Iterator0_t1813892813, ___U24PC_5)); }
inline int32_t get_U24PC_5() const { return ___U24PC_5; }
inline int32_t* get_address_of_U24PC_5() { return &___U24PC_5; }
inline void set_U24PC_5(int32_t value)
{
___U24PC_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CCARETBLINKU3EC__ITERATOR0_T1813892813_H
#ifndef U3CDELAYEDSETDIRTYU3EC__ITERATOR0_T2304611114_H
#define U3CDELAYEDSETDIRTYU3EC__ITERATOR0_T2304611114_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.LayoutGroup/<DelayedSetDirty>c__Iterator0
struct U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114 : public RuntimeObject
{
public:
// UnityEngine.RectTransform UnityEngine.UI.LayoutGroup/<DelayedSetDirty>c__Iterator0::rectTransform
RectTransform_t3700156813 * ___rectTransform_0;
// System.Object UnityEngine.UI.LayoutGroup/<DelayedSetDirty>c__Iterator0::$current
RuntimeObject * ___U24current_1;
// System.Boolean UnityEngine.UI.LayoutGroup/<DelayedSetDirty>c__Iterator0::$disposing
bool ___U24disposing_2;
// System.Int32 UnityEngine.UI.LayoutGroup/<DelayedSetDirty>c__Iterator0::$PC
int32_t ___U24PC_3;
public:
inline static int32_t get_offset_of_rectTransform_0() { return static_cast<int32_t>(offsetof(U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114, ___rectTransform_0)); }
inline RectTransform_t3700156813 * get_rectTransform_0() const { return ___rectTransform_0; }
inline RectTransform_t3700156813 ** get_address_of_rectTransform_0() { return &___rectTransform_0; }
inline void set_rectTransform_0(RectTransform_t3700156813 * value)
{
___rectTransform_0 = value;
Il2CppCodeGenWriteBarrier((&___rectTransform_0), value);
}
inline static int32_t get_offset_of_U24current_1() { return static_cast<int32_t>(offsetof(U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114, ___U24current_1)); }
inline RuntimeObject * get_U24current_1() const { return ___U24current_1; }
inline RuntimeObject ** get_address_of_U24current_1() { return &___U24current_1; }
inline void set_U24current_1(RuntimeObject * value)
{
___U24current_1 = value;
Il2CppCodeGenWriteBarrier((&___U24current_1), value);
}
inline static int32_t get_offset_of_U24disposing_2() { return static_cast<int32_t>(offsetof(U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114, ___U24disposing_2)); }
inline bool get_U24disposing_2() const { return ___U24disposing_2; }
inline bool* get_address_of_U24disposing_2() { return &___U24disposing_2; }
inline void set_U24disposing_2(bool value)
{
___U24disposing_2 = value;
}
inline static int32_t get_offset_of_U24PC_3() { return static_cast<int32_t>(offsetof(U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114, ___U24PC_3)); }
inline int32_t get_U24PC_3() const { return ___U24PC_3; }
inline int32_t* get_address_of_U24PC_3() { return &___U24PC_3; }
inline void set_U24PC_3(int32_t value)
{
___U24PC_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CDELAYEDSETDIRTYU3EC__ITERATOR0_T2304611114_H
#ifndef LAYOUTREBUILDER_T2045564245_H
#define LAYOUTREBUILDER_T2045564245_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.LayoutRebuilder
struct LayoutRebuilder_t2045564245 : public RuntimeObject
{
public:
// UnityEngine.RectTransform UnityEngine.UI.LayoutRebuilder::m_ToRebuild
RectTransform_t3700156813 * ___m_ToRebuild_0;
// System.Int32 UnityEngine.UI.LayoutRebuilder::m_CachedHashFromTransform
int32_t ___m_CachedHashFromTransform_1;
public:
inline static int32_t get_offset_of_m_ToRebuild_0() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245, ___m_ToRebuild_0)); }
inline RectTransform_t3700156813 * get_m_ToRebuild_0() const { return ___m_ToRebuild_0; }
inline RectTransform_t3700156813 ** get_address_of_m_ToRebuild_0() { return &___m_ToRebuild_0; }
inline void set_m_ToRebuild_0(RectTransform_t3700156813 * value)
{
___m_ToRebuild_0 = value;
Il2CppCodeGenWriteBarrier((&___m_ToRebuild_0), value);
}
inline static int32_t get_offset_of_m_CachedHashFromTransform_1() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245, ___m_CachedHashFromTransform_1)); }
inline int32_t get_m_CachedHashFromTransform_1() const { return ___m_CachedHashFromTransform_1; }
inline int32_t* get_address_of_m_CachedHashFromTransform_1() { return &___m_CachedHashFromTransform_1; }
inline void set_m_CachedHashFromTransform_1(int32_t value)
{
___m_CachedHashFromTransform_1 = value;
}
};
struct LayoutRebuilder_t2045564245_StaticFields
{
public:
// UnityEngine.UI.ObjectPool`1<UnityEngine.UI.LayoutRebuilder> UnityEngine.UI.LayoutRebuilder::s_Rebuilders
ObjectPool_1_t960346694 * ___s_Rebuilders_2;
// UnityEngine.RectTransform/ReapplyDrivenProperties UnityEngine.UI.LayoutRebuilder::<>f__mg$cache0
ReapplyDrivenProperties_t2885473943 * ___U3CU3Ef__mgU24cache0_3;
// System.Predicate`1<UnityEngine.Component> UnityEngine.UI.LayoutRebuilder::<>f__am$cache0
Predicate_1_t2905866299 * ___U3CU3Ef__amU24cache0_4;
// UnityEngine.Events.UnityAction`1<UnityEngine.Component> UnityEngine.UI.LayoutRebuilder::<>f__am$cache1
UnityAction_1_t2003765821 * ___U3CU3Ef__amU24cache1_5;
// UnityEngine.Events.UnityAction`1<UnityEngine.Component> UnityEngine.UI.LayoutRebuilder::<>f__am$cache2
UnityAction_1_t2003765821 * ___U3CU3Ef__amU24cache2_6;
// UnityEngine.Events.UnityAction`1<UnityEngine.Component> UnityEngine.UI.LayoutRebuilder::<>f__am$cache3
UnityAction_1_t2003765821 * ___U3CU3Ef__amU24cache3_7;
// UnityEngine.Events.UnityAction`1<UnityEngine.Component> UnityEngine.UI.LayoutRebuilder::<>f__am$cache4
UnityAction_1_t2003765821 * ___U3CU3Ef__amU24cache4_8;
public:
inline static int32_t get_offset_of_s_Rebuilders_2() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245_StaticFields, ___s_Rebuilders_2)); }
inline ObjectPool_1_t960346694 * get_s_Rebuilders_2() const { return ___s_Rebuilders_2; }
inline ObjectPool_1_t960346694 ** get_address_of_s_Rebuilders_2() { return &___s_Rebuilders_2; }
inline void set_s_Rebuilders_2(ObjectPool_1_t960346694 * value)
{
___s_Rebuilders_2 = value;
Il2CppCodeGenWriteBarrier((&___s_Rebuilders_2), value);
}
inline static int32_t get_offset_of_U3CU3Ef__mgU24cache0_3() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245_StaticFields, ___U3CU3Ef__mgU24cache0_3)); }
inline ReapplyDrivenProperties_t2885473943 * get_U3CU3Ef__mgU24cache0_3() const { return ___U3CU3Ef__mgU24cache0_3; }
inline ReapplyDrivenProperties_t2885473943 ** get_address_of_U3CU3Ef__mgU24cache0_3() { return &___U3CU3Ef__mgU24cache0_3; }
inline void set_U3CU3Ef__mgU24cache0_3(ReapplyDrivenProperties_t2885473943 * value)
{
___U3CU3Ef__mgU24cache0_3 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__mgU24cache0_3), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache0_4() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245_StaticFields, ___U3CU3Ef__amU24cache0_4)); }
inline Predicate_1_t2905866299 * get_U3CU3Ef__amU24cache0_4() const { return ___U3CU3Ef__amU24cache0_4; }
inline Predicate_1_t2905866299 ** get_address_of_U3CU3Ef__amU24cache0_4() { return &___U3CU3Ef__amU24cache0_4; }
inline void set_U3CU3Ef__amU24cache0_4(Predicate_1_t2905866299 * value)
{
___U3CU3Ef__amU24cache0_4 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache0_4), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache1_5() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245_StaticFields, ___U3CU3Ef__amU24cache1_5)); }
inline UnityAction_1_t2003765821 * get_U3CU3Ef__amU24cache1_5() const { return ___U3CU3Ef__amU24cache1_5; }
inline UnityAction_1_t2003765821 ** get_address_of_U3CU3Ef__amU24cache1_5() { return &___U3CU3Ef__amU24cache1_5; }
inline void set_U3CU3Ef__amU24cache1_5(UnityAction_1_t2003765821 * value)
{
___U3CU3Ef__amU24cache1_5 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache1_5), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache2_6() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245_StaticFields, ___U3CU3Ef__amU24cache2_6)); }
inline UnityAction_1_t2003765821 * get_U3CU3Ef__amU24cache2_6() const { return ___U3CU3Ef__amU24cache2_6; }
inline UnityAction_1_t2003765821 ** get_address_of_U3CU3Ef__amU24cache2_6() { return &___U3CU3Ef__amU24cache2_6; }
inline void set_U3CU3Ef__amU24cache2_6(UnityAction_1_t2003765821 * value)
{
___U3CU3Ef__amU24cache2_6 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache2_6), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache3_7() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245_StaticFields, ___U3CU3Ef__amU24cache3_7)); }
inline UnityAction_1_t2003765821 * get_U3CU3Ef__amU24cache3_7() const { return ___U3CU3Ef__amU24cache3_7; }
inline UnityAction_1_t2003765821 ** get_address_of_U3CU3Ef__amU24cache3_7() { return &___U3CU3Ef__amU24cache3_7; }
inline void set_U3CU3Ef__amU24cache3_7(UnityAction_1_t2003765821 * value)
{
___U3CU3Ef__amU24cache3_7 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache3_7), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache4_8() { return static_cast<int32_t>(offsetof(LayoutRebuilder_t2045564245_StaticFields, ___U3CU3Ef__amU24cache4_8)); }
inline UnityAction_1_t2003765821 * get_U3CU3Ef__amU24cache4_8() const { return ___U3CU3Ef__amU24cache4_8; }
inline UnityAction_1_t2003765821 ** get_address_of_U3CU3Ef__amU24cache4_8() { return &___U3CU3Ef__amU24cache4_8; }
inline void set_U3CU3Ef__amU24cache4_8(UnityAction_1_t2003765821 * value)
{
___U3CU3Ef__amU24cache4_8 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache4_8), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LAYOUTREBUILDER_T2045564245_H
#ifndef LAYOUTUTILITY_T2212037470_H
#define LAYOUTUTILITY_T2212037470_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.LayoutUtility
struct LayoutUtility_t2212037470 : public RuntimeObject
{
public:
public:
};
struct LayoutUtility_t2212037470_StaticFields
{
public:
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single> UnityEngine.UI.LayoutUtility::<>f__am$cache0
Func_2_t3786485805 * ___U3CU3Ef__amU24cache0_0;
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single> UnityEngine.UI.LayoutUtility::<>f__am$cache1
Func_2_t3786485805 * ___U3CU3Ef__amU24cache1_1;
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single> UnityEngine.UI.LayoutUtility::<>f__am$cache2
Func_2_t3786485805 * ___U3CU3Ef__amU24cache2_2;
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single> UnityEngine.UI.LayoutUtility::<>f__am$cache3
Func_2_t3786485805 * ___U3CU3Ef__amU24cache3_3;
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single> UnityEngine.UI.LayoutUtility::<>f__am$cache4
Func_2_t3786485805 * ___U3CU3Ef__amU24cache4_4;
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single> UnityEngine.UI.LayoutUtility::<>f__am$cache5
Func_2_t3786485805 * ___U3CU3Ef__amU24cache5_5;
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single> UnityEngine.UI.LayoutUtility::<>f__am$cache6
Func_2_t3786485805 * ___U3CU3Ef__amU24cache6_6;
// System.Func`2<UnityEngine.UI.ILayoutElement,System.Single> UnityEngine.UI.LayoutUtility::<>f__am$cache7
Func_2_t3786485805 * ___U3CU3Ef__amU24cache7_7;
public:
inline static int32_t get_offset_of_U3CU3Ef__amU24cache0_0() { return static_cast<int32_t>(offsetof(LayoutUtility_t2212037470_StaticFields, ___U3CU3Ef__amU24cache0_0)); }
inline Func_2_t3786485805 * get_U3CU3Ef__amU24cache0_0() const { return ___U3CU3Ef__amU24cache0_0; }
inline Func_2_t3786485805 ** get_address_of_U3CU3Ef__amU24cache0_0() { return &___U3CU3Ef__amU24cache0_0; }
inline void set_U3CU3Ef__amU24cache0_0(Func_2_t3786485805 * value)
{
___U3CU3Ef__amU24cache0_0 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache0_0), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache1_1() { return static_cast<int32_t>(offsetof(LayoutUtility_t2212037470_StaticFields, ___U3CU3Ef__amU24cache1_1)); }
inline Func_2_t3786485805 * get_U3CU3Ef__amU24cache1_1() const { return ___U3CU3Ef__amU24cache1_1; }
inline Func_2_t3786485805 ** get_address_of_U3CU3Ef__amU24cache1_1() { return &___U3CU3Ef__amU24cache1_1; }
inline void set_U3CU3Ef__amU24cache1_1(Func_2_t3786485805 * value)
{
___U3CU3Ef__amU24cache1_1 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache1_1), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache2_2() { return static_cast<int32_t>(offsetof(LayoutUtility_t2212037470_StaticFields, ___U3CU3Ef__amU24cache2_2)); }
inline Func_2_t3786485805 * get_U3CU3Ef__amU24cache2_2() const { return ___U3CU3Ef__amU24cache2_2; }
inline Func_2_t3786485805 ** get_address_of_U3CU3Ef__amU24cache2_2() { return &___U3CU3Ef__amU24cache2_2; }
inline void set_U3CU3Ef__amU24cache2_2(Func_2_t3786485805 * value)
{
___U3CU3Ef__amU24cache2_2 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache2_2), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache3_3() { return static_cast<int32_t>(offsetof(LayoutUtility_t2212037470_StaticFields, ___U3CU3Ef__amU24cache3_3)); }
inline Func_2_t3786485805 * get_U3CU3Ef__amU24cache3_3() const { return ___U3CU3Ef__amU24cache3_3; }
inline Func_2_t3786485805 ** get_address_of_U3CU3Ef__amU24cache3_3() { return &___U3CU3Ef__amU24cache3_3; }
inline void set_U3CU3Ef__amU24cache3_3(Func_2_t3786485805 * value)
{
___U3CU3Ef__amU24cache3_3 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache3_3), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache4_4() { return static_cast<int32_t>(offsetof(LayoutUtility_t2212037470_StaticFields, ___U3CU3Ef__amU24cache4_4)); }
inline Func_2_t3786485805 * get_U3CU3Ef__amU24cache4_4() const { return ___U3CU3Ef__amU24cache4_4; }
inline Func_2_t3786485805 ** get_address_of_U3CU3Ef__amU24cache4_4() { return &___U3CU3Ef__amU24cache4_4; }
inline void set_U3CU3Ef__amU24cache4_4(Func_2_t3786485805 * value)
{
___U3CU3Ef__amU24cache4_4 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache4_4), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache5_5() { return static_cast<int32_t>(offsetof(LayoutUtility_t2212037470_StaticFields, ___U3CU3Ef__amU24cache5_5)); }
inline Func_2_t3786485805 * get_U3CU3Ef__amU24cache5_5() const { return ___U3CU3Ef__amU24cache5_5; }
inline Func_2_t3786485805 ** get_address_of_U3CU3Ef__amU24cache5_5() { return &___U3CU3Ef__amU24cache5_5; }
inline void set_U3CU3Ef__amU24cache5_5(Func_2_t3786485805 * value)
{
___U3CU3Ef__amU24cache5_5 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache5_5), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache6_6() { return static_cast<int32_t>(offsetof(LayoutUtility_t2212037470_StaticFields, ___U3CU3Ef__amU24cache6_6)); }
inline Func_2_t3786485805 * get_U3CU3Ef__amU24cache6_6() const { return ___U3CU3Ef__amU24cache6_6; }
inline Func_2_t3786485805 ** get_address_of_U3CU3Ef__amU24cache6_6() { return &___U3CU3Ef__amU24cache6_6; }
inline void set_U3CU3Ef__amU24cache6_6(Func_2_t3786485805 * value)
{
___U3CU3Ef__amU24cache6_6 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache6_6), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache7_7() { return static_cast<int32_t>(offsetof(LayoutUtility_t2212037470_StaticFields, ___U3CU3Ef__amU24cache7_7)); }
inline Func_2_t3786485805 * get_U3CU3Ef__amU24cache7_7() const { return ___U3CU3Ef__amU24cache7_7; }
inline Func_2_t3786485805 ** get_address_of_U3CU3Ef__amU24cache7_7() { return &___U3CU3Ef__amU24cache7_7; }
inline void set_U3CU3Ef__amU24cache7_7(Func_2_t3786485805 * value)
{
___U3CU3Ef__amU24cache7_7 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache7_7), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LAYOUTUTILITY_T2212037470_H
#ifndef VALUETYPE_T1651021560_H
#define VALUETYPE_T1651021560_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.ValueType
struct ValueType_t1651021560 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_t1651021560_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_t1651021560_marshaled_com
{
};
#endif // VALUETYPE_T1651021560_H
#ifndef REFLECTIONMETHODSCACHE_T3869594295_H
#define REFLECTIONMETHODSCACHE_T3869594295_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ReflectionMethodsCache
struct ReflectionMethodsCache_t3869594295 : public RuntimeObject
{
public:
// UnityEngine.UI.ReflectionMethodsCache/Raycast3DCallback UnityEngine.UI.ReflectionMethodsCache::raycast3D
Raycast3DCallback_t3731579633 * ___raycast3D_0;
// UnityEngine.UI.ReflectionMethodsCache/RaycastAllCallback UnityEngine.UI.ReflectionMethodsCache::raycast3DAll
RaycastAllCallback_t1653149632 * ___raycast3DAll_1;
// UnityEngine.UI.ReflectionMethodsCache/Raycast2DCallback UnityEngine.UI.ReflectionMethodsCache::raycast2D
Raycast2DCallback_t890783784 * ___raycast2D_2;
// UnityEngine.UI.ReflectionMethodsCache/GetRayIntersectionAllCallback UnityEngine.UI.ReflectionMethodsCache::getRayIntersectionAll
GetRayIntersectionAllCallback_t3143667439 * ___getRayIntersectionAll_3;
public:
inline static int32_t get_offset_of_raycast3D_0() { return static_cast<int32_t>(offsetof(ReflectionMethodsCache_t3869594295, ___raycast3D_0)); }
inline Raycast3DCallback_t3731579633 * get_raycast3D_0() const { return ___raycast3D_0; }
inline Raycast3DCallback_t3731579633 ** get_address_of_raycast3D_0() { return &___raycast3D_0; }
inline void set_raycast3D_0(Raycast3DCallback_t3731579633 * value)
{
___raycast3D_0 = value;
Il2CppCodeGenWriteBarrier((&___raycast3D_0), value);
}
inline static int32_t get_offset_of_raycast3DAll_1() { return static_cast<int32_t>(offsetof(ReflectionMethodsCache_t3869594295, ___raycast3DAll_1)); }
inline RaycastAllCallback_t1653149632 * get_raycast3DAll_1() const { return ___raycast3DAll_1; }
inline RaycastAllCallback_t1653149632 ** get_address_of_raycast3DAll_1() { return &___raycast3DAll_1; }
inline void set_raycast3DAll_1(RaycastAllCallback_t1653149632 * value)
{
___raycast3DAll_1 = value;
Il2CppCodeGenWriteBarrier((&___raycast3DAll_1), value);
}
inline static int32_t get_offset_of_raycast2D_2() { return static_cast<int32_t>(offsetof(ReflectionMethodsCache_t3869594295, ___raycast2D_2)); }
inline Raycast2DCallback_t890783784 * get_raycast2D_2() const { return ___raycast2D_2; }
inline Raycast2DCallback_t890783784 ** get_address_of_raycast2D_2() { return &___raycast2D_2; }
inline void set_raycast2D_2(Raycast2DCallback_t890783784 * value)
{
___raycast2D_2 = value;
Il2CppCodeGenWriteBarrier((&___raycast2D_2), value);
}
inline static int32_t get_offset_of_getRayIntersectionAll_3() { return static_cast<int32_t>(offsetof(ReflectionMethodsCache_t3869594295, ___getRayIntersectionAll_3)); }
inline GetRayIntersectionAllCallback_t3143667439 * get_getRayIntersectionAll_3() const { return ___getRayIntersectionAll_3; }
inline GetRayIntersectionAllCallback_t3143667439 ** get_address_of_getRayIntersectionAll_3() { return &___getRayIntersectionAll_3; }
inline void set_getRayIntersectionAll_3(GetRayIntersectionAllCallback_t3143667439 * value)
{
___getRayIntersectionAll_3 = value;
Il2CppCodeGenWriteBarrier((&___getRayIntersectionAll_3), value);
}
};
struct ReflectionMethodsCache_t3869594295_StaticFields
{
public:
// UnityEngine.UI.ReflectionMethodsCache UnityEngine.UI.ReflectionMethodsCache::s_ReflectionMethodsCache
ReflectionMethodsCache_t3869594295 * ___s_ReflectionMethodsCache_4;
public:
inline static int32_t get_offset_of_s_ReflectionMethodsCache_4() { return static_cast<int32_t>(offsetof(ReflectionMethodsCache_t3869594295_StaticFields, ___s_ReflectionMethodsCache_4)); }
inline ReflectionMethodsCache_t3869594295 * get_s_ReflectionMethodsCache_4() const { return ___s_ReflectionMethodsCache_4; }
inline ReflectionMethodsCache_t3869594295 ** get_address_of_s_ReflectionMethodsCache_4() { return &___s_ReflectionMethodsCache_4; }
inline void set_s_ReflectionMethodsCache_4(ReflectionMethodsCache_t3869594295 * value)
{
___s_ReflectionMethodsCache_4 = value;
Il2CppCodeGenWriteBarrier((&___s_ReflectionMethodsCache_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // REFLECTIONMETHODSCACHE_T3869594295_H
#ifndef MASKUTILITIES_T3025508624_H
#define MASKUTILITIES_T3025508624_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.MaskUtilities
struct MaskUtilities_t3025508624 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MASKUTILITIES_T3025508624_H
#ifndef BASEVERTEXEFFECT_T1995380047_H
#define BASEVERTEXEFFECT_T1995380047_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.BaseVertexEffect
struct BaseVertexEffect_t1995380047 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BASEVERTEXEFFECT_T1995380047_H
#ifndef GRAPHICREGISTRY_T2942561618_H
#define GRAPHICREGISTRY_T2942561618_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.GraphicRegistry
struct GraphicRegistry_t2942561618 : public RuntimeObject
{
public:
// System.Collections.Generic.Dictionary`2<UnityEngine.Canvas,UnityEngine.UI.Collections.IndexedSet`1<UnityEngine.UI.Graphic>> UnityEngine.UI.GraphicRegistry::m_Graphics
Dictionary_2_t136510004 * ___m_Graphics_1;
public:
inline static int32_t get_offset_of_m_Graphics_1() { return static_cast<int32_t>(offsetof(GraphicRegistry_t2942561618, ___m_Graphics_1)); }
inline Dictionary_2_t136510004 * get_m_Graphics_1() const { return ___m_Graphics_1; }
inline Dictionary_2_t136510004 ** get_address_of_m_Graphics_1() { return &___m_Graphics_1; }
inline void set_m_Graphics_1(Dictionary_2_t136510004 * value)
{
___m_Graphics_1 = value;
Il2CppCodeGenWriteBarrier((&___m_Graphics_1), value);
}
};
struct GraphicRegistry_t2942561618_StaticFields
{
public:
// UnityEngine.UI.GraphicRegistry UnityEngine.UI.GraphicRegistry::s_Instance
GraphicRegistry_t2942561618 * ___s_Instance_0;
// System.Collections.Generic.List`1<UnityEngine.UI.Graphic> UnityEngine.UI.GraphicRegistry::s_EmptyList
List_1_t4053678182 * ___s_EmptyList_2;
public:
inline static int32_t get_offset_of_s_Instance_0() { return static_cast<int32_t>(offsetof(GraphicRegistry_t2942561618_StaticFields, ___s_Instance_0)); }
inline GraphicRegistry_t2942561618 * get_s_Instance_0() const { return ___s_Instance_0; }
inline GraphicRegistry_t2942561618 ** get_address_of_s_Instance_0() { return &___s_Instance_0; }
inline void set_s_Instance_0(GraphicRegistry_t2942561618 * value)
{
___s_Instance_0 = value;
Il2CppCodeGenWriteBarrier((&___s_Instance_0), value);
}
inline static int32_t get_offset_of_s_EmptyList_2() { return static_cast<int32_t>(offsetof(GraphicRegistry_t2942561618_StaticFields, ___s_EmptyList_2)); }
inline List_1_t4053678182 * get_s_EmptyList_2() const { return ___s_EmptyList_2; }
inline List_1_t4053678182 ** get_address_of_s_EmptyList_2() { return &___s_EmptyList_2; }
inline void set_s_EmptyList_2(List_1_t4053678182 * value)
{
___s_EmptyList_2 = value;
Il2CppCodeGenWriteBarrier((&___s_EmptyList_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GRAPHICREGISTRY_T2942561618_H
#ifndef INT32_T2185247404_H
#define INT32_T2185247404_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Int32
struct Int32_t2185247404
{
public:
// System.Int32 System.Int32::m_value
int32_t ___m_value_2;
public:
inline static int32_t get_offset_of_m_value_2() { return static_cast<int32_t>(offsetof(Int32_t2185247404, ___m_value_2)); }
inline int32_t get_m_value_2() const { return ___m_value_2; }
inline int32_t* get_address_of_m_value_2() { return &___m_value_2; }
inline void set_m_value_2(int32_t value)
{
___m_value_2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INT32_T2185247404_H
#ifndef CHAR_T215683921_H
#define CHAR_T215683921_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Char
struct Char_t215683921
{
public:
// System.Char System.Char::m_value
Il2CppChar ___m_value_2;
public:
inline static int32_t get_offset_of_m_value_2() { return static_cast<int32_t>(offsetof(Char_t215683921, ___m_value_2)); }
inline Il2CppChar get_m_value_2() const { return ___m_value_2; }
inline Il2CppChar* get_address_of_m_value_2() { return &___m_value_2; }
inline void set_m_value_2(Il2CppChar value)
{
___m_value_2 = value;
}
};
struct Char_t215683921_StaticFields
{
public:
// System.Byte* System.Char::category_data
uint8_t* ___category_data_3;
// System.Byte* System.Char::numeric_data
uint8_t* ___numeric_data_4;
// System.Double* System.Char::numeric_data_values
double* ___numeric_data_values_5;
// System.UInt16* System.Char::to_lower_data_low
uint16_t* ___to_lower_data_low_6;
// System.UInt16* System.Char::to_lower_data_high
uint16_t* ___to_lower_data_high_7;
// System.UInt16* System.Char::to_upper_data_low
uint16_t* ___to_upper_data_low_8;
// System.UInt16* System.Char::to_upper_data_high
uint16_t* ___to_upper_data_high_9;
public:
inline static int32_t get_offset_of_category_data_3() { return static_cast<int32_t>(offsetof(Char_t215683921_StaticFields, ___category_data_3)); }
inline uint8_t* get_category_data_3() const { return ___category_data_3; }
inline uint8_t** get_address_of_category_data_3() { return &___category_data_3; }
inline void set_category_data_3(uint8_t* value)
{
___category_data_3 = value;
}
inline static int32_t get_offset_of_numeric_data_4() { return static_cast<int32_t>(offsetof(Char_t215683921_StaticFields, ___numeric_data_4)); }
inline uint8_t* get_numeric_data_4() const { return ___numeric_data_4; }
inline uint8_t** get_address_of_numeric_data_4() { return &___numeric_data_4; }
inline void set_numeric_data_4(uint8_t* value)
{
___numeric_data_4 = value;
}
inline static int32_t get_offset_of_numeric_data_values_5() { return static_cast<int32_t>(offsetof(Char_t215683921_StaticFields, ___numeric_data_values_5)); }
inline double* get_numeric_data_values_5() const { return ___numeric_data_values_5; }
inline double** get_address_of_numeric_data_values_5() { return &___numeric_data_values_5; }
inline void set_numeric_data_values_5(double* value)
{
___numeric_data_values_5 = value;
}
inline static int32_t get_offset_of_to_lower_data_low_6() { return static_cast<int32_t>(offsetof(Char_t215683921_StaticFields, ___to_lower_data_low_6)); }
inline uint16_t* get_to_lower_data_low_6() const { return ___to_lower_data_low_6; }
inline uint16_t** get_address_of_to_lower_data_low_6() { return &___to_lower_data_low_6; }
inline void set_to_lower_data_low_6(uint16_t* value)
{
___to_lower_data_low_6 = value;
}
inline static int32_t get_offset_of_to_lower_data_high_7() { return static_cast<int32_t>(offsetof(Char_t215683921_StaticFields, ___to_lower_data_high_7)); }
inline uint16_t* get_to_lower_data_high_7() const { return ___to_lower_data_high_7; }
inline uint16_t** get_address_of_to_lower_data_high_7() { return &___to_lower_data_high_7; }
inline void set_to_lower_data_high_7(uint16_t* value)
{
___to_lower_data_high_7 = value;
}
inline static int32_t get_offset_of_to_upper_data_low_8() { return static_cast<int32_t>(offsetof(Char_t215683921_StaticFields, ___to_upper_data_low_8)); }
inline uint16_t* get_to_upper_data_low_8() const { return ___to_upper_data_low_8; }
inline uint16_t** get_address_of_to_upper_data_low_8() { return &___to_upper_data_low_8; }
inline void set_to_upper_data_low_8(uint16_t* value)
{
___to_upper_data_low_8 = value;
}
inline static int32_t get_offset_of_to_upper_data_high_9() { return static_cast<int32_t>(offsetof(Char_t215683921_StaticFields, ___to_upper_data_high_9)); }
inline uint16_t* get_to_upper_data_high_9() const { return ___to_upper_data_high_9; }
inline uint16_t** get_address_of_to_upper_data_high_9() { return &___to_upper_data_high_9; }
inline void set_to_upper_data_high_9(uint16_t* value)
{
___to_upper_data_high_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CHAR_T215683921_H
#ifndef UNITYEVENT_1_T1966248298_H
#define UNITYEVENT_1_T1966248298_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Events.UnityEvent`1<System.String>
struct UnityEvent_1_t1966248298 : public UnityEventBase_t1200889892
{
public:
// System.Object[] UnityEngine.Events.UnityEvent`1::m_InvokeArray
ObjectU5BU5D_t3885370135* ___m_InvokeArray_4;
public:
inline static int32_t get_offset_of_m_InvokeArray_4() { return static_cast<int32_t>(offsetof(UnityEvent_1_t1966248298, ___m_InvokeArray_4)); }
inline ObjectU5BU5D_t3885370135* get_m_InvokeArray_4() const { return ___m_InvokeArray_4; }
inline ObjectU5BU5D_t3885370135** get_address_of_m_InvokeArray_4() { return &___m_InvokeArray_4; }
inline void set_m_InvokeArray_4(ObjectU5BU5D_t3885370135* value)
{
___m_InvokeArray_4 = value;
Il2CppCodeGenWriteBarrier((&___m_InvokeArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNITYEVENT_1_T1966248298_H
#ifndef VECTOR4_T4108915337_H
#define VECTOR4_T4108915337_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector4
struct Vector4_t4108915337
{
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_t4108915337, ___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_t4108915337, ___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_t4108915337, ___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_t4108915337, ___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_t4108915337_StaticFields
{
public:
// UnityEngine.Vector4 UnityEngine.Vector4::zeroVector
Vector4_t4108915337 ___zeroVector_5;
// UnityEngine.Vector4 UnityEngine.Vector4::oneVector
Vector4_t4108915337 ___oneVector_6;
// UnityEngine.Vector4 UnityEngine.Vector4::positiveInfinityVector
Vector4_t4108915337 ___positiveInfinityVector_7;
// UnityEngine.Vector4 UnityEngine.Vector4::negativeInfinityVector
Vector4_t4108915337 ___negativeInfinityVector_8;
public:
inline static int32_t get_offset_of_zeroVector_5() { return static_cast<int32_t>(offsetof(Vector4_t4108915337_StaticFields, ___zeroVector_5)); }
inline Vector4_t4108915337 get_zeroVector_5() const { return ___zeroVector_5; }
inline Vector4_t4108915337 * get_address_of_zeroVector_5() { return &___zeroVector_5; }
inline void set_zeroVector_5(Vector4_t4108915337 value)
{
___zeroVector_5 = value;
}
inline static int32_t get_offset_of_oneVector_6() { return static_cast<int32_t>(offsetof(Vector4_t4108915337_StaticFields, ___oneVector_6)); }
inline Vector4_t4108915337 get_oneVector_6() const { return ___oneVector_6; }
inline Vector4_t4108915337 * get_address_of_oneVector_6() { return &___oneVector_6; }
inline void set_oneVector_6(Vector4_t4108915337 value)
{
___oneVector_6 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_7() { return static_cast<int32_t>(offsetof(Vector4_t4108915337_StaticFields, ___positiveInfinityVector_7)); }
inline Vector4_t4108915337 get_positiveInfinityVector_7() const { return ___positiveInfinityVector_7; }
inline Vector4_t4108915337 * get_address_of_positiveInfinityVector_7() { return &___positiveInfinityVector_7; }
inline void set_positiveInfinityVector_7(Vector4_t4108915337 value)
{
___positiveInfinityVector_7 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector4_t4108915337_StaticFields, ___negativeInfinityVector_8)); }
inline Vector4_t4108915337 get_negativeInfinityVector_8() const { return ___negativeInfinityVector_8; }
inline Vector4_t4108915337 * get_address_of_negativeInfinityVector_8() { return &___negativeInfinityVector_8; }
inline void set_negativeInfinityVector_8(Vector4_t4108915337 value)
{
___negativeInfinityVector_8 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR4_T4108915337_H
#ifndef VECTOR3_T67624592_H
#define VECTOR3_T67624592_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector3
struct Vector3_t67624592
{
public:
// System.Single UnityEngine.Vector3::x
float ___x_1;
// System.Single UnityEngine.Vector3::y
float ___y_2;
// System.Single UnityEngine.Vector3::z
float ___z_3;
public:
inline static int32_t get_offset_of_x_1() { return static_cast<int32_t>(offsetof(Vector3_t67624592, ___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(Vector3_t67624592, ___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(Vector3_t67624592, ___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;
}
};
struct Vector3_t67624592_StaticFields
{
public:
// UnityEngine.Vector3 UnityEngine.Vector3::zeroVector
Vector3_t67624592 ___zeroVector_4;
// UnityEngine.Vector3 UnityEngine.Vector3::oneVector
Vector3_t67624592 ___oneVector_5;
// UnityEngine.Vector3 UnityEngine.Vector3::upVector
Vector3_t67624592 ___upVector_6;
// UnityEngine.Vector3 UnityEngine.Vector3::downVector
Vector3_t67624592 ___downVector_7;
// UnityEngine.Vector3 UnityEngine.Vector3::leftVector
Vector3_t67624592 ___leftVector_8;
// UnityEngine.Vector3 UnityEngine.Vector3::rightVector
Vector3_t67624592 ___rightVector_9;
// UnityEngine.Vector3 UnityEngine.Vector3::forwardVector
Vector3_t67624592 ___forwardVector_10;
// UnityEngine.Vector3 UnityEngine.Vector3::backVector
Vector3_t67624592 ___backVector_11;
// UnityEngine.Vector3 UnityEngine.Vector3::positiveInfinityVector
Vector3_t67624592 ___positiveInfinityVector_12;
// UnityEngine.Vector3 UnityEngine.Vector3::negativeInfinityVector
Vector3_t67624592 ___negativeInfinityVector_13;
public:
inline static int32_t get_offset_of_zeroVector_4() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___zeroVector_4)); }
inline Vector3_t67624592 get_zeroVector_4() const { return ___zeroVector_4; }
inline Vector3_t67624592 * get_address_of_zeroVector_4() { return &___zeroVector_4; }
inline void set_zeroVector_4(Vector3_t67624592 value)
{
___zeroVector_4 = value;
}
inline static int32_t get_offset_of_oneVector_5() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___oneVector_5)); }
inline Vector3_t67624592 get_oneVector_5() const { return ___oneVector_5; }
inline Vector3_t67624592 * get_address_of_oneVector_5() { return &___oneVector_5; }
inline void set_oneVector_5(Vector3_t67624592 value)
{
___oneVector_5 = value;
}
inline static int32_t get_offset_of_upVector_6() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___upVector_6)); }
inline Vector3_t67624592 get_upVector_6() const { return ___upVector_6; }
inline Vector3_t67624592 * get_address_of_upVector_6() { return &___upVector_6; }
inline void set_upVector_6(Vector3_t67624592 value)
{
___upVector_6 = value;
}
inline static int32_t get_offset_of_downVector_7() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___downVector_7)); }
inline Vector3_t67624592 get_downVector_7() const { return ___downVector_7; }
inline Vector3_t67624592 * get_address_of_downVector_7() { return &___downVector_7; }
inline void set_downVector_7(Vector3_t67624592 value)
{
___downVector_7 = value;
}
inline static int32_t get_offset_of_leftVector_8() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___leftVector_8)); }
inline Vector3_t67624592 get_leftVector_8() const { return ___leftVector_8; }
inline Vector3_t67624592 * get_address_of_leftVector_8() { return &___leftVector_8; }
inline void set_leftVector_8(Vector3_t67624592 value)
{
___leftVector_8 = value;
}
inline static int32_t get_offset_of_rightVector_9() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___rightVector_9)); }
inline Vector3_t67624592 get_rightVector_9() const { return ___rightVector_9; }
inline Vector3_t67624592 * get_address_of_rightVector_9() { return &___rightVector_9; }
inline void set_rightVector_9(Vector3_t67624592 value)
{
___rightVector_9 = value;
}
inline static int32_t get_offset_of_forwardVector_10() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___forwardVector_10)); }
inline Vector3_t67624592 get_forwardVector_10() const { return ___forwardVector_10; }
inline Vector3_t67624592 * get_address_of_forwardVector_10() { return &___forwardVector_10; }
inline void set_forwardVector_10(Vector3_t67624592 value)
{
___forwardVector_10 = value;
}
inline static int32_t get_offset_of_backVector_11() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___backVector_11)); }
inline Vector3_t67624592 get_backVector_11() const { return ___backVector_11; }
inline Vector3_t67624592 * get_address_of_backVector_11() { return &___backVector_11; }
inline void set_backVector_11(Vector3_t67624592 value)
{
___backVector_11 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_12() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___positiveInfinityVector_12)); }
inline Vector3_t67624592 get_positiveInfinityVector_12() const { return ___positiveInfinityVector_12; }
inline Vector3_t67624592 * get_address_of_positiveInfinityVector_12() { return &___positiveInfinityVector_12; }
inline void set_positiveInfinityVector_12(Vector3_t67624592 value)
{
___positiveInfinityVector_12 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_13() { return static_cast<int32_t>(offsetof(Vector3_t67624592_StaticFields, ___negativeInfinityVector_13)); }
inline Vector3_t67624592 get_negativeInfinityVector_13() const { return ___negativeInfinityVector_13; }
inline Vector3_t67624592 * get_address_of_negativeInfinityVector_13() { return &___negativeInfinityVector_13; }
inline void set_negativeInfinityVector_13(Vector3_t67624592 value)
{
___negativeInfinityVector_13 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR3_T67624592_H
#ifndef VECTOR2_T3854014517_H
#define VECTOR2_T3854014517_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Vector2
struct Vector2_t3854014517
{
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_t3854014517, ___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_t3854014517, ___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_t3854014517_StaticFields
{
public:
// UnityEngine.Vector2 UnityEngine.Vector2::zeroVector
Vector2_t3854014517 ___zeroVector_2;
// UnityEngine.Vector2 UnityEngine.Vector2::oneVector
Vector2_t3854014517 ___oneVector_3;
// UnityEngine.Vector2 UnityEngine.Vector2::upVector
Vector2_t3854014517 ___upVector_4;
// UnityEngine.Vector2 UnityEngine.Vector2::downVector
Vector2_t3854014517 ___downVector_5;
// UnityEngine.Vector2 UnityEngine.Vector2::leftVector
Vector2_t3854014517 ___leftVector_6;
// UnityEngine.Vector2 UnityEngine.Vector2::rightVector
Vector2_t3854014517 ___rightVector_7;
// UnityEngine.Vector2 UnityEngine.Vector2::positiveInfinityVector
Vector2_t3854014517 ___positiveInfinityVector_8;
// UnityEngine.Vector2 UnityEngine.Vector2::negativeInfinityVector
Vector2_t3854014517 ___negativeInfinityVector_9;
public:
inline static int32_t get_offset_of_zeroVector_2() { return static_cast<int32_t>(offsetof(Vector2_t3854014517_StaticFields, ___zeroVector_2)); }
inline Vector2_t3854014517 get_zeroVector_2() const { return ___zeroVector_2; }
inline Vector2_t3854014517 * get_address_of_zeroVector_2() { return &___zeroVector_2; }
inline void set_zeroVector_2(Vector2_t3854014517 value)
{
___zeroVector_2 = value;
}
inline static int32_t get_offset_of_oneVector_3() { return static_cast<int32_t>(offsetof(Vector2_t3854014517_StaticFields, ___oneVector_3)); }
inline Vector2_t3854014517 get_oneVector_3() const { return ___oneVector_3; }
inline Vector2_t3854014517 * get_address_of_oneVector_3() { return &___oneVector_3; }
inline void set_oneVector_3(Vector2_t3854014517 value)
{
___oneVector_3 = value;
}
inline static int32_t get_offset_of_upVector_4() { return static_cast<int32_t>(offsetof(Vector2_t3854014517_StaticFields, ___upVector_4)); }
inline Vector2_t3854014517 get_upVector_4() const { return ___upVector_4; }
inline Vector2_t3854014517 * get_address_of_upVector_4() { return &___upVector_4; }
inline void set_upVector_4(Vector2_t3854014517 value)
{
___upVector_4 = value;
}
inline static int32_t get_offset_of_downVector_5() { return static_cast<int32_t>(offsetof(Vector2_t3854014517_StaticFields, ___downVector_5)); }
inline Vector2_t3854014517 get_downVector_5() const { return ___downVector_5; }
inline Vector2_t3854014517 * get_address_of_downVector_5() { return &___downVector_5; }
inline void set_downVector_5(Vector2_t3854014517 value)
{
___downVector_5 = value;
}
inline static int32_t get_offset_of_leftVector_6() { return static_cast<int32_t>(offsetof(Vector2_t3854014517_StaticFields, ___leftVector_6)); }
inline Vector2_t3854014517 get_leftVector_6() const { return ___leftVector_6; }
inline Vector2_t3854014517 * get_address_of_leftVector_6() { return &___leftVector_6; }
inline void set_leftVector_6(Vector2_t3854014517 value)
{
___leftVector_6 = value;
}
inline static int32_t get_offset_of_rightVector_7() { return static_cast<int32_t>(offsetof(Vector2_t3854014517_StaticFields, ___rightVector_7)); }
inline Vector2_t3854014517 get_rightVector_7() const { return ___rightVector_7; }
inline Vector2_t3854014517 * get_address_of_rightVector_7() { return &___rightVector_7; }
inline void set_rightVector_7(Vector2_t3854014517 value)
{
___rightVector_7 = value;
}
inline static int32_t get_offset_of_positiveInfinityVector_8() { return static_cast<int32_t>(offsetof(Vector2_t3854014517_StaticFields, ___positiveInfinityVector_8)); }
inline Vector2_t3854014517 get_positiveInfinityVector_8() const { return ___positiveInfinityVector_8; }
inline Vector2_t3854014517 * get_address_of_positiveInfinityVector_8() { return &___positiveInfinityVector_8; }
inline void set_positiveInfinityVector_8(Vector2_t3854014517 value)
{
___positiveInfinityVector_8 = value;
}
inline static int32_t get_offset_of_negativeInfinityVector_9() { return static_cast<int32_t>(offsetof(Vector2_t3854014517_StaticFields, ___negativeInfinityVector_9)); }
inline Vector2_t3854014517 get_negativeInfinityVector_9() const { return ___negativeInfinityVector_9; }
inline Vector2_t3854014517 * get_address_of_negativeInfinityVector_9() { return &___negativeInfinityVector_9; }
inline void set_negativeInfinityVector_9(Vector2_t3854014517 value)
{
___negativeInfinityVector_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VECTOR2_T3854014517_H
#ifndef SINGLE_T3320337292_H
#define SINGLE_T3320337292_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Single
struct Single_t3320337292
{
public:
// System.Single System.Single::m_value
float ___m_value_7;
public:
inline static int32_t get_offset_of_m_value_7() { return static_cast<int32_t>(offsetof(Single_t3320337292, ___m_value_7)); }
inline float get_m_value_7() const { return ___m_value_7; }
inline float* get_address_of_m_value_7() { return &___m_value_7; }
inline void set_m_value_7(float value)
{
___m_value_7 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SINGLE_T3320337292_H
#ifndef COLOR_T267620335_H
#define COLOR_T267620335_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Color
struct Color_t267620335
{
public:
// System.Single UnityEngine.Color::r
float ___r_0;
// System.Single UnityEngine.Color::g
float ___g_1;
// System.Single UnityEngine.Color::b
float ___b_2;
// System.Single UnityEngine.Color::a
float ___a_3;
public:
inline static int32_t get_offset_of_r_0() { return static_cast<int32_t>(offsetof(Color_t267620335, ___r_0)); }
inline float get_r_0() const { return ___r_0; }
inline float* get_address_of_r_0() { return &___r_0; }
inline void set_r_0(float value)
{
___r_0 = value;
}
inline static int32_t get_offset_of_g_1() { return static_cast<int32_t>(offsetof(Color_t267620335, ___g_1)); }
inline float get_g_1() const { return ___g_1; }
inline float* get_address_of_g_1() { return &___g_1; }
inline void set_g_1(float value)
{
___g_1 = value;
}
inline static int32_t get_offset_of_b_2() { return static_cast<int32_t>(offsetof(Color_t267620335, ___b_2)); }
inline float get_b_2() const { return ___b_2; }
inline float* get_address_of_b_2() { return &___b_2; }
inline void set_b_2(float value)
{
___b_2 = value;
}
inline static int32_t get_offset_of_a_3() { return static_cast<int32_t>(offsetof(Color_t267620335, ___a_3)); }
inline float get_a_3() const { return ___a_3; }
inline float* get_address_of_a_3() { return &___a_3; }
inline void set_a_3(float value)
{
___a_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLOR_T267620335_H
#ifndef UNITYEVENT_1_T1551502964_H
#define UNITYEVENT_1_T1551502964_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Events.UnityEvent`1<UnityEngine.Vector2>
struct UnityEvent_1_t1551502964 : public UnityEventBase_t1200889892
{
public:
// System.Object[] UnityEngine.Events.UnityEvent`1::m_InvokeArray
ObjectU5BU5D_t3885370135* ___m_InvokeArray_4;
public:
inline static int32_t get_offset_of_m_InvokeArray_4() { return static_cast<int32_t>(offsetof(UnityEvent_1_t1551502964, ___m_InvokeArray_4)); }
inline ObjectU5BU5D_t3885370135* get_m_InvokeArray_4() const { return ___m_InvokeArray_4; }
inline ObjectU5BU5D_t3885370135** get_address_of_m_InvokeArray_4() { return &___m_InvokeArray_4; }
inline void set_m_InvokeArray_4(ObjectU5BU5D_t3885370135* value)
{
___m_InvokeArray_4 = value;
Il2CppCodeGenWriteBarrier((&___m_InvokeArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNITYEVENT_1_T1551502964_H
#ifndef SPRITESTATE_T2212279481_H
#define SPRITESTATE_T2212279481_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.SpriteState
struct SpriteState_t2212279481
{
public:
// UnityEngine.Sprite UnityEngine.UI.SpriteState::m_HighlightedSprite
Sprite_t3419621700 * ___m_HighlightedSprite_0;
// UnityEngine.Sprite UnityEngine.UI.SpriteState::m_PressedSprite
Sprite_t3419621700 * ___m_PressedSprite_1;
// UnityEngine.Sprite UnityEngine.UI.SpriteState::m_DisabledSprite
Sprite_t3419621700 * ___m_DisabledSprite_2;
public:
inline static int32_t get_offset_of_m_HighlightedSprite_0() { return static_cast<int32_t>(offsetof(SpriteState_t2212279481, ___m_HighlightedSprite_0)); }
inline Sprite_t3419621700 * get_m_HighlightedSprite_0() const { return ___m_HighlightedSprite_0; }
inline Sprite_t3419621700 ** get_address_of_m_HighlightedSprite_0() { return &___m_HighlightedSprite_0; }
inline void set_m_HighlightedSprite_0(Sprite_t3419621700 * value)
{
___m_HighlightedSprite_0 = value;
Il2CppCodeGenWriteBarrier((&___m_HighlightedSprite_0), value);
}
inline static int32_t get_offset_of_m_PressedSprite_1() { return static_cast<int32_t>(offsetof(SpriteState_t2212279481, ___m_PressedSprite_1)); }
inline Sprite_t3419621700 * get_m_PressedSprite_1() const { return ___m_PressedSprite_1; }
inline Sprite_t3419621700 ** get_address_of_m_PressedSprite_1() { return &___m_PressedSprite_1; }
inline void set_m_PressedSprite_1(Sprite_t3419621700 * value)
{
___m_PressedSprite_1 = value;
Il2CppCodeGenWriteBarrier((&___m_PressedSprite_1), value);
}
inline static int32_t get_offset_of_m_DisabledSprite_2() { return static_cast<int32_t>(offsetof(SpriteState_t2212279481, ___m_DisabledSprite_2)); }
inline Sprite_t3419621700 * get_m_DisabledSprite_2() const { return ___m_DisabledSprite_2; }
inline Sprite_t3419621700 ** get_address_of_m_DisabledSprite_2() { return &___m_DisabledSprite_2; }
inline void set_m_DisabledSprite_2(Sprite_t3419621700 * value)
{
___m_DisabledSprite_2 = value;
Il2CppCodeGenWriteBarrier((&___m_DisabledSprite_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.UI.SpriteState
struct SpriteState_t2212279481_marshaled_pinvoke
{
Sprite_t3419621700 * ___m_HighlightedSprite_0;
Sprite_t3419621700 * ___m_PressedSprite_1;
Sprite_t3419621700 * ___m_DisabledSprite_2;
};
// Native definition for COM marshalling of UnityEngine.UI.SpriteState
struct SpriteState_t2212279481_marshaled_com
{
Sprite_t3419621700 * ___m_HighlightedSprite_0;
Sprite_t3419621700 * ___m_PressedSprite_1;
Sprite_t3419621700 * ___m_DisabledSprite_2;
};
#endif // SPRITESTATE_T2212279481_H
#ifndef RECT_T3345319094_H
#define RECT_T3345319094_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rect
struct Rect_t3345319094
{
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_t3345319094, ___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_t3345319094, ___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_t3345319094, ___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_t3345319094, ___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_T3345319094_H
#ifndef UNITYEVENT_1_T1017825739_H
#define UNITYEVENT_1_T1017825739_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Events.UnityEvent`1<System.Single>
struct UnityEvent_1_t1017825739 : public UnityEventBase_t1200889892
{
public:
// System.Object[] UnityEngine.Events.UnityEvent`1::m_InvokeArray
ObjectU5BU5D_t3885370135* ___m_InvokeArray_4;
public:
inline static int32_t get_offset_of_m_InvokeArray_4() { return static_cast<int32_t>(offsetof(UnityEvent_1_t1017825739, ___m_InvokeArray_4)); }
inline ObjectU5BU5D_t3885370135* get_m_InvokeArray_4() const { return ___m_InvokeArray_4; }
inline ObjectU5BU5D_t3885370135** get_address_of_m_InvokeArray_4() { return &___m_InvokeArray_4; }
inline void set_m_InvokeArray_4(ObjectU5BU5D_t3885370135* value)
{
___m_InvokeArray_4 = value;
Il2CppCodeGenWriteBarrier((&___m_InvokeArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNITYEVENT_1_T1017825739_H
#ifndef DRIVENRECTTRANSFORMTRACKER_T2435175526_H
#define DRIVENRECTTRANSFORMTRACKER_T2435175526_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.DrivenRectTransformTracker
struct DrivenRectTransformTracker_t2435175526
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DRIVENRECTTRANSFORMTRACKER_T2435175526_H
#ifndef ENUM_T2506116811_H
#define ENUM_T2506116811_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Enum
struct Enum_t2506116811 : public ValueType_t1651021560
{
public:
public:
};
struct Enum_t2506116811_StaticFields
{
public:
// System.Char[] System.Enum::split_char
CharU5BU5D_t1522321484* ___split_char_0;
public:
inline static int32_t get_offset_of_split_char_0() { return static_cast<int32_t>(offsetof(Enum_t2506116811_StaticFields, ___split_char_0)); }
inline CharU5BU5D_t1522321484* get_split_char_0() const { return ___split_char_0; }
inline CharU5BU5D_t1522321484** get_address_of_split_char_0() { return &___split_char_0; }
inline void set_split_char_0(CharU5BU5D_t1522321484* value)
{
___split_char_0 = value;
Il2CppCodeGenWriteBarrier((&___split_char_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t2506116811_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t2506116811_marshaled_com
{
};
#endif // ENUM_T2506116811_H
#ifndef LAYERMASK_T2995007519_H
#define LAYERMASK_T2995007519_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.LayerMask
struct LayerMask_t2995007519
{
public:
// System.Int32 UnityEngine.LayerMask::m_Mask
int32_t ___m_Mask_0;
public:
inline static int32_t get_offset_of_m_Mask_0() { return static_cast<int32_t>(offsetof(LayerMask_t2995007519, ___m_Mask_0)); }
inline int32_t get_m_Mask_0() const { return ___m_Mask_0; }
inline int32_t* get_address_of_m_Mask_0() { return &___m_Mask_0; }
inline void set_m_Mask_0(int32_t value)
{
___m_Mask_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LAYERMASK_T2995007519_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 UNITYEVENT_1_T3634686199_H
#define UNITYEVENT_1_T3634686199_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Events.UnityEvent`1<System.Boolean>
struct UnityEvent_1_t3634686199 : public UnityEventBase_t1200889892
{
public:
// System.Object[] UnityEngine.Events.UnityEvent`1::m_InvokeArray
ObjectU5BU5D_t3885370135* ___m_InvokeArray_4;
public:
inline static int32_t get_offset_of_m_InvokeArray_4() { return static_cast<int32_t>(offsetof(UnityEvent_1_t3634686199, ___m_InvokeArray_4)); }
inline ObjectU5BU5D_t3885370135* get_m_InvokeArray_4() const { return ___m_InvokeArray_4; }
inline ObjectU5BU5D_t3885370135** get_address_of_m_InvokeArray_4() { return &___m_InvokeArray_4; }
inline void set_m_InvokeArray_4(ObjectU5BU5D_t3885370135* value)
{
___m_InvokeArray_4 = value;
Il2CppCodeGenWriteBarrier((&___m_InvokeArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNITYEVENT_1_T3634686199_H
#ifndef COMPAREFUNCTION_T2535906654_H
#define COMPAREFUNCTION_T2535906654_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rendering.CompareFunction
struct CompareFunction_t2535906654
{
public:
// System.Int32 UnityEngine.Rendering.CompareFunction::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(CompareFunction_t2535906654, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COMPAREFUNCTION_T2535906654_H
#ifndef ASPECTMODE_T3758921781_H
#define ASPECTMODE_T3758921781_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.AspectRatioFitter/AspectMode
struct AspectMode_t3758921781
{
public:
// System.Int32 UnityEngine.UI.AspectRatioFitter/AspectMode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(AspectMode_t3758921781, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ASPECTMODE_T3758921781_H
#ifndef COLORWRITEMASK_T1030456560_H
#define COLORWRITEMASK_T1030456560_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rendering.ColorWriteMask
struct ColorWriteMask_t1030456560
{
public:
// System.Int32 UnityEngine.Rendering.ColorWriteMask::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ColorWriteMask_t1030456560, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLORWRITEMASK_T1030456560_H
#ifndef SCALEMODE_T3168547327_H
#define SCALEMODE_T3168547327_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.CanvasScaler/ScaleMode
struct ScaleMode_t3168547327
{
public:
// System.Int32 UnityEngine.UI.CanvasScaler/ScaleMode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ScaleMode_t3168547327, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCALEMODE_T3168547327_H
#ifndef COLORBLOCK_T3155116571_H
#define COLORBLOCK_T3155116571_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ColorBlock
struct ColorBlock_t3155116571
{
public:
// UnityEngine.Color UnityEngine.UI.ColorBlock::m_NormalColor
Color_t267620335 ___m_NormalColor_0;
// UnityEngine.Color UnityEngine.UI.ColorBlock::m_HighlightedColor
Color_t267620335 ___m_HighlightedColor_1;
// UnityEngine.Color UnityEngine.UI.ColorBlock::m_PressedColor
Color_t267620335 ___m_PressedColor_2;
// UnityEngine.Color UnityEngine.UI.ColorBlock::m_DisabledColor
Color_t267620335 ___m_DisabledColor_3;
// System.Single UnityEngine.UI.ColorBlock::m_ColorMultiplier
float ___m_ColorMultiplier_4;
// System.Single UnityEngine.UI.ColorBlock::m_FadeDuration
float ___m_FadeDuration_5;
public:
inline static int32_t get_offset_of_m_NormalColor_0() { return static_cast<int32_t>(offsetof(ColorBlock_t3155116571, ___m_NormalColor_0)); }
inline Color_t267620335 get_m_NormalColor_0() const { return ___m_NormalColor_0; }
inline Color_t267620335 * get_address_of_m_NormalColor_0() { return &___m_NormalColor_0; }
inline void set_m_NormalColor_0(Color_t267620335 value)
{
___m_NormalColor_0 = value;
}
inline static int32_t get_offset_of_m_HighlightedColor_1() { return static_cast<int32_t>(offsetof(ColorBlock_t3155116571, ___m_HighlightedColor_1)); }
inline Color_t267620335 get_m_HighlightedColor_1() const { return ___m_HighlightedColor_1; }
inline Color_t267620335 * get_address_of_m_HighlightedColor_1() { return &___m_HighlightedColor_1; }
inline void set_m_HighlightedColor_1(Color_t267620335 value)
{
___m_HighlightedColor_1 = value;
}
inline static int32_t get_offset_of_m_PressedColor_2() { return static_cast<int32_t>(offsetof(ColorBlock_t3155116571, ___m_PressedColor_2)); }
inline Color_t267620335 get_m_PressedColor_2() const { return ___m_PressedColor_2; }
inline Color_t267620335 * get_address_of_m_PressedColor_2() { return &___m_PressedColor_2; }
inline void set_m_PressedColor_2(Color_t267620335 value)
{
___m_PressedColor_2 = value;
}
inline static int32_t get_offset_of_m_DisabledColor_3() { return static_cast<int32_t>(offsetof(ColorBlock_t3155116571, ___m_DisabledColor_3)); }
inline Color_t267620335 get_m_DisabledColor_3() const { return ___m_DisabledColor_3; }
inline Color_t267620335 * get_address_of_m_DisabledColor_3() { return &___m_DisabledColor_3; }
inline void set_m_DisabledColor_3(Color_t267620335 value)
{
___m_DisabledColor_3 = value;
}
inline static int32_t get_offset_of_m_ColorMultiplier_4() { return static_cast<int32_t>(offsetof(ColorBlock_t3155116571, ___m_ColorMultiplier_4)); }
inline float get_m_ColorMultiplier_4() const { return ___m_ColorMultiplier_4; }
inline float* get_address_of_m_ColorMultiplier_4() { return &___m_ColorMultiplier_4; }
inline void set_m_ColorMultiplier_4(float value)
{
___m_ColorMultiplier_4 = value;
}
inline static int32_t get_offset_of_m_FadeDuration_5() { return static_cast<int32_t>(offsetof(ColorBlock_t3155116571, ___m_FadeDuration_5)); }
inline float get_m_FadeDuration_5() const { return ___m_FadeDuration_5; }
inline float* get_address_of_m_FadeDuration_5() { return &___m_FadeDuration_5; }
inline void set_m_FadeDuration_5(float value)
{
___m_FadeDuration_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COLORBLOCK_T3155116571_H
#ifndef UNIT_T3440473078_H
#define UNIT_T3440473078_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.CanvasScaler/Unit
struct Unit_t3440473078
{
public:
// System.Int32 UnityEngine.UI.CanvasScaler/Unit::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Unit_t3440473078, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UNIT_T3440473078_H
#ifndef STENCILOP_T1777355712_H
#define STENCILOP_T1777355712_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Rendering.StencilOp
struct StencilOp_t1777355712
{
public:
// System.Int32 UnityEngine.Rendering.StencilOp::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(StencilOp_t1777355712, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // STENCILOP_T1777355712_H
#ifndef FITMODE_T1001252671_H
#define FITMODE_T1001252671_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ContentSizeFitter/FitMode
struct FitMode_t1001252671
{
public:
// System.Int32 UnityEngine.UI.ContentSizeFitter/FitMode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(FitMode_t1001252671, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // FITMODE_T1001252671_H
#ifndef VERTEXHELPER_T122899649_H
#define VERTEXHELPER_T122899649_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_t122899649 : public RuntimeObject
{
public:
// System.Collections.Generic.List`1<UnityEngine.Vector3> UnityEngine.UI.VertexHelper::m_Positions
List_1_t3585477728 * ___m_Positions_0;
// System.Collections.Generic.List`1<UnityEngine.Color32> UnityEngine.UI.VertexHelper::m_Colors
List_1_t1617812587 * ___m_Colors_1;
// System.Collections.Generic.List`1<UnityEngine.Vector2> UnityEngine.UI.VertexHelper::m_Uv0S
List_1_t3076900357 * ___m_Uv0S_2;
// System.Collections.Generic.List`1<UnityEngine.Vector2> UnityEngine.UI.VertexHelper::m_Uv1S
List_1_t3076900357 * ___m_Uv1S_3;
// System.Collections.Generic.List`1<UnityEngine.Vector2> UnityEngine.UI.VertexHelper::m_Uv2S
List_1_t3076900357 * ___m_Uv2S_4;
// System.Collections.Generic.List`1<UnityEngine.Vector2> UnityEngine.UI.VertexHelper::m_Uv3S
List_1_t3076900357 * ___m_Uv3S_5;
// System.Collections.Generic.List`1<UnityEngine.Vector3> UnityEngine.UI.VertexHelper::m_Normals
List_1_t3585477728 * ___m_Normals_6;
// System.Collections.Generic.List`1<UnityEngine.Vector4> UnityEngine.UI.VertexHelper::m_Tangents
List_1_t3331801177 * ___m_Tangents_7;
// System.Collections.Generic.List`1<System.Int32> UnityEngine.UI.VertexHelper::m_Indices
List_1_t1408133244 * ___m_Indices_8;
public:
inline static int32_t get_offset_of_m_Positions_0() { return static_cast<int32_t>(offsetof(VertexHelper_t122899649, ___m_Positions_0)); }
inline List_1_t3585477728 * get_m_Positions_0() const { return ___m_Positions_0; }
inline List_1_t3585477728 ** get_address_of_m_Positions_0() { return &___m_Positions_0; }
inline void set_m_Positions_0(List_1_t3585477728 * 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_t122899649, ___m_Colors_1)); }
inline List_1_t1617812587 * get_m_Colors_1() const { return ___m_Colors_1; }
inline List_1_t1617812587 ** get_address_of_m_Colors_1() { return &___m_Colors_1; }
inline void set_m_Colors_1(List_1_t1617812587 * 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_t122899649, ___m_Uv0S_2)); }
inline List_1_t3076900357 * get_m_Uv0S_2() const { return ___m_Uv0S_2; }
inline List_1_t3076900357 ** get_address_of_m_Uv0S_2() { return &___m_Uv0S_2; }
inline void set_m_Uv0S_2(List_1_t3076900357 * 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_t122899649, ___m_Uv1S_3)); }
inline List_1_t3076900357 * get_m_Uv1S_3() const { return ___m_Uv1S_3; }
inline List_1_t3076900357 ** get_address_of_m_Uv1S_3() { return &___m_Uv1S_3; }
inline void set_m_Uv1S_3(List_1_t3076900357 * 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_t122899649, ___m_Uv2S_4)); }
inline List_1_t3076900357 * get_m_Uv2S_4() const { return ___m_Uv2S_4; }
inline List_1_t3076900357 ** get_address_of_m_Uv2S_4() { return &___m_Uv2S_4; }
inline void set_m_Uv2S_4(List_1_t3076900357 * 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_t122899649, ___m_Uv3S_5)); }
inline List_1_t3076900357 * get_m_Uv3S_5() const { return ___m_Uv3S_5; }
inline List_1_t3076900357 ** get_address_of_m_Uv3S_5() { return &___m_Uv3S_5; }
inline void set_m_Uv3S_5(List_1_t3076900357 * 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_t122899649, ___m_Normals_6)); }
inline List_1_t3585477728 * get_m_Normals_6() const { return ___m_Normals_6; }
inline List_1_t3585477728 ** get_address_of_m_Normals_6() { return &___m_Normals_6; }
inline void set_m_Normals_6(List_1_t3585477728 * 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_t122899649, ___m_Tangents_7)); }
inline List_1_t3331801177 * get_m_Tangents_7() const { return ___m_Tangents_7; }
inline List_1_t3331801177 ** get_address_of_m_Tangents_7() { return &___m_Tangents_7; }
inline void set_m_Tangents_7(List_1_t3331801177 * 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_t122899649, ___m_Indices_8)); }
inline List_1_t1408133244 * get_m_Indices_8() const { return ___m_Indices_8; }
inline List_1_t1408133244 ** get_address_of_m_Indices_8() { return &___m_Indices_8; }
inline void set_m_Indices_8(List_1_t1408133244 * value)
{
___m_Indices_8 = value;
Il2CppCodeGenWriteBarrier((&___m_Indices_8), value);
}
};
struct VertexHelper_t122899649_StaticFields
{
public:
// UnityEngine.Vector4 UnityEngine.UI.VertexHelper::s_DefaultTangent
Vector4_t4108915337 ___s_DefaultTangent_9;
// UnityEngine.Vector3 UnityEngine.UI.VertexHelper::s_DefaultNormal
Vector3_t67624592 ___s_DefaultNormal_10;
public:
inline static int32_t get_offset_of_s_DefaultTangent_9() { return static_cast<int32_t>(offsetof(VertexHelper_t122899649_StaticFields, ___s_DefaultTangent_9)); }
inline Vector4_t4108915337 get_s_DefaultTangent_9() const { return ___s_DefaultTangent_9; }
inline Vector4_t4108915337 * get_address_of_s_DefaultTangent_9() { return &___s_DefaultTangent_9; }
inline void set_s_DefaultTangent_9(Vector4_t4108915337 value)
{
___s_DefaultTangent_9 = value;
}
inline static int32_t get_offset_of_s_DefaultNormal_10() { return static_cast<int32_t>(offsetof(VertexHelper_t122899649_StaticFields, ___s_DefaultNormal_10)); }
inline Vector3_t67624592 get_s_DefaultNormal_10() const { return ___s_DefaultNormal_10; }
inline Vector3_t67624592 * get_address_of_s_DefaultNormal_10() { return &___s_DefaultNormal_10; }
inline void set_s_DefaultNormal_10(Vector3_t67624592 value)
{
___s_DefaultNormal_10 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VERTEXHELPER_T122899649_H
#ifndef CORNER_T1934471927_H
#define CORNER_T1934471927_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.GridLayoutGroup/Corner
struct Corner_t1934471927
{
public:
// System.Int32 UnityEngine.UI.GridLayoutGroup/Corner::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Corner_t1934471927, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CORNER_T1934471927_H
#ifndef AXIS_T2011730614_H
#define AXIS_T2011730614_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.GridLayoutGroup/Axis
struct Axis_t2011730614
{
public:
// System.Int32 UnityEngine.UI.GridLayoutGroup/Axis::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Axis_t2011730614, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AXIS_T2011730614_H
#ifndef CONSTRAINT_T2120095582_H
#define CONSTRAINT_T2120095582_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.GridLayoutGroup/Constraint
struct Constraint_t2120095582
{
public:
// System.Int32 UnityEngine.UI.GridLayoutGroup/Constraint::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Constraint_t2120095582, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CONSTRAINT_T2120095582_H
#ifndef TOGGLEEVENT_T538146237_H
#define TOGGLEEVENT_T538146237_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Toggle/ToggleEvent
struct ToggleEvent_t538146237 : public UnityEvent_1_t3634686199
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOGGLEEVENT_T538146237_H
#ifndef BOUNDS_T2168426705_H
#define BOUNDS_T2168426705_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Bounds
struct Bounds_t2168426705
{
public:
// UnityEngine.Vector3 UnityEngine.Bounds::m_Center
Vector3_t67624592 ___m_Center_0;
// UnityEngine.Vector3 UnityEngine.Bounds::m_Extents
Vector3_t67624592 ___m_Extents_1;
public:
inline static int32_t get_offset_of_m_Center_0() { return static_cast<int32_t>(offsetof(Bounds_t2168426705, ___m_Center_0)); }
inline Vector3_t67624592 get_m_Center_0() const { return ___m_Center_0; }
inline Vector3_t67624592 * get_address_of_m_Center_0() { return &___m_Center_0; }
inline void set_m_Center_0(Vector3_t67624592 value)
{
___m_Center_0 = value;
}
inline static int32_t get_offset_of_m_Extents_1() { return static_cast<int32_t>(offsetof(Bounds_t2168426705, ___m_Extents_1)); }
inline Vector3_t67624592 get_m_Extents_1() const { return ___m_Extents_1; }
inline Vector3_t67624592 * get_address_of_m_Extents_1() { return &___m_Extents_1; }
inline void set_m_Extents_1(Vector3_t67624592 value)
{
___m_Extents_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOUNDS_T2168426705_H
#ifndef TOUCHSCREENKEYBOARDTYPE_T2797467997_H
#define TOUCHSCREENKEYBOARDTYPE_T2797467997_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.TouchScreenKeyboardType
struct TouchScreenKeyboardType_t2797467997
{
public:
// System.Int32 UnityEngine.TouchScreenKeyboardType::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(TouchScreenKeyboardType_t2797467997, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOUCHSCREENKEYBOARDTYPE_T2797467997_H
#ifndef SCREENMATCHMODE_T2916724817_H
#define SCREENMATCHMODE_T2916724817_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.CanvasScaler/ScreenMatchMode
struct ScreenMatchMode_t2916724817
{
public:
// System.Int32 UnityEngine.UI.CanvasScaler/ScreenMatchMode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ScreenMatchMode_t2916724817, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCREENMATCHMODE_T2916724817_H
#ifndef TOGGLETRANSITION_T3219964137_H
#define TOGGLETRANSITION_T3219964137_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Toggle/ToggleTransition
struct ToggleTransition_t3219964137
{
public:
// System.Int32 UnityEngine.UI.Toggle/ToggleTransition::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ToggleTransition_t3219964137, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOGGLETRANSITION_T3219964137_H
#ifndef OBJECT_T1332387349_H
#define OBJECT_T1332387349_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Object
struct Object_t1332387349 : 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_t1332387349, ___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_t1332387349_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_t1332387349_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_t1332387349_marshaled_pinvoke
{
intptr_t ___m_CachedPtr_0;
};
// Native definition for COM marshalling of UnityEngine.Object
struct Object_t1332387349_marshaled_com
{
intptr_t ___m_CachedPtr_0;
};
#endif // OBJECT_T1332387349_H
#ifndef RAY_T3058960190_H
#define RAY_T3058960190_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Ray
struct Ray_t3058960190
{
public:
// UnityEngine.Vector3 UnityEngine.Ray::m_Origin
Vector3_t67624592 ___m_Origin_0;
// UnityEngine.Vector3 UnityEngine.Ray::m_Direction
Vector3_t67624592 ___m_Direction_1;
public:
inline static int32_t get_offset_of_m_Origin_0() { return static_cast<int32_t>(offsetof(Ray_t3058960190, ___m_Origin_0)); }
inline Vector3_t67624592 get_m_Origin_0() const { return ___m_Origin_0; }
inline Vector3_t67624592 * get_address_of_m_Origin_0() { return &___m_Origin_0; }
inline void set_m_Origin_0(Vector3_t67624592 value)
{
___m_Origin_0 = value;
}
inline static int32_t get_offset_of_m_Direction_1() { return static_cast<int32_t>(offsetof(Ray_t3058960190, ___m_Direction_1)); }
inline Vector3_t67624592 get_m_Direction_1() const { return ___m_Direction_1; }
inline Vector3_t67624592 * get_address_of_m_Direction_1() { return &___m_Direction_1; }
inline void set_m_Direction_1(Vector3_t67624592 value)
{
___m_Direction_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RAY_T3058960190_H
#ifndef TEXTANCHOR_T517930805_H
#define TEXTANCHOR_T517930805_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.TextAnchor
struct TextAnchor_t517930805
{
public:
// System.Int32 UnityEngine.TextAnchor::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(TextAnchor_t517930805, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TEXTANCHOR_T517930805_H
#ifndef ONCHANGEEVENT_T970128749_H
#define ONCHANGEEVENT_T970128749_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/OnChangeEvent
struct OnChangeEvent_t970128749 : public UnityEvent_1_t1966248298
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ONCHANGEEVENT_T970128749_H
#ifndef SUBMITEVENT_T2550651048_H
#define SUBMITEVENT_T2550651048_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/SubmitEvent
struct SubmitEvent_t2550651048 : public UnityEvent_1_t1966248298
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SUBMITEVENT_T2550651048_H
#ifndef LINETYPE_T3268879351_H
#define LINETYPE_T3268879351_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/LineType
struct LineType_t3268879351
{
public:
// System.Int32 UnityEngine.UI.InputField/LineType::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(LineType_t3268879351, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LINETYPE_T3268879351_H
#ifndef CHARACTERVALIDATION_T2169882528_H
#define CHARACTERVALIDATION_T2169882528_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/CharacterValidation
struct CharacterValidation_t2169882528
{
public:
// System.Int32 UnityEngine.UI.InputField/CharacterValidation::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(CharacterValidation_t2169882528, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CHARACTERVALIDATION_T2169882528_H
#ifndef INPUTTYPE_T2526005958_H
#define INPUTTYPE_T2526005958_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/InputType
struct InputType_t2526005958
{
public:
// System.Int32 UnityEngine.UI.InputField/InputType::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(InputType_t2526005958, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTTYPE_T2526005958_H
#ifndef CONTENTTYPE_T1708293613_H
#define CONTENTTYPE_T1708293613_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/ContentType
struct ContentType_t1708293613
{
public:
// System.Int32 UnityEngine.UI.InputField/ContentType::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ContentType_t1708293613, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CONTENTTYPE_T1708293613_H
#ifndef ORIGIN360_T2916974445_H
#define ORIGIN360_T2916974445_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Image/Origin360
struct Origin360_t2916974445
{
public:
// System.Int32 UnityEngine.UI.Image/Origin360::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Origin360_t2916974445, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ORIGIN360_T2916974445_H
#ifndef ORIGIN180_T3595788426_H
#define ORIGIN180_T3595788426_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Image/Origin180
struct Origin180_t3595788426
{
public:
// System.Int32 UnityEngine.UI.Image/Origin180::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Origin180_t3595788426, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ORIGIN180_T3595788426_H
#ifndef ORIGIN90_T1855357908_H
#define ORIGIN90_T1855357908_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Image/Origin90
struct Origin90_t1855357908
{
public:
// System.Int32 UnityEngine.UI.Image/Origin90::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Origin90_t1855357908, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ORIGIN90_T1855357908_H
#ifndef ORIGINVERTICAL_T4015097076_H
#define ORIGINVERTICAL_T4015097076_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Image/OriginVertical
struct OriginVertical_t4015097076
{
public:
// System.Int32 UnityEngine.UI.Image/OriginVertical::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(OriginVertical_t4015097076, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ORIGINVERTICAL_T4015097076_H
#ifndef ORIGINHORIZONTAL_T4239248393_H
#define ORIGINHORIZONTAL_T4239248393_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Image/OriginHorizontal
struct OriginHorizontal_t4239248393
{
public:
// System.Int32 UnityEngine.UI.Image/OriginHorizontal::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(OriginHorizontal_t4239248393, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ORIGINHORIZONTAL_T4239248393_H
#ifndef FILLMETHOD_T2543319811_H
#define FILLMETHOD_T2543319811_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Image/FillMethod
struct FillMethod_t2543319811
{
public:
// System.Int32 UnityEngine.UI.Image/FillMethod::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(FillMethod_t2543319811, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // FILLMETHOD_T2543319811_H
#ifndef TYPE_T3948253205_H
#define TYPE_T3948253205_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Image/Type
struct Type_t3948253205
{
public:
// System.Int32 UnityEngine.UI.Image/Type::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Type_t3948253205, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TYPE_T3948253205_H
#ifndef BLOCKINGOBJECTS_T1079817636_H
#define BLOCKINGOBJECTS_T1079817636_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.GraphicRaycaster/BlockingObjects
struct BlockingObjects_t1079817636
{
public:
// System.Int32 UnityEngine.UI.GraphicRaycaster/BlockingObjects::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(BlockingObjects_t1079817636, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BLOCKINGOBJECTS_T1079817636_H
#ifndef U3CMOUSEDRAGOUTSIDERECTU3EC__ITERATOR1_T1050685415_H
#define U3CMOUSEDRAGOUTSIDERECTU3EC__ITERATOR1_T1050685415_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1
struct U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415 : public RuntimeObject
{
public:
// UnityEngine.EventSystems.PointerEventData UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1::eventData
PointerEventData_t164029711 * ___eventData_0;
// UnityEngine.Vector2 UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1::<localMousePos>__1
Vector2_t3854014517 ___U3ClocalMousePosU3E__1_1;
// UnityEngine.Rect UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1::<rect>__1
Rect_t3345319094 ___U3CrectU3E__1_2;
// System.Single UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1::<delay>__1
float ___U3CdelayU3E__1_3;
// UnityEngine.UI.InputField UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1::$this
InputField_t3950490122 * ___U24this_4;
// System.Object UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1::$current
RuntimeObject * ___U24current_5;
// System.Boolean UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1::$disposing
bool ___U24disposing_6;
// System.Int32 UnityEngine.UI.InputField/<MouseDragOutsideRect>c__Iterator1::$PC
int32_t ___U24PC_7;
public:
inline static int32_t get_offset_of_eventData_0() { return static_cast<int32_t>(offsetof(U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415, ___eventData_0)); }
inline PointerEventData_t164029711 * get_eventData_0() const { return ___eventData_0; }
inline PointerEventData_t164029711 ** get_address_of_eventData_0() { return &___eventData_0; }
inline void set_eventData_0(PointerEventData_t164029711 * value)
{
___eventData_0 = value;
Il2CppCodeGenWriteBarrier((&___eventData_0), value);
}
inline static int32_t get_offset_of_U3ClocalMousePosU3E__1_1() { return static_cast<int32_t>(offsetof(U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415, ___U3ClocalMousePosU3E__1_1)); }
inline Vector2_t3854014517 get_U3ClocalMousePosU3E__1_1() const { return ___U3ClocalMousePosU3E__1_1; }
inline Vector2_t3854014517 * get_address_of_U3ClocalMousePosU3E__1_1() { return &___U3ClocalMousePosU3E__1_1; }
inline void set_U3ClocalMousePosU3E__1_1(Vector2_t3854014517 value)
{
___U3ClocalMousePosU3E__1_1 = value;
}
inline static int32_t get_offset_of_U3CrectU3E__1_2() { return static_cast<int32_t>(offsetof(U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415, ___U3CrectU3E__1_2)); }
inline Rect_t3345319094 get_U3CrectU3E__1_2() const { return ___U3CrectU3E__1_2; }
inline Rect_t3345319094 * get_address_of_U3CrectU3E__1_2() { return &___U3CrectU3E__1_2; }
inline void set_U3CrectU3E__1_2(Rect_t3345319094 value)
{
___U3CrectU3E__1_2 = value;
}
inline static int32_t get_offset_of_U3CdelayU3E__1_3() { return static_cast<int32_t>(offsetof(U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415, ___U3CdelayU3E__1_3)); }
inline float get_U3CdelayU3E__1_3() const { return ___U3CdelayU3E__1_3; }
inline float* get_address_of_U3CdelayU3E__1_3() { return &___U3CdelayU3E__1_3; }
inline void set_U3CdelayU3E__1_3(float value)
{
___U3CdelayU3E__1_3 = value;
}
inline static int32_t get_offset_of_U24this_4() { return static_cast<int32_t>(offsetof(U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415, ___U24this_4)); }
inline InputField_t3950490122 * get_U24this_4() const { return ___U24this_4; }
inline InputField_t3950490122 ** get_address_of_U24this_4() { return &___U24this_4; }
inline void set_U24this_4(InputField_t3950490122 * value)
{
___U24this_4 = value;
Il2CppCodeGenWriteBarrier((&___U24this_4), value);
}
inline static int32_t get_offset_of_U24current_5() { return static_cast<int32_t>(offsetof(U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415, ___U24current_5)); }
inline RuntimeObject * get_U24current_5() const { return ___U24current_5; }
inline RuntimeObject ** get_address_of_U24current_5() { return &___U24current_5; }
inline void set_U24current_5(RuntimeObject * value)
{
___U24current_5 = value;
Il2CppCodeGenWriteBarrier((&___U24current_5), value);
}
inline static int32_t get_offset_of_U24disposing_6() { return static_cast<int32_t>(offsetof(U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415, ___U24disposing_6)); }
inline bool get_U24disposing_6() const { return ___U24disposing_6; }
inline bool* get_address_of_U24disposing_6() { return &___U24disposing_6; }
inline void set_U24disposing_6(bool value)
{
___U24disposing_6 = value;
}
inline static int32_t get_offset_of_U24PC_7() { return static_cast<int32_t>(offsetof(U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415, ___U24PC_7)); }
inline int32_t get_U24PC_7() const { return ___U24PC_7; }
inline int32_t* get_address_of_U24PC_7() { return &___U24PC_7; }
inline void set_U24PC_7(int32_t value)
{
___U24PC_7 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMOUSEDRAGOUTSIDERECTU3EC__ITERATOR1_T1050685415_H
#ifndef CULLSTATECHANGEDEVENT_T2536871658_H
#define CULLSTATECHANGEDEVENT_T2536871658_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.MaskableGraphic/CullStateChangedEvent
struct CullStateChangedEvent_t2536871658 : public UnityEvent_1_t3634686199
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CULLSTATECHANGEDEVENT_T2536871658_H
#ifndef EDITSTATE_T906096569_H
#define EDITSTATE_T906096569_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/EditState
struct EditState_t906096569
{
public:
// System.Int32 UnityEngine.UI.InputField/EditState::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(EditState_t906096569, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // EDITSTATE_T906096569_H
#ifndef MODE_T248186590_H
#define MODE_T248186590_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Navigation/Mode
struct Mode_t248186590
{
public:
// System.Int32 UnityEngine.UI.Navigation/Mode::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Mode_t248186590, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MODE_T248186590_H
#ifndef AXIS_T597648171_H
#define AXIS_T597648171_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Slider/Axis
struct Axis_t597648171
{
public:
// System.Int32 UnityEngine.UI.Slider/Axis::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Axis_t597648171, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AXIS_T597648171_H
#ifndef SLIDEREVENT_T260680582_H
#define SLIDEREVENT_T260680582_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Slider/SliderEvent
struct SliderEvent_t260680582 : public UnityEvent_1_t1017825739
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SLIDEREVENT_T260680582_H
#ifndef DIRECTION_T4110063302_H
#define DIRECTION_T4110063302_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Slider/Direction
struct Direction_t4110063302
{
public:
// System.Int32 UnityEngine.UI.Slider/Direction::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Direction_t4110063302, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DIRECTION_T4110063302_H
#ifndef RAYCASTHIT_T254327561_H
#define RAYCASTHIT_T254327561_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RaycastHit
struct RaycastHit_t254327561
{
public:
// UnityEngine.Vector3 UnityEngine.RaycastHit::m_Point
Vector3_t67624592 ___m_Point_0;
// UnityEngine.Vector3 UnityEngine.RaycastHit::m_Normal
Vector3_t67624592 ___m_Normal_1;
// System.Int32 UnityEngine.RaycastHit::m_FaceID
int32_t ___m_FaceID_2;
// System.Single UnityEngine.RaycastHit::m_Distance
float ___m_Distance_3;
// UnityEngine.Vector2 UnityEngine.RaycastHit::m_UV
Vector2_t3854014517 ___m_UV_4;
// UnityEngine.Collider UnityEngine.RaycastHit::m_Collider
Collider_t3058509131 * ___m_Collider_5;
public:
inline static int32_t get_offset_of_m_Point_0() { return static_cast<int32_t>(offsetof(RaycastHit_t254327561, ___m_Point_0)); }
inline Vector3_t67624592 get_m_Point_0() const { return ___m_Point_0; }
inline Vector3_t67624592 * get_address_of_m_Point_0() { return &___m_Point_0; }
inline void set_m_Point_0(Vector3_t67624592 value)
{
___m_Point_0 = value;
}
inline static int32_t get_offset_of_m_Normal_1() { return static_cast<int32_t>(offsetof(RaycastHit_t254327561, ___m_Normal_1)); }
inline Vector3_t67624592 get_m_Normal_1() const { return ___m_Normal_1; }
inline Vector3_t67624592 * get_address_of_m_Normal_1() { return &___m_Normal_1; }
inline void set_m_Normal_1(Vector3_t67624592 value)
{
___m_Normal_1 = value;
}
inline static int32_t get_offset_of_m_FaceID_2() { return static_cast<int32_t>(offsetof(RaycastHit_t254327561, ___m_FaceID_2)); }
inline int32_t get_m_FaceID_2() const { return ___m_FaceID_2; }
inline int32_t* get_address_of_m_FaceID_2() { return &___m_FaceID_2; }
inline void set_m_FaceID_2(int32_t value)
{
___m_FaceID_2 = value;
}
inline static int32_t get_offset_of_m_Distance_3() { return static_cast<int32_t>(offsetof(RaycastHit_t254327561, ___m_Distance_3)); }
inline float get_m_Distance_3() const { return ___m_Distance_3; }
inline float* get_address_of_m_Distance_3() { return &___m_Distance_3; }
inline void set_m_Distance_3(float value)
{
___m_Distance_3 = value;
}
inline static int32_t get_offset_of_m_UV_4() { return static_cast<int32_t>(offsetof(RaycastHit_t254327561, ___m_UV_4)); }
inline Vector2_t3854014517 get_m_UV_4() const { return ___m_UV_4; }
inline Vector2_t3854014517 * get_address_of_m_UV_4() { return &___m_UV_4; }
inline void set_m_UV_4(Vector2_t3854014517 value)
{
___m_UV_4 = value;
}
inline static int32_t get_offset_of_m_Collider_5() { return static_cast<int32_t>(offsetof(RaycastHit_t254327561, ___m_Collider_5)); }
inline Collider_t3058509131 * get_m_Collider_5() const { return ___m_Collider_5; }
inline Collider_t3058509131 ** get_address_of_m_Collider_5() { return &___m_Collider_5; }
inline void set_m_Collider_5(Collider_t3058509131 * value)
{
___m_Collider_5 = value;
Il2CppCodeGenWriteBarrier((&___m_Collider_5), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.RaycastHit
struct RaycastHit_t254327561_marshaled_pinvoke
{
Vector3_t67624592 ___m_Point_0;
Vector3_t67624592 ___m_Normal_1;
int32_t ___m_FaceID_2;
float ___m_Distance_3;
Vector2_t3854014517 ___m_UV_4;
Collider_t3058509131 * ___m_Collider_5;
};
// Native definition for COM marshalling of UnityEngine.RaycastHit
struct RaycastHit_t254327561_marshaled_com
{
Vector3_t67624592 ___m_Point_0;
Vector3_t67624592 ___m_Normal_1;
int32_t ___m_FaceID_2;
float ___m_Distance_3;
Vector2_t3854014517 ___m_UV_4;
Collider_t3058509131 * ___m_Collider_5;
};
#endif // RAYCASTHIT_T254327561_H
#ifndef SELECTIONSTATE_T3662906228_H
#define SELECTIONSTATE_T3662906228_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Selectable/SelectionState
struct SelectionState_t3662906228
{
public:
// System.Int32 UnityEngine.UI.Selectable/SelectionState::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(SelectionState_t3662906228, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SELECTIONSTATE_T3662906228_H
#ifndef TRANSITION_T75905610_H
#define TRANSITION_T75905610_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Selectable/Transition
struct Transition_t75905610
{
public:
// System.Int32 UnityEngine.UI.Selectable/Transition::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Transition_t75905610, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TRANSITION_T75905610_H
#ifndef SCROLLRECTEVENT_T1918886797_H
#define SCROLLRECTEVENT_T1918886797_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ScrollRect/ScrollRectEvent
struct ScrollRectEvent_t1918886797 : public UnityEvent_1_t1551502964
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCROLLRECTEVENT_T1918886797_H
#ifndef MOVEMENTTYPE_T27617511_H
#define MOVEMENTTYPE_T27617511_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ScrollRect/MovementType
struct MovementType_t27617511
{
public:
// System.Int32 UnityEngine.UI.ScrollRect/MovementType::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(MovementType_t27617511, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MOVEMENTTYPE_T27617511_H
#ifndef SCROLLBARVISIBILITY_T836594649_H
#define SCROLLBARVISIBILITY_T836594649_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ScrollRect/ScrollbarVisibility
struct ScrollbarVisibility_t836594649
{
public:
// System.Int32 UnityEngine.UI.ScrollRect/ScrollbarVisibility::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(ScrollbarVisibility_t836594649, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCROLLBARVISIBILITY_T836594649_H
#ifndef SCROLLEVENT_T2334911764_H
#define SCROLLEVENT_T2334911764_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Scrollbar/ScrollEvent
struct ScrollEvent_t2334911764 : public UnityEvent_1_t1017825739
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCROLLEVENT_T2334911764_H
#ifndef RAYCASTHIT2D_T3236695499_H
#define RAYCASTHIT2D_T3236695499_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.RaycastHit2D
struct RaycastHit2D_t3236695499
{
public:
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::m_Centroid
Vector2_t3854014517 ___m_Centroid_0;
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::m_Point
Vector2_t3854014517 ___m_Point_1;
// UnityEngine.Vector2 UnityEngine.RaycastHit2D::m_Normal
Vector2_t3854014517 ___m_Normal_2;
// System.Single UnityEngine.RaycastHit2D::m_Distance
float ___m_Distance_3;
// System.Single UnityEngine.RaycastHit2D::m_Fraction
float ___m_Fraction_4;
// UnityEngine.Collider2D UnityEngine.RaycastHit2D::m_Collider
Collider2D_t2180151806 * ___m_Collider_5;
public:
inline static int32_t get_offset_of_m_Centroid_0() { return static_cast<int32_t>(offsetof(RaycastHit2D_t3236695499, ___m_Centroid_0)); }
inline Vector2_t3854014517 get_m_Centroid_0() const { return ___m_Centroid_0; }
inline Vector2_t3854014517 * get_address_of_m_Centroid_0() { return &___m_Centroid_0; }
inline void set_m_Centroid_0(Vector2_t3854014517 value)
{
___m_Centroid_0 = value;
}
inline static int32_t get_offset_of_m_Point_1() { return static_cast<int32_t>(offsetof(RaycastHit2D_t3236695499, ___m_Point_1)); }
inline Vector2_t3854014517 get_m_Point_1() const { return ___m_Point_1; }
inline Vector2_t3854014517 * get_address_of_m_Point_1() { return &___m_Point_1; }
inline void set_m_Point_1(Vector2_t3854014517 value)
{
___m_Point_1 = value;
}
inline static int32_t get_offset_of_m_Normal_2() { return static_cast<int32_t>(offsetof(RaycastHit2D_t3236695499, ___m_Normal_2)); }
inline Vector2_t3854014517 get_m_Normal_2() const { return ___m_Normal_2; }
inline Vector2_t3854014517 * get_address_of_m_Normal_2() { return &___m_Normal_2; }
inline void set_m_Normal_2(Vector2_t3854014517 value)
{
___m_Normal_2 = value;
}
inline static int32_t get_offset_of_m_Distance_3() { return static_cast<int32_t>(offsetof(RaycastHit2D_t3236695499, ___m_Distance_3)); }
inline float get_m_Distance_3() const { return ___m_Distance_3; }
inline float* get_address_of_m_Distance_3() { return &___m_Distance_3; }
inline void set_m_Distance_3(float value)
{
___m_Distance_3 = value;
}
inline static int32_t get_offset_of_m_Fraction_4() { return static_cast<int32_t>(offsetof(RaycastHit2D_t3236695499, ___m_Fraction_4)); }
inline float get_m_Fraction_4() const { return ___m_Fraction_4; }
inline float* get_address_of_m_Fraction_4() { return &___m_Fraction_4; }
inline void set_m_Fraction_4(float value)
{
___m_Fraction_4 = value;
}
inline static int32_t get_offset_of_m_Collider_5() { return static_cast<int32_t>(offsetof(RaycastHit2D_t3236695499, ___m_Collider_5)); }
inline Collider2D_t2180151806 * get_m_Collider_5() const { return ___m_Collider_5; }
inline Collider2D_t2180151806 ** get_address_of_m_Collider_5() { return &___m_Collider_5; }
inline void set_m_Collider_5(Collider2D_t2180151806 * value)
{
___m_Collider_5 = value;
Il2CppCodeGenWriteBarrier((&___m_Collider_5), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.RaycastHit2D
struct RaycastHit2D_t3236695499_marshaled_pinvoke
{
Vector2_t3854014517 ___m_Centroid_0;
Vector2_t3854014517 ___m_Point_1;
Vector2_t3854014517 ___m_Normal_2;
float ___m_Distance_3;
float ___m_Fraction_4;
Collider2D_t2180151806 * ___m_Collider_5;
};
// Native definition for COM marshalling of UnityEngine.RaycastHit2D
struct RaycastHit2D_t3236695499_marshaled_com
{
Vector2_t3854014517 ___m_Centroid_0;
Vector2_t3854014517 ___m_Point_1;
Vector2_t3854014517 ___m_Normal_2;
float ___m_Distance_3;
float ___m_Fraction_4;
Collider2D_t2180151806 * ___m_Collider_5;
};
#endif // RAYCASTHIT2D_T3236695499_H
#ifndef DELEGATE_T2669736448_H
#define DELEGATE_T2669736448_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Delegate
struct Delegate_t2669736448 : 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::method_code
IntPtr_t ___method_code_5;
// System.Reflection.MethodInfo System.Delegate::method_info
MethodInfo_t * ___method_info_6;
// System.Reflection.MethodInfo System.Delegate::original_method_info
MethodInfo_t * ___original_method_info_7;
// System.DelegateData System.Delegate::data
DelegateData_t3352901259 * ___data_8;
public:
inline static int32_t get_offset_of_method_ptr_0() { return static_cast<int32_t>(offsetof(Delegate_t2669736448, ___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_t2669736448, ___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_t2669736448, ___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_t2669736448, ___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_t2669736448, ___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_method_code_5() { return static_cast<int32_t>(offsetof(Delegate_t2669736448, ___method_code_5)); }
inline IntPtr_t get_method_code_5() const { return ___method_code_5; }
inline IntPtr_t* get_address_of_method_code_5() { return &___method_code_5; }
inline void set_method_code_5(IntPtr_t value)
{
___method_code_5 = value;
}
inline static int32_t get_offset_of_method_info_6() { return static_cast<int32_t>(offsetof(Delegate_t2669736448, ___method_info_6)); }
inline MethodInfo_t * get_method_info_6() const { return ___method_info_6; }
inline MethodInfo_t ** get_address_of_method_info_6() { return &___method_info_6; }
inline void set_method_info_6(MethodInfo_t * value)
{
___method_info_6 = value;
Il2CppCodeGenWriteBarrier((&___method_info_6), value);
}
inline static int32_t get_offset_of_original_method_info_7() { return static_cast<int32_t>(offsetof(Delegate_t2669736448, ___original_method_info_7)); }
inline MethodInfo_t * get_original_method_info_7() const { return ___original_method_info_7; }
inline MethodInfo_t ** get_address_of_original_method_info_7() { return &___original_method_info_7; }
inline void set_original_method_info_7(MethodInfo_t * value)
{
___original_method_info_7 = value;
Il2CppCodeGenWriteBarrier((&___original_method_info_7), value);
}
inline static int32_t get_offset_of_data_8() { return static_cast<int32_t>(offsetof(Delegate_t2669736448, ___data_8)); }
inline DelegateData_t3352901259 * get_data_8() const { return ___data_8; }
inline DelegateData_t3352901259 ** get_address_of_data_8() { return &___data_8; }
inline void set_data_8(DelegateData_t3352901259 * value)
{
___data_8 = value;
Il2CppCodeGenWriteBarrier((&___data_8), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DELEGATE_T2669736448_H
#ifndef AXIS_T2635272803_H
#define AXIS_T2635272803_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Scrollbar/Axis
struct Axis_t2635272803
{
public:
// System.Int32 UnityEngine.UI.Scrollbar/Axis::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Axis_t2635272803, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AXIS_T2635272803_H
#ifndef DIRECTION_T929465853_H
#define DIRECTION_T929465853_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Scrollbar/Direction
struct Direction_t929465853
{
public:
// System.Int32 UnityEngine.UI.Scrollbar/Direction::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(Direction_t929465853, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DIRECTION_T929465853_H
#ifndef MATENTRY_T1755173256_H
#define MATENTRY_T1755173256_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.StencilMaterial/MatEntry
struct MatEntry_t1755173256 : public RuntimeObject
{
public:
// UnityEngine.Material UnityEngine.UI.StencilMaterial/MatEntry::baseMat
Material_t3939796247 * ___baseMat_0;
// UnityEngine.Material UnityEngine.UI.StencilMaterial/MatEntry::customMat
Material_t3939796247 * ___customMat_1;
// System.Int32 UnityEngine.UI.StencilMaterial/MatEntry::count
int32_t ___count_2;
// System.Int32 UnityEngine.UI.StencilMaterial/MatEntry::stencilId
int32_t ___stencilId_3;
// UnityEngine.Rendering.StencilOp UnityEngine.UI.StencilMaterial/MatEntry::operation
int32_t ___operation_4;
// UnityEngine.Rendering.CompareFunction UnityEngine.UI.StencilMaterial/MatEntry::compareFunction
int32_t ___compareFunction_5;
// System.Int32 UnityEngine.UI.StencilMaterial/MatEntry::readMask
int32_t ___readMask_6;
// System.Int32 UnityEngine.UI.StencilMaterial/MatEntry::writeMask
int32_t ___writeMask_7;
// System.Boolean UnityEngine.UI.StencilMaterial/MatEntry::useAlphaClip
bool ___useAlphaClip_8;
// UnityEngine.Rendering.ColorWriteMask UnityEngine.UI.StencilMaterial/MatEntry::colorMask
int32_t ___colorMask_9;
public:
inline static int32_t get_offset_of_baseMat_0() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___baseMat_0)); }
inline Material_t3939796247 * get_baseMat_0() const { return ___baseMat_0; }
inline Material_t3939796247 ** get_address_of_baseMat_0() { return &___baseMat_0; }
inline void set_baseMat_0(Material_t3939796247 * value)
{
___baseMat_0 = value;
Il2CppCodeGenWriteBarrier((&___baseMat_0), value);
}
inline static int32_t get_offset_of_customMat_1() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___customMat_1)); }
inline Material_t3939796247 * get_customMat_1() const { return ___customMat_1; }
inline Material_t3939796247 ** get_address_of_customMat_1() { return &___customMat_1; }
inline void set_customMat_1(Material_t3939796247 * value)
{
___customMat_1 = value;
Il2CppCodeGenWriteBarrier((&___customMat_1), value);
}
inline static int32_t get_offset_of_count_2() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___count_2)); }
inline int32_t get_count_2() const { return ___count_2; }
inline int32_t* get_address_of_count_2() { return &___count_2; }
inline void set_count_2(int32_t value)
{
___count_2 = value;
}
inline static int32_t get_offset_of_stencilId_3() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___stencilId_3)); }
inline int32_t get_stencilId_3() const { return ___stencilId_3; }
inline int32_t* get_address_of_stencilId_3() { return &___stencilId_3; }
inline void set_stencilId_3(int32_t value)
{
___stencilId_3 = value;
}
inline static int32_t get_offset_of_operation_4() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___operation_4)); }
inline int32_t get_operation_4() const { return ___operation_4; }
inline int32_t* get_address_of_operation_4() { return &___operation_4; }
inline void set_operation_4(int32_t value)
{
___operation_4 = value;
}
inline static int32_t get_offset_of_compareFunction_5() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___compareFunction_5)); }
inline int32_t get_compareFunction_5() const { return ___compareFunction_5; }
inline int32_t* get_address_of_compareFunction_5() { return &___compareFunction_5; }
inline void set_compareFunction_5(int32_t value)
{
___compareFunction_5 = value;
}
inline static int32_t get_offset_of_readMask_6() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___readMask_6)); }
inline int32_t get_readMask_6() const { return ___readMask_6; }
inline int32_t* get_address_of_readMask_6() { return &___readMask_6; }
inline void set_readMask_6(int32_t value)
{
___readMask_6 = value;
}
inline static int32_t get_offset_of_writeMask_7() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___writeMask_7)); }
inline int32_t get_writeMask_7() const { return ___writeMask_7; }
inline int32_t* get_address_of_writeMask_7() { return &___writeMask_7; }
inline void set_writeMask_7(int32_t value)
{
___writeMask_7 = value;
}
inline static int32_t get_offset_of_useAlphaClip_8() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___useAlphaClip_8)); }
inline bool get_useAlphaClip_8() const { return ___useAlphaClip_8; }
inline bool* get_address_of_useAlphaClip_8() { return &___useAlphaClip_8; }
inline void set_useAlphaClip_8(bool value)
{
___useAlphaClip_8 = value;
}
inline static int32_t get_offset_of_colorMask_9() { return static_cast<int32_t>(offsetof(MatEntry_t1755173256, ___colorMask_9)); }
inline int32_t get_colorMask_9() const { return ___colorMask_9; }
inline int32_t* get_address_of_colorMask_9() { return &___colorMask_9; }
inline void set_colorMask_9(int32_t value)
{
___colorMask_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MATENTRY_T1755173256_H
#ifndef NAVIGATION_T1087547695_H
#define NAVIGATION_T1087547695_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Navigation
struct Navigation_t1087547695
{
public:
// UnityEngine.UI.Navigation/Mode UnityEngine.UI.Navigation::m_Mode
int32_t ___m_Mode_0;
// UnityEngine.UI.Selectable UnityEngine.UI.Navigation::m_SelectOnUp
Selectable_t3916939825 * ___m_SelectOnUp_1;
// UnityEngine.UI.Selectable UnityEngine.UI.Navigation::m_SelectOnDown
Selectable_t3916939825 * ___m_SelectOnDown_2;
// UnityEngine.UI.Selectable UnityEngine.UI.Navigation::m_SelectOnLeft
Selectable_t3916939825 * ___m_SelectOnLeft_3;
// UnityEngine.UI.Selectable UnityEngine.UI.Navigation::m_SelectOnRight
Selectable_t3916939825 * ___m_SelectOnRight_4;
public:
inline static int32_t get_offset_of_m_Mode_0() { return static_cast<int32_t>(offsetof(Navigation_t1087547695, ___m_Mode_0)); }
inline int32_t get_m_Mode_0() const { return ___m_Mode_0; }
inline int32_t* get_address_of_m_Mode_0() { return &___m_Mode_0; }
inline void set_m_Mode_0(int32_t value)
{
___m_Mode_0 = value;
}
inline static int32_t get_offset_of_m_SelectOnUp_1() { return static_cast<int32_t>(offsetof(Navigation_t1087547695, ___m_SelectOnUp_1)); }
inline Selectable_t3916939825 * get_m_SelectOnUp_1() const { return ___m_SelectOnUp_1; }
inline Selectable_t3916939825 ** get_address_of_m_SelectOnUp_1() { return &___m_SelectOnUp_1; }
inline void set_m_SelectOnUp_1(Selectable_t3916939825 * value)
{
___m_SelectOnUp_1 = value;
Il2CppCodeGenWriteBarrier((&___m_SelectOnUp_1), value);
}
inline static int32_t get_offset_of_m_SelectOnDown_2() { return static_cast<int32_t>(offsetof(Navigation_t1087547695, ___m_SelectOnDown_2)); }
inline Selectable_t3916939825 * get_m_SelectOnDown_2() const { return ___m_SelectOnDown_2; }
inline Selectable_t3916939825 ** get_address_of_m_SelectOnDown_2() { return &___m_SelectOnDown_2; }
inline void set_m_SelectOnDown_2(Selectable_t3916939825 * value)
{
___m_SelectOnDown_2 = value;
Il2CppCodeGenWriteBarrier((&___m_SelectOnDown_2), value);
}
inline static int32_t get_offset_of_m_SelectOnLeft_3() { return static_cast<int32_t>(offsetof(Navigation_t1087547695, ___m_SelectOnLeft_3)); }
inline Selectable_t3916939825 * get_m_SelectOnLeft_3() const { return ___m_SelectOnLeft_3; }
inline Selectable_t3916939825 ** get_address_of_m_SelectOnLeft_3() { return &___m_SelectOnLeft_3; }
inline void set_m_SelectOnLeft_3(Selectable_t3916939825 * value)
{
___m_SelectOnLeft_3 = value;
Il2CppCodeGenWriteBarrier((&___m_SelectOnLeft_3), value);
}
inline static int32_t get_offset_of_m_SelectOnRight_4() { return static_cast<int32_t>(offsetof(Navigation_t1087547695, ___m_SelectOnRight_4)); }
inline Selectable_t3916939825 * get_m_SelectOnRight_4() const { return ___m_SelectOnRight_4; }
inline Selectable_t3916939825 ** get_address_of_m_SelectOnRight_4() { return &___m_SelectOnRight_4; }
inline void set_m_SelectOnRight_4(Selectable_t3916939825 * value)
{
___m_SelectOnRight_4 = value;
Il2CppCodeGenWriteBarrier((&___m_SelectOnRight_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.UI.Navigation
struct Navigation_t1087547695_marshaled_pinvoke
{
int32_t ___m_Mode_0;
Selectable_t3916939825 * ___m_SelectOnUp_1;
Selectable_t3916939825 * ___m_SelectOnDown_2;
Selectable_t3916939825 * ___m_SelectOnLeft_3;
Selectable_t3916939825 * ___m_SelectOnRight_4;
};
// Native definition for COM marshalling of UnityEngine.UI.Navigation
struct Navigation_t1087547695_marshaled_com
{
int32_t ___m_Mode_0;
Selectable_t3916939825 * ___m_SelectOnUp_1;
Selectable_t3916939825 * ___m_SelectOnDown_2;
Selectable_t3916939825 * ___m_SelectOnLeft_3;
Selectable_t3916939825 * ___m_SelectOnRight_4;
};
#endif // NAVIGATION_T1087547695_H
#ifndef COMPONENT_T590567089_H
#define COMPONENT_T590567089_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Component
struct Component_t590567089 : public Object_t1332387349
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COMPONENT_T590567089_H
#ifndef MULTICASTDELEGATE_T929297072_H
#define MULTICASTDELEGATE_T929297072_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.MulticastDelegate
struct MulticastDelegate_t929297072 : public Delegate_t2669736448
{
public:
// System.MulticastDelegate System.MulticastDelegate::prev
MulticastDelegate_t929297072 * ___prev_9;
// System.MulticastDelegate System.MulticastDelegate::kpm_next
MulticastDelegate_t929297072 * ___kpm_next_10;
public:
inline static int32_t get_offset_of_prev_9() { return static_cast<int32_t>(offsetof(MulticastDelegate_t929297072, ___prev_9)); }
inline MulticastDelegate_t929297072 * get_prev_9() const { return ___prev_9; }
inline MulticastDelegate_t929297072 ** get_address_of_prev_9() { return &___prev_9; }
inline void set_prev_9(MulticastDelegate_t929297072 * value)
{
___prev_9 = value;
Il2CppCodeGenWriteBarrier((&___prev_9), value);
}
inline static int32_t get_offset_of_kpm_next_10() { return static_cast<int32_t>(offsetof(MulticastDelegate_t929297072, ___kpm_next_10)); }
inline MulticastDelegate_t929297072 * get_kpm_next_10() const { return ___kpm_next_10; }
inline MulticastDelegate_t929297072 ** get_address_of_kpm_next_10() { return &___kpm_next_10; }
inline void set_kpm_next_10(MulticastDelegate_t929297072 * value)
{
___kpm_next_10 = value;
Il2CppCodeGenWriteBarrier((&___kpm_next_10), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MULTICASTDELEGATE_T929297072_H
#ifndef BEHAVIOUR_T2439740933_H
#define BEHAVIOUR_T2439740933_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Behaviour
struct Behaviour_t2439740933 : public Component_t590567089
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BEHAVIOUR_T2439740933_H
#ifndef RAYCASTALLCALLBACK_T1653149632_H
#define RAYCASTALLCALLBACK_T1653149632_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ReflectionMethodsCache/RaycastAllCallback
struct RaycastAllCallback_t1653149632 : public MulticastDelegate_t929297072
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RAYCASTALLCALLBACK_T1653149632_H
#ifndef ONVALIDATEINPUT_T977755270_H
#define ONVALIDATEINPUT_T977755270_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField/OnValidateInput
struct OnValidateInput_t977755270 : public MulticastDelegate_t929297072
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ONVALIDATEINPUT_T977755270_H
#ifndef RAYCAST3DCALLBACK_T3731579633_H
#define RAYCAST3DCALLBACK_T3731579633_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ReflectionMethodsCache/Raycast3DCallback
struct Raycast3DCallback_t3731579633 : public MulticastDelegate_t929297072
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RAYCAST3DCALLBACK_T3731579633_H
#ifndef GETRAYINTERSECTIONALLCALLBACK_T3143667439_H
#define GETRAYINTERSECTIONALLCALLBACK_T3143667439_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ReflectionMethodsCache/GetRayIntersectionAllCallback
struct GetRayIntersectionAllCallback_t3143667439 : public MulticastDelegate_t929297072
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GETRAYINTERSECTIONALLCALLBACK_T3143667439_H
#ifndef RAYCAST2DCALLBACK_T890783784_H
#define RAYCAST2DCALLBACK_T890783784_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ReflectionMethodsCache/Raycast2DCallback
struct Raycast2DCallback_t890783784 : public MulticastDelegate_t929297072
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RAYCAST2DCALLBACK_T890783784_H
#ifndef MONOBEHAVIOUR_T4157868977_H
#define MONOBEHAVIOUR_T4157868977_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.MonoBehaviour
struct MonoBehaviour_t4157868977 : public Behaviour_t2439740933
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MONOBEHAVIOUR_T4157868977_H
#ifndef UIBEHAVIOUR_T1413405078_H
#define UIBEHAVIOUR_T1413405078_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_t1413405078 : public MonoBehaviour_t4157868977
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // UIBEHAVIOUR_T1413405078_H
#ifndef CANVASSCALER_T1970195371_H
#define CANVASSCALER_T1970195371_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.CanvasScaler
struct CanvasScaler_t1970195371 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.UI.CanvasScaler/ScaleMode UnityEngine.UI.CanvasScaler::m_UiScaleMode
int32_t ___m_UiScaleMode_2;
// System.Single UnityEngine.UI.CanvasScaler::m_ReferencePixelsPerUnit
float ___m_ReferencePixelsPerUnit_3;
// System.Single UnityEngine.UI.CanvasScaler::m_ScaleFactor
float ___m_ScaleFactor_4;
// UnityEngine.Vector2 UnityEngine.UI.CanvasScaler::m_ReferenceResolution
Vector2_t3854014517 ___m_ReferenceResolution_5;
// UnityEngine.UI.CanvasScaler/ScreenMatchMode UnityEngine.UI.CanvasScaler::m_ScreenMatchMode
int32_t ___m_ScreenMatchMode_6;
// System.Single UnityEngine.UI.CanvasScaler::m_MatchWidthOrHeight
float ___m_MatchWidthOrHeight_7;
// UnityEngine.UI.CanvasScaler/Unit UnityEngine.UI.CanvasScaler::m_PhysicalUnit
int32_t ___m_PhysicalUnit_9;
// System.Single UnityEngine.UI.CanvasScaler::m_FallbackScreenDPI
float ___m_FallbackScreenDPI_10;
// System.Single UnityEngine.UI.CanvasScaler::m_DefaultSpriteDPI
float ___m_DefaultSpriteDPI_11;
// System.Single UnityEngine.UI.CanvasScaler::m_DynamicPixelsPerUnit
float ___m_DynamicPixelsPerUnit_12;
// UnityEngine.Canvas UnityEngine.UI.CanvasScaler::m_Canvas
Canvas_t2948613984 * ___m_Canvas_13;
// System.Single UnityEngine.UI.CanvasScaler::m_PrevScaleFactor
float ___m_PrevScaleFactor_14;
// System.Single UnityEngine.UI.CanvasScaler::m_PrevReferencePixelsPerUnit
float ___m_PrevReferencePixelsPerUnit_15;
public:
inline static int32_t get_offset_of_m_UiScaleMode_2() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_UiScaleMode_2)); }
inline int32_t get_m_UiScaleMode_2() const { return ___m_UiScaleMode_2; }
inline int32_t* get_address_of_m_UiScaleMode_2() { return &___m_UiScaleMode_2; }
inline void set_m_UiScaleMode_2(int32_t value)
{
___m_UiScaleMode_2 = value;
}
inline static int32_t get_offset_of_m_ReferencePixelsPerUnit_3() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_ReferencePixelsPerUnit_3)); }
inline float get_m_ReferencePixelsPerUnit_3() const { return ___m_ReferencePixelsPerUnit_3; }
inline float* get_address_of_m_ReferencePixelsPerUnit_3() { return &___m_ReferencePixelsPerUnit_3; }
inline void set_m_ReferencePixelsPerUnit_3(float value)
{
___m_ReferencePixelsPerUnit_3 = value;
}
inline static int32_t get_offset_of_m_ScaleFactor_4() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_ScaleFactor_4)); }
inline float get_m_ScaleFactor_4() const { return ___m_ScaleFactor_4; }
inline float* get_address_of_m_ScaleFactor_4() { return &___m_ScaleFactor_4; }
inline void set_m_ScaleFactor_4(float value)
{
___m_ScaleFactor_4 = value;
}
inline static int32_t get_offset_of_m_ReferenceResolution_5() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_ReferenceResolution_5)); }
inline Vector2_t3854014517 get_m_ReferenceResolution_5() const { return ___m_ReferenceResolution_5; }
inline Vector2_t3854014517 * get_address_of_m_ReferenceResolution_5() { return &___m_ReferenceResolution_5; }
inline void set_m_ReferenceResolution_5(Vector2_t3854014517 value)
{
___m_ReferenceResolution_5 = value;
}
inline static int32_t get_offset_of_m_ScreenMatchMode_6() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_ScreenMatchMode_6)); }
inline int32_t get_m_ScreenMatchMode_6() const { return ___m_ScreenMatchMode_6; }
inline int32_t* get_address_of_m_ScreenMatchMode_6() { return &___m_ScreenMatchMode_6; }
inline void set_m_ScreenMatchMode_6(int32_t value)
{
___m_ScreenMatchMode_6 = value;
}
inline static int32_t get_offset_of_m_MatchWidthOrHeight_7() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_MatchWidthOrHeight_7)); }
inline float get_m_MatchWidthOrHeight_7() const { return ___m_MatchWidthOrHeight_7; }
inline float* get_address_of_m_MatchWidthOrHeight_7() { return &___m_MatchWidthOrHeight_7; }
inline void set_m_MatchWidthOrHeight_7(float value)
{
___m_MatchWidthOrHeight_7 = value;
}
inline static int32_t get_offset_of_m_PhysicalUnit_9() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_PhysicalUnit_9)); }
inline int32_t get_m_PhysicalUnit_9() const { return ___m_PhysicalUnit_9; }
inline int32_t* get_address_of_m_PhysicalUnit_9() { return &___m_PhysicalUnit_9; }
inline void set_m_PhysicalUnit_9(int32_t value)
{
___m_PhysicalUnit_9 = value;
}
inline static int32_t get_offset_of_m_FallbackScreenDPI_10() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_FallbackScreenDPI_10)); }
inline float get_m_FallbackScreenDPI_10() const { return ___m_FallbackScreenDPI_10; }
inline float* get_address_of_m_FallbackScreenDPI_10() { return &___m_FallbackScreenDPI_10; }
inline void set_m_FallbackScreenDPI_10(float value)
{
___m_FallbackScreenDPI_10 = value;
}
inline static int32_t get_offset_of_m_DefaultSpriteDPI_11() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_DefaultSpriteDPI_11)); }
inline float get_m_DefaultSpriteDPI_11() const { return ___m_DefaultSpriteDPI_11; }
inline float* get_address_of_m_DefaultSpriteDPI_11() { return &___m_DefaultSpriteDPI_11; }
inline void set_m_DefaultSpriteDPI_11(float value)
{
___m_DefaultSpriteDPI_11 = value;
}
inline static int32_t get_offset_of_m_DynamicPixelsPerUnit_12() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_DynamicPixelsPerUnit_12)); }
inline float get_m_DynamicPixelsPerUnit_12() const { return ___m_DynamicPixelsPerUnit_12; }
inline float* get_address_of_m_DynamicPixelsPerUnit_12() { return &___m_DynamicPixelsPerUnit_12; }
inline void set_m_DynamicPixelsPerUnit_12(float value)
{
___m_DynamicPixelsPerUnit_12 = value;
}
inline static int32_t get_offset_of_m_Canvas_13() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_Canvas_13)); }
inline Canvas_t2948613984 * get_m_Canvas_13() const { return ___m_Canvas_13; }
inline Canvas_t2948613984 ** get_address_of_m_Canvas_13() { return &___m_Canvas_13; }
inline void set_m_Canvas_13(Canvas_t2948613984 * value)
{
___m_Canvas_13 = value;
Il2CppCodeGenWriteBarrier((&___m_Canvas_13), value);
}
inline static int32_t get_offset_of_m_PrevScaleFactor_14() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_PrevScaleFactor_14)); }
inline float get_m_PrevScaleFactor_14() const { return ___m_PrevScaleFactor_14; }
inline float* get_address_of_m_PrevScaleFactor_14() { return &___m_PrevScaleFactor_14; }
inline void set_m_PrevScaleFactor_14(float value)
{
___m_PrevScaleFactor_14 = value;
}
inline static int32_t get_offset_of_m_PrevReferencePixelsPerUnit_15() { return static_cast<int32_t>(offsetof(CanvasScaler_t1970195371, ___m_PrevReferencePixelsPerUnit_15)); }
inline float get_m_PrevReferencePixelsPerUnit_15() const { return ___m_PrevReferencePixelsPerUnit_15; }
inline float* get_address_of_m_PrevReferencePixelsPerUnit_15() { return &___m_PrevReferencePixelsPerUnit_15; }
inline void set_m_PrevReferencePixelsPerUnit_15(float value)
{
___m_PrevReferencePixelsPerUnit_15 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CANVASSCALER_T1970195371_H
#ifndef BASERAYCASTER_T2446964997_H
#define BASERAYCASTER_T2446964997_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.EventSystems.BaseRaycaster
struct BaseRaycaster_t2446964997 : public UIBehaviour_t1413405078
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BASERAYCASTER_T2446964997_H
#ifndef LAYOUTGROUP_T3642062901_H
#define LAYOUTGROUP_T3642062901_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.LayoutGroup
struct LayoutGroup_t3642062901 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.RectOffset UnityEngine.UI.LayoutGroup::m_Padding
RectOffset_t3582970358 * ___m_Padding_2;
// UnityEngine.TextAnchor UnityEngine.UI.LayoutGroup::m_ChildAlignment
int32_t ___m_ChildAlignment_3;
// UnityEngine.RectTransform UnityEngine.UI.LayoutGroup::m_Rect
RectTransform_t3700156813 * ___m_Rect_4;
// UnityEngine.DrivenRectTransformTracker UnityEngine.UI.LayoutGroup::m_Tracker
DrivenRectTransformTracker_t2435175526 ___m_Tracker_5;
// UnityEngine.Vector2 UnityEngine.UI.LayoutGroup::m_TotalMinSize
Vector2_t3854014517 ___m_TotalMinSize_6;
// UnityEngine.Vector2 UnityEngine.UI.LayoutGroup::m_TotalPreferredSize
Vector2_t3854014517 ___m_TotalPreferredSize_7;
// UnityEngine.Vector2 UnityEngine.UI.LayoutGroup::m_TotalFlexibleSize
Vector2_t3854014517 ___m_TotalFlexibleSize_8;
// System.Collections.Generic.List`1<UnityEngine.RectTransform> UnityEngine.UI.LayoutGroup::m_RectChildren
List_1_t2923042653 * ___m_RectChildren_9;
public:
inline static int32_t get_offset_of_m_Padding_2() { return static_cast<int32_t>(offsetof(LayoutGroup_t3642062901, ___m_Padding_2)); }
inline RectOffset_t3582970358 * get_m_Padding_2() const { return ___m_Padding_2; }
inline RectOffset_t3582970358 ** get_address_of_m_Padding_2() { return &___m_Padding_2; }
inline void set_m_Padding_2(RectOffset_t3582970358 * value)
{
___m_Padding_2 = value;
Il2CppCodeGenWriteBarrier((&___m_Padding_2), value);
}
inline static int32_t get_offset_of_m_ChildAlignment_3() { return static_cast<int32_t>(offsetof(LayoutGroup_t3642062901, ___m_ChildAlignment_3)); }
inline int32_t get_m_ChildAlignment_3() const { return ___m_ChildAlignment_3; }
inline int32_t* get_address_of_m_ChildAlignment_3() { return &___m_ChildAlignment_3; }
inline void set_m_ChildAlignment_3(int32_t value)
{
___m_ChildAlignment_3 = value;
}
inline static int32_t get_offset_of_m_Rect_4() { return static_cast<int32_t>(offsetof(LayoutGroup_t3642062901, ___m_Rect_4)); }
inline RectTransform_t3700156813 * get_m_Rect_4() const { return ___m_Rect_4; }
inline RectTransform_t3700156813 ** get_address_of_m_Rect_4() { return &___m_Rect_4; }
inline void set_m_Rect_4(RectTransform_t3700156813 * value)
{
___m_Rect_4 = value;
Il2CppCodeGenWriteBarrier((&___m_Rect_4), value);
}
inline static int32_t get_offset_of_m_Tracker_5() { return static_cast<int32_t>(offsetof(LayoutGroup_t3642062901, ___m_Tracker_5)); }
inline DrivenRectTransformTracker_t2435175526 get_m_Tracker_5() const { return ___m_Tracker_5; }
inline DrivenRectTransformTracker_t2435175526 * get_address_of_m_Tracker_5() { return &___m_Tracker_5; }
inline void set_m_Tracker_5(DrivenRectTransformTracker_t2435175526 value)
{
___m_Tracker_5 = value;
}
inline static int32_t get_offset_of_m_TotalMinSize_6() { return static_cast<int32_t>(offsetof(LayoutGroup_t3642062901, ___m_TotalMinSize_6)); }
inline Vector2_t3854014517 get_m_TotalMinSize_6() const { return ___m_TotalMinSize_6; }
inline Vector2_t3854014517 * get_address_of_m_TotalMinSize_6() { return &___m_TotalMinSize_6; }
inline void set_m_TotalMinSize_6(Vector2_t3854014517 value)
{
___m_TotalMinSize_6 = value;
}
inline static int32_t get_offset_of_m_TotalPreferredSize_7() { return static_cast<int32_t>(offsetof(LayoutGroup_t3642062901, ___m_TotalPreferredSize_7)); }
inline Vector2_t3854014517 get_m_TotalPreferredSize_7() const { return ___m_TotalPreferredSize_7; }
inline Vector2_t3854014517 * get_address_of_m_TotalPreferredSize_7() { return &___m_TotalPreferredSize_7; }
inline void set_m_TotalPreferredSize_7(Vector2_t3854014517 value)
{
___m_TotalPreferredSize_7 = value;
}
inline static int32_t get_offset_of_m_TotalFlexibleSize_8() { return static_cast<int32_t>(offsetof(LayoutGroup_t3642062901, ___m_TotalFlexibleSize_8)); }
inline Vector2_t3854014517 get_m_TotalFlexibleSize_8() const { return ___m_TotalFlexibleSize_8; }
inline Vector2_t3854014517 * get_address_of_m_TotalFlexibleSize_8() { return &___m_TotalFlexibleSize_8; }
inline void set_m_TotalFlexibleSize_8(Vector2_t3854014517 value)
{
___m_TotalFlexibleSize_8 = value;
}
inline static int32_t get_offset_of_m_RectChildren_9() { return static_cast<int32_t>(offsetof(LayoutGroup_t3642062901, ___m_RectChildren_9)); }
inline List_1_t2923042653 * get_m_RectChildren_9() const { return ___m_RectChildren_9; }
inline List_1_t2923042653 ** get_address_of_m_RectChildren_9() { return &___m_RectChildren_9; }
inline void set_m_RectChildren_9(List_1_t2923042653 * value)
{
___m_RectChildren_9 = value;
Il2CppCodeGenWriteBarrier((&___m_RectChildren_9), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LAYOUTGROUP_T3642062901_H
#ifndef LAYOUTELEMENT_T305886837_H
#define LAYOUTELEMENT_T305886837_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.LayoutElement
struct LayoutElement_t305886837 : public UIBehaviour_t1413405078
{
public:
// System.Boolean UnityEngine.UI.LayoutElement::m_IgnoreLayout
bool ___m_IgnoreLayout_2;
// System.Single UnityEngine.UI.LayoutElement::m_MinWidth
float ___m_MinWidth_3;
// System.Single UnityEngine.UI.LayoutElement::m_MinHeight
float ___m_MinHeight_4;
// System.Single UnityEngine.UI.LayoutElement::m_PreferredWidth
float ___m_PreferredWidth_5;
// System.Single UnityEngine.UI.LayoutElement::m_PreferredHeight
float ___m_PreferredHeight_6;
// System.Single UnityEngine.UI.LayoutElement::m_FlexibleWidth
float ___m_FlexibleWidth_7;
// System.Single UnityEngine.UI.LayoutElement::m_FlexibleHeight
float ___m_FlexibleHeight_8;
// System.Int32 UnityEngine.UI.LayoutElement::m_LayoutPriority
int32_t ___m_LayoutPriority_9;
public:
inline static int32_t get_offset_of_m_IgnoreLayout_2() { return static_cast<int32_t>(offsetof(LayoutElement_t305886837, ___m_IgnoreLayout_2)); }
inline bool get_m_IgnoreLayout_2() const { return ___m_IgnoreLayout_2; }
inline bool* get_address_of_m_IgnoreLayout_2() { return &___m_IgnoreLayout_2; }
inline void set_m_IgnoreLayout_2(bool value)
{
___m_IgnoreLayout_2 = value;
}
inline static int32_t get_offset_of_m_MinWidth_3() { return static_cast<int32_t>(offsetof(LayoutElement_t305886837, ___m_MinWidth_3)); }
inline float get_m_MinWidth_3() const { return ___m_MinWidth_3; }
inline float* get_address_of_m_MinWidth_3() { return &___m_MinWidth_3; }
inline void set_m_MinWidth_3(float value)
{
___m_MinWidth_3 = value;
}
inline static int32_t get_offset_of_m_MinHeight_4() { return static_cast<int32_t>(offsetof(LayoutElement_t305886837, ___m_MinHeight_4)); }
inline float get_m_MinHeight_4() const { return ___m_MinHeight_4; }
inline float* get_address_of_m_MinHeight_4() { return &___m_MinHeight_4; }
inline void set_m_MinHeight_4(float value)
{
___m_MinHeight_4 = value;
}
inline static int32_t get_offset_of_m_PreferredWidth_5() { return static_cast<int32_t>(offsetof(LayoutElement_t305886837, ___m_PreferredWidth_5)); }
inline float get_m_PreferredWidth_5() const { return ___m_PreferredWidth_5; }
inline float* get_address_of_m_PreferredWidth_5() { return &___m_PreferredWidth_5; }
inline void set_m_PreferredWidth_5(float value)
{
___m_PreferredWidth_5 = value;
}
inline static int32_t get_offset_of_m_PreferredHeight_6() { return static_cast<int32_t>(offsetof(LayoutElement_t305886837, ___m_PreferredHeight_6)); }
inline float get_m_PreferredHeight_6() const { return ___m_PreferredHeight_6; }
inline float* get_address_of_m_PreferredHeight_6() { return &___m_PreferredHeight_6; }
inline void set_m_PreferredHeight_6(float value)
{
___m_PreferredHeight_6 = value;
}
inline static int32_t get_offset_of_m_FlexibleWidth_7() { return static_cast<int32_t>(offsetof(LayoutElement_t305886837, ___m_FlexibleWidth_7)); }
inline float get_m_FlexibleWidth_7() const { return ___m_FlexibleWidth_7; }
inline float* get_address_of_m_FlexibleWidth_7() { return &___m_FlexibleWidth_7; }
inline void set_m_FlexibleWidth_7(float value)
{
___m_FlexibleWidth_7 = value;
}
inline static int32_t get_offset_of_m_FlexibleHeight_8() { return static_cast<int32_t>(offsetof(LayoutElement_t305886837, ___m_FlexibleHeight_8)); }
inline float get_m_FlexibleHeight_8() const { return ___m_FlexibleHeight_8; }
inline float* get_address_of_m_FlexibleHeight_8() { return &___m_FlexibleHeight_8; }
inline void set_m_FlexibleHeight_8(float value)
{
___m_FlexibleHeight_8 = value;
}
inline static int32_t get_offset_of_m_LayoutPriority_9() { return static_cast<int32_t>(offsetof(LayoutElement_t305886837, ___m_LayoutPriority_9)); }
inline int32_t get_m_LayoutPriority_9() const { return ___m_LayoutPriority_9; }
inline int32_t* get_address_of_m_LayoutPriority_9() { return &___m_LayoutPriority_9; }
inline void set_m_LayoutPriority_9(int32_t value)
{
___m_LayoutPriority_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LAYOUTELEMENT_T305886837_H
#ifndef MASK_T3699985323_H
#define MASK_T3699985323_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Mask
struct Mask_t3699985323 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.RectTransform UnityEngine.UI.Mask::m_RectTransform
RectTransform_t3700156813 * ___m_RectTransform_2;
// System.Boolean UnityEngine.UI.Mask::m_ShowMaskGraphic
bool ___m_ShowMaskGraphic_3;
// UnityEngine.UI.Graphic UnityEngine.UI.Mask::m_Graphic
Graphic_t535825046 * ___m_Graphic_4;
// UnityEngine.Material UnityEngine.UI.Mask::m_MaskMaterial
Material_t3939796247 * ___m_MaskMaterial_5;
// UnityEngine.Material UnityEngine.UI.Mask::m_UnmaskMaterial
Material_t3939796247 * ___m_UnmaskMaterial_6;
public:
inline static int32_t get_offset_of_m_RectTransform_2() { return static_cast<int32_t>(offsetof(Mask_t3699985323, ___m_RectTransform_2)); }
inline RectTransform_t3700156813 * get_m_RectTransform_2() const { return ___m_RectTransform_2; }
inline RectTransform_t3700156813 ** get_address_of_m_RectTransform_2() { return &___m_RectTransform_2; }
inline void set_m_RectTransform_2(RectTransform_t3700156813 * value)
{
___m_RectTransform_2 = value;
Il2CppCodeGenWriteBarrier((&___m_RectTransform_2), value);
}
inline static int32_t get_offset_of_m_ShowMaskGraphic_3() { return static_cast<int32_t>(offsetof(Mask_t3699985323, ___m_ShowMaskGraphic_3)); }
inline bool get_m_ShowMaskGraphic_3() const { return ___m_ShowMaskGraphic_3; }
inline bool* get_address_of_m_ShowMaskGraphic_3() { return &___m_ShowMaskGraphic_3; }
inline void set_m_ShowMaskGraphic_3(bool value)
{
___m_ShowMaskGraphic_3 = value;
}
inline static int32_t get_offset_of_m_Graphic_4() { return static_cast<int32_t>(offsetof(Mask_t3699985323, ___m_Graphic_4)); }
inline Graphic_t535825046 * get_m_Graphic_4() const { return ___m_Graphic_4; }
inline Graphic_t535825046 ** get_address_of_m_Graphic_4() { return &___m_Graphic_4; }
inline void set_m_Graphic_4(Graphic_t535825046 * value)
{
___m_Graphic_4 = value;
Il2CppCodeGenWriteBarrier((&___m_Graphic_4), value);
}
inline static int32_t get_offset_of_m_MaskMaterial_5() { return static_cast<int32_t>(offsetof(Mask_t3699985323, ___m_MaskMaterial_5)); }
inline Material_t3939796247 * get_m_MaskMaterial_5() const { return ___m_MaskMaterial_5; }
inline Material_t3939796247 ** get_address_of_m_MaskMaterial_5() { return &___m_MaskMaterial_5; }
inline void set_m_MaskMaterial_5(Material_t3939796247 * value)
{
___m_MaskMaterial_5 = value;
Il2CppCodeGenWriteBarrier((&___m_MaskMaterial_5), value);
}
inline static int32_t get_offset_of_m_UnmaskMaterial_6() { return static_cast<int32_t>(offsetof(Mask_t3699985323, ___m_UnmaskMaterial_6)); }
inline Material_t3939796247 * get_m_UnmaskMaterial_6() const { return ___m_UnmaskMaterial_6; }
inline Material_t3939796247 ** get_address_of_m_UnmaskMaterial_6() { return &___m_UnmaskMaterial_6; }
inline void set_m_UnmaskMaterial_6(Material_t3939796247 * value)
{
___m_UnmaskMaterial_6 = value;
Il2CppCodeGenWriteBarrier((&___m_UnmaskMaterial_6), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MASK_T3699985323_H
#ifndef RECTMASK2D_T2399484214_H
#define RECTMASK2D_T2399484214_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.RectMask2D
struct RectMask2D_t2399484214 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.UI.RectangularVertexClipper UnityEngine.UI.RectMask2D::m_VertexClipper
RectangularVertexClipper_t3760579564 * ___m_VertexClipper_2;
// UnityEngine.RectTransform UnityEngine.UI.RectMask2D::m_RectTransform
RectTransform_t3700156813 * ___m_RectTransform_3;
// System.Collections.Generic.HashSet`1<UnityEngine.UI.IClippable> UnityEngine.UI.RectMask2D::m_ClipTargets
HashSet_1_t3635898901 * ___m_ClipTargets_4;
// System.Boolean UnityEngine.UI.RectMask2D::m_ShouldRecalculateClipRects
bool ___m_ShouldRecalculateClipRects_5;
// System.Collections.Generic.List`1<UnityEngine.UI.RectMask2D> UnityEngine.UI.RectMask2D::m_Clippers
List_1_t1622370054 * ___m_Clippers_6;
// UnityEngine.Rect UnityEngine.UI.RectMask2D::m_LastClipRectCanvasSpace
Rect_t3345319094 ___m_LastClipRectCanvasSpace_7;
// System.Boolean UnityEngine.UI.RectMask2D::m_LastValidClipRect
bool ___m_LastValidClipRect_8;
// System.Boolean UnityEngine.UI.RectMask2D::m_ForceClip
bool ___m_ForceClip_9;
public:
inline static int32_t get_offset_of_m_VertexClipper_2() { return static_cast<int32_t>(offsetof(RectMask2D_t2399484214, ___m_VertexClipper_2)); }
inline RectangularVertexClipper_t3760579564 * get_m_VertexClipper_2() const { return ___m_VertexClipper_2; }
inline RectangularVertexClipper_t3760579564 ** get_address_of_m_VertexClipper_2() { return &___m_VertexClipper_2; }
inline void set_m_VertexClipper_2(RectangularVertexClipper_t3760579564 * value)
{
___m_VertexClipper_2 = value;
Il2CppCodeGenWriteBarrier((&___m_VertexClipper_2), value);
}
inline static int32_t get_offset_of_m_RectTransform_3() { return static_cast<int32_t>(offsetof(RectMask2D_t2399484214, ___m_RectTransform_3)); }
inline RectTransform_t3700156813 * get_m_RectTransform_3() const { return ___m_RectTransform_3; }
inline RectTransform_t3700156813 ** get_address_of_m_RectTransform_3() { return &___m_RectTransform_3; }
inline void set_m_RectTransform_3(RectTransform_t3700156813 * value)
{
___m_RectTransform_3 = value;
Il2CppCodeGenWriteBarrier((&___m_RectTransform_3), value);
}
inline static int32_t get_offset_of_m_ClipTargets_4() { return static_cast<int32_t>(offsetof(RectMask2D_t2399484214, ___m_ClipTargets_4)); }
inline HashSet_1_t3635898901 * get_m_ClipTargets_4() const { return ___m_ClipTargets_4; }
inline HashSet_1_t3635898901 ** get_address_of_m_ClipTargets_4() { return &___m_ClipTargets_4; }
inline void set_m_ClipTargets_4(HashSet_1_t3635898901 * value)
{
___m_ClipTargets_4 = value;
Il2CppCodeGenWriteBarrier((&___m_ClipTargets_4), value);
}
inline static int32_t get_offset_of_m_ShouldRecalculateClipRects_5() { return static_cast<int32_t>(offsetof(RectMask2D_t2399484214, ___m_ShouldRecalculateClipRects_5)); }
inline bool get_m_ShouldRecalculateClipRects_5() const { return ___m_ShouldRecalculateClipRects_5; }
inline bool* get_address_of_m_ShouldRecalculateClipRects_5() { return &___m_ShouldRecalculateClipRects_5; }
inline void set_m_ShouldRecalculateClipRects_5(bool value)
{
___m_ShouldRecalculateClipRects_5 = value;
}
inline static int32_t get_offset_of_m_Clippers_6() { return static_cast<int32_t>(offsetof(RectMask2D_t2399484214, ___m_Clippers_6)); }
inline List_1_t1622370054 * get_m_Clippers_6() const { return ___m_Clippers_6; }
inline List_1_t1622370054 ** get_address_of_m_Clippers_6() { return &___m_Clippers_6; }
inline void set_m_Clippers_6(List_1_t1622370054 * value)
{
___m_Clippers_6 = value;
Il2CppCodeGenWriteBarrier((&___m_Clippers_6), value);
}
inline static int32_t get_offset_of_m_LastClipRectCanvasSpace_7() { return static_cast<int32_t>(offsetof(RectMask2D_t2399484214, ___m_LastClipRectCanvasSpace_7)); }
inline Rect_t3345319094 get_m_LastClipRectCanvasSpace_7() const { return ___m_LastClipRectCanvasSpace_7; }
inline Rect_t3345319094 * get_address_of_m_LastClipRectCanvasSpace_7() { return &___m_LastClipRectCanvasSpace_7; }
inline void set_m_LastClipRectCanvasSpace_7(Rect_t3345319094 value)
{
___m_LastClipRectCanvasSpace_7 = value;
}
inline static int32_t get_offset_of_m_LastValidClipRect_8() { return static_cast<int32_t>(offsetof(RectMask2D_t2399484214, ___m_LastValidClipRect_8)); }
inline bool get_m_LastValidClipRect_8() const { return ___m_LastValidClipRect_8; }
inline bool* get_address_of_m_LastValidClipRect_8() { return &___m_LastValidClipRect_8; }
inline void set_m_LastValidClipRect_8(bool value)
{
___m_LastValidClipRect_8 = value;
}
inline static int32_t get_offset_of_m_ForceClip_9() { return static_cast<int32_t>(offsetof(RectMask2D_t2399484214, ___m_ForceClip_9)); }
inline bool get_m_ForceClip_9() const { return ___m_ForceClip_9; }
inline bool* get_address_of_m_ForceClip_9() { return &___m_ForceClip_9; }
inline void set_m_ForceClip_9(bool value)
{
___m_ForceClip_9 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RECTMASK2D_T2399484214_H
#ifndef CONTENTSIZEFITTER_T1789893878_H
#define CONTENTSIZEFITTER_T1789893878_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ContentSizeFitter
struct ContentSizeFitter_t1789893878 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.UI.ContentSizeFitter/FitMode UnityEngine.UI.ContentSizeFitter::m_HorizontalFit
int32_t ___m_HorizontalFit_2;
// UnityEngine.UI.ContentSizeFitter/FitMode UnityEngine.UI.ContentSizeFitter::m_VerticalFit
int32_t ___m_VerticalFit_3;
// UnityEngine.RectTransform UnityEngine.UI.ContentSizeFitter::m_Rect
RectTransform_t3700156813 * ___m_Rect_4;
// UnityEngine.DrivenRectTransformTracker UnityEngine.UI.ContentSizeFitter::m_Tracker
DrivenRectTransformTracker_t2435175526 ___m_Tracker_5;
public:
inline static int32_t get_offset_of_m_HorizontalFit_2() { return static_cast<int32_t>(offsetof(ContentSizeFitter_t1789893878, ___m_HorizontalFit_2)); }
inline int32_t get_m_HorizontalFit_2() const { return ___m_HorizontalFit_2; }
inline int32_t* get_address_of_m_HorizontalFit_2() { return &___m_HorizontalFit_2; }
inline void set_m_HorizontalFit_2(int32_t value)
{
___m_HorizontalFit_2 = value;
}
inline static int32_t get_offset_of_m_VerticalFit_3() { return static_cast<int32_t>(offsetof(ContentSizeFitter_t1789893878, ___m_VerticalFit_3)); }
inline int32_t get_m_VerticalFit_3() const { return ___m_VerticalFit_3; }
inline int32_t* get_address_of_m_VerticalFit_3() { return &___m_VerticalFit_3; }
inline void set_m_VerticalFit_3(int32_t value)
{
___m_VerticalFit_3 = value;
}
inline static int32_t get_offset_of_m_Rect_4() { return static_cast<int32_t>(offsetof(ContentSizeFitter_t1789893878, ___m_Rect_4)); }
inline RectTransform_t3700156813 * get_m_Rect_4() const { return ___m_Rect_4; }
inline RectTransform_t3700156813 ** get_address_of_m_Rect_4() { return &___m_Rect_4; }
inline void set_m_Rect_4(RectTransform_t3700156813 * value)
{
___m_Rect_4 = value;
Il2CppCodeGenWriteBarrier((&___m_Rect_4), value);
}
inline static int32_t get_offset_of_m_Tracker_5() { return static_cast<int32_t>(offsetof(ContentSizeFitter_t1789893878, ___m_Tracker_5)); }
inline DrivenRectTransformTracker_t2435175526 get_m_Tracker_5() const { return ___m_Tracker_5; }
inline DrivenRectTransformTracker_t2435175526 * get_address_of_m_Tracker_5() { return &___m_Tracker_5; }
inline void set_m_Tracker_5(DrivenRectTransformTracker_t2435175526 value)
{
___m_Tracker_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // CONTENTSIZEFITTER_T1789893878_H
#ifndef ASPECTRATIOFITTER_T714713384_H
#define ASPECTRATIOFITTER_T714713384_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.AspectRatioFitter
struct AspectRatioFitter_t714713384 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.UI.AspectRatioFitter/AspectMode UnityEngine.UI.AspectRatioFitter::m_AspectMode
int32_t ___m_AspectMode_2;
// System.Single UnityEngine.UI.AspectRatioFitter::m_AspectRatio
float ___m_AspectRatio_3;
// UnityEngine.RectTransform UnityEngine.UI.AspectRatioFitter::m_Rect
RectTransform_t3700156813 * ___m_Rect_4;
// UnityEngine.DrivenRectTransformTracker UnityEngine.UI.AspectRatioFitter::m_Tracker
DrivenRectTransformTracker_t2435175526 ___m_Tracker_5;
public:
inline static int32_t get_offset_of_m_AspectMode_2() { return static_cast<int32_t>(offsetof(AspectRatioFitter_t714713384, ___m_AspectMode_2)); }
inline int32_t get_m_AspectMode_2() const { return ___m_AspectMode_2; }
inline int32_t* get_address_of_m_AspectMode_2() { return &___m_AspectMode_2; }
inline void set_m_AspectMode_2(int32_t value)
{
___m_AspectMode_2 = value;
}
inline static int32_t get_offset_of_m_AspectRatio_3() { return static_cast<int32_t>(offsetof(AspectRatioFitter_t714713384, ___m_AspectRatio_3)); }
inline float get_m_AspectRatio_3() const { return ___m_AspectRatio_3; }
inline float* get_address_of_m_AspectRatio_3() { return &___m_AspectRatio_3; }
inline void set_m_AspectRatio_3(float value)
{
___m_AspectRatio_3 = value;
}
inline static int32_t get_offset_of_m_Rect_4() { return static_cast<int32_t>(offsetof(AspectRatioFitter_t714713384, ___m_Rect_4)); }
inline RectTransform_t3700156813 * get_m_Rect_4() const { return ___m_Rect_4; }
inline RectTransform_t3700156813 ** get_address_of_m_Rect_4() { return &___m_Rect_4; }
inline void set_m_Rect_4(RectTransform_t3700156813 * value)
{
___m_Rect_4 = value;
Il2CppCodeGenWriteBarrier((&___m_Rect_4), value);
}
inline static int32_t get_offset_of_m_Tracker_5() { return static_cast<int32_t>(offsetof(AspectRatioFitter_t714713384, ___m_Tracker_5)); }
inline DrivenRectTransformTracker_t2435175526 get_m_Tracker_5() const { return ___m_Tracker_5; }
inline DrivenRectTransformTracker_t2435175526 * get_address_of_m_Tracker_5() { return &___m_Tracker_5; }
inline void set_m_Tracker_5(DrivenRectTransformTracker_t2435175526 value)
{
___m_Tracker_5 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ASPECTRATIOFITTER_T714713384_H
#ifndef TOGGLEGROUP_T171083327_H
#define TOGGLEGROUP_T171083327_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ToggleGroup
struct ToggleGroup_t171083327 : public UIBehaviour_t1413405078
{
public:
// System.Boolean UnityEngine.UI.ToggleGroup::m_AllowSwitchOff
bool ___m_AllowSwitchOff_2;
// System.Collections.Generic.List`1<UnityEngine.UI.Toggle> UnityEngine.UI.ToggleGroup::m_Toggles
List_1_t3773614295 * ___m_Toggles_3;
public:
inline static int32_t get_offset_of_m_AllowSwitchOff_2() { return static_cast<int32_t>(offsetof(ToggleGroup_t171083327, ___m_AllowSwitchOff_2)); }
inline bool get_m_AllowSwitchOff_2() const { return ___m_AllowSwitchOff_2; }
inline bool* get_address_of_m_AllowSwitchOff_2() { return &___m_AllowSwitchOff_2; }
inline void set_m_AllowSwitchOff_2(bool value)
{
___m_AllowSwitchOff_2 = value;
}
inline static int32_t get_offset_of_m_Toggles_3() { return static_cast<int32_t>(offsetof(ToggleGroup_t171083327, ___m_Toggles_3)); }
inline List_1_t3773614295 * get_m_Toggles_3() const { return ___m_Toggles_3; }
inline List_1_t3773614295 ** get_address_of_m_Toggles_3() { return &___m_Toggles_3; }
inline void set_m_Toggles_3(List_1_t3773614295 * value)
{
___m_Toggles_3 = value;
Il2CppCodeGenWriteBarrier((&___m_Toggles_3), value);
}
};
struct ToggleGroup_t171083327_StaticFields
{
public:
// System.Predicate`1<UnityEngine.UI.Toggle> UnityEngine.UI.ToggleGroup::<>f__am$cache0
Predicate_1_t2571060369 * ___U3CU3Ef__amU24cache0_4;
// System.Func`2<UnityEngine.UI.Toggle,System.Boolean> UnityEngine.UI.ToggleGroup::<>f__am$cache1
Func_2_t4116566899 * ___U3CU3Ef__amU24cache1_5;
public:
inline static int32_t get_offset_of_U3CU3Ef__amU24cache0_4() { return static_cast<int32_t>(offsetof(ToggleGroup_t171083327_StaticFields, ___U3CU3Ef__amU24cache0_4)); }
inline Predicate_1_t2571060369 * get_U3CU3Ef__amU24cache0_4() const { return ___U3CU3Ef__amU24cache0_4; }
inline Predicate_1_t2571060369 ** get_address_of_U3CU3Ef__amU24cache0_4() { return &___U3CU3Ef__amU24cache0_4; }
inline void set_U3CU3Ef__amU24cache0_4(Predicate_1_t2571060369 * value)
{
___U3CU3Ef__amU24cache0_4 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache0_4), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache1_5() { return static_cast<int32_t>(offsetof(ToggleGroup_t171083327_StaticFields, ___U3CU3Ef__amU24cache1_5)); }
inline Func_2_t4116566899 * get_U3CU3Ef__amU24cache1_5() const { return ___U3CU3Ef__amU24cache1_5; }
inline Func_2_t4116566899 ** get_address_of_U3CU3Ef__amU24cache1_5() { return &___U3CU3Ef__amU24cache1_5; }
inline void set_U3CU3Ef__amU24cache1_5(Func_2_t4116566899 * value)
{
___U3CU3Ef__amU24cache1_5 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache1_5), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOGGLEGROUP_T171083327_H
#ifndef GRAPHIC_T535825046_H
#define GRAPHIC_T535825046_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Graphic
struct Graphic_t535825046 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.Material UnityEngine.UI.Graphic::m_Material
Material_t3939796247 * ___m_Material_4;
// UnityEngine.Color UnityEngine.UI.Graphic::m_Color
Color_t267620335 ___m_Color_5;
// System.Boolean UnityEngine.UI.Graphic::m_RaycastTarget
bool ___m_RaycastTarget_6;
// UnityEngine.RectTransform UnityEngine.UI.Graphic::m_RectTransform
RectTransform_t3700156813 * ___m_RectTransform_7;
// UnityEngine.CanvasRenderer UnityEngine.UI.Graphic::m_CanvasRender
CanvasRenderer_t4042724174 * ___m_CanvasRender_8;
// UnityEngine.Canvas UnityEngine.UI.Graphic::m_Canvas
Canvas_t2948613984 * ___m_Canvas_9;
// System.Boolean UnityEngine.UI.Graphic::m_VertsDirty
bool ___m_VertsDirty_10;
// System.Boolean UnityEngine.UI.Graphic::m_MaterialDirty
bool ___m_MaterialDirty_11;
// UnityEngine.Events.UnityAction UnityEngine.UI.Graphic::m_OnDirtyLayoutCallback
UnityAction_t516660186 * ___m_OnDirtyLayoutCallback_12;
// UnityEngine.Events.UnityAction UnityEngine.UI.Graphic::m_OnDirtyVertsCallback
UnityAction_t516660186 * ___m_OnDirtyVertsCallback_13;
// UnityEngine.Events.UnityAction UnityEngine.UI.Graphic::m_OnDirtyMaterialCallback
UnityAction_t516660186 * ___m_OnDirtyMaterialCallback_14;
// UnityEngine.UI.CoroutineTween.TweenRunner`1<UnityEngine.UI.CoroutineTween.ColorTween> UnityEngine.UI.Graphic::m_ColorTweenRunner
TweenRunner_1_t812855407 * ___m_ColorTweenRunner_17;
// System.Boolean UnityEngine.UI.Graphic::<useLegacyMeshGeneration>k__BackingField
bool ___U3CuseLegacyMeshGenerationU3Ek__BackingField_18;
public:
inline static int32_t get_offset_of_m_Material_4() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_Material_4)); }
inline Material_t3939796247 * get_m_Material_4() const { return ___m_Material_4; }
inline Material_t3939796247 ** get_address_of_m_Material_4() { return &___m_Material_4; }
inline void set_m_Material_4(Material_t3939796247 * value)
{
___m_Material_4 = value;
Il2CppCodeGenWriteBarrier((&___m_Material_4), value);
}
inline static int32_t get_offset_of_m_Color_5() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_Color_5)); }
inline Color_t267620335 get_m_Color_5() const { return ___m_Color_5; }
inline Color_t267620335 * get_address_of_m_Color_5() { return &___m_Color_5; }
inline void set_m_Color_5(Color_t267620335 value)
{
___m_Color_5 = value;
}
inline static int32_t get_offset_of_m_RaycastTarget_6() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_RaycastTarget_6)); }
inline bool get_m_RaycastTarget_6() const { return ___m_RaycastTarget_6; }
inline bool* get_address_of_m_RaycastTarget_6() { return &___m_RaycastTarget_6; }
inline void set_m_RaycastTarget_6(bool value)
{
___m_RaycastTarget_6 = value;
}
inline static int32_t get_offset_of_m_RectTransform_7() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_RectTransform_7)); }
inline RectTransform_t3700156813 * get_m_RectTransform_7() const { return ___m_RectTransform_7; }
inline RectTransform_t3700156813 ** get_address_of_m_RectTransform_7() { return &___m_RectTransform_7; }
inline void set_m_RectTransform_7(RectTransform_t3700156813 * value)
{
___m_RectTransform_7 = value;
Il2CppCodeGenWriteBarrier((&___m_RectTransform_7), value);
}
inline static int32_t get_offset_of_m_CanvasRender_8() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_CanvasRender_8)); }
inline CanvasRenderer_t4042724174 * get_m_CanvasRender_8() const { return ___m_CanvasRender_8; }
inline CanvasRenderer_t4042724174 ** get_address_of_m_CanvasRender_8() { return &___m_CanvasRender_8; }
inline void set_m_CanvasRender_8(CanvasRenderer_t4042724174 * value)
{
___m_CanvasRender_8 = value;
Il2CppCodeGenWriteBarrier((&___m_CanvasRender_8), value);
}
inline static int32_t get_offset_of_m_Canvas_9() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_Canvas_9)); }
inline Canvas_t2948613984 * get_m_Canvas_9() const { return ___m_Canvas_9; }
inline Canvas_t2948613984 ** get_address_of_m_Canvas_9() { return &___m_Canvas_9; }
inline void set_m_Canvas_9(Canvas_t2948613984 * value)
{
___m_Canvas_9 = value;
Il2CppCodeGenWriteBarrier((&___m_Canvas_9), value);
}
inline static int32_t get_offset_of_m_VertsDirty_10() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_VertsDirty_10)); }
inline bool get_m_VertsDirty_10() const { return ___m_VertsDirty_10; }
inline bool* get_address_of_m_VertsDirty_10() { return &___m_VertsDirty_10; }
inline void set_m_VertsDirty_10(bool value)
{
___m_VertsDirty_10 = value;
}
inline static int32_t get_offset_of_m_MaterialDirty_11() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_MaterialDirty_11)); }
inline bool get_m_MaterialDirty_11() const { return ___m_MaterialDirty_11; }
inline bool* get_address_of_m_MaterialDirty_11() { return &___m_MaterialDirty_11; }
inline void set_m_MaterialDirty_11(bool value)
{
___m_MaterialDirty_11 = value;
}
inline static int32_t get_offset_of_m_OnDirtyLayoutCallback_12() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_OnDirtyLayoutCallback_12)); }
inline UnityAction_t516660186 * get_m_OnDirtyLayoutCallback_12() const { return ___m_OnDirtyLayoutCallback_12; }
inline UnityAction_t516660186 ** get_address_of_m_OnDirtyLayoutCallback_12() { return &___m_OnDirtyLayoutCallback_12; }
inline void set_m_OnDirtyLayoutCallback_12(UnityAction_t516660186 * value)
{
___m_OnDirtyLayoutCallback_12 = value;
Il2CppCodeGenWriteBarrier((&___m_OnDirtyLayoutCallback_12), value);
}
inline static int32_t get_offset_of_m_OnDirtyVertsCallback_13() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_OnDirtyVertsCallback_13)); }
inline UnityAction_t516660186 * get_m_OnDirtyVertsCallback_13() const { return ___m_OnDirtyVertsCallback_13; }
inline UnityAction_t516660186 ** get_address_of_m_OnDirtyVertsCallback_13() { return &___m_OnDirtyVertsCallback_13; }
inline void set_m_OnDirtyVertsCallback_13(UnityAction_t516660186 * value)
{
___m_OnDirtyVertsCallback_13 = value;
Il2CppCodeGenWriteBarrier((&___m_OnDirtyVertsCallback_13), value);
}
inline static int32_t get_offset_of_m_OnDirtyMaterialCallback_14() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_OnDirtyMaterialCallback_14)); }
inline UnityAction_t516660186 * get_m_OnDirtyMaterialCallback_14() const { return ___m_OnDirtyMaterialCallback_14; }
inline UnityAction_t516660186 ** get_address_of_m_OnDirtyMaterialCallback_14() { return &___m_OnDirtyMaterialCallback_14; }
inline void set_m_OnDirtyMaterialCallback_14(UnityAction_t516660186 * value)
{
___m_OnDirtyMaterialCallback_14 = value;
Il2CppCodeGenWriteBarrier((&___m_OnDirtyMaterialCallback_14), value);
}
inline static int32_t get_offset_of_m_ColorTweenRunner_17() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___m_ColorTweenRunner_17)); }
inline TweenRunner_1_t812855407 * get_m_ColorTweenRunner_17() const { return ___m_ColorTweenRunner_17; }
inline TweenRunner_1_t812855407 ** get_address_of_m_ColorTweenRunner_17() { return &___m_ColorTweenRunner_17; }
inline void set_m_ColorTweenRunner_17(TweenRunner_1_t812855407 * value)
{
___m_ColorTweenRunner_17 = value;
Il2CppCodeGenWriteBarrier((&___m_ColorTweenRunner_17), value);
}
inline static int32_t get_offset_of_U3CuseLegacyMeshGenerationU3Ek__BackingField_18() { return static_cast<int32_t>(offsetof(Graphic_t535825046, ___U3CuseLegacyMeshGenerationU3Ek__BackingField_18)); }
inline bool get_U3CuseLegacyMeshGenerationU3Ek__BackingField_18() const { return ___U3CuseLegacyMeshGenerationU3Ek__BackingField_18; }
inline bool* get_address_of_U3CuseLegacyMeshGenerationU3Ek__BackingField_18() { return &___U3CuseLegacyMeshGenerationU3Ek__BackingField_18; }
inline void set_U3CuseLegacyMeshGenerationU3Ek__BackingField_18(bool value)
{
___U3CuseLegacyMeshGenerationU3Ek__BackingField_18 = value;
}
};
struct Graphic_t535825046_StaticFields
{
public:
// UnityEngine.Material UnityEngine.UI.Graphic::s_DefaultUI
Material_t3939796247 * ___s_DefaultUI_2;
// UnityEngine.Texture2D UnityEngine.UI.Graphic::s_WhiteTexture
Texture2D_t1384570725 * ___s_WhiteTexture_3;
// UnityEngine.Mesh UnityEngine.UI.Graphic::s_Mesh
Mesh_t3666751399 * ___s_Mesh_15;
// UnityEngine.UI.VertexHelper UnityEngine.UI.Graphic::s_VertexHelper
VertexHelper_t122899649 * ___s_VertexHelper_16;
public:
inline static int32_t get_offset_of_s_DefaultUI_2() { return static_cast<int32_t>(offsetof(Graphic_t535825046_StaticFields, ___s_DefaultUI_2)); }
inline Material_t3939796247 * get_s_DefaultUI_2() const { return ___s_DefaultUI_2; }
inline Material_t3939796247 ** get_address_of_s_DefaultUI_2() { return &___s_DefaultUI_2; }
inline void set_s_DefaultUI_2(Material_t3939796247 * value)
{
___s_DefaultUI_2 = value;
Il2CppCodeGenWriteBarrier((&___s_DefaultUI_2), value);
}
inline static int32_t get_offset_of_s_WhiteTexture_3() { return static_cast<int32_t>(offsetof(Graphic_t535825046_StaticFields, ___s_WhiteTexture_3)); }
inline Texture2D_t1384570725 * get_s_WhiteTexture_3() const { return ___s_WhiteTexture_3; }
inline Texture2D_t1384570725 ** get_address_of_s_WhiteTexture_3() { return &___s_WhiteTexture_3; }
inline void set_s_WhiteTexture_3(Texture2D_t1384570725 * value)
{
___s_WhiteTexture_3 = value;
Il2CppCodeGenWriteBarrier((&___s_WhiteTexture_3), value);
}
inline static int32_t get_offset_of_s_Mesh_15() { return static_cast<int32_t>(offsetof(Graphic_t535825046_StaticFields, ___s_Mesh_15)); }
inline Mesh_t3666751399 * get_s_Mesh_15() const { return ___s_Mesh_15; }
inline Mesh_t3666751399 ** get_address_of_s_Mesh_15() { return &___s_Mesh_15; }
inline void set_s_Mesh_15(Mesh_t3666751399 * value)
{
___s_Mesh_15 = value;
Il2CppCodeGenWriteBarrier((&___s_Mesh_15), value);
}
inline static int32_t get_offset_of_s_VertexHelper_16() { return static_cast<int32_t>(offsetof(Graphic_t535825046_StaticFields, ___s_VertexHelper_16)); }
inline VertexHelper_t122899649 * get_s_VertexHelper_16() const { return ___s_VertexHelper_16; }
inline VertexHelper_t122899649 ** get_address_of_s_VertexHelper_16() { return &___s_VertexHelper_16; }
inline void set_s_VertexHelper_16(VertexHelper_t122899649 * value)
{
___s_VertexHelper_16 = value;
Il2CppCodeGenWriteBarrier((&___s_VertexHelper_16), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GRAPHIC_T535825046_H
#ifndef SCROLLRECT_T1834416425_H
#define SCROLLRECT_T1834416425_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.ScrollRect
struct ScrollRect_t1834416425 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.RectTransform UnityEngine.UI.ScrollRect::m_Content
RectTransform_t3700156813 * ___m_Content_2;
// System.Boolean UnityEngine.UI.ScrollRect::m_Horizontal
bool ___m_Horizontal_3;
// System.Boolean UnityEngine.UI.ScrollRect::m_Vertical
bool ___m_Vertical_4;
// UnityEngine.UI.ScrollRect/MovementType UnityEngine.UI.ScrollRect::m_MovementType
int32_t ___m_MovementType_5;
// System.Single UnityEngine.UI.ScrollRect::m_Elasticity
float ___m_Elasticity_6;
// System.Boolean UnityEngine.UI.ScrollRect::m_Inertia
bool ___m_Inertia_7;
// System.Single UnityEngine.UI.ScrollRect::m_DecelerationRate
float ___m_DecelerationRate_8;
// System.Single UnityEngine.UI.ScrollRect::m_ScrollSensitivity
float ___m_ScrollSensitivity_9;
// UnityEngine.RectTransform UnityEngine.UI.ScrollRect::m_Viewport
RectTransform_t3700156813 * ___m_Viewport_10;
// UnityEngine.UI.Scrollbar UnityEngine.UI.ScrollRect::m_HorizontalScrollbar
Scrollbar_t3517713769 * ___m_HorizontalScrollbar_11;
// UnityEngine.UI.Scrollbar UnityEngine.UI.ScrollRect::m_VerticalScrollbar
Scrollbar_t3517713769 * ___m_VerticalScrollbar_12;
// UnityEngine.UI.ScrollRect/ScrollbarVisibility UnityEngine.UI.ScrollRect::m_HorizontalScrollbarVisibility
int32_t ___m_HorizontalScrollbarVisibility_13;
// UnityEngine.UI.ScrollRect/ScrollbarVisibility UnityEngine.UI.ScrollRect::m_VerticalScrollbarVisibility
int32_t ___m_VerticalScrollbarVisibility_14;
// System.Single UnityEngine.UI.ScrollRect::m_HorizontalScrollbarSpacing
float ___m_HorizontalScrollbarSpacing_15;
// System.Single UnityEngine.UI.ScrollRect::m_VerticalScrollbarSpacing
float ___m_VerticalScrollbarSpacing_16;
// UnityEngine.UI.ScrollRect/ScrollRectEvent UnityEngine.UI.ScrollRect::m_OnValueChanged
ScrollRectEvent_t1918886797 * ___m_OnValueChanged_17;
// UnityEngine.Vector2 UnityEngine.UI.ScrollRect::m_PointerStartLocalCursor
Vector2_t3854014517 ___m_PointerStartLocalCursor_18;
// UnityEngine.Vector2 UnityEngine.UI.ScrollRect::m_ContentStartPosition
Vector2_t3854014517 ___m_ContentStartPosition_19;
// UnityEngine.RectTransform UnityEngine.UI.ScrollRect::m_ViewRect
RectTransform_t3700156813 * ___m_ViewRect_20;
// UnityEngine.Bounds UnityEngine.UI.ScrollRect::m_ContentBounds
Bounds_t2168426705 ___m_ContentBounds_21;
// UnityEngine.Bounds UnityEngine.UI.ScrollRect::m_ViewBounds
Bounds_t2168426705 ___m_ViewBounds_22;
// UnityEngine.Vector2 UnityEngine.UI.ScrollRect::m_Velocity
Vector2_t3854014517 ___m_Velocity_23;
// System.Boolean UnityEngine.UI.ScrollRect::m_Dragging
bool ___m_Dragging_24;
// UnityEngine.Vector2 UnityEngine.UI.ScrollRect::m_PrevPosition
Vector2_t3854014517 ___m_PrevPosition_25;
// UnityEngine.Bounds UnityEngine.UI.ScrollRect::m_PrevContentBounds
Bounds_t2168426705 ___m_PrevContentBounds_26;
// UnityEngine.Bounds UnityEngine.UI.ScrollRect::m_PrevViewBounds
Bounds_t2168426705 ___m_PrevViewBounds_27;
// System.Boolean UnityEngine.UI.ScrollRect::m_HasRebuiltLayout
bool ___m_HasRebuiltLayout_28;
// System.Boolean UnityEngine.UI.ScrollRect::m_HSliderExpand
bool ___m_HSliderExpand_29;
// System.Boolean UnityEngine.UI.ScrollRect::m_VSliderExpand
bool ___m_VSliderExpand_30;
// System.Single UnityEngine.UI.ScrollRect::m_HSliderHeight
float ___m_HSliderHeight_31;
// System.Single UnityEngine.UI.ScrollRect::m_VSliderWidth
float ___m_VSliderWidth_32;
// UnityEngine.RectTransform UnityEngine.UI.ScrollRect::m_Rect
RectTransform_t3700156813 * ___m_Rect_33;
// UnityEngine.RectTransform UnityEngine.UI.ScrollRect::m_HorizontalScrollbarRect
RectTransform_t3700156813 * ___m_HorizontalScrollbarRect_34;
// UnityEngine.RectTransform UnityEngine.UI.ScrollRect::m_VerticalScrollbarRect
RectTransform_t3700156813 * ___m_VerticalScrollbarRect_35;
// UnityEngine.DrivenRectTransformTracker UnityEngine.UI.ScrollRect::m_Tracker
DrivenRectTransformTracker_t2435175526 ___m_Tracker_36;
// UnityEngine.Vector3[] UnityEngine.UI.ScrollRect::m_Corners
Vector3U5BU5D_t2251457841* ___m_Corners_37;
public:
inline static int32_t get_offset_of_m_Content_2() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Content_2)); }
inline RectTransform_t3700156813 * get_m_Content_2() const { return ___m_Content_2; }
inline RectTransform_t3700156813 ** get_address_of_m_Content_2() { return &___m_Content_2; }
inline void set_m_Content_2(RectTransform_t3700156813 * value)
{
___m_Content_2 = value;
Il2CppCodeGenWriteBarrier((&___m_Content_2), value);
}
inline static int32_t get_offset_of_m_Horizontal_3() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Horizontal_3)); }
inline bool get_m_Horizontal_3() const { return ___m_Horizontal_3; }
inline bool* get_address_of_m_Horizontal_3() { return &___m_Horizontal_3; }
inline void set_m_Horizontal_3(bool value)
{
___m_Horizontal_3 = value;
}
inline static int32_t get_offset_of_m_Vertical_4() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Vertical_4)); }
inline bool get_m_Vertical_4() const { return ___m_Vertical_4; }
inline bool* get_address_of_m_Vertical_4() { return &___m_Vertical_4; }
inline void set_m_Vertical_4(bool value)
{
___m_Vertical_4 = value;
}
inline static int32_t get_offset_of_m_MovementType_5() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_MovementType_5)); }
inline int32_t get_m_MovementType_5() const { return ___m_MovementType_5; }
inline int32_t* get_address_of_m_MovementType_5() { return &___m_MovementType_5; }
inline void set_m_MovementType_5(int32_t value)
{
___m_MovementType_5 = value;
}
inline static int32_t get_offset_of_m_Elasticity_6() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Elasticity_6)); }
inline float get_m_Elasticity_6() const { return ___m_Elasticity_6; }
inline float* get_address_of_m_Elasticity_6() { return &___m_Elasticity_6; }
inline void set_m_Elasticity_6(float value)
{
___m_Elasticity_6 = value;
}
inline static int32_t get_offset_of_m_Inertia_7() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Inertia_7)); }
inline bool get_m_Inertia_7() const { return ___m_Inertia_7; }
inline bool* get_address_of_m_Inertia_7() { return &___m_Inertia_7; }
inline void set_m_Inertia_7(bool value)
{
___m_Inertia_7 = value;
}
inline static int32_t get_offset_of_m_DecelerationRate_8() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_DecelerationRate_8)); }
inline float get_m_DecelerationRate_8() const { return ___m_DecelerationRate_8; }
inline float* get_address_of_m_DecelerationRate_8() { return &___m_DecelerationRate_8; }
inline void set_m_DecelerationRate_8(float value)
{
___m_DecelerationRate_8 = value;
}
inline static int32_t get_offset_of_m_ScrollSensitivity_9() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_ScrollSensitivity_9)); }
inline float get_m_ScrollSensitivity_9() const { return ___m_ScrollSensitivity_9; }
inline float* get_address_of_m_ScrollSensitivity_9() { return &___m_ScrollSensitivity_9; }
inline void set_m_ScrollSensitivity_9(float value)
{
___m_ScrollSensitivity_9 = value;
}
inline static int32_t get_offset_of_m_Viewport_10() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Viewport_10)); }
inline RectTransform_t3700156813 * get_m_Viewport_10() const { return ___m_Viewport_10; }
inline RectTransform_t3700156813 ** get_address_of_m_Viewport_10() { return &___m_Viewport_10; }
inline void set_m_Viewport_10(RectTransform_t3700156813 * value)
{
___m_Viewport_10 = value;
Il2CppCodeGenWriteBarrier((&___m_Viewport_10), value);
}
inline static int32_t get_offset_of_m_HorizontalScrollbar_11() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_HorizontalScrollbar_11)); }
inline Scrollbar_t3517713769 * get_m_HorizontalScrollbar_11() const { return ___m_HorizontalScrollbar_11; }
inline Scrollbar_t3517713769 ** get_address_of_m_HorizontalScrollbar_11() { return &___m_HorizontalScrollbar_11; }
inline void set_m_HorizontalScrollbar_11(Scrollbar_t3517713769 * value)
{
___m_HorizontalScrollbar_11 = value;
Il2CppCodeGenWriteBarrier((&___m_HorizontalScrollbar_11), value);
}
inline static int32_t get_offset_of_m_VerticalScrollbar_12() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_VerticalScrollbar_12)); }
inline Scrollbar_t3517713769 * get_m_VerticalScrollbar_12() const { return ___m_VerticalScrollbar_12; }
inline Scrollbar_t3517713769 ** get_address_of_m_VerticalScrollbar_12() { return &___m_VerticalScrollbar_12; }
inline void set_m_VerticalScrollbar_12(Scrollbar_t3517713769 * value)
{
___m_VerticalScrollbar_12 = value;
Il2CppCodeGenWriteBarrier((&___m_VerticalScrollbar_12), value);
}
inline static int32_t get_offset_of_m_HorizontalScrollbarVisibility_13() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_HorizontalScrollbarVisibility_13)); }
inline int32_t get_m_HorizontalScrollbarVisibility_13() const { return ___m_HorizontalScrollbarVisibility_13; }
inline int32_t* get_address_of_m_HorizontalScrollbarVisibility_13() { return &___m_HorizontalScrollbarVisibility_13; }
inline void set_m_HorizontalScrollbarVisibility_13(int32_t value)
{
___m_HorizontalScrollbarVisibility_13 = value;
}
inline static int32_t get_offset_of_m_VerticalScrollbarVisibility_14() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_VerticalScrollbarVisibility_14)); }
inline int32_t get_m_VerticalScrollbarVisibility_14() const { return ___m_VerticalScrollbarVisibility_14; }
inline int32_t* get_address_of_m_VerticalScrollbarVisibility_14() { return &___m_VerticalScrollbarVisibility_14; }
inline void set_m_VerticalScrollbarVisibility_14(int32_t value)
{
___m_VerticalScrollbarVisibility_14 = value;
}
inline static int32_t get_offset_of_m_HorizontalScrollbarSpacing_15() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_HorizontalScrollbarSpacing_15)); }
inline float get_m_HorizontalScrollbarSpacing_15() const { return ___m_HorizontalScrollbarSpacing_15; }
inline float* get_address_of_m_HorizontalScrollbarSpacing_15() { return &___m_HorizontalScrollbarSpacing_15; }
inline void set_m_HorizontalScrollbarSpacing_15(float value)
{
___m_HorizontalScrollbarSpacing_15 = value;
}
inline static int32_t get_offset_of_m_VerticalScrollbarSpacing_16() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_VerticalScrollbarSpacing_16)); }
inline float get_m_VerticalScrollbarSpacing_16() const { return ___m_VerticalScrollbarSpacing_16; }
inline float* get_address_of_m_VerticalScrollbarSpacing_16() { return &___m_VerticalScrollbarSpacing_16; }
inline void set_m_VerticalScrollbarSpacing_16(float value)
{
___m_VerticalScrollbarSpacing_16 = value;
}
inline static int32_t get_offset_of_m_OnValueChanged_17() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_OnValueChanged_17)); }
inline ScrollRectEvent_t1918886797 * get_m_OnValueChanged_17() const { return ___m_OnValueChanged_17; }
inline ScrollRectEvent_t1918886797 ** get_address_of_m_OnValueChanged_17() { return &___m_OnValueChanged_17; }
inline void set_m_OnValueChanged_17(ScrollRectEvent_t1918886797 * value)
{
___m_OnValueChanged_17 = value;
Il2CppCodeGenWriteBarrier((&___m_OnValueChanged_17), value);
}
inline static int32_t get_offset_of_m_PointerStartLocalCursor_18() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_PointerStartLocalCursor_18)); }
inline Vector2_t3854014517 get_m_PointerStartLocalCursor_18() const { return ___m_PointerStartLocalCursor_18; }
inline Vector2_t3854014517 * get_address_of_m_PointerStartLocalCursor_18() { return &___m_PointerStartLocalCursor_18; }
inline void set_m_PointerStartLocalCursor_18(Vector2_t3854014517 value)
{
___m_PointerStartLocalCursor_18 = value;
}
inline static int32_t get_offset_of_m_ContentStartPosition_19() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_ContentStartPosition_19)); }
inline Vector2_t3854014517 get_m_ContentStartPosition_19() const { return ___m_ContentStartPosition_19; }
inline Vector2_t3854014517 * get_address_of_m_ContentStartPosition_19() { return &___m_ContentStartPosition_19; }
inline void set_m_ContentStartPosition_19(Vector2_t3854014517 value)
{
___m_ContentStartPosition_19 = value;
}
inline static int32_t get_offset_of_m_ViewRect_20() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_ViewRect_20)); }
inline RectTransform_t3700156813 * get_m_ViewRect_20() const { return ___m_ViewRect_20; }
inline RectTransform_t3700156813 ** get_address_of_m_ViewRect_20() { return &___m_ViewRect_20; }
inline void set_m_ViewRect_20(RectTransform_t3700156813 * value)
{
___m_ViewRect_20 = value;
Il2CppCodeGenWriteBarrier((&___m_ViewRect_20), value);
}
inline static int32_t get_offset_of_m_ContentBounds_21() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_ContentBounds_21)); }
inline Bounds_t2168426705 get_m_ContentBounds_21() const { return ___m_ContentBounds_21; }
inline Bounds_t2168426705 * get_address_of_m_ContentBounds_21() { return &___m_ContentBounds_21; }
inline void set_m_ContentBounds_21(Bounds_t2168426705 value)
{
___m_ContentBounds_21 = value;
}
inline static int32_t get_offset_of_m_ViewBounds_22() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_ViewBounds_22)); }
inline Bounds_t2168426705 get_m_ViewBounds_22() const { return ___m_ViewBounds_22; }
inline Bounds_t2168426705 * get_address_of_m_ViewBounds_22() { return &___m_ViewBounds_22; }
inline void set_m_ViewBounds_22(Bounds_t2168426705 value)
{
___m_ViewBounds_22 = value;
}
inline static int32_t get_offset_of_m_Velocity_23() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Velocity_23)); }
inline Vector2_t3854014517 get_m_Velocity_23() const { return ___m_Velocity_23; }
inline Vector2_t3854014517 * get_address_of_m_Velocity_23() { return &___m_Velocity_23; }
inline void set_m_Velocity_23(Vector2_t3854014517 value)
{
___m_Velocity_23 = value;
}
inline static int32_t get_offset_of_m_Dragging_24() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Dragging_24)); }
inline bool get_m_Dragging_24() const { return ___m_Dragging_24; }
inline bool* get_address_of_m_Dragging_24() { return &___m_Dragging_24; }
inline void set_m_Dragging_24(bool value)
{
___m_Dragging_24 = value;
}
inline static int32_t get_offset_of_m_PrevPosition_25() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_PrevPosition_25)); }
inline Vector2_t3854014517 get_m_PrevPosition_25() const { return ___m_PrevPosition_25; }
inline Vector2_t3854014517 * get_address_of_m_PrevPosition_25() { return &___m_PrevPosition_25; }
inline void set_m_PrevPosition_25(Vector2_t3854014517 value)
{
___m_PrevPosition_25 = value;
}
inline static int32_t get_offset_of_m_PrevContentBounds_26() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_PrevContentBounds_26)); }
inline Bounds_t2168426705 get_m_PrevContentBounds_26() const { return ___m_PrevContentBounds_26; }
inline Bounds_t2168426705 * get_address_of_m_PrevContentBounds_26() { return &___m_PrevContentBounds_26; }
inline void set_m_PrevContentBounds_26(Bounds_t2168426705 value)
{
___m_PrevContentBounds_26 = value;
}
inline static int32_t get_offset_of_m_PrevViewBounds_27() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_PrevViewBounds_27)); }
inline Bounds_t2168426705 get_m_PrevViewBounds_27() const { return ___m_PrevViewBounds_27; }
inline Bounds_t2168426705 * get_address_of_m_PrevViewBounds_27() { return &___m_PrevViewBounds_27; }
inline void set_m_PrevViewBounds_27(Bounds_t2168426705 value)
{
___m_PrevViewBounds_27 = value;
}
inline static int32_t get_offset_of_m_HasRebuiltLayout_28() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_HasRebuiltLayout_28)); }
inline bool get_m_HasRebuiltLayout_28() const { return ___m_HasRebuiltLayout_28; }
inline bool* get_address_of_m_HasRebuiltLayout_28() { return &___m_HasRebuiltLayout_28; }
inline void set_m_HasRebuiltLayout_28(bool value)
{
___m_HasRebuiltLayout_28 = value;
}
inline static int32_t get_offset_of_m_HSliderExpand_29() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_HSliderExpand_29)); }
inline bool get_m_HSliderExpand_29() const { return ___m_HSliderExpand_29; }
inline bool* get_address_of_m_HSliderExpand_29() { return &___m_HSliderExpand_29; }
inline void set_m_HSliderExpand_29(bool value)
{
___m_HSliderExpand_29 = value;
}
inline static int32_t get_offset_of_m_VSliderExpand_30() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_VSliderExpand_30)); }
inline bool get_m_VSliderExpand_30() const { return ___m_VSliderExpand_30; }
inline bool* get_address_of_m_VSliderExpand_30() { return &___m_VSliderExpand_30; }
inline void set_m_VSliderExpand_30(bool value)
{
___m_VSliderExpand_30 = value;
}
inline static int32_t get_offset_of_m_HSliderHeight_31() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_HSliderHeight_31)); }
inline float get_m_HSliderHeight_31() const { return ___m_HSliderHeight_31; }
inline float* get_address_of_m_HSliderHeight_31() { return &___m_HSliderHeight_31; }
inline void set_m_HSliderHeight_31(float value)
{
___m_HSliderHeight_31 = value;
}
inline static int32_t get_offset_of_m_VSliderWidth_32() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_VSliderWidth_32)); }
inline float get_m_VSliderWidth_32() const { return ___m_VSliderWidth_32; }
inline float* get_address_of_m_VSliderWidth_32() { return &___m_VSliderWidth_32; }
inline void set_m_VSliderWidth_32(float value)
{
___m_VSliderWidth_32 = value;
}
inline static int32_t get_offset_of_m_Rect_33() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Rect_33)); }
inline RectTransform_t3700156813 * get_m_Rect_33() const { return ___m_Rect_33; }
inline RectTransform_t3700156813 ** get_address_of_m_Rect_33() { return &___m_Rect_33; }
inline void set_m_Rect_33(RectTransform_t3700156813 * value)
{
___m_Rect_33 = value;
Il2CppCodeGenWriteBarrier((&___m_Rect_33), value);
}
inline static int32_t get_offset_of_m_HorizontalScrollbarRect_34() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_HorizontalScrollbarRect_34)); }
inline RectTransform_t3700156813 * get_m_HorizontalScrollbarRect_34() const { return ___m_HorizontalScrollbarRect_34; }
inline RectTransform_t3700156813 ** get_address_of_m_HorizontalScrollbarRect_34() { return &___m_HorizontalScrollbarRect_34; }
inline void set_m_HorizontalScrollbarRect_34(RectTransform_t3700156813 * value)
{
___m_HorizontalScrollbarRect_34 = value;
Il2CppCodeGenWriteBarrier((&___m_HorizontalScrollbarRect_34), value);
}
inline static int32_t get_offset_of_m_VerticalScrollbarRect_35() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_VerticalScrollbarRect_35)); }
inline RectTransform_t3700156813 * get_m_VerticalScrollbarRect_35() const { return ___m_VerticalScrollbarRect_35; }
inline RectTransform_t3700156813 ** get_address_of_m_VerticalScrollbarRect_35() { return &___m_VerticalScrollbarRect_35; }
inline void set_m_VerticalScrollbarRect_35(RectTransform_t3700156813 * value)
{
___m_VerticalScrollbarRect_35 = value;
Il2CppCodeGenWriteBarrier((&___m_VerticalScrollbarRect_35), value);
}
inline static int32_t get_offset_of_m_Tracker_36() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Tracker_36)); }
inline DrivenRectTransformTracker_t2435175526 get_m_Tracker_36() const { return ___m_Tracker_36; }
inline DrivenRectTransformTracker_t2435175526 * get_address_of_m_Tracker_36() { return &___m_Tracker_36; }
inline void set_m_Tracker_36(DrivenRectTransformTracker_t2435175526 value)
{
___m_Tracker_36 = value;
}
inline static int32_t get_offset_of_m_Corners_37() { return static_cast<int32_t>(offsetof(ScrollRect_t1834416425, ___m_Corners_37)); }
inline Vector3U5BU5D_t2251457841* get_m_Corners_37() const { return ___m_Corners_37; }
inline Vector3U5BU5D_t2251457841** get_address_of_m_Corners_37() { return &___m_Corners_37; }
inline void set_m_Corners_37(Vector3U5BU5D_t2251457841* value)
{
___m_Corners_37 = value;
Il2CppCodeGenWriteBarrier((&___m_Corners_37), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCROLLRECT_T1834416425_H
#ifndef SELECTABLE_T3916939825_H
#define SELECTABLE_T3916939825_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Selectable
struct Selectable_t3916939825 : public UIBehaviour_t1413405078
{
public:
// UnityEngine.UI.Navigation UnityEngine.UI.Selectable::m_Navigation
Navigation_t1087547695 ___m_Navigation_3;
// UnityEngine.UI.Selectable/Transition UnityEngine.UI.Selectable::m_Transition
int32_t ___m_Transition_4;
// UnityEngine.UI.ColorBlock UnityEngine.UI.Selectable::m_Colors
ColorBlock_t3155116571 ___m_Colors_5;
// UnityEngine.UI.SpriteState UnityEngine.UI.Selectable::m_SpriteState
SpriteState_t2212279481 ___m_SpriteState_6;
// UnityEngine.UI.AnimationTriggers UnityEngine.UI.Selectable::m_AnimationTriggers
AnimationTriggers_t3098459444 * ___m_AnimationTriggers_7;
// System.Boolean UnityEngine.UI.Selectable::m_Interactable
bool ___m_Interactable_8;
// UnityEngine.UI.Graphic UnityEngine.UI.Selectable::m_TargetGraphic
Graphic_t535825046 * ___m_TargetGraphic_9;
// System.Boolean UnityEngine.UI.Selectable::m_GroupsAllowInteraction
bool ___m_GroupsAllowInteraction_10;
// UnityEngine.UI.Selectable/SelectionState UnityEngine.UI.Selectable::m_CurrentSelectionState
int32_t ___m_CurrentSelectionState_11;
// System.Boolean UnityEngine.UI.Selectable::<isPointerInside>k__BackingField
bool ___U3CisPointerInsideU3Ek__BackingField_12;
// System.Boolean UnityEngine.UI.Selectable::<isPointerDown>k__BackingField
bool ___U3CisPointerDownU3Ek__BackingField_13;
// System.Boolean UnityEngine.UI.Selectable::<hasSelection>k__BackingField
bool ___U3ChasSelectionU3Ek__BackingField_14;
// System.Collections.Generic.List`1<UnityEngine.CanvasGroup> UnityEngine.UI.Selectable::m_CanvasGroupCache
List_1_t554132179 * ___m_CanvasGroupCache_15;
public:
inline static int32_t get_offset_of_m_Navigation_3() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_Navigation_3)); }
inline Navigation_t1087547695 get_m_Navigation_3() const { return ___m_Navigation_3; }
inline Navigation_t1087547695 * get_address_of_m_Navigation_3() { return &___m_Navigation_3; }
inline void set_m_Navigation_3(Navigation_t1087547695 value)
{
___m_Navigation_3 = value;
}
inline static int32_t get_offset_of_m_Transition_4() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_Transition_4)); }
inline int32_t get_m_Transition_4() const { return ___m_Transition_4; }
inline int32_t* get_address_of_m_Transition_4() { return &___m_Transition_4; }
inline void set_m_Transition_4(int32_t value)
{
___m_Transition_4 = value;
}
inline static int32_t get_offset_of_m_Colors_5() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_Colors_5)); }
inline ColorBlock_t3155116571 get_m_Colors_5() const { return ___m_Colors_5; }
inline ColorBlock_t3155116571 * get_address_of_m_Colors_5() { return &___m_Colors_5; }
inline void set_m_Colors_5(ColorBlock_t3155116571 value)
{
___m_Colors_5 = value;
}
inline static int32_t get_offset_of_m_SpriteState_6() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_SpriteState_6)); }
inline SpriteState_t2212279481 get_m_SpriteState_6() const { return ___m_SpriteState_6; }
inline SpriteState_t2212279481 * get_address_of_m_SpriteState_6() { return &___m_SpriteState_6; }
inline void set_m_SpriteState_6(SpriteState_t2212279481 value)
{
___m_SpriteState_6 = value;
}
inline static int32_t get_offset_of_m_AnimationTriggers_7() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_AnimationTriggers_7)); }
inline AnimationTriggers_t3098459444 * get_m_AnimationTriggers_7() const { return ___m_AnimationTriggers_7; }
inline AnimationTriggers_t3098459444 ** get_address_of_m_AnimationTriggers_7() { return &___m_AnimationTriggers_7; }
inline void set_m_AnimationTriggers_7(AnimationTriggers_t3098459444 * value)
{
___m_AnimationTriggers_7 = value;
Il2CppCodeGenWriteBarrier((&___m_AnimationTriggers_7), value);
}
inline static int32_t get_offset_of_m_Interactable_8() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_Interactable_8)); }
inline bool get_m_Interactable_8() const { return ___m_Interactable_8; }
inline bool* get_address_of_m_Interactable_8() { return &___m_Interactable_8; }
inline void set_m_Interactable_8(bool value)
{
___m_Interactable_8 = value;
}
inline static int32_t get_offset_of_m_TargetGraphic_9() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_TargetGraphic_9)); }
inline Graphic_t535825046 * get_m_TargetGraphic_9() const { return ___m_TargetGraphic_9; }
inline Graphic_t535825046 ** get_address_of_m_TargetGraphic_9() { return &___m_TargetGraphic_9; }
inline void set_m_TargetGraphic_9(Graphic_t535825046 * value)
{
___m_TargetGraphic_9 = value;
Il2CppCodeGenWriteBarrier((&___m_TargetGraphic_9), value);
}
inline static int32_t get_offset_of_m_GroupsAllowInteraction_10() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_GroupsAllowInteraction_10)); }
inline bool get_m_GroupsAllowInteraction_10() const { return ___m_GroupsAllowInteraction_10; }
inline bool* get_address_of_m_GroupsAllowInteraction_10() { return &___m_GroupsAllowInteraction_10; }
inline void set_m_GroupsAllowInteraction_10(bool value)
{
___m_GroupsAllowInteraction_10 = value;
}
inline static int32_t get_offset_of_m_CurrentSelectionState_11() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_CurrentSelectionState_11)); }
inline int32_t get_m_CurrentSelectionState_11() const { return ___m_CurrentSelectionState_11; }
inline int32_t* get_address_of_m_CurrentSelectionState_11() { return &___m_CurrentSelectionState_11; }
inline void set_m_CurrentSelectionState_11(int32_t value)
{
___m_CurrentSelectionState_11 = value;
}
inline static int32_t get_offset_of_U3CisPointerInsideU3Ek__BackingField_12() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___U3CisPointerInsideU3Ek__BackingField_12)); }
inline bool get_U3CisPointerInsideU3Ek__BackingField_12() const { return ___U3CisPointerInsideU3Ek__BackingField_12; }
inline bool* get_address_of_U3CisPointerInsideU3Ek__BackingField_12() { return &___U3CisPointerInsideU3Ek__BackingField_12; }
inline void set_U3CisPointerInsideU3Ek__BackingField_12(bool value)
{
___U3CisPointerInsideU3Ek__BackingField_12 = value;
}
inline static int32_t get_offset_of_U3CisPointerDownU3Ek__BackingField_13() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___U3CisPointerDownU3Ek__BackingField_13)); }
inline bool get_U3CisPointerDownU3Ek__BackingField_13() const { return ___U3CisPointerDownU3Ek__BackingField_13; }
inline bool* get_address_of_U3CisPointerDownU3Ek__BackingField_13() { return &___U3CisPointerDownU3Ek__BackingField_13; }
inline void set_U3CisPointerDownU3Ek__BackingField_13(bool value)
{
___U3CisPointerDownU3Ek__BackingField_13 = value;
}
inline static int32_t get_offset_of_U3ChasSelectionU3Ek__BackingField_14() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___U3ChasSelectionU3Ek__BackingField_14)); }
inline bool get_U3ChasSelectionU3Ek__BackingField_14() const { return ___U3ChasSelectionU3Ek__BackingField_14; }
inline bool* get_address_of_U3ChasSelectionU3Ek__BackingField_14() { return &___U3ChasSelectionU3Ek__BackingField_14; }
inline void set_U3ChasSelectionU3Ek__BackingField_14(bool value)
{
___U3ChasSelectionU3Ek__BackingField_14 = value;
}
inline static int32_t get_offset_of_m_CanvasGroupCache_15() { return static_cast<int32_t>(offsetof(Selectable_t3916939825, ___m_CanvasGroupCache_15)); }
inline List_1_t554132179 * get_m_CanvasGroupCache_15() const { return ___m_CanvasGroupCache_15; }
inline List_1_t554132179 ** get_address_of_m_CanvasGroupCache_15() { return &___m_CanvasGroupCache_15; }
inline void set_m_CanvasGroupCache_15(List_1_t554132179 * value)
{
___m_CanvasGroupCache_15 = value;
Il2CppCodeGenWriteBarrier((&___m_CanvasGroupCache_15), value);
}
};
struct Selectable_t3916939825_StaticFields
{
public:
// System.Collections.Generic.List`1<UnityEngine.UI.Selectable> UnityEngine.UI.Selectable::s_List
List_1_t3139825665 * ___s_List_2;
public:
inline static int32_t get_offset_of_s_List_2() { return static_cast<int32_t>(offsetof(Selectable_t3916939825_StaticFields, ___s_List_2)); }
inline List_1_t3139825665 * get_s_List_2() const { return ___s_List_2; }
inline List_1_t3139825665 ** get_address_of_s_List_2() { return &___s_List_2; }
inline void set_s_List_2(List_1_t3139825665 * value)
{
___s_List_2 = value;
Il2CppCodeGenWriteBarrier((&___s_List_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SELECTABLE_T3916939825_H
#ifndef INPUTFIELD_T3950490122_H
#define INPUTFIELD_T3950490122_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.InputField
struct InputField_t3950490122 : public Selectable_t3916939825
{
public:
// UnityEngine.TouchScreenKeyboard UnityEngine.UI.InputField::m_Keyboard
TouchScreenKeyboard_t1595360201 * ___m_Keyboard_16;
// UnityEngine.UI.Text UnityEngine.UI.InputField::m_TextComponent
Text_t2925720878 * ___m_TextComponent_18;
// UnityEngine.UI.Graphic UnityEngine.UI.InputField::m_Placeholder
Graphic_t535825046 * ___m_Placeholder_19;
// UnityEngine.UI.InputField/ContentType UnityEngine.UI.InputField::m_ContentType
int32_t ___m_ContentType_20;
// UnityEngine.UI.InputField/InputType UnityEngine.UI.InputField::m_InputType
int32_t ___m_InputType_21;
// System.Char UnityEngine.UI.InputField::m_AsteriskChar
Il2CppChar ___m_AsteriskChar_22;
// UnityEngine.TouchScreenKeyboardType UnityEngine.UI.InputField::m_KeyboardType
int32_t ___m_KeyboardType_23;
// UnityEngine.UI.InputField/LineType UnityEngine.UI.InputField::m_LineType
int32_t ___m_LineType_24;
// System.Boolean UnityEngine.UI.InputField::m_HideMobileInput
bool ___m_HideMobileInput_25;
// UnityEngine.UI.InputField/CharacterValidation UnityEngine.UI.InputField::m_CharacterValidation
int32_t ___m_CharacterValidation_26;
// System.Int32 UnityEngine.UI.InputField::m_CharacterLimit
int32_t ___m_CharacterLimit_27;
// UnityEngine.UI.InputField/SubmitEvent UnityEngine.UI.InputField::m_OnEndEdit
SubmitEvent_t2550651048 * ___m_OnEndEdit_28;
// UnityEngine.UI.InputField/OnChangeEvent UnityEngine.UI.InputField::m_OnValueChanged
OnChangeEvent_t970128749 * ___m_OnValueChanged_29;
// UnityEngine.UI.InputField/OnValidateInput UnityEngine.UI.InputField::m_OnValidateInput
OnValidateInput_t977755270 * ___m_OnValidateInput_30;
// UnityEngine.Color UnityEngine.UI.InputField::m_CaretColor
Color_t267620335 ___m_CaretColor_31;
// System.Boolean UnityEngine.UI.InputField::m_CustomCaretColor
bool ___m_CustomCaretColor_32;
// UnityEngine.Color UnityEngine.UI.InputField::m_SelectionColor
Color_t267620335 ___m_SelectionColor_33;
// System.String UnityEngine.UI.InputField::m_Text
String_t* ___m_Text_34;
// System.Single UnityEngine.UI.InputField::m_CaretBlinkRate
float ___m_CaretBlinkRate_35;
// System.Int32 UnityEngine.UI.InputField::m_CaretWidth
int32_t ___m_CaretWidth_36;
// System.Boolean UnityEngine.UI.InputField::m_ReadOnly
bool ___m_ReadOnly_37;
// System.Int32 UnityEngine.UI.InputField::m_CaretPosition
int32_t ___m_CaretPosition_38;
// System.Int32 UnityEngine.UI.InputField::m_CaretSelectPosition
int32_t ___m_CaretSelectPosition_39;
// UnityEngine.RectTransform UnityEngine.UI.InputField::caretRectTrans
RectTransform_t3700156813 * ___caretRectTrans_40;
// UnityEngine.UIVertex[] UnityEngine.UI.InputField::m_CursorVerts
UIVertexU5BU5D_t2534070687* ___m_CursorVerts_41;
// UnityEngine.TextGenerator UnityEngine.UI.InputField::m_InputTextCache
TextGenerator_t1838611233 * ___m_InputTextCache_42;
// UnityEngine.CanvasRenderer UnityEngine.UI.InputField::m_CachedInputRenderer
CanvasRenderer_t4042724174 * ___m_CachedInputRenderer_43;
// System.Boolean UnityEngine.UI.InputField::m_PreventFontCallback
bool ___m_PreventFontCallback_44;
// UnityEngine.Mesh UnityEngine.UI.InputField::m_Mesh
Mesh_t3666751399 * ___m_Mesh_45;
// System.Boolean UnityEngine.UI.InputField::m_AllowInput
bool ___m_AllowInput_46;
// System.Boolean UnityEngine.UI.InputField::m_ShouldActivateNextUpdate
bool ___m_ShouldActivateNextUpdate_47;
// System.Boolean UnityEngine.UI.InputField::m_UpdateDrag
bool ___m_UpdateDrag_48;
// System.Boolean UnityEngine.UI.InputField::m_DragPositionOutOfBounds
bool ___m_DragPositionOutOfBounds_49;
// System.Boolean UnityEngine.UI.InputField::m_CaretVisible
bool ___m_CaretVisible_52;
// UnityEngine.Coroutine UnityEngine.UI.InputField::m_BlinkCoroutine
Coroutine_t3331234651 * ___m_BlinkCoroutine_53;
// System.Single UnityEngine.UI.InputField::m_BlinkStartTime
float ___m_BlinkStartTime_54;
// System.Int32 UnityEngine.UI.InputField::m_DrawStart
int32_t ___m_DrawStart_55;
// System.Int32 UnityEngine.UI.InputField::m_DrawEnd
int32_t ___m_DrawEnd_56;
// UnityEngine.Coroutine UnityEngine.UI.InputField::m_DragCoroutine
Coroutine_t3331234651 * ___m_DragCoroutine_57;
// System.String UnityEngine.UI.InputField::m_OriginalText
String_t* ___m_OriginalText_58;
// System.Boolean UnityEngine.UI.InputField::m_WasCanceled
bool ___m_WasCanceled_59;
// System.Boolean UnityEngine.UI.InputField::m_HasDoneFocusTransition
bool ___m_HasDoneFocusTransition_60;
// UnityEngine.Event UnityEngine.UI.InputField::m_ProcessingEvent
Event_t1644639841 * ___m_ProcessingEvent_62;
public:
inline static int32_t get_offset_of_m_Keyboard_16() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_Keyboard_16)); }
inline TouchScreenKeyboard_t1595360201 * get_m_Keyboard_16() const { return ___m_Keyboard_16; }
inline TouchScreenKeyboard_t1595360201 ** get_address_of_m_Keyboard_16() { return &___m_Keyboard_16; }
inline void set_m_Keyboard_16(TouchScreenKeyboard_t1595360201 * value)
{
___m_Keyboard_16 = value;
Il2CppCodeGenWriteBarrier((&___m_Keyboard_16), value);
}
inline static int32_t get_offset_of_m_TextComponent_18() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_TextComponent_18)); }
inline Text_t2925720878 * get_m_TextComponent_18() const { return ___m_TextComponent_18; }
inline Text_t2925720878 ** get_address_of_m_TextComponent_18() { return &___m_TextComponent_18; }
inline void set_m_TextComponent_18(Text_t2925720878 * value)
{
___m_TextComponent_18 = value;
Il2CppCodeGenWriteBarrier((&___m_TextComponent_18), value);
}
inline static int32_t get_offset_of_m_Placeholder_19() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_Placeholder_19)); }
inline Graphic_t535825046 * get_m_Placeholder_19() const { return ___m_Placeholder_19; }
inline Graphic_t535825046 ** get_address_of_m_Placeholder_19() { return &___m_Placeholder_19; }
inline void set_m_Placeholder_19(Graphic_t535825046 * value)
{
___m_Placeholder_19 = value;
Il2CppCodeGenWriteBarrier((&___m_Placeholder_19), value);
}
inline static int32_t get_offset_of_m_ContentType_20() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_ContentType_20)); }
inline int32_t get_m_ContentType_20() const { return ___m_ContentType_20; }
inline int32_t* get_address_of_m_ContentType_20() { return &___m_ContentType_20; }
inline void set_m_ContentType_20(int32_t value)
{
___m_ContentType_20 = value;
}
inline static int32_t get_offset_of_m_InputType_21() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_InputType_21)); }
inline int32_t get_m_InputType_21() const { return ___m_InputType_21; }
inline int32_t* get_address_of_m_InputType_21() { return &___m_InputType_21; }
inline void set_m_InputType_21(int32_t value)
{
___m_InputType_21 = value;
}
inline static int32_t get_offset_of_m_AsteriskChar_22() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_AsteriskChar_22)); }
inline Il2CppChar get_m_AsteriskChar_22() const { return ___m_AsteriskChar_22; }
inline Il2CppChar* get_address_of_m_AsteriskChar_22() { return &___m_AsteriskChar_22; }
inline void set_m_AsteriskChar_22(Il2CppChar value)
{
___m_AsteriskChar_22 = value;
}
inline static int32_t get_offset_of_m_KeyboardType_23() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_KeyboardType_23)); }
inline int32_t get_m_KeyboardType_23() const { return ___m_KeyboardType_23; }
inline int32_t* get_address_of_m_KeyboardType_23() { return &___m_KeyboardType_23; }
inline void set_m_KeyboardType_23(int32_t value)
{
___m_KeyboardType_23 = value;
}
inline static int32_t get_offset_of_m_LineType_24() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_LineType_24)); }
inline int32_t get_m_LineType_24() const { return ___m_LineType_24; }
inline int32_t* get_address_of_m_LineType_24() { return &___m_LineType_24; }
inline void set_m_LineType_24(int32_t value)
{
___m_LineType_24 = value;
}
inline static int32_t get_offset_of_m_HideMobileInput_25() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_HideMobileInput_25)); }
inline bool get_m_HideMobileInput_25() const { return ___m_HideMobileInput_25; }
inline bool* get_address_of_m_HideMobileInput_25() { return &___m_HideMobileInput_25; }
inline void set_m_HideMobileInput_25(bool value)
{
___m_HideMobileInput_25 = value;
}
inline static int32_t get_offset_of_m_CharacterValidation_26() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CharacterValidation_26)); }
inline int32_t get_m_CharacterValidation_26() const { return ___m_CharacterValidation_26; }
inline int32_t* get_address_of_m_CharacterValidation_26() { return &___m_CharacterValidation_26; }
inline void set_m_CharacterValidation_26(int32_t value)
{
___m_CharacterValidation_26 = value;
}
inline static int32_t get_offset_of_m_CharacterLimit_27() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CharacterLimit_27)); }
inline int32_t get_m_CharacterLimit_27() const { return ___m_CharacterLimit_27; }
inline int32_t* get_address_of_m_CharacterLimit_27() { return &___m_CharacterLimit_27; }
inline void set_m_CharacterLimit_27(int32_t value)
{
___m_CharacterLimit_27 = value;
}
inline static int32_t get_offset_of_m_OnEndEdit_28() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_OnEndEdit_28)); }
inline SubmitEvent_t2550651048 * get_m_OnEndEdit_28() const { return ___m_OnEndEdit_28; }
inline SubmitEvent_t2550651048 ** get_address_of_m_OnEndEdit_28() { return &___m_OnEndEdit_28; }
inline void set_m_OnEndEdit_28(SubmitEvent_t2550651048 * value)
{
___m_OnEndEdit_28 = value;
Il2CppCodeGenWriteBarrier((&___m_OnEndEdit_28), value);
}
inline static int32_t get_offset_of_m_OnValueChanged_29() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_OnValueChanged_29)); }
inline OnChangeEvent_t970128749 * get_m_OnValueChanged_29() const { return ___m_OnValueChanged_29; }
inline OnChangeEvent_t970128749 ** get_address_of_m_OnValueChanged_29() { return &___m_OnValueChanged_29; }
inline void set_m_OnValueChanged_29(OnChangeEvent_t970128749 * value)
{
___m_OnValueChanged_29 = value;
Il2CppCodeGenWriteBarrier((&___m_OnValueChanged_29), value);
}
inline static int32_t get_offset_of_m_OnValidateInput_30() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_OnValidateInput_30)); }
inline OnValidateInput_t977755270 * get_m_OnValidateInput_30() const { return ___m_OnValidateInput_30; }
inline OnValidateInput_t977755270 ** get_address_of_m_OnValidateInput_30() { return &___m_OnValidateInput_30; }
inline void set_m_OnValidateInput_30(OnValidateInput_t977755270 * value)
{
___m_OnValidateInput_30 = value;
Il2CppCodeGenWriteBarrier((&___m_OnValidateInput_30), value);
}
inline static int32_t get_offset_of_m_CaretColor_31() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CaretColor_31)); }
inline Color_t267620335 get_m_CaretColor_31() const { return ___m_CaretColor_31; }
inline Color_t267620335 * get_address_of_m_CaretColor_31() { return &___m_CaretColor_31; }
inline void set_m_CaretColor_31(Color_t267620335 value)
{
___m_CaretColor_31 = value;
}
inline static int32_t get_offset_of_m_CustomCaretColor_32() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CustomCaretColor_32)); }
inline bool get_m_CustomCaretColor_32() const { return ___m_CustomCaretColor_32; }
inline bool* get_address_of_m_CustomCaretColor_32() { return &___m_CustomCaretColor_32; }
inline void set_m_CustomCaretColor_32(bool value)
{
___m_CustomCaretColor_32 = value;
}
inline static int32_t get_offset_of_m_SelectionColor_33() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_SelectionColor_33)); }
inline Color_t267620335 get_m_SelectionColor_33() const { return ___m_SelectionColor_33; }
inline Color_t267620335 * get_address_of_m_SelectionColor_33() { return &___m_SelectionColor_33; }
inline void set_m_SelectionColor_33(Color_t267620335 value)
{
___m_SelectionColor_33 = value;
}
inline static int32_t get_offset_of_m_Text_34() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_Text_34)); }
inline String_t* get_m_Text_34() const { return ___m_Text_34; }
inline String_t** get_address_of_m_Text_34() { return &___m_Text_34; }
inline void set_m_Text_34(String_t* value)
{
___m_Text_34 = value;
Il2CppCodeGenWriteBarrier((&___m_Text_34), value);
}
inline static int32_t get_offset_of_m_CaretBlinkRate_35() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CaretBlinkRate_35)); }
inline float get_m_CaretBlinkRate_35() const { return ___m_CaretBlinkRate_35; }
inline float* get_address_of_m_CaretBlinkRate_35() { return &___m_CaretBlinkRate_35; }
inline void set_m_CaretBlinkRate_35(float value)
{
___m_CaretBlinkRate_35 = value;
}
inline static int32_t get_offset_of_m_CaretWidth_36() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CaretWidth_36)); }
inline int32_t get_m_CaretWidth_36() const { return ___m_CaretWidth_36; }
inline int32_t* get_address_of_m_CaretWidth_36() { return &___m_CaretWidth_36; }
inline void set_m_CaretWidth_36(int32_t value)
{
___m_CaretWidth_36 = value;
}
inline static int32_t get_offset_of_m_ReadOnly_37() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_ReadOnly_37)); }
inline bool get_m_ReadOnly_37() const { return ___m_ReadOnly_37; }
inline bool* get_address_of_m_ReadOnly_37() { return &___m_ReadOnly_37; }
inline void set_m_ReadOnly_37(bool value)
{
___m_ReadOnly_37 = value;
}
inline static int32_t get_offset_of_m_CaretPosition_38() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CaretPosition_38)); }
inline int32_t get_m_CaretPosition_38() const { return ___m_CaretPosition_38; }
inline int32_t* get_address_of_m_CaretPosition_38() { return &___m_CaretPosition_38; }
inline void set_m_CaretPosition_38(int32_t value)
{
___m_CaretPosition_38 = value;
}
inline static int32_t get_offset_of_m_CaretSelectPosition_39() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CaretSelectPosition_39)); }
inline int32_t get_m_CaretSelectPosition_39() const { return ___m_CaretSelectPosition_39; }
inline int32_t* get_address_of_m_CaretSelectPosition_39() { return &___m_CaretSelectPosition_39; }
inline void set_m_CaretSelectPosition_39(int32_t value)
{
___m_CaretSelectPosition_39 = value;
}
inline static int32_t get_offset_of_caretRectTrans_40() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___caretRectTrans_40)); }
inline RectTransform_t3700156813 * get_caretRectTrans_40() const { return ___caretRectTrans_40; }
inline RectTransform_t3700156813 ** get_address_of_caretRectTrans_40() { return &___caretRectTrans_40; }
inline void set_caretRectTrans_40(RectTransform_t3700156813 * value)
{
___caretRectTrans_40 = value;
Il2CppCodeGenWriteBarrier((&___caretRectTrans_40), value);
}
inline static int32_t get_offset_of_m_CursorVerts_41() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CursorVerts_41)); }
inline UIVertexU5BU5D_t2534070687* get_m_CursorVerts_41() const { return ___m_CursorVerts_41; }
inline UIVertexU5BU5D_t2534070687** get_address_of_m_CursorVerts_41() { return &___m_CursorVerts_41; }
inline void set_m_CursorVerts_41(UIVertexU5BU5D_t2534070687* value)
{
___m_CursorVerts_41 = value;
Il2CppCodeGenWriteBarrier((&___m_CursorVerts_41), value);
}
inline static int32_t get_offset_of_m_InputTextCache_42() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_InputTextCache_42)); }
inline TextGenerator_t1838611233 * get_m_InputTextCache_42() const { return ___m_InputTextCache_42; }
inline TextGenerator_t1838611233 ** get_address_of_m_InputTextCache_42() { return &___m_InputTextCache_42; }
inline void set_m_InputTextCache_42(TextGenerator_t1838611233 * value)
{
___m_InputTextCache_42 = value;
Il2CppCodeGenWriteBarrier((&___m_InputTextCache_42), value);
}
inline static int32_t get_offset_of_m_CachedInputRenderer_43() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CachedInputRenderer_43)); }
inline CanvasRenderer_t4042724174 * get_m_CachedInputRenderer_43() const { return ___m_CachedInputRenderer_43; }
inline CanvasRenderer_t4042724174 ** get_address_of_m_CachedInputRenderer_43() { return &___m_CachedInputRenderer_43; }
inline void set_m_CachedInputRenderer_43(CanvasRenderer_t4042724174 * value)
{
___m_CachedInputRenderer_43 = value;
Il2CppCodeGenWriteBarrier((&___m_CachedInputRenderer_43), value);
}
inline static int32_t get_offset_of_m_PreventFontCallback_44() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_PreventFontCallback_44)); }
inline bool get_m_PreventFontCallback_44() const { return ___m_PreventFontCallback_44; }
inline bool* get_address_of_m_PreventFontCallback_44() { return &___m_PreventFontCallback_44; }
inline void set_m_PreventFontCallback_44(bool value)
{
___m_PreventFontCallback_44 = value;
}
inline static int32_t get_offset_of_m_Mesh_45() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_Mesh_45)); }
inline Mesh_t3666751399 * get_m_Mesh_45() const { return ___m_Mesh_45; }
inline Mesh_t3666751399 ** get_address_of_m_Mesh_45() { return &___m_Mesh_45; }
inline void set_m_Mesh_45(Mesh_t3666751399 * value)
{
___m_Mesh_45 = value;
Il2CppCodeGenWriteBarrier((&___m_Mesh_45), value);
}
inline static int32_t get_offset_of_m_AllowInput_46() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_AllowInput_46)); }
inline bool get_m_AllowInput_46() const { return ___m_AllowInput_46; }
inline bool* get_address_of_m_AllowInput_46() { return &___m_AllowInput_46; }
inline void set_m_AllowInput_46(bool value)
{
___m_AllowInput_46 = value;
}
inline static int32_t get_offset_of_m_ShouldActivateNextUpdate_47() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_ShouldActivateNextUpdate_47)); }
inline bool get_m_ShouldActivateNextUpdate_47() const { return ___m_ShouldActivateNextUpdate_47; }
inline bool* get_address_of_m_ShouldActivateNextUpdate_47() { return &___m_ShouldActivateNextUpdate_47; }
inline void set_m_ShouldActivateNextUpdate_47(bool value)
{
___m_ShouldActivateNextUpdate_47 = value;
}
inline static int32_t get_offset_of_m_UpdateDrag_48() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_UpdateDrag_48)); }
inline bool get_m_UpdateDrag_48() const { return ___m_UpdateDrag_48; }
inline bool* get_address_of_m_UpdateDrag_48() { return &___m_UpdateDrag_48; }
inline void set_m_UpdateDrag_48(bool value)
{
___m_UpdateDrag_48 = value;
}
inline static int32_t get_offset_of_m_DragPositionOutOfBounds_49() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_DragPositionOutOfBounds_49)); }
inline bool get_m_DragPositionOutOfBounds_49() const { return ___m_DragPositionOutOfBounds_49; }
inline bool* get_address_of_m_DragPositionOutOfBounds_49() { return &___m_DragPositionOutOfBounds_49; }
inline void set_m_DragPositionOutOfBounds_49(bool value)
{
___m_DragPositionOutOfBounds_49 = value;
}
inline static int32_t get_offset_of_m_CaretVisible_52() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_CaretVisible_52)); }
inline bool get_m_CaretVisible_52() const { return ___m_CaretVisible_52; }
inline bool* get_address_of_m_CaretVisible_52() { return &___m_CaretVisible_52; }
inline void set_m_CaretVisible_52(bool value)
{
___m_CaretVisible_52 = value;
}
inline static int32_t get_offset_of_m_BlinkCoroutine_53() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_BlinkCoroutine_53)); }
inline Coroutine_t3331234651 * get_m_BlinkCoroutine_53() const { return ___m_BlinkCoroutine_53; }
inline Coroutine_t3331234651 ** get_address_of_m_BlinkCoroutine_53() { return &___m_BlinkCoroutine_53; }
inline void set_m_BlinkCoroutine_53(Coroutine_t3331234651 * value)
{
___m_BlinkCoroutine_53 = value;
Il2CppCodeGenWriteBarrier((&___m_BlinkCoroutine_53), value);
}
inline static int32_t get_offset_of_m_BlinkStartTime_54() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_BlinkStartTime_54)); }
inline float get_m_BlinkStartTime_54() const { return ___m_BlinkStartTime_54; }
inline float* get_address_of_m_BlinkStartTime_54() { return &___m_BlinkStartTime_54; }
inline void set_m_BlinkStartTime_54(float value)
{
___m_BlinkStartTime_54 = value;
}
inline static int32_t get_offset_of_m_DrawStart_55() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_DrawStart_55)); }
inline int32_t get_m_DrawStart_55() const { return ___m_DrawStart_55; }
inline int32_t* get_address_of_m_DrawStart_55() { return &___m_DrawStart_55; }
inline void set_m_DrawStart_55(int32_t value)
{
___m_DrawStart_55 = value;
}
inline static int32_t get_offset_of_m_DrawEnd_56() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_DrawEnd_56)); }
inline int32_t get_m_DrawEnd_56() const { return ___m_DrawEnd_56; }
inline int32_t* get_address_of_m_DrawEnd_56() { return &___m_DrawEnd_56; }
inline void set_m_DrawEnd_56(int32_t value)
{
___m_DrawEnd_56 = value;
}
inline static int32_t get_offset_of_m_DragCoroutine_57() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_DragCoroutine_57)); }
inline Coroutine_t3331234651 * get_m_DragCoroutine_57() const { return ___m_DragCoroutine_57; }
inline Coroutine_t3331234651 ** get_address_of_m_DragCoroutine_57() { return &___m_DragCoroutine_57; }
inline void set_m_DragCoroutine_57(Coroutine_t3331234651 * value)
{
___m_DragCoroutine_57 = value;
Il2CppCodeGenWriteBarrier((&___m_DragCoroutine_57), value);
}
inline static int32_t get_offset_of_m_OriginalText_58() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_OriginalText_58)); }
inline String_t* get_m_OriginalText_58() const { return ___m_OriginalText_58; }
inline String_t** get_address_of_m_OriginalText_58() { return &___m_OriginalText_58; }
inline void set_m_OriginalText_58(String_t* value)
{
___m_OriginalText_58 = value;
Il2CppCodeGenWriteBarrier((&___m_OriginalText_58), value);
}
inline static int32_t get_offset_of_m_WasCanceled_59() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_WasCanceled_59)); }
inline bool get_m_WasCanceled_59() const { return ___m_WasCanceled_59; }
inline bool* get_address_of_m_WasCanceled_59() { return &___m_WasCanceled_59; }
inline void set_m_WasCanceled_59(bool value)
{
___m_WasCanceled_59 = value;
}
inline static int32_t get_offset_of_m_HasDoneFocusTransition_60() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_HasDoneFocusTransition_60)); }
inline bool get_m_HasDoneFocusTransition_60() const { return ___m_HasDoneFocusTransition_60; }
inline bool* get_address_of_m_HasDoneFocusTransition_60() { return &___m_HasDoneFocusTransition_60; }
inline void set_m_HasDoneFocusTransition_60(bool value)
{
___m_HasDoneFocusTransition_60 = value;
}
inline static int32_t get_offset_of_m_ProcessingEvent_62() { return static_cast<int32_t>(offsetof(InputField_t3950490122, ___m_ProcessingEvent_62)); }
inline Event_t1644639841 * get_m_ProcessingEvent_62() const { return ___m_ProcessingEvent_62; }
inline Event_t1644639841 ** get_address_of_m_ProcessingEvent_62() { return &___m_ProcessingEvent_62; }
inline void set_m_ProcessingEvent_62(Event_t1644639841 * value)
{
___m_ProcessingEvent_62 = value;
Il2CppCodeGenWriteBarrier((&___m_ProcessingEvent_62), value);
}
};
struct InputField_t3950490122_StaticFields
{
public:
// System.Char[] UnityEngine.UI.InputField::kSeparators
CharU5BU5D_t1522321484* ___kSeparators_17;
public:
inline static int32_t get_offset_of_kSeparators_17() { return static_cast<int32_t>(offsetof(InputField_t3950490122_StaticFields, ___kSeparators_17)); }
inline CharU5BU5D_t1522321484* get_kSeparators_17() const { return ___kSeparators_17; }
inline CharU5BU5D_t1522321484** get_address_of_kSeparators_17() { return &___kSeparators_17; }
inline void set_kSeparators_17(CharU5BU5D_t1522321484* value)
{
___kSeparators_17 = value;
Il2CppCodeGenWriteBarrier((&___kSeparators_17), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INPUTFIELD_T3950490122_H
#ifndef MASKABLEGRAPHIC_T1515231992_H
#define MASKABLEGRAPHIC_T1515231992_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.MaskableGraphic
struct MaskableGraphic_t1515231992 : public Graphic_t535825046
{
public:
// System.Boolean UnityEngine.UI.MaskableGraphic::m_ShouldRecalculateStencil
bool ___m_ShouldRecalculateStencil_19;
// UnityEngine.Material UnityEngine.UI.MaskableGraphic::m_MaskMaterial
Material_t3939796247 * ___m_MaskMaterial_20;
// UnityEngine.UI.RectMask2D UnityEngine.UI.MaskableGraphic::m_ParentMask
RectMask2D_t2399484214 * ___m_ParentMask_21;
// System.Boolean UnityEngine.UI.MaskableGraphic::m_Maskable
bool ___m_Maskable_22;
// System.Boolean UnityEngine.UI.MaskableGraphic::m_IncludeForMasking
bool ___m_IncludeForMasking_23;
// UnityEngine.UI.MaskableGraphic/CullStateChangedEvent UnityEngine.UI.MaskableGraphic::m_OnCullStateChanged
CullStateChangedEvent_t2536871658 * ___m_OnCullStateChanged_24;
// System.Boolean UnityEngine.UI.MaskableGraphic::m_ShouldRecalculate
bool ___m_ShouldRecalculate_25;
// System.Int32 UnityEngine.UI.MaskableGraphic::m_StencilValue
int32_t ___m_StencilValue_26;
// UnityEngine.Vector3[] UnityEngine.UI.MaskableGraphic::m_Corners
Vector3U5BU5D_t2251457841* ___m_Corners_27;
public:
inline static int32_t get_offset_of_m_ShouldRecalculateStencil_19() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_ShouldRecalculateStencil_19)); }
inline bool get_m_ShouldRecalculateStencil_19() const { return ___m_ShouldRecalculateStencil_19; }
inline bool* get_address_of_m_ShouldRecalculateStencil_19() { return &___m_ShouldRecalculateStencil_19; }
inline void set_m_ShouldRecalculateStencil_19(bool value)
{
___m_ShouldRecalculateStencil_19 = value;
}
inline static int32_t get_offset_of_m_MaskMaterial_20() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_MaskMaterial_20)); }
inline Material_t3939796247 * get_m_MaskMaterial_20() const { return ___m_MaskMaterial_20; }
inline Material_t3939796247 ** get_address_of_m_MaskMaterial_20() { return &___m_MaskMaterial_20; }
inline void set_m_MaskMaterial_20(Material_t3939796247 * value)
{
___m_MaskMaterial_20 = value;
Il2CppCodeGenWriteBarrier((&___m_MaskMaterial_20), value);
}
inline static int32_t get_offset_of_m_ParentMask_21() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_ParentMask_21)); }
inline RectMask2D_t2399484214 * get_m_ParentMask_21() const { return ___m_ParentMask_21; }
inline RectMask2D_t2399484214 ** get_address_of_m_ParentMask_21() { return &___m_ParentMask_21; }
inline void set_m_ParentMask_21(RectMask2D_t2399484214 * value)
{
___m_ParentMask_21 = value;
Il2CppCodeGenWriteBarrier((&___m_ParentMask_21), value);
}
inline static int32_t get_offset_of_m_Maskable_22() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_Maskable_22)); }
inline bool get_m_Maskable_22() const { return ___m_Maskable_22; }
inline bool* get_address_of_m_Maskable_22() { return &___m_Maskable_22; }
inline void set_m_Maskable_22(bool value)
{
___m_Maskable_22 = value;
}
inline static int32_t get_offset_of_m_IncludeForMasking_23() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_IncludeForMasking_23)); }
inline bool get_m_IncludeForMasking_23() const { return ___m_IncludeForMasking_23; }
inline bool* get_address_of_m_IncludeForMasking_23() { return &___m_IncludeForMasking_23; }
inline void set_m_IncludeForMasking_23(bool value)
{
___m_IncludeForMasking_23 = value;
}
inline static int32_t get_offset_of_m_OnCullStateChanged_24() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_OnCullStateChanged_24)); }
inline CullStateChangedEvent_t2536871658 * get_m_OnCullStateChanged_24() const { return ___m_OnCullStateChanged_24; }
inline CullStateChangedEvent_t2536871658 ** get_address_of_m_OnCullStateChanged_24() { return &___m_OnCullStateChanged_24; }
inline void set_m_OnCullStateChanged_24(CullStateChangedEvent_t2536871658 * value)
{
___m_OnCullStateChanged_24 = value;
Il2CppCodeGenWriteBarrier((&___m_OnCullStateChanged_24), value);
}
inline static int32_t get_offset_of_m_ShouldRecalculate_25() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_ShouldRecalculate_25)); }
inline bool get_m_ShouldRecalculate_25() const { return ___m_ShouldRecalculate_25; }
inline bool* get_address_of_m_ShouldRecalculate_25() { return &___m_ShouldRecalculate_25; }
inline void set_m_ShouldRecalculate_25(bool value)
{
___m_ShouldRecalculate_25 = value;
}
inline static int32_t get_offset_of_m_StencilValue_26() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_StencilValue_26)); }
inline int32_t get_m_StencilValue_26() const { return ___m_StencilValue_26; }
inline int32_t* get_address_of_m_StencilValue_26() { return &___m_StencilValue_26; }
inline void set_m_StencilValue_26(int32_t value)
{
___m_StencilValue_26 = value;
}
inline static int32_t get_offset_of_m_Corners_27() { return static_cast<int32_t>(offsetof(MaskableGraphic_t1515231992, ___m_Corners_27)); }
inline Vector3U5BU5D_t2251457841* get_m_Corners_27() const { return ___m_Corners_27; }
inline Vector3U5BU5D_t2251457841** get_address_of_m_Corners_27() { return &___m_Corners_27; }
inline void set_m_Corners_27(Vector3U5BU5D_t2251457841* value)
{
___m_Corners_27 = value;
Il2CppCodeGenWriteBarrier((&___m_Corners_27), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MASKABLEGRAPHIC_T1515231992_H
#ifndef SCROLLBAR_T3517713769_H
#define SCROLLBAR_T3517713769_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Scrollbar
struct Scrollbar_t3517713769 : public Selectable_t3916939825
{
public:
// UnityEngine.RectTransform UnityEngine.UI.Scrollbar::m_HandleRect
RectTransform_t3700156813 * ___m_HandleRect_16;
// UnityEngine.UI.Scrollbar/Direction UnityEngine.UI.Scrollbar::m_Direction
int32_t ___m_Direction_17;
// System.Single UnityEngine.UI.Scrollbar::m_Value
float ___m_Value_18;
// System.Single UnityEngine.UI.Scrollbar::m_Size
float ___m_Size_19;
// System.Int32 UnityEngine.UI.Scrollbar::m_NumberOfSteps
int32_t ___m_NumberOfSteps_20;
// UnityEngine.UI.Scrollbar/ScrollEvent UnityEngine.UI.Scrollbar::m_OnValueChanged
ScrollEvent_t2334911764 * ___m_OnValueChanged_21;
// UnityEngine.RectTransform UnityEngine.UI.Scrollbar::m_ContainerRect
RectTransform_t3700156813 * ___m_ContainerRect_22;
// UnityEngine.Vector2 UnityEngine.UI.Scrollbar::m_Offset
Vector2_t3854014517 ___m_Offset_23;
// UnityEngine.DrivenRectTransformTracker UnityEngine.UI.Scrollbar::m_Tracker
DrivenRectTransformTracker_t2435175526 ___m_Tracker_24;
// UnityEngine.Coroutine UnityEngine.UI.Scrollbar::m_PointerDownRepeat
Coroutine_t3331234651 * ___m_PointerDownRepeat_25;
// System.Boolean UnityEngine.UI.Scrollbar::isPointerDownAndNotDragging
bool ___isPointerDownAndNotDragging_26;
public:
inline static int32_t get_offset_of_m_HandleRect_16() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_HandleRect_16)); }
inline RectTransform_t3700156813 * get_m_HandleRect_16() const { return ___m_HandleRect_16; }
inline RectTransform_t3700156813 ** get_address_of_m_HandleRect_16() { return &___m_HandleRect_16; }
inline void set_m_HandleRect_16(RectTransform_t3700156813 * value)
{
___m_HandleRect_16 = value;
Il2CppCodeGenWriteBarrier((&___m_HandleRect_16), value);
}
inline static int32_t get_offset_of_m_Direction_17() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_Direction_17)); }
inline int32_t get_m_Direction_17() const { return ___m_Direction_17; }
inline int32_t* get_address_of_m_Direction_17() { return &___m_Direction_17; }
inline void set_m_Direction_17(int32_t value)
{
___m_Direction_17 = value;
}
inline static int32_t get_offset_of_m_Value_18() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_Value_18)); }
inline float get_m_Value_18() const { return ___m_Value_18; }
inline float* get_address_of_m_Value_18() { return &___m_Value_18; }
inline void set_m_Value_18(float value)
{
___m_Value_18 = value;
}
inline static int32_t get_offset_of_m_Size_19() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_Size_19)); }
inline float get_m_Size_19() const { return ___m_Size_19; }
inline float* get_address_of_m_Size_19() { return &___m_Size_19; }
inline void set_m_Size_19(float value)
{
___m_Size_19 = value;
}
inline static int32_t get_offset_of_m_NumberOfSteps_20() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_NumberOfSteps_20)); }
inline int32_t get_m_NumberOfSteps_20() const { return ___m_NumberOfSteps_20; }
inline int32_t* get_address_of_m_NumberOfSteps_20() { return &___m_NumberOfSteps_20; }
inline void set_m_NumberOfSteps_20(int32_t value)
{
___m_NumberOfSteps_20 = value;
}
inline static int32_t get_offset_of_m_OnValueChanged_21() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_OnValueChanged_21)); }
inline ScrollEvent_t2334911764 * get_m_OnValueChanged_21() const { return ___m_OnValueChanged_21; }
inline ScrollEvent_t2334911764 ** get_address_of_m_OnValueChanged_21() { return &___m_OnValueChanged_21; }
inline void set_m_OnValueChanged_21(ScrollEvent_t2334911764 * value)
{
___m_OnValueChanged_21 = value;
Il2CppCodeGenWriteBarrier((&___m_OnValueChanged_21), value);
}
inline static int32_t get_offset_of_m_ContainerRect_22() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_ContainerRect_22)); }
inline RectTransform_t3700156813 * get_m_ContainerRect_22() const { return ___m_ContainerRect_22; }
inline RectTransform_t3700156813 ** get_address_of_m_ContainerRect_22() { return &___m_ContainerRect_22; }
inline void set_m_ContainerRect_22(RectTransform_t3700156813 * value)
{
___m_ContainerRect_22 = value;
Il2CppCodeGenWriteBarrier((&___m_ContainerRect_22), value);
}
inline static int32_t get_offset_of_m_Offset_23() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_Offset_23)); }
inline Vector2_t3854014517 get_m_Offset_23() const { return ___m_Offset_23; }
inline Vector2_t3854014517 * get_address_of_m_Offset_23() { return &___m_Offset_23; }
inline void set_m_Offset_23(Vector2_t3854014517 value)
{
___m_Offset_23 = value;
}
inline static int32_t get_offset_of_m_Tracker_24() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_Tracker_24)); }
inline DrivenRectTransformTracker_t2435175526 get_m_Tracker_24() const { return ___m_Tracker_24; }
inline DrivenRectTransformTracker_t2435175526 * get_address_of_m_Tracker_24() { return &___m_Tracker_24; }
inline void set_m_Tracker_24(DrivenRectTransformTracker_t2435175526 value)
{
___m_Tracker_24 = value;
}
inline static int32_t get_offset_of_m_PointerDownRepeat_25() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___m_PointerDownRepeat_25)); }
inline Coroutine_t3331234651 * get_m_PointerDownRepeat_25() const { return ___m_PointerDownRepeat_25; }
inline Coroutine_t3331234651 ** get_address_of_m_PointerDownRepeat_25() { return &___m_PointerDownRepeat_25; }
inline void set_m_PointerDownRepeat_25(Coroutine_t3331234651 * value)
{
___m_PointerDownRepeat_25 = value;
Il2CppCodeGenWriteBarrier((&___m_PointerDownRepeat_25), value);
}
inline static int32_t get_offset_of_isPointerDownAndNotDragging_26() { return static_cast<int32_t>(offsetof(Scrollbar_t3517713769, ___isPointerDownAndNotDragging_26)); }
inline bool get_isPointerDownAndNotDragging_26() const { return ___isPointerDownAndNotDragging_26; }
inline bool* get_address_of_isPointerDownAndNotDragging_26() { return &___isPointerDownAndNotDragging_26; }
inline void set_isPointerDownAndNotDragging_26(bool value)
{
___isPointerDownAndNotDragging_26 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SCROLLBAR_T3517713769_H
#ifndef GRAPHICRAYCASTER_T121155276_H
#define GRAPHICRAYCASTER_T121155276_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.GraphicRaycaster
struct GraphicRaycaster_t121155276 : public BaseRaycaster_t2446964997
{
public:
// System.Boolean UnityEngine.UI.GraphicRaycaster::m_IgnoreReversedGraphics
bool ___m_IgnoreReversedGraphics_3;
// UnityEngine.UI.GraphicRaycaster/BlockingObjects UnityEngine.UI.GraphicRaycaster::m_BlockingObjects
int32_t ___m_BlockingObjects_4;
// UnityEngine.LayerMask UnityEngine.UI.GraphicRaycaster::m_BlockingMask
LayerMask_t2995007519 ___m_BlockingMask_5;
// UnityEngine.Canvas UnityEngine.UI.GraphicRaycaster::m_Canvas
Canvas_t2948613984 * ___m_Canvas_6;
// System.Collections.Generic.List`1<UnityEngine.UI.Graphic> UnityEngine.UI.GraphicRaycaster::m_RaycastResults
List_1_t4053678182 * ___m_RaycastResults_7;
public:
inline static int32_t get_offset_of_m_IgnoreReversedGraphics_3() { return static_cast<int32_t>(offsetof(GraphicRaycaster_t121155276, ___m_IgnoreReversedGraphics_3)); }
inline bool get_m_IgnoreReversedGraphics_3() const { return ___m_IgnoreReversedGraphics_3; }
inline bool* get_address_of_m_IgnoreReversedGraphics_3() { return &___m_IgnoreReversedGraphics_3; }
inline void set_m_IgnoreReversedGraphics_3(bool value)
{
___m_IgnoreReversedGraphics_3 = value;
}
inline static int32_t get_offset_of_m_BlockingObjects_4() { return static_cast<int32_t>(offsetof(GraphicRaycaster_t121155276, ___m_BlockingObjects_4)); }
inline int32_t get_m_BlockingObjects_4() const { return ___m_BlockingObjects_4; }
inline int32_t* get_address_of_m_BlockingObjects_4() { return &___m_BlockingObjects_4; }
inline void set_m_BlockingObjects_4(int32_t value)
{
___m_BlockingObjects_4 = value;
}
inline static int32_t get_offset_of_m_BlockingMask_5() { return static_cast<int32_t>(offsetof(GraphicRaycaster_t121155276, ___m_BlockingMask_5)); }
inline LayerMask_t2995007519 get_m_BlockingMask_5() const { return ___m_BlockingMask_5; }
inline LayerMask_t2995007519 * get_address_of_m_BlockingMask_5() { return &___m_BlockingMask_5; }
inline void set_m_BlockingMask_5(LayerMask_t2995007519 value)
{
___m_BlockingMask_5 = value;
}
inline static int32_t get_offset_of_m_Canvas_6() { return static_cast<int32_t>(offsetof(GraphicRaycaster_t121155276, ___m_Canvas_6)); }
inline Canvas_t2948613984 * get_m_Canvas_6() const { return ___m_Canvas_6; }
inline Canvas_t2948613984 ** get_address_of_m_Canvas_6() { return &___m_Canvas_6; }
inline void set_m_Canvas_6(Canvas_t2948613984 * value)
{
___m_Canvas_6 = value;
Il2CppCodeGenWriteBarrier((&___m_Canvas_6), value);
}
inline static int32_t get_offset_of_m_RaycastResults_7() { return static_cast<int32_t>(offsetof(GraphicRaycaster_t121155276, ___m_RaycastResults_7)); }
inline List_1_t4053678182 * get_m_RaycastResults_7() const { return ___m_RaycastResults_7; }
inline List_1_t4053678182 ** get_address_of_m_RaycastResults_7() { return &___m_RaycastResults_7; }
inline void set_m_RaycastResults_7(List_1_t4053678182 * value)
{
___m_RaycastResults_7 = value;
Il2CppCodeGenWriteBarrier((&___m_RaycastResults_7), value);
}
};
struct GraphicRaycaster_t121155276_StaticFields
{
public:
// System.Collections.Generic.List`1<UnityEngine.UI.Graphic> UnityEngine.UI.GraphicRaycaster::s_SortedGraphics
List_1_t4053678182 * ___s_SortedGraphics_8;
// System.Comparison`1<UnityEngine.UI.Graphic> UnityEngine.UI.GraphicRaycaster::<>f__am$cache0
Comparison_1_t466931136 * ___U3CU3Ef__amU24cache0_9;
public:
inline static int32_t get_offset_of_s_SortedGraphics_8() { return static_cast<int32_t>(offsetof(GraphicRaycaster_t121155276_StaticFields, ___s_SortedGraphics_8)); }
inline List_1_t4053678182 * get_s_SortedGraphics_8() const { return ___s_SortedGraphics_8; }
inline List_1_t4053678182 ** get_address_of_s_SortedGraphics_8() { return &___s_SortedGraphics_8; }
inline void set_s_SortedGraphics_8(List_1_t4053678182 * value)
{
___s_SortedGraphics_8 = value;
Il2CppCodeGenWriteBarrier((&___s_SortedGraphics_8), value);
}
inline static int32_t get_offset_of_U3CU3Ef__amU24cache0_9() { return static_cast<int32_t>(offsetof(GraphicRaycaster_t121155276_StaticFields, ___U3CU3Ef__amU24cache0_9)); }
inline Comparison_1_t466931136 * get_U3CU3Ef__amU24cache0_9() const { return ___U3CU3Ef__amU24cache0_9; }
inline Comparison_1_t466931136 ** get_address_of_U3CU3Ef__amU24cache0_9() { return &___U3CU3Ef__amU24cache0_9; }
inline void set_U3CU3Ef__amU24cache0_9(Comparison_1_t466931136 * value)
{
___U3CU3Ef__amU24cache0_9 = value;
Il2CppCodeGenWriteBarrier((&___U3CU3Ef__amU24cache0_9), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GRAPHICRAYCASTER_T121155276_H
#ifndef TOGGLE_T255761159_H
#define TOGGLE_T255761159_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Toggle
struct Toggle_t255761159 : public Selectable_t3916939825
{
public:
// UnityEngine.UI.Toggle/ToggleTransition UnityEngine.UI.Toggle::toggleTransition
int32_t ___toggleTransition_16;
// UnityEngine.UI.Graphic UnityEngine.UI.Toggle::graphic
Graphic_t535825046 * ___graphic_17;
// UnityEngine.UI.ToggleGroup UnityEngine.UI.Toggle::m_Group
ToggleGroup_t171083327 * ___m_Group_18;
// UnityEngine.UI.Toggle/ToggleEvent UnityEngine.UI.Toggle::onValueChanged
ToggleEvent_t538146237 * ___onValueChanged_19;
// System.Boolean UnityEngine.UI.Toggle::m_IsOn
bool ___m_IsOn_20;
public:
inline static int32_t get_offset_of_toggleTransition_16() { return static_cast<int32_t>(offsetof(Toggle_t255761159, ___toggleTransition_16)); }
inline int32_t get_toggleTransition_16() const { return ___toggleTransition_16; }
inline int32_t* get_address_of_toggleTransition_16() { return &___toggleTransition_16; }
inline void set_toggleTransition_16(int32_t value)
{
___toggleTransition_16 = value;
}
inline static int32_t get_offset_of_graphic_17() { return static_cast<int32_t>(offsetof(Toggle_t255761159, ___graphic_17)); }
inline Graphic_t535825046 * get_graphic_17() const { return ___graphic_17; }
inline Graphic_t535825046 ** get_address_of_graphic_17() { return &___graphic_17; }
inline void set_graphic_17(Graphic_t535825046 * value)
{
___graphic_17 = value;
Il2CppCodeGenWriteBarrier((&___graphic_17), value);
}
inline static int32_t get_offset_of_m_Group_18() { return static_cast<int32_t>(offsetof(Toggle_t255761159, ___m_Group_18)); }
inline ToggleGroup_t171083327 * get_m_Group_18() const { return ___m_Group_18; }
inline ToggleGroup_t171083327 ** get_address_of_m_Group_18() { return &___m_Group_18; }
inline void set_m_Group_18(ToggleGroup_t171083327 * value)
{
___m_Group_18 = value;
Il2CppCodeGenWriteBarrier((&___m_Group_18), value);
}
inline static int32_t get_offset_of_onValueChanged_19() { return static_cast<int32_t>(offsetof(Toggle_t255761159, ___onValueChanged_19)); }
inline ToggleEvent_t538146237 * get_onValueChanged_19() const { return ___onValueChanged_19; }
inline ToggleEvent_t538146237 ** get_address_of_onValueChanged_19() { return &___onValueChanged_19; }
inline void set_onValueChanged_19(ToggleEvent_t538146237 * value)
{
___onValueChanged_19 = value;
Il2CppCodeGenWriteBarrier((&___onValueChanged_19), value);
}
inline static int32_t get_offset_of_m_IsOn_20() { return static_cast<int32_t>(offsetof(Toggle_t255761159, ___m_IsOn_20)); }
inline bool get_m_IsOn_20() const { return ___m_IsOn_20; }
inline bool* get_address_of_m_IsOn_20() { return &___m_IsOn_20; }
inline void set_m_IsOn_20(bool value)
{
___m_IsOn_20 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TOGGLE_T255761159_H
#ifndef GRIDLAYOUTGROUP_T3942022971_H
#define GRIDLAYOUTGROUP_T3942022971_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.GridLayoutGroup
struct GridLayoutGroup_t3942022971 : public LayoutGroup_t3642062901
{
public:
// UnityEngine.UI.GridLayoutGroup/Corner UnityEngine.UI.GridLayoutGroup::m_StartCorner
int32_t ___m_StartCorner_10;
// UnityEngine.UI.GridLayoutGroup/Axis UnityEngine.UI.GridLayoutGroup::m_StartAxis
int32_t ___m_StartAxis_11;
// UnityEngine.Vector2 UnityEngine.UI.GridLayoutGroup::m_CellSize
Vector2_t3854014517 ___m_CellSize_12;
// UnityEngine.Vector2 UnityEngine.UI.GridLayoutGroup::m_Spacing
Vector2_t3854014517 ___m_Spacing_13;
// UnityEngine.UI.GridLayoutGroup/Constraint UnityEngine.UI.GridLayoutGroup::m_Constraint
int32_t ___m_Constraint_14;
// System.Int32 UnityEngine.UI.GridLayoutGroup::m_ConstraintCount
int32_t ___m_ConstraintCount_15;
public:
inline static int32_t get_offset_of_m_StartCorner_10() { return static_cast<int32_t>(offsetof(GridLayoutGroup_t3942022971, ___m_StartCorner_10)); }
inline int32_t get_m_StartCorner_10() const { return ___m_StartCorner_10; }
inline int32_t* get_address_of_m_StartCorner_10() { return &___m_StartCorner_10; }
inline void set_m_StartCorner_10(int32_t value)
{
___m_StartCorner_10 = value;
}
inline static int32_t get_offset_of_m_StartAxis_11() { return static_cast<int32_t>(offsetof(GridLayoutGroup_t3942022971, ___m_StartAxis_11)); }
inline int32_t get_m_StartAxis_11() const { return ___m_StartAxis_11; }
inline int32_t* get_address_of_m_StartAxis_11() { return &___m_StartAxis_11; }
inline void set_m_StartAxis_11(int32_t value)
{
___m_StartAxis_11 = value;
}
inline static int32_t get_offset_of_m_CellSize_12() { return static_cast<int32_t>(offsetof(GridLayoutGroup_t3942022971, ___m_CellSize_12)); }
inline Vector2_t3854014517 get_m_CellSize_12() const { return ___m_CellSize_12; }
inline Vector2_t3854014517 * get_address_of_m_CellSize_12() { return &___m_CellSize_12; }
inline void set_m_CellSize_12(Vector2_t3854014517 value)
{
___m_CellSize_12 = value;
}
inline static int32_t get_offset_of_m_Spacing_13() { return static_cast<int32_t>(offsetof(GridLayoutGroup_t3942022971, ___m_Spacing_13)); }
inline Vector2_t3854014517 get_m_Spacing_13() const { return ___m_Spacing_13; }
inline Vector2_t3854014517 * get_address_of_m_Spacing_13() { return &___m_Spacing_13; }
inline void set_m_Spacing_13(Vector2_t3854014517 value)
{
___m_Spacing_13 = value;
}
inline static int32_t get_offset_of_m_Constraint_14() { return static_cast<int32_t>(offsetof(GridLayoutGroup_t3942022971, ___m_Constraint_14)); }
inline int32_t get_m_Constraint_14() const { return ___m_Constraint_14; }
inline int32_t* get_address_of_m_Constraint_14() { return &___m_Constraint_14; }
inline void set_m_Constraint_14(int32_t value)
{
___m_Constraint_14 = value;
}
inline static int32_t get_offset_of_m_ConstraintCount_15() { return static_cast<int32_t>(offsetof(GridLayoutGroup_t3942022971, ___m_ConstraintCount_15)); }
inline int32_t get_m_ConstraintCount_15() const { return ___m_ConstraintCount_15; }
inline int32_t* get_address_of_m_ConstraintCount_15() { return &___m_ConstraintCount_15; }
inline void set_m_ConstraintCount_15(int32_t value)
{
___m_ConstraintCount_15 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // GRIDLAYOUTGROUP_T3942022971_H
#ifndef HORIZONTALORVERTICALLAYOUTGROUP_T786020932_H
#define HORIZONTALORVERTICALLAYOUTGROUP_T786020932_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.HorizontalOrVerticalLayoutGroup
struct HorizontalOrVerticalLayoutGroup_t786020932 : public LayoutGroup_t3642062901
{
public:
// System.Single UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_Spacing
float ___m_Spacing_10;
// System.Boolean UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_ChildForceExpandWidth
bool ___m_ChildForceExpandWidth_11;
// System.Boolean UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_ChildForceExpandHeight
bool ___m_ChildForceExpandHeight_12;
// System.Boolean UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_ChildControlWidth
bool ___m_ChildControlWidth_13;
// System.Boolean UnityEngine.UI.HorizontalOrVerticalLayoutGroup::m_ChildControlHeight
bool ___m_ChildControlHeight_14;
public:
inline static int32_t get_offset_of_m_Spacing_10() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_t786020932, ___m_Spacing_10)); }
inline float get_m_Spacing_10() const { return ___m_Spacing_10; }
inline float* get_address_of_m_Spacing_10() { return &___m_Spacing_10; }
inline void set_m_Spacing_10(float value)
{
___m_Spacing_10 = value;
}
inline static int32_t get_offset_of_m_ChildForceExpandWidth_11() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_t786020932, ___m_ChildForceExpandWidth_11)); }
inline bool get_m_ChildForceExpandWidth_11() const { return ___m_ChildForceExpandWidth_11; }
inline bool* get_address_of_m_ChildForceExpandWidth_11() { return &___m_ChildForceExpandWidth_11; }
inline void set_m_ChildForceExpandWidth_11(bool value)
{
___m_ChildForceExpandWidth_11 = value;
}
inline static int32_t get_offset_of_m_ChildForceExpandHeight_12() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_t786020932, ___m_ChildForceExpandHeight_12)); }
inline bool get_m_ChildForceExpandHeight_12() const { return ___m_ChildForceExpandHeight_12; }
inline bool* get_address_of_m_ChildForceExpandHeight_12() { return &___m_ChildForceExpandHeight_12; }
inline void set_m_ChildForceExpandHeight_12(bool value)
{
___m_ChildForceExpandHeight_12 = value;
}
inline static int32_t get_offset_of_m_ChildControlWidth_13() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_t786020932, ___m_ChildControlWidth_13)); }
inline bool get_m_ChildControlWidth_13() const { return ___m_ChildControlWidth_13; }
inline bool* get_address_of_m_ChildControlWidth_13() { return &___m_ChildControlWidth_13; }
inline void set_m_ChildControlWidth_13(bool value)
{
___m_ChildControlWidth_13 = value;
}
inline static int32_t get_offset_of_m_ChildControlHeight_14() { return static_cast<int32_t>(offsetof(HorizontalOrVerticalLayoutGroup_t786020932, ___m_ChildControlHeight_14)); }
inline bool get_m_ChildControlHeight_14() const { return ___m_ChildControlHeight_14; }
inline bool* get_address_of_m_ChildControlHeight_14() { return &___m_ChildControlHeight_14; }
inline void set_m_ChildControlHeight_14(bool value)
{
___m_ChildControlHeight_14 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // HORIZONTALORVERTICALLAYOUTGROUP_T786020932_H
#ifndef SLIDER_T546755744_H
#define SLIDER_T546755744_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Slider
struct Slider_t546755744 : public Selectable_t3916939825
{
public:
// UnityEngine.RectTransform UnityEngine.UI.Slider::m_FillRect
RectTransform_t3700156813 * ___m_FillRect_16;
// UnityEngine.RectTransform UnityEngine.UI.Slider::m_HandleRect
RectTransform_t3700156813 * ___m_HandleRect_17;
// UnityEngine.UI.Slider/Direction UnityEngine.UI.Slider::m_Direction
int32_t ___m_Direction_18;
// System.Single UnityEngine.UI.Slider::m_MinValue
float ___m_MinValue_19;
// System.Single UnityEngine.UI.Slider::m_MaxValue
float ___m_MaxValue_20;
// System.Boolean UnityEngine.UI.Slider::m_WholeNumbers
bool ___m_WholeNumbers_21;
// System.Single UnityEngine.UI.Slider::m_Value
float ___m_Value_22;
// UnityEngine.UI.Slider/SliderEvent UnityEngine.UI.Slider::m_OnValueChanged
SliderEvent_t260680582 * ___m_OnValueChanged_23;
// UnityEngine.UI.Image UnityEngine.UI.Slider::m_FillImage
Image_t2917938530 * ___m_FillImage_24;
// UnityEngine.Transform UnityEngine.UI.Slider::m_FillTransform
Transform_t2468616896 * ___m_FillTransform_25;
// UnityEngine.RectTransform UnityEngine.UI.Slider::m_FillContainerRect
RectTransform_t3700156813 * ___m_FillContainerRect_26;
// UnityEngine.Transform UnityEngine.UI.Slider::m_HandleTransform
Transform_t2468616896 * ___m_HandleTransform_27;
// UnityEngine.RectTransform UnityEngine.UI.Slider::m_HandleContainerRect
RectTransform_t3700156813 * ___m_HandleContainerRect_28;
// UnityEngine.Vector2 UnityEngine.UI.Slider::m_Offset
Vector2_t3854014517 ___m_Offset_29;
// UnityEngine.DrivenRectTransformTracker UnityEngine.UI.Slider::m_Tracker
DrivenRectTransformTracker_t2435175526 ___m_Tracker_30;
public:
inline static int32_t get_offset_of_m_FillRect_16() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_FillRect_16)); }
inline RectTransform_t3700156813 * get_m_FillRect_16() const { return ___m_FillRect_16; }
inline RectTransform_t3700156813 ** get_address_of_m_FillRect_16() { return &___m_FillRect_16; }
inline void set_m_FillRect_16(RectTransform_t3700156813 * value)
{
___m_FillRect_16 = value;
Il2CppCodeGenWriteBarrier((&___m_FillRect_16), value);
}
inline static int32_t get_offset_of_m_HandleRect_17() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_HandleRect_17)); }
inline RectTransform_t3700156813 * get_m_HandleRect_17() const { return ___m_HandleRect_17; }
inline RectTransform_t3700156813 ** get_address_of_m_HandleRect_17() { return &___m_HandleRect_17; }
inline void set_m_HandleRect_17(RectTransform_t3700156813 * value)
{
___m_HandleRect_17 = value;
Il2CppCodeGenWriteBarrier((&___m_HandleRect_17), value);
}
inline static int32_t get_offset_of_m_Direction_18() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_Direction_18)); }
inline int32_t get_m_Direction_18() const { return ___m_Direction_18; }
inline int32_t* get_address_of_m_Direction_18() { return &___m_Direction_18; }
inline void set_m_Direction_18(int32_t value)
{
___m_Direction_18 = value;
}
inline static int32_t get_offset_of_m_MinValue_19() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_MinValue_19)); }
inline float get_m_MinValue_19() const { return ___m_MinValue_19; }
inline float* get_address_of_m_MinValue_19() { return &___m_MinValue_19; }
inline void set_m_MinValue_19(float value)
{
___m_MinValue_19 = value;
}
inline static int32_t get_offset_of_m_MaxValue_20() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_MaxValue_20)); }
inline float get_m_MaxValue_20() const { return ___m_MaxValue_20; }
inline float* get_address_of_m_MaxValue_20() { return &___m_MaxValue_20; }
inline void set_m_MaxValue_20(float value)
{
___m_MaxValue_20 = value;
}
inline static int32_t get_offset_of_m_WholeNumbers_21() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_WholeNumbers_21)); }
inline bool get_m_WholeNumbers_21() const { return ___m_WholeNumbers_21; }
inline bool* get_address_of_m_WholeNumbers_21() { return &___m_WholeNumbers_21; }
inline void set_m_WholeNumbers_21(bool value)
{
___m_WholeNumbers_21 = value;
}
inline static int32_t get_offset_of_m_Value_22() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_Value_22)); }
inline float get_m_Value_22() const { return ___m_Value_22; }
inline float* get_address_of_m_Value_22() { return &___m_Value_22; }
inline void set_m_Value_22(float value)
{
___m_Value_22 = value;
}
inline static int32_t get_offset_of_m_OnValueChanged_23() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_OnValueChanged_23)); }
inline SliderEvent_t260680582 * get_m_OnValueChanged_23() const { return ___m_OnValueChanged_23; }
inline SliderEvent_t260680582 ** get_address_of_m_OnValueChanged_23() { return &___m_OnValueChanged_23; }
inline void set_m_OnValueChanged_23(SliderEvent_t260680582 * value)
{
___m_OnValueChanged_23 = value;
Il2CppCodeGenWriteBarrier((&___m_OnValueChanged_23), value);
}
inline static int32_t get_offset_of_m_FillImage_24() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_FillImage_24)); }
inline Image_t2917938530 * get_m_FillImage_24() const { return ___m_FillImage_24; }
inline Image_t2917938530 ** get_address_of_m_FillImage_24() { return &___m_FillImage_24; }
inline void set_m_FillImage_24(Image_t2917938530 * value)
{
___m_FillImage_24 = value;
Il2CppCodeGenWriteBarrier((&___m_FillImage_24), value);
}
inline static int32_t get_offset_of_m_FillTransform_25() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_FillTransform_25)); }
inline Transform_t2468616896 * get_m_FillTransform_25() const { return ___m_FillTransform_25; }
inline Transform_t2468616896 ** get_address_of_m_FillTransform_25() { return &___m_FillTransform_25; }
inline void set_m_FillTransform_25(Transform_t2468616896 * value)
{
___m_FillTransform_25 = value;
Il2CppCodeGenWriteBarrier((&___m_FillTransform_25), value);
}
inline static int32_t get_offset_of_m_FillContainerRect_26() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_FillContainerRect_26)); }
inline RectTransform_t3700156813 * get_m_FillContainerRect_26() const { return ___m_FillContainerRect_26; }
inline RectTransform_t3700156813 ** get_address_of_m_FillContainerRect_26() { return &___m_FillContainerRect_26; }
inline void set_m_FillContainerRect_26(RectTransform_t3700156813 * value)
{
___m_FillContainerRect_26 = value;
Il2CppCodeGenWriteBarrier((&___m_FillContainerRect_26), value);
}
inline static int32_t get_offset_of_m_HandleTransform_27() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_HandleTransform_27)); }
inline Transform_t2468616896 * get_m_HandleTransform_27() const { return ___m_HandleTransform_27; }
inline Transform_t2468616896 ** get_address_of_m_HandleTransform_27() { return &___m_HandleTransform_27; }
inline void set_m_HandleTransform_27(Transform_t2468616896 * value)
{
___m_HandleTransform_27 = value;
Il2CppCodeGenWriteBarrier((&___m_HandleTransform_27), value);
}
inline static int32_t get_offset_of_m_HandleContainerRect_28() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_HandleContainerRect_28)); }
inline RectTransform_t3700156813 * get_m_HandleContainerRect_28() const { return ___m_HandleContainerRect_28; }
inline RectTransform_t3700156813 ** get_address_of_m_HandleContainerRect_28() { return &___m_HandleContainerRect_28; }
inline void set_m_HandleContainerRect_28(RectTransform_t3700156813 * value)
{
___m_HandleContainerRect_28 = value;
Il2CppCodeGenWriteBarrier((&___m_HandleContainerRect_28), value);
}
inline static int32_t get_offset_of_m_Offset_29() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_Offset_29)); }
inline Vector2_t3854014517 get_m_Offset_29() const { return ___m_Offset_29; }
inline Vector2_t3854014517 * get_address_of_m_Offset_29() { return &___m_Offset_29; }
inline void set_m_Offset_29(Vector2_t3854014517 value)
{
___m_Offset_29 = value;
}
inline static int32_t get_offset_of_m_Tracker_30() { return static_cast<int32_t>(offsetof(Slider_t546755744, ___m_Tracker_30)); }
inline DrivenRectTransformTracker_t2435175526 get_m_Tracker_30() const { return ___m_Tracker_30; }
inline DrivenRectTransformTracker_t2435175526 * get_address_of_m_Tracker_30() { return &___m_Tracker_30; }
inline void set_m_Tracker_30(DrivenRectTransformTracker_t2435175526 value)
{
___m_Tracker_30 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SLIDER_T546755744_H
#ifndef RAWIMAGE_T3786877047_H
#define RAWIMAGE_T3786877047_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.RawImage
struct RawImage_t3786877047 : public MaskableGraphic_t1515231992
{
public:
// UnityEngine.Texture UnityEngine.UI.RawImage::m_Texture
Texture_t2354860603 * ___m_Texture_28;
// UnityEngine.Rect UnityEngine.UI.RawImage::m_UVRect
Rect_t3345319094 ___m_UVRect_29;
public:
inline static int32_t get_offset_of_m_Texture_28() { return static_cast<int32_t>(offsetof(RawImage_t3786877047, ___m_Texture_28)); }
inline Texture_t2354860603 * get_m_Texture_28() const { return ___m_Texture_28; }
inline Texture_t2354860603 ** get_address_of_m_Texture_28() { return &___m_Texture_28; }
inline void set_m_Texture_28(Texture_t2354860603 * value)
{
___m_Texture_28 = value;
Il2CppCodeGenWriteBarrier((&___m_Texture_28), value);
}
inline static int32_t get_offset_of_m_UVRect_29() { return static_cast<int32_t>(offsetof(RawImage_t3786877047, ___m_UVRect_29)); }
inline Rect_t3345319094 get_m_UVRect_29() const { return ___m_UVRect_29; }
inline Rect_t3345319094 * get_address_of_m_UVRect_29() { return &___m_UVRect_29; }
inline void set_m_UVRect_29(Rect_t3345319094 value)
{
___m_UVRect_29 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RAWIMAGE_T3786877047_H
#ifndef HORIZONTALLAYOUTGROUP_T3413312766_H
#define HORIZONTALLAYOUTGROUP_T3413312766_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.HorizontalLayoutGroup
struct HorizontalLayoutGroup_t3413312766 : public HorizontalOrVerticalLayoutGroup_t786020932
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // HORIZONTALLAYOUTGROUP_T3413312766_H
#ifndef VERTICALLAYOUTGROUP_T1538775690_H
#define VERTICALLAYOUTGROUP_T1538775690_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.VerticalLayoutGroup
struct VerticalLayoutGroup_t1538775690 : public HorizontalOrVerticalLayoutGroup_t786020932
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VERTICALLAYOUTGROUP_T1538775690_H
#ifndef IMAGE_T2917938530_H
#define IMAGE_T2917938530_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Image
struct Image_t2917938530 : public MaskableGraphic_t1515231992
{
public:
// UnityEngine.Sprite UnityEngine.UI.Image::m_Sprite
Sprite_t3419621700 * ___m_Sprite_29;
// UnityEngine.Sprite UnityEngine.UI.Image::m_OverrideSprite
Sprite_t3419621700 * ___m_OverrideSprite_30;
// UnityEngine.UI.Image/Type UnityEngine.UI.Image::m_Type
int32_t ___m_Type_31;
// System.Boolean UnityEngine.UI.Image::m_PreserveAspect
bool ___m_PreserveAspect_32;
// System.Boolean UnityEngine.UI.Image::m_FillCenter
bool ___m_FillCenter_33;
// UnityEngine.UI.Image/FillMethod UnityEngine.UI.Image::m_FillMethod
int32_t ___m_FillMethod_34;
// System.Single UnityEngine.UI.Image::m_FillAmount
float ___m_FillAmount_35;
// System.Boolean UnityEngine.UI.Image::m_FillClockwise
bool ___m_FillClockwise_36;
// System.Int32 UnityEngine.UI.Image::m_FillOrigin
int32_t ___m_FillOrigin_37;
// System.Single UnityEngine.UI.Image::m_AlphaHitTestMinimumThreshold
float ___m_AlphaHitTestMinimumThreshold_38;
public:
inline static int32_t get_offset_of_m_Sprite_29() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_Sprite_29)); }
inline Sprite_t3419621700 * get_m_Sprite_29() const { return ___m_Sprite_29; }
inline Sprite_t3419621700 ** get_address_of_m_Sprite_29() { return &___m_Sprite_29; }
inline void set_m_Sprite_29(Sprite_t3419621700 * value)
{
___m_Sprite_29 = value;
Il2CppCodeGenWriteBarrier((&___m_Sprite_29), value);
}
inline static int32_t get_offset_of_m_OverrideSprite_30() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_OverrideSprite_30)); }
inline Sprite_t3419621700 * get_m_OverrideSprite_30() const { return ___m_OverrideSprite_30; }
inline Sprite_t3419621700 ** get_address_of_m_OverrideSprite_30() { return &___m_OverrideSprite_30; }
inline void set_m_OverrideSprite_30(Sprite_t3419621700 * value)
{
___m_OverrideSprite_30 = value;
Il2CppCodeGenWriteBarrier((&___m_OverrideSprite_30), value);
}
inline static int32_t get_offset_of_m_Type_31() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_Type_31)); }
inline int32_t get_m_Type_31() const { return ___m_Type_31; }
inline int32_t* get_address_of_m_Type_31() { return &___m_Type_31; }
inline void set_m_Type_31(int32_t value)
{
___m_Type_31 = value;
}
inline static int32_t get_offset_of_m_PreserveAspect_32() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_PreserveAspect_32)); }
inline bool get_m_PreserveAspect_32() const { return ___m_PreserveAspect_32; }
inline bool* get_address_of_m_PreserveAspect_32() { return &___m_PreserveAspect_32; }
inline void set_m_PreserveAspect_32(bool value)
{
___m_PreserveAspect_32 = value;
}
inline static int32_t get_offset_of_m_FillCenter_33() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_FillCenter_33)); }
inline bool get_m_FillCenter_33() const { return ___m_FillCenter_33; }
inline bool* get_address_of_m_FillCenter_33() { return &___m_FillCenter_33; }
inline void set_m_FillCenter_33(bool value)
{
___m_FillCenter_33 = value;
}
inline static int32_t get_offset_of_m_FillMethod_34() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_FillMethod_34)); }
inline int32_t get_m_FillMethod_34() const { return ___m_FillMethod_34; }
inline int32_t* get_address_of_m_FillMethod_34() { return &___m_FillMethod_34; }
inline void set_m_FillMethod_34(int32_t value)
{
___m_FillMethod_34 = value;
}
inline static int32_t get_offset_of_m_FillAmount_35() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_FillAmount_35)); }
inline float get_m_FillAmount_35() const { return ___m_FillAmount_35; }
inline float* get_address_of_m_FillAmount_35() { return &___m_FillAmount_35; }
inline void set_m_FillAmount_35(float value)
{
___m_FillAmount_35 = value;
}
inline static int32_t get_offset_of_m_FillClockwise_36() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_FillClockwise_36)); }
inline bool get_m_FillClockwise_36() const { return ___m_FillClockwise_36; }
inline bool* get_address_of_m_FillClockwise_36() { return &___m_FillClockwise_36; }
inline void set_m_FillClockwise_36(bool value)
{
___m_FillClockwise_36 = value;
}
inline static int32_t get_offset_of_m_FillOrigin_37() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_FillOrigin_37)); }
inline int32_t get_m_FillOrigin_37() const { return ___m_FillOrigin_37; }
inline int32_t* get_address_of_m_FillOrigin_37() { return &___m_FillOrigin_37; }
inline void set_m_FillOrigin_37(int32_t value)
{
___m_FillOrigin_37 = value;
}
inline static int32_t get_offset_of_m_AlphaHitTestMinimumThreshold_38() { return static_cast<int32_t>(offsetof(Image_t2917938530, ___m_AlphaHitTestMinimumThreshold_38)); }
inline float get_m_AlphaHitTestMinimumThreshold_38() const { return ___m_AlphaHitTestMinimumThreshold_38; }
inline float* get_address_of_m_AlphaHitTestMinimumThreshold_38() { return &___m_AlphaHitTestMinimumThreshold_38; }
inline void set_m_AlphaHitTestMinimumThreshold_38(float value)
{
___m_AlphaHitTestMinimumThreshold_38 = value;
}
};
struct Image_t2917938530_StaticFields
{
public:
// UnityEngine.Material UnityEngine.UI.Image::s_ETC1DefaultUI
Material_t3939796247 * ___s_ETC1DefaultUI_28;
// UnityEngine.Vector2[] UnityEngine.UI.Image::s_VertScratch
Vector2U5BU5D_t572702552* ___s_VertScratch_39;
// UnityEngine.Vector2[] UnityEngine.UI.Image::s_UVScratch
Vector2U5BU5D_t572702552* ___s_UVScratch_40;
// UnityEngine.Vector3[] UnityEngine.UI.Image::s_Xy
Vector3U5BU5D_t2251457841* ___s_Xy_41;
// UnityEngine.Vector3[] UnityEngine.UI.Image::s_Uv
Vector3U5BU5D_t2251457841* ___s_Uv_42;
public:
inline static int32_t get_offset_of_s_ETC1DefaultUI_28() { return static_cast<int32_t>(offsetof(Image_t2917938530_StaticFields, ___s_ETC1DefaultUI_28)); }
inline Material_t3939796247 * get_s_ETC1DefaultUI_28() const { return ___s_ETC1DefaultUI_28; }
inline Material_t3939796247 ** get_address_of_s_ETC1DefaultUI_28() { return &___s_ETC1DefaultUI_28; }
inline void set_s_ETC1DefaultUI_28(Material_t3939796247 * value)
{
___s_ETC1DefaultUI_28 = value;
Il2CppCodeGenWriteBarrier((&___s_ETC1DefaultUI_28), value);
}
inline static int32_t get_offset_of_s_VertScratch_39() { return static_cast<int32_t>(offsetof(Image_t2917938530_StaticFields, ___s_VertScratch_39)); }
inline Vector2U5BU5D_t572702552* get_s_VertScratch_39() const { return ___s_VertScratch_39; }
inline Vector2U5BU5D_t572702552** get_address_of_s_VertScratch_39() { return &___s_VertScratch_39; }
inline void set_s_VertScratch_39(Vector2U5BU5D_t572702552* value)
{
___s_VertScratch_39 = value;
Il2CppCodeGenWriteBarrier((&___s_VertScratch_39), value);
}
inline static int32_t get_offset_of_s_UVScratch_40() { return static_cast<int32_t>(offsetof(Image_t2917938530_StaticFields, ___s_UVScratch_40)); }
inline Vector2U5BU5D_t572702552* get_s_UVScratch_40() const { return ___s_UVScratch_40; }
inline Vector2U5BU5D_t572702552** get_address_of_s_UVScratch_40() { return &___s_UVScratch_40; }
inline void set_s_UVScratch_40(Vector2U5BU5D_t572702552* value)
{
___s_UVScratch_40 = value;
Il2CppCodeGenWriteBarrier((&___s_UVScratch_40), value);
}
inline static int32_t get_offset_of_s_Xy_41() { return static_cast<int32_t>(offsetof(Image_t2917938530_StaticFields, ___s_Xy_41)); }
inline Vector3U5BU5D_t2251457841* get_s_Xy_41() const { return ___s_Xy_41; }
inline Vector3U5BU5D_t2251457841** get_address_of_s_Xy_41() { return &___s_Xy_41; }
inline void set_s_Xy_41(Vector3U5BU5D_t2251457841* value)
{
___s_Xy_41 = value;
Il2CppCodeGenWriteBarrier((&___s_Xy_41), value);
}
inline static int32_t get_offset_of_s_Uv_42() { return static_cast<int32_t>(offsetof(Image_t2917938530_StaticFields, ___s_Uv_42)); }
inline Vector3U5BU5D_t2251457841* get_s_Uv_42() const { return ___s_Uv_42; }
inline Vector3U5BU5D_t2251457841** get_address_of_s_Uv_42() { return &___s_Uv_42; }
inline void set_s_Uv_42(Vector3U5BU5D_t2251457841* value)
{
___s_Uv_42 = value;
Il2CppCodeGenWriteBarrier((&___s_Uv_42), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // IMAGE_T2917938530_H
#ifndef TEXT_T2925720878_H
#define TEXT_T2925720878_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.UI.Text
struct Text_t2925720878 : public MaskableGraphic_t1515231992
{
public:
// UnityEngine.UI.FontData UnityEngine.UI.Text::m_FontData
FontData_t3568634606 * ___m_FontData_28;
// System.String UnityEngine.UI.Text::m_Text
String_t* ___m_Text_29;
// UnityEngine.TextGenerator UnityEngine.UI.Text::m_TextCache
TextGenerator_t1838611233 * ___m_TextCache_30;
// UnityEngine.TextGenerator UnityEngine.UI.Text::m_TextCacheForLayout
TextGenerator_t1838611233 * ___m_TextCacheForLayout_31;
// System.Boolean UnityEngine.UI.Text::m_DisableFontTextureRebuiltCallback
bool ___m_DisableFontTextureRebuiltCallback_33;
// UnityEngine.UIVertex[] UnityEngine.UI.Text::m_TempVerts
UIVertexU5BU5D_t2534070687* ___m_TempVerts_34;
public:
inline static int32_t get_offset_of_m_FontData_28() { return static_cast<int32_t>(offsetof(Text_t2925720878, ___m_FontData_28)); }
inline FontData_t3568634606 * get_m_FontData_28() const { return ___m_FontData_28; }
inline FontData_t3568634606 ** get_address_of_m_FontData_28() { return &___m_FontData_28; }
inline void set_m_FontData_28(FontData_t3568634606 * value)
{
___m_FontData_28 = value;
Il2CppCodeGenWriteBarrier((&___m_FontData_28), value);
}
inline static int32_t get_offset_of_m_Text_29() { return static_cast<int32_t>(offsetof(Text_t2925720878, ___m_Text_29)); }
inline String_t* get_m_Text_29() const { return ___m_Text_29; }
inline String_t** get_address_of_m_Text_29() { return &___m_Text_29; }
inline void set_m_Text_29(String_t* value)
{
___m_Text_29 = value;
Il2CppCodeGenWriteBarrier((&___m_Text_29), value);
}
inline static int32_t get_offset_of_m_TextCache_30() { return static_cast<int32_t>(offsetof(Text_t2925720878, ___m_TextCache_30)); }
inline TextGenerator_t1838611233 * get_m_TextCache_30() const { return ___m_TextCache_30; }
inline TextGenerator_t1838611233 ** get_address_of_m_TextCache_30() { return &___m_TextCache_30; }
inline void set_m_TextCache_30(TextGenerator_t1838611233 * value)
{
___m_TextCache_30 = value;
Il2CppCodeGenWriteBarrier((&___m_TextCache_30), value);
}
inline static int32_t get_offset_of_m_TextCacheForLayout_31() { return static_cast<int32_t>(offsetof(Text_t2925720878, ___m_TextCacheForLayout_31)); }
inline TextGenerator_t1838611233 * get_m_TextCacheForLayout_31() const { return ___m_TextCacheForLayout_31; }
inline TextGenerator_t1838611233 ** get_address_of_m_TextCacheForLayout_31() { return &___m_TextCacheForLayout_31; }
inline void set_m_TextCacheForLayout_31(TextGenerator_t1838611233 * value)
{
___m_TextCacheForLayout_31 = value;
Il2CppCodeGenWriteBarrier((&___m_TextCacheForLayout_31), value);
}
inline static int32_t get_offset_of_m_DisableFontTextureRebuiltCallback_33() { return static_cast<int32_t>(offsetof(Text_t2925720878, ___m_DisableFontTextureRebuiltCallback_33)); }
inline bool get_m_DisableFontTextureRebuiltCallback_33() const { return ___m_DisableFontTextureRebuiltCallback_33; }
inline bool* get_address_of_m_DisableFontTextureRebuiltCallback_33() { return &___m_DisableFontTextureRebuiltCallback_33; }
inline void set_m_DisableFontTextureRebuiltCallback_33(bool value)
{
___m_DisableFontTextureRebuiltCallback_33 = value;
}
inline static int32_t get_offset_of_m_TempVerts_34() { return static_cast<int32_t>(offsetof(Text_t2925720878, ___m_TempVerts_34)); }
inline UIVertexU5BU5D_t2534070687* get_m_TempVerts_34() const { return ___m_TempVerts_34; }
inline UIVertexU5BU5D_t2534070687** get_address_of_m_TempVerts_34() { return &___m_TempVerts_34; }
inline void set_m_TempVerts_34(UIVertexU5BU5D_t2534070687* value)
{
___m_TempVerts_34 = value;
Il2CppCodeGenWriteBarrier((&___m_TempVerts_34), value);
}
};
struct Text_t2925720878_StaticFields
{
public:
// UnityEngine.Material UnityEngine.UI.Text::s_DefaultText
Material_t3939796247 * ___s_DefaultText_32;
public:
inline static int32_t get_offset_of_s_DefaultText_32() { return static_cast<int32_t>(offsetof(Text_t2925720878_StaticFields, ___s_DefaultText_32)); }
inline Material_t3939796247 * get_s_DefaultText_32() const { return ___s_DefaultText_32; }
inline Material_t3939796247 ** get_address_of_s_DefaultText_32() { return &___s_DefaultText_32; }
inline void set_s_DefaultText_32(Material_t3939796247 * value)
{
___s_DefaultText_32 = value;
Il2CppCodeGenWriteBarrier((&___s_DefaultText_32), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TEXT_T2925720878_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1700 = { sizeof (GraphicRaycaster_t121155276), -1, sizeof(GraphicRaycaster_t121155276_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1700[8] =
{
0,
GraphicRaycaster_t121155276::get_offset_of_m_IgnoreReversedGraphics_3(),
GraphicRaycaster_t121155276::get_offset_of_m_BlockingObjects_4(),
GraphicRaycaster_t121155276::get_offset_of_m_BlockingMask_5(),
GraphicRaycaster_t121155276::get_offset_of_m_Canvas_6(),
GraphicRaycaster_t121155276::get_offset_of_m_RaycastResults_7(),
GraphicRaycaster_t121155276_StaticFields::get_offset_of_s_SortedGraphics_8(),
GraphicRaycaster_t121155276_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1701 = { sizeof (BlockingObjects_t1079817636)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1701[5] =
{
BlockingObjects_t1079817636::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1702 = { sizeof (GraphicRegistry_t2942561618), -1, sizeof(GraphicRegistry_t2942561618_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1702[3] =
{
GraphicRegistry_t2942561618_StaticFields::get_offset_of_s_Instance_0(),
GraphicRegistry_t2942561618::get_offset_of_m_Graphics_1(),
GraphicRegistry_t2942561618_StaticFields::get_offset_of_s_EmptyList_2(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1703 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1704 = { sizeof (Image_t2917938530), -1, sizeof(Image_t2917938530_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1704[15] =
{
Image_t2917938530_StaticFields::get_offset_of_s_ETC1DefaultUI_28(),
Image_t2917938530::get_offset_of_m_Sprite_29(),
Image_t2917938530::get_offset_of_m_OverrideSprite_30(),
Image_t2917938530::get_offset_of_m_Type_31(),
Image_t2917938530::get_offset_of_m_PreserveAspect_32(),
Image_t2917938530::get_offset_of_m_FillCenter_33(),
Image_t2917938530::get_offset_of_m_FillMethod_34(),
Image_t2917938530::get_offset_of_m_FillAmount_35(),
Image_t2917938530::get_offset_of_m_FillClockwise_36(),
Image_t2917938530::get_offset_of_m_FillOrigin_37(),
Image_t2917938530::get_offset_of_m_AlphaHitTestMinimumThreshold_38(),
Image_t2917938530_StaticFields::get_offset_of_s_VertScratch_39(),
Image_t2917938530_StaticFields::get_offset_of_s_UVScratch_40(),
Image_t2917938530_StaticFields::get_offset_of_s_Xy_41(),
Image_t2917938530_StaticFields::get_offset_of_s_Uv_42(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1705 = { sizeof (Type_t3948253205)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1705[5] =
{
Type_t3948253205::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1706 = { sizeof (FillMethod_t2543319811)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1706[6] =
{
FillMethod_t2543319811::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1707 = { sizeof (OriginHorizontal_t4239248393)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1707[3] =
{
OriginHorizontal_t4239248393::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1708 = { sizeof (OriginVertical_t4015097076)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1708[3] =
{
OriginVertical_t4015097076::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1709 = { sizeof (Origin90_t1855357908)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1709[5] =
{
Origin90_t1855357908::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1710 = { sizeof (Origin180_t3595788426)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1710[5] =
{
Origin180_t3595788426::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1711 = { sizeof (Origin360_t2916974445)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1711[5] =
{
Origin360_t2916974445::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1712 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1713 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1714 = { sizeof (InputField_t3950490122), -1, sizeof(InputField_t3950490122_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1714[47] =
{
InputField_t3950490122::get_offset_of_m_Keyboard_16(),
InputField_t3950490122_StaticFields::get_offset_of_kSeparators_17(),
InputField_t3950490122::get_offset_of_m_TextComponent_18(),
InputField_t3950490122::get_offset_of_m_Placeholder_19(),
InputField_t3950490122::get_offset_of_m_ContentType_20(),
InputField_t3950490122::get_offset_of_m_InputType_21(),
InputField_t3950490122::get_offset_of_m_AsteriskChar_22(),
InputField_t3950490122::get_offset_of_m_KeyboardType_23(),
InputField_t3950490122::get_offset_of_m_LineType_24(),
InputField_t3950490122::get_offset_of_m_HideMobileInput_25(),
InputField_t3950490122::get_offset_of_m_CharacterValidation_26(),
InputField_t3950490122::get_offset_of_m_CharacterLimit_27(),
InputField_t3950490122::get_offset_of_m_OnEndEdit_28(),
InputField_t3950490122::get_offset_of_m_OnValueChanged_29(),
InputField_t3950490122::get_offset_of_m_OnValidateInput_30(),
InputField_t3950490122::get_offset_of_m_CaretColor_31(),
InputField_t3950490122::get_offset_of_m_CustomCaretColor_32(),
InputField_t3950490122::get_offset_of_m_SelectionColor_33(),
InputField_t3950490122::get_offset_of_m_Text_34(),
InputField_t3950490122::get_offset_of_m_CaretBlinkRate_35(),
InputField_t3950490122::get_offset_of_m_CaretWidth_36(),
InputField_t3950490122::get_offset_of_m_ReadOnly_37(),
InputField_t3950490122::get_offset_of_m_CaretPosition_38(),
InputField_t3950490122::get_offset_of_m_CaretSelectPosition_39(),
InputField_t3950490122::get_offset_of_caretRectTrans_40(),
InputField_t3950490122::get_offset_of_m_CursorVerts_41(),
InputField_t3950490122::get_offset_of_m_InputTextCache_42(),
InputField_t3950490122::get_offset_of_m_CachedInputRenderer_43(),
InputField_t3950490122::get_offset_of_m_PreventFontCallback_44(),
InputField_t3950490122::get_offset_of_m_Mesh_45(),
InputField_t3950490122::get_offset_of_m_AllowInput_46(),
InputField_t3950490122::get_offset_of_m_ShouldActivateNextUpdate_47(),
InputField_t3950490122::get_offset_of_m_UpdateDrag_48(),
InputField_t3950490122::get_offset_of_m_DragPositionOutOfBounds_49(),
0,
0,
InputField_t3950490122::get_offset_of_m_CaretVisible_52(),
InputField_t3950490122::get_offset_of_m_BlinkCoroutine_53(),
InputField_t3950490122::get_offset_of_m_BlinkStartTime_54(),
InputField_t3950490122::get_offset_of_m_DrawStart_55(),
InputField_t3950490122::get_offset_of_m_DrawEnd_56(),
InputField_t3950490122::get_offset_of_m_DragCoroutine_57(),
InputField_t3950490122::get_offset_of_m_OriginalText_58(),
InputField_t3950490122::get_offset_of_m_WasCanceled_59(),
InputField_t3950490122::get_offset_of_m_HasDoneFocusTransition_60(),
0,
InputField_t3950490122::get_offset_of_m_ProcessingEvent_62(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1715 = { sizeof (ContentType_t1708293613)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1715[11] =
{
ContentType_t1708293613::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1716 = { sizeof (InputType_t2526005958)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1716[4] =
{
InputType_t2526005958::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1717 = { sizeof (CharacterValidation_t2169882528)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1717[7] =
{
CharacterValidation_t2169882528::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1718 = { sizeof (LineType_t3268879351)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1718[4] =
{
LineType_t3268879351::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1719 = { sizeof (OnValidateInput_t977755270), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1720 = { sizeof (SubmitEvent_t2550651048), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1721 = { sizeof (OnChangeEvent_t970128749), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1722 = { sizeof (EditState_t906096569)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1722[3] =
{
EditState_t906096569::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1723 = { sizeof (U3CCaretBlinkU3Ec__Iterator0_t1813892813), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1723[6] =
{
U3CCaretBlinkU3Ec__Iterator0_t1813892813::get_offset_of_U3CblinkPeriodU3E__1_0(),
U3CCaretBlinkU3Ec__Iterator0_t1813892813::get_offset_of_U3CblinkStateU3E__1_1(),
U3CCaretBlinkU3Ec__Iterator0_t1813892813::get_offset_of_U24this_2(),
U3CCaretBlinkU3Ec__Iterator0_t1813892813::get_offset_of_U24current_3(),
U3CCaretBlinkU3Ec__Iterator0_t1813892813::get_offset_of_U24disposing_4(),
U3CCaretBlinkU3Ec__Iterator0_t1813892813::get_offset_of_U24PC_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1724 = { sizeof (U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1724[8] =
{
U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415::get_offset_of_eventData_0(),
U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415::get_offset_of_U3ClocalMousePosU3E__1_1(),
U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415::get_offset_of_U3CrectU3E__1_2(),
U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415::get_offset_of_U3CdelayU3E__1_3(),
U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415::get_offset_of_U24this_4(),
U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415::get_offset_of_U24current_5(),
U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415::get_offset_of_U24disposing_6(),
U3CMouseDragOutsideRectU3Ec__Iterator1_t1050685415::get_offset_of_U24PC_7(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1725 = { sizeof (Mask_t3699985323), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1725[5] =
{
Mask_t3699985323::get_offset_of_m_RectTransform_2(),
Mask_t3699985323::get_offset_of_m_ShowMaskGraphic_3(),
Mask_t3699985323::get_offset_of_m_Graphic_4(),
Mask_t3699985323::get_offset_of_m_MaskMaterial_5(),
Mask_t3699985323::get_offset_of_m_UnmaskMaterial_6(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1726 = { sizeof (MaskableGraphic_t1515231992), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1726[9] =
{
MaskableGraphic_t1515231992::get_offset_of_m_ShouldRecalculateStencil_19(),
MaskableGraphic_t1515231992::get_offset_of_m_MaskMaterial_20(),
MaskableGraphic_t1515231992::get_offset_of_m_ParentMask_21(),
MaskableGraphic_t1515231992::get_offset_of_m_Maskable_22(),
MaskableGraphic_t1515231992::get_offset_of_m_IncludeForMasking_23(),
MaskableGraphic_t1515231992::get_offset_of_m_OnCullStateChanged_24(),
MaskableGraphic_t1515231992::get_offset_of_m_ShouldRecalculate_25(),
MaskableGraphic_t1515231992::get_offset_of_m_StencilValue_26(),
MaskableGraphic_t1515231992::get_offset_of_m_Corners_27(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1727 = { sizeof (CullStateChangedEvent_t2536871658), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1728 = { sizeof (MaskUtilities_t3025508624), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1729 = { sizeof (Misc_t1087338646), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1730 = { sizeof (Navigation_t1087547695)+ sizeof (RuntimeObject), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1730[5] =
{
Navigation_t1087547695::get_offset_of_m_Mode_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
Navigation_t1087547695::get_offset_of_m_SelectOnUp_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
Navigation_t1087547695::get_offset_of_m_SelectOnDown_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
Navigation_t1087547695::get_offset_of_m_SelectOnLeft_3() + static_cast<int32_t>(sizeof(RuntimeObject)),
Navigation_t1087547695::get_offset_of_m_SelectOnRight_4() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1731 = { sizeof (Mode_t248186590)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1731[6] =
{
Mode_t248186590::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1732 = { sizeof (RawImage_t3786877047), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1732[2] =
{
RawImage_t3786877047::get_offset_of_m_Texture_28(),
RawImage_t3786877047::get_offset_of_m_UVRect_29(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1733 = { sizeof (RectMask2D_t2399484214), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1733[8] =
{
RectMask2D_t2399484214::get_offset_of_m_VertexClipper_2(),
RectMask2D_t2399484214::get_offset_of_m_RectTransform_3(),
RectMask2D_t2399484214::get_offset_of_m_ClipTargets_4(),
RectMask2D_t2399484214::get_offset_of_m_ShouldRecalculateClipRects_5(),
RectMask2D_t2399484214::get_offset_of_m_Clippers_6(),
RectMask2D_t2399484214::get_offset_of_m_LastClipRectCanvasSpace_7(),
RectMask2D_t2399484214::get_offset_of_m_LastValidClipRect_8(),
RectMask2D_t2399484214::get_offset_of_m_ForceClip_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1734 = { sizeof (Scrollbar_t3517713769), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1734[11] =
{
Scrollbar_t3517713769::get_offset_of_m_HandleRect_16(),
Scrollbar_t3517713769::get_offset_of_m_Direction_17(),
Scrollbar_t3517713769::get_offset_of_m_Value_18(),
Scrollbar_t3517713769::get_offset_of_m_Size_19(),
Scrollbar_t3517713769::get_offset_of_m_NumberOfSteps_20(),
Scrollbar_t3517713769::get_offset_of_m_OnValueChanged_21(),
Scrollbar_t3517713769::get_offset_of_m_ContainerRect_22(),
Scrollbar_t3517713769::get_offset_of_m_Offset_23(),
Scrollbar_t3517713769::get_offset_of_m_Tracker_24(),
Scrollbar_t3517713769::get_offset_of_m_PointerDownRepeat_25(),
Scrollbar_t3517713769::get_offset_of_isPointerDownAndNotDragging_26(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1735 = { sizeof (Direction_t929465853)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1735[5] =
{
Direction_t929465853::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1736 = { sizeof (ScrollEvent_t2334911764), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1737 = { sizeof (Axis_t2635272803)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1737[3] =
{
Axis_t2635272803::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1738 = { sizeof (U3CClickRepeatU3Ec__Iterator0_t2092823809), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1738[5] =
{
U3CClickRepeatU3Ec__Iterator0_t2092823809::get_offset_of_eventData_0(),
U3CClickRepeatU3Ec__Iterator0_t2092823809::get_offset_of_U24this_1(),
U3CClickRepeatU3Ec__Iterator0_t2092823809::get_offset_of_U24current_2(),
U3CClickRepeatU3Ec__Iterator0_t2092823809::get_offset_of_U24disposing_3(),
U3CClickRepeatU3Ec__Iterator0_t2092823809::get_offset_of_U24PC_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1739 = { sizeof (ScrollRect_t1834416425), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1739[36] =
{
ScrollRect_t1834416425::get_offset_of_m_Content_2(),
ScrollRect_t1834416425::get_offset_of_m_Horizontal_3(),
ScrollRect_t1834416425::get_offset_of_m_Vertical_4(),
ScrollRect_t1834416425::get_offset_of_m_MovementType_5(),
ScrollRect_t1834416425::get_offset_of_m_Elasticity_6(),
ScrollRect_t1834416425::get_offset_of_m_Inertia_7(),
ScrollRect_t1834416425::get_offset_of_m_DecelerationRate_8(),
ScrollRect_t1834416425::get_offset_of_m_ScrollSensitivity_9(),
ScrollRect_t1834416425::get_offset_of_m_Viewport_10(),
ScrollRect_t1834416425::get_offset_of_m_HorizontalScrollbar_11(),
ScrollRect_t1834416425::get_offset_of_m_VerticalScrollbar_12(),
ScrollRect_t1834416425::get_offset_of_m_HorizontalScrollbarVisibility_13(),
ScrollRect_t1834416425::get_offset_of_m_VerticalScrollbarVisibility_14(),
ScrollRect_t1834416425::get_offset_of_m_HorizontalScrollbarSpacing_15(),
ScrollRect_t1834416425::get_offset_of_m_VerticalScrollbarSpacing_16(),
ScrollRect_t1834416425::get_offset_of_m_OnValueChanged_17(),
ScrollRect_t1834416425::get_offset_of_m_PointerStartLocalCursor_18(),
ScrollRect_t1834416425::get_offset_of_m_ContentStartPosition_19(),
ScrollRect_t1834416425::get_offset_of_m_ViewRect_20(),
ScrollRect_t1834416425::get_offset_of_m_ContentBounds_21(),
ScrollRect_t1834416425::get_offset_of_m_ViewBounds_22(),
ScrollRect_t1834416425::get_offset_of_m_Velocity_23(),
ScrollRect_t1834416425::get_offset_of_m_Dragging_24(),
ScrollRect_t1834416425::get_offset_of_m_PrevPosition_25(),
ScrollRect_t1834416425::get_offset_of_m_PrevContentBounds_26(),
ScrollRect_t1834416425::get_offset_of_m_PrevViewBounds_27(),
ScrollRect_t1834416425::get_offset_of_m_HasRebuiltLayout_28(),
ScrollRect_t1834416425::get_offset_of_m_HSliderExpand_29(),
ScrollRect_t1834416425::get_offset_of_m_VSliderExpand_30(),
ScrollRect_t1834416425::get_offset_of_m_HSliderHeight_31(),
ScrollRect_t1834416425::get_offset_of_m_VSliderWidth_32(),
ScrollRect_t1834416425::get_offset_of_m_Rect_33(),
ScrollRect_t1834416425::get_offset_of_m_HorizontalScrollbarRect_34(),
ScrollRect_t1834416425::get_offset_of_m_VerticalScrollbarRect_35(),
ScrollRect_t1834416425::get_offset_of_m_Tracker_36(),
ScrollRect_t1834416425::get_offset_of_m_Corners_37(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1740 = { sizeof (MovementType_t27617511)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1740[4] =
{
MovementType_t27617511::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1741 = { sizeof (ScrollbarVisibility_t836594649)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1741[4] =
{
ScrollbarVisibility_t836594649::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1742 = { sizeof (ScrollRectEvent_t1918886797), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1743 = { sizeof (Selectable_t3916939825), -1, sizeof(Selectable_t3916939825_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1743[14] =
{
Selectable_t3916939825_StaticFields::get_offset_of_s_List_2(),
Selectable_t3916939825::get_offset_of_m_Navigation_3(),
Selectable_t3916939825::get_offset_of_m_Transition_4(),
Selectable_t3916939825::get_offset_of_m_Colors_5(),
Selectable_t3916939825::get_offset_of_m_SpriteState_6(),
Selectable_t3916939825::get_offset_of_m_AnimationTriggers_7(),
Selectable_t3916939825::get_offset_of_m_Interactable_8(),
Selectable_t3916939825::get_offset_of_m_TargetGraphic_9(),
Selectable_t3916939825::get_offset_of_m_GroupsAllowInteraction_10(),
Selectable_t3916939825::get_offset_of_m_CurrentSelectionState_11(),
Selectable_t3916939825::get_offset_of_U3CisPointerInsideU3Ek__BackingField_12(),
Selectable_t3916939825::get_offset_of_U3CisPointerDownU3Ek__BackingField_13(),
Selectable_t3916939825::get_offset_of_U3ChasSelectionU3Ek__BackingField_14(),
Selectable_t3916939825::get_offset_of_m_CanvasGroupCache_15(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1744 = { sizeof (Transition_t75905610)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1744[5] =
{
Transition_t75905610::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1745 = { sizeof (SelectionState_t3662906228)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1745[5] =
{
SelectionState_t3662906228::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1746 = { sizeof (SetPropertyUtility_t18317635), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1747 = { sizeof (Slider_t546755744), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1747[15] =
{
Slider_t546755744::get_offset_of_m_FillRect_16(),
Slider_t546755744::get_offset_of_m_HandleRect_17(),
Slider_t546755744::get_offset_of_m_Direction_18(),
Slider_t546755744::get_offset_of_m_MinValue_19(),
Slider_t546755744::get_offset_of_m_MaxValue_20(),
Slider_t546755744::get_offset_of_m_WholeNumbers_21(),
Slider_t546755744::get_offset_of_m_Value_22(),
Slider_t546755744::get_offset_of_m_OnValueChanged_23(),
Slider_t546755744::get_offset_of_m_FillImage_24(),
Slider_t546755744::get_offset_of_m_FillTransform_25(),
Slider_t546755744::get_offset_of_m_FillContainerRect_26(),
Slider_t546755744::get_offset_of_m_HandleTransform_27(),
Slider_t546755744::get_offset_of_m_HandleContainerRect_28(),
Slider_t546755744::get_offset_of_m_Offset_29(),
Slider_t546755744::get_offset_of_m_Tracker_30(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1748 = { sizeof (Direction_t4110063302)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1748[5] =
{
Direction_t4110063302::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1749 = { sizeof (SliderEvent_t260680582), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1750 = { sizeof (Axis_t597648171)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1750[3] =
{
Axis_t597648171::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1751 = { sizeof (SpriteState_t2212279481)+ sizeof (RuntimeObject), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1751[3] =
{
SpriteState_t2212279481::get_offset_of_m_HighlightedSprite_0() + static_cast<int32_t>(sizeof(RuntimeObject)),
SpriteState_t2212279481::get_offset_of_m_PressedSprite_1() + static_cast<int32_t>(sizeof(RuntimeObject)),
SpriteState_t2212279481::get_offset_of_m_DisabledSprite_2() + static_cast<int32_t>(sizeof(RuntimeObject)),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1752 = { sizeof (StencilMaterial_t3060600715), -1, sizeof(StencilMaterial_t3060600715_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1752[1] =
{
StencilMaterial_t3060600715_StaticFields::get_offset_of_m_List_0(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1753 = { sizeof (MatEntry_t1755173256), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1753[10] =
{
MatEntry_t1755173256::get_offset_of_baseMat_0(),
MatEntry_t1755173256::get_offset_of_customMat_1(),
MatEntry_t1755173256::get_offset_of_count_2(),
MatEntry_t1755173256::get_offset_of_stencilId_3(),
MatEntry_t1755173256::get_offset_of_operation_4(),
MatEntry_t1755173256::get_offset_of_compareFunction_5(),
MatEntry_t1755173256::get_offset_of_readMask_6(),
MatEntry_t1755173256::get_offset_of_writeMask_7(),
MatEntry_t1755173256::get_offset_of_useAlphaClip_8(),
MatEntry_t1755173256::get_offset_of_colorMask_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1754 = { sizeof (Text_t2925720878), -1, sizeof(Text_t2925720878_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1754[7] =
{
Text_t2925720878::get_offset_of_m_FontData_28(),
Text_t2925720878::get_offset_of_m_Text_29(),
Text_t2925720878::get_offset_of_m_TextCache_30(),
Text_t2925720878::get_offset_of_m_TextCacheForLayout_31(),
Text_t2925720878_StaticFields::get_offset_of_s_DefaultText_32(),
Text_t2925720878::get_offset_of_m_DisableFontTextureRebuiltCallback_33(),
Text_t2925720878::get_offset_of_m_TempVerts_34(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1755 = { sizeof (Toggle_t255761159), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1755[5] =
{
Toggle_t255761159::get_offset_of_toggleTransition_16(),
Toggle_t255761159::get_offset_of_graphic_17(),
Toggle_t255761159::get_offset_of_m_Group_18(),
Toggle_t255761159::get_offset_of_onValueChanged_19(),
Toggle_t255761159::get_offset_of_m_IsOn_20(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1756 = { sizeof (ToggleTransition_t3219964137)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1756[3] =
{
ToggleTransition_t3219964137::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1757 = { sizeof (ToggleEvent_t538146237), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1758 = { sizeof (ToggleGroup_t171083327), -1, sizeof(ToggleGroup_t171083327_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1758[4] =
{
ToggleGroup_t171083327::get_offset_of_m_AllowSwitchOff_2(),
ToggleGroup_t171083327::get_offset_of_m_Toggles_3(),
ToggleGroup_t171083327_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_4(),
ToggleGroup_t171083327_StaticFields::get_offset_of_U3CU3Ef__amU24cache1_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1759 = { sizeof (ClipperRegistry_t406775284), -1, sizeof(ClipperRegistry_t406775284_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1759[2] =
{
ClipperRegistry_t406775284_StaticFields::get_offset_of_s_Instance_0(),
ClipperRegistry_t406775284::get_offset_of_m_Clippers_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1760 = { sizeof (Clipping_t759274911), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1761 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1762 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1763 = { sizeof (RectangularVertexClipper_t3760579564), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1763[2] =
{
RectangularVertexClipper_t3760579564::get_offset_of_m_WorldCorners_0(),
RectangularVertexClipper_t3760579564::get_offset_of_m_CanvasCorners_1(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1764 = { sizeof (AspectRatioFitter_t714713384), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1764[4] =
{
AspectRatioFitter_t714713384::get_offset_of_m_AspectMode_2(),
AspectRatioFitter_t714713384::get_offset_of_m_AspectRatio_3(),
AspectRatioFitter_t714713384::get_offset_of_m_Rect_4(),
AspectRatioFitter_t714713384::get_offset_of_m_Tracker_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1765 = { sizeof (AspectMode_t3758921781)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1765[6] =
{
AspectMode_t3758921781::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1766 = { sizeof (CanvasScaler_t1970195371), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1766[14] =
{
CanvasScaler_t1970195371::get_offset_of_m_UiScaleMode_2(),
CanvasScaler_t1970195371::get_offset_of_m_ReferencePixelsPerUnit_3(),
CanvasScaler_t1970195371::get_offset_of_m_ScaleFactor_4(),
CanvasScaler_t1970195371::get_offset_of_m_ReferenceResolution_5(),
CanvasScaler_t1970195371::get_offset_of_m_ScreenMatchMode_6(),
CanvasScaler_t1970195371::get_offset_of_m_MatchWidthOrHeight_7(),
0,
CanvasScaler_t1970195371::get_offset_of_m_PhysicalUnit_9(),
CanvasScaler_t1970195371::get_offset_of_m_FallbackScreenDPI_10(),
CanvasScaler_t1970195371::get_offset_of_m_DefaultSpriteDPI_11(),
CanvasScaler_t1970195371::get_offset_of_m_DynamicPixelsPerUnit_12(),
CanvasScaler_t1970195371::get_offset_of_m_Canvas_13(),
CanvasScaler_t1970195371::get_offset_of_m_PrevScaleFactor_14(),
CanvasScaler_t1970195371::get_offset_of_m_PrevReferencePixelsPerUnit_15(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1767 = { sizeof (ScaleMode_t3168547327)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1767[4] =
{
ScaleMode_t3168547327::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1768 = { sizeof (ScreenMatchMode_t2916724817)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1768[4] =
{
ScreenMatchMode_t2916724817::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1769 = { sizeof (Unit_t3440473078)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1769[6] =
{
Unit_t3440473078::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1770 = { sizeof (ContentSizeFitter_t1789893878), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1770[4] =
{
ContentSizeFitter_t1789893878::get_offset_of_m_HorizontalFit_2(),
ContentSizeFitter_t1789893878::get_offset_of_m_VerticalFit_3(),
ContentSizeFitter_t1789893878::get_offset_of_m_Rect_4(),
ContentSizeFitter_t1789893878::get_offset_of_m_Tracker_5(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1771 = { sizeof (FitMode_t1001252671)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1771[4] =
{
FitMode_t1001252671::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1772 = { sizeof (GridLayoutGroup_t3942022971), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1772[6] =
{
GridLayoutGroup_t3942022971::get_offset_of_m_StartCorner_10(),
GridLayoutGroup_t3942022971::get_offset_of_m_StartAxis_11(),
GridLayoutGroup_t3942022971::get_offset_of_m_CellSize_12(),
GridLayoutGroup_t3942022971::get_offset_of_m_Spacing_13(),
GridLayoutGroup_t3942022971::get_offset_of_m_Constraint_14(),
GridLayoutGroup_t3942022971::get_offset_of_m_ConstraintCount_15(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1773 = { sizeof (Corner_t1934471927)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1773[5] =
{
Corner_t1934471927::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1774 = { sizeof (Axis_t2011730614)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1774[3] =
{
Axis_t2011730614::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1775 = { sizeof (Constraint_t2120095582)+ sizeof (RuntimeObject), sizeof(int32_t), 0, 0 };
extern const int32_t g_FieldOffsetTable1775[4] =
{
Constraint_t2120095582::get_offset_of_value___1() + static_cast<int32_t>(sizeof(RuntimeObject)),
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1776 = { sizeof (HorizontalLayoutGroup_t3413312766), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1777 = { sizeof (HorizontalOrVerticalLayoutGroup_t786020932), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1777[5] =
{
HorizontalOrVerticalLayoutGroup_t786020932::get_offset_of_m_Spacing_10(),
HorizontalOrVerticalLayoutGroup_t786020932::get_offset_of_m_ChildForceExpandWidth_11(),
HorizontalOrVerticalLayoutGroup_t786020932::get_offset_of_m_ChildForceExpandHeight_12(),
HorizontalOrVerticalLayoutGroup_t786020932::get_offset_of_m_ChildControlWidth_13(),
HorizontalOrVerticalLayoutGroup_t786020932::get_offset_of_m_ChildControlHeight_14(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1778 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1779 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1780 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1781 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1782 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1783 = { sizeof (LayoutElement_t305886837), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1783[8] =
{
LayoutElement_t305886837::get_offset_of_m_IgnoreLayout_2(),
LayoutElement_t305886837::get_offset_of_m_MinWidth_3(),
LayoutElement_t305886837::get_offset_of_m_MinHeight_4(),
LayoutElement_t305886837::get_offset_of_m_PreferredWidth_5(),
LayoutElement_t305886837::get_offset_of_m_PreferredHeight_6(),
LayoutElement_t305886837::get_offset_of_m_FlexibleWidth_7(),
LayoutElement_t305886837::get_offset_of_m_FlexibleHeight_8(),
LayoutElement_t305886837::get_offset_of_m_LayoutPriority_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1784 = { sizeof (LayoutGroup_t3642062901), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1784[8] =
{
LayoutGroup_t3642062901::get_offset_of_m_Padding_2(),
LayoutGroup_t3642062901::get_offset_of_m_ChildAlignment_3(),
LayoutGroup_t3642062901::get_offset_of_m_Rect_4(),
LayoutGroup_t3642062901::get_offset_of_m_Tracker_5(),
LayoutGroup_t3642062901::get_offset_of_m_TotalMinSize_6(),
LayoutGroup_t3642062901::get_offset_of_m_TotalPreferredSize_7(),
LayoutGroup_t3642062901::get_offset_of_m_TotalFlexibleSize_8(),
LayoutGroup_t3642062901::get_offset_of_m_RectChildren_9(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1785 = { sizeof (U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114), -1, 0, 0 };
extern const int32_t g_FieldOffsetTable1785[4] =
{
U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114::get_offset_of_rectTransform_0(),
U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114::get_offset_of_U24current_1(),
U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114::get_offset_of_U24disposing_2(),
U3CDelayedSetDirtyU3Ec__Iterator0_t2304611114::get_offset_of_U24PC_3(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1786 = { sizeof (LayoutRebuilder_t2045564245), -1, sizeof(LayoutRebuilder_t2045564245_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1786[9] =
{
LayoutRebuilder_t2045564245::get_offset_of_m_ToRebuild_0(),
LayoutRebuilder_t2045564245::get_offset_of_m_CachedHashFromTransform_1(),
LayoutRebuilder_t2045564245_StaticFields::get_offset_of_s_Rebuilders_2(),
LayoutRebuilder_t2045564245_StaticFields::get_offset_of_U3CU3Ef__mgU24cache0_3(),
LayoutRebuilder_t2045564245_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_4(),
LayoutRebuilder_t2045564245_StaticFields::get_offset_of_U3CU3Ef__amU24cache1_5(),
LayoutRebuilder_t2045564245_StaticFields::get_offset_of_U3CU3Ef__amU24cache2_6(),
LayoutRebuilder_t2045564245_StaticFields::get_offset_of_U3CU3Ef__amU24cache3_7(),
LayoutRebuilder_t2045564245_StaticFields::get_offset_of_U3CU3Ef__amU24cache4_8(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1787 = { sizeof (LayoutUtility_t2212037470), -1, sizeof(LayoutUtility_t2212037470_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1787[8] =
{
LayoutUtility_t2212037470_StaticFields::get_offset_of_U3CU3Ef__amU24cache0_0(),
LayoutUtility_t2212037470_StaticFields::get_offset_of_U3CU3Ef__amU24cache1_1(),
LayoutUtility_t2212037470_StaticFields::get_offset_of_U3CU3Ef__amU24cache2_2(),
LayoutUtility_t2212037470_StaticFields::get_offset_of_U3CU3Ef__amU24cache3_3(),
LayoutUtility_t2212037470_StaticFields::get_offset_of_U3CU3Ef__amU24cache4_4(),
LayoutUtility_t2212037470_StaticFields::get_offset_of_U3CU3Ef__amU24cache5_5(),
LayoutUtility_t2212037470_StaticFields::get_offset_of_U3CU3Ef__amU24cache6_6(),
LayoutUtility_t2212037470_StaticFields::get_offset_of_U3CU3Ef__amU24cache7_7(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1788 = { sizeof (VerticalLayoutGroup_t1538775690), -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1789 = { 0, -1, 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1790 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1790[2] =
{
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1791 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1791[1] =
{
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1792 = { 0, 0, 0, 0 };
extern const int32_t g_FieldOffsetTable1792[4] =
{
0,
0,
0,
0,
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1793 = { sizeof (ReflectionMethodsCache_t3869594295), -1, sizeof(ReflectionMethodsCache_t3869594295_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1793[5] =
{
ReflectionMethodsCache_t3869594295::get_offset_of_raycast3D_0(),
ReflectionMethodsCache_t3869594295::get_offset_of_raycast3DAll_1(),
ReflectionMethodsCache_t3869594295::get_offset_of_raycast2D_2(),
ReflectionMethodsCache_t3869594295::get_offset_of_getRayIntersectionAll_3(),
ReflectionMethodsCache_t3869594295_StaticFields::get_offset_of_s_ReflectionMethodsCache_4(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1794 = { sizeof (Raycast3DCallback_t3731579633), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1795 = { sizeof (Raycast2DCallback_t890783784), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1796 = { sizeof (RaycastAllCallback_t1653149632), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1797 = { sizeof (GetRayIntersectionAllCallback_t3143667439), sizeof(Il2CppMethodPointer), 0, 0 };
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1798 = { sizeof (VertexHelper_t122899649), -1, sizeof(VertexHelper_t122899649_StaticFields), 0 };
extern const int32_t g_FieldOffsetTable1798[11] =
{
VertexHelper_t122899649::get_offset_of_m_Positions_0(),
VertexHelper_t122899649::get_offset_of_m_Colors_1(),
VertexHelper_t122899649::get_offset_of_m_Uv0S_2(),
VertexHelper_t122899649::get_offset_of_m_Uv1S_3(),
VertexHelper_t122899649::get_offset_of_m_Uv2S_4(),
VertexHelper_t122899649::get_offset_of_m_Uv3S_5(),
VertexHelper_t122899649::get_offset_of_m_Normals_6(),
VertexHelper_t122899649::get_offset_of_m_Tangents_7(),
VertexHelper_t122899649::get_offset_of_m_Indices_8(),
VertexHelper_t122899649_StaticFields::get_offset_of_s_DefaultTangent_9(),
VertexHelper_t122899649_StaticFields::get_offset_of_s_DefaultNormal_10(),
};
extern const Il2CppTypeDefinitionSizes g_typeDefinitionSize1799 = { sizeof (BaseVertexEffect_t1995380047), -1, 0, 0 };
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| 42.411041 | 201 | 0.826068 | 2Dkun |
286e9e69a98848f53786fb92e28cd9c39dda299a | 18,354 | cpp | C++ | Source/GUI/Qt/GUI_Main_Core_Table.cpp | JeromeMartinez/BWFMetaEdit | 6a228bd0914aa2749f19dd94510d2126a1231248 | [
"MIT",
"0BSD"
] | null | null | null | Source/GUI/Qt/GUI_Main_Core_Table.cpp | JeromeMartinez/BWFMetaEdit | 6a228bd0914aa2749f19dd94510d2126a1231248 | [
"MIT",
"0BSD"
] | null | null | null | Source/GUI/Qt/GUI_Main_Core_Table.cpp | JeromeMartinez/BWFMetaEdit | 6a228bd0914aa2749f19dd94510d2126a1231248 | [
"MIT",
"0BSD"
] | null | null | null | // BWF MetaEdit GUI - A GUI for BWF MetaEdit
//
// This code was created in 2010 for the Library of Congress and the
// other federal government agencies participating in the Federal Agencies
// Digital Guidelines Initiative and it is in the public domain.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#include "GUI/Qt/GUI_Main_Core_Table.h"
#include "GUI/Qt/GUI_Main.h"
#include "GUI/Qt/GUI_Main_xxxx_Bext.h"
#include "GUI/Qt/GUI_Main_xxxx_CodingHistoryDialog.h"
#include "GUI/Qt/GUI_Main_xxxx_DateDialog.h"
#include "GUI/Qt/GUI_Main_xxxx_Loudness.h"
#include "GUI/Qt/GUI_Main_xxxx_TextEditDialog.h"
#include "GUI/Qt/GUI_Main_xxxx_TimeReferenceDialog.h"
#include "GUI/Qt/GUI_Main_xxxx_UmidDialog.h"
#include "GUI/Qt/GUI_Main_xxxx_ContextMenu.h"
#include "Common/Core.h"
#include "ZenLib/ZtringListList.h"
#include <QLabel>
#include <QEvent>
#include <QFont>
#include <QTextEdit>
#include <QDateEdit>
#include <QSpinBox>
#include <QItemDelegate>
#include <QStandardItemModel>
#include <QDate>
#include <QContextMenuEvent>
#include <QAction>
#include <QMenu>
#include <QApplication>
#include <QClipboard>
using namespace ZenLib;
using namespace std;
//---------------------------------------------------------------------------
//***************************************************************************
// Constructor/Destructor
//***************************************************************************
//---------------------------------------------------------------------------
GUI_Main_Core_Table::GUI_Main_Core_Table(Core* _C, GUI_Main* parent)
: GUI_Main_xxxx__Common(_C, parent)
{
}
//***************************************************************************
// Events
//***************************************************************************
//---------------------------------------------------------------------------
void GUI_Main_Core_Table::contextMenuEvent (QContextMenuEvent* Event)
{
//Retrieving data
QList<QTableWidgetItem*> SelectedItems=selectedItems();
if (SelectedItems.size()==1)
{
QTableWidgetItem* Item=itemAt(Event->pos());
if (Item==NULL)
return;
SelectedItems.clear();
SelectedItems.append(Item);
}
QList<QPair<string, string> > Items;
for (int Pos=0; Pos<SelectedItems.size(); Pos++)
{
QTableWidgetItem* Item=SelectedItems.at(Pos);
string FileName=FileName_Before+item(Item->row(), FILENAME_COL)->text().toUtf8().data();
string Field=horizontalHeaderItem(Item->column())->text().toUtf8().data();
Items.append(qMakePair(FileName, Field));
}
int Modified=GUI_Main_xxxx_ContextMenu(Main, C, this).showCoreMenu(Event->globalPos(), Items);
if (Modified==SelectedItems.count())
{
for (int Pos=0; Pos<SelectedItems.size(); Pos++)
{
QTableWidgetItem* Item=SelectedItems.at(Pos);
string FileName=FileName_Before+item(Item->row(), FILENAME_COL)->text().toUtf8().data();
string Field=horizontalHeaderItem(Item->column())->text().toUtf8().data();
//Updating
Ztring NewValue=Ztring().From_UTF8(C->Get(FileName, Field));
NewValue.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
item(Item->row(), Item->column())->setText(QString::fromUtf8(NewValue.To_UTF8().c_str()));
dataChanged(indexFromItem(item(Item->row(), Item->column())), indexFromItem(item(Item->row(), Item->column())));
//Special case
if (Field=="TimeReference")
SetText(*Item, "TimeReference (translated)");
if (Field=="TimeReference (translated)")
SetText(*Item, "TimeReference");
if (Field=="OriginationDate")
SetText(*Item, "OriginationTime");
if (Field=="OriginationTime")
SetText(*Item, "OriginationDate");
//Changing BextVersion Enabled value
SetText (*Item, "BextVersion");
SetEnabled(*Item, "BextVersion");
}
}
else if (Modified>SelectedItems.count())
{
for (int Pos=0; Pos<SelectedItems.size(); Pos++)
{
QTableWidgetItem* Item=SelectedItems.at(Pos);
string FileName=FileName_Before+item(Item->row(), FILENAME_COL)->text().toUtf8().data();
string Field=horizontalHeaderItem(Item->column())->text().toUtf8().data();
for (int Row=0; Row<rowCount(); Row++)
{
string FileName=FileName_Before+item(Row, FILENAME_COL)->text().toUtf8().data();
Ztring NewValue=Ztring().From_UTF8(C->Get(FileName, Field));
NewValue.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
item(Row, Item->column())->setText(QString::fromUtf8(C->Get(FileName, Field).c_str()));
dataChanged(indexFromItem(item(Row, Item->column())), indexFromItem(item(Row, Item->column())));
//Special case
if (Field=="TimeReference")
SetText(*Item, "TimeReference (translated)");
if (Field=="TimeReference (translated)")
SetText(*Item, "TimeReference");
//Changing BextVersion Enabled value
SetText (*Item, "BextVersion");
SetEnabled(*Item, "BextVersion");
}
}
}
//Menu
Main->Menu_Update();
}
//---------------------------------------------------------------------------
void GUI_Main_Core_Table::keyPressEvent(QKeyEvent* Event)
{
if (selectedItems().size()==1)
{
QTableWidgetItem* Item=selectedItems().at(0);
string FileName=FileName_Before+item(Item->row(), FILENAME_COL)->text().toUtf8().data();
string Field=horizontalHeaderItem(Item->column())->text().toUtf8().data();
if (Event->matches(QKeySequence::Copy))
{
QApplication::clipboard()->setText(QString::fromUtf8(C->Get(FileName, Field).c_str()));
Event->accept();
return;
}
else if (Event->matches(QKeySequence::Paste))
{
if (!QApplication::clipboard()->text().isEmpty() && C->IsValid(FileName, Field, QApplication::clipboard()->text().toStdString()))
{
Ztring NewValue=Ztring().From_UTF8(QApplication::clipboard()->text().toStdString());
NewValue.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
item(Item->row(), Item->column())->setText(QString::fromUtf8(NewValue.To_UTF8().c_str()));
dataChanged(indexFromItem(item(Item->row(), Item->column())), indexFromItem(item(Item->row(), Item->column())));
update(indexFromItem(item(Item->row(), Item->column())));
//Special case
if (Field=="TimeReference")
SetText(*Item, "TimeReference (translated)");
if (Field=="TimeReference (translated)")
SetText(*Item, "TimeReference");
if (Field=="OriginationDate")
SetText(*Item, "OriginationTime");
if (Field=="OriginationTime")
SetText(*Item, "OriginationDate");
//Changing BextVersion Enabled value
SetText (*Item, "BextVersion");
SetEnabled(*Item, "BextVersion");
Event->accept();
return;
}
}
}
QTableWidget::keyPressEvent(Event);
}
//---------------------------------------------------------------------------
bool GUI_Main_Core_Table::edit (const QModelIndex &index, EditTrigger trigger, QEvent *Event)
{
//Must we edit or not
if (!index.isValid())
return QTableWidget::edit(index, trigger, Event); //Normal editing
//Init
string FileName=FileName_Before+item(index.row(), FILENAME_COL)->text().toUtf8().data();
string Field=horizontalHeaderItem(index.column())->text().toUtf8().data();
//Line is selected?
if (trigger==CurrentChanged)
{
C->Menu_File_Close_File_FileName_Clear();
C->Menu_File_Close_File_FileName_Set(FileName_Before+item(index.row(), FILENAME_COL)->text().toUtf8().data());
Main->Menu_Update();
}
//Should we handle edition manualy?
if (trigger!=DoubleClicked && trigger!=AnyKeyPressed)
return QTableWidget::edit(index, trigger, Event); //Normal editing
//Retrieving data
QString ModifiedContentQ;
if (trigger==AnyKeyPressed)
{
ModifiedContentQ=((QKeyEvent*)Event)->text(); //What the user has pressed
if (!ModifiedContentQ.isEmpty() && ModifiedContentQ[0]==127)
ModifiedContentQ.clear();
}
else
ModifiedContentQ=index.model()->data(index.model()->index(index.row(), index.column(), rootIndex())).toString(); //Old value
//Description / Originator / OriginatorReference
if (Field=="Description" || Field=="Originator" || Field=="OriginatorReference" || Field=="IARL" || Field=="IART" || Field=="ICMS" || Field=="ICMT" || Field=="ICOP" || Field=="IENG" || Field=="IGNR" || Field=="IKEY" || Field=="IMED" || Field=="INAM" || Field=="IPRD" || Field=="ISBJ" || Field=="ISFT" || Field=="ISRC" || Field=="ISRF" || Field=="ITCH") //Most INFO fields added in order to permit to show warning
{
//User interaction
GUI_Main_xxxx_TextEditDialog* Edit=new GUI_Main_xxxx_TextEditDialog(C, FileName, Field, ModifiedContentQ);
if (Edit->exec()!=QDialog::Accepted)
{
delete Edit; //Edit=NULL;
return false; //No change
}
delete Edit; //Edit=NULL;
//Filling
Ztring NewValue=Ztring().From_UTF8(C->Get(FileName, Field));
NewValue.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
item(index.row(), index.column())->setText(QString::fromUtf8(NewValue.To_UTF8().c_str()));
if (Field=="Originator")
SetText(index, "IARL"); //IARL is sometimes updated if Originator is modified
//Changing BextVersion Enabled value
SetText (index, "BextVersion");
SetEnabled(index, "BextVersion");
return false;
}
//Description / Originator / OriginatorReference
if (Field=="UMID")
{
//User interaction
GUI_Main_xxxx_UmidDialog* Edit=new GUI_Main_xxxx_UmidDialog(C, FileName, Field, ModifiedContentQ, this);
if (Edit->exec()!=QDialog::Accepted)
{
delete Edit; //Edit=NULL;
return false; //No change
}
delete Edit; //Edit=NULL;
//Filling
Ztring NewValue=Ztring().From_UTF8(C->Get(FileName, Field));
NewValue.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
item(index.row(), index.column())->setText(QString::fromUtf8(NewValue.To_UTF8().c_str()));
//Changing BextVersion Enabled value
SetText (index, "BextVersion");
SetEnabled(index, "BextVersion");
return false;
}
//BextVersion
if (Field=="BextVersion")
{
if (Main->Bext_Toggle_Get())
{
//Retrieving data
int8u NewValue=Ztring().From_UTF8(C->Get(FileName, "BextVersion").c_str()).To_int8u();
if (NewValue>=Main->Bext_MaxVersion_Get())
{
bool HasV1=C->Get(FileName, "LoudnessValue").empty() && C->Get(FileName, "LoudnessRange").empty() && C->Get(FileName, "MaxTruePeakLevel").empty() && C->Get(FileName, "MaxMomentaryLoudness").empty() && C->Get(FileName, "MaxShortTermLoudness").empty();
bool HasV0=HasV1 && C->Get(FileName, "UMID").empty();
if (HasV0)
NewValue=0;
else if (HasV1)
NewValue=1;
else
NewValue=2;
}
else
NewValue++;
//Filling
C->Set(FileName, "BextVersion", Ztring::ToZtring(NewValue).To_UTF8());
item(index.row(), index.column())->setText(Ztring::ToZtring(NewValue).To_UTF8().c_str());
Colors_Update(item(index.row(), index.column()), FileName, Field); //Must be forced because normal method does not handle Yes/No
return false;
}
else
{
//User interaction
GUI_Main_xxxx_Bext* Edit=new GUI_Main_xxxx_Bext(C, FileName, Main->Bext_MaxVersion_Get());
if (Edit->exec()!=QDialog::Accepted)
{
delete Edit; //Edit=NULL;
return false; //No change
}
delete Edit; //Edit=NULL;
Ztring NewValue=Ztring().From_UTF8(C->Get(FileName, "BextVersion"));
//Updating
item(index.row(), index.column())->setText(NewValue.To_UTF8().c_str());
Colors_Update(item(index.row(), index.column()), FileName, Field); //Must be forced because normal method does not handle Yes/No
return false;
}
}
//OriginationDate / OriginationTime / ICRD
if (Field=="OriginationDate" || Field=="OriginationTime" || Field=="ICRD")
{
//User interaction
GUI_Main_xxxx_DateDialog* Edit=new GUI_Main_xxxx_DateDialog(C, FileName, Field, ModifiedContentQ);
if (Edit->exec()!=QDialog::Accepted)
{
delete Edit; //Edit=NULL;
return false; //No change
}
delete Edit; //Edit=NULL;
//Updating
Ztring NewValue=Ztring().From_UTF8(C->Get(FileName, Field));
NewValue.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
item(index.row(), index.column())->setText(QString::fromUtf8(NewValue.To_UTF8().c_str()));
//Changing BextVersion Enabled value
SetText (index, "BextVersion");
SetEnabled(index, "BextVersion");
return false;
}
//TimeReference
if (Field=="TimeReference (translated)" || Field=="TimeReference")
{
//User interaction
GUI_Main_xxxx_TimeReferenceDialog* Edit=new GUI_Main_xxxx_TimeReferenceDialog(C, FileName, "TimeReference");
if (Edit->exec()!=QDialog::Accepted)
{
delete Edit; //Edit=NULL;
return false; //No change
}
delete Edit; //Edit=NULL;
//Updating
SetText(index, "TimeReference");
SetText(index, "TimeReference (translated)");
//Changing BextVersion Enabled value
SetText (index, "BextVersion");
SetEnabled(index, "BextVersion");
return false;
}
//History
if (Field=="CodingHistory")
{
//User interaction
GUI_Main_xxxx_CodingHistoryDialog* Edit=new GUI_Main_xxxx_CodingHistoryDialog(C, FileName, Field, ModifiedContentQ, C->Rules.CodingHistory_Rec);
if (Edit->exec()!=QDialog::Accepted)
{
delete Edit; //Edit=NULL;
return false; //No change
}
delete Edit; //Edit=NULL;
//Updating
Ztring NewValue=Ztring().From_UTF8(C->Get(FileName, Field));
NewValue.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
item(index.row(), index.column())->setText(QString::fromUtf8(NewValue.To_UTF8().c_str()));
//Changing BextVersion Enabled value
SetText (index, "BextVersion");
SetEnabled(index, "BextVersion");
return false;
}
//f
if (Field=="LoudnessValue" || Field=="LoudnessRange" || Field=="MaxTruePeakLevel" || Field=="MaxMomentaryLoudness" || Field=="MaxShortTermLoudness")
{
//User interaction
GUI_Main_xxxx_Loudness* Edit=new GUI_Main_xxxx_Loudness(C, FileName, Field, ModifiedContentQ, C->Rules.Tech3285_Req);
if (Edit->exec()!=QDialog::Accepted)
{
delete Edit; //Edit=NULL;
return false; //No change
}
delete Edit; //Edit=NULL;
//Updating
Ztring NewValue=Ztring().From_UTF8(C->Get(FileName, Field));
NewValue.FindAndReplace(__T("\r\n"), __T("\n"), 0, Ztring_Recursive);
item(index.row(), index.column())->setText(QString::fromUtf8(NewValue.To_UTF8().c_str()));
//Changing BextVersion Enabled value
SetText (index, "BextVersion");
SetEnabled(index, "BextVersion");
return false;
}
return QTableWidget::edit(index, trigger, Event); //Normal editing
}
//***************************************************************************
// Helpers
//***************************************************************************
//---------------------------------------------------------------------------
const string &GUI_Main_Core_Table::Fill_Content ()
{
return C->Core_Get();
}
//---------------------------------------------------------------------------
group GUI_Main_Core_Table::Fill_Group ()
{
return Group_Core;
}
//---------------------------------------------------------------------------
bool GUI_Main_Core_Table::Fill_Enabled (const string &FileName, const string &Field, const string &Value)
{
if (Field=="FileName")
return false;
if (Field=="BextVersion")
{
if (Main->Bext_MaxVersion_Get()>2 || Ztring().From_UTF8(C->Get(FileName, "BextVersion")).To_int16u()>Main->Bext_MaxVersion_Get() || (C->Get(FileName, "LoudnessValue").empty() && C->Get(FileName, "LoudnessRange").empty() && C->Get(FileName, "MaxTruePeakLevel").empty() && C->Get(FileName, "MaxMomentaryLoudness").empty() && C->Get(FileName, "MaxShortTermLoudness").empty()))
return true;
else
return false;
}
if (!C->Overwrite_Reject)
return true;
return Value.empty();
}
| 40.161926 | 418 | 0.545004 | JeromeMartinez |
286f3a538930e04128f89bf896e75b997dc6f613 | 1,853 | cpp | C++ | src/engine/Camera/CameraControllers/CameraController.cpp | noasoder/VulkanEngine | c5cde80bb62df4ead23c55b70d0149949d1e4d9e | [
"MIT"
] | 1 | 2022-01-23T14:28:56.000Z | 2022-01-23T14:28:56.000Z | src/engine/Camera/CameraControllers/CameraController.cpp | noasoder/VulkanEngine | c5cde80bb62df4ead23c55b70d0149949d1e4d9e | [
"MIT"
] | 1 | 2021-11-07T22:33:36.000Z | 2021-11-07T22:33:36.000Z | src/engine/Camera/CameraControllers/CameraController.cpp | noasoder/VulkanEngine | c5cde80bb62df4ead23c55b70d0149949d1e4d9e | [
"MIT"
] | null | null | null | #include "Camera/CameraControllers/CameraController.h"
#include "Vulkan.h"
#include "Types.h"
#include "Camera/Camera.h"
#include "Managers/InputManager.h"
#include "Managers/CameraManager.h"
CameraController::CameraController()
: m_currMoveSpeed(0)
, m_moveSpeedSlow(3)
, m_moveSpeed(10)
, m_moveSpeedFast(20)
, m_lastMousePos(0, 0)
{
Camera* currCamera = CameraManager::GetCurrentCamera();
}
CameraController::~CameraController()
{
}
void CameraController::Update(float DeltaTime)
{
glm::vec3 moveLUA = glm::vec3();
glm::vec3 moveRDB = glm::vec3();
if (InputManager::GetKey(GLFW_KEY_W))
moveLUA = moveLUA + glm::vec3(0, 1, 0);
if (InputManager::GetKey(GLFW_KEY_A))
moveLUA = moveLUA + glm::vec3(-1, 0, 0);
if (InputManager::GetKey(GLFW_KEY_S))
moveRDB = moveRDB + glm::vec3(0, -1, 0);
if (InputManager::GetKey(GLFW_KEY_D))
moveRDB = moveRDB + glm::vec3(1, 0, 0);
if (InputManager::GetKey(GLFW_KEY_E))
moveLUA = moveLUA + glm::vec3(0, 0, 1);
if (InputManager::GetKey(GLFW_KEY_Q))
moveRDB = moveRDB + glm::vec3(0, 0, -1);
if (InputManager::GetKey(GLFW_KEY_LEFT_SHIFT))
m_currMoveSpeed = m_moveSpeedFast;
else if (InputManager::GetKey(GLFW_KEY_LEFT_CONTROL))
m_currMoveSpeed = m_moveSpeedSlow;
else
m_currMoveSpeed = m_moveSpeed;
glm::vec3 rot = glm::vec3();
glm::vec3 movePos = (moveLUA + moveRDB) * m_currMoveSpeed * DeltaTime;
glm::vec2 mousePos = InputManager::GetMousePosition();
glm::vec2 mouseMove = (m_lastMousePos - mousePos) * 0.1f;
m_lastMousePos = mousePos;
rot = glm::vec3(mouseMove.y, 0, mouseMove.x);
glm::vec3 moveLength = abs(rot);
Camera* currCamera = CameraManager::GetCurrentCamera();
currCamera->RotateCam(rot, moveLength);
currCamera->TranslateLocal(movePos);
} | 29.887097 | 74 | 0.67728 | noasoder |
2874ea976afa2648f583fbaadd8f3fc514ef2e20 | 118,995 | hpp | C++ | include/vkoGlbFuncs.hpp | alec101/vko | f2d274eb11d28bb718a7a6ce79ea2727cdf1fa0f | [
"Unlicense"
] | 5 | 2019-07-15T18:23:39.000Z | 2019-10-17T00:42:53.000Z | include/vkoGlbFuncs.hpp | alec101/vko | f2d274eb11d28bb718a7a6ce79ea2727cdf1fa0f | [
"Unlicense"
] | null | null | null | include/vkoGlbFuncs.hpp | alec101/vko | f2d274eb11d28bb718a7a6ce79ea2727cdf1fa0f | [
"Unlicense"
] | null | null | null | #pragma once
/// there is a conflict with some WIN32 defines for CreateSemaphore and CreateEvent
#ifdef CreateSemaphore
#undef CreateSemaphore
#endif
#ifdef CreateEvent
#undef CreateEvent
#endif
///============///
// GLOBAL funcs //
///============///
#ifdef VKO_USE_GLOBAL_FUNCS
// VULKAN 1.0 ========================================================================
#ifdef VK_VERSION_1_0
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkInstance *pInstance) {
return (*vkObject::glb())->CreateInstance(pCreateInfo, pAllocator, pInstance); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyInstance(instance, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices(VkInstance instance, uint32_t *pPhysicalDeviceCount, VkPhysicalDevice *pPhysicalDevices) {
return (*vkObject::glb())->EnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures *pFeatures) {
(*vkObject::glb())->GetPhysicalDeviceFeatures(physicalDevice, pFeatures); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties *pFormatProperties) {
(*vkObject::glb())->GetPhysicalDeviceFormatProperties(physicalDevice, format, pFormatProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties *pImageFormatProperties) {
return (*vkObject::glb())->GetPhysicalDeviceImageFormatProperties(physicalDevice, format, type, tiling, usage, flags, pImageFormatProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties *pProperties) {
(*vkObject::glb())->GetPhysicalDeviceProperties(physicalDevice, pProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties *pQueueFamilyProperties) {
(*vkObject::glb())->GetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties *pMemoryProperties) {
(*vkObject::glb())->GetPhysicalDeviceMemoryProperties(physicalDevice, pMemoryProperties); }
inline VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char *pName) {
return (*vkObject::glb())->GetInstanceProcAddr(instance, pName); }
inline VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char *pName) {
return (*vkObject::glb())->GetDeviceProcAddr(device, pName); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDevice *pDevice) {
return (*vkObject::glb())->CreateDevice(physicalDevice, pCreateInfo, pAllocator, pDevice); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyDevice(device, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) {
return (*vkObject::glb())->EnumerateInstanceExtensionProperties(pLayerName, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties(VkPhysicalDevice physicalDevice, const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) {
return (*vkObject::glb())->EnumerateDeviceExtensionProperties(physicalDevice, pLayerName, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties(uint32_t *pPropertyCount, VkLayerProperties *pProperties) {
return (*vkObject::glb())->EnumerateInstanceLayerProperties(pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkLayerProperties *pProperties) {
return (*vkObject::glb())->EnumerateDeviceLayerProperties(physicalDevice, pPropertyCount, pProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue *pQueue) {
(*vkObject::glb())->GetDeviceQueue(device, queueFamilyIndex, queueIndex, pQueue); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence) {
return (*vkObject::glb())->QueueSubmit(queue, submitCount, pSubmits, fence); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle(VkQueue queue) {
return (*vkObject::glb())->QueueWaitIdle(queue); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle(VkDevice device) {
return (*vkObject::glb())->DeviceWaitIdle(device); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory(VkDevice device, const VkMemoryAllocateInfo *pAllocateInfo, const VkAllocationCallbacks *pAllocator, VkDeviceMemory *pMemory) {
return (*vkObject::glb())->AllocateMemory(device, pAllocateInfo, pAllocator, pMemory); }
inline VKAPI_ATTR void VKAPI_CALL vkFreeMemory(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->FreeMemory(device, memory, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void **ppData) {
return (*vkObject::glb())->MapMemory(device, memory, offset, size, flags, ppData); }
inline VKAPI_ATTR void VKAPI_CALL vkUnmapMemory(VkDevice device, VkDeviceMemory memory) {
(*vkObject::glb())->UnmapMemory(device, memory); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) {
return (*vkObject::glb())->FlushMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange *pMemoryRanges) {
return (*vkObject::glb())->InvalidateMappedMemoryRanges(device, memoryRangeCount, pMemoryRanges); }
inline VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment(VkDevice device, VkDeviceMemory memory, VkDeviceSize *pCommittedMemoryInBytes) {
(*vkObject::glb())->GetDeviceMemoryCommitment(device, memory, pCommittedMemoryInBytes); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
return (*vkObject::glb())->BindBufferMemory(device, buffer, memory, memoryOffset); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset) {
return (*vkObject::glb())->BindImageMemory(device, image, memory, memoryOffset); }
inline VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements(VkDevice device, VkBuffer buffer, VkMemoryRequirements *pMemoryRequirements) {
(*vkObject::glb())->GetBufferMemoryRequirements(device, buffer, pMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements(VkDevice device, VkImage image, VkMemoryRequirements *pMemoryRequirements) {
(*vkObject::glb())->GetImageMemoryRequirements(device, image, pMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements(VkDevice device, VkImage image, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements *pSparseMemoryRequirements) {
(*vkObject::glb())->GetImageSparseMemoryRequirements(device, image, pSparseMemoryRequirementCount, pSparseMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t *pPropertyCount, VkSparseImageFormatProperties *pProperties) {
(*vkObject::glb())->GetPhysicalDeviceSparseImageFormatProperties(physicalDevice, format, type, samples, usage, tiling, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, VkFence fence) {
return (*vkObject::glb())->QueueBindSparse(queue, bindInfoCount, pBindInfo, fence); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence(VkDevice device, const VkFenceCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
return (*vkObject::glb())->CreateFence(device, pCreateInfo, pAllocator, pFence); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyFence(VkDevice device, VkFence fence, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyFence(device, fence, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkResetFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences) {
return (*vkObject::glb())->ResetFences(device, fenceCount, pFences); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus(VkDevice device, VkFence fence) {
return (*vkObject::glb())->GetFenceStatus(device, fence); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences(VkDevice device, uint32_t fenceCount, const VkFence *pFences, VkBool32 waitAll, uint64_t timeout) {
return (*vkObject::glb())->WaitForFences(device, fenceCount, pFences, waitAll, timeout); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore(VkDevice device, const VkSemaphoreCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSemaphore *pSemaphore) {
return (*vkObject::glb())->CreateSemaphore(device, pCreateInfo, pAllocator, pSemaphore); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroySemaphore(device, semaphore, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent(VkDevice device, const VkEventCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkEvent *pEvent) {
return (*vkObject::glb())->CreateEvent(device, pCreateInfo, pAllocator, pEvent); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyEvent(VkDevice device, VkEvent event, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyEvent(device, event, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus(VkDevice device, VkEvent event) {
return (*vkObject::glb())->GetEventStatus(device, event); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent(VkDevice device, VkEvent event) {
return (*vkObject::glb())->SetEvent(device, event); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent(VkDevice device, VkEvent event) {
return (*vkObject::glb())->ResetEvent(device, event); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool(VkDevice device, const VkQueryPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkQueryPool *pQueryPool) {
return (*vkObject::glb())->CreateQueryPool(device, pCreateInfo, pAllocator, pQueryPool); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyQueryPool(device, queryPool, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) {
return (*vkObject::glb())->GetQueryPoolResults(device, queryPool, firstQuery, queryCount, dataSize, pData, stride, flags); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer(VkDevice device, const VkBufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBuffer *pBuffer) {
return (*vkObject::glb())->CreateBuffer(device, pCreateInfo, pAllocator, pBuffer); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyBuffer(device, buffer, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView(VkDevice device, const VkBufferViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkBufferView *pView) {
return (*vkObject::glb())->CreateBufferView(device, pCreateInfo, pAllocator, pView); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyBufferView(device, bufferView, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage(VkDevice device, const VkImageCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImage *pImage) {
return (*vkObject::glb())->CreateImage(device, pCreateInfo, pAllocator, pImage); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyImage(VkDevice device, VkImage image, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyImage(device, image, pAllocator); }
inline VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout(VkDevice device, VkImage image, const VkImageSubresource *pSubresource, VkSubresourceLayout *pLayout) {
(*vkObject::glb())->GetImageSubresourceLayout(device, image, pSubresource, pLayout); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView(VkDevice device, const VkImageViewCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkImageView *pView) {
return (*vkObject::glb())->CreateImageView(device, pCreateInfo, pAllocator, pView); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice device, VkImageView imageView, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyImageView(device, imageView, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule(VkDevice device, const VkShaderModuleCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkShaderModule *pShaderModule) {
return (*vkObject::glb())->CreateShaderModule(device, pCreateInfo, pAllocator, pShaderModule); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyShaderModule(device, shaderModule, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache(VkDevice device, const VkPipelineCacheCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineCache *pPipelineCache) {
return (*vkObject::glb())->CreatePipelineCache(device, pCreateInfo, pAllocator, pPipelineCache); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyPipelineCache(device, pipelineCache, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData(VkDevice device, VkPipelineCache pipelineCache, size_t *pDataSize, void *pData) {
return (*vkObject::glb())->GetPipelineCacheData(device, pipelineCache, pDataSize, pData); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache *pSrcCaches) {
return (*vkObject::glb())->MergePipelineCaches(device, dstCache, srcCacheCount, pSrcCaches); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) {
return (*vkObject::glb())->CreateGraphicsPipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) {
return (*vkObject::glb())->CreateComputePipelines(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyPipeline(device, pipeline, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout(VkDevice device,const VkPipelineLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPipelineLayout *pPipelineLayout) {
return (*vkObject::glb())->CreatePipelineLayout(device, pCreateInfo, pAllocator, pPipelineLayout); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyPipelineLayout(device, pipelineLayout, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler(VkDevice device, const VkSamplerCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSampler *pSampler) {
return (*vkObject::glb())->CreateSampler(device, pCreateInfo, pAllocator, pSampler); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroySampler(VkDevice device, VkSampler sampler, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroySampler(device, sampler, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorSetLayout *pSetLayout) {
return (*vkObject::glb())->CreateDescriptorSetLayout(device, pCreateInfo, pAllocator, pSetLayout); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyDescriptorSetLayout(device, descriptorSetLayout, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool(VkDevice device, const VkDescriptorPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorPool *pDescriptorPool) {
return (*vkObject::glb())->CreateDescriptorPool(device, pCreateInfo, pAllocator, pDescriptorPool); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyDescriptorPool(device, descriptorPool, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags) {
return (*vkObject::glb())->ResetDescriptorPool(device, descriptorPool, flags); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets(VkDevice device, const VkDescriptorSetAllocateInfo *pAllocateInfo, VkDescriptorSet *pDescriptorSets) {
return (*vkObject::glb())->AllocateDescriptorSets(device, pAllocateInfo, pDescriptorSets); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets) {
return (*vkObject::glb())->FreeDescriptorSets(device, descriptorPool, descriptorSetCount, pDescriptorSets); }
inline VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet *pDescriptorCopies) {
(*vkObject::glb())->UpdateDescriptorSets(device, descriptorWriteCount, pDescriptorWrites, descriptorCopyCount, pDescriptorCopies); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer(VkDevice device, const VkFramebufferCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkFramebuffer *pFramebuffer) {
return (*vkObject::glb())->CreateFramebuffer(device, pCreateInfo, pAllocator, pFramebuffer); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyFramebuffer(device, framebuffer, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass(VkDevice device, const VkRenderPassCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) {
return (*vkObject::glb())->CreateRenderPass(device, pCreateInfo, pAllocator, pRenderPass); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyRenderPass(device, renderPass, pAllocator); }
inline VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity(VkDevice device, VkRenderPass renderPass, VkExtent2D *pGranularity) {
(*vkObject::glb())->GetRenderAreaGranularity(device, renderPass, pGranularity); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkCommandPool *pCommandPool) {
return (*vkObject::glb())->CreateCommandPool(device, pCreateInfo, pAllocator, pCommandPool); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyCommandPool(device, commandPool, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags) {
return (*vkObject::glb())->ResetCommandPool(device, commandPool, flags); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferAllocateInfo *pAllocateInfo, VkCommandBuffer *pCommandBuffers) {
return (*vkObject::glb())->AllocateCommandBuffers(device, pAllocateInfo, pCommandBuffers); }
inline VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) {
(*vkObject::glb())->FreeCommandBuffers(device, commandPool, commandBufferCount, pCommandBuffers); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo *pBeginInfo) {
return (*vkObject::glb())->BeginCommandBuffer(commandBuffer, pBeginInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer(VkCommandBuffer commandBuffer) {
return (*vkObject::glb())->EndCommandBuffer(commandBuffer); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) {
return (*vkObject::glb())->ResetCommandBuffer(commandBuffer, flags); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline) {
(*vkObject::glb())->CmdBindPipeline(commandBuffer, pipelineBindPoint, pipeline); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport *pViewports) {
(*vkObject::glb())->CmdSetViewport(commandBuffer, firstViewport, viewportCount, pViewports); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *pScissors) {
(*vkObject::glb())->CmdSetScissor(commandBuffer, firstScissor, scissorCount, pScissors); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth(VkCommandBuffer commandBuffer, float lineWidth) {
(*vkObject::glb())->CmdSetLineWidth(commandBuffer, lineWidth); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor) {
(*vkObject::glb())->CmdSetDepthBias(commandBuffer, depthBiasConstantFactor, depthBiasClamp, depthBiasSlopeFactor); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants(VkCommandBuffer commandBuffer, const float blendConstants[4]) {
(*vkObject::glb())->CmdSetBlendConstants(commandBuffer, blendConstants); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds) {
(*vkObject::glb())->CmdSetDepthBounds(commandBuffer, minDepthBounds, maxDepthBounds); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask) {
(*vkObject::glb())->CmdSetStencilCompareMask(commandBuffer, faceMask, compareMask); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask) {
(*vkObject::glb())->CmdSetStencilWriteMask(commandBuffer, faceMask, writeMask); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference) {
(*vkObject::glb())->CmdSetStencilReference(commandBuffer, faceMask, reference); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet *pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t *pDynamicOffsets) {
(*vkObject::glb())->CmdBindDescriptorSets(commandBuffer, pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, dynamicOffsetCount, pDynamicOffsets); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType) {
(*vkObject::glb())->CmdBindIndexBuffer(commandBuffer, buffer, offset, indexType); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets) {
(*vkObject::glb())->CmdBindVertexBuffers(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDraw(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance) {
(*vkObject::glb())->CmdDraw(commandBuffer, vertexCount, instanceCount, firstVertex, firstInstance); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance) {
(*vkObject::glb())->CmdDrawIndexed(commandBuffer, indexCount, instanceCount, firstIndex, vertexOffset, firstInstance); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawIndirect(commandBuffer, buffer, offset, drawCount, stride); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawIndexedIndirect(commandBuffer, buffer, offset, drawCount, stride); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDispatch(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) {
(*vkObject::glb())->CmdDispatch(commandBuffer, groupCountX, groupCountY, groupCountZ); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset) {
(*vkObject::glb())->CmdDispatchIndirect(commandBuffer, buffer, offset); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy *pRegions) {
(*vkObject::glb())->CmdCopyBuffer(commandBuffer, srcBuffer, dstBuffer, regionCount, pRegions); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy *pRegions) {
(*vkObject::glb())->CmdCopyImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit *pRegions, VkFilter filter) {
(*vkObject::glb())->CmdBlitImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions, filter); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy *pRegions) {
(*vkObject::glb())->CmdCopyBufferToImage(commandBuffer, srcBuffer, dstImage, dstImageLayout, regionCount, pRegions); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy *pRegions) {
(*vkObject::glb())->CmdCopyImageToBuffer(commandBuffer, srcImage, srcImageLayout, dstBuffer, regionCount, pRegions); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void *pData) {
(*vkObject::glb())->CmdUpdateBuffer(commandBuffer, dstBuffer, dstOffset, dataSize, pData); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data) {
(*vkObject::glb())->CmdFillBuffer(commandBuffer, dstBuffer, dstOffset, size, data); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue *pColor, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) {
(*vkObject::glb())->CmdClearColorImage(commandBuffer, image, imageLayout, pColor, rangeCount, pRanges); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue *pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange *pRanges) {
(*vkObject::glb())->CmdClearDepthStencilImage(commandBuffer, image, imageLayout, pDepthStencil, rangeCount, pRanges); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment *pAttachments, uint32_t rectCount, const VkClearRect *pRects) {
(*vkObject::glb())->CmdClearAttachments(commandBuffer, attachmentCount, pAttachments, rectCount, pRects); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve *pRegions) {
(*vkObject::glb())->CmdResolveImage(commandBuffer, srcImage, srcImageLayout, dstImage, dstImageLayout, regionCount, pRegions); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
(*vkObject::glb())->CmdSetEvent(commandBuffer, event, stageMask); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask) {
(*vkObject::glb())->CmdResetEvent(commandBuffer, event, stageMask); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) {
(*vkObject::glb())->CmdWaitEvents(commandBuffer, eventCount, pEvents, srcStageMask, dstStageMask, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier *pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier *pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier *pImageMemoryBarriers) {
(*vkObject::glb())->CmdPipelineBarrier(commandBuffer, srcStageMask, dstStageMask, dependencyFlags, memoryBarrierCount, pMemoryBarriers, bufferMemoryBarrierCount, pBufferMemoryBarriers, imageMemoryBarrierCount, pImageMemoryBarriers); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags) {
(*vkObject::glb())->CmdBeginQuery(commandBuffer, queryPool, query, flags); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query) {
(*vkObject::glb())->CmdEndQuery(commandBuffer, queryPool, query); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) {
(*vkObject::glb())->CmdResetQueryPool(commandBuffer, queryPool, firstQuery, queryCount); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query) {
(*vkObject::glb())->CmdWriteTimestamp(commandBuffer, pipelineStage, queryPool, query); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags) {
(*vkObject::glb())->CmdCopyQueryPoolResults(commandBuffer, queryPool, firstQuery, queryCount, dstBuffer, dstOffset, stride, flags); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void *pValues) {
(*vkObject::glb())->CmdPushConstants(commandBuffer, layout, stageFlags, offset, size, pValues); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, VkSubpassContents contents) {
(*vkObject::glb())->CmdBeginRenderPass(commandBuffer, pRenderPassBegin, contents); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass(VkCommandBuffer commandBuffer, VkSubpassContents contents) {
(*vkObject::glb())->CmdNextSubpass(commandBuffer, contents); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass(VkCommandBuffer commandBuffer) {
(*vkObject::glb())->CmdEndRenderPass(commandBuffer); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer *pCommandBuffers) {
(*vkObject::glb())->CmdExecuteCommands(commandBuffer, commandBufferCount, pCommandBuffers); }
#endif // VULKAN 1.0
// VULKAN 1.1 ========================================================================
#ifdef VK_VERSION_1_1
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion(uint32_t *pApiVersion) {
return (*vkObject::glb())->EnumerateInstanceVersion(pApiVersion); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo *pBindInfos) {
return (*vkObject::glb())->BindBufferMemory2(device, bindInfoCount, pBindInfos); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo *pBindInfos) {
return (*vkObject::glb())->BindImageMemory2(device, bindInfoCount, pBindInfos); }
inline VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags *pPeerMemoryFeatures) {
(*vkObject::glb())->GetDeviceGroupPeerMemoryFeatures(device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMask(VkCommandBuffer commandBuffer, uint32_t deviceMask) {
(*vkObject::glb())->CmdSetDeviceMask(commandBuffer, deviceMask); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBase(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) {
(*vkObject::glb())->CmdDispatchBase(commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties) {
return (*vkObject::glb())->EnumeratePhysicalDeviceGroups(instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) {
(*vkObject::glb())->GetImageMemoryRequirements2(device, pInfo, pMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) {
(*vkObject::glb())->GetBufferMemoryRequirements2(device, pInfo, pMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) {
(*vkObject::glb())->GetImageSparseMemoryRequirements2(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures) {
(*vkObject::glb())->GetPhysicalDeviceFeatures2(physicalDevice, pFeatures); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) {
(*vkObject::glb())->GetPhysicalDeviceProperties2(physicalDevice, pProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 *pFormatProperties) {
(*vkObject::glb())->GetPhysicalDeviceFormatProperties2(physicalDevice, format, pFormatProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) {
return (*vkObject::glb())->GetPhysicalDeviceImageFormatProperties2(physicalDevice, pImageFormatInfo, pImageFormatProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties) {
(*vkObject::glb())->GetPhysicalDeviceQueueFamilyProperties2(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) {
(*vkObject::glb())->GetPhysicalDeviceMemoryProperties2(physicalDevice, pMemoryProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties) {
(*vkObject::glb())->GetPhysicalDeviceSparseImageFormatProperties2(physicalDevice, pFormatInfo, pPropertyCount, pProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) {
(*vkObject::glb())->TrimCommandPool(device, commandPool, flags); }
inline VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2(VkDevice device, const VkDeviceQueueInfo2 *pQueueInfo, VkQueue *pQueue) {
(*vkObject::glb())->GetDeviceQueue2(device, pQueueInfo, pQueue); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion) {
return (*vkObject::glb())->CreateSamplerYcbcrConversion(device, pCreateInfo, pAllocator, pYcbcrConversion); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversion(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroySamplerYcbcrConversion(device, ycbcrConversion, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplate(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) {
return (*vkObject::glb())->CreateDescriptorUpdateTemplate(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplate(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyDescriptorUpdateTemplate(device, descriptorUpdateTemplate, pAllocator); }
inline VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void *pData) {
(*vkObject::glb())->UpdateDescriptorSetWithTemplate(device, descriptorSet, descriptorUpdateTemplate, pData); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) {
(*vkObject::glb())->GetPhysicalDeviceExternalBufferProperties(physicalDevice, pExternalBufferInfo, pExternalBufferProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) {
(*vkObject::glb())->GetPhysicalDeviceExternalFenceProperties(physicalDevice, pExternalFenceInfo, pExternalFenceProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties) {
(*vkObject::glb())->GetPhysicalDeviceExternalSemaphoreProperties(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, VkDescriptorSetLayoutSupport *pSupport) {
(*vkObject::glb())->GetDescriptorSetLayoutSupport(device, pCreateInfo, pSupport); }
#endif // VULKAN 1.1
// VULKAN 1.2 ========================================================================
#ifdef VK_VERSION_1_2
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawIndirectCount(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCount(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawIndexedIndirectCount(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass2(VkDevice device, const VkRenderPassCreateInfo2 *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) {
return (*vkObject::glb())->CreateRenderPass2(device, pCreateInfo, pAllocator, pRenderPass); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass2(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, const VkSubpassBeginInfo *pSubpassBeginInfo) {
(*vkObject::glb())->CmdBeginRenderPass2(commandBuffer, pRenderPassBegin, pSubpassBeginInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass2(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo *pSubpassBeginInfo, const VkSubpassEndInfo *pSubpassEndInfo) {
(*vkObject::glb())->CmdNextSubpass2(commandBuffer, pSubpassBeginInfo, pSubpassEndInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2(VkCommandBuffer commandBuffer, const VkSubpassEndInfo *pSubpassEndInfo) {
(*vkObject::glb())->CmdEndRenderPass2(commandBuffer, pSubpassEndInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkResetQueryPool(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) {
(*vkObject::glb())->ResetQueryPool(device, queryPool, firstQuery, queryCount); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreCounterValue(VkDevice device, VkSemaphore semaphore, uint64_t *pValue) {
return (*vkObject::glb())->GetSemaphoreCounterValue(device, semaphore, pValue); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkWaitSemaphores(VkDevice device, const VkSemaphoreWaitInfo *pWaitInfo, uint64_t timeout) {
return (*vkObject::glb())->WaitSemaphores(device, pWaitInfo, timeout); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo) {
return (*vkObject::glb())->SignalSemaphore(device, pSignalInfo); }
inline VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddress(VkDevice device, const VkBufferDeviceAddressInfo *pInfo) {
return (*vkObject::glb())->GetBufferDeviceAddress(device, pInfo); }
inline VKAPI_ATTR uint64_t VKAPI_CALL vkGetBufferOpaqueCaptureAddress(VkDevice device, const VkBufferDeviceAddressInfo *pInfo) {
return (*vkObject::glb())->GetBufferOpaqueCaptureAddress(device, pInfo); }
inline VKAPI_ATTR uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddress(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo *pInfo) {
return (*vkObject::glb())->GetDeviceMemoryOpaqueCaptureAddress(device, pInfo); }
#endif // VK_VERSION_1_2
///========================================================================================///
// EXTENSIONS ============================================================================= //
///========================================================================================///
#ifdef VK_KHR_surface // "VK_KHR_surface"
inline VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroySurfaceKHR(instance, surface, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32 *pSupported) {
return (*vkObject::glb())->GetPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, pSupported); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) {
return (*vkObject::glb())->GetPhysicalDeviceSurfaceCapabilitiesKHR(physicalDevice, surface, pSurfaceCapabilities); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pSurfaceFormatCount, VkSurfaceFormatKHR *pSurfaceFormats) {
return (*vkObject::glb())->GetPhysicalDeviceSurfaceFormatsKHR(physicalDevice, surface, pSurfaceFormatCount, pSurfaceFormats); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes) {
return (*vkObject::glb())->GetPhysicalDeviceSurfacePresentModesKHR(physicalDevice, surface, pPresentModeCount, pPresentModes); }
#endif /// VK_KHR_surface
#ifdef VK_KHR_swapchain // "VK_KHR_swapchain"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR(VkDevice device, const VkSwapchainCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain) {
return (*vkObject::glb())->CreateSwapchainKHR(device, pCreateInfo, pAllocator, pSwapchain); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroySwapchainKHR(device, swapchain, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages) {
return (*vkObject::glb())->GetSwapchainImagesKHR(device, swapchain, pSwapchainImageCount, pSwapchainImages); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t *pImageIndex) {
return (*vkObject::glb())->AcquireNextImageKHR(device, swapchain, timeout, semaphore, fence, pImageIndex); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *pPresentInfo) {
return (*vkObject::glb())->QueuePresentKHR(queue, pPresentInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHR(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pDeviceGroupPresentCapabilities) {
return (*vkObject::glb())->GetDeviceGroupPresentCapabilitiesKHR(device, pDeviceGroupPresentCapabilities); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR *pModes) {
return (*vkObject::glb())->GetDeviceGroupSurfacePresentModesKHR(device, surface, pModes); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t *pRectCount, VkRect2D *pRects) {
return (*vkObject::glb())->GetPhysicalDevicePresentRectanglesKHR(physicalDevice, surface, pRectCount, pRects); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHR(VkDevice device, const VkAcquireNextImageInfoKHR *pAcquireInfo, uint32_t *pImageIndex) {
return (*vkObject::glb())->AcquireNextImage2KHR(device, pAcquireInfo, pImageIndex); }
#endif /// VK_KHR_swapchain
#ifdef VK_KHR_display // "VK_KHR_display"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPropertiesKHR *pProperties) {
return (*vkObject::glb())->GetPhysicalDeviceDisplayPropertiesKHR(physicalDevice, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPlanePropertiesKHR *pProperties) {
return (*vkObject::glb())->GetPhysicalDeviceDisplayPlanePropertiesKHR(physicalDevice, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t *pDisplayCount, VkDisplayKHR *pDisplays) {
return (*vkObject::glb())->GetDisplayPlaneSupportedDisplaysKHR(physicalDevice, planeIndex, pDisplayCount, pDisplays); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t *pPropertyCount, VkDisplayModePropertiesKHR *pProperties) {
return (*vkObject::glb())->GetDisplayModePropertiesKHR(physicalDevice, display, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDisplayModeKHR *pMode) {
return (*vkObject::glb())->CreateDisplayModeKHR(physicalDevice, display, pCreateInfo, pAllocator, pMode); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR *pCapabilities) {
return (*vkObject::glb())->GetDisplayPlaneCapabilitiesKHR(physicalDevice, mode, planeIndex, pCapabilities); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
return (*vkObject::glb())->CreateDisplayPlaneSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); }
#endif /// VK_KHR_display
#ifdef VK_KHR_display_swapchain // "VK_KHR_display_swapchain"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchains) {
return (*vkObject::glb())->CreateSharedSwapchainsKHR(device, swapchainCount, pCreateInfos, pAllocator, pSwapchains); }
#endif /// VK_KHR_display_swapchain
#ifdef VK_KHR_get_physical_device_properties2 // "VK_KHR_get_physical_device_properties2"
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2 *pFeatures) {
(*vkObject::glb())->GetPhysicalDeviceFeatures2KHR(physicalDevice, pFeatures); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) {
(*vkObject::glb())->GetPhysicalDeviceProperties2KHR(physicalDevice, pProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2 *pFormatProperties) {
(*vkObject::glb())->GetPhysicalDeviceFormatProperties2KHR(physicalDevice, format, pFormatProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) {
return (*vkObject::glb())->GetPhysicalDeviceImageFormatProperties2KHR(physicalDevice, pImageFormatInfo, pImageFormatProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR(VkPhysicalDevice physicalDevice, uint32_t *pQueueFamilyPropertyCount, VkQueueFamilyProperties2 *pQueueFamilyProperties) {
(*vkObject::glb())->GetPhysicalDeviceQueueFamilyProperties2KHR(physicalDevice, pQueueFamilyPropertyCount, pQueueFamilyProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2 *pMemoryProperties) {
(*vkObject::glb())->GetPhysicalDeviceMemoryProperties2KHR(physicalDevice, pMemoryProperties); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2 *pFormatInfo, uint32_t *pPropertyCount, VkSparseImageFormatProperties2 *pProperties) {
(*vkObject::glb())->GetPhysicalDeviceSparseImageFormatProperties2KHR(physicalDevice, pFormatInfo, pPropertyCount, pProperties); }
#endif /// VK_KHR_get_physical_device_properties2
#ifdef VK_KHR_device_group // "VK_KHR_device_group"
inline VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHR(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags *pPeerMemoryFeatures) {
(*vkObject::glb())->GetDeviceGroupPeerMemoryFeaturesKHR(device, heapIndex, localDeviceIndex, remoteDeviceIndex, pPeerMemoryFeatures); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMaskKHR(VkCommandBuffer commandBuffer, uint32_t deviceMask) {
(*vkObject::glb())->CmdSetDeviceMaskKHR(commandBuffer, deviceMask); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHR(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ) {
(*vkObject::glb())->CmdDispatchBaseKHR(commandBuffer, baseGroupX, baseGroupY, baseGroupZ, groupCountX, groupCountY, groupCountZ); }
#endif /// VK_KHR_device_group
#ifdef VK_KHR_maintenance1 // "VK_KHR_maintenance1"
inline VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags) {
(*vkObject::glb())->TrimCommandPoolKHR(device, commandPool, flags); }
#endif /// VK_KHR_maintenance1
#ifdef VK_KHR_device_group_creation // "VK_KHR_device_group_creation"
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHR(VkInstance instance, uint32_t *pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties *pPhysicalDeviceGroupProperties) {
return (*vkObject::glb())->EnumeratePhysicalDeviceGroupsKHR(instance, pPhysicalDeviceGroupCount, pPhysicalDeviceGroupProperties); }
#endif /// VK_KHR_device_group_creation
#ifdef VK_KHR_external_memory_capabilities // "VK_KHR_external_memory_capabilities"
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo *pExternalBufferInfo, VkExternalBufferProperties *pExternalBufferProperties) {
(*vkObject::glb())->GetPhysicalDeviceExternalBufferPropertiesKHR(physicalDevice, pExternalBufferInfo, pExternalBufferProperties); }
#endif /// VK_KHR_external_memory_capabilities
#ifdef VK_KHR_external_memory_fd // "VK_KHR_external_memory_fd"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHR(VkDevice device, const VkMemoryGetFdInfoKHR *pGetFdInfo, int *pFd) {
return (*vkObject::glb())->GetMemoryFdKHR(device, pGetFdInfo, pFd); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, int fd, VkMemoryFdPropertiesKHR *pMemoryFdProperties) {
return (*vkObject::glb())->GetMemoryFdPropertiesKHR(device, handleType, fd, pMemoryFdProperties); }
#endif /// VK_KHR_external_memory_fd
#ifdef VK_KHR_external_semaphore_capabilities // "VK_KHR_external_semaphore_capabilities"
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo *pExternalSemaphoreInfo, VkExternalSemaphoreProperties *pExternalSemaphoreProperties) {
(*vkObject::glb())->GetPhysicalDeviceExternalSemaphorePropertiesKHR(physicalDevice, pExternalSemaphoreInfo, pExternalSemaphoreProperties); }
#endif /// VK_KHR_external_semaphore_capabilities
#ifdef VK_KHR_external_semaphore_fd // "VK_KHR_external_semaphore_fd"
inline VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHR(VkDevice device, const VkImportSemaphoreFdInfoKHR *pImportSemaphoreFdInfo) {
return (*vkObject::glb())->ImportSemaphoreFdKHR(device, pImportSemaphoreFdInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR(VkDevice device, const VkSemaphoreGetFdInfoKHR *pGetFdInfo, int *pFd) {
return (*vkObject::glb())->GetSemaphoreFdKHR(device, pGetFdInfo, pFd); }
#endif /// VK_KHR_external_semaphore_fd
#ifdef VK_KHR_push_descriptor // "VK_KHR_push_descriptor"
inline VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetKHR(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet *pDescriptorWrites) {
(*vkObject::glb())->CmdPushDescriptorSetKHR(commandBuffer, pipelineBindPoint, layout, set, descriptorWriteCount, pDescriptorWrites); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void *pData) {
(*vkObject::glb())->CmdPushDescriptorSetWithTemplateKHR(commandBuffer, descriptorUpdateTemplate, layout, set, pData); }
#endif
#ifdef VK_KHR_descriptor_update_template // "VK_KHR_descriptor_update_template"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplateKHR(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDescriptorUpdateTemplate *pDescriptorUpdateTemplate) {
return (*vkObject::glb())->CreateDescriptorUpdateTemplateKHR(device, pCreateInfo, pAllocator, pDescriptorUpdateTemplate); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplateKHR(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyDescriptorUpdateTemplateKHR(device, descriptorUpdateTemplate, pAllocator); }
inline VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void *pData) {
(*vkObject::glb())->UpdateDescriptorSetWithTemplateKHR(device, descriptorSet, descriptorUpdateTemplate, pData); }
#endif /// VK_KHR_descriptor_update_template
#ifdef VK_KHR_create_renderpass2 // "VK_KHR_create_renderpass2"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass2KHR(VkDevice device, const VkRenderPassCreateInfo2KHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkRenderPass *pRenderPass) {
return (*vkObject::glb())->CreateRenderPass2KHR(device, pCreateInfo, pAllocator, pRenderPass); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass2KHR(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo *pRenderPassBegin, const VkSubpassBeginInfoKHR *pSubpassBeginInfo) {
(*vkObject::glb())->CmdBeginRenderPass2KHR(commandBuffer, pRenderPassBegin, pSubpassBeginInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass2KHR(VkCommandBuffer commandBuffer, const VkSubpassBeginInfoKHR *pSubpassBeginInfo, const VkSubpassEndInfoKHR *pSubpassEndInfo) {
(*vkObject::glb())->CmdNextSubpass2KHR(commandBuffer, pSubpassBeginInfo, pSubpassEndInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2KHR(VkCommandBuffer commandBuffer, const VkSubpassEndInfoKHR *pSubpassEndInfo) {
(*vkObject::glb())->CmdEndRenderPass2KHR(commandBuffer, pSubpassEndInfo); }
#endif /// VK_KHR_create_renderpass2
#ifdef VK_KHR_shared_presentable_image // "VK_KHR_shared_presentable_image"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR(VkDevice device, VkSwapchainKHR swapchain) {
return (*vkObject::glb())->GetSwapchainStatusKHR(device, swapchain); }
#endif /// VK_KHR_shared_presentable_image
#ifdef VK_KHR_external_fence_capabilities // "VK_KHR_external_fence_capabilities"
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo *pExternalFenceInfo, VkExternalFenceProperties *pExternalFenceProperties) {
(*vkObject::glb())->GetPhysicalDeviceExternalFencePropertiesKHR(physicalDevice, pExternalFenceInfo, pExternalFenceProperties); }
#endif /// VK_KHR_external_fence_capabilities
#ifdef VK_KHR_external_fence_fd // "VK_KHR_external_fence_fd"
inline VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceFdKHR(VkDevice device, const VkImportFenceFdInfoKHR *pImportFenceFdInfo) {
return (*vkObject::glb())->ImportFenceFdKHR(device, pImportFenceFdInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR(VkDevice device, const VkFenceGetFdInfoKHR *pGetFdInfo, int *pFd) {
return (*vkObject::glb())->GetFenceFdKHR(device, pGetFdInfo, pFd); }
#endif
#ifdef VK_KHR_performance_query // "VK_KHR_performance_query"
inline VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, uint32_t *pCounterCount, VkPerformanceCounterKHR *pCounters, VkPerformanceCounterDescriptionKHR *pCounterDescriptions) {
return (*vkObject::glb())->EnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR(physicalDevice, queueFamilyIndex, pCounterCount, pCounters, pCounterDescriptions); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(VkPhysicalDevice physicalDevice, const VkQueryPoolPerformanceCreateInfoKHR *pPerformanceQueryCreateInfo, uint32_t *pNumPasses) {
(*vkObject::glb())->GetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR(physicalDevice, pPerformanceQueryCreateInfo, pNumPasses); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkAcquireProfilingLockKHR(VkDevice device, const VkAcquireProfilingLockInfoKHR *pInfo) {
return (*vkObject::glb())->AcquireProfilingLockKHR(device, pInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkReleaseProfilingLockKHR(VkDevice device) {
(*vkObject::glb())->ReleaseProfilingLockKHR(device); }
#endif
#ifdef VK_KHR_get_surface_capabilities2 // "VK_KHR_get_surface_capabilities2"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, VkSurfaceCapabilities2KHR *pSurfaceCapabilities) {
return (*vkObject::glb())->GetPhysicalDeviceSurfaceCapabilities2KHR(physicalDevice, pSurfaceInfo, pSurfaceCapabilities); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, uint32_t *pSurfaceFormatCount, VkSurfaceFormat2KHR *pSurfaceFormats) {
return (*vkObject::glb())->GetPhysicalDeviceSurfaceFormats2KHR(physicalDevice, pSurfaceInfo, pSurfaceFormatCount, pSurfaceFormats); }
#endif
#ifdef VK_KHR_get_display_properties2 // "VK_KHR_get_display_properties2"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayProperties2KHR *pProperties) {
return (*vkObject::glb())->GetPhysicalDeviceDisplayProperties2KHR(physicalDevice, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkDisplayPlaneProperties2KHR *pProperties) {
return (*vkObject::glb())->GetPhysicalDeviceDisplayPlaneProperties2KHR(physicalDevice, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModeProperties2KHR(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t *pPropertyCount, VkDisplayModeProperties2KHR *pProperties) {
return (*vkObject::glb())->GetDisplayModeProperties2KHR(physicalDevice, display, pPropertyCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physicalDevice, const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo, VkDisplayPlaneCapabilities2KHR *pCapabilities) {
return (*vkObject::glb())->GetDisplayPlaneCapabilities2KHR(physicalDevice, pDisplayPlaneInfo, pCapabilities); }
#endif
#ifdef VK_KHR_get_memory_requirements2 // "VK_KHR_get_memory_requirements2"
inline VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2KHR(VkDevice device, const VkImageMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) {
(*vkObject::glb())->GetImageMemoryRequirements2KHR(device, pInfo, pMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2KHR(VkDevice device, const VkBufferMemoryRequirementsInfo2 *pInfo, VkMemoryRequirements2 *pMemoryRequirements) {
(*vkObject::glb())->GetBufferMemoryRequirements2KHR(device, pInfo, pMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR(VkDevice device, const VkImageSparseMemoryRequirementsInfo2 *pInfo, uint32_t *pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2 *pSparseMemoryRequirements) {
(*vkObject::glb())->GetImageSparseMemoryRequirements2KHR(device, pInfo, pSparseMemoryRequirementCount, pSparseMemoryRequirements); }
#endif
#ifdef VK_KHR_sampler_ycbcr_conversion // "VK_KHR_sampler_ycbcr_conversion"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversionKHR(VkDevice device, const VkSamplerYcbcrConversionCreateInfo *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSamplerYcbcrConversion *pYcbcrConversion) {
return (*vkObject::glb())->CreateSamplerYcbcrConversionKHR(device, pCreateInfo, pAllocator, pYcbcrConversion); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversionKHR(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroySamplerYcbcrConversionKHR(device, ycbcrConversion, pAllocator); }
#endif
#ifdef VK_KHR_bind_memory2 // "VK_KHR_bind_memory2"
inline VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo *pBindInfos) {
return (*vkObject::glb())->BindBufferMemory2KHR(device, bindInfoCount, pBindInfos); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHR(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo *pBindInfos) {
return (*vkObject::glb())->BindImageMemory2KHR(device, bindInfoCount, pBindInfos); }
#endif
#ifdef VK_KHR_maintenance3 // "VK_KHR_maintenance3"
inline VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupportKHR(VkDevice device, const VkDescriptorSetLayoutCreateInfo *pCreateInfo, VkDescriptorSetLayoutSupport *pSupport) {
(*vkObject::glb())->GetDescriptorSetLayoutSupportKHR(device, pCreateInfo, pSupport); }
#endif
#ifdef VK_KHR_draw_indirect_count // "VK_KHR_draw_indirect_count"
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawIndirectCountKHR(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountKHR(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawIndexedIndirectCountKHR(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); }
#endif
#ifdef VK_KHR_timeline_semaphore // "VK_KHR_timeline_semaphore"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreCounterValueKHR(VkDevice device, VkSemaphore semaphore, uint64_t *pValue) {
return (*vkObject::glb())->GetSemaphoreCounterValueKHR(device, semaphore, pValue); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkWaitSemaphoresKHR(VkDevice device, const VkSemaphoreWaitInfo *pWaitInfo, uint64_t timeout) {
return (*vkObject::glb())->WaitSemaphoresKHR(device, pWaitInfo, timeout); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkSignalSemaphoreKHR(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo) {
return (*vkObject::glb())->SignalSemaphoreKHR(device, pSignalInfo); }
#endif
#ifdef VK_KHR_pipeline_executable_properties // "VK_KHR_pipeline_executable_properties"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutablePropertiesKHR(VkDevice device, const VkPipelineInfoKHR *pPipelineInfo, uint32_t *pExecutableCount, VkPipelineExecutablePropertiesKHR *pProperties) {
return (*vkObject::glb())->GetPipelineExecutablePropertiesKHR(device, pPipelineInfo, pExecutableCount, pProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutableStatisticsKHR(VkDevice device, const VkPipelineExecutableInfoKHR *pExecutableInfo, uint32_t *pStatisticCount, VkPipelineExecutableStatisticKHR *pStatistics) {
return (*vkObject::glb())->GetPipelineExecutableStatisticsKHR(device, pExecutableInfo, pStatisticCount, pStatistics); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutableInternalRepresentationsKHR(VkDevice device, const VkPipelineExecutableInfoKHR *pExecutableInfo, uint32_t *pInternalRepresentationCount, VkPipelineExecutableInternalRepresentationKHR *pInternalRepresentations) {
return (*vkObject::glb())->GetPipelineExecutableInternalRepresentationsKHR(device, pExecutableInfo, pInternalRepresentationCount, pInternalRepresentations); }
#endif
#ifdef VK_EXT_debug_report // "VK_EXT_debug_report"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT *pCallback) {
return (*vkObject::glb())->CreateDebugReportCallbackEXT(instance, pCreateInfo, pAllocator, pCallback); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyDebugReportCallbackEXT(instance, callback, pAllocator); }
inline VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char *pLayerPrefix, const char *pMessage) {
(*vkObject::glb())->DebugReportMessageEXT(instance, flags, objectType, object, location, messageCode, pLayerPrefix, pMessage); }
#endif
#ifdef VK_EXT_debug_marker // "VK_EXT_debug_marker"
inline VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT(VkDevice device, const VkDebugMarkerObjectTagInfoEXT *pTagInfo) {
return (*vkObject::glb())->DebugMarkerSetObjectTagEXT(device, pTagInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT(VkDevice device, const VkDebugMarkerObjectNameInfoEXT *pNameInfo) {
return (*vkObject::glb())->DebugMarkerSetObjectNameEXT(device, pNameInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT *pMarkerInfo) {
(*vkObject::glb())->CmdDebugMarkerBeginEXT(commandBuffer, pMarkerInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT(VkCommandBuffer commandBuffer) {
(*vkObject::glb())->CmdDebugMarkerEndEXT(commandBuffer); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT *pMarkerInfo) {
(*vkObject::glb())->CmdDebugMarkerInsertEXT(commandBuffer, pMarkerInfo); }
#endif
#ifdef VK_EXT_transform_feedback // "VK_EXT_transform_feedback"
inline VKAPI_ATTR void VKAPI_CALL vkCmdBindTransformFeedbackBuffersEXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes) {
(*vkObject::glb())->CmdBindTransformFeedbackBuffersEXT(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets, pSizes); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBeginTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer *pCounterBuffers, const VkDeviceSize *pCounterBufferOffsets) {
(*vkObject::glb())->CmdBeginTransformFeedbackEXT(commandBuffer, firstCounterBuffer, counterBufferCount, pCounterBuffers, pCounterBufferOffsets); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdEndTransformFeedbackEXT(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer *pCounterBuffers, const VkDeviceSize *pCounterBufferOffsets) {
(*vkObject::glb())->CmdEndTransformFeedbackEXT(commandBuffer, firstCounterBuffer, counterBufferCount, pCounterBuffers, pCounterBufferOffsets); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBeginQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags, uint32_t index) {
(*vkObject::glb())->CmdBeginQueryIndexedEXT(commandBuffer, queryPool, query, flags, index); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdEndQueryIndexedEXT(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, uint32_t index) {
(*vkObject::glb())->CmdEndQueryIndexedEXT(commandBuffer, queryPool, query, index); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectByteCountEXT(VkCommandBuffer commandBuffer, uint32_t instanceCount, uint32_t firstInstance, VkBuffer counterBuffer, VkDeviceSize counterBufferOffset, uint32_t counterOffset, uint32_t vertexStride) {
(*vkObject::glb())->CmdDrawIndirectByteCountEXT(commandBuffer, instanceCount, firstInstance, counterBuffer, counterBufferOffset, counterOffset, vertexStride); }
#endif
#ifdef VK_NVX_image_view_handle
inline VKAPI_ATTR uint32_t VKAPI_CALL vkGetImageViewHandleNVX(VkDevice device, const VkImageViewHandleInfoNVX *pInfo) {
return (*vkObject::glb())->GetImageViewHandleNVX(device, pInfo); }
#endif
#ifdef VK_AMD_draw_indirect_count // "VK_AMD_draw_indirect_count"
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawIndexedIndirectCountAMD(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); }
#endif
#ifdef VK_AMD_shader_info // "VK_AMD_shader_info"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetShaderInfoAMD(VkDevice device, VkPipeline pipeline, VkShaderStageFlagBits shaderStage, VkShaderInfoTypeAMD infoType, size_t *pInfoSize, void *pInfo) {
return (*vkObject::glb())->GetShaderInfoAMD(device, pipeline, shaderStage, infoType, pInfoSize, pInfo); }
#endif
#ifdef VK_NV_external_memory_capabilities // "VK_NV_external_memory_capabilities"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesNV(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV *pExternalImageFormatProperties) {
return (*vkObject::glb())->GetPhysicalDeviceExternalImageFormatPropertiesNV(physicalDevice, format, type, tiling, usage, flags, externalHandleType, pExternalImageFormatProperties); }
#endif
#ifdef VK_EXT_conditional_rendering // "VK_EXT_conditional_rendering"
inline VKAPI_ATTR void VKAPI_CALL vkCmdBeginConditionalRenderingEXT(VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT *pConditionalRenderingBegin) {
(*vkObject::glb())->CmdBeginConditionalRenderingEXT(commandBuffer, pConditionalRenderingBegin); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdEndConditionalRenderingEXT(VkCommandBuffer commandBuffer) {
(*vkObject::glb())->CmdEndConditionalRenderingEXT(commandBuffer); }
#endif
#ifdef VK_NVX_device_generated_commands // "VK_NVX_device_generated_commands"
inline VKAPI_ATTR void VKAPI_CALL vkCmdProcessCommandsNVX(VkCommandBuffer commandBuffer, const VkCmdProcessCommandsInfoNVX *pProcessCommandsInfo) {
(*vkObject::glb())->CmdProcessCommandsNVX(commandBuffer, pProcessCommandsInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdReserveSpaceForCommandsNVX(VkCommandBuffer commandBuffer, const VkCmdReserveSpaceForCommandsInfoNVX *pReserveSpaceInfo) {
(*vkObject::glb())->CmdReserveSpaceForCommandsNVX(commandBuffer, pReserveSpaceInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNVX(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNVX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkIndirectCommandsLayoutNVX *pIndirectCommandsLayout) {
return (*vkObject::glb())->CreateIndirectCommandsLayoutNVX(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNVX(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyIndirectCommandsLayoutNVX(device, indirectCommandsLayout, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateObjectTableNVX(VkDevice device, const VkObjectTableCreateInfoNVX *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkObjectTableNVX *pObjectTable) {
return (*vkObject::glb())->CreateObjectTableNVX(device, pCreateInfo, pAllocator, pObjectTable); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyObjectTableNVX(VkDevice device, VkObjectTableNVX objectTable, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyObjectTableNVX(device, objectTable, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkRegisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectTableEntryNVX *const *ppObjectTableEntries, const uint32_t *pObjectIndices) {
return (*vkObject::glb())->RegisterObjectsNVX(device, objectTable, objectCount, ppObjectTableEntries, pObjectIndices); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkUnregisterObjectsNVX(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectEntryTypeNVX *pObjectEntryTypes, const uint32_t *pObjectIndices) {
return (*vkObject::glb())->UnregisterObjectsNVX(device, objectTable, objectCount, pObjectEntryTypes, pObjectIndices); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX(VkPhysicalDevice physicalDevice, VkDeviceGeneratedCommandsFeaturesNVX *pFeatures, VkDeviceGeneratedCommandsLimitsNVX *pLimits) {
(*vkObject::glb())->GetPhysicalDeviceGeneratedCommandsPropertiesNVX(physicalDevice, pFeatures, pLimits); }
#endif
#ifdef VK_NV_clip_space_w_scaling // "VK_NV_clip_space_w_scaling"
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV *pViewportWScalings) {
(*vkObject::glb())->CmdSetViewportWScalingNV(commandBuffer, firstViewport, viewportCount, pViewportWScalings); }
#endif
#ifdef VK_EXT_direct_mode_display // "VK_EXT_direct_mode_display"
inline VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT(VkPhysicalDevice physicalDevice, VkDisplayKHR display) {
return (*vkObject::glb())->ReleaseDisplayEXT(physicalDevice, display); }
#endif
#ifdef VK_EXT_display_surface_counter // "VK_EXT_display_surface_counter"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT *pSurfaceCapabilities) {
return (*vkObject::glb())->GetPhysicalDeviceSurfaceCapabilities2EXT(physicalDevice, surface, pSurfaceCapabilities); }
#endif
#ifdef VK_EXT_display_control // "VK_EXT_display_control"
inline VKAPI_ATTR VkResult VKAPI_CALL vkDisplayPowerControlEXT(VkDevice device, VkDisplayKHR display, const VkDisplayPowerInfoEXT *pDisplayPowerInfo) {
return (*vkObject::glb())->DisplayPowerControlEXT(device, display, pDisplayPowerInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDeviceEventEXT(VkDevice device, const VkDeviceEventInfoEXT *pDeviceEventInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
return (*vkObject::glb())->RegisterDeviceEventEXT(device, pDeviceEventInfo, pAllocator, pFence); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDisplayEventEXT(VkDevice device, VkDisplayKHR display, const VkDisplayEventInfoEXT *pDisplayEventInfo, const VkAllocationCallbacks *pAllocator, VkFence *pFence) {
return (*vkObject::glb())->RegisterDisplayEventEXT(device, display, pDisplayEventInfo, pAllocator, pFence); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainCounterEXT(VkDevice device, VkSwapchainKHR swapchain, VkSurfaceCounterFlagBitsEXT counter, uint64_t *pCounterValue) {
return (*vkObject::glb())->GetSwapchainCounterEXT(device, swapchain, counter, pCounterValue); }
#endif
#ifdef VK_GOOGLE_display_timing // "VK_GOOGLE_display_timing"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetRefreshCycleDurationGOOGLE(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE *pDisplayTimingProperties) {
return (*vkObject::glb())->GetRefreshCycleDurationGOOGLE(device, swapchain, pDisplayTimingProperties); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE(VkDevice device, VkSwapchainKHR swapchain, uint32_t *pPresentationTimingCount, VkPastPresentationTimingGOOGLE *pPresentationTimings) {
return (*vkObject::glb())->GetPastPresentationTimingGOOGLE(device, swapchain, pPresentationTimingCount, pPresentationTimings); }
#endif
#ifdef VK_EXT_discard_rectangles // "VK_EXT_discard_rectangles"
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D *pDiscardRectangles) {
(*vkObject::glb())->CmdSetDiscardRectangleEXT(commandBuffer, firstDiscardRectangle, discardRectangleCount, pDiscardRectangles); }
#endif
#ifdef VK_EXT_hdr_metadata // "VK_EXT_hdr_metadata"
inline VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR *pSwapchains, const VkHdrMetadataEXT *pMetadata) {
(*vkObject::glb())->SetHdrMetadataEXT(device, swapchainCount, pSwapchains, pMetadata); }
#endif
#ifdef VK_EXT_debug_utils // "VK_EXT_debug_utils"
inline VKAPI_ATTR VkResult VKAPI_CALL vkSetDebugUtilsObjectNameEXT(VkDevice device, const VkDebugUtilsObjectNameInfoEXT *pNameInfo) {
return (*vkObject::glb())->SetDebugUtilsObjectNameEXT(device, pNameInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkSetDebugUtilsObjectTagEXT(VkDevice device, const VkDebugUtilsObjectTagInfoEXT *pTagInfo) {
return (*vkObject::glb())->SetDebugUtilsObjectTagEXT(device, pTagInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkQueueBeginDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT *pLabelInfo) {
(*vkObject::glb())->QueueBeginDebugUtilsLabelEXT(queue, pLabelInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkQueueEndDebugUtilsLabelEXT(VkQueue queue) {
(*vkObject::glb())->QueueEndDebugUtilsLabelEXT(queue); }
inline VKAPI_ATTR void VKAPI_CALL vkQueueInsertDebugUtilsLabelEXT(VkQueue queue, const VkDebugUtilsLabelEXT *pLabelInfo) {
(*vkObject::glb())->QueueInsertDebugUtilsLabelEXT(queue, pLabelInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBeginDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo) {
(*vkObject::glb())->CmdBeginDebugUtilsLabelEXT(commandBuffer, pLabelInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdEndDebugUtilsLabelEXT(VkCommandBuffer commandBuffer) {
(*vkObject::glb())->CmdEndDebugUtilsLabelEXT(commandBuffer); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdInsertDebugUtilsLabelEXT(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT *pLabelInfo) {
(*vkObject::glb())->CmdInsertDebugUtilsLabelEXT(commandBuffer, pLabelInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkDebugUtilsMessengerEXT *pMessenger) {
return (*vkObject::glb())->CreateDebugUtilsMessengerEXT(instance, pCreateInfo, pAllocator, pMessenger); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT messenger, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyDebugUtilsMessengerEXT(instance, messenger, pAllocator); }
inline VKAPI_ATTR void VKAPI_CALL vkSubmitDebugUtilsMessageEXT(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData) {
(*vkObject::glb())->SubmitDebugUtilsMessageEXT(instance, messageSeverity, messageTypes, pCallbackData); }
#endif
#ifdef VK_EXT_sample_locations // "VK_EXT_sample_locations"
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetSampleLocationsEXT(VkCommandBuffer commandBuffer, const VkSampleLocationsInfoEXT *pSampleLocationsInfo) {
(*vkObject::glb())->CmdSetSampleLocationsEXT(commandBuffer, pSampleLocationsInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMultisamplePropertiesEXT(VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples, VkMultisamplePropertiesEXT *pMultisampleProperties) {
(*vkObject::glb())->GetPhysicalDeviceMultisamplePropertiesEXT(physicalDevice, samples, pMultisampleProperties); }
#endif
#ifdef VK_EXT_image_drm_format_modifier // "VK_EXT_image_drm_format_modifier"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetImageDrmFormatModifierPropertiesEXT(VkDevice device, VkImage image, VkImageDrmFormatModifierPropertiesEXT *pProperties) {
return (*vkObject::glb())->GetImageDrmFormatModifierPropertiesEXT(device, image, pProperties); }
#endif
#ifdef VK_EXT_validation_cache // "VK_EXT_validation_cache"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateValidationCacheEXT(VkDevice device, const VkValidationCacheCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkValidationCacheEXT *pValidationCache) {
return (*vkObject::glb())->CreateValidationCacheEXT(device, pCreateInfo, pAllocator, pValidationCache); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyValidationCacheEXT(VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyValidationCacheEXT(device, validationCache, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkMergeValidationCachesEXT(VkDevice device, VkValidationCacheEXT dstCache, uint32_t srcCacheCount, const VkValidationCacheEXT *pSrcCaches) {
return (*vkObject::glb())->MergeValidationCachesEXT(device, dstCache, srcCacheCount, pSrcCaches); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetValidationCacheDataEXT(VkDevice device, VkValidationCacheEXT validationCache, size_t *pDataSize, void *pData) {
return (*vkObject::glb())->GetValidationCacheDataEXT(device, validationCache, pDataSize, pData); }
#endif
#ifdef VK_NV_shading_rate_image // "VK_NV_shading_rate_image"
inline VKAPI_ATTR void VKAPI_CALL vkCmdBindShadingRateImageNV(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout) {
(*vkObject::glb())->CmdBindShadingRateImageNV(commandBuffer, imageView, imageLayout); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportShadingRatePaletteNV(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkShadingRatePaletteNV *pShadingRatePalettes) {
(*vkObject::glb())->CmdSetViewportShadingRatePaletteNV(commandBuffer, firstViewport, viewportCount, pShadingRatePalettes); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetCoarseSampleOrderNV(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const VkCoarseSampleOrderCustomNV *pCustomSampleOrders) {
(*vkObject::glb())->CmdSetCoarseSampleOrderNV(commandBuffer, sampleOrderType, customSampleOrderCount, pCustomSampleOrders); }
#endif
#ifdef VK_NV_ray_tracing // "VK_NV_ray_tracing"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateAccelerationStructureNV(VkDevice device, const VkAccelerationStructureCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkAccelerationStructureNV *pAccelerationStructure) {
return (*vkObject::glb())->CreateAccelerationStructureNV(device, pCreateInfo, pAllocator, pAccelerationStructure); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyAccelerationStructureNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyAccelerationStructureNV(device, accelerationStructure, pAllocator); }
inline VKAPI_ATTR void VKAPI_CALL vkGetAccelerationStructureMemoryRequirementsNV(VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNV *pInfo, VkMemoryRequirements2KHR *pMemoryRequirements) {
(*vkObject::glb())->GetAccelerationStructureMemoryRequirementsNV(device, pInfo, pMemoryRequirements); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkBindAccelerationStructureMemoryNV(VkDevice device, uint32_t bindInfoCount, const VkBindAccelerationStructureMemoryInfoNV *pBindInfos) {
return (*vkObject::glb())->BindAccelerationStructureMemoryNV(device, bindInfoCount, pBindInfos); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBuildAccelerationStructureNV(VkCommandBuffer commandBuffer, const VkAccelerationStructureInfoNV *pInfo, VkBuffer instanceData, VkDeviceSize instanceOffset, VkBool32 update, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkBuffer scratch, VkDeviceSize scratchOffset) {
(*vkObject::glb())->CmdBuildAccelerationStructureNV(commandBuffer, pInfo, instanceData, instanceOffset, update, dst, src, scratch, scratchOffset); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdCopyAccelerationStructureNV(VkCommandBuffer commandBuffer, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkCopyAccelerationStructureModeNV mode) {
(*vkObject::glb())->CmdCopyAccelerationStructureNV(commandBuffer, dst, src, mode); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdTraceRaysNV(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer, VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride, uint32_t width, uint32_t height, uint32_t depth) {
(*vkObject::glb())->CmdTraceRaysNV(commandBuffer, raygenShaderBindingTableBuffer, raygenShaderBindingOffset, missShaderBindingTableBuffer, missShaderBindingOffset, missShaderBindingStride, hitShaderBindingTableBuffer, hitShaderBindingOffset, hitShaderBindingStride, callableShaderBindingTableBuffer, callableShaderBindingOffset, callableShaderBindingStride, width, height, depth); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateRayTracingPipelinesNV(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoNV *pCreateInfos, const VkAllocationCallbacks *pAllocator, VkPipeline *pPipelines) {
return (*vkObject::glb())->CreateRayTracingPipelinesNV(device, pipelineCache, createInfoCount, pCreateInfos, pAllocator, pPipelines); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetRayTracingShaderGroupHandlesNV(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void *pData) {
return (*vkObject::glb())->GetRayTracingShaderGroupHandlesNV(device, pipeline, firstGroup, groupCount, dataSize, pData); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetAccelerationStructureHandleNV(VkDevice device, VkAccelerationStructureNV accelerationStructure, size_t dataSize, void *pData) {
return (*vkObject::glb())->GetAccelerationStructureHandleNV(device, accelerationStructure, dataSize, pData); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdWriteAccelerationStructuresPropertiesNV(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureNV *pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery) {
(*vkObject::glb())->CmdWriteAccelerationStructuresPropertiesNV(commandBuffer, accelerationStructureCount, pAccelerationStructures, queryType, queryPool, firstQuery); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCompileDeferredNV(VkDevice device, VkPipeline pipeline, uint32_t shader) {
return (*vkObject::glb())->CompileDeferredNV(device, pipeline, shader); }
#endif
#ifdef VK_EXT_external_memory_host // "VK_EXT_external_memory_host"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryHostPointerPropertiesEXT(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void *pHostPointer, VkMemoryHostPointerPropertiesEXT *pMemoryHostPointerProperties) {
return (*vkObject::glb())->GetMemoryHostPointerPropertiesEXT(device, handleType, pHostPointer, pMemoryHostPointerProperties); }
#endif
#ifdef VK_AMD_buffer_marker // "VK_AMD_buffer_marker"
inline VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarkerAMD(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker) {
(*vkObject::glb())->CmdWriteBufferMarkerAMD(commandBuffer, pipelineStage, dstBuffer, dstOffset, marker); }
#endif
#ifdef VK_EXT_calibrated_timestamps // "VK_EXT_calibrated_timestamps"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCalibrateableTimeDomainsEXT(VkPhysicalDevice physicalDevice, uint32_t *pTimeDomainCount, VkTimeDomainEXT *pTimeDomains) {
return (*vkObject::glb())->GetPhysicalDeviceCalibrateableTimeDomainsEXT(physicalDevice, pTimeDomainCount, pTimeDomains); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetCalibratedTimestampsEXT(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoEXT *pTimestampInfos, uint64_t *pTimestamps, uint64_t *pMaxDeviation) {
return (*vkObject::glb())->GetCalibratedTimestampsEXT(device, timestampCount, pTimestampInfos, pTimestamps, pMaxDeviation); }
#endif
#ifdef VK_NV_mesh_shader // "VK_NV_mesh_shader"
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksNV(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask) {
(*vkObject::glb())->CmdDrawMeshTasksNV(commandBuffer, taskCount, firstTask); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksIndirectNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawMeshTasksIndirectNV(commandBuffer, buffer, offset, drawCount, stride); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksIndirectCountNV(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride) {
(*vkObject::glb())->CmdDrawMeshTasksIndirectCountNV(commandBuffer, buffer, offset, countBuffer, countBufferOffset, maxDrawCount, stride); }
#endif
#ifdef VK_NV_scissor_exclusive // "VK_NV_scissor_exclusive"
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorNV(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D *pExclusiveScissors) {
(*vkObject::glb())->CmdSetExclusiveScissorNV(commandBuffer, firstExclusiveScissor, exclusiveScissorCount, pExclusiveScissors); }
#endif
#ifdef VK_NV_device_diagnostic_checkpoints // "VK_NV_device_diagnostic_checkpoints"
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetCheckpointNV(VkCommandBuffer commandBuffer, const void *pCheckpointMarker) {
(*vkObject::glb())->CmdSetCheckpointNV(commandBuffer, pCheckpointMarker); }
inline VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointDataNV(VkQueue queue, uint32_t *pCheckpointDataCount, VkCheckpointDataNV *pCheckpointData) {
(*vkObject::glb())->GetQueueCheckpointDataNV(queue, pCheckpointDataCount, pCheckpointData); }
#endif
#ifdef VK_INTEL_performance_query // "VK_INTEL_performance_query"
inline VKAPI_ATTR VkResult VKAPI_CALL vkInitializePerformanceApiINTEL(VkDevice device, const VkInitializePerformanceApiInfoINTEL *pInitializeInfo) {
return (*vkObject::glb())->InitializePerformanceApiINTEL(device, pInitializeInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkUninitializePerformanceApiINTEL(VkDevice device) {
(*vkObject::glb())->UninitializePerformanceApiINTEL(device); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCmdSetPerformanceMarkerINTEL(VkCommandBuffer commandBuffer, const VkPerformanceMarkerInfoINTEL *pMarkerInfo) {
return (*vkObject::glb())->CmdSetPerformanceMarkerINTEL(commandBuffer, pMarkerInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCmdSetPerformanceStreamMarkerINTEL(VkCommandBuffer commandBuffer, const VkPerformanceStreamMarkerInfoINTEL *pMarkerInfo) {
return (*vkObject::glb())->CmdSetPerformanceStreamMarkerINTEL(commandBuffer, pMarkerInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCmdSetPerformanceOverrideINTEL(VkCommandBuffer commandBuffer, const VkPerformanceOverrideInfoINTEL *pOverrideInfo) {
return (*vkObject::glb())->CmdSetPerformanceOverrideINTEL(commandBuffer, pOverrideInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkAcquirePerformanceConfigurationINTEL(VkDevice device, const VkPerformanceConfigurationAcquireInfoINTEL *pAcquireInfo, VkPerformanceConfigurationINTEL *pConfiguration) {
return (*vkObject::glb())->AcquirePerformanceConfigurationINTEL(device, pAcquireInfo, pConfiguration); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkReleasePerformanceConfigurationINTEL(VkDevice device, VkPerformanceConfigurationINTEL configuration) {
return (*vkObject::glb())->ReleasePerformanceConfigurationINTEL(device, configuration); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkQueueSetPerformanceConfigurationINTEL(VkQueue queue, VkPerformanceConfigurationINTEL configuration) {
return (*vkObject::glb())->QueueSetPerformanceConfigurationINTEL(queue, configuration); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPerformanceParameterINTEL(VkDevice device, VkPerformanceParameterTypeINTEL parameter, VkPerformanceValueINTEL *pValue) {
return (*vkObject::glb())->GetPerformanceParameterINTEL(device, parameter, pValue); }
#endif
#ifdef VK_AMD_display_native_hdr
inline VKAPI_ATTR void VKAPI_CALL vkSetLocalDimmingAMD(VkDevice device, VkSwapchainKHR swapChain, VkBool32 localDimmingEnable) {
(*vkObject::glb())->SetLocalDimmingAMD(device, swapChain, localDimmingEnable); }
#endif
#ifdef VK_EXT_buffer_device_address
inline VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddressEXT(VkDevice device, const VkBufferDeviceAddressInfo *pInfo) {
return (*vkObject::glb())->GetBufferDeviceAddressEXT(device, pInfo); }
#endif
#ifdef VK_EXT_tooling_info
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceToolPropertiesEXT(VkPhysicalDevice physicalDevice, uint32_t *pToolCount, VkPhysicalDeviceToolPropertiesEXT *pToolProperties) {
return (*vkObject::glb())->GetPhysicalDeviceToolPropertiesEXT(physicalDevice, pToolCount, pToolProperties); }
#endif
#ifdef VK_NV_cooperative_matrix
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCooperativeMatrixPropertiesNV(VkPhysicalDevice physicalDevice, uint32_t *pPropertyCount, VkCooperativeMatrixPropertiesNV *pProperties) {
return (*vkObject::glb())->GetPhysicalDeviceCooperativeMatrixPropertiesNV(physicalDevice, pPropertyCount, pProperties); }
#endif
#ifdef VK_EXT_headless_surface
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateHeadlessSurfaceEXT(VkInstance instance, const VkHeadlessSurfaceCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
return (*vkObject::glb())->CreateHeadlessSurfaceEXT(instance, pCreateInfo, pAllocator, pSurface); }
#endif
#ifdef VK_EXT_line_rasterization
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetLineStippleEXT(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern) {
(*vkObject::glb())->CmdSetLineStippleEXT(commandBuffer, lineStippleFactor, lineStipplePattern); }
#endif
#ifdef VK_EXT_host_query_reset
inline VKAPI_ATTR void VKAPI_CALL vkResetQueryPoolEXT(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount) {
(*vkObject::glb())->ResetQueryPoolEXT(device, queryPool, firstQuery, queryCount); }
#endif
#ifdef VK_EXT_extended_dynamic_state
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetCullModeEXT(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode) {
(*vkObject::glb())->CmdSetCullModeEXT(commandBuffer, cullMode); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetFrontFaceEXT(VkCommandBuffer commandBuffer, VkFrontFace frontFace) {
(*vkObject::glb())->CmdSetFrontFaceEXT(commandBuffer, frontFace); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetPrimitiveTopologyEXT(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology) {
(*vkObject::glb())->CmdSetPrimitiveTopologyEXT(commandBuffer, primitiveTopology); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWithCountEXT(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport *pViewports) {
(*vkObject::glb())->CmdSetViewportWithCountEXT(commandBuffer, viewportCount, pViewports); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetScissorWithCountEXT(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D *pScissors) {
(*vkObject::glb())->CmdSetScissorWithCountEXT(commandBuffer, scissorCount, pScissors); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers2EXT(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer *pBuffers, const VkDeviceSize *pOffsets, const VkDeviceSize *pSizes, const VkDeviceSize *pStrides) {
(*vkObject::glb())->CmdBindVertexBuffers2EXT(commandBuffer, firstBinding, bindingCount, pBuffers, pOffsets, pSizes, pStrides); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable) {
(*vkObject::glb())->CmdSetDepthTestEnableEXT(commandBuffer, depthTestEnable); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthWriteEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable) {
(*vkObject::glb())->CmdSetDepthWriteEnableEXT(commandBuffer, depthWriteEnable); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthCompareOpEXT(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp) {
(*vkObject::glb())->CmdSetDepthCompareOpEXT(commandBuffer, depthCompareOp); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBoundsTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable) {
(*vkObject::glb())->CmdSetDepthBoundsTestEnableEXT(commandBuffer, depthBoundsTestEnable); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilTestEnableEXT(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable) {
(*vkObject::glb())->CmdSetStencilTestEnableEXT(commandBuffer, stencilTestEnable); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilOpEXT(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp) {
(*vkObject::glb())->CmdSetStencilOpEXT(commandBuffer, faceMask, failOp, passOp, depthFailOp, compareOp); }
#endif
#ifdef VK_NV_device_generated_commands
inline VKAPI_ATTR void VKAPI_CALL vkGetGeneratedCommandsMemoryRequirementsNV(VkDevice device, const VkGeneratedCommandsMemoryRequirementsInfoNV *pInfo, VkMemoryRequirements2 *pMemoryRequirements) {
(*vkObject::glb())->GetGeneratedCommandsMemoryRequirementsNV(device, pInfo, pMemoryRequirements); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdPreprocessGeneratedCommandsNV(VkCommandBuffer commandBuffer, const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo) {
(*vkObject::glb())->CmdPreprocessGeneratedCommandsNV(commandBuffer, pGeneratedCommandsInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdExecuteGeneratedCommandsNV(VkCommandBuffer commandBuffer, VkBool32 isPreprocessed, const VkGeneratedCommandsInfoNV *pGeneratedCommandsInfo) {
(*vkObject::glb())->CmdExecuteGeneratedCommandsNV(commandBuffer, isPreprocessed, pGeneratedCommandsInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdBindPipelineShaderGroupNV(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline, uint32_t groupIndex) {
(*vkObject::glb())->CmdBindPipelineShaderGroupNV(commandBuffer, pipelineBindPoint, pipeline, groupIndex); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNV(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNV *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkIndirectCommandsLayoutNV *pIndirectCommandsLayout) {
return (*vkObject::glb())->CreateIndirectCommandsLayoutNV(device, pCreateInfo, pAllocator, pIndirectCommandsLayout); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNV(VkDevice device, VkIndirectCommandsLayoutNV indirectCommandsLayout, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyIndirectCommandsLayoutNV(device, indirectCommandsLayout, pAllocator); }
#endif
#ifdef VK_EXT_private_data
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreatePrivateDataSlotEXT(VkDevice device, const VkPrivateDataSlotCreateInfoEXT *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkPrivateDataSlotEXT *pPrivateDataSlot) {
return (*vkObject::glb())->CreatePrivateDataSlotEXT(device, pCreateInfo, pAllocator, pPrivateDataSlot); }
inline VKAPI_ATTR void VKAPI_CALL vkDestroyPrivateDataSlotEXT(VkDevice device, VkPrivateDataSlotEXT privateDataSlot, const VkAllocationCallbacks *pAllocator) {
(*vkObject::glb())->DestroyPrivateDataSlotEXT(device, privateDataSlot, pAllocator); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkSetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t data) {
return (*vkObject::glb())->SetPrivateDataEXT(device, objectType, objectHandle, privateDataSlot, data); }
inline VKAPI_ATTR void VKAPI_CALL vkGetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t *pData) {
(*vkObject::glb())->GetPrivateDataEXT(device, objectType, objectHandle, privateDataSlot, pData); }
#endif
#ifdef VK_KHR_synchronization2
inline VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfoKHR *pDependencyInfo) {
(*vkObject::glb())->CmdSetEvent2KHR( commandBuffer, event, pDependencyInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent2KHR(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2KHR stageMask) {
(*vkObject::glb())->CmdResetEvent2KHR( commandBuffer, event, stageMask); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents2KHR(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent *pEvents, const VkDependencyInfoKHR *pDependencyInfos) {
(*vkObject::glb())->CmdWaitEvents2KHR( commandBuffer, eventCount, pEvents, pDependencyInfos); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier2KHR(VkCommandBuffer commandBuffer, const VkDependencyInfoKHR *pDependencyInfo) {
(*vkObject::glb())->CmdPipelineBarrier2KHR( commandBuffer, pDependencyInfo); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp2KHR(VkCommandBuffer commandBuffer, VkPipelineStageFlags2KHR stage, VkQueryPool queryPool, uint32_t query) {
(*vkObject::glb())->CmdWriteTimestamp2KHR( commandBuffer, stage, queryPool, query); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit2KHR(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2KHR *pSubmits, VkFence fence) {
return (*vkObject::glb())->QueueSubmit2KHR( queue, submitCount, pSubmits, fence); }
inline VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarker2AMD(VkCommandBuffer commandBuffer, VkPipelineStageFlags2KHR stage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker) {
(*vkObject::glb())->CmdWriteBufferMarker2AMD( commandBuffer, stage, dstBuffer, dstOffset, marker); }
inline VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointData2NV(VkQueue queue, uint32_t *pCheckpointDataCount, VkCheckpointData2NV *pCheckpointData) {
(*vkObject::glb())->GetQueueCheckpointData2NV( queue, pCheckpointDataCount, pCheckpointData); }
#endif
// MAC OS specific =========================================================================================
#ifdef VK_MVK_macos_surface // "VK_MVK_macos_surface"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
return (*vkObject::glb())->CreateMacOSSurfaceMVK(instance, pCreateInfo, pAllocator, pSurface); }
#endif
// WAYLAND specific ========================================================================================
#ifdef VK_KHR_wayland_surface // "VK_KHR_wayland_surface"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
return (*vkObject::glb())->CreateWaylandSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); }
inline VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display *display) {
return (*vkObject::glb())->GetPhysicalDeviceWaylandPresentationSupportKHR(physicalDevice, queueFamilyIndex, display); }
#endif
// WINDOWS specifi =========================================================================================
#ifdef VK_KHR_win32_surface // "VK_KHR_win32_surface"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR(VkInstance instance, const VkWin32SurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
return (*vkObject::glb())->CreateWin32SurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); }
inline VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex) {
return (*vkObject::glb())->GetPhysicalDeviceWin32PresentationSupportKHR(physicalDevice, queueFamilyIndex); }
#endif
#ifdef VK_KHR_external_memory_win32 // "VK_KHR_external_memory_win32"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR(VkDevice device, const VkMemoryGetWin32HandleInfoKHR *pGetWin32HandleInfo, HANDLE *pHandle) {
return (*vkObject::glb())->GetMemoryWin32HandleKHR(device, pGetWin32HandleInfo, pHandle); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR *pMemoryWin32HandleProperties) {
return (*vkObject::glb())->GetMemoryWin32HandlePropertiesKHR(device, handleType, handle, pMemoryWin32HandleProperties); }
#endif
#ifdef VK_KHR_external_semaphore_win32 // "VK_KHR_external_semaphore_win32"
inline VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR *pImportSemaphoreWin32HandleInfo) {
return (*vkObject::glb())->ImportSemaphoreWin32HandleKHR(device, pImportSemaphoreWin32HandleInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR *pGetWin32HandleInfo, HANDLE *pHandle) {
return (*vkObject::glb())->GetSemaphoreWin32HandleKHR(device, pGetWin32HandleInfo, pHandle); }
#endif
#ifdef VK_KHR_external_fence_win32 // "VK_KHR_external_fence_win32"
inline VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR(VkDevice device, const VkImportFenceWin32HandleInfoKHR *pImportFenceWin32HandleInfo) {
return (*vkObject::glb())->ImportFenceWin32HandleKHR(device, pImportFenceWin32HandleInfo); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR(VkDevice device, const VkFenceGetWin32HandleInfoKHR *pGetWin32HandleInfo, HANDLE *pHandle) {
return (*vkObject::glb())->GetFenceWin32HandleKHR(device, pGetWin32HandleInfo, pHandle); }
#endif
#ifdef VK_NV_external_memory_win32 // "VK_NV_external_memory_win32"
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE *pHandle) {
return (*vkObject::glb())->GetMemoryWin32HandleNV(device, memory, handleType, pHandle); }
#endif
// LINUX XCB specific ======================================================================================
#ifdef VK_KHR_xcb_surface // "VK_KHR_xcb_surface"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR(VkInstance instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
return (*vkObject::glb())->CreateXcbSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); }
inline VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t *connection, xcb_visualid_t visual_id) {
return (*vkObject::glb())->GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice, queueFamilyIndex, connection, visual_id); }
#endif
// LINUX XLIB specific =====================================================================================
#ifdef VK_KHR_xlib_surface // "VK_KHR_xlib_surface"
inline VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR(VkInstance instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo, const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface) {
return (*vkObject::glb())->CreateXlibSurfaceKHR(instance, pCreateInfo, pAllocator, pSurface); }
inline VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display *dpy, VisualID visualID) {
return (*vkObject::glb())->GetPhysicalDeviceXlibPresentationSupportKHR(physicalDevice, queueFamilyIndex, dpy, visualID); }
#endif
// LINUX XRANDR specific ===================================================================================
#ifdef VK_EXT_acquire_xlib_display // "VK_EXT_acquire_xlib_display"
inline VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, VkDisplayKHR display) {
return (*vkObject::glb())->AcquireXlibDisplayEXT(physicalDevice, dpy, display); }
inline VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT(VkPhysicalDevice physicalDevice, Display *dpy, RROutput rrOutput, VkDisplayKHR *pDisplay) {
return (*vkObject::glb())->GetRandROutputDisplayEXT(physicalDevice, dpy, rrOutput, pDisplay); }
#endif
#endif // VKO_USE_GLOBAL_FUNCS
| 104.290096 | 567 | 0.832186 | alec101 |
287674cd9758974b2b4934219fdbf2b15785df4a | 236 | cpp | C++ | mios/ppt.cpp | nery556/programacionnery | 01174228004bd88d803e8eba70c1333999e3f49a | [
"MIT"
] | null | null | null | mios/ppt.cpp | nery556/programacionnery | 01174228004bd88d803e8eba70c1333999e3f49a | [
"MIT"
] | null | null | null | mios/ppt.cpp | nery556/programacionnery | 01174228004bd88d803e8eba70c1333999e3f49a | [
"MIT"
] | null | null | null | #include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main (){
int numeroaleatorio;
srand(time(NULL));
numeroaleatorio=rand()%2;
cout << numeroaleatorio;
return 0;
} | 13.882353 | 29 | 0.601695 | nery556 |
287695793a67d389af69fd62bd013d1e412758dc | 141 | hxx | C++ | src/Providers/UNIXProviders/DiagnosticServiceRecord/UNIX_DiagnosticServiceRecord_HPUX.hxx | brunolauze/openpegasus-providers-old | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | [
"MIT"
] | 1 | 2020-10-12T09:00:09.000Z | 2020-10-12T09:00:09.000Z | src/Providers/UNIXProviders/DiagnosticServiceRecord/UNIX_DiagnosticServiceRecord_HPUX.hxx | brunolauze/openpegasus-providers-old | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | [
"MIT"
] | null | null | null | src/Providers/UNIXProviders/DiagnosticServiceRecord/UNIX_DiagnosticServiceRecord_HPUX.hxx | brunolauze/openpegasus-providers-old | b00f1aad575bae144b8538bf57ba5fd5582a4ec7 | [
"MIT"
] | null | null | null | #ifdef PEGASUS_OS_HPUX
#ifndef __UNIX_DIAGNOSTICSERVICERECORD_PRIVATE_H
#define __UNIX_DIAGNOSTICSERVICERECORD_PRIVATE_H
#endif
#endif
| 11.75 | 48 | 0.865248 | brunolauze |
2876b0d7a13104045ff285abad912c44dfed7a53 | 3,843 | cpp | C++ | main.cpp | baldurk/dxilprocessor | aca6f4740b61a662bd36c6d0db0c8b8236b96a8c | [
"MIT"
] | 1 | 2021-08-10T01:02:05.000Z | 2021-08-10T01:02:05.000Z | main.cpp | baldurk/dxilprocessor | aca6f4740b61a662bd36c6d0db0c8b8236b96a8c | [
"MIT"
] | null | null | null | main.cpp | baldurk/dxilprocessor | aca6f4740b61a662bd36c6d0db0c8b8236b96a8c | [
"MIT"
] | 1 | 2021-08-10T01:02:06.000Z | 2021-08-10T01:02:06.000Z | /******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2019 Baldur Karlsson
*
* 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 <stdio.h>
#include <vector>
#include "common.h"
#include "dxil_inspect.h"
struct DXBCFileHeader
{
uint32_t fourcc; // "DXBC"
uint8_t hashValue[16]; // unknown hash function and data
uint16_t majorVersion;
uint16_t minorVersion;
uint32_t fileLength;
uint32_t numChunks;
// uint32 chunkOffsets[numChunks]; follows
};
struct DXBCChunkHeader
{
uint32_t fourcc;
uint32_t dataLength;
// byte data[dataLength]; follows
};
DXIL::DebugName *debug_name = NULL;
DXIL::Features features;
int main(int argc, char **argv)
{
if(argc != 2)
{
fprintf(stderr, "Usage: %s [file.dxbc]\n", argv[0]);
return 1;
}
FILE *f = fopen(argv[1], "rb");
if(f == NULL)
{
fprintf(stderr, "Couldn't open file %s: %i\n", argv[1], errno);
return 2;
}
fseek(f, 0, SEEK_END);
long size = ftell(f);
fseek(f, 0, SEEK_SET);
std::vector<byte> buffer;
buffer.resize((size_t)size);
size_t numRead = fread(&buffer[0], 1, buffer.size(), f);
fclose(f);
if(numRead != buffer.size())
{
fprintf(stderr, "Couldn't fully read file %s: %i\n", argv[1], errno);
return 2;
}
const byte *ptr = buffer.data();
const DXBCFileHeader *header = (const DXBCFileHeader *)ptr;
if(buffer.size() < sizeof(*header) || header->fileLength != buffer.size() ||
header->fourcc != MAKE_FOURCC('D', 'X', 'B', 'C'))
{
fprintf(stderr, "Invalid DXBC file\n");
return 3;
}
const uint32_t *offsets = (const uint32_t *)(header + 1);
const DXBCChunkHeader *best_dxil_chunk = NULL;
DXIL::Program *dxil = NULL;
for(uint32_t chunkIdx = 0; chunkIdx < header->numChunks; chunkIdx++)
{
const DXBCChunkHeader *chunk = (const DXBCChunkHeader *)(ptr + offsets[chunkIdx]);
if(chunk->fourcc == MAKE_FOURCC('D', 'X', 'I', 'L'))
{
// only use DXIL if we don't already have debug DXIL
if(!best_dxil_chunk)
best_dxil_chunk = chunk;
}
else if(chunk->fourcc == MAKE_FOURCC('S', 'F', 'I', '0'))
{
features = *(DXIL::Features *)(chunk + 1);
}
else if(chunk->fourcc == MAKE_FOURCC('I', 'L', 'D', 'N'))
{
debug_name = new DXIL::DebugName(chunk + 1, chunk->dataLength);
}
else if(chunk->fourcc == MAKE_FOURCC('I', 'L', 'D', 'B'))
{
// debug DXIL is always the best
best_dxil_chunk = chunk;
}
}
if(best_dxil_chunk)
dxil = new DXIL::Program(best_dxil_chunk + 1, best_dxil_chunk->dataLength);
if(!dxil)
{
fprintf(stderr, "Couldn't find DXIL chunk\n");
return 4;
}
return 0;
} | 28.679104 | 86 | 0.632058 | baldurk |
2877387ff81df56d2b58f4bd431ccaf181d27f44 | 3,712 | cxx | C++ | tests/tdump.cxx | cpackham/novaprova | 770781f2b27f461c99342ed39547f69582f6a7ca | [
"Apache-2.0"
] | 29 | 2015-08-13T01:21:38.000Z | 2020-08-03T01:38:56.000Z | tests/tdump.cxx | gnb/novaprova | c03882c7f078d899cbc49c9ecfc48dd80088cc3e | [
"Apache-2.0"
] | 34 | 2015-08-10T00:55:34.000Z | 2022-03-23T03:08:06.000Z | tests/tdump.cxx | gnb/novaprova | c03882c7f078d899cbc49c9ecfc48dd80088cc3e | [
"Apache-2.0"
] | 9 | 2015-08-13T06:20:53.000Z | 2021-02-26T03:43:18.000Z | /*
* Copyright 2011-2012 Gregory Banks
*
* 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 "np/spiegel/spiegel.hxx"
#include "np/spiegel/dwarf/state.hxx"
#include <string.h>
using namespace std;
using namespace np::util;
static void
dump_types(np::spiegel::dwarf::state_t &state)
{
printf("Types\n");
printf("=====\n");
vector<np::spiegel::compile_unit_t *> units = np::spiegel::get_compile_units();
vector<np::spiegel::compile_unit_t *>::iterator i;
for (i = units.begin() ; i != units.end() ; ++i)
{
printf("%s\n", (*i)->get_absolute_path().c_str());
(*i)->dump_types();
}
printf("\n\n");
}
static void
dump_functions(np::spiegel::dwarf::state_t &state)
{
printf("Functions\n");
printf("=========\n");
vector<np::spiegel::compile_unit_t *> units = np::spiegel::get_compile_units();
vector<np::spiegel::compile_unit_t *>::iterator i;
for (i = units.begin() ; i != units.end() ; ++i)
{
printf("%s\n", (*i)->get_absolute_path().c_str());
vector<np::spiegel::function_t *> fns = (*i)->get_functions();
vector<np::spiegel::function_t *>::iterator j;
for (j = fns.begin() ; j != fns.end() ; ++j)
{
unsigned long addr = (unsigned long)(*j)->get_address();
printf(" ");
if (!addr)
printf("extern");
else
printf("/*0x%lx*/", addr);
printf(" %s\n", (*j)->to_string().c_str());
}
}
printf("\n\n");
}
static void
dump_compile_units(np::spiegel::dwarf::state_t &state)
{
printf("Compile Units\n");
printf("=============\n");
vector<np::spiegel::compile_unit_t *> units = np::spiegel::get_compile_units();
vector<np::spiegel::compile_unit_t *>::iterator i;
for (i = units.begin() ; i != units.end() ; ++i)
{
printf("compile_unit\n");
printf(" name: %s\n", (*i)->get_name().c_str());
printf(" compile_dir: %s\n", (*i)->get_compile_dir().c_str());
printf(" absolute_path: %s\n", (*i)->get_absolute_path().c_str());
printf(" executable: %s\n", (*i)->get_executable());
}
printf("\n\n");
}
extern void __np_terminate_handler();
int
main(int argc, char **argv)
{
argv0 = argv[0];
const char *a0 = 0;
const char *filename = 0;
std::set_terminate(__np_terminate_handler);
for (int i = 1 ; i < argc ; i++)
{
if (argv[i][0] == '-')
{
usage:
fatal("Usage: %s [executable]\n", argv0);
}
else
{
if (filename)
goto usage;
filename = argv[i];
}
}
np::spiegel::dwarf::state_t state;
if (filename)
{
if (!state.add_executable(filename))
return 1;
}
else
{
if (!state.add_self())
return 1;
}
if ((a0 = strrchr(argv0, '/')))
a0++;
else
a0 = argv0;
if (!strcmp(a0, "tdumpdvar"))
state.dump_variables();
else if (!strcmp(a0, "tdumpdabbr"))
state.dump_abbrevs();
else if (!strcmp(a0, "tdumpdfn"))
state.dump_functions();
else if (!strcmp(a0, "tdumpdstr"))
state.dump_structs();
else if (!strcmp(a0, "tdumpatype"))
dump_types(state);
else if (!strcmp(a0, "tdumpafn"))
dump_functions(state);
else if (!strcmp(a0, "tdumpacu"))
dump_compile_units(state);
else
fatal("Don't know which dumper to run");
return 0;
}
| 24.746667 | 83 | 0.611261 | cpackham |
287ba2218dcdd35c78d40d99971fd18bfb3f10fe | 24,914 | cpp | C++ | s3/s3_transport/src/s3_transport.cpp | alanking/irods_resource_plugin_s3 | 492839f885f432d30fa904ac9d5f89369d248ece | [
"BSD-3-Clause"
] | null | null | null | s3/s3_transport/src/s3_transport.cpp | alanking/irods_resource_plugin_s3 | 492839f885f432d30fa904ac9d5f89369d248ece | [
"BSD-3-Clause"
] | null | null | null | s3/s3_transport/src/s3_transport.cpp | alanking/irods_resource_plugin_s3 | 492839f885f432d30fa904ac9d5f89369d248ece | [
"BSD-3-Clause"
] | null | null | null | #include "circular_buffer.hpp"
// iRODS includes
#include <transport/transport.hpp>
// misc includes
#include "json.hpp"
#include <libs3.h>
// stdlib and misc includes
#include <string>
#include <thread>
#include <vector>
#include <cstdio>
#include <iostream>
#include <mutex>
#include <condition_variable>
#include <new>
#include <ctime>
#include <random>
// boost includes
#include <boost/algorithm/string/predicate.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/map.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/containers/list.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
#include <boost/container/scoped_allocator.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
// local includes
#include "s3_multipart_shared_data.hpp"
#include "s3_transport.hpp"
namespace irods::experimental::io::s3_transport
{
const int S3_DEFAULT_CIRCULAR_BUFFER_SIZE = 4;
const std::string S3_RESTORATION_TIER_STANDARD{"Standard"};
const unsigned int S3_DEFAULT_RESTORATION_DAYS = 7;
const std::string S3_DEFAULT_RESTORATION_TIER{S3_RESTORATION_TIER_STANDARD};
irods::error get_object_s3_status(const std::string& object_key,
libs3_types::bucket_context& bucket_context,
int64_t& object_size,
object_s3_status& object_status) {
data_for_head_callback data(bucket_context);
S3ResponseHandler head_object_handler = { &s3_head_object_callback::on_response_properties,
&s3_head_object_callback::on_response_complete };
S3_head_object(&bucket_context, object_key.c_str(), 0, 0, &head_object_handler, &data);
if (S3StatusOK != data.status) {
object_status = object_s3_status::DOES_NOT_EXIST;
return SUCCESS();
}
object_size = data.content_length;
if (data.x_amz_storage_class == "GLACIER") {
if (data.x_amz_restore.find("ongoing-request=\"false\"") != std::string::npos) {
// already restored
object_status = object_s3_status::IN_S3;
} else if (data.x_amz_restore.find("ongoing-request=\"true\"") != std::string::npos) {
// being restored
object_status = object_s3_status::IN_GLACIER_RESTORE_IN_PROGRESS;
} else {
object_status = object_s3_status::IN_GLACIER;
}
} else {
object_status = object_s3_status::IN_S3;
}
return SUCCESS();
} // end get_object_s3_status
irods::error handle_glacier_status(const std::string& object_key,
libs3_types::bucket_context& bucket_context,
const unsigned int restoration_days,
const std::string& restoration_tier,
object_s3_status object_status) {
irods::error result = SUCCESS();
switch (object_status) {
case object_s3_status::IN_S3:
break;
case object_s3_status::DOES_NOT_EXIST:
rodsLog(LOG_ERROR, "Object does not exist and open mode requires it to exist.\n");
result = ERROR(S3_FILE_OPEN_ERR, "Object does not exist and open mode requires it to exist.");
break;
case object_s3_status::IN_GLACIER:
result = restore_s3_object(object_key, bucket_context, restoration_days, restoration_tier);
break;
case object_s3_status::IN_GLACIER_RESTORE_IN_PROGRESS:
// restoration is already in progress
result = ERROR(REPLICA_IS_BEING_STAGED, "Object is in glacier and is currently being restored. "
"Try again later.");
break;
default:
// invalid object status - should not happen
result = ERROR(S3_FILE_OPEN_ERR, "Invalid S3 object status detected.");
break;
}
return result;
} // end handle_glacier_status
irods::error restore_s3_object(const std::string& object_key,
libs3_types::bucket_context& bucket_context,
const unsigned int restoration_days,
const std::string& restoration_tier) {
unsigned long thread_id = std::hash<std::thread::id>{}(std::this_thread::get_id());
std::stringstream xml("");
xml << "<RestoreRequest>\n"
<< " <Days>" << restoration_days << "</Days>\n"
<< " <GlacierJobParameters>\n"
<< " <Tier>" << restoration_tier << "</Tier>\n"
<< " </GlacierJobParameters>\n"
<< "</RestoreRequest>\n";
irods::experimental::io::s3_transport::upload_manager upload_manager(bucket_context);
upload_manager.remaining = xml.str().size();
upload_manager.xml = const_cast<char*>(xml.str().c_str());
upload_manager.offset = 0;
std::stringstream msg;
msg.str( std::string() ); // Clear
msg << "Multipart: Restoring object " << object_key.c_str();
rodsLog(LOG_DEBUG, "%s:%d (%s) [[%lu]] %s\n", __FILE__, __LINE__, __FUNCTION__, thread_id,
msg.str().c_str() );
rodsLog(LOG_DEBUG, "%s:%d (%s) [[%lu]] [key=%s] Request: %s\n", __FILE__, __LINE__, __FUNCTION__,
thread_id, object_key.c_str(), xml.str().c_str() );
S3RestoreObjectHandler commit_handler
= { {restore_object_callback::on_response_properties,
restore_object_callback::on_response_completion },
restore_object_callback::on_response };
S3_restore_object(&bucket_context, object_key.c_str(),
&commit_handler, upload_manager.remaining, nullptr, 0, &upload_manager);
rodsLog(LOG_DEBUG, "%s:%d (%s) [[%lu]] [key=%s][manager.status=%s]\n", __FILE__, __LINE__,
__FUNCTION__, thread_id, object_key.c_str(), S3_get_status_name(upload_manager.status));
if (upload_manager.status != S3StatusOK) {
rodsLog(LOG_ERROR, "%s:%d (%s) [[%lu]] S3_restore_object returned error [status=%s][object_key=%s].\n",
__FILE__, __LINE__, __FUNCTION__, thread_id,
S3_get_status_name(upload_manager.status), object_key.c_str());
return ERROR(REPLICA_STAGING_FAILED, "Object is in glacier, but scheduling restoration failed.");
}
return ERROR(REPLICA_IS_BEING_STAGED, "Object is in glacier and has been queued for restoration. "
"Try again later.");
} // end restore_s3_object
int S3_status_is_retryable(S3Status status) {
return ::S3_status_is_retryable(status) || libs3_types::status_error_unknown == status;
}
void print_bucket_context(const libs3_types::bucket_context& bucket_context)
{
rodsLog(LOG_DEBUG, "BucketContext: [hostName=%s] [bucketName=%s][protocol=%d]"
"[uriStyle=%d][accessKeyId=%s][secretAccessKey=%s]"
"[securityToken=%s][stsDate=%d][region=%s]\n",
bucket_context.hostName == nullptr ? "" : bucket_context.hostName,
bucket_context.bucketName == nullptr ? "" : bucket_context.bucketName,
bucket_context.protocol,
bucket_context.uriStyle,
bucket_context.accessKeyId == nullptr ? "" : bucket_context.accessKeyId,
bucket_context.secretAccessKey == nullptr ? "" : bucket_context.secretAccessKey,
bucket_context.securityToken == nullptr ? "" : bucket_context.securityToken,
bucket_context.stsDate,
bucket_context.authRegion);
}
void store_and_log_status( libs3_types::status status,
const libs3_types::error_details *error,
const std::string& function,
const libs3_types::bucket_context& saved_bucket_context,
libs3_types::status& pStatus,
unsigned long thread_id )
{
int log_level = LOG_DEBUG;
if (thread_id == 0) {
thread_id = std::hash<std::thread::id>{}(std::this_thread::get_id());
}
pStatus = status;
if(status != libs3_types::status_ok && status != S3StatusHttpErrorNotFound) {
log_level = LOG_ERROR;
}
rodsLog(log_level, "%s:%d [%s] [[%lu]] libs3_types::status: [%s] - %d\n",
__FILE__, __LINE__, __FUNCTION__, thread_id, S3_get_status_name( status ), static_cast<int>(status) );
if (saved_bucket_context.hostName) {
rodsLog(log_level, "%s:%d [%s] [[%lu]] S3Host: %s\n",
__FILE__, __LINE__, __FUNCTION__, thread_id, saved_bucket_context.hostName );
}
rodsLog(log_level, "%s:%d [%s] [[%lu]] Function: %s\n",
__FILE__, __LINE__, __FUNCTION__, thread_id, function.c_str() );
if (error) {
if (error->message) {
rodsLog(log_level, "%s:%d [%s] [[%lu]] Message: %s\n",
__FILE__, __LINE__, __FUNCTION__, thread_id, error->message);
}
if (error->resource) {
rodsLog(log_level, "%s:%d [%s] [[%lu]] Resource: %s\n",
__FILE__, __LINE__, __FUNCTION__, thread_id, error->resource);
}
if (error->furtherDetails) {
rodsLog(log_level, "%s:%d [%s] [[%lu]] Further Details: %s\n",
__FILE__, __LINE__, __FUNCTION__, thread_id, error->furtherDetails);
}
if (error->extraDetailsCount) {
rodsLog(log_level, "%s:%d [%s] [[%lu]]%s",
__FILE__, __LINE__, __FUNCTION__, thread_id, " Extra Details:\n");
for (int i = 0; i < error->extraDetailsCount; i++) {
rodsLog(log_level, "%s:%d [%s] [[%lu]] %s: %s\n",
__FILE__, __LINE__, __FUNCTION__, thread_id, error->extraDetails[i].name,
error->extraDetails[i].value);
}
}
}
} // end store_and_log_status
// Returns timestamp in usec for delta-t comparisons
// uint64_t provides plenty of headroom
uint64_t get_time_in_microseconds()
{
struct timeval tv;
gettimeofday(&tv, nullptr);
return (tv.tv_sec) * 1000000LL + tv.tv_usec;
} // end get_time_in_microseconds
// Sleep between _s/2 to _s.
// The random addition ensures that threads don't all cluster up and retry
// at the same time (dogpile effect)
void s3_sleep(
int _s) {
std::random_device r;
std::default_random_engine e1(r());
std::uniform_int_distribution<int> uniform_dist(0, RAND_MAX);
int random = uniform_dist(e1);
int sleep_time = (int)((((double)random / (double)RAND_MAX) + 1) * .5 * _s); // sleep between _s/2 and _s
std::this_thread::sleep_for (std::chrono::seconds (sleep_time));
}
namespace s3_head_object_callback
{
libs3_types::status on_response_properties (const libs3_types::response_properties *properties,
void *callback_data)
{
data_for_head_callback *data = (data_for_head_callback*)callback_data;
data->content_length = properties->contentLength;
// read the headers used by GLACIER
if (properties->xAmzStorageClass) {
data->x_amz_storage_class = properties->xAmzStorageClass;
}
if (properties->xAmzRestore) {
data->x_amz_restore = properties->xAmzRestore;
}
return libs3_types::status_ok;
}
void on_response_complete (libs3_types::status status,
const libs3_types::error_details *error,
void *callback_data)
{
data_for_head_callback *data = (data_for_head_callback*)callback_data;
store_and_log_status( status, error, "s3_head_object_callback::on_response_complete", data->bucket_context,
data->status );
}
}
namespace s3_upload
{
namespace initialization_callback
{
libs3_types::status on_response (const libs3_types::char_type* upload_id,
void *callback_data )
{
using named_shared_memory_object =
irods::experimental::interprocess::shared_memory::named_shared_memory_object
<shared_data::multipart_shared_data>;
// upload upload_id in shared memory
// no need to shared_memory_lock as this should already be locked
// upload upload_id in shared memory
upload_manager *manager = (upload_manager *)callback_data;
std::string& shmem_key = manager->shmem_key;
// upload upload_id in shared memory
named_shared_memory_object shm_obj{shmem_key,
manager->shared_memory_timeout_in_seconds,
constants::MAX_S3_SHMEM_SIZE};
// upload upload_id in shared memory - already locked here
shm_obj.exec([upload_id](auto& data) {
data.upload_id = upload_id;
});
// upload upload_id in shared memory
return libs3_types::status_ok;
} // end on_response
libs3_types::status on_response_properties (const libs3_types::response_properties *properties,
void *callback_data)
{
return libs3_types::status_ok;
} // end on_response_properties
void on_response_complete (libs3_types::status status,
const libs3_types::error_details *error,
void *callback_data)
{
upload_manager *data = (upload_manager*)callback_data;
store_and_log_status( status, error, "s3_upload::on_response_complete", data->saved_bucket_context,
data->status );
} // end on_response_complete
} // end namespace initialization_callback
// Uploading the multipart completion XML from our buffer
namespace commit_callback
{
int on_response (int buffer_size,
libs3_types::buffer_type buffer,
void *callback_data)
{
upload_manager *manager = (upload_manager *)callback_data;
long ret = 0;
if (manager->remaining) {
int to_read_count = ((manager->remaining > static_cast<int64_t>(buffer_size)) ?
static_cast<int64_t>(buffer_size) : manager->remaining);
memcpy(buffer, manager->xml.c_str() + manager->offset, to_read_count);
ret = to_read_count;
}
manager->remaining -= ret;
manager->offset += ret;
return static_cast<int>(ret);
} // end commit
libs3_types::status on_response_properties (const libs3_types::response_properties *properties,
void *callback_data)
{
return libs3_types::status_ok;
} // end response_properties
void on_response_completion (libs3_types::status status,
const libs3_types::error_details *error,
void *callback_data)
{
upload_manager *data = (upload_manager*)callback_data;
store_and_log_status( status, error, "s3_upload::on_response_completion", data->saved_bucket_context,
data->status );
// Don't change the global error, we may want to retry at a higher level.
// The WorkerThread will note that status!=OK and act appropriately (retry or fail)
} // end response_completion
} // end namespace commit_callback
namespace cancel_callback
{
libs3_types::status g_response_completion_status = libs3_types::status_ok;
libs3_types::bucket_context *g_response_completion_saved_bucket_context = nullptr;
libs3_types::status on_response_properties (const libs3_types::response_properties *properties,
void *callback_data)
{
return libs3_types::status_ok;
} // response_properties
// S3_abort_multipart_upload() does not allow a callback_data parameter, so pass the
// final operation status using this global.
void on_response_completion (libs3_types::status status,
const libs3_types::error_details *error,
void *callback_data)
{
store_and_log_status( status, error, "cancel_callback::on_response_completion", *g_response_completion_saved_bucket_context,
g_response_completion_status);
// Don't change the global error, we may want to retry at a higher level.
// The WorkerThread will note that status!=OK and act appropriately (retry or fail)
} // end response_completion
} // end namespace cancel_callback
} // end namespace s3_upload
namespace s3_multipart_upload
{
namespace initialization_callback
{
libs3_types::status on_response (const libs3_types::char_type* upload_id,
void *callback_data )
{
using named_shared_memory_object =
irods::experimental::interprocess::shared_memory::named_shared_memory_object
<shared_data::multipart_shared_data>;
// upload upload_id in shared memory
// no need to shared_memory_lock as this should already be locked
// upload upload_id in shared memory
upload_manager *manager = (upload_manager *)callback_data;
std::string& shmem_key = manager->shmem_key;
named_shared_memory_object shm_obj{shmem_key,
manager->shared_memory_timeout_in_seconds,
constants::MAX_S3_SHMEM_SIZE};
// upload upload_id in shared memory - already locked here
shm_obj.exec([upload_id](auto& data) {
data.upload_id = upload_id;
});
// upload upload_id in shared memory
return libs3_types::status_ok;
} // end on_response
libs3_types::status on_response_properties (const libs3_types::response_properties *properties,
void *callback_data)
{
return libs3_types::status_ok;
} // end on_response_properties
void on_response_complete (libs3_types::status status,
const libs3_types::error_details *error,
void *callback_data)
{
upload_manager *data = (upload_manager*)callback_data;
store_and_log_status( status, error, "s3_multipart_upload::on_response_complete", data->saved_bucket_context,
data->status);
} // end on_response_complete
} // end namespace initialization_callback
// Uploading the multipart completion XML from our buffer
namespace commit_callback
{
int on_response (int buffer_size,
libs3_types::buffer_type buffer,
void *callback_data)
{
upload_manager *manager = (upload_manager *)callback_data;
long ret = 0;
if (manager->remaining) {
int to_read_count = ((manager->remaining > static_cast<int64_t>(buffer_size)) ?
static_cast<int64_t>(buffer_size) : manager->remaining);
memcpy(buffer, manager->xml.c_str() + manager->offset, to_read_count);
ret = to_read_count;
}
manager->remaining -= ret;
manager->offset += ret;
return static_cast<int>(ret);
} // end commit
libs3_types::status on_response_properties (const libs3_types::response_properties *properties,
void *callback_data)
{
return libs3_types::status_ok;
} // end response_properties
void on_response_completion (libs3_types::status status,
const libs3_types::error_details *error,
void *callback_data)
{
upload_manager *data = (upload_manager*)callback_data;
store_and_log_status( status, error, "s3_multipart_upload::on_response_completion", data->saved_bucket_context,
data->status );
// Don't change the global error, we may want to retry at a higher level.
// The WorkerThread will note that status!=OK and act appropriately (retry or fail)
} // end response_completion
} // end namespace commit_callback
namespace cancel_callback
{
libs3_types::status g_response_completion_status = libs3_types::status_ok;
libs3_types::bucket_context *g_response_completion_saved_bucket_context = nullptr;
libs3_types::status on_response_properties (const libs3_types::response_properties *properties,
void *callback_data)
{
return libs3_types::status_ok;
} // response_properties
// S3_abort_multipart_upload() does not allow a callback_data parameter, so pass the
// final operation status using this global.
void on_response_completion (libs3_types::status status,
const libs3_types::error_details *error,
void *callback_data)
{
store_and_log_status( status, error, "cancel_callback::on_response_completion", *g_response_completion_saved_bucket_context,
g_response_completion_status );
// Don't change the global error, we may want to retry at a higher level.
// The WorkerThread will note that status!=OK and act appropriately (retry or fail)
} // end response_completion
} // end namespace cancel_callback
} // end namespace s3_multipart_upload
namespace restore_object_callback
{
int on_response (int buffer_size,
libs3_types::buffer_type buffer,
void *callback_data)
{
upload_manager *manager = (upload_manager *)callback_data;
int ret = 0;
if (manager->remaining) {
int to_read_count = (static_cast<int>(manager->remaining) > buffer_size) ?
buffer_size : manager->remaining;
memcpy(buffer, manager->xml.c_str() + manager->offset, to_read_count);
ret = to_read_count;
}
manager->remaining -= ret;
manager->offset += ret;
return ret;
} // end on_response
libs3_types::status on_response_properties (const libs3_types::response_properties *properties,
void *callback_data)
{
return libs3_types::status_ok;
} // end on_response_properties
void on_response_completion (libs3_types::status status,
const libs3_types::error_details *error,
void *callback_data)
{
upload_manager *data = (upload_manager*)callback_data;
if (data) {
store_and_log_status( status, error, "s3_upload::on_response_completion", data->saved_bucket_context,
data->status );
}
// Don't change the global error, we may want to retry at a higher level.
// The WorkerThread will note that status!=OK and act appropriately (retry or fail)
} // end on_response_completion
} // end namespace restore_object_callback
}
| 41.248344 | 140 | 0.586979 | alanking |
2880a4b4059b670cbcf8121de9434d343a6aeabb | 535 | cpp | C++ | EjerciciosClase/ejercicio8-Factura con descuento/factura2.cpp | LaryEscobar/cpp | 6f131350a8fa23b155a3114191c6d63da9709313 | [
"MIT"
] | null | null | null | EjerciciosClase/ejercicio8-Factura con descuento/factura2.cpp | LaryEscobar/cpp | 6f131350a8fa23b155a3114191c6d63da9709313 | [
"MIT"
] | null | null | null | EjerciciosClase/ejercicio8-Factura con descuento/factura2.cpp | LaryEscobar/cpp | 6f131350a8fa23b155a3114191c6d63da9709313 | [
"MIT"
] | null | null | null | #include <iostream>
#include<stdio.h>
using namespace std;
int main (){
double subtotal = 0;
double total = 0;
double imp = 0.15;
int descuento= 0;
double Cdescuento = 0;
double Cimp = 0;
cout <<" Ingrese el subtotal de la facura: " <<endl;
cin >> subtotal;
cout <<" Ingrese el descuento (0,10,15,20): " <<endl;
cin >> descuento;
Cdescuento = (subtotal * descuento) /100 ;
Cimp = (subtotal - Cdescuento )* 0.15 ;
total = subtotal - Cdescuento + Cimp;
cout <<" Total a pagar: " <<total << endl;;
system("pause");
return 0;
} | 18.448276 | 53 | 0.648598 | LaryEscobar |
2881dce4ecbb7eff83db90a0b4d2000f7e2a7d68 | 11,444 | cpp | C++ | demo/widget_show/demo.cpp11.cpp | gfannes/nana | 3b8d33f9a98579684ea0440b6952deabe61bd978 | [
"BSL-1.0"
] | 1 | 2018-02-09T21:25:13.000Z | 2018-02-09T21:25:13.000Z | demo/widget_show/demo.cpp11.cpp | gfannes/nana | 3b8d33f9a98579684ea0440b6952deabe61bd978 | [
"BSL-1.0"
] | null | null | null | demo/widget_show/demo.cpp11.cpp | gfannes/nana | 3b8d33f9a98579684ea0440b6952deabe61bd978 | [
"BSL-1.0"
] | null | null | null | /*
* This is a demo of Nana C++ Library
* Author: Jinhao
* The demo requires Nana 0.6 and C++11 compiler
* Screenshot at http://sourceforge.net/projects/stdex
*/
#include <nana/gui/wvl.hpp>
#include <nana/gui/place.hpp>
#include <nana/gui/widgets/button.hpp>
#include <nana/gui/widgets/combox.hpp>
#include <nana/gui/widgets/label.hpp>
#include <nana/gui/widgets/progress.hpp>
#include <nana/gui/widgets/tabbar.hpp>
#include <nana/gui/widgets/panel.hpp>
#include <nana/gui/widgets/listbox.hpp>
#include <nana/gui/widgets/treebox.hpp>
#include <nana/gui/widgets/checkbox.hpp>
#include <nana/filesystem/file_iterator.hpp>
#include <nana/gui/widgets/date_chooser.hpp>
#include <nana/gui/widgets/textbox.hpp>
#include <nana/gui/widgets/categorize.hpp>
#include <nana/gui/timer.hpp>
#include <nana/gui/tooltip.hpp>
#include <memory>
#include <vector>
namespace demo
{
using namespace nana::gui;
class tab_page_listbox
: public panel<false>
{
public:
tab_page_listbox(window wd)
: panel<false>(wd)
{
place_.bind(*this);
place_.div("<list vertical>");
listbox_.create(*this);
listbox_.append_header(STR("Supported compilers"), 200);
auto cat = listbox_.append(STR("Nana.C++03"));
cat.push_back(STR("GCC 3.4 and later"));
cat.push_back(STR("Visual C++ 2003 and later"));
cat = listbox_.append(STR("Nana.C++11"));
cat.push_back(STR("GCC 4.6 and later"));
cat.push_back(STR("Visual C++ 2012 and later"));
checkbox_.create(*this);
checkbox_.caption(STR("Checkable Listbox"));
checkbox_.make_event<events::click>([this]()
{
this->listbox_.checkable(this->checkbox_.checked());
});
place_.field("list")<<listbox_<<5<<place_.fixed(checkbox_, 30);
}
private:
place place_;
listbox listbox_;
checkbox checkbox_;
};
class tab_page_treebox
: public panel<false>
{
public:
typedef treebox::item_proxy item_proxy;
tab_page_treebox(window wd)
: panel<false>(wd)
{
place_.bind(*this);
place_.div("<tree>");
treebox_.create(*this);
place_.field("tree")<<treebox_;
#if defined(NANA_WINDOWS)
item_proxy node = treebox_.insert(STR("C:"), STR("Local Drive(C:)"));
nana::filesystem::file_iterator i(STR("C:\\")), end;
#elif defined(NANA_LINUX)
//Use a whitespace for the root key string under Linux
item_proxy node = treebox_.insert(STR(" "), STR("Root"));
nana::filesystem::file_iterator i(STR("/")), end;
#endif
for(; i != end; ++i)
{
if(false == i->directory) continue;
treebox_.insert(node, i->name, i->name);
break;
}
treebox_.ext_event().expand = nana::make_fun(*this, &tab_page_treebox::_m_expand);
}
private:
void _m_expand(nana::gui::window, item_proxy node, bool exp)
{
if(!exp) return; //If this is contracted.
nana::string path = treebox_.make_key_path(node, STR("/")) + STR("/");
//Trim the head of whitespace, more portable, because the root
//under Linux is a whitespace
nana::string::size_type path_start_pos = path.find_first_not_of(STR(" "));
if(path_start_pos != nana::string::npos)
path.erase(0, path_start_pos);
//Walk in the path directory for sub directories.
nana::filesystem::file_iterator i(path), end;
for(; i != end; ++i)
{
if(false == i->directory) continue; //If it is not a directory.
item_proxy child = treebox_.insert(node, i->name, i->name);
if(child.empty()) continue;
//Find a directory in child directory, if there is a directory,
//insert it into the child, just insert one node to indicate the
//node has a child and an arrow symbol will be displayed in the
//front of the node.
nana::filesystem::file_iterator u(path + i->name);
for(; u != end; ++u)
{
if(false == u->directory) continue; //If it is not a directory.
treebox_.insert(child, u->name, u->name);
break;
}
}
}
private:
place place_;
treebox treebox_;
};
class tab_page_datechooser
: public panel<false>
{
public:
tab_page_datechooser(window wd)
: panel<false>(wd)
{
date_.create(*this, nana::rectangle(10, 10, 260, 200));
textbox_.create(*this, nana::rectangle(280, 10, 170, 23));
textbox_.tip_string(STR("Input a date:"));
}
private:
date_chooser date_;
textbox textbox_;
};
class tab_page_radiogroup
: public panel<false>
{
public:
tab_page_radiogroup(window wd)
: panel<false>(wd)
{
place_.bind(*this);
place_.div("<weight=5><vertical<check vertical><bottom vertical weight=50>><weight=5>");
const nana::string str[6] = {
STR("Airbus"), STR("AHTOHOB"),
STR("Boeing"), STR("Bombardier"),
STR("Cessna"), STR("EMBRAER")};
for(int i = 0; i < 6; ++i)
{
auto p = std::make_shared<checkbox>(*this);
box_.push_back(p);
//Add the checkbox to the radio group. The radio group does not
//manage the life of checkboxs.
group_.add(*p);
place_.field("check")<<place_.fixed(*p, 20)<<5;
p->caption(str[i]);
p->make_event<events::click>([this]()
{
std::size_t index = this->group_.checked();
nana::string str = this->box_[index]->caption();
this->label_.caption(STR("You have selected ") + str);
this->categorize_.caption(STR("Manufacturer\\" + str));
});
}
label_.create(*this);
label_.caption(STR("Select an airplane manufacturer"));
categorize_.create(*this);
place_.field("bottom")<<place_.fixed(label_, 20)<<5<<place_.fixed(categorize_, 20);
std::map<nana::string, std::vector<nana::string>> map;
auto p = &(map[str[0]]);
p->push_back(STR("320"));
p->push_back(STR("330"));
p = &(map[str[1]]);
p->push_back(STR("An-124"));
p->push_back(STR("An-225"));
p = &(map[str[2]]);
p->push_back(STR("737"));
p->push_back(STR("747"));
p->push_back(STR("757"));
p->push_back(STR("767"));
p->push_back(STR("777"));
p->push_back(STR("787"));
p = &(map[str[3]]);
p->push_back(STR("CRJ"));
p->push_back(STR("Dash 8"));
p = &(map[str[4]]);
p->push_back(STR("C-170"));
p->push_back(STR("C-172"));
p = &(map[str[5]]);
p->push_back(STR("ERJ-145"));
p->push_back(STR("E-195"));
for(auto & mstr: str)
{
categorize_.caption(STR("Manufacturer"));
categorize_.insert(mstr, 0);
for(auto & astr : map[mstr])
categorize_.childset(astr, 0);
}
}
private:
place place_;
radio_group group_;
std::vector<std::shared_ptr<checkbox>> box_;
label label_;
categorize<int> categorize_;
};
class widget_show
: public form
{
public:
widget_show()
: form(API::make_center(500, 400), appear::decorate<appear::sizable>())
{
this->caption(STR("This is a demo of Nana C++ Library"));
place_.bind(*this);
place_.div("vertical<weight=40%<weight=10><vertical <weight=10><table grid[6,4] gap = 10>>><tab weight=20><tab_frame>");
_m_init_buttons();
_m_init_comboxs();
_m_init_labels();
_m_init_progresses();
_m_init_tabbar();
this->make_event<events::unload>([this](const eventinfo& ei)
{
msgbox mb(this->handle(), STR("Question"), msgbox::yes_no);
mb.icon(mb.icon_question);
mb<<STR("Are you sure you want to exit the demo?");
ei.unload.cancel = (mb.pick_no == mb());
});
place_.collocate();
};
private:
void _m_init_buttons()
{
msgbox mb(*this, STR("Msgbox"));
mb.icon(mb.icon_information);
mb<<STR("Button Clicked");
for(int i = 0; i < 3; ++i)
{
auto p = std::make_shared<button>(*this);
buttons_.push_back(p);
place_.field("table")<<place_.room(*p, 2, 1);
p->make_event<events::click>(mb);
}
auto ptr = buttons_[0];
ptr->caption(STR("Normal Button"));
ptr = buttons_[1];
//Nana does not support ICON under Linux now
#if defined(NANA_WINDOWS)
ptr->icon(STR("image.ico"));
#else
ptr->icon(STR("image.bmp"));
#endif
ptr->caption(STR("Button with An Image"));
ptr = buttons_[2];
ptr->caption(STR("Pushed Button"));
ptr->enable_pushed(true);
}
void _m_init_comboxs()
{
for(int i = 0; i < 2; ++i)
{
auto p = std::make_shared<combox>(*this);
comboxs_.push_back(p);
place_.field("table")<<place_.room(*p, 3, 1);
p->push_back(STR("Item 0"));
p->push_back(STR("Item 1"));
}
msgbox mb(*this, STR("Item Selected"));
mb.icon(mb.icon_information);
auto ptr = comboxs_[0];
ptr->editable(true);
ptr->caption(STR("This is an editable combox"));
ptr->ext_event().selected = [this, mb](combox& cmb) mutable
{
mb<<STR("The item ")<<cmb.option()<<STR(" is selected in editable combox");
mb();
//Clear the buffer, otherwise the mb shows the text generated in
//the last selected event.
mb.clear();
};
ptr = comboxs_[1];
ptr->caption(STR("This is an uneditable combox"));
ptr->ext_event().selected = [this, mb](combox& cmb) mutable
{
mb<<STR("The item ")<<cmb.option()<<STR(" is selected in uneditable combox");
mb();
//Clear the buffer, otherwise the mb shows the text generated in
//the last selected event.
mb.clear();
};
}
void _m_init_labels()
{
for(int i = 0; i < 2; ++i)
{
auto p = std::make_shared<label>(*this);
labels_.push_back(p);
place_.field("table")<<place_.room(*p, 3, 1);
}
auto wd = labels_[0];
wd->caption(STR("This is a normal label"));
wd = labels_[1];
wd->format(true);
wd->caption(STR("This is a <bold, color=0xFF0000, font=\"Consolas\">formatted label</>"));
}
void _m_init_progresses()
{
const nana::string tipstr[] = {STR("Unknwon in progress"), STR("Known in progress")};
for(int i = 0; i < 2; ++i)
{
auto p = std::make_shared<progress>(*this);
place_.field("table")<<place_.room(*p, 3, 1);
progresses_.push_back(p);
p->unknown(i == 0); //The first progress is unknown mode, the second is known mode.
tooltip_.set(*p, tipstr[i]);
}
timer_.make_tick([this]()
{
for(auto & p : this->progresses_)
{
//Resets the known mode progress if its value reaches the amount value.
if(false == p->unknown())
{
if(p->value() == p->amount())
p->value(0);
}
p->inc();
}
});
timer_.enable(true);
timer_.interval(80);
}
void _m_init_tabbar()
{
tabbar_.create(*this);
place_.field("tab")<<tabbar_;
tabbar_.push_back(STR("listbox"));
tabpages_.push_back(std::make_shared<tab_page_listbox>(*this));
tabbar_.push_back(STR("treebox"));
tabpages_.push_back(std::make_shared<tab_page_treebox>(*this));
tabbar_.push_back(STR("date_chooser"));
tabpages_.push_back(std::make_shared<tab_page_datechooser>(*this));
tabbar_.push_back(STR("radio_group"));
tabpages_.push_back(std::make_shared<tab_page_radiogroup>(*this));
std::size_t index = 0;
for(auto & i : tabpages_)
{
tabbar_.relate(index++, *i);
place_.field("tab_frame").fasten(*i); //Fasten the tab pages
}
}
private:
//A gird layout management
place place_;
nana::gui::timer timer_;
nana::gui::tooltip tooltip_;
std::vector<std::shared_ptr<button>> buttons_;
std::vector<std::shared_ptr<combox>> comboxs_;
std::vector<std::shared_ptr<label>> labels_;
std::vector<std::shared_ptr<progress>> progresses_;
tabbar<nana::string> tabbar_;
std::vector<std::shared_ptr<panel<false>>> tabpages_;
};//end class widget_show
void go()
{
widget_show wdshow;
wdshow.show();
exec();
}
}
int main()
{
demo::go();
}
| 26.613953 | 123 | 0.633869 | gfannes |
28840bbc5eb73b9c7081e60eaa08a26e9d0e3773 | 5,891 | cpp | C++ | OpenGL-Sandbox/src/ShapeHandler.cpp | cshreyastech/OpenGL | 5d6dcce4a0fa210318fb70892423f5646c4bba98 | [
"Apache-2.0"
] | null | null | null | OpenGL-Sandbox/src/ShapeHandler.cpp | cshreyastech/OpenGL | 5d6dcce4a0fa210318fb70892423f5646c4bba98 | [
"Apache-2.0"
] | null | null | null | OpenGL-Sandbox/src/ShapeHandler.cpp | cshreyastech/OpenGL | 5d6dcce4a0fa210318fb70892423f5646c4bba98 | [
"Apache-2.0"
] | null | null | null | #include "ShapeHandler.h"
ShapeHandler::ShapeHandler(Isosurface::Facet id, std::vector<int>& indexSequence, const GLenum type,
const uint32_t indexOffset, const uint32_t vertexOffset, const size_t maxShapeCount)
: ID(id), IndexSequence(indexSequence), Type(type), IndexOffset(indexOffset),
VertexOffset(vertexOffset), MaxShapeCount(maxShapeCount),
MaxIndexCount(MaxShapeCount* IndexOffset),
MaxVertexCount(maxShapeCount* VertexOffset)
{
CreateVA();
CreateVB();
EnableVA();
CreateIB();
TextureSlotReset();
}
ShapeHandler::ShapeHandler(Isosurface::Facet id, const GLenum type,
const uint32_t indexOffset, const uint32_t vertexOffset, const size_t maxShapeCount)
: ID(id), IndexSequence(*new std::vector<int>), Type(type),
IndexOffset(indexOffset), VertexOffset(vertexOffset),
MaxShapeCount(maxShapeCount), MaxIndexCount(maxShapeCount * IndexOffset),
MaxVertexCount(maxShapeCount * VertexOffset)
{
CreateVA();
CreateVB();
EnableVA();
TextureSlotReset();
}
void ShapeHandler::DrawShape(const std::vector<glm::vec3> positions, const glm::vec4& color, const std::vector<glm::vec2> TexIndices)
{
if (indexCount >= MaxIndexCount)
{
EndBatch();
FlushElements(this->Type);
BeginBatch();
}
float textureIndex = 0.0f;
for (int i = 0; i < VertexOffset; i++)
{
shapeBufferPtr->Position = positions.at(i);
shapeBufferPtr->Color = color;
shapeBufferPtr->TexCoords = TexIndices.at(i);
shapeBufferPtr->TexIndex = textureIndex;
shapeBufferPtr++;
}
indexCount += IndexOffset;
RenderStats.QuadCount++;
RenderStats.VertexCount = RenderStats.QuadCount * VertexOffset;
RenderStats.IndexCount = RenderStats.QuadCount * IndexOffset;
}
void ShapeHandler::PlotPoint(const std::vector<glm::vec3> positions, const glm::vec4& color, const std::vector<glm::vec2> TexIndices)
{
if (vertexCount >= MaxVertexCount)
{
EndBatch();
FlushArray();
BeginBatch();
}
float textureIndex = 0.0f;
shapeBufferPtr->Position = positions.at(0);
shapeBufferPtr->Color = color;
shapeBufferPtr->TexCoords = TexIndices.at(0);
shapeBufferPtr->TexIndex = textureIndex;
shapeBufferPtr++;
vertexCount++;
RenderStats.QuadCount++;
RenderStats.VertexCount = RenderStats.QuadCount;
}
void ShapeHandler::Shutdown()
{
glDeleteVertexArrays(1, &quadVA);
glDeleteBuffers(1, &quadVB);
glDeleteBuffers(1, &quadIB);
glDeleteTextures(1, &WhiteTexture);
delete[] shapeBuffer;
}
void ShapeHandler::BeginBatch()
{
// Resets point to the begining
// pointer keeps traks of where we copying the data to
// in the cpu side vertex buffer
shapeBufferPtr = shapeBuffer;
}
void ShapeHandler::EndBatch()
{
GLsizeiptr size = (uint8_t*)shapeBufferPtr - (uint8_t*)shapeBuffer;
glBindBuffer(GL_ARRAY_BUFFER, quadVB);
glBufferSubData(GL_ARRAY_BUFFER, 0, size, shapeBuffer);
}
void ShapeHandler::FlushElements(GLenum type)
{
for (uint32_t i = 0; i < TextureSlotIndex; i++)
glBindTextureUnit(i, TextureSlots[i]);
glBindVertexArray(quadVA);
// To be split for points
glDrawElements(type, indexCount, GL_UNSIGNED_INT, nullptr);
RenderStats.DrawCount++;
indexCount = 0;
TextureSlotIndex = 1;
}
void ShapeHandler::FlushArray()
{
for (uint32_t i = 0; i < TextureSlotIndex; i++)
glBindTextureUnit(i, TextureSlots[i]);
glBindVertexArray(quadVA);
glPointSize(3);
glDrawArrays(GL_POINTS, 0, vertexCount);
RenderStats.DrawCount++;
vertexCount = 0;
indexCount = 0;
TextureSlotIndex = 1;
}
const Stats& ShapeHandler::GetStats()
{
RenderStats.ID = (int)ID;
return RenderStats;
}
void ShapeHandler::ResetStats()
{
memset(&RenderStats, 0, sizeof(Stats));
}
void ShapeHandler::CreateVA()
{
glCreateVertexArrays(1, &quadVA);
glBindVertexArray(quadVA);
}
void ShapeHandler::CreateVB()
{
shapeBuffer = new Vertex[MaxVertexCount];
glCreateBuffers(1, &quadVB);
glBindBuffer(GL_ARRAY_BUFFER, quadVB);
glBufferData(GL_ARRAY_BUFFER, MaxVertexCount * sizeof(Vertex), nullptr, GL_DYNAMIC_DRAW);
}
void ShapeHandler::EnableVA()
{
glEnableVertexArrayAttrib(quadVA, 0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const void*)offsetof(Vertex, Position));
glEnableVertexArrayAttrib(quadVA, 1);
glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const void*)offsetof(Vertex, Color));
glEnableVertexArrayAttrib(quadVA, 2);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const void*)offsetof(Vertex, TexCoords));
glEnableVertexArrayAttrib(quadVA, 3);
glVertexAttribPointer(3, 1, GL_FLOAT, GL_FALSE, sizeof(Vertex), (const void*)offsetof(Vertex, TexIndex));
}
void ShapeHandler::CreateIB()
{
uint32_t* indices;
indices = new uint32_t[MaxIndexCount];
uint32_t offset = 0;
for (size_t i = 0; i < MaxIndexCount; i += IndexOffset)
{
for (int j = 0; j < IndexOffset; j++)
indices[i + j] = IndexSequence[j] + offset;
offset += VertexOffset;
}
//Sending to GPU
glCreateBuffers(1, &quadIB);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, quadIB);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint32_t) * MaxIndexCount, indices, GL_STATIC_DRAW);
delete[] indices;
}
void ShapeHandler::TextureSlotReset()
{
TextureSlots[0] = WhiteTexture;
//memory clear, alternatively use memset
for (size_t i = 1; i < MaxTextures; i++)
TextureSlots[i] = 0;
//1 x 1 white texture
glCreateTextures(GL_TEXTURE_2D, 1, &WhiteTexture);
glBindTexture(GL_TEXTURE_2D, WhiteTexture);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
uint32_t color = 0xffffffff;
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB8, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, &color);
TextureSlots[0] = WhiteTexture;
//memory clear, alternatively use memset
for (size_t i = 1; i < MaxTextures; i++)
TextureSlots[i] = 0;
} | 26.899543 | 133 | 0.749448 | cshreyastech |
28845398d837680e62aea8df330fa816f68826b2 | 6,467 | cpp | C++ | tesseract_monitoring/src/contact_monitor_node.cpp | ros-industrial-consortium/tesseract_ros | b61abc18edb5bb350f05259ddf259937dbdb45f4 | [
"Apache-2.0",
"BSD-2-Clause"
] | 28 | 2020-03-13T05:07:25.000Z | 2021-09-09T01:57:20.000Z | tesseract_monitoring/src/contact_monitor_node.cpp | ros-industrial-consortium/tesseract_ros | b61abc18edb5bb350f05259ddf259937dbdb45f4 | [
"Apache-2.0",
"BSD-2-Clause"
] | 73 | 2020-03-12T17:25:52.000Z | 2021-09-14T14:58:08.000Z | tesseract_monitoring/src/contact_monitor_node.cpp | ros-industrial-consortium/tesseract_ros | b61abc18edb5bb350f05259ddf259937dbdb45f4 | [
"Apache-2.0",
"BSD-2-Clause"
] | 18 | 2020-03-06T20:45:27.000Z | 2021-10-06T21:51:18.000Z | /**
* @file contact_monitor_node.cpp
* @brief Node that instantiates a contact_monitor
*
* @author David Merz, Jr.
* @version TODO
* @bug No known bugs
*
* @copyright Copyright (c) 2020, Southwest Research Institute
*
* @par License
* Software License Agreement (Apache License)
* @par
* 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
* @par
* 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 <tesseract_monitoring/contact_monitor.h>
#include <tesseract_common/macros.h>
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#include <ros/ros.h>
TESSERACT_COMMON_IGNORE_WARNINGS_POP
#include <boost/thread/thread.hpp>
#include <tesseract_environment/environment.h>
#include <tesseract_scene_graph/graph.h>
#include <tesseract_srdf/srdf_model.h>
#include <tesseract_urdf/urdf_parser.h>
#include <tesseract_rosutils/utils.h>
// Stuff for the contact monitor
const static std::string ROBOT_DESCRIPTION_PARAM =
"robot_description"; /**< Default ROS parameter for robot description */
const static double DEFAULT_CONTACT_DISTANCE = 0.1;
int main(int argc, char** argv)
{
ros::init(argc, argv, "tesseract_contact_monitoring");
ros::NodeHandle nh;
ros::NodeHandle pnh("~");
tesseract_scene_graph::SceneGraph::Ptr scene_graph;
tesseract_srdf::SRDFModel::Ptr srdf_model;
std::string robot_description;
std::string joint_state_topic;
std::string monitor_namespace;
std::string monitored_namespace;
bool publish_environment{ false };
bool publish_markers{ false };
if (!pnh.getParam("monitor_namespace", monitor_namespace))
{
ROS_ERROR("Missing required parameter monitor_namespace!");
return 1;
}
pnh.param<std::string>("monitored_namespace", monitored_namespace, "");
pnh.param<std::string>("robot_description", robot_description, ROBOT_DESCRIPTION_PARAM);
pnh.param<std::string>("joint_state_topic", joint_state_topic, tesseract_monitoring::DEFAULT_JOINT_STATES_TOPIC);
pnh.param<bool>("publish_environment", publish_environment, publish_environment);
pnh.param<bool>("publish_markers", publish_markers, publish_markers);
// Initial setup
std::string urdf_xml_string, srdf_xml_string;
if (!nh.hasParam(robot_description))
{
ROS_ERROR("Failed to find parameter: %s", robot_description.c_str());
return -1;
}
if (!nh.hasParam(robot_description + "_semantic"))
{
ROS_ERROR("Failed to find parameter: %s", (robot_description + "_semantic").c_str());
return -1;
}
nh.getParam(robot_description, urdf_xml_string);
nh.getParam(robot_description + "_semantic", srdf_xml_string);
auto env = std::make_unique<tesseract_environment::Environment>();
auto locator = std::make_shared<tesseract_rosutils::ROSResourceLocator>();
if (!env->init(urdf_xml_string, srdf_xml_string, locator))
{
ROS_ERROR("Failed to initialize environment.");
return -1;
}
double contact_distance;
pnh.param<double>("contact_distance", contact_distance, DEFAULT_CONTACT_DISTANCE);
std::vector<std::string> monitored_link_names;
if (pnh.hasParam("monitor_links"))
{
std::string monitored_link_names_str;
pnh.getParam("monitor_links", monitored_link_names_str);
if (!monitored_link_names_str.empty())
boost::split(monitored_link_names, monitored_link_names_str, boost::is_any_of(" "));
}
if (monitored_link_names.empty())
monitored_link_names = env->getLinkNames();
std::vector<std::string> disabled_link_names;
if (pnh.hasParam("disabled_links"))
{
std::string disabled_link_names_str;
pnh.getParam("disabled_links", disabled_link_names_str);
if (!disabled_link_names_str.empty())
boost::split(disabled_link_names, disabled_link_names_str, boost::is_any_of(" "));
}
std::string disabled_link_names_str;
for (const auto& disabled_link : disabled_link_names)
{
if (disabled_link_names_str.empty())
disabled_link_names_str = disabled_link;
else
disabled_link_names_str += (", " + disabled_link);
}
ROS_INFO("DISABLED_LINKS: %s", disabled_link_names_str.c_str());
auto pred = [&disabled_link_names](const std::string& key) -> bool {
return std::find(disabled_link_names.begin(), disabled_link_names.end(), key) != disabled_link_names.end();
};
monitored_link_names.erase(std::remove_if(monitored_link_names.begin(), monitored_link_names.end(), pred),
monitored_link_names.end());
std::string monitored_link_names_str;
for (const auto& monitor_link : monitored_link_names)
{
if (monitored_link_names_str.empty())
monitored_link_names_str = monitor_link;
else
monitored_link_names_str += (", " + monitor_link);
}
ROS_INFO("MONITORED_LINKS: %s", monitored_link_names_str.c_str());
int contact_test_type = 2;
if (pnh.hasParam("contact_test_type"))
pnh.getParam("contact_test_type", contact_test_type);
if (contact_test_type < 0 || contact_test_type > 3)
{
ROS_WARN("Request type must be 0, 1, 2 or 3. Setting to 2(ALL)!");
contact_test_type = 2;
}
tesseract_collision::ContactTestType type = static_cast<tesseract_collision::ContactTestType>(contact_test_type);
tesseract_monitoring::ContactMonitor cm(monitor_namespace,
std::move(env),
nh,
pnh,
monitored_link_names,
disabled_link_names,
type,
contact_distance,
joint_state_topic);
if (publish_environment)
cm.startPublishingEnvironment();
if (!monitored_namespace.empty())
cm.startMonitoringEnvironment(monitored_namespace);
if (publish_markers)
cm.startPublishingMarkers();
boost::thread t(&tesseract_monitoring::ContactMonitor::computeCollisionReportThread, &cm);
ROS_INFO("Contact Monitor Running!");
ros::spin();
return 0;
}
| 34.216931 | 115 | 0.705273 | ros-industrial-consortium |
288520fc8308e359a5213b749becf027b1e53c9f | 73,597 | cpp | C++ | tests/TensorAlgebra.cpp | jturney/EinsumsInCpp | 5da72c32b8814adacb601face888d970edfae205 | [
"MIT"
] | 9 | 2022-01-29T22:21:19.000Z | 2022-03-10T06:26:40.000Z | tests/TensorAlgebra.cpp | jturney/EinsumsInCpp | 5da72c32b8814adacb601face888d970edfae205 | [
"MIT"
] | null | null | null | tests/TensorAlgebra.cpp | jturney/EinsumsInCpp | 5da72c32b8814adacb601face888d970edfae205 | [
"MIT"
] | null | null | null | #include "einsums/TensorAlgebra.hpp"
#include "einsums/LinearAlgebra.hpp"
#include "einsums/State.hpp"
#include "einsums/Tensor.hpp"
#include <H5Fpublic.h>
#include <catch2/catch.hpp>
#include <type_traits>
TEST_CASE("Identity Tensor", "[tensor]") {
using namespace einsums;
using namespace einsums::tensor_algebra;
Tensor<2, double> I = create_identity_tensor("I", 3, 3);
REQUIRE(I(0, 0) == 1.0);
REQUIRE(I(0, 1) == 0.0);
REQUIRE(I(0, 2) == 0.0);
REQUIRE(I(1, 0) == 0.0);
REQUIRE(I(1, 1) == 1.0);
REQUIRE(I(1, 2) == 0.0);
REQUIRE(I(2, 0) == 0.0);
REQUIRE(I(2, 1) == 0.0);
REQUIRE(I(2, 2) == 1.0);
}
TEST_CASE("Scale Row", "[tensor]") {
using namespace einsums;
using namespace einsums::linear_algebra;
Tensor<2> I_original = create_random_tensor("I", 3, 3);
Tensor<2> I_copy = I_original;
scale_row(1, 2.0, &I_copy);
REQUIRE(I_copy(0, 0) == I_original(0, 0));
REQUIRE(I_copy(0, 1) == I_original(0, 1));
REQUIRE(I_copy(0, 2) == I_original(0, 2));
REQUIRE(I_copy(1, 0) == 2.0 * I_original(1, 0));
REQUIRE(I_copy(1, 1) == 2.0 * I_original(1, 1));
REQUIRE(I_copy(1, 2) == 2.0 * I_original(1, 2));
REQUIRE(I_copy(2, 0) == I_original(2, 0));
REQUIRE(I_copy(2, 1) == I_original(2, 1));
REQUIRE(I_copy(2, 2) == I_original(2, 2));
}
TEST_CASE("Scale Column", "[tensor]") {
using namespace einsums;
using namespace einsums::linear_algebra;
Tensor<2> I_original = create_random_tensor("I", 3, 3);
Tensor<2> I_copy = I_original;
scale_column(1, 2.0, &I_copy);
REQUIRE(I_copy(0, 0) == I_original(0, 0));
REQUIRE(I_copy(0, 1) == 2.0 * I_original(0, 1));
REQUIRE(I_copy(0, 2) == I_original(0, 2));
REQUIRE(I_copy(1, 0) == I_original(1, 0));
REQUIRE(I_copy(1, 1) == 2.0 * I_original(1, 1));
REQUIRE(I_copy(1, 2) == I_original(1, 2));
REQUIRE(I_copy(2, 0) == I_original(2, 0));
REQUIRE(I_copy(2, 1) == 2.0 * I_original(2, 1));
REQUIRE(I_copy(2, 2) == I_original(2, 2));
}
TEST_CASE("Scale Row TensorView", "[tensor]") {
using namespace einsums;
using namespace einsums::linear_algebra;
Tensor<2> I_original = create_random_tensor("I", 3, 3);
Tensor<2> I_copy = I_original;
TensorView<2> I_view{I_copy, Dim<2>{2, 2}, Offset<2>{1, 1}};
scale_row(1, 2.0, &I_view);
REQUIRE(I_copy(0, 0) == I_original(0, 0));
REQUIRE(I_copy(0, 1) == I_original(0, 1));
REQUIRE(I_copy(0, 2) == I_original(0, 2));
REQUIRE(I_copy(1, 0) == I_original(1, 0));
REQUIRE(I_copy(1, 1) == I_original(1, 1));
REQUIRE(I_copy(1, 2) == I_original(1, 2));
REQUIRE(I_copy(2, 0) == I_original(2, 0));
REQUIRE(I_copy(2, 1) == 2.0 * I_original(2, 1));
REQUIRE(I_copy(2, 2) == 2.0 * I_original(2, 2));
REQUIRE(I_view(0, 0) == I_original(1, 1));
REQUIRE(I_view(0, 1) == I_original(1, 2));
REQUIRE(I_view(1, 0) == 2.0 * I_original(2, 1));
REQUIRE(I_view(1, 1) == 2.0 * I_original(2, 2));
}
TEST_CASE("Scale Column TensorView", "[tensor]") {
using namespace einsums;
using namespace einsums::linear_algebra;
Tensor<2> I_original = create_random_tensor("I", 3, 3);
Tensor<2> I_copy = I_original;
TensorView<2> I_view{I_copy, Dim<2>{2, 2}, Offset<2>{1, 1}};
scale_column(1, 2.0, &I_view);
REQUIRE(I_copy(0, 0) == I_original(0, 0));
REQUIRE(I_copy(0, 1) == I_original(0, 1));
REQUIRE(I_copy(0, 2) == I_original(0, 2));
REQUIRE(I_copy(1, 0) == I_original(1, 0));
REQUIRE(I_copy(1, 1) == I_original(1, 1));
REQUIRE(I_copy(1, 2) == 2.0 * I_original(1, 2));
REQUIRE(I_copy(2, 0) == I_original(2, 0));
REQUIRE(I_copy(2, 1) == I_original(2, 1));
REQUIRE(I_copy(2, 2) == 2.0 * I_original(2, 2));
REQUIRE(I_view(0, 0) == I_original(1, 1));
REQUIRE(I_view(0, 1) == 2.0 * I_original(1, 2));
REQUIRE(I_view(1, 0) == I_original(2, 1));
REQUIRE(I_view(1, 1) == 2.0 * I_original(2, 2));
}
TEST_CASE("GEMM TensorView", "[tensor]") {
using namespace einsums;
using namespace einsums::linear_algebra;
Tensor<2> I_original{"I", 3, 3};
for (int i = 0, ij = 1; i < 3; i++)
for (int j = 0; j < 3; j++, ij++)
I_original(i, j) = ij;
Tensor<2> I_copy = I_original;
TensorView<2> I_view{I_copy, Dim<2>{2, 2}, Offset<2>{1, 1}};
SECTION("Result into 2x2 matrix") {
Tensor<2> result{"result", 2, 2};
gemm<false, false>(1.0, I_view, I_view, 0.0, &result);
REQUIRE(result(0, 0) == 73.0);
REQUIRE(result(0, 1) == 84.0);
REQUIRE(result(1, 0) == 112.0);
REQUIRE(result(1, 1) == 129.0);
}
SECTION("Result into 2x2 view of matrix") {
Tensor<2> result{"result", 5, 5};
TensorView<2> result_view{result, Dim<2>{2, 2}, Offset<2>{3, 2}};
gemm<false, false>(1.0, I_view, I_view, 0.0, &result_view);
// Check view
REQUIRE(result_view(0, 0) == 73.0);
REQUIRE(result_view(0, 1) == 84.0);
REQUIRE(result_view(1, 0) == 112.0);
REQUIRE(result_view(1, 1) == 129.0);
// Check full
REQUIRE(result(3, 2) == 73.0);
REQUIRE(result(3, 3) == 84.0);
REQUIRE(result(4, 2) == 112.0);
REQUIRE(result(4, 3) == 129.0);
}
SECTION("Transpose") {
Tensor<2> result{"result", 2, 2};
gemm<false, true>(1.0, I_view, I_view, 0.0, &result);
REQUIRE(result(0, 0) == 61.0);
REQUIRE(result(0, 1) == 94.0);
REQUIRE(result(1, 0) == 94.0);
REQUIRE(result(1, 1) == 145.0);
gemm<true, false>(1.0, I_view, I_view, 0.0, &result);
REQUIRE(result(0, 0) == 89.0);
REQUIRE(result(0, 1) == 102.0);
REQUIRE(result(1, 0) == 102.0);
REQUIRE(result(1, 1) == 117.0);
gemm<true, true>(1.0, I_view, I_view, 0.0, &result);
REQUIRE(result(0, 0) == 73.0);
REQUIRE(result(0, 1) == 112.0);
REQUIRE(result(1, 0) == 84.0);
REQUIRE(result(1, 1) == 129.0);
}
}
TEST_CASE("Subset TensorView", "[tensor]") {
using namespace einsums;
using namespace einsums::linear_algebra;
SECTION("Subset View 7x7[1,:] -> 1x7") {
const size_t size = 7;
const size_t row = 1;
Tensor<2> I_original = create_random_tensor("Original", size, size);
TensorView<1> I_view = I_original(row, All{});
for (size_t i = 0; i < size; i++) {
REQUIRE(I_original(row, i) == I_view(i));
}
}
SECTION("Subset View 7x7x7[4,:,:] -> 7x7") {
const size_t size = 7;
const size_t d1 = 4;
Tensor<3> I_original = create_random_tensor("Original", size, size, size);
TensorView<2> I_view = I_original(d1, All{}, All{});
for (size_t i = 0; i < size; i++) {
for (size_t j = 0; j < size; j++) {
REQUIRE(I_original(d1, i, j) == I_view(i, j));
}
}
}
SECTION("Subset View 7x7x7[4,3,:] -> 7") {
const size_t size = 7;
const size_t d1 = 4;
const size_t d2 = 3;
Tensor<3> I_original = create_random_tensor("Original", size, size, size);
TensorView<1> I_view = I_original(d1, d2, All{});
for (size_t i = 0; i < size; i++) {
REQUIRE(I_original(d1, d2, i) == I_view(i));
}
}
SECTION("Subset View GEMM 7x3x3[4,:,:] -> 3x3") {
const size_t d1_size = 7, d2_size = 3, d3_size = 3;
const size_t d1 = 4;
Tensor<3> original = create_random_tensor("Original", d1_size, d2_size, d3_size);
// Set submatrix to a set of known values
for (size_t i = 0, ij = 1; i < 3; i++) {
for (size_t j = 0; j < 3; j++, ij++) {
original(d1, i, j) = ij;
}
}
// Obtain a 3x3 view of original[4,:,:]
TensorView<2> view = original(d1, All{}, All{});
Tensor<2> result{"result", d2_size, d3_size};
// false, false
{
gemm<false, false>(1.0, view, view, 0.0, &result);
REQUIRE(result(0, 0) == 30.0);
REQUIRE(result(0, 1) == 36.0);
REQUIRE(result(0, 2) == 42.0);
REQUIRE(result(1, 0) == 66.0);
REQUIRE(result(1, 1) == 81.0);
REQUIRE(result(1, 2) == 96.0);
REQUIRE(result(2, 0) == 102.0);
REQUIRE(result(2, 1) == 126.0);
REQUIRE(result(2, 2) == 150.0);
}
// false, true
{
gemm<false, true>(1.0, view, view, 0.0, &result);
REQUIRE(result(0, 0) == 14.0);
REQUIRE(result(0, 1) == 32.0);
REQUIRE(result(0, 2) == 50.0);
REQUIRE(result(1, 0) == 32.0);
REQUIRE(result(1, 1) == 77.0);
REQUIRE(result(1, 2) == 122.0);
REQUIRE(result(2, 0) == 50.0);
REQUIRE(result(2, 1) == 122.0);
REQUIRE(result(2, 2) == 194.0);
}
// true, false
{
gemm<true, false>(1.0, view, view, 0.0, &result);
REQUIRE(result(0, 0) == 66.0);
REQUIRE(result(0, 1) == 78.0);
REQUIRE(result(0, 2) == 90.0);
REQUIRE(result(1, 0) == 78.0);
REQUIRE(result(1, 1) == 93.0);
REQUIRE(result(1, 2) == 108.0);
REQUIRE(result(2, 0) == 90.0);
REQUIRE(result(2, 1) == 108.0);
REQUIRE(result(2, 2) == 126.0);
}
// true, true
{
gemm<true, true>(1.0, view, view, 0.0, &result);
REQUIRE(result(0, 0) == 30.0);
REQUIRE(result(0, 1) == 66.0);
REQUIRE(result(0, 2) == 102.0);
REQUIRE(result(1, 0) == 36.0);
REQUIRE(result(1, 1) == 81.0);
REQUIRE(result(1, 2) == 126.0);
REQUIRE(result(2, 0) == 42.0);
REQUIRE(result(2, 1) == 96.0);
REQUIRE(result(2, 2) == 150.0);
}
}
SECTION("Subset View GEMM 7x3x3[4,:,:] -> [2,:,:]") {
// Description:
// 1. Allocate tensor [7, 3, 3]
// 2. Obtain view [4,:,:] (3x3 view) of tensor
// 3. Perform GEMM and store result into view [2,:,:] (3x3 view) of tensor
// 4. Test correctness of the GEMM result and of the data
// elements that should not have been touched.
const size_t d1_size = 7, d2_size = 3, d3_size = 3;
const size_t d1 = 4;
const size_t e1 = 2;
const std::array<size_t, 6> untouched_d1{0, 1, 3, 4, 5, 6};
Tensor<3> original = create_random_tensor("Original", d1_size, d2_size, d3_size);
// Set submatrix to a set of known values
for (size_t i = 0, ij = 1; i < 3; i++) {
for (size_t j = 0; j < 3; j++, ij++) {
original(d1, i, j) = ij;
}
}
Tensor<3> copy = original;
// Obtain a 3x3 view of original[4,:,:]
// A view does not copy data it is just an offset pointer into the original with necessary striding information.
TensorView<2> view = original(d1, All{}, All{});
// Obtain a 3x3 view of original[2,:,:] to store the result
TensorView<2> result = original(e1, All{}, All{});
// false, false
{
// Call BLAS routine passing necessary offset pointer, dimension, and stride information.
gemm<false, false>(1.0, view, view, 0.0, &result);
// Test against the view
REQUIRE(result(0, 0) == 30.0);
REQUIRE(result(0, 1) == 36.0);
REQUIRE(result(0, 2) == 42.0);
REQUIRE(result(1, 0) == 66.0);
REQUIRE(result(1, 1) == 81.0);
REQUIRE(result(1, 2) == 96.0);
REQUIRE(result(2, 0) == 102.0);
REQUIRE(result(2, 1) == 126.0);
REQUIRE(result(2, 2) == 150.0);
// Test that the elements that shouldn't have been touched:
for (size_t i : untouched_d1) {
for (size_t j = 0; j < d2_size; j++) {
for (size_t k = 0; k < d3_size; k++) {
REQUIRE(original(i, j, k) == copy(i, j, k));
}
}
}
}
// false, true
{
gemm<false, true>(1.0, view, view, 0.0, &result);
REQUIRE(result(0, 0) == 14.0);
REQUIRE(result(0, 1) == 32.0);
REQUIRE(result(0, 2) == 50.0);
REQUIRE(result(1, 0) == 32.0);
REQUIRE(result(1, 1) == 77.0);
REQUIRE(result(1, 2) == 122.0);
REQUIRE(result(2, 0) == 50.0);
REQUIRE(result(2, 1) == 122.0);
REQUIRE(result(2, 2) == 194.0);
// Test that the elements that shouldn't have been touched:
for (size_t i : untouched_d1) {
for (size_t j = 0; j < d2_size; j++) {
for (size_t k = 0; k < d3_size; k++) {
REQUIRE(original(i, j, k) == copy(i, j, k));
}
}
}
}
// true, false
{
gemm<true, false>(1.0, view, view, 0.0, &result);
REQUIRE(result(0, 0) == 66.0);
REQUIRE(result(0, 1) == 78.0);
REQUIRE(result(0, 2) == 90.0);
REQUIRE(result(1, 0) == 78.0);
REQUIRE(result(1, 1) == 93.0);
REQUIRE(result(1, 2) == 108.0);
REQUIRE(result(2, 0) == 90.0);
REQUIRE(result(2, 1) == 108.0);
REQUIRE(result(2, 2) == 126.0);
// Test that the elements that shouldn't have been touched:
for (size_t i : untouched_d1) {
for (size_t j = 0; j < d2_size; j++) {
for (size_t k = 0; k < d3_size; k++) {
REQUIRE(original(i, j, k) == copy(i, j, k));
}
}
}
}
// true, true
{
gemm<true, true>(1.0, view, view, 0.0, &result);
REQUIRE(result(0, 0) == 30.0);
REQUIRE(result(0, 1) == 66.0);
REQUIRE(result(0, 2) == 102.0);
REQUIRE(result(1, 0) == 36.0);
REQUIRE(result(1, 1) == 81.0);
REQUIRE(result(1, 2) == 126.0);
REQUIRE(result(2, 0) == 42.0);
REQUIRE(result(2, 1) == 96.0);
REQUIRE(result(2, 2) == 150.0);
// Test that the elements that shouldn't have been touched:
for (size_t i : untouched_d1) {
for (size_t j = 0; j < d2_size; j++) {
for (size_t k = 0; k < d3_size; k++) {
REQUIRE(original(i, j, k) == copy(i, j, k));
}
}
}
}
}
}
TEST_CASE("einsum1", "[tensor]") {
using namespace einsums;
using namespace einsums::tensor_algebra;
SECTION("ik=ij,jk") {
Tensor<2> A{"A", 3, 3};
Tensor<2> B{"B", 3, 3};
Tensor<2> C{"C", 3, 3};
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++, ij++) {
A(i, j) = ij;
B(i, j) = ij;
}
}
REQUIRE_NOTHROW(einsum(Indices{index::i, index::j}, &C, Indices{index::i, index::k}, A, Indices{index::k, index::j}, B));
// println(A);
// println(B);
// println(C);
/*[[ 30, 36, 42],
[ 66, 81, 96],
[102, 126, 150]]*/
REQUIRE(C(0, 0) == 30.0);
REQUIRE(C(0, 1) == 36.0);
REQUIRE(C(0, 2) == 42.0);
REQUIRE(C(1, 0) == 66.0);
REQUIRE(C(1, 1) == 81.0);
REQUIRE(C(1, 2) == 96.0);
REQUIRE(C(2, 0) == 102.0);
REQUIRE(C(2, 1) == 126.0);
REQUIRE(C(2, 2) == 150.0);
}
SECTION("il=ijk,jkl") {
Tensor<3> A{"A", 3, 3, 3};
Tensor<3> B{"B", 3, 3, 3};
Tensor<2> C{"C", 3, 3};
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++, ij++) {
A(i, j, k) = ij;
B(i, j, k) = ij;
}
}
}
// println(A);
// println(B);
// println(C);
// einsum("il=ijk,jkl", &C, A, B);
REQUIRE_NOTHROW(
einsum(Indices{index::i, index::l}, &C, Indices{index::i, index::j, index::k}, A, Indices{index::j, index::k, index::l}, B));
// println(C);
// array([[ 765., 810., 855.],
// [1818., 1944., 2070.],
// [2871., 3078., 3285.]])
REQUIRE(C(0, 0) == 765.0);
REQUIRE(C(0, 1) == 810.0);
REQUIRE(C(0, 2) == 855.0);
REQUIRE(C(1, 0) == 1818.0);
REQUIRE(C(1, 1) == 1944.0);
REQUIRE(C(1, 2) == 2070.0);
REQUIRE(C(2, 0) == 2871.0);
REQUIRE(C(2, 1) == 3078.0);
REQUIRE(C(2, 2) == 3285.0);
}
}
TEST_CASE("einsum TensorView", "[tensor]") {
using namespace einsums;
using namespace einsums::tensor_algebra;
SECTION("Subset View GEMM 7x3x3[4,:,:] -> [2,:,:]") {
// Description: Obtain view [4,:,:] (3x3 view) perform GEMM and store result into
// view [2,:,:] (3x3 view)
const size_t d1_size = 7, d2_size = 3, d3_size = 3;
const size_t d1 = 4;
const size_t e1 = 2;
const std::array<size_t, 6> untouched1{0, 1, 3, 4, 5, 6};
Tensor<3> original = create_random_tensor("Original", d1_size, d2_size, d3_size);
// Set submatrix to a set of known values
for (size_t i = 0, ij = 1; i < 3; i++) {
for (size_t j = 0; j < 3; j++, ij++) {
original(d1, i, j) = static_cast<double>(ij);
}
}
Tensor<3> copy = original;
// Obtain a 3x3 view of original[4,:,:]
TensorView<2> view = original(d1, All{}, All{});
// Obtain a 3x3 view of original[2,:,:] to store the result
TensorView<2> result = original(e1, All{}, All{});
// false, false
{
// einsum("ik=ij,jk", &result, view, view);
REQUIRE_NOTHROW(
einsum(Indices{index::i, index::k}, &result, Indices{index::i, index::j}, view, Indices{index::j, index::k}, view));
// gemm<false, false>(1.0, view, view, 0.0, &result);
// Test against the view
REQUIRE(result(0, 0) == 30.0);
REQUIRE(result(0, 1) == 36.0);
REQUIRE(result(0, 2) == 42.0);
REQUIRE(result(1, 0) == 66.0);
REQUIRE(result(1, 1) == 81.0);
REQUIRE(result(1, 2) == 96.0);
REQUIRE(result(2, 0) == 102.0);
REQUIRE(result(2, 1) == 126.0);
REQUIRE(result(2, 2) == 150.0);
// Test the position in the original
REQUIRE(original(2, 0, 0) == 30.0);
REQUIRE(original(2, 0, 1) == 36.0);
REQUIRE(original(2, 0, 2) == 42.0);
REQUIRE(original(2, 1, 0) == 66.0);
REQUIRE(original(2, 1, 1) == 81.0);
REQUIRE(original(2, 1, 2) == 96.0);
REQUIRE(original(2, 2, 0) == 102.0);
REQUIRE(original(2, 2, 1) == 126.0);
REQUIRE(original(2, 2, 2) == 150.0);
// Test that the elements that shouldn't have been touched:
for (size_t i : untouched1) {
for (size_t j = 0; j < d2_size; j++) {
for (size_t k = 0; k < d3_size; k++) {
REQUIRE(original(i, j, k) == copy(i, j, k));
}
}
}
}
}
}
TEST_CASE("sort2") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
SECTION("Rank 2 - axpy") {
Tensor<2> A{"A", 3, 3};
Tensor<2> C{"C", 3, 3};
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++, ij++) {
A(i, j) = ij;
}
}
sort(Indices{i, j}, &C, Indices{i, j}, A);
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++, ij++) {
REQUIRE(C(i, j) == A(i, j));
}
}
TensorView<2> A_view{A, Dim<2>{2, 2}, Offset<2>{1, 1}};
TensorView<2> C_view{C, Dim<2>{2, 2}, Offset<2>{1, 1}};
sort(Indices{j, i}, &C_view, Indices{i, j}, A_view);
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++, ij++) {
if (i == 0 || j == 0)
REQUIRE(C(i, j) == A(i, j));
else
REQUIRE(C(j, i) == A(i, j));
}
}
}
SECTION("Rank 2 - axpy (2)") {
Tensor<2> A = create_random_tensor("A", 3, 3);
Tensor<2> C0{"C", 3, 3};
Tensor<2> C1{"C", 3, 3};
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++, ij++) {
C0(i, j) = ij;
C1(i, j) = ij + A(i, j);
}
}
sort(1.0, Indices{i, j}, &C0, 1.0, Indices{i, j}, A);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
REQUIRE(C0(i, j) == C1(i, j));
}
}
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++, ij++) {
C0(i, j) = ij;
C1(i, j) = 2.0 * ij + 0.5 * A(i, j);
}
}
sort(2.0, Indices{i, j}, &C0, 0.5, Indices{i, j}, A);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
REQUIRE(C0(i, j) == C1(i, j));
}
}
}
SECTION("Rank 2") {
Tensor<2> A{"A", 3, 3};
Tensor<2> C{"C", 3, 3};
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++, ij++) {
A(i, j) = ij;
}
}
sort(Indices{j, i}, &C, Indices{i, j}, A);
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++, ij++) {
REQUIRE(C(j, i) == A(i, j));
}
}
}
SECTION("Rank 3") {
Tensor<3> A{"A", 3, 3, 3};
Tensor<3> B{"B", 3, 3, 3};
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++, ij++) {
A(i, j, k) = ij;
}
}
}
sort(Indices{k, j, i}, &B, Indices{i, j, k}, A);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
REQUIRE(B(k, j, i) == A(i, j, k));
}
}
}
sort(Indices{i, k, j}, &B, Indices{i, j, k}, A);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
REQUIRE(B(i, k, j) == A(i, j, k));
}
}
}
sort(Indices{j, k, i}, &B, Indices{i, j, k}, A);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
REQUIRE(B(j, k, i) == A(i, j, k));
}
}
}
sort(Indices{i, j, k}, &B, Indices{k, j, i}, A);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
REQUIRE(B(i, j, k) == A(k, j, i));
}
}
}
}
SECTION("Rank 4") {
Tensor<4> A{"A", 3, 3, 3, 3};
Tensor<4> B{"B", 3, 3, 3, 3};
for (int i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
for (int l = 0; l < 3; l++, ij++) {
A(i, j, k, l) = ij;
}
}
}
}
sort(0.0, Indices{i, l, k, j}, &B, 0.5, Indices{k, j, l, i}, A);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
for (int l = 0; l < 3; l++) {
REQUIRE(B(i, l, k, j) == 0.5 * A(k, j, l, i));
}
}
}
}
}
SECTION("Rank 5") {
Tensor<5, float> A{"A", 3, 3, 3, 3, 3};
Tensor<5, float> B{"B", 3, 3, 3, 3, 3};
for (short i = 0, ij = 1; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
for (int l = 0; l < 3; l++) {
for (int m = 0; m < 3; m++, ij++) {
A(i, j, k, l, m) = ij;
}
}
}
}
}
sort(Indices{i, k, l, m, j}, &B, Indices{j, k, l, m, i}, A);
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
for (int l = 0; l < 3; l++) {
for (int m = 0; m < 3; m++) {
REQUIRE(B(i, k, l, m, j) == A(j, k, l, m, i));
}
}
}
}
}
}
SECTION("Rank 2 - Different Sizes") {
Tensor<2> A{"A", 3, 9};
Tensor<2> B{"B", 9, 3};
for (int i = 0, ij = 0; i < A.dim(0); i++) {
for (int j = 0; j < A.dim(1); j++, ij++) {
A(i, j) = ij;
}
}
sort(Indices{j, i}, &B, Indices{i, j}, A);
for (int i = 0; i < A.dim(0); i++) {
for (int j = 0; j < A.dim(1); j++) {
REQUIRE(B(j, i) == A(i, j));
}
}
}
SECTION("Rank 3 - Different Sizes") {
Tensor<3> A{"A", 2, 3, 4};
Tensor<3> B{"B", 3, 4, 2};
for (int i = 0, ij = 1; i < A.dim(0); i++) {
for (int j = 0; j < A.dim(1); j++) {
for (int k = 0; k < A.dim(2); k++, ij++) {
A(i, j, k) = ij;
}
}
}
sort(Indices{j, k, i}, &B, Indices{i, j, k}, A);
for (int i = 0, ij = 1; i < A.dim(0); i++) {
for (int j = 0; j < A.dim(1); j++) {
for (int k = 0; k < A.dim(2); k++, ij++) {
REQUIRE(B(j, k, i) == A(i, j, k));
}
}
}
}
}
TEST_CASE("einsum2") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
SECTION("3x3 <- 3x5 * 5x3") {
Tensor<2> C0{"C0", 3, 3};
Tensor<2> C1{"C1", 3, 3};
Tensor<2> A = create_random_tensor("A", 3, 5);
Tensor<2> B = create_random_tensor("B", 5, 3);
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, A, B, 0, &C1);
for (size_t i0 = 0; i0 < C0.dim(0); i0++) {
for (size_t j0 = 0; j0 < C0.dim(1); j0++) {
REQUIRE_THAT(C0(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("3x3 <- 3x5 * 3x5") {
Tensor<2> C0{"C0", 3, 3};
Tensor<2> C1{"C1", 3, 3};
Tensor<2> A = create_random_tensor("A", 3, 5);
Tensor<2> B = create_random_tensor("B", 3, 5);
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{j, k}, B));
linear_algebra::gemm<false, true>(1.0, A, B, 0, &C1);
for (size_t i0 = 0; i0 < C0.dim(0); i0++) {
for (size_t j0 = 0; j0 < C0.dim(1); j0++) {
REQUIRE_THAT(C0(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("3 <- 3x5 * 5") {
Tensor<1> C0{"C0", 3};
Tensor<1> C1{"C1", 3};
Tensor<2> A = create_random_tensor("A", 3, 5);
Tensor<1> B = create_random_tensor("B", 5);
REQUIRE_NOTHROW(einsum(Indices{i}, &C0, Indices{i, j}, A, Indices{j}, B));
linear_algebra::gemv<false>(1.0, A, B, 0.0, &C1);
for (size_t i0 = 0; i0 < C0.dim(0); i0++) {
REQUIRE_THAT(C0(i0), Catch::Matchers::WithinAbs(C1(i0), 0.001));
}
}
SECTION("3 <- 3x4x5 * 4x3x5") {
Tensor<1> C0{"C0", 3};
Tensor<1> C1{"C1", 3};
Tensor<3> A = create_random_tensor("A", 3, 4, 5);
Tensor<3> B = create_random_tensor("B", 4, 3, 5);
REQUIRE_NOTHROW(einsum(Indices{i}, &C0, Indices{i, j, k}, A, Indices{j, i, k}, B));
for (size_t i0 = 0; i0 < 3; i0++) {
double sum{0};
for (size_t j0 = 0; j0 < 4; j0++) {
for (size_t k0 = 0; k0 < 5; k0++) {
sum += A(i0, j0, k0) * B(j0, i0, k0);
}
}
C1(i0) = sum;
}
for (size_t i0 = 0; i0 < 3; i0++) {
REQUIRE_THAT(C0(i0), Catch::Matchers::WithinRel(C1(i0), 0.0001));
}
}
SECTION("3x5 <- 3x4x5 * 4x3x5") {
Tensor<2> C0{"C0", 3, 5};
Tensor<2> C1{"C1", 3, 5};
Tensor<3> A = create_random_tensor("A", 3, 4, 5);
Tensor<3> B = create_random_tensor("B", 4, 3, 5);
// timer::push("einsum: 3x5 <- 3x4x5 * 4x3x5");
REQUIRE_NOTHROW(einsum(Indices{i, k}, &C0, Indices{i, j, k}, A, Indices{j, i, k}, B));
// timer::pop();
// timer::push("hand : 3x5 <- 3x4x5 * 4x3x5");
for (size_t i0 = 0; i0 < 3; i0++) {
for (size_t k0 = 0; k0 < 5; k0++) {
double sum{0};
for (size_t j0 = 0; j0 < 4; j0++) {
sum += A(i0, j0, k0) * B(j0, i0, k0);
}
C1(i0, k0) = sum;
}
}
// timer::pop();
for (size_t i0 = 0; i0 < 3; i0++) {
for (size_t j0 = 0; j0 < 5; j0++) {
REQUIRE_THAT(C0(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("3, l <- 3x4x5 * 4x3x5") {
Tensor<2> C0{"C0", 3, 5};
Tensor<2> C1{"C1", 3, 5};
Tensor<3> A = create_random_tensor("A", 3, 4, 5);
Tensor<3> B = create_random_tensor("B", 4, 3, 5);
// timer::push("einsum: 3x5 <- 3x4x5 * 4x3x5");
REQUIRE_NOTHROW(einsum(Indices{i, l}, &C0, Indices{i, j, k}, A, Indices{j, i, k}, B));
// timer::pop();
// timer::push("hand : 3x5 <- 3x4x5 * 4x3x5");
for (size_t i0 = 0; i0 < 3; i0++) {
for (size_t k0 = 0; k0 < 5; k0++) {
for (size_t l0 = 0; l0 < 5; l0++) {
double sum{0};
for (size_t j0 = 0; j0 < 4; j0++) {
sum += A(i0, j0, k0) * B(j0, i0, k0);
}
C1(i0, l0) += sum;
}
}
}
// timer::pop();
for (size_t i0 = 0; i0 < 3; i0++) {
for (size_t j0 = 0; j0 < 5; j0++) {
// REQUIRE(C0(i0, j0) == C1(i0, j0));?
REQUIRE_THAT(C0(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0000001));
}
}
}
// timer::report();
// timer::finalize();
}
TEST_CASE("einsum3") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
// timer::initialize();
SECTION("3x3 <- 3x5 * 5x3") {
Tensor<2> C0{"C0", 3, 3};
Tensor<2> C1{"C1", 3, 3};
Tensor<2> A = create_random_tensor("A", 3, 5);
Tensor<2> B = create_random_tensor("B", 5, 3);
// Working to get the einsum to perform the gemm that follows.
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, A, B, 0, &C1);
for (size_t i0 = 0; i0 < C0.dim(0); i0++) {
for (size_t j0 = 0; j0 < C0.dim(1); j0++) {
REQUIRE_THAT(C0(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("3x3x3x3 <- 3x3x3x3 * 3x3") {
// This one is to represent a two-electron integral transformation
Tensor<4> gMO0{"g0", 3, 3, 3, 3};
Tensor<4> gMO1{"g1", 3, 3, 3, 3};
Tensor<4> A = create_random_tensor("A", 3, 3, 3, 3);
Tensor<2> B = create_random_tensor("B", 3, 3);
REQUIRE_NOTHROW(einsum(Indices{i, j, k, l}, &gMO0, Indices{i, j, k, p}, A, Indices{p, l}, B));
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
for (size_t p0 = 0; p0 < B.dim(0); p0++) {
gMO1(i0, j0, k0, l0) += A(i0, j0, k0, p0) * B(p0, l0);
}
}
}
}
}
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
REQUIRE_THAT(gMO0(i0, j0, k0, l0), Catch::Matchers::WithinAbs(gMO1(i0, j0, k0, l0), 0.001));
}
}
}
}
REQUIRE_NOTHROW(einsum(Indices{i, j, k, l}, &gMO0, Indices{i, j, p, l}, A, Indices{p, k}, B));
gMO1.zero();
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
for (size_t p0 = 0; p0 < B.dim(0); p0++) {
gMO1(i0, j0, k0, l0) += A(i0, j0, p0, l0) * B(p0, k0);
}
}
}
}
}
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
REQUIRE_THAT(gMO0(i0, j0, k0, l0), Catch::Matchers::WithinAbs(gMO1(i0, j0, k0, l0), 0.001));
}
}
}
}
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
auto vgMO0 = gMO0(i0, j0, All{}, All{});
REQUIRE_NOTHROW(einsum(Indices{k, l}, &vgMO0, Indices{p, l}, A(i0, j0, All{}, All{}), Indices{p, k}, B));
}
}
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
REQUIRE_THAT(gMO0(i0, j0, k0, l0), Catch::Matchers::WithinAbs(gMO1(i0, j0, k0, l0), 0.001));
}
}
}
}
}
// timer::report();
// timer::finalize();
}
TEST_CASE("einsum4") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
// timer::initialize();
SECTION("3x3x3x3 <- 3x3x3x3 * 3x3") {
// This one is to represent a two-electron integral transformation
Tensor<4> gMO0{"g0", 3, 3, 3, 3};
Tensor<4> gMO1{"g1", 3, 3, 3, 3};
Tensor<4> A = create_random_tensor("A", 3, 3, 3, 3);
Tensor<2> B = create_random_tensor("B", 3, 3);
REQUIRE_NOTHROW(einsum(Indices{p, q, r, l}, &gMO0, Indices{p, q, r, s}, A, Indices{s, l}, B));
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
for (size_t p0 = 0; p0 < B.dim(0); p0++) {
gMO1(i0, j0, k0, l0) += A(i0, j0, k0, p0) * B(p0, l0);
}
}
}
}
}
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
REQUIRE_THAT(gMO0(i0, j0, k0, l0), Catch::Matchers::WithinAbs(gMO1(i0, j0, k0, l0), 0.001));
}
}
}
}
REQUIRE_NOTHROW(einsum(Indices{p, q, k, s}, &gMO0, Indices{p, q, r, s}, A, Indices{r, k}, B));
gMO1.zero();
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
for (size_t p0 = 0; p0 < B.dim(0); p0++) {
gMO1(i0, j0, k0, l0) += A(i0, j0, p0, l0) * B(p0, k0);
}
}
}
}
}
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
REQUIRE_THAT(gMO0(i0, j0, k0, l0), Catch::Matchers::WithinAbs(gMO1(i0, j0, k0, l0), 0.001));
}
}
}
}
#if 0
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
auto vgMO0 = gMO0(i0, j0, All{}, All{});
TensorAlgebra::einsum(Indices{k, s}, &vgMO0, Indices{r, s}, A(i0, j0, All{}, All{}), Indices{r, k}, B);
}
}
for (size_t i0 = 0; i0 < gMO0.dim(0); i0++) {
for (size_t j0 = 0; j0 < gMO0.dim(1); j0++) {
for (size_t k0 = 0; k0 < gMO0.dim(2); k0++) {
for (size_t l0 = 0; l0 < gMO0.dim(3); l0++) {
// println("i0 %lu j0 %lu k0 %lu l0 %lu, gMO0 %lf, gMO1 %lf", i0, j0, k0, l0, gMO0(i0, j0, k0, l0),
// gMO1(i0, j0, k0, l0));
REQUIRE(gMO0(i0, j0, k0, l0) == gMO1(i0, j0, k0, l0));
}
}
}
}
#endif
}
// timer::report();
// timer::finalize();
}
TEST_CASE("IntegralTransformation") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
// timer::initialize();
// SECTION("3x3x3x3 <- 3x3x3x3 * 3x3 * 3x3 * 3x3 * 3x3") {
// Tensor<2> C1 = create_random_tensor("C1", 4, 2);
// Tensor<2> C2 = create_random_tensor("C2", 4, 2);
// Tensor<2> C3 = create_random_tensor("C3", 4, 3);
// Tensor<2> C4 = create_random_tensor("C4", 4, 4);
// Tensor<4> true_answer{"true", 2, 2, 3, 4};
// Tensor<4> memory_ao = create_random_tensor("ao", 4, 4, 4, 4);
// DiskTensor<4> disk_ao{State::data, "ao", 4, 4, 4, 4};
// // #pragma omp parallel for collapse(8)
// for (size_t i0 = 0; i0 < C1.dim(1); i0++) {
// for (size_t j0 = 0; j0 < C2.dim(1); j0++) {
// for (size_t k0 = 0; k0 < C3.dim(1); k0++) {
// for (size_t l0 = 0; l0 < C4.dim(1); l0++) {
// for (size_t p0 = 0; p0 < C1.dim(0); p0++) {
// for (size_t q0 = 0; q0 < C2.dim(0); q0++) {
// for (size_t r0 = 0; r0 < C3.dim(0); r0++) {
// for (size_t s0 = 0; s0 < C4.dim(0); s0++) {
// true_answer(i0, j0, k0, l0) +=
// C1(p0, i0) * C2(q0, j0) * C3(r0, k0) * C4(s0, l0) * memory_ao(p0, q0, r0, s0);
// }
// }
// }
// }
// }
// }
// }
// }
// // Save our inital memory_ao to disk
// write(State::data, C1);
// write(State::data, C2);
// write(State::data, C3);
// write(State::data, C4);
// disk_ao(All{}, All{}, All{}, All{}) = memory_ao;
// auto temp = disk_ao(All{}, All{}, All{}, All{});
// auto &temp2 = temp.get();
// // Ensure the data was saved to disk correctly
// for (size_t i0 = 0; i0 < C1.dim(1); i0++) {
// for (size_t j0 = 0; j0 < C2.dim(1); j0++) {
// for (size_t k0 = 0; k0 < C3.dim(1); k0++) {
// for (size_t l0 = 0; l0 < C4.dim(1); l0++) {
// REQUIRE(temp2(i0, j0, k0, l0) == memory_ao(i0, j0, k0, l0));
// }
// }
// }
// }
// auto memory_result = transformation("mo", memory_ao, C1, C2, C3, C4);
// auto disk_result = transformation("mo", disk_ao, C1, C2, C3, C4);
// // Make sure the memory and disk results match
// for (size_t i0 = 0; i0 < C1.dim(1); i0++) {
// for (size_t j0 = 0; j0 < C2.dim(1); j0++) {
// for (size_t k0 = 0; k0 < C3.dim(1); k0++) {
// for (size_t l0 = 0; l0 < C4.dim(1); l0++) {
// REQUIRE_THAT(memory_result(i0, j0, k0, l0), Catch::Matchers::WithinRel(true_answer(i0, j0, k0, l0), 0.0000001));
// }
// }
// }
// }
// for (size_t i0 = 0; i0 < C1.dim(1); i0++) {
// for (size_t j0 = 0; j0 < C2.dim(1); j0++) {
// auto disk_view = disk_result(i0, j0, All{}, All{});
// auto &disk_tensor = disk_view.get();
// for (size_t k0 = 0; k0 < C3.dim(1); k0++) {
// for (size_t l0 = 0; l0 < C4.dim(1); l0++) {
// REQUIRE_THAT(disk_tensor(k0, l0), Catch::Matchers::WithinRel(true_answer(i0, j0, k0, l0), 0.0000001));
// }
// }
// }
// }
// }
SECTION("R2 <- R3 * R3") {
Tensor<2> W_mi = create_random_tensor("W_mi", 4, 4);
Tensor<3> g_m = create_random_tensor("g_m", 4, 8, 8);
Tensor<3> t_i = create_random_tensor("t_i", 4, 8, 8);
// println(W_mi);
// println(g_m);
// println(t_i);
REQUIRE_NOTHROW(einsum(1.0, Indices{index::n, index::j}, &W_mi, 0.25, Indices{index::n, index::e, index::f}, g_m,
Indices{index::j, index::e, index::f}, t_i));
}
}
TEST_CASE("Hadamard") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
size_t _i = 3, _j = 4, _k = 5;
SECTION("i,j <- i,i * j*j") {
Tensor<2> A = create_random_tensor("A", _i, _i);
Tensor<2> B = create_random_tensor("B", _j, _j);
Tensor<2> C{"C", _i, _j};
Tensor<2> C0{"C0", _i, _j};
C0.zero();
// println(A);
// println(B);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
C0(i0, j0) += A(i0, i0) * B(j0, j0);
}
}
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{i, i}, A, Indices{j, j}, B));
// println(C0);
// println(C);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
REQUIRE_THAT(C(i0, j0), Catch::Matchers::WithinAbs(C0(i0, j0), 0.0001));
}
}
}
SECTION("i,j <- i,i,j * j,j,i") {
Tensor<3> A = create_random_tensor("A", _i, _i, _j);
Tensor<3> B = create_random_tensor("B", _j, _j, _i);
Tensor<2> C{"C", _i, _j};
Tensor<2> C0{"C0", _i, _j};
C0.zero();
// println(A);
// println(B);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
C0(i0, j0) += A(i0, i0, j0) * B(j0, j0, i0);
}
}
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{i, i, j}, A, Indices{j, j, i}, B));
// println(C0);
// println(C);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
REQUIRE_THAT(C(i0, j0), Catch::Matchers::WithinAbs(C0(i0, j0), 0.0001));
}
}
}
SECTION("i,j <- i,j,i * j,i,j") {
Tensor<3> A = create_random_tensor("A", _i, _j, _i);
Tensor<3> B = create_random_tensor("B", _j, _i, _j);
Tensor<2> C{"C", _i, _j};
Tensor<2> C0{"C0", _i, _j};
C0.zero();
// println(A);
// println(B);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
C0(i0, j0) += A(i0, j0, i0) * B(j0, i0, j0);
}
}
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{i, j, i}, A, Indices{j, i, j}, B));
// println(C0);
// println(C);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
REQUIRE_THAT(C(i0, j0), Catch::Matchers::WithinAbs(C0(i0, j0), 0.0001));
}
}
}
SECTION("i,j,i <- i,j,i * j,i,j") {
Tensor<3> A = create_random_tensor("A", _i, _j, _i);
Tensor<3> B = create_random_tensor("B", _j, _i, _j);
Tensor<3> C{"C", _i, _j, _i};
Tensor<3> C0{"C0", _i, _j, _i};
C0.zero();
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
C0(i0, j0, i0) += A(i0, j0, i0) * B(j0, i0, j0);
}
}
REQUIRE_NOTHROW(einsum(Indices{i, j, i}, &C, Indices{i, j, i}, A, Indices{j, i, j}, B));
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
CHECK_THAT(C(i0, j0, i0), Catch::Matchers::WithinRel(C0(i0, j0, i0), 0.00001));
}
}
}
SECTION("i,i,i <- i,j,i * j,i,j") {
Tensor<3> A = create_random_tensor("A", _i, _j, _i);
Tensor<3> B = create_random_tensor("B", _j, _i, _j);
Tensor<3> C{"C", _i, _i, _i};
Tensor<3> C0{"C0", _i, _i, _i};
C0.zero();
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
C0(i0, i0, i0) += A(i0, j0, i0) * B(j0, i0, j0);
}
}
REQUIRE_NOTHROW(einsum(Indices{i, i, i}, &C, Indices{i, j, i}, A, Indices{j, i, j}, B));
for (size_t i0 = 0; i0 < _i; i0++) {
CHECK_THAT(C(i0, i0, i0), Catch::Matchers::WithinRel(C0(i0, i0, i0), 0.00001));
}
}
SECTION("i,i <- i,j,k * j,i,k") {
Tensor<3> A = create_random_tensor("A", _i, _j, _k);
Tensor<3> B = create_random_tensor("B", _j, _i, _k);
Tensor<2> C{"C", _i, _i};
Tensor<2> C0{"C0", _i, _i};
C0.zero();
C.zero();
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
for (size_t k0 = 0; k0 < _k; k0++) {
C0(i0, i0) += A(i0, j0, k0) * B(j0, i0, k0);
}
}
}
REQUIRE_NOTHROW(einsum(Indices{i, i}, &C, Indices{i, j, k}, A, Indices{j, i, k}, B));
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _i; j0++) {
CHECK_THAT(C(i0, j0), Catch::Matchers::WithinRel(C0(i0, j0), 0.00001));
}
}
}
}
TEST_CASE("unique_ptr") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
SECTION("C") {
auto C0 = std::make_unique<Tensor<2>>("C0", 3, 3);
Tensor<2> C1{"C1", 3, 3};
Tensor<2> A = create_random_tensor("A", 3, 5);
Tensor<2> B = create_random_tensor("B", 5, 3);
// Working to get the einsum to perform the gemm that follows.
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, A, B, 0, &C1);
for (size_t i0 = 0; i0 < C0->dim(0); i0++) {
for (size_t j0 = 0; j0 < C0->dim(1); j0++) {
REQUIRE_THAT(C0->operator()(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("A") {
Tensor<2> C0{"C0", 3, 3};
Tensor<2> C1{"C1", 3, 3};
auto A = std::make_unique<Tensor<2>>(create_random_tensor("A", 3, 5));
Tensor<2> B = create_random_tensor("B", 5, 3);
// Working to get the einsum to perform the gemm that follows.
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, *A, B, 0, &C1);
for (size_t i0 = 0; i0 < C0.dim(0); i0++) {
for (size_t j0 = 0; j0 < C0.dim(1); j0++) {
REQUIRE_THAT(C0(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("B") {
Tensor<2> C0{"C0", 3, 3};
Tensor<2> C1{"C1", 3, 3};
Tensor<2> A = create_random_tensor("A", 5, 3);
auto B = std::make_unique<Tensor<2>>(create_random_tensor("B", 3, 5));
// Working to get the einsum to perform the gemm that follows.
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, A, *B, 0, &C1);
for (size_t i0 = 0; i0 < C0.dim(0); i0++) {
for (size_t j0 = 0; j0 < C0.dim(1); j0++) {
REQUIRE_THAT(C0(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("AB") {
Tensor<2> C0{"C0", 3, 3};
Tensor<2> C1{"C1", 3, 3};
auto A = std::make_unique<Tensor<2>>(create_random_tensor("A", 3, 5));
auto B = std::make_unique<Tensor<2>>(create_random_tensor("B", 3, 5));
// Working to get the einsum to perform the gemm that follows.
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, *A, *B, 0, &C1);
for (size_t i0 = 0; i0 < C0.dim(0); i0++) {
for (size_t j0 = 0; j0 < C0.dim(1); j0++) {
REQUIRE_THAT(C0(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("CA") {
auto C0 = std::make_unique<Tensor<2>>("C0", 3, 3);
Tensor<2> C1{"C1", 3, 3};
auto A = std::make_unique<Tensor<2>>(create_random_tensor("A", 3, 5));
Tensor<2> B = create_random_tensor("B", 5, 3);
// Working to get the einsum to perform the gemm that follows.
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, *A, B, 0, &C1);
for (size_t i0 = 0; i0 < C0->dim(0); i0++) {
for (size_t j0 = 0; j0 < C0->dim(1); j0++) {
REQUIRE_THAT(C0->operator()(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("CB") {
auto C0 = std::make_unique<Tensor<2>>("C0", 3, 3);
Tensor<2> C1{"C1", 3, 3};
Tensor<2> A = create_random_tensor("A", 5, 3);
auto B = std::make_unique<Tensor<2>>(create_random_tensor("B", 3, 5));
// Working to get the einsum to perform the gemm that follows.
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, A, *B, 0, &C1);
for (size_t i0 = 0; i0 < C0->dim(0); i0++) {
for (size_t j0 = 0; j0 < C0->dim(1); j0++) {
REQUIRE_THAT(C0->operator()(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
SECTION("CAB") {
auto C0 = std::make_unique<Tensor<2>>("C0", 3, 3);
Tensor<2> C1{"C1", 3, 3};
auto A = std::make_unique<Tensor<2>>(create_random_tensor("A", 3, 5));
auto B = std::make_unique<Tensor<2>>(create_random_tensor("B", 3, 5));
// Working to get the einsum to perform the gemm that follows.
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C0, Indices{i, k}, A, Indices{k, j}, B));
linear_algebra::gemm<false, false>(1.0, *A, *B, 0, &C1);
for (size_t i0 = 0; i0 < C0->dim(0); i0++) {
for (size_t j0 = 0; j0 < C0->dim(1); j0++) {
REQUIRE_THAT(C0->operator()(i0, j0), Catch::Matchers::WithinRel(C1(i0, j0), 0.0001));
}
}
}
}
TEST_CASE("Transpose C", "[einsum]") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
size_t _i = 3, _j = 4, _k = 5;
SECTION("i,j <- j,k * k,i === true, false, false") {
Tensor<2> A = create_random_tensor("A", _j, _k);
Tensor<2> B = create_random_tensor("B", _k, _i);
Tensor<2> C{"C", _i, _j};
Tensor<2> C0{"C0", _i, _j};
C0.zero();
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{j, k}, A, Indices{k, i}, B));
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
for (size_t k0 = 0; k0 < _k; k0++) {
C0(i0, j0) += A(j0, k0) * B(k0, i0);
}
}
}
// println(C0);
// println(C);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
REQUIRE_THAT(C(i0, j0), Catch::Matchers::WithinAbs(C0(i0, j0), 0.001));
}
}
}
SECTION("i,j <- k,j * k,i === true, true, false") {
Tensor<2> A = create_random_tensor("A", _k, _j);
Tensor<2> B = create_random_tensor("B", _k, _i);
Tensor<2> C{"C", _i, _j};
Tensor<2> C0{"C0", _i, _j};
C0.zero();
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{k, j}, A, Indices{k, i}, B));
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
for (size_t k0 = 0; k0 < _k; k0++) {
C0(i0, j0) += A(k0, j0) * B(k0, i0);
}
}
}
// println(C0);
// println(C);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
REQUIRE_THAT(C(i0, j0), Catch::Matchers::WithinAbs(C0(i0, j0), 0.001));
}
}
}
SECTION("i,j <- j,k * i,k === true, false, true") {
Tensor<2> A = create_random_tensor("A", _j, _k);
Tensor<2> B = create_random_tensor("B", _i, _k);
Tensor<2> C{"C", _i, _j};
Tensor<2> C0{"C0", _i, _j};
C0.zero();
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{j, k}, A, Indices{i, k}, B));
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
for (size_t k0 = 0; k0 < _k; k0++) {
C0(i0, j0) += A(j0, k0) * B(i0, k0);
}
}
}
// println(C0);
// println(C);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
REQUIRE_THAT(C(i0, j0), Catch::Matchers::WithinAbs(C0(i0, j0), 0.001));
}
}
}
SECTION("i,j <- k,j * i,k === true, true, true") {
Tensor<2> A = create_random_tensor("A", _k, _j);
Tensor<2> B = create_random_tensor("B", _i, _k);
Tensor<2> C{"C", _i, _j};
Tensor<2> C0{"C0", _i, _j};
C0.zero();
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{k, j}, A, Indices{i, k}, B));
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
for (size_t k0 = 0; k0 < _k; k0++) {
C0(i0, j0) += A(k0, j0) * B(i0, k0);
}
}
}
// println(C0);
// println(C);
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
REQUIRE_THAT(C(i0, j0), Catch::Matchers::WithinAbs(C0(i0, j0), 0.001));
}
}
}
SECTION("Wmnij <- 0.25 t_ijef * g_mnef") {
size_t _m = 12, _n = 12, _i = 5, _j = 5, _e = 7, _f = 7;
Tensor<4> Wmnij{"Wmnij", _m, _n, _i, _j};
Tensor<4> W0{"Wmnij", _m, _n, _i, _j};
Tensor<4> t_oovv = create_random_tensor("t_oovv", _i, _j, _e, _f);
Tensor<4> g_oovv = create_random_tensor("g_oovv", _m, _n, _e, _f);
REQUIRE_NOTHROW(einsum(1.0, Indices{m, n, i, j}, &Wmnij, 0.25, Indices{i, j, e, f}, t_oovv, Indices{m, n, e, f}, g_oovv));
for (size_t m0 = 0; m0 < _m; m0++) {
for (size_t n0 = 0; n0 < _n; n0++) {
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
for (size_t e0 = 0; e0 < _e; e0++) {
for (size_t f0 = 0; f0 < _f; f0++) {
W0(m0, n0, i0, j0) += 0.25 * t_oovv(i0, j0, e0, f0) * g_oovv(m0, n0, e0, f0);
}
}
}
}
}
}
for (size_t m0 = 0; m0 < _m; m0++) {
for (size_t n0 = 0; n0 < _n; n0++) {
for (size_t i0 = 0; i0 < _i; i0++) {
for (size_t j0 = 0; j0 < _j; j0++) {
REQUIRE_THAT(Wmnij(m0, n0, i0, j0), Catch::Matchers::WithinAbs(W0(m0, n0, i0, j0), 0.001));
}
}
}
}
}
}
TEST_CASE("gemv") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
SECTION("check") {
size_t _p = 7, _q = 7, _r = 7, _s = 7;
Tensor<4> g = create_random_tensor("g", _p, _q, _r, _s);
Tensor<2> D = create_random_tensor("d", _r, _s);
Tensor<2> F{"F", _p, _q};
Tensor<2> F0{"F0", _p, _q};
REQUIRE_NOTHROW(einsum(1.0, Indices{p, q}, &F0, 2.0, Indices{p, q, r, s}, g, Indices{r, s}, D));
TensorView<2> gv{g, Dim<2>{_p * _q, _r * _s}};
TensorView<1> dv{D, Dim<1>{_r * _s}};
TensorView<1> Fv{F, Dim<1>{_p * _q}};
linear_algebra::gemv<false>(2.0, gv, dv, 1.0, &Fv);
// println(F0);
// println(F);
}
}
TEST_CASE("TensorView einsum") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
// Test if everything passed to einsum is a TensorView.
Tensor<2> A = create_random_tensor("A", 3, 5);
Tensor<2> B = create_random_tensor("B", 3, 5);
TensorView<2> A_view{A, Dim<2>{3, 3}};
TensorView<2> B_view{B, Dim<2>{3, 3}, Offset<2>{0, 2}};
Tensor<2> C{"C2", 10, 10};
TensorView<2> C_view{C, Dim<2>{3, 3}, Offset<2>{5, 5}};
// To perform the test we make an explicit copy of the TensorViews into their own Tensors
Tensor<2> A_copy{"A copy", 3, 3};
Tensor<2> B_copy{"B copy", 3, 3};
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
A_copy(x, y) = A_view(x, y);
B_copy(x, y) = B_view(x, y);
}
}
// The target solution is determined from not using views
Tensor<2> C_solution{"C solution", 3, 3};
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C_solution, Indices{i, k}, A_copy, Indices{j, k}, B_copy));
// einsum where everything is a TensorView
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C_view, Indices{i, k}, A_view, Indices{j, k}, B_view));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C_view(x, y), Catch::Matchers::WithinAbs(C_solution(x, y), 0.001));
REQUIRE_THAT(C(x + 5, y + 5), Catch::Matchers::WithinAbs(C_solution(x, y), 0.001));
}
}
}
TEST_CASE("outer product") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
SECTION("1 * 1 -> 2") {
Tensor<1> A = create_random_tensor("A", 3);
Tensor<1> B = create_random_tensor("B", 3);
Tensor<2> C{"C", 3, 3};
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{i}, A, Indices{j}, B));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C(x, y), Catch::Matchers::WithinAbs(A(x) * B(y), 0.001));
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{j}, A, Indices{i}, B));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C(x, y), Catch::Matchers::WithinAbs(A(y) * B(x), 0.001));
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{j, i}, &C, Indices{j}, A, Indices{i}, B));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C(y, x), Catch::Matchers::WithinAbs(A(y) * B(x), 0.001));
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{j, i}, &C, Indices{i}, A, Indices{j}, B));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C(y, x), Catch::Matchers::WithinAbs(A(x) * B(y), 0.001));
}
}
}
SECTION("2 * 1 -> 3") {
Tensor<2> A = create_random_tensor("A", 3, 3);
Tensor<1> B = create_random_tensor("B", 3);
Tensor<3> C{"C", 3, 3, 3};
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j, k}, &C, Indices{i, j}, A, Indices{k}, B));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
REQUIRE_THAT(C(x, y, z), Catch::Matchers::WithinAbs(A(x, y) * B(z), 0.001));
}
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{k, i, j}, &C, Indices{i, j}, A, Indices{k}, B));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
REQUIRE_THAT(C(z, x, y), Catch::Matchers::WithinAbs(A(x, y) * B(z), 0.001));
}
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{k, i, j}, &C, Indices{k}, B, Indices{i, j}, A));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
REQUIRE_THAT(C(z, x, y), Catch::Matchers::WithinAbs(A(x, y) * B(z), 0.001));
}
}
}
}
SECTION("2 * 2 -> 4") {
Tensor<2> A = create_random_tensor("A", 3, 3);
Tensor<2> B = create_random_tensor("B", 3, 3);
Tensor<4> C{"C", 3, 3, 3, 3};
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j, k, l}, &C, Indices{i, j}, A, Indices{k, l}, B));
for (int w = 0; w < 3; w++) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
REQUIRE_THAT(C(w, x, y, z), Catch::Matchers::WithinAbs(A(w, x) * B(y, z), 0.001));
}
}
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j, k, l}, &C, Indices{k, l}, A, Indices{i, j}, B));
for (int w = 0; w < 3; w++) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
REQUIRE_THAT(C(w, x, y, z), Catch::Matchers::WithinAbs(A(y, z) * B(w, x), 0.001));
}
}
}
}
}
}
TEST_CASE("view outer product") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
SECTION("1 * 1 -> 2") {
Tensor<1> A = create_random_tensor("A", 6);
Tensor<1> B = create_random_tensor("B", 6);
auto vA = TensorView<1>(A, Dim<1>{3}, Offset<1>{3});
auto vB = TensorView<1>(B, Dim<1>{3});
Tensor<2> C{"C", 3, 3};
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{i}, vA, Indices{j}, vB));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C(x, y), Catch::Matchers::WithinAbs(vA(x) * vB(y), 0.001));
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j}, &C, Indices{j}, vA, Indices{i}, vB));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C(x, y), Catch::Matchers::WithinAbs(vA(y) * vB(x), 0.001));
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{j, i}, &C, Indices{j}, vA, Indices{i}, vB));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C(y, x), Catch::Matchers::WithinAbs(vA(y) * vB(x), 0.001));
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{j, i}, &C, Indices{i}, vA, Indices{j}, vB));
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
REQUIRE_THAT(C(y, x), Catch::Matchers::WithinAbs(vA(x) * vB(y), 0.001));
}
}
}
SECTION("2 * 2 -> 4") {
Tensor<2> A = create_random_tensor("A", 9, 9);
Tensor<2> B = create_random_tensor("B", 12, 12);
auto vA = TensorView{A, Dim<2>{3, 3}, Offset<2>{6, 3}};
auto vB = TensorView{B, Dim<2>{3, 3}, Offset<2>{5, 7}};
Tensor<4> C{"C", 3, 3, 3, 3};
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j, k, l}, &C, Indices{i, j}, vA, Indices{k, l}, vB));
for (int w = 0; w < 3; w++) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
REQUIRE_THAT(C(w, x, y, z), Catch::Matchers::WithinAbs(vA(w, x) * vB(y, z), 0.001));
}
}
}
}
C.set_all(0.0);
REQUIRE_NOTHROW(einsum(Indices{i, j, k, l}, &C, Indices{k, l}, vA, Indices{i, j}, vB));
for (int w = 0; w < 3; w++) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
REQUIRE_THAT(C(w, x, y, z), Catch::Matchers::WithinAbs(vA(y, z) * vB(w, x), 0.001));
}
}
}
}
}
}
TEST_CASE("element transform") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
SECTION("tensor") {
Tensor<4> A = create_random_tensor("A", 32, 32, 32, 32);
Tensor<4> Acopy = A;
element_transform(&A, [](double val) -> double { return 1.0 / val; });
for (int w = 0; w < 3; w++) {
for (int x = 0; x < 3; x++) {
for (int y = 0; y < 3; y++) {
for (int z = 0; z < 3; z++) {
REQUIRE_THAT(A(w, x, y, z), Catch::Matchers::WithinAbs(1.0 / Acopy(w, x, y, z), 0.001));
}
}
}
}
}
SECTION("smartptr tensor") {
auto A = std::make_unique<Tensor<4>>("A", 32, 32, 32, 32);
element_transform(&A, [](double val) -> double { return 1.0 / val; });
}
}
TEST_CASE("element") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
SECTION("1") {
Tensor<4> A = create_random_tensor("A", 10, 10, 10, 10);
Tensor<4> Acopy = A;
Tensor<4> B = create_random_tensor("B", 10, 10, 10, 10);
element([](double const &Aval, double const &Bval) -> double { return Aval + Bval; }, &A, B);
for (int w = 0; w < 10; w++) {
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
for (int z = 0; z < 10; z++) {
REQUIRE_THAT(A(w, x, y, z), Catch::Matchers::WithinAbs(Acopy(w, x, y, z) + B(w, x, y, z), 0.001));
}
}
}
}
}
SECTION("2") {
Tensor<4> A = create_random_tensor("A", 10, 10, 10, 10);
Tensor<4> Acopy = A;
Tensor<4> B = create_random_tensor("B", 10, 10, 10, 10);
Tensor<4> C = create_random_tensor("C", 10, 10, 10, 10);
element([](double const &Aval, double const &Bval, double const &Cval) -> double { return Aval + Bval + Cval; }, &A, B, C);
for (int w = 0; w < 10; w++) {
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 10; y++) {
for (int z = 0; z < 10; z++) {
REQUIRE_THAT(A(w, x, y, z), Catch::Matchers::WithinAbs(Acopy(w, x, y, z) + B(w, x, y, z) + C(w, x, y, z), 0.001));
}
}
}
}
}
// SECTION("2 - error") {
// Tensor<4> A = create_random_tensor("A", 10, 10, 10, 10);
// Tensor<4> Acopy = A;
// Tensor<4> B = create_random_tensor("B", 10, 10, 10, 9);
// Tensor<4> C = create_random_tensor("C", 10, 10, 10, 10);
// element(
// &A, [](double const &Aval, double const &Bval, double const &Cval) -> double { return Aval + Bval + Cval; }, B, C);
// }
}
TEST_CASE("F12 - V term") {
using namespace einsums;
using namespace einsums::tensor_algebra;
using namespace einsums::tensor_algebra::index;
// int nocc{5}, ncabs{116}, nobs{41};
int nocc{1}, ncabs{4}, nobs{2};
int nall{nobs + ncabs};
auto F = create_incremented_tensor("F", nall, nall, nall, nall);
auto G = create_incremented_tensor("G", nall, nall, nall, nall);
TensorView<4> F_ooco{F, Dim<4>{nocc, nocc, ncabs, nocc}, Offset<4>{0, 0, nobs, 0}};
TensorView<4> F_oooc{F, Dim<4>{nocc, nocc, nocc, ncabs}, Offset<4>{0, 0, 0, nobs}};
TensorView<4> F_oopq{F, Dim<4>{nocc, nocc, nobs, nobs}, Offset<4>{0, 0, 0, 0}};
TensorView<4> G_ooco{G, Dim<4>{nocc, nocc, ncabs, nocc}, Offset<4>{0, 0, nobs, 0}};
TensorView<4> G_oooc{G, Dim<4>{nocc, nocc, nocc, ncabs}, Offset<4>{0, 0, 0, nobs}};
TensorView<4> G_oopq{G, Dim<4>{nocc, nocc, nobs, nobs}, Offset<4>{0, 0, 0, 0}};
Tensor ijkl_1 = Tensor{"Einsum Temp 1", nocc, nocc, nocc, nocc};
Tensor ijkl_2 = Tensor{"Einsum Temp 2", nocc, nocc, nocc, nocc};
Tensor ijkl_3 = Tensor{"Einsum Temp 3", nocc, nocc, nocc, nocc};
ijkl_1.set_all(0.0);
ijkl_2.set_all(0.0);
ijkl_3.set_all(0.0);
Tensor result = Tensor{"Result", nocc, nocc, nocc, nocc};
Tensor result2 = Tensor{"Result2", nocc, nocc, nocc, nocc};
// println(F);
// println(G);
einsum(Indices{i, j, k, l}, &ijkl_1, Indices{i, j, p, n}, G_ooco, Indices{k, l, p, n}, F_ooco);
einsum(Indices{i, j, k, l}, &ijkl_2, Indices{i, j, m, q}, G_oooc, Indices{k, l, m, q}, F_oooc);
einsum(Indices{i, j, k, l}, &ijkl_3, Indices{i, j, p, q}, G_oopq, Indices{k, l, p, q}, F_oopq);
result.set_all(0.0);
result2.set_all(0.0);
timer::push("raw for loops");
for (size_t _i = 0; _i < nocc; _i++) {
for (size_t _j = 0; _j < nocc; _j++) {
for (size_t _k = 0; _k < nocc; _k++) {
for (size_t _l = 0; _l < nocc; _l++) {
for (size_t _p = 0; _p < ncabs; _p++) {
for (size_t _n = 0; _n < nocc; _n++) {
// println("A({}, {}, {}, {}) = {}", _i, _j, _p, _n, G_ooco(_i, _j, _p, _n));
// println("B({}, {}, {}, {}) = {}", _k, _l, _p, _n, F_ooco(_k, _l, _p, _n));
result(_i, _j, _k, _l) += G(_i, _j, nobs + _p, _n) * F(_k, _l, nobs + _p, _n);
result2(_i, _j, _k, _l) += G_ooco(_i, _j, _p, _n) * F_ooco(_k, _l, _p, _n);
}
}
}
}
}
}
timer::pop();
// println(result);
// println(ijkl_1);
for (size_t _i = 0; _i < nocc; _i++) {
for (size_t _j = 0; _j < nocc; _j++) {
for (size_t _k = 0; _k < nocc; _k++) {
for (size_t _l = 0; _l < nocc; _l++) {
REQUIRE_THAT(result2(_i, _j, _k, _l), Catch::Matchers::WithinAbs(result(_i, _j, _k, _l), 0.001));
}
}
}
}
for (size_t _i = 0; _i < nocc; _i++) {
for (size_t _j = 0; _j < nocc; _j++) {
for (size_t _k = 0; _k < nocc; _k++) {
for (size_t _l = 0; _l < nocc; _l++) {
REQUIRE_THAT(ijkl_1(_i, _j, _k, _l), Catch::Matchers::WithinAbs(result(_i, _j, _k, _l), 0.001));
}
}
}
}
} | 34.715566 | 139 | 0.440249 | jturney |
2885fb771f55eac7f0fa6436dee6595c72bc9b33 | 260 | cpp | C++ | bytecode/interpreter/src/BytecodeInterpreter/Units/InterpreterCommandJumpRel.cpp | Scorbutics/skalang | c8d1869a2f0c7857ee05ef45bd3aa4e537d39558 | [
"MIT"
] | 3 | 2019-04-08T17:34:19.000Z | 2020-01-03T04:47:06.000Z | bytecode/interpreter/src/BytecodeInterpreter/Units/InterpreterCommandJumpRel.cpp | Scorbutics/skalang | c8d1869a2f0c7857ee05ef45bd3aa4e537d39558 | [
"MIT"
] | 4 | 2020-04-19T22:09:06.000Z | 2020-11-06T15:47:08.000Z | bytecode/interpreter/src/BytecodeInterpreter/Units/InterpreterCommandJumpRel.cpp | Scorbutics/skalang | c8d1869a2f0c7857ee05ef45bd3aa4e537d39558 | [
"MIT"
] | null | null | null | #include "InterpreterCommandJumpRel.h"
SKALANG_BYTECODE_INTERPRETER_COMMAND_DECLARE(JUMP_REL)(ExecutionContext& context, const Operand& left, const Operand& right) {
context.jumpRelative(context.get<long>(context.currentInstruction().dest()));
return {};
}
| 37.142857 | 126 | 0.803846 | Scorbutics |
2887639327b6324c51c5ef436cc18b8db262a8dd | 1,159 | cpp | C++ | 4788/src/main/cpp/ControlMap.cpp | goanna247/2021-GameChangers | 99faf17d1e444f0a0f861bcb85375502c52d366c | [
"MIT"
] | 1 | 2021-02-04T09:06:51.000Z | 2021-02-04T09:06:51.000Z | 4788/src/main/cpp/ControlMap.cpp | goanna247/2021-GameChangers | 99faf17d1e444f0a0f861bcb85375502c52d366c | [
"MIT"
] | null | null | null | 4788/src/main/cpp/ControlMap.cpp | goanna247/2021-GameChangers | 99faf17d1e444f0a0f861bcb85375502c52d366c | [
"MIT"
] | null | null | null | #include "ControlMap.h"
using namespace wml;
using namespace wml::controllers;
void ControlMap::InitsmartControllerGroup(SmartControllerGroup &contGroup) {
// Remap Here (map POV buttons to names etc)
}
// ------------------ Values ------------------
// Controller Ports
const int ControlMap::Xbox1Port = 0;
const int ControlMap::Xbox2Port = 1;
// Deadzones
const double ControlMap::XboxDeadzone = 0.1;
const double ControlMap::TriggerDeadzone = 0.15;
// PCMs
const int ControlMap::PCModule = 1;
// Left Drive
const int ControlMap::FLport = 1;
const int ControlMap::BLport = 2;
// Right Drive
const int ControlMap::FRport = 3;
const int ControlMap::BRport = 4;
// Drivetrain speed
const double ControlMap::MaxDrivetrainSpeed = 0.8;
// Robot Values
const double ControlMap::TrackWidth = 0.56;
const double ControlMap::TrackDepth = 0.60;
const double ControlMap::WheelRadius = 0.0762; // In meters
const double ControlMap::Mass = 50; // KG's
// ------------------ Values ------------------
const tAxis ControlMap::DrivetrainLeft{ Driver, XboxController::kLeftYAxis };
const tAxis ControlMap::DrivetrainRight{ Driver, XboxController::kRightYAxis }; | 26.340909 | 79 | 0.705781 | goanna247 |
288952c3486266ca500db759bc9403a6ffb8de0e | 823 | hpp | C++ | include/awt/KeyboardFocusManager.hpp | krzydyn/jacpp | ab9b5bfcca1774198c05d9187e5891de1fdf4759 | [
"Apache-2.0"
] | 5 | 2019-01-01T14:55:58.000Z | 2021-01-31T14:55:59.000Z | include/awt/KeyboardFocusManager.hpp | krzydyn/jacpp | ab9b5bfcca1774198c05d9187e5891de1fdf4759 | [
"Apache-2.0"
] | null | null | null | include/awt/KeyboardFocusManager.hpp | krzydyn/jacpp | ab9b5bfcca1774198c05d9187e5891de1fdf4759 | [
"Apache-2.0"
] | null | null | null | #ifndef __AWT_KEYBOARDFOCUSMANAGER_HPP
#define __AWT_KEYBOARDFOCUSMANAGER_HPP
#include <awt/AWTEvent.hpp>
namespace awt {
class Component;
class KeyboardFocusManager {
public:
static const int FORWARD_TRAVERSAL_KEYS = 0;
static const int BACKWARD_TRAVERSAL_KEYS = 1;
static const int UP_CYCLE_TRAVERSAL_KEYS = 2;
static const int DOWN_CYCLE_TRAVERSAL_KEYS = 3;
static KeyboardFocusManager* getCurrentKeyboardFocusManager();
static void setCurrentKeyboardFocusManager(KeyboardFocusManager* newManager);
static boolean isAutoFocusTransferEnabledFor(Component *comp);
static AWTEvent& retargetFocusEvent(AWTEvent& event);
virtual boolean dispatchEvent(AWTEvent& e) const = 0;
virtual void processKeyEvent(Component* focusedComponent, AWTEvent& e) const = 0;
virtual Component* getFocusOwner();
};
}
#endif
| 26.548387 | 82 | 0.81531 | krzydyn |
288bbb5bca80b34fecf6d2073e61b5c8eeefa761 | 355 | cpp | C++ | chapter_03/question_7/main.cpp | chichi9527/C-Plus-Plus-Primer-Plus-Answers | 82c88a16ea7283109a3d44332c1322b05d3aec35 | [
"MIT"
] | null | null | null | chapter_03/question_7/main.cpp | chichi9527/C-Plus-Plus-Primer-Plus-Answers | 82c88a16ea7283109a3d44332c1322b05d3aec35 | [
"MIT"
] | null | null | null | chapter_03/question_7/main.cpp | chichi9527/C-Plus-Plus-Primer-Plus-Answers | 82c88a16ea7283109a3d44332c1322b05d3aec35 | [
"MIT"
] | null | null | null | #include <iostream>
int main(void) {
using std::cout;
using std::endl;
using std::cin;
double lper100km;
cout << "Enter the gasoline consumption of the car(L / 100 km): ";
cin >> lper100km;
cout << "The car is " << 100 * 3.875 / lper100km * 0.6214;
cout << " miles per gallon." << endl;
return 0;
} | 20.882353 | 71 | 0.549296 | chichi9527 |
288cea20cf1be1d8054b4fe61140e0f6a1ab7b4a | 305 | cpp | C++ | src/examples/11_module/02_dynamic_memory/main.cpp | acc-cosc-1337-spring-2020-hl/acc-cosc-1337-spring-2020-hl-acc-cosc-1337-spring-2020-94919311 | 0d5b19456063a304d4c20040ee2d3b21a1f6b131 | [
"MIT"
] | null | null | null | src/examples/11_module/02_dynamic_memory/main.cpp | acc-cosc-1337-spring-2020-hl/acc-cosc-1337-spring-2020-hl-acc-cosc-1337-spring-2020-94919311 | 0d5b19456063a304d4c20040ee2d3b21a1f6b131 | [
"MIT"
] | null | null | null | src/examples/11_module/02_dynamic_memory/main.cpp | acc-cosc-1337-spring-2020-hl/acc-cosc-1337-spring-2020-hl-acc-cosc-1337-spring-2020-94919311 | 0d5b19456063a304d4c20040ee2d3b21a1f6b131 | [
"MIT"
] | null | null | null | #include <iostream>
using std::cout;
int main()
{
int* ptr_num = new int(5);
cout << &ptr_num << "\n"; // displays the adress where ptr_num is stored
cout << ptr_num << "\n"; // displays the adress where 5 is stored
cout << *ptr_num << "\n";
delete ptr_num;
ptr_num = nullptr;
return 0;
} | 16.944444 | 73 | 0.619672 | acc-cosc-1337-spring-2020-hl |
288db0de853572e3d2b344a5cfae9b74dac2b7cd | 23,470 | cpp | C++ | examples/getting_started.cpp | cfRod/oneDNN | 7981216b8341b8603e54472f5a0dd7a12ef9cf67 | [
"Apache-2.0"
] | 1,327 | 2018-01-25T21:23:47.000Z | 2020-04-03T09:39:30.000Z | examples/getting_started.cpp | cfRod/oneDNN | 7981216b8341b8603e54472f5a0dd7a12ef9cf67 | [
"Apache-2.0"
] | 498 | 2018-01-25T00:14:48.000Z | 2020-04-03T16:21:44.000Z | examples/getting_started.cpp | cfRod/oneDNN | 7981216b8341b8603e54472f5a0dd7a12ef9cf67 | [
"Apache-2.0"
] | 365 | 2018-01-29T16:12:36.000Z | 2020-04-03T08:32:27.000Z | /*******************************************************************************
* Copyright 2019-2022 Intel Corporation
*
* 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.
*******************************************************************************/
/// @example getting_started.cpp
/// @copybrief getting_started_cpp
/// > Annotated version: @ref getting_started_cpp
#include <cmath>
#include <numeric>
#include <stdexcept>
#include <vector>
#include "oneapi/dnnl/dnnl.hpp"
#include "oneapi/dnnl/dnnl_debug.h"
#include "example_utils.hpp"
using namespace dnnl;
// [Prologue]
/// @page getting_started_cpp Getting started
///
/// This C++ API example demonstrates the basics of the oneDNN programming model.
///
/// > Example code: @ref getting_started.cpp
///
/// This C++ API example demonstrates the basics of the oneDNN programming model:
/// - How to create oneDNN memory objects.
/// - How to get data from the user's buffer into a oneDNN memory object.
/// - How a tensor's logical dimensions and memory object formats relate.
/// - How to create oneDNN primitives.
/// - How to execute the primitives.
///
/// The example uses the ReLU operation and comprises the following steps:
/// 1. Creating @ref getting_started_cpp_sub1 to execute a primitive.
/// 2. Performing @ref getting_started_cpp_sub2.
/// 3. @ref getting_started_cpp_sub3 (using different flavors).
/// 4. @ref getting_started_cpp_sub4.
/// 5. @ref getting_started_cpp_sub5.
/// 6. @ref getting_started_cpp_sub6 (checking that the resulting image does
/// not contain negative values).
///
/// These steps are implemented in the @ref getting_started_cpp_tutorial, which
/// in turn is called from @ref getting_started_cpp_main (which is also
/// responsible for error handling).
///
/// @section getting_started_cpp_headers Public headers
///
/// To start using oneDNN we must first include the @ref dnnl.hpp
/// header file in the program. We also include @ref dnnl_debug.h in
/// example_utils.hpp, which contains some debugging facilities like returning
/// a string representation for common oneDNN C types.
// [Prologue]
/// @page getting_started_cpp
/// @section getting_started_cpp_tutorial getting_started_tutorial() function
///
void getting_started_tutorial(engine::kind engine_kind) {
/// @page getting_started_cpp
/// @subsection getting_started_cpp_sub1 Engine and stream
///
/// All oneDNN primitives and memory objects are attached to a
/// particular @ref dnnl::engine, which is an abstraction of a
/// computational device (see also @ref dev_guide_basic_concepts). The
/// primitives are created and optimized for the device they are attached
/// to and the memory objects refer to memory residing on the
/// corresponding device. In particular, that means neither memory objects
/// nor primitives that were created for one engine can be used on
/// another.
///
/// To create an engine, we should specify the @ref dnnl::engine::kind
/// and the index of the device of the given kind.
///
/// @snippet getting_started.cpp Initialize engine
// [Initialize engine]
engine eng(engine_kind, 0);
// [Initialize engine]
/// In addition to an engine, all primitives require a @ref dnnl::stream
/// for the execution. The stream encapsulates an execution context and is
/// tied to a particular engine.
///
/// The creation is pretty straightforward:
/// @snippet getting_started.cpp Initialize stream
// [Initialize stream]
stream engine_stream(eng);
// [Initialize stream]
/// In the simple cases, when a program works with one device only (e.g.
/// only on CPU), an engine and a stream can be created once and used
/// throughout the program. Some frameworks create singleton objects that
/// hold oneDNN engine and stream and use them throughout the code.
/// @subsection getting_started_cpp_sub2 Data preparation (code outside of oneDNN)
///
/// Now that the preparation work is done, let's create some data to work
/// with. We will create a 4D tensor in NHWC format, which is quite
/// popular in many frameworks.
///
/// Note that even though we work with one image only, the image tensor
/// is still 4D. The extra dimension (here N) corresponds to the
/// batch, and, in case of a single image, is equal to 1. It is pretty
/// typical to have the batch dimension even when working with a single
/// image.
///
/// In oneDNN, all CNN primitives assume that tensors have the batch
/// dimension, which is always the first logical dimension (see also @ref
/// dev_guide_conventions).
///
/// @snippet getting_started.cpp Create user's data
// [Create user's data]
const int N = 1, H = 13, W = 13, C = 3;
// Compute physical strides for each dimension
const int stride_N = H * W * C;
const int stride_H = W * C;
const int stride_W = C;
const int stride_C = 1;
// An auxiliary function that maps logical index to the physical offset
auto offset = [=](int n, int h, int w, int c) {
return n * stride_N + h * stride_H + w * stride_W + c * stride_C;
};
// The image size
const int image_size = N * H * W * C;
// Allocate a buffer for the image
std::vector<float> image(image_size);
// Initialize the image with some values
for (int n = 0; n < N; ++n)
for (int h = 0; h < H; ++h)
for (int w = 0; w < W; ++w)
for (int c = 0; c < C; ++c) {
int off = offset(
n, h, w, c); // Get the physical offset of a pixel
image[off] = -std::cos(off / 10.f);
}
// [Create user's data]
/// @subsection getting_started_cpp_sub3 Wrapping data into a oneDNN memory object
///
/// Now, having the image ready, let's wrap it in a @ref dnnl::memory
/// object to be able to pass the data to oneDNN primitives.
///
/// Creating @ref dnnl::memory comprises two steps:
/// 1. Initializing the @ref dnnl::memory::desc struct (also referred to
/// as a memory descriptor), which only describes the tensor data and
/// doesn't contain the data itself. Memory descriptors are used to
/// create @ref dnnl::memory objects and to initialize primitive
/// descriptors (shown later in the example).
/// 2. Creating the @ref dnnl::memory object itself (also referred to as
/// a memory object), based on the memory descriptor initialized in
/// step 1, an engine, and, optionally, a handle to data. The
/// memory object is used when a primitive is executed.
///
/// Thanks to the
/// [list initialization](https://en.cppreference.com/w/cpp/language/list_initialization)
/// introduced in C++11, it is possible to combine these two steps whenever
/// a memory descriptor is not used anywhere else but in creating a @ref
/// dnnl::memory object.
///
/// However, for the sake of demonstration, we will show both steps
/// explicitly.
/// @subsubsection getting_started_cpp_sub31 Memory descriptor
///
/// To initialize the @ref dnnl::memory::desc, we need to pass:
/// 1. The tensor's dimensions, **the semantic order** of which is
/// defined by **the primitive** that will use this memory
/// (descriptor).
///
/// @warning
/// Memory descriptors and objects are not aware of any meaning of
/// the data they describe or contain.
/// 2. The data type for the tensor (@ref dnnl::memory::data_type).
/// 3. The memory format tag (@ref dnnl::memory::format_tag) that
/// describes how the data is going to be laid out in the device's
/// memory. The memory format is required for the primitive to
/// correctly handle the data.
///
/// The code:
/// @snippet getting_started.cpp Init src_md
// [Init src_md]
auto src_md = memory::desc(
{N, C, H, W}, // logical dims, the order is defined by a primitive
memory::data_type::f32, // tensor's data type
memory::format_tag::nhwc // memory format, NHWC in this case
);
// [Init src_md]
/// The first thing to notice here is that we pass dimensions as `{N, C,
/// H, W}` while it might seem more natural to pass `{N, H, W, C}`, which
/// better corresponds to the user's code. This is because oneDNN
/// CNN primitives like ReLU always expect tensors in the following form:
///
/// | Spatial dim | Tensor dimensions
/// | :-- | :--
/// | 0D | \f$N \times C\f$
/// | 1D | \f$N \times C \times W\f$
/// | 2D | \f$N \times C \times H \times W\f$
/// | 3D | \f$N \times C \times D \times H \times W\f$
///
/// where:
/// - \f$N\f$ is a batch dimension (discussed above),
/// - \f$C\f$ is channel (aka feature maps) dimension, and
/// - \f$D\f$, \f$H\f$, and \f$W\f$ are spatial dimensions.
///
/// Now that the logical order of dimension is defined, we need to specify
/// the memory format (the third parameter), which describes how logical
/// indices map to the offset in memory. This is the place where the user's
/// format NHWC comes into play. oneDNN has different @ref
/// dnnl::memory::format_tag values that cover the most popular memory
/// formats like NCHW, NHWC, CHWN, and some others.
///
/// The memory descriptor for the image is called `src_md`. The `src` part
/// comes from the fact that the image will be a source for the ReLU
/// primitive (that is, we formulate memory names from the primitive
/// perspective; hence we will use `dst` to name the output memory). The
/// `md` is an initialism for Memory Descriptor.
/// @paragraph getting_started_cpp_sub311 Alternative way to create a memory descriptor
///
/// Before we continue with memory creation, let us show the alternative
/// way to create the same memory descriptor: instead of using the
/// @ref dnnl::memory::format_tag, we can directly specify the strides
/// of each tensor dimension:
/// @snippet getting_started.cpp Init alt_src_md
// [Init alt_src_md]
auto alt_src_md = memory::desc(
{N, C, H, W}, // logical dims, the order is defined by a primitive
memory::data_type::f32, // tensor's data type
{stride_N, stride_C, stride_H, stride_W} // the strides
);
// Sanity check: the memory descriptors should be the same
if (src_md != alt_src_md)
throw std::logic_error("Memory descriptor initialization mismatch.");
// [Init alt_src_md]
/// Just as before, the tensor's dimensions come in the `N, C, H, W` order
/// as required by CNN primitives. To define the physical memory format,
/// the strides are passed as the third parameter. Note that the order of
/// the strides corresponds to the order of the tensor's dimensions.
///
/// @warning
/// Using the wrong order might lead to incorrect results or even a
/// crash.
/// @subsubsection getting_started_cpp_sub32 Creating a memory object
///
/// Having a memory descriptor and an engine prepared, let's create
/// input and output memory objects for a ReLU primitive.
/// @snippet getting_started.cpp Create memory objects
// [Create memory objects]
// src_mem contains a copy of image after write_to_dnnl_memory function
auto src_mem = memory(src_md, eng);
write_to_dnnl_memory(image.data(), src_mem);
// For dst_mem the library allocates buffer
auto dst_mem = memory(src_md, eng);
// [Create memory objects]
/// We already have a memory buffer for the source memory object. We pass
/// it to the
/// @ref dnnl::memory::memory(const desc &, const engine &, void *)
/// constructor that takes a buffer pointer as its last argument.
///
/// Let's use a constructor that instructs the library to allocate a
/// memory buffer for the `dst_mem` for educational purposes.
///
/// The key difference between these two are:
/// 1. The library will own the memory for `dst_mem` and will deallocate
/// it when `dst_mem` is destroyed. That means the memory buffer can
/// be used only while `dst_mem` is alive.
/// 2. Library-allocated buffers have good alignment, which typically
/// results in better performance.
///
/// @note
/// Memory allocated outside of the library and passed to oneDNN
/// should have good alignment for better performance.
///
/// In the subsequent section we will show how to get the buffer (pointer)
/// from the `dst_mem` memory object.
/// @subsection getting_started_cpp_sub4 Creating a ReLU primitive
///
/// Let's now create a ReLU primitive.
///
/// The library implements ReLU primitive as a particular algorithm of a
/// more general @ref dev_guide_eltwise primitive, which applies a specified
/// function to each and every element of the source tensor.
///
/// Just as in the case of @ref dnnl::memory, a user should always go
/// through (at least) three creation steps (which however, can be sometimes
/// combined thanks to C++11):
/// 1. Initialize an operation descriptor (in this example,
/// @ref dnnl::eltwise_forward::desc), which defines the operation
/// parameters.
/// 2. Create an operation primitive descriptor (here @ref
/// dnnl::eltwise_forward::primitive_desc), which is a
/// **lightweight** descriptor of the actual algorithm that
/// **implements** the given operation. The user can query different
/// characteristics of the chosen implementation such as memory
/// consumptions and some others that will be covered in the next topic
/// (@ref memory_format_propagation_cpp).
/// 3. Create a primitive (here @ref dnnl::eltwise_forward) that can be
/// executed on memory objects to compute the operation.
///
/// oneDNN separates steps 2 and 3 to enable the user to inspect details of a
/// primitive implementation prior to creating the primitive. This may be
/// expensive, because, for example, oneDNN generates the optimized
/// computational code on the fly.
///
///@note
/// Primitive creation might be a very expensive operation, so consider
/// creating primitive objects once and executing them multiple times.
///
/// The code:
/// @snippet getting_started.cpp Create a ReLU primitive
// [Create a ReLU primitive]
// ReLU op descriptor (no engine- or implementation-specific information)
auto relu_d = eltwise_forward::desc(
prop_kind::forward_inference, algorithm::eltwise_relu,
src_md, // the memory descriptor for an operation to work on
0.f, // alpha parameter means negative slope in case of ReLU
0.f // beta parameter is ignored in case of ReLU
);
// ReLU primitive descriptor, which corresponds to a particular
// implementation in the library
auto relu_pd
= eltwise_forward::primitive_desc(relu_d, // an operation descriptor
eng // an engine the primitive will be created for
);
// ReLU primitive
auto relu = eltwise_forward(relu_pd); // !!! this can take quite some time
// [Create a ReLU primitive]
/// A note about variable names. Similar to the `_md` suffix used for
/// memory descriptor, we use `_d` for the operation descriptor names,
/// `_pd` for the primitive descriptors, and no suffix for primitives
/// themselves.
///
/// It is worth mentioning that we specified the exact tensor and its
/// memory format when we were initializing the `relu_d`. That means
/// `relu` primitive would perform computations with memory objects that
/// correspond to this description. This is the one and only one way of
/// creating non-compute-intensive primitives like @ref dev_guide_eltwise,
/// @ref dev_guide_batch_normalization, and others.
///
/// Compute-intensive primitives (like @ref dev_guide_convolution) have an
/// ability to define the appropriate memory format on their own. This is
/// one of the key features of the library and will be discussed in detail
/// in the next topic: @ref memory_format_propagation_cpp.
/// @subsection getting_started_cpp_sub5 Executing the ReLU primitive
///
/// Finally, let's execute the primitive and wait for its completion.
///
/// The input and output memory objects are passed to the `execute()`
/// method using a <tag, memory> map. Each tag specifies what kind of
/// tensor each memory object represents. All @ref dev_guide_eltwise
/// primitives require the map to have two elements: a source memory
/// object (input) and a destination memory (output).
///
/// A primitive is executed in a stream (the first parameter of the
/// `execute()` method). Depending on a stream kind, an execution might be
/// blocking or non-blocking. This means that we need to call @ref
/// dnnl::stream::wait before accessing the results.
///
/// @snippet getting_started.cpp Execute ReLU primitive
// [Execute ReLU primitive]
// Execute ReLU (out-of-place)
relu.execute(engine_stream, // The execution stream
{
// A map with all inputs and outputs
{DNNL_ARG_SRC, src_mem}, // Source tag and memory obj
{DNNL_ARG_DST, dst_mem}, // Destination tag and memory obj
});
// Wait the stream to complete the execution
engine_stream.wait();
// [Execute ReLU primitive]
/// The @ref dev_guide_eltwise is one of the primitives that support
/// in-place operations, meaning that the source and destination memory can
/// be the same. To perform in-place transformation, the user must pass the
/// same memory object for both the `DNNL_ARG_SRC` and
/// `DNNL_ARG_DST` tags:
/// @snippet getting_started.cpp Execute ReLU primitive in-place
// [Execute ReLU primitive in-place]
// Execute ReLU (in-place)
// relu.execute(engine_stream, {
// {DNNL_ARG_SRC, src_mem},
// {DNNL_ARG_DST, src_mem},
// });
// [Execute ReLU primitive in-place]
/// @page getting_started_cpp
/// @subsection getting_started_cpp_sub6 Obtaining the result and validation
///
/// Now that we have the computed result, let's validate that it is
/// actually correct. The result is stored in the `dst_mem` memory object.
/// So we need to obtain the C++ pointer to a buffer with data via @ref
/// dnnl::memory::get_data_handle() and cast it to the proper data type
/// as shown below.
///
/// @warning
/// The @ref dnnl::memory::get_data_handle() returns a raw handle
/// to the buffer, the type of which is engine specific. For the CPU
/// engine the buffer is always a pointer to `void`, which can safely
/// be used. However, for engines other than CPU the handle might be
/// runtime-specific type, such as `cl_mem` in case of GPU/OpenCL.
///
/// @snippet getting_started.cpp Check the results
// [Check the results]
// Obtain a buffer for the `dst_mem` and cast it to `float *`.
// This is safe since we created `dst_mem` as f32 tensor with known
// memory format.
std::vector<float> relu_image(image_size);
read_from_dnnl_memory(relu_image.data(), dst_mem);
/*
// Check the results
for (int n = 0; n < N; ++n)
for (int h = 0; h < H; ++h)
for (int w = 0; w < W; ++w)
for (int c = 0; c < C; ++c) {
int off = offset(
n, h, w, c); // get the physical offset of a pixel
float expected = image[off] < 0
? 0.f
: image[off]; // expected value
if (relu_image[off] != expected) {
std::cout << "At index(" << n << ", " << c << ", " << h
<< ", " << w << ") expect " << expected
<< " but got " << relu_image[off]
<< std::endl;
throw std::logic_error("Accuracy check failed.");
}
}
// [Check the results]
*/
}
/// @page getting_started_cpp
///
/// @section getting_started_cpp_main main() function
///
/// We now just call everything we prepared earlier.
///
/// Because we are using the oneDNN C++ API, we use exceptions to handle errors
/// (see @ref dev_guide_c_and_cpp_apis).
/// The oneDNN C++ API throws exceptions of type @ref dnnl::error,
/// which contains the error status (of type @ref dnnl_status_t) and a
/// human-readable error message accessible through regular `what()` method.
/// @page getting_started_cpp
/// @snippet getting_started.cpp Main
// [Main]
int main(int argc, char **argv) {
int exit_code = 0;
engine::kind engine_kind = parse_engine_kind(argc, argv);
try {
getting_started_tutorial(engine_kind);
} catch (dnnl::error &e) {
std::cout << "oneDNN error caught: " << std::endl
<< "\tStatus: " << dnnl_status2str(e.status) << std::endl
<< "\tMessage: " << e.what() << std::endl;
exit_code = 1;
} catch (std::string &e) {
std::cout << "Error in the example: " << e << "." << std::endl;
exit_code = 2;
}
std::cout << "Example " << (exit_code ? "failed" : "passed") << " on "
<< engine_kind2str_upper(engine_kind) << "." << std::endl;
return exit_code;
}
// [Main]
/// @page getting_started_cpp
///
/// <b></b>
///
/// Upon compiling and run the example the output should be just:
///
/// ~~~
/// Example passed.
/// ~~~
///
/// Users are encouraged to experiment with the code to familiarize themselves
/// with the concepts. In particular, one of the changes that might be of
/// interest is to spoil some of the library calls to check how error handling
/// happens. For instance, if we replace
///
/// ~~~cpp
/// relu.execute(engine_stream, {
/// {DNNL_ARG_SRC, src_mem},
/// {DNNL_ARG_DST, dst_mem},
/// });
/// ~~~
///
/// with
///
/// ~~~cpp
/// relu.execute(engine_stream, {
/// {DNNL_ARG_SRC, src_mem},
/// // {DNNL_ARG_DST, dst_mem}, // Oops, forgot about this one
/// });
/// ~~~
///
/// we should get the following output:
///
/// ~~~
/// oneDNN error caught:
/// Status: invalid_arguments
/// Message: could not execute a primitive
/// Example failed.
/// ~~~
| 43.869159 | 93 | 0.636983 | cfRod |
2895386a8a449851d627f38ddf3572df66c5f6ef | 5,006 | hpp | C++ | contracts/oaclib/varint.hpp | openaichain/openaichain | 14f144afa1bb4db5e4bf75a5ad836f4e408cfc95 | [
"MIT"
] | 15 | 2018-06-09T14:15:53.000Z | 2021-03-05T09:56:42.000Z | contracts/oaclib/varint.hpp | openaichain/openaichain | 14f144afa1bb4db5e4bf75a5ad836f4e408cfc95 | [
"MIT"
] | null | null | null | contracts/oaclib/varint.hpp | openaichain/openaichain | 14f144afa1bb4db5e4bf75a5ad836f4e408cfc95 | [
"MIT"
] | 2 | 2019-12-06T00:46:15.000Z | 2020-03-18T10:47:45.000Z | /**
* @file
* @copyright defined in oac/LICENSE.txt
*/
#pragma once
/**
* @defgroup varint Variable Length Integer
* @ingroup types
* @{
*/
struct unsigned_int {
unsigned_int( uint32_t v = 0 ):value(v){}
template<typename T>
unsigned_int( T v ):value(v){}
//operator uint32_t()const { return value; }
//operator uint64_t()const { return value; }
template<typename T>
operator T()const { return static_cast<T>(value); }
unsigned_int& operator=( uint32_t v ) { value = v; return *this; }
uint32_t value;
friend bool operator==( const unsigned_int& i, const uint32_t& v ) { return i.value == v; }
friend bool operator==( const uint32_t& i, const unsigned_int& v ) { return i == v.value; }
friend bool operator==( const unsigned_int& i, const unsigned_int& v ) { return i.value == v.value; }
friend bool operator!=( const unsigned_int& i, const uint32_t& v ) { return i.value != v; }
friend bool operator!=( const uint32_t& i, const unsigned_int& v ) { return i != v.value; }
friend bool operator!=( const unsigned_int& i, const unsigned_int& v ) { return i.value != v.value; }
friend bool operator<( const unsigned_int& i, const uint32_t& v ) { return i.value < v; }
friend bool operator<( const uint32_t& i, const unsigned_int& v ) { return i < v.value; }
friend bool operator<( const unsigned_int& i, const unsigned_int& v ) { return i.value < v.value; }
friend bool operator>=( const unsigned_int& i, const uint32_t& v ) { return i.value >= v; }
friend bool operator>=( const uint32_t& i, const unsigned_int& v ) { return i >= v.value; }
friend bool operator>=( const unsigned_int& i, const unsigned_int& v ) { return i.value >= v.value; }
template<typename DataStream>
friend DataStream& operator << ( DataStream& ds, const unsigned_int& v ){
uint64_t val = v.value;
do {
uint8_t b = uint8_t(val) & 0x7f;
val >>= 7;
b |= ((val > 0) << 7);
ds.write((char*)&b,1);//.put(b);
} while( val );
return ds;
}
template<typename DataStream>
friend DataStream& operator >> ( DataStream& ds, unsigned_int& vi ){
uint64_t v = 0; char b = 0; uint8_t by = 0;
do {
ds.get(b);
v |= uint32_t(uint8_t(b) & 0x7f) << by;
by += 7;
} while( uint8_t(b) & 0x80 );
vi.value = static_cast<uint32_t>(v);
return ds;
}
};
/**
* @brief serializes a 32 bit signed integer in as few bytes as possible
*
* Uses the google protobuf algorithm for seralizing signed numbers
*/
struct signed_int {
signed_int( int32_t v = 0 ):value(v){}
operator int32_t()const { return value; }
template<typename T>
signed_int& operator=( const T& v ) { value = v; return *this; }
signed_int operator++(int) { return value++; }
signed_int& operator++(){ ++value; return *this; }
int32_t value;
friend bool operator==( const signed_int& i, const int32_t& v ) { return i.value == v; }
friend bool operator==( const int32_t& i, const signed_int& v ) { return i == v.value; }
friend bool operator==( const signed_int& i, const signed_int& v ) { return i.value == v.value; }
friend bool operator!=( const signed_int& i, const int32_t& v ) { return i.value != v; }
friend bool operator!=( const int32_t& i, const signed_int& v ) { return i != v.value; }
friend bool operator!=( const signed_int& i, const signed_int& v ) { return i.value != v.value; }
friend bool operator<( const signed_int& i, const int32_t& v ) { return i.value < v; }
friend bool operator<( const int32_t& i, const signed_int& v ) { return i < v.value; }
friend bool operator<( const signed_int& i, const signed_int& v ) { return i.value < v.value; }
friend bool operator>=( const signed_int& i, const int32_t& v ) { return i.value >= v; }
friend bool operator>=( const int32_t& i, const signed_int& v ) { return i >= v.value; }
friend bool operator>=( const signed_int& i, const signed_int& v ) { return i.value >= v.value; }
template<typename DataStream>
friend DataStream& operator << ( DataStream& ds, const signed_int& v ){
uint32_t val = uint32_t((v.value<<1) ^ (v.value>>31));
do {
uint8_t b = uint8_t(val) & 0x7f;
val >>= 7;
b |= ((val > 0) << 7);
ds.write((char*)&b,1);//.put(b);
} while( val );
return ds;
}
template<typename DataStream>
friend DataStream& operator >> ( DataStream& ds, signed_int& vi ){
uint32_t v = 0; char b = 0; int by = 0;
do {
ds.get(b);
v |= uint32_t(uint8_t(b) & 0x7f) << by;
by += 7;
} while( uint8_t(b) & 0x80 );
vi.value = ((v>>1) ^ (v>>31)) + (v&0x01);
vi.value = v&0x01 ? vi.value : -vi.value;
vi.value = -vi.value;
return ds;
}
};
/// @}
| 38.507692 | 105 | 0.590691 | openaichain |
28998ce8db4464326726659d0da6945bc37c1115 | 10,440 | cpp | C++ | roxe.cdt/roxe_llvm/tools/clang/lib/CodeGen/CGLoopInfo.cpp | APFDev/actc | be5c1c0539d30a3745a725b0027767448ef8e1f6 | [
"MIT"
] | 427 | 2018-05-29T14:21:02.000Z | 2022-03-16T03:17:54.000Z | roxe.cdt/roxe_llvm/tools/clang/lib/CodeGen/CGLoopInfo.cpp | APFDev/actc | be5c1c0539d30a3745a725b0027767448ef8e1f6 | [
"MIT"
] | 25 | 2018-07-23T08:34:15.000Z | 2021-11-05T07:13:36.000Z | roxe.cdt/roxe_llvm/tools/clang/lib/CodeGen/CGLoopInfo.cpp | APFDev/actc | be5c1c0539d30a3745a725b0027767448ef8e1f6 | [
"MIT"
] | 52 | 2018-07-19T19:57:32.000Z | 2022-03-11T16:05:38.000Z | //===---- CGLoopInfo.cpp - LLVM CodeGen for loop metadata -*- C++ -*-------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "CGLoopInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Attr.h"
#include "clang/Sema/LoopHint.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Metadata.h"
using namespace clang::CodeGen;
using namespace llvm;
static MDNode *createMetadata(LLVMContext &Ctx, const LoopAttributes &Attrs,
const llvm::DebugLoc &StartLoc,
const llvm::DebugLoc &EndLoc) {
if (!Attrs.IsParallel && Attrs.VectorizeWidth == 0 &&
Attrs.InterleaveCount == 0 && Attrs.UnrollCount == 0 &&
Attrs.VectorizeEnable == LoopAttributes::Unspecified &&
Attrs.UnrollEnable == LoopAttributes::Unspecified &&
Attrs.DistributeEnable == LoopAttributes::Unspecified &&
!StartLoc && !EndLoc)
return nullptr;
SmallVector<Metadata *, 4> Args;
// Reserve operand 0 for loop id self reference.
auto TempNode = MDNode::getTemporary(Ctx, None);
Args.push_back(TempNode.get());
// If we have a valid start debug location for the loop, add it.
if (StartLoc) {
Args.push_back(StartLoc.getAsMDNode());
// If we also have a valid end debug location for the loop, add it.
if (EndLoc)
Args.push_back(EndLoc.getAsMDNode());
}
// Setting vectorize.width
if (Attrs.VectorizeWidth > 0) {
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.vectorize.width"),
ConstantAsMetadata::get(ConstantInt::get(
Type::getInt32Ty(Ctx), Attrs.VectorizeWidth))};
Args.push_back(MDNode::get(Ctx, Vals));
}
// Setting interleave.count
if (Attrs.InterleaveCount > 0) {
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.interleave.count"),
ConstantAsMetadata::get(ConstantInt::get(
Type::getInt32Ty(Ctx), Attrs.InterleaveCount))};
Args.push_back(MDNode::get(Ctx, Vals));
}
// Setting interleave.count
if (Attrs.UnrollCount > 0) {
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.unroll.count"),
ConstantAsMetadata::get(ConstantInt::get(
Type::getInt32Ty(Ctx), Attrs.UnrollCount))};
Args.push_back(MDNode::get(Ctx, Vals));
}
// Setting vectorize.enable
if (Attrs.VectorizeEnable != LoopAttributes::Unspecified) {
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.vectorize.enable"),
ConstantAsMetadata::get(ConstantInt::get(
Type::getInt1Ty(Ctx), (Attrs.VectorizeEnable ==
LoopAttributes::Enable)))};
Args.push_back(MDNode::get(Ctx, Vals));
}
// Setting unroll.full or unroll.disable
if (Attrs.UnrollEnable != LoopAttributes::Unspecified) {
std::string Name;
if (Attrs.UnrollEnable == LoopAttributes::Enable)
Name = "llvm.loop.unroll.enable";
else if (Attrs.UnrollEnable == LoopAttributes::Full)
Name = "llvm.loop.unroll.full";
else
Name = "llvm.loop.unroll.disable";
Metadata *Vals[] = {MDString::get(Ctx, Name)};
Args.push_back(MDNode::get(Ctx, Vals));
}
if (Attrs.DistributeEnable != LoopAttributes::Unspecified) {
Metadata *Vals[] = {MDString::get(Ctx, "llvm.loop.distribute.enable"),
ConstantAsMetadata::get(ConstantInt::get(
Type::getInt1Ty(Ctx), (Attrs.DistributeEnable ==
LoopAttributes::Enable)))};
Args.push_back(MDNode::get(Ctx, Vals));
}
// Set the first operand to itself.
MDNode *LoopID = MDNode::get(Ctx, Args);
LoopID->replaceOperandWith(0, LoopID);
return LoopID;
}
LoopAttributes::LoopAttributes(bool IsParallel)
: IsParallel(IsParallel), VectorizeEnable(LoopAttributes::Unspecified),
UnrollEnable(LoopAttributes::Unspecified), VectorizeWidth(0),
InterleaveCount(0), UnrollCount(0),
DistributeEnable(LoopAttributes::Unspecified) {}
void LoopAttributes::clear() {
IsParallel = false;
VectorizeWidth = 0;
InterleaveCount = 0;
UnrollCount = 0;
VectorizeEnable = LoopAttributes::Unspecified;
UnrollEnable = LoopAttributes::Unspecified;
DistributeEnable = LoopAttributes::Unspecified;
}
LoopInfo::LoopInfo(BasicBlock *Header, const LoopAttributes &Attrs,
const llvm::DebugLoc &StartLoc, const llvm::DebugLoc &EndLoc)
: LoopID(nullptr), Header(Header), Attrs(Attrs) {
LoopID = createMetadata(Header->getContext(), Attrs, StartLoc, EndLoc);
}
void LoopInfoStack::push(BasicBlock *Header, const llvm::DebugLoc &StartLoc,
const llvm::DebugLoc &EndLoc) {
Active.push_back(LoopInfo(Header, StagedAttrs, StartLoc, EndLoc));
// Clear the attributes so nested loops do not inherit them.
StagedAttrs.clear();
}
void LoopInfoStack::push(BasicBlock *Header, clang::ASTContext &Ctx,
ArrayRef<const clang::Attr *> Attrs,
const llvm::DebugLoc &StartLoc,
const llvm::DebugLoc &EndLoc) {
// Identify loop hint attributes from Attrs.
for (const auto *Attr : Attrs) {
const LoopHintAttr *LH = dyn_cast<LoopHintAttr>(Attr);
const OpenCLUnrollHintAttr *OpenCLHint =
dyn_cast<OpenCLUnrollHintAttr>(Attr);
// Skip non loop hint attributes
if (!LH && !OpenCLHint) {
continue;
}
LoopHintAttr::OptionType Option = LoopHintAttr::Unroll;
LoopHintAttr::LoopHintState State = LoopHintAttr::Disable;
unsigned ValueInt = 1;
// Translate opencl_unroll_hint attribute argument to
// equivalent LoopHintAttr enums.
// OpenCL v2.0 s6.11.5:
// 0 - full unroll (no argument).
// 1 - disable unroll.
// other positive integer n - unroll by n.
if (OpenCLHint) {
ValueInt = OpenCLHint->getUnrollHint();
if (ValueInt == 0) {
State = LoopHintAttr::Full;
} else if (ValueInt != 1) {
Option = LoopHintAttr::UnrollCount;
State = LoopHintAttr::Numeric;
}
} else if (LH) {
auto *ValueExpr = LH->getValue();
if (ValueExpr) {
llvm::APSInt ValueAPS = ValueExpr->EvaluateKnownConstInt(Ctx);
ValueInt = ValueAPS.getSExtValue();
}
Option = LH->getOption();
State = LH->getState();
}
switch (State) {
case LoopHintAttr::Disable:
switch (Option) {
case LoopHintAttr::Vectorize:
// Disable vectorization by specifying a width of 1.
setVectorizeWidth(1);
break;
case LoopHintAttr::Interleave:
// Disable interleaving by speciyfing a count of 1.
setInterleaveCount(1);
break;
case LoopHintAttr::Unroll:
setUnrollState(LoopAttributes::Disable);
break;
case LoopHintAttr::Distribute:
setDistributeState(false);
break;
case LoopHintAttr::UnrollCount:
case LoopHintAttr::VectorizeWidth:
case LoopHintAttr::InterleaveCount:
llvm_unreachable("Options cannot be disabled.");
break;
}
break;
case LoopHintAttr::Enable:
switch (Option) {
case LoopHintAttr::Vectorize:
case LoopHintAttr::Interleave:
setVectorizeEnable(true);
break;
case LoopHintAttr::Unroll:
setUnrollState(LoopAttributes::Enable);
break;
case LoopHintAttr::Distribute:
setDistributeState(true);
break;
case LoopHintAttr::UnrollCount:
case LoopHintAttr::VectorizeWidth:
case LoopHintAttr::InterleaveCount:
llvm_unreachable("Options cannot enabled.");
break;
}
break;
case LoopHintAttr::AssumeSafety:
switch (Option) {
case LoopHintAttr::Vectorize:
case LoopHintAttr::Interleave:
// Apply "llvm.mem.parallel_loop_access" metadata to load/stores.
setParallel(true);
setVectorizeEnable(true);
break;
case LoopHintAttr::Unroll:
case LoopHintAttr::UnrollCount:
case LoopHintAttr::VectorizeWidth:
case LoopHintAttr::InterleaveCount:
case LoopHintAttr::Distribute:
llvm_unreachable("Options cannot be used to assume mem safety.");
break;
}
break;
case LoopHintAttr::Full:
switch (Option) {
case LoopHintAttr::Unroll:
setUnrollState(LoopAttributes::Full);
break;
case LoopHintAttr::Vectorize:
case LoopHintAttr::Interleave:
case LoopHintAttr::UnrollCount:
case LoopHintAttr::VectorizeWidth:
case LoopHintAttr::InterleaveCount:
case LoopHintAttr::Distribute:
llvm_unreachable("Options cannot be used with 'full' hint.");
break;
}
break;
case LoopHintAttr::Numeric:
switch (Option) {
case LoopHintAttr::VectorizeWidth:
setVectorizeWidth(ValueInt);
break;
case LoopHintAttr::InterleaveCount:
setInterleaveCount(ValueInt);
break;
case LoopHintAttr::UnrollCount:
setUnrollCount(ValueInt);
break;
case LoopHintAttr::Unroll:
case LoopHintAttr::Vectorize:
case LoopHintAttr::Interleave:
case LoopHintAttr::Distribute:
llvm_unreachable("Options cannot be assigned a value.");
break;
}
break;
}
}
/// Stage the attributes.
push(Header, StartLoc, EndLoc);
}
void LoopInfoStack::pop() {
assert(!Active.empty() && "No active loops to pop");
Active.pop_back();
}
void LoopInfoStack::InsertHelper(Instruction *I) const {
if (!hasInfo())
return;
const LoopInfo &L = getInfo();
if (!L.getLoopID())
return;
if (TerminatorInst *TI = dyn_cast<TerminatorInst>(I)) {
for (unsigned i = 0, ie = TI->getNumSuccessors(); i < ie; ++i)
if (TI->getSuccessor(i) == L.getHeader()) {
TI->setMetadata(llvm::LLVMContext::MD_loop, L.getLoopID());
break;
}
return;
}
if (L.getAttributes().IsParallel && I->mayReadOrWriteMemory())
I->setMetadata("llvm.mem.parallel_loop_access", L.getLoopID());
}
| 34.117647 | 80 | 0.629215 | APFDev |
2899bb4e89da513fc76519576a0779debb6dcba9 | 1,346 | cpp | C++ | CnprNSPDistribution.cpp | mhoopmann/NeoProtXMLParser | f34b71cfb6bd2a366f405891bd68661d399d944d | [
"Apache-2.0"
] | null | null | null | CnprNSPDistribution.cpp | mhoopmann/NeoProtXMLParser | f34b71cfb6bd2a366f405891bd68661d399d944d | [
"Apache-2.0"
] | null | null | null | CnprNSPDistribution.cpp | mhoopmann/NeoProtXMLParser | f34b71cfb6bd2a366f405891bd68661d399d944d | [
"Apache-2.0"
] | null | null | null | #include "CnprNSPDistribution.h"
using namespace std;
CnprNSPDistribution::CnprNSPDistribution(){
bin_no=-1;
nsp_lower_bound_incl=-1;
nsp_lower_bound_excl=-1;
pos_freq=-1;
neg_freq=-1;
pos_to_neg_ratio=-1;
alt_pos_to_neg_ratio=-1;
}
void CnprNSPDistribution::write(FILE* f, int tabs){
//required
string el = "nsp_distribution";
if (bin_no<0) NPRerrMsg(el, "bin_no");
if (pos_freq<0) NPRerrMsg(el, "pos_freq");
if (neg_freq<0) NPRerrMsg(el, "neg_freq");
if (pos_to_neg_ratio<0) NPRerrMsg(el, "pos_to_neg_ratio");
NPRprintTabs(f, tabs);
fprintf(f, "<nsp_distribution");
fprintf(f, " bin_no=\"%d\"", bin_no);
if (nsp_lower_bound_incl>-1) fprintf(f, " nsp_lower_bound_incl=\"%.2lf\"", nsp_lower_bound_incl);
if (!nsp_upper_bound_excl.empty()) fprintf(f, " nsp_upper_bound_excl=\"%s\"", nsp_upper_bound_excl.c_str());
if (nsp_lower_bound_excl>-1) fprintf(f, " nsp_lower_bound_excl=\"%.2lf\"", nsp_lower_bound_excl);
if (!nsp_upper_bound_incl.empty()) fprintf(f, " nsp_upper_bound_incl=\"%s\"", nsp_upper_bound_incl.c_str());
fprintf(f, " pos_freq=\"%.2lf\"", pos_freq);
fprintf(f, " neg_freq=\"%.2lf\"", neg_freq);
fprintf(f, " pos_to_neg_ratio=\"%.2lf\"", pos_to_neg_ratio);
if (alt_pos_to_neg_ratio>-1) fprintf(f, " alt_pos_to_neg_ratio=\"%.2lf\"", alt_pos_to_neg_ratio);
fprintf(f, "/>\n");
}
| 36.378378 | 110 | 0.700594 | mhoopmann |
80bec6dd355213fec861d7034756ea4444e505e3 | 179 | cc | C++ | main.cc | jeffersonsylva/deltaforce | b79743b6f8b24436d663982915438fa115b025a9 | [
"Apache-2.0"
] | null | null | null | main.cc | jeffersonsylva/deltaforce | b79743b6f8b24436d663982915438fa115b025a9 | [
"Apache-2.0"
] | null | null | null | main.cc | jeffersonsylva/deltaforce | b79743b6f8b24436d663982915438fa115b025a9 | [
"Apache-2.0"
] | null | null | null | #include "Allegro.h"
int main()
{
Allegro *allegro = new Allegro();
allegro->init();
allegro->createWindow(60.0, 640, 480);
allegro->gameLoop();
return 0;
}
| 12.785714 | 41 | 0.597765 | jeffersonsylva |
80bf2c050afd9ca59178a60ef7d542619da13af2 | 5,637 | cpp | C++ | target/TestEnclave/Enclave/Edger8rSyntax/Pointers.cpp | kandeldipak06/CacheZoom | dd8cb2796cf2ee632a0c60e7f443c83b61976973 | [
"MIT"
] | 13 | 2017-07-07T02:48:57.000Z | 2021-12-09T06:32:47.000Z | target/TestEnclave/Enclave/Edger8rSyntax/Pointers.cpp | ksutcr18/CacheZoom | 510848da73e1728663e094cb7bb8cf5b349eb0b0 | [
"MIT"
] | null | null | null | target/TestEnclave/Enclave/Edger8rSyntax/Pointers.cpp | ksutcr18/CacheZoom | 510848da73e1728663e094cb7bb8cf5b349eb0b0 | [
"MIT"
] | 6 | 2017-10-15T19:23:15.000Z | 2022-01-27T08:33:41.000Z | /*
* Copyright (C) 2011-2016 Intel Corporation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Intel Corporation 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.
*
*/
/* Test Pointer Auttributes */
#include <sys/types.h>
#include <string.h>
#include "sgx_trts.h"
#include "../Enclave.h"
#include "Enclave_t.h"
/* checksum_internal:
* get simple checksum of input buffer and length
*/
int32_t checksum_internal(char *buf, size_t count)
{
register int32_t sum = 0;
int16_t *ptr = (int16_t *)buf;
/* Main summing loop */
while(count > 1) {
sum = sum + *ptr++;
count = count - 2;
}
/* Add left-over byte, if any */
if (count > 0)
sum = sum + *((char *)ptr);
return ~sum;
}
/* ecall_pointer_user_check, ecall_pointer_in, ecall_pointer_out, ecall_pointer_in_out:
* The root ECALLs to test [in], [out], [user_check] attributes.
*/
size_t ecall_pointer_user_check(void *val, size_t sz)
{
/* check if the buffer is allocated outside */
if (sgx_is_outside_enclave(val, sz) != 1)
abort();
char tmp[100] = {0};
size_t len = sz>100?100:sz;
/* copy the memory into the enclave to make sure 'val'
* is not being changed in checksum_internal() */
memcpy(tmp, val, len);
int32_t sum = checksum_internal((char *)tmp, len);
/* modify outside memory directly */
memcpy(val, "SGX_SUCCESS", len>12?12:len);
return len;
}
/* ecall_pointer_in:
* the buffer of val is copied to the enclave.
*/
void ecall_pointer_in(int *val)
{
if (sgx_is_within_enclave(val, sizeof(int)) != 1)
abort();
*val = 1234;
}
/* ecall_pointer_out:
* the buffer of val is copied to the untrusted side.
*/
void ecall_pointer_out(int *val)
{
if (sgx_is_within_enclave(val, sizeof(int)) != 1)
abort();
assert(*val == 0);
*val = 1234;
}
/* ecall_pointer_in_out:
* the buffer of val is double-copied.
*/
void ecall_pointer_in_out(int *val)
{
if (sgx_is_within_enclave(val, sizeof(int)) != 1)
abort();
*val = 1234;
}
/* ocall_pointer_attr:
* The root ECALL that test OCALL [in], [out], [user_check].
*/
void ocall_pointer_attr(void)
{
sgx_status_t ret = SGX_ERROR_UNEXPECTED;
int val = 0;
ret = ocall_pointer_user_check(&val);
if (ret != SGX_SUCCESS)
abort();
val = 0;
ret = ocall_pointer_in(&val);
if (ret != SGX_SUCCESS)
abort();
assert(val == 0);
val = 0;
ret = ocall_pointer_out(&val);
if (ret != SGX_SUCCESS)
abort();
assert(val == 1234);
val = 0;
ret = ocall_pointer_in_out(&val);
if (ret != SGX_SUCCESS)
abort();
assert(val == 1234);
return;
}
/* ecall_pointer_string:
* [string] defines a string.
*/
void ecall_pointer_string(char *str)
{
strncpy(str, "0987654321", strlen(str));
}
/* ecall_pointer_string_const:
* const [string] defines a string that cannot be modified.
*/
void ecall_pointer_string_const(const char *str)
{
char* temp = new char[strlen(str)];
strncpy(temp, str, strlen(str));
delete []temp;
}
/* ecall_pointer_size:
* 'len' needs to be specified to tell Edger8r the length of 'str'.
*/
void ecall_pointer_size(void *ptr, size_t len)
{
strncpy((char*)ptr, "0987654321", len);
}
/* ecall_pointer_count:
* 'cnt' needs to be specified to tell Edger8r the number of elements in 'arr'.
*/
void ecall_pointer_count(int *arr, int cnt)
{
for (int i = (cnt - 1); i >= 0; i--)
arr[i] = (cnt - 1 - i);
}
/* ecall_pointer_isptr_readonly:
* 'buf' is user defined type, shall be tagged with [isptr].
* if it's not writable, [readonly] shall be specified.
*/
void ecall_pointer_isptr_readonly(buffer_t buf, size_t len)
{
strncpy((char*)buf, "0987654321", len);
}
/* get_buffer_len:
* get the length of input buffer 'buf'.
*/
size_t get_buffer_len(const char* buf)
{
(void)buf;
return 10*sizeof(int);
}
/* ecall_pointer_sizefunc:
* call get_buffer_len to determin the length of 'buf'.
*/
void ecall_pointer_sizefunc(char *buf)
{
int *tmp = (int*)buf;
for (int i = 0; i < 10; i++) {
assert(tmp[i] == 0);
tmp[i] = i;
}
}
| 26.097222 | 87 | 0.660635 | kandeldipak06 |
80c0142ad95d3f1e63653864dfae4883ff624e9f | 2,764 | inl | C++ | opencl/test/unit_test/api/cl_enqueue_verify_memory.inl | demarle/compute-runtime | 12458fb183d651f74873ebe835b10fc4a3e3a614 | [
"MIT"
] | null | null | null | opencl/test/unit_test/api/cl_enqueue_verify_memory.inl | demarle/compute-runtime | 12458fb183d651f74873ebe835b10fc4a3e3a614 | [
"MIT"
] | null | null | null | opencl/test/unit_test/api/cl_enqueue_verify_memory.inl | demarle/compute-runtime | 12458fb183d651f74873ebe835b10fc4a3e3a614 | [
"MIT"
] | null | null | null | /*
* Copyright (C) 2017-2020 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/aub_mem_dump/aub_services.h"
#include "opencl/extensions/public/cl_ext_private.h"
#include "opencl/test/unit_test/api/cl_api_tests.h"
#include "opencl/test/unit_test/mocks/mock_csr.h"
#include "test.h"
using namespace NEO;
TEST(CheckVerifyMemoryRelatedApiConstants, givenVerifyMemoryRelatedApiConstantsWhenVerifyingTheirValueThenCorrectValuesAreReturned) {
EXPECT_EQ(AubMemDump::CmdServicesMemTraceMemoryCompare::CompareOperationValues::CompareEqual, CL_MEM_COMPARE_EQUAL);
EXPECT_EQ(AubMemDump::CmdServicesMemTraceMemoryCompare::CompareOperationValues::CompareNotEqual, CL_MEM_COMPARE_NOT_EQUAL);
}
struct clEnqueueVerifyMemoryINTELSettings {
const cl_uint comparisonMode = CL_MEM_COMPARE_EQUAL;
const size_t bufferSize = 1;
static constexpr size_t expectedSize = 1;
int expected[expectedSize]{};
void *gpuAddress = expected;
};
class clEnqueueVerifyMemoryINTELTests : public api_tests,
public clEnqueueVerifyMemoryINTELSettings {
};
TEST_F(clEnqueueVerifyMemoryINTELTests, givenSizeOfComparisonEqualZeroWhenCallingVerifyMemoryThenErrorIsReturned) {
cl_int retval = clEnqueueVerifyMemoryINTEL(nullptr, nullptr, nullptr, 0, comparisonMode);
EXPECT_EQ(CL_INVALID_VALUE, retval);
}
TEST_F(clEnqueueVerifyMemoryINTELTests, givenNullExpectedDataWhenCallingVerifyMemoryThenErrorIsReturned) {
cl_int retval = clEnqueueVerifyMemoryINTEL(nullptr, nullptr, nullptr, expectedSize, comparisonMode);
EXPECT_EQ(CL_INVALID_VALUE, retval);
}
TEST_F(clEnqueueVerifyMemoryINTELTests, givenInvalidAllocationPointerWhenCallingVerifyMemoryThenErrorIsReturned) {
cl_int retval = clEnqueueVerifyMemoryINTEL(nullptr, nullptr, expected, expectedSize, comparisonMode);
EXPECT_EQ(CL_INVALID_VALUE, retval);
}
TEST_F(clEnqueueVerifyMemoryINTELTests, givenInvalidCommandQueueWhenCallingVerifyMemoryThenErrorIsReturned) {
cl_int retval = clEnqueueVerifyMemoryINTEL(nullptr, gpuAddress, expected, expectedSize, comparisonMode);
EXPECT_EQ(CL_INVALID_COMMAND_QUEUE, retval);
}
TEST_F(clEnqueueVerifyMemoryINTELTests, givenEqualMemoryWhenCallingVerifyMemoryThenSuccessIsReturned) {
cl_int retval = clEnqueueVerifyMemoryINTEL(pCommandQueue, gpuAddress, expected, expectedSize, comparisonMode);
EXPECT_EQ(CL_SUCCESS, retval);
}
TEST_F(clEnqueueVerifyMemoryINTELTests, givenNotEqualMemoryWhenCallingVerifyMemoryThenInvalidValueErrorIsReturned) {
int differentMemory = expected[0] + 1;
cl_int retval = clEnqueueVerifyMemoryINTEL(pCommandQueue, gpuAddress, &differentMemory, sizeof(differentMemory), comparisonMode);
EXPECT_EQ(CL_INVALID_VALUE, retval);
}
| 43.1875 | 133 | 0.818379 | demarle |
80c2525c7ccfe4737eedeeea3d6f477f7f2e864f | 16,281 | hpp | C++ | include/System/Net/Sockets/Socket_--c.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | include/System/Net/Sockets/Socket_--c.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | include/System/Net/Sockets/Socket_--c.hpp | marksteward/BeatSaber-Quest-Codegen | a76f063f71cef207a9f048ad7613835f554911a7 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
#include "extern/beatsaber-hook/shared/utils/byref.hpp"
// Including type: System.Net.Sockets.Socket
#include "System/Net/Sockets/Socket.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: System
namespace System {
// Forward declaring type: IOAsyncCallback
class IOAsyncCallback;
// Forward declaring type: IOAsyncResult
class IOAsyncResult;
// Forward declaring type: IAsyncResult
class IAsyncResult;
}
// Completed forward declares
// Type namespace: System.Net.Sockets
namespace System::Net::Sockets {
// Size: 0x10
#pragma pack(push, 1)
// Autogenerated type: System.Net.Sockets.Socket/System.Net.Sockets.<>c
// [TokenAttribute] Offset: FFFFFFFF
// [CompilerGeneratedAttribute] Offset: FFFFFFFF
class Socket::$$c : public ::Il2CppObject {
public:
// Creating value type constructor for type: $$c
$$c() noexcept {}
// Get static field: static public readonly System.Net.Sockets.Socket/System.Net.Sockets.<>c <>9
static System::Net::Sockets::Socket::$$c* _get_$$9();
// Set static field: static public readonly System.Net.Sockets.Socket/System.Net.Sockets.<>c <>9
static void _set_$$9(System::Net::Sockets::Socket::$$c* value);
// Get static field: static public System.IOAsyncCallback <>9__241_0
static System::IOAsyncCallback* _get_$$9__241_0();
// Set static field: static public System.IOAsyncCallback <>9__241_0
static void _set_$$9__241_0(System::IOAsyncCallback* value);
// static private System.Void .cctor()
// Offset: 0x128D464
static void _cctor();
// System.Void <BeginSend>b__241_0(System.IOAsyncResult s)
// Offset: 0x128D4D0
void $BeginSend$b__241_0(System::IOAsyncResult* s);
// System.Void <.cctor>b__309_0(System.IAsyncResult ares)
// Offset: 0x128D568
void $_cctor$b__309_0(System::IAsyncResult* ares);
// System.Void <.cctor>b__309_1(System.IOAsyncResult ares)
// Offset: 0x128D820
void $_cctor$b__309_1(System::IOAsyncResult* ares);
// System.Void <.cctor>b__309_2(System.IOAsyncResult ares)
// Offset: 0x128D968
void $_cctor$b__309_2(System::IOAsyncResult* ares);
// System.Void <.cctor>b__309_3(System.IAsyncResult ares)
// Offset: 0x128DC08
void $_cctor$b__309_3(System::IAsyncResult* ares);
// System.Void <.cctor>b__309_4(System.IOAsyncResult ares)
// Offset: 0x128DE50
void $_cctor$b__309_4(System::IOAsyncResult* ares);
// System.Void <.cctor>b__309_5(System.IAsyncResult ares)
// Offset: 0x128E2D0
void $_cctor$b__309_5(System::IAsyncResult* ares);
// System.Void <.cctor>b__309_6(System.IOAsyncResult ares)
// Offset: 0x128E518
void $_cctor$b__309_6(System::IOAsyncResult* ares);
// System.Void <.cctor>b__309_7(System.IAsyncResult ares)
// Offset: 0x128E624
void $_cctor$b__309_7(System::IAsyncResult* ares);
// System.Void <.cctor>b__309_8(System.IOAsyncResult ares)
// Offset: 0x128E874
void $_cctor$b__309_8(System::IOAsyncResult* ares);
// System.Void <.cctor>b__309_9(System.IOAsyncResult ares)
// Offset: 0x128EA4C
void $_cctor$b__309_9(System::IOAsyncResult* ares);
// System.Void <.cctor>b__309_10(System.IAsyncResult ares)
// Offset: 0x128EB64
void $_cctor$b__309_10(System::IAsyncResult* ares);
// System.Void <.cctor>b__309_11(System.IOAsyncResult ares)
// Offset: 0x128EDB8
void $_cctor$b__309_11(System::IOAsyncResult* ares);
// System.Void <.cctor>b__309_12(System.IAsyncResult ares)
// Offset: 0x128EF94
void $_cctor$b__309_12(System::IAsyncResult* ares);
// System.Void <.cctor>b__309_13(System.IOAsyncResult ares)
// Offset: 0x128F1E4
void $_cctor$b__309_13(System::IOAsyncResult* ares);
// System.Void <.cctor>b__309_14(System.IAsyncResult ares)
// Offset: 0x128F2FC
void $_cctor$b__309_14(System::IAsyncResult* ares);
// public System.Void .ctor()
// Offset: 0x128D4C8
// Implemented from: System.Object
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static Socket::$$c* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("System::Net::Sockets::Socket::$$c::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<Socket::$$c*, creationType>()));
}
}; // System.Net.Sockets.Socket/System.Net.Sockets.<>c
#pragma pack(pop)
}
DEFINE_IL2CPP_ARG_TYPE(System::Net::Sockets::Socket::$$c*, "System.Net.Sockets", "Socket/<>c");
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::_cctor
// Il2CppName: .cctor
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (*)()>(&System::Net::Sockets::Socket::$$c::_cctor)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), ".cctor", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$BeginSend$b__241_0
// Il2CppName: <BeginSend>b__241_0
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$BeginSend$b__241_0)> {
static const MethodInfo* get() {
static auto* s = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<BeginSend>b__241_0", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{s});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_0
// Il2CppName: <.cctor>b__309_0
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_0)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_0", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_1
// Il2CppName: <.cctor>b__309_1
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_1)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_1", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_2
// Il2CppName: <.cctor>b__309_2
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_2)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_2", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_3
// Il2CppName: <.cctor>b__309_3
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_3)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_3", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_4
// Il2CppName: <.cctor>b__309_4
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_4)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_4", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_5
// Il2CppName: <.cctor>b__309_5
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_5)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_5", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_6
// Il2CppName: <.cctor>b__309_6
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_6)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_6", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_7
// Il2CppName: <.cctor>b__309_7
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_7)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_7", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_8
// Il2CppName: <.cctor>b__309_8
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_8)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_8", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_9
// Il2CppName: <.cctor>b__309_9
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_9)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_9", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_10
// Il2CppName: <.cctor>b__309_10
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_10)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_10", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_11
// Il2CppName: <.cctor>b__309_11
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_11)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_11", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_12
// Il2CppName: <.cctor>b__309_12
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_12)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_12", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_13
// Il2CppName: <.cctor>b__309_13
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IOAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_13)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IOAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_13", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::$_cctor$b__309_14
// Il2CppName: <.cctor>b__309_14
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (System::Net::Sockets::Socket::$$c::*)(System::IAsyncResult*)>(&System::Net::Sockets::Socket::$$c::$_cctor$b__309_14)> {
static const MethodInfo* get() {
static auto* ares = &::il2cpp_utils::GetClassFromName("System", "IAsyncResult")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(System::Net::Sockets::Socket::$$c*), "<.cctor>b__309_14", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{ares});
}
};
// Writing MetadataGetter for method: System::Net::Sockets::Socket::$$c::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
| 61.206767 | 198 | 0.697684 | marksteward |
80c31544389e2cfaff807ed3037a2bcf0f4907d1 | 10,828 | cc | C++ | crp_test.cc | redpony/cpyp | 7ecb1801af3636f9d5ae008799ae412d476153e2 | [
"Apache-2.0"
] | 29 | 2015-01-21T07:18:16.000Z | 2021-06-10T00:57:54.000Z | crp_test.cc | redpony/cpyp | 7ecb1801af3636f9d5ae008799ae412d476153e2 | [
"Apache-2.0"
] | null | null | null | crp_test.cc | redpony/cpyp | 7ecb1801af3636f9d5ae008799ae412d476153e2 | [
"Apache-2.0"
] | 8 | 2015-02-25T06:02:46.000Z | 2021-06-10T00:57:38.000Z | #include <iostream>
#include <vector>
#include <cassert>
#include <string>
#include "cpyp/crp.h"
#include "cpyp/mf_crp.h"
#include "cpyp/random.h"
using namespace std;
static const double p0[] = { 0.1, 0.2, 0.7 }; // actual base distribution
static const double q0[] = { 0.5, 0.4, 0.1 }; // proposal base distribution
// log likelihood of a CRP including draws from a static base distribution p0
double llh(const cpyp::crp<int>& crp, const double* pp0) {
double l = crp.log_likelihood();
for (int i = 0; i < 3; ++i)
l += crp.num_tables(i) * log(pp0[i]);
return l;
}
void test_mh1() {
cpyp::MT19937 eng;
const vector<double> ref = {0, 0, 0, 0.00466121, 0.0233846, 0.0647365, 0.125693, 0.183448, 0.204806, 0.177036, 0.119629, 0.0627523, 0.02507, 0.00725451, 0.0013911};
cpyp::crp<int> crp(0.5, 1.0);
vector<int> hist(15, 0);
double c = 0;
double ac = 0;
double tmh = 0;
for (int s = 0; s < 200000; ++s) {
for (int i = 0; i < 15; ++i) {
int y_i = i % 3;
cpyp::crp<int> prev = crp; // save old state
bool wasrem = false;
if (s > 0)
wasrem = crp.decrement(y_i, eng);
bool wasnew = crp.increment(y_i, q0[y_i], eng);
if (s > 0) {
double p_new = 1, q_new = 1;
if (wasnew) { p_new = p0[y_i]; q_new = q0[y_i]; }
double p_old = 1, q_old = 1;
if (wasrem) { p_old = p0[y_i]; q_old = q0[y_i]; }
double a = p_new / p_old * q_old / q_new;
++tmh;
if (a >= 1.0 || cpyp::sample_uniform01<double>(eng) < a) { // mh accept
++ac;
} else { // mh reject
std::swap(crp, prev); // swap is faster than =
}
}
}
if (s > 300 && s % 4 == 3) { ++c; hist[crp.num_tables()]++; }
}
ac /= tmh;
cerr << "ACCEPTANCE: " << ac << endl;
int j =0;
double te = 0;
double me = 0;
for (auto i : hist) {
double err = (i / c - ref[j++]);
cerr << err << "\t" << i/c << endl;
te += fabs(err);
if (fabs(err) > me) { me = fabs(err); }
}
te /= 12;
cerr << "Average error: " << te;
if (te > 0.01) { cerr << " ** TOO HIGH **"; }
cerr << endl << " Max error: " << me;
if (me > 0.01) { cerr << " ** TOO HIGH **"; }
cerr << endl;
}
// same model as test_mh1, same proposal, different way of computing
// p's and q's
void test_mh1a() {
cpyp::MT19937 eng;
const vector<double> ref = {0, 0, 0, 0.00466121, 0.0233846, 0.0647365, 0.125693, 0.183448, 0.204806, 0.177036, 0.119629, 0.0627523, 0.02507, 0.00725451, 0.0013911};
cpyp::crp<int> crp(0.5, 1.0);
vector<int> hist(15, 0);
double c = 0;
double ac = 0;
double tmh = 0;
for (int s = 0; s < 200000; ++s) {
for (int i = 0; i < 15; ++i) {
int y_i = i % 3;
cpyp::crp<int> prev = crp; // save old state
double lq_old = 0;
double lp_old = llh(crp, p0);
if (s > 0) crp.decrement(y_i, eng, &lq_old);
double lq_new = 0;
crp.increment_no_base(y_i, eng, &lq_new);
if (s > 0) {
double lp_new = llh(crp, p0);
double a = exp(lp_new - lp_old + lq_old - lq_new);
++tmh;
if (a >= 1.0 || cpyp::sample_uniform01<double>(eng) < a) { // mh accept
++ac;
} else { // mh reject
std::swap(crp, prev); // swap is faster than =
}
}
}
if (s > 300 && s % 4 == 3) { ++c; hist[crp.num_tables()]++; }
}
ac /= tmh;
cerr << "ACCEPTANCE: " << ac << endl;
int j =0;
double te = 0;
double me = 0;
for (auto i : hist) {
double err = (i / c - ref[j++]);
cerr << err << "\t" << i/c << endl;
te += fabs(err);
if (fabs(err) > me) { me = fabs(err); }
}
te /= 12;
cerr << "Average error: " << te;
if (te > 0.01) { cerr << " ** TOO HIGH **"; }
cerr << endl << " Max error: " << me;
if (me > 0.01) { cerr << " ** TOO HIGH **"; }
cerr << endl;
}
static const double p0_a[] = { 0.1, 0.2, 0.7 }; // actual base distribution
static const double p0_b[] = { 0.6, 0.3, 0.1 }; // actual base of d2
static const double q0_a[] = { 0.05, 0.1, 0.35 }; // estimated base distribution
static const double q0_b[] = { 0.3, 0.15, 0.05 }; // estimated base of d2
void test_mh2() {
cpyp::MT19937 eng;
cpyp::crp<int> a(0.5, 1.0);
cpyp::crp<int> b(0.5, 1.0);
vector<int> hist_a(16, 0);
vector<int> hist_b(16, 0);
vector<double> ref_a = {3.70004e-06, 0.0144611, 0.0614236, 0.138702, 0.211308, 0.231733, 0.183865, 0.103685, 0.0409419, 0.0114253, 0.00214592, 0.000281003, 2.33002e-05, 7.00007e-07, 2.12303e-07, 0};
vector<double> ref_b = {2.90003e-06, 0.00876079, 0.0471061, 0.115841, 0.187615, 0.221488, 0.196102, 0.130352, 0.063905, 0.0224984, 0.00542085, 0.000828908, 7.53008e-05, 4.90005e-06, 1.00001e-07, 0};
double ref_t0b = 1.53498;
vector<bool> z(15);
double c = 0;
double ac = 0;
double tmh = 0;
double zz = 0;
double t0b = 0;
for (int s = 0; s < 200000; ++s) {
for (int i = 0; i < 15; ++i) {
const unsigned int y_i = i % 3;
const bool old_z = z[i];
cpyp::crp<int> old_a = a;
cpyp::crp<int> old_b = b;
double lp_old = llh(a, p0_a) + llh(b, p0_b);
double lq_old = 0;
double lq_new = 0;
if (s > 0) (z[i] ? b : a).decrement(y_i, eng, &lq_old);
double aa = 0.5; // these can be better estimates
double bb = 0.5;
z[i] = cpyp::sample_bernoulli(aa, bb, eng);
(z[i] ? b : a).increment_no_base(y_i, eng, &lq_new);
lq_new += log((z[i] ? bb : aa) / (aa + bb));
lq_old += log((old_z ? bb : aa) / (aa + bb));
if (s > 0) {
double lp_new = llh(a, p0_a) + llh(b, p0_b);
double acc = exp(lp_new - lp_old + lq_old - lq_new);
++tmh;
if (acc >= 1.0 || cpyp::sample_uniform01<double>(eng) < acc) { // mh accept
++ac;
} else { // mh reject
std::swap(a, old_a);
std::swap(b, old_b);
z[i] = old_z;
}
}
}
// record sample
if (s> 200 && s % 10 == 9) {
assert(a.num_tables() < hist_a.size());
assert(b.num_tables() < hist_b.size());
hist_a[a.num_tables()]++; hist_b[b.num_tables()]++; ++c;
for (int i = 0; i < 15; ++i) {
unsigned int y_i = i % 3;
if (!z[i]) { t0b += y_i; ++zz; }
}
}
}
ac /= tmh;
cerr << "ACCEPTANCE: " << ac << endl;
int j =0;
double te = 0;
double me = 0;
for (int i = 0; i < 15; ++i) {
double a = hist_a[i];
double b = hist_b[i];
double err_a = (a / c - ref_a[j]);
double err_b = (b / c - ref_b[j++]);
cerr << err_a << "\t" << err_b << endl;
te += fabs(err_a) + fabs(err_b);
if (fabs(err_a) > me) { me = fabs(err_a); }
if (fabs(err_b) > me) { me = fabs(err_b); }
}
te /= 30;
cerr << "t0b = " << (t0b / zz) << endl;
double ee = fabs((t0b / zz) - ref_t0b);
cerr << "err t0b = " << ee;
if (ee > 0.01) { cerr << " ** TOO HIGH **"; }
cerr << endl;
cerr << "Average error: " << te;
if (te > 0.01) { cerr << " ** TOO HIGH **"; }
cerr << endl << " Max error: " << me;
if (me > 0.01) { cerr << " ** TOO HIGH **"; }
cerr << endl;
}
void test_mfcrp() {
vector<double> ref_up = {0.0152302, 0.0754287, 0.153957, 0.209485, 0.213071, 0.16726, 0.101233, 0.0460308, 0.0149256, 0.003075, 0.00030408};
vector<double> ref_down = {0.185252, 0.32385, 0.271888, 0.145849, 0.0548223, 0.0149361, 0.00294062, 0.0004185, 4.074e-05, 2.3e-06, 4e-08};
cpyp::MT19937 eng;
long double p0[2]{1.0,1.0}; // pa(0), pb(0)
double lam[2]{0.3,0.7};
vector<double> hist_upstairs(11, 0);
vector<double> hist_downstairs(11, 0);
int c = 0;
for (int n = 0; n < 200000; ++n) {
cpyp::mf_crp<2, unsigned> crp(0.5, 1.0);
int upstairs = 0;
int downstairs = 0;
for (int i = 0; i < 10; ++i) {
unsigned obs = 0;
pair<unsigned, int> floor_count = crp.increment(obs, p0, lam, eng);
if (floor_count.second) (floor_count.first ? upstairs : downstairs)++;
}
// resample some stuff
for (int j = 0; j < 4; ++j) {
for (int i = 0; i < 10; ++i) {
unsigned obs = 0;
pair<unsigned, int> floor_count = crp.decrement(obs, eng);
if (floor_count.second) (floor_count.first ? upstairs : downstairs)--;
floor_count = crp.increment(obs, p0, lam, eng);
if (floor_count.second) (floor_count.first ? upstairs : downstairs)++;
}
}
hist_downstairs[downstairs] += 1.0;
hist_upstairs[upstairs] += 1.0;
++c;
}
cerr << "Upstairs:\n";
int j = 0;
double max_up = 0;
double tot_up = 0;
for (auto& d : hist_upstairs) {
double diff = d / c - ref_up[j++];
cerr << diff << endl;
if (fabs(diff) > max_up) max_up = fabs(diff);
tot_up += fabs(diff);
}
if (max_up > 0.01) { cerr << "** TOO BIG "; }
cerr << "max_up=" << max_up << endl;
tot_up /= 11;
if (tot_up > 0.005) { cerr << "*** TOO BIG "; }
cerr << "avg_up=" << tot_up << endl;
cerr << "Downstairs:\n";
j = 0;
double tot_down = 0;
double max_down = 0;
for (auto& d : hist_downstairs) {
double diff = (d / c - ref_down[j++]);
cerr << diff << endl;
if (fabs(diff) > max_down) max_down = fabs(diff);
tot_down += fabs(diff);
}
if (max_down > 0.01) { cerr << "** TOO BIG "; }
cerr << "max_down=" << max_down << endl;
tot_down /= 11;
if (tot_down > 0.005) { cerr << "*** TOO BIG "; }
cerr << "avg_down=" << tot_down << endl;
}
int main() {
cpyp::MT19937 eng;
double tot = 0;
double xt = 0;
cpyp::crp<int> crp(0.5, 1.0);
unsigned cust = 10;
vector<int> hist(cust + 1, 0);
for (unsigned i = 0; i < cust; ++i) { crp.increment(1, 1.0, eng); }
const int samples = 200000;
const bool simulate = true;
for (int k = 0; k < samples; ++k) {
if (!simulate) {
crp.clear();
for (unsigned i = 0; i < cust; ++i) { crp.increment(1, 1.0, eng); }
} else {
unsigned da = cpyp::sample_uniform01<double>(eng) * cust;
bool a = cpyp::sample_uniform01<double>(eng) < 0.5;
if (a) {
for (unsigned i = 0; i < da; ++i) { crp.increment(1, 1.0, eng); }
for (unsigned i = 0; i < da; ++i) { crp.decrement(1, eng); }
xt += 1.0;
} else {
for (unsigned i = 0; i < da; ++i) { crp.decrement(1, eng); }
for (unsigned i = 0; i < da; ++i) { crp.increment(1, 1.0, eng); }
}
}
int c = crp.num_tables(1);
++hist[c];
tot += c;
}
assert(cust == crp.num_customers());
cerr << crp << endl;
cerr << crp.log_likelihood() << endl;
cerr << "P(a) = " << (xt / samples) << endl;
cerr << "mean num tables = " << (tot / samples) << endl;
double error = fabs((tot / samples) - 5.4);
cerr << " error = " << error << endl;
for (unsigned i = 1; i <= cust; ++i)
cerr << i << ' ' << (hist[i]) << endl;
if (error > 0.1) {
cerr << "*** error is too big = " << error << endl;
return 1;
}
test_mh1();
test_mh1a();
test_mh2();
test_mfcrp();
return 0;
}
| 32.322388 | 200 | 0.526782 | redpony |
80c3c99bb8fbb974fe76f636a384b37d2accd24e | 3,059 | cpp | C++ | abserv/abserv/DataProvider.cpp | pablokawan/ABx | 064d6df265c48c667ce81b0a83f84e5e22a7ff53 | [
"MIT"
] | null | null | null | abserv/abserv/DataProvider.cpp | pablokawan/ABx | 064d6df265c48c667ce81b0a83f84e5e22a7ff53 | [
"MIT"
] | null | null | null | abserv/abserv/DataProvider.cpp | pablokawan/ABx | 064d6df265c48c667ce81b0a83f84e5e22a7ff53 | [
"MIT"
] | null | null | null | /**
* Copyright 2017-2020 Stefan Ascher
*
* 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 "DataProvider.h"
#include "ConfigManager.h"
#include "NavigationMesh.h"
#include "IONavMesh.h"
#include "IOTerrain.h"
#include "Terrain.h"
#include "Model.h"
#include "IOModel.h"
#include "IOScript.h"
#include <abscommon/Utils.h>
#include <abscommon/StringUtils.h>
#include <abscommon/Subsystems.h>
namespace IO {
DataProvider::DataProvider()
{
// Add Importer
AddImporter<Navigation::NavigationMesh, IO::IONavMesh>();
AddImporter<Game::Terrain, IO::IOTerrain>();
AddImporter<Game::Model, IO::IOModel>();
AddImporter<Game::Script, IO::IOScript>();
}
DataProvider::~DataProvider() = default;
void DataProvider::Update()
{
if (!watchFiles_)
return;
for (const auto& item : cache_)
{
if (item.second.watcher)
item.second.watcher->Update();
}
}
std::string DataProvider::GetDataFile(const std::string& name)
{
return Utils::ConcatPath(GetDataDir(), name);
}
const std::string& DataProvider::GetDataDir()
{
return (*GetSubsystem<ConfigManager>())[ConfigManager::DataDir].GetString();
}
bool DataProvider::FileExists(const std::string& name)
{
return Utils::FileExists(name);
}
std::string DataProvider::GetFile(const std::string& name)
{
if (Utils::FileExists(name))
return name;
std::string n = GetDataFile(name);
if (Utils::FileExists(n))
return n;
return name;
}
void DataProvider::CleanCache()
{
if (cache_.size() == 0)
return;
#ifdef _DEBUG
LOG_DEBUG << "Cleaning cache" << std::endl;
#endif
// Delete all assets that are only owned by the cache
auto i = cache_.begin();
while ((i = ea::find_if(i, cache_.end(), [](const auto& current) -> bool
{
if (current.second.asset.use_count() == 1)
return Utils::TimeElapsed(current.second.lastUsed) >= CACHE_KEEP_UNUSED_ASSETS;
return false;
})) != cache_.end())
{
cache_.erase(i++);
}
}
}
| 28.324074 | 91 | 0.692056 | pablokawan |
80c45048c0b03a0a5cb03a4be780850e063a2fc8 | 353 | cpp | C++ | src/protocol/cert_finish.cpp | Vieraw/auth | 5ed546a9b65289abc91c42813f66e59e363dd2d3 | [
"MIT"
] | 2 | 2021-12-04T11:19:45.000Z | 2021-12-30T11:56:14.000Z | src/protocol/cert_finish.cpp | Vieraw/auth | 5ed546a9b65289abc91c42813f66e59e363dd2d3 | [
"MIT"
] | null | null | null | src/protocol/cert_finish.cpp | Vieraw/auth | 5ed546a9b65289abc91c42813f66e59e363dd2d3 | [
"MIT"
] | 1 | 2021-12-04T11:19:53.000Z | 2021-12-04T11:19:53.000Z |
#include "cert_finish.h"
#include "../auth_client.h"
namespace protocol {
factory_register<cert_finish> cert_finish::_add{548};
void cert_finish::read(util::bytestream &data) {}
void cert_finish::write() {
util::bytestream body;
body << retcode;
body << reserved1;
getClient()->write(548, body);
}
} | 19.611111 | 57 | 0.623229 | Vieraw |
80c87ce8a6964225c2340f1c74b12eba28d8f14f | 55,153 | cpp | C++ | src/DjvuLib.Shared/libdjvu/DjVuDocument.cpp | eadordzhiev/DjvuLib | cbbe626708630e8d2abe5ba3ffed1d1d744700ca | [
"Apache-2.0"
] | 1 | 2018-01-14T23:21:13.000Z | 2018-01-14T23:21:13.000Z | src/DjvuLib.Shared/libdjvu/DjVuDocument.cpp | eadordzhiev/DjvuLib | cbbe626708630e8d2abe5ba3ffed1d1d744700ca | [
"Apache-2.0"
] | null | null | null | src/DjvuLib.Shared/libdjvu/DjVuDocument.cpp | eadordzhiev/DjvuLib | cbbe626708630e8d2abe5ba3ffed1d1d744700ca | [
"Apache-2.0"
] | null | null | null | //C- -*- C++ -*-
//C- -------------------------------------------------------------------
//C- DjVuLibre-3.5
//C- Copyright (c) 2002 Leon Bottou and Yann Le Cun.
//C- Copyright (c) 2001 AT&T
//C-
//C- This software is subject to, and may be distributed under, the
//C- GNU General Public License, either Version 2 of the license,
//C- or (at your option) any later version. The license should have
//C- accompanied the software or you may obtain a copy of the license
//C- from the Free Software Foundation at http://www.fsf.org .
//C-
//C- This program is distributed in the hope that it will be useful,
//C- but WITHOUT ANY WARRANTY; without even the implied warranty of
//C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//C- GNU General Public License for more details.
//C-
//C- DjVuLibre-3.5 is derived from the DjVu(r) Reference Library from
//C- Lizardtech Software. Lizardtech Software has authorized us to
//C- replace the original DjVu(r) Reference Library notice by the following
//C- text (see doc/lizard2002.djvu and doc/lizardtech2007.djvu):
//C-
//C- ------------------------------------------------------------------
//C- | DjVu (r) Reference Library (v. 3.5)
//C- | Copyright (c) 1999-2001 LizardTech, Inc. All Rights Reserved.
//C- | The DjVu Reference Library is protected by U.S. Pat. No.
//C- | 6,058,214 and patents pending.
//C- |
//C- | This software is subject to, and may be distributed under, the
//C- | GNU General Public License, either Version 2 of the license,
//C- | or (at your option) any later version. The license should have
//C- | accompanied the software or you may obtain a copy of the license
//C- | from the Free Software Foundation at http://www.fsf.org .
//C- |
//C- | The computer code originally released by LizardTech under this
//C- | license and unmodified by other parties is deemed "the LIZARDTECH
//C- | ORIGINAL CODE." Subject to any third party intellectual property
//C- | claims, LizardTech grants recipient a worldwide, royalty-free,
//C- | non-exclusive license to make, use, sell, or otherwise dispose of
//C- | the LIZARDTECH ORIGINAL CODE or of programs derived from the
//C- | LIZARDTECH ORIGINAL CODE in compliance with the terms of the GNU
//C- | General Public License. This grant only confers the right to
//C- | infringe patent claims underlying the LIZARDTECH ORIGINAL CODE to
//C- | the extent such infringement is reasonably necessary to enable
//C- | recipient to make, have made, practice, sell, or otherwise dispose
//C- | of the LIZARDTECH ORIGINAL CODE (or portions thereof) and not to
//C- | any greater extent that may be necessary to utilize further
//C- | modifications or combinations.
//C- |
//C- | The LIZARDTECH ORIGINAL CODE is provided "AS IS" WITHOUT WARRANTY
//C- | OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
//C- | TO ANY WARRANTY OF NON-INFRINGEMENT, OR ANY IMPLIED WARRANTY OF
//C- | MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
//C- +------------------------------------------------------------------
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if NEED_GNUG_PRAGMAS
# pragma implementation
#endif
#include "DjVuDocument.h"
#include "DjVmDoc.h"
#include "DjVmDir0.h"
#include "DjVmNav.h"
#include "DjVuNavDir.h"
#include "DjVuImage.h"
#include "DjVuFileCache.h"
#include "IFFByteStream.h"
#include "GOS.h"
#include "DataPool.h"
#include "IW44Image.h"
#include "GRect.h"
#include "debug.h"
#ifdef HAVE_NAMESPACES
namespace DJVU {
# ifdef NOT_DEFINED // Just to fool emacs c++ mode
}
#endif
#endif
static const char octets[4]={0x41,0x54,0x26,0x54};
const float DjVuDocument::thumb_gamma=(float)2.20;
void (* DjVuDocument::djvu_import_codec)(
GP<DataPool> &pool, const GURL &url, bool &needs_compression,
bool &needs_rename )=0;
void (* DjVuDocument::djvu_compress_codec)(
GP<ByteStream> &doc,const GURL &where,bool bundled)=0;
void
DjVuDocument::set_import_codec(
void (*codec)(
GP<DataPool> &pool, const GURL &url, bool &needs_compression, bool &needs_rename ))
{
djvu_import_codec=codec;
}
void
DjVuDocument::set_compress_codec(
void (* codec)(
GP<ByteStream> &doc,const GURL &where,bool bundled))
{
djvu_compress_codec=codec;
}
DjVuDocument::DjVuDocument(void)
: doc_type(UNKNOWN_TYPE),
needs_compression_flag(false),
can_compress_flag(false),
needs_rename_flag(false),
has_url_names(false),
recover_errors(ABORT),
verbose_eof(false),
init_started(false),
cache(0)
{
}
GP<DjVuDocument>
DjVuDocument::create(
GP<DataPool> pool, GP<DjVuPort> xport, DjVuFileCache * const xcache)
{
DjVuDocument *doc=new DjVuDocument;
GP<DjVuDocument> retval=doc;
doc->init_data_pool=pool;
doc->start_init(GURL(),xport,xcache);
return retval;
}
GP<DjVuDocument>
DjVuDocument::create(
const GP<ByteStream> &bs, GP<DjVuPort> xport, DjVuFileCache * const xcache)
{
return create(DataPool::create(bs),xport,xcache);
}
GP<DjVuDocument>
DjVuDocument::create_wait(
const GURL &url, GP<DjVuPort> xport, DjVuFileCache * const xcache)
{
GP<DjVuDocument> retval=create(url,xport,xcache);
retval->wait_for_complete_init();
return retval;
}
void
DjVuDocument::start_init(
const GURL & url, GP<DjVuPort> xport, DjVuFileCache * xcache)
{
DEBUG_MSG("DjVuDocument::start_init(): initializing class...\n");
DEBUG_MAKE_INDENT(3);
if (init_started)
G_THROW( ERR_MSG("DjVuDocument.2nd_init") );
if (!get_count())
G_THROW( ERR_MSG("DjVuDocument.not_secure") );
if(url.is_empty())
{
if (!init_data_pool)
G_THROW( ERR_MSG("DjVuDocument.empty_url") );
if(init_url.is_empty())
{
init_url=invent_url("document.djvu");
}
}else
{
init_url=url;
}
// Initialize
cache=xcache;
doc_type=UNKNOWN_TYPE;
DataPool::close_all();
DjVuPortcaster * pcaster=get_portcaster();
if (!xport)
xport=simple_port=new DjVuSimplePort();
pcaster->add_route(this, xport);
pcaster->add_route(this, this);
if(!url.is_empty())
{
init_data_pool=pcaster->request_data(this, init_url);
if(init_data_pool)
{
if(!init_url.is_empty() && init_url.is_local_file_url() && djvu_import_codec)
{
djvu_import_codec(init_data_pool,init_url,needs_compression_flag,needs_rename_flag);
}
if(needs_rename_flag)
can_compress_flag=true;
}
if (!init_data_pool)
{
G_THROW( ERR_MSG("DjVuDocument.fail_URL") "\t"+init_url.get_string());
}
}
// Now we say it is ready
init_started=true;
init_thread_flags=STARTED;
init_life_saver=this;
init_thr.create(static_init_thread, this);
}
DjVuDocument::~DjVuDocument(void)
{
// No more messages, please. We're being destroyed.
get_portcaster()->del_port(this);
// We want to stop any DjVuFile which has been created by us
// and is still being decoded. We have to stop them manually because
// they keep the "life saver" in the decoding thread and won't stop
// when we clear the last reference to them
{
GCriticalSectionLock lock(&ufiles_lock);
for(GPosition pos=ufiles_list;pos;++pos)
{
GP<DjVuFile> file=ufiles_list[pos]->file;
file->stop_decode(false);
file->stop(false); // Disable any access to data
}
ufiles_list.empty();
}
GPList<DjVuPort> ports=get_portcaster()->prefix_to_ports(get_int_prefix());
for(GPosition pos=ports;pos;++pos)
{
GP<DjVuPort> port=ports[pos];
if (port->inherits("DjVuFile"))
{
DjVuFile * file=(DjVuFile *) (DjVuPort *) port;
file->stop_decode(false);
file->stop(false); // Disable any access to data
}
}
DataPool::close_all();
}
void
DjVuDocument::stop_init(void)
{
DEBUG_MSG("DjVuDocument::stop_init(): making sure that the init thread dies.\n");
DEBUG_MAKE_INDENT(3);
GMonitorLock lock(&init_thread_flags);
while((init_thread_flags & STARTED) &&
!(init_thread_flags & FINISHED))
{
if (init_data_pool) init_data_pool->stop(true); // blocking operation
if (ndir_file) ndir_file->stop(false);
{
GCriticalSectionLock lock(&ufiles_lock);
for(GPosition pos=ufiles_list;pos;++pos)
ufiles_list[pos]->file->stop(false); // Disable any access to data
ufiles_list.empty();
}
init_thread_flags.wait(50);
}
}
void
DjVuDocument::check() const
{
if (!init_started)
G_THROW( ERR_MSG("DjVuDocument.not_init") );
}
void
DjVuDocument::static_init_thread(void * cl_data)
{
DjVuDocument * th=(DjVuDocument *) cl_data;
GP<DjVuDocument> life_saver=th;
th->init_life_saver=0;
G_TRY {
th->init_thread();
} G_CATCH(exc) {
G_TRY {
int changed = DjVuDocument::DOC_INIT_FAILED;
th->flags |= changed;
get_portcaster()->notify_doc_flags_changed(th, changed, 0);
} G_CATCH_ALL {
} G_ENDCATCH;
G_TRY {
th->check_unnamed_files();
if (!exc.cmp_cause(ByteStream::EndOfFile) && th->verbose_eof)
get_portcaster()->notify_error(th, ERR_MSG("DjVuDocument.init_eof"));
else if (!exc.cmp_cause(DataPool::Stop))
get_portcaster()->notify_status(th, ERR_MSG("DjVuDocument.stopped"));
else
get_portcaster()->notify_error(th, exc.get_cause());
} G_CATCH_ALL {
} G_ENDCATCH;
th->init_thread_flags |= FINISHED;
} G_ENDCATCH;
}
void
DjVuDocument::init_thread(void)
// This function is run in a separate thread.
// The goal is to detect the document type (BUNDLED, OLD_INDEXED, etc.)
// and decode navigation directory.
{
DEBUG_MSG("DjVuDocument::init_thread(): guessing what we're dealing with\n");
DEBUG_MAKE_INDENT(3);
DjVuPortcaster * pcaster=get_portcaster();
GP<ByteStream> stream=init_data_pool->get_stream();
GP<IFFByteStream> giff=IFFByteStream::create(stream);
IFFByteStream &iff=*giff;
GUTF8String chkid;
int size=iff.get_chunk(chkid);
if (!size)
G_THROW( ByteStream::EndOfFile );
if (size < 0)
G_THROW( ERR_MSG("DjVuDocument.no_file") );
if (size<8)
G_THROW( ERR_MSG("DjVuDocument.not_DjVu") );
if (chkid=="FORM:DJVM")
{
DEBUG_MSG("Got DJVM document here\n");
DEBUG_MAKE_INDENT(3);
size=iff.get_chunk(chkid);
if (chkid=="DIRM")
{
djvm_dir=DjVmDir::create();
djvm_dir->decode(iff.get_bytestream());
iff.close_chunk();
if (djvm_dir->is_bundled())
{
DEBUG_MSG("Got BUNDLED file.\n");
doc_type=BUNDLED;
}
else
{
DEBUG_MSG("Got INDIRECT file.\n");
doc_type=INDIRECT;
}
flags|=DOC_TYPE_KNOWN | DOC_DIR_KNOWN;
pcaster->notify_doc_flags_changed(this,
DOC_TYPE_KNOWN | DOC_DIR_KNOWN, 0);
check_unnamed_files();
/* Check for NAVM */
size=iff.get_chunk(chkid);
if (size && chkid=="NAVM")
{
djvm_nav=DjVmNav::create();
djvm_nav->decode(iff.get_bytestream());
iff.close_chunk();
}
}
else if (chkid=="DIR0")
{
DEBUG_MSG("Got OLD_BUNDLED file.\n");
doc_type=OLD_BUNDLED;
flags|=DOC_TYPE_KNOWN;
pcaster->notify_doc_flags_changed(this, DOC_TYPE_KNOWN, 0);
check_unnamed_files();
}
else
G_THROW( ERR_MSG("DjVuDocument.bad_format") );
if (doc_type==OLD_BUNDLED)
{
// Read the DjVmDir0 directory. We are unable to tell what
// files are pages and what are included at this point.
// We only know that the first file with DJVU (BM44 or PM44)
// form *is* the first page. The rest will become known
// after we decode DjVuNavDir
djvm_dir0=DjVmDir0::create();
djvm_dir0->decode(*iff.get_bytestream());
iff.close_chunk();
// Get offset to the first DJVU, PM44 or BM44 chunk
int first_page_offset=0;
while(!first_page_offset)
{
int offset;
size=iff.get_chunk(chkid, &offset);
if (size==0) G_THROW( ERR_MSG("DjVuDocument.no_page") );
if (chkid=="FORM:DJVU" ||
chkid=="FORM:PM44" || chkid=="FORM:BM44")
{
DEBUG_MSG("Got 1st page offset=" << offset << "\n");
first_page_offset=offset;
}
iff.close_chunk();
}
// Now get the name of this file
int file_num;
for(file_num=0;file_num<djvm_dir0->get_files_num();file_num++)
{
DjVmDir0::FileRec & file=*djvm_dir0->get_file(file_num);
if (file.offset==first_page_offset)
{
first_page_name=file.name;
break;
}
}
if (!first_page_name.length())
G_THROW( ERR_MSG("DjVuDocument.no_page") );
flags|=DOC_DIR_KNOWN;
pcaster->notify_doc_flags_changed(this, DOC_DIR_KNOWN, 0);
check_unnamed_files();
}
}
else // chkid!="FORM:DJVM"
{
// DJVU format
DEBUG_MSG("Got DJVU OLD_INDEXED or SINGLE_PAGE document here.\n");
doc_type=SINGLE_PAGE;
flags |= DOC_TYPE_KNOWN;
pcaster->notify_doc_flags_changed(this, DOC_TYPE_KNOWN, 0);
check_unnamed_files();
}
if (doc_type==OLD_BUNDLED || doc_type==SINGLE_PAGE)
{
DEBUG_MSG("Searching for NDIR chunks...\n");
ndir_file=get_djvu_file(-1);
if (ndir_file) ndir=ndir_file->decode_ndir();
ndir_file=0; // Otherwise ~DjVuDocument() will stop (=kill) it
if (!ndir)
{
// Seems to be 1-page old-style document. Create dummy NDIR
if (doc_type==OLD_BUNDLED)
{
ndir=DjVuNavDir::create(GURL::UTF8("directory",init_url));
ndir->insert_page(-1, first_page_name);
}
else
{
ndir=DjVuNavDir::create(GURL::UTF8("directory",init_url.base()));
ndir->insert_page(-1, init_url.fname());
}
}
else
{
if (doc_type==SINGLE_PAGE)
doc_type=OLD_INDEXED;
}
flags|=DOC_NDIR_KNOWN;
pcaster->notify_doc_flags_changed(this, DOC_NDIR_KNOWN, 0);
check_unnamed_files();
}
flags |= DOC_INIT_OK;
pcaster->notify_doc_flags_changed(this, DOC_INIT_OK, 0);
check_unnamed_files();
init_thread_flags|=FINISHED;
DEBUG_MSG("DOCUMENT IS FULLY INITIALIZED now: doc_type='" <<
(doc_type==BUNDLED ? "BUNDLED" :
doc_type==OLD_BUNDLED ? "OLD_BUNDLED" :
doc_type==INDIRECT ? "INDIRECT" :
doc_type==OLD_INDEXED ? "OLD_INDEXED" :
doc_type==SINGLE_PAGE ? "SINGLE_PAGE" :
"UNKNOWN") << "'\n");
}
bool
DjVuDocument::wait_for_complete_init(void)
{
flags.enter();
while(!(flags & DOC_INIT_FAILED) &&
!(flags & DOC_INIT_OK)) flags.wait();
flags.leave();
init_thread_flags.enter();
while (!(init_thread_flags & FINISHED))
init_thread_flags.wait();
init_thread_flags.leave();
return (flags & (DOC_INIT_OK | DOC_INIT_FAILED))!=0;
}
int
DjVuDocument::wait_get_pages_num(void) const
{
GSafeFlags &f=const_cast<GSafeFlags &>(flags);
f.enter();
while(!(f & DOC_TYPE_KNOWN) &&
!(f & DOC_INIT_FAILED) &&
!(f & DOC_INIT_OK)) f.wait();
f.leave();
return get_pages_num();
}
GUTF8String
DjVuDocument::get_int_prefix(void) const
{
// These NAMEs are used to enable DjVuFile sharing inside the same
// DjVuDocument using DjVuPortcaster. Since URLs are unique to the
// document, other DjVuDocuments cannot retrieve files until they're
// assigned some permanent name. After '?' there should be the real
// file's URL. Please note, that output of this function is used only
// as name for DjVuPortcaster. Not as a URL.
GUTF8String retval;
return retval.format("document_%p%d?", this, hash(init_url));
}
void
DjVuDocument::set_file_aliases(const DjVuFile * file)
{
DEBUG_MSG("DjVuDocument::set_file_aliases(): setting global aliases for file '"
<< file->get_url() << "'\n");
DEBUG_MAKE_INDENT(3);
DjVuPortcaster * pcaster=DjVuPort::get_portcaster();
GMonitorLock lock(&((DjVuFile *) file)->get_safe_flags());
pcaster->clear_aliases(file);
if (file->is_decode_ok() && cache)
{
// If file is successfully decoded and caching is enabled,
// assign a global alias to this file, so that any other
// DjVuDocument will be able to use it.
pcaster->add_alias(file, file->get_url().get_string());
if (flags & (DOC_NDIR_KNOWN | DOC_DIR_KNOWN))
{
int page_num=url_to_page(file->get_url());
if (page_num>=0)
{
if (page_num==0) pcaster->add_alias(file, init_url.get_string()+"#-1");
pcaster->add_alias(file, init_url.get_string()+"#"+GUTF8String(page_num));
}
}
// The following line MUST stay here. For OLD_INDEXED documents
// a page may finish decoding before DIR or NDIR becomes known
// (multithreading, remember), so the code above would not execute
pcaster->add_alias(file, file->get_url().get_string()+"#-1");
} else pcaster->add_alias(file, get_int_prefix()+file->get_url());
}
void
DjVuDocument::check_unnamed_files(void)
{
DEBUG_MSG("DjVuDocument::check_unnamed_files(): Seeing if we can fix some...\n");
DEBUG_MAKE_INDENT(3);
if (flags & DOC_INIT_FAILED)
{
// Init failed. All unnamed files should be terminated
GCriticalSectionLock lock(&ufiles_lock);
for(GPosition pos=ufiles_list;pos;++pos)
{
GP<DjVuFile> file=ufiles_list[pos]->file;
file->stop_decode(true);
file->stop(false); // Disable any access to data
}
ufiles_list.empty();
return;
}
if ((flags & DOC_TYPE_KNOWN)==0)
return;
// See the list of unnamed files (created when there was insufficient
// information about DjVuDocument structure) and try to fix those,
// which can be fixed at this time
while(true)
{
DjVuPortcaster * pcaster=get_portcaster();
GP<UnnamedFile> ufile;
GURL new_url;
GPosition pos ;
GCriticalSectionLock lock(&ufiles_lock);
for(pos=ufiles_list;pos;)
{
G_TRY
{
GP<UnnamedFile> f=ufiles_list[pos];
if (f->id_type==UnnamedFile::ID)
new_url=id_to_url(f->id);
else
new_url=page_to_url(f->page_num);
if (!new_url.is_empty())
{
ufile=f;
// Don't take it off the list. We want to be
// able to stop the init from ~DjVuDocument();
//
// ufiles_list.del(pos);
break;
} else if (is_init_complete())
{
// No empty URLs are allowed at this point.
// We now know all information about the document
// and can determine if a page is inside it or not
f->data_pool->set_eof();
GUTF8String msg;
if (f->id_type==UnnamedFile::ID)
msg= ERR_MSG("DjVuDocument.miss_page_name") "\t"+f->id;
else
msg= ERR_MSG("DjVuDocument.miss_page_num") "\t"+GUTF8String(f->page_num);
G_THROW(msg);
}
++pos;
}
G_CATCH(exc)
{
pcaster->notify_error(this, exc.get_cause());
GP<DataPool> pool=ufiles_list[pos]->data_pool;
if (pool)
pool->stop();
GPosition this_pos=pos;
++pos;
ufiles_list.del(this_pos);
}
G_ENDCATCH;
}
if (ufile && !new_url.is_empty())
{
DEBUG_MSG("Fixing file: '" << ufile->url << "'=>'" << new_url << "'\n");
// Now, once we know its real URL we can request a real DataPool and
// can connect the DataPool owned by DjVuFile to that real one
// Note, that now request_data() will not play fool because
// we have enough information
G_TRY
{
if (ufile->data_pool)
{
GP<DataPool> new_pool=pcaster->request_data(ufile->file, new_url);
if(!new_pool)
G_THROW( ERR_MSG("DjVuDocument.fail_URL") "\t"+new_url.get_string());
ufile->data_pool->connect(new_pool);
}
ufile->file->set_name(new_url.fname());
ufile->file->move(new_url.base());
set_file_aliases(ufile->file);
}
G_CATCH(exc)
{
pcaster->notify_error(this, exc.get_cause());
}
G_ENDCATCH;
}
else
break;
// Remove the 'ufile' from the list
for(pos=ufiles_list;pos;++pos)
if (ufiles_list[pos]==ufile)
{
ufiles_list.del(pos);
break;
}
} // while(1)
}
int
DjVuDocument::get_pages_num(void) const
{
check();
if (flags & DOC_TYPE_KNOWN)
{
if (doc_type==BUNDLED || doc_type==INDIRECT)
return djvm_dir->get_pages_num();
else if (flags & DOC_NDIR_KNOWN)
return ndir->get_pages_num();
}
return 1;
}
GURL
DjVuDocument::page_to_url(int page_num) const
{
check();
DEBUG_MSG("DjVuDocument::page_to_url(): page_num=" << page_num << "\n");
DEBUG_MAKE_INDENT(3);
GURL url;
if (flags & DOC_TYPE_KNOWN)
switch(doc_type)
{
case SINGLE_PAGE:
{
if (page_num<1)
url=init_url;
else
G_THROW( ERR_MSG("DjVuDocument.big_num") );
break;
}
case OLD_INDEXED:
{
if (page_num<0)
url=init_url;
else if (flags & DOC_NDIR_KNOWN)
url=ndir->page_to_url(page_num);
break;
}
case OLD_BUNDLED:
{
if (page_num<0)
page_num=0;
if (page_num==0 && (flags & DOC_DIR_KNOWN))
url=GURL::UTF8(first_page_name,init_url);
else if (flags & DOC_NDIR_KNOWN)
url=ndir->page_to_url(page_num);
break;
}
case BUNDLED:
{
if (page_num<0)
page_num=0;
if (flags & DOC_DIR_KNOWN)
{
GP<DjVmDir::File> file=djvm_dir->page_to_file(page_num);
if (!file)
G_THROW( ERR_MSG("DjVuDocument.big_num") );
url=GURL::UTF8(file->get_load_name(),init_url);
}
break;
}
case INDIRECT:
{
if (page_num<0) page_num=0;
if (flags & DOC_DIR_KNOWN)
{
GP<DjVmDir::File> file=djvm_dir->page_to_file(page_num);
if (!file)
G_THROW( ERR_MSG("DjVuDocument.big_num") );
url=GURL::UTF8(file->get_load_name(),init_url.base());
}
break;
}
default:
G_THROW( ERR_MSG("DjVuDocument.unk_type") );
}
return url;
}
int
DjVuDocument::url_to_page(const GURL & url) const
{
check();
DEBUG_MSG("DjVuDocument::url_to_page(): url='" << url << "'\n");
DEBUG_MAKE_INDENT(3);
int page_num=-1;
if (flags & DOC_TYPE_KNOWN)
switch(doc_type)
{
case SINGLE_PAGE:
case OLD_BUNDLED:
case OLD_INDEXED:
{
if (flags & DOC_NDIR_KNOWN) page_num=ndir->url_to_page(url);
break;
}
case BUNDLED:
{
if (flags & DOC_DIR_KNOWN)
{
GP<DjVmDir::File> file;
if (url.base()==init_url)
file=djvm_dir->id_to_file(url.fname());
if (file)
page_num=file->get_page_num();
}
break;
}
case INDIRECT:
{
if (flags & DOC_DIR_KNOWN)
{
GP<DjVmDir::File> file;
if (url.base()==init_url.base())
file=djvm_dir->id_to_file(url.fname());
if (file)
page_num=file->get_page_num();
}
break;
}
default:
G_THROW( ERR_MSG("DjVuDocument.unk_type") );
}
return page_num;
}
GURL
DjVuDocument::id_to_url(const GUTF8String & id) const
{
check();
DEBUG_MSG("DjVuDocument::id_to_url(): translating ID='" << id << "' to URL\n");
DEBUG_MAKE_INDENT(3);
if (flags & DOC_TYPE_KNOWN)
switch(doc_type)
{
case BUNDLED:
if (flags & DOC_DIR_KNOWN)
{
GP<DjVmDir::File> file=djvm_dir->id_to_file(id);
if (!file)
{
file=djvm_dir->name_to_file(id);
if (!file)
file=djvm_dir->title_to_file(id);
}
if (file)
return GURL::UTF8(file->get_load_name(),init_url);
}
break;
case INDIRECT:
if (flags & DOC_DIR_KNOWN)
{
GP<DjVmDir::File> file=djvm_dir->id_to_file(id);
if (!file)
{
file=djvm_dir->name_to_file(id);
if (!file)
file=djvm_dir->title_to_file(id);
}
if (file)
return GURL::UTF8(file->get_load_name(),init_url.base());
}
break;
case OLD_BUNDLED:
if (flags & DOC_DIR_KNOWN)
{
GP<DjVmDir0::FileRec> frec=djvm_dir0->get_file(id);
if (frec)
return GURL::UTF8(id,init_url);
}
break;
case OLD_INDEXED:
case SINGLE_PAGE:
return GURL::UTF8(id,init_url.base());
break;
}
return GURL();
}
GURL
DjVuDocument::id_to_url(const DjVuPort * source, const GUTF8String &id)
{
return id_to_url(id);
}
GP<DjVuFile>
DjVuDocument::url_to_file(const GURL & url, bool dont_create) const
// This function is private and is called from two places:
// id_to_file() and get_djvu_file() ONLY when the structure is known
{
check();
DEBUG_MSG("DjVuDocument::url_to_file(): url='" << url << "'\n");
DEBUG_MAKE_INDENT(3);
// Try DjVuPortcaster to find existing files.
DjVuPortcaster * pcaster=DjVuPort::get_portcaster();
GP<DjVuPort> port;
if (cache)
{
// First - fully decoded files
port=pcaster->alias_to_port(url.get_string());
if (port && port->inherits("DjVuFile"))
{
DEBUG_MSG("found fully decoded file using DjVuPortcaster\n");
return (DjVuFile *) (DjVuPort *) port;
}
}
// Second - internal files
port=pcaster->alias_to_port(get_int_prefix()+url);
if (port && port->inherits("DjVuFile"))
{
DEBUG_MSG("found internal file using DjVuPortcaster\n");
return (DjVuFile *) (DjVuPort *) port;
}
GP<DjVuFile> file;
if (!dont_create)
{
DEBUG_MSG("creating a new file\n");
file=DjVuFile::create(url,const_cast<DjVuDocument *>(this),recover_errors,verbose_eof);
const_cast<DjVuDocument *>(this)->set_file_aliases(file);
}
return file;
}
GP<DjVuFile>
DjVuDocument::get_djvu_file(int page_num, bool dont_create) const
{
check();
DEBUG_MSG("DjVuDocument::get_djvu_file(): request for page " << page_num << "\n");
DEBUG_MAKE_INDENT(3);
DjVuPortcaster * pcaster=DjVuPort::get_portcaster();
GURL url;
{
// I'm locking the flags because depending on what page_to_url()
// returns me, I'll be creating DjVuFile in different ways.
// And I don't want the situation to change between the moment I call
// id_to_url() and I actually create DjVuFile
GMonitorLock lock(&(const_cast<DjVuDocument *>(this)->flags));
url=page_to_url(page_num);
if (url.is_empty())
{
// If init is complete and url is empty, we know for sure, that
// smth is wrong with the page_num. So we can return ZERO.
// Otherwise we create a temporary file and wait for init to finish
if (is_init_complete()) return 0;
DEBUG_MSG("Structure is not known => check <doc_url>#<page_num> alias...\n");
GP<DjVuPort> port;
if (cache)
port=pcaster->alias_to_port(init_url.get_string()+"#"+GUTF8String(page_num));
if (!port || !port->inherits("DjVuFile"))
{
DEBUG_MSG("failed => invent dummy URL and proceed\n");
// Invent some dummy temporary URL. I don't care what it will
// be. I'll remember the page_num and will generate the correct URL
// after I learn what the document is
GUTF8String name("page");
name+=GUTF8String(page_num);
name+=".djvu";
url=invent_url(name);
GCriticalSectionLock(&(const_cast<DjVuDocument *>(this)->ufiles_lock));
for(GPosition pos=ufiles_list;pos;++pos)
{
GP<UnnamedFile> f=ufiles_list[pos];
if (f->url==url) return f->file;
}
GP<UnnamedFile> ufile=new UnnamedFile(UnnamedFile::PAGE_NUM, 0,
page_num, url, 0);
// We're adding the record to the list before creating the DjVuFile
// because DjVuFile::init() will call request_data(), and the
// latter should be able to find the record.
//
// We also want to keep ufiles_lock to make sure that when
// request_data() is called, the record is still there
const_cast<DjVuDocument *>(this)->ufiles_list.append(ufile);
GP<DjVuFile> file=
DjVuFile::create(url,const_cast<DjVuDocument *>(this),recover_errors,verbose_eof);
ufile->file=file;
return file;
} else url=((DjVuFile *) (DjVuPort *) port)->get_url();
}
}
GP<DjVuFile> file=url_to_file(url, dont_create);
if (file)
pcaster->add_route(file, const_cast<DjVuDocument *>(this));
return file;
}
GURL
DjVuDocument::invent_url(const GUTF8String &name) const
{
GUTF8String buffer;
buffer.format("djvufileurl://%p/%s", this, (const char *)name);
return GURL::UTF8(buffer);
}
GP<DjVuFile>
DjVuDocument::get_djvu_file(const GUTF8String& id, bool dont_create)
{
check();
DEBUG_MSG("DjVuDocument::get_djvu_file(): ID='" << id << "'\n");
DEBUG_MAKE_INDENT(3);
if (!id.length())
return get_djvu_file(-1);
// Integers are not supported, only ID's
// if (id.is_int())
// return get_djvu_file(id.toInt(),dont_create);
GURL url;
// I'm locking the flags because depending on what id_to_url()
// returns me, I'll be creating DjVuFile in different ways.
// And I don't want the situation to change between the moment I call
// id_to_url() and I actually create DjVuFile
{
GMonitorLock lock(&flags);
url=id_to_url(id);
if(url.is_empty() && !id.is_int())
{
// If init is complete, we know for sure, that there is no such
// file with ID 'id' in the document. Otherwise we have to
// create a temporary file and wait for the init to finish
if (is_init_complete())
return 0;
// Invent some dummy temporary URL. I don't care what it will
// be. I'll remember the ID and will generate the correct URL
// after I learn what the document is
url=invent_url(id);
DEBUG_MSG("Invented url='" << url << "'\n");
GCriticalSectionLock lock(&ufiles_lock);
for(GPosition pos=ufiles_list;pos;++pos)
{
GP<UnnamedFile> f=ufiles_list[pos];
if (f->url==url)
return f->file;
}
GP<UnnamedFile> ufile=new UnnamedFile(UnnamedFile::ID, id, 0, url, 0);
// We're adding the record to the list before creating the DjVuFile
// because DjVuFile::init() will call request_data(), and the
// latter should be able to find the record.
//
// We also want to keep ufiles_lock to make sure that when
// request_data() is called, the record is still there
ufiles_list.append(ufile);
GP<DjVuFile> file=DjVuFile::create(url,this,recover_errors,verbose_eof);
ufile->file=file;
return file;
}
}
return get_djvu_file(url,dont_create);
}
GP<DjVuFile>
DjVuDocument::get_djvu_file(const GURL& url, bool dont_create)
{
check();
DEBUG_MSG("DjVuDocument::get_djvu_file(): URL='" << url << "'\n");
DEBUG_MAKE_INDENT(3);
if (url.is_empty())
return 0;
const GP<DjVuFile> file(url_to_file(url, dont_create));
if (file)
get_portcaster()->add_route(file, this);
return file;
}
GP<DjVuImage>
DjVuDocument::get_page(int page_num, bool sync, DjVuPort * port) const
{
check();
DEBUG_MSG("DjVuDocument::get_page(): request for page " << page_num << "\n");
DEBUG_MAKE_INDENT(3);
GP<DjVuImage> dimg;
const GP<DjVuFile> file(get_djvu_file(page_num));
if (file)
{
dimg=DjVuImage::create(file);
if (port)
DjVuPort::get_portcaster()->add_route(dimg, port);
file->resume_decode();
if (dimg && sync)
dimg->wait_for_complete_decode();
}
return dimg;
}
GP<DjVuImage>
DjVuDocument::get_page(const GUTF8String &id, bool sync, DjVuPort * port)
{
check();
DEBUG_MSG("DjVuDocument::get_page(): ID='" << id << "'\n");
DEBUG_MAKE_INDENT(3);
GP<DjVuImage> dimg;
const GP<DjVuFile> file(get_djvu_file(id));
if(file)
{
dimg=DjVuImage::create(file);
if (port)
DjVuPort::get_portcaster()->add_route(dimg, port);
file->resume_decode();
if (dimg && sync)
dimg->wait_for_complete_decode();
}
return dimg;
}
void
DjVuDocument::process_threqs(void)
// Will look thru threqs_list and try to fulfil every request
{
GCriticalSectionLock lock(&threqs_lock);
for(GPosition pos=threqs_list;pos;)
{
GP<ThumbReq> req=threqs_list[pos];
bool remove=false;
if (req->thumb_file)
{
G_TRY {
// There is supposed to be a file with thumbnails
if (req->thumb_file->is_data_present())
{
// Cool, we can extract the thumbnail now
GP<ByteStream> str=req->thumb_file->get_init_data_pool()->get_stream();
GP<IFFByteStream> giff=IFFByteStream::create(str);
IFFByteStream &iff=*giff;
GUTF8String chkid;
if (!iff.get_chunk(chkid) || chkid!="FORM:THUM")
G_THROW( ERR_MSG("DjVuDocument.bad_thumb") );
for(int i=0;i<req->thumb_chunk;i++)
{
if (!iff.get_chunk(chkid))
G_THROW( ERR_MSG("DjVuDocument.bad_thumb") );
iff.close_chunk();
}
if (!iff.get_chunk(chkid) || chkid!="TH44")
G_THROW( ERR_MSG("DjVuDocument.bad_thumb") );
// Copy the data
char buffer[1024];
int length;
while((length=iff.read(buffer, 1024)))
req->data_pool->add_data(buffer, length);
req->data_pool->set_eof();
// Also add this file to cache so that we won't have
// to download it next time
add_to_cache(req->thumb_file);
req->thumb_file=0;
req->image_file=0;
remove=true;
}
} G_CATCH(exc) {
GUTF8String msg= ERR_MSG("DjVuDocument.cant_extract") "\n";
msg+=exc.get_cause();
get_portcaster()->notify_error(this, msg);
// Switch this request to the "decoding" mode
req->image_file=get_djvu_file(req->page_num);
req->thumb_file=0;
req->data_pool->set_eof();
remove=true;
} G_ENDCATCH;
} // if (req->thumb_file)
if (req->image_file)
{
G_TRY {
// Decode the file if necessary. Or just used predecoded image.
GSafeFlags & file_flags=req->image_file->get_safe_flags();
{
GMonitorLock lock(&file_flags);
if (!req->image_file->is_decoding())
{
if (req->image_file->is_decode_ok())
{
// We can generate it now
const GP<DjVuImage> dimg(DjVuImage::create(req->image_file));
dimg->wait_for_complete_decode();
int width = 160;
int height = 160;
if( dimg->get_width() )
width = dimg->get_width();
if( dimg->get_height() )
height = dimg->get_height();
GRect rect(0, 0, 160, height*160/width);
GP<GPixmap> pm=dimg->get_pixmap(rect, rect, thumb_gamma);
if (!pm)
{
GP<GBitmap> bm=dimg->get_bitmap(rect, rect, sizeof(int));
if(bm)
pm=GPixmap::create(*bm);
else
pm = GPixmap::create(rect.height(), rect.width(),
&GPixel::WHITE);
}
// Store and compress the pixmap
GP<IW44Image> iwpix=IW44Image::create_encode(*pm);
GP<ByteStream> gstr=ByteStream::create();
IWEncoderParms parms;
parms.slices=97;
parms.bytes=0;
parms.decibels=0;
iwpix->encode_chunk(gstr, parms);
TArray<char> data=gstr->get_data();
req->data_pool->add_data((const char *) data, data.size());
req->data_pool->set_eof();
req->thumb_file=0;
req->image_file=0;
remove=true;
} else if (req->image_file->is_decode_failed())
{
// Unfortunately we cannot decode it
req->thumb_file=0;
req->image_file=0;
req->data_pool->set_eof();
remove=true;
} else
{
req->image_file->start_decode();
}
}
}
} G_CATCH(exc) {
GUTF8String msg="Failed to decode thumbnails:\n";
msg+=exc.get_cause();
get_portcaster()->notify_error(this, msg);
// Get rid of this request
req->image_file=0;
req->thumb_file=0;
req->data_pool->set_eof();
remove=true;
} G_ENDCATCH;
}
if (remove)
{
GPosition this_pos=pos;
++pos;
threqs_list.del(this_pos);
} else ++pos;
}
}
GP<DjVuDocument::ThumbReq>
DjVuDocument::add_thumb_req(const GP<ThumbReq> & thumb_req)
// Will look through the list of pending requests for thumbnails
// and try to add the specified request. If a duplicate is found,
// it will be returned and the list will not be modified
{
GCriticalSectionLock lock(&threqs_lock);
for(GPosition pos=threqs_list;pos;++pos)
{
GP<ThumbReq> req=threqs_list[pos];
if (req->page_num==thumb_req->page_num)
return req;
}
threqs_list.append(thumb_req);
return thumb_req;
}
GList<GUTF8String>
DjVuDocument::get_id_list(void)
{
GList<GUTF8String> ids;
if (is_init_complete())
{
if(djvm_dir)
{
GPList<DjVmDir::File> files_list=djvm_dir->get_files_list();
for(GPosition pos=files_list;pos;++pos)
{
ids.append(files_list[pos]->get_load_name());
}
}else
{
const int page_num=get_pages_num();
for(int page=0;page<page_num;page++)
{
ids.append(page_to_url(page).fname());
}
}
}
return ids;
}
void
DjVuDocument::map_ids(GMap<GUTF8String,void *> &map)
{
GList<GUTF8String> ids=get_id_list();
for(GPosition pos=ids;pos;++pos)
{
map[ids[pos]]=0;
}
}
GP<DataPool>
DjVuDocument::get_thumbnail(int page_num, bool dont_decode)
{
DEBUG_MSG("DjVuDocument::get_thumbnail(): page_num=" << page_num << "\n");
DEBUG_MAKE_INDENT(3);
if (!is_init_complete()) return 0;
{
// See if we already have request for this thumbnail pending
GCriticalSectionLock lock(&threqs_lock);
for(GPosition pos=threqs_list;pos;++pos)
{
GP<ThumbReq> req=threqs_list[pos];
if (req->page_num==page_num)
return req->data_pool; // That's it. Just return it.
}
}
// No pending request for this page... Create one
GP<ThumbReq> thumb_req=new ThumbReq(page_num, DataPool::create());
// First try to find predecoded thumbnail
if (get_doc_type()==INDIRECT || get_doc_type()==BUNDLED)
{
// Predecoded thumbnails exist for new formats only
GPList<DjVmDir::File> files_list=djvm_dir->get_files_list();
GP<DjVmDir::File> thumb_file;
int thumb_start=0;
int page_cnt=-1;
for(GPosition pos=files_list;pos;++pos)
{
GP<DjVmDir::File> f=files_list[pos];
if (f->is_thumbnails())
{
thumb_file=f;
thumb_start=page_cnt+1;
} else if (f->is_page())
{
page_cnt++;
}
if (page_cnt==page_num) break;
}
if (thumb_file)
{
// That's the file with the desired thumbnail image
thumb_req->thumb_file=get_djvu_file(thumb_file->get_load_name());
thumb_req->thumb_chunk=page_num-thumb_start;
thumb_req=add_thumb_req(thumb_req);
process_threqs();
return thumb_req->data_pool;
}
}
// Apparently we're out of luck and need to decode the requested
// page (unless it's already done and if it's allowed) and render
// it into the thumbnail. If dont_decode is true, do not attempt
// to create this file (because this will result in a request for data)
GP<DjVuFile> file=get_djvu_file(page_num, dont_decode);
if (file)
{
thumb_req->image_file=file;
// I'm locking the flags here to make sure, that DjVuFile will not
// change its state in between of the checks.
GSafeFlags & file_flags=file->get_safe_flags();
{
GMonitorLock lock(&file_flags);
if (thumb_req->image_file->is_decode_ok() || !dont_decode)
{
// Just add it to the list and call process_threqs(). It
// will start decoding if necessary
thumb_req=add_thumb_req(thumb_req);
process_threqs();
} else
{
// Nothing can be done return ZERO
thumb_req=0;
}
}
} else thumb_req=0;
if (thumb_req) return thumb_req->data_pool;
else return 0;
}
static void
add_to_cache(const GP<DjVuFile> & f, GMap<GURL, void *> & map,
DjVuFileCache * cache)
{
GURL url=f->get_url();
DEBUG_MSG("DjVuDocument::add_to_cache(): url='" << url << "'\n");
DEBUG_MAKE_INDENT(3);
if (!map.contains(url))
{
map[url]=0;
cache->add_file(f);
GPList<DjVuFile> list;
for(GPosition pos=list;pos;++pos)
add_to_cache(list[pos], map, cache);
}
}
void
DjVuDocument::add_to_cache(const GP<DjVuFile> & f)
{
if (cache)
{
GMap<GURL, void *> map;
::add_to_cache(f, map, cache);
}
}
void
DjVuDocument::notify_file_flags_changed(const DjVuFile * source,
long set_mask, long clr_mask)
{
// Don't check here if the document is initialized or not.
// This function may be called when it's not.
// check();
if (set_mask & DjVuFile::DECODE_OK)
{
set_file_aliases(source);
if (cache) add_to_cache((DjVuFile *) source);
if(!needs_compression_flag)
{
if(source->needs_compression())
{
can_compress_flag=true;
needs_compression_flag=true;
}else if(source->can_compress())
{
can_compress_flag=true;
}
}
}
process_threqs();
}
GP<DjVuFile>
DjVuDocument::id_to_file(const DjVuPort * source, const GUTF8String &id)
{
return (DjVuFile *) get_djvu_file(id);
}
GP<DataPool>
DjVuDocument::request_data(const DjVuPort * source, const GURL & url)
{
DEBUG_MSG("DjVuDocument::request_data(): seeing if we can do it\n");
DEBUG_MAKE_INDENT(3);
if (url==init_url)
return init_data_pool;
check(); // Don't put it before 'init_data_pool'
{
// See if there is a file in the "UnnamedFiles" list.
// If it's there, then create an empty DataPool and store its
// pointer in the list. The "init thread" will eventually
// do smth with it.
GCriticalSectionLock lock(&ufiles_lock);
for(GPosition pos=ufiles_list;pos;++pos)
{
GP<UnnamedFile> f=ufiles_list[pos];
if (f->url==url)
{
DEBUG_MSG("Found tmp unnamed DjVuFile. Return empty DataPool\n");
// Remember the DataPool. We will connect it to the
// actual data after the document structure becomes known
f->data_pool=DataPool::create();
return f->data_pool;
}
}
}
// Well, the url is not in the "UnnamedFiles" list, but it doesn't
// mean, that it's not "artificial". Stay alert!
GP<DataPool> data_pool;
if (flags & DOC_TYPE_KNOWN)
switch(doc_type)
{
case OLD_BUNDLED:
{
if (flags & DOC_DIR_KNOWN)
{
DEBUG_MSG("The document is in OLD_BUNDLED format\n");
if (url.base()!=init_url)
G_THROW( ERR_MSG("DjVuDocument.URL_outside") "\t"+url.get_string());
GP<DjVmDir0::FileRec> file=djvm_dir0->get_file(url.fname());
if (!file)
{
G_THROW( ERR_MSG("DjVuDocument.file_outside") "\t"+url.fname());
}
data_pool=DataPool::create(init_data_pool, file->offset, file->size);
}
break;
}
case BUNDLED:
{
if (flags & DOC_DIR_KNOWN)
{
DEBUG_MSG("The document is in new BUNDLED format\n");
if (url.base()!=init_url)
{
G_THROW( ERR_MSG("DjVuDocument.URL_outside") "\t"
+url.get_string());
}
GP<DjVmDir::File> file=djvm_dir->id_to_file(url.fname());
if (!file)
{
G_THROW( ERR_MSG("DjVuDocument.file_outside") "\t"+url.fname());
}
data_pool=DataPool::create(init_data_pool, file->offset, file->size);
}
break;
}
case SINGLE_PAGE:
case OLD_INDEXED:
case INDIRECT:
{
DEBUG_MSG("The document is in SINGLE_PAGE or OLD_INDEXED or INDIRECT format\n");
if (flags & DOC_DIR_KNOWN)
if (doc_type==INDIRECT && !djvm_dir->id_to_file(url.fname()))
G_THROW( ERR_MSG("DjVuDocument.URL_outside2") "\t"+url.get_string());
if (url.is_local_file_url())
{
// GUTF8String fname=GOS::url_to_filename(url);
// if (GOS::basename(fname)=="-") fname="-";
DEBUG_MSG("url=" << url << "\n");
data_pool=DataPool::create(url);
}
}
}
return data_pool;
}
static void
add_file_to_djvm(const GP<DjVuFile> & file, bool page,
DjVmDoc & doc, GMap<GURL, void *> & map)
// This function is used only for obsolete formats.
// For new formats there is no need to process files recursively.
// All information is already available from the DJVM chunk
{
GURL url=file->get_url();
if (!map.contains(url))
{
map[url]=0;
if (file->get_chunks_number()>0 && !file->contains_chunk("NDIR"))
{
// Get the data and unlink any file containing NDIR chunk.
// Yes. We're lazy. We don't check if those files contain
// anything else.
GPosition pos;
GPList<DjVuFile> files_list=file->get_included_files(false);
GP<DataPool> data=file->get_djvu_data(false);
for(pos=files_list;pos;++pos)
{
GP<DjVuFile> f=files_list[pos];
if (f->contains_chunk("NDIR"))
data=DjVuFile::unlink_file(data, f->get_url().fname());
}
// Finally add it to the document
GUTF8String name=file->get_url().fname();
GP<DjVmDir::File> file_rec=DjVmDir::File::create(
name, name, name,
page ? DjVmDir::File::PAGE : DjVmDir::File::INCLUDE );
doc.insert_file(file_rec, data, -1);
// And repeat for all included files
for(pos=files_list;pos;++pos)
add_file_to_djvm(files_list[pos], false, doc, map);
}
}
}
static void
add_file_to_djvm(const GP<DjVuFile> & file, bool page,
DjVmDoc & doc, GMap<GURL, void *> & map,
bool &needs_compression_flag, bool &can_compress_flag )
{
if(!needs_compression_flag)
{
if(file->needs_compression())
{
can_compress_flag=true;
needs_compression_flag=true;
}else if(file->can_compress())
{
can_compress_flag=true;
}
}
add_file_to_djvm(file,page,doc,map);
}
static void
local_get_url_names(DjVuFile * f,const GMap<GURL, void *> & map,GMap<GURL,void *> &tmpmap)
{
GURL url=f->get_url();
if (!map.contains(url) && !tmpmap.contains(url))
{
tmpmap[url]=0;
f->process_incl_chunks();
GPList<DjVuFile> files_list=f->get_included_files(false);
for(GPosition pos=files_list;pos;++pos)
local_get_url_names(files_list[pos], map, tmpmap);
}
}
static void
local_get_url_names(DjVuFile * f, GMap<GURL, void *> & map)
{
GMap<GURL,void *> tmpmap;
local_get_url_names(f,map,tmpmap);
for(GPosition pos=tmpmap;pos;++pos)
map[tmpmap.key(pos)]=0;
}
GList<GURL>
DjVuDocument::get_url_names(void)
{
check();
GCriticalSectionLock lock(&url_names_lock);
if(has_url_names)
return url_names;
GMap<GURL, void *> map;
int i;
if (doc_type==BUNDLED || doc_type==INDIRECT)
{
GPList<DjVmDir::File> files_list=djvm_dir->get_files_list();
for(GPosition pos=files_list;pos;++pos)
{
GURL url=id_to_url(files_list[pos]->get_load_name());
map[url]=0;
}
}else
{
int pages_num=get_pages_num();
for(i=0;i<pages_num;i++)
{
G_TRY
{
local_get_url_names(get_djvu_file(i), map);
}
G_CATCH(ex)
{
// Why is this try/catch block here?
G_TRY {
get_portcaster()->notify_error(this, ex.get_cause());
GUTF8String emsg = ERR_MSG("DjVuDocument.exclude_page") "\t" + GUTF8String(i+1);
get_portcaster()->notify_error(this, emsg);
}
G_CATCH_ALL
{
G_RETHROW;
}
G_ENDCATCH;
}
G_ENDCATCH;
}
}
for(GPosition j=map;j;++j)
{
if (map.key(j).is_local_file_url())
{
url_names.append(map.key(j));
}
}
has_url_names=true;
return url_names;
}
GP<DjVmDoc>
DjVuDocument::get_djvm_doc()
// This function may block for data
{
check();
DEBUG_MSG("DjVuDocument::get_djvm_doc(): creating the DjVmDoc\n");
DEBUG_MAKE_INDENT(3);
if (!is_init_complete())
G_THROW( ERR_MSG("DjVuDocument.init_not_done") );
GP<DjVmDoc> doc=DjVmDoc::create();
if (doc_type==BUNDLED || doc_type==INDIRECT)
{
GPList<DjVmDir::File> files_list=djvm_dir->get_files_list();
for(GPosition pos=files_list;pos;++pos)
{
GP<DjVmDir::File> f=new DjVmDir::File(*files_list[pos]);
GP<DjVuFile> file=url_to_file(id_to_url(f->get_load_name()));
GP<DataPool> data;
if (file->is_modified())
data=file->get_djvu_data(false);
else
data=file->get_init_data_pool();
doc->insert_file(f, data);
}
if (djvm_nav)
doc->set_djvm_nav(djvm_nav);
}
else if (doc_type==SINGLE_PAGE)
{
DEBUG_MSG("Creating: djvm for a single page document.\n");
GMap<GURL, void *> map_add;
GP<DjVuFile> file=get_djvu_file(0);
add_file_to_djvm(file, true, *doc, map_add,
needs_compression_flag,can_compress_flag);
}
else
{
DEBUG_MSG("Converting: the document is in an old format.\n");
GMap<GURL, void *> map_add;
if(recover_errors == ABORT)
{
for(int page_num=0;page_num<ndir->get_pages_num();page_num++)
{
GP<DjVuFile> file=url_to_file(ndir->page_to_url(page_num));
add_file_to_djvm(file, true, *doc, map_add,
needs_compression_flag,can_compress_flag);
}
}
else
{
for(int page_num=0;page_num<ndir->get_pages_num();page_num++)
{
G_TRY
{
GP<DjVuFile> file=url_to_file(ndir->page_to_url(page_num));
add_file_to_djvm(file, true, *doc, map_add,
needs_compression_flag,can_compress_flag);
}
G_CATCH(ex)
{
G_TRY {
get_portcaster()->notify_error(this, ex.get_cause());
GUTF8String emsg = ERR_MSG("DjVuDocument.skip_page") "\t"
+ GUTF8String(page_num+1);
get_portcaster()->notify_error(this, emsg);
}
G_CATCH_ALL
{
G_RETHROW;
}
G_ENDCATCH;
}
G_ENDCATCH;
}
}
}
return doc;
}
void
DjVuDocument::write( const GP<ByteStream> &gstr,
const GMap<GUTF8String,void *> &reserved)
{
DEBUG_MSG("DjVuDocument::write(): storing DjVmDoc into ByteStream\n");
DEBUG_MAKE_INDENT(3);
get_djvm_doc()->write(gstr,reserved);
}
void
DjVuDocument::write(const GP<ByteStream> &gstr, bool force_djvm)
{
DEBUG_MSG("DjVuDocument::write(): storing DjVmDoc into ByteStream\n");
DEBUG_MAKE_INDENT(3);
GP<DjVmDoc> doc=get_djvm_doc();
GP<DjVmDir> dir=doc->get_djvm_dir();
bool singlepage = (dir->get_files_num()==1 && !djvm_nav && !force_djvm);
if (singlepage)
{
// maybe save as single page
DjVmDir::File *file = dir->page_to_file(0);
if (file->get_title() != file->get_load_name())
singlepage = false;
}
if (! singlepage)
{
doc->write(gstr);
}
else
{
GPList<DjVmDir::File> files_list=dir->resolve_duplicates(false);
GP<DataPool> pool=doc->get_data(files_list[files_list]->get_load_name());
GP<ByteStream> pool_str=pool->get_stream();
ByteStream &str=*gstr;
str.writall(octets,4);
str.copy(*pool_str);
}
}
void
DjVuDocument::expand(const GURL &codebase, const GUTF8String &idx_name)
{
DEBUG_MSG("DjVuDocument::expand(): codebase='" << codebase << "'\n");
DEBUG_MAKE_INDENT(3);
GP<DjVmDoc> doc=get_djvm_doc();
doc->expand(codebase, idx_name);
}
void
DjVuDocument::save_as(const GURL &where, bool bundled)
{
DEBUG_MSG("DjVuDocument::save_as(): where='" << where <<
"', bundled=" << bundled << "\n");
DEBUG_MAKE_INDENT(3);
if (needs_compression())
{
if(!djvu_compress_codec)
{
G_THROW( ERR_MSG("DjVuDocument.comp_codec") );
}
GP<ByteStream> gmbs=ByteStream::create();
write(gmbs);
ByteStream &mbs=*gmbs;
mbs.flush();
mbs.seek(0,SEEK_SET);
(*djvu_compress_codec)(gmbs,where,bundled);
}else if (bundled)
{
DataPool::load_file(where);
write(ByteStream::create(where, "wb"));
} else
{
expand(where.base(), where.fname());
}
}
static const char prolog[]="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE DjVuXML PUBLIC \"-//W3C//DTD DjVuXML 1.1//EN\" \"pubtext/DjVuXML-s.dtd\">\n<DjVuXML>\n<HEAD>";
static const char start_xml[]="</HEAD>\n<BODY>\n";
static const char end_xml[]="</BODY>\n</DjVuXML>\n";
void
DjVuDocument::writeDjVuXML(const GP<ByteStream> &gstr_out,
int flags, int page) const
{
ByteStream &str_out=*gstr_out;
str_out.writestring(
prolog+get_init_url().get_string().toEscaped()+start_xml);
const int pages=wait_get_pages_num();
int pstart = (page < 0) ? 0 : page;
int pend = (page < 0) ? pages : page+1;
for(int page_num=pstart; page_num<pend; ++page_num)
{
const GP<DjVuImage> dimg(get_page(page_num,true));
if(!dimg)
{
G_THROW( ERR_MSG("DjVuToText.decode_failed") );
}
dimg->writeXML(str_out,get_init_url(),flags);
}
str_out.writestring(GUTF8String(end_xml));
}
#ifdef HAVE_NAMESPACES
}
# ifndef NOT_USING_DJVU_NAMESPACE
using namespace DJVU;
# endif
#endif
| 29.446343 | 176 | 0.608145 | eadordzhiev |
80cc82c4ba7e1394b737e9be368d245622335d3c | 17,386 | cpp | C++ | tests/cpu/ParseUtils_tests.cpp | kartik1000/OpenColorIO | 9d6089faaae5f69d94fe73ac25f336d04216abb1 | [
"BSD-3-Clause"
] | null | null | null | tests/cpu/ParseUtils_tests.cpp | kartik1000/OpenColorIO | 9d6089faaae5f69d94fe73ac25f336d04216abb1 | [
"BSD-3-Clause"
] | 1 | 2020-06-12T19:10:09.000Z | 2020-06-12T19:10:09.000Z | tests/cpu/ParseUtils_tests.cpp | kartik1000/OpenColorIO | 9d6089faaae5f69d94fe73ac25f336d04216abb1 | [
"BSD-3-Clause"
] | null | null | null | // SPDX-License-Identifier: BSD-3-Clause
// Copyright Contributors to the OpenColorIO Project.
#include "ParseUtils.cpp"
#include "UnitTest.h"
namespace OCIO = OCIO_NAMESPACE;
OCIO_ADD_TEST(ParseUtils, xml_text)
{
const std::string in("abc \" def ' ghi < jkl > mnop & efg");
const std::string ref("abc " def ' ghi < jkl > mnop & efg");
std::string out = OCIO::ConvertSpecialCharToXmlToken(in);
OCIO_CHECK_EQUAL(out, ref);
std::string back = OCIO::ConvertXmlTokenToSpecialChar(ref);
OCIO_CHECK_EQUAL(back, in);
}
OCIO_ADD_TEST(ParseUtils, bool_string)
{
std::string resStr = OCIO::BoolToString(true);
OCIO_CHECK_EQUAL("true", resStr);
resStr = OCIO::BoolToString(false);
OCIO_CHECK_EQUAL("false", resStr);
bool resBool = OCIO::BoolFromString("yes");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("Yes");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("YES");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("YeS");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("yEs");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("true");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("TRUE");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("True");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("tRUe");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("tRUE");
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BoolFromString("yes ");
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BoolFromString(" true ");
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BoolFromString("false");
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BoolFromString("");
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BoolFromString("no");
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BoolFromString("valid");
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BoolFromString("success");
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BoolFromString("anything");
OCIO_CHECK_EQUAL(false, resBool);
}
OCIO_ADD_TEST(ParseUtils, transform_direction)
{
std::string resStr;
resStr = OCIO::TransformDirectionToString(OCIO::TRANSFORM_DIR_FORWARD);
OCIO_CHECK_EQUAL("forward", resStr);
resStr = OCIO::TransformDirectionToString(OCIO::TRANSFORM_DIR_INVERSE);
OCIO_CHECK_EQUAL("inverse", resStr);
resStr = OCIO::TransformDirectionToString(OCIO::TRANSFORM_DIR_UNKNOWN);
OCIO_CHECK_EQUAL("unknown", resStr);
OCIO::TransformDirection resDir;
resDir = OCIO::TransformDirectionFromString("forward");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_FORWARD, resDir);
resDir = OCIO::TransformDirectionFromString("inverse");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_INVERSE, resDir);
resDir = OCIO::TransformDirectionFromString("Forward");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_FORWARD, resDir);
resDir = OCIO::TransformDirectionFromString("Inverse");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_INVERSE, resDir);
resDir = OCIO::TransformDirectionFromString("FORWARD");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_FORWARD, resDir);
resDir = OCIO::TransformDirectionFromString("INVERSE");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_INVERSE, resDir);
resDir = OCIO::TransformDirectionFromString("unknown");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_UNKNOWN, resDir);
resDir = OCIO::TransformDirectionFromString("");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_UNKNOWN, resDir);
resDir = OCIO::TransformDirectionFromString("anything");
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_UNKNOWN, resDir);
resDir = OCIO::CombineTransformDirections(OCIO::TRANSFORM_DIR_UNKNOWN,
OCIO::TRANSFORM_DIR_FORWARD);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_UNKNOWN, resDir);
resDir = OCIO::CombineTransformDirections(OCIO::TRANSFORM_DIR_INVERSE,
OCIO::TRANSFORM_DIR_UNKNOWN);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_UNKNOWN, resDir);
resDir = OCIO::CombineTransformDirections(OCIO::TRANSFORM_DIR_UNKNOWN,
OCIO::TRANSFORM_DIR_UNKNOWN);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_UNKNOWN, resDir);
resDir = OCIO::CombineTransformDirections(OCIO::TRANSFORM_DIR_INVERSE,
OCIO::TRANSFORM_DIR_INVERSE);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_FORWARD, resDir);
resDir = OCIO::CombineTransformDirections(OCIO::TRANSFORM_DIR_FORWARD,
OCIO::TRANSFORM_DIR_FORWARD);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_FORWARD, resDir);
resDir = OCIO::CombineTransformDirections(OCIO::TRANSFORM_DIR_INVERSE,
OCIO::TRANSFORM_DIR_FORWARD);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_INVERSE, resDir);
resDir = OCIO::CombineTransformDirections(OCIO::TRANSFORM_DIR_FORWARD,
OCIO::TRANSFORM_DIR_INVERSE);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_INVERSE, resDir);
resDir = OCIO::GetInverseTransformDirection(OCIO::TRANSFORM_DIR_UNKNOWN);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_UNKNOWN, resDir);
resDir = OCIO::GetInverseTransformDirection(OCIO::TRANSFORM_DIR_INVERSE);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_FORWARD, resDir);
resDir = OCIO::GetInverseTransformDirection(OCIO::TRANSFORM_DIR_FORWARD);
OCIO_CHECK_EQUAL(OCIO::TRANSFORM_DIR_INVERSE, resDir);
}
OCIO_ADD_TEST(ParseUtils, color_space)
{
std::string resStr;
resStr = OCIO::ColorSpaceDirectionToString(OCIO::COLORSPACE_DIR_TO_REFERENCE);
OCIO_CHECK_EQUAL("to_reference", resStr);
resStr = OCIO::ColorSpaceDirectionToString(OCIO::COLORSPACE_DIR_FROM_REFERENCE);
OCIO_CHECK_EQUAL("from_reference", resStr);
resStr = OCIO::ColorSpaceDirectionToString(OCIO::COLORSPACE_DIR_UNKNOWN);
OCIO_CHECK_EQUAL("unknown", resStr);
OCIO::ColorSpaceDirection resCSD;
resCSD = OCIO::ColorSpaceDirectionFromString("to_reference");
OCIO_CHECK_EQUAL(OCIO::COLORSPACE_DIR_TO_REFERENCE, resCSD);
resCSD = OCIO::ColorSpaceDirectionFromString("from_reference");
OCIO_CHECK_EQUAL(OCIO::COLORSPACE_DIR_FROM_REFERENCE, resCSD);
resCSD = OCIO::ColorSpaceDirectionFromString("unkwon");
OCIO_CHECK_EQUAL(OCIO::COLORSPACE_DIR_UNKNOWN, resCSD);
resCSD = OCIO::ColorSpaceDirectionFromString("");
OCIO_CHECK_EQUAL(OCIO::COLORSPACE_DIR_UNKNOWN, resCSD);
}
OCIO_ADD_TEST(ParseUtils, bitdepth)
{
std::string resStr;
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_UINT8);
OCIO_CHECK_EQUAL("8ui", resStr);
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_UINT10);
OCIO_CHECK_EQUAL("10ui", resStr);
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_UINT12);
OCIO_CHECK_EQUAL("12ui", resStr);
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_UINT14);
OCIO_CHECK_EQUAL("14ui", resStr);
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_UINT16);
OCIO_CHECK_EQUAL("16ui", resStr);
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_UINT32);
OCIO_CHECK_EQUAL("32ui", resStr);
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_F16);
OCIO_CHECK_EQUAL("16f", resStr);
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_F32);
OCIO_CHECK_EQUAL("32f", resStr);
resStr = OCIO::BitDepthToString(OCIO::BIT_DEPTH_UNKNOWN);
OCIO_CHECK_EQUAL("unknown", resStr);
OCIO::BitDepth resBD;
resBD = OCIO::BitDepthFromString("8ui");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT8, resBD);
resBD = OCIO::BitDepthFromString("8Ui");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT8, resBD);
resBD = OCIO::BitDepthFromString("8UI");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT8, resBD);
resBD = OCIO::BitDepthFromString("8uI");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT8, resBD);
resBD = OCIO::BitDepthFromString("10ui");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT10, resBD);
resBD = OCIO::BitDepthFromString("12ui");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT12, resBD);
resBD = OCIO::BitDepthFromString("14ui");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT14, resBD);
resBD = OCIO::BitDepthFromString("16ui");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT16, resBD);
resBD = OCIO::BitDepthFromString("32ui");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UINT32, resBD);
resBD = OCIO::BitDepthFromString("16f");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_F16, resBD);
resBD = OCIO::BitDepthFromString("32f");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_F32, resBD);
resBD = OCIO::BitDepthFromString("7ui");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UNKNOWN, resBD);
resBD = OCIO::BitDepthFromString("unknown");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UNKNOWN, resBD);
resBD = OCIO::BitDepthFromString("");
OCIO_CHECK_EQUAL(OCIO::BIT_DEPTH_UNKNOWN, resBD);
bool resBool;
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_F16);
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_F32);
OCIO_CHECK_EQUAL(true, resBool);
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_UINT8);
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_UINT10);
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_UINT12);
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_UINT14);
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_UINT16);
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_UINT32);
OCIO_CHECK_EQUAL(false, resBool);
resBool = OCIO::BitDepthIsFloat(OCIO::BIT_DEPTH_UNKNOWN);
OCIO_CHECK_EQUAL(false, resBool);
int resInt;
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_UINT8);
OCIO_CHECK_EQUAL(8, resInt);
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_UINT10);
OCIO_CHECK_EQUAL(10, resInt);
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_UINT12);
OCIO_CHECK_EQUAL(12, resInt);
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_UINT14);
OCIO_CHECK_EQUAL(14, resInt);
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_UINT16);
OCIO_CHECK_EQUAL(16, resInt);
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_UINT32);
OCIO_CHECK_EQUAL(32, resInt);
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_F16);
OCIO_CHECK_EQUAL(0, resInt);
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_F32);
OCIO_CHECK_EQUAL(0, resInt);
resInt = OCIO::BitDepthToInt(OCIO::BIT_DEPTH_UNKNOWN);
OCIO_CHECK_EQUAL(0, resInt);
}
OCIO_ADD_TEST(ParseUtils, string_to_int)
{
int ival = 0;
bool success = false;
success = OCIO::StringToInt(&ival, "", false);
OCIO_CHECK_EQUAL(success, false);
success = OCIO::StringToInt(&ival, "9", false);
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(ival, 9);
success = OCIO::StringToInt(&ival, " 10 ", false);
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(ival, 10);
success = OCIO::StringToInt(&ival, " 101", true);
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(ival, 101);
success = OCIO::StringToInt(&ival, " 11x ", false);
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(ival, 11);
success = OCIO::StringToInt(&ival, " 12x ", true);
OCIO_CHECK_EQUAL(success, false);
success = OCIO::StringToInt(&ival, "13", true);
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(ival, 13);
success = OCIO::StringToInt(&ival, "-14", true);
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(ival, -14);
success = OCIO::StringToInt(&ival, "x-15", false);
OCIO_CHECK_EQUAL(success, false);
success = OCIO::StringToInt(&ival, "x-16", false);
OCIO_CHECK_EQUAL(success, false);
}
OCIO_ADD_TEST(ParseUtils, string_to_float)
{
float fval = 0;
bool success = false;
success = OCIO::StringToFloat(&fval, "");
OCIO_CHECK_EQUAL(success, false);
success = OCIO::StringToFloat(&fval, "1.0");
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(fval, 1.0f);
success = OCIO::StringToFloat(&fval, "1");
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(fval, 1.0f);
success = OCIO::StringToFloat(&fval, "a1");
OCIO_CHECK_EQUAL(success, false);
success = OCIO::StringToFloat(&fval,
"1 do we really want this to succeed?");
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(fval, 1.0f);
success = OCIO::StringToFloat(&fval, "1Success");
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(fval, 1.0f);
success = OCIO::StringToFloat(&fval,
"1.0000000000000000000000000000000000000000000001");
OCIO_CHECK_EQUAL(success, true);
OCIO_CHECK_EQUAL(fval, 1.0f);
}
OCIO_ADD_TEST(ParseUtils, float_double)
{
std::string resStr;
resStr = OCIO::FloatToString(0.0f);
OCIO_CHECK_EQUAL("0", resStr);
resStr = OCIO::FloatToString(0.1111001f);
OCIO_CHECK_EQUAL("0.1111001", resStr);
resStr = OCIO::FloatToString(0.11000001f);
OCIO_CHECK_EQUAL("0.11", resStr);
resStr = OCIO::DoubleToString(0.11000001);
OCIO_CHECK_EQUAL("0.11000001", resStr);
resStr = OCIO::DoubleToString(0.1100000000000001);
OCIO_CHECK_EQUAL("0.1100000000000001", resStr);
resStr = OCIO::DoubleToString(0.11000000000000001);
OCIO_CHECK_EQUAL("0.11", resStr);
}
OCIO_ADD_TEST(ParseUtils, string_vec_to_int_vec)
{
std::vector<int> intArray;
OCIO::StringVec lineParts;
bool success = OCIO::StringVecToIntVec(intArray, lineParts);
OCIO_CHECK_EQUAL(true, success);
OCIO_CHECK_EQUAL(0, intArray.size());
lineParts.push_back("42");
lineParts.push_back("");
success = OCIO::StringVecToIntVec(intArray, lineParts);
OCIO_CHECK_EQUAL(false, success);
OCIO_CHECK_EQUAL(2, intArray.size());
intArray.clear();
lineParts.clear();
lineParts.push_back("42");
lineParts.push_back("0");
success = OCIO::StringVecToIntVec(intArray, lineParts);
OCIO_CHECK_EQUAL(true, success);
OCIO_CHECK_EQUAL(2, intArray.size());
OCIO_CHECK_EQUAL(42, intArray[0]);
OCIO_CHECK_EQUAL(0, intArray[1]);
intArray.clear();
lineParts.clear();
lineParts.push_back("42");
lineParts.push_back("021");
success = OCIO::StringVecToIntVec(intArray, lineParts);
OCIO_CHECK_EQUAL(true, success);
OCIO_CHECK_EQUAL(2, intArray.size());
OCIO_CHECK_EQUAL(42, intArray[0]);
OCIO_CHECK_EQUAL(21, intArray[1]);
intArray.clear();
lineParts.clear();
lineParts.push_back("42");
lineParts.push_back("0x21");
success = OCIO::StringVecToIntVec(intArray, lineParts);
OCIO_CHECK_EQUAL(false, success);
OCIO_CHECK_EQUAL(2, intArray.size());
intArray.clear();
lineParts.clear();
lineParts.push_back("42u");
lineParts.push_back("21");
success = OCIO::StringVecToIntVec(intArray, lineParts);
OCIO_CHECK_EQUAL(false, success);
OCIO_CHECK_EQUAL(2, intArray.size());
}
OCIO_ADD_TEST(ParseUtils, split_string_env_style)
{
OCIO::StringVec outputvec;
OCIO::SplitStringEnvStyle(outputvec, "This:is:a:test");
OCIO_CHECK_EQUAL(4, outputvec.size());
OCIO_CHECK_EQUAL("This", outputvec[0]);
OCIO_CHECK_EQUAL("is", outputvec[1]);
OCIO_CHECK_EQUAL("a", outputvec[2]);
OCIO_CHECK_EQUAL("test", outputvec[3]);
outputvec.clear();
OCIO::SplitStringEnvStyle(outputvec, " This : is : a: test ");
OCIO_CHECK_EQUAL(4, outputvec.size());
OCIO_CHECK_EQUAL("This", outputvec[0]);
OCIO_CHECK_EQUAL("is", outputvec[1]);
OCIO_CHECK_EQUAL("a", outputvec[2]);
OCIO_CHECK_EQUAL("test", outputvec[3]);
outputvec.clear();
OCIO::SplitStringEnvStyle(outputvec, " This , is , a, test ");
OCIO_CHECK_EQUAL(4, outputvec.size());
OCIO_CHECK_EQUAL("This", outputvec[0]);
OCIO_CHECK_EQUAL("is", outputvec[1]);
OCIO_CHECK_EQUAL("a", outputvec[2]);
OCIO_CHECK_EQUAL("test", outputvec[3]);
outputvec.clear();
OCIO::SplitStringEnvStyle(outputvec, "This:is , a:test ");
OCIO_CHECK_EQUAL(2, outputvec.size());
OCIO_CHECK_EQUAL("This:is", outputvec[0]);
OCIO_CHECK_EQUAL("a:test", outputvec[1]);
outputvec.clear();
OCIO::SplitStringEnvStyle(outputvec, ",,");
OCIO_CHECK_EQUAL(3, outputvec.size());
OCIO_CHECK_EQUAL("", outputvec[0]);
OCIO_CHECK_EQUAL("", outputvec[1]);
OCIO_CHECK_EQUAL("", outputvec[2]);
}
OCIO_ADD_TEST(ParseUtils, intersect_string_vecs_case_ignore)
{
OCIO::StringVec source1;
OCIO::StringVec source2;
source1.push_back("111");
source1.push_back("This");
source1.push_back("is");
source1.push_back("222");
source1.push_back("a");
source1.push_back("test");
source2.push_back("333");
source2.push_back("TesT");
source2.push_back("this");
source2.push_back("444");
source2.push_back("a");
source2.push_back("IS");
OCIO::StringVec resInter = OCIO::IntersectStringVecsCaseIgnore(source1, source2);
OCIO_CHECK_EQUAL(4, resInter.size());
OCIO_CHECK_EQUAL("This", resInter[0]);
OCIO_CHECK_EQUAL("is", resInter[1]);
OCIO_CHECK_EQUAL("a", resInter[2]);
OCIO_CHECK_EQUAL("test", resInter[3]);
}
| 36.220833 | 85 | 0.702979 | kartik1000 |
80d3611d33fade77f36797e37b841fe48c50b679 | 3,084 | cpp | C++ | src/dist/topology.cpp | cbassem/resilient-icnc | 9f94b185358f2af133244fc8c877190bd15ed413 | [
"BSD-3-Clause"
] | null | null | null | src/dist/topology.cpp | cbassem/resilient-icnc | 9f94b185358f2af133244fc8c877190bd15ed413 | [
"BSD-3-Clause"
] | null | null | null | src/dist/topology.cpp | cbassem/resilient-icnc | 9f94b185358f2af133244fc8c877190bd15ed413 | [
"BSD-3-Clause"
] | null | null | null | /* *******************************************************************************
* Copyright (c) 2010-2014, Intel Corporation
*
* 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.
* * Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
********************************************************************************/
#include "src/dist/topology.h"
#include <iostream>
namespace CnC {
namespace Internal {
void topology::init_ring(int n, int myrank){
// std::cerr << "n = " << n << std::endl;
// std::cerr << "myrank = " << myrank << std::endl;
a.clear();
edges.clear();
edges.resize(n);
if (n < 16){
for (int i = 0; i < n; i++){
for (int j = 0; j < n; j++) if (i!=j){
edges[i].push_back(j);
}
}
} else {
for (int i = 0; i < n; i++){
edges[i].push_back((i+1)%n);
edges[(i+1)%n].push_back(i);
}
int l = 0;
int r = n;
for (;r-l>1;){
int m = (l+r)/2;
if (m*m>n) r = m;
else l = m;
}
for (int i = 0; i < n; i++){
for (int j = 1; j*l < n; j++){
edges[i].push_back((i+j*l)%n);
}
}
}
for (int i = 0; i < static_cast<int>(edges[myrank].size()); i++){
a.push_back(edges[myrank][i]);
}
}
} // namespace Internal
} // namespace CnC
| 42.246575 | 82 | 0.530156 | cbassem |
80d6c3c5f9a375b04891a005ad03dde5c82aaa65 | 1,033 | cpp | C++ | src/ieme/raw_fraction.test.cpp | Adjacence/Ieme | be411b0a5d6048c7f6f3213e199ab982e0040ce7 | [
"MIT"
] | null | null | null | src/ieme/raw_fraction.test.cpp | Adjacence/Ieme | be411b0a5d6048c7f6f3213e199ab982e0040ce7 | [
"MIT"
] | null | null | null | src/ieme/raw_fraction.test.cpp | Adjacence/Ieme | be411b0a5d6048c7f6f3213e199ab982e0040ce7 | [
"MIT"
] | null | null | null | #define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include <ieme/raw_fraction.hpp>
using namespace ieme;
TEST_CASE("A raw fraction can be constructed from a numerator and denominator",
"[raw_fraction]")
{
const auto rf = raw_fraction(34, -21);
REQUIRE(rf.numerator == 34);
REQUIRE(rf.denominator == -21);
}
TEST_CASE("A raw fraction can be constructed from a different raw fraction "
"with a different representation type",
"[raw_fraction]")
{
const auto rf = raw_fraction<long long>(raw_fraction(-54, 47));
REQUIRE(rf.numerator == -54);
REQUIRE(rf.denominator == 47);
}
TEST_CASE("A raw fraction can be serialized", "[raw_fraction]")
{
const auto rf = raw_fraction(-5, 7);
std::ostringstream stream;
stream << rf;
REQUIRE(stream.str() == "-5/7");
}
TEST_CASE("A raw fraction can be deserialized", "[raw_fraction]")
{
std::istringstream stream {" -5 / 7 "};
raw_fraction<int> rf;
stream >> rf;
REQUIRE(rf.numerator == -5);
REQUIRE(rf.denominator == 7);
}
| 21.081633 | 79 | 0.666989 | Adjacence |
80d7c8e1e3e7056cfefc53dc281bc1eff730d850 | 1,162 | cpp | C++ | data_struct/sort/shell_sort.cpp | AMDyesIntelno/c_cpp_code | 972b452976a67be0c9c1fdac8caffa4baf00c5cf | [
"MIT"
] | null | null | null | data_struct/sort/shell_sort.cpp | AMDyesIntelno/c_cpp_code | 972b452976a67be0c9c1fdac8caffa4baf00c5cf | [
"MIT"
] | null | null | null | data_struct/sort/shell_sort.cpp | AMDyesIntelno/c_cpp_code | 972b452976a67be0c9c1fdac8caffa4baf00c5cf | [
"MIT"
] | null | null | null | #include"shell_sort.h"
void shell_sort(int *array, int len) {//希尔排序
for (int shell = len / 2; shell > 0; shell /= 2) {//切片
for (int i = shell; i < len; ++i) {//片后递增
int j;
int temp = array[i];
for (j = i; j >= shell && array[j - shell] > temp; j -= shell) {//修改为部分片段有序
array[j] = array[j - shell];
}
array[j] = temp;
}
}
return;
/*
例子
87654321
第一次切片 8765 | 4321
修改为部分片段有序 4321 | 8765
第二次切片 43 | 21 | 87 | 65
修改为部分片段有序
1.比较21的片段和43的片段并尝试替换
21 | 43 | 87 | 65
2.比较21,43的片段和87的片段并尝试替换
21 | 43 | 87 | 65
3.比较21,43,87的片段和65的片段并尝试替换
21 | 43 | 65 | 87
第三次切片 2 | 1 | 4 | 3 | 6 | 5 | 8 | 7
修改为部分片段有序
1.比较2和1并尝试替换
1 | 2 | 4 | 3 | 6 | 5 | 8 | 7
2.比较1,2和4并尝试替换
1 | 2 | 4 | 3 | 6 | 5 | 8 | 7
3.比较1,2,4和3并尝试替换
1 | 2 | 3 | 4 | 6 | 5 | 8 | 7
4.比较1,2,3,4和6并尝试替换
1 | 2 | 3 | 4 | 6 | 5 | 8 | 7
5.比较1,2,3,4,6和5并尝试替换
1 | 2 | 3 | 4 | 5 | 6 | 8 | 7
6.比较1,2,3,4,5,6和8并尝试替换
1 | 2 | 3 | 4 | 5 | 6 | 8 | 7
7.比较1,2,3,4,5,6,8和7并尝试替换
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
*/
} | 25.822222 | 87 | 0.444062 | AMDyesIntelno |
80d8653295e044ee07bbb17b96bf6d26500cff9d | 5,587 | cc | C++ | cpp_src/net/connection.cc | andyoknen/reindexer | ff1b2bcc0a80c4692361c9c184243d74a920ead7 | [
"Apache-2.0"
] | null | null | null | cpp_src/net/connection.cc | andyoknen/reindexer | ff1b2bcc0a80c4692361c9c184243d74a920ead7 | [
"Apache-2.0"
] | null | null | null | cpp_src/net/connection.cc | andyoknen/reindexer | ff1b2bcc0a80c4692361c9c184243d74a920ead7 | [
"Apache-2.0"
] | null | null | null |
#include "connection.h"
#include <errno.h>
namespace reindexer {
namespace net {
constexpr double kStatsUpdatePeriod = 1.0;
template <typename Mutex>
Connection<Mutex>::Connection(int fd, ev::dynamic_loop &loop, bool enableStat, size_t readBufSize, size_t writeBufSize)
: sock_(fd), curEvents_(0), wrBuf_(writeBufSize), rdBuf_(readBufSize) {
attach(loop);
if (enableStat) {
stat_ = std::make_shared<ConnectionStat>();
statsUpdater_.start(kStatsUpdatePeriod, kStatsUpdatePeriod);
}
}
template <typename Mutex>
Connection<Mutex>::~Connection() {
if (sock_.valid()) {
io_.stop();
sock_.close();
}
}
template <typename Mutex>
void Connection<Mutex>::restart(int fd) {
assert(!sock_.valid());
sock_ = fd;
wrBuf_.clear();
rdBuf_.clear();
curEvents_ = 0;
closeConn_ = false;
if (stat_) {
stat_.reset(new ConnectionStat());
prevSecSentBytes_ = 0;
prevSecRecvBytes_ = 0;
statsUpdater_.start(kStatsUpdatePeriod, kStatsUpdatePeriod);
}
}
template <typename Mutex>
void Connection<Mutex>::attach(ev::dynamic_loop &loop) {
assert(!attached_);
io_.set<Connection, &Connection::callback>(this);
io_.set(loop);
if (sock_.valid()) {
if (curEvents_) io_.start(sock_.fd(), curEvents_);
clientAddr_ = sock_.addr();
}
timeout_.set<Connection, &Connection::timeout_cb>(this);
timeout_.set(loop);
async_.set<Connection, &Connection::async_cb>(this);
async_.set(loop);
statsUpdater_.set<Connection, &Connection::stats_check_cb>(this);
statsUpdater_.set(loop);
attached_ = true;
}
template <typename Mutex>
void Connection<Mutex>::detach() {
assert(attached_);
io_.stop();
io_.reset();
timeout_.stop();
timeout_.reset();
async_.stop();
async_.reset();
statsUpdater_.stop();
statsUpdater_.reset();
attached_ = false;
}
template <typename Mutex>
void Connection<Mutex>::closeConn() {
io_.loop.break_loop();
if (sock_.valid()) {
io_.stop();
sock_.close();
}
timeout_.stop();
async_.stop();
statsUpdater_.stop();
onClose();
closeConn_ = false;
}
// Generic callback
template <typename Mutex>
void Connection<Mutex>::callback(ev::io & /*watcher*/, int revents) {
if (ev::ERROR & revents) return;
if (revents & ev::READ) {
read_cb();
revents |= ev::WRITE;
}
if (revents & ev::WRITE) {
canWrite_ = true;
write_cb();
}
int nevents = ev::READ | (wrBuf_.size() ? ev::WRITE : 0);
if (curEvents_ != nevents && sock_.valid()) {
(curEvents_) ? io_.set(nevents) : io_.start(sock_.fd(), nevents);
curEvents_ = nevents;
}
}
// Socket is writable
template <typename Mutex>
void Connection<Mutex>::write_cb() {
while (wrBuf_.size()) {
auto chunks = wrBuf_.tail();
constexpr size_t kMaxWriteChuncks = 1024;
if (chunks.size() > kMaxWriteChuncks) {
chunks = chunks.subspan(0, kMaxWriteChuncks);
}
ssize_t written = sock_.send(chunks);
int err = sock_.last_error();
if (written < 0 && err == EINTR) continue;
if (written < 0) {
if (!socket::would_block(err)) {
closeConn();
}
canWrite_ = false;
return;
}
ssize_t toWrite = 0;
for (auto &chunk : chunks) toWrite += chunk.size();
wrBuf_.erase(written);
if (stat_) {
stat_->sentBytes.fetch_add(written, std::memory_order_relaxed);
auto now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
stat_->lastSendTs.store(now.count(), std::memory_order_relaxed);
stat_->sendBufBytes.store(wrBuf_.data_size(), std::memory_order_relaxed);
}
if (written < toWrite) return;
}
if (closeConn_) {
closeConn();
}
}
// Receive message from client socket
template <typename Mutex>
void Connection<Mutex>::read_cb() {
while (!closeConn_) {
auto it = rdBuf_.head();
ssize_t nread = sock_.recv(it);
int err = sock_.last_error();
if (nread < 0 && err == EINTR) continue;
if ((nread < 0 && !socket::would_block(err)) || nread == 0) {
closeConn();
return;
} else if (nread > 0) {
if (stat_) {
stat_->recvBytes.fetch_add(nread, std::memory_order_relaxed);
auto now = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
stat_->lastRecvTs.store(now.count(), std::memory_order_relaxed);
}
rdBuf_.advance_head(nread);
if (!closeConn_) onRead();
}
if (nread < ssize_t(it.size()) || !rdBuf_.available()) return;
}
}
template <typename Mutex>
void Connection<Mutex>::timeout_cb(ev::periodic & /*watcher*/, int /*time*/) {
closeConn();
}
template <typename Mutex>
void Connection<Mutex>::async_cb(ev::async &) {
callback(io_, ev::WRITE);
}
template <typename Mutex>
void Connection<Mutex>::stats_check_cb(ev::periodic & /*watcher*/, int /*time*/) {
assert(stat_);
const uint64_t kAvgPeriod = 10;
auto curRecvBytes = stat_->recvBytes.load(std::memory_order_relaxed);
auto recvRate =
prevSecRecvBytes_ == 0 ? uint32_t(curRecvBytes) : (stat_->recvRate.load(std::memory_order_relaxed) / kAvgPeriod) * (kAvgPeriod - 1);
stat_->recvRate.store(recvRate + (curRecvBytes - prevSecRecvBytes_) / kAvgPeriod, std::memory_order_relaxed);
prevSecRecvBytes_ = curRecvBytes;
auto curSentBytes = stat_->sentBytes.load(std::memory_order_relaxed);
auto sendRate =
prevSecSentBytes_ == 0 ? uint32_t(curSentBytes) : (stat_->sendRate.load(std::memory_order_relaxed) / kAvgPeriod) * (kAvgPeriod - 1);
stat_->sendRate.store(sendRate + (curSentBytes - prevSecSentBytes_) / kAvgPeriod, std::memory_order_relaxed);
prevSecSentBytes_ = curSentBytes;
}
template class Connection<std::mutex>;
template class Connection<reindexer::dummy_mutex>;
} // namespace net
} // namespace reindexer
| 26.860577 | 134 | 0.696975 | andyoknen |
80d94cd2b09b249f103fe349d7ad276cfb120747 | 1,338 | cpp | C++ | tests/unit/util/bind/bind_eq2_test.cpp | kempj/hpx | ffdbfed5dfa029a0f2e97e7367cb66d12103df67 | [
"BSL-1.0"
] | null | null | null | tests/unit/util/bind/bind_eq2_test.cpp | kempj/hpx | ffdbfed5dfa029a0f2e97e7367cb66d12103df67 | [
"BSL-1.0"
] | null | null | null | tests/unit/util/bind/bind_eq2_test.cpp | kempj/hpx | ffdbfed5dfa029a0f2e97e7367cb66d12103df67 | [
"BSL-1.0"
] | null | null | null | #include <hpx/hpx_init.hpp>
#if defined(BOOST_MSVC)
#pragma warning(disable: 4786) // identifier truncated in debug info
#pragma warning(disable: 4710) // function not inlined
#pragma warning(disable: 4711) // function selected for automatic inline expansion
#pragma warning(disable: 4514) // unreferenced inline removed
#endif
// Taken from the Boost.Bind library
//
// bind_eq2_test.cpp - hpx::util::bind equality operator
//
// Copyright (c) 2004, 2005, 2009 Peter Dimov
// Copyright (c) 2013 Agustin Berge
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include <hpx/util/bind.hpp>
#include <boost/function_equal.hpp>
#include <hpx/util/lightweight_test.hpp>
namespace placeholders = hpx::util::placeholders;
void f( int )
{
}
int g( int i )
{
return i + 5;
}
template< class F > void test_self_equal( F f )
{
#ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
using hpx::function_equal;
#endif
HPX_TEST( function_equal( f, f ) );
}
int main()
{
test_self_equal( hpx::util::bind( f, placeholders::_1 ) );
test_self_equal( hpx::util::bind( g, placeholders::_1 ) );
test_self_equal( hpx::util::bind( f, hpx::util::bind( g, placeholders::_1 ) ) );
return hpx::util::report_errors();
}
| 24.777778 | 84 | 0.705531 | kempj |
80daf695d8bb249fe240e7bc79ca7bfa2345912c | 1,111 | hpp | C++ | engine/graphics/opengl/android/OGLRenderDeviceAndroid.hpp | tsukoyumi/ouzel | 43f4f4871d49a310529366a4a4db061a96097164 | [
"Unlicense"
] | null | null | null | engine/graphics/opengl/android/OGLRenderDeviceAndroid.hpp | tsukoyumi/ouzel | 43f4f4871d49a310529366a4a4db061a96097164 | [
"Unlicense"
] | null | null | null | engine/graphics/opengl/android/OGLRenderDeviceAndroid.hpp | tsukoyumi/ouzel | 43f4f4871d49a310529366a4a4db061a96097164 | [
"Unlicense"
] | null | null | null | // Ouzel by Elviss Strazdins
#ifndef OUZEL_GRAPHICS_OGLRENDERDEVICEANDROID_HPP
#define OUZEL_GRAPHICS_OGLRENDERDEVICEANDROID_HPP
#include "../../../core/Setup.h"
#if defined(__ANDROID__) && OUZEL_COMPILE_OPENGL
#include <atomic>
#include <thread>
#include "EGL/egl.h"
#include "EGL/eglext.h"
#include "../OGLRenderDevice.hpp"
#include "../../../core/Window.hpp"
#include "../../../thread/Thread.hpp"
namespace ouzel::graphics::opengl::android
{
class RenderDevice final: public opengl::RenderDevice
{
friend Graphics;
public:
RenderDevice(const Settings& settings,
core::Window& initWindow);
~RenderDevice() override;
void start() final;
void reload();
void destroy();
private:
void present() final;
void renderMain();
EGLDisplay display = EGL_NO_DISPLAY;
EGLSurface surface = EGL_NO_SURFACE;
EGLContext context = EGL_NO_CONTEXT;
std::atomic_bool running{false};
thread::Thread renderThread;
};
}
#endif
#endif // OUZEL_GRAPHICS_OGLRENDERDEVICEANDROID_HPP
| 23.638298 | 57 | 0.663366 | tsukoyumi |
80daf8b21bab6bff7f87e994cf44ffaa0d3c6150 | 18,584 | cc | C++ | src/voxel.cc | c-lamas/voxel_packing | eb3f9b8de086982524d0c92d90a522fbd8acc2f1 | [
"MIT"
] | null | null | null | src/voxel.cc | c-lamas/voxel_packing | eb3f9b8de086982524d0c92d90a522fbd8acc2f1 | [
"MIT"
] | null | null | null | src/voxel.cc | c-lamas/voxel_packing | eb3f9b8de086982524d0c92d90a522fbd8acc2f1 | [
"MIT"
] | null | null | null | #include "3dlib.h"
#include <string>
#include <fstream>
#include <iostream>
#include <cmath>
using namespace std;
VOXEL::VOXEL()
{
init = false;
resolution = 0.1;
creationTime = -1;
rotAngle.assign(3, 0);
cornerInd.assign(3, 0);
corner.assign(3, 0);
name = "empty dir";
// cout << "Initialized voxel!" << endl;
}
void VOXEL::move(vector<double> mvec)
{
for (int i = 0; i < 3; i++)
{
corner[i] += mvec[i];
}
}
void VOXEL::render_to_file(string dest_file)
{
// Open file:
FILE * vfile = fopen(dest_file.c_str(), "w");
// Initialize vars for the loop:
int mapsize_i = map.size();
int mapsize_j = map[0].size();
int mapsize_k = map[0][0].size();
// Start writing:
fprintf(vfile, "function load_thing() {\n\tvar coordinates = [\n");
// Write header:
fprintf(vfile, "// res\t%.4f\n", resolution);
fprintf(vfile, "// pos\t%.4f\t%.4f\t%.4f\n", corner[0], corner[1], corner[2]);
bool isFirst = true;
for (int i = 0; i < mapsize_i; ++i)
{
for (int j = 0; j < mapsize_j; ++j)
{
for (int k = 0; k < mapsize_k; ++k)
{
if (!map[i][j][k])
{
// ++negative;
// glColor4f(1.0f / div, 1.0f / div, 1.0f / div, 0.2f);
continue;
}
// If i, j and k are > 0 and less than the border, do further checks:
if (i > 0 && j > 0 && k > 0 && i < mapsize_i - 1 && j < mapsize_j -1 && k < mapsize_k - 1)
{
// If it's fully surrounded, we don't need to draw it:
if (map[i - 1][j][k] && map[i][j - 1][k] && map[i][j][k - 1] && map[i + 1][j][k] && map[i][j + 1][k] && map[i][j][k + 1])
continue;
}
if (isFirst)
{
fprintf(vfile, "\t\t[%d,\t%d,\t%d]", i, j, k);
isFirst = false;
}
else
{
fprintf(vfile, ",\n\t\t[%d,\t%d,\t%d]", i, j, k);
}
}
}
}
fprintf(vfile, "\n];\n");
fprintf(vfile, "\nreturn coordinates;\n");
fprintf(vfile, "}\n");
fclose(vfile);
}
double VOXEL::phi_voxel_no_rot(VOXEL V2, int &mvdir)
{
// mvdir returns one guess where you could move V1 to make contact with V2 (!)
double phi_val = 1e30;
double aux_phi_val, voxel_phi_val;
double twoRes = resolution/2 + V2.resolution/2;
int aux_mdir;
for (int i = 0; i < map.size(); ++i)
{
for (int j = 0; j < map[i].size(); ++j)
{
for (int k = 0; k < map[i][j].size(); ++k)
{
// If this voxel is not used in V1, skip it:
if (!map[i][j][k])
continue;
// If it is used, check it against all the voxels in V2:
for (int i2 = 0; i2 < V2.map.size(); ++i2)
{
for (int j2 = 0; j2 < V2.map[i2].size(); ++j2)
{
for (int k2 = 0; k2 < V2.map[i2][j2].size(); ++k2)
{
// If this voxel in V2 is not used, skip the test
if (!V2.map[i2][j2][k2])
continue;
// Both voxels are used, check the phi_value between them, and store the maximum of the three:
// coord x
voxel_phi_val = abs((corner[0] + i*resolution) - (V2.corner[0] + i2*V2.resolution)) - twoRes;
aux_mdir = 0;
// coord y
aux_phi_val = abs((corner[1] + j*resolution) - (V2.corner[1] + j2*V2.resolution)) - twoRes;
if (voxel_phi_val < aux_phi_val)
{
voxel_phi_val = aux_phi_val;
aux_mdir = 1;
}
// coord z
aux_phi_val = abs((corner[2] + k*resolution) - (V2.corner[2] + k2*V2.resolution)) - twoRes;
if (voxel_phi_val < aux_phi_val)
{
aux_mdir = 2;
voxel_phi_val = aux_phi_val;
}
// If this value is smaller than the original, store it:
if (voxel_phi_val < phi_val)
{
phi_val = voxel_phi_val;
mvdir = aux_mdir;
}
//if (phi_val < TOL && phi_val > -TOL)
//printf("Found a 0!\n");
// printf("[%i, %i, %i] vs [%i, %i, %i]: %f (dir: %i)\n", i, j, k, i2, j2, k2, phi_val, mvdir);
} // end of i2, V2
} // end of j2, V2
} // end of k2, V2
} // end of i, V1
} // end of j, V1
} // end of k, V1
return phi_val;
}
bool VOXEL::voxel_voxel_intersection_res(VOXEL &V2)
{
vector<int> V1cornerIndex(3);
vector<int> V2cornerIndex(3);
for (int i = 0; i < 3; i++)
{
V1cornerIndex[i] = round(corner[i] / resolution);
V2cornerIndex[i] = round(V2.corner[i] / V2.resolution);
}
cornerInd = V1cornerIndex;
V2.cornerInd = V2cornerIndex;
return voxel_voxel_intersection(V2);
}
bool VOXEL::voxel_voxel_intersection(VOXEL &V2)
{
return voxel_voxel_intersection(V2, cornerInd, V2.cornerInd);
}
bool VOXEL::voxel_voxel_intersection(VOXEL &V2, vector<int> indV1, vector<int> indV2)
{
vector<int> voxel2coord(3);
const int V2mapSizeMin0 = V2.map.size() - 1;
const int V2mapSizeMin1 = V2.map[0].size() - 1;
const int V2mapSizeMin2 = V2.map[0][0].size() - 1;
const int V1mapSize0 = map.size();
const int V1mapSize1 = map[0].size();
const int V1mapSize2 = map[0][0].size();
//V1cornerIndex = { round(corner[0] / resolution), round(corner[1] / resolution), round(corner[2] / resolution) };
// for (int i = 0; i < map.size(); ++i)
for (int i = 0; i < V1mapSize0; ++i)
{
voxel2coord[0] = indV1[0] + i - indV2[0];
// Find the corresponding coordinate of this voxel in V2:
if (voxel2coord[0] < 0 || voxel2coord[0] > V2mapSizeMin0)
continue;
// for (int j = 0; j < map[i].size(); ++j)
for (int j = 0; j < V1mapSize1; ++j)
{
voxel2coord[1] = indV1[1] + j - indV2[1];
if (voxel2coord[1] < 0 || voxel2coord[1] > V2mapSizeMin1)
continue;
for (int k = 0; k < V1mapSize2; ++k)
{
voxel2coord[2] = indV1[2] + k - indV2[2];
// If this voxel is not used in V1, skip it:
if (!map[i][j][k])
continue;
if (voxel2coord[2] < 0 || voxel2coord[2] > V2mapSizeMin2)
continue;
// if (V2.map[voxel2coord[0]][voxel2coord[1]][voxel2coord[2]])
if (V2.get_map_value(voxel2coord[0], voxel2coord[1], voxel2coord[2]))
return true;
} // end of i, V1
} // end of j, V1
} // end of k, V1
return false;
}
double VOXEL::phi_voxel(VOXEL V2, int &mvdir)
{
double minPointPlaneDist = 0; // When comparing two cubes, the minimum vertex to face distance
double minCubeCubeDist, minPointPlaneDistV2; // The minimum distance between two cubes
vector<int> coordsV1(3), coordsV2(3); // Store the integer coordinates of the cubes being analysed.
vector<double> cubeCornerV1(3), cubeCornerV2(3); // Store the actual coordinates here.
double aux, aux2;
// Aux. vars for the edge-edge contact:
vector<double> nu(3), tau(3);
for (int i = 0; i < map.size(); ++i)
{
for (int j = 0; j < map[i].size(); ++j)
{
for (int k = 0; k < map[i][j].size(); ++k)
{
// If this voxel is not used in V1, skip it:
if (!map[i][j][k])
continue;
coordsV1 = { i, j, k };
// rotate_vertex(coordsV1, rotAngle);
// Enter now the second voxel:
for (int iv2 = 0; iv2 < map.size(); ++iv2)
{
for (int jv2 = 0; jv2 < map[i].size(); ++jv2)
{
for (int kv2 = 0; kv2 < map[i][j].size(); ++kv2)
{
// If this voxel is not used in V1, skip it:
if (!map[iv2][jv2][kv2])
continue;
coordsV2 = { iv2, jv2, kv2 };
// STEP 1:
// Check all the vertices of the one cube from V1 against the faces of the cube in V2 and vice-versa:
//minPointPlaneDist = 1e32; // Set the distance to Inf. as we want to know the max.
//minPointPlaneDistV2 = 1e32; // Same for the V2 vs V1 computation.
for (int axis = 0; axis < 3; axis++)
{
// Find the corner of the two cubes:
cubeCornerV1[axis] = corner[coordsV1[axis]] + resolution*coordsV1[axis];
cubeCornerV2[axis] = V2.corner[coordsV2[axis]] + V2.resolution*coordsV2[axis];
//rotate_vertex(coordsV2, V2.rotAngle);
// Go through the 8 points of each cube and look for the minimum point-plane distance
// +0
minPointPlaneDist = cubeCornerV2[axis] - cubeCornerV1[axis];
aux = cubeCornerV2[axis] + 2 * resolution - cubeCornerV1[axis];
if (aux < minPointPlaneDist)
{
minPointPlaneDist = aux;
mvdir = axis;
}
minPointPlaneDistV2 = cubeCornerV1[axis] - cubeCornerV2[axis];
aux = cubeCornerV1[axis] + 2 * resolution - cubeCornerV2[axis];
if (aux < minPointPlaneDistV2)
{
minPointPlaneDistV2 = aux;
mvdir = axis;
}
// +2
minPointPlaneDist = cubeCornerV2[axis] - (cubeCornerV1[axis] + 2*resolution);
aux = cubeCornerV2[axis] + 2 * resolution - (cubeCornerV1[axis] + 2 * resolution);
if (aux < minPointPlaneDist)
{
minPointPlaneDist = aux;
mvdir = axis;
}
minPointPlaneDistV2 = cubeCornerV1[axis] - (cubeCornerV2[axis] + 2 * V2.resolution);
aux = cubeCornerV1[axis] + 2 * resolution - (cubeCornerV2[axis] + 2 * V2.resolution);
if (aux < minPointPlaneDistV2)
{
minPointPlaneDistV2 = aux;
mvdir = axis;
}
}
// STEP 2:
// Check edge-edge contact:
} // end of i, V2
} // end of j, V2
} // end of k, V2
} // end of i, V1
} // end of j, V1
} // end of k, V1
// DEBUG:
return minPointPlaneDist;
}
int VOXEL::get_binvox_index(int x, int y, int z)
{
int index = x * wxh + z * width + y; // wxh = width * height = d * d
return index;
}
int VOXEL::slice_usage(int sliceIdx, int sliceCoord)
{
int startValues[3];
int endValues[3];
int voxelsThere = 0;
for (int coord = 0; coord < 3; coord++)
{
if (sliceCoord == coord)
{
startValues[coord] = sliceIdx;
endValues[coord] = sliceIdx + 1;
}
else
{
startValues[coord] = 0;
endValues[coord] = get_grid_size(coord);
}
// cout << "Coordinate " << coord << " iterates from " << startValues[coord] << " to " << endValues[coord] << endl;
}
for (int i = startValues[0]; i < endValues[0]; i++)
{
for (int j = startValues[1]; j < endValues[1]; j++)
{
for (int k = startValues[2]; k < endValues[2]; k++)
{
if (get_map_value(i, j, k))
voxelsThere++;
// {
// }
// else
// {
// cout << "Map for " << i << " " << j << " " << k << " was " << map[i][j][k] << endl;
// }
}
}
}
return voxelsThere;
}
int VOXEL::get_grid_size(int coord)
{
switch (coord)
{
case 0 :
return map.size();
// return width;
case 1 :
return map[0].size();
// return height;
case 2 :
return map[0][0].size();
// return depth;
default:
return -1;
}
}
bool VOXEL::get_map_value(int i, int j, int k)
{
// Easy way at the moment...
return map[i][j][k];
}
void VOXEL::voxelsTomap()
{
// Reads the voxels array and writes the map() 3d matrix
// Reserve the necessary memory:
// vector<bool> line(width);
// depth = width;
// cout << endl << depth << endl;
// printf("\nVoxel dimensions %d, %d, %d", width, height, depth);
vector<bool> line;
depth = size / wxh;
cout << endl << "\t\tVoxel dimensions " << width << ", " << height << ", " << depth << endl;
line.assign(width, false);
vector<vector<bool>> slice;
slice.assign(height, line);
map.assign(depth, slice);
cout << endl << "\t\tMap dimensions " << map.size() << ", " << map[0].size() << ", " << map[0][0].size() << endl;
// line.assign(width, false);
float volumePerc = 0;
int volumeCount = 0;
double res3 = pow(resolution, 3);
// printf("\nSice Vol: \n");
for (int i = 0; i < width; i++)
{
// printf("%.2f\t", ((float) volumeCount) / size);
for (int j = 0; j < height; j++)
{
for (int k = 0; k < depth; k++)
{
if (voxels[get_binvox_index(i, j, k)] == '\x1')
{
// cout << "true (" << i << ", " << j << ", " << k << ")\n";
map[i][j][k] = true;
++volumeCount;
}
// else
// cout << "false\n";
}
}
}
volumePerc = float(volumeCount) / float(size);
volume = volumeCount;
volumeDouble = double(volume) * res3;
// printf("\n\t\tVolume was %.2f%%\n", volumePerc);
// cout << "\t\t(Volume count: " << volume << " )" << endl;
// cout << "\t\t(Real volume: " << volumeDouble << ", resolution " << resolution << ")" << endl;
// Remove the empty slices we might have:
// cout << "\t\tremoving empty slices..." << endl;
cout << "-----" << endl;
remove_empty_slices();
// cout << "\t\tdone." << endl;
size = width * depth * height;
cout << "\t\tVoxel size: " << size << " (" << width << " x " << height << " x " << depth << ")" << endl;
cout << "\t\tVoxel real size: " << double(size) * res3;
cout << " (" << width*resolution << " x " << height*resolution << " x " << depth*resolution << ")" << endl;
volumePerc = ((float)volumeCount) / size;
printf("\t\tVolume after removing slices is %.2f%% ", volumePerc*100);
cout << "(Volume count: " << volume << " )" << endl;
}
void VOXEL::remove_empty_slices()
{
// cout << endl << endl << "WARNING! Slice removal to be implemented..." << endl << endl;
// Start removing YZ slices:
int slicesRemoved = 0;
int slicesRemovedFront = 0;
for (int sliceCoord = 0; sliceCoord < 3; sliceCoord++)
{
for (int i = get_grid_size(sliceCoord) - 1; i >= 0; i--)
{
int sliceUsageValue = slice_usage(i, sliceCoord);
// cout << "Slice " << i << " for coordinate " << 0 << " usage value is: " << sliceUsageValue << endl;
if (sliceUsageValue == 0)
{
slicesRemoved++;
// cout << "Found an empty slice, removing..." << endl;
if (sliceCoord == 0)
{
map.pop_back();
width -= 1;
}
else if (sliceCoord == 1)
{
for (int xcoord = 0; xcoord < width; xcoord++)
{
map[xcoord].pop_back();
}
height -= 1;
}
else if (sliceCoord == 2)
{
for (int xcoord = 0; xcoord < width; xcoord++)
{
for (int ycoord = 0; ycoord < height; ycoord++)
{
map[xcoord][ycoord].pop_back();
}
}
depth -= 1;
}
}
else
{
break;
}
}
}
// Now, do it backwards in case something is empty from the other side:
// cout << "Current size: " << get_grid_size(0) << " x " << get_grid_size(1) << " x " << get_grid_size(2) << endl;
int slicesChecked = 0;
for (int sliceCoord = 0; sliceCoord < 3; sliceCoord++)
{
for (int i = 0; i <= get_grid_size(sliceCoord) - 1; i++)
{
int sliceUsageValue = slice_usage(i, sliceCoord);
slicesChecked++;
// cout << "Slice " << i << " for coordinate " << sliceCoord << " usage value is: " << sliceUsageValue << endl;
if (sliceUsageValue == 0)
{
i = -1;
slicesRemovedFront++;
// cout << "SliceCoord " << sliceCoord << endl;
// cout << "Found an empty slice, removing..." << endl;
if (sliceCoord == 0)
{
map.erase(map.begin());
width -= 1;
}
else if (sliceCoord == 1)
{
for (int xcoord = 0; xcoord < width; xcoord++)
{
map[xcoord].erase(map[xcoord].begin());
}
height -= 1;
}
else if (sliceCoord == 2)
{
for (int xcoord = 0; xcoord < width; xcoord++)
{
for (int ycoord = 0; ycoord < height; ycoord++)
{
map[xcoord][ycoord].erase(map[xcoord][ycoord].begin());
}
}
depth -= 1;
}
}
else
{
// cout << "Exit on break. (Coord " << sliceCoord << ", index " << i << ", usage was " << sliceUsageValue << " )" << endl;
break;
}
}
}
// Bounding box volumes:
BoxVoxelVolume = width*depth*height;
BoxRealVolume = BoxVoxelVolume*pow(resolution, 3);
// cout << "Current size: " << get_grid_size(0) << " x " << get_grid_size(1) << " x " << get_grid_size(2) << endl;
// cout << "Checked " << slicesChecked << " front slices." << endl;
// cout << "\t\t\tRemoved " << slicesRemoved + slicesRemovedFront << "slices." << endl;
// cout << "\t\t\t(" << slicesRemoved << " back + " << slicesRemovedFront << " front)" << endl;
}
void VOXEL::readBinvox(string filespec)
{
// Code from: http://www.cs.princeton.edu/~min/binvox/read_binvox.cc
// (Modified for compatibility)
/*
OUTPUTS:
- depth
- version
- height
- width
- tx, ty, tz
- scale
- size
- voxels
*/
// int version;
// int depth, height, width;
// int size;
// byte *voxels = 0;
// float tx, ty, tz;
// float scale;
cout << "Reading binvox file: " << filespec.c_str() << endl;
ifstream *input = new ifstream(filespec.c_str(), ios::in | ios::binary);
name.assign(filespec);
//
// read header
//
string line;
// line.reserve(200);
*input >> line; // #binvox
if (line.compare("#binvox") != 0) {
cout << "Error: first line reads [" << line << "] instead of [#binvox]" << endl;
delete input;
return;
// return 0;
}
*input >> version;
// cout << "\tbinvox version " << version << endl;
int depth = -1;
int done = 0;
while (input->good() && !done) {
*input >> line;
if (line.compare("data") == 0) done = 1;
else if (line.compare("dim") == 0) {
*input >> depth >> height >> width;
}
else if (line.compare("translate") == 0) {
*input >> tx >> ty >> tz;
}
else if (line.compare("scale") == 0) {
*input >> scale;
}
else {
cout << " unrecognized keyword [" << line << "], skipping" << endl;
char c;
do { // skip until end of line
c = input->get();
} while (input->good() && (c != '\n'));
}
}
if (!done) {
cout << " error reading header" << endl;
return;
// return 0;
}
if (depth == -1) {
cout << " missing dimensions in header" << endl;
return;
// return 0;
}
size = width * height * depth;
// printf("\nVoxel dimensions %d, %d, %d", width, height, depth);
// wxh = width * height;
wxh = width * height;
voxels = new byte[size];
if (!voxels) {
cout << " error allocating memory" << endl;
// return 0;
return;
}
//
// read voxel data
//
byte value;
byte count;
int index = 0;
int end_index = 0;
int nr_voxels = 0;
input->unsetf(ios::skipws); // need to read every byte now (!)
*input >> value; // read the linefeed char
while ((end_index < size) && input->good()) {
*input >> value >> count;
if (input->good()) {
end_index = index + count;
if (end_index > size)
exit(-1);
// return 0;
for (int i = index; i < end_index; i++)
voxels[i] = value;
if (value) nr_voxels += count;
index = end_index;
} // if file still ok
} // while
input->close();
line.clear();
// cout << "\tread " << nr_voxels << " voxels" << endl;
// Convert to map:
corner.assign(3, 0);
// corner.reserve(3);
// corner.push_back(tx);
// corner.push_back(ty);
// corner.push_back(tz);
// cout << "\tconverting voxels to map..." << endl;
voxelsTomap();
// cout << "\tdone." << endl;
cout << "Done." << endl << endl;
}
| 25.353342 | 126 | 0.556877 | c-lamas |
80db2b04153406f97e4ff94b441f4a186a9e2baf | 15,651 | cpp | C++ | cpp/benchmarks/core/Hashmap.cpp | Dudulle/Open3D | ffed2d1bee6d45b6acc4b7ae7133752e50d6ecab | [
"MIT"
] | 8 | 2021-03-17T14:24:12.000Z | 2022-03-30T15:35:27.000Z | cpp/benchmarks/core/Hashmap.cpp | Dudulle/Open3D | ffed2d1bee6d45b6acc4b7ae7133752e50d6ecab | [
"MIT"
] | 1 | 2021-11-04T09:22:25.000Z | 2022-02-14T01:32:31.000Z | cpp/benchmarks/core/Hashmap.cpp | Dudulle/Open3D | ffed2d1bee6d45b6acc4b7ae7133752e50d6ecab | [
"MIT"
] | 2 | 2021-08-24T18:06:55.000Z | 2021-12-17T10:48:34.000Z | // ----------------------------------------------------------------------------
// - Open3D: www.open3d.org -
// ----------------------------------------------------------------------------
// The MIT License (MIT)
//
// Copyright (c) 2018 www.open3d.org
//
// 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 "open3d/core/hashmap/Hashmap.h"
#include <benchmark/benchmark.h>
#include <random>
#include "open3d/core/AdvancedIndexing.h"
#include "open3d/core/Dtype.h"
#include "open3d/core/MemoryManager.h"
#include "open3d/core/SizeVector.h"
#include "open3d/core/Tensor.h"
#include "open3d/core/kernel/Kernel.h"
namespace open3d {
namespace core {
template <typename K, typename V>
class HashData {
public:
HashData(int count, int slots) {
keys_.resize(count);
vals_.resize(count);
std::vector<int> indices(count);
std::iota(indices.begin(), indices.end(), 0);
std::shuffle(indices.begin(), indices.end(),
std::default_random_engine(0));
// Ensure enough duplicates for harder tests
for (int i = 0; i < count; ++i) {
int v = indices[i] % slots;
keys_[i] = K(v * k_factor_);
vals_[i] = V(v);
}
}
public:
const int k_factor_ = 101;
std::vector<K> keys_;
std::vector<V> vals_;
};
void HashInsertInt(benchmark::State& state,
int capacity,
int duplicate_factor,
const Device& device,
const HashmapBackend& backend) {
int slots = std::max(1, capacity / duplicate_factor);
HashData<int, int> data(capacity, slots);
#ifdef BUILD_CUDA_MODULE
CUDACachedMemoryManager::ReleaseCache();
#endif
Tensor keys(data.keys_, {capacity}, Dtype::Int32, device);
Tensor values(data.vals_, {capacity}, Dtype::Int32, device);
Hashmap hashmap_warmup(capacity, Dtype::Int32, Dtype::Int32, {1}, {1},
device, backend);
Tensor addrs, masks;
hashmap_warmup.Insert(keys, values, addrs, masks);
for (auto _ : state) {
state.PauseTiming();
Hashmap hashmap(capacity, Dtype::Int32, Dtype::Int32, {1}, {1}, device,
backend);
Tensor addrs, masks;
state.ResumeTiming();
hashmap.Insert(keys, values, addrs, masks);
state.PauseTiming();
int64_t s = hashmap.Size();
if (s != slots) {
utility::LogError(
"Error returning hashmap size, expected {}, but got {}.",
slots, s);
}
state.ResumeTiming();
}
}
void HashEraseInt(benchmark::State& state,
int capacity,
int duplicate_factor,
const Device& device,
const HashmapBackend& backend) {
int slots = std::max(1, capacity / duplicate_factor);
HashData<int, int> data(capacity, slots);
#ifdef BUILD_CUDA_MODULE
CUDACachedMemoryManager::ReleaseCache();
#endif
Tensor keys(data.keys_, {capacity}, Dtype::Int32, device);
Tensor values(data.vals_, {capacity}, Dtype::Int32, device);
Hashmap hashmap_warmup(capacity, Dtype::Int32, Dtype::Int32, {1}, {1},
device, backend);
Tensor addrs, masks;
hashmap_warmup.Insert(keys, values, addrs, masks);
for (auto _ : state) {
state.PauseTiming();
Hashmap hashmap(capacity, Dtype::Int32, Dtype::Int32, {1}, {1}, device,
backend);
Tensor addrs, masks;
hashmap.Insert(keys, values, addrs, masks);
state.ResumeTiming();
hashmap.Erase(keys, masks);
state.PauseTiming();
int64_t s = hashmap.Size();
if (s != 0) {
utility::LogError(
"Error returning hashmap size, expected {}, but got {}.", 0,
s);
}
state.ResumeTiming();
}
}
void HashFindInt(benchmark::State& state,
int capacity,
int duplicate_factor,
const Device& device,
const HashmapBackend& backend) {
int slots = std::max(1, capacity / duplicate_factor);
HashData<int, int> data(capacity, slots);
#ifdef BUILD_CUDA_MODULE
CUDACachedMemoryManager::ReleaseCache();
#endif
Tensor keys(data.keys_, {capacity}, Dtype::Int32, device);
Tensor values(data.vals_, {capacity}, Dtype::Int32, device);
Hashmap hashmap(capacity, Dtype::Int32, Dtype::Int32, {1}, {1}, device,
backend);
Tensor addrs, masks;
// Insert as warp-up
hashmap.Insert(keys, values, addrs, masks);
for (auto _ : state) {
hashmap.Find(keys, addrs, masks);
}
}
void HashClearInt(benchmark::State& state,
int capacity,
int duplicate_factor,
const Device& device,
const HashmapBackend& backend) {
int slots = std::max(1, capacity / duplicate_factor);
HashData<int, int> data(capacity, slots);
#ifdef BUILD_CUDA_MODULE
CUDACachedMemoryManager::ReleaseCache();
#endif
Tensor keys(data.keys_, {capacity}, Dtype::Int32, device);
Tensor values(data.vals_, {capacity}, Dtype::Int32, device);
Hashmap hashmap_warmup(capacity, Dtype::Int32, Dtype::Int32, {1}, {1},
device, backend);
Tensor addrs, masks;
hashmap_warmup.Insert(keys, values, addrs, masks);
for (auto _ : state) {
state.PauseTiming();
Hashmap hashmap(capacity, Dtype::Int32, Dtype::Int32, {1}, {1}, device,
backend);
Tensor addrs, masks;
hashmap.Insert(keys, values, addrs, masks);
int64_t s = hashmap.Size();
if (s != slots) {
utility::LogError(
"Error returning hashmap size, expected {}, but got {}.",
slots, s);
}
state.ResumeTiming();
hashmap.Clear();
state.PauseTiming();
s = hashmap.Size();
if (s != 0) {
utility::LogError(
"Error returning hashmap size, expected {}, but got {}.", 0,
s);
}
state.ResumeTiming();
}
}
class Int3 {
public:
Int3() : x_(0), y_(0), z_(0){};
Int3(int k) : x_(k), y_(k * 2), z_(k * 4){};
bool operator==(const Int3& other) const {
return x_ == other.x_ && y_ == other.y_ && z_ == other.z_;
}
int x_;
int y_;
int z_;
};
void HashInsertInt3(benchmark::State& state,
int capacity,
int duplicate_factor,
const Device& device,
const HashmapBackend& backend) {
int slots = std::max(1, capacity / duplicate_factor);
HashData<Int3, int> data(capacity, slots);
std::vector<int> keys_Int3;
keys_Int3.assign(reinterpret_cast<int*>(data.keys_.data()),
reinterpret_cast<int*>(data.keys_.data()) + 3 * capacity);
#ifdef BUILD_CUDA_MODULE
CUDACachedMemoryManager::ReleaseCache();
#endif
Tensor keys(keys_Int3, {capacity, 3}, Dtype::Int32, device);
Tensor values(data.vals_, {capacity}, Dtype::Int32, device);
Hashmap hashmap_warmup(capacity, Dtype::Int32, Dtype::Int32, {3}, {1},
device, backend);
Tensor addrs, masks;
hashmap_warmup.Insert(keys, values, addrs, masks);
for (auto _ : state) {
state.PauseTiming();
Hashmap hashmap(capacity, Dtype::Int32, Dtype::Int32, {3}, {1}, device,
backend);
Tensor addrs, masks;
state.ResumeTiming();
hashmap.Insert(keys, values, addrs, masks);
state.PauseTiming();
int64_t s = hashmap.Size();
if (s != slots) {
utility::LogError(
"Error returning hashmap size, expected {}, but got {}.",
slots, s);
}
state.ResumeTiming();
}
}
void HashEraseInt3(benchmark::State& state,
int capacity,
int duplicate_factor,
const Device& device,
const HashmapBackend& backend) {
int slots = std::max(1, capacity / duplicate_factor);
HashData<Int3, int> data(capacity, slots);
std::vector<int> keys_Int3;
keys_Int3.assign(reinterpret_cast<int*>(data.keys_.data()),
reinterpret_cast<int*>(data.keys_.data()) + 3 * capacity);
#ifdef BUILD_CUDA_MODULE
CUDACachedMemoryManager::ReleaseCache();
#endif
Tensor keys(keys_Int3, {capacity, 3}, Dtype::Int32, device);
Tensor values(data.vals_, {capacity}, Dtype::Int32, device);
Hashmap hashmap_warmup(capacity, Dtype::Int32, Dtype::Int32, {3}, {1},
device, backend);
Tensor addrs, masks;
hashmap_warmup.Insert(keys, values, addrs, masks);
for (auto _ : state) {
state.PauseTiming();
Hashmap hashmap(capacity, Dtype::Int32, Dtype::Int32, {3}, {1}, device,
backend);
Tensor addrs, masks;
hashmap.Insert(keys, values, addrs, masks);
state.ResumeTiming();
hashmap.Erase(keys, masks);
state.PauseTiming();
int64_t s = hashmap.Size();
if (s != 0) {
utility::LogError(
"Error returning hashmap size, expected {}, but got {}.", 0,
s);
}
state.ResumeTiming();
}
}
void HashFindInt3(benchmark::State& state,
int capacity,
int duplicate_factor,
const Device& device,
const HashmapBackend& backend) {
int slots = std::max(1, capacity / duplicate_factor);
HashData<Int3, int> data(capacity, slots);
std::vector<int> keys_Int3;
keys_Int3.assign(reinterpret_cast<int*>(data.keys_.data()),
reinterpret_cast<int*>(data.keys_.data()) + 3 * capacity);
#ifdef BUILD_CUDA_MODULE
CUDACachedMemoryManager::ReleaseCache();
#endif
Tensor keys(keys_Int3, {capacity, 3}, Dtype::Int32, device);
Tensor values(data.vals_, {capacity}, Dtype::Int32, device);
Hashmap hashmap(capacity, Dtype::Int32, Dtype::Int32, {3}, {1}, device,
backend);
Tensor addrs, masks;
hashmap.Insert(keys, values, addrs, masks);
for (auto _ : state) {
hashmap.Find(keys, addrs, masks);
}
}
void HashClearInt3(benchmark::State& state,
int capacity,
int duplicate_factor,
const Device& device,
const HashmapBackend& backend) {
int slots = std::max(1, capacity / duplicate_factor);
HashData<Int3, int> data(capacity, slots);
std::vector<int> keys_Int3;
keys_Int3.assign(reinterpret_cast<int*>(data.keys_.data()),
reinterpret_cast<int*>(data.keys_.data()) + 3 * capacity);
#ifdef BUILD_CUDA_MODULE
CUDACachedMemoryManager::ReleaseCache();
#endif
Tensor keys(keys_Int3, {capacity, 3}, Dtype::Int32, device);
Tensor values(data.vals_, {capacity}, Dtype::Int32, device);
Hashmap hashmap_warmup(capacity, Dtype::Int32, Dtype::Int32, {3}, {1},
device, backend);
Tensor addrs, masks;
hashmap_warmup.Insert(keys, values, addrs, masks);
for (auto _ : state) {
state.PauseTiming();
Hashmap hashmap(capacity, Dtype::Int32, Dtype::Int32, {3}, {1}, device,
backend);
Tensor addrs, masks;
hashmap.Insert(keys, values, addrs, masks);
int64_t s = hashmap.Size();
if (s != slots) {
utility::LogError(
"Error returning hashmap size, expected {}, but got {}.",
slots, s);
}
state.ResumeTiming();
hashmap.Clear();
state.PauseTiming();
s = hashmap.Size();
if (s != 0) {
utility::LogError(
"Error returning hashmap size, expected {}, but got {}.", 0,
s);
}
state.ResumeTiming();
}
}
// Note: to enable large scale insertion (> 1M entries), change
// default_max_load_factor() in stdgpu from 1.0 to 1.2~1.4.
#define ENUM_BM_CAPACITY(FN, FACTOR, DEVICE, BACKEND) \
BENCHMARK_CAPTURE(FN, BACKEND##_100_##FACTOR, 100, FACTOR, DEVICE, \
BACKEND) \
->Unit(benchmark::kMillisecond); \
BENCHMARK_CAPTURE(FN, BACKEND##_1000_##FACTOR, 1000, FACTOR, DEVICE, \
BACKEND) \
->Unit(benchmark::kMillisecond); \
BENCHMARK_CAPTURE(FN, BACKEND##_10000_##FACTOR, 10000, FACTOR, DEVICE, \
BACKEND) \
->Unit(benchmark::kMillisecond); \
BENCHMARK_CAPTURE(FN, BACKEND##_100000_##FACTOR, 100000, FACTOR, DEVICE, \
BACKEND) \
->Unit(benchmark::kMillisecond); \
BENCHMARK_CAPTURE(FN, BACKEND##_1000000_##FACTOR, 1000000, FACTOR, DEVICE, \
BACKEND) \
->Unit(benchmark::kMillisecond);
#define ENUM_BM_FACTOR(FN, DEVICE, BACKEND) \
ENUM_BM_CAPACITY(FN, 1, DEVICE, BACKEND) \
ENUM_BM_CAPACITY(FN, 2, DEVICE, BACKEND) \
ENUM_BM_CAPACITY(FN, 4, DEVICE, BACKEND) \
ENUM_BM_CAPACITY(FN, 8, DEVICE, BACKEND) \
ENUM_BM_CAPACITY(FN, 16, DEVICE, BACKEND) \
ENUM_BM_CAPACITY(FN, 32, DEVICE, BACKEND)
#ifdef BUILD_CUDA_MODULE
#define ENUM_BM_BACKEND(FN) \
ENUM_BM_FACTOR(FN, Device("CPU:0"), HashmapBackend::TBB) \
ENUM_BM_FACTOR(FN, Device("CUDA:0"), HashmapBackend::Slab) \
ENUM_BM_FACTOR(FN, Device("CUDA:0"), HashmapBackend::StdGPU)
#else
#define ENUM_BM_BACKEND(FN) \
ENUM_BM_FACTOR(FN, Device("CPU:0"), HashmapBackend::TBB)
#endif
ENUM_BM_BACKEND(HashInsertInt)
ENUM_BM_BACKEND(HashInsertInt3)
ENUM_BM_BACKEND(HashEraseInt)
ENUM_BM_BACKEND(HashEraseInt3)
ENUM_BM_BACKEND(HashFindInt)
ENUM_BM_BACKEND(HashFindInt3)
ENUM_BM_BACKEND(HashClearInt)
ENUM_BM_BACKEND(HashClearInt3)
} // namespace core
} // namespace open3d
| 35.25 | 80 | 0.566481 | Dudulle |
80dcbb4d66b4bfaa14e106657536ce4da581394e | 1,986 | cpp | C++ | contests/1579/c.cpp | Peppa-Peddler/graph-theory | ed022859a1378386d8dba4e7ade6a96a7d683827 | [
"MIT"
] | null | null | null | contests/1579/c.cpp | Peppa-Peddler/graph-theory | ed022859a1378386d8dba4e7ade6a96a7d683827 | [
"MIT"
] | null | null | null | contests/1579/c.cpp | Peppa-Peddler/graph-theory | ed022859a1378386d8dba4e7ade6a96a7d683827 | [
"MIT"
] | null | null | null | #include<bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define VI vector<int>
#define PB push_back
#define PQ priority_queue
#define MP make_pair
#define F first
#define S second
#define MOD 1000000007
#define N6 1000006
#define N5 100005
#define N4 10004
#define N3 1003
#define PI 3.1415926535897932384626
#define N N5
#define clr(v, a) memset(v, a, sizeof(v))
#define all(x) x.begin(),x.end()
#define R(i, n) for(int i=0; i<n; i++)
#define len(x) ((int)(x).size())
#define bits(x) __builtin_popcount(x)
#define bitsLL(x) __builtin_popcountll(x)
#define zerosl(x) __builtin_clz(x)
#define zerosr(x) __builtin_ctz(x)
/*
⢸⣿⣿⣿⣿⠃⠄⢀⣴⡾⠃⠄⠄⠄⠄⠄⠈⠺⠟⠛⠛⠛⠛⠻⢿⣿⣿⣿⣿⣶⣤⡀⠄
⢸⣿⣿⣿⡟⢀⣴⣿⡿⠁⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⣸⣿⣿⣿⣿⣿⣿⣿⣷
⢸⣿⣿⠟⣴⣿⡿⡟⡼⢹⣷⢲⡶⣖⣾⣶⢄⠄⠄⠄⠄⠄⢀⣼⣿⢿⣿⣿⣿⣿⣿⣿⣿
⢸⣿⢫⣾⣿⡟⣾⡸⢠⡿⢳⡿⠍⣼⣿⢏⣿⣷⢄⡀⠄⢠⣾⢻⣿⣸⣿⣿⣿⣿⣿⣿⣿
⡿⣡⣿⣿⡟⡼⡁⠁⣰⠂⡾⠉⢨⣿⠃⣿⡿⠍⣾⣟⢤⣿⢇⣿⢇⣿⣿⢿⣿⣿⣿⣿⣿
⣱⣿⣿⡟⡐⣰⣧⡷⣿⣴⣧⣤⣼⣯⢸⡿⠁⣰⠟⢀⣼⠏⣲⠏⢸⣿⡟⣿⣿⣿⣿⣿⣿
⣿⣿⡟⠁⠄⠟⣁⠄⢡⣿⣿⣿⣿⣿⣿⣦⣼⢟⢀⡼⠃⡹⠃⡀⢸⡿⢸⣿⣿⣿⣿⣿⡟
⣿⣿⠃⠄⢀⣾⠋⠓⢰⣿⣿⣿⣿⣿⣿⠿⣿⣿⣾⣅⢔⣕⡇⡇⡼⢁⣿⣿⣿⣿⣿⣿⢣
⣿⡟⠄⠄⣾⣇⠷⣢⣿⣿⣿⣿⣿⣿⣿⣭⣀⡈⠙⢿⣿⣿⡇⡧⢁⣾⣿⣿⣿⣿⣿⢏⣾
⣿⡇⠄⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⢻⠇⠄⠄⢿⣿⡇⢡⣾⣿⣿⣿⣿⣿⣏⣼⣿
⣿⣷⢰⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⢰⣧⣀⡄⢀⠘⡿⣰⣿⣿⣿⣿⣿⣿⠟⣼⣿⣿
⢹⣿⢸⣿⣿⠟⠻⢿⣿⣿⣿⣿⣿⣿⣿⣶⣭⣉⣤⣿⢈⣼⣿⣿⣿⣿⣿⣿⠏⣾⣹⣿⣿
⢸⠇⡜⣿⡟⠄⠄⠄⠈⠙⣿⣿⣿⣿⣿⣿⣿⣿⠟⣱⣻⣿⣿⣿⣿⣿⠟⠁⢳⠃⣿⣿⣿
⠄⣰⡗⠹⣿⣄⠄⠄⠄⢀⣿⣿⣿⣿⣿⣿⠟⣅⣥⣿⣿⣿⣿⠿⠋⠄⠄⣾⡌⢠⣿⡿⠃
⠜⠋⢠⣷⢻⣿⣿⣶⣾⣿⣿⣿⣿⠿⣛⣥⣾⣿⠿⠟⠛⠉⠄⠄
*/
using namespace std;
int n, m, k, t = 1;
bool T[ 15 ][ 25 ];
string s[15];
string solve(){
cin >> n >> m >> k;
R(i, n) cin >> s[ i ];
R(i, n) R(j, m) T[ i ][ j ] = false;
int d;
for( int i = n - 1; i >= 1 ; i-- ){
for( int j = 1; j < m - 1; j ++ ){
if( s[ i ][ j ] != '*' ) continue;
if( s[ i - 1 ][ j - 1 ] != s[ i - 1 ][ j + 1 ] or s[ i - 1 ][ j + 1 ] != '*' ) continue;
d = 1;
while( i - d >= 0 && j + d < m && j - d >= 0 && s[ i - d ][ j - d ] == '*' and s[ i - d ][ j + d ] == '*' ) d++;
if( d <= k ) continue;
R(D, d)
T[ i - D ][ j - D ] = T[ i - D ][ j + D ] = true;
}
}
R(i, n){
R(j, m){
if( s[ i ][ j ] == '*' and !T[ i ][ j ] ){
return "NO";
}
}
}
return "YES";
}
int main(){
cin >> t;
while(t--) cout << solve() << endl;
//while(t--) solve();
}
| 20.060606 | 115 | 0.376636 | Peppa-Peddler |
80dd316621eee700deb9e18f3fc3bff98a7900c9 | 3,965 | cpp | C++ | crank_nicolson_solver.cpp | hamchiy/yya_pde_solver | bb8390031a761ccdc829893728cd7c6906811a1a | [
"BSD-3-Clause"
] | null | null | null | crank_nicolson_solver.cpp | hamchiy/yya_pde_solver | bb8390031a761ccdc829893728cd7c6906811a1a | [
"BSD-3-Clause"
] | null | null | null | crank_nicolson_solver.cpp | hamchiy/yya_pde_solver | bb8390031a761ccdc829893728cd7c6906811a1a | [
"BSD-3-Clause"
] | null | null | null | #include "crank_nicolson_solver.hpp"
using namespace std;
void gauss(vector<vector<double>>& augmented_matrix) {
int n = augmented_matrix.size();
for(int i=0; i<n; ++i) {
// find row from i with largest value at i
int tr = i;
for(int j=i+1; j<n; ++j) {
if(fabs(augmented_matrix[j][i]) > fabs(augmented_matrix[tr][i])) tr = j;
}
// swap with row i
for(int j=0; j<=n; ++j) swap(augmented_matrix[i][j], augmented_matrix[tr][j]);
// eliminate i from all rows below
for(int j=i+1; j<n; ++j) {
for(int k=n; k>=i; --k) {
augmented_matrix[j][k] -= augmented_matrix[i][k] * augmented_matrix[j][i] / augmented_matrix[i][i];
}
}
}
// restore
for(int i=n-1; i>=0; --i) {
double t = augmented_matrix[i][n];
for(int j=i+1; j<n; ++j) t -= augmented_matrix[i][j] * augmented_matrix[j][n];
t /= augmented_matrix[i][i];
augmented_matrix[i][n] = t;
}
// value of the i'th variable is in augmented_matrix[i][n]
}
crank_nicolson_solver::crank_nicolson_solver(double theta,double (*sigma)(double,double),
double (*r)(double,double),boundary_value_condition* bv,int T,mesh initial_mesh) {
this->theta = theta;
this->sigma = sigma;
this->r = r;
this->bv = bv;
this->T = T;
this->initial_mesh = initial_mesh;
dx = initial_mesh.range/(initial_mesh.arr[0].size()-1);
dt = 1;
answer.resize(T+1);
}
void crank_nicolson_solver::solve() {
answer[T].init(initial_mesh.N,initial_mesh.x_0,initial_mesh.range);
answer[T].init(initial_mesh.arr[1]);
int n = initial_mesh.N;
vector<double> L(n);
//storing L(i,T) at L[i] for i=1 to (n-2)
for(int i=1;i<n-1;i++) {
double f_curr = initial_mesh.get_val_at_index(i);
double f_next = initial_mesh.get_val_at_index(i+1);
double f_prev = initial_mesh.get_val_at_index(i-1);
double x = initial_mesh.get_xval(i);
double s = sigma(x,T);
double r_val = r(x,T);
L[i] = -0.5*s*s*(f_next-2*f_curr+f_prev)/(dx*dx) +
0.5*(s*s-r_val)*(f_next-f_prev)/(2*dx) + r_val*f_curr;
}
vector<vector<double>> augmented_matrix(n);
for(int i=0;i<n;i++) {
augmented_matrix[i].resize(n+1);
}
for(int t=T-1;t>=0;t--) {
answer[t].init(initial_mesh.N,initial_mesh.x_0,initial_mesh.range);
//clearing value of augmented matrix
for(int i=0;i<n;i++) {
augmented_matrix[i] = vector<double>(n+1,0);
}
bv->get_eqn_at_time(t,augmented_matrix[0],augmented_matrix[n-1]);
for(int i=1;i<n-1;i++) {
//filling the matrix
double x = answer[t].get_xval(i);
double s = sigma(x,t);
double r_val = r(x,t);
augmented_matrix[i][i+1] = -0.5*s*s*dt/(dx*dx)*theta +
0.5*(s*s-r_val)*dt/(2*dx)*theta;
augmented_matrix[i][i] = -0.5*s*s*(-2)*dt/(dx*dx)*theta + r_val*theta*dt + 1;
augmented_matrix[i][i-1] = -0.5*s*s*dt/(dx*dx)*theta -
0.5*(s*s-r_val)*dt/(2*dx)*theta;
augmented_matrix[i][n] = answer[t+1].get_val_at_index(i) - (1-theta)*L[i]*dt;
}
gauss(augmented_matrix);
for(int i=0;i<n;i++) {
answer[t].arr[1][i] = augmented_matrix[i][n];
}
//setting value of L(i,t) in L[i] for all i=1..(N-1)
for(int i=1;i<n-1;i++) {
double f_curr = answer[t].get_val_at_index(i);
double f_next = answer[t].get_val_at_index(i+1);
double f_prev = answer[t].get_val_at_index(i-1);
double x = answer[t].get_xval(i);
double s = sigma(x,T);
double r_val = r(x,T);
L[i] = -0.5*s*s*(f_next-2*f_curr+f_prev)/(dx*dx) +
0.5*(s*s-r_val)*(f_next-f_prev)/(2*dx) + r_val*f_curr;
}
}
}
| 31.975806 | 115 | 0.545271 | hamchiy |
80dd643c24851f355702d9f18f3c131795a108d2 | 477 | cpp | C++ | himan-lib/source/logger.cpp | jrintala/fmi-data | 625f0a44919e6406440349425ee0b3f1a64a923d | [
"MIT"
] | null | null | null | himan-lib/source/logger.cpp | jrintala/fmi-data | 625f0a44919e6406440349425ee0b3f1a64a923d | [
"MIT"
] | null | null | null | himan-lib/source/logger.cpp | jrintala/fmi-data | 625f0a44919e6406440349425ee0b3f1a64a923d | [
"MIT"
] | null | null | null | /*
* logger.cpp
*
*/
#include "logger.h"
namespace himan
{
HPDebugState logger::MainDebugState = himan::kInfoMsg;
logger::logger() : itsDebugState(kInfoMsg), itsUserName("HimanDefaultLogger") {}
logger::logger(const std::string& theUserName)
: itsDebugState(MainDebugState), itsUserName(theUserName)
{
}
logger::logger(const std::string& theUserName, HPDebugState theDebugState)
: itsDebugState(theDebugState), itsUserName(theUserName)
{
}
} // namespace himan
| 19.875 | 80 | 0.742138 | jrintala |
80de7970282a63cd314ca79d0b1925857a40d4f4 | 2,168 | hh | C++ | src/gui/plugins/modules/EntityContextMenu.hh | jasmeet0915/ign-gazebo | fc2a98ec5e1b149d773eeb6cae4a407bd82a81a2 | [
"ECL-2.0",
"Apache-2.0"
] | 198 | 2020-04-15T16:56:09.000Z | 2022-03-27T12:31:08.000Z | src/gui/plugins/modules/EntityContextMenu.hh | jasmeet0915/ign-gazebo | fc2a98ec5e1b149d773eeb6cae4a407bd82a81a2 | [
"ECL-2.0",
"Apache-2.0"
] | 1,220 | 2020-04-15T18:10:29.000Z | 2022-03-31T22:37:06.000Z | src/gui/plugins/modules/EntityContextMenu.hh | jasmeet0915/ign-gazebo | fc2a98ec5e1b149d773eeb6cae4a407bd82a81a2 | [
"ECL-2.0",
"Apache-2.0"
] | 134 | 2020-04-15T16:59:57.000Z | 2022-03-26T08:51:31.000Z | /*
* Copyright (C) 2019 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef IGNITION_GAZEBO_GUI_ENTITYCONTEXTMENU_HH_
#define IGNITION_GAZEBO_GUI_ENTITYCONTEXTMENU_HH_
#include <ignition/gui/qt.h>
#include <QtQml/QQmlExtensionPlugin>
#include <memory>
namespace ignition
{
namespace gazebo
{
class EntityContextMenuPrivate;
/// \brief IgnGazebo QML Plugin that registers C++ class so that they are
/// accessible from QML.
class IgnGazeboPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
// unique id
Q_PLUGIN_METADATA(IID "IgnGazebo/1.0")
/// \brief Overrided function that registers C++ class as a QML type
/// \param[in] _uri Plugin uri.
public: void registerTypes(const char *_uri) override;
};
/// \brief A context menu providing actions that can be invoked on an entity
class EntityContextMenu : public QQuickItem
{
Q_OBJECT
/// \brief Constructor
public: EntityContextMenu();
/// \brief Destructor
public: ~EntityContextMenu() override;
/// \brief Callback when a context menu item is invoked
/// \param[in] _data Request data
/// \param[in] _type Entity type
public: Q_INVOKABLE void OnRemove(
const QString &_data, const QString &_type);
/// \brief Callback when a context menu item is invoked
/// \param[in] _request Request type
/// \param[in] _data Request data
public: Q_INVOKABLE void OnRequest(const QString &_request,
const QString &_data);
/// \internal
/// \brief Pointer to private data.
private: std::unique_ptr<EntityContextMenuPrivate> dataPtr;
};
}
}
#endif
| 28.526316 | 78 | 0.712177 | jasmeet0915 |
80e1da0d8c4ecb61f2a1fdce91d01618dc6538a4 | 5,258 | cc | C++ | Contrib/dmk/dsk2dmk.cc | D15C0DE/openMSX | 5119a9657de4b82115c745f670cdc55dc7363133 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 4 | 2015-06-19T04:49:29.000Z | 2022-02-16T15:02:04.000Z | Contrib/dmk/dsk2dmk.cc | D15C0DE/openMSX | 5119a9657de4b82115c745f670cdc55dc7363133 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1 | 2016-01-02T15:55:29.000Z | 2016-01-02T15:55:29.000Z | Contrib/dmk/dsk2dmk.cc | D15C0DE/openMSX | 5119a9657de4b82115c745f670cdc55dc7363133 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 2 | 2020-01-17T02:06:13.000Z | 2021-06-10T17:13:07.000Z | #include <string>
#include <stdexcept>
#include <vector>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <sys/stat.h>
#include <sys/types.h>
using namespace std;
typedef unsigned char byte; // 8 bit
typedef unsigned short word; // 16 bit
static const unsigned int TRACK_LENGTH = 6250;
struct DiskInfo
{
int gap1;
int gap2;
int gap3;
int gap4a;
int sectorsPerTrack;
int numberCylinders;
int sectorSizeCode;
bool doubleSided;
};
struct DmkHeader
{
byte writeProtected;
byte numTracks;
byte trackLen[2];
byte flags;
byte reserved[7];
byte format[4];
};
class File
{
public:
File(const string& filename, const char* mode)
: f(fopen(filename.c_str(), mode))
{
if (!f) {
throw runtime_error("Couldn't open: " + filename);
}
}
~File()
{
fclose(f);
}
void read(void* data, int size)
{
if (fread(data, size, 1, f) != 1) {
throw runtime_error("Couldn't read file");
}
}
void write(const void* data, int size)
{
if (fwrite(data, size, 1, f) != 1) {
throw runtime_error("Couldn't write file");
}
}
private:
FILE* f;
};
static void updateCrc(word& crc, byte val)
{
for (int i = 8; i < 16; ++i) {
crc = (crc << 1) ^ ((((crc ^ (val << i)) & 0x8000) ? 0x1021 : 0));
}
}
static void fill(byte*& p, int len, byte value)
{
memset(p, value, len);
p += len;
}
void convert(const DiskInfo& info, const string& input, const string& output)
{
int numSides = info.doubleSided ? 2 : 1;
int sectorSize = 128 << info.sectorSizeCode;
int totalTracks = numSides * info.numberCylinders;
int totalSectors = totalTracks * info.sectorsPerTrack;
int totalSize = totalSectors * sectorSize;
struct stat st;
stat(input.c_str(), &st);
if (st.st_size != totalSize) {
throw runtime_error("Wrong input filesize");
}
File inf(input, "rb");
File outf(output, "wb");
int rawSectorLen =
12 + 10 + info.gap2 + 12 + 4 +
sectorSize + 2 + info.gap3;
int gap4b = TRACK_LENGTH - (info.gap4a + 12 + 4 + info.gap1 +
info.sectorsPerTrack * rawSectorLen);
assert(gap4b > 0);
int dmkTrackLen = TRACK_LENGTH + 128;
DmkHeader header;
memset(&header, 0, sizeof(header));
header.numTracks = info.numberCylinders;
header.trackLen[0] = dmkTrackLen & 0xff;
header.trackLen[1] = dmkTrackLen >> 8;
header.flags = (info.doubleSided ? (0 << 4) : (1 << 4)) |
(0 << 6); // double density (MFM)
outf.write(&header, sizeof(header));
vector<byte*> addrPos(info.sectorsPerTrack);
vector<byte*> dataPos(info.sectorsPerTrack);
vector<byte> buf(dmkTrackLen); // zero-initialized
byte* ip = &buf[ 0]; // pointer in IDAM table
byte* tp = &buf[128]; // pointer in actual track data
fill(tp, info.gap4a, 0x4e); // gap4a
fill(tp, 12, 0x00); // sync
fill(tp, 3, 0xc2); // index mark
fill(tp, 1, 0xfc); //
fill(tp, info.gap1, 0x4e); // gap1
for (int sec = 0; sec < info.sectorsPerTrack; ++sec) {
fill(tp, 12, 0x00); // sync
fill(tp, 3, 0xa1); // ID addr mark
int pos = tp - &buf[0];
assert(pos < 0x4000);
*ip++ = pos & 0xff;
*ip++ = (pos >> 8) | 0x80; // double density (MFM) sector
fill(tp, 1, 0xfe); // ID addr mark (cont)
addrPos[sec] = tp;
fill(tp, 6, 0x00); // C H R N CRC (overwritten later)
fill(tp, info.gap2, 0x4e); // gap2
fill(tp, 12, 0x00); // sync
fill(tp, 3, 0xa1); // data mark
fill(tp, 1, 0xfb); //
dataPos[sec] = tp;
fill(tp, sectorSize, 0x00); // sector data (overwritten later)
fill(tp, 2, 0x00); // CRC (overwritten later)
fill(tp, info.gap3, 0x4e); // gap3
}
fill(tp, gap4b, 0x4e); // gap4b
assert((tp - &buf[0]) == dmkTrackLen);
for (int cyl = 0; cyl < info.numberCylinders; ++cyl) {
for (int head = 0; head < numSides; ++head) {
for (int sec = 0; sec < info.sectorsPerTrack; ++sec) {
byte* ap = addrPos[sec];
*ap++ = cyl;
*ap++ = head;
*ap++ = sec + 1;
*ap++ = info.sectorSizeCode;
word addrCrc = 0xffff;
const byte* t1 = ap - 8;
for (int i = 0; i < 8; ++i) {
updateCrc(addrCrc, t1[i]);
}
*ap++ = addrCrc >> 8;
*ap++ = addrCrc & 0xff;
byte* dp = dataPos[sec];
inf.read(dp, sectorSize);
dp += sectorSize;
word dataCrc = 0xffff;
const byte* t2 = dp - sectorSize - 4;
for (int i = 0; i < sectorSize + 4; ++i) {
updateCrc(dataCrc, t2[i]);
}
*dp++ = dataCrc >> 8;
*dp++ = dataCrc & 0xff;
}
outf.write(&buf[0], dmkTrackLen);
}
}
}
int main(int argc, char** argv)
{
if (argc != 3) {
printf("dsk2dmk\n"
"\n"
"Utility to convert a dsk disk image into a dmk disk\n"
"image. At the moment this utility is limited to 720kB\n"
"double sided, double density dsk images.\n"
"\n"
"Usage: %s <input.dsk> <output.dmk>\n", argv[0]);
exit(1);
}
// TODO add command line options to make these parameters configurable
DiskInfo info;
info.gap1 = 50;
info.gap2 = 22;
info.gap3 = 84;
info.gap4a = 80;
info.sectorsPerTrack = 9;
info.numberCylinders = 80;
info.sectorSizeCode = 2; // 512 = 128 << 2
info.doubleSided = true;
try {
convert(info, argv[1], argv[2]);
} catch (std::exception& e) {
fprintf(stderr, "Error: %s\n", e.what());
}
}
| 23.9 | 77 | 0.600228 | D15C0DE |
80e52a4c1c3408fc4f939f10db771133a42d2293 | 1,737 | hpp | C++ | test/unittest/ast/TypeTest.hpp | denisw/soyac | 2531e16e8dfbfa966931b774f9d79af528d16ff9 | [
"MIT"
] | 1 | 2019-06-17T07:16:01.000Z | 2019-06-17T07:16:01.000Z | test/unittest/ast/TypeTest.hpp | denisw/soyac | 2531e16e8dfbfa966931b774f9d79af528d16ff9 | [
"MIT"
] | null | null | null | test/unittest/ast/TypeTest.hpp | denisw/soyac | 2531e16e8dfbfa966931b774f9d79af528d16ff9 | [
"MIT"
] | null | null | null | /*
* soyac - The Soya programming language compiler
* Copyright (c) 2009 Denis Washington <dwashington@gmx.net>
*
* This file is distributed under the terms of the MIT license.
* See LICENSE.txt for details.
*/
#ifndef _TYPE_DECLARATION_TEST_HPP
#define _TYPE_DECLARATION_TEST_HPP
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <ast/UnknownType.hpp>
#include "DummyType.hpp"
using namespace soyac::ast;
class TypeTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE (TypeTest);
CPPUNIT_TEST (testConvertable);
CPPUNIT_TEST (testNotConvertable);
CPPUNIT_TEST (testImplicitlyConvertable);
CPPUNIT_TEST (testNotImplicitlyConvertable);
CPPUNIT_TEST (testImplicitlyConvertableToUnknown);
CPPUNIT_TEST (testSubtypeOf);
CPPUNIT_TEST_SUITE_END ();
public:
void setUp()
{
mDecl = new DummyType(Name("Sophia"));
}
void tearDown()
{
delete mDecl;
}
void testConvertable()
{
CPPUNIT_ASSERT (mDecl->isConvertableTo(mDecl));
}
void testNotConvertable()
{
DummyType decl2;
CPPUNIT_ASSERT (!mDecl->isConvertableTo(&decl2));
}
void testImplicitlyConvertable()
{
CPPUNIT_ASSERT (mDecl->isImplicitlyConvertableTo(mDecl));
}
void testNotImplicitlyConvertable()
{
DummyType decl2;
CPPUNIT_ASSERT (!mDecl->isImplicitlyConvertableTo(&decl2));
}
void testImplicitlyConvertableToUnknown()
{
CPPUNIT_ASSERT (mDecl->isImplicitlyConvertableTo(TYPE_UNKNOWN));
}
void testSubtypeOf()
{
DummyType decl2;
CPPUNIT_ASSERT (!mDecl->isSubtypeOf(&decl2));
}
private:
Type* mDecl;
};
#endif
| 21.7125 | 72 | 0.685665 | denisw |
80e640db29bb7cd4d51acbf82f90ad063f62a50a | 2,771 | ipp | C++ | ThirdParty/oglplus-develop/implement/oglplus/enums/ext/compat_attrib_group_names.ipp | vif/3D-STG | 721402e76a9b9b99b88ba3eb06beb6abb17a9254 | [
"MIT"
] | 24 | 2015-01-31T15:30:49.000Z | 2022-01-29T08:36:42.000Z | ThirdParty/oglplus-develop/implement/oglplus/enums/ext/compat_attrib_group_names.ipp | vif/3D-STG | 721402e76a9b9b99b88ba3eb06beb6abb17a9254 | [
"MIT"
] | 4 | 2015-08-21T02:29:15.000Z | 2020-05-02T13:50:36.000Z | ThirdParty/oglplus-develop/implement/oglplus/enums/ext/compat_attrib_group_names.ipp | vif/3D-STG | 721402e76a9b9b99b88ba3eb06beb6abb17a9254 | [
"MIT"
] | 9 | 2015-06-08T22:04:15.000Z | 2021-08-16T03:52:11.000Z | /*
* .file oglplus/enums/ext/compat_attrib_group_names.ipp
*
* Automatically generated header file. DO NOT modify manually,
* edit 'source/enums/oglplus/ext/compat_attrib_group.txt' instead.
*
* Copyright 2010-2013 Matus Chochlik. Distributed under the Boost
* Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/
namespace enums {
OGLPLUS_LIB_FUNC StrLit ValueName_(
CompatibilityAttributeGroup*,
GLbitfield value
)
#if (!OGLPLUS_LINK_LIBRARY || defined(OGLPLUS_IMPLEMENTING_LIBRARY)) && \
!defined(OGLPLUS_IMPL_EVN_COMPATIBILITYATTRIBUTEGROUP)
#define OGLPLUS_IMPL_EVN_COMPATIBILITYATTRIBUTEGROUP
{
switch(value)
{
#if defined GL_ACCUM_BUFFER_BIT
case GL_ACCUM_BUFFER_BIT: return StrLit("ACCUM_BUFFER_BIT");
#endif
#if defined GL_COLOR_BUFFER_BIT
case GL_COLOR_BUFFER_BIT: return StrLit("COLOR_BUFFER_BIT");
#endif
#if defined GL_CURRENT_BIT
case GL_CURRENT_BIT: return StrLit("CURRENT_BIT");
#endif
#if defined GL_DEPTH_BUFFER_BIT
case GL_DEPTH_BUFFER_BIT: return StrLit("DEPTH_BUFFER_BIT");
#endif
#if defined GL_ENABLE_BIT
case GL_ENABLE_BIT: return StrLit("ENABLE_BIT");
#endif
#if defined GL_EVAL_BIT
case GL_EVAL_BIT: return StrLit("EVAL_BIT");
#endif
#if defined GL_FOG_BIT
case GL_FOG_BIT: return StrLit("FOG_BIT");
#endif
#if defined GL_HINT_BIT
case GL_HINT_BIT: return StrLit("HINT_BIT");
#endif
#if defined GL_LIGHTING_BIT
case GL_LIGHTING_BIT: return StrLit("LIGHTING_BIT");
#endif
#if defined GL_LINE_BIT
case GL_LINE_BIT: return StrLit("LINE_BIT");
#endif
#if defined GL_LIST_BIT
case GL_LIST_BIT: return StrLit("LIST_BIT");
#endif
#if defined GL_MULTISAMPLE_BIT
case GL_MULTISAMPLE_BIT: return StrLit("MULTISAMPLE_BIT");
#endif
#if defined GL_PIXEL_MODE_BIT
case GL_PIXEL_MODE_BIT: return StrLit("PIXEL_MODE_BIT");
#endif
#if defined GL_POINT_BIT
case GL_POINT_BIT: return StrLit("POINT_BIT");
#endif
#if defined GL_POLYGON_BIT
case GL_POLYGON_BIT: return StrLit("POLYGON_BIT");
#endif
#if defined GL_POLYGON_STIPPLE_BIT
case GL_POLYGON_STIPPLE_BIT: return StrLit("POLYGON_STIPPLE_BIT");
#endif
#if defined GL_SCISSOR_BIT
case GL_SCISSOR_BIT: return StrLit("SCISSOR_BIT");
#endif
#if defined GL_STENCIL_BUFFER_BIT
case GL_STENCIL_BUFFER_BIT: return StrLit("STENCIL_BUFFER_BIT");
#endif
#if defined GL_TEXTURE_BIT
case GL_TEXTURE_BIT: return StrLit("TEXTURE_BIT");
#endif
#if defined GL_TRANSFORM_BIT
case GL_TRANSFORM_BIT: return StrLit("TRANSFORM_BIT");
#endif
#if defined GL_VIEWPORT_BIT
case GL_VIEWPORT_BIT: return StrLit("VIEWPORT_BIT");
#endif
#if defined GL_ALL_ATTRIB_BITS
case GL_ALL_ATTRIB_BITS: return StrLit("ALL_ATTRIB_BITS");
#endif
default:;
}
OGLPLUS_FAKE_USE(value);
return StrLit();
}
#else
;
#endif
} // namespace enums
| 27.989899 | 73 | 0.799711 | vif |
80e6498b78010eff5a4b5cd93b14da69a061aaee | 7,930 | cpp | C++ | test/unit/multithread_simple.cpp | jsoniq/jsoniq | f7af29417f809d64d1f0b2622d880bc4d87f2e42 | [
"Apache-2.0"
] | 94 | 2015-01-18T09:40:36.000Z | 2022-03-02T21:14:55.000Z | test/unit/multithread_simple.cpp | jsoniq/jsoniq | f7af29417f809d64d1f0b2622d880bc4d87f2e42 | [
"Apache-2.0"
] | 72 | 2015-01-05T22:00:31.000Z | 2021-07-17T11:35:03.000Z | test/unit/multithread_simple.cpp | jsoniq/jsoniq | f7af29417f809d64d1f0b2622d880bc4d87f2e42 | [
"Apache-2.0"
] | 27 | 2015-01-18T20:20:54.000Z | 2020-11-01T18:01:07.000Z | /*
* Copyright 2006-2008 The FLWOR Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <vector>
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include <zorba/zorba.h>
#include <zorba/store_manager.h>
using namespace zorba;
void* query_thread_1(void *param);
void* query_thread_2(void *param);
void* query_thread_3(void *param);
void* query_thread_4(void *param);
#define NR_THREADS 20
struct data {
Zorba* lZorba;
Item lItem;
int index;
};
typedef struct {
Zorba* lZorba;
int index;
} data_2;
#ifdef ZORBA_HAVE_PTHREAD_H
static XQuery_t lQuery;
std::string make_absolute_file_name(const char *target_file_name, const char *this_file_name);
/*
Simple cloning test
*/
bool
multithread_example_1(Zorba* aZorba)
{
unsigned int i;
pthread_t pt[NR_THREADS];
try {
lQuery = aZorba->compileQuery("1+1");
for(i=0; i<NR_THREADS; i++)
pthread_create(&pt[i], NULL, query_thread_1, (void*)i);
//wait for threads to finish
for(i=0;i<NR_THREADS;i++)
pthread_join(pt[i], NULL);
lQuery->close();
return true;
}
catch (ZorbaException &e) {
std::cerr << "some exception " << e << std::endl;
return false;
}
}
/*
Create multiple threads that compile and execute a query
*/
bool
multithread_example_2(Zorba* aZorba)
{
unsigned int i;
pthread_t* pthreads;
data_2* pdata;
try {
pthreads=(pthread_t *)malloc(NR_THREADS*sizeof(*pthreads));
pdata=(data_2 *)malloc(NR_THREADS*sizeof(data_2));
for(i=0; i<NR_THREADS; i++)
{
pdata[i].lZorba = aZorba;
pdata[i].index = i;
pthread_create(&pthreads[i], NULL, query_thread_2, (void*)(pdata+i));
}
//wait for threads to finish
for(i=0; i<NR_THREADS; i++)
pthread_join(pthreads[i], NULL);
free(pthreads);
free(pdata);
return true;
}
catch (ZorbaException &e) {
std::cerr << "some exception " << e << std::endl;
return false;
}
}
/*
Create separate queries that are working with the same document loaded in store.
*/
bool
multithread_example_3(Zorba* aZorba)
{
unsigned int i;
pthread_t pt[NR_THREADS];
data* test;
try {
std::stringstream lInStream("<books><book>Book 1</book><book>Book 2</book><book>Book 3</book></books>");
Item aItem = aZorba->getXmlDataManager()->loadDocument("books.xml", lInStream);
for(i=0; i<NR_THREADS; i++)
{
test = new data ();
test->lZorba = aZorba;
test->lItem = aItem;
test->index = i+1;
pthread_create(&pt[i], NULL, query_thread_3, (void*)test);
}
for(i=0;i<NR_THREADS;i++)
{
void *thread_result;
pthread_join(pt[i], &thread_result);
}
aItem = NULL;
delete test;
return true;
}
catch (ZorbaException &e) {
std::cerr << "some exception " << e << std::endl;
return false;
}
}
/*
Load a document in store and query it from diffrent threads.
*/
bool
multithread_example_4(Zorba* aZorba)
{
unsigned int i;
pthread_t pt[NR_THREADS];
data* test;
try {
Item aItem = aZorba->getXmlDataManager()->loadDocument(make_absolute_file_name("book.xml", __FILE__));
for(i=0; i<NR_THREADS; i++)
{
test = new data ();
test->lZorba = aZorba;
test->lItem = aItem;
test->index = i+1;
pthread_create(&pt[i], NULL, query_thread_4, (void*)test);
}
for(i=0;i<NR_THREADS;i++)
{
void *thread_result;
pthread_join(pt[i], &thread_result);
}
aItem = NULL;
delete test;
return true;
}
catch (ZorbaException &e) {
std::cerr << "some exception " << e << std::endl;
return false;
}
}
int
multithread_simple(int argc, char* argv[])
{
simplestore::SimpleStore* lStore = StoreManager::getStore();
Zorba* lZorba = Zorba::getInstance(StoreManager::getStore());
bool res = false;
// std::cout << std::endl << "executing multithread test 1 : ";
// res = multithread_example_1(lZorba);
// if (!res) {
// std::cout << "Failed" << std::endl;
// lZorba->shutdown();
// StoreManager::shutdownStore(lStore);
// return 1;
// }
// else std::cout << "Passed" << std::endl;
std::cout << std::endl << "executing multithread test 2 : ";
res = multithread_example_2(lZorba);
if (!res) {
std::cout << "Failed" << std::endl;
lZorba->shutdown();
StoreManager::shutdownStore(lStore);
return 1;
}
else std::cout << "Passed" << std::endl;
// std::cout << std::endl << "executing multithread test 3 : ";
// res = multithread_example_3(lZorba);
// if (!res) {
// std::cout << "Failed" << std::endl;
// lZorba->shutdown();
// StoreManager::shutdownStore(lStore);
// return 1;
// }
// else std::cout << "Passed" << std::endl;
// std::cout << std::endl << "executing multithread test 4 : ";
// res = multithread_example_4(lZorba);
// if (!res) {
// std::cout << "Failed" << std::endl;
// lZorba->shutdown();
// StoreManager::shutdownStore(lStore);
// return 1;
// }
// else std::cout << "Passed" << std::endl;
lZorba->shutdown();
StoreManager::shutdownStore(lStore);
return 0;
}
void* query_thread_1(void *param)
{
XQuery_t xquery_clone = lQuery->clone();
if(xquery_clone == NULL)
{
std::cout << "cannot clone xquery object" << std::endl;
return (void*)1;
}
std::ostringstream os;
os << xquery_clone << std::endl;
return (void*)0;
}
void* query_thread_2(void *param)
{
data_2* var = (data_2*)param;
try
{
XQuery_t query = var->lZorba->compileQuery("1+1");
std::ostringstream os;
os << query << std::endl;
query->close();
} catch (ZorbaException &e) {
std::cerr << "filename: " << e.getFileName() << ", ";
std::cerr << "line NO: " << e.getFileLineNumber() << ", ";
std::cerr << e.getDescription() << std::endl;
return NULL;
}
// std::cout << "1 ";
return (0);
}
void* query_thread_3(void *param)
{
data* var = (data*)param;
XQuery_t lQuery = var->lZorba->compileQuery("declare variable $var external; doc('books.xml')//book");
DynamicContext* lCtx = lQuery->getDynamicContext();
lCtx->setVariable("var", var->lItem);
std::ostringstream os;
os << lQuery << std::endl;
var->lItem = NULL;
lQuery->close();
return (void*)0;
}
void* query_thread_4(void *param)
{
data* var = (data*)param;
char buff [3];
int n;
int i = var->index % 10;
n=sprintf (buff, "%d", i);
XQuery_t aQuery = var->lZorba->compileQuery("declare variable $var external; doc('books.xml')//chapter[@id=1]");
DynamicContext* lCtx = aQuery->getDynamicContext();
lCtx->setVariable("var", var->lItem);
std::ostringstream os;
os << aQuery << std::endl;
var->lItem = NULL;
aQuery->close();
return (void*)0;
}
std::string make_absolute_file_name(const char *target_file_name, const char *this_file_name)
{
std::string str_result;
std::string::size_type pos;
str_result = this_file_name;
pos = str_result.rfind('/');
if(pos == std::string::npos)
pos = str_result.rfind('\\');
if(pos == std::string::npos)
return target_file_name;
str_result.erase(pos+1);
str_result += target_file_name;
// std::cout << "make_absolute_file_name -> " << str_result << std::endl;
return str_result;
}
#endif
/* vim:set et sw=2 ts=2: */
| 22.464589 | 114 | 0.621438 | jsoniq |
80e6b0ae1b1addd9b76ad9c10d68f0b76f3f186f | 382 | cpp | C++ | opencl/source/gen11/sampler_gen11.cpp | troels/compute-runtime | 3269e719a3ee7bcd97c50ec2cfe78fc8674adec0 | [
"Intel",
"MIT"
] | 778 | 2017-09-29T20:02:43.000Z | 2022-03-31T15:35:28.000Z | opencl/source/gen11/sampler_gen11.cpp | troels/compute-runtime | 3269e719a3ee7bcd97c50ec2cfe78fc8674adec0 | [
"Intel",
"MIT"
] | 478 | 2018-01-26T16:06:45.000Z | 2022-03-30T10:19:10.000Z | opencl/source/gen11/sampler_gen11.cpp | troels/compute-runtime | 3269e719a3ee7bcd97c50ec2cfe78fc8674adec0 | [
"Intel",
"MIT"
] | 215 | 2018-01-30T08:39:32.000Z | 2022-03-29T11:08:51.000Z | /*
* Copyright (C) 2019-2021 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "shared/source/gen11/hw_cmds.h"
#include "opencl/source/sampler/sampler.h"
#include "opencl/source/sampler/sampler.inl"
namespace NEO {
typedef ICLFamily Family;
static auto gfxCore = IGFX_GEN11_CORE;
#include "opencl/source/sampler/sampler_factory_init.inl"
} // namespace NEO
| 19.1 | 57 | 0.751309 | troels |
80e9d41143bfb645b20bd879fd615d868e98fac0 | 6,085 | cpp | C++ | codecs/png.cpp | mattvchandler/asciiart | 65eeb38aa42b98d49ce15bb2cc3a98950edb18cc | [
"MIT"
] | 5 | 2020-06-02T18:05:43.000Z | 2022-02-19T10:44:47.000Z | codecs/png.cpp | mattvchandler/asciiart | 65eeb38aa42b98d49ce15bb2cc3a98950edb18cc | [
"MIT"
] | null | null | null | codecs/png.cpp | mattvchandler/asciiart | 65eeb38aa42b98d49ce15bb2cc3a98950edb18cc | [
"MIT"
] | 1 | 2021-11-29T15:32:54.000Z | 2021-11-29T15:32:54.000Z | #include "png.hpp"
#include <iostream>
#include <stdexcept>
#include <csetjmp>
#include <png.h>
#ifdef EXIF_FOUND
#include "exif.hpp"
#endif
void read_fn(png_structp png_ptr, png_bytep data, png_size_t length) noexcept
{
auto in = static_cast<std::istream *>(png_get_io_ptr(png_ptr));
if(!in)
std::longjmp(png_jmpbuf(png_ptr), 1);
in->read(reinterpret_cast<char *>(data), length);
if(in->bad())
std::longjmp(png_jmpbuf(png_ptr), 1);
}
Png::Png(std::istream & input)
{
auto png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if(!png_ptr)
throw std::runtime_error{"Error initializing libpng"};
auto info_ptr = png_create_info_struct(png_ptr);
if(!info_ptr)
{
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
throw std::runtime_error{"Error initializing libpng info"};
}
auto end_info_ptr = png_create_info_struct(png_ptr);
if(!end_info_ptr)
{
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
throw std::runtime_error{"Error initializing libpng info"};
}
if(setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info_ptr);
throw std::runtime_error{"Error reading with libpng"};
}
// set custom read callback (to read from header / c++ istream)
png_set_read_fn(png_ptr, &input, read_fn);
// don't care about non-image data
png_set_keep_unknown_chunks(png_ptr, PNG_HANDLE_CHUNK_NEVER, nullptr, 0);
// get image properties
png_read_info(png_ptr, info_ptr);
set_size(png_get_image_width(png_ptr, info_ptr), png_get_image_height(png_ptr, info_ptr));
auto bit_depth = png_get_bit_depth(png_ptr, info_ptr);
auto color_type = png_get_color_type(png_ptr, info_ptr);
// set transformations to convert to 32-bit RGBA
if(!(color_type & PNG_COLOR_MASK_COLOR))
png_set_gray_to_rgb(png_ptr);
if(color_type & PNG_COLOR_MASK_PALETTE)
png_set_palette_to_rgb(png_ptr);
if(!(color_type & PNG_COLOR_MASK_ALPHA))
png_set_add_alpha(png_ptr, 0xFF, PNG_FILLER_AFTER);
if(bit_depth == 16)
png_set_strip_16(png_ptr);
if(bit_depth < 8)
png_set_packing(png_ptr);
auto number_of_passes = png_set_interlace_handling(png_ptr);
png_read_update_info(png_ptr, info_ptr);
if(png_get_rowbytes(png_ptr, info_ptr) != width_ * 4)
throw std::runtime_error{"PNG bytes per row incorrect"};
for(decltype(number_of_passes) pass = 0; pass < number_of_passes; ++pass)
{
for(size_t row = 0; row < height_; ++row)
{
png_read_row(png_ptr, reinterpret_cast<unsigned char*>(std::data(image_data_[row])), NULL);
}
}
#ifdef EXIF_FOUND
auto orientation { exif::Orientation::r_0};
png_bytep exif = nullptr;
png_uint_32 exif_length = 0;
png_read_end(png_ptr, end_info_ptr);
if(png_get_eXIf_1(png_ptr, info_ptr, &exif_length, &exif) != 0 || png_get_eXIf_1(png_ptr, end_info_ptr, &exif_length, &exif) != 0)
{
if (exif_length > 1)
{
std::vector<unsigned char> exif_buf(exif_length + 6);
for(auto i = 0; i < 6; ++i)
exif_buf[i] = "Exif\0\0"[i];
std::copy(exif, exif + exif_length, std::begin(exif_buf) + 6);
orientation = exif::get_orientation(std::data(exif_buf), std::size(exif_buf));
}
}
transpose_image(orientation);
#endif
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info_ptr);
}
void write_fn(png_structp png_ptr, png_bytep data, png_size_t length) noexcept
{
auto out = static_cast<std::ostream *>(png_get_io_ptr(png_ptr));
if(!out)
std::longjmp(png_jmpbuf(png_ptr), 1);
out->write(reinterpret_cast<char *>(data), length);
if(out->bad())
std::longjmp(png_jmpbuf(png_ptr), 1);
}
void flush_fn(png_structp png_ptr)
{
auto out = static_cast<std::ostream *>(png_get_io_ptr(png_ptr));
if(!out)
std::longjmp(png_jmpbuf(png_ptr), 1);
out->flush();
}
void Png::write(std::ostream & out, const Image & img, bool invert)
{
const Image * img_p = &img;
std::unique_ptr<Image> img_copy{nullptr};
if(invert)
{
img_copy = std::make_unique<Image>(img.get_width(), img.get_height());
for(std::size_t row = 0; row < img_copy->get_height(); ++row)
{
for(std::size_t col = 0; col < img_copy->get_width(); ++col)
{
FColor fcolor {img[row][col]};
if(invert)
fcolor.invert();
(*img_copy)[row][col] = fcolor;
}
}
img_p = img_copy.get();
}
std::vector<const unsigned char *> row_ptrs(img_p->get_height());
for(std::size_t i = 0; i < img_p->get_height(); ++i)
row_ptrs[i] = reinterpret_cast<decltype(row_ptrs)::value_type>(std::data((*img_p)[i]));
auto png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if(!png_ptr)
throw std::runtime_error{"Error initializing libpng"};
auto info_ptr = png_create_info_struct(png_ptr);
if(!info_ptr)
{
png_destroy_write_struct(&png_ptr, nullptr);
throw std::runtime_error{"Error initializing libpng info"};
}
if(setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_write_struct(&png_ptr, &info_ptr);
throw std::runtime_error{"Error writing with libpng"};
}
// set custom write callbacks to write to std::ostream
png_set_write_fn(png_ptr, &out, write_fn, flush_fn);
png_set_IHDR(png_ptr, info_ptr,
img.get_width(), img.get_height(),
8, PNG_COLOR_TYPE_RGB_ALPHA,
PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
png_set_rows(png_ptr, info_ptr, const_cast<png_bytepp>(std::data(row_ptrs)));
png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, nullptr);
png_write_end(png_ptr, nullptr);
png_destroy_write_struct(&png_ptr, &info_ptr);
}
| 31.045918 | 134 | 0.652588 | mattvchandler |
80eae8dda71122b56fbf3c238af4f2ecccd455a5 | 13,517 | cpp | C++ | allocator/buddyallocator.cpp | StiliyanDr/allocator | eb83302d52b1992509556cfa7044c4b99884ad2a | [
"MIT"
] | null | null | null | allocator/buddyallocator.cpp | StiliyanDr/allocator | eb83302d52b1992509556cfa7044c4b99884ad2a | [
"MIT"
] | null | null | null | allocator/buddyallocator.cpp | StiliyanDr/allocator | eb83302d52b1992509556cfa7044c4b99884ad2a | [
"MIT"
] | null | null | null | #include "buddyallocator.hpp"
#include <assert.h>
#include <memory>
#include <stdexcept>
#include <utility>
#include "insufficientmemory.hpp"
namespace allocator
{
BuddyAllocator::BuddyAllocator() :
free_lists(nullptr)
{
}
BuddyAllocator::BuddyAllocator(void* memory, std::size_t size)
{
verify_pointer_is_not_null(memory);
const auto memory_descriptor =
set_logical_start_size_and_levels_count(memory, size);
const auto free_memory_start =
create_data_structures(memory_descriptor);
initialise_data_structures(free_memory_start);
}
void BuddyAllocator::verify_pointer_is_not_null(void* memory)
{
if (memory == nullptr)
{
throw std::invalid_argument{ "Expected a pointer to memory!" };
}
}
BuddyAllocator::MemoryDescriptor
BuddyAllocator::set_logical_start_size_and_levels_count(
void* memory,
std::size_t size
)
{
const auto aligned_memory = first_aligned_address_within(memory, size);
auto actual_size = std::size_t(size - subtract(aligned_memory, memory));
const auto wasted_bytes_at_end = actual_size % LEAF_SIZE;
actual_size -= wasted_bytes_at_end;
set_size(actual_size);
set_start(aligned_memory, actual_size);
set_levels_count();
return { aligned_memory, actual_size, wasted_bytes_at_end };
}
void* BuddyAllocator::first_aligned_address_within(void* memory,
std::size_t size)
{
const auto result = std::align(ALIGNMENT_REQUIREMENT,
LEAF_SIZE,
memory,
size);
if (result != nullptr)
{
return result;
}
else
{
throw InsufficientMemory{};
}
}
std::size_t BuddyAllocator::subtract(void* a, void* b)
{
assert(a >= b);
return value_of_pointer(a) - value_of_pointer(b);
}
void BuddyAllocator::set_size(std::size_t actual_size)
{
assert(actual_size >= LEAF_SIZE);
size = next_power_of_two(actual_size);
}
void BuddyAllocator::set_start(void* actual_start,
std::size_t actual_size)
{
const auto logical_memory_size = std::size_t(size - actual_size);
start = value_of_pointer(actual_start) - logical_memory_size;
}
void BuddyAllocator::set_levels_count()
{
levels_count = log2(size / LEAF_SIZE) + 1;
if (levels_count < MIN_LEVELS_COUNT)
{
throw InsufficientMemory{};
}
}
void* BuddyAllocator::create_data_structures(MemoryDescriptor memory)
{
memory = create_free_lists(memory);
return create_maps(memory);
}
BuddyAllocator::MemoryDescriptor
BuddyAllocator::create_free_lists(const MemoryDescriptor& memory)
{
const auto size_per_list = compute_size_per_list(memory);
const auto size_for_lists = levels_count * size_per_list;
if (size_for_lists < memory.size)
{
free_lists = new (memory.start) FreeList[levels_count];
return { add_to(memory.start, size_for_lists),
memory.size - size_for_lists,
memory.wasted_bytes_at_end };
}
else
{
throw InsufficientMemory{};
}
}
std::size_t BuddyAllocator::compute_size_per_list(
const MemoryDescriptor& memory
)
{
const auto size_of_list = sizeof(FreeList);
assert(size_of_list < memory.size);
auto first_list_end = add_to(memory.start, size_of_list);
auto available_space = std::size_t(memory.size - size_of_list);
const auto second_list = std::align(alignof(FreeList),
size_of_list,
first_list_end,
available_space);
assert(second_list != nullptr);
return subtract(second_list, memory.start);
}
void* BuddyAllocator::create_maps(const MemoryDescriptor& memory)
{
const auto bit_map_size = two_to_the_power_of(levels_count - 1);
const auto bit_map_size_in_bytes = size_in_bytes(bit_map_size);
const auto maps_start = determine_maps_storage(
2 * bit_map_size_in_bytes,
memory
);
split_map = BitMap(maps_start, bit_map_size - 1);
free_map = BitMap(maps_start + bit_map_size_in_bytes, bit_map_size);
free_map.flip(0);
return add_to(
memory.start,
maps_start == memory.start ?
2 * bit_map_size_in_bytes : 0
);
}
unsigned char* BuddyAllocator::determine_maps_storage(
std::size_t maps_size,
const MemoryDescriptor& memory
)
{
auto result = static_cast<void*>(nullptr);
if (maps_size <= memory.wasted_bytes_at_end)
{
result = add_to(memory.start, memory.size);
}
else if (maps_size < memory.size)
{
result = memory.start;
}
else
{
throw InsufficientMemory{};
}
return reinterpret_cast<unsigned char*>(result);
}
void BuddyAllocator::initialise_data_structures(
void* free_memory_start
)
{
const auto preallocated_size =
value_of_pointer(free_memory_start) - start;
const auto first_leaf = first_index_at(levels_count - 1);
const auto last_leaf_to_allocate =
first_leaf + size_in_leaves(preallocated_size) - 1;
preallocate_leaves_until(last_leaf_to_allocate);
}
void BuddyAllocator::preallocate_leaves_until(std::size_t leaf)
{
mark_blocks_as_allocated_until(leaf, levels_count - 1);
preallocate_leaves_parents_until(
parent_of(leaf),
leaf
);
}
void BuddyAllocator::mark_blocks_as_allocated_until(std::size_t index,
std::size_t level)
{
if (is_even(to_level_index(index, level)))
{
flip_free_map_at(index);
}
}
void BuddyAllocator::flip_free_map_at(std::size_t index)
{
free_map.flip(free_map_index_for(index));
}
bool BuddyAllocator::free_map_at(std::size_t index) const
{
return free_map.at(free_map_index_for(index));
}
void BuddyAllocator::preallocate_leaves_parents_until(
std::size_t index,
std::size_t last_preallocated_leaf
)
{
auto level = int(levels_count - 2);
auto last_block_to_allocate = index;
auto last_allocated_child = last_preallocated_leaf;
while (level >= 0)
{
mark_blocks_as_split_until(last_block_to_allocate, level);
mark_blocks_as_allocated_until(last_block_to_allocate, level);
insert_free_blocks_at(level + 1,
last_allocated_child,
last_block_to_allocate);
--level;
last_allocated_child = last_block_to_allocate;
last_block_to_allocate = parent_of(last_block_to_allocate);
}
}
void BuddyAllocator::mark_blocks_as_split_until(std::size_t index,
std::size_t level)
{
assert(level < levels_count - 1);
for (auto i = first_index_at(level);
i <= index;
++i)
{
split_map.flip(i);
}
}
void BuddyAllocator::insert_free_blocks_at(std::size_t level,
std::size_t last_allocated_block,
std::size_t last_allocated_parent)
{
assert(level < levels_count);
const auto right_child = right_child_of(last_allocated_parent);
if (right_child > last_allocated_block)
{
free_lists[level].insert(
to_address(right_child, level)
);
}
}
void* BuddyAllocator::to_address(std::size_t index,
std::size_t level) const
{
const auto preceding_blocks_count =
index - first_index_at(level);
return as_pointer(start +
preceding_blocks_count * size_at(level));
}
BuddyAllocator::BuddyAllocator(BuddyAllocator&& source) :
start(source.start),
size(source.size),
levels_count(source.levels_count),
free_lists(source.free_lists),
split_map(std::move(source.split_map)),
free_map(std::move(source.free_map))
{
source.clear();
}
BuddyAllocator& BuddyAllocator::operator=(BuddyAllocator&& rhs)
{
if (this != &rhs)
{
auto copy = std::move(rhs);
swap_contents_with(copy);
}
return *this;
}
void BuddyAllocator::swap_contents_with(BuddyAllocator& other)
{
std::swap(this->start, other.start);
std::swap(this->size, other.size);
std::swap(this->levels_count, other.levels_count);
std::swap(this->free_lists, other.free_lists);
std::swap(this->split_map, other.split_map);
std::swap(this->free_map, other.free_map);
}
void* BuddyAllocator::allocate(std::size_t size)
{
auto block = static_cast<void*>(nullptr);
if (manages_memory() && size != 0)
{
const auto level = level_for_block_with(size);
if (level != -1)
{
assert(level >= 0);
assert(level < levels_count);
block = allocate_block_at(level);
}
}
return block;
}
int BuddyAllocator::level_for_block_with(std::size_t size) const
{
assert(size > 0);
if (size <= LEAF_SIZE)
{
return levels_count - 1;
}
else if (size <= this->size)
{
return level_for_block_with_power_of_two_size(
next_power_of_two(size)
);
}
else
{
return -1;
}
}
void* BuddyAllocator::allocate_block_at(std::size_t level)
{
auto& free_blocks = free_lists[level];
if (free_blocks.is_empty())
{
if (level == 0)
{
return nullptr;
}
const auto block = allocate_block_at(level - 1);
if (block != nullptr)
{
split_map.flip(index_of(block, level - 1));
insert_in(free_blocks, block, add_to(block, size_at(level)));
}
else
{
return nullptr;
}
}
const auto result = free_blocks.extract();
flip_free_map_at(index_of(result, level));
return result;
}
std::size_t BuddyAllocator::index_of(void* ptr,
std::size_t level) const
{
return first_index_at(level) + index_at(level, ptr);
}
std::size_t BuddyAllocator::index_at(std::size_t level,
void* ptr) const
{
return (value_of_pointer(ptr) - start) / size_at(level);
}
void BuddyAllocator::deallocate(void* block)
{
if (manages_memory() && block != nullptr)
{
free(block, level_of(block));
}
}
std::size_t BuddyAllocator::level_of(void* p) const
{
auto level = levels_count - 1;
auto index = index_of(p, level);
while (level > 0)
{
const auto parent = parent_of(index);
if (split_map.at(parent))
{
break;
}
else
{
--level;
index = parent;
}
}
return level;
}
void BuddyAllocator::free(void* block, std::size_t level)
{
assert(block != nullptr);
assert(level < levels_count);
free(block, level, index_of(block, level));
}
void BuddyAllocator::free(void* block,
std::size_t level,
std::size_t index)
{
auto& free_blocks = free_lists[level];
if (free_map_at(index))
{
assert(level > 0);
const auto buddy_level_index =
to_level_index(buddy_of(index), level);
const auto buddy =
as_pointer(start + buddy_level_index * size_at(level));
free_blocks.remove(buddy);
const auto parent = parent_of(index);
split_map.flip(parent);
free(to_address(parent, level - 1), level - 1, parent);
}
else
{
free_blocks.insert(block);
}
flip_free_map_at(index);
}
void BuddyAllocator::deallocate(void* block, std::size_t size)
{
if (manages_memory() && block != nullptr)
{
const auto level =
level_for_block_with(size);
assert(level >= 0);
free(block, level);
}
}
} | 26.246602 | 81 | 0.55138 | StiliyanDr |
80ef0c9370db2488cac6a2d292106e0d7f4291ec | 469 | cpp | C++ | pre_ast/nodes/statement_with_two_bodies.cpp | kahveciderin/cornpiler | b6f843eb44e7b79ef74b0943ec9792ab1cb4740c | [
"Unlicense"
] | null | null | null | pre_ast/nodes/statement_with_two_bodies.cpp | kahveciderin/cornpiler | b6f843eb44e7b79ef74b0943ec9792ab1cb4740c | [
"Unlicense"
] | null | null | null | pre_ast/nodes/statement_with_two_bodies.cpp | kahveciderin/cornpiler | b6f843eb44e7b79ef74b0943ec9792ab1cb4740c | [
"Unlicense"
] | null | null | null | #include "statement_with_two_bodies.hpp"
ast_types::statement_with_two_bodies::statement_with_two_bodies() { act = act_type::statement_with_two_bodies; }
std::string ast_types::statement_with_two_bodies::print_node() {
return "\"statement_with_two_bodies\": {\"name\":" + this->name.print_node() +
",\"args\": " + this->args.print_node() +
",\"body1\": " + this->body.print_node() +
",\"body2\": " + this->second_body.print_node() + "}";
} | 52.111111 | 112 | 0.663113 | kahveciderin |
80f2405fa92fe83e58f69c27345bb4323bbb5bb3 | 27,406 | cpp | C++ | src/mongo/s/metadata_loader_test.cpp | edaniels/mongo | 60f9f92f966d7bfabe722d96bc6e196292a4d051 | [
"Apache-2.0"
] | null | null | null | src/mongo/s/metadata_loader_test.cpp | edaniels/mongo | 60f9f92f966d7bfabe722d96bc6e196292a4d051 | [
"Apache-2.0"
] | null | null | null | src/mongo/s/metadata_loader_test.cpp | edaniels/mongo | 60f9f92f966d7bfabe722d96bc6e196292a4d051 | [
"Apache-2.0"
] | null | null | null | /**
* Copyright (C) 2012 10gen Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <boost/scoped_ptr.hpp>
#include <vector>
#include "mongo/base/status.h"
#include "mongo/client/connpool.h"
#include "mongo/client/dbclientinterface.h"
#include "mongo/db/jsobj.h"
#include "mongo/dbtests/mock/mock_conn_registry.h"
#include "mongo/dbtests/mock/mock_remote_db_server.h"
#include "mongo/s/collection_metadata.h"
#include "mongo/s/metadata_loader.h"
#include "mongo/s/type_chunk.h"
#include "mongo/s/type_collection.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/net/hostandport.h"
namespace {
using boost::scoped_ptr;
using mongo::BSONObj;
using mongo::BSONArray;
using mongo::ChunkType;
using mongo::ChunkVersion;
using mongo::CollectionMetadata;
using mongo::CollectionType;
using mongo::ConnectionString;
using mongo::Date_t;
using mongo::ErrorCodes;
using mongo::HostAndPort;
using mongo::MAXKEY;
using mongo::MINKEY;
using mongo::MetadataLoader;
using mongo::OID;
using mongo::MockConnRegistry;
using mongo::MockRemoteDBServer;
using mongo::ScopedDbConnection;
using mongo::Status;
using std::string;
using std::vector;
const std::string CONFIG_HOST_PORT = "$dummy_config:27017";
const ConnectionString CONFIG_LOC( CONFIG_HOST_PORT );
// TODO: Test config server down
// TODO: Test read of chunks with new epoch
// TODO: Test that you can properly load config using format with deprecated fields?
TEST(MetadataLoader, DroppedColl) {
MockRemoteDBServer dummyConfig( CONFIG_HOST_PORT );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( &dummyConfig );
CollectionType collInfo;
collInfo.setNS( "test.foo");
collInfo.setUpdatedAt( 0 );
collInfo.setEpoch( OID() );
collInfo.setDropped( true );
string errMsg;
ASSERT( collInfo.isValid( &errMsg ) );
dummyConfig.insert( CollectionType::ConfigNS, collInfo.toBSON() );
MetadataLoader loader( CONFIG_LOC );
string errmsg;
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
ASSERT_EQUALS( status.code(), ErrorCodes::NamespaceNotFound );
MockConnRegistry::get()->clear();
ScopedDbConnection::clearPool();
}
TEST(MetadataLoader, EmptyColl) {
MockRemoteDBServer dummyConfig( CONFIG_HOST_PORT );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( &dummyConfig );
MetadataLoader loader( CONFIG_LOC );
string errmsg;
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
ASSERT_EQUALS( status.code(), ErrorCodes::NamespaceNotFound );
MockConnRegistry::get()->clear();
ScopedDbConnection::clearPool();
}
TEST(MetadataLoader, BadColl) {
MockRemoteDBServer dummyConfig( CONFIG_HOST_PORT );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( &dummyConfig );
dummyConfig.insert( CollectionType::ConfigNS, BSON( CollectionType::ns("test.foo") ) );
MetadataLoader loader( CONFIG_LOC );
string errmsg;
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
ASSERT_EQUALS( status.code(), ErrorCodes::FailedToParse );
MockConnRegistry::get()->clear();
ScopedDbConnection::clearPool();
}
TEST(MetadataLoader, BadChunk) {
MockRemoteDBServer dummyConfig( CONFIG_HOST_PORT );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( &dummyConfig );
CollectionType collInfo;
collInfo.setNS( "test.foo");
collInfo.setUpdatedAt( 0 );
collInfo.setKeyPattern( BSON("a" << 1) );
collInfo.setEpoch( OID::gen() );
string errMsg;
ASSERT( collInfo.isValid( &errMsg ) );
dummyConfig.insert( CollectionType::ConfigNS, collInfo.toBSON() );
ChunkType chunkInfo;
chunkInfo.setNS( "test.foo");
chunkInfo.setVersion( ChunkVersion( 1, 0, collInfo.getEpoch() ) );
ASSERT( !chunkInfo.isValid( &errMsg ) );
dummyConfig.insert( ChunkType::ConfigNS, chunkInfo.toBSON() );
MetadataLoader loader( CONFIG_LOC );
string errmsg;
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
// For now, since the differ doesn't have parsing errors, we get this kind of status
// NamespaceNotFound since we aren't refreshing off known metadata
// TODO: Make the differ do parse errors
ASSERT_EQUALS( status.code(), ErrorCodes::NamespaceNotFound );
MockConnRegistry::get()->clear();
ScopedDbConnection::clearPool();
}
class NoChunkFixture : public mongo::unittest::Test {
protected:
void setUp() {
_dummyConfig.reset( new MockRemoteDBServer( CONFIG_HOST_PORT ) );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( _dummyConfig.get() );
OID epoch = OID::gen();
BSONObj collFoo = BSON(CollectionType::ns("test.foo") <<
CollectionType::keyPattern(BSON("a" << 1)) <<
CollectionType::unique(false) <<
CollectionType::updatedAt(1ULL) <<
CollectionType::epoch(epoch));
_dummyConfig->insert( CollectionType::ConfigNS, collFoo );
}
void tearDown() {
MockConnRegistry::get()->clear();
ScopedDbConnection::clearPool();
}
private:
scoped_ptr<MockRemoteDBServer> _dummyConfig;
};
TEST_F(NoChunkFixture, NoChunksIsDropped) {
MetadataLoader loader( CONFIG_LOC );
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
// This is interpreted as a dropped ns, since we drop the chunks first
ASSERT_EQUALS( status.code(), ErrorCodes::NamespaceNotFound );
}
class NoChunkHereFixture : public mongo::unittest::Test {
protected:
void setUp() {
_dummyConfig.reset( new MockRemoteDBServer( CONFIG_HOST_PORT ) );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( _dummyConfig.get() );
OID epoch = OID::gen();
CollectionType collType;
collType.setNS( "test.foo" );
collType.setKeyPattern( BSON("a" << 1) );
collType.setUnique( false );
collType.setUpdatedAt( 1ULL );
collType.setEpoch( epoch );
string errMsg;
ASSERT( collType.isValid( &errMsg ) );
_dummyConfig->insert( CollectionType::ConfigNS, collType.toBSON() );
// Need a chunk on another shard, otherwise the chunks are invalid in general and we
// can't load metadata
ChunkType chunkType;
chunkType.setNS( "test.foo");
chunkType.setShard( "shard0001" );
chunkType.setMin( BSON( "a" << MINKEY ) );
chunkType.setMax( BSON( "a" << MAXKEY ) );
chunkType.setVersion( ChunkVersion( 1, 0, epoch ) );
chunkType.setName( OID::gen().toString() );
ASSERT( chunkType.isValid( &errMsg ) );
_dummyConfig->insert( ChunkType::ConfigNS, chunkType.toBSON() );
}
MockRemoteDBServer* getDummyConfig(){
return _dummyConfig.get();
}
void tearDown() {
MockConnRegistry::get()->clear();
ScopedDbConnection::clearPool();
}
private:
scoped_ptr<MockRemoteDBServer> _dummyConfig;
};
TEST_F(NoChunkHereFixture, CheckNumChunk) {
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
ASSERT( status.isOK() );
ASSERT_EQUALS( 0U, metadata.getNumChunks() );
ASSERT_EQUALS( 1, metadata.getCollVersion().majorVersion() );
ASSERT_EQUALS( 0, metadata.getShardVersion().majorVersion() );
ASSERT_NOT_EQUALS( OID(), metadata.getCollVersion().epoch() );
ASSERT_NOT_EQUALS( OID(), metadata.getShardVersion().epoch() );
}
TEST_F(NoChunkHereFixture, BadChunkNotDropped) {
MetadataLoader loader( CONFIG_LOC );
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
ASSERT( status.isOK() );
ChunkType chunkInfo;
chunkInfo.setNS( "test.foo");
chunkInfo.setVersion( ChunkVersion( 1, 0, OID() ) );
string errMsg;
ASSERT( !chunkInfo.isValid( &errMsg ) );
// Replace the chunk with a bad chunk
getDummyConfig()->remove( ChunkType::ConfigNS, BSONObj() );
getDummyConfig()->insert( ChunkType::ConfigNS, chunkInfo.toBSON() );
CollectionMetadata nextMetadata;
status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
&metadata, /* using old metadata */
&nextMetadata );
// Remote change error, since there's not an epoch change and we reloaded no chunks
ASSERT_EQUALS( status.code(), ErrorCodes::RemoteChangeDetected );
MockConnRegistry::get()->clear();
ScopedDbConnection::clearPool();
}
class ConfigServerFixture : public mongo::unittest::Test {
protected:
void setUp() {
_dummyConfig.reset( new MockRemoteDBServer( CONFIG_HOST_PORT ) );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( _dummyConfig.get() );
OID epoch = OID::gen();
_maxCollVersion = ChunkVersion( 1, 0, epoch );
BSONObj collFoo = BSON(CollectionType::ns("test.foo") <<
CollectionType::keyPattern(BSON("a" << 1)) <<
CollectionType::unique(false) <<
CollectionType::updatedAt(1ULL) <<
CollectionType::epoch(epoch));
_dummyConfig->insert( CollectionType::ConfigNS, collFoo );
BSONObj fooSingle = BSON(ChunkType::name("test.foo-a_MinKey") <<
ChunkType::ns("test.foo") <<
ChunkType::min(BSON("a" << MINKEY)) <<
ChunkType::max(BSON("a" << MAXKEY)) <<
ChunkType::DEPRECATED_lastmod(_maxCollVersion.toLong()) <<
ChunkType::DEPRECATED_epoch(epoch) <<
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, fooSingle );
}
void tearDown() {
MockConnRegistry::get()->clear();
}
ChunkVersion getMaxCollVersion() const {
return _maxCollVersion;
}
ChunkVersion getMaxShardVersion() const {
return _maxCollVersion;
}
MockRemoteDBServer* getConfigServer() const {
return _dummyConfig.get();
}
private:
scoped_ptr<MockRemoteDBServer> _dummyConfig;
ChunkVersion _maxCollVersion;
};
TEST_F(ConfigServerFixture, SingleChunkCheckNumChunk) {
// Load from mock server.
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
ASSERT( status.isOK() );
ASSERT_EQUALS( 1U, metadata.getNumChunks() );
}
TEST_F(ConfigServerFixture, SingleChunkGetNext) {
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
loader.makeCollectionMetadata( "test.foo", "shard0000", NULL, /* no old metadata */
&metadata );
ChunkType chunkInfo;
ASSERT_TRUE( metadata.getNextChunk(BSON("a" << MINKEY), &chunkInfo) );
}
TEST_F(ConfigServerFixture, SingleChunkGetShardKey) {
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
loader.makeCollectionMetadata( "test.foo", "shard0000", NULL, /* no old metadata */
&metadata );
ASSERT_TRUE( metadata.getKeyPattern().equal(BSON("a" << 1)) );
}
TEST_F(ConfigServerFixture, SingleChunkGetMaxCollVersion) {
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
loader.makeCollectionMetadata( "test.foo", "shard0000", NULL, /* no old metadata */
&metadata );
ASSERT_TRUE( getMaxCollVersion().isEquivalentTo( metadata.getCollVersion() ) );
}
TEST_F(ConfigServerFixture, SingleChunkGetMaxShardVersion) {
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
loader.makeCollectionMetadata( "test.foo", "shard0000", NULL, /* no old metadata */
&metadata );
ASSERT_TRUE( getMaxShardVersion().isEquivalentTo( metadata.getShardVersion() ) );
}
TEST_F(ConfigServerFixture, NoChunks) {
getConfigServer()->remove( ChunkType::ConfigNS, BSONObj() );
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "test.foo", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
// NSNotFound because we're reloading with no old metadata
ASSERT_EQUALS( status.code(), ErrorCodes::NamespaceNotFound );
}
#if 0
// TODO: MockServer functionality does not support selective query - consider
// inserting nothing at all to chunk/collections collection
TEST_F(ConfigServerFixture, EmptyDataForNS) {
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "not.sharded", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
ASSERT( !status.isOK() );
}
#endif
#if 0
// TODO: d_chunk_manager_test has no tests for passing old ShardChunkManager
class TwoChunkFixture : public mongo::unittest::Test {
protected:
void setUp() {
_dummyConfig.reset( new MockRemoteDBServer( CONFIG_HOST_PORT ) );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( _dummyConfig.get() );
OID epoch = OID::gen();
_maxCollVersion = ChunkVersion( 1, 0, epoch );
BSONObj collFoo = BSON(CollectionType::ns("test.foo") <<
CollectionType::keyPattern(BSON("a" << 1)) <<
CollectionType::unique(false) <<
CollectionType::updatedAt(1ULL) <<
CollectionType::epoch(epoch));
_dummyConfig->insert( CollectionType::ConfigNS, collFoo );
BSONObj fooSingle = BSON(ChunkType::name("test.foo-a_MinKey") <<
ChunkType::ns("test.foo") <<
ChunkType::min(BSON("a" << MINKEY)) <<
ChunkType::max(BSON("a" << MAXKEY)) <<
ChunkType::DEPRECATED_lastmod(_maxCollVersion.toLong()) <<
ChunkType::DEPRECATED_epoch(epoch) <<
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, fooSingle );
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
Status status = loader.makeCollectionMetadata( "not.sharded", // br
"shard0000",
NULL, /* no old metadata */
&_oldMetadata );
ASSERT( status.isOK() );
// Needs to delete the collection and rebuild because the mock server
// not support updates.
_dummyConfig->remove( CollectionType::ConfigNS, BSONObj() );
_dummyConfig->remove( ChunkType::ConfigNS, BSONObj() );
OID epoch2 = OID::gen();
_maxCollVersion = ChunkVersion( 2, 0, epoch2 );
BSONObj collFoo = BSON(CollectionType::ns("test.foo") <<
CollectionType::keyPattern(BSON("a" << 1)) <<
CollectionType::unique(false) <<
CollectionType::updatedAt(2ULL) <<
CollectionType::epoch(epoch2));
_dummyConfig->insert( CollectionType::ConfigNS, collFoo );
BSONObj chunk1 = BSON(ChunkType::name("test.foo-a_MinKey") <<
ChunkType::ns("test.foo") <<
ChunkType::min(BSON("a" << MINKEY)) <<
ChunkType::max(BSON("a" << 100)) <<
ChunkType::DEPRECATED_lastmod(_maxCollVersion.toLong()) <<
ChunkType::DEPRECATED_epoch(epoch2) <<
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, chunk1 );
BSONObj chunk2 = BSON(ChunkType::name("test.foo-a_100") <<
ChunkType::ns("test.foo") <<
ChunkType::min(BSON("a" << 100)) <<
ChunkType::max(BSON("a" << MAXKEY)) <<
ChunkType::DEPRECATED_lastmod(_maxCollVersion.toLong()) <<
ChunkType::DEPRECATED_epoch(epoch2) <<
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, chunk2 );
}
void tearDown() {
MockConnRegistry::get()->removeServer( _dummyConfig->getServerAddress() );
}
ChunkVersion getCollVersion() const {
return _maxCollVersion;
}
const ChunkVersion& getShardVersion( size_t shard ) const {
return _maxCollVersion;
}
const CollectionMetadata* getOldMetadata() const {
return _oldMetadata;
}
private:
scoped_ptr<MockRemoteDBServer> _dummyConfig;
CollectionMetadata _oldMetadata;
ChunkVersion _maxCollVersion;
};
#endif
#if 0
// TODO: MockServer functionality does not support selective query
class ThreeChunkTwoShardFixture : public mongo::unittest::Test {
protected:
void setUp() {
_dummyConfig.reset( new MockRemoteDBServer( CONFIG_HOST_PORT ) );
mongo::ConnectionString::setConnectionHook( MockConnRegistry::get()->getConnStrHook() );
MockConnRegistry::get()->addServer( _dummyConfig.get() );
OID epoch = OID::gen();
_maxCollVersion = ChunkVersion( 1, 0, epoch );
BSONObj collFoo = BSON(CollectionType::ns("test.foo") <<
CollectionType::keyPattern(BSON("a" << 1)) <<
CollectionType::unique(false) <<
CollectionType::updatedAt(1ULL) <<
CollectionType::epoch(epoch));
_dummyConfig->insert( CollectionType::ConfigNS, collFoo );
BSONObj fooSingle = BSON(ChunkType::name("test.foo-a_MinKey") <<
ChunkType::ns("test.foo") <<
ChunkType::min(BSON("a" << MINKEY)) <<
ChunkType::max(BSON("a" << MAXKEY)) <<
ChunkType::DEPRECATED_lastmod(_maxCollVersion.toLong()) <<
ChunkType::DEPRECATED_epoch(epoch) <<
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, fooSingle );
ConnectionString confServerStr( CONFIG_HOST_PORT );
ConnectionString configLoc( confServerStr );
MetadataLoader loader( configLoc );
CollectionMetadata metadata;
Status status = loader.makeCollectionMetadata( "not.sharded", // br
"shard0000",
NULL, /* no old metadata */
&metadata );
ASSERT( status.isOK() );
// Needs to delete the collection and rebuild because the mock server
// not support updates.
_dummyConfig->remove( CollectionType::ConfigNS, BSONObj() );
_dummyConfig->remove( ChunkType::ConfigNS, BSONObj() );
OID epoch2 = OID::gen();
_maxCollVersion = ChunkVersion( 2, 0, epoch2 );
_maxShardVersion.push_back( _maxCollVersion );
BSONObj collFoo = BSON(CollectionType::ns("test.foo") <<
CollectionType::keyPattern(BSON("a" << 1)) <<
CollectionType::unique(false) <<
CollectionType::updatedAt(2ULL) <<
CollectionType::epoch(epoch2));
_dummyConfig->insert( CollectionType::ConfigNS, collFoo );
BSONObj chunk1 = BSON(ChunkType::name("test.foo-a_MinKey") <<
ChunkType::ns("test.foo") <<
ChunkType::min(BSON("a" << MINKEY)) <<
ChunkType::max(BSON("a" << 10)) <<
ChunkType::DEPRECATED_lastmod(_maxCollVersion.toLong()) <<
ChunkType::DEPRECATED_epoch(epoch2) <<
ChunkType::shard("shard0000"));
_dummyConfig->insert( ChunkType::ConfigNS, chunk1 );
OID epoch3 = OID::gen();
_maxCollVersion = ChunkVersion( 2, 0, epoch3 );
_maxShardVersion.push_back( _maxCollVersion );
BSONObj chunk2 = BSON(ChunkType::name("test.foo-a_10") <<
ChunkType::ns("test.foo") <<
ChunkType::min(BSON("a" << 10)) <<
ChunkType::max(BSON("a" << 100)) <<
ChunkType::DEPRECATED_lastmod(_maxCollVersion.toLong()) <<
ChunkType::DEPRECATED_epoch(epoch3) <<
ChunkType::shard("shard0001"));
_dummyConfig->insert( ChunkType::ConfigNS, chunk2 );
BSONObj chunk3 = BSON(ChunkType::name("test.foo-a_100") <<
ChunkType::ns("test.foo") <<
ChunkType::min(BSON("a" << 100)) <<
ChunkType::max(BSON("a" << MAXKEY)) <<
ChunkType::DEPRECATED_lastmod(_maxCollVersion.toLong()) <<
ChunkType::DEPRECATED_epoch(epoch3) <<
ChunkType::shard("shard0001"));
_dummyConfig->insert( ChunkType::ConfigNS, chunk3 );
}
void tearDown() {
MockConnRegistry::get()->removeServer( _dummyConfig->getServerAddress() );
}
ChunkVersion getCollVersion() const {
return _maxCollVersion;
}
const ChunkVersion& getShardVersion( size_t shard ) const {
return _maxShardVersion[shard];
}
private:
scoped_ptr<MockRemoteDBServer> _dummyConfig;
CollectionMetadata _oldMetadata;
ChunkVersion _maxCollVersion;
vector<ChunkVersion> _maxShardVersion;
};
#endif
}
// unnamed namespace
| 41.15015 | 100 | 0.563234 | edaniels |
80f6022056824e14f3d3d63c443688449a0a547f | 11,182 | cpp | C++ | util/stringutils.cpp | velezladonna/mwc-qt-wallet | bd241b91d28350e17e52a10208e663fcb992d7cc | [
"Apache-2.0"
] | 1 | 2020-03-19T10:02:16.000Z | 2020-03-19T10:02:16.000Z | util/stringutils.cpp | velezladonna/mwc-qt-wallet | bd241b91d28350e17e52a10208e663fcb992d7cc | [
"Apache-2.0"
] | null | null | null | util/stringutils.cpp | velezladonna/mwc-qt-wallet | bd241b91d28350e17e52a10208e663fcb992d7cc | [
"Apache-2.0"
] | null | null | null | // Copyright 2019 The MWC Developers
//
// 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 "../core/global.h"
#include "stringutils.h"
#include <QDateTime>
namespace util {
QVector<QString> parsePhrase2Words( const QString & phrase ) {
// input seed in low cases
QVector<QString> words;
words.push_back("");
for (QChar ch : phrase) {
if (ch.isLetter()) { // letter goes to the last word
words.back()+=ch;
}
else {
// Start new word
if (words.back().length()==0)
continue;
words.push_back("");
}
}
// Clean up the last seprator case
if (words.back().length()==0)
words.pop_back();
return words;
}
// convert nano items to dtirng that represent that fraction as a double
QString nano2one( int64_t nano ) {
if (nano == 0)
return "0";
if (nano<0)
return "-" + nano2one(-nano);
QString myNumber = QString::number( std::abs(nano),10);
while (myNumber.length()<9+1)
myNumber = "0" + myNumber;
myNumber.insert( myNumber.length()-9, '.' );
while( myNumber[myNumber.length()-1] == '0' ) {
myNumber.remove(myNumber.length()-1,1);
}
if (myNumber[myNumber.length()-1] == '.')
myNumber.remove(myNumber.length()-1,1);
if (nano<0)
myNumber.push_front("-");
return myNumber;
}
// 1.0100000 => 1.01 or 0001.0000000 => 1
QString zeroDbl2Dbl(QString dbl) {
QString res = dbl.trimmed();
// remove leading chars
while( res.length()>1 && res[0]=='0' && res[1]!='.' )
res = res.mid(1);
int ptIdx = res.indexOf('.');
if (ptIdx>0) {
while( res.length()>ptIdx && res[res.length()-1]=='0' )
res = res.left(res.length()-1);
if (res[res.length()-1]=='.')
res = res.left(res.length()-1);
}
return res;
}
// convert string representing double into nano
QPair<bool,int64_t> one2nano(QString str) {
if (str.length()==0)
return QPair<bool,int64_t>(false, 0);
bool ok = false;
double dbl = str.toDouble(&ok);
if (!ok)
return QPair<bool,int64_t>(false, 0);
int64_t s = 1;
if ( dbl < 0.0 ) {
s = -1;
dbl = -dbl;
}
int64_t nano = int64_t(dbl * 1000000000.0 + 0.5);
return QPair<bool,int64_t>( true, nano*s );
}
// Trim string that represent double. 23434.32345, len 7 => 23434.32; 23434.32345, len 5 => 23434
QString trimStrAsDouble(const QString & dblStr, int maxLen) {
if (dblStr.size() < maxLen)
return dblStr;
QString res = dblStr;
int ptIdx = res.indexOf('.');
if (ptIdx<=0)
return res;
res = res.left( std::max(ptIdx, maxLen) );
if ( res[res.size()-1] == '.' ) {
res = res.left( res.size()-1 );
}
return res;
}
// convert int64_t strign into shorter version
// abcdefgh => abc...
QString string2shortStrR( QString str, int lenLimit ) {
if ( str.length() < lenLimit )
return str;
int pts = std::min(3,lenLimit-1);
str.chop( (str.length() - lenLimit)-pts );
for (int i=0;i<pts;i++)
str.push_back('.');
return str;
}
// 'abc' => 'abc '
QString expandStrR(QString str, int len, QChar filler ) {
while(str.length() < len)
str.push_back(filler);
return str;
}
// 'abc' => ' abc'
QString expandStrL(QString str, int len, QChar filler ) {
while(str.length() < len)
str.push_front(filler);
return str;
}
// 'abc' => ' abc '
QString expandStrM(QString str, int len, QChar filler ) {
while(str.length() < len) {
str.push_front(filler);
if (str.length() < len)
str.push_back(filler);
}
return str;
}
// Filter Error message: "error: Not enough funds." => "Not enough funds."
QString trimErrorMessage(QString errorMsg) {
errorMsg = errorMsg.trimmed();
if ( errorMsg.startsWith("error:", Qt::CaseInsensitive) )
return errorMsg.mid( (int)strlen("error:") ).trimmed();
if ( errorMsg.startsWith("warning:", Qt::CaseInsensitive) )
return errorMsg.mid( (int)strlen("warning:") ).trimmed();
if ( errorMsg.startsWith("info:", Qt::CaseInsensitive) )
return errorMsg.mid( (int)strlen("info:") ).trimmed();
return errorMsg;
}
// Format bunch of error messages to be ready pronted one by one
QString formatErrorMessages(QStringList messages) {
QString errMsg;
for (auto & err : messages) {
if (errMsg.size()>0)
errMsg += "\n";
errMsg += util::trimErrorMessage(err);
}
return errMsg;
}
// Get safely substring from the string. If indexes out of range, return emoty string
QString getSubString(const QString & str, int idx1, int idx2) {
idx2 = std::min(idx2, str.length());
if (idx2<=idx1 || idx1>=str.length())
return "";
return str.mid(idx1, idx2-idx1).trimmed();
}
static int calcOffsetFromUTC() {
return QDateTime::currentDateTime().offsetFromUtc();
}
// Convert mwc713 UTC time to this wallet time. Time template is different.
QString mwc713time2ThisTime(QString mwc713TimeStr) {
if (mwc713TimeStr.isEmpty())
return mwc713TimeStr;
static int offsetFromUTC = calcOffsetFromUTC();
QDateTime time = QDateTime::fromString(mwc713TimeStr, mwc::DATETIME_TEMPLATE_MWC713 );
time = time.addSecs(offsetFromUTC);
QString res = time.toString( mwc::DATETIME_TEMPLATE_THIS);
return res;
}
QPair <bool, QString> validateMwc713Str(QString str, bool secureStr) {
QString nonAsciiChars;
for ( QChar ch : str ) {
if ( ch.isLowSurrogate() || ch.isNonCharacter() || ch.isSurrogate() )
return QPair<bool, QString>( false, (secureStr ? "Input string " : "String '" + str + "' ") + "contains not acceptable unicode characters" );
// https://ascii.cl/
ushort code = ch.unicode();
if ( code>=32 && code<127 )
continue; // Acceptable symbols
if ( !nonAsciiChars.contains(ch) )
nonAsciiChars += ch;
}
if (nonAsciiChars.isEmpty()) // success
return QPair<bool, QString>(true, "");
// generating the report about inputs
QString reportStr = (secureStr ? "Input string " : "String '" + str + "' ") + "contains not acceptable symbols: ";
for (QChar ch : nonAsciiChars)
reportStr += QString("'") + ch + "',";
return QPair<bool, QString>( false, reportStr.left(reportStr.size()-1) + "." );
}
// String to escape and prepare for mwc713 input.
// str - string to process as sdd => "as sdd"; pa@"a\s => "pa@\"a\\s"
// noSpecialCharacters - if true will clean up all characters like a new line
QString toMwc713input(QString str, bool noSpecialCharacters ) {
QString res = "\"";
for (QChar ch : str) {
if (noSpecialCharacters && ch.unicode() < 32 ) // skipping all special chars
continue;
if (ch == '"')
res += "\\\"";
else if (ch == '\\')
res += "\\\\";
else
res += ch;
}
res += "\"";
return res;
}
// Formal long number to string. Example 78,765
QString longLong2Str(int64_t n) {
QString res = QString::number(n);
if (res.size()<=3)
return res;
// add commas every 3 digits
int pos = res.length() - 3;
while ( pos>0 && res[pos-1].isDigit() ) {
res.insert(pos, ',');
pos -= 3;
}
return res;
}
// Formal long number to string with length Limit. Example 1123123123, 9 => 1123.12 M
QString longLong2ShortStr(int64_t n, int lengthLimit) {
QString numberStr = longLong2Str(n);
if (numberStr.length()<=lengthLimit)
return numberStr;
// Need to shorten the string
// We can do
// M - millions, 6+2 digits
// B - billion, 9+3 Digits
// T - trillion, 12+4 Digits
// Q - quadrillions, 15+5 Digits
// Letter will take 2 digits
int scale = numberStr.length() - lengthLimit + 2;
QString decimals;
QString letter;
QString number;
if (scale <= 6+2) {
letter = "M";
scale = 6+2;
}
else if (scale <= 9+3) {
letter = "B";
scale = 9+3;
}
else if (scale <= 12+4) {
letter = "T";
scale = 12+4;
}
else {
letter = "Q";
scale = 15+5;
}
number = numberStr.left( numberStr.size() - scale );
decimals = numberStr.right( scale ).remove(',');
if (decimals.length()>3)
decimals = decimals.left(3); // we really don't want print many decimals. It doesn't look good
if (number.length()+2 <= lengthLimit-2 ) {
number += "." + decimals;
number = number.left(lengthLimit-2);
// Clean up .00
while ( number.size()>0 && number[number.size()-1] == '0' )
number = number.left(number.size()-1);
if ( number.size()>0 && number[number.size()-1] == '.' )
number = number.left(number.size()-1);
}
return number + " " + letter;
}
static bool isunreserved(unsigned char in)
{
switch(in) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case 'a': case 'b': case 'c': case 'd': case 'e':
case 'f': case 'g': case 'h': case 'i': case 'j':
case 'k': case 'l': case 'm': case 'n': case 'o':
case 'p': case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D': case 'E':
case 'F': case 'G': case 'H': case 'I': case 'J':
case 'K': case 'L': case 'M': case 'N': case 'O':
case 'P': case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
case '-': case '.': case '_': case '~':
return true;
default:
break;
}
return false;
}
static const QString hexEncStr = "0123456789ABCDEF";
// Encode String into URL format. Expected that it is param or value
// https://en.wikipedia.org/wiki/Percent-encoding#Percent-encoding_in_a_URI
// All not unreserved MUST be encoded.
QString urlEncode( QString str ) {
QString result;
QByteArray chars = str.toUtf8();
// utf 8 fits isunreserved pretty well. Only 1 byte can be mapped to the symbol
for (unsigned char ch : chars ) {
if (isunreserved(ch)) {
result += ch;
}
else {
// Percent encoding is required
uint chI = ch;
result += '%';
result += hexEncStr[chI/16];
result += hexEncStr[chI%16];
}
}
return result;
}
}
| 28.025063 | 153 | 0.57682 | velezladonna |
80f6e80ae172b31325dd4d0436339854d817c833 | 2,888 | cc | C++ | Core/DianYing/Source/Component/Internal/Script/Widget/FDyWidgetScriptStatus.cc | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | 4 | 2019-03-17T19:46:54.000Z | 2019-12-09T20:11:01.000Z | Core/DianYing/Source/Component/Internal/Script/Widget/FDyWidgetScriptStatus.cc | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | null | null | null | Core/DianYing/Source/Component/Internal/Script/Widget/FDyWidgetScriptStatus.cc | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | null | null | null | #include <precompiled.h>
///
/// MIT License
/// Copyright (c) 2018-2019 Jongmin Yun
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
///
/// Header file
#include <Dy/Component/Internal/Script/FWidgetScriptState.h>
#include <Dy/Component/Internal/Widget/CBaseWidgetScript.h>
#include <Dy/Component/Internal/Widget/CWidgetScriptCpp.h>
#include <Dy/Meta/Information/ScriptMetaInformation.h>
#include <Dy/Helper/System/Assertion.h>
namespace dy
{
FWidgetScriptState::FWidgetScriptState(FWidget& widgetReference, const PDyScriptInstanceMetaInfo& descriptor)
: mStatus{EScriptState::CalledNothing},
mType{descriptor.mScriptType}
{
switch (this->mType)
{
case EDyScriptType::Cpp:
{ // Cpp
this->mScriptInstance = std::make_unique<CWidgetScriptCpp>(widgetReference, descriptor);
} break;
case EDyScriptType::Lua:
{ // Lua
MDY_NOT_IMPLEMENTED_ASSERT();
} break;
default: MDY_UNEXPECTED_BRANCH();
}
}
void FWidgetScriptState::CallScriptFunction(TF32 dt) noexcept
{
MDY_ASSERT_MSG(MDY_CHECK_ISNOTEMPTY(this->mScriptInstance),"Script instace must be activated!");
MDY_ASSERT_MSG(this->mStatus != EScriptState::NoneError, "FDyScriptState must be initialized!");
switch (this->mStatus)
{
case EScriptState::CalledNothing:
this->mScriptInstance->Initiate();
this->mStatus = EScriptState::CalledInitiate;
break;
case EScriptState::CalledInitiate:
this->mScriptInstance->Start();
this->mScriptInstance->Update(dt);
this->mStatus = EScriptState::CalledUpdate;
break;
case EScriptState::CalledUpdate:
this->mScriptInstance->Update(dt);
break;
default: MDY_UNEXPECTED_BRANCH(); break;
}
}
void FWidgetScriptState::MDY_PRIVATE(CallDestroyFunctionAnyway)() noexcept
{
MDY_ASSERT_MSG(MDY_CHECK_ISNOTEMPTY(this->mScriptInstance),"Script instace must be activated!");
this->mScriptInstance->Destroy();
}
EDyScriptType FWidgetScriptState::GetScriptType() const noexcept
{
MDY_ASSERT_MSG(this->mType != decltype(this->mType)::NoneError, "Script type must be specified properly.");
return this->mType;
}
EScriptState FWidgetScriptState::GetScriptStatus() const noexcept
{
return this->mStatus;
}
CBaseWidgetScript* FWidgetScriptState::MDY_PRIVATE(GetPtrInternalWidgetScript)() const noexcept
{
MDY_ASSERT_MSG(MDY_CHECK_ISNOTEMPTY(this->mScriptInstance), "Internal script instance must be valid.");
return this->mScriptInstance.get();
}
} /// ::dy namespace | 32.449438 | 110 | 0.756579 | liliilli |
80fbdfc39197bacf52a50250240993dbf19c38dc | 16,849 | cpp | C++ | latte-dock/app/main.cpp | VaughnValle/lush-pop | cdfe9d7b6a7ebb89ba036ab9a4f07d8db6817355 | [
"MIT"
] | 64 | 2020-07-08T18:49:29.000Z | 2022-03-23T22:58:49.000Z | latte-dock/app/main.cpp | VaughnValle/kanji-pop | 0153059f0c62a8aeb809545c040225da5d249bb8 | [
"MIT"
] | 1 | 2021-04-02T04:39:45.000Z | 2021-09-25T11:53:18.000Z | latte-dock/app/main.cpp | VaughnValle/kanji-pop | 0153059f0c62a8aeb809545c040225da5d249bb8 | [
"MIT"
] | 11 | 2020-12-04T18:19:11.000Z | 2022-01-10T08:50:08.000Z | /*
* Copyright 2016 Smith AR <audoban@openmailbox.org>
* Michail Vourlakos <mvourlakos@gmail.com>
*
* This file is part of Latte-Dock
*
* Latte-Dock is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* Latte-Dock 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/>.
*/
// local
#include "config-latte.h"
#include "apptypes.h"
#include "lattecorona.h"
#include "layouts/importer.h"
// C++
#include <memory>
#include <csignal>
// Qt
#include <QApplication>
#include <QDebug>
#include <QQuickWindow>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QDir>
#include <QLockFile>
#include <QSharedMemory>
// KDE
#include <KCrash>
#include <KLocalizedString>
#include <KAboutData>
#include <KDBusService>
#include <KQuickAddons/QtQuickSettings>
//! COLORS
#define CNORMAL "\e[0m"
#define CIGREEN "\e[1;32m"
#define CGREEN "\e[0;32m"
#define CICYAN "\e[1;36m"
#define CCYAN "\e[0;36m"
#define CIRED "\e[1;31m"
#define CRED "\e[0;31m"
inline void configureAboutData();
inline void detectPlatform(int argc, char **argv);
inline void filterDebugMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg);
QString filterDebugMessageText;
int main(int argc, char **argv)
{
//Plasma scales itself to font DPI
//on X, where we don't have compositor scaling, this generally works fine.
//also there are bugs on older Qt, especially when it comes to fractional scaling
//there's advantages to disabling, and (other than small context menu icons) few advantages in enabling
//On wayland, it's different. Everything is simpler as all co-ordinates are in the same co-ordinate system
//we don't have fractional scaling on the client so don't hit most the remaining bugs and
//even if we don't use Qt scaling the compositor will try to scale us anyway so we have no choice
if (!qEnvironmentVariableIsSet("PLASMA_USE_QT_SCALING")) {
qunsetenv("QT_DEVICE_PIXEL_RATIO");
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
} else {
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
}
QQuickWindow::setDefaultAlphaBuffer(true);
const bool qpaVariable = qEnvironmentVariableIsSet("QT_QPA_PLATFORM");
detectPlatform(argc, argv);
QApplication app(argc, argv);
if (!qpaVariable) {
// don't leak the env variable to processes we start
qunsetenv("QT_QPA_PLATFORM");
}
KQuickAddons::QtQuickSettings::init();
KLocalizedString::setApplicationDomain("latte-dock");
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("latte-dock")));
//protect from closing app when changing to "alternative session" and back
app.setQuitOnLastWindowClosed(false);
configureAboutData();
QCommandLineParser parser;
parser.addHelpOption();
parser.addOptions({
{{"r", "replace"}, i18nc("command line", "Replace the current Latte instance.")}
, {{"d", "debug"}, i18nc("command line", "Show the debugging messages on stdout.")}
, {{"cc", "clear-cache"}, i18nc("command line", "Clear qml cache. It can be useful after system upgrades.")}
, {"default-layout", i18nc("command line", "Import and load default layout on startup.")}
, {"available-layouts", i18nc("command line", "Print available layouts")}
, {"layout", i18nc("command line", "Load specific layout on startup."), i18nc("command line: load", "layout_name")}
, {"import-layout", i18nc("command line", "Import and load a layout."), i18nc("command line: import", "file_name")}
, {"import-full", i18nc("command line", "Import full configuration."), i18nc("command line: import", "file_name")}
, {"single", i18nc("command line", "Single layout memory mode. Only one layout is active at any case.")}
, {"multiple", i18nc("command line", "Multiple layouts memory mode. Multiple layouts can be active at any time based on Activities running.")}
});
//! START: Hidden options for Developer and Debugging usage
QCommandLineOption graphicsOption(QStringList() << QStringLiteral("graphics"));
graphicsOption.setDescription(QStringLiteral("Draw boxes around of the applets."));
graphicsOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(graphicsOption);
QCommandLineOption withWindowOption(QStringList() << QStringLiteral("with-window"));
withWindowOption.setDescription(QStringLiteral("Open a window with much debug information"));
withWindowOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(withWindowOption);
QCommandLineOption maskOption(QStringList() << QStringLiteral("mask"));
maskOption.setDescription(QStringLiteral("Show messages of debugging for the mask (Only useful to devs)."));
maskOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(maskOption);
QCommandLineOption timersOption(QStringList() << QStringLiteral("timers"));
timersOption.setDescription(QStringLiteral("Show messages for debugging the timers (Only useful to devs)."));
timersOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(timersOption);
QCommandLineOption spacersOption(QStringList() << QStringLiteral("spacers"));
spacersOption.setDescription(QStringLiteral("Show visual indicators for debugging spacers (Only useful to devs)."));
spacersOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(spacersOption);
QCommandLineOption overloadedIconsOption(QStringList() << QStringLiteral("overloaded-icons"));
overloadedIconsOption.setDescription(QStringLiteral("Show visual indicators for debugging overloaded applets icons (Only useful to devs)."));
overloadedIconsOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(overloadedIconsOption);
QCommandLineOption edgesOption(QStringList() << QStringLiteral("kwinedges"));
edgesOption.setDescription(QStringLiteral("Show visual window indicators for hidden screen edge windows."));
edgesOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(edgesOption);
QCommandLineOption localGeometryOption(QStringList() << QStringLiteral("localgeometry"));
localGeometryOption.setDescription(QStringLiteral("Show visual window indicators for calculated local geometry."));
localGeometryOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(localGeometryOption);
QCommandLineOption layouterOption(QStringList() << QStringLiteral("layouter"));
layouterOption.setDescription(QStringLiteral("Show visual debug tags for items sizes."));
layouterOption.setFlags(QCommandLineOption::HiddenFromHelp);
parser.addOption(layouterOption);
QCommandLineOption filterDebugTextOption(QStringList() << QStringLiteral("debug-text"));
filterDebugTextOption.setDescription(QStringLiteral("Show only debug messages that contain specific text."));
filterDebugTextOption.setFlags(QCommandLineOption::HiddenFromHelp);
filterDebugTextOption.setValueName(i18nc("command line: debug-text", "filter_debug_text"));
parser.addOption(filterDebugTextOption);
//! END: Hidden options
parser.process(app);
//! print available-layouts
if (parser.isSet(QStringLiteral("available-layouts"))) {
QStringList layouts = Latte::Layouts::Importer::availableLayouts();
if (layouts.count() > 0) {
qInfo() << i18n("Available layouts that can be used to start Latte:");
for (const auto &layout : layouts) {
qInfo() << " " << layout;
}
} else {
qInfo() << i18n("There are no available layouts, during startup Default will be used.");
}
qGuiApp->exit();
return 0;
}
bool defaultLayoutOnStartup = false;
int memoryUsage = -1;
QString layoutNameOnStartup = "";
//! --default-layout option
if (parser.isSet(QStringLiteral("default-layout"))) {
defaultLayoutOnStartup = true;
} else if (parser.isSet(QStringLiteral("layout"))) {
layoutNameOnStartup = parser.value(QStringLiteral("layout"));
if (!Latte::Layouts::Importer::layoutExists(layoutNameOnStartup)) {
qInfo() << i18nc("layout missing", "This layout doesn't exist in the system.");
qGuiApp->exit();
return 0;
}
}
//! --replace option
QString username = qgetenv("USER");
if (username.isEmpty())
username = qgetenv("USERNAME");
QLockFile lockFile {QDir::tempPath() + "/latte-dock." + username + ".lock"};
int timeout {100};
if (parser.isSet(QStringLiteral("replace")) || parser.isSet(QStringLiteral("import-full"))) {
qint64 pid{ -1};
if (lockFile.getLockInfo(&pid, nullptr, nullptr)) {
kill(static_cast<pid_t>(pid), SIGINT);
timeout = -1;
}
}
if (!lockFile.tryLock(timeout)) {
qInfo() << i18n("An instance is already running!, use --replace to restart Latte");
qGuiApp->exit();
return 0;
}
//! clear-cache option
if (parser.isSet(QStringLiteral("clear-cache"))) {
QDir cacheDir(QDir::homePath() + "/.cache/lattedock/qmlcache");
if (cacheDir.exists()) {
cacheDir.removeRecursively();
qDebug() << "Cache directory found and cleared...";
}
}
//! import-full option
if (parser.isSet(QStringLiteral("import-full"))) {
bool imported = Latte::Layouts::Importer::importHelper(parser.value(QStringLiteral("import-full")));
if (!imported) {
qInfo() << i18n("The configuration cannot be imported");
qGuiApp->exit();
return 0;
}
}
//! import-layout option
if (parser.isSet(QStringLiteral("import-layout"))) {
QString importedLayout = Latte::Layouts::Importer::importLayoutHelper(parser.value(QStringLiteral("import-layout")));
if (importedLayout.isEmpty()) {
qInfo() << i18n("The layout cannot be imported");
qGuiApp->exit();
return 0;
} else {
layoutNameOnStartup = importedLayout;
}
}
//! memory usage option
if (parser.isSet(QStringLiteral("multiple"))) {
memoryUsage = (int)(Latte::MemoryUsage::MultipleLayouts);
} else if (parser.isSet(QStringLiteral("single"))) {
memoryUsage = (int)(Latte::MemoryUsage::SingleLayout);
}
//! text filter for debug messages
if (parser.isSet(QStringLiteral("debug-text"))) {
filterDebugMessageText = parser.value(QStringLiteral("debug-text"));
}
//! debug/mask options
if (parser.isSet(QStringLiteral("debug")) || parser.isSet(QStringLiteral("mask")) || parser.isSet(QStringLiteral("debug-text"))) {
qInstallMessageHandler(filterDebugMessageOutput);
} else {
const auto noMessageOutput = [](QtMsgType, const QMessageLogContext &, const QString &) {};
qInstallMessageHandler(noMessageOutput);
}
auto signal_handler = [](int) {
qGuiApp->exit();
};
std::signal(SIGKILL, signal_handler);
std::signal(SIGINT, signal_handler);
KCrash::setDrKonqiEnabled(true);
KCrash::setFlags(KCrash::AutoRestart | KCrash::AlwaysDirectly);
Latte::Corona corona(defaultLayoutOnStartup, layoutNameOnStartup, memoryUsage);
KDBusService service(KDBusService::Unique);
return app.exec();
}
inline void filterDebugMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
if (msg.endsWith("QML Binding: Not restoring previous value because restoreMode has not been set.This behavior is deprecated.In Qt < 6.0 the default is Binding.RestoreBinding.In Qt >= 6.0 the default is Binding.RestoreBindingOrValue.")
|| msg.endsWith("QML Binding: Not restoring previous value because restoreMode has not been set.\nThis behavior is deprecated.\nYou have to import QtQml 2.15 after any QtQuick imports and set\nthe restoreMode of the binding to fix this warning.\nIn Qt < 6.0 the default is Binding.RestoreBinding.\nIn Qt >= 6.0 the default is Binding.RestoreBindingOrValue.\n")
|| msg.endsWith("QML Binding: Not restoring previous value because restoreMode has not been set.\nThis behavior is deprecated.\nYou have to import QtQml 2.15 after any QtQuick imports and set\nthe restoreMode of the binding to fix this warning.\nIn Qt < 6.0 the default is Binding.RestoreBinding.\nIn Qt >= 6.0 the default is Binding.RestoreBindingOrValue.")
|| msg.endsWith("QML Connections: Implicitly defined onFoo properties in Connections are deprecated. Use this syntax instead: function onFoo(<arguments>) { ... }")) {
//! block warnings because they will be needed only after qt6.0 support. Currently Binding.restoreMode can not be supported because
//! qt5.9 is the minimum supported version.
return;
}
if (!filterDebugMessageText.isEmpty() && !msg.contains(filterDebugMessageText)) {
return;
}
const char *function = context.function ? context.function : "";
QString typeStr;
switch (type) {
case QtDebugMsg:
typeStr = "Debug";
break;
case QtInfoMsg:
typeStr = "Info";
break;
case QtWarningMsg:
typeStr = "Warning" ;
break;
case QtCriticalMsg:
typeStr = "Critical";
break;
case QtFatalMsg:
typeStr = "Fatal";
break;
};
const char *TypeColor;
if (type == QtInfoMsg || type == QtWarningMsg) {
TypeColor = CGREEN;
} else if (type == QtCriticalMsg || type == QtFatalMsg) {
TypeColor = CRED;
} else {
TypeColor = CIGREEN;
}
qDebug().nospace() << TypeColor << "[" << typeStr.toStdString().c_str() << " : " << CGREEN << QTime::currentTime().toString("h:mm:ss.zz").toStdString().c_str() << TypeColor << "]" << CNORMAL
#ifndef QT_NO_DEBUG
<< CIRED << " [" << CCYAN << function << CIRED << ":" << CCYAN << context.line << CIRED << "]"
#endif
<< CICYAN << " - " << CNORMAL << msg;
}
inline void configureAboutData()
{
KAboutData about(QStringLiteral("lattedock")
, QStringLiteral("Latte Dock")
, QStringLiteral(VERSION)
, i18n("Latte is a dock based on plasma frameworks that provides an elegant and "
"intuitive experience for your tasks and plasmoids. It animates its contents "
"by using parabolic zoom effect and tries to be there only when it is needed."
"\n\n\"Art in Coffee\"")
, KAboutLicense::GPL_V2
, QStringLiteral("\251 2016-2017 Michail Vourlakos, Smith AR"));
about.setHomepage(WEBSITE);
about.setProgramLogo(QIcon::fromTheme(QStringLiteral("latte-dock")));
about.setDesktopFileName(QStringLiteral("latte-dock"));
// Authors
about.addAuthor(QStringLiteral("Michail Vourlakos"), QString(), QStringLiteral("mvourlakos@gmail.com"));
about.addAuthor(QStringLiteral("Smith AR"), QString(), QStringLiteral("audoban@openmailbox.org"));
KAboutData::setApplicationData(about);
}
//! used the version provided by PW:KWorkspace
inline void detectPlatform(int argc, char **argv)
{
if (qEnvironmentVariableIsSet("QT_QPA_PLATFORM")) {
return;
}
for (int i = 0; i < argc; i++) {
if (qstrcmp(argv[i], "-platform") == 0 ||
qstrcmp(argv[i], "--platform") == 0 ||
QByteArray(argv[i]).startsWith("-platform=") ||
QByteArray(argv[i]).startsWith("--platform=")) {
return;
}
}
const QByteArray sessionType = qgetenv("XDG_SESSION_TYPE");
if (sessionType.isEmpty()) {
return;
}
if (qstrcmp(sessionType, "wayland") == 0) {
qputenv("QT_QPA_PLATFORM", "wayland");
} else if (qstrcmp(sessionType, "x11") == 0) {
qputenv("QT_QPA_PLATFORM", "xcb");
}
}
| 41.5 | 368 | 0.664372 | VaughnValle |
440059144dfea91aa588a1c33aa055eb6e5a1794 | 6,842 | hpp | C++ | src/vlGraphics/Renderer.hpp | zpc930/visualizationlibrary | c81fa75c720a3d04d295b977a1f5dc4624428b53 | [
"BSD-2-Clause"
] | null | null | null | src/vlGraphics/Renderer.hpp | zpc930/visualizationlibrary | c81fa75c720a3d04d295b977a1f5dc4624428b53 | [
"BSD-2-Clause"
] | null | null | null | src/vlGraphics/Renderer.hpp | zpc930/visualizationlibrary | c81fa75c720a3d04d295b977a1f5dc4624428b53 | [
"BSD-2-Clause"
] | null | null | null | /**************************************************************************************/
/* */
/* Visualization Library */
/* http://www.visualizationlibrary.org */
/* */
/* Copyright (c) 2005-2010, Michele Bosi */
/* All rights reserved. */
/* */
/* Redistribution and use in source and binary forms, with or without modification, */
/* are permitted provided that the following conditions are met: */
/* */
/* - Redistributions of source code must retain the above copyright notice, this */
/* list of conditions and the following disclaimer. */
/* */
/* - Redistributions in binary form must reproduce the above copyright notice, this */
/* list of conditions and the following disclaimer in the documentation and/or */
/* other materials provided with the distribution. */
/* */
/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND */
/* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED */
/* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE */
/* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR */
/* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES */
/* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; */
/* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON */
/* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */
/* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
/* */
/**************************************************************************************/
#ifndef Renderer_INCLUDE_ONCE
#define Renderer_INCLUDE_ONCE
#include <vlGraphics/RendererAbstract.hpp>
#include <vlGraphics/ProjViewTransfCallback.hpp>
#include <vlGraphics/Shader.hpp>
#include <map>
namespace vl
{
//-----------------------------------------------------------------------------
// Renderer
//-----------------------------------------------------------------------------
/** The Renderer class executes the actual rendering on the given RenderQueue.
* \sa Rendering */
class VLGRAPHICS_EXPORT Renderer: public RendererAbstract
{
VL_INSTRUMENT_CLASS(vl::Renderer, RendererAbstract)
public:
Renderer();
virtual ~Renderer() {}
/** Takes as input the render queue to render and returns a possibly filtered render queue for further processing.
* Renderer's implementation of this function always returns \p in_render_queue. */
virtual const RenderQueue* render(const RenderQueue* in_render_queue, Camera* camera, real frame_clock);
void setProjViewTransfCallback(ProjViewTransfCallback* callback) { mProjViewTransfCallback = callback; }
const ProjViewTransfCallback* projViewTransfCallback() const { return mProjViewTransfCallback.get(); }
ProjViewTransfCallback* projViewTransfCallback() { return mProjViewTransfCallback.get(); }
/** A bitmask/Shader map used to everride the Shader of those Actors whose enable mask satisfy the following condition:
(Actors::enableMask() & bitmask) != 0. Useful when you want to override the Shader of a whole set of Actors.
If multiple mask/shader pairs match an Actor's enable mask then the shader with the corresponding lowest mask will be used.
See also vl::Actor::enableMask() and vl::Rendering::effectOverrideMask(). */
const std::map<unsigned int, ref<Shader> >& shaderOverrideMask() const { return mShaderOverrideMask; }
/** A bitmask/Shader map used to everride the Shader of those Actors whose enable mask satisfy the following condition:
(Actors::enableMask() & bitmask) != 0. Useful when you want to override the Shader of a whole set of Actors.
If multiple mask/shader pairs match an Actor's enable mask then the shader with the corresponding lowest mask will be used.
See also vl::Actor::enableMask() and vl::Rendering::effectOverrideMask(). */
std::map<unsigned int, ref<Shader> >& shaderOverrideMask() { return mShaderOverrideMask; }
/** Render states that will be used as default by the opengl context by this renderer.
Useful for example to setup the default left/right color mask for anaglyph stereo rendering. */
std::vector<RenderStateSlot>& overriddenDefaultRenderStates() { return mOverriddenDefaultRenderStates; }
/** Render states that will be used as default by the opengl context by this renderer.
Useful for example to setup the default left/right color mask for anaglyph stereo rendering. */
const std::vector<RenderStateSlot>& overriddenDefaultRenderStates() const { return mOverriddenDefaultRenderStates; }
bool isEnabled(unsigned int mask) { return (mask & mEnableMask) != 0; }
/** The Framebuffer on which the rendering is performed. */
void setFramebuffer(Framebuffer* framebuffer) { mFramebuffer = framebuffer; }
/** The Framebuffer on which the rendering is performed. */
const Framebuffer* framebuffer() const { return mFramebuffer.get(); }
/** The Framebuffer on which the rendering is performed. */
Framebuffer* framebuffer() { return mFramebuffer.get(); }
protected:
ref<Framebuffer> mFramebuffer;
// used to reset the OpenGL states & enables at the end of the rendering.
vl::ref<EnableSet> mDummyEnables;
vl::ref<RenderStateSet> mDummyStateSet;
std::map<unsigned int, ref<Shader> > mShaderOverrideMask;
std::vector<RenderStateSlot> mOverriddenDefaultRenderStates;
ref<ProjViewTransfCallback> mProjViewTransfCallback;
};
//------------------------------------------------------------------------------
}
#endif
| 60.017544 | 132 | 0.573078 | zpc930 |
4404670291faa8763a29228118cdff20781281d7 | 788 | cpp | C++ | src/food.cpp | prinsij/RogueReborn | 20e6ba4d2e61a47283747ba207a758e604fa89d9 | [
"BSD-3-Clause"
] | null | null | null | src/food.cpp | prinsij/RogueReborn | 20e6ba4d2e61a47283747ba207a758e604fa89d9 | [
"BSD-3-Clause"
] | null | null | null | src/food.cpp | prinsij/RogueReborn | 20e6ba4d2e61a47283747ba207a758e604fa89d9 | [
"BSD-3-Clause"
] | null | null | null | /**
* @file food.cpp
* @author Team Rogue++
* @date December 08, 2016
*
* @brief Member definitions for the Food class
*/
#include "include/coord.h"
#include "include/food.h"
#include "include/item.h"
#include "include/random.h"
Food::Food(Coord location, Item::Context context)
: Item(':', location, context, "Food", "Some Rations of Food", 0, true, false, FOOD_WEIGHT) {}
bool Food::activate(PlayerChar* player) {
int foodLife = player->getFoodLife()/3;
if (Generator::rand() < 0.60) {
player->appendLog("Yum, that tasted good");
foodLife += Generator::intFromRange(FOOD_MIDDLE, FOOD_HIGH);
} else {
player->appendLog("Yuk, that food tasted awful");
foodLife += Generator::intFromRange(FOOD_LOW, FOOD_MIDDLE);
}
player->setFoodLife(foodLife);
return true;
}
| 24.625 | 95 | 0.690355 | prinsij |
440c078334872159b62ad7668efd952d6af5bceb | 2,685 | cpp | C++ | Binary Search Trees/Check BT is BST or not 3.cpp | hidayat7z/Data-Structures-and-Algorithms | b78fc9c09b55f6ce9e92edeb48b5069792c4341b | [
"MIT"
] | 22 | 2020-09-13T15:12:50.000Z | 2021-01-29T08:29:57.000Z | Binary Search Trees/Check BT is BST or not 3.cpp | hidayat7z/Data-Structures-and-Algorithms | b78fc9c09b55f6ce9e92edeb48b5069792c4341b | [
"MIT"
] | null | null | null | Binary Search Trees/Check BT is BST or not 3.cpp | hidayat7z/Data-Structures-and-Algorithms | b78fc9c09b55f6ce9e92edeb48b5069792c4341b | [
"MIT"
] | 6 | 2020-09-13T15:34:38.000Z | 2021-01-29T08:30:01.000Z | /*
Input taken in the BST with same method as Binary Tree
*/
#include<iostream>
#include<queue>
using namespace std;
template<typename T>
class BinaryTreeNode
{
public:
T data;
BinaryTreeNode* left;
BinaryTreeNode* right;
BinaryTreeNode(T data)
{
this->data= data;
left= NULL;
right= NULL;
}
~BinaryTreeNode() //when one node, delete left= delete NULL
{ // it's ok. there's no issue
delete left;
delete right;
}
};
BinaryTreeNode<int>* takeInputLevelWise()
{
int rootData;
cout<<"Enter root data: ";
cin>>rootData;
if(rootData==-1)
return NULL;
BinaryTreeNode <int> *root= new BinaryTreeNode <int>(rootData);
queue< BinaryTreeNode<int>* > pendingNodes;
pendingNodes.push(root);
while(pendingNodes.size() != 0)
{
BinaryTreeNode <int> *temp= pendingNodes.front();
pendingNodes.pop();
int leftdata;
cout<<"Enter left child of "<<temp->data<<": ";
cin>>leftdata;
if(leftdata != -1)
{
BinaryTreeNode <int> *leftChild= new BinaryTreeNode <int>(leftdata);
temp->left= leftChild;
pendingNodes.push(leftChild);
}
int rightdata;
cout<<"Enter right child of "<<temp->data<<": ";
cin>>rightdata;
if(rightdata != -1)
{
BinaryTreeNode <int> *rightChild= new BinaryTreeNode <int>(rightdata);
temp->right= rightChild;
pendingNodes.push(rightChild);
}
}
return root;
}
class triplet
{
public:
bool checkBST;
int MIN;
int MAX;
};
bool isBST(BinaryTreeNode<int> *root, int min= INT_MIN, int max= INT_MAX)
{
if(root==NULL)
return true;
if( root->data < min || root->data > max)
return false;
bool isLeftOK= isBST(root->left, min, root->data -1);
bool isRightOK= isBST(root->right, root->data, max);
return isLeftOK && isRightOK ;
}
void printLevelWise(BinaryTreeNode<int> *root)
{
if(root==NULL)
return;
queue< BinaryTreeNode<int>* > q;
q.push(root);
while( q.size() !=0)
{
BinaryTreeNode<int>* temp= q.front();
q.pop();
if(temp==NULL)
{
cout<<endl;
if(q.size()!=0)
q.push(NULL);
}
else
{
cout<<temp->data<<": ";
if(temp->left!=NULL)
{
cout<<"L";
q.push(temp->left);
cout<<temp->left->data<<",";
}
else
cout<<"";
if(temp->right!=NULL)
{
cout<<"R";
q.push(temp->right);
cout<<temp->right->data<<endl;
}
else
cout<<""<<endl;
}
}
}
int main()
{
BinaryTreeNode <int> *root= takeInputLevelWise();
printLevelWise(root);
cout<<"\n\n ANS= "<<isBST(root);
delete root;
}
| 17.664474 | 74 | 0.579516 | hidayat7z |
4411db54c23103b2369bc4d42bf76f6d37b00cd8 | 2,289 | hpp | C++ | lib/SelbaWard/PieChart.hpp | BridgeFan/bridgefan-tbs-game | 062593cf3094cc6fe9858b5575dd76d020774698 | [
"MIT"
] | null | null | null | lib/SelbaWard/PieChart.hpp | BridgeFan/bridgefan-tbs-game | 062593cf3094cc6fe9858b5575dd76d020774698 | [
"MIT"
] | 1 | 2020-08-16T18:01:37.000Z | 2020-08-16T18:01:37.000Z | lib/SelbaWard/PieChart.hpp | BridgeFan/bridgefan-tbs-game | 062593cf3094cc6fe9858b5575dd76d020774698 | [
"MIT"
] | null | null | null | //////////////////////////////////////////////////////////////////////////////
//
// Selba Ward (https://github.com/Hapaxia/SelbaWard)
// --
//
// Pie Chart
//
// Copyright(c) 2015-2019 M.J.Silk
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions :
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software.If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
// M.J.Silk
// MJSilk2@gmail.com
//
//////////////////////////////////////////////////////////////////////////////
#ifndef SELBAWARD_PIECHART_HPP
#define SELBAWARD_PIECHART_HPP
#include "Common.hpp"
namespace selbaward
{
// SW Pie Chart v1.0.3
class PieChart : public sf::Drawable, public sf::Transformable
{
public:
struct Slice
{
float size;
float scale;
float explode;
sf::Color color;
Slice();
};
std::vector<Slice> slices;
PieChart();
void update();
void setSize(sf::Vector2f size);
sf::Vector2f getSize() const;
void setRadius(float radius);
void setDiameter(float diameter);
sf::FloatRect getLocalBounds() const;
sf::FloatRect getGlobalBounds() const;
private:
sf::PrimitiveType m_primitive;
std::vector<sf::Vertex> m_vertices;
sf::Vector2f m_size;
virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const;
};
inline void PieChart::setSize(sf::Vector2f size)
{
m_size = size;
}
inline sf::Vector2f PieChart::getSize() const
{
return m_size;
}
inline void PieChart::setRadius(float radius)
{
setDiameter(radius * 2.f);
}
inline void PieChart::setDiameter(float diameter)
{
m_size = { diameter, diameter };
}
} // namespace selbaward
#endif // SELBAWARD_PIECHART_HPP
| 24.094737 | 78 | 0.68152 | BridgeFan |
4415da814c141209ad4ec869f6e50a5dcb905fc0 | 179 | cpp | C++ | third-party/Empirical/tests/Evolve/World_iterator.cpp | koellingh/empirical-p53-simulator | aa6232f661e8fc65852ab6d3e809339557af521b | [
"MIT"
] | null | null | null | third-party/Empirical/tests/Evolve/World_iterator.cpp | koellingh/empirical-p53-simulator | aa6232f661e8fc65852ab6d3e809339557af521b | [
"MIT"
] | null | null | null | third-party/Empirical/tests/Evolve/World_iterator.cpp | koellingh/empirical-p53-simulator | aa6232f661e8fc65852ab6d3e809339557af521b | [
"MIT"
] | null | null | null | #define CATCH_CONFIG_MAIN
#include "third-party/Catch/single_include/catch2/catch.hpp"
#include "emp/Evolve/World_iterator.hpp"
TEST_CASE("Test World_iterator", "[Evolve]")
{
} | 19.888889 | 60 | 0.776536 | koellingh |
4417001ac890b32726630402c98f71955543c4e2 | 915 | cpp | C++ | src/cpp/SbfMw.cpp | james-rank/sbf | f2b3ce8c4a324110a22cb880970d2a34bd22ef27 | [
"MIT"
] | null | null | null | src/cpp/SbfMw.cpp | james-rank/sbf | f2b3ce8c4a324110a22cb880970d2a34bd22ef27 | [
"MIT"
] | null | null | null | src/cpp/SbfMw.cpp | james-rank/sbf | f2b3ce8c4a324110a22cb880970d2a34bd22ef27 | [
"MIT"
] | null | null | null | #include "SbfMw.hpp"
neueda::SbfMw::SbfMw (SbfLog* log, SbfKeyValue* properties) :
mLog(log),
mProperties(properties)
{
mValue = sbfMw_create (log->getHandle(), properties->getHandle());
}
neueda::SbfMw::~SbfMw ()
{
if (getHandle () != NULL)
sbfMw_destroy (getHandle ());
}
sbfMw neueda::SbfMw::getHandle ()
{
return mValue;
}
u_int neueda::SbfMw::getNumThreads()
{
u_int ret = 0;
if (getHandle () != NULL)
ret = sbfMw_getNumThreads (getHandle());
return ret;
}
sbfMwThread neueda::SbfMw::getThread(u_int index)
{
sbfMwThread ret = NULL;
if (getHandle () != NULL)
ret = sbfMw_getThread (getHandle (), index);
return ret;
}
sbfMwThread neueda::SbfMw::getDefaultThread()
{
return getThread(0);
}
neueda::SbfLog* neueda::SbfMw::getLog()
{
return mLog;
}
neueda::SbfKeyValue* neueda::SbfMw::getProperties()
{
return mProperties;
}
| 17.941176 | 70 | 0.64153 | james-rank |
441bfa9628c3045eb98ff61b53500e9b1c67241a | 500 | cpp | C++ | performance/ejercicio01/authentication.cpp | gerardogtn/Calidad-y-Pruebas-de-Software | ed338b5627a343b7dee366aaa36cd735f74e53af | [
"MIT"
] | null | null | null | performance/ejercicio01/authentication.cpp | gerardogtn/Calidad-y-Pruebas-de-Software | ed338b5627a343b7dee366aaa36cd735f74e53af | [
"MIT"
] | null | null | null | performance/ejercicio01/authentication.cpp | gerardogtn/Calidad-y-Pruebas-de-Software | ed338b5627a343b7dee366aaa36cd735f74e53af | [
"MIT"
] | null | null | null | // Copyright 2017 Gerardo Teruel
#include <cstdio>
#include <cstring>
// If you overflow temp, then you'd modify out variable. Thus getting a one,
// and indicating a valid authentication
int fun(char* pass) {
int out = 0;
char temp[8];
strcpy(temp, pass);
if (strcmp(temp, "1234567") == 0) {
out = 1;
}
return out;
}
int main(int argc, char *argv[]) {
if (fun(argv[1])) {
printf("%s\n", "Access granted");
} else {
printf("%s\n", "Access denied");
}
return 0;
}
| 17.857143 | 76 | 0.608 | gerardogtn |
44213ad99d5c907952549fe9e5b7271ecfd4fdad | 478 | cpp | C++ | src/TREngine/Core/Render/RawShader.cpp | CXUtk/TRV2 | 945950012e2385aeb24e80bf5e876703445ba423 | [
"Apache-2.0"
] | null | null | null | src/TREngine/Core/Render/RawShader.cpp | CXUtk/TRV2 | 945950012e2385aeb24e80bf5e876703445ba423 | [
"Apache-2.0"
] | 15 | 2021-09-04T13:02:51.000Z | 2021-10-05T05:51:31.000Z | src/TREngine/Core/Render/RawShader.cpp | CXUtk/TRV2 | 945950012e2385aeb24e80bf5e876703445ba423 | [
"Apache-2.0"
] | null | null | null | #include "RawShader.h"
#include <Core/Utils/Utils.h>
#include <array>
TRV2_NAMESPACE_BEGIN
RawShader::RawShader(IGraphicsResourceManager* resourceManager, const char* code, ShaderType shaderType, const char* fileName)
: IGraphicsResource(resourceManager), _type(shaderType), _fileName(fileName)
{
_handle = resourceManager->CreateRawShader(code, shaderType, fileName);
}
RawShader::~RawShader()
{
_resourceManager->DeleteRawShader(_handle);
}
TRV2_NAMESPACE_END | 26.555556 | 126 | 0.784519 | CXUtk |
44220366f6eaebe87faf674f6c2511a30e537fb2 | 10,182 | cpp | C++ | XVrII/src/aircraft/SsgB748.cpp | ryan1336/VRInsight-Xplane-Interface | 72e77d0f1f355350c5ec9f66783e8d0eb61c0449 | [
"MIT"
] | null | null | null | XVrII/src/aircraft/SsgB748.cpp | ryan1336/VRInsight-Xplane-Interface | 72e77d0f1f355350c5ec9f66783e8d0eb61c0449 | [
"MIT"
] | null | null | null | XVrII/src/aircraft/SsgB748.cpp | ryan1336/VRInsight-Xplane-Interface | 72e77d0f1f355350c5ec9f66783e8d0eb61c0449 | [
"MIT"
] | null | null | null | #include "SsgB748.h"
#include <XPLM/XPLMProcessing.h>
#include "logger.h"
#include <list>
#include "VRiCommPort.h"
//const char *SsgB748::LAM_B747_ND = "laminar/B747/nd/";
//const char *SsgB748::LAM_B747_EFIS = "laminar/B747/efis/";
//const char *SsgB748::LAM_B747_TOGGLE = "laminar/B747/toggle_switch/";
SsgB748::SsgB748()
: BaseAircraft()
, m_displayCommandsScheduled(0)
, m_displayCommandCooldown(0.0)
{
m_refAltNNNup = findCommandRef("SSG/UFMC/Alt_UP");
XPLMRegisterCommandHandler(m_refAltNNNup, ssgCommandCallback, 0, this);
m_refAltNNNdn = findCommandRef("SSG/UFMC/Alt_Down");
XPLMRegisterCommandHandler(m_refAltNNNdn, ssgCommandCallback, 0, this);
m_refHdgNNNup = findCommandRef("SSG/UFMC/HDG_UP");
XPLMRegisterCommandHandler(m_refHdgNNNup, ssgCommandCallback, 0, this);
m_refHdgNNNdn = findCommandRef("SSG/UFMC/HDG_Down");
XPLMRegisterCommandHandler(m_refHdgNNNdn, ssgCommandCallback, 0, this);
m_refSpdNNNup = findCommandRef("SSG/UFMC/Speed_UP");
XPLMRegisterCommandHandler(m_refSpdNNNup, ssgCommandCallback, 0, this);
m_refSpdNNNdn = findCommandRef("SSG/UFMC/Speed_Down");
XPLMRegisterCommandHandler(m_refSpdNNNdn, ssgCommandCallback, 0, this);
m_refFlightDirectorTogglePt = findCommandRef("SSG/UFMC/FD_Pilot_SW");
m_refFlightDirectorToggleCp = findCommandRef("SSG/UFMC/FD_Copilot_SW");
m_refAutoThrottleToggle = findCommandRef("SSG/UFMC/AP_ARM_AT_Switch");
m_refAptN1 = findCommandRef("SSG/UFMC/AP_N1_Button");
m_refAptSpd = findCommandRef("SSG/UFMC/AP_SPD_Button");
m_refAptFlch = findCommandRef("SSG/UFMC/AP_LVLCHG_Button");
m_refAptHdgSel = findCommandRef("SSG/UFMC/AP_HDG_Button");
m_refAptHdgHold = findCommandRef("SSG/UFMC/AP_HDGHOLD_Button");
m_refAptSpdSel = findCommandRef("SSG/UFMC/AP_SPD_Intervention_Button");
m_refAptAltSel = findCommandRef("SSG/UFMC/AP_Altitude_Intervention_Button");
m_refAptAltHold = findCommandRef("SSG/UFMC/AP_ALTHOLD_Button");
m_refAptVvsHold = findCommandRef("SSG/UFMC/AP_VS_Button");
m_refAptVNav = findCommandRef("SSG/UFMC/AP_VNAV_Button");
m_refAptLNav = findCommandRef("SSG/UFMC/AP_LNAV_Button");
m_refAptCmdA = findCommandRef("SSG/UFMC/AP_CMDA_Button");
m_refAptCmdC = findCommandRef("SSG/UFMC/AP_CMDB_Button");
m_refAptCmdB = findCommandRef("SSG/UFMC/AP_CMDC_Button");
m_refAptLoc = findCommandRef("SSG/UFMC/AP_VORLOC_Button");
m_refAptApp = findCommandRef("SSG/UFMC/AP_APP_Button");
m_refApMaster = findCommandRef("SSG/UFMC/AP_discon_Button");
m_refAptToGa1 = findCommandRef("SSG/UFMC/TOGA_Button");
m_refAptToGa2 = m_refAptToGa1;
m_refNdMode = findDataRef("ssg/B748/ND/mode_pilot");
m_ndMode = XPLMGetDataf(m_refNdMode);
m_refNdRange = findDataRef("ssg/B748/ND/range_pilot");
m_ndRange = XPLMGetDataf(m_refNdRange);
m_refShowTCAS = findDataRef("ssg/B748/ND/show_TCAS_pilot");
m_showTCAS = XPLMGetDataf(m_refShowTCAS);
m_refShowWx = findDataRef("ssg/B748/ND/show_wheather_pilot");
m_showWx = XPLMGetDataf(m_refShowWx);
m_refShowSta = findDataRef("ssg/B748/ND/show_VOR_pilot");
m_showSta = XPLMGetDataf(m_refShowSta);
m_refShowWaypoint = findDataRef("ssg/B748/ND/show_waypoint_pilot");
m_showWaypoint = XPLMGetDataf(m_refShowWaypoint);
m_refShowAirport = findDataRef("ssg/B748/ND/show_airport_pilot");
m_showAirport = XPLMGetDataf(m_refShowAirport);
m_refShowData = findDataRef("ssg/B748/ND/show_NDB_pilot");
m_showData = XPLMGetDataf(m_refShowData);
m_refShowPos = findDataRef("ssg/B748/ND/show_POS_pilot");
m_showPos = XPLMGetDataf(m_refShowPos);
m_refShowTerr = findDataRef("ssg/B748/ND/show_Terr_pilot");
m_showTerr = XPLMGetDataf(m_refShowTerr);
m_refTriggerCtr = findDataRef("ssg/B748/ND/CRT_pilot");
m_refVorAdf1 = findDataRef("ssg/B748/MCP/ap_vor_adf1");
m_vorAdf1 = XPLMGetDataf(m_refVorAdf1);
m_refVorAdf2 = findDataRef("ssg/B748/MCP/ap_vor_adf2");
m_vorAdf2 = XPLMGetDataf(m_refVorAdf2);
m_refTemp = findDataRef("ssg/B748/MCP/ap_vor_adf1");
float m_val = XPLMGetDataf(m_refTemp);
if (m_refTemp == nullptr)
{
VLLog("Not Found");
}
else
{
XPLMDataTypeID id = XPLMGetDataRefTypes(m_refTemp);
VLLog("Type %u Can write: %d = %f", id, XPLMCanWriteDataRef(m_refTemp), m_val);
}
}
SsgB748::~SsgB748()
{
VLLog("Deconstruct");
XPLMUnregisterCommandHandler(m_refAltNNNup, ssgCommandCallback, 0, this);
XPLMUnregisterCommandHandler(m_refAltNNNdn, ssgCommandCallback, 0, this);
XPLMUnregisterCommandHandler(m_refSpdNNNup, ssgCommandCallback, 0, this);
XPLMUnregisterCommandHandler(m_refSpdNNNdn, ssgCommandCallback, 0, this);
XPLMUnregisterCommandHandler(m_refHdgNNNup, ssgCommandCallback, 0, this);
XPLMUnregisterCommandHandler(m_refHdgNNNdn, ssgCommandCallback, 0, this);
}
int SsgB748::ssgCommandCallback(XPLMCommandRef inCommand, XPLMCommandPhase inPhase, void *inRefcon)
{
SsgB748 *plane = static_cast<SsgB748*>(inRefcon);
if (plane == nullptr)
return 1;
std::lock_guard<std::mutex> guard(plane->m_commandCounterMutex);
if (/*(inCommand == plane->m_refAltNNNup ||
inCommand == plane->m_refAltNNNdn ||
inCommand == plane->m_refHdgNNNup ||
inCommand == plane->m_refHdgNNNdn ||
inCommand == plane->m_refSpdNNNup ||
inCommand == plane->m_refSpdNNNdn) &&*/ plane->m_displayCommandsScheduled > 0)
{
plane->m_displayCommandsScheduled--;
if (plane->m_displayCommandsScheduled == 0)
plane->m_displayCommandCooldown = (XPLMGetElapsedTime() + 1.5f);
}
return 1;
}
bool SsgB748::hardwareDisplayUpdateAllowed()
{
std::lock_guard<std::mutex> guard(m_commandCounterMutex);
return ((m_displayCommandsScheduled == 0) && (m_displayCommandCooldown < XPLMGetElapsedTime()));
}
void SsgB748::updateAltitude(const std::list<BaseDeviceHandler*> &devices)
{
if (!hardwareDisplayUpdateAllowed())
return;
// Only sync from sim to hardware, changing is done through up/down command
float displayed = XPLMGetDataf(m_refApDisplayedAltitude);
if (displayed != m_altitude)
{
for (auto &it = devices.begin(); it != devices.end(); it++)
{
(*it)->displayMcpAltitude(displayed);
}
m_altitude = displayed;
m_hardwareAltitude = displayed;
}
}
void SsgB748::updateHeading(const std::list<BaseDeviceHandler*> &devices)
{
if (!hardwareDisplayUpdateAllowed())
return;
// Only sync from sim to hardware, changing is done through up/down command
float displayed = XPLMGetDataf(m_refApDisplayedHeading);
if (displayed != m_heading)
{
for (auto &it = devices.begin(); it != devices.end(); it++)
{
(*it)->displayMcpHeading(displayed);
}
m_heading = displayed;
m_hardwareHeading = displayed;
}
}
#define COMMAND(a) case BaseDeviceHandler::##a: scheduleCommand(m_ref##a); return true;
#define DISPLAYCOMMAND(a,b) case BaseDeviceHandler::##a: { std::lock_guard<std::mutex> guard(m_commandCounterMutex); m_displayCommandsScheduled+=b; scheduleCommand(m_ref##a, b); return true; }
void SsgB748::relayToggle(XPLMDataRef ref, float &value)
{
if (value < 1.0)
value = 1.0;
else
value = 0.0;
XPLMSetDataf(ref, value);
}
bool SsgB748::handleCommand(BaseDeviceHandler::VriCommandParameters command)
{
switch (command.m_command)
{
DISPLAYCOMMAND(AltNNNup, 1);
DISPLAYCOMMAND(AltNNNdn, 1);
COMMAND(AptAltSel);
DISPLAYCOMMAND(HdgNNNup, 2);
DISPLAYCOMMAND(HdgNNNdn, 2);
DISPLAYCOMMAND(SpdNNNup, 2);
DISPLAYCOMMAND(SpdNNNdn, 2);
COMMAND(AptSpdSel);
case BaseDeviceHandler::EfisTfc:
relayToggle(m_refShowTCAS, m_showTCAS);
return true;
case BaseDeviceHandler::EfisCtr:
XPLMSetDataf(m_refTriggerCtr, 1.0);
return true;
case BaseDeviceHandler::EfisWx:
relayToggle(m_refShowWx, m_showWx);
return true;
case BaseDeviceHandler::EfisSta:
relayToggle(m_refShowSta, m_showSta);
return true;
case BaseDeviceHandler::EfisWpt:
relayToggle(m_refShowWaypoint, m_showWaypoint);
return true;
case BaseDeviceHandler::EfisTerr:
relayToggle(m_refShowTerr, m_showTerr);
return true;
case BaseDeviceHandler::EfisData:
relayToggle(m_refShowData, m_showData);
return true;
case BaseDeviceHandler::EfisPos:
relayToggle(m_refShowPos, m_showPos);
return true;
case BaseDeviceHandler::EfisArpt:
relayToggle(m_refShowAirport, m_showAirport);
return true;
case BaseDeviceHandler::EfisModeDown:
if (m_ndMode > 0.0)
{
m_ndMode -= 1.0;
XPLMSetDataf(m_refNdMode, m_ndMode);
}
return true;
case BaseDeviceHandler::EfisModeUp:
if (m_ndMode < 3.0)
{
m_ndMode += 1.0;
XPLMSetDataf(m_refNdMode, m_ndMode);
}
return true;
case BaseDeviceHandler::EfisZoomIn:
if (m_ndRange > -3.0)
{
m_ndRange -= 1.0;
XPLMSetDataf(m_refNdRange, m_ndRange);
}
return true;
case BaseDeviceHandler::EfisZoomOut:
if (m_ndRange < 7.0)
{
m_ndRange += 1.0;
XPLMSetDataf(m_refNdRange, m_ndRange);
}
return true;
case BaseDeviceHandler::EfisVor1Up:
if (m_vorAdf1 < 1.0)
{
m_vorAdf1++;
XPLMSetDataf(m_refVorAdf1, m_vorAdf1);
}
return true;
case BaseDeviceHandler::EfisVor1Down:
if (m_vorAdf1 > -1.0)
{
m_vorAdf1--;
XPLMSetDataf(m_refVorAdf1, m_vorAdf1);
}
return true;
case BaseDeviceHandler::EfisVor2Up:
if (m_vorAdf2 < 1.0)
{
m_vorAdf2++;
XPLMSetDataf(m_refVorAdf2, m_vorAdf2);
}
return true;
case BaseDeviceHandler::EfisVor2Down:
if (m_vorAdf2 > -1.0)
{
m_vorAdf2--;
XPLMSetDataf(m_refVorAdf2, m_vorAdf2);
}
return true;
case BaseDeviceHandler::AptAtArm:
case BaseDeviceHandler::AptAtDisarm:
scheduleCommand(m_refAutoThrottleToggle);
scheduleCommand(m_refAutoThrottleToggle);
return true;
case BaseDeviceHandler::AptFdArm:
case BaseDeviceHandler::AptFdDisarm:
scheduleCommand(m_refFlightDirectorTogglePt);
scheduleCommand(m_refFlightDirectorToggleCp);
return true;
case BaseDeviceHandler::AptMasterConnect:
case BaseDeviceHandler::AptMasterDisconnect:
scheduleCommand(m_refApMaster);
return true;
COMMAND(AptN1);
COMMAND(AptFlch);
COMMAND(AptSpd);
COMMAND(AptHdgSel);
COMMAND(AptHdgHold);
COMMAND(AptAltHold);
COMMAND(AptVvsHold);
COMMAND(AptVNav);
COMMAND(AptLNav);
COMMAND(AptCmdA);
COMMAND(AptCmdB);
COMMAND(AptCmdC);
COMMAND(AptLoc);
COMMAND(AptApp);
default:
return BaseAircraft::handleCommand(command);
}
}
bool SsgB748::isLoaded()
{
return (XPLMFindCommand("SSG/UFMC/AP_LNAV_Button") != nullptr);
}
| 29.427746 | 192 | 0.760067 | ryan1336 |
442365162689b70a872f4c11540530d3afcb31cb | 6,941 | cpp | C++ | examples/camera_example.cpp | alexandre-bernier/coro-eyes-sdk | b552bf32e51d2b22ddf71dbaaf75f08f47f230a9 | [
"BSD-3-Clause"
] | 1 | 2022-03-27T01:12:30.000Z | 2022-03-27T01:12:30.000Z | examples/camera_example.cpp | alexandre-bernier/coro_eyes_sdk | b552bf32e51d2b22ddf71dbaaf75f08f47f230a9 | [
"BSD-3-Clause"
] | null | null | null | examples/camera_example.cpp | alexandre-bernier/coro_eyes_sdk | b552bf32e51d2b22ddf71dbaaf75f08f47f230a9 | [
"BSD-3-Clause"
] | null | null | null | /** @file camera_example.cpp
* @brief Example showing how to use the camera api.
* @copyright BSD-3-Clause License
* @example camera_example.cpp
*/
#include <iostream>
#include "coro_eyes_sdk.h"
/**
* @brief Structure used as a callback argument.
*/
struct FrameInfo {
std::string cv_window_name; ///< Name of the OpenCV window where the received frame should be displayed
unsigned int image_height; ///< Height of the image in pixels
unsigned int image_width; ///< Width of the image in pixels
};
/**
* @brief Callback for every new frame received.
* @param frame Pointer to the last frame received in OpenCV format
* @param callback_data Pointer to a FrameInfo
*/
void camera_feed_callback(cv::Mat frame, void *callback_data)
{
// Typecast callback data
FrameInfo frame_info = *(FrameInfo*)callback_data;
// Rescale image
float scale_factor = 0.5;
cv::Mat rescaled_frame;
cv::resize(frame, rescaled_frame, cv::Size(frame_info.image_width*scale_factor, frame_info.image_height*scale_factor));
// Show the frame in the appropriate window
cv::imshow(frame_info.cv_window_name, rescaled_frame);
}
int main(void)
{
/**
* @section avail_cam Get the number of available cameras
* @snippet camera_example.cpp Available cameras
*/
// [Available cameras]
unsigned int num_cameras = Camera::get_num_available_cameras();
std::cout << "Number of available cameras: " << num_cameras << std::endl;
if(num_cameras < 1) {
std::cerr << "No camera connected. Stopping application..." << std::endl;
return -1;
}
// [Available cameras]
/**
* @section guid Get the GUID for every available camera
* @snippet camera_example.cpp GUID
*/
// [GUID]
std::cout << "Getting camera's GUIDs..." << std::endl;
FlyCapture2::PGRGuid guid[num_cameras];
for(unsigned int i=0; i<num_cameras; i++) {
if(Camera::get_guid(i, &guid[i])) {
std::cerr << "Can't get GUID of camera " << i << std::endl;
return -1;
}
}
// [GUID]
/**
* @section connect Connect to all available cameras
* @snippet camera_example.cpp Connect
*/
// [Connect]
std::cout << "Connecting to all available cameras..." << std::endl;
Camera camera[num_cameras];
for(unsigned int i=0; i<num_cameras; i++) {
if(camera[i].connect(&guid[i]) != FlyCapture2::PGRERROR_OK) {
std::cerr << "Can't connect to camera " << i << std::endl;
}
std::cout << "Serial number" << ": " << camera[i].get_serial_number() << std::endl;
}
// [Connect]
/**
* @section configure Configure cameras
* @snippet camera_example.cpp Configure
*/
// [Configure]
std::cout << "Configuring all connected cameras..." << std::endl;
for(unsigned int i=0; i<num_cameras; i++) {
if(camera[i].configure()) {
std::cerr << "Can't configure camera " << i << std::endl;
std::cout << "Disconnecting from all cameras" << std::endl;
for(unsigned int i=0; i<num_cameras; i++) {
camera[i].disconnect();
}
return -1;
}
}
// [Configure]
/**
* @section coro_eyes_properties Set camera properties for CoRo Eyes
* @snippet camera_example.cpp CoRo Eyes properties
*/
// [CoRo Eyes properties]
std::cout << "Setting up cameras for CoRo Eyes..." << std::endl;
Camera::CameraPosition camera_position = Camera::CameraPosition::Undefined;
for(unsigned int i=0; i<num_cameras; i++) {
switch(camera[i].get_serial_number()) {
case 19153384: // Serial number of the left camera
camera_position = Camera::CameraPosition::Left;
break;
case 19305617: // Serial number of the right camera
camera_position = Camera::CameraPosition::Right;
break;
default:
std::cerr << "Unrecognized camera (" << camera[i].get_serial_number() << ")." << std::endl;
break;
}
if(camera[i].set_properties_for_coro_eyes(camera_position)) {
std::cerr << "Can't configure camera " << i << "." << std::endl;
std::cout << "Disconnecting from all cameras" << std::endl;
for(unsigned int i=0; i<num_cameras; i++) {
camera[i].disconnect();
}
return -1;
}
}
// [CoRo Eyes properties]
/**
* @section other_properties Overwriting some properties to make it work without the projector
* @snippet camera_example.cpp Other properties
*/
// [Other properties]
for(unsigned int i_cam=0; i_cam<num_cameras; i_cam++) {
camera[i_cam].set_camera_trigger(false);
camera[i_cam].set_shutter_speed(8.0);
}
// [Other properties]
/**
* @section feeds Setup camera feeds
* @snippet camera_example.cpp Camera feeds
*/
// [Camera feeds]
std::cout << "Starting up camera feeds..." << std::endl;
FrameInfo frame_info[num_cameras];
for(unsigned int i=0; i<num_cameras; i++) {
frame_info[i].cv_window_name = "Camera " + std::to_string(i);
frame_info[i].image_height = camera[i].get_camera_height();
frame_info[i].image_width = camera[i].get_camera_width();
cv::namedWindow(frame_info[i].cv_window_name, cv::WINDOW_AUTOSIZE);
camera[i].set_new_frame_callback(camera_feed_callback, &frame_info[i]);
}
// [Camera feeds]
/**
* @section start_capture Start capturing with cameras
* @snippet camera_example.cpp Start capture
*/
// [Start capture]
std::cout << "Starting captures..." << std::endl;
for(unsigned int i=0; i<num_cameras; i++) {
camera[i].start_capture();
}
// [Start capture]
/**
* @section wait_user Wait for the user to press a key
* @snippet camera_example.cpp Wait for user
*/
// [Wait for user]
cv::waitKey();
// [Wait for user]
/**
* @section close_windows Close all windows
* @snippet camera_example.cpp Close windows
*/
// [Close windows]
cv::destroyAllWindows();
// [Close windows]
/**
* @section stop_captures Stop all captures
* @snippet camera_example.cpp Stop captures
*/
// [Stop captures]
std::cout << "Stopping captures..." << std::endl;
for(unsigned int i=0; i<num_cameras; i++) {
camera[i].stop_capture();
}
// [Stop captures]
/**
* @section disconnect Disconnect from all cameras
* @snippet camera_example.cpp Disconnect
*/
// [Disconnect]
std::cout << "Disconnecting from all cameras..." << std::endl;
for(unsigned int i=0; i<num_cameras; i++) {
camera[i].disconnect();
}
// [Disconnect]
}
| 22.318328 | 123 | 0.598185 | alexandre-bernier |
4427607a6d61d2217340657e0e84bb15145faf4a | 5,216 | cpp | C++ | src/BlocksWorldExample.cpp | buele/pop | 34dd8d7d4d6ec7d8cd3546b83bb3c77c0b23667c | [
"MIT"
] | 2 | 2021-12-07T03:57:54.000Z | 2022-02-08T07:20:36.000Z | src/BlocksWorldExample.cpp | buele/pop | 34dd8d7d4d6ec7d8cd3546b83bb3c77c0b23667c | [
"MIT"
] | null | null | null | src/BlocksWorldExample.cpp | buele/pop | 34dd8d7d4d6ec7d8cd3546b83bb3c77c0b23667c | [
"MIT"
] | 1 | 2020-02-10T16:33:55.000Z | 2020-02-10T16:33:55.000Z | /*
* The MIT License
*
* Copyright 2017 buele.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/*
* File: BlocksWorldExample.cpp
* Author: buele
*
* Created on December 3, 2017, 11:01 PM
*/
#include <string>
#include <vector>
#include <stack>
#include <set>
class State;
#include "Action.h"
#include "State.h"
#include "Edge.h"
#include "World.h"
#include "Plan.h"
#include "Pop.h"
#include "BlocksWorldExample.h"
#include "BWUnstackAction.h"
#include "BWStackAction.h"
#include "BWClearState.h"
#include "BWTableState.h"
#include "BWOnState.h"
#include <iostream>
using namespace std;
BlocksWorldExample::BlocksWorldExample() {
}
BlocksWorldExample::BlocksWorldExample(const BlocksWorldExample& orig) {
}
BlocksWorldExample::~BlocksWorldExample() {
}
std::vector<State*> BlocksWorldExample::generateFinishPreconditions(Action * finish) {
// on(A,B)
std::vector<std::string> on_a_b_params = std::vector<std::string>();
on_a_b_params.push_back("A");
on_a_b_params.push_back("B");
BWOnState * on_a_b = new BWOnState(true, finish, on_a_b_params);
// on(B,C)
std::vector<std::string> on_b_c_params = std::vector<std::string>();
on_b_c_params.push_back("B");
on_b_c_params.push_back("C");
BWOnState * on_b_c = new BWOnState(true, finish, on_b_c_params);
std::vector<State *> preconditions = std::vector<State *>();
preconditions.push_back(on_a_b);
preconditions.push_back(on_b_c);
return preconditions;
}
std::vector<State*> BlocksWorldExample::generateStartEffects(Action * start) {
// on(C,A)
std::vector<std::string> on_c_a_params = std::vector<std::string>();
on_c_a_params.push_back("C");
on_c_a_params.push_back("A");
BWOnState * on_c_a = new BWOnState(true, start, on_c_a_params);
// clear(C)
std::vector<std::string> clear_c_params = std::vector<std::string>();
clear_c_params.push_back("C");
BWClearState * clear_c = new BWClearState(true, start, clear_c_params);
// clear(B)
std::vector<std::string> clear_b_params = std::vector<std::string>();
clear_b_params.push_back("B");
BWClearState * clear_b = new BWClearState(true, start, clear_b_params);
// table(A)
std::vector<std::string> table_a_params = std::vector<std::string>();
table_a_params.push_back("A");
BWTableState * table_a = new BWTableState(true, start, table_a_params);
// table(B)
std::vector<std::string> table_b_params = std::vector<std::string>();
table_b_params.push_back("B");
BWTableState * table_b = new BWTableState(true, start, table_b_params);
std::vector<State *> effects = std::vector<State *>();
effects.push_back(on_c_a);
effects.push_back(clear_c);
effects.push_back(clear_b);
effects.push_back(table_a);
effects.push_back(table_b);
return effects;
}
void BlocksWorldExample::run(){
cout << " *** Artificial Intelligence Fundamentals - UNIPI 2017/2018 ***\n";
cout << " Partial Order Planning - 4th assignment \n";
cout << " Raffaele Bua - raffaele.bua@gmail.com \n";
cout << " Example of Block World \n\n" << endl;
// define world actions
std::vector<Action*> actions = std::vector<Action *>();
actions.push_back(new BWStackAction());
actions.push_back(new BWUnstackAction());
// start
Action * start = new Action();
start->name = "START";
start->effects = this->generateStartEffects(start);
// finish
Action * finish = new Action();
finish->name = "FINISH";
finish->preconditions = this->generateFinishPreconditions(finish);
std::vector<string> items = std::vector<string>();
items.push_back("A");
items.push_back("B");
items.push_back("C");
// create world
World * world = new World(items, actions, start, finish);
// create pop
Pop pop = Pop(world);
// run pop
pop.Compute();
// print plan
pop.PrintPlan();
// free memory
actions.clear();
delete start;
delete finish;
delete world;
} | 30.682353 | 86 | 0.66737 | buele |
442c7e8002da47505f832a4c1b84bc69ecddae3a | 846 | cpp | C++ | C++_Essential_Training/Chap03/bitfields.cpp | MarkWMavis/developer_practice | a10a11874454eb805e4cea8cbbdbc315c9791996 | [
"MIT"
] | 1 | 2020-07-20T15:28:50.000Z | 2020-07-20T15:28:50.000Z | C++_Essential_Training/Chap03/bitfields.cpp | MarkWMavis/developer_practice | a10a11874454eb805e4cea8cbbdbc315c9791996 | [
"MIT"
] | 1 | 2022-03-02T13:16:03.000Z | 2022-03-02T13:16:03.000Z | C++/LinkedInLearning/Exercise Files/Chap03/bitfields.cpp | Youngermaster/Learning-Programming-Languages | b94d3d85abc6c107877b11b42a3862d4aae8e3ee | [
"MIT"
] | null | null | null | // bitfields.cpp by Bill Weinman <http://bw.org/>
// updated 2020-06-24
#include <cstdio>
struct Prefs {
bool likesMusic : 1;
bool hasHair : 1;
bool hasInternet : 1;
bool hasDinosaur : 1;
unsigned int numberOfChildren : 4;
};
int main() {
Prefs homer;
homer.likesMusic = true;
homer.hasHair = false;
homer.hasInternet = true;
homer.hasDinosaur = false;
homer.numberOfChildren = 3;
printf("sizeof homer: %zd bits\n", sizeof(homer) * 8);
printf("sizeof int: %zd bits\n", sizeof(int) * 8);
if(homer.likesMusic) printf("homer likes music\n");
if(homer.hasHair) printf("homer has hair\n");
if(homer.hasInternet) printf("homer has net\n");
if(homer.hasDinosaur) printf("homer has a dino\n");
printf("homer has %d children\n", homer.numberOfChildren);
return 0;
}
| 26.4375 | 62 | 0.640662 | MarkWMavis |
4434004cb2a135e2962d0cd355d31585af27bfe7 | 1,402 | cpp | C++ | codeforce3/514D. R2D2 and Droid Army.cpp | khaled-farouk/My_problem_solving_solutions | 46ed6481fc9b424d0714bc717cd0ba050a6638ef | [
"MIT"
] | null | null | null | codeforce3/514D. R2D2 and Droid Army.cpp | khaled-farouk/My_problem_solving_solutions | 46ed6481fc9b424d0714bc717cd0ba050a6638ef | [
"MIT"
] | null | null | null | codeforce3/514D. R2D2 and Droid Army.cpp | khaled-farouk/My_problem_solving_solutions | 46ed6481fc9b424d0714bc717cd0ba050a6638ef | [
"MIT"
] | null | null | null | /*
Idea:
- Using Segment tree to calculate the maximum in range.
- Then using Two pointers to calculate the maximum segment.
*/
#include <bits/stdc++.h>
using namespace std;
int const N = 1e5 + 10;
int n, m, k, a[N][6], sum[N], seg[4 * N][6];
void build(int at, int l, int r) {
if(l == r) {
for(int i = 1; i <= m; ++i)
seg[at][i] = a[l][i];
return;
}
int mid = (l + r) >> 1;
build(at << 1, l, mid);
build(at << 1 | 1, mid + 1, r);
for(int i = 1; i <= m; ++i)
seg[at][i] = max(seg[at << 1][i], seg[at << 1 | 1][i]);
}
int s, e, tar;
int get(int at, int l, int r) {
if(l > e || r < s)
return 0;
if(l >= s && r <= e)
return seg[at][tar];
int mid = (l + r) >> 1;
return max(get(at << 1, l, mid), get(at << 1 | 1, mid + 1, r));
}
int calc(int l, int r) {
int sum = 0;
s = l, e = r;
for(int i = 1; i <= m; ++i) {
tar = i;
sum += get(1, 1, n);
}
return sum;
}
int main() {
scanf("%d %d %d", &n, &m, &k);
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= m; ++j) {
scanf("%d", &a[i][j]);
sum[i] += a[i][j];
}
build(1, 1, n);
int l = 1, r = 1, r1, r2, len = 0;
while(r <= n) {
while(l < r && calc(l, r) > k)
++l;
if(calc(r, l) <= k && r - l + 1 > len)
len = r - l + 1, r1 = l, r2 = r;;
++r;
}
s = r1, e = r2;
for(int i = 1; i <= m; ++i) {
tar = i;
printf("%s%d", i == 1 ? "" : " ", get(1, 1, n));
}
puts("");
return 0;
}
| 17.308642 | 64 | 0.442225 | khaled-farouk |
44368b0c2549b557d5d84f1863103f09e2ca90a3 | 3,499 | hpp | C++ | include/eagine/shapes/value_tree.hpp | matus-chochlik/eagine-shapes | d77a5e92517771a0bcdc409668bae4d274115e84 | [
"BSL-1.0"
] | null | null | null | include/eagine/shapes/value_tree.hpp | matus-chochlik/eagine-shapes | d77a5e92517771a0bcdc409668bae4d274115e84 | [
"BSL-1.0"
] | null | null | null | include/eagine/shapes/value_tree.hpp | matus-chochlik/eagine-shapes | d77a5e92517771a0bcdc409668bae4d274115e84 | [
"BSL-1.0"
] | null | null | null | /// @file
///
/// Copyright Matus Chochlik.
/// Distributed under the Boost Software License, Version 1.0.
/// See accompanying file LICENSE_1_0.txt or copy at
/// http://www.boost.org/LICENSE_1_0.txt
///
#ifndef EAGINE_SHAPES_VALUE_TREE_HPP
#define EAGINE_SHAPES_VALUE_TREE_HPP
#include "config/basic.hpp"
#include "gen_base.hpp"
#include <eagine/main_ctx_object.hpp>
#include <eagine/value_tree/wrappers.hpp>
#include <map>
namespace eagine::shapes {
//------------------------------------------------------------------------------
/// @brief Loader that fetches shape data from a value tree (JSON, YAML, etc.)
/// @ingroup shapes
/// @see from_value_tree
/// @see valtree::compound
/// @see valtree::attribute
/// @see valtree::from_json_text
/// @see valtree::from_yaml_text
class value_tree_loader
: public main_ctx_object
, public centered_unit_shape_generator_base {
public:
value_tree_loader(valtree::compound source, main_ctx_parent) noexcept;
auto vertex_count() -> span_size_t override;
auto attribute_variants(const vertex_attrib_kind) -> span_size_t override;
auto variant_name(const vertex_attrib_variant) -> string_view override;
auto values_per_vertex(const vertex_attrib_variant) -> span_size_t override;
auto attrib_type(const vertex_attrib_variant vav)
-> attrib_data_type override;
auto is_attrib_normalized(const vertex_attrib_variant) -> bool override;
void attrib_values(const vertex_attrib_variant, span<byte>) override;
void attrib_values(const vertex_attrib_variant, span<std::int16_t>) override;
void attrib_values(const vertex_attrib_variant, span<std::int32_t>) override;
void attrib_values(const vertex_attrib_variant, span<std::uint16_t>)
override;
void attrib_values(const vertex_attrib_variant, span<std::uint32_t>)
override;
void attrib_values(const vertex_attrib_variant, span<float>) override;
auto index_type(const drawing_variant) -> index_data_type override;
auto index_count(const drawing_variant) -> span_size_t override;
void indices(const drawing_variant, span<std::uint16_t> dest) override;
void indices(const drawing_variant, span<std::uint32_t> dest) override;
auto operation_count(const drawing_variant) -> span_size_t override;
void instructions(const drawing_variant, span<draw_operation> ops) override;
private:
using _base = centered_unit_shape_generator_base;
valtree::compound _source{};
std::string _temp{};
std::map<vertex_attrib_variant, std::string> _variant_names{};
static auto _attr_mask(const valtree::compound&) noexcept
-> vertex_attrib_bits;
template <typename T>
void _attrib_values(const vertex_attrib_variant, span<T>);
};
//------------------------------------------------------------------------------
/// @brief Constructs instances of value_tree_loader.
/// @ingroup shapes
/// @see unit_cube
/// @see unit_round_cube
/// @see unit_sphere
/// @see unit_icosahedron
/// @see unit_screen
/// @see unit_torus
/// @see unit_twisted_torus
static inline auto from_value_tree(
valtree::compound source,
main_ctx_parent parent) {
return std::make_unique<value_tree_loader>(std::move(source), parent);
}
//------------------------------------------------------------------------------
} // namespace eagine::shapes
#if !EAGINE_SHAPES_LIBRARY || defined(EAGINE_IMPLEMENTING_SHAPES_LIBRARY)
#include <eagine/shapes/value_tree.inl>
#endif
#endif // EAGINE_SHAPES_VALUE_TREE_HPP
| 34.303922 | 81 | 0.707631 | matus-chochlik |
4437a1d3ef26e66b7eb504af8c42de527c9ba7d2 | 7,612 | cpp | C++ | Studies/Graphics/OpenGL/src/main.cpp | iota97/Misc | fa72d84f0f63d4f5f30c538dba0bf97834018039 | [
"MIT"
] | 1 | 2019-05-09T09:54:04.000Z | 2019-05-09T09:54:04.000Z | Studies/Graphics/OpenGL/src/main.cpp | iota97/Misc | fa72d84f0f63d4f5f30c538dba0bf97834018039 | [
"MIT"
] | null | null | null | Studies/Graphics/OpenGL/src/main.cpp | iota97/Misc | fa72d84f0f63d4f5f30c538dba0bf97834018039 | [
"MIT"
] | null | null | null | #include "GPU/glad/glad.h"
#include "GPU/stb_image/stb_image.h"
#include "GPU/Shader.h"
#include "GPU/Camera.h"
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
#include <GLFW/glfw3.h>
#include <stdio.h>
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
void mouse_callback(GLFWwindow* window, double xpos, double ypos);
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset);
void processInput(GLFWwindow *window);
// settings
const unsigned int SCR_WIDTH = 800;
const unsigned int SCR_HEIGHT = 600;
// camera
Camera camera(glm::vec3(0.0f, 0.0f, 3.0f));
float lastX = SCR_WIDTH / 2.0f;
float lastY = SCR_HEIGHT / 2.0f;
bool firstMouse = true;
// timing
float deltaTime = 0.0f; // time between current frame and last frame
float lastFrame = 0.0f;
int main(int argc, char *argv[]) {
// Set OpenGL 3.3
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
// Create windows
GLFWwindow *window = glfwCreateWindow(800, 600, "LearnOpenGL", NULL, NULL);
if (!window) {
puts("Failed to create GLFW window");
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// Initialize GLAD
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
puts("Failed to initialize GLAD");
return -1;
}
// Viewport
glViewport(0, 0, 800, 600);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
glfwSetCursorPosCallback(window, mouse_callback);
glfwSetScrollCallback(window, scroll_callback);
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
float vertices[] = {
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
0.5f, -0.5f, -0.5f, 1.0f, 0.0f,
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 0.0f,
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
0.5f, 0.5f, 0.5f, 1.0f, 1.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
-0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
-0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
-0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
0.5f, -0.5f, -0.5f, 1.0f, 1.0f,
0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
0.5f, -0.5f, 0.5f, 1.0f, 0.0f,
-0.5f, -0.5f, 0.5f, 0.0f, 0.0f,
-0.5f, -0.5f, -0.5f, 0.0f, 1.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f,
0.5f, 0.5f, -0.5f, 1.0f, 1.0f,
0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
0.5f, 0.5f, 0.5f, 1.0f, 0.0f,
-0.5f, 0.5f, 0.5f, 0.0f, 0.0f,
-0.5f, 0.5f, -0.5f, 0.0f, 1.0f
};
unsigned int VBO, VAO;
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
// Bind
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
// position attribute
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
// texture coord attribute
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(float), (void*)(3 * sizeof(float)));
glEnableVertexAttribArray(1);
// Shader
Shader ourShader("res/shaders/shader.vs", "res/shaders/shader.fs");
// Texture
unsigned int texture;
glGenTextures(1, &texture);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texture);
// set the texture wrapping/filtering options (on the currently bound texture object)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
// load and generate the texture
int width, height, nrChannels;
unsigned char *data = stbi_load("res/textures/container.jpg", &width, &height, &nrChannels, 0);
if (data) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
} else {
puts("Failed to load texture");
}
stbi_image_free(data);
// Depth test
glEnable(GL_DEPTH_TEST);
// Main loop
while(!glfwWindowShouldClose(window)) {
float currentFrame = glfwGetTime();
deltaTime = currentFrame - lastFrame;
lastFrame = currentFrame;
processInput(window);
// Rendering command
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
ourShader.use();
glm::mat4 view = camera.GetViewMatrix();
glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH/SCR_HEIGHT, 0.1f, 100.0f);
// retrieve the matrix uniform locations
unsigned int viewLoc = glGetUniformLocation(ourShader.ID, "view");
unsigned int projectionLoc = glGetUniformLocation(ourShader.ID, "projection");
glUniformMatrix4fv(viewLoc, 1, GL_FALSE, &view[0][0]);
glUniformMatrix4fv(projectionLoc, 1, GL_FALSE, &projection[0][0]);
glm::vec3 cubePositions[] = {
glm::vec3( 0.0f, 0.0f, 0.0f),
glm::vec3( 2.0f, 5.0f, -15.0f),
glm::vec3(-1.5f, -2.2f, -2.5f),
glm::vec3(-3.8f, -2.0f, -12.3f),
glm::vec3( 2.4f, -0.4f, -3.5f),
glm::vec3(-1.7f, 3.0f, -7.5f),
glm::vec3( 1.3f, -2.0f, -2.5f),
glm::vec3( 1.5f, 2.0f, -2.5f),
glm::vec3( 1.5f, 0.2f, -1.5f),
glm::vec3(-1.3f, 1.0f, -1.5f)
};
glBindVertexArray(VAO);
for (unsigned int i = 0; i < 10; i++) {
glm::mat4 model = glm::mat4(1.0f);
model = glm::translate(model, cubePositions[i]);
float angle = 20.0f * i;
model = glm::rotate(model, glm::radians(angle), glm::vec3(1.0f, 0.3f, 0.5f));
unsigned int modelLoc = glGetUniformLocation(ourShader.ID, "model");
glUniformMatrix4fv(modelLoc, 1, GL_FALSE, &model[0][0]);
glDrawArrays(GL_TRIANGLES, 0, 36);
}
glfwSwapBuffers(window);
glfwPollEvents();
}
// Clean up
glDeleteVertexArrays(1, &VAO);
glDeleteBuffers(1, &VBO);
// Terminate
glfwTerminate();
return 0;
}
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
glViewport(0, 0, width, height);
}
void processInput(GLFWwindow *window) {
if (glfwGetKey(window, GLFW_KEY_ESCAPE) == GLFW_PRESS)
glfwSetWindowShouldClose(window, true);
if (glfwGetKey(window, GLFW_KEY_W) == GLFW_PRESS)
camera.ProcessKeyboard(FORWARD, deltaTime);
if (glfwGetKey(window, GLFW_KEY_S) == GLFW_PRESS)
camera.ProcessKeyboard(BACKWARD, deltaTime);
if (glfwGetKey(window, GLFW_KEY_A) == GLFW_PRESS)
camera.ProcessKeyboard(LEFT, deltaTime);
if (glfwGetKey(window, GLFW_KEY_D) == GLFW_PRESS)
camera.ProcessKeyboard(RIGHT, deltaTime);
}
void mouse_callback(GLFWwindow* window, double xpos, double ypos) {
if (firstMouse) {
lastX = xpos;
lastY = ypos;
firstMouse = false;
}
float xoffset = xpos - lastX;
float yoffset = lastY - ypos; // reversed since y-coordinates go from bottom to top
lastX = xpos;
lastY = ypos;
camera.ProcessMouseMovement(xoffset, yoffset);
}
void scroll_callback(GLFWwindow* window, double xoffset, double yoffset) {
camera.ProcessMouseScroll(yoffset);
}
| 30.943089 | 112 | 0.65515 | iota97 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.