blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
99b4f853565d0d6f6f7e51491bc9b69de2bc27b1 | cb5b5899d044892d64ae291cbf44f536d1389e67 | /Demo-MemoryPool/Message.h | 6a0c4a0950bd70572df4772fb000e6bfe67f621a | [] | no_license | freestylekf/CourseMaterial-CppDeeplyEmbedded | fe80224b4de81928b52a3877fdc902cd78ec965a | 22f4fe232c9a52e076df01c9a559dc539771b4df | refs/heads/master | 2021-01-17T21:36:52.478954 | 2016-05-04T07:08:43 | 2016-05-04T07:08:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,360 | h | /**
* The MIT License (MIT)
*
* Copyright (c) 2016 Denis Vasilik
*
* 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.
*/
#pragma once
#include "stdafx.h"
#include "PoolAllocator.h"
class Message : public PoolAllocator<Message>
{
public:
Message(char* pData, int length);
char* getData();
private:
int _id;
int _length;
char _data[16];
};
| [
"DenisVasilik"
] | DenisVasilik |
3124ba7b9922c69dccf2c21e5922debc9639a1dc | e51d009c6c6a1633c2c11ea4e89f289ea294ec7e | /xr2-dsgn/sources/freeimage/FreeImage/PluginTIFF.cpp | 5b9ab98f6be5dc47c8bd414e20715cf02e9b219c | [] | no_license | avmal0-Cor/xr2-dsgn | a0c726a4d54a2ac8147a36549bc79620fead0090 | 14e9203ee26be7a3cb5ca5da7056ecb53c558c72 | refs/heads/master | 2023-07-03T02:05:00.566892 | 2021-08-06T03:10:53 | 2021-08-06T03:10:53 | 389,939,196 | 3 | 2 | null | null | null | null | WINDOWS-1250 | C++ | false | false | 65,878 | cpp | // ==========================================================
// TIFF Loader and Writer
//
// Design and implementation by
// - Floris van den Berg (flvdberg@wxs.nl)
// - Hervé Drolon (drolon@infonie.fr)
// - Markus Loibl (markus.loibl@epost.de)
// - Luca Piergentili (l.pierge@terra.es)
// - Detlev Vendt (detlev.vendt@brillit.de)
//
// This file is part of FreeImage 3
//
// COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES
// THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE
// OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED
// CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT
// THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY
// SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL
// PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER
// THIS DISCLAIMER.
//
// Use at your own risk!
// ==========================================================
#ifdef _MSC_VER
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters
#endif
#ifdef unix
#undef unix
#endif
#ifdef __unix
#undef __unix
#endif
#include "../LibTIFF/tiffiop.h"
#include "FreeImage.h"
#include "Utilities.h"
#include "../Metadata/FreeImageTag.h"
// ----------------------------------------------------------
// geotiff interface (see XTIFF.cpp)
// ----------------------------------------------------------
// Extended TIFF Directory GEO Tag Support
void XTIFFInitialize();
// GeoTIFF profile
void tiff_read_geotiff_profile(TIFF *tif, FIBITMAP *dib);
void tiff_write_geotiff_profile(TIFF *tif, FIBITMAP *dib);
// ----------------------------------------------------------
// exif interface (see XTIFF.cpp)
// ----------------------------------------------------------
// TIFF Exif profile
BOOL tiff_read_exif_tags(TIFF *tif, TagLib::MDMODEL md_model, FIBITMAP *dib);
// ----------------------------------------------------------
// LogLuv conversion functions interface (see TIFFLogLuv.cpp)
// ----------------------------------------------------------
void tiff_ConvertLineXYZToRGB(BYTE *target, BYTE *source, double stonits, int width_in_pixels);
void tiff_ConvertLineRGBToXYZ(BYTE *target, BYTE *source, int width_in_pixels);
// ----------------------------------------------------------
/** Supported loading methods */
typedef enum {
LoadAsRBGA = 0,
LoadAsCMYK = 1,
LoadAs8BitTrns = 2,
LoadAsGenericStrip = 3,
LoadAsTiled = 4,
LoadAsRGBF = 5
} TIFFLoadMethod;
// ----------------------------------------------------------
// local prototypes
// ----------------------------------------------------------
static tsize_t _tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size);
static tsize_t _tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size);
static toff_t _tiffSeekProc(thandle_t handle, toff_t off, int whence);
static int _tiffCloseProc(thandle_t fd);
static int _tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize);
static void _tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size);
static uint16 CheckColormap(int n, uint16* r, uint16* g, uint16* b);
static uint16 GetPhotometric(FIBITMAP *dib);
static void ReadResolution(TIFF *tiff, FIBITMAP *dib);
static void WriteResolution(TIFF *tiff, FIBITMAP *dib);
static void ReadPalette(TIFF *tiff, uint16 photometric, uint16 bitspersample, FIBITMAP *dib);
static FIBITMAP* CreateImageType(FREE_IMAGE_TYPE fit, int width, int height, uint16 bitspersample, uint16 samplesperpixel);
static FREE_IMAGE_TYPE ReadImageType(TIFF *tiff, uint16 bitspersample, uint16 samplesperpixel);
static void WriteImageType(TIFF *tiff, FREE_IMAGE_TYPE fit);
static void WriteCompression(TIFF *tiff, uint16 bitspersample, uint16 samplesperpixel, uint16 photometric, int flags);
static BOOL tiff_read_iptc_profile(TIFF *tiff, FIBITMAP *dib);
static BOOL tiff_read_xmp_profile(TIFF *tiff, FIBITMAP *dib);
static BOOL tiff_read_exif_profile(TIFF *tiff, FIBITMAP *dib);
static void ReadMetadata(TIFF *tiff, FIBITMAP *dib);
static BOOL tiff_write_iptc_profile(TIFF *tiff, FIBITMAP *dib);
static BOOL tiff_write_xmp_profile(TIFF *tiff, FIBITMAP *dib);
static void WriteMetadata(TIFF *tiff, FIBITMAP *dib);
static TIFFLoadMethod FindLoadMethod(TIFF *tif, uint16 photometric, uint16 bitspersample, uint16 samplesperpixel, FREE_IMAGE_TYPE image_type, int flags);
// ==========================================================
// Plugin Interface
// ==========================================================
static int s_format_id;
typedef struct {
FreeImageIO *io;
fi_handle handle;
TIFF *tif;
} fi_TIFFIO;
// ----------------------------------------------------------
// libtiff interface
// ----------------------------------------------------------
static tsize_t
_tiffReadProc(thandle_t handle, tdata_t buf, tsize_t size) {
fi_TIFFIO *fio = (fi_TIFFIO*)handle;
return fio->io->read_proc(buf, size, 1, fio->handle) * size;
}
static tsize_t
_tiffWriteProc(thandle_t handle, tdata_t buf, tsize_t size) {
fi_TIFFIO *fio = (fi_TIFFIO*)handle;
return fio->io->write_proc(buf, size, 1, fio->handle) * size;
}
static toff_t
_tiffSeekProc(thandle_t handle, toff_t off, int whence) {
fi_TIFFIO *fio = (fi_TIFFIO*)handle;
fio->io->seek_proc(fio->handle, off, whence);
return fio->io->tell_proc(fio->handle);
}
static int
_tiffCloseProc(thandle_t fd) {
return 0;
}
#include <sys/stat.h>
static toff_t
_tiffSizeProc(thandle_t handle) {
fi_TIFFIO *fio = (fi_TIFFIO*)handle;
long currPos = fio->io->tell_proc(fio->handle);
fio->io->seek_proc(fio->handle, 0, SEEK_END);
long fileSize = fio->io->tell_proc(fio->handle);
fio->io->seek_proc(fio->handle, currPos, SEEK_SET);
return fileSize;
}
static int
_tiffMapProc(thandle_t fd, tdata_t* pbase, toff_t* psize) {
return 0;
}
static void
_tiffUnmapProc(thandle_t fd, tdata_t base, toff_t size) {
}
// ----------------------------------------------------------
// Open a TIFF file descriptor for read/writing.
// ----------------------------------------------------------
TIFF *
TIFFFdOpen(thandle_t handle, const char *name, const char *mode) {
TIFF *tif;
// Set up the callback for extended TIFF directory tag support
// (see XTIFF.cpp)
XTIFFInitialize();
// Open the file; the callback will set everything up
tif = TIFFClientOpen(name, mode, handle,
_tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc,
_tiffSizeProc, _tiffMapProc, _tiffUnmapProc);
// Warning: tif_fd is declared as 'int' currently (see libTIFF),
// may result in incorrect file pointers inside libTIFF on
// 64bit machines (sizeof(int) != sizeof(long)).
// Needs to be fixed within libTIFF.
if (tif)
tif->tif_fd = (long)handle;
return tif;
}
// ----------------------------------------------------------
// Open a TIFF file for read/writing.
// ----------------------------------------------------------
TIFF*
TIFFOpen(const char* name, const char* mode) {
return 0;
}
// ----------------------------------------------------------
// TIFF library FreeImage-specific routines.
// ----------------------------------------------------------
tdata_t
_TIFFmalloc(tsize_t s) {
return malloc(s);
}
void
_TIFFfree(tdata_t p) {
free(p);
}
tdata_t
_TIFFrealloc(tdata_t p, tsize_t s) {
return realloc(p, s);
}
void
_TIFFmemset(tdata_t p, int v, tsize_t c) {
memset(p, v, (size_t) c);
}
void
_TIFFmemcpy(tdata_t d, const tdata_t s, tsize_t c) {
memcpy(d, s, (size_t) c);
}
int
_TIFFmemcmp(const tdata_t p1, const tdata_t p2, tsize_t c) {
return (memcmp(p1, p2, (size_t) c));
}
// ----------------------------------------------------------
// in FreeImage warnings and errors are disabled
// ----------------------------------------------------------
static void
msdosWarningHandler(const char* module, const char* fmt, va_list ap) {
}
TIFFErrorHandler _TIFFwarningHandler = msdosWarningHandler;
static void
msdosErrorHandler(const char* module, const char* fmt, va_list ap) {
// use this for diagnostic only (do not use otherwise, even in DEBUG mode)
/*
if (module != NULL) {
char msg[1024];
vsprintf(msg, fmt, ap);
FreeImage_OutputMessageProc(s_format_id, "%s: %s", module, msg);
}
*/
}
TIFFErrorHandler _TIFFerrorHandler = msdosErrorHandler;
// ----------------------------------------------------------
#define CVT(x) (((x) * 255L) / ((1L<<16)-1))
#define SCALE(x) (((x)*((1L<<16)-1))/255)
// ==========================================================
// Internal functions
// ==========================================================
static uint16
CheckColormap(int n, uint16* r, uint16* g, uint16* b) {
while (n-- > 0) {
if (*r++ >= 256 || *g++ >= 256 || *b++ >= 256) {
return 16;
}
}
return 8;
}
/**
Get the TIFFTAG_PHOTOMETRIC value from the dib
*/
static uint16
GetPhotometric(FIBITMAP *dib) {
FREE_IMAGE_COLOR_TYPE color_type = FreeImage_GetColorType(dib);
switch(color_type) {
case FIC_MINISWHITE: // min value is white
return PHOTOMETRIC_MINISWHITE;
case FIC_MINISBLACK: // min value is black
return PHOTOMETRIC_MINISBLACK;
case FIC_PALETTE: // color map indexed
return PHOTOMETRIC_PALETTE;
case FIC_RGB: // RGB color model
case FIC_RGBALPHA: // RGB color model with alpha channel
return PHOTOMETRIC_RGB;
case FIC_CMYK: // CMYK color model
return PHOTOMETRIC_RGB; // default to RGB unless the save flag is set to TIFF_CMYK
default:
return PHOTOMETRIC_MINISBLACK;
}
}
/**
Get the resolution from the TIFF and fill the dib with universal units
*/
static void
ReadResolution(TIFF *tiff, FIBITMAP *dib) {
float fResX = 300.0;
float fResY = 300.0;
uint16 resUnit = RESUNIT_INCH;
TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit);
TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &fResX);
TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &fResY);
// If we don't have a valid resolution unit and valid resolution is specified then assume inch
if (resUnit == RESUNIT_NONE && fResX > 0.0 && fResY > 0.0) {
resUnit = RESUNIT_INCH;
}
if (resUnit == RESUNIT_INCH) {
FreeImage_SetDotsPerMeterX(dib, (unsigned) (fResX/0.0254000 + 0.5));
FreeImage_SetDotsPerMeterY(dib, (unsigned) (fResY/0.0254000 + 0.5));
} else if(resUnit == RESUNIT_CENTIMETER) {
FreeImage_SetDotsPerMeterX(dib, (unsigned) (fResX*100.0 + 0.5));
FreeImage_SetDotsPerMeterY(dib, (unsigned) (fResY*100.0 + 0.5));
}
}
/**
Set the resolution to the TIFF using english units
*/
static void
WriteResolution(TIFF *tiff, FIBITMAP *dib) {
double res;
TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);
res = (unsigned long) (0.5 + 0.0254 * FreeImage_GetDotsPerMeterX(dib));
TIFFSetField(tiff, TIFFTAG_XRESOLUTION, res);
res = (unsigned long) (0.5 + 0.0254 * FreeImage_GetDotsPerMeterY(dib));
TIFFSetField(tiff, TIFFTAG_YRESOLUTION, res);
}
/**
Fill the dib palette according to the TIFF photometric
*/
static void
ReadPalette(TIFF *tiff, uint16 photometric, uint16 bitspersample, FIBITMAP *dib) {
RGBQUAD *pal = FreeImage_GetPalette(dib);
switch(photometric) {
case PHOTOMETRIC_MINISBLACK: // bitmap and greyscale image types
case PHOTOMETRIC_MINISWHITE:
// Monochrome image
if (bitspersample == 1) {
if (photometric == PHOTOMETRIC_MINISWHITE) {
pal[0].rgbRed = pal[0].rgbGreen = pal[0].rgbBlue = 255;
pal[1].rgbRed = pal[1].rgbGreen = pal[1].rgbBlue = 0;
} else {
pal[0].rgbRed = pal[0].rgbGreen = pal[0].rgbBlue = 0;
pal[1].rgbRed = pal[1].rgbGreen = pal[1].rgbBlue = 255;
}
} else if ((bitspersample == 4) ||(bitspersample == 8)) {
// need to build the scale for greyscale images
int ncolors = FreeImage_GetColorsUsed(dib);
if (photometric == PHOTOMETRIC_MINISBLACK) {
for (int i = 0; i < ncolors; i++) {
pal[i].rgbRed =
pal[i].rgbGreen =
pal[i].rgbBlue = (BYTE)(i*(255/(ncolors-1)));
}
} else {
for (int i = 0; i < ncolors; i++) {
pal[i].rgbRed =
pal[i].rgbGreen =
pal[i].rgbBlue = (BYTE)(255-i*(255/(ncolors-1)));
}
}
}
break;
case PHOTOMETRIC_PALETTE: // color map indexed
uint16 *red;
uint16 *green;
uint16 *blue;
TIFFGetField(tiff, TIFFTAG_COLORMAP, &red, &green, &blue);
// load the palette in the DIB
if (CheckColormap(1<<bitspersample, red, green, blue) == 16) {
for (int i = (1 << bitspersample) - 1; i >= 0; i--) {
pal[i].rgbRed =(BYTE) CVT(red[i]);
pal[i].rgbGreen = (BYTE) CVT(green[i]);
pal[i].rgbBlue = (BYTE) CVT(blue[i]);
}
} else {
for (int i = (1 << bitspersample) - 1; i >= 0; i--) {
pal[i].rgbRed = (BYTE) red[i];
pal[i].rgbGreen = (BYTE) green[i];
pal[i].rgbBlue = (BYTE) blue[i];
}
}
break;
}
}
/**
Allocate a FIBITMAP
@param fit Image type
@param width Image width in pixels
@param height Image height in pixels
@param bitspersample # bits per sample
@param samplesperpixel # samples per pixel
@return Returns the allocated image if successful, returns NULL otherwise
*/
static FIBITMAP*
CreateImageType(FREE_IMAGE_TYPE fit, int width, int height, uint16 bitspersample, uint16 samplesperpixel) {
FIBITMAP *dib = NULL;
uint16 bpp = bitspersample * samplesperpixel;
if(fit == FIT_BITMAP) {
// standard bitmap type
if(bitspersample == 16) {
if(samplesperpixel == 1) {
// 16-bit greyscale -> convert to 8-bit
dib = FreeImage_Allocate(width, height, 8);
}
else if(samplesperpixel == 3) {
// 48-bit RGB -> convert to 24-bit RGB
dib = FreeImage_Allocate(width, height, 24, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
}
}
else if(bpp == 16) {
if((samplesperpixel == 2) && (bitspersample == 8)) {
// 8-bit indexed + 8-bit alpha channel -> convert to 8-bit transparent
dib = FreeImage_Allocate(width, height, 8);
} else {
// 16-bit RGB -> expect it to be 565
dib = FreeImage_Allocate(width, height, bpp, FI16_565_RED_MASK, FI16_565_GREEN_MASK, FI16_565_BLUE_MASK);
}
}
else if(bpp == 24) {
// BGR
dib = FreeImage_Allocate(width, height, bpp, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
}
else if(bpp == 32) {
// BGRA
dib = FreeImage_Allocate(width, height, bpp, FI_RGBA_RED_MASK, FI_RGBA_GREEN_MASK, FI_RGBA_BLUE_MASK);
}
else {
// anything else <= 8-bit
dib = FreeImage_Allocate(width, height, bpp);
}
} else {
// other bitmap types
dib = FreeImage_AllocateT(fit, width, height, bpp);
}
return dib;
}
/**
Read the TIFFTAG_SAMPLEFORMAT tag and convert to FREE_IMAGE_TYPE
@param tiff LibTIFF TIFF Handle
@param bitspersample # bit per sample
@param samplesperpixel # samples per pixel
@return Returns the image type as a FREE_IMAGE_TYPE value
*/
static FREE_IMAGE_TYPE
ReadImageType(TIFF *tiff, uint16 bitspersample, uint16 samplesperpixel) {
uint16 sampleformat = 0;
FREE_IMAGE_TYPE fit = FIT_BITMAP;
uint16 bpp = bitspersample * samplesperpixel;
// try the sampleformat tag
if(TIFFGetField(tiff, TIFFTAG_SAMPLEFORMAT, &sampleformat)) {
switch (sampleformat) {
case SAMPLEFORMAT_UINT:
switch (bpp) {
case 1:
case 4:
case 8:
case 24:
fit = FIT_BITMAP;
break;
case 16:
// 8-bit + alpha or 16-bit greyscale
if(samplesperpixel == 2) {
fit = FIT_BITMAP;
} else {
fit = FIT_UINT16;
}
break;
case 32:
if(samplesperpixel == 4) {
fit = FIT_BITMAP;
} else {
fit = FIT_UINT32;
}
break;
case 48:
if(samplesperpixel == 3) {
fit = FIT_RGB16;
}
break;
case 64:
if(samplesperpixel == 4) {
fit = FIT_RGBA16;
}
break;
}
break;
case SAMPLEFORMAT_INT:
switch (bpp) {
case 16:
if(samplesperpixel == 3) {
fit = FIT_BITMAP;
} else {
fit = FIT_INT16;
}
break;
case 32:
fit = FIT_INT32;
break;
}
break;
case SAMPLEFORMAT_IEEEFP:
switch (bpp) {
case 32:
fit = FIT_FLOAT;
break;
case 64:
fit = FIT_DOUBLE;
break;
case 96:
fit = FIT_RGBF;
break;
}
break;
case SAMPLEFORMAT_COMPLEXIEEEFP:
switch (bpp) {
case 64:
break;
case 128:
fit = FIT_COMPLEX;
break;
}
break;
}
}
// no sampleformat tag : assume SAMPLEFORMAT_UINT
else {
if(samplesperpixel == 1) {
switch (bpp) {
case 16:
fit = FIT_UINT16;
break;
case 32:
fit = FIT_UINT32;
break;
}
}
else if(samplesperpixel == 3) {
if(bpp == 48) fit = FIT_RGB16;
}
else if(samplesperpixel == 4) {
if(bpp == 64) fit = FIT_RGBA16;
}
}
return fit;
}
/**
Convert FREE_IMAGE_TYPE and write TIFFTAG_SAMPLEFORMAT
@param tiff LibTIFF TIFF Handle
@param fit Image type as a FREE_IMAGE_TYPE value
*/
static void
WriteImageType(TIFF *tiff, FREE_IMAGE_TYPE fit) {
switch(fit) {
case FIT_BITMAP: // standard image: 1-, 4-, 8-, 16-, 24-, 32-bit
case FIT_UINT16: // array of unsigned short : unsigned 16-bit
case FIT_UINT32: // array of unsigned long : unsigned 32-bit
case FIT_RGB16: // 48-bit RGB image : 3 x 16-bit
case FIT_RGBA16: // 64-bit RGBA image : 4 x 16-bit
TIFFSetField(tiff, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_UINT);
break;
case FIT_INT16: // array of short : signed 16-bit
case FIT_INT32: // array of long : signed 32-bit
TIFFSetField(tiff, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_INT);
break;
case FIT_FLOAT: // array of float : 32-bit
case FIT_DOUBLE: // array of double : 64-bit
case FIT_RGBF: // 96-bit RGB float image : 3 x 32-bit IEEE floating point
case FIT_RGBAF: // 128-bit RGBA float image : 4 x 32-bit IEEE floating point
TIFFSetField(tiff, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_IEEEFP);
break;
case FIT_COMPLEX: // array of COMPLEX : 2 x 64-bit
TIFFSetField(tiff, TIFFTAG_SAMPLEFORMAT, SAMPLEFORMAT_COMPLEXIEEEFP);
break;
}
}
/**
Select the compression algorithm
@param tiff LibTIFF TIFF Handle
@param
*/
static void
WriteCompression(TIFF *tiff, uint16 bitspersample, uint16 samplesperpixel, uint16 photometric, int flags) {
uint16 compression;
uint16 bitsperpixel = bitspersample * samplesperpixel;
if(photometric == PHOTOMETRIC_LOGLUV) {
compression = COMPRESSION_SGILOG;
} else if ((flags & TIFF_PACKBITS) == TIFF_PACKBITS) {
compression = COMPRESSION_PACKBITS;
} else if ((flags & TIFF_DEFLATE) == TIFF_DEFLATE) {
compression = COMPRESSION_DEFLATE;
} else if ((flags & TIFF_ADOBE_DEFLATE) == TIFF_ADOBE_DEFLATE) {
compression = COMPRESSION_ADOBE_DEFLATE;
} else if ((flags & TIFF_NONE) == TIFF_NONE) {
compression = COMPRESSION_NONE;
} else if ((bitsperpixel == 1) && ((flags & TIFF_CCITTFAX3) == TIFF_CCITTFAX3)) {
compression = COMPRESSION_CCITTFAX3;
} else if ((bitsperpixel == 1) && ((flags & TIFF_CCITTFAX4) == TIFF_CCITTFAX4)) {
compression = COMPRESSION_CCITTFAX4;
} else if ((flags & TIFF_LZW) == TIFF_LZW) {
compression = COMPRESSION_LZW;
} else if ((flags & TIFF_JPEG) == TIFF_JPEG) {
if(((bitsperpixel == 8) && (photometric != PHOTOMETRIC_PALETTE)) || (bitsperpixel == 24)) {
compression = COMPRESSION_JPEG;
// RowsPerStrip must be multiple of 8 for JPEG
uint32 rowsperstrip = (uint32) -1;
rowsperstrip = TIFFDefaultStripSize(tiff, rowsperstrip);
rowsperstrip = rowsperstrip + (8 - (rowsperstrip % 8));
// overwrite previous RowsPerStrip
TIFFSetField(tiff, TIFFTAG_ROWSPERSTRIP, rowsperstrip);
} else {
// default to LZW
compression = COMPRESSION_LZW;
}
}
else {
// default compression scheme
switch(bitsperpixel) {
case 1 :
compression = COMPRESSION_CCITTFAX4;
break;
case 4 :
case 8 :
case 16 :
case 24 :
case 32 :
compression = COMPRESSION_LZW;
break;
case 48:
case 64 :
case 128:
compression = COMPRESSION_LZW;
break;
default :
compression = COMPRESSION_NONE;
break;
}
}
TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression);
if(compression == COMPRESSION_LZW) {
// This option is only meaningful with LZW compression: a predictor value of 2
// causes each scanline of the output image to undergo horizontal differencing
// before it is encoded; a value of 1 forces each scanline to be encoded without differencing.
// Found on LibTIFF mailing list :
// LZW without differencing works well for 1-bit images, 4-bit grayscale images,
// and many palette-color images. But natural 24-bit color images and some 8-bit
// grayscale images do much better with differencing.
if((bitspersample == 8) || (bitspersample == 16)) {
if ((bitsperpixel >= 8) && (photometric != PHOTOMETRIC_PALETTE))
TIFFSetField(tiff, TIFFTAG_PREDICTOR, 2);
else
TIFFSetField(tiff, TIFFTAG_PREDICTOR, 1);
} else {
TIFFSetField(tiff, TIFFTAG_PREDICTOR, 1);
}
}
else if(compression == COMPRESSION_CCITTFAX3) {
// try to be compliant with the TIFF Class F specification
// that documents the TIFF tags specific to FAX applications
// see http://palimpsest.stanford.edu/bytopic/imaging/std/tiff-f.html
uint32 group3options = GROUP3OPT_2DENCODING | GROUP3OPT_FILLBITS;
TIFFSetField(tiff, TIFFTAG_GROUP3OPTIONS, group3options); // 2d-encoded, has aligned EOL
TIFFSetField(tiff, TIFFTAG_FILLORDER, FILLORDER_LSB2MSB); // lsb-to-msb fillorder
}
}
// ==========================================================
// TIFF metadata routines
// ==========================================================
/**
Read the TIFFTAG_RICHTIFFIPTC tag (IPTC/NAA or Adobe Photoshop profile)
*/
static BOOL
tiff_read_iptc_profile(TIFF *tiff, FIBITMAP *dib) {
BYTE *profile = NULL;
uint32 profile_size = 0;
if(TIFFGetField(tiff,TIFFTAG_RICHTIFFIPTC, &profile_size, &profile) == 1) {
if (TIFFIsByteSwapped(tiff) != 0)
TIFFSwabArrayOfLong((uint32 *) profile, (unsigned long)profile_size);
return read_iptc_profile(dib, profile, 4 * profile_size);
}
return FALSE;
}
/**
Read the TIFFTAG_XMLPACKET tag (XMP profile)
@param dib Input FIBITMAP
@param tiff LibTIFF TIFF handle
@return Returns TRUE if successful, FALSE otherwise
*/
static BOOL
tiff_read_xmp_profile(TIFF *tiff, FIBITMAP *dib) {
BYTE *profile = NULL;
uint32 profile_size = 0;
if (TIFFGetField(tiff, TIFFTAG_XMLPACKET, &profile_size, &profile) == 1) {
// create a tag
FITAG *tag = FreeImage_CreateTag();
if(!tag) return FALSE;
FreeImage_SetTagID(tag, TIFFTAG_XMLPACKET); // 700
FreeImage_SetTagKey(tag, g_TagLib_XMPFieldName);
FreeImage_SetTagLength(tag, profile_size);
FreeImage_SetTagCount(tag, profile_size);
FreeImage_SetTagType(tag, FIDT_ASCII);
FreeImage_SetTagValue(tag, profile);
// store the tag
FreeImage_SetMetadata(FIMD_XMP, dib, FreeImage_GetTagKey(tag), tag);
// destroy the tag
FreeImage_DeleteTag(tag);
return TRUE;
}
return FALSE;
}
/**
Read the Exif profile embedded in a TIFF
@param dib Input FIBITMAP
@param tiff LibTIFF TIFF handle
@return Returns TRUE if successful, FALSE otherwise
*/
static BOOL
tiff_read_exif_profile(TIFF *tiff, FIBITMAP *dib) {
uint32 exif_offset = 0;
// read EXIF-TIFF tags
tiff_read_exif_tags(tiff, TagLib::EXIF_MAIN, dib);
// get the IFD offset
if(TIFFGetField(tiff, TIFFTAG_EXIFIFD, &exif_offset)) {
// read EXIF tags
if(!TIFFReadEXIFDirectory(tiff, exif_offset))
return FALSE;
return tiff_read_exif_tags(tiff, TagLib::EXIF_EXIF, dib);
}
return FALSE;
}
/**
Read TIFF special profiles
*/
static void
ReadMetadata(TIFF *tiff, FIBITMAP *dib) {
// IPTC/NAA
tiff_read_iptc_profile(tiff, dib);
// Adobe XMP
tiff_read_xmp_profile(tiff, dib);
// GeoTIFF
tiff_read_geotiff_profile(tiff, dib);
// Exif-TIFF
tiff_read_exif_profile(tiff, dib);
}
// ----------------------------------------------------------
/**
Write the TIFFTAG_RICHTIFFIPTC tag (IPTC/NAA or Adobe Photoshop profile)
*/
static BOOL
tiff_write_iptc_profile(TIFF *tiff, FIBITMAP *dib) {
if(FreeImage_GetMetadataCount(FIMD_IPTC, dib)) {
BYTE *profile = NULL;
uint32 profile_size = 0;
// create a binary profile
if(write_iptc_profile(dib, &profile, &profile_size)) {
uint32 iptc_size = profile_size;
iptc_size += (4-(iptc_size & 0x03)); // Round up for long word alignment
BYTE *iptc_profile = (BYTE*)malloc(iptc_size);
if(!iptc_profile) {
free(profile);
return FALSE;
}
memset(iptc_profile, 0, iptc_size);
memcpy(iptc_profile, profile, profile_size);
if (TIFFIsByteSwapped(tiff))
TIFFSwabArrayOfLong((uint32 *) iptc_profile, (unsigned long)iptc_size/4);
// Tag is type TIFF_LONG so byte length is divided by four
TIFFSetField(tiff, TIFFTAG_RICHTIFFIPTC, iptc_size/4, iptc_profile);
// release the profile data
free(iptc_profile);
free(profile);
return TRUE;
}
}
return FALSE;
}
/**
Write the TIFFTAG_XMLPACKET tag (XMP profile)
@param dib Input FIBITMAP
@param tiff LibTIFF TIFF handle
@return Returns TRUE if successful, FALSE otherwise
*/
static BOOL
tiff_write_xmp_profile(TIFF *tiff, FIBITMAP *dib) {
FITAG *tag_xmp = NULL;
FreeImage_GetMetadata(FIMD_XMP, dib, g_TagLib_XMPFieldName, &tag_xmp);
if(tag_xmp && (NULL != FreeImage_GetTagValue(tag_xmp))) {
TIFFSetField(tiff, TIFFTAG_XMLPACKET, (uint32)FreeImage_GetTagLength(tag_xmp), (BYTE*)FreeImage_GetTagValue(tag_xmp));
return TRUE;
}
return FALSE;
}
/**
Write TIFF special profiles
*/
static void
WriteMetadata(TIFF *tiff, FIBITMAP *dib) {
// IPTC
tiff_write_iptc_profile(tiff, dib);
// Adobe XMP
tiff_write_xmp_profile(tiff, dib);
// GeoTIFF tags
tiff_write_geotiff_profile(tiff, dib);
}
// ==========================================================
// Plugin Implementation
// ==========================================================
static const char * DLL_CALLCONV
Format() {
return "TIFF";
}
static const char * DLL_CALLCONV
Description() {
return "Tagged Image File Format";
}
static const char * DLL_CALLCONV
Extension() {
return "tif,tiff";
}
static const char * DLL_CALLCONV
RegExpr() {
return "^[MI][MI][\\x01*][\\x01*]";
}
static const char * DLL_CALLCONV
MimeType() {
return "image/tiff";
}
static BOOL DLL_CALLCONV
Validate(FreeImageIO *io, fi_handle handle) {
BYTE tiff_id1[] = { 0x49, 0x49, 0x2A, 0x00 };
BYTE tiff_id2[] = { 0x4D, 0x4D, 0x00, 0x2A };
BYTE signature[4] = { 0, 0, 0, 0 };
io->read_proc(signature, 1, 4, handle);
if(memcmp(tiff_id1, signature, 4) == 0)
return TRUE;
if(memcmp(tiff_id2, signature, 4) == 0)
return TRUE;
return FALSE;
}
static BOOL DLL_CALLCONV
SupportsExportDepth(int depth) {
return (
(depth == 1) ||
(depth == 4) ||
(depth == 8) ||
(depth == 24) ||
(depth == 32)
);
}
static BOOL DLL_CALLCONV
SupportsExportType(FREE_IMAGE_TYPE type) {
return (
(type == FIT_BITMAP) ||
(type == FIT_UINT16) ||
(type == FIT_INT16) ||
(type == FIT_UINT32) ||
(type == FIT_INT32) ||
(type == FIT_FLOAT) ||
(type == FIT_DOUBLE) ||
(type == FIT_COMPLEX) ||
(type == FIT_RGB16) ||
(type == FIT_RGBA16) ||
(type == FIT_RGBF)
);
}
static BOOL DLL_CALLCONV
SupportsICCProfiles() {
return TRUE;
}
// ----------------------------------------------------------
static void * DLL_CALLCONV
Open(FreeImageIO *io, fi_handle handle, BOOL read) {
// wrapper for TIFF I/O
fi_TIFFIO *fio = (fi_TIFFIO*)malloc(sizeof(fi_TIFFIO));
if(!fio) return NULL;
fio->io = io;
fio->handle = handle;
if (read) {
fio->tif = TIFFFdOpen((thandle_t)fio, "", "r");
} else {
fio->tif = TIFFFdOpen((thandle_t)fio, "", "w");
}
if(fio->tif == NULL) {
free(fio);
FreeImage_OutputMessageProc(s_format_id, "Error while opening TIFF: data is invalid");
return NULL;
}
return fio;
}
static void DLL_CALLCONV
Close(FreeImageIO *io, fi_handle handle, void *data) {
if(data) {
fi_TIFFIO *fio = (fi_TIFFIO*)data;
TIFFClose(fio->tif);
free(fio);
}
}
// ----------------------------------------------------------
static int DLL_CALLCONV
PageCount(FreeImageIO *io, fi_handle handle, void *data) {
if(data) {
fi_TIFFIO *fio = (fi_TIFFIO*)data;
TIFF *tif = (TIFF *)fio->tif;
int nr_ifd = 0;
do {
nr_ifd++;
} while (TIFFReadDirectory(tif));
return nr_ifd;
}
return 0;
}
// ----------------------------------------------------------
/**
check for uncommon bitspersample values (e.g. 10, 12, ...)
@param photometric TIFFTAG_PHOTOMETRIC tiff tag
@param bitspersample TIFFTAG_BITSPERSAMPLE tiff tag
@return Returns FALSE if a uncommon bit-depth is encountered, returns TRUE otherwise
*/
static BOOL IsValidBitsPerSample(uint16 photometric, uint16 bitspersample) {
switch(bitspersample) {
case 1:
case 4:
if((photometric == PHOTOMETRIC_MINISWHITE) || (photometric == PHOTOMETRIC_MINISBLACK) || (photometric == PHOTOMETRIC_PALETTE)) {
return TRUE;
} else {
return FALSE;
}
break;
case 8:
return TRUE;
case 16:
if(photometric != PHOTOMETRIC_PALETTE) {
return TRUE;
} else {
return FALSE;
}
break;
case 32:
return TRUE;
case 64:
case 128:
if(photometric == PHOTOMETRIC_MINISBLACK) {
return TRUE;
} else {
return FALSE;
}
break;
default:
return FALSE;
}
}
static TIFFLoadMethod
FindLoadMethod(TIFF *tif, FREE_IMAGE_TYPE image_type, int flags) {
uint16 bitspersample;
uint16 samplesperpixel;
uint16 photometric;
uint16 planar_config;
TIFFLoadMethod loadMethod = LoadAsGenericStrip;
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric);
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planar_config);
BOOL bIsTiled = (TIFFIsTiled(tif) == 0) ? FALSE:TRUE;
switch(photometric) {
// convert to 24 or 32 bits RGB if the image is full color
case PHOTOMETRIC_RGB:
if((image_type == FIT_RGB16) || (image_type == FIT_RGBA16)) {
// load 48-bit RGB and 64-bit RGBA without conversion
loadMethod = LoadAsGenericStrip;
} else if(bitspersample >= 8) {
loadMethod = LoadAsRBGA;
}
break;
case PHOTOMETRIC_YCBCR:
case PHOTOMETRIC_CIELAB:
case PHOTOMETRIC_ICCLAB:
case PHOTOMETRIC_ITULAB:
loadMethod = LoadAsRBGA;
break;
case PHOTOMETRIC_LOGLUV:
loadMethod = LoadAsRGBF;
break;
case PHOTOMETRIC_SEPARATED:
if(planar_config == PLANARCONFIG_CONTIG) {
// if image is PHOTOMETRIC_SEPARATED _and_ comes with an ICC profile,
// then the image should preserve its original (CMYK) colour model and
// should be read as CMYK (to keep the match of pixel and profile and
// to avoid multiple conversions. Conversion can be done by changing
// the profile from it's original CMYK to an RGB profile with an
// apropriate color management system. Works with non-tiled TIFFs.
if((((flags & TIFF_CMYK) == TIFF_CMYK) || samplesperpixel > 4) && !bIsTiled) {
loadMethod = LoadAsCMYK;
} else {
loadMethod = LoadAsRBGA;
}
} else if(planar_config == PLANARCONFIG_SEPARATE) {
// TIFFReadRGBAImage doesn't support this case ...
loadMethod = LoadAsCMYK;
}
break;
case PHOTOMETRIC_MINISWHITE:
case PHOTOMETRIC_MINISBLACK:
case PHOTOMETRIC_PALETTE:
// When samplesperpixel = 2 and bitspersample = 8, set the image as a
// 8-bit indexed image + 8-bit alpha layer image
// and convert to a 8-bit image with a transparency table
if((samplesperpixel == 2) && (bitspersample == 8)) {
loadMethod = LoadAs8BitTrns;
} else {
loadMethod = LoadAsGenericStrip;
}
break;
default:
loadMethod = LoadAsGenericStrip;
break;
}
if((loadMethod == LoadAsGenericStrip) && bIsTiled) {
loadMethod = LoadAsTiled;
}
return loadMethod;
}
static FIBITMAP * DLL_CALLCONV
Load(FreeImageIO *io, fi_handle handle, int page, int flags, void *data) {
if ((handle != NULL) && (data != NULL)) {
TIFF *tif = NULL;
uint32 height = 0;
uint32 width = 0;
uint16 bitspersample = 1;
uint16 samplesperpixel = 1;
uint32 rowsperstrip;
uint16 photometric = PHOTOMETRIC_MINISWHITE;
uint16 compression = COMPRESSION_NONE;
uint16 planar_config;
FIBITMAP *dib = NULL;
uint32 iccSize = 0; // ICC profile length
void *iccBuf = NULL; // ICC profile data
try {
fi_TIFFIO *fio = (fi_TIFFIO*)data;
tif = fio->tif;
if (page != -1)
if (!tif || !TIFFSetDirectory(tif, (tdir_t)page))
throw "Error encountered while opening TIFF file";
// first, get the photometric, the compression and basic metadata
// ---------------------------------------------------------------------------------
TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &photometric);
TIFFGetField(tif, TIFFTAG_COMPRESSION, &compression);
// check for HDR formats
// ---------------------------------------------------------------------------------
if(photometric == PHOTOMETRIC_LOGLUV) {
// check the compression
if(compression != COMPRESSION_SGILOG && compression != COMPRESSION_SGILOG24) {
throw "Only support SGILOG compressed LogLuv data";
}
// set decoder to output in IEEE 32-bit float XYZ values
TIFFSetField(tif, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_FLOAT);
}
// ---------------------------------------------------------------------------------
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &width);
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &height);
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplesperpixel);
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitspersample);
TIFFGetField(tif, TIFFTAG_ROWSPERSTRIP, &rowsperstrip);
TIFFGetField(tif, TIFFTAG_ICCPROFILE, &iccSize, &iccBuf);
TIFFGetFieldDefaulted(tif, TIFFTAG_PLANARCONFIG, &planar_config);
// check for unsupported formats
// ---------------------------------------------------------------------------------
if (compression == COMPRESSION_OJPEG)
throw "6.0 JPEG encoding is not supported";
if((photometric == PHOTOMETRIC_SEPARATED) && (bitspersample == 16))
throw "Unable to handle 16-bit CMYK TIFF";
if(IsValidBitsPerSample(photometric, bitspersample) == FALSE) {
FreeImage_OutputMessageProc(s_format_id,
"Unable to handle this format: bitspersample = %d, samplesperpixel = %d, photometric = %d",
(int)bitspersample, (int)samplesperpixel, (int)photometric);
throw (char*)NULL;
}
// ---------------------------------------------------------------------------------
// get image data type
FREE_IMAGE_TYPE image_type = ReadImageType(tif, bitspersample, samplesperpixel);
// get the most appropriate loading method
TIFFLoadMethod loadMethod = FindLoadMethod(tif, image_type, flags);
// ---------------------------------------------------------------------------------
if(loadMethod == LoadAsRBGA) {
// ---------------------------------------------------------------------------------
// RGB[A] loading using the TIFFReadRGBAImage() API
// ---------------------------------------------------------------------------------
BOOL has_alpha = FALSE;
// Read the whole image into one big RGBA buffer and then
// convert it to a DIB. This is using the traditional
// TIFFReadRGBAImage() API that we trust.
uint32 *raster = (uint32*)_TIFFmalloc(width * height * sizeof(uint32));
if (raster == NULL)
throw "No space for raster buffer";
// read the image in one chunk into an RGBA array
if (!TIFFReadRGBAImage(tif, width, height, raster, 0)) {
_TIFFfree(raster);
throw "Unsupported TIF format";
}
// TIFFReadRGBAImage always deliveres 3 or 4 samples per pixel images
// (RGB or RGBA, see below). Cut-off possibly present channels (additional
// alpha channels) from e.g. Photoshop. Any CMYK(A..) is now treated as RGB,
// any additional alpha channel on RGB(AA..) is lost on conversion to RGB(A)
if(samplesperpixel > 4) {
FreeImage_OutputMessageProc(s_format_id, "Warning: %d additional alpha channel(s) ignored", samplesperpixel-4);
samplesperpixel = 4;
}
// create a new DIB (take care of different samples-per-pixel in case
// of converted CMYK image (RGB conversion is on sample per pixel less)
if (photometric == PHOTOMETRIC_SEPARATED && samplesperpixel == 4) {
samplesperpixel = 3;
}
dib = CreateImageType(image_type, width, height, bitspersample, samplesperpixel);
if (dib == NULL) {
// free the raster pointer and output an error if allocation failed
_TIFFfree(raster);
throw "DIB allocation failed";
}
// fill in the resolution (english or universal)
ReadResolution(tif, dib);
// read the raster lines and save them in the DIB
// with RGB mode, we have to change the order of the 3 samples RGB
// We use macros for extracting components from the packed ABGR
// form returned by TIFFReadRGBAImage.
uint32 *row = &raster[0];
if (samplesperpixel == 4) {
// 32-bit RGBA
for (uint32 y = 0; y < height; y++) {
BYTE *bits = FreeImage_GetScanLine(dib, y);
for (uint32 x = 0; x < width; x++) {
bits[FI_RGBA_BLUE] = (BYTE)TIFFGetB(row[x]);
bits[FI_RGBA_GREEN] = (BYTE)TIFFGetG(row[x]);
bits[FI_RGBA_RED] = (BYTE)TIFFGetR(row[x]);
bits[FI_RGBA_ALPHA] = (BYTE)TIFFGetA(row[x]);
if (bits[FI_RGBA_ALPHA] != 0)
has_alpha = TRUE;
bits += 4;
}
row += width;
}
} else {
// 24-bit RGB
for (uint32 y = 0; y < height; y++) {
BYTE *bits = FreeImage_GetScanLine(dib, y);
for (uint32 x = 0; x < width; x++) {
bits[FI_RGBA_BLUE] = (BYTE)TIFFGetB(row[x]);
bits[FI_RGBA_GREEN] = (BYTE)TIFFGetG(row[x]);
bits[FI_RGBA_RED] = (BYTE)TIFFGetR(row[x]);
bits += 3;
}
row += width;
}
}
_TIFFfree(raster);
FreeImage_SetTransparent(dib, has_alpha);
} else if(loadMethod == LoadAs8BitTrns) {
// ---------------------------------------------------------------------------------
// 8-bit + 8-bit alpha layer loading
// ---------------------------------------------------------------------------------
// create a new 8-bit DIB
dib = CreateImageType(image_type, width, height, bitspersample, samplesperpixel);
if (dib == NULL) {
throw FI_MSG_ERROR_MEMORY;
}
// fill in the resolution (english or universal)
ReadResolution(tif, dib);
// set up the colormap based on photometric
ReadPalette(tif, photometric, bitspersample, dib);
// calculate the line + pitch (separate for scr & dest)
tsize_t src_line = TIFFScanlineSize(tif);
// here, the pitch is 2x less than the original as we only keep the first layer
int dst_pitch = FreeImage_GetPitch(dib);
// transparency table for 8-bit + 8-bit alpha images
BYTE trns[256];
// clear the transparency table
memset(trns, 0xFF, 256 * sizeof(BYTE));
// In the tiff file the lines are save from up to down
// In a DIB the lines must be saved from down to up
BYTE *bits = FreeImage_GetScanLine(dib, height - 1);
// read the tiff lines and save them in the DIB
if(planar_config == PLANARCONFIG_CONTIG) {
BYTE *buf = (BYTE*)malloc(TIFFStripSize(tif) * sizeof(BYTE));
if(buf == NULL) throw FI_MSG_ERROR_MEMORY;
for (uint32 y = 0; y < height; y += rowsperstrip) {
int32 nrow = (y + rowsperstrip > height ? height - y : rowsperstrip);
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), buf, nrow * src_line) == -1) {
free(buf);
throw "Parsing error";
}
for (int l = 0; l < nrow; l++) {
BYTE *p = bits;
BYTE *b = buf + l * src_line;
for(uint32 x = 0; x < (uint32)(src_line / samplesperpixel); x++) {
// copy the 8-bit layer
*p = b[0];
// convert the 8-bit alpha layer to a trns table
trns[ b[0] ] = b[1];
p++;
b += samplesperpixel;
}
bits -= dst_pitch;
}
}
free(buf);
}
else if(planar_config == PLANARCONFIG_SEPARATE) {
tsize_t stripsize = TIFFStripSize(tif) * sizeof(BYTE);
BYTE *buf = (BYTE*)malloc(2 * stripsize);
BYTE *grey = buf;
BYTE *alpha = buf + stripsize;
for (uint32 y = 0; y < height; y += rowsperstrip) {
int32 nrow = (y + rowsperstrip > height ? height - y : rowsperstrip);
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), grey, nrow * src_line) == -1) {
free(buf);
throw "Parsing error";
}
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, y, 1), alpha, nrow * src_line) == -1) {
free(buf);
throw "Parsing error";
}
for (int l = 0; l < nrow; l++) {
BYTE *p = bits;
BYTE *g = grey + l * src_line;
BYTE *a = alpha + l * src_line;
for(uint32 x = 0; x < (uint32)(src_line); x++) {
// copy the 8-bit layer
*p = g[0];
// convert the 8-bit alpha layer to a trns table
trns[ g[0] ] = a[0];
p++;
g++;
a++;
}
bits -= dst_pitch;
}
}
free(buf);
}
FreeImage_SetTransparencyTable(dib, &trns[0], 256);
FreeImage_SetTransparent(dib, TRUE);
} else if(loadMethod == LoadAsCMYK) {
// ---------------------------------------------------------------------------------
// CMYK loading
// ---------------------------------------------------------------------------------
BOOL has_alpha = FALSE;
// At this place, samplesperpixel could be > 4, esp. when a CMYK(A) format
// is recognized. Where all other formats are handled straight-forward, this
// format has to be handled special
BOOL isCMYKA = (photometric == PHOTOMETRIC_SEPARATED) && (samplesperpixel > 4);
uint16 spp = MIN(samplesperpixel, (uint16)4);
if((planar_config == PLANARCONFIG_SEPARATE) && !isCMYKA && ((flags & TIFF_CMYK) != TIFF_CMYK)) {
// CMYK picture => convert to RGB 24-bit
spp = 3;
}
// create a new DIB
dib = CreateImageType(image_type, width, height, bitspersample, spp);
if (dib == NULL) {
throw FI_MSG_ERROR_MEMORY;
}
// fill in the resolution (english or universal)
ReadResolution(tif, dib);
// calculate the line + pitch (separate for scr & dest)
tsize_t src_line = TIFFScanlineSize(tif);
int dst_pitch = FreeImage_GetPitch(dib);
// In the tiff file the lines are save from up to down
// In a DIB the lines must be saved from down to up
BYTE *bits = FreeImage_GetScanLine(dib, height - 1);
// read the tiff lines and save them in the DIB
if(planar_config == PLANARCONFIG_CONTIG) {
BYTE *buf = (BYTE*)malloc(TIFFStripSize(tif) * sizeof(BYTE));
if(buf == NULL) throw FI_MSG_ERROR_MEMORY;
for (uint32 y = 0; y < height; y += rowsperstrip) {
int32 nrow = (y + rowsperstrip > height ? height - y : rowsperstrip);
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), buf, nrow * src_line) == -1) {
free(buf);
throw "Parsing error";
}
if(isCMYKA) {
// CMYKA picture
for (int l = 0; l < nrow; l++) {
// Here we know: samples-per-pixel was >= 5 on CMYKA picture
// This should be converted to RGBA or CMYK, depending on
// TIFF_CMYK is given. The resulting image always has 32bpp.
BYTE *p = bits;
BYTE *b = buf + l * src_line;
for (uint32 x = 0; x < (uint32)(src_line / samplesperpixel); x++) {
if ((flags & TIFF_CMYK) == TIFF_CMYK) {
memcpy(p, b, spp);
} else {
BYTE k = 255 - b[3];
p[FI_RGBA_RED] = (k*(255-b[0]))/255;
p[FI_RGBA_GREEN] = (k*(255-b[1]))/255;
p[FI_RGBA_BLUE] = (k*(255-b[2]))/255;
if ((p[FI_RGBA_ALPHA] = b[4]) != 0)
has_alpha = TRUE;
}
b += samplesperpixel;
p += spp;
}
bits -= dst_pitch;
}
}
else {
// CMYK picture: just copy
for (int l = 0; l < nrow; l++) {
BYTE *b = buf + l * src_line;
memcpy(bits, b, src_line);
bits -= dst_pitch;
}
}
}
free(buf);
}
else if(planar_config == PLANARCONFIG_SEPARATE) {
uint16 sample;
BYTE *channel;
tsize_t stripsize = TIFFStripSize(tif) * sizeof(BYTE);
BYTE *buf = (BYTE*)malloc(samplesperpixel * stripsize);
if(buf == NULL) throw FI_MSG_ERROR_MEMORY;
for (uint32 y = 0; y < height; y += rowsperstrip) {
int32 nrow = (y + rowsperstrip > height ? height - y : rowsperstrip);
// read all separated strips
channel = buf;
for(sample = 0; sample < samplesperpixel; sample++) {
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, y, sample), channel, nrow * src_line) == -1) {
free(buf);
throw "Parsing error";
}
channel += stripsize;
}
if ((flags & TIFF_CMYK) == TIFF_CMYK) {
// CMYK or CMYKA picture: load as 32-bit CMYK, skipping possibly present alpha channel(s)
for (int l = 0; l < nrow; l++) {
channel = buf;
for(sample = 0; sample < spp; sample++) {
BYTE *src_bits = channel + l * src_line;
BYTE *dst_bits = bits;
for (uint32 x = 0; x < (uint32)(src_line); x++) {
dst_bits[sample] = src_bits[x];
dst_bits += spp;
}
channel += stripsize;
}
bits -= dst_pitch;
}
}
else if(isCMYKA) {
// CMYKA picture: convert to RGBA, skipping possibly some alpha channel(s)
for (int l = 0; l < nrow; l++) {
BYTE *c_channel = buf + l * src_line;
BYTE *m_channel = buf + stripsize + l * src_line;
BYTE *y_channel = buf + 2*stripsize + l * src_line;
BYTE *k_channel = buf + 3*stripsize + l * src_line;
BYTE *a_channel = buf + 4*stripsize + l * src_line;
BYTE *dst_bits = bits;
for (uint32 x = 0; x < (uint32)(src_line); x++) {
BYTE k = 255 - k_channel[x];
dst_bits[FI_RGBA_RED] = (k*(255-c_channel[x]))/255;
dst_bits[FI_RGBA_GREEN] = (k*(255-m_channel[x]))/255;
dst_bits[FI_RGBA_BLUE] = (k*(255-y_channel[x]))/255;
if ((dst_bits[FI_RGBA_ALPHA] = a_channel[x]) != 0)
has_alpha = TRUE;
dst_bits += spp;
}
bits -= dst_pitch;
}
}
else {
// CMYK picture: convert to RGB
for (int l = 0; l < nrow; l++) {
BYTE *c_channel = buf + l * src_line;
BYTE *m_channel = buf + stripsize + l * src_line;
BYTE *y_channel = buf + 2*stripsize + l * src_line;
BYTE *k_channel = buf + 3*stripsize + l * src_line;
BYTE *dst_bits = bits;
for (uint32 x = 0; x < (uint32)(src_line); x++) {
BYTE k = 255 - k_channel[x];
dst_bits[FI_RGBA_RED] = (k*(255-c_channel[x]))/255;
dst_bits[FI_RGBA_GREEN] = (k*(255-m_channel[x]))/255;
dst_bits[FI_RGBA_BLUE] = (k*(255-y_channel[x]))/255;
dst_bits += spp;
}
bits -= dst_pitch;
}
}
}
free(buf);
}
FreeImage_SetTransparent(dib, has_alpha);
} else if(loadMethod == LoadAsGenericStrip) {
// ---------------------------------------------------------------------------------
// Generic loading
// ---------------------------------------------------------------------------------
// create a new DIB
dib = CreateImageType(image_type, width, height, bitspersample, samplesperpixel);
if (dib == NULL) {
throw FI_MSG_ERROR_MEMORY;
}
// fill in the resolution (english or universal)
ReadResolution(tif, dib);
// set up the colormap based on photometric
ReadPalette(tif, photometric, bitspersample, dib);
// calculate the line + pitch (separate for scr & dest)
tsize_t src_line = TIFFScanlineSize(tif);
int dst_pitch = FreeImage_GetPitch(dib);
// In the tiff file the lines are save from up to down
// In a DIB the lines must be saved from down to up
BYTE *bits = FreeImage_GetScanLine(dib, height - 1);
// read the tiff lines and save them in the DIB
if(planar_config == PLANARCONFIG_CONTIG) {
BOOL bThrowMessage = FALSE;
BYTE *buf = (BYTE*)malloc(TIFFStripSize(tif) * sizeof(BYTE));
if(buf == NULL) throw FI_MSG_ERROR_MEMORY;
for (uint32 y = 0; y < height; y += rowsperstrip) {
int32 nrow = (y + rowsperstrip > height ? height - y : rowsperstrip);
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), buf, nrow * src_line) == -1) {
// ignore errors as they can be frequent and not really valid errors, especially with fax images
bThrowMessage = TRUE;
/*
free(buf);
throw "Parsing error";
*/
}
// color/greyscale picture (1-, 4-, 8-bit) or special type (int, long, double, ...)
// ... just copy
for (int l = 0; l < nrow; l++) {
memcpy(bits, buf + l * src_line, src_line);
bits -= dst_pitch;
}
}
free(buf);
if(bThrowMessage) {
FreeImage_OutputMessageProc(s_format_id, "Warning: parsing error. Image may be incomplete or contain invalid data !");
}
}
else if(planar_config == PLANARCONFIG_SEPARATE) {
BOOL bThrowMessage = FALSE;
uint16 sample;
BYTE *channel;
tsize_t stripsize = TIFFStripSize(tif) * sizeof(BYTE);
BYTE *buf = (BYTE*)malloc(samplesperpixel * stripsize);
if(buf == NULL) throw FI_MSG_ERROR_MEMORY;
int bytespersample = bitspersample / 8;
int bytesperpixel = bytespersample * samplesperpixel;
for (uint32 y = 0; y < height; y += rowsperstrip) {
int32 nrow = (y + rowsperstrip > height ? height - y : rowsperstrip);
// read all separated strips
channel = buf;
for(sample = 0; sample < samplesperpixel; sample++) {
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, y, sample), channel, nrow * src_line) == -1) {
// ignore errors as they can be frequent and not really valid errors, especially with fax images
bThrowMessage = TRUE;
/*
free(buf);
throw "Parsing error";
*/
}
channel += stripsize;
}
// reconstruct the picture
for (int l = 0; l < nrow; l++) {
channel = buf;
for(sample = 0; sample < samplesperpixel; sample++) {
BYTE *src_bits = channel + l * src_line;
BYTE *dst_bits = bits + sample * bytespersample;
for (uint32 x = 0; x < (uint32)(src_line / bytespersample); x++) {
memcpy(dst_bits, src_bits, bytespersample);
src_bits += bytespersample;
dst_bits += bytesperpixel;
}
channel += stripsize;
}
bits -= dst_pitch;
}
}
free(buf);
if(bThrowMessage) {
FreeImage_OutputMessageProc(s_format_id, "Warning: parsing error. Image may be incomplete or contain invalid data !");
}
}
} else if(loadMethod == LoadAsTiled) {
// ---------------------------------------------------------------------------------
// Tiled image loading
// ---------------------------------------------------------------------------------
uint32 tileWidth, tileHeight;
uint32 src_line = 0;
// create a new DIB
dib = CreateImageType(image_type, width, height, bitspersample, samplesperpixel);
if (dib == NULL) {
throw FI_MSG_ERROR_MEMORY;
}
// fill in the resolution (english or universal)
ReadResolution(tif, dib);
// set up the colormap based on photometric
ReadPalette(tif, photometric, bitspersample, dib);
// get the tile geometry
if(!TIFFGetField(tif, TIFFTAG_TILEWIDTH, &tileWidth) || !TIFFGetField(tif, TIFFTAG_TILELENGTH, &tileHeight)) {
throw "Invalid tiled TIFF image";
}
// get the maximum number of bytes required to contain a tile
tsize_t tileSize = TIFFTileSize(tif);
// allocate tile buffer
BYTE *tileBuffer = (BYTE*)malloc(tileSize * sizeof(BYTE));
if(tileBuffer == NULL) throw "Not enough space for tile buffer";
// calculate src line and dst pitch
int dst_pitch = FreeImage_GetPitch(dib);
int tileRowSize = TIFFTileRowSize(tif);
int imageRowSize = TIFFScanlineSize(tif);
// In the tiff file the lines are save from up to down
// In a DIB the lines must be saved from down to up
BYTE *bits = FreeImage_GetScanLine(dib, height - 1);
// read the tiff lines and save them in the DIB
if(planar_config == PLANARCONFIG_CONTIG) {
uint32 x, y, rowSize;
for (y = 0; y < height; y += tileHeight) {
int32 nrows = (y + tileHeight > height ? height - y : tileHeight);
for (x = 0, rowSize = 0; x < width; x += tileWidth, rowSize += tileRowSize) {
memset(tileBuffer, 0, tileSize);
// read one tile
if (TIFFReadTile(tif, tileBuffer, x, y, 0, 0) < 0) {
free(tileBuffer);
throw "Corrupted tiled TIFF file!";
}
// convert to strip
if(x + tileWidth > width) {
src_line = imageRowSize - rowSize;
} else {
src_line = tileRowSize;
}
BYTE *src_bits = tileBuffer;
BYTE *dst_bits = bits + rowSize;
for(int k = 0; k < nrows; k++) {
memcpy(dst_bits, src_bits, src_line);
src_bits += tileRowSize;
dst_bits -= dst_pitch;
}
}
bits -= nrows * dst_pitch;
}
}
else if(planar_config == PLANARCONFIG_SEPARATE) {
free(tileBuffer);
throw "Separated tiled TIFF images are not supported";
}
free(tileBuffer);
} else if(loadMethod == LoadAsRGBF) {
// ---------------------------------------------------------------------------------
// RGBF loading
// ---------------------------------------------------------------------------------
double stonits; // input conversion to nits
if (!TIFFGetField(tif, TIFFTAG_STONITS, &stonits)) {
stonits = 1;
}
// create a new DIB
dib = CreateImageType(image_type, width, height, bitspersample, samplesperpixel);
if (dib == NULL) {
throw FI_MSG_ERROR_MEMORY;
}
// fill in the resolution (english or universal)
ReadResolution(tif, dib);
// calculate the line + pitch (separate for scr & dest)
tsize_t src_line = TIFFScanlineSize(tif);
int dst_pitch = FreeImage_GetPitch(dib);
// In the tiff file the lines are save from up to down
// In a DIB the lines must be saved from down to up
BYTE *bits = FreeImage_GetScanLine(dib, height - 1);
// read the tiff lines and save them in the DIB
if(planar_config == PLANARCONFIG_CONTIG) {
BYTE *buf = (BYTE*)malloc(TIFFStripSize(tif) * sizeof(BYTE));
if(buf == NULL) throw FI_MSG_ERROR_MEMORY;
for (uint32 y = 0; y < height; y += rowsperstrip) {
int32 nrow = (y + rowsperstrip > height ? height - y : rowsperstrip);
if (TIFFReadEncodedStrip(tif, TIFFComputeStrip(tif, y, 0), buf, nrow * src_line) == -1) {
free(buf);
throw "Parsing error";
}
// convert from XYZ to RGB
for (int l = 0; l < nrow; l++) {
tiff_ConvertLineXYZToRGB(bits, buf + l * src_line, stonits, width);
bits -= dst_pitch;
}
}
free(buf);
}
else if(planar_config == PLANARCONFIG_SEPARATE) {
// this cannot happend according to the LogLuv specification
throw "Unable to handle PLANARCONFIG_SEPARATE LogLuv images";
}
} else {
// ---------------------------------------------------------------------------------
// Unknown or unsupported format
// ---------------------------------------------------------------------------------
throw "Unknown format";
}
// copy ICC profile data (must be done after FreeImage_Allocate)
FreeImage_CreateICCProfile(dib, iccBuf, iccSize);
if (photometric == PHOTOMETRIC_SEPARATED && ((flags & TIFF_CMYK) == TIFF_CMYK)) {
FreeImage_GetICCProfile(dib)->flags |= FIICC_COLOR_IS_CMYK;
}
// copy TIFF metadata (must be done after FreeImage_Allocate)
ReadMetadata(tif, dib);
return (FIBITMAP *)dib;
} catch (const char *message) {
if(dib) FreeImage_Unload(dib);
if(message) FreeImage_OutputMessageProc(s_format_id, message);
return NULL;
}
}
return NULL;
}
static BOOL DLL_CALLCONV
Save(FreeImageIO *io, FIBITMAP *dib, fi_handle handle, int page, int flags, void *data) {
if ((dib != NULL) && (handle != NULL) && (data != NULL)) {
fi_TIFFIO *fio = (fi_TIFFIO*)data;
TIFF *out = fio->tif;
int32 height;
int32 width;
uint32 rowsperstrip = (uint32) -1;
uint16 bitsperpixel;
uint16 bitspersample;
uint16 samplesperpixel;
uint16 photometric;
uint16 pitch;
int32 x, y;
FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(dib);
width = FreeImage_GetWidth(dib);
height = FreeImage_GetHeight(dib);
bitsperpixel = (uint16)FreeImage_GetBPP(dib);
FIICCPROFILE *iccProfile = FreeImage_GetICCProfile(dib);
if(image_type == FIT_BITMAP) {
// standard image: 1-, 4-, 8-, 16-, 24-, 32-bit
samplesperpixel = ((bitsperpixel == 24) ? 3 : ((bitsperpixel == 32) ? 4 : 1));
bitspersample = bitsperpixel / samplesperpixel;
photometric = GetPhotometric(dib);
if((bitsperpixel == 8) && FreeImage_IsTransparent(dib)) {
// 8-bit transparent picture : convert later to 8-bit + 8-bit alpha
samplesperpixel = 2;
bitspersample = 8;
}
else if(bitsperpixel == 32) {
// 32-bit images : check for CMYK or alpha transparency
if((((iccProfile->flags & FIICC_COLOR_IS_CMYK) == FIICC_COLOR_IS_CMYK) || ((flags & TIFF_CMYK) == TIFF_CMYK))) {
// CMYK support
photometric = PHOTOMETRIC_SEPARATED;
TIFFSetField(out, TIFFTAG_INKSET, INKSET_CMYK);
TIFFSetField(out, TIFFTAG_NUMBEROFINKS, 4);
}
else if(photometric == PHOTOMETRIC_RGB) {
// transparency mask support
uint16 sampleinfo[1];
// unassociated alpha data is transparency information
sampleinfo[0] = EXTRASAMPLE_UNASSALPHA;
TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, sampleinfo);
}
}
} else if(image_type == FIT_RGB16) {
// 48-bit RGB
samplesperpixel = 3;
bitspersample = bitsperpixel / samplesperpixel;
photometric = PHOTOMETRIC_RGB;
} else if(image_type == FIT_RGBA16) {
// 64-bit RGBA
samplesperpixel = 4;
bitspersample = bitsperpixel / samplesperpixel;
photometric = PHOTOMETRIC_RGB;
// transparency mask support
uint16 sampleinfo[1];
// unassociated alpha data is transparency information
sampleinfo[0] = EXTRASAMPLE_UNASSALPHA;
TIFFSetField(out, TIFFTAG_EXTRASAMPLES, 1, sampleinfo);
} else if(image_type == FIT_RGBF) {
// 96-bit RGBF => store with a LogLuv encoding
samplesperpixel = 3;
bitspersample = bitsperpixel / samplesperpixel;
photometric = PHOTOMETRIC_LOGLUV;
// the library converts to and from floating-point XYZ CIE values
TIFFSetField(out, TIFFTAG_SGILOGDATAFMT, SGILOGDATAFMT_FLOAT);
// TIFFSetField(out, TIFFTAG_STONITS, 1.0); // assume unknown
} else {
// special image type (int, long, double, ...)
samplesperpixel = 1;
bitspersample = bitsperpixel;
photometric = PHOTOMETRIC_MINISBLACK;
}
// set image data type
WriteImageType(out, image_type);
// write possible ICC profile
if (iccProfile->size && iccProfile->data) {
TIFFSetField(out, TIFFTAG_ICCPROFILE, iccProfile->size, iccProfile->data);
}
// handle standard width/height/bpp stuff
TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
TIFFSetField(out, TIFFTAG_IMAGELENGTH, height);
TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, samplesperpixel);
TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, bitspersample);
TIFFSetField(out, TIFFTAG_PHOTOMETRIC, photometric);
TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); // single image plane
TIFFSetField(out, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT);
TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, TIFFDefaultStripSize(out, rowsperstrip));
// handle metrics
WriteResolution(out, dib);
// multi-paging
if (page >= 0) {
char page_number[20];
sprintf(page_number, "Page %d", page);
TIFFSetField(out, TIFFTAG_SUBFILETYPE, FILETYPE_PAGE);
TIFFSetField(out, TIFFTAG_PAGENUMBER, page);
TIFFSetField(out, TIFFTAG_PAGENAME, page_number);
} else {
TIFFSetField(out, TIFFTAG_SUBFILETYPE, 0);
}
// palettes (image colormaps are automatically scaled to 16-bits)
if (photometric == PHOTOMETRIC_PALETTE) {
uint16 *r, *g, *b;
uint16 nColors = (uint16)FreeImage_GetColorsUsed(dib);
RGBQUAD *pal = FreeImage_GetPalette(dib);
r = (uint16 *) _TIFFmalloc(sizeof(uint16) * 3 * nColors);
if(r == NULL) throw FI_MSG_ERROR_MEMORY;
g = r + nColors;
b = g + nColors;
for (int i = nColors - 1; i >= 0; i--) {
r[i] = SCALE((uint16)pal[i].rgbRed);
g[i] = SCALE((uint16)pal[i].rgbGreen);
b[i] = SCALE((uint16)pal[i].rgbBlue);
}
TIFFSetField(out, TIFFTAG_COLORMAP, r, g, b);
_TIFFfree(r);
}
// compression
WriteCompression(out, bitspersample, samplesperpixel, photometric, flags);
// metadata
WriteMetadata(out, dib);
// read the DIB lines from bottom to top
// and save them in the TIF
// -------------------------------------
pitch = (uint16)FreeImage_GetPitch(dib);
if(image_type == FIT_BITMAP) {
// standard bitmap type
switch(bitsperpixel) {
case 1 :
case 4 :
case 8 :
{
if((bitsperpixel == 8) && FreeImage_IsTransparent(dib)) {
// 8-bit transparent picture : convert to 8-bit + 8-bit alpha
// get the transparency table
BYTE *trns = FreeImage_GetTransparencyTable(dib);
BYTE *buffer = (BYTE *)malloc(2 * width * sizeof(BYTE));
if(buffer == NULL) throw FI_MSG_ERROR_MEMORY;
for (y = height - 1; y >= 0; y--) {
BYTE *bits = FreeImage_GetScanLine(dib, y);
BYTE *p = bits, *b = buffer;
for(x = 0; x < width; x++) {
// copy the 8-bit layer
b[0] = *p;
// convert the trns table to a 8-bit alpha layer
b[1] = trns[ b[0] ];
p++;
b += samplesperpixel;
}
// write the scanline to disc
TIFFWriteScanline(out, buffer, height - y - 1, 0);
}
free(buffer);
}
else {
// other cases
BYTE *buffer = (BYTE *)malloc(pitch * sizeof(BYTE));
if(buffer == NULL) throw FI_MSG_ERROR_MEMORY;
for (y = 0; y < height; y++) {
// get a copy of the scanline
memcpy(buffer, FreeImage_GetScanLine(dib, height - y - 1), pitch);
// write the scanline to disc
TIFFWriteScanline(out, buffer, y, 0);
}
free(buffer);
}
break;
}
case 24:
case 32:
{
BYTE *buffer = (BYTE *)malloc(pitch * sizeof(BYTE));
if(buffer == NULL) throw FI_MSG_ERROR_MEMORY;
for (y = 0; y < height; y++) {
// get a copy of the scanline
memcpy(buffer, FreeImage_GetScanLine(dib, height - y - 1), pitch);
#if FREEIMAGE_COLORORDER == FREEIMAGE_COLORORDER_BGR
if (photometric != PHOTOMETRIC_SEPARATED) {
// TIFFs store color data RGB(A) instead of BGR(A)
BYTE *pBuf = buffer;
for (x = 0; x < width; x++) {
INPLACESWAP(pBuf[0], pBuf[2]);
pBuf += samplesperpixel;
}
}
#endif
// write the scanline to disc
TIFFWriteScanline(out, buffer, y, 0);
}
free(buffer);
break;
}
}
} else if(image_type == FIT_RGBF) {
// RGBF image => store as XYZ using a LogLuv encoding
BYTE *buffer = (BYTE *)malloc(pitch * sizeof(BYTE));
if(buffer == NULL) throw FI_MSG_ERROR_MEMORY;
for (y = 0; y < height; y++) {
// get a copy of the scanline and convert from RGB to XYZ
tiff_ConvertLineRGBToXYZ(buffer, FreeImage_GetScanLine(dib, height - y - 1), width);
// write the scanline to disc
TIFFWriteScanline(out, buffer, y, 0);
}
free(buffer);
} else {
// special bitmap type (int, long, double, etc.)
switch(bitsperpixel) {
case 16:
case 32:
case 48:
case 64:
case 128:
{
BYTE *buffer = (BYTE *)malloc(pitch * sizeof(BYTE));
if(buffer == NULL) throw FI_MSG_ERROR_MEMORY;
for (y = 0; y < height; y++) {
// get a copy of the scanline
memcpy(buffer, FreeImage_GetScanLine(dib, height - y - 1), pitch);
// write the scanline to disc
TIFFWriteScanline(out, buffer, y, 0);
}
free(buffer);
}
break;
}
}
// write out the directory tag if we wrote a page other than -1
if (page >= 0)
TIFFWriteDirectory(out);
return TRUE;
}
return FALSE;
}
// ==========================================================
// Init
// ==========================================================
void DLL_CALLCONV
InitTIFF(Plugin *plugin, int format_id) {
s_format_id = format_id;
plugin->format_proc = Format;
plugin->description_proc = Description;
plugin->extension_proc = Extension;
plugin->regexpr_proc = RegExpr;
plugin->open_proc = Open;
plugin->close_proc = Close;
plugin->pagecount_proc = PageCount;
plugin->pagecapability_proc = NULL;
plugin->load_proc = Load;
plugin->save_proc = Save;
plugin->validate_proc = Validate;
plugin->mime_proc = MimeType;
plugin->supports_export_bpp_proc = SupportsExportDepth;
plugin->supports_export_type_proc = SupportsExportType;
plugin->supports_icc_profiles_proc = SupportsICCProfiles;
}
| [
"youalexandrov@icloud.com"
] | youalexandrov@icloud.com |
b8a3b67448372e06fdf51018417e24c2f4790d2c | 14582f8c74c28d346399f877b9957d0332ba1c3c | /tags/pstade_2007/pstade/junk/adaptable.hpp | d929c2822e8751ece65be75ef8525877f77a854e | [
"BSL-1.0"
] | permissive | svn2github/p-stade | c7b421be9eeb8327ddd04d3cb36822ba1331a43e | 909b46567aa203d960fe76055adafc3fdc48e8a5 | refs/heads/master | 2016-09-05T22:14:09.460711 | 2014-08-22T08:16:11 | 2014-08-22T08:16:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,230 | hpp | #ifndef PSTADE_ADAPTABLE_HPP
#define PSTADE_ADAPTABLE_HPP
#include "./detail/prefix.hpp"
// PStade.Wine
//
// Copyright Shunsuke Sogame 2005-2007.
// 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)
// What:
//
// Converts a FunctionObject supporting 'result_of' into an Adaptable one.
#include <functional>
#include <boost/utility/result_of.hpp>
#include <pstade/callable.hpp>
#include <pstade/deferred.hpp>
#include <pstade/pass_by.hpp>
#include <pstade/specified.hpp>
namespace pstade {
namespace adaptable_detail {
template<class Callable, class A0>
struct return_fun1 :
std::unary_function<
A0,
typename boost::result_of<PSTADE_DEFERRED(Callable const)(A0&)>::type
>
{
typename boost::result_of<PSTADE_DEFERRED(Callable const)(A0&)>::type
operator()(A0& a0) const
{
return m_fun(a0);
}
explicit return_fun1(Callable fun) :
m_fun(fun)
{ }
private:
Callable m_fun;
};
template<class Callable, class A0, class A1>
struct return_fun2 :
std::binary_function<
A0, A1,
typename boost::result_of<PSTADE_DEFERRED(Callable const)(A0&, A1&)>::type
>
{
typename boost::result_of<PSTADE_DEFERRED(Callable const)(A0&, A1&)>::type
operator()(A0& a0, A1& a1) const
{
return m_fun(a0, a1);
}
explicit return_fun2(Callable fun) :
m_fun(fun)
{ }
private:
Callable m_fun;
};
} // namespace adaptable_detail
template<class A0>
struct op_adaptable_unary :
callable< op_adaptable_unary<A0> >
{
template<class Myself, class Callable>
struct apply
{
typedef
adaptable_detail::return_fun1<
typename pass_by_value<Callable>::type,
A0
>
type;
};
template<class Result, class Callable>
Result call(Callable& fun) const
{
return Result(fun);
}
};
PSTADE_SPECIFIED1(adaptable_unary, op_adaptable_unary, 1)
template<class A0, class A1>
struct op_adaptable_binary :
callable< op_adaptable_binary<A0, A1> >
{
template<class Myself, class Callable>
struct apply
{
typedef
adaptable_detail::return_fun2<
typename pass_by_value<Callable>::type,
A0, A1
>
type;
};
template<class Result, class Callable>
Result call(Callable& fun) const
{
return Result(fun);
}
};
PSTADE_SPECIFIED1(adaptable_binary, op_adaptable_binary, 2)
} // namespace pstade
#endif
| [
"mb2sync@350e9bb6-6311-0410-90c3-be67731b76ec"
] | mb2sync@350e9bb6-6311-0410-90c3-be67731b76ec |
e16a40c6d51d657adc19e3080271c4cf4a9d0ff5 | 9a310f9857356af442b38ce15d11ac1c58bef3cb | /include/CkRss.h | 01a77eec079645931c45a7e9a4e2a23d0f039412 | [] | no_license | namtuanbk/cat_ke_team | efe4017eae529f63f241cb87646097c75e7405b0 | 059a4541bc6b14d093d582a58366b7742d92e059 | refs/heads/master | 2020-03-22T13:07:51.578531 | 2018-07-22T09:06:55 | 2018-07-22T09:06:55 | 140,085,441 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 7,298 | h | // CkRss.h: interface for the CkRss class.
//
//////////////////////////////////////////////////////////////////////
// This header is generated for Chilkat 9.5.0.73
#ifndef _CkRss_H
#define _CkRss_H
#include "chilkatDefs.h"
#include "CkString.h"
#include "CkClassWithCallbacks.h"
class CkTask;
class CkBaseProgress;
#if !defined(__sun__) && !defined(__sun)
#pragma pack (push, 8)
#endif
// CLASS: CkRss
class CK_VISIBLE_PUBLIC CkRss : public CkClassWithCallbacks
{
private:
// Don't allow assignment or copying these objects.
CkRss(const CkRss &);
CkRss &operator=(const CkRss &);
public:
CkRss(void);
virtual ~CkRss(void);
static CkRss *createNew(void);
void CK_VISIBLE_PRIVATE inject(void *impl);
// May be called when finished with the object to free/dispose of any
// internal resources held by the object.
void dispose(void);
CkBaseProgress *get_EventCallbackObject(void) const;
void put_EventCallbackObject(CkBaseProgress *progress);
// BEGIN PUBLIC INTERFACE
// ----------------------
// Properties
// ----------------------
// The number of channels in the RSS document.
int get_NumChannels(void);
// The number of items in the channel.
int get_NumItems(void);
// ----------------------
// Methods
// ----------------------
// Adds a new channel to the RSS document. Returns the Rss object representing the
// Channel which can then be edited.
// The caller is responsible for deleting the object returned by this method.
CkRss *AddNewChannel(void);
// Adds a new image to the RSS document. Returns the Rss object representing the
// image, which can then be edited.
// The caller is responsible for deleting the object returned by this method.
CkRss *AddNewImage(void);
// Adds a new Item to an Rss channel. Returns the Rss object representing the item
// which can then be edited.
// The caller is responsible for deleting the object returned by this method.
CkRss *AddNewItem(void);
// Downloads an RSS document from the Internet and populates the Rss object with
// the contents.
bool DownloadRss(const char *url);
// Downloads an RSS document from the Internet and populates the Rss object with
// the contents.
CkTask *DownloadRssAsync(const char *url);
// Returns the value of a sub-element attribute. For example, to get the value of
// the "isPermaLink" attribute of the "guid" sub-element, call
// item.GetAttr("guid","isPermaLink").
bool GetAttr(const char *tag, const char *attrName, CkString &outStr);
// Returns the value of a sub-element attribute. For example, to get the value of
// the "isPermaLink" attribute of the "guid" sub-element, call
// item.GetAttr("guid","isPermaLink").
const char *getAttr(const char *tag, const char *attrName);
// Returns the value of a sub-element attribute. For example, to get the value of
// the "isPermaLink" attribute of the "guid" sub-element, call
// item.GetAttr("guid","isPermaLink").
const char *attr(const char *tag, const char *attrName);
// Returns the Nth channel of an RSS document. Usually there is only 1 channel per
// document, so the index argument should be set to 0.
// The caller is responsible for deleting the object returned by this method.
CkRss *GetChannel(int index);
// Return the number of sub-elements with a specific tag.
int GetCount(const char *tag);
// Return the value of a sub-element in date/time format.
bool GetDate(const char *tag, SYSTEMTIME &outSysTime);
// The same as GetDate, except the date/time is returned in RFC822 string format.
bool GetDateStr(const char *tag, CkString &outStr);
// The same as GetDate, except the date/time is returned in RFC822 string format.
const char *getDateStr(const char *tag);
// The same as GetDate, except the date/time is returned in RFC822 string format.
const char *dateStr(const char *tag);
// Return the image associated with the channel.
// The caller is responsible for deleting the object returned by this method.
CkRss *GetImage(void);
// Return the value of a numeric sub-element as an integer.
int GetInt(const char *tag);
// Return the Nth item of a channel as an RSS object.
// The caller is responsible for deleting the object returned by this method.
CkRss *GetItem(int index);
// Return the value of an sub-element as a string.
bool GetString(const char *tag, CkString &outStr);
// Return the value of an sub-element as a string.
const char *getString(const char *tag);
// Return the value of an sub-element as a string.
const char *string(const char *tag);
// Load an RSS document from a file.
bool LoadRssFile(const char *filePath);
// Loads an RSS feed document from an in-memory string.
bool LoadRssString(const char *rssString);
// Get an attribute value for the Nth sub-element having a specific tag. As an
// example, an RSS item may have several "category" sub-elements. To get the value
// of the "domain" attribute for the 3rd category, call
// MGetAttr("category",2,"domain").
bool MGetAttr(const char *tag, int index, const char *attrName, CkString &outStr);
// Get an attribute value for the Nth sub-element having a specific tag. As an
// example, an RSS item may have several "category" sub-elements. To get the value
// of the "domain" attribute for the 3rd category, call
// MGetAttr("category",2,"domain").
const char *mGetAttr(const char *tag, int index, const char *attrName);
// Get the value of the Nth occurrence of a sub-element. Indexing begins at 0.
bool MGetString(const char *tag, int index, CkString &outStr);
// Get the value of the Nth occurrence of a sub-element. Indexing begins at 0.
const char *mGetString(const char *tag, int index);
// Set an attribute on the Nth occurrence of a sub-element.
bool MSetAttr(const char *tag, int idx, const char *attrName, const char *value);
// Set the value of the Nth occurrence of a sub-element. Indexing begins at 0.
bool MSetString(const char *tag, int idx, const char *value);
// Clears the RSS document.
void NewRss(void);
// Removes a sub-element from the RSS document.
void Remove(const char *tag);
// Sets the value of a sub-element attribute.
void SetAttr(const char *tag, const char *attrName, const char *value);
// Sets the value of a date/time sub-element.
void SetDate(const char *tag, SYSTEMTIME &dateTime);
// Sets the value of a date/time sub-element to the current system date/time.
void SetDateNow(const char *tag);
// The same as SetDate, except the date/time is passed as an RFC822 string.
void SetDateStr(const char *tag, const char *dateTimeStr);
// Sets the value of an integer sub-element.
void SetInt(const char *tag, int value);
// Sets the value of a sub-element.
void SetString(const char *tag, const char *value);
// Returns the RSS document as an XML string.
bool ToXmlString(CkString &outStr);
// Returns the RSS document as an XML string.
const char *toXmlString(void);
// END PUBLIC INTERFACE
};
#if !defined(__sun__) && !defined(__sun)
#pragma pack (pop)
#endif
#endif
| [
"namtuanbk@gmail.com"
] | namtuanbk@gmail.com |
ba9a1073cc1f8e98535663a00292fffc8ed24e62 | c16cf927bbcefa96ec51a2e5acb809f6a4cc49f5 | /codeforces/ozon2020/B/B.cpp | 6c65de99eb1b86ed81ba70770fbdaf59af37070c | [] | no_license | Danis98/CompetitiveProgramming | 4a033094b24fc3a73655fc6d2e83a078b139a66d | 9aaeee762cf90348bb0c04952f1668464d7c1551 | refs/heads/master | 2023-05-30T21:08:45.462364 | 2021-06-21T11:15:29 | 2021-06-21T11:15:29 | 266,433,601 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,546 | cpp | #include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> ii;
typedef std::pair<int, ii> iii;
typedef std::pair<ull, ull> ull2;
typedef std::pair<ll, ll> ll2;
typedef std::pair<double, double> dd;
int main(){
#ifdef LOCAL
freopen("input.txt", "r", stdin);
#endif
std::string S;
std::cin>>S;
int N = S.length();
std::vector<int> pre_open(N), post_close(N);
for(int i=0;i<N;i++){
if(i > 0)
pre_open[i] = pre_open[i-1];
if(S[i] == '(')
pre_open[i]++;
}
for(int i=N-1;i>=0;i--){
if(i < N-1)
post_close[i] = post_close[i+1];
if(S[i] == ')')
post_close[i]++;
}
int m_idx = -1, m_val = 0;
for(int i=0;i<N;i++){
int v = std::min(pre_open[i], post_close[i]);
if(m_val < v){
m_idx = i;
m_val = v;
}
}
if(m_idx == -1){
std::cout<<"0\n";
}
else{
std::cout<<"1\n"<<(2*m_val)<<"\n";
int ctr = 0;
for(int i=0;i<=m_idx;i++)
if(S[i] == '('){
std::cout<<i+1<<" ";
ctr++;
if(ctr >= m_val) break;
}
ctr = 0;
std::vector<int> p;
for(int i=N-1;i>=m_idx;i--)
if(S[i] == ')'){
p.push_back(i+1);
ctr++;
if(ctr >= m_val) break;
}
for(int i=p.size()-1;i>=0;i--) std::cout<<p[i]<<" ";
std::cout<<"\n";
}
}
| [
"danielevenier1998@gmail.com"
] | danielevenier1998@gmail.com |
13444884b79600096f2985c13f106941e7eac779 | 858a0c5b6529dcd9615caffa3b3ca5d0de6f1d8f | /HUD.cpp | d77a96f9a559b0e7d591adc1b7eefbe1c24cc75b | [] | no_license | awestover/theknightdawns | 48582ca724268e4ad5d43c8ada5ae77fe2c0bf1c | 58bc3f97da21f7fa4a48f4bbfc9014cd4607351e | refs/heads/master | 2020-06-08T14:37:40.021648 | 2019-07-01T00:12:19 | 2019-07-01T00:12:19 | 193,244,193 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,607 | cpp |
#include <iostream>
#include "HUD.hpp"
#include "constants.hpp"
#include "utilityFunctions.hpp"
HUD::HUD(std::string username, std::string quest) {
view.setSize(HUD_DIMENSIONS);
view.setCenter(HUD_DIMENSIONS*0.5f);
if(!font.loadFromFile("data/arial.ttf"))
std::cout<<"ERROR loading arial font"<<std::endl;
bg[0] = sf::Vertex(sf::Vector2f(0, 0), sf::Color(57,74,102,150));
bg[1] = sf::Vertex(sf::Vector2f(0, HUD_DIMENSIONS.y), sf::Color(73,104,155,150));
bg[2] = sf::Vertex(sf::Vector2f(HUD_DIMENSIONS.x, HUD_DIMENSIONS.y), sf::Color(54,107,193,150));
bg[3] = sf::Vertex(sf::Vector2f(HUD_DIMENSIONS.x, 0), sf::Color(17,95,221,150));
texts["roomText"] = new sf::Text;
texts["questText"] = new sf::Text;
texts["usernameText"] = new sf::Text;
initializeText(texts["roomText"], TEXT_PADDING, TEXT_PADDING, "Room: null");
initializeText(texts["questText"], HUD_DIMENSIONS.x/2-TEXT_PADDING*6, TEXT_PADDING, "Quest: "+quest);
initializeText(texts["usernameText"], 0, 0, "Username: "+username); // fake positions
texts["usernameText"]->setPosition(HUD_DIMENSIONS.x - texts["usernameText"]->getLocalBounds().width-TEXT_PADDING*4, TEXT_PADDING);
}
void HUD::setRoom(std::string room){
std::string tmpA("Room: ");
std::string tmp = tmpA+room;
texts["roomText"]->setString(tmp);
}
void HUD::draw(sf::RenderWindow *window){
window->setView(view);
window->draw(bg, 4, sf::Quads);
for(std::map<std::string, sf::Text*>::iterator it = texts.begin(); it != texts.end(); it++){
window->draw(*(it->second));
}
}
void HUD::setQuest(std::string title){
texts["questText"]->setString(title);
}
| [
"alek.westover@gmail.com"
] | alek.westover@gmail.com |
8326480e54035a506362cc7c42d19679cf021bab | af539815e496171f9c2b49f12d484906e050ab21 | /Source/Engine/Model/Material.h | fa5a8ccc7c416699c898b5440bcaf5a10fb22dc5 | [] | no_license | evopen/SillyCatEngine | 1fbf526987cdf45cce0a9b7839f8dee68e1031c2 | 94405e62e510350889115e20b79a6df6ee21d37c | refs/heads/master | 2022-12-26T10:29:57.061093 | 2020-10-06T02:14:28 | 2020-10-06T02:14:28 | 293,312,172 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 360 | h | #pragma once
#include "Engine/pch.h"
#include "Engine/Platform/Platform.h"
namespace Sce
{
class Texture;
class Material
{
public:
API Material(aiMaterial* inMaterial, aiTexture** inTextures);
std::shared_ptr<Texture> GetDiffuseTexture() { return Diffuse; }
private:
std::shared_ptr<Texture> Diffuse;
};
}
| [
"520dhh@gmail.com"
] | 520dhh@gmail.com |
74316ae8d2e0ad46e213f7c3879c05a0f78a7932 | 5902fa0857cd4f722a9663bbd61aa0895b9f8dea | /BMIG-5101-SequencesAsBioInformation/Blast/ncbi-blast-2.10.0+-src/c++/src/corelib/stream_utils.cpp | 2598af74956bae91de11a79132912486fd07a245 | [] | no_license | thegrapesofwrath/spring-2020 | 1b38d45fa44fcdc78dcecfb3b221107b97ceff9c | f90fcde64d83c04e55f9b421d20f274427cbe1c8 | refs/heads/main | 2023-01-23T13:35:05.394076 | 2020-12-08T21:40:42 | 2020-12-08T21:40:42 | 319,763,280 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 130 | cpp | version https://git-lfs.github.com/spec/v1
oid sha256:e63e32f5fbaf80693861d7539464d9d21049594d068b75cf4ae29b1fdeb5f4a6
size 23233
| [
"shawn-hartley@sbcglobal.net"
] | shawn-hartley@sbcglobal.net |
2430fbeba5eff45c5346b77c247081faefbe5578 | 89d00799bc2e49ee8a9861029a41443ae86c7975 | /src/roughtime_private.hpp | 5c7388e4668eb661be052c502f488d638200a957 | [
"MIT"
] | permissive | cfogelklou/roughtime_cpp_client | 15b0b6bdf5db5698737e7247fa1c66dcf467939e | ca71099968a9f830b5ab1d9c2ac4a145d925595d | refs/heads/devel | 2023-08-31T00:47:35.366534 | 2023-08-17T12:05:59 | 2023-08-17T12:05:59 | 172,003,660 | 0 | 0 | MIT | 2023-08-17T12:06:01 | 2019-02-22T06:02:36 | C++ | UTF-8 | C++ | false | false | 580 | hpp | #ifndef ROUGHTIME_PRIVATE_HPP
#define ROUGHTIME_PRIVATE_HPP
#ifdef __cplusplus
#include "endian_convert.h"
#include <assert.h>
#include <cstdio>
#include <string>
typedef std::basic_string<uint8_t, std::char_traits<uint8_t>, std::allocator<uint8_t> > sstring;
#define u_str() data()
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#define LOG_WARNING(x) printf x
#define LOG_ASSERT assert
#define LOG_ASSERT_WARN(x) if (!(x)) do { printf("Warning at %s (%d)\r\n", __FILE__, __LINE__);} while(0)
#define ARRSZ(arr) (sizeof((arr))/sizeof((arr)[0]))
#endif
#endif
| [
"chris.fogelklou@polestar.com"
] | chris.fogelklou@polestar.com |
62ab518b08ddca6fdb77470d0c352d3e2c26f25e | c3e8d3b8ee3dc01998375386fca43ca0293e5416 | /traceur-core/include/traceur/core/scene/primitive/box.hpp | 4ba4101a5bbb18c7916f7ba0dabc0272663d911e | [
"MIT"
] | permissive | fabianishere/traceur | 38d28828ba49d40b681ed8864cd89e0970a84911 | 93eefd77fc402dbd340dac7760a27b491c44a30f | refs/heads/master | 2021-09-10T15:22:53.940261 | 2018-01-08T15:00:23 | 2018-01-09T11:36:38 | 93,953,662 | 2 | 0 | MIT | 2018-03-28T12:32:45 | 2017-06-10T17:02:45 | C++ | UTF-8 | C++ | false | false | 5,194 | hpp | /*
* The MIT License (MIT)
*
* Copyright (c) 2017 Traceur authors
*
* 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.
*/
#ifndef TRACEUR_CORE_SCENE_PRIMITIVE_BOX_H
#define TRACEUR_CORE_SCENE_PRIMITIVE_BOX_H
#include <limits>
#include <traceur/core/scene/primitive/primitive.hpp>
namespace traceur {
/**
* A primitive that represents a box.
*/
class Box : public Primitive {
public:
/**
* An axis of the box.
*/
enum class Axis: int {
X = 0, Y = 1, Z = 2
};
/**
* The minimum vertex in the box.
*/
glm::vec3 min;
/**
* The maximum vertex in the box.
*/
glm::vec3 max;
/**
* Construct a {@link Box} instance.
*
* @param[in] material The material of the primitive.
*/
Box(const std::shared_ptr<traceur::Material> material) :
Primitive(glm::vec3(), material), min(glm::vec3()), max(glm::vec3()) {}
/**
* Construct a {@link Box} instance.
*
* @param[in] min The minimum vertex in the box.
* @param[in] max The maximum vertex in the box.
* @param[in] material The material of the primitive.
*/
Box(const glm::vec3 &min, const glm::vec3 max,
const std::shared_ptr<traceur::Material> material) :
Primitive((min + max) / 2.f, material), min(min), max(max) {}
/**
* Construct a {@link Box} as bounding box.
*
* @return The bounding box instance.
*/
static Box createBoundingBox()
{
auto min = glm::vec3(std::numeric_limits<float>::infinity());
auto max = -min;
return createBoundingBox(min, max);
}
/**
* Construct a {@link Box} as bounding box.
*
* @param[in] min The minimum vertex in the box.
* @param[in] max The maximum vertex in the box.
* @return The bounding box instance.
*/
static Box createBoundingBox(const glm::vec3 &min, const glm::vec3 &max)
{
return Box(min, max, std::make_shared<traceur::Material>());
}
/**
* Determine whether the given ray intersects the shape.
*
* @param[in] ray The ray to intersect with this shape.
* @param[in] hit The intersection structure to which the details will
* be written to.
* @return <code>true</code> if the shape intersects the ray, otherwise
* <code>false</code>.
*/
inline virtual bool intersect(const traceur::Ray &ray, traceur::Hit &hit) const final
{
/* TODO precalculate inverse */
glm::vec3 inverse = 1.0f / ray.direction;
auto u = (min - ray.origin) * inverse;
auto v = (max - ray.origin) * inverse;
float tmin = std::fmax(std::fmax(std::fmin(u[0], v[0]), std::fmin(u[1], v[1])), std::fmin(u[2], v[2]));
float tmax = std::fmin(std::fmin(std::fmax(u[0], v[0]), std::fmax(u[1], v[1])), std::fmax(u[2], v[2]));
if (tmax < 0)
return false;
if (tmin > tmax)
return false;
hit.primitive = this;
hit.distance = tmin;
hit.position = ray.origin + tmin * ray.direction;
return true;
}
/**
* Expand this {@link Box} with another box.
*
* @param[in] other The other box to expand with.
* @return The next expanded box with the material properties of this
* instance.
*/
traceur::Box expand(const traceur::Box &other) const
{
return traceur::Box(glm::min(min, other.min), glm::max(max, other.max), material);
}
/**
* Accept a {@link SceneGraphVisitor} instance to visit this node in
* the graph of the scene.
*
* @param[in] visitor The visitor to accept.
*/
inline virtual void accept(traceur::SceneGraphVisitor &visitor) const final
{
visitor.visit(*this);
}
/**
* Return the bounding {@link Box} which encapsulates the whole
* primitive.
*
* @return The bounding {@link Box} instance.
*/
virtual const traceur::Box & bounding_box() const final
{
return *this;
}
/**
* Return the longest axis of this box.
*
* @return The longest axis of the box.
*/
traceur::Box::Axis longestAxis() const {
auto length = max - min;
if (length.x > length.y && length.x > length.z)
return traceur::Box::Axis::X;
if (length.y > length.x && length.y > length.z)
return traceur::Box::Axis::Y;
return traceur::Box::Axis::Z;
}
};
}
#endif /* TRACEUR_CORE_SCENE_PRIMITIVE_PRIMITIVE_H */
| [
"mail.fabianm@gmail.com"
] | mail.fabianm@gmail.com |
fa6673b569ed4a2fc7fd221a17758cc06501b8ea | 32724bd03797947b015a26127734095d23be5726 | /src/tests/test_entropy.cpp | f2475e47e43582c54dc9e1b46cefbf203a38d9ee | [
"BSD-2-Clause"
] | permissive | andreaceccanti/botan | 123ad9ece48fac36d2c3ae3d1b3bf3be61731d9c | 9b54e39d96b3d586cb3a790ddc9a9610b25a07bf | refs/heads/master | 2021-01-15T10:07:21.675787 | 2015-11-26T22:28:13 | 2015-11-26T22:28:13 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,208 | cpp | /*
* (C) 2015 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#include "tests.h"
#include <botan/entropy_src.h>
#if defined(BOTAN_HAS_COMPRESSION)
#include <botan/compression.h>
#endif
namespace Botan_Tests {
namespace {
class Entropy_Source_Tests : public Test
{
public:
std::vector<Test::Result> run() override
{
static const size_t MAX_ENTROPY = 512;
static const size_t MAX_SAMPLES = 256;
static const size_t MAX_ENTROPY_BYTES = 256*1024;
Botan::Entropy_Sources& srcs = Botan::Entropy_Sources::global_sources();
std::vector<std::string> src_names = srcs.enabled_sources();
std::vector<Test::Result> results;
for(auto&& src_name : src_names)
{
Test::Result result("Entropy source " + src_name);
result.start_timer();
std::vector<uint8_t> entropy;
size_t samples = 0;
size_t entropy_estimate = 0;
// TODO: add a timeout
Botan::Entropy_Accumulator accum([&](const uint8_t buf[], size_t buf_len, size_t buf_entropy) -> bool
{
entropy.insert(entropy.end(), buf, buf + buf_len);
entropy_estimate += buf_entropy;
++samples;
result.test_note("sample " + std::to_string(samples) + " " +
Botan::hex_encode(buf, buf_len) + " " + std::to_string(buf_entropy));
result.test_gte("impossible entropy", buf_len * 8, buf_entropy);
return (entropy_estimate > MAX_ENTROPY ||
samples > MAX_SAMPLES ||
entropy.size() > MAX_ENTROPY_BYTES);
});
result.confirm("polled source", srcs.poll_just(accum, src_name));
result.test_note("saw " + std::to_string(samples) +
" samples with total estimated entropy " +
std::to_string(entropy_estimate));
//result.test_gte("impossible entropy", entropy.size() * 8, entropy_estimate);
if(!entropy.empty())
{
#if defined(BOTAN_HAS_COMPRESSION)
for(auto comp_algo : { "zlib", "bzip2", "lzma" })
{
std::unique_ptr<Botan::Compressor_Transform> comp(Botan::make_compressor(comp_algo, 9));
if(comp)
{
Botan::secure_vector<byte> compressed;
compressed.assign(entropy.begin(), entropy.end());
comp->start();
comp->finish(compressed);
result.test_gte("compressed entropy better than advertised",
compressed.size() * 8, entropy_estimate);
// TODO: perform 2nd poll and check compression differential
}
}
#endif
}
result.end_timer();
results.push_back(result);
}
return results;
}
};
BOTAN_REGISTER_TEST("entropy", Entropy_Source_Tests);
}
}
| [
"lloyd@randombit.net"
] | lloyd@randombit.net |
e511c99bb4f569c2c69b7d28466f664987d51cde | 6e8d1bc47b1d293d2cb0ffe917b2e4afdb676c50 | /TestCode/FruitMatch/Classes/Map/MapDataManager.cpp | a2324a2dc4f37834d37408f1736be391fa375449 | [] | no_license | wlgys8/TestCode | 03b4184c9327230e5da903a5b6c3bef77f8920e0 | 5ce57346bd40fcd41ad6b020709a75994bc8b67a | refs/heads/master | 2021-01-01T19:07:42.928205 | 2013-04-13T15:40:31 | 2013-04-13T15:40:31 | 8,627,580 | 1 | 0 | null | 2013-04-12T13:30:40 | 2013-03-07T13:12:55 | C | UTF-8 | C++ | false | false | 1,176 | cpp | #include "Map/MapDataManager.h"
const int MAP_COUNT=16;
static std::string mapNames[MAP_COUNT]={
"level_0.txt",
"level_1.txt",
"level_2.txt",
"level_3.txt",
"level_4.txt",
"level_5.txt",
"level_6.txt",
"level_7.txt",
"level_8.txt",
"level_9.txt",
"level_10.txt",
"level_11.txt",
"level_12.txt",
"level_13.txt",
"level_14.txt",
"level_15.txt",
};
MapDataManager::MapDataManager(){
}
void MapDataManager::loadAllMapData(){
for(int i=0;i<MAP_COUNT;i++){
MapData* data=MapData::readFrom("levels/"+mapNames[i]);
if(data){
_dataMap[mapNames[i]]=data;
data->retain();
DebugLog("load %s success",mapNames[i].c_str());
}else{
DebugLog("load mapData %s failed.",mapNames[i].c_str());
}
}
}
MapData* MapDataManager::find(const std::string& name){
DebugLog("find map data:%s",name.c_str());
DataMap::iterator it=_dataMap.find(name);
if(it!=_dataMap.end()){
return it->second;
}
return 0;
}
MapDataManager::~MapDataManager(){
DataMap::iterator it;
for(it=_dataMap.begin();it!=_dataMap.end();it++){
it->second->release();
}
_dataMap.clear();
}
MapDataManager* MapDataManager::instance(){
static MapDataManager ret;
return &ret;
} | [
"wlgys8@gmail.com"
] | wlgys8@gmail.com |
9bf9412c55b8ae556e53e4c050df8853adb69ef6 | 491ef641cc5a2dc48fbbb85a58de01c9f5caeb42 | /megamodule/source/main.cpp | 1e5102f43d159b7f3621e4e745e5a823f3b02dd2 | [] | no_license | Fynn93/riivolution | 423cfb60165a443ce69670700c22374b68eb70ba | de533a25073a6e592f147230d2de9e3870e65495 | refs/heads/master | 2023-04-16T21:42:59.508301 | 2021-04-29T19:27:01 | 2021-04-29T19:27:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 240 | cpp | #include "debugger.h"
#include "gctypes.h"
#include "mem.h"
static u8 Heapspace[0x28000];
int main()
{
InitializeHeap(Heapspace, sizeof(Heapspace), 8);
ProxiIOS::Debugger::Debugger debugger;
return debugger.Loop();
}
| [
"zurgeg@gmail.com"
] | zurgeg@gmail.com |
042ff3f0bb2d812c3f2193db717467928d4ee633 | e229f6ba418b7223a9174309aa40da7276575ba3 | /build-SAPR-mingw-Release/release/moc_mainwindow.cpp | 79bf804c83a970c687ab508b050a541f7ab288a8 | [] | no_license | DenisMyasnikov/SAPR | 3a8ec7bbc8d1860d5079ef0aa67c1b80186d8bb3 | 7118e28d88fda7cc911d32d048e0b665f3687e6d | refs/heads/master | 2023-02-07T18:51:55.570243 | 2020-12-29T11:46:13 | 2020-12-29T11:46:13 | 303,171,643 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,151 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'mainwindow.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.12.9)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../SAPR/mainwindow.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'mainwindow.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.12.9. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
QT_WARNING_PUSH
QT_WARNING_DISABLE_DEPRECATED
struct qt_meta_stringdata_MainWindow_t {
QByteArrayData data[27];
char stringdata0[730];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
{
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
QT_MOC_LITERAL(1, 11, 32), // "on_btnAcceptNumberOfRods_clicked"
QT_MOC_LITERAL(2, 44, 0), // ""
QT_MOC_LITERAL(3, 45, 32), // "on_btnChangeNumberOfRods_clicked"
QT_MOC_LITERAL(4, 78, 28), // "on_leLenngth_editingFinished"
QT_MOC_LITERAL(5, 107, 27), // "on_sbPropOfRod_valueChanged"
QT_MOC_LITERAL(6, 135, 4), // "arg1"
QT_MOC_LITERAL(7, 140, 25), // "on_leArea_editingFinished"
QT_MOC_LITERAL(8, 166, 28), // "on_leModuleE_editingFinished"
QT_MOC_LITERAL(9, 195, 32), // "on_leModuleSigma_editingFinished"
QT_MOC_LITERAL(10, 228, 35), // "on_cbUnitLength_currentIndexC..."
QT_MOC_LITERAL(11, 264, 5), // "index"
QT_MOC_LITERAL(12, 270, 33), // "on_cbUnitArea_currentIndexCha..."
QT_MOC_LITERAL(13, 304, 32), // "on_cbModuleE_currentIndexChanged"
QT_MOC_LITERAL(14, 337, 36), // "on_cbModuleSigma_currentIndex..."
QT_MOC_LITERAL(15, 374, 30), // "on_btnAcceptPropOfRods_clicked"
QT_MOC_LITERAL(16, 405, 24), // "on_cbSetLeftProp_clicked"
QT_MOC_LITERAL(17, 430, 25), // "on_cbSetRightProp_clicked"
QT_MOC_LITERAL(18, 456, 31), // "on_leLoadOnNode_editingFinished"
QT_MOC_LITERAL(19, 488, 30), // "on_leLoadOnRod_editingFinished"
QT_MOC_LITERAL(20, 519, 28), // "on_sbLoadOnNode_valueChanged"
QT_MOC_LITERAL(21, 548, 27), // "on_sbLoadOnRod_valueChanged"
QT_MOC_LITERAL(22, 576, 39), // "on_cbUnitLoadOnNode_currentIn..."
QT_MOC_LITERAL(23, 616, 38), // "on_cbUnitLoadOnRod_currentInd..."
QT_MOC_LITERAL(24, 655, 24), // "on_actioncSave_triggered"
QT_MOC_LITERAL(25, 680, 29), // "on_actionGo_to_post_triggered"
QT_MOC_LITERAL(26, 710, 19) // "on_action_triggered"
},
"MainWindow\0on_btnAcceptNumberOfRods_clicked\0"
"\0on_btnChangeNumberOfRods_clicked\0"
"on_leLenngth_editingFinished\0"
"on_sbPropOfRod_valueChanged\0arg1\0"
"on_leArea_editingFinished\0"
"on_leModuleE_editingFinished\0"
"on_leModuleSigma_editingFinished\0"
"on_cbUnitLength_currentIndexChanged\0"
"index\0on_cbUnitArea_currentIndexChanged\0"
"on_cbModuleE_currentIndexChanged\0"
"on_cbModuleSigma_currentIndexChanged\0"
"on_btnAcceptPropOfRods_clicked\0"
"on_cbSetLeftProp_clicked\0"
"on_cbSetRightProp_clicked\0"
"on_leLoadOnNode_editingFinished\0"
"on_leLoadOnRod_editingFinished\0"
"on_sbLoadOnNode_valueChanged\0"
"on_sbLoadOnRod_valueChanged\0"
"on_cbUnitLoadOnNode_currentIndexChanged\0"
"on_cbUnitLoadOnRod_currentIndexChanged\0"
"on_actioncSave_triggered\0"
"on_actionGo_to_post_triggered\0"
"on_action_triggered"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_MainWindow[] = {
// content:
8, // revision
0, // classname
0, 0, // classinfo
23, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 129, 2, 0x08 /* Private */,
3, 0, 130, 2, 0x08 /* Private */,
4, 0, 131, 2, 0x08 /* Private */,
5, 1, 132, 2, 0x08 /* Private */,
7, 0, 135, 2, 0x08 /* Private */,
8, 0, 136, 2, 0x08 /* Private */,
9, 0, 137, 2, 0x08 /* Private */,
10, 1, 138, 2, 0x08 /* Private */,
12, 1, 141, 2, 0x08 /* Private */,
13, 1, 144, 2, 0x08 /* Private */,
14, 1, 147, 2, 0x08 /* Private */,
15, 0, 150, 2, 0x08 /* Private */,
16, 0, 151, 2, 0x08 /* Private */,
17, 0, 152, 2, 0x08 /* Private */,
18, 0, 153, 2, 0x08 /* Private */,
19, 0, 154, 2, 0x08 /* Private */,
20, 1, 155, 2, 0x08 /* Private */,
21, 1, 158, 2, 0x08 /* Private */,
22, 1, 161, 2, 0x08 /* Private */,
23, 1, 164, 2, 0x08 /* Private */,
24, 0, 167, 2, 0x08 /* Private */,
25, 0, 168, 2, 0x08 /* Private */,
26, 0, 169, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, QMetaType::Int, 6,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, QMetaType::Int, 11,
QMetaType::Void, QMetaType::Int, 11,
QMetaType::Void, QMetaType::Int, 11,
QMetaType::Void, QMetaType::Int, 11,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void, QMetaType::Int, 6,
QMetaType::Void, QMetaType::Int, 6,
QMetaType::Void, QMetaType::Int, 11,
QMetaType::Void, QMetaType::Int, 11,
QMetaType::Void,
QMetaType::Void,
QMetaType::Void,
0 // eod
};
void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
auto *_t = static_cast<MainWindow *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->on_btnAcceptNumberOfRods_clicked(); break;
case 1: _t->on_btnChangeNumberOfRods_clicked(); break;
case 2: _t->on_leLenngth_editingFinished(); break;
case 3: _t->on_sbPropOfRod_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 4: _t->on_leArea_editingFinished(); break;
case 5: _t->on_leModuleE_editingFinished(); break;
case 6: _t->on_leModuleSigma_editingFinished(); break;
case 7: _t->on_cbUnitLength_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 8: _t->on_cbUnitArea_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 9: _t->on_cbModuleE_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 10: _t->on_cbModuleSigma_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 11: _t->on_btnAcceptPropOfRods_clicked(); break;
case 12: _t->on_cbSetLeftProp_clicked(); break;
case 13: _t->on_cbSetRightProp_clicked(); break;
case 14: _t->on_leLoadOnNode_editingFinished(); break;
case 15: _t->on_leLoadOnRod_editingFinished(); break;
case 16: _t->on_sbLoadOnNode_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 17: _t->on_sbLoadOnRod_valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 18: _t->on_cbUnitLoadOnNode_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 19: _t->on_cbUnitLoadOnRod_currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
case 20: _t->on_actioncSave_triggered(); break;
case 21: _t->on_actionGo_to_post_triggered(); break;
case 22: _t->on_action_triggered(); break;
default: ;
}
}
}
QT_INIT_METAOBJECT const QMetaObject MainWindow::staticMetaObject = { {
&QMainWindow::staticMetaObject,
qt_meta_stringdata_MainWindow.data,
qt_meta_data_MainWindow,
qt_static_metacall,
nullptr,
nullptr
} };
const QMetaObject *MainWindow::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *MainWindow::qt_metacast(const char *_clname)
{
if (!_clname) return nullptr;
if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0))
return static_cast<void*>(this);
return QMainWindow::qt_metacast(_clname);
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 23)
qt_static_metacall(this, _c, _id, _a);
_id -= 23;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 23)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 23;
}
return _id;
}
QT_WARNING_POP
QT_END_MOC_NAMESPACE
| [
"durmadon@list.ru"
] | durmadon@list.ru |
05478c8e1c2141c2b5fe7735b306e48ddd6dc826 | 99e494d9ca83ebafdbe6fbebc554ab229edcbacc | /.history/Day 2/Practice/Answers/MinimumWasteCells_20210305182322.cpp | 6085477b382764c8c41d3b000906b239932f8213 | [] | no_license | Datta2901/CCC | c0364caa1e4937bc7bce68e4847c8d599aef0f59 | 4debb2c1c70df693d0e5f68b5798bd9c7a7ef3dc | refs/heads/master | 2023-04-19T10:05:12.372578 | 2021-04-23T12:50:08 | 2021-04-23T12:50:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 186 | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string name;
getline(cin,name);
int size = name.size();
cout << size << endl;
int n = sqrt()
return 0;
} | [
"manikanta2901@gmail.com"
] | manikanta2901@gmail.com |
4db8e7008e3fc9d7d0597cf86d806f70367e9476 | cf8ddfc720bf6451c4ef4fa01684327431db1919 | /SDK/ARKSurvivalEvolved_PrimalItemSkin_ChibiDino_Seeker_functions.cpp | 61e77e00e311f7f902dc559e652854a284bf38a2 | [
"MIT"
] | permissive | git-Charlie/ARK-SDK | 75337684b11e7b9f668da1f15e8054052a3b600f | c38ca9925309516b2093ad8c3a70ed9489e1d573 | refs/heads/master | 2023-06-20T06:30:33.550123 | 2021-07-11T13:41:45 | 2021-07-11T13:41:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,170 | cpp | // ARKSurvivalEvolved (329.9) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "ARKSurvivalEvolved_PrimalItemSkin_ChibiDino_Seeker_parameters.hpp"
namespace sdk
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
// Function PrimalItemSkin_ChibiDino_Seeker.PrimalItemSkin_ChibiDino_Seeker_C.ExecuteUbergraph_PrimalItemSkin_ChibiDino_Seeker
// ()
// Parameters:
// int EntryPoint (Parm, ZeroConstructor, IsPlainOldData)
void UPrimalItemSkin_ChibiDino_Seeker_C::ExecuteUbergraph_PrimalItemSkin_ChibiDino_Seeker(int EntryPoint)
{
static auto fn = UObject::FindObject<UFunction>("Function PrimalItemSkin_ChibiDino_Seeker.PrimalItemSkin_ChibiDino_Seeker_C.ExecuteUbergraph_PrimalItemSkin_ChibiDino_Seeker");
UPrimalItemSkin_ChibiDino_Seeker_C_ExecuteUbergraph_PrimalItemSkin_ChibiDino_Seeker_Params params;
params.EntryPoint = EntryPoint;
auto flags = fn->FunctionFlags;
UObject::ProcessEvent(fn, ¶ms);
fn->FunctionFlags = flags;
}
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"sergey.2bite@gmail.com"
] | sergey.2bite@gmail.com |
c50f6a366c757c76b1f940acd2ab692e087a8522 | cd5683a9865f59424d1b890f66717175e9700561 | /중앙값구하기.cpp | 4d1251ad629c93d7b6963920653950529ae45421 | [] | no_license | sanghyub/Algo | 3ff911b029fc2bf9e389c0d6ca2737a9305caca6 | 4a4100cd5692a8b629135b500f155d4ba79bcdc3 | refs/heads/master | 2021-06-17T21:20:12.531329 | 2017-06-19T15:01:46 | 2017-06-19T15:01:46 | 85,571,279 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 361 | cpp | #include<cstdio>
#include<algorithm>
using namespace std;
int main() {
int t; scanf("%d", &t);
while (t--) {
int n; scanf("%d",&n);
int arr[10000];
for (int i = 1; i <= n; i++) scanf("%d", &arr[i]);
printf("%d\n", n / 2 + 1);
for (int i = 1; i <= n; i += 2) {
sort(arr + 1, arr + 1 + i);
printf("%d ", arr[i / 2 + 1]);
}
printf("\n");
}
} | [
"sanghyub91@gmail.com"
] | sanghyub91@gmail.com |
b23a678eb3c171330767ddd5f51dea2aab3d1b69 | cbdec665c5a8b167182c044572152f0f9e930774 | /attic/pl-rev.cpp | 5fc6e5a9bc38dd6bc0893b07f9fa311d15a5d5dc | [] | no_license | AlloSphere-Research-Group/synthesisTutorial | 0d69bac3b55642f788c077e0b327e12a06df98f5 | a734758b71b0a2781c9abe4740dc4962446b704c | refs/heads/master | 2020-05-07T10:20:05.658747 | 2019-05-30T23:11:53 | 2019-05-30T23:11:53 | 180,413,805 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,015 | cpp | /* Gamma - Generic processing library
See COPYRIGHT file for authors and license information
Example: Filter / Plucked String
Description: Simulation of a plucked string with noise and a feedback
delay-line.
*/
#include <cstdio> // for printing to stdout
#define GAMMA_H_INC_ALL // define this to include all header files
#define GAMMA_H_NO_IO // define this to avoid bringing AudioIO from Gamma
#include "Gamma/Gamma.h"
#include "al/core/io/al_AudioIO.hpp"
#include "al/util/scene/al_SynthSequencer.hpp"
using namespace gam;
using namespace al;
class PluckedString : public SynthVoice {
public:
PluckedString(float frq=440)
: mAmp(1),
comb(0.4, 1./100, 1,0),
comb2(0.4, 1./200, 1,0),
comb3(0.4, 1./300, 1,0),
comb4(0.4, 1./400, 1,0),
mallpass(1000,100),
mallpass2(500,100),
env(0.1), fil(2), delay(1./27.5, 1./frq){
decay(1.0);
mAmpEnv.curve(4); // make segments lines
mAmpEnv.levels(1,1,0);
}
PluckedString& freq(float v){delay.freq(v); return *this; }
PluckedString& amp(float v){ mAmp=v; return *this; }
PluckedString& dur(float v){
mAmpEnv.lengths()[0] = v;
return *this; }
PluckedString& decay(float v){
mAmpEnv.lengths()[1] = v;
return *this;
}
PluckedString& pan(float v){ mPan.pos(v); return *this; }
void reset(){ env.reset(); }
PluckedString& set(
float a, float b, float c, float d, float e=0
){
return dur(a).freq(b).amp(c).decay(d).pan(e);
}
float operator() (){
return (*this)(noise()*env());
}
float operator() (float in){
return delay(
fil( delay() + in )
);
}
void onProcess(AudioIOData& io){
while(io()){
//comb.feeds(0,-0.7);
comb.feeds(0,-0.99);
comb2.feeds(1,0);
comb3.feeds(1,0);
comb4.feeds(1,0);
float s = (*this)() * mAmpEnv() * mAmp;
comb.ipolType(ipl::CUBIC);
comb2.ipolType(ipl::CUBIC);
comb3.ipolType(ipl::CUBIC);
comb4.ipolType(ipl::CUBIC);
comb.maxDelay(0.4);
comb2.maxDelay(0.4);
comb3.maxDelay(0.4);
comb4.maxDelay(0.4);
comb.delay(1./100 + 1./10000);
comb2.delay(1./200 + 1./10000);
comb3.delay(1./300 + 1./10000);
comb4.delay(1./400 + 1./10000);
float s1 = (comb(s) + comb2(s) + comb3(s) + comb4(s));
s1 += mallpass(s);
s1 += mallpass2(s);
//float s1 = comb(s);
float s2;
mPan(s1, s1,s2);
mEnvFollow(s1);
io.out(0) += s1;
io.out(1) += s2;
}
if(mAmpEnv.done() && (mEnvFollow.value() < 0.00001f)) free();
}
virtual void onTriggerOn() override {
mAmpEnv.reset();
}
protected:
float mAmp;
// float mDur;
Pan<> mPan;
NoiseWhite<> noise;
Decay<> env;
MovingAvg<> fil;
Delay<float, ipl::Trunc> delay;
Env<2> mAmpEnv;
//Comb<float, ipl::Any> comb;
Comb<float, ipl::Linear> comb, comb2,comb3,comb4;
AllPass2<> mallpass, mallpass2;
EnvFollow<> mEnvFollow;
};
int main(){
SynthSequencer s;
s.add<PluckedString>( 0 ).set(6.5, 110, 0.3, .005, -1);
s.add<PluckedString>( 3.5).set(6.5, 233, 0.3, .1, 0);
PluckedString &thirdPluck = s.add<PluckedString>( 6.5).set(6.5, 329, 0.7, .0001, 1);
// s.add(Func(thirdPluck, &PluckedString::freq, 440)).dt(8);
AudioIO io;
io.initWithDefaults(s.audioCB, &s, true, false);
Domain::master().spu(io.framesPerSecond());
io.start();
printf("\nPress 'enter' or Ctrl-C to quit...\n");
while (io.isRunning()) {
auto c = getchar();
if (c != -1) {
std::cout << c <<std::endl;
io.stop();
}
}
return 0;
}
| [
"andres@atari"
] | andres@atari |
cc7768b782e14dfc0d519cb2e9af5a9b717fec56 | 1fcf175c9a2e1fa775634b385eee1b6a7f053cca | /0_LeetCode/gray-code.cpp | 5907f1054dfe865a2c60281ba30d0cd0f4d4b71e | [] | no_license | scytulip/MyCollections | e79b791ec24d320ca1fd67ab623dca3e8d10f760 | aab9084553da670386b9a0ab7ffae8817371f14d | refs/heads/master | 2020-04-10T20:31:57.407504 | 2017-07-04T13:15:00 | 2017-07-04T13:15:00 | 20,774,704 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 457 | cpp | class Solution {
public:
vector<int> grayCode(int n) {
vector<int> rt_val;
int i;
rt_val.push_back(0);
if (n<1) return rt_val;
rt_val.push_back(1);
if (n==1) return rt_val;
rt_val = grayCode(n-1);
for (i=rt_val.size()-1; i>=0; i--)
{
rt_val.push_back(rt_val[i]+(1<<(n-1)));
}
return rt_val;
}
}; | [
"scy.tulip@gmail.com"
] | scy.tulip@gmail.com |
f215f866a2d5ca8f5d85657b1a765d0ea310f5d5 | a738fab3d35dbc7ae90b7ca24ff7411ac12a76d9 | /Security and criptography/Tema2_SC/Tema2_SC/Debug/Generated Files/winrt/impl/Windows.Storage.AccessCache.1.h | aa165e8a702ad5976810f5e45f06783c512958b5 | [] | no_license | TheSeeven/personal-projects | 66c309233dfdf1d9986846f5bec5ededd57cf119 | 0d103b9647d2b1c650b0f0d7a63cc64786ddac23 | refs/heads/main | 2023-06-10T19:12:06.490243 | 2021-07-01T08:34:01 | 2021-07-01T08:34:01 | 301,747,006 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,226 | h | // WARNING: Please don't edit this file. It was generated by C++/WinRT v2.0.210403.2
#ifndef WINRT_Windows_Storage_AccessCache_1_H
#define WINRT_Windows_Storage_AccessCache_1_H
#include "winrt/impl/Windows.Storage.AccessCache.0.h"
WINRT_EXPORT namespace winrt::Windows::Storage::AccessCache
{
struct __declspec(empty_bases) IItemRemovedEventArgs :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IItemRemovedEventArgs>
{
IItemRemovedEventArgs(std::nullptr_t = nullptr) noexcept {}
IItemRemovedEventArgs(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IItemRemovedEventArgs(IItemRemovedEventArgs const&) noexcept = default;
IItemRemovedEventArgs(IItemRemovedEventArgs&&) noexcept = default;
IItemRemovedEventArgs& operator=(IItemRemovedEventArgs const&) & noexcept = default;
IItemRemovedEventArgs& operator=(IItemRemovedEventArgs&&) & noexcept = default;
};
struct __declspec(empty_bases) IStorageApplicationPermissionsStatics :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IStorageApplicationPermissionsStatics>
{
IStorageApplicationPermissionsStatics(std::nullptr_t = nullptr) noexcept {}
IStorageApplicationPermissionsStatics(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IStorageApplicationPermissionsStatics(IStorageApplicationPermissionsStatics const&) noexcept = default;
IStorageApplicationPermissionsStatics(IStorageApplicationPermissionsStatics&&) noexcept = default;
IStorageApplicationPermissionsStatics& operator=(IStorageApplicationPermissionsStatics const&) & noexcept = default;
IStorageApplicationPermissionsStatics& operator=(IStorageApplicationPermissionsStatics&&) & noexcept = default;
};
struct __declspec(empty_bases) IStorageApplicationPermissionsStatics2 :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IStorageApplicationPermissionsStatics2>
{
IStorageApplicationPermissionsStatics2(std::nullptr_t = nullptr) noexcept {}
IStorageApplicationPermissionsStatics2(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IStorageApplicationPermissionsStatics2(IStorageApplicationPermissionsStatics2 const&) noexcept = default;
IStorageApplicationPermissionsStatics2(IStorageApplicationPermissionsStatics2&&) noexcept = default;
IStorageApplicationPermissionsStatics2& operator=(IStorageApplicationPermissionsStatics2 const&) & noexcept = default;
IStorageApplicationPermissionsStatics2& operator=(IStorageApplicationPermissionsStatics2&&) & noexcept = default;
};
struct __declspec(empty_bases) IStorageItemAccessList :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IStorageItemAccessList>
{
IStorageItemAccessList(std::nullptr_t = nullptr) noexcept {}
IStorageItemAccessList(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IStorageItemAccessList(IStorageItemAccessList const&) noexcept = default;
IStorageItemAccessList(IStorageItemAccessList&&) noexcept = default;
IStorageItemAccessList& operator=(IStorageItemAccessList const&) & noexcept = default;
IStorageItemAccessList& operator=(IStorageItemAccessList&&) & noexcept = default;
};
struct __declspec(empty_bases) IStorageItemMostRecentlyUsedList :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IStorageItemMostRecentlyUsedList>,
impl::require<winrt::Windows::Storage::AccessCache::IStorageItemMostRecentlyUsedList, winrt::Windows::Storage::AccessCache::IStorageItemAccessList>
{
IStorageItemMostRecentlyUsedList(std::nullptr_t = nullptr) noexcept {}
IStorageItemMostRecentlyUsedList(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IStorageItemMostRecentlyUsedList(IStorageItemMostRecentlyUsedList const&) noexcept = default;
IStorageItemMostRecentlyUsedList(IStorageItemMostRecentlyUsedList&&) noexcept = default;
IStorageItemMostRecentlyUsedList& operator=(IStorageItemMostRecentlyUsedList const&) & noexcept = default;
IStorageItemMostRecentlyUsedList& operator=(IStorageItemMostRecentlyUsedList&&) & noexcept = default;
};
struct __declspec(empty_bases) IStorageItemMostRecentlyUsedList2 :
winrt::Windows::Foundation::IInspectable,
impl::consume_t<IStorageItemMostRecentlyUsedList2>,
impl::require<winrt::Windows::Storage::AccessCache::IStorageItemMostRecentlyUsedList2, winrt::Windows::Storage::AccessCache::IStorageItemAccessList, winrt::Windows::Storage::AccessCache::IStorageItemMostRecentlyUsedList>
{
IStorageItemMostRecentlyUsedList2(std::nullptr_t = nullptr) noexcept {}
IStorageItemMostRecentlyUsedList2(void* ptr, take_ownership_from_abi_t) noexcept : winrt::Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
IStorageItemMostRecentlyUsedList2(IStorageItemMostRecentlyUsedList2 const&) noexcept = default;
IStorageItemMostRecentlyUsedList2(IStorageItemMostRecentlyUsedList2&&) noexcept = default;
IStorageItemMostRecentlyUsedList2& operator=(IStorageItemMostRecentlyUsedList2 const&) & noexcept = default;
IStorageItemMostRecentlyUsedList2& operator=(IStorageItemMostRecentlyUsedList2&&) & noexcept = default;
using impl::consume_t<IStorageItemMostRecentlyUsedList2, IStorageItemMostRecentlyUsedList2>::Add;
using impl::consume_t<IStorageItemMostRecentlyUsedList2, winrt::Windows::Storage::AccessCache::IStorageItemAccessList>::Add;
using impl::consume_t<IStorageItemMostRecentlyUsedList2, IStorageItemMostRecentlyUsedList2>::AddOrReplace;
using impl::consume_t<IStorageItemMostRecentlyUsedList2, winrt::Windows::Storage::AccessCache::IStorageItemAccessList>::AddOrReplace;
};
}
#endif
| [
"perianu.leon@outlook.com"
] | perianu.leon@outlook.com |
eef313fc0ad494b8249d4d0aaba6bb82037102f4 | 449106fb27ecd76391571b991ea36c4031d6ba9e | /ComponentObject.cpp | 331b8e8a1c34ba23067e06e99e9597c2cd741e84 | [] | no_license | AppleMangoSpd/MakeMyOwnGameEngine | 451e71eb84e2e524e38d0cc4416406f201456f42 | e87c884ecac451918d8374c493c333732466b126 | refs/heads/master | 2023-01-31T20:45:50.368122 | 2020-12-15T14:42:49 | 2020-12-15T14:42:49 | 307,305,876 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 29 | cpp | #include "ComponentObject.h"
| [
"52735083+AppleMangoSpd@users.noreply.github.com"
] | 52735083+AppleMangoSpd@users.noreply.github.com |
df2b38e3886059646b0821624091f43be02e63ca | 8a37e0512790fb942c9590dba92e9b4a00f5fda4 | /libraries/Multiplexer.h | b0dad00fd564639bed8effda3af3fe91b3298512 | [] | no_license | Danigy/ArduinoDebugger | 14cc1d631fb44b3efd1e64719403554a51b35995 | 24c4abd4e4b00371a4f0696329b3b930e334e33e | refs/heads/master | 2020-07-10T07:21:30.797562 | 2018-07-10T23:34:51 | 2018-07-10T23:34:51 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,276 | h | #ifndef Multiplexer_H
#define Multiplexer_H
#include "ConnectedComponent.h"
class Multiplexer:public ConnectedComponent
{
public:
// Constructor
Multiplexer(int, int, Component *);
// Destructor
~Multiplexer();
void Paint(HDC _hdc, PAINTSTRUCT _ps, HDC _hdcMemory);
void Init (HWND _windowHandle, HINSTANCE _g_hInst, char *);
void print (char * ch);
void print (int value);
bool clearTheText;
void HandleMenu ( int command );
void AddMenu ();
void HandleMouseMove (HWND hWnd, int _x, int _y);
void HandleMouseDown (HWND hWnd, int _x, int _y);
void HandleMouseUp (HWND hWnd);
void MoveTo (int, int);
void SaveYourself (FILE * fp);
void NotSavedYet(){};
void Select ( bool select);
void Update ();
Pin * FindPort ( char * port);
Pin * PinActive();
Pin * PortSelected();
private:
bool firstUpdate;
int lastSelection;
bool pinSelected;
static int const MAX_MULTIPLEXER_PINS = 16;
Pin * pin[MAX_MULTIPLEXER_PINS];
void WriteOutValue (int value);
HBITMAP hbmPinDot;
BITMAP bmPinDot;
HBITMAP hbmRedDot;
BITMAP bmRedDot;
HBITMAP hbmBlackDot;
BITMAP bmBlackDot;
};
#endif
| [
"paulware@hotmail.com"
] | paulware@hotmail.com |
f41b8d1f287b3290a8d1f7cd1b2645557573e4c8 | fd899e63d4c33261911f0e35fb8cb286332b7a95 | /algorithm_202005/1324f_1.cpp | 667ba5e684523bfbf2cd95383d0282e7d0e22170 | [] | no_license | choyj0920/algorithm | 948452d652455973e928ef537729174109972252 | e1287799e7073232cbf8904cea7c348a2f2a9c30 | refs/heads/master | 2023-05-25T22:23:11.044049 | 2021-09-08T03:40:42 | 2021-08-13T08:04:46 | 225,736,983 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,037 | cpp | #include <iostream>
#include<vector>
#include <Algorithm>
using namespace std;
vector<int> a;
vector<int> dp;
vector<int> ans;
vector<vector<int>> g;
void dfs(int v, int p = -1) {
dp[v] = a[v];
for (auto to : g[v]) {
if (to == p) continue;
dfs(to, v);
dp[v] += max(dp[to], 0);
}
}
void dfs2(int v, int p = -1) {
ans[v] = dp[v];
for (auto to : g[v]) {
if (to == p) continue;
dp[v] -= max(0, dp[to]); //밑부분 제거하고
dp[to] += max(0, dp[v]); // 밑부분 계산에 위부분을 지나는 부분 더해줌
dfs2(to, v);
dp[to] -= max(0, dp[v]); //종료후 값 원래대로
dp[v] += max(0, dp[to]); //값 원래 대로
}
}
int main() {
int n;
cin >> n;
a = dp = ans = vector<int>(n);
g = vector<vector<int>>(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
if (a[i] == 0) a[i] = -1;
}
for (int i = 0; i < n - 1; ++i) {
int x, y;
cin >> x >> y;
--x, --y;
g[x].push_back(y);
g[y].push_back(x);
}
dfs(0);
dfs2(0);
for (auto it : ans) cout << it << " ";
cout << endl;
return 0;
} | [
"44551544+choyj0920@users.noreply.github.com"
] | 44551544+choyj0920@users.noreply.github.com |
7bb9e202c18bbbe62840f7b4d8b6da4cd308eaa9 | 323fac9e077ad960f8be0c09b3b5ff5eedfc73d3 | /branches/app/lan-txt-editor/common/proto/msgFile.pb.h | 0c66b4a14a70ba1cbd4d1c73bd3497f8102464b7 | [] | no_license | yellowbigbird/bird-self-lib | 226f08a1d5a0c7cde994fe14c2a47f5ac443ba3e | 04dae41aa62609028d61f13490b2562ae1479134 | refs/heads/master | 2021-06-13T15:49:35.125938 | 2017-08-03T07:18:06 | 2017-08-03T07:18:06 | 39,172,862 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | true | 17,498 | h | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: msgFile.proto
#ifndef PROTOBUF_msgFile_2eproto__INCLUDED
#define PROTOBUF_msgFile_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#include "..\comDll.h"
#pragma warning(disable:4275)
#pragma warning(disable:4251)
#if GOOGLE_PROTOBUF_VERSION < 2005000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 2005000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/generated_enum_reflection.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
// Internal implementation detail -- do not call these.
void protobuf_AddDesc_msgFile_2eproto();
void protobuf_AssignDesc_msgFile_2eproto();
void protobuf_ShutdownFile_msgFile_2eproto();
class MsgFile;
enum MsgFile_TYPE {
MsgFile_TYPE_FILE = 0,
MsgFile_TYPE_DIR = 1,
MsgFile_TYPE_NotExist = 2
};
bool MsgFile_TYPE_IsValid(int value);
const MsgFile_TYPE MsgFile_TYPE_TYPE_MIN = MsgFile_TYPE_FILE;
const MsgFile_TYPE MsgFile_TYPE_TYPE_MAX = MsgFile_TYPE_NotExist;
const int MsgFile_TYPE_TYPE_ARRAYSIZE = MsgFile_TYPE_TYPE_MAX + 1;
const ::google::protobuf::EnumDescriptor* MsgFile_TYPE_descriptor();
inline const ::std::string& MsgFile_TYPE_Name(MsgFile_TYPE value) {
return ::google::protobuf::internal::NameOfEnum(
MsgFile_TYPE_descriptor(), value);
}
inline bool MsgFile_TYPE_Parse(
const ::std::string& name, MsgFile_TYPE* value) {
return ::google::protobuf::internal::ParseNamedEnum<MsgFile_TYPE>(
MsgFile_TYPE_descriptor(), name, value);
}
// ===================================================================
class MsgFile : public ::google::protobuf::Message {
public:
MsgFile();
virtual ~MsgFile();
MsgFile(const MsgFile& from);
inline MsgFile& operator=(const MsgFile& from) {
CopyFrom(from);
return *this;
}
inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
return _unknown_fields_;
}
inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
return &_unknown_fields_;
}
static const ::google::protobuf::Descriptor* descriptor();
static const MsgFile& default_instance();
void Swap(MsgFile* other);
// implements Message ----------------------------------------------
MsgFile* New() const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const MsgFile& from);
void MergeFrom(const MsgFile& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
typedef MsgFile_TYPE TYPE;
static const TYPE FILE = MsgFile_TYPE_FILE;
static const TYPE DIR = MsgFile_TYPE_DIR;
static const TYPE NotExist = MsgFile_TYPE_NotExist;
static inline bool TYPE_IsValid(int value) {
return MsgFile_TYPE_IsValid(value);
}
static const TYPE TYPE_MIN =
MsgFile_TYPE_TYPE_MIN;
static const TYPE TYPE_MAX =
MsgFile_TYPE_TYPE_MAX;
static const int TYPE_ARRAYSIZE =
MsgFile_TYPE_TYPE_ARRAYSIZE;
static inline const ::google::protobuf::EnumDescriptor*
TYPE_descriptor() {
return MsgFile_TYPE_descriptor();
}
static inline const ::std::string& TYPE_Name(TYPE value) {
return MsgFile_TYPE_Name(value);
}
static inline bool TYPE_Parse(const ::std::string& name,
TYPE* value) {
return MsgFile_TYPE_Parse(name, value);
}
// accessors -------------------------------------------------------
// required .MsgFile.TYPE fileType = 1;
inline bool has_filetype() const;
inline void clear_filetype();
static const int kFileTypeFieldNumber = 1;
inline ::MsgFile_TYPE filetype() const;
inline void set_filetype(::MsgFile_TYPE value);
// required string fileName = 2;
inline bool has_filename() const;
inline void clear_filename();
static const int kFileNameFieldNumber = 2;
inline const ::std::string& filename() const;
inline void set_filename(const ::std::string& value);
inline void set_filename(const char* value);
inline void set_filename(const char* value, size_t size);
inline ::std::string* mutable_filename();
inline ::std::string* release_filename();
inline void set_allocated_filename(::std::string* filename);
// optional uint64 fileSize = 3;
inline bool has_filesize() const;
inline void clear_filesize();
static const int kFileSizeFieldNumber = 3;
inline ::google::protobuf::uint64 filesize() const;
inline void set_filesize(::google::protobuf::uint64 value);
// optional int64 fileTime = 4;
inline bool has_filetime() const;
inline void clear_filetime();
static const int kFileTimeFieldNumber = 4;
inline ::google::protobuf::int64 filetime() const;
inline void set_filetime(::google::protobuf::int64 value);
// required bool file7z = 5;
inline bool has_file7z() const;
inline void clear_file7z();
static const int kFile7ZFieldNumber = 5;
inline bool file7z() const;
inline void set_file7z(bool value);
// optional string filePathName = 9;
inline bool has_filepathname() const;
inline void clear_filepathname();
static const int kFilePathNameFieldNumber = 9;
inline const ::std::string& filepathname() const;
inline void set_filepathname(const ::std::string& value);
inline void set_filepathname(const char* value);
inline void set_filepathname(const char* value, size_t size);
inline ::std::string* mutable_filepathname();
inline ::std::string* release_filepathname();
inline void set_allocated_filepathname(::std::string* filepathname);
// optional string fileData = 10;
inline bool has_filedata() const;
inline void clear_filedata();
static const int kFileDataFieldNumber = 10;
inline const ::std::string& filedata() const;
inline void set_filedata(const ::std::string& value);
inline void set_filedata(const char* value);
inline void set_filedata(const char* value, size_t size);
inline ::std::string* mutable_filedata();
inline ::std::string* release_filedata();
inline void set_allocated_filedata(::std::string* filedata);
// @@protoc_insertion_point(class_scope:MsgFile)
private:
inline void set_has_filetype();
inline void clear_has_filetype();
inline void set_has_filename();
inline void clear_has_filename();
inline void set_has_filesize();
inline void clear_has_filesize();
inline void set_has_filetime();
inline void clear_has_filetime();
inline void set_has_file7z();
inline void clear_has_file7z();
inline void set_has_filepathname();
inline void clear_has_filepathname();
inline void set_has_filedata();
inline void clear_has_filedata();
::google::protobuf::UnknownFieldSet _unknown_fields_;
::std::string* filename_;
::google::protobuf::uint64 filesize_;
int filetype_;
bool file7z_;
::google::protobuf::int64 filetime_;
::std::string* filepathname_;
::std::string* filedata_;
mutable int _cached_size_;
::google::protobuf::uint32 _has_bits_[(7 + 31) / 32];
friend void protobuf_AddDesc_msgFile_2eproto();
friend void protobuf_AssignDesc_msgFile_2eproto();
friend void protobuf_ShutdownFile_msgFile_2eproto();
void InitAsDefaultInstance();
static MsgFile* default_instance_;
};
// ===================================================================
// ===================================================================
// MsgFile
// required .MsgFile.TYPE fileType = 1;
inline bool MsgFile::has_filetype() const {
return (_has_bits_[0] & 0x00000001u) != 0;
}
inline void MsgFile::set_has_filetype() {
_has_bits_[0] |= 0x00000001u;
}
inline void MsgFile::clear_has_filetype() {
_has_bits_[0] &= ~0x00000001u;
}
inline void MsgFile::clear_filetype() {
filetype_ = 0;
clear_has_filetype();
}
inline ::MsgFile_TYPE MsgFile::filetype() const {
return static_cast< ::MsgFile_TYPE >(filetype_);
}
inline void MsgFile::set_filetype(::MsgFile_TYPE value) {
assert(::MsgFile_TYPE_IsValid(value));
set_has_filetype();
filetype_ = value;
}
// required string fileName = 2;
inline bool MsgFile::has_filename() const {
return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void MsgFile::set_has_filename() {
_has_bits_[0] |= 0x00000002u;
}
inline void MsgFile::clear_has_filename() {
_has_bits_[0] &= ~0x00000002u;
}
inline void MsgFile::clear_filename() {
if (filename_ != &::google::protobuf::internal::kEmptyString) {
filename_->clear();
}
clear_has_filename();
}
inline const ::std::string& MsgFile::filename() const {
return *filename_;
}
inline void MsgFile::set_filename(const ::std::string& value) {
set_has_filename();
if (filename_ == &::google::protobuf::internal::kEmptyString) {
filename_ = new ::std::string;
}
filename_->assign(value);
}
inline void MsgFile::set_filename(const char* value) {
set_has_filename();
if (filename_ == &::google::protobuf::internal::kEmptyString) {
filename_ = new ::std::string;
}
filename_->assign(value);
}
inline void MsgFile::set_filename(const char* value, size_t size) {
set_has_filename();
if (filename_ == &::google::protobuf::internal::kEmptyString) {
filename_ = new ::std::string;
}
filename_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* MsgFile::mutable_filename() {
set_has_filename();
if (filename_ == &::google::protobuf::internal::kEmptyString) {
filename_ = new ::std::string;
}
return filename_;
}
inline ::std::string* MsgFile::release_filename() {
clear_has_filename();
if (filename_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = filename_;
filename_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void MsgFile::set_allocated_filename(::std::string* filename) {
if (filename_ != &::google::protobuf::internal::kEmptyString) {
delete filename_;
}
if (filename) {
set_has_filename();
filename_ = filename;
} else {
clear_has_filename();
filename_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
}
// optional uint64 fileSize = 3;
inline bool MsgFile::has_filesize() const {
return (_has_bits_[0] & 0x00000004u) != 0;
}
inline void MsgFile::set_has_filesize() {
_has_bits_[0] |= 0x00000004u;
}
inline void MsgFile::clear_has_filesize() {
_has_bits_[0] &= ~0x00000004u;
}
inline void MsgFile::clear_filesize() {
filesize_ = GOOGLE_ULONGLONG(0);
clear_has_filesize();
}
inline ::google::protobuf::uint64 MsgFile::filesize() const {
return filesize_;
}
inline void MsgFile::set_filesize(::google::protobuf::uint64 value) {
set_has_filesize();
filesize_ = value;
}
// optional int64 fileTime = 4;
inline bool MsgFile::has_filetime() const {
return (_has_bits_[0] & 0x00000008u) != 0;
}
inline void MsgFile::set_has_filetime() {
_has_bits_[0] |= 0x00000008u;
}
inline void MsgFile::clear_has_filetime() {
_has_bits_[0] &= ~0x00000008u;
}
inline void MsgFile::clear_filetime() {
filetime_ = GOOGLE_LONGLONG(0);
clear_has_filetime();
}
inline ::google::protobuf::int64 MsgFile::filetime() const {
return filetime_;
}
inline void MsgFile::set_filetime(::google::protobuf::int64 value) {
set_has_filetime();
filetime_ = value;
}
// required bool file7z = 5;
inline bool MsgFile::has_file7z() const {
return (_has_bits_[0] & 0x00000010u) != 0;
}
inline void MsgFile::set_has_file7z() {
_has_bits_[0] |= 0x00000010u;
}
inline void MsgFile::clear_has_file7z() {
_has_bits_[0] &= ~0x00000010u;
}
inline void MsgFile::clear_file7z() {
file7z_ = false;
clear_has_file7z();
}
inline bool MsgFile::file7z() const {
return file7z_;
}
inline void MsgFile::set_file7z(bool value) {
set_has_file7z();
file7z_ = value;
}
// optional string filePathName = 9;
inline bool MsgFile::has_filepathname() const {
return (_has_bits_[0] & 0x00000020u) != 0;
}
inline void MsgFile::set_has_filepathname() {
_has_bits_[0] |= 0x00000020u;
}
inline void MsgFile::clear_has_filepathname() {
_has_bits_[0] &= ~0x00000020u;
}
inline void MsgFile::clear_filepathname() {
if (filepathname_ != &::google::protobuf::internal::kEmptyString) {
filepathname_->clear();
}
clear_has_filepathname();
}
inline const ::std::string& MsgFile::filepathname() const {
return *filepathname_;
}
inline void MsgFile::set_filepathname(const ::std::string& value) {
set_has_filepathname();
if (filepathname_ == &::google::protobuf::internal::kEmptyString) {
filepathname_ = new ::std::string;
}
filepathname_->assign(value);
}
inline void MsgFile::set_filepathname(const char* value) {
set_has_filepathname();
if (filepathname_ == &::google::protobuf::internal::kEmptyString) {
filepathname_ = new ::std::string;
}
filepathname_->assign(value);
}
inline void MsgFile::set_filepathname(const char* value, size_t size) {
set_has_filepathname();
if (filepathname_ == &::google::protobuf::internal::kEmptyString) {
filepathname_ = new ::std::string;
}
filepathname_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* MsgFile::mutable_filepathname() {
set_has_filepathname();
if (filepathname_ == &::google::protobuf::internal::kEmptyString) {
filepathname_ = new ::std::string;
}
return filepathname_;
}
inline ::std::string* MsgFile::release_filepathname() {
clear_has_filepathname();
if (filepathname_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = filepathname_;
filepathname_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void MsgFile::set_allocated_filepathname(::std::string* filepathname) {
if (filepathname_ != &::google::protobuf::internal::kEmptyString) {
delete filepathname_;
}
if (filepathname) {
set_has_filepathname();
filepathname_ = filepathname;
} else {
clear_has_filepathname();
filepathname_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
}
// optional string fileData = 10;
inline bool MsgFile::has_filedata() const {
return (_has_bits_[0] & 0x00000040u) != 0;
}
inline void MsgFile::set_has_filedata() {
_has_bits_[0] |= 0x00000040u;
}
inline void MsgFile::clear_has_filedata() {
_has_bits_[0] &= ~0x00000040u;
}
inline void MsgFile::clear_filedata() {
if (filedata_ != &::google::protobuf::internal::kEmptyString) {
filedata_->clear();
}
clear_has_filedata();
}
inline const ::std::string& MsgFile::filedata() const {
return *filedata_;
}
inline void MsgFile::set_filedata(const ::std::string& value) {
set_has_filedata();
if (filedata_ == &::google::protobuf::internal::kEmptyString) {
filedata_ = new ::std::string;
}
filedata_->assign(value);
}
inline void MsgFile::set_filedata(const char* value) {
set_has_filedata();
if (filedata_ == &::google::protobuf::internal::kEmptyString) {
filedata_ = new ::std::string;
}
filedata_->assign(value);
}
inline void MsgFile::set_filedata(const char* value, size_t size) {
set_has_filedata();
if (filedata_ == &::google::protobuf::internal::kEmptyString) {
filedata_ = new ::std::string;
}
filedata_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* MsgFile::mutable_filedata() {
set_has_filedata();
if (filedata_ == &::google::protobuf::internal::kEmptyString) {
filedata_ = new ::std::string;
}
return filedata_;
}
inline ::std::string* MsgFile::release_filedata() {
clear_has_filedata();
if (filedata_ == &::google::protobuf::internal::kEmptyString) {
return NULL;
} else {
::std::string* temp = filedata_;
filedata_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
return temp;
}
}
inline void MsgFile::set_allocated_filedata(::std::string* filedata) {
if (filedata_ != &::google::protobuf::internal::kEmptyString) {
delete filedata_;
}
if (filedata) {
set_has_filedata();
filedata_ = filedata;
} else {
clear_has_filedata();
filedata_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
}
}
// @@protoc_insertion_point(namespace_scope)
#ifndef SWIG
namespace google {
namespace protobuf {
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::MsgFile_TYPE>() {
return ::MsgFile_TYPE_descriptor();
}
} // namespace google
} // namespace protobuf
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_msgFile_2eproto__INCLUDED
| [
"yellowbigbird@gmail.com"
] | yellowbigbird@gmail.com |
194998eddebae8b9011bba8fe59ea54809fe3648 | df8076fbc7429cb8255f0dc13985cda52c2d9de2 | /lib/LLVMSlicer/Backtrack/ScanRule.h | 1197945d5fcd84f6d38623be7c1eb8aa8ad94477 | [
"NCSA"
] | permissive | pwnzen-mobile/llvm-slicer | 0f2f657cc593a9920b1383db0729e94fc22d79d4 | efe730e1a491f50842ae0e1e421dd259c1c1a169 | refs/heads/master | 2020-06-11T15:48:30.817796 | 2019-12-16T06:39:57 | 2019-12-16T06:39:57 | 194,010,291 | 0 | 0 | NOASSERTION | 2019-06-27T02:40:26 | 2019-06-27T02:40:26 | null | UTF-8 | C++ | false | false | 426 | h | #ifndef LLVM_SCANRULE_H
#define LLVM_SCANRULE_H
#include <string>
#include <set>
#include <assert.h>
#include "Rule.h"
#include "Path.h"
namespace llvm {
class Instruction;
namespace slicing {
class ScanRule;
void parseScanRules(std::vector<llvm::slicing::Rule*>*,std::vector<llvm::slicing::Rule*>*,std::set<llvm::slicing::Rule*>*,std::set<llvm::slicing::Rule*>*);
}
}
#endif //LLVM_RULE_H
| [
"xiesikefu@pwnzen.com"
] | xiesikefu@pwnzen.com |
7ce13a308c036bff64b49cf88e32a14f276e290b | 59f00d4f6fccb6b1103c5aa54f43a6e4d4f8bfc5 | /src/common-plugin-view/HelpPlugin/HelpReadHhc.h | a98731c41403d812e6eb862c9b64a31261fcf32b | [] | no_license | tomas-pluskal/masspp | 9c9492443bb796533bcb27fe52a0a60e4ba62160 | 808bf095215e549e7eb5317c02c04dfb2ceaba15 | refs/heads/master | 2021-01-01T05:33:44.483127 | 2015-06-07T12:54:17 | 2015-06-07T12:54:17 | 33,917,190 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,506 | h | /**
* @file HelpReadHhc.h
* @brief read HHC file class
* @author Y.Murata
* @date 2011.12.21
* Copyright (C) 2014 Shimadzu Corporation All rights reserved.
*/
#ifndef __HELP_READ_HHC_H__
#define __HELP_READ_HHC_H__
#include "HelpTypedef.h"
namespace kome {
namespace view {
/**
* @class HelpReadHhc
* @brief read HHC file class
*/
class HelpReadHhc {
public:
/**
* @fn HelpReadHhc( std::vector< ST_HELP_OBJECT >* pvctHelp = NULL )
* @param pvctHelp HHC file information for each plug-in objects
* @brief constructor
*/
HelpReadHhc( std::vector< ST_HELP_OBJECT >* pvctHelp = NULL );
/**
* @fn virtual ~ScoreCalculation()
* @brief destructor
*/
virtual ~HelpReadHhc();
/**
* @fn bool createChapterInfo( const char* szHhkFileName, const char* szHtmlFullPath )
* @brief Create an HHC file from the specified chapters.
* @param szHhcFileName read HHC file name
* @param szHtmlFullPath full path to add
* @return Returns FALSE on failure.Processing returns TRUE if successful.
*/
bool createChapterInfo( const char* szHhcFileName, const char* szHtmlFullPath );
// member
private:
/** ID for each plug-in */
int m_nId;
/** Parent ID to the various plug-ins */
std::vector< int > m_vctParentId;
/** HHK file information for each plug-in objects */
std::vector< ST_HELP_OBJECT >* m_pvctHelp;
};
}
}
#endif // __HELP_READ_HHC_H__
| [
"Satoshi Tanaka@localhost"
] | Satoshi Tanaka@localhost |
e56884c55b17f6e14bb0c01899d8d10a4179f202 | 340d0bd71af6cb93bec8a6a0c7fdefc6dbb208fd | /Final/ข้อ 5/Line_notify.ino | d6706715cfb47852542082b8961c0c73bbfe2ed0 | [] | no_license | AittiKo/Study_IoT | 2ee28a2b2a924f26d2dae73d87c5d50beb20761c | 4b6d02d5369c1fecf83b5aff6f58a5a65bdece64 | refs/heads/master | 2021-07-05T18:04:46.086760 | 2017-10-01T17:12:44 | 2017-10-01T17:12:44 | 105,458,729 | 0 | 1 | null | 2017-10-01T17:08:30 | 2017-10-01T17:08:30 | null | UTF-8 | C++ | false | false | 2,155 | ino | void Line_Notify(String message) ;
#include <ESP8266WiFi.h>
// Config connect WiFi
#define WIFI_SSID "Apple TV" // แก้ชื่อ ssid
#define WIFI_PASSWORD "APPLE_TV" // แก้รหัสผ่าน
// Line config
#define LINE_TOKEN "OzOsSaIKUU1jE1cIQp5vuzYL73jQraU1w7AxKXQFZhU" // แก้ LINE TOKEN
String message = "Hello NodeMCU and Line";
String message2 = "%E0%B8%A1%E0%B8%B5%E0%B8%84%E0%B8%99%E0%B9%80%E0%B8%82%E0%B9%89%E0%B8%B2%E0%B8%A1%E0%B8%B2";
//Line Notify ยังไม่รองรับภาษาไทย ดังนั้นเราสามารถแปลงข้อความเป็น utf-8 เพื่อส่งเป็นภาษาไทยได้ จาก http://meyerweb.com/eric/tools/dencoder/
void setup() {
Serial.begin(115200);
pinMode(D2, INPUT);
WiFi.mode(WIFI_STA);
// connect to wifi.
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("connecting");
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.println();
Serial.print("connected: ");
Serial.println(WiFi.localIP());
}
void loop() {
int value= digitalRead(D2);
Serial.println("Enter !");
Serial.println(value);
//message = value;
if(value == 1){
Line_Notify(message2);
}
//Line_Notify("Distance = " + value);
Serial.println();
delay(2000);
}
void Line_Notify(String message) {
WiFiClientSecure client;
if (!client.connect("notify-api.line.me", 443)) {
Serial.println("connection failed");
return;
}
String req = "";
req += "POST /api/notify HTTP/1.1\r\n";
req += "Host: notify-api.line.me\r\n";
req += "Authorization: Bearer " + String(LINE_TOKEN) + "\r\n";
req += "Cache-Control: no-cache\r\n";
req += "User-Agent: ESP8266\r\n";
req += "Content-Type: application/x-www-form-urlencoded\r\n";
req += "Content-Length: " + String(String("message=" + message).length()) + "\r\n";
req += "\r\n";
req += "message=" + message;
// Serial.println(req);
client.print(req);
delay(20);
while (client.connected()) {
String line = client.readStringUntil('\n');
if (line == "\r") {
break;
}
// Serial.println(line);
}
Serial.println("-------------");
}
| [
"cofen.yensira@gmail.com"
] | cofen.yensira@gmail.com |
ae3c3de6c70eec3c851faf78863cc3337a177329 | b690baf6e48d1dd76c18a4a28254a0daaff5f64c | /LeetCode/Insert into a Binary Search Tree/Solution.cpp | 65b6e5cd9d355c365baa4a64579ff151e1639af8 | [] | no_license | sorablaze11/Solved-Programming-Problems- | 3262c06f773d2a37d72b7df302a49efb7d355842 | b91ecbd59f6db85cc6a289f76563ed58baa1393d | refs/heads/master | 2020-08-22T06:49:07.754044 | 2020-01-25T10:35:21 | 2020-01-25T10:35:21 | 216,341,201 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 538 | cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* insertIntoBST(TreeNode* root, int val) {
if(root == NULL){
root = new TreeNode(val);
return root;
}
if(root->val >= val) root->left = insertIntoBST(root->left, val);
else root->right = insertIntoBST(root->right, val);
return root;
}
}; | [
"limburaj65@gmail.com"
] | limburaj65@gmail.com |
233366bb01c1159e826492ac1ef7e4c65a666ee7 | e537ccf5cec931491ab74bec6eda6603cd3db173 | /book/admodifybookdialog.cpp | c59af57898512a8bd2b0a37eb910306b70e6cad5 | [] | no_license | H-K-ai/Qt-4.7.4 | 47b8f5e84a96a1448c78f690b63453f296d67561 | b5f857e75799e711e48bda1e29e023c17557cfe6 | refs/heads/master | 2021-05-28T07:22:34.300373 | 2015-03-02T19:10:15 | 2015-03-02T19:10:15 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,691 | cpp | #include "admodifybookdialog.h"
#include "ui_admodifybookdialog.h"
adModifyBookDialog::adModifyBookDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::adModifyBookDialog)
{
ui->setupUi(this);
ui->lineEdit->clear();
ui->lineEdit_2->clear();
ui->lineEdit_3->clear();
ui->lineEdit_4->clear();
ui->lineEdit_5->clear();
ui->lineEdit_6->clear();
ui->dateEdit->setDate(QDate::currentDate());
}
adModifyBookDialog::~adModifyBookDialog()
{
delete ui;
}
void adModifyBookDialog::showEvent(QShowEvent *)
{
//显示窗体
ui->lineEdit->clear();
ui->lineEdit_2->clear();
ui->lineEdit_3->clear();
ui->lineEdit_4->clear();
ui->lineEdit_5->clear();
ui->lineEdit_6->clear();
ui->dateEdit->setDate(QDate::currentDate());
}
void adModifyBookDialog::on_pushButton_clicked()
{
//搜索
QSqlQuery query;
query.exec("select * from books where bookcode = '" + ui->lineEdit_6->text().trimmed() + "'");
while(query.next())
{
ui->lineEdit->setText(query.value(1).toString());
ui->lineEdit_2->setText(query.value(2).toString());
ui->lineEdit_3->setText(query.value(3).toString());
ui->lineEdit_4->setText(query.value(4).toString());
ui->lineEdit_5->setText(query.value(5).toString());
ui->dateEdit->setDate(QDate::fromString(query.value(6).toString(), "yyyy.MM.dd"));
return;
}
QMessageBox::information(NULL, "Warring", "图书编号未找到!");
}
void adModifyBookDialog::on_pushButton_2_clicked()
{
//修改
QSqlQuery query;
QString idNum, bookStatus;
query.exec("select booksid,status from books bookcode = '" + ui->lineEdit_6->text().trimmed() + "'");
while(query.next())
{
idNum = query.value(0).toString();
bookStatus = query.value(1).toString();
}
query.exec("delete from books where bookcode = '" + ui->lineEdit_6->text().trimmed() + "'");
query.exec("insert into books values('" + idNum + "', '"
+ ui->lineEdit->text().trimmed() + "', '"
+ ui->lineEdit_2->text().trimmed() + "', '"
+ ui->lineEdit_3->text().trimmed() + "', '"
+ ui->lineEdit_4->text().trimmed() + "', '"
+ ui->lineEdit_5->text().trimmed() + "', '"
+ ui->dateEdit->date().toString("yyyy.MM.dd") + "', '"
+ bookStatus + "')");
ui->lineEdit->clear();
ui->lineEdit_2->clear();
ui->lineEdit_3->clear();
ui->lineEdit_4->clear();
ui->lineEdit_5->clear();
ui->dateEdit->setDate(QDate::currentDate());
QMessageBox::information(NULL, "success", "修改成功!");
emit modifyBook();
}
| [
"llwslc@gmail.com"
] | llwslc@gmail.com |
a8b6e5b0bba1c2cbee641f3a1a76a5553cf1ba30 | 0374c01c0f378bdeeaa84cb9b3af8f43a659f0f3 | /main.cpp | 767ff41a5a57a29f0fef63328fbf6358138fa187 | [] | no_license | nickits/maco | 159ab4bbbc7c844e30ebd493d54f1a426bab5474 | 494caf5007d85e0acade52d35caf1634c665abb5 | refs/heads/master | 2021-01-23T13:48:53.360041 | 2012-12-30T01:40:11 | 2012-12-30T01:40:11 | 2,675,505 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,848 | cpp | /*
Copyright (C) 2011 Nicki, Bulgaria.
See the LICENSE file for terms of use.
*/
#include "main.h"
#include <cppcms/service.h>
#include <cppcms/http_response.h>
#include <cppcms/http_request.h>
#include <cppcms/url_dispatcher.h>
#include <bits/stl_multimap.h>
#include <iostream>
#include <sstream>
#include "model/defines.h"
#include "utils/formgenerator.h"
Main::Main(cppcms::service& srv): application(srv)
{
dispatcher().assign("/submit", &Main::submit, this);
dispatcher().assign("/grid/(\\w+)", &Main::grid, this, 1);
dispatcher().assign("/griddata/(\\w+)", &Main::griddata, this, 1);
dispatcher().assign("/filterinit/(\\w+)", &Main::filterinit, this, 1);
dispatcher().assign("/filterpost/(\\w+)", &Main::filterpost, this, 1);
dispatcher().assign("/form/(\\w+)", &Main::form, this, 1);
dispatcher().assign("/forminit/(\\w+)/(\\d+)", &Main::forminit, this, 1, 2);
dispatcher().assign("/formpost/(\\w+)", &Main::formpost, this, 1);
dispatcher().assign("/delete/(\\w+)/(\\d+)", &Main::del, this, 1, 2);
dispatcher().assign("/(\\w+)", &Main::admin, this, 1);
}
void Main::main(std::string str)
{
cppcms::application::main(str);
}
void Main::admin(std::string arg)
{
message_admin_.entity = arg;
session().load();
int i = 0;
std::string stri = session().get("iii", "0");
std::stringstream ss;
ss.str(stri);
ss >> i;
std::cout << i++ << std::endl;
std::stringstream si;
si << i;
std::cout << si.str() << std::endl;
session().set("iii", si.str());
std::cout << session().get("iii", "0") << std::endl;
session().save();
std::cout << session().age() << std::endl;
std::cout << session().expiration() << std::endl;
render("skinback", "admin", message_admin_);
}
void Main::grid(std::string arg)
{
MapString mapParams;
getRequestData(mapParams);
FormGenerator generator(arg, mapParams, session_);
response().out() << generator.grid();
}
void Main::griddata(std::string arg)
{
MapString mapParams;
getRequestData(mapParams);
FormGenerator generator(arg, mapParams, session_);
response().out() << generator.grid_data();
}
void Main::filterinit(std::string arg)
{
MapString mapParams;
getRequestData(mapParams);
FormGenerator generator(arg, mapParams, session_);
response().out() << generator.filter();
}
void Main::filterpost(std::string arg)
{
MapString mapParams;
getRequestData(mapParams);
FormGenerator generator(arg, mapParams, session_);
response().out() << generator.filterpost();
}
void Main::getRequestData(MapString& mapParams)
{
cppcms::http::request::form_type req = request().post_or_get();
for(cppcms::http::request::form_type::iterator i = req.begin(); i != req.end(); ++i){
mapParams.insert(PairString(i->first, i->second));
}
}
void Main::admin()
{
}
void Main::form(std::string arg)
{
}
void Main::formpost(std::string arg)
{
MapString mapParams;
getRequestData(mapParams);
FormGenerator generator(arg, mapParams, session_);
response().out() << generator.formpost();
}
void Main::forminit(std::string arg, std::string id)
{
MapString mapParams;
getRequestData(mapParams);
mapParams.insert(PairString("id", id));
FormGenerator generator(arg, mapParams, session_);
response().out() << generator.form();
}
void Main::del(std::string arg, std::string id)
{
MapString mapParams;
getRequestData(mapParams);
mapParams.insert(PairString("id", id));
FormGenerator generator(arg, mapParams, session_);
response().out() << generator.del();
}
void Main::submit()
{
response().out() << "submit";
}
int main(int argc,char ** argv)
{
try {
cppcms::service srv(argc,argv);
srv.applications_pool().mount(cppcms::applications_factory<Main>());
srv.run();
}
catch(std::exception const &e) {
std::cerr << e.what() << std::endl;
}
}
| [
"nicki.ts@gmail.com"
] | nicki.ts@gmail.com |
7c0284a3f480dc7aabc9a468481e752dafc3cc99 | 016f75d6a07fd6d67ba4c1619f824c64f3809353 | /src/central_clock_main.cc | 3b99a9ddf4982b4a7ec0ca476e4d7145c8374175 | [] | no_license | zilmano/distrubuted_agent_planning | b94b4aeb17985a966fe40f1fcad172e6098c2642 | a9fb50bddef42854efe17e043ae12f4396dddea6 | refs/heads/master | 2023-07-02T04:16:18.516027 | 2021-07-21T06:43:00 | 2021-07-21T06:43:00 | 369,639,657 | 0 | 1 | null | 2021-07-18T21:33:01 | 2021-05-21T19:49:49 | C++ | UTF-8 | C++ | false | false | 851 | cc | #include <sstream>
#include "ros/ros.h"
#include "defs.h"
#include "std_msgs/String.h"
#include "distributed_mapf/ClockMsg.h"
#include <string>
using std::cout;
using std::endl;
int main(int argc, char **argv)
{
pid_t pid = getpid();
std::stringstream ss;
ss << "central_clock_" << pid;
std::string node_name = ss.str();
ros::init(argc, argv, node_name);
ros::NodeHandle n;
ros::Rate loop_rate(defs::central_clock_freq);
unsigned long clock_count = 1;
ros::Publisher clock_pub =
n.advertise<distributed_mapf::ClockMsg>(defs::clock_topic, 1000);
loop_rate.sleep();
distributed_mapf::ClockMsg clock_msg;
while (ros::ok()) {
//cout << "Clock count:" << clock_count << endl;
clock_msg.clock = clock_count;
clock_pub.publish(clock_msg);
clock_count++;
loop_rate.sleep();
}
return 0;
} | [
"zilmano@gmail.com"
] | zilmano@gmail.com |
69cad1f86c9c7cf2e0899963c716cfa87c14ec9f | fdd836226529a1d0098a8dd9c2014a53e645bcc9 | /rocksdb/misc/verify-input-data/verify.cpp | feb3f5b1731a0696d6aff6dc3b86473d03e674fe | [] | no_license | hobinyoon/mutant-misc | 41520b952964421c016d973dbd6cd29356da1f25 | b6ea031b00cda723dbd20a79884ec460c8e7c5ff | refs/heads/master | 2021-01-02T23:02:51.782760 | 2018-03-09T18:03:25 | 2018-03-09T18:03:25 | 99,450,632 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 5,569 | cpp | #include <atomic>
#include <condition_variable>
#include <memory>
#include <mutex>
#include <thread>
#include <boost/regex.hpp>
#include "concurrent-q.h"
#include "conf.h"
#include "cons.h"
#include "prog-mon.h"
#include "simtime.h"
#include "util.h"
#include "verify.h"
using namespace std;
namespace Verify {
struct TsOpOid {
long ts;
char op;
long oid;
TsOpOid()
: ts(-1), op('-'), oid(-1)
{}
TsOpOid(ifstream& ifs) {
ifs.read((char*)&ts, sizeof(ts));
ifs.read(&op, sizeof(op));
ifs.read((char*)&oid, sizeof(oid));
}
boost::posix_time::ptime TimeStamp() {
// 160711170502871000
// 012345678901234567
//
// 160711-170502.871000
return Util::ToPtime(ts);
}
string ToString() const {
// 229006591800701509
// 012345678901234567
return str(boost::format("%d %c %18d") % ts % op % oid);
}
};
ostream& operator<<(ostream& os, const TsOpOid& too) {
os << too.ToString();
return os;
}
void _VerifyFiles();
void _VerifyFile(const string& fn);
void _DumpFile(const string& fn);
void _CheckWorkloadData(const ifstream& ifs);
int _value_len;
atomic<int> _num_threads_ready_to_gen_requests(0);
// Number of workers ready
int _worker_ready = 0;
mutex _worker_ready_mutex;
condition_variable _worker_ready_cv;
int _num_workers = 0;
mutex _worker_start_generating_requests_mutex;
condition_variable _worker_start_generating_requests_cv;
bool _worker_start_generating_requests = false;
atomic<bool> _stop_requested(false);
ConcurrentQ<string> _q;
// Verify that
// - records are in the ts order
// - records intermixed by different obj_id(s)
void Run() {
// Get workload file list
{
string dn = Conf::GetDir("workload_dir");
vector<string> fns1 = Util::ListDir(dn);
int i = 0;
boost::regex e(".+/\\d\\d\\d$");
for (const auto& fn: fns1) {
boost::smatch results;
if (! boost::regex_match(fn, results, e))
continue;
_q.Push(fn);
// Useful for debugging
if (false) {
i ++;
if (i == 3) {
Cons::P(boost::format("Loaded %d for debugging") % i);
break;
}
}
}
Cons::P(boost::format("Found %d files in %s") % _q.Size() % dn);
lock_guard<mutex> lk(_worker_ready_mutex);
_num_workers = _q.Size();
}
int num_cpus = thread::hardware_concurrency();
Cons::P(boost::format("Found %d CPUs") % num_cpus);
// For debugging. Use with _DumpFile() below
if (false)
num_cpus = 1;
vector<thread> threads;
for (size_t i = 0; i < num_cpus; i ++)
threads.push_back(thread(_VerifyFiles));
for (auto& t: threads)
t.join();
}
void Stop() {
_stop_requested.exchange(true);
SimTime::WakeupSleepingThreads();
}
// Read and make request one by one. Loading everything in memory can be too
// much, especially on a EC2 node with limited memory.
void _VerifyFiles() {
try {
while (true) {
string fn;
try {
fn = _q.Pop();
} catch (const ConQEmpty& e) {
break;
}
_VerifyFile(fn);
//_DumpFile(fn);
}
} catch (const exception& e) {
Cons::P(boost::format("Got an exception: %s") % e.what());
exit(1);
}
}
void _VerifyFile(const string& fn) {
//Cons::MT _(boost::format("Verifying %s ...") % fn);
boost::timer::cpu_timer tmr;
ifstream ifs(fn, ios::binary);
size_t s;
ifs.read((char*) &s, sizeof(s));
TsOpOid* too_prev = NULL;
bool do_histogram = false;
// map<oid, map<histo_dist_from_last_oid, cnt> >
map<long , map<int, int> > oid_dist_histo;
// map<oid, last_pos>
map<long , size_t> oid_lastpos;
for (size_t i = 0; i < s; i ++) {
TsOpOid* too = new TsOpOid(ifs);
if (too_prev) {
if (too_prev->ts > too->ts) {
THROW(boost::format("[%s] [%s]") % *too_prev % *too);
// Caught an error!
// [160727121555772632 G 395893451423586438] [160716055518961815 S 499359422661863438]
}
}
if (do_histogram) {
auto it = oid_lastpos.find(too->oid);
if (it != oid_lastpos.end()) {
size_t lastpos = it->second;
int dist = i - lastpos;
auto it2 = oid_dist_histo.find(too->oid);
if (it2 == oid_dist_histo.end())
oid_dist_histo[too->oid] = map<int, int>();
auto it3 = oid_dist_histo[too->oid].find(dist);
if (it3 == oid_dist_histo[too->oid].end()) {
oid_dist_histo[too->oid][dist] = 1;
} else {
it3->second ++;
}
}
oid_lastpos[too->oid] = i;
}
if (too_prev)
delete too_prev;
too_prev = too;
}
if (too_prev)
delete too_prev;
// Print out the histogram
if (do_histogram) {
for (auto i: oid_dist_histo) {
stringstream ss;
long oid = i.first;
ss << oid << ":";
for (auto j: i.second)
ss << boost::format(" %d:%d") % j.first % j.second;
Cons::P(ss.str());
}
}
Cons::P(boost::format("Checked file %s in %.0f ms")
% fn % (tmr.elapsed().wall / 1000000.0));
}
// I can clearly see that objects are sorted by their obj_ids first and by
// their ts! Error detected!
void _DumpFile(const string& fn) {
Cons::MT _(boost::format("Dumping %s ...") % fn);
ifstream ifs(fn, ios::binary);
size_t s;
ifs.read((char*) &s, sizeof(s));
for (size_t i = 0; i < s; i ++) {
TsOpOid too(ifs);
Cons::P(too.ToString());
}
}
void _CheckWorkloadData(ifstream& ifs, size_t s, const string& fn) {
// Check data: oldest and newest ones
TsOpOid first;
bool first_set = false;
TsOpOid last;
for (size_t i = 0; i < s; i ++) {
TsOpOid too(ifs);
if (! first_set) {
first = too;
first_set = true;
}
last = too;
}
Cons::P(boost::format("%s %8d %s %s %d")
% boost::filesystem::path(fn).filename().string()
% boost::filesystem::file_size(fn)
% first % last
% (first.oid == last.oid)
);
}
}
| [
"hobinyoon@gmail.com"
] | hobinyoon@gmail.com |
c66e47f5a67b25861dabda01d33e9b8a2b22bd92 | ae6f3496a13e01c3c7221f57a5a36516a535a027 | /roboclaw-driver/src/RoboclawLib.cpp | bd45ba4bfc48dbdbda6977b5e14819491a112a3e | [
"MIT"
] | permissive | project-capo/amber-cpp-drivers | 187357608b47139d37308fb746078613319c49a8 | b040c6a8f28c15b816eb1675f6fe4d9bda58e071 | refs/heads/master | 2021-01-09T07:59:49.813232 | 2017-07-08T15:00:46 | 2017-07-08T15:00:46 | 25,423,769 | 0 | 1 | null | 2015-11-20T14:57:42 | 2014-10-19T10:22:13 | C++ | UTF-8 | C++ | false | false | 26,683 | cpp | #include <cstdio>
#include <unistd.h>
#include <linux/types.h>
#include <termios.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <strings.h>
#include <boost/thread.hpp>
#include <boost/thread/thread_time.hpp>
#include "RoboclawLib.h"
void fill_crc(__u8 *buf, int size) {
__u8 sum = 0;
for (int i = 0; i < size - 1; i++) {
sum = (__u8)(sum + buf[i]);
}
buf[size - 1] = sum & 0x7F;
}
bool check_crc(__u8 rc_address, __u8 command_id, __u8 *buf, int size) {
__u8 sum = (__u8)(rc_address + command_id);
for (int i = 0; i < size - 1; i++) {
sum = (__u8)(sum + buf[i]);
}
return buf[size - 1] == (sum & 0x7F);
}
int rc_uart_open(const char *blockdevice) {
return open(blockdevice, O_RDWR);
}
int rc_uart_close(int fd) {
return close(fd);
}
int rc_uart_init(int fd, speed_t speed)
{
struct termios termios;
bzero(&termios, sizeof(termios));
cfmakeraw(&termios);
termios.c_cflag |= (CS8 | CREAD | CLOCAL);
termios.c_cc[VMIN] = 0;
termios.c_cc[VTIME] = 1;
cfsetispeed(&termios, speed);
cfsetospeed(&termios, speed);
return tcsetattr(fd, TCSANOW, &termios);
}
ssize_t rc_uart_write(int fd, int bytes, __u8 *buf) {
ssize_t res, chars_in_tx_queue;
res = write(fd, buf, bytes);
if (res < 0) {
return -1;
}
// wait for buffer to empty
do {
boost::this_thread::sleep(boost::posix_time::microseconds(500));
ioctl (fd, TIOCOUTQ, &chars_in_tx_queue);
} while (chars_in_tx_queue > 0);
//tcdrain(fd);
return res;
}
ssize_t rc_uart_read(int fd, int to_read, __u8 *buf) {
ssize_t received;
ssize_t sum = 0;
while (sum < to_read) {
received = read(fd, buf, 1);
buf += received;
sum += received;
if (received <= 0) {
return sum;
}
}
return sum;
}
int rc_uart_flush_input(int fd) {
return tcflush(fd, TCIFLUSH);
}
int rc_gpio_open(const char *gpio_path) {
return open(gpio_path, O_WRONLY);
}
int rc_gpio_set(int gpio_fd, bool state) {
const char *command;
command = state ? "1" : "0";
ssize_t res = write(gpio_fd, command, 1);
if (res < 0) {
return -1;
}
return 0;
}
int rc_gpio_close(int gpio_fd) {
return close(gpio_fd);
}
int rc_reset(int gpio_fd) {
if (rc_gpio_set(gpio_fd, false) < 0) {
return -1;
}
boost::this_thread::sleep(boost::posix_time::microseconds(500));
if (rc_gpio_set(gpio_fd, true) < 0) {
return -1;
}
return 0;
}
int rc_drive_forward_m1(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_FORWARD_M1,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_backwards_m1(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_BACKWARDS_M1,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_set_minimum_main_voltage(int fd, __u8 rc_address, __u8 voltage) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
SET_MINIMUM_MAIN_VOLTAGE,
voltage,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_set_maximum_main_voltage(int fd, __u8 rc_address, __u8 voltage) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
SET_MAXIMUM_MAIN_VOLTAGE,
voltage,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_forward_m2(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_FORWARD_M2,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_backwards_m2(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_BACKWARDS_M2,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_m1(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_M1,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_m2(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_M2,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_forward(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_FORWARD,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_backwards(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_BACKWARDS,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_turn_right(int fd, __u8 rc_address, __u8 value) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
TURN_RIGHT,
value,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_turn_left(int fd, __u8 rc_address, __u8 value) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
TURN_LEFT,
value,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive(int fd, __u8 rc_address, __u8 speed) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
DRIVE_FORWARD_OR_BACKWARD,
speed,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_turn(int fd, __u8 rc_address, __u8 value) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
TURN_LEFT_OR_RIGHT,
value,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_read_firmware_version(int fd, __u8 rc_address, unsigned char *str) {
__u8 buffer[4] = {
rc_address,
READ_FIRMWARE_VERSION};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, 2, buffer) != 2) {
return -1;
}
ssize_t received;
int sum = 0;
unsigned char *str_t = str;
bool one_more = false;
while((received = read(fd, str_t, 1)) > 0) {
sum++;
if (one_more) {
break;
} else if(*str_t == 0x00) {
one_more = true;
}
str_t++;
}
if (received == -1 || !check_crc(rc_address, READ_FIRMWARE_VERSION, str, sum)) {
return -1;
}
return sum - 1;
}
int rc_read_main_battery_voltage_level(int fd, __u8 rc_address, __u16 *value) {
const ssize_t command_size = 2;
__u8 buffer[4] = {
rc_address,
READ_MAIN_BATTEY_VOLTAGE_LEVEL};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 3;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_MAIN_BATTEY_VOLTAGE_LEVEL, in_buffer, reply_size)) {
return -1;
}
*value = (__u16)((in_buffer[0] << 8) | in_buffer[1]);
return 0;
}
int rc_read_logic_battery_voltage_level(int fd, __u8 rc_address, __u16 *value) {
__u8 buffer[4] = {
rc_address,
READ_LOGIC_BATTERY_VOLTAGE_LEVEL};
rc_uart_flush_input(fd);
rc_uart_write(fd, 2, buffer);
const ssize_t reply_size = 3;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_LOGIC_BATTERY_VOLTAGE_LEVEL, in_buffer, reply_size)) {
return -1;
}
*value = (__u16)((in_buffer[0] << 8) | in_buffer[1]);
return 0;
}
int rc_set_minimum_logic_voltage_level(int fd, __u8 rc_address, __u8 voltage) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
SET_MINIMUM_LOGIC_VOLTAGE_LEVEL,
voltage,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_set_maximum_logic_voltage_level(int fd, __u8 rc_address, __u8 voltage) {
const ssize_t command_size = 4;
__u8 buffer[command_size] = {
rc_address,
SET_MAXIMUM_LOGIC_VOLTAGE_LEVEL,
voltage,
0x00, // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_read_encoder_register_m1(int fd, __u8 rc_address, __u32 *value, __u8 *status) {
const ssize_t command_size = 2;
__u8 buffer[2] = {
rc_address,
READ_QUADRATURE_ENCODER_REGISTER_M1};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 6;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_QUADRATURE_ENCODER_REGISTER_M1, in_buffer, reply_size)) {
return -1;
}
*value = (in_buffer[0] << 24) | (in_buffer[1] << 16) | (in_buffer[2] << 8) | in_buffer[3];
*status = in_buffer[4];
return 0;
}
int rc_read_encoder_register_m2(int fd, __u8 rc_address, __u32 *value, __u8 *status) {
const ssize_t command_size = 2;
__u8 buffer[4] = {
rc_address,
READ_QUADRATURE_ENCODER_REGISTER_M2};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 6;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_QUADRATURE_ENCODER_REGISTER_M2, in_buffer, reply_size)) {
return -1;
}
*value = (in_buffer[0] << 24) | (in_buffer[1] << 16) | (in_buffer[2] << 8) | in_buffer[3];
*status = in_buffer[4];
return 0;
}
int rc_read_speed_m1(int fd, __u8 rc_address, __u32 *value, __u8 *direction) {
const ssize_t command_size = 2;
__u8 buffer[2] = {
rc_address,
READ_SPEED_M1};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 6;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_SPEED_M1, in_buffer, reply_size)) {
return -1;
}
*value = (in_buffer[0] << 24) | (in_buffer[1] << 16) | (in_buffer[2] << 8) | in_buffer[3];
*direction = in_buffer[4];
return 0;
}
int rc_read_speed_m2(int fd, __u8 rc_address, __u32 *value, __u8 *direction) {
const ssize_t command_size = 2;
__u8 buffer[2] = {
rc_address,
READ_SPEED_M2};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 6;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_SPEED_M2, in_buffer, reply_size)) {
return -1;
}
*value = (in_buffer[0] << 24) | (in_buffer[1] << 16) | (in_buffer[2] << 8) | in_buffer[3];
*direction = in_buffer[4];
return 0;
}
int rc_set_pid_consts_m1(int fd, __u8 rc_address, __u32 d, __u32 p, __u32 i, __u32 qpps) {
const ssize_t command_size = 19;
__u8 buffer[command_size] = {
rc_address,
SET_PID_CONSTANTS_M1,
BYTE(d, 3),
BYTE(d, 2),
BYTE(d, 1),
BYTE(d, 0),
BYTE(p, 3),
BYTE(p, 2),
BYTE(p, 1),
BYTE(p, 0),
BYTE(i, 3),
BYTE(i, 2),
BYTE(i, 1),
BYTE(i, 0),
BYTE(qpps, 3),
BYTE(qpps, 2),
BYTE(qpps, 1),
BYTE(qpps, 0),
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_set_pid_consts_m2(int fd, __u8 rc_address, __u32 d, __u32 p, __u32 i, __u32 qpps) {
const ssize_t command_size = 19;
__u8 buffer[command_size] = {
rc_address,
SET_PID_CONSTANTS_M2,
BYTE(d, 3),
BYTE(d, 2),
BYTE(d, 1),
BYTE(d, 0),
BYTE(p, 3),
BYTE(p, 2),
BYTE(p, 1),
BYTE(p, 0),
BYTE(i, 3),
BYTE(i, 2),
BYTE(i, 1),
BYTE(i, 0),
BYTE(qpps, 3),
BYTE(qpps, 2),
BYTE(qpps, 1),
BYTE(qpps, 0),
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_reset_encoder_counters(int fd, __u8 rc_address) {
const ssize_t command_size = 2;
__u8 buffer[4] = {
rc_address,
RESET_QUADRATURE_ENCODER_COUNTERS};
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_read_speed125_m1(int fd, __u8 rc_address, __u32 *value) {
const ssize_t command_size = 2;
__u8 buffer[2] = {
rc_address,
READ_CURRENT_SPEED_M1};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 4;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_CURRENT_SPEED_M1, in_buffer, reply_size)) {
return -1;
}
*value = (in_buffer[0] << 24) | (in_buffer[1] << 16) | (in_buffer[2] << 8) | in_buffer[3];
return 0;
}
int rc_read_speed125_m2(int fd, __u8 rc_address, __u32 *value) {
const ssize_t command_size = 2;
__u8 buffer[2] = {
rc_address,
READ_CURRENT_SPEED_M2};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 4;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_CURRENT_SPEED_M2, in_buffer, reply_size)) {
return -1;
}
*value = (in_buffer[0] << 24) | (in_buffer[1] << 16) | (in_buffer[2] << 8) | in_buffer[3];
return 0;
}
int rc_drive_m1_speed(int fd, __u8 rc_address, __s32 speed_m) {
const ssize_t command_size = 7;
__u8 buffer[command_size] = {
rc_address,
DRIVE_M1_SPEED,
BYTE(speed_m, 3),
BYTE(speed_m, 2),
BYTE(speed_m, 1),
BYTE(speed_m, 0),
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_m2_speed(int fd, __u8 rc_address, __s32 speed_m) {
const ssize_t command_size = 7;
__u8 buffer[command_size] = {
rc_address,
DRIVE_M2_SPEED,
BYTE(speed_m, 3),
BYTE(speed_m, 2),
BYTE(speed_m, 1),
BYTE(speed_m, 0),
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_speed(int fd, __u8 rc_address, __s32 speed_m1, __s32 speed_m2) {
const ssize_t command_size = 11;
__u8 buffer[command_size] = {
rc_address,
MIX_MODE_DRIVE_SPEED,
BYTE(speed_m1, 3),
BYTE(speed_m1, 2),
BYTE(speed_m1, 1),
BYTE(speed_m1, 0),
BYTE(speed_m2, 3),
BYTE(speed_m2, 2),
BYTE(speed_m2, 1),
BYTE(speed_m2, 0),
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_m1_speed_accel(int fd, __u8 rc_address, __u32 accel, __s32 speed) {
const ssize_t command_size = 11;
__u8 buffer[command_size] = {
rc_address,
DRIVE_M1_SPEED_ACCEL,
BYTE(accel, 3),
BYTE(accel, 2),
BYTE(accel, 1),
BYTE(accel, 0),
BYTE(speed, 3),
BYTE(speed, 2),
BYTE(speed, 1),
BYTE(speed, 0),
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_m2_speed_accel(int fd, __u8 rc_address, __u32 accel, __s32 speed) {
const ssize_t command_size = 11;
__u8 buffer[command_size] = {
rc_address,
DRIVE_M2_SPEED_ACCEL,
BYTE(accel, 3),
BYTE(accel, 2),
BYTE(accel, 1),
BYTE(accel, 0),
BYTE(speed, 3),
BYTE(speed, 2),
BYTE(speed, 1),
BYTE(speed, 0),
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_drive_speed_accel(int fd, __u8 rc_address, __u32 accel, __s32 speed_m1, __s32 speed_m2) {
const ssize_t command_size = 15;
__u8 buffer[command_size] = {
rc_address,
MIX_MODE_DRIVE_SPEED_ACCEL,
BYTE(accel, 3),
BYTE(accel, 2),
BYTE(accel, 1),
BYTE(accel, 0),
BYTE(speed_m1, 3),
BYTE(speed_m1, 2),
BYTE(speed_m1, 1),
BYTE(speed_m1, 0),
BYTE(speed_m2, 3),
BYTE(speed_m2, 2),
BYTE(speed_m2, 1),
BYTE(speed_m2, 0),
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_buffered_m1_drive_speed_dist(int fd, __u8 rc_address,__s32 speed, __u32 dist, __u8 now) {
const ssize_t command_size = 12;
__u8 buffer[command_size] = {
rc_address,
BUFFERED_M1_DRIVE_SPEED_DIST,
BYTE(speed, 3),
BYTE(speed, 2),
BYTE(speed, 1),
BYTE(speed, 0),
BYTE(dist, 3),
BYTE(dist, 2),
BYTE(dist, 1),
BYTE(dist, 0),
now,
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_buffered_m2_drive_speed_dist(int fd, __u8 rc_address,__s32 speed, __u32 dist, __u8 now) {
const ssize_t command_size = 12;
__u8 buffer[command_size] = {
rc_address,
BUFFERED_M2_DRIVE_SPEED_DIST,
BYTE(speed, 3),
BYTE(speed, 2),
BYTE(speed, 1),
BYTE(speed, 0),
BYTE(dist, 3),
BYTE(dist, 2),
BYTE(dist, 1),
BYTE(dist, 0),
now,
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_buffered_drive_speed_dist(int fd, __u8 rc_address, __s32 speed_m1, __u32 dist_m1, __s32 speed_m2, __u32 dist_m2, __u8 now) {
const ssize_t command_size = 20;
__u8 buffer[command_size] = {
rc_address,
BUFFERED_MIX_MODE_DRIVE_SPEED_DIST,
BYTE(speed_m1, 3),
BYTE(speed_m1, 2),
BYTE(speed_m1, 1),
BYTE(speed_m1, 0),
BYTE(dist_m1, 3),
BYTE(dist_m1, 2),
BYTE(dist_m1, 1),
BYTE(dist_m1, 0),
BYTE(speed_m2, 3),
BYTE(speed_m2, 2),
BYTE(speed_m2, 1),
BYTE(speed_m2, 0),
BYTE(dist_m2, 3),
BYTE(dist_m2, 2),
BYTE(dist_m2, 1),
BYTE(dist_m2, 0),
now,
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_buffered_m1_drive_speed_accel_dist(int fd, __u8 rc_address, __u32 accel, __s32 speed, __u32 dist, __u8 now){
const ssize_t command_size = 16;
__u8 buffer[command_size] = {
rc_address,
BUFFERED_M1_DRIVE_SPEED_ACCEL_DIST,
BYTE(accel, 3),
BYTE(accel, 2),
BYTE(accel, 1),
BYTE(accel, 0),
BYTE(speed, 3),
BYTE(speed, 2),
BYTE(speed, 1),
BYTE(speed, 0),
BYTE(dist, 3),
BYTE(dist, 2),
BYTE(dist, 1),
BYTE(dist, 0),
now,
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_buffered_m2_drive_speed_accel_dist(int fd, __u8 rc_address, __u32 accel, __s32 speed, __u32 dist, __u8 now){
const ssize_t command_size = 16;
__u8 buffer[command_size] = {
rc_address,
BUFFERED_M2_DRIVE_SPEED_ACCEL_DIST,
BYTE(accel, 3),
BYTE(accel, 2),
BYTE(accel, 1),
BYTE(accel, 0),
BYTE(speed, 3),
BYTE(speed, 2),
BYTE(speed, 1),
BYTE(speed, 0),
BYTE(dist, 3),
BYTE(dist, 2),
BYTE(dist, 1),
BYTE(dist, 0),
now,
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_buffered_drive_speed_accel_dist(int fd, __u8 rc_address, __u32 accel, __s32 speed_m1, __u32 dist_m1, __s32 speed_m2, __u32 dist_m2, __u8 now) {
const ssize_t command_size = 24;
__u8 buffer[command_size] = {
rc_address,
BUFFERED_MIX_MODE_SPEED_ACCEL_DISTANCE,
BYTE(accel, 3),
BYTE(accel, 2),
BYTE(accel, 1),
BYTE(accel, 0),
BYTE(speed_m1, 3),
BYTE(speed_m1, 2),
BYTE(speed_m1, 1),
BYTE(speed_m1, 0),
BYTE(dist_m1, 3),
BYTE(dist_m1, 2),
BYTE(dist_m1, 1),
BYTE(dist_m1, 0),
BYTE(speed_m2, 3),
BYTE(speed_m2, 2),
BYTE(speed_m2, 1),
BYTE(speed_m2, 0),
BYTE(dist_m2, 3),
BYTE(dist_m2, 2),
BYTE(dist_m2, 1),
BYTE(dist_m2, 0),
now,
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
return 0;
}
int rc_read_temperature(int fd, __u8 rc_address, __u16* value) {
const ssize_t command_size = 2;
__u8 buffer[4] = {
rc_address,
READ_TEMPERATURE};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 3;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_TEMPERATURE, in_buffer, reply_size)) {
return -1;
}
*value = (__u16)((in_buffer[0] << 8) | in_buffer[1]);
return 0;
}
int rc_read_error_status(int fd, __u8 rc_address, __u8* error) {
const ssize_t command_size = 2;
__u8 buffer[4] = {
rc_address,
READ_ERROR_STATUS};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 2;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_ERROR_STATUS, in_buffer, reply_size)) {
return -1;
}
*error = (__u8) in_buffer[0];
return 0;
}
int rc_read_pid_const_m1(int fd, __u8 rc_address, __u32 *d, __u32 *p, __u32 *i, __u32 *qpps) {
const ssize_t command_size = 2;
__u8 buffer[4] = {
rc_address,
READ_PID_CONST_M1};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 17;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_PID_CONST_M1, in_buffer, reply_size)) {
return -1;
}
*p = (in_buffer[0] << 24) | (in_buffer[1] << 16) | (in_buffer[2] << 8) | in_buffer[3];
*i = (in_buffer[4] << 24) | (in_buffer[5] << 16) | (in_buffer[6] << 8) | in_buffer[7];
*d = (in_buffer[8] << 24) | (in_buffer[9] << 16) | (in_buffer[10] << 8) | in_buffer[11];
*qpps = (in_buffer[12] << 24) | (in_buffer[13] << 16) | (in_buffer[14] << 8) | in_buffer[15];
return 0;
}
int rc_read_pid_const_m2(int fd, __u8 rc_address, __u32 *d, __u32 *p, __u32 *i, __u32 *qpps) {
const ssize_t command_size = 2;
__u8 buffer[4] = {
rc_address,
READ_PID_CONST_M2};
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
const ssize_t reply_size = 17;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, READ_PID_CONST_M2, in_buffer, reply_size)) {
return -1;
}
*p = (in_buffer[0] << 24) | (in_buffer[1] << 16) | (in_buffer[2] << 8) | in_buffer[3];
*i = (in_buffer[4] << 24) | (in_buffer[5] << 16) | (in_buffer[6] << 8) | in_buffer[7];
*d = (in_buffer[8] << 24) | (in_buffer[9] << 16) | (in_buffer[10] << 8) | in_buffer[11];
*qpps = (in_buffer[12] << 24) | (in_buffer[13] << 16) | (in_buffer[14] << 8) | in_buffer[15];
return 0;
}
int rc_write_to_eeprom(int fd, __u8 rc_address) {
const ssize_t command_size = 3;
__u8 buffer[4] = {
rc_address,
WRITE_TO_EEPROM,
0x00 // to be filled with CRC
};
fill_crc(buffer, command_size);
rc_uart_flush_input(fd);
if (rc_uart_write(fd, command_size, buffer) != command_size) {
return -1;
}
for (int i =0; i < command_size; i++) {
printf("%x ", buffer[i]);
}
printf("\n");
const ssize_t reply_size = 1;
__u8 in_buffer[reply_size];
if (rc_uart_read(fd, reply_size, in_buffer) != reply_size ||
!check_crc(rc_address, WRITE_TO_EEPROM, in_buffer, reply_size)) {
return -1;
}
return 0;
} | [
"m4jkel@gmail.com"
] | m4jkel@gmail.com |
107141d8e603aea714afd42345c269c4c13474b2 | 709fa4aa157eb4792932012941873ffb1f12460c | /Collision - Quadtree research/Motor2D/EntityManager.h | e2ba18b8479d3a41d367f68bf1d90de93f56f60f | [
"MIT"
] | permissive | X0KA/Quadtrees-Research | 7f3d8758c1dd36dec2ca9dd456289e4ad2933854 | 2e28632ec74370ee9e9b30d16f58477eef9b3e44 | refs/heads/master | 2020-04-29T10:15:22.836476 | 2019-08-23T01:02:20 | 2019-08-23T01:02:20 | 176,055,126 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 430 | h | #ifndef __j1ENTITYMANAGER_H__
#define __j1ENTITYMANAGER_H__
#define MAX_ENEMIES 100
#define MAX_TOWERS 8
#include "j1Module.h"
#include <list>
class Entity;
class EntityManager :public j1Module
{
public:
EntityManager();
~EntityManager() {}
bool Start();
bool Update(float dt);
bool CleanUp();
public:
Entity* AddEntity(int x, int y);
public:
std::list<Entity*> entities;
};
#endif // __j1ENTITYMANAGER_H__
| [
"36265613+X0KA@users.noreply.github.com"
] | 36265613+X0KA@users.noreply.github.com |
4cfc7a462f215aaf604a7225bbb91914b4b2b01c | 2c67304879966c4df4503dd1488358749c2593fd | /C++/cppExamples-master/08_audioExamples/01_usingJack/02_oscillators/main.cpp | 423728993486ec35efd21ee68fbef1a0d9a05464 | [] | no_license | KuubuuBuubuu/CSD2 | f7530f243b03899e68cc947da4827b0f9d31d172 | 883ceb4cc960e12d4609da1f3c742ed88a913efd | refs/heads/master | 2021-06-08T12:51:49.716770 | 2020-08-03T10:33:28 | 2020-08-03T10:33:28 | 148,146,033 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,135 | cpp | #include <iostream>
#include <thread>
#include "jack_module.h"
#include "sine.h"
int main(int argc,char **argv)
{
// create a JackModule instance
JackModule jack;
// init the jack, use program name as JACK client name
jack.init(argv[0]);
//create a Sine instance
Sine sine(jack.getSamplerate(), 220, 0);
//assign a function to the JackModule::onProces
jack.onProcess = [&sine](jack_default_audio_sample_t *inBuf,
jack_default_audio_sample_t *outBuf, jack_nframes_t nframes)
{
//loop through frames, retrieve sample of sine per frame
for(unsigned int i = 0; i < nframes; i++) {
//TODO check type of jack_default_audio_sample_t, double? or float?
outBuf[i] = sine.getSample();
sine.tick();
}
return 0;
};
jack.autoConnect();
//keep the program running and listen for user input, q = quit
std::cout << "\n\nPress 'q' when you want to quit the program.\n";
bool running = true;
while (running)
{
switch (std::cin.get())
{
case 'q':
running = false;
jack.end();
break;
}
}
//end the program
return 0;
} // main()
| [
"kayawsm@hotmail.com"
] | kayawsm@hotmail.com |
a0fa9bb46e159999c4175f9724efd4d3834ad745 | 5d903dbf8025c0b388e9b10d081baf44c625a361 | /Source/MutilDevWinComponent.h | 6e84bc3baa98a4f603f0b977ad67c93f13808757 | [] | no_license | yichui/XTOUCH_FOR_WINDOWS | be3dc5082756184c5561f301389a13192dcbf59b | 30758fb9390b1db100ee34c2dec13caaa7d81a91 | refs/heads/master | 2021-01-12T17:43:22.770459 | 2016-10-22T13:02:57 | 2016-10-22T13:02:57 | 71,630,540 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,560 | h | /*
==============================================================================
This is an automatically generated GUI class created by the Introjucer!
Be careful when adding custom code to these files, as only the code within
the "//[xyz]" and "//[/xyz]" sections will be retained when the file is loaded
and re-saved.
Created with Introjucer version: 3.1.0
------------------------------------------------------------------------------
The Introjucer is part of the JUCE library - "Jules' Utility Class Extensions"
Copyright 2004-13 by Raw Material Software Ltd.
==============================================================================
*/
#ifndef __JUCE_HEADER_E7545BDEAB99567E__
#define __JUCE_HEADER_E7545BDEAB99567E__
//[Headers] -- You can add your own extra header files here --
#include "JuceHeader.h"
#include "MyTextButton.h"
#include "LookAndFeel_V4.h"
//[/Headers]
//==============================================================================
/**
//[Comments]
An auto-generated component, created by the Introjucer.
Describe your class and how it works here!
//[/Comments]
*/
class MutilDevWinComponent : public Component,
public ButtonListener
{
public:
//==============================================================================
MutilDevWinComponent ();
~MutilDevWinComponent();
//==============================================================================
//[UserMethods] -- You can add your own custom methods in this section.
//[/UserMethods]
void paint (Graphics& g);
void resized();
void buttonClicked (Button* buttonThatWasClicked);
private:
//[UserVariables] -- You can add your own custom variables in this section.
LookAndFeel_V4 lookAndFeelV4;
//Array<ScopedPointer<MyTextButton>> MyTextButtonlist;
ScopedPointer<MyTextButton> CompactDummy;
ScopedPointer<MyTextButton> MiniDummy;
ScopedPointer<MyTextButton> MyTextButtonlist[20];
//[/UserVariables]
//==============================================================================
ScopedPointer<TextButton> textButton;
//==============================================================================
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (MutilDevWinComponent)
};
//[EndFile] You can add extra defines here...
//[/EndFile]
#endif // __JUCE_HEADER_E7545BDEAB99567E__
| [
"896873144@qq.com"
] | 896873144@qq.com |
30b299bf314f23f1a98d7722fd79eda79778cef9 | cabbd12c9f2fa13af3e541bedc494e3e61b55c61 | /Shapebox/shapes/Triangle.h | 58cd40f03b2854d6095f8c3bf083000db0f1762e | [] | no_license | ajcarvajal/oldclasses | 2e978a44b3b5d237c4192d9302e79c9fdb5e6b5e | 5e3eda3dd11c2ca5ffaf22bc1a2932fd255f3e2a | refs/heads/master | 2021-07-24T04:50:32.021261 | 2020-06-08T03:59:10 | 2020-06-08T03:59:10 | 182,876,696 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 101 | h | #pragma once
#include "Polygon.h"
class Triangle : public Polygon
{
public:
Triangle(double);
};
| [
"alanjcarv@gmail.com"
] | alanjcarv@gmail.com |
3802701f35db910c6c7cdde0c174898a836866dc | ac227cc22d5f5364e5d029a2cef83816a6954590 | /applications/physbam/physbam-lib/Public_Library/PhysBAM_Rendering/PhysBAM_OpenGL/OpenGL_Components/OPENGL_COMPONENT_SCALAR_FIELD_3D.cpp | 7a5af7122d6f46f35d78359045a37734c5996365 | [
"BSD-3-Clause"
] | permissive | schinmayee/nimbus | 597185bc8bac91a2480466cebc8b337f5d96bd2e | 170cd15e24a7a88243a6ea80aabadc0fc0e6e177 | refs/heads/master | 2020-03-11T11:42:39.262834 | 2018-04-18T01:28:23 | 2018-04-18T01:28:23 | 129,976,755 | 0 | 0 | BSD-3-Clause | 2018-04-17T23:33:23 | 2018-04-17T23:33:23 | null | UTF-8 | C++ | false | false | 7,801 | cpp | //#####################################################################
// Copyright 2004-2009, Eran Guendelman, Geoffrey Irving, Andrew Selle.
// This file is part of PhysBAM whose distribution is governed by the license contained in the accompanying file PHYSBAM_COPYRIGHT.txt.
//#####################################################################
#include <PhysBAM_Tools/Grids_Uniform/UNIFORM_GRID_ITERATOR_CELL.h>
#include <PhysBAM_Tools/Grids_Uniform_Arrays/ARRAYS_ND.h>
#include <PhysBAM_Tools/Grids_Uniform_Interpolation/LINEAR_INTERPOLATION_UNIFORM.h>
#include <PhysBAM_Tools/Read_Write/Grids_Uniform_Arrays/READ_WRITE_ARRAYS.h>
#include <PhysBAM_Tools/Read_Write/Utilities/FILE_UTILITIES.h>
#include <PhysBAM_Rendering/PhysBAM_OpenGL/OpenGL_Components/OPENGL_COMPONENT_SCALAR_FIELD_3D.h>
using namespace PhysBAM;
template<class T,class T2,class RW> OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
OPENGL_COMPONENT_SCALAR_FIELD_3D(const GRID<TV> &grid_input,OPENGL_COLOR_MAP<T2>* color_map_input)
: OPENGL_COMPONENT("Scalar Field 3D"), opengl_scalar_field(grid_input,*new ARRAY<T2,VECTOR<int,3> >,color_map_input),
scalar_field_filename(""), frame_loaded(-1), valid(false)
{
opengl_scalar_field.values.Resize(grid_input.Domain_Indices());
is_animation = true;
}
template<class T,class T2,class RW> OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
OPENGL_COMPONENT_SCALAR_FIELD_3D(const GRID<TV> &grid_input, const std::string &scalar_field_filename_input,OPENGL_COLOR_MAP<T2>* color_map_input)
: OPENGL_COMPONENT("Scalar Field 3D"), opengl_scalar_field(grid_input,*new ARRAY<T2,VECTOR<int,3> >,color_map_input),
scalar_field_filename(scalar_field_filename_input), frame_loaded(-1), valid(false)
{
is_animation = FILE_UTILITIES::Is_Animated(scalar_field_filename);
}
template<class T,class T2,class RW> OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
OPENGL_COMPONENT_SCALAR_FIELD_3D(const GRID<TV> &grid_input, const std::string &scalar_field_filename_input,OPENGL_COLOR_MAP<T2>* color_map_input,
typename OPENGL_SCALAR_FIELD_3D<T,T2>::DRAW_MODE draw_mode_input)
: OPENGL_COMPONENT("Scalar Field 3D"), opengl_scalar_field(grid_input,*new ARRAY<T2,VECTOR<int,3> >,color_map_input,draw_mode_input),
scalar_field_filename(scalar_field_filename_input), frame_loaded(-1), valid(false)
{
is_animation = FILE_UTILITIES::Is_Animated(scalar_field_filename);
}
template<class T,class T2,class RW> OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
~OPENGL_COMPONENT_SCALAR_FIELD_3D()
{
delete &opengl_scalar_field.values;
}
template<class T,class T2,class RW> bool OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Valid_Frame(int frame_input) const
{
return FILE_UTILITIES::Frame_File_Exists(scalar_field_filename, frame_input);
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Set_Frame(int frame_input)
{
OPENGL_COMPONENT::Set_Frame(frame_input);
Reinitialize();
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Set_Draw(bool draw_input)
{
OPENGL_COMPONENT::Set_Draw(draw_input);
if (draw_input) opengl_scalar_field.Set_Slice(slice);
Reinitialize();
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Display(const int in_color) const
{
if (valid && draw) opengl_scalar_field.Display(in_color);
}
template<class T,class T2,class RW> RANGE<VECTOR<float,3> > OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Bounding_Box() const
{
if (valid && draw) return opengl_scalar_field.Bounding_Box();
else return RANGE<VECTOR<float,3> >::Centered_Box();
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Print_Selection_Info(std::ostream& output_stream,OPENGL_SELECTION* current_selection) const
{
if(Is_Up_To_Date(frame)){
output_stream<<component_name<<": ";
opengl_scalar_field.Print_Selection_Info(output_stream,current_selection);}
}
template<class T> void
Reinitialize_From_Simulation_Helper(const GRID<VECTOR<T,3> >& grid,const GRID<VECTOR<T,3> >& coarse_grid,ARRAY<int,VECTOR<int,3> > &values,const ARRAY<int,VECTOR<int,3> > &simulated_values)
{
PHYSBAM_FATAL_ERROR();
}
template<class T> void
Reinitialize_From_Simulation_Helper(const GRID<VECTOR<T,3> >& grid,const GRID<VECTOR<T,3> >& coarse_grid,ARRAY<bool,VECTOR<int,3> > &values,const ARRAY<bool,VECTOR<int,3> > &simulated_values)
{
PHYSBAM_FATAL_ERROR();
}
template<class T> void
Reinitialize_From_Simulation_Helper(const GRID<VECTOR<T,3> >& grid,const GRID<VECTOR<T,3> >& coarse_grid,ARRAY<T,VECTOR<int,3> > &values,const ARRAY<T,VECTOR<int,3> > &simulated_values)
{
typedef VECTOR<T,3> TV;
LINEAR_INTERPOLATION_UNIFORM<GRID<TV>,T> interpolation;
for(typename GRID<TV>::CELL_ITERATOR iterator(grid);iterator.Valid();iterator.Next())
values(iterator.Cell_Index())=interpolation.Clamped_To_Array(coarse_grid,simulated_values,iterator.Location());
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Reinitialize_From_Simulation()
{
if(draw){
if((is_animation && frame_loaded != frame) || (!is_animation && frame_loaded < 0)){
valid = false;
if(opengl_scalar_field.values_simulated){
if(opengl_scalar_field.upsample_scale>1) Reinitialize_From_Simulation_Helper(opengl_scalar_field.grid,*opengl_scalar_field.coarse_grid,opengl_scalar_field.values,*opengl_scalar_field.values_simulated);
else for(typename GRID<TV>::CELL_ITERATOR iterator(opengl_scalar_field.grid);iterator.Valid();iterator.Next()) opengl_scalar_field.values(iterator.Cell_Index())=(*opengl_scalar_field.values_simulated)(iterator.Cell_Index());}
opengl_scalar_field.Update();
frame_loaded = frame;
valid = true;}}
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Reinitialize()
{
if(is_interactive) Reinitialize_From_Simulation();
else if(draw){
if((is_animation && frame_loaded != frame) || (!is_animation && frame_loaded < 0)){
valid = false;
std::string filename=FILE_UTILITIES::Get_Frame_Filename(scalar_field_filename,frame);
if (FILE_UTILITIES::File_Exists(filename)) FILE_UTILITIES::Read_From_File<RW>(filename,opengl_scalar_field.values);
else return;
opengl_scalar_field.Update();
frame_loaded = frame;
valid = true;}}
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Toggle_Smooth_Slice()
{
opengl_scalar_field.Toggle_Smooth_Slice_Texture();
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Toggle_Draw_Mode()
{
opengl_scalar_field.Toggle_Draw_Mode();
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Toggle_Color_Map()
{
opengl_scalar_field.Toggle_Color_Map();
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Toggle_Increase_Color_Map_Range()
{
opengl_scalar_field.Increase_Scale_Range();
}
template<class T,class T2,class RW> void OPENGL_COMPONENT_SCALAR_FIELD_3D<T,T2,RW>::
Toggle_Decrease_Color_Map_Range()
{
opengl_scalar_field.Decrease_Scale_Range();
}
template class OPENGL_COMPONENT_SCALAR_FIELD_3D<float,int,float>;
template class OPENGL_COMPONENT_SCALAR_FIELD_3D<float,bool,float>;
template class OPENGL_COMPONENT_SCALAR_FIELD_3D<float,float,float>;
#ifndef COMPILE_WITHOUT_DOUBLE_SUPPORT
template class OPENGL_COMPONENT_SCALAR_FIELD_3D<double,int,double>;
template class OPENGL_COMPONENT_SCALAR_FIELD_3D<double,bool,double>;
template class OPENGL_COMPONENT_SCALAR_FIELD_3D<double,double,double>;
#endif
| [
"quhang@stanford.edu"
] | quhang@stanford.edu |
7d3368738b17bebc2d1c204bc481eb694e6bdd05 | 6258de2aeb36cc728c998c107013ccd3f4ec29f1 | /브루트포스/브루트포스/테트리스_3019.cpp | ad3e97e0b0b072a959771ed1bd6750762390f17d | [] | no_license | gihop/AlgorithmStudy | ac1f885ad03ba896d5b88334aaedc8a385d2fb48 | 281d786f4e6fc51bceb69fbc8684ab9485489012 | refs/heads/master | 2021-06-30T11:57:18.768253 | 2021-05-07T15:56:46 | 2021-05-07T15:56:46 | 230,912,854 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,578 | cpp | //
// 테트리스_3019.cpp
// 브루트포스
//
// Created by jiho park on 2020/01/18.
// Copyright © 2020 jiho park. All rights reserved.
//
#include <iostream>
using namespace std;
int main(){
int C[100];
int c, p, ans=0;
cin >> c >> p;
for(int i=0; i<c; i++)
cin >> C[i];
switch(p){
case 1:
for(int i=0; i<c-3; i++)
if(C[i]==C[i+1] && C[i+1]==C[i+2] && C[i+2]==C[i+3])
ans++;
ans += c;
break;
case 2:
for(int i=0; i<c-1; i++)
if(C[i]==C[i+1])
ans++;
break;
case 3:
for(int i=0; i<c-2; i++)
if(C[i]==C[i+1] && C[i+1]==C[i+2]-1)
ans++;
for(int i=0; i<c-1; i++)
if(C[i]-1==C[i+1])
ans++;
break;
case 4:
for(int i=0; i<c-2; i++)
if(C[i]-1==C[i+1] && C[i+1]==C[i+2])
ans++;
for(int i=0; i<c-1; i++)
if(C[i]==C[i+1]-1)
ans++;
break;
case 5:
for(int i=0; i<c-2; i++){
if(C[i]==C[i+1] && C[i+1]==C[i+2])
ans++;
if(C[i]==C[i+1]+1 && C[i+1]+1==C[i+2])
ans++;
}
for(int i=0; i<c-1; i++){
if(C[i]==C[i+1]-1)
ans++;
if(C[i]==C[i+1]+1)
ans++;
}
break;
case 6:
for(int i=0; i<c-2; i++){
if(C[i]==C[i+1] && C[i+1]==C[i+2])
ans++;
if(C[i]+1==C[i+1] && C[i+1]==C[i+2])
ans++;
}
for(int i=0; i<c-1; i++){
if(C[i]==C[i+1]+2)
ans++;
if(C[i]==C[i+1])
ans++;
}
break;
case 7:
for(int i=0; i<c-2; i++){
if(C[i]==C[i+1] && C[i+1]==C[i+2])
ans++;
if(C[i]==C[i+1] && C[i+1]==C[i+2]+1)
ans++;
}
for(int i=0; i<c-1; i++){
if(C[i]==C[i+1]-2)
ans++;
if(C[i]==C[i+1])
ans++;
}
break;
}
cout << ans;
return 0;
}
| [
"giho-p@hanmail.net"
] | giho-p@hanmail.net |
aee40c6e7f1cf4b78d6af849e136536fca97d381 | f80a589a69d00a4fd360d44deb38c3ca949da994 | /fastq2agd/src/agd_writer.cc | 79986a005614aca99fa1f4eebc4836d4c2bef705 | [] | no_license | sbyma/viralign | 9639868a3461ba0dfa254f2e1b57ddcbade1fde4 | 9d3898d51031428e01fcb7d8890ff339ce04ed87 | refs/heads/master | 2022-08-01T02:46:08.460672 | 2020-05-26T07:10:19 | 2020-05-26T07:10:19 | 250,788,403 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,528 | cc |
#include "agd_writer.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fstream>
#include <iostream>
#include "absl/strings/str_cat.h"
#include "libagd/src/format.h"
using namespace std;
void CreateIfNotExist(const std::string& output_dir) {
struct stat info;
if (stat(output_dir.c_str(), &info) != 0) {
// doesnt exist, create
cout << "creating dir " << output_dir << "\n";
int e = mkdir(output_dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
if (e != 0) {
cout << "could not create output dir " << output_dir << ", exiting ...\n";
exit(0);
}
} else if (!(info.st_mode & S_IFDIR)) {
// exists but not dir
cout << "output dir exists but is not dir, exiting ...\n";
exit(0);
} else {
// dir exists, nuke
// im too lazy to do this the proper way
string cmd = absl::StrCat("rm -rf ", output_dir, "/*");
cout << "dir " << output_dir << " exists, nuking ...\n";
int nuke_result = system(cmd.c_str());
if (nuke_result != 0) {
cout << "Could not nuke dir " << output_dir << "\n";
exit(0);
}
}
}
Status AGDWriter::Init(const std::string& output_dir) {
CreateIfNotExist(output_dir);
output_dir_ = output_dir;
return Status::OK();
}
Status AGDWriter::Write(const OutputQueueItem& item) {
// combine with header and write chunk files
agd::format::FileHeader header;
header.record_type = agd::format::RecordType::TEXT;
header.compression_type = agd::format::CompressionType::GZIP;
memset(header.string_id, 0, sizeof(agd::format::FileHeader::string_id));
auto copy_size =
min(dataset_name_.size(), sizeof(agd::format::FileHeader::string_id));
strncpy(&header.string_id[0], dataset_name_.c_str(), copy_size);
header.first_ordinal = item.first_ordinal;
header.last_ordinal = item.first_ordinal + item.columns.chunk_size;
auto bases_name = absl::StrCat(output_dir_, dataset_name_, "_",
header.first_ordinal, ".base");
auto qual_name = absl::StrCat(output_dir_, dataset_name_, "_",
header.first_ordinal, ".qual");
auto meta_name = absl::StrCat(output_dir_, dataset_name_, "_",
header.first_ordinal, ".meta");
std::ofstream bases_file(bases_name, std::ios::binary);
bases_file.write(reinterpret_cast<const char*>(&header), sizeof(header));
bases_file.write(item.columns.base->data(), item.columns.base->size());
if (!bases_file.good()) {
return errors::Internal("Failed to write bases file ", bases_name);
}
bases_file.close();
std::ofstream qual_file(qual_name, std::ios::binary);
qual_file.write(reinterpret_cast<const char*>(&header), sizeof(header));
qual_file.write(item.columns.qual->data(), item.columns.qual->size());
if (!qual_file.good()) {
return errors::Internal("Failed to write qual file ", qual_name);
}
qual_file.close();
std::ofstream meta_file(meta_name, std::ios::binary);
meta_file.write(reinterpret_cast<const char*>(&header), sizeof(header));
meta_file.write(item.columns.meta->data(), item.columns.meta->size());
if (!meta_file.good()) {
return errors::Internal("Failed to write meta file ", meta_name);
}
meta_file.close();
nlohmann::json j;
j["first"] = item.first_ordinal;
j["last"] = item.first_ordinal + item.columns.chunk_size;
j["path"] = absl::StrCat(dataset_name_, "_", header.first_ordinal);
records_.push_back(j);
return Status::OK();
} | [
"stuart.byma@epfl.ch"
] | stuart.byma@epfl.ch |
cc2d6736ef225a8f804e1f7fb002d6473ad232fe | b22588340d7925b614a735bbbde1b351ad657ffc | /athena/Tracking/TrkFitter/TrkiPatFitterUtils/src/FitMatrices.cxx | 24b489c807101545ddb68af8b2020de832333bc5 | [] | no_license | rushioda/PIXELVALID_athena | 90befe12042c1249cbb3655dde1428bb9b9a42ce | 22df23187ef85e9c3120122c8375ea0e7d8ea440 | refs/heads/master | 2020-12-14T22:01:15.365949 | 2020-01-19T03:59:35 | 2020-01-19T03:59:35 | 234,836,993 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,283 | cxx | /*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////////////////////////////
// class FitMatrices
// Storage and manipulation of matrices during track fitting
// (note the actual matrices are structs (FitMatrix.h) to give faster execution)
//
// Given matrix of measurement derivatives wrt fit parameters (DerivativeMatrix DM)
// and vector of differences between measurements and fitted trajectory,
// solve for:
// parameter weight matrix = (covariance)-1 = DMtranspose.DM
// parameter change = (DMtranspose.DM)-1 * (DMtranspose.differences)
//
// NOTE:
// covariances, derivatives etc, use d0, z0, phi, cot(theta), qOverPt as first 5 parameters
// distinguish: full covariance with all parameters:
// includes misalignments, scattering and energy loss
// 5*5 final covariance with possible external contribution representing
// leading material and field gradient effects
//
// (c) ATLAS tracking software
//////////////////////////////////////////////////////////////////////////////
//<<<<<< INCLUDES >>>>>>
#include <iomanip>
#include <iostream>
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/SystemOfUnits.h"
#include "TrkExUtils/TrackSurfaceIntersection.h"
#include "TrkiPatFitterUtils/FitMatrices.h"
#include "TrkiPatFitterUtils/FitMatrix.h"
#include "TrkiPatFitterUtils/FitMeasurement.h"
#include "TrkiPatFitterUtils/FitParameters.h"
//<<<<<< CLASS STRUCTURE INITIALIZATION >>>>>>
namespace Trk{
FitMatrices::FitMatrices(bool constrainedAlignmentEffects)
: m_columnsDM (0),
m_constrainedAlignmentEffects (constrainedAlignmentEffects),
m_covariance (0),
m_derivativeMatrix (0),
m_finalCovariance (0),
m_largePhiWeight (10000.), // arbitrary - equiv to 10um
m_matrixFromCLHEP (false),
m_measurements (0),
m_numberDoF (0),
m_numberDriftCircles (0),
m_numberPerigee (5),
m_parameters (0),
m_perigee (0),
m_perigeeDifference (Amg::MatrixX(1,m_numberPerigee)),
m_perigeeWeight (0),
m_residuals (0),
m_rowsDM (0),
m_usePerigee (false),
m_weight (0),
m_weightedDifference (0)
{}
FitMatrices::~FitMatrices(void)
{
delete m_covariance;
delete m_derivativeMatrix;
delete m_finalCovariance;
delete m_residuals;
delete m_weight;
delete m_weightedDifference;
}
//<<<<<< PUBLIC MEMBER FUNCTION DEFINITIONS >>>>>>
void
FitMatrices::checkPointers (MsgStream& log) const
{
// debugging: check smart pointers
for (int col = 0; col < m_columnsDM; ++col)
{
// firstRow
for (int i = 0; i < m_firstRowForParameter[col]; ++i)
{
if (fitMatrix.derivative[i][col] != 0.)
log << " col " << col
<< " unexpected first nonzero DM element " << i << " / "
<< m_firstRowForParameter[col] << endmsg;
}
int j = m_firstRowForParameter[col];
if (fitMatrix.derivative[j][col] == 0.)
log << " col " << col
<< " first nonzero DM element is zero! " << j << " / "
<< m_firstRowForParameter[col] << endmsg;
// lastRow
for (int i = m_lastRowForParameter[col]; i < m_rowsDM; ++i)
{
if (fitMatrix.derivative[i][col] != 0.)
log << " col " << col
<< " unexpected last nonzero DM element " << i << " / "
<< m_lastRowForParameter[col] << endmsg;
}
}
}
double
FitMatrices::chiSquaredChange (void) const
{
// TODO: eigen
// // not applicable when matrix has been inverted already
// if (! m_numberDoF || ! m_weightMA27 || m_covariance) return 0.;
// AlVec diffAl = m_parameters->differencesMA27();
// Amg::VectorX diff(m_columnsDM);
// for (int i = 0; i != m_columnsDM; ++i) diff[i] = diffAl[i];
// if (m_matrixFromCLHEP)
// {
// // return m_weightCLHEP->similarity(diff)/static_cast<double>(m_numberDoF);
// return 0;
// }
// else
// {
// Amg::MatrixX weight(m_columnsDM,m_columnsDM);
// for (int i = 0; i != m_columnsDM; ++i)
// {
// for (int j = 0; j != m_columnsDM; ++j) weight(i,j) = (*m_weightMA27)[j][i];
// }
// return (diff * weight * diff.transpose())(0,0) / static_cast<double>(m_numberDoF);
// }
////
std::cout << " unexpected :chiSquaredChange " << std::endl;
return 0.;
////
}
const Amg::MatrixX*
FitMatrices::fullCovariance (void)
{
// return result if matrix already inverted
if (m_covariance) return m_covariance;
m_covariance = new Amg::MatrixX(m_columnsDM,m_columnsDM);
// fix weighting ???? shouldn't we just remove large phi weight?
if (m_parameters->phiInstability()) solveEquations();
// invert weight matrix
Amg::MatrixX& covariance = *m_covariance;
int failure = 0;
// avoid singularity through ill-defined momentum ???? again
avoidMomentumSingularity();
// neater - but gives small rounding-like diffs wrt matrix copy version
// keep matrix copy for release 21 to avoid rounding changes at Tier0
// covariance = (*m_weight).inverse();
// matrix copy version (legacy of MA27 which needed copy between matrix packages)
Amg::MatrixX weight(m_columnsDM,m_columnsDM);
weight.selfadjointView<0x2>();
weight = (*m_weight).inverse();
for (int row = 0; row != m_columnsDM; ++row)
{
for (int col = 0; col != m_columnsDM; ++col) covariance(row,col) = weight(col,row);
}
// trap singular matrix
if (failure)
{
delete m_covariance;
m_covariance = 0;
return 0;
}
// back convert curved fits to Tracking units (MeV)
if (m_parameters->fitMomentum())
{
// transform to MeV
double d4 = 1./Gaudi::Units::TeV;
for (int row = 0; row < m_columnsDM; ++row)
{
covariance(4,row) *= d4;
covariance(row,4) = covariance(4,row);
}
covariance(4,4) *= d4;
// transform units for fitted energy deposit (for now fit qOverP at calo exit)
if (m_parameters->fitEnergyDeposit())
{
double d5 = 1./Gaudi::Units::TeV;
for (int row = 0; row < m_columnsDM; ++row)
{
covariance(5,row) *= d5;
covariance(row,5) = covariance(5,row);
}
covariance(5,5) *= d5;
}
}
// FIXME: errors underestimated on d0,z0 when large scatterer precedes precise measurements
// final covariance starts with 5*5 representing perigee from full covariance
delete m_finalCovariance;
m_finalCovariance = new Amg::MatrixX(5,5);
for (int i = 0; i != 5; ++i)
{
for (int j = 0; j != 5; ++j)
{
(*m_finalCovariance)(i,j) = covariance(i,j);
}
}
// return pointer to full covariance
return m_covariance;
}
double
FitMatrices::perigeeChiSquared (void)
{
m_perigeeDifference = m_parameters->parameterDifference(*m_perigee);
return (m_perigeeDifference * (*m_perigeeWeight) * m_perigeeDifference.transpose())(0,0);
}
void
FitMatrices::printDerivativeMatrix (void)
{
std::cout << "DerivativeMatrix: rows * columns " << m_rowsDM << " * "
<< m_columnsDM << " numberDoF " << m_numberDoF << std::endl;
int firstCol = 0;
int lastCol = 0;
if (! m_measurements) return;
std::vector<FitMeasurement*>::iterator m = m_measurements->begin();
std::vector<FitMeasurement*> alignmentfm;
FitMeasurement* fm = *m;
bool singleRow = true;
for (int row = 0; row < m_rowsDM; ++row)
{
// get corresponding FitMeasurement
if (singleRow)
{
while (m != m_measurements->end() && (! (**m).numberDoF() || (**m).isAlignment()))
{
if ((**m).isAlignment()) alignmentfm.push_back(*m);
++m;
}
if (m != m_measurements->end())
{
fm = *m;
}
else
{
fm = alignmentfm.back();
alignmentfm.pop_back();
}
firstCol = fm->firstParameter();
lastCol = fm->lastParameter() - 1;
std::cout << std::endl << std::setiosflags(std::ios::fixed);
if (fm->isPositionMeasurement())
{
std::cout << "measurement";
}
else if (fm->isScatterer())
{
std::cout << "scatterer ";
}
else if (fm->isEnergyDeposit())
{
std::cout << "energyDepos";
}
else if (fm->isAlignment())
{
std::cout << "alignment ";
}
else
{
std::cout << " ?? ";
}
if (fm->is2Dimensional())
{
singleRow = false;
}
else
{
if (m != m_measurements->end()) ++m;
}
std::cout << " row " << std::setw(3) << row << " col 0 ";
}
else
{
if (m != m_measurements->end()) ++m;
singleRow = true;
std::cout << std::endl << std::setiosflags(std::ios::fixed)
<< " row " << std::setw(3) << row << " col 0 ";
}
for (int col = 0; col < m_columnsDM; ++col)
{
if (col < firstCol || col > lastCol) // m_firstRowForParameter[row])
{
if (fitMatrix.derivative[row][col] == 0.)
{
std::cout << " ";
}
else
{
// flag out-of-order
std::cout << std::setiosflags(std::ios::scientific) << std::setbase(10)
<< "<" <<std::setw(10) << fitMatrix.derivative[row][col] << ">";
}
}
else
{
std::cout << std::setiosflags(std::ios::scientific) << std::setbase(10)
<< std::setw(10) << fitMatrix.derivative[row][col] << " ";
}
if ((col+1)%12 == 0 && col+1 < m_columnsDM)
std::cout << std::endl << std::setiosflags(std::ios::fixed)
<< " col " << std::setw(3) << col+1 << " ";
}
}
std::cout << std::endl;
}
void
FitMatrices::printWeightMatrix (void)
{
std::cout << std::endl << "WeightMatrix: symmetric with rank " << m_columnsDM;
for (int row = 0; row < m_columnsDM; ++row)
{
std::cout << std::endl << std::setiosflags(std::ios::fixed)
<< " row " << std::setw(3) << row << " col 0 ";
for (int col = 0; col <= row; ++col)
{
std::cout << std::setiosflags(std::ios::scientific) << std::setbase(10)
<< std::setw(10) << (*m_weight)(row,col) << " ";
if ((col+1)%13 == 0 && col < row)
std::cout << std::endl << std::setiosflags(std::ios::fixed)
<< " col " << std::setw(3) << col+1 << " ";
}
}
std::cout << std::endl;
}
void
FitMatrices::refinePointers (void)
{
// remove leading and trailing zeroes from smart pointers
for (int col = 0; col < m_columnsDM; ++col)
{
int i = m_firstRowForParameter[col];
int j = m_lastRowForParameter[col];
if (fitMatrix.derivative[i][col] == 0. && i < --j)
{
while (i != j && fitMatrix.derivative[i][col] == 0.) ++i;
m_firstRowForParameter[col] = i;
}
if (fitMatrix.derivative[j][col] == 0. && j > i)
{
while (j != i && fitMatrix.derivative[j][col] == 0.) --j;
m_lastRowForParameter[col] = ++j;
}
}
}
void
FitMatrices::releaseMemory (void)
{
delete m_derivativeMatrix;
delete m_weight;
delete m_weightedDifference;
m_derivativeMatrix = 0;
m_weight = 0;
m_weightedDifference = 0;
}
int
FitMatrices::setDimensions (std::vector<FitMeasurement*>& measurements,
FitParameters* parameters)
{
// keep pointer for debug purposes
m_measurements = &measurements;
// only use perigee on request (from special fit types)
m_usePerigee = false;
// count rows, misalignments and scatterers from loop over FitMeasurements
m_firstRowForParameter.clear();
m_firstRowForParameter.reserve(128);
m_lastRowForParameter.clear();
m_lastRowForParameter.reserve(128);
m_parameters = parameters;
delete m_residuals;
m_residuals = new std::vector<double>(2*measurements.size(), 0.);
m_numberDriftCircles = 0;
bool haveMeasurement = false;
bool haveVertex = false;
int numberAlignments = 0;
int numberEnergyDeposits = 0;
int numberParameters = 5;
int numberScatterers = 0;
int row = 0;
// keep first row with measurements up to each number of parameters
m_firstRowForParameter = std::vector<int>(numberParameters,-1);
std::vector<FitMeasurement*>::iterator m = measurements.begin();
if ((**m).isVertex())
{
haveVertex = true;
m_firstRowForParameter[row] = row;
// set pointers into big matrix
(**m).derivative(&fitMatrix.derivative[row][0]);
(**m).residual(row+m_residuals->begin());
++row;
if ((**m).is2Dimensional())
{
m_firstRowForParameter[row] = row;
(**m).derivative2(&fitMatrix.derivative[row][0]);
++row;
}
++m;
}
// allocate rows to fitted measurements (DoF > 0)
for ( ; m != measurements.end(); ++m)
{
if (! (**m).numberDoF()) continue;
// alignment rows come after scattering
if ((**m).isAlignment()) continue;
// identify leading material
if (! haveMeasurement)
{
if ((**m).isPositionMeasurement())
{
haveMeasurement = true;
for (int i = 0; i < numberParameters; ++i)
if (m_firstRowForParameter[i] < 0) m_firstRowForParameter[i] = row;
}
else if (! haveVertex && (**m).isScatterer())
{
(**m).numberDoF(0);
continue;
}
else
{
// row += (**m).numberDoF();
}
}
// only allocate rows to fitted measurements (DoF > 0)
// if (! (**m).numberDoF()) continue;
if ((**m).isDrift()) ++m_numberDriftCircles;
// fit energyDeposit unless momentum fixed or near infinite
if ((**m).isEnergyDeposit())
{
// if (! m_parameters->fitMomentum() || m_parameters->extremeMomentum())
if (! m_parameters->fitMomentum())
{
(**m).numberDoF(0);
continue;
}
else
{
if (m_firstRowForParameter.back() < 0)
m_firstRowForParameter.back() = row;
// m_firstRowForParameter[numberParameters-1] = row;
m_firstRowForParameter.push_back(row);
m_parameters->fitEnergyDeposit((**m).minEnergyDeposit());
++numberEnergyDeposits;
++numberParameters;
}
}
if ((**m).isScatterer()) ++numberScatterers;
// set pointers into big matrix
(**m).derivative(&fitMatrix.derivative[row][0]);
(**m).residual(row+m_residuals->begin());
++row;
if ((**m).is2Dimensional())
{
(**m).derivative2(&fitMatrix.derivative[row][0]);
++row;
}
}
// second loop puts alignment rows at bottom of matrix
for (m = measurements.begin();
m != measurements.end();
++m)
{
if (! (**m).isAlignment()) continue;
++numberAlignments;
// set pointers into big matrix
(**m).derivative(&fitMatrix.derivative[row][0]);
(**m).residual(row+m_residuals->begin());
++row;
if ((**m).is2Dimensional())
{
(**m).derivative2(&fitMatrix.derivative[row][0]);
++row;
}
}
// keep first row with measurements up to each number of parameters
parameters->numberAlignments(numberAlignments);
parameters->numberScatterers(numberScatterers);
bool afterCalo = false;
int lastRow = 0;
m_rowsDM = 0;
for (m = measurements.begin();
m != measurements.end();
++m)
{
if ((**m).numberDoF())
{
if ((**m).isEnergyDeposit())
{
afterCalo = true;
// m_lastRowForParameter[4] = m_firstRowForParameter[5] + 1;
}
else if ((**m).isScatterer())
{
m_firstRowForParameter.push_back(m_rowsDM);
m_firstRowForParameter.push_back(++m_rowsDM);
(**m).lastParameter(m_firstRowForParameter.size(), afterCalo);
parameters->addScatterer((**m).scattererPhi(),(**m).scattererTheta());
lastRow = ++m_rowsDM;
continue;
}
else if ((**m).isAlignment())
{
// defer alignment
continue;
}
m_rowsDM += (**m).numberDoF();
lastRow = m_rowsDM;
}
(**m).lastParameter(m_firstRowForParameter.size(), afterCalo);
}
numberParameters = m_firstRowForParameter.size();
m_lastRowForParameter = std::vector<int>(numberParameters,lastRow);
if (afterCalo) m_lastRowForParameter[4] = m_firstRowForParameter[5] + 1;
// following loop puts any alignment info into the final rows
if (numberAlignments)
{
row = 0;
unsigned alignmentParameter = 0;
int firstAlignmentRow = 0;
int firstAlignment2Row = 0;
for (m = measurements.begin();
m != measurements.end();
++m)
{
if ((**m).alignmentParameter())
{
if ((**m).alignmentParameter() > alignmentParameter)
{
if (! firstAlignmentRow) firstAlignmentRow = row;
}
if ((**m).alignmentParameter2())
{
if (! firstAlignment2Row) firstAlignment2Row = row;
}
}
if (! (**m).numberDoF()) continue;
if (! (**m).isAlignment())
{
row += (**m).numberDoF();
continue;
}
parameters->addAlignment(m_constrainedAlignmentEffects,
(**m).alignmentAngle(),
(**m).alignmentOffset());
m_firstRowForParameter.push_back(firstAlignmentRow);
m_firstRowForParameter.push_back(firstAlignmentRow);
m_lastRowForParameter.push_back(++m_rowsDM);
m_lastRowForParameter.push_back(++m_rowsDM);
(**m).firstParameter(numberParameters);
numberParameters += 2;
alignmentParameter = parameters->numberAlignments();
(**m).alignmentParameter(alignmentParameter);
(**m).lastParameter(numberParameters,afterCalo);
// m_rowsDM += (**m).numberDoF();
// some bug to fix here...
// firstAlignmentRow = firstAlignment2Row;
// firstAlignment2Row = 0;
}
}
// initialize number of parameters (including alignments and scatterers)
numberParameters = m_firstRowForParameter.size();
parameters->numberParameters(numberParameters);
// and degrees of freedom
m_numberDoF = m_rowsDM - numberParameters;
// make some checks: return fitCode in case of problem
int fitCode = 0;
//if (row > mxmeas) fitCode = 2; // too many measurements for fit matrix size
if (2*measurements.size() > mxmeas) fitCode = 2; // too many measurements for fit matrix size
if (numberParameters > mxparam) fitCode = 3; // too many parameters for fit matrix size
if (m_numberDoF < 0) fitCode = 4; // unconstrained fit: negative numberDoF
if (numberEnergyDeposits > 1) fitCode = 12; // too many EnergyDeposit parameters
if (fitCode) return fitCode;
// reserve derivatives for jacobian propagation to 'non-measurements'
row = m_rowsDM;
for (m = measurements.begin();
m != measurements.end();
++m)
{
if (! (**m).isPositionMeasurement() || (**m).numberDoF() > 1) continue;
if (! (**m).numberDoF())
{
for (int i = 0; i != numberParameters; ++i) fitMatrix.derivative[row][i] = 0.;
(**m).derivative(&fitMatrix.derivative[row][0]);
(**m).residual(row+m_residuals->begin());
++row;
}
for (int i = 0; i != numberParameters; ++i) fitMatrix.derivative[row][i] = 0.;
(**m).derivative2(&fitMatrix.derivative[row][0]);
++row;
}
// update partitioning of fit matrices
for (int row = 0; row < m_rowsDM; ++row)
{
for (int param = 0; param < numberParameters; ++param)
{
fitMatrix.derivative[row][param] = 0.;
}
}
// fix degrees of freedom for external customers
if (! m_parameters->fitMomentum()) ++m_numberDoF;
// we don't have any fit results yet
delete m_covariance;
m_covariance = 0;
delete m_finalCovariance;
m_finalCovariance = 0;
// reallocate to get correct matrix sizes
if (! m_derivativeMatrix || ! m_weight || numberParameters != m_columnsDM)
{
m_columnsDM = numberParameters;
delete m_derivativeMatrix;
m_derivativeMatrix = new Amg::MatrixX(m_rowsDM,m_columnsDM);
delete m_weight;
m_weight = new Amg::MatrixX(m_columnsDM,m_columnsDM);
// isn't this faster? indicating that we have a symmetric matrix <0x2> = <Upper>
// any gain seems to be negated by additional for loop copies to recover full cov matrix
// introduces some rounding differences - keep for release 21 to respect strict Tier0 policy
(*m_weight).selfadjointView<0x2>();
delete m_weightedDifference;
m_weightedDifference = new Amg::VectorX(m_columnsDM);
}
// this should never happen
if (! m_derivativeMatrix) fitCode = 13;
return fitCode;
}
bool
FitMatrices::solveEquations(void)
{
// use Eigen Matrix multiplication ATR-15723
// note: fitMatrix (struct) is row-major whereas Eigen prefers column-major storage
// hence the loops are nested to optimise row-major and to form the Eigen transpose
Amg::MatrixX& weight = *m_weight;
Amg::VectorX& weightedDifference = *m_weightedDifference;
Amg::MatrixX fitMatrixDerivativeT(m_columnsDM, m_rowsDM);
Amg::MatrixX residuals(m_rowsDM,1);
for (int row = 0; row < m_rowsDM; ++row)
{
residuals(row,0) = (*m_residuals)[row];
for (int col = 0; col < m_columnsDM; ++col)
{
fitMatrixDerivativeT(col,row) = fitMatrix.derivative[row][col];
}
}
weight = fitMatrixDerivativeT*fitMatrixDerivativeT.transpose();
weightedDifference = fitMatrixDerivativeT*residuals;
// stabilize fits with badly determined phi
if (m_parameters->phiInstability()) weight(0,0) += m_largePhiWeight;
// avoid some possible singularities in matrix inversion
avoidMomentumSingularity();
// solve is faster than inverse: wait for explicit request for covariance before inversion
*m_weightedDifference = weight.colPivHouseholderQr().solve(weightedDifference);
// bool failure = (weight*(*m_weightedDifference) - weightedDifference).isZero(1e-4);
// if (failure)
// {
// std::cout << " Eigen failed " << std::endl;
// return false;
// }
// else
// {
m_parameters->update(*m_weightedDifference);
return true;
// }
}
void
FitMatrices::usePerigee (const FitMeasurement& measurement)
{
m_perigee = measurement.perigee();
m_perigeeWeight = measurement.perigeeWeight();
// TODO: needs eigen equiv !!
if (m_matrixFromCLHEP)
{
m_usePerigee = true;
}
}
//<<<<<< PRIVATE MEMBER FUNCTION DEFINITIONS >>>>>>
void
FitMatrices::addPerigeeMeasurement (void)
{
// TODO: needs eigen equiv !!
// const Amg::MatrixX& perigeeWeight = *m_perigeeWeight;
// Amg::MatrixX& weight = *m_weightCLHEP;
// AmgVectorX& weightedDifference = *m_weightedDifferenceCLHEP;
// AmgVectorX diff_vector = perigeeWeight*m_perigeeDifference.T();
// for (int row = 0; row < m_numberPerigee; ++row)
// {
// weightedDifference[row] += diff_vector[row];
// for (int col = 0; col <= row; ++col) weight[row][col] += perigeeWeight[row][col];
// }
}
void
FitMatrices::avoidMomentumSingularity(void)
{
// fix momentum if line-fit or fit attempted with negligible field integral
Amg::MatrixX& weight = *m_weight;
if (m_parameters->fitEnergyDeposit() && weight(5,5) < 1./Gaudi::Units::TeV)
{
for (int i = 0; i != m_columnsDM; ++i)
{
weight(i,5) = 0.;
weight(5,i) = 0.;
}
weight(5,5) += 1./Gaudi::Units::TeV;
}
if (! m_parameters->fitMomentum() || weight(4,4) < 1./Gaudi::Units::TeV)
{
m_parameters->fitMomentum(false);
for (int i = 0; i != m_columnsDM; ++i)
{
weight(i,4) = 0.;
weight(4,i) = 0.;
}
weight(4,4) += 1./Gaudi::Units::TeV;
}
}
} // end of namespace
| [
"rushioda@lxplus754.cern.ch"
] | rushioda@lxplus754.cern.ch |
a4d24e59fc9b8b071f28d02f4f294bac87b9c3a6 | 27be413613f3ec5b3c10cefcc03390f801476118 | /src/system/TimeService.cpp | b69ca57a3a07ab1c0eb14d9c84dd526e38491cbc | [] | no_license | guolisen/ElfBox | ecc491199d0e12646a285921b433efb5263d0c2e | 90ce1a4c9735ffd3880111e39fb50a941fd41cc9 | refs/heads/master | 2021-01-25T05:56:51.288233 | 2018-09-02T09:24:34 | 2018-09-02T09:24:34 | 80,709,073 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,903 | cpp | //
// Created by Lewis on 2017/2/16.
//
#include "TimeService.h"
namespace elfbox
{
namespace system
{
TimeService::TimeService(ThreadPoolPtr threadPool,
common::MessageBroadcasterPtr messageBroadcaster,
std::shared_ptr<ITimeService> impl):
threadPool_(threadPool), messageBroadcaster_(messageBroadcaster),
impl_(impl), timerCounter(0)
{
}
bool TimeService::setOption(const std::string &strKey, const void *pValue)
{
std::lock_guard<std::mutex> guard(tickMutex_);
return impl_->setOption(strKey, pValue);
}
void TimeService::reset()
{
std::lock_guard<std::mutex> guard(tickMutex_);
return impl_->reset();
}
uint32_ TimeService::getMilliseconds()
{
std::lock_guard<std::mutex> guard(tickMutex_);
return impl_->getMilliseconds();
}
uint32_ TimeService::getMicroseconds()
{
std::lock_guard<std::mutex> guard(tickMutex_);
return impl_->getMicroseconds();
}
uint32_ TimeService::getMillisecondsCPU()
{
std::lock_guard<std::mutex> guard(tickMutex_);
return impl_->getMillisecondsCPU();
}
uint32_ TimeService::getMicrosecondsCPU()
{
std::lock_guard<std::mutex> guard(tickMutex_);
return impl_->getMicrosecondsCPU();
}
void TimeService::sleep(unsigned int tick)
{
return impl_->sleep(tick);
}
bool TimeService::initialize()
{
reset();
messageBroadcaster_->subscribe(
common::TIMER_TIME_OUT, std::bind(&TimeService::timeOutHandler,
this, std::placeholders::_1));
threadPool_->attach(std::bind(&TimeService::timerLooper, this, std::placeholders::_1), -1);
impl_->initialize();
return true;
}
TimerId TimeService::createTimer(
TimerHandler handler, int interval, bool isRepeat)
{
TimerId id = getTimerId();
TimerEntryPtr timer = std::make_shared<TimerEntry>(
handler, interval * 1000, isRepeat);
timer->startTick = getMicroseconds();
timer->isEnable = true;
{
std::lock_guard<std::mutex> guard(timerMapMutex_);
timerMap_.insert(std::make_pair(id, timer));
}
return id;
}
void TimeService::sendTimeOutMessage(TimerId id)
{
printf("sendTimeOutMessage %d\n", id);
common::MessageData data;
data[EventTimerId] = id;
messageBroadcaster_->sendMessage(common::TIMER_TIME_OUT, data);
}
void TimeService::timeOutHandler(common::MessageData data)
{
TimerId id = data[EventTimerId];
TimerHandler handler;
{
std::lock_guard<std::mutex> guard(timerMapMutex_);
auto it = timerMap_.find(id);
if (it == timerMap_.end())
return;
handler = it->second->handler;
if (!it->second->isRepeat)
{
timerMap_.erase(it);
}
else
it->second->isEnable = true;
}
handler(id);
}
void TimeService::timerLooper(unsigned threadId)
{
while (true)
{
{
std::lock_guard<std::mutex> guard(timerMapMutex_);
if (timerMap_.empty())
{
sleep(100);
continue;
}
//printf("have message %d\n", timerMap_.size());
uint32_ currentTick = getMicroseconds();
for(auto timerIt : timerMap_)
{
uint32_ diff = currentTick - timerIt.second->startTick;
//printf("timeDiff %d\n", diff);
if (diff > timerIt.second->interval)
{
if (timerIt.second->isEnable)
{
sendTimeOutMessage(timerIt.first);
timerIt.second->isEnable = false;
}
if (timerIt.second->isRepeat)
{
timerIt.second->startTick = getMicroseconds();
}
}
}
}
sleep(1);
}
}
}
} | [
"guolisen@163.com"
] | guolisen@163.com |
538c62db3789077cf27d39fe26f29629c1b061c1 | f27ed319211b41c9933ffe2af8875ca9cc87f73a | /src/util.cpp | 72acd414ef1ddfa2d4b353541e09b21eb16f27ea | [
"MIT"
] | permissive | VeganMoney/vmoney | 5fbd21a2932ecbf53986fbe54c84a2e74f9fefde | 4a95e858963d41add4e290a020ca6f30ae4ca632 | refs/heads/master | 2020-03-18T16:05:08.988190 | 2018-05-26T09:22:41 | 2018-05-26T09:22:41 | 134,945,493 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 43,197 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef WIN32
// for posix_fallocate
#ifdef __linux__
#define _POSIX_C_SOURCE 200112L
#endif
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/resource.h>
#endif
#include "util.h"
#include "sync.h"
#include "version.h"
#include "ui_interface.h"
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
// Work around clang compilation problem in Boost 1.46:
// /usr/include/boost/program_options/detail/config_file.hpp:163:17: error: call to function 'to_internal' that is neither visible in the template definition nor found by argument-dependent lookup
// See also: http://stackoverflow.com/questions/10020179/compilation-fail-in-boost-librairies-program-options
// http://clang.debian.net/status.php?version=3.0&key=CANNOT_FIND_FUNCTION
namespace boost {
namespace program_options {
std::string to_internal(const std::string&);
}
}
#include <boost/program_options/detail/config_file.hpp>
#include <boost/program_options/parsers.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/foreach.hpp>
#include <boost/thread.hpp>
#include <openssl/crypto.h>
#include <openssl/rand.h>
#include <stdarg.h>
#ifdef WIN32
#ifdef _MSC_VER
#pragma warning(disable:4786)
#pragma warning(disable:4804)
#pragma warning(disable:4805)
#pragma warning(disable:4717)
#endif
#ifdef _WIN32_WINNT
#undef _WIN32_WINNT
#endif
#define _WIN32_WINNT 0x0501
#ifdef _WIN32_IE
#undef _WIN32_IE
#endif
#define _WIN32_IE 0x0501
#define WIN32_LEAN_AND_MEAN 1
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <io.h> /* for _commit */
#include "shlobj.h"
#elif defined(__linux__)
# include <sys/prctl.h>
#endif
using namespace std;
map<string, string> mapArgs;
map<string, vector<string> > mapMultiArgs;
bool fDebug = false;
bool fDebugNet = false;
bool fPrintToConsole = false;
bool fPrintToDebugger = false;
bool fDaemon = false;
bool fServer = false;
bool fCommandLine = false;
string strMiscWarning;
bool fTestNet = false;
bool fBloomFilters = true;
bool fNoListen = false;
bool fLogTimestamps = false;
CMedianFilter<int64> vTimeOffsets(200,0);
volatile bool fReopenDebugLog = false;
bool fCachedPath[2] = {false, false};
// Init OpenSSL library multithreading support
static CCriticalSection** ppmutexOpenSSL;
void locking_callback(int mode, int i, const char* file, int line)
{
if (mode & CRYPTO_LOCK) {
ENTER_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
} else {
LEAVE_CRITICAL_SECTION(*ppmutexOpenSSL[i]);
}
}
LockedPageManager LockedPageManager::instance;
// Init
class CInit
{
public:
CInit()
{
// Init OpenSSL library multithreading support
ppmutexOpenSSL = (CCriticalSection**)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(CCriticalSection*));
for (int i = 0; i < CRYPTO_num_locks(); i++)
ppmutexOpenSSL[i] = new CCriticalSection();
CRYPTO_set_locking_callback(locking_callback);
#ifdef WIN32
// Seed random number generator with screen scrape and other hardware sources
RAND_screen();
#endif
// Seed random number generator with performance counter
RandAddSeed();
}
~CInit()
{
// Shutdown OpenSSL library multithreading support
CRYPTO_set_locking_callback(NULL);
for (int i = 0; i < CRYPTO_num_locks(); i++)
delete ppmutexOpenSSL[i];
OPENSSL_free(ppmutexOpenSSL);
}
}
instance_of_cinit;
void RandAddSeed()
{
// Seed with CPU performance counter
int64 nCounter = GetPerformanceCounter();
RAND_add(&nCounter, sizeof(nCounter), 1.5);
memset(&nCounter, 0, sizeof(nCounter));
}
void RandAddSeedPerfmon()
{
RandAddSeed();
// This can take up to 2 seconds, so only do it every 10 minutes
static int64 nLastPerfmon;
if (GetTime() < nLastPerfmon + 10 * 60)
return;
nLastPerfmon = GetTime();
#ifdef WIN32
// Don't need this on Linux, OpenSSL automatically uses /dev/urandom
// Seed with the entire set of perfmon data
unsigned char pdata[250000];
memset(pdata, 0, sizeof(pdata));
unsigned long nSize = sizeof(pdata);
long ret = RegQueryValueExA(HKEY_PERFORMANCE_DATA, "Global", NULL, NULL, pdata, &nSize);
RegCloseKey(HKEY_PERFORMANCE_DATA);
if (ret == ERROR_SUCCESS)
{
RAND_add(pdata, nSize, nSize/100.0);
OPENSSL_cleanse(pdata, nSize);
printf("RandAddSeed() %lu bytes\n", nSize);
}
#endif
}
uint64 GetRand(uint64 nMax)
{
if (nMax == 0)
return 0;
// The range of the random source must be a multiple of the modulus
// to give every possible output value an equal possibility
uint64 nRange = (std::numeric_limits<uint64>::max() / nMax) * nMax;
uint64 nRand = 0;
do
RAND_bytes((unsigned char*)&nRand, sizeof(nRand));
while (nRand >= nRange);
return (nRand % nMax);
}
int GetRandInt(int nMax)
{
return GetRand(nMax);
}
uint256 GetRandHash()
{
uint256 hash;
RAND_bytes((unsigned char*)&hash, sizeof(hash));
return hash;
}
//
// OutputDebugStringF (aka printf -- there is a #define that we really
// should get rid of one day) has been broken a couple of times now
// by well-meaning people adding mutexes in the most straightforward way.
// It breaks because it may be called by global destructors during shutdown.
// Since the order of destruction of static/global objects is undefined,
// defining a mutex as a global object doesn't work (the mutex gets
// destroyed, and then some later destructor calls OutputDebugStringF,
// maybe indirectly, and you get a core dump at shutdown trying to lock
// the mutex).
static boost::once_flag debugPrintInitFlag = BOOST_ONCE_INIT;
// We use boost::call_once() to make sure these are initialized in
// in a thread-safe manner the first time it is called:
static FILE* fileout = NULL;
static boost::mutex* mutexDebugLog = NULL;
static void DebugPrintInit()
{
assert(fileout == NULL);
assert(mutexDebugLog == NULL);
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
fileout = fopen(pathDebug.string().c_str(), "a");
if (fileout) setbuf(fileout, NULL); // unbuffered
mutexDebugLog = new boost::mutex();
}
int OutputDebugStringF(const char* pszFormat, ...)
{
int ret = 0; // Returns total number of characters written
if (fPrintToConsole)
{
// print to console
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
ret += vprintf(pszFormat, arg_ptr);
va_end(arg_ptr);
}
else if (!fPrintToDebugger)
{
static bool fStartedNewLine = true;
boost::call_once(&DebugPrintInit, debugPrintInitFlag);
if (fileout == NULL)
return ret;
boost::mutex::scoped_lock scoped_lock(*mutexDebugLog);
// reopen the log file, if requested
if (fReopenDebugLog) {
fReopenDebugLog = false;
boost::filesystem::path pathDebug = GetDataDir() / "debug.log";
if (freopen(pathDebug.string().c_str(),"a",fileout) != NULL)
setbuf(fileout, NULL); // unbuffered
}
// Debug print useful for profiling
if (fLogTimestamps && fStartedNewLine)
ret += fprintf(fileout, "%s ", DateTimeStrFormat("%Y-%m-%d %H:%M:%S", GetTime()).c_str());
if (pszFormat[strlen(pszFormat) - 1] == '\n')
fStartedNewLine = true;
else
fStartedNewLine = false;
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
ret += vfprintf(fileout, pszFormat, arg_ptr);
va_end(arg_ptr);
}
#ifdef WIN32
if (fPrintToDebugger)
{
static CCriticalSection cs_OutputDebugStringF;
// accumulate and output a line at a time
{
LOCK(cs_OutputDebugStringF);
static std::string buffer;
va_list arg_ptr;
va_start(arg_ptr, pszFormat);
buffer += vstrprintf(pszFormat, arg_ptr);
va_end(arg_ptr);
int line_start = 0, line_end;
while((line_end = buffer.find('\n', line_start)) != -1)
{
OutputDebugStringA(buffer.substr(line_start, line_end - line_start).c_str());
line_start = line_end + 1;
ret += line_end-line_start;
}
buffer.erase(0, line_start);
}
}
#endif
return ret;
}
string vstrprintf(const char *format, va_list ap)
{
char buffer[50000];
char* p = buffer;
int limit = sizeof(buffer);
int ret;
loop
{
va_list arg_ptr;
va_copy(arg_ptr, ap);
#ifdef WIN32
ret = _vsnprintf(p, limit, format, arg_ptr);
#else
ret = vsnprintf(p, limit, format, arg_ptr);
#endif
va_end(arg_ptr);
if (ret >= 0 && ret < limit)
break;
if (p != buffer)
delete[] p;
limit *= 2;
p = new char[limit];
if (p == NULL)
throw std::bad_alloc();
}
string str(p, p+ret);
if (p != buffer)
delete[] p;
return str;
}
string real_strprintf(const char *format, int dummy, ...)
{
va_list arg_ptr;
va_start(arg_ptr, dummy);
string str = vstrprintf(format, arg_ptr);
va_end(arg_ptr);
return str;
}
string real_strprintf(const std::string &format, int dummy, ...)
{
va_list arg_ptr;
va_start(arg_ptr, dummy);
string str = vstrprintf(format.c_str(), arg_ptr);
va_end(arg_ptr);
return str;
}
bool error(const char *format, ...)
{
va_list arg_ptr;
va_start(arg_ptr, format);
std::string str = vstrprintf(format, arg_ptr);
va_end(arg_ptr);
printf("ERROR: %s\n", str.c_str());
return false;
}
void ParseString(const string& str, char c, vector<string>& v)
{
if (str.empty())
return;
string::size_type i1 = 0;
string::size_type i2;
loop
{
i2 = str.find(c, i1);
if (i2 == str.npos)
{
v.push_back(str.substr(i1));
return;
}
v.push_back(str.substr(i1, i2-i1));
i1 = i2+1;
}
}
string FormatMoney(int64 n, bool fPlus)
{
// Note: not using straight sprintf here because we do NOT want
// localized number formatting.
int64 n_abs = (n > 0 ? n : -n);
int64 quotient = n_abs/COIN;
int64 remainder = n_abs%COIN;
string str = strprintf("%"PRI64d".%08"PRI64d, quotient, remainder);
// Right-trim excess zeros before the decimal point:
int nTrim = 0;
for (int i = str.size()-1; (str[i] == '0' && isdigit(str[i-2])); --i)
++nTrim;
if (nTrim)
str.erase(str.size()-nTrim, nTrim);
if (n < 0)
str.insert((unsigned int)0, 1, '-');
else if (fPlus && n > 0)
str.insert((unsigned int)0, 1, '+');
return str;
}
bool ParseMoney(const string& str, int64& nRet)
{
return ParseMoney(str.c_str(), nRet);
}
bool ParseMoney(const char* pszIn, int64& nRet)
{
string strWhole;
int64 nUnits = 0;
const char* p = pszIn;
while (isspace(*p))
p++;
for (; *p; p++)
{
if (*p == '.')
{
p++;
int64 nMult = CENT*10;
while (isdigit(*p) && (nMult > 0))
{
nUnits += nMult * (*p++ - '0');
nMult /= 10;
}
break;
}
if (isspace(*p))
break;
if (!isdigit(*p))
return false;
strWhole.insert(strWhole.end(), *p);
}
for (; *p; p++)
if (!isspace(*p))
return false;
if (strWhole.size() > 10) // guard against 63 bit overflow
return false;
if (nUnits < 0 || nUnits > COIN)
return false;
int64 nWhole = atoi64(strWhole);
int64 nValue = nWhole*COIN + nUnits;
nRet = nValue;
return true;
}
// safeChars chosen to allow simple messages/URLs/email addresses, but avoid anything
// even possibly remotely dangerous like & or >
static string safeChars("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890 .,;_/:?@");
string SanitizeString(const string& str)
{
string strResult;
for (std::string::size_type i = 0; i < str.size(); i++)
{
if (safeChars.find(str[i]) != std::string::npos)
strResult.push_back(str[i]);
}
return strResult;
}
static const signed char phexdigit[256] =
{ -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,0xa,0xb,0xc,0xd,0xe,0xf,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, };
bool IsHex(const string& str)
{
BOOST_FOREACH(unsigned char c, str)
{
if (phexdigit[c] < 0)
return false;
}
return (str.size() > 0) && (str.size()%2 == 0);
}
vector<unsigned char> ParseHex(const char* psz)
{
// convert hex dump to vector
vector<unsigned char> vch;
loop
{
while (isspace(*psz))
psz++;
signed char c = phexdigit[(unsigned char)*psz++];
if (c == (signed char)-1)
break;
unsigned char n = (c << 4);
c = phexdigit[(unsigned char)*psz++];
if (c == (signed char)-1)
break;
n |= c;
vch.push_back(n);
}
return vch;
}
vector<unsigned char> ParseHex(const string& str)
{
return ParseHex(str.c_str());
}
static void InterpretNegativeSetting(string name, map<string, string>& mapSettingsRet)
{
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
if (name.find("-no") == 0)
{
std::string positive("-");
positive.append(name.begin()+3, name.end());
if (mapSettingsRet.count(positive) == 0)
{
bool value = !GetBoolArg(name);
mapSettingsRet[positive] = (value ? "1" : "0");
}
}
}
void ParseParameters(int argc, const char* const argv[])
{
mapArgs.clear();
mapMultiArgs.clear();
for (int i = 1; i < argc; i++)
{
std::string str(argv[i]);
std::string strValue;
size_t is_index = str.find('=');
if (is_index != std::string::npos)
{
strValue = str.substr(is_index+1);
str = str.substr(0, is_index);
}
#ifdef WIN32
boost::to_lower(str);
if (boost::algorithm::starts_with(str, "/"))
str = "-" + str.substr(1);
#endif
if (str[0] != '-')
break;
mapArgs[str] = strValue;
mapMultiArgs[str].push_back(strValue);
}
// New 0.6 features:
BOOST_FOREACH(const PAIRTYPE(string,string)& entry, mapArgs)
{
string name = entry.first;
// interpret --foo as -foo (as long as both are not set)
if (name.find("--") == 0)
{
std::string singleDash(name.begin()+1, name.end());
if (mapArgs.count(singleDash) == 0)
mapArgs[singleDash] = entry.second;
name = singleDash;
}
// interpret -nofoo as -foo=0 (and -nofoo=0 as -foo=1) as long as -foo not set
InterpretNegativeSetting(name, mapArgs);
}
}
std::string GetArg(const std::string& strArg, const std::string& strDefault)
{
if (mapArgs.count(strArg))
return mapArgs[strArg];
return strDefault;
}
int64 GetArg(const std::string& strArg, int64 nDefault)
{
if (mapArgs.count(strArg))
return atoi64(mapArgs[strArg]);
return nDefault;
}
bool GetBoolArg(const std::string& strArg, bool fDefault)
{
if (mapArgs.count(strArg))
{
if (mapArgs[strArg].empty())
return true;
return (atoi(mapArgs[strArg]) != 0);
}
return fDefault;
}
bool SoftSetArg(const std::string& strArg, const std::string& strValue)
{
if (mapArgs.count(strArg))
return false;
mapArgs[strArg] = strValue;
return true;
}
bool SoftSetBoolArg(const std::string& strArg, bool fValue)
{
if (fValue)
return SoftSetArg(strArg, std::string("1"));
else
return SoftSetArg(strArg, std::string("0"));
}
string EncodeBase64(const unsigned char* pch, size_t len)
{
static const char *pbase64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
string strRet="";
strRet.reserve((len+2)/3*4);
int mode=0, left=0;
const unsigned char *pchEnd = pch+len;
while (pch<pchEnd)
{
int enc = *(pch++);
switch (mode)
{
case 0: // we have no bits
strRet += pbase64[enc >> 2];
left = (enc & 3) << 4;
mode = 1;
break;
case 1: // we have two bits
strRet += pbase64[left | (enc >> 4)];
left = (enc & 15) << 2;
mode = 2;
break;
case 2: // we have four bits
strRet += pbase64[left | (enc >> 6)];
strRet += pbase64[enc & 63];
mode = 0;
break;
}
}
if (mode)
{
strRet += pbase64[left];
strRet += '=';
if (mode == 1)
strRet += '=';
}
return strRet;
}
string EncodeBase64(const string& str)
{
return EncodeBase64((const unsigned char*)str.c_str(), str.size());
}
vector<unsigned char> DecodeBase64(const char* p, bool* pfInvalid)
{
static const int decode64_table[256] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1,
-1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 50, 51, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
if (pfInvalid)
*pfInvalid = false;
vector<unsigned char> vchRet;
vchRet.reserve(strlen(p)*3/4);
int mode = 0;
int left = 0;
while (1)
{
int dec = decode64_table[(unsigned char)*p];
if (dec == -1) break;
p++;
switch (mode)
{
case 0: // we have no bits and get 6
left = dec;
mode = 1;
break;
case 1: // we have 6 bits and keep 4
vchRet.push_back((left<<2) | (dec>>4));
left = dec & 15;
mode = 2;
break;
case 2: // we have 4 bits and get 6, we keep 2
vchRet.push_back((left<<4) | (dec>>2));
left = dec & 3;
mode = 3;
break;
case 3: // we have 2 bits and get 6
vchRet.push_back((left<<6) | dec);
mode = 0;
break;
}
}
if (pfInvalid)
switch (mode)
{
case 0: // 4n base64 characters processed: ok
break;
case 1: // 4n+1 base64 character processed: impossible
*pfInvalid = true;
break;
case 2: // 4n+2 base64 characters processed: require '=='
if (left || p[0] != '=' || p[1] != '=' || decode64_table[(unsigned char)p[2]] != -1)
*pfInvalid = true;
break;
case 3: // 4n+3 base64 characters processed: require '='
if (left || p[0] != '=' || decode64_table[(unsigned char)p[1]] != -1)
*pfInvalid = true;
break;
}
return vchRet;
}
string DecodeBase64(const string& str)
{
vector<unsigned char> vchRet = DecodeBase64(str.c_str());
return string((const char*)&vchRet[0], vchRet.size());
}
string EncodeBase32(const unsigned char* pch, size_t len)
{
static const char *pbase32 = "abcdefghijklmnopqrstuvwxyz234567";
string strRet="";
strRet.reserve((len+4)/5*8);
int mode=0, left=0;
const unsigned char *pchEnd = pch+len;
while (pch<pchEnd)
{
int enc = *(pch++);
switch (mode)
{
case 0: // we have no bits
strRet += pbase32[enc >> 3];
left = (enc & 7) << 2;
mode = 1;
break;
case 1: // we have three bits
strRet += pbase32[left | (enc >> 6)];
strRet += pbase32[(enc >> 1) & 31];
left = (enc & 1) << 4;
mode = 2;
break;
case 2: // we have one bit
strRet += pbase32[left | (enc >> 4)];
left = (enc & 15) << 1;
mode = 3;
break;
case 3: // we have four bits
strRet += pbase32[left | (enc >> 7)];
strRet += pbase32[(enc >> 2) & 31];
left = (enc & 3) << 3;
mode = 4;
break;
case 4: // we have two bits
strRet += pbase32[left | (enc >> 5)];
strRet += pbase32[enc & 31];
mode = 0;
}
}
static const int nPadding[5] = {0, 6, 4, 3, 1};
if (mode)
{
strRet += pbase32[left];
for (int n=0; n<nPadding[mode]; n++)
strRet += '=';
}
return strRet;
}
string EncodeBase32(const string& str)
{
return EncodeBase32((const unsigned char*)str.c_str(), str.size());
}
vector<unsigned char> DecodeBase32(const char* p, bool* pfInvalid)
{
static const int decode32_table[256] =
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 0, 1, 2,
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
};
if (pfInvalid)
*pfInvalid = false;
vector<unsigned char> vchRet;
vchRet.reserve((strlen(p))*5/8);
int mode = 0;
int left = 0;
while (1)
{
int dec = decode32_table[(unsigned char)*p];
if (dec == -1) break;
p++;
switch (mode)
{
case 0: // we have no bits and get 5
left = dec;
mode = 1;
break;
case 1: // we have 5 bits and keep 2
vchRet.push_back((left<<3) | (dec>>2));
left = dec & 3;
mode = 2;
break;
case 2: // we have 2 bits and keep 7
left = left << 5 | dec;
mode = 3;
break;
case 3: // we have 7 bits and keep 4
vchRet.push_back((left<<1) | (dec>>4));
left = dec & 15;
mode = 4;
break;
case 4: // we have 4 bits, and keep 1
vchRet.push_back((left<<4) | (dec>>1));
left = dec & 1;
mode = 5;
break;
case 5: // we have 1 bit, and keep 6
left = left << 5 | dec;
mode = 6;
break;
case 6: // we have 6 bits, and keep 3
vchRet.push_back((left<<2) | (dec>>3));
left = dec & 7;
mode = 7;
break;
case 7: // we have 3 bits, and keep 0
vchRet.push_back((left<<5) | dec);
mode = 0;
break;
}
}
if (pfInvalid)
switch (mode)
{
case 0: // 8n base32 characters processed: ok
break;
case 1: // 8n+1 base32 characters processed: impossible
case 3: // +3
case 6: // +6
*pfInvalid = true;
break;
case 2: // 8n+2 base32 characters processed: require '======'
if (left || p[0] != '=' || p[1] != '=' || p[2] != '=' || p[3] != '=' || p[4] != '=' || p[5] != '=' || decode32_table[(unsigned char)p[6]] != -1)
*pfInvalid = true;
break;
case 4: // 8n+4 base32 characters processed: require '===='
if (left || p[0] != '=' || p[1] != '=' || p[2] != '=' || p[3] != '=' || decode32_table[(unsigned char)p[4]] != -1)
*pfInvalid = true;
break;
case 5: // 8n+5 base32 characters processed: require '==='
if (left || p[0] != '=' || p[1] != '=' || p[2] != '=' || decode32_table[(unsigned char)p[3]] != -1)
*pfInvalid = true;
break;
case 7: // 8n+7 base32 characters processed: require '='
if (left || p[0] != '=' || decode32_table[(unsigned char)p[1]] != -1)
*pfInvalid = true;
break;
}
return vchRet;
}
string DecodeBase32(const string& str)
{
vector<unsigned char> vchRet = DecodeBase32(str.c_str());
return string((const char*)&vchRet[0], vchRet.size());
}
bool WildcardMatch(const char* psz, const char* mask)
{
loop
{
switch (*mask)
{
case '\0':
return (*psz == '\0');
case '*':
return WildcardMatch(psz, mask+1) || (*psz && WildcardMatch(psz+1, mask));
case '?':
if (*psz == '\0')
return false;
break;
default:
if (*psz != *mask)
return false;
break;
}
psz++;
mask++;
}
}
bool WildcardMatch(const string& str, const string& mask)
{
return WildcardMatch(str.c_str(), mask.c_str());
}
static std::string FormatException(std::exception* pex, const char* pszThread)
{
#ifdef WIN32
char pszModule[MAX_PATH] = "";
GetModuleFileNameA(NULL, pszModule, sizeof(pszModule));
#else
const char* pszModule = "vmoney";
#endif
if (pex)
return strprintf(
"EXCEPTION: %s \n%s \n%s in %s \n", typeid(*pex).name(), pex->what(), pszModule, pszThread);
else
return strprintf(
"UNKNOWN EXCEPTION \n%s in %s \n", pszModule, pszThread);
}
void LogException(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
printf("\n%s", message.c_str());
}
void PrintException(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
printf("\n\n************************\n%s\n", message.c_str());
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
strMiscWarning = message;
throw;
}
void PrintExceptionContinue(std::exception* pex, const char* pszThread)
{
std::string message = FormatException(pex, pszThread);
printf("\n\n************************\n%s\n", message.c_str());
fprintf(stderr, "\n\n************************\n%s\n", message.c_str());
strMiscWarning = message;
}
boost::filesystem::path GetDefaultDataDir()
{
namespace fs = boost::filesystem;
// Windows < Vista: C:\Documents and Settings\Username\Application Data\Bitcoin
// Windows >= Vista: C:\Users\Username\AppData\Roaming\Bitcoin
// Mac: ~/Library/Application Support/Bitcoin
// Unix: ~/.bitcoin
#ifdef WIN32
// Windows
return GetSpecialFolderPath(CSIDL_APPDATA) / "vmoney";
#else
fs::path pathRet;
char* pszHome = getenv("HOME");
if (pszHome == NULL || strlen(pszHome) == 0)
pathRet = fs::path("/");
else
pathRet = fs::path(pszHome);
#ifdef MAC_OSX
// Mac
pathRet /= "Library/Application Support";
fs::create_directory(pathRet);
return pathRet / "vmoney";
#else
// Unix
return pathRet / ".vmoney";
#endif
#endif
}
const boost::filesystem::path &GetDataDir(bool fNetSpecific)
{
namespace fs = boost::filesystem;
static fs::path pathCached[2];
static CCriticalSection csPathCached;
fs::path &path = pathCached[fNetSpecific];
// This can be called during exceptions by printf, so we cache the
// value so we don't have to do memory allocations after that.
if (fCachedPath[fNetSpecific])
return path;
LOCK(csPathCached);
if (mapArgs.count("-datadir")) {
path = fs::system_complete(mapArgs["-datadir"]);
if (!fs::is_directory(path)) {
path = "";
return path;
}
} else {
path = GetDefaultDataDir();
}
if (fNetSpecific && GetBoolArg("-testnet", false))
path /= "testnet3";
fs::create_directories(path);
fCachedPath[fNetSpecific] = true;
return path;
}
boost::filesystem::path GetConfigFile()
{
boost::filesystem::path pathConfigFile(GetArg("-conf", "vmoney.conf"));
if (!pathConfigFile.is_complete()) pathConfigFile = GetDataDir(false) / pathConfigFile;
return pathConfigFile;
}
void ReadConfigFile(map<string, string>& mapSettingsRet,
map<string, vector<string> >& mapMultiSettingsRet)
{
boost::filesystem::ifstream streamConfig(GetConfigFile());
if (!streamConfig.good())
return; // No bitcoin.conf file is OK
// clear path cache after loading config file
fCachedPath[0] = fCachedPath[1] = false;
set<string> setOptions;
setOptions.insert("*");
for (boost::program_options::detail::config_file_iterator it(streamConfig, setOptions), end; it != end; ++it)
{
// Don't overwrite existing settings so command line settings override bitcoin.conf
string strKey = string("-") + it->string_key;
if (mapSettingsRet.count(strKey) == 0)
{
mapSettingsRet[strKey] = it->value[0];
// interpret nofoo=1 as foo=0 (and nofoo=0 as foo=1) as long as foo not set)
InterpretNegativeSetting(strKey, mapSettingsRet);
}
mapMultiSettingsRet[strKey].push_back(it->value[0]);
}
}
boost::filesystem::path GetPidFile()
{
boost::filesystem::path pathPidFile(GetArg("-pid", "vmoneyd.pid"));
if (!pathPidFile.is_complete()) pathPidFile = GetDataDir() / pathPidFile;
return pathPidFile;
}
#ifndef WIN32
void CreatePidFile(const boost::filesystem::path &path, pid_t pid)
{
FILE* file = fopen(path.string().c_str(), "w");
if (file)
{
fprintf(file, "%d\n", pid);
fclose(file);
}
}
#endif
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest)
{
#ifdef WIN32
return MoveFileExA(src.string().c_str(), dest.string().c_str(),
MOVEFILE_REPLACE_EXISTING);
#else
int rc = std::rename(src.string().c_str(), dest.string().c_str());
return (rc == 0);
#endif /* WIN32 */
}
void FileCommit(FILE *fileout)
{
fflush(fileout); // harmless if redundantly called
#ifdef WIN32
_commit(_fileno(fileout));
#else
#if defined(__linux__) || defined(__NetBSD__)
fdatasync(fileno(fileout));
#elif defined(__APPLE__) && defined(F_FULLFSYNC)
fcntl(fileno(fileout), F_FULLFSYNC, 0);
#else
fsync(fileno(fileout));
#endif
#endif
}
int GetFilesize(FILE* file)
{
int nSavePos = ftell(file);
int nFilesize = -1;
if (fseek(file, 0, SEEK_END) == 0)
nFilesize = ftell(file);
fseek(file, nSavePos, SEEK_SET);
return nFilesize;
}
bool TruncateFile(FILE *file, unsigned int length) {
#if defined(WIN32)
return _chsize(_fileno(file), length) == 0;
#else
return ftruncate(fileno(file), length) == 0;
#endif
}
// this function tries to raise the file descriptor limit to the requested number.
// It returns the actual file descriptor limit (which may be more or less than nMinFD)
int RaiseFileDescriptorLimit(int nMinFD) {
#if defined(WIN32)
return 2048;
#else
struct rlimit limitFD;
if (getrlimit(RLIMIT_NOFILE, &limitFD) != -1) {
if (limitFD.rlim_cur < (rlim_t)nMinFD) {
limitFD.rlim_cur = nMinFD;
if (limitFD.rlim_cur > limitFD.rlim_max)
limitFD.rlim_cur = limitFD.rlim_max;
setrlimit(RLIMIT_NOFILE, &limitFD);
getrlimit(RLIMIT_NOFILE, &limitFD);
}
return limitFD.rlim_cur;
}
return nMinFD; // getrlimit failed, assume it's fine
#endif
}
// this function tries to make a particular range of a file allocated (corresponding to disk space)
// it is advisory, and the range specified in the arguments will never contain live data
void AllocateFileRange(FILE *file, unsigned int offset, unsigned int length) {
#if defined(WIN32)
// Windows-specific version
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
LARGE_INTEGER nFileSize;
int64 nEndPos = (int64)offset + length;
nFileSize.u.LowPart = nEndPos & 0xFFFFFFFF;
nFileSize.u.HighPart = nEndPos >> 32;
SetFilePointerEx(hFile, nFileSize, 0, FILE_BEGIN);
SetEndOfFile(hFile);
#elif defined(MAC_OSX)
// OSX specific version
fstore_t fst;
fst.fst_flags = F_ALLOCATECONTIG;
fst.fst_posmode = F_PEOFPOSMODE;
fst.fst_offset = 0;
fst.fst_length = (off_t)offset + length;
fst.fst_bytesalloc = 0;
if (fcntl(fileno(file), F_PREALLOCATE, &fst) == -1) {
fst.fst_flags = F_ALLOCATEALL;
fcntl(fileno(file), F_PREALLOCATE, &fst);
}
ftruncate(fileno(file), fst.fst_length);
#elif defined(__linux__)
// Version using posix_fallocate
off_t nEndPos = (off_t)offset + length;
posix_fallocate(fileno(file), 0, nEndPos);
#else
// Fallback version
// TODO: just write one byte per block
static const char buf[65536] = {};
fseek(file, offset, SEEK_SET);
while (length > 0) {
unsigned int now = 65536;
if (length < now)
now = length;
fwrite(buf, 1, now, file); // allowed to fail; this function is advisory anyway
length -= now;
}
#endif
}
void ShrinkDebugFile()
{
// Scroll debug.log if it's getting too big
boost::filesystem::path pathLog = GetDataDir() / "debug.log";
FILE* file = fopen(pathLog.string().c_str(), "r");
if (file && GetFilesize(file) > 10 * 1000000)
{
// Restart the file with some of the end
char pch[200000];
fseek(file, -sizeof(pch), SEEK_END);
int nBytes = fread(pch, 1, sizeof(pch), file);
fclose(file);
file = fopen(pathLog.string().c_str(), "w");
if (file)
{
fwrite(pch, 1, nBytes, file);
fclose(file);
}
}
else if(file != NULL)
fclose(file);
}
//
// "Never go to sea with two chronometers; take one or three."
// Our three time sources are:
// - System clock
// - Median of other nodes clocks
// - The user (asking the user to fix the system clock if the first two disagree)
//
static int64 nMockTime = 0; // For unit testing
int64 GetTime()
{
if (nMockTime) return nMockTime;
return time(NULL);
}
void SetMockTime(int64 nMockTimeIn)
{
nMockTime = nMockTimeIn;
}
static int64 nTimeOffset = 0;
int64 GetTimeOffset()
{
return nTimeOffset;
}
int64 GetAdjustedTime()
{
return GetTime() + GetTimeOffset();
}
void AddTimeData(const CNetAddr& ip, int64 nTime)
{
int64 nOffsetSample = nTime - GetTime();
// Ignore duplicates
static set<CNetAddr> setKnown;
if (!setKnown.insert(ip).second)
return;
// Add data
vTimeOffsets.input(nOffsetSample);
printf("Added time data, samples %d, offset %+"PRI64d" (%+"PRI64d" minutes)\n", vTimeOffsets.size(), nOffsetSample, nOffsetSample/60);
if (vTimeOffsets.size() >= 5 && vTimeOffsets.size() % 2 == 1)
{
int64 nMedian = vTimeOffsets.median();
std::vector<int64> vSorted = vTimeOffsets.sorted();
// Only let other nodes change our time by so much
if (abs64(nMedian) < 35 * 60) // vmoney: changed maximum adjust to 35 mins to avoid letting peers change our time too much in case of an attack.
{
nTimeOffset = nMedian;
}
else
{
nTimeOffset = 0;
static bool fDone;
if (!fDone)
{
// If nobody has a time different than ours but within 5 minutes of ours, give a warning
bool fMatch = false;
BOOST_FOREACH(int64 nOffset, vSorted)
if (nOffset != 0 && abs64(nOffset) < 5 * 60)
fMatch = true;
if (!fMatch)
{
fDone = true;
string strMessage = _("Warning: Please check that your computer's date and time are correct! If your clock is wrong vmoney will not work properly.");
strMiscWarning = strMessage;
printf("*** %s\n", strMessage.c_str());
uiInterface.ThreadSafeMessageBox(strMessage, "", CClientUIInterface::MSG_WARNING);
}
}
}
if (fDebug) {
BOOST_FOREACH(int64 n, vSorted)
printf("%+"PRI64d" ", n);
printf("| ");
}
printf("nTimeOffset = %+"PRI64d" (%+"PRI64d" minutes)\n", nTimeOffset, nTimeOffset/60);
}
}
uint32_t insecure_rand_Rz = 11;
uint32_t insecure_rand_Rw = 11;
void seed_insecure_rand(bool fDeterministic)
{
//The seed values have some unlikely fixed points which we avoid.
if(fDeterministic)
{
insecure_rand_Rz = insecure_rand_Rw = 11;
} else {
uint32_t tmp;
do {
RAND_bytes((unsigned char*)&tmp, 4);
} while(tmp == 0 || tmp == 0x9068ffffU);
insecure_rand_Rz = tmp;
do {
RAND_bytes((unsigned char*)&tmp, 4);
} while(tmp == 0 || tmp == 0x464fffffU);
insecure_rand_Rw = tmp;
}
}
string FormatVersion(int nVersion)
{
if (nVersion%100 == 0)
return strprintf("%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100);
else
return strprintf("%d.%d.%d.%d", nVersion/1000000, (nVersion/10000)%100, (nVersion/100)%100, nVersion%100);
}
string FormatFullVersion()
{
return CLIENT_BUILD;
}
// Format the subversion field according to BIP 14 spec (https://en.bitcoin.it/wiki/BIP_0014)
std::string FormatSubVersion(const std::string& name, int nClientVersion, const std::vector<std::string>& comments)
{
std::ostringstream ss;
ss << "/";
ss << name << ":" << FormatVersion(nClientVersion);
if (!comments.empty())
ss << "(" << boost::algorithm::join(comments, "; ") << ")";
ss << "/";
return ss.str();
}
#ifdef WIN32
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate)
{
namespace fs = boost::filesystem;
char pszPath[MAX_PATH] = "";
if(SHGetSpecialFolderPathA(NULL, pszPath, nFolder, fCreate))
{
return fs::path(pszPath);
}
printf("SHGetSpecialFolderPathA() failed, could not obtain requested path.\n");
return fs::path("");
}
#endif
boost::filesystem::path GetTempPath() {
#if BOOST_FILESYSTEM_VERSION == 3
return boost::filesystem::temp_directory_path();
#else
// TODO: remove when we don't support filesystem v2 anymore
boost::filesystem::path path;
#ifdef WIN32
char pszPath[MAX_PATH] = "";
if (GetTempPathA(MAX_PATH, pszPath))
path = boost::filesystem::path(pszPath);
#else
path = boost::filesystem::path("/tmp");
#endif
if (path.empty() || !boost::filesystem::is_directory(path)) {
printf("GetTempPath(): failed to find temp path\n");
return boost::filesystem::path("");
}
return path;
#endif
}
void runCommand(std::string strCommand)
{
int nErr = ::system(strCommand.c_str());
if (nErr)
printf("runCommand error: system(%s) returned %d\n", strCommand.c_str(), nErr);
}
void RenameThread(const char* name)
{
#if defined(PR_SET_NAME)
// Only the first 15 characters are used (16 - NUL terminator)
::prctl(PR_SET_NAME, name, 0, 0, 0);
#elif 0 && (defined(__FreeBSD__) || defined(__OpenBSD__))
// TODO: This is currently disabled because it needs to be verified to work
// on FreeBSD or OpenBSD first. When verified the '0 &&' part can be
// removed.
pthread_set_name_np(pthread_self(), name);
#elif defined(MAC_OSX) && defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
// pthread_setname_np is XCode 10.6-and-later
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
pthread_setname_np(name);
#endif
#else
// Prevent warnings for unused parameters...
(void)name;
#endif
}
bool NewThread(void(*pfn)(void*), void* parg)
{
try
{
boost::thread(pfn, parg); // thread detaches when out of scope
} catch(boost::thread_resource_error &e) {
printf("Error creating thread: %s\n", e.what());
return false;
}
return true;
}
| [
"don.kong2016@yandex.com"
] | don.kong2016@yandex.com |
4b83a3256f26b389490985c23368906b834b15bd | 737b5c951f7985c8e42d765920ec0def7f3debe1 | /src/services/pcn-ddosmitigator/src/interface/BlacklistSrcInterface.h | 57de92a1ae666bb2d76820923f365946bcff3e03 | [
"Apache-2.0"
] | permissive | mbertrone/polycube | e3bd8db976abdf820863bcbe72f133802cd79ed4 | b35a6aa13273c000237d53c5f1bf286f12e4b9bd | refs/heads/master | 2020-04-15T04:58:34.309749 | 2019-02-21T23:01:40 | 2019-02-21T23:01:40 | 164,404,243 | 2 | 0 | NOASSERTION | 2019-01-07T08:53:22 | 2019-01-07T08:53:21 | null | UTF-8 | C++ | false | false | 770 | h | /**
* ddosmitigator API
* DDoS Mitigator Service
*
* OpenAPI spec version: 2.0
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/polycube-network/swagger-codegen.git
* branch polycube
*/
/* Do not edit this file manually */
/*
* BlacklistSrcInterface.h
*
*
*/
#pragma once
#include "../serializer/BlacklistSrcJsonObject.h"
using namespace io::swagger::server::model;
class BlacklistSrcInterface {
public:
virtual void update(const BlacklistSrcJsonObject &conf) = 0;
virtual BlacklistSrcJsonObject toJsonObject() = 0;
/// <summary>
/// Source IP Address
/// </summary>
virtual std::string getIp() = 0;
/// <summary>
/// Dropped Packets
/// </summary>
virtual uint64_t getDropPkts() = 0;
};
| [
"whoeverys@gmail.com"
] | whoeverys@gmail.com |
53d419c5496d2cb37d07557e6e4ecc61157409b6 | 8582d5b415e1b9cbc2a81924360a449d5cfcb23a | /lab3/Relation.h | 8f252c01d46c908671b466af87ca86cc541f5018 | [] | no_license | jmbarzee/byu-236 | 11ab7a277fd18d6c5d50f1a67783ec6fd23eb70a | f1fb20331c3495cd8aa5c177cae691d74c98f870 | refs/heads/master | 2021-01-21T06:30:13.534341 | 2017-02-26T20:46:28 | 2017-02-26T20:46:28 | 83,239,452 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 846 | h | /*
* Relation.h
*
* Created on: Jul 22, 2015
* Author: jacobmb
*/
#ifndef RELATION_H_
#define RELATION_H_
#include <set>
#include <string>
#include <iostream>
#include "Tuple.h"
#include "Scheme.h"
using namespace std;
class Relation {
private:
string name;
Scheme scheme;
set<Tuple> truths;
public:
Relation(string name, Scheme scheme) {
this->name = name;
this->scheme = scheme;
}
Relation() {
this->name = "";
}
string getName() {
return name;
}
Scheme getScheme() {
return scheme;
}
set<Tuple> getTruths() {
return truths;
}
int getSize() {
return truths.size();
}
void addTuple(Tuple truth) {
truths.insert(truth);
}
void setTruths(set<Tuple> truths) {
this->truths = truths;
}
void setScheme(Scheme scheme) {
this->scheme = scheme;
}
string toString();
};
#endif /* RELATION_H_ */
| [
"jbarzee@qualtrics.com"
] | jbarzee@qualtrics.com |
7410919334acf1844085b4f668953ae339b9ba4f | 0f0b2c5e9095ba273992ab0b74a82f986b4f941e | /services/sensorservice/hidl/utils.h | b350928187a682507bfbb0caf4ec839679bee51b | [
"LicenseRef-scancode-unicode",
"Apache-2.0"
] | permissive | LineageOS/android_frameworks_native | 28274a8a6a3d2b16150702e0a34434bc45090b9a | c25b27db855a0a6d749bfd45d05322939d2ad39a | refs/heads/lineage-18.1 | 2023-08-04T11:18:47.942921 | 2023-05-05T12:54:26 | 2023-05-05T12:54:26 | 75,639,913 | 21 | 626 | NOASSERTION | 2021-06-11T19:11:21 | 2016-12-05T15:41:33 | C++ | UTF-8 | C++ | false | false | 1,414 | h | /*
* Copyright (C) 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_FRAMEWORKS_SENSORSERVICE_V1_0_UTILS_H
#define ANDROID_FRAMEWORKS_SENSORSERVICE_V1_0_UTILS_H
#include <android/frameworks/sensorservice/1.0/types.h>
#include <android/hardware/sensors/1.0/types.h>
#include <hidl/HidlSupport.h>
#include <sensor/Sensor.h>
namespace android {
namespace frameworks {
namespace sensorservice {
namespace V1_0 {
namespace implementation {
::android::hardware::sensors::V1_0::SensorInfo convertSensor(const ::android::Sensor &src);
Result convertResult(status_t status);
::android::hardware::sensors::V1_0::Event convertEvent(const ::ASensorEvent &event);
} // namespace implementation
} // namespace V1_0
} // namespace sensorservice
} // namespace frameworks
} // namespace android
#endif // ANDROID_FRAMEWORKS_SENSORSERVICE_V1_0_UTILS_H
| [
"elsk@google.com"
] | elsk@google.com |
49a0ad04f2335d6ea8d45b1d73e8c081e1707e8f | 0ae2636a1b95f470648755e503d48f5e6bba2059 | /DP/Solution to at coder dp contest problems/l.cpp | 140a135df3d83d0aa6ab22319ef986af95110b73 | [] | no_license | AparnaJuhi/DS-ALGO | 5668a2f5f64731aaae96ed1ef92847fe243a4338 | d519e5bbac728192b3636f5d8a50b20bc0c335e0 | refs/heads/master | 2022-12-20T23:17:34.354534 | 2020-10-02T06:34:52 | 2020-10-02T06:34:52 | 300,136,335 | 0 | 1 | null | 2020-10-02T06:34:53 | 2020-10-01T04:03:12 | C++ | UTF-8 | C++ | false | false | 1,779 | cpp | #include <bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define int long long int
using namespace std;
#define pii pair <int, int>
#define mii map<int, int>
#define pb push_back
#define deb(x) cout << #x << " " << x << endl
#define deb2(x, y) cout << #x << " " << x << " " << #y << " " << y << endl
#define Loop(s, e, itr) for (int itr = s; itr < e; itr++)
#define loop(n) for(int i = 0; i < n; i++)
#define vin vector<int>
#define w(t) int tc; cin >> tc; for(int t = 1; t <= tc; t++)
#define vec vector
#define mod 1000000007
#define all(x) x.begin(), x.end()
int n;
int arr[3005];
pii dp_fist[3005][3005];
pii dp_second[3005][3005];
int vis_first[3005][3005];
int vis_second[3005][3005];
pii second(int, int);
pii first(int i, int j){
if(i == j) return {arr[i] , 0};
if(vis_first[i][j] == -1){
vis_first[i][j] = 1;
pii a = second(i+1, j);
a.first += arr[i];
pii b = second(i, j-1);
b.first += arr[j];
if(a.first - a.second > b.first - b.second) dp_fist[i][j] = a;
else dp_fist[i][j] = b;
}
return dp_fist[i][j];
}
pii second(int i, int j){
if(i == j) return {0, arr[i]};
if(vis_second[i][j] == -1){
vis_second[i][j] = 1;
pii a = first(i+1, j);
a.second += arr[i];
pii b = first(i, j-1);
b.second += arr[j];
if(a.first - a.second < b.first - b.second) dp_second[i][j] = a;
else dp_second[i][j] = b;
}
return dp_second[i][j];
}
int32_t main(){
memset(vis_first, -1, sizeof(vis_first));
memset(vis_second, -1, sizeof(vis_second));
cin >> n;
loop(n) cin >> arr[i];
pii ans = first(0, n-1);
cout << ans.first - ans.second << endl;
} | [
"arpit.cs18@nitp.ac.in"
] | arpit.cs18@nitp.ac.in |
39878b62bad8b0e1884a8984d22e0a26b29352fd | 952154b3b85324e30c596f3b962af1e616cc6feb | /likely/types.h | 99f3c82118abf4a062bdafeaa4c3863143f08c2b | [] | no_license | slosar/likely | 367be1834becf3d24fe4351b7e6f01109cf0db3f | 469345083c53dbed130f1f6d75e77da051537745 | refs/heads/master | 2020-12-29T02:55:38.925354 | 2015-08-16T15:43:23 | 2015-08-16T15:43:23 | 5,621,804 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,947 | h | // Created 20-May-2011 by David Kirkby (University of California, Irvine) <dkirkby@uci.edu>
#ifndef LIKELY_TYPES
#define LIKELY_TYPES
#include "boost/function.hpp"
#include "boost/smart_ptr.hpp"
#include <vector>
namespace likely {
// Represents a vector of parameter values.
typedef std::vector<double> Parameters;
// Represents a gradient vector of function partial derivatives.
typedef std::vector<double> Gradient;
// Represents a smart pointer to a random number generator.
class Random;
typedef boost::shared_ptr<Random> RandomPtr;
// Declares a smart pointer to a const binning object.
class AbsBinning;
typedef boost::shared_ptr<const AbsBinning> AbsBinningCPtr;
// Declares a smart pointer to a (const) covariance matrix.
class CovarianceMatrix;
typedef boost::shared_ptr<CovarianceMatrix> CovarianceMatrixPtr;
typedef boost::shared_ptr<const CovarianceMatrix> CovarianceMatrixCPtr;
// Declares a smart pointer to a (const) covariance matrix accumulator.
class CovarianceAccumulator;
typedef boost::shared_ptr<CovarianceAccumulator> CovarianceAccumulatorPtr;
typedef boost::shared_ptr<const CovarianceAccumulator> CovarianceAccumulatorCPtr;
// Declares a smart pointer to a (const) BinnedData object.
class BinnedData;
typedef boost::shared_ptr<BinnedData> BinnedDataPtr;
typedef boost::shared_ptr<const BinnedData> BinnedDataCPtr;
// Represents a smart pointer to a minimization engine.
class AbsEngine;
typedef boost::shared_ptr<AbsEngine> AbsEnginePtr;
// Encapsulates a minimization objective function.
typedef boost::function<double (Parameters const &pValues)> Function;
// Declares a smart pointer to an objective function.
typedef boost::shared_ptr<Function> FunctionPtr;
// Encapsulates a gradient calculator for a minimization objective function.
typedef boost::function<void (Parameters const &pValues, Gradient &gValues)>
GradientCalculator;
// Declares a smart pointer to a gradient calculator.
typedef boost::shared_ptr<GradientCalculator> GradientCalculatorPtr;
// Represents a smart pointer to a function minimum object.
class FunctionMinimum;
typedef boost::shared_ptr<FunctionMinimum> FunctionMinimumPtr;
typedef boost::shared_ptr<const FunctionMinimum> FunctionMinimumCPtr;
// Represents a smart pointer to an interpolator object.
class Interpolator;
typedef boost::shared_ptr<Interpolator> InterpolatorPtr;
// Represents a smart pointer to a weighted accumulator object.
class AbsAccumulator;
typedef boost::shared_ptr<AbsAccumulator> AbsAccumulatorPtr;
// Represents a smart pointer to a fit parameter statistics object.
class FitParameterStatistics;
typedef boost::shared_ptr<FitParameterStatistics> FitParameterStatisticsPtr;
} // likely
#endif // LIKELY_TYPES
| [
"dkirkby@uci.edu"
] | dkirkby@uci.edu |
aebcce55e1fb518338a8a1872affd03ddcd5b706 | 283cd255667cab07213477056e131fe067938ffc | /v1.5-old/PerfComp/Server/linux/perf_comp_cpp/bangdb_bench/bangdb_server_bench.h | ed61e47c4c9164262f4d206eb15cbd8bc3e207b6 | [
"BSD-3-Clause"
] | permissive | shubham8agar/BangDB | 441a8090a9294e36eb9b9849cd45e6b851001ffd | ab19a8b60d3b05d02c670cef9040f490589c76cb | refs/heads/master | 2023-04-08T07:08:18.227611 | 2021-04-18T22:31:40 | 2021-04-18T22:31:40 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,705 | h | /*
* bangdb_bench.h
*
*/
#include "common.h"
#include "client-linux/include/database.h"
using namespace bangdb_client;
int bangdb_server_get(threadarg *ta)
{
table *tbl = (table*)ta->tbl;
connection *conn = tbl->getconnection();
if(!conn)
{
printf("connection null error, please change the max conn config in bangdb.config, it could be the reason\n");
return -1;
}
int s = ta->nstart, n = ta->nend, val_len, retval = 0;
FDT ikey, *ival = NULL;
char *key, *val;
int count = 0, mismatch = 0;
bool successflag = true;
for(int i = s; i<n; i++)
{
key = getkey(i);
val = getval(i);
val_len = strlen(val);
ikey.data = key;
ikey.length = strlen(key);
if((ival = conn->get(&ikey)) == NULL)
{
//printf("null retrieved for i=%d \n",i);
count++;
successflag = false;
}
else if(memcmp(ival->data, val, val_len) != 0)
{
//printf("mismatch\n");
retval = 1;
mismatch++;
}
if(ival)
ival->free();
delete ival;
delete[] key;
delete[] val;
ta->ncomplete++;
}
if(count > 0)
printf("could not read %d keys\n", count);
if(mismatch > 0)
printf("mismatch in read for %d keys\n", mismatch);
if(successflag)
return retval;
return -1;
}
int bangdb_server_put(threadarg *ta)
{
table *tbl = (table*)ta->tbl;
connection *conn = tbl->getconnection();
if(!conn)
{
printf("connection null error, please change the max conn config in bangdb.config, it could be the reason\n");
return -1;
}
int s = ta->nstart, n = ta->nend;
FDT ikey, ival;
char *key, *val;
bool successflag = true;
int count = 0;
for(int i = s; i<n; i++)
{
key = getkey(i);
val = getval(i);
ikey.data = key;
ikey.length = strlen(key);
ival.data = val;
ival.length = strlen(val);
if(conn->put(&ikey, &ival, INSERT_UNIQUE) < 0)
{
successflag = false;
count++;
}
delete[] key;
delete[] val;
ta->ncomplete++;
}
if(count > 0)
printf("could not insert %d keys\n", count);
if(successflag)
return 0;
return -1;
}
int bangdb_server_simple(threadarg *ta)
{
table *tbl = (table*)ta->tbl;
connection *conn = tbl->getconnection();
if(!conn)
{
printf("connection null error, please change the max conn config in bangdb.config, it could be the reason\n");
return -1;
}
int s = ta->nstart, n = ta->nend;
bool successflag = true;
int count = 0;
for(int i = s; i<n; i++)
{
if(conn->make_simple_call() < 0)
{
successflag = false;
count++;
}
ta->ncomplete++;
}
if(count > 0)
printf("could not make simple calls for %d keys\n", count);
if(successflag)
return 0;
return -1;
}
int bangdb_server_getput(threadarg *ta)
{
table *tbl = (table*)ta->tbl;
connection *conn = tbl->getconnection();
if(!conn)
{
printf("connection null error, please change the max conn config in bangdb.config, it could be the reason\n");
return -1;
}
int s = ta->nstart, n = ta->nend, factor = ta->factor, x, y, w = 0, r = 0, val_len, no_write = 0, no_read = 0, ret, retval = 0;
int base_write = s + ((factor-1)*(n-s))/factor;
FDT ikey, ival, *out;
char *key, *val;
bool successflag = true;
for(int i = s; i<n; i++)
{
x = my_rand(1, factor);
if(x == factor)
{
//write
w++;
y = my_rand(base_write, n);
key = getkey(y);
val = getval(y);
val_len = strlen(val);
ikey.data = key;
ikey.length = strlen(key);
ival.data = (void*)val;
ival.length = val_len;
if((ret=conn->put(&ikey, &ival, INSERT_UPDATE)) < 0)
{
successflag = false;
}
if(ret == 1)
no_write++;
delete[] key;
delete[] val;
}
else
{
//read
r++;
y = my_rand(s, base_write);
key = getkey(y);
val = getval(y);
val_len = strlen(val);
ikey.data = key;
ikey.length = strlen(key);
if((out = conn->get(&ikey)) == NULL)
{
no_read++;
}
else if(memcmp(out->data, val, val_len) != 0)
{
//printf("mismatch\n");
retval = 1;
}
if(out)
out->free();
delete out;
delete[] key;
delete[] val;
}
ta->ncomplete++;
}
printf("Write = %d and Read = %d | noWrite = %d and noRead = %d\n", w, r, no_write, no_read);
if(successflag)
return retval;
return -1;
}
void *bangdb_server_threadfuncput(void *arg)
{
threadarg *ta = (threadarg*)arg;
off_t retval = bangdb_server_put(ta);
//delete ta;
return (void*)retval;
}
void *bangdb_server_threadfunc_simple(void *arg)
{
threadarg *ta = (threadarg*)arg;
off_t retval = bangdb_server_simple(ta);
//delete ta;
return (void*)retval;
}
void *bangdb_server_threadfuncget(void *arg)
{
threadarg *ta = (threadarg*)arg;
off_t retval = bangdb_server_get(ta);
//delete ta;
return (void*)retval;
}
void *bangdb_server_threadfunc_getput(void *arg)
{
threadarg *ta = (threadarg*)arg;
off_t retval = bangdb_server_getput(ta);
//delete ta;
return (void*)retval;
}
int bangdb_server_bench_getput(table *tbl, int num_threads, int num_items, int factor)
{
printf("[%d percent write and %d percent read performance test for BangDB] by inserting %d items using %d threads\n", 100/factor, (100*factor-100)/factor, num_items, num_threads);
pthread_t thrds[num_threads], backg_thrd;
pthread_attr_t attr;
bool successflag = true;
void *status;
time_eval te;
int s = 0, ret;long retval = 0;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
//first insert some items based on factor for better read by threads
for(int i = 0; i<num_threads; i++)
{
int nitems = ((num_items/num_threads)*(factor-1))/factor;
printf("writing from %d upto %d for nitems = %d\n", s, s+nitems, nitems);
threadarg temp_ta;
temp_ta.tbl = (void*)tbl; temp_ta.nstart = s; temp_ta.nend = s+nitems; temp_ta.ncomplete = 0;
if((ret = bangdb_server_put(&temp_ta)) < 0)
successflag = false;
s += (num_items/num_threads);
}
if(pthread_create(&backg_thrd, &attr, progress_update, (void*)&num_threads) != 0)
{
printf("error in creating background thread for progress update");
exit(-1);
}
s = 0;
te.start_counting();
for(int i = 0; i<num_threads; i++)
{
targs[i].tbl = (void*)tbl;
targs[i].nstart = s;
targs[i].nend = s + (num_items/num_threads);
targs[i].factor = factor;
targs[i].ncomplete = 0;
if(pthread_create(&thrds[i], &attr, bangdb_server_threadfunc_getput, (void*)&targs[i]) != 0)
{
printf("error in creating thread in BangDB getput, qutting");
exit(-1);
}
s += (num_items/num_threads);
}
//wait for all threads to join
for(int i = 0; i<num_threads; i++)
{
if(pthread_join(thrds[i], &status) != 0)
printf("error in joining thread in BangDB PUT");
if((long)status == -1)
successflag = false;
else
retval = (long)status;
}
te.end_counting();
printf("Overall time taken for writing and reading of %d items by %d threads for BangDB is;\n", num_items, num_threads);
te.print_time();
if(pthread_join(backg_thrd, &status) != 0)
printf("error in joining background thread for progress update");
if(successflag)
return (int)retval;
return -1;
}
int bangdb_server_bench_simple(table *tbl, int num_threads, int num_items)
{
printf("[SIMPLE CALL- performance test for BangDB] by inserting %d items using %d threads\n", num_items, num_threads);
pthread_t thrds[num_threads], backg_thrd;
pthread_attr_t attr;
bool successflag = true;
void *status;
int s = 0;long retval = 0;
time_eval te;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
//background thread for counting
if(pthread_create(&backg_thrd, &attr, progress_update, (void*)&num_threads) != 0)
{
printf("error in creating background thread for progress update");
exit(-1);
}
te.start_counting();
for(int i = 0; i<num_threads; i++)
{
targs[i].tbl = (void*)tbl;
targs[i].nstart = s;
targs[i].nend = s + (num_items/num_threads);
targs[i].ncomplete = 0;
if(pthread_create(&thrds[i], &attr, bangdb_server_threadfunc_simple, (void*)&targs[i]) != 0)
{
printf("error in creating thread in BangDB SIMPLE CALL, qutting");
exit(-1);
}
s += num_items/num_threads;
}
//wait for all threads to join
for(int i = 0; i<num_threads; i++)
{
if(pthread_join(thrds[i], &status) != 0)
printf("error in joining thread in BangDB SIMPLE CALL");
if((long)status == -1)
successflag = false;
else
retval = (long)status;
}
te.end_counting();
printf("Overall time taken for making simple call %d items by %d threads for BangDB is;\n", num_items, num_threads);
te.print_time();
if(pthread_join(backg_thrd, &status) != 0)
printf("error in joining the background progress update thread");
if(successflag)
return (int)retval;
return -1;
}
int bangdb_server_bench_put(table *tbl, int num_threads, int num_items)
{
printf("[PUT- performance test for BangDB] by inserting %d items using %d threads\n", num_items, num_threads);
pthread_t thrds[num_threads], backg_thrd;
pthread_attr_t attr;
bool successflag = true;
void *status;
int s = 0;long retval = 0;
time_eval te;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
//background thread for counting
if(pthread_create(&backg_thrd, &attr, progress_update, (void*)&num_threads) != 0)
{
printf("error in creating background thread for progress update");
exit(-1);
}
te.start_counting();
for(int i = 0; i<num_threads; i++)
{
targs[i].tbl = (void*)tbl;
targs[i].nstart = s;
targs[i].nend = s + (num_items/num_threads);
targs[i].ncomplete = 0;
if(pthread_create(&thrds[i], &attr, bangdb_server_threadfuncput, (void*)&targs[i]) != 0)
{
printf("error in creating thread in BangDB PUT, qutting");
exit(-1);
}
s += num_items/num_threads;
}
//wait for all threads to join
for(int i = 0; i<num_threads; i++)
{
if(pthread_join(thrds[i], &status) != 0)
printf("error in joining thread in BangDB PUT");
if((long)status == -1)
successflag = false;
else
retval = (long)status;
}
te.end_counting();
printf("Overall time taken for inserting %d items by %d threads for BangDB is;\n", num_items, num_threads);
te.print_time();
if(pthread_join(backg_thrd, &status) != 0)
printf("error in joining the background progress update thread");
if(successflag)
return (int)retval;
return -1;
}
int bangdb_server_bench_get(table *tbl, int num_threads, int num_items)
{
printf("[GET- performance test for BangdDB] by retrieving %d items using %d threads\n", num_items, num_threads);
pthread_t thrds[num_threads], backg_thrd;
pthread_attr_t attr;
bool successflag = true;
void *status;
int s = 0;long retval = 0;
time_eval te;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
//start background thread for progress update
if(pthread_create(&backg_thrd, &attr, progress_update, (void*)&num_threads) != 0)
{
printf("error in creating background thread for progress update");
exit(-1);
}
te.start_counting();
for(int i = 0; i<num_threads; i++)
{
targs[i].tbl = (void*)tbl;
targs[i].nstart = s;
targs[i].nend = s + (num_items/num_threads);
targs[i].ncomplete = 0;
if(pthread_create(&thrds[i], &attr, bangdb_server_threadfuncget, (void*)&targs[i]) != 0)
{
printf("error in creating thread in BangDB GET, qutting");
exit(-1);
}
s += num_items/num_threads;
}
//wait for all threads to join
for(int i = 0; i<num_threads; i++)
{
if(pthread_join(thrds[i], &status) != 0)
printf("error in joining thread in BangDB GET");
if((long)status == -1)
successflag = false;
else
retval = (long)status;
}
te.end_counting();
printf("Overall time taken for getting %d items by %d threads for BangDB is;\n", num_items, num_threads);
te.print_time();
if(pthread_join(backg_thrd, &status) != 0)
printf("error in joining background thread for progress update");
if(successflag)
return (int)retval;
return -1;
}
void bangdb_server_bench(int num_threads, int num_items, char *ops, int factor)
{
int retval = 0;
database *db;
table *tbl;
//create database, table and connection
bangdbEnv dbenv; //using all the default values defined in bangdb.config file kept locally
db = dbenv.openDatabase((char*)"mydb");
if((tbl = db->gettable((char*)"mytbl", OPENCREATE)) == NULL)
{
printf("table NULL error, quitting");
exit(-1);
}
if(strncmp(ops, "put", 3) == 0)
{
if((retval = bangdb_server_bench_put(tbl, num_threads, num_items)) < 0)
printf("Error in running the BangDB bench for PUT\n");
}
else if(strncmp(ops, "get", 3) == 0)
{
if((retval = bangdb_server_bench_get(tbl, num_threads, num_items)) < 0)
printf("Error in running the BangDB bench for GET\n");
}
else if(strncmp(ops, "all", 3) == 0)
{
if((retval = bangdb_server_bench_put(tbl, num_threads, num_items)) < 0)
printf("Error in running the BangDB bench for PUT\n");
if((retval = bangdb_server_bench_get(tbl, num_threads, num_items)) < 0)
printf("Error in running the BangDB bench for GET\n");
}
else if(strncmp(ops, "overlap", 7) == 0)
{
if((retval = bangdb_server_bench_getput(tbl, num_threads, num_items, factor)) < 0)
printf("Error in running the BangDB bench for overlap read and write\n");
}
else if(strncmp(ops, "simple", 6) == 0)
{
if((retval == bangdb_server_bench_simple(tbl, num_threads, num_items)) < 0)
printf("Error in running the BangDB bench for simple calls\n");
}
else
printf("Error in specifying the opertion type(put/get/all/overlap) for BangDB bench\n");
delete tbl;
db->closedatabase();
delete db;
if(retval != -1)
{
printf("The BangDB bench test was successful\n");
if(retval == 1)
printf("There were expected or unexptected mismatches in the retrieved values\n");
}
else
printf("There were errors in BangDB bench test\n");
}
| [
"sachin@iqlect.com"
] | sachin@iqlect.com |
076a87b7aee87f2a4e8b7d5e81f20036c94d7d93 | 170dd8b4d93da1f3431054a97cad2e7fabfffd09 | /opt/check_breadcrumbs/CheckBreadcrumbs.cpp | 87ceb6bc35cdd45cc81c1286c1f211f68cc28808 | [
"MIT"
] | permissive | urantialife/redex | 37959427c167df8d92622e3ad67c4ba8ae4e32d5 | 7c970695c7bb1ca3720c6843de7abcb0175faa8f | refs/heads/master | 2020-06-01T14:18:23.771227 | 2019-06-07T00:09:34 | 2019-06-07T00:22:25 | 190,811,580 | 1 | 0 | null | 2019-06-07T21:36:30 | 2019-06-07T21:36:29 | null | UTF-8 | C++ | false | false | 17,717 | cpp | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "CheckBreadcrumbs.h"
#include <algorithm>
#include <unordered_set>
#include <sstream>
#include "DexAccess.h"
#include "DexClass.h"
#include "DexUtil.h"
#include "IRCode.h"
#include "IRInstruction.h"
#include "Resolver.h"
#include "Walkers.h"
/**
* Performs 2 kind of verifications:
* 1- no references should be to a DexClass that is "internal"
* but not in scope (effectively deleted)
* 2- if a field or method reference is a def the field or method
* must exist on the class it is defined on
* Those are 2 relatively common problems we introduce: leave references
* to deleted types, methods or fields.
*/
namespace {
constexpr const char* METRIC_BAD_FIELDS = "bad_fields";
constexpr const char* METRIC_BAD_METHODS = "bad_methods";
constexpr const char* METRIC_BAD_TYPE_INSTRUCTIONS = "bad_type_instructions";
constexpr const char* METRIC_BAD_FIELD_INSTRUCTIONS = "bad_field_instructions";
constexpr const char* METRIC_BAD_METHOD_INSTRUCTIONS =
"bad_method_instructions";
constexpr const char* METRIC_ILLEGAL_CROSS_STORE_REFS =
"illegal_cross_store_refs";
bool class_contains(const DexField* field) {
const auto& cls = type_class(field->get_class());
if (cls == nullptr) return true;
for (const auto& cls_field : cls->get_ifields()) {
if (field == cls_field) return true;
}
for (const auto& cls_field : cls->get_sfields()) {
if (field == cls_field) return true;
}
return false;
}
bool class_contains(const DexMethod* method) {
const auto& cls = type_class(method->get_class());
if (cls == nullptr) return true;
for (const auto& cls_meth : cls->get_vmethods()) {
if (method == cls_meth) return true;
}
for (const auto& cls_meth : cls->get_dmethods()) {
if (method == cls_meth) return true;
}
return false;
}
using Fields = std::vector<const DexField*>;
using Methods = std::vector<const DexMethod*>;
using Instructions = std::vector<const IRInstruction*>;
using MethodInsns = std::map<const DexMethod*, Instructions, dexmethods_comparator>;
size_t illegal_elements(const MethodInsns& method_to_insns,
const char* msj,
std::ostringstream& ss) {
size_t num_illegal_cross_store_refs = 0;
for (const auto& pair : method_to_insns) {
const auto method = pair.first;
const auto& insns = pair.second;
ss << "Illegal " << msj << " in method "
<< method->get_deobfuscated_name() << std::endl;
num_illegal_cross_store_refs += insns.size();
for (const auto insn : insns) {
ss << "\t" << show_deobfuscated(insn) << std::endl;
}
}
return num_illegal_cross_store_refs;
}
} // namespace
Breadcrumbs::Breadcrumbs(const Scope& scope, DexStoresVector& stores, bool reject_illegal_refs_root_store)
: m_scope(scope),
m_xstores(stores),
m_reject_illegal_refs_root_store(reject_illegal_refs_root_store) {
m_classes.insert(scope.begin(), scope.end());
m_multiple_root_store_dexes = stores[0].get_dexen().size() > 1;
}
void Breadcrumbs::check_breadcrumbs() {
check_fields();
check_methods();
check_opcodes();
}
void Breadcrumbs::report_deleted_types(bool report_only, PassManager& mgr) {
size_t bad_fields_count = 0;
size_t bad_methods_count = 0;
size_t bad_type_insns_count = 0;
size_t bad_field_insns_count = 0;
size_t bad_meths_insns_count = 0;
if (m_bad_fields.size() > 0 || m_bad_methods.size() > 0 ||
m_bad_type_insns.size() > 0 || m_bad_field_insns.size() > 0 ||
m_bad_meth_insns.size() > 0) {
std::ostringstream ss;
for (const auto& bad_field : m_bad_fields) {
for (const auto& field : bad_field.second) {
bad_fields_count++;
ss << "Reference to deleted type " << SHOW(bad_field.first)
<< " in field " << SHOW(field) << std::endl;
}
}
for (const auto& bad_meth : m_bad_methods) {
for (const auto& meth : bad_meth.second) {
bad_methods_count++;
ss << "Reference to deleted type " << SHOW(bad_meth.first)
<< " in method " << SHOW(meth) << std::endl;
}
}
for (const auto& bad_insns : m_bad_type_insns) {
for (const auto& insns : bad_insns.second) {
for (const auto& insn : insns.second) {
bad_type_insns_count++;
ss << "Reference to deleted type " << SHOW(bad_insns.first)
<< " in instruction " << SHOW(insn) << " in method "
<< SHOW(insns.first) << std::endl;
}
}
}
for (const auto& bad_insns : m_bad_field_insns) {
for (const auto& insns : bad_insns.second) {
for (const auto& insn : insns.second) {
bad_field_insns_count++;
ss << "Reference to deleted field " << SHOW(bad_insns.first)
<< " in instruction " << SHOW(insn) << " in method "
<< SHOW(insns.first) << std::endl;
}
}
}
for (const auto& bad_insns : m_bad_meth_insns) {
for (const auto& insns : bad_insns.second) {
for (const auto& insn : insns.second) {
bad_meths_insns_count++;
ss << "Reference to deleted method " << SHOW(bad_insns.first)
<< " in instruction " << SHOW(insn) << " in method "
<< SHOW(insns.first) << std::endl;
}
}
}
TRACE(BRCR, 1,
"Dangling References in Fields: %ld"
"Dangling References in Methods: %ld\n"
"Dangling References in Type Instructions: %ld\n"
"Dangling References in Fields Field Instructions: %ld\n"
"Dangling References in Method Instructions: %ld\n",
bad_fields_count, bad_methods_count, bad_type_insns_count,
bad_field_insns_count, bad_meths_insns_count);
TRACE(BRCR, 2, "%s", ss.str().c_str());
always_assert_log(
report_only,
"ERROR - Dangling References (contact redex@on-call):\n%s",
ss.str().c_str());
} else {
TRACE(BRCR, 1, "No dangling references");
}
mgr.incr_metric(METRIC_BAD_FIELDS, bad_fields_count);
mgr.incr_metric(METRIC_BAD_METHODS, bad_methods_count);
mgr.incr_metric(METRIC_BAD_TYPE_INSTRUCTIONS, bad_type_insns_count);
mgr.incr_metric(METRIC_BAD_FIELD_INSTRUCTIONS, bad_field_insns_count);
mgr.incr_metric(METRIC_BAD_METHOD_INSTRUCTIONS, bad_meths_insns_count);
}
std::string Breadcrumbs::get_methods_with_bad_refs() {
std::ostringstream ss;
for (const auto& class_meth : m_bad_methods) {
const auto type = class_meth.first;
const auto& methods = class_meth.second;
ss << "Bad methods in class " << type->get_name()->c_str() << std::endl;
for (const auto method : methods) {
ss << "\t" << method->get_name()->c_str() << std::endl;
}
ss << std::endl;
}
for (const auto& meth_field : m_bad_fields_refs) {
const auto type = meth_field.first->get_class();
const auto method = meth_field.first;
const auto& fields = meth_field.second;
ss << "Bad field refs in method " << type->get_name()->c_str() << "."
<< method->get_name()->c_str() << std::endl;
for (const auto field : fields) {
ss << "\t" << field->get_name()->c_str() << std::endl;
}
ss << std::endl;
}
return ss.str();
}
void Breadcrumbs::report_illegal_refs(bool fail_if_illegal_refs,
PassManager& mgr) {
size_t num_illegal_fields = 0;
std::ostringstream ss;
for (const auto& pair : m_illegal_field) {
const auto type = pair.first;
const auto& fields = pair.second;
num_illegal_fields += fields.size();
ss << "Illegal fields in class "
<< type_class(type)->get_deobfuscated_name() << std::endl;
;
for (const auto field : fields) {
ss << "\t" << field->get_deobfuscated_name() << std::endl;
}
}
size_t num_illegal_type_refs =
illegal_elements(m_illegal_type, "type refs", ss);
size_t num_illegal_field_type_refs =
illegal_elements(m_illegal_field_type, "field type refs", ss);
size_t num_illegal_field_cls =
illegal_elements(m_illegal_field_cls, "field class refs", ss);
size_t num_illegal_method_calls =
illegal_elements(m_illegal_method_call, "method call", ss);
size_t num_illegal_cross_store_refs =
num_illegal_fields + num_illegal_type_refs + num_illegal_field_cls +
num_illegal_field_type_refs + num_illegal_method_calls;
mgr.set_metric(METRIC_ILLEGAL_CROSS_STORE_REFS, num_illegal_cross_store_refs);
TRACE(BRCR,
1,
"Illegal fields : %ld"
"Illegal type refs : %ld\n"
"Illegal field type refs : %ld\n"
"Illegal field cls refs : %ld\n"
"Illegal method calls : %ld\n",
num_illegal_fields,
num_illegal_type_refs,
num_illegal_field_type_refs,
num_illegal_field_cls,
num_illegal_method_calls);
TRACE(BRCR, 2, "%s", ss.str().c_str());
always_assert_log(ss.str().empty() || !fail_if_illegal_refs,
"ERROR - illegal cross store references "
"(contact redex@on-call):\n%s",
ss.str().c_str());
}
bool Breadcrumbs::has_illegal_access(const DexMethod* input_method) {
bool result = false;
if (input_method->get_code() == nullptr) {
return false;
}
for (const auto& mie : InstructionIterable(input_method->get_code())) {
auto* insn = mie.insn;
if (insn->has_field()) {
auto res_field = resolve_field(insn->get_field());
if (res_field != nullptr) {
if (!check_field_accessibility(input_method, res_field)) {
result = true;
}
} else if (referenced_field_is_deleted(insn->get_field())) {
result = true;
}
}
if (insn->has_method()) {
auto res_method =
resolve_method(insn->get_method(), opcode_to_search(insn));
if (res_method != nullptr) {
if (!check_method_accessibility(input_method, res_method)) {
result = true;
}
} else if (referenced_method_is_deleted(insn->get_method())) {
result = true;
}
}
}
return result;
}
bool Breadcrumbs::is_illegal_cross_store(const DexType* caller,
const DexType* callee) {
// Skip deleted types, as we don't know the store for those.
if (m_classes.count(type_class(caller)) == 0 ||
m_classes.count(type_class(callee)) == 0) {
return false;
}
size_t caller_store_idx = m_xstores.get_store_idx(caller);
size_t callee_store_idx = m_xstores.get_store_idx(callee);
if (m_multiple_root_store_dexes && caller_store_idx == 0 &&
callee_store_idx == 1 && !m_reject_illegal_refs_root_store) {
return false;
}
return m_xstores.illegal_ref_between_stores(caller_store_idx,
callee_store_idx);
}
const DexType* Breadcrumbs::check_type(const DexType* type) {
const auto& cls = type_class(type);
if (cls == nullptr) return nullptr;
if (cls->is_external()) return nullptr;
if (m_classes.count(cls) > 0) return nullptr;
return type;
}
const DexType* Breadcrumbs::check_method(const DexMethodRef* method) {
const auto& proto = method->get_proto();
auto type = check_type(proto->get_rtype());
if (type != nullptr) return type;
const auto& args = proto->get_args();
if (args == nullptr) return nullptr;
for (const auto& arg : args->get_type_list()) {
type = check_type(arg);
if (type != nullptr) return type;
}
return nullptr;
}
void Breadcrumbs::bad_type(const DexType* type,
const DexMethod* method,
const IRInstruction* insn) {
m_bad_type_insns[type][method].emplace_back(insn);
}
// verify that all field definitions are of a type not deleted
void Breadcrumbs::check_fields() {
walk::fields(m_scope, [&](DexField* field) {
const auto& type = check_type(field->get_type());
if (type == nullptr) {
const auto cls = field->get_class();
const auto field_type = field->get_type();
if (is_illegal_cross_store(cls, field_type)) {
m_illegal_field[cls].emplace_back(field);
}
return;
}
m_bad_fields[type].emplace_back(field);
});
}
// verify that all method definitions use not deleted types in their sig
void Breadcrumbs::check_methods() {
walk::methods(m_scope, [&](DexMethod* method) {
const auto& type = check_method(method);
if (type == nullptr) return;
m_bad_methods[type].emplace_back(method);
has_illegal_access(method);
});
}
/* verify that all method instructions that access fields are valid */
bool Breadcrumbs::check_field_accessibility(const DexMethod* method,
const DexField* res_field) {
const auto field_class = res_field->get_class();
const auto method_class = method->get_class();
if (field_class != method_class && is_private(res_field)) {
m_bad_fields_refs[method].emplace_back(res_field);
return false;
}
return true;
}
bool Breadcrumbs::referenced_field_is_deleted(DexFieldRef* field) {
return field->is_def() && !class_contains(static_cast<DexField*>(field));
}
bool Breadcrumbs::referenced_method_is_deleted(DexMethodRef* method) {
return method->is_def() && !class_contains(static_cast<DexMethod*>(method));
}
/* verify that all method instructions that access methods are valid */
bool Breadcrumbs::check_method_accessibility(
const DexMethod* method, const DexMethod* res_called_method) {
const auto called_method_class = res_called_method->get_class();
const auto method_class = method->get_class();
if (called_method_class != method_class && is_private(res_called_method)) {
m_bad_methods[method_class].emplace_back(res_called_method);
return false;
}
return true;
}
// verify that all opcodes are to non deleted references
void Breadcrumbs::check_type_opcode(const DexMethod* method,
IRInstruction* insn) {
const DexType* type = insn->get_type();
type = check_type(type);
if (type != nullptr) {
bad_type(type, method, insn);
} else {
const auto cls = method->get_class();
if (is_illegal_cross_store(cls, insn->get_type())) {
m_illegal_type[method].emplace_back(insn);
}
}
}
void Breadcrumbs::check_field_opcode(const DexMethod* method,
IRInstruction* insn) {
auto field = insn->get_field();
const DexType* type = check_type(field->get_class());
if (type != nullptr) {
bad_type(type, method, insn);
return;
}
auto cls = method->get_class();
if (is_illegal_cross_store(cls, field->get_class())) {
m_illegal_field_type[method].emplace_back(insn);
}
type = check_type(field->get_type());
if (type != nullptr) {
bad_type(type, method, insn);
return;
}
if (is_illegal_cross_store(cls, field->get_type())) {
m_illegal_field_cls[method].emplace_back(insn);
}
auto res_field = resolve_field(field);
if (res_field != nullptr) {
// a resolved field can only differ in the owner class
if (field != res_field) {
type = check_type(field->get_class());
if (type != nullptr) {
bad_type(type, method, insn);
return;
}
}
} else {
// the class of the field is around but the field may have
// been deleted so let's verify the field exists on the class
if (referenced_field_is_deleted(field)) {
m_bad_field_insns[static_cast<DexField*>(field)][method].emplace_back(
insn);
return;
}
}
}
void Breadcrumbs::check_method_opcode(const DexMethod* method,
IRInstruction* insn) {
const auto& meth = insn->get_method();
const DexType* type = check_method(meth);
if (type != nullptr) {
bad_type(type, method, insn);
return;
}
if (is_illegal_cross_store(method->get_class(), meth->get_class())) {
m_illegal_method_call[method].emplace_back(insn);
}
DexMethod* res_meth = resolve_method(meth, opcode_to_search(insn));
if (res_meth != nullptr) {
// a resolved method can only differ in the owner class
if (res_meth != meth) {
type = check_type(res_meth->get_class());
if (type != nullptr) {
bad_type(type, method, insn);
return;
}
}
} else {
// the class of the method is around but the method may have
// been deleted so let's verify the method exists on the class
if (referenced_method_is_deleted(meth)) {
m_bad_meth_insns[static_cast<DexMethod*>(meth)][method].emplace_back(
insn);
return;
}
}
}
void Breadcrumbs::check_opcodes() {
walk::opcodes(m_scope,
[](DexMethod*) { return true; },
[&](DexMethod* method, IRInstruction* insn) {
if (insn->has_type()) {
check_type_opcode(method, insn);
return;
}
if (insn->has_field()) {
check_field_opcode(method, insn);
return;
}
if (insn->has_method()) {
check_method_opcode(method, insn);
}
});
}
void CheckBreadcrumbsPass::run_pass(DexStoresVector& stores,
ConfigFiles& /* conf */,
PassManager& mgr) {
auto scope = build_class_scope(stores);
Breadcrumbs bc(scope, stores, reject_illegal_refs_root_store);
bc.check_breadcrumbs();
bc.report_deleted_types(!fail, mgr);
bc.report_illegal_refs(fail_if_illegal_refs, mgr);
}
static CheckBreadcrumbsPass s_pass;
| [
"facebook-github-bot@users.noreply.github.com"
] | facebook-github-bot@users.noreply.github.com |
021cf2c2419311a4b19e056feb537081e14b3fdc | 0e40a0486826825c2c8adba9a538e16ad3efafaf | /OutputMethods/AnaglyphOutput/stdafx.cpp | aa4ef1484a76dd4fdf8e5cef28988a1fe0c78dd6 | [
"MIT"
] | permissive | iraqigeek/iZ3D | 4c45e69a6e476ad434d5477f21f5b5eb48336727 | ced8b3a4b0a152d0177f2e94008918efc76935d5 | refs/heads/master | 2023-05-25T19:04:06.082744 | 2020-12-28T03:27:55 | 2020-12-28T03:27:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 448 | cpp | /* IZ3D_FILE: $Id$
*
* Project : iZ3D Stereo Driver
* Copyright (C) iZ3D Inc. 2002 - 2010
*
* $Author$
* $Revision$
* $Date$
* $LastChangedBy$
* $URL$
*/
// stdafx.cpp : source file that includes just the standard includes
// AnaglyphOutput.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
// TODO: reference any additional headers you need in STDAFX.H
// and not in this file
| [
"github@bo3b.net"
] | github@bo3b.net |
71225b3c61d235c0e921ace11d3dc7ad9ec7a89f | 001600a0ffab37c974b8d8eacccd36794cdc748c | /lcd/lcd.ino | d18268fa830992177cc5ac029fc7d8992d3fe5e0 | [] | no_license | erdahuja/Arduino-Codes | 81767204c917838f67ea3fc53c97c0ef9f099d61 | 87721ffd04bd541531b1c621f5d5a223ae751bbe | refs/heads/master | 2021-01-20T20:14:17.683836 | 2016-08-02T13:55:32 | 2016-08-02T13:55:32 | 61,364,596 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 745 | ino | int rs = 8 ;
int e = 9 ;
void setup()
{
for (int i = 0; i < 10; i++)
{
pinMode(i,OUTPUT) ;
}
}
char d1[] = {"HIMANSHI"} ;
char d2[a] = {"DEEPAK"} ;
void command(int x)
{
digitalWrite(rs, 0) ;
PORTD = x ;
enable() ;
}
void data(int x)
{
digitalWrite(rs, 1) ;
PORTD = x ;
enable() ;
}
void loop()
{
command(0x01);
delay(15) ;
command(0x38);
delay(15) ;
command(0x0E);
digitalWrite(8, 1) ;
delay(15) ;
for (int i = 0; d1[i]!='\0'; i++)
{
data(d1[i]);
delay(100) ;
}
delay(1000) ;
command(0x01);
delay(15) ;
for (int i = 0; d2[i]!='\0'; i++)
{
data(d2[i]);
delay(100) ;
}
delay(1000) ;
}
void enable()
{
digitalWrite(9, 1) ;
delay(20) ;
digitalWrite(9, 0) ;
}
| [
"er.d.ahuja@gmail.com"
] | er.d.ahuja@gmail.com |
4ea90ddc0c74439418b4ba646afbe1634cab1090 | 616d9e83ac7b0dafc37bb0a753da79bc10c9bd6d | /week--01/day-03/FavouriteNumber/main.cpp | 373fa54d6a83fb26ce03726de33c96547b8ba8ab | [] | no_license | green-fox-academy/Teleeeee | 7c8428922497a9bd76ea43de903e840a9cbdeaa5 | b7b8eff32c79e1ee03684096ee0ca246db389079 | refs/heads/master | 2020-07-19T06:58:07.323979 | 2020-01-30T21:18:02 | 2020-01-30T21:18:02 | 206,396,188 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 129 | cpp | #include <iostream>
int main() {
int a = 3 ;
std::cout << "My favourite number is:" << a <<std::endl;
return 0;
}
| [
"lev9433@gmail.com"
] | lev9433@gmail.com |
593a4b8accd43cd2d072b9b7c7f1fe70702b99c4 | a67eba5bac73aeb1dca7245d926bcfca94ae43cf | /Samples/DMDesigner/inc/Widgets/DUITreeEx.h | c93822bbc7142a91d88b3891fb9b0778c6872d7e | [] | no_license | skyformat99/directUI-REDM | f34f151bbfc9b88f6491894044cc5c46084826cb | 2703afc1c84add0b17cc20286e06cec87b620793 | refs/heads/master | 2020-03-07T17:51:25.748522 | 2018-03-29T08:48:39 | 2018-03-29T08:48:39 | 127,622,801 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 16,868 | h | //-------------------------------------------------------
// Copyright (c) DuiMagic
// All rights reserved.
//
// File Name: DUITreeEx.h
// File Des:
// File Summary:
// Cur Version: 1.0
// Author:
// Create Data:
// History:
// <Author> <Time> <Version> <Des>
// guoyou 2015-2-26 1.0
//-------------------------------------------------------
#pragma once
#include "DUIScrollBase.h"
#include "DUIItemPanel.h"
#include "DMTreeT.h"
namespace DMAttr
{
/// <summary>
/// <see cref="DM::DUITreeEx"/>的xml属性定义
/// </summary>
class DUITreeAttr:public DUIScrollBaseAttr
{
public:
static wchar_t* SKIN_toggleskin; ///< 展开、收起小三角图案,六种状态(收起三种+展开三种),示例:toggleskin="treetoggle"
static wchar_t* SKIN_checkskin; ///< 选中、不选中,半选中图案,用于启用了checkbox状态,9种状态(正常三种+选中三种+半选中三种),示例:checkskin="treecheck"
static wchar_t* SKIN_eyeskin; ///< 9种状态(正常三种+选中三种+半选中三种),示例:eyeskin="treecheck"
static wchar_t* SKIN_lockskin; ///< 9种状态(正常三种+选中三种+半选中三种),示例:lockskin="treecheck"
static wchar_t* SKIN_itembgskin; ///< 项所在的背景图案,正常/停留/选中,示例:itembgskin="itembgskin"
static wchar_t* COLOR_clritembg; ///< item项的背景色,示例:clritembg="pbgra(ff,ff,ff,ff)"
static wchar_t* COLOR_clritemhoverbg; ///< item项的停留背景色,示例:clritemhoverbg="pbgra(ff,ff,ff,ff)"
static wchar_t* COLOR_clritemselbg; ///< item项的选中背景色,示例:clritemselbg="pbgra(ff,ff,ff,ff)"
static wchar_t* INT_childoffset; ///< 子项相对于父项的偏移,可被具体项覆盖,示例:childoffset="20"
static wchar_t* INT_itemheight; ///< 每项高度,可被具体项覆盖,示例:itemheight="20"
static wchar_t* INT_itemwidth; ///< 每项宽度,可被具体项覆盖,示例:itemwidth="20"
static wchar_t* bool_brightclicksel; ///< 是否支持右击选中,示例:brightclicksel="1"
static wchar_t* bool_bcheckbox; ///< 是否启用checkbox,示例:bcheckbox="1"
static wchar_t* NODE_treeitem; ///< treectrl的xml项结点名
static wchar_t* ITEM_bcollapsed; ///< 项是否收缩,示例:bcollapsed="1"
static wchar_t* ITEM_height; ///< 项的高度(可选),示例:height="10"
static wchar_t* ITEM_width; ///< 项的宽度(可选),示例:weidth="10"
static wchar_t* ITEM_childoffset; ///< 项的宽度(可选),示例:childoffset="10"
static wchar_t* ITEM_data; ///< 项的数据,示例:data="1"
};
DMAttrValueInit(DUITreeAttr,SKIN_toggleskin)DMAttrValueInit(DUITreeAttr,SKIN_checkskin)DMAttrValueInit(DUITreeAttr,SKIN_eyeskin)DMAttrValueInit(DUITreeAttr,SKIN_lockskin)
DMAttrValueInit(DUITreeAttr,SKIN_itembgskin)DMAttrValueInit(DUITreeAttr,COLOR_clritembg)DMAttrValueInit(DUITreeAttr,COLOR_clritemhoverbg)
DMAttrValueInit(DUITreeAttr,COLOR_clritemselbg)DMAttrValueInit(DUITreeAttr,INT_childoffset)DMAttrValueInit(DUITreeAttr,INT_itemheight)DMAttrValueInit(DUITreeAttr,INT_itemwidth)
DMAttrValueInit(DUITreeAttr,bool_brightclicksel)DMAttrValueInit(DUITreeAttr,bool_bcheckbox)DMAttrValueInit(DUITreeAttr,NODE_treeitem)DMAttrValueInit(DUITreeAttr,ITEM_bcollapsed)
DMAttrValueInit(DUITreeAttr,ITEM_height)DMAttrValueInit(DUITreeAttr,ITEM_width)DMAttrValueInit(DUITreeAttr,ITEM_childoffset)DMAttrValueInit(DUITreeAttr,ITEM_data)
}
namespace DM
{
enum
{
DMTVEX_COLLAPSE = 1,///< 收缩
DMTVEX_EXPAND, ///< 展开
DMTVEX_TOGGLE, ///< 自动,原来是展开就收缩
};
enum ///< 绘制属性
{
DMTVEXMask_Toggle = 0x00000001UL,
DMTVEXMask_CheckBox = 0x00000002UL,
};
enum ///< 鼠标是否停留在小三角的矩形区域
{
DMTVEXBtn_None,
DMTVEXBtn_Toggle,
DMTVEXBtn_CheckBox,
DMTVEXBtn_Eye,
DMTVEXBtn_Lock,
};
enum
{
DMTVEXCheckBox_UnChecked, ///< 未选中
DMTVEXCheckBox_Checked, ///< 选中
DMTVEXCheckBox_PartChecked ///< 部分选中
};
enum
{
DMTVEXLock_UnLocked, ///< 未锁定
DMTVEXLock_Locked, ///< 锁定
DMTVEXLock_PartLocked ///< 部分锁定
};
enum
{
DMTVEXEye_Eyed, ///< 可见
DMTVEXEye_UnEye, ///< 不可见
DMTVEXEye_PartUnEyed ///< 部分不可见
};
/// <summary>
///
/// </summary>
typedef struct stTVITMEX
{
stTVITMEX(DMXmlNode XmlNode, IDMItemPanelOwner* pItemOwner)
{
pPanel.Attach(new DUIItemPanel(XmlNode,pItemOwner));
hItem = iHeight = iChildOffset = nLevel = lParam = NULL;
bVisible = true;
iWidth = 20;
iCheckValue = DMTVEXCheckBox_UnChecked;
iLockValue = DMTVEXLock_UnLocked;
iEyeValue = DMTVEXEye_Eyed;
bCollapsed = true;
bHasChildren = false;
dwToggleState = DUIWNDSTATE_Normal;
dwCheckBoxState = DUIWNDSTATE_Normal;
dwLockState = DUIWNDSTATE_Normal;
dwEyeState = DUIWNDSTATE_Normal;
}
virtual~stTVITMEX()
{
pPanel.Release();
}
DMSmartPtrT<DUIItemPanel> pPanel; ///< 面板
HDMTREEITEM hItem; ///< 在树中的标识
int nLevel; ///< 所处的层次
int iHeight; ///< 高度
int iWidth; ///< 宽度
int iChildOffset; ///< 子项相对于父项的偏移,在有toggleskin时,在计算时会自动加上toggleskin和checkskin的宽度(首项也会被全局的ichildoffset影响到,所以首项一般需自己配个ichildoffset=0)
int iCheckValue; ///< checkbox当前状态(正常,选中,半选中)
int iLockValue; ///< lock的当前状态(无锁,半锁,解锁)
int iEyeValue; ///< eye的当前状态(不可见,半可见,可见)
DWORD dwCheckBoxState; ///< checkbox状态(normal,hover,sel)
DWORD dwToggleState; ///< 折叠小三角的状态(normal,hover,sel)
DWORD dwLockState; ///< lock的的状态(normal,hover,sel)
DWORD dwEyeState; ///< eye的的状态(normal,hover,sel)
bool bCollapsed; ///< 折叠状态
bool bVisible; ///< 是否可见
bool bHasChildren; ///< 是否存在子树
LPARAM lParam; ///< data
}TVITEMEX,*LPTVITEMEX;
/// <summary>
/// DUITreeEx的内置实现,属性:<see cref="DMAttr::DUITreeAttr"/>
/// </summary>
class DUITreeEx
: public DUIScrollBase
, public IDMItemPanelOwner
, public DMTreeT<LPTVITEMEX>
{
DMDECLARE_CLASS_NAME(DUITreeEx, DUINAME_TreeCtrlEx,DMREG_Window)
public:
DUITreeEx();
~DUITreeEx();
public:
//---------------------------------------------------
// Function Des: 对外接口
//---------------------------------------------------
bool RemoveAllItems(); ///< 移除所有结点
bool RemoveItem(HDMTREEITEM hItem);
bool SetItemRect(HDMTREEITEM hItem, CRect rcItem); ///< 设置某项的区域
///---------------------------------
/// 插入函数
HDMTREEITEM InsertItem(LPTVITEMEX pData,HDMTREEITEM hParent,HDMTREEITEM hInsertAfter,BOOL bEnsureVisible);
HDMTREEITEM InsertItem(DMXmlNode &XmlItem,HDMTREEITEM hParent=DMTVI_ROOT, HDMTREEITEM hInsertAfter=DMTVI_LAST,BOOL bEnsureVisible=FALSE);
///---------------------------------
/// 获取系列函数,可参考CTreeCtrl的成员函数列表
HDMTREEITEM GetRootItem();
HDMTREEITEM GetRootItem(HDMTREEITEM hItem);
HDMTREEITEM GetNextSiblingItem(HDMTREEITEM hItem);
HDMTREEITEM GetPrevSiblingItem(HDMTREEITEM hItem);
HDMTREEITEM GetChildItem(HDMTREEITEM hItem,bool bFirst =true);
HDMTREEITEM GetParentItem(HDMTREEITEM hItem);
HDMTREEITEM GetSelectedItem();
HDMTREEITEM GetNextItem(HDMTREEITEM hItem);
bool SelectItem(HDMTREEITEM hItem,bool bEnsureVisible=true);
bool HoverItem(HDMTREEITEM hItem,bool bEnsureVisible=true);
bool ItemHasChildren(HDMTREEITEM hItem);
bool SetItemData(HDMTREEITEM hItem, LPARAM lParam);
LPARAM GetItemData(HDMTREEITEM hItem) const;
bool GetCheckState(HDMTREEITEM hItem) const;
bool SetCheckState(HDMTREEITEM hItem,bool bCheck);
bool SetLockState(HDMTREEITEM hItem,bool bLock);
bool SetEyeState(HDMTREEITEM hItem,bool bUnEye);
bool Expand(HDMTREEITEM hItem,UINT nCode = DMTVEX_EXPAND);
bool EnsureVisible(HDMTREEITEM hItem,bool bFirstVisible = false);
public:// 绘制!!!!
virtual void DrawItem(IDMCanvas* pCanvas,CRect& rc,HDMTREEITEM hItem);
virtual void RedrawItem(HDMTREEITEM hItem);
public:
DM_BEGIN_MSG_MAP()
DM_MSG_WM_PAINT(DM_OnPaint)
MSG_WM_DESTROY(OnDestroy)
MSG_WM_LBUTTONDOWN(OnLButtonDown)
MSG_WM_LBUTTONDBLCLK(OnLButtonDbClick)
MSG_WM_LBUTTONUP(OnLButtonUp)
MSG_WM_RBUTTONDOWN(OnRButtonDown);
MSG_WM_MOUSEMOVE(OnMouseMove)
MSG_WM_MOUSELEAVE(OnMouseLeave)
DM_MSG_WM_SETFOCUS(DM_OnSetFocus)
DM_MSG_WM_KILLFOCUS(DM_OnKillFocus)
MSG_WM_CHAR(OnChar)
MSG_WM_KEYDOWN(OnKeyDown)
MSG_WM_MOUSEWHEEL(OnMouseWheel)
MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST,WM_MOUSELAST,OnMouseEvent)
MESSAGE_RANGE_HANDLER_EX(WM_KEYFIRST,WM_KEYLAST,OnKeyEvent)
MESSAGE_RANGE_HANDLER_EX(WM_IME_STARTCOMPOSITION,WM_IME_KEYLAST,OnKeyEvent)
MESSAGE_HANDLER_EX(WM_IME_CHAR,OnKeyEvent)
DM_END_MSG_MAP()
public:
//---------------------------------------------------
// Function Des: DUI的消息分发系列函数
//---------------------------------------------------
void DM_OnPaint(IDMCanvas* pCanvas);
void OnDestroy();
void OnLButtonDown(UINT nFlags,CPoint pt);
void OnLButtonDbClick(UINT nFlags,CPoint pt);
void OnLButtonUp(UINT nFlags,CPoint pt);
void OnRButtonDown(UINT nFlags, CPoint pt);
void OnMouseMove(UINT nFlags,CPoint pt);
void OnMouseLeave();
void DM_OnSetFocus();
void DM_OnKillFocus();
void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
void OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags);
BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
LRESULT OnMouseEvent(UINT uMsg,WPARAM wParam,LPARAM lParam);
LRESULT OnKeyEvent(UINT uMsg,WPARAM wParam,LPARAM lParam);
public:
//---------------------------------------------------
// Function Des: 可重载函数
//---------------------------------------------------
virtual DMCode DV_CreateChildWnds(DMXmlNode &XmlNode);
virtual DMCode DV_OnSetCursor(const CPoint &pt);
virtual DMCode DV_OnUpdateToolTip(CPoint pt, DMToolTipInfo &tipInfo);
virtual void LoadBranch(HDMTREEITEM hParent,DMXmlNode &XmlItem);
virtual void LoadItemAttribute(DMXmlNode &XmlItem, LPTVITEMEX pData);
virtual void OnNodeFree(LPTVITEMEX &pItemData);
virtual int GetScrollLineSize(bool bVert){return m_iDefItemHei;};
// 抽象实现
DUIWindow* GetOwnerWindow();
DMCode OnSetCapture(DUIItemPanel* pPanel);
DMCode OnReleaseCapture(DUIItemPanel* pPanel);
DMCode OnGetPanelRect(DUIItemPanel* pPanel,LPRECT lpRect); ///< 请使用*lpRect赋值!
public:// 辅助
void SetChildrenVisible(HDMTREEITEM hItem,bool bVisible);
void SetChildrenState(HDMTREEITEM hItem,int iCheckValue);
void CheckState(HDMTREEITEM hItem, bool bCheck,bool bCheckChild = true);
bool CheckChildrenState(HDMTREEITEM hItem,bool bCheck);
bool IsAncestor(HDMTREEITEM hItem1,HDMTREEITEM hItem2); // hItem2是否为hItem1的子项
bool ItemIsValid(HDMTREEITEM hItem);
void ModifyToggleState(HDMTREEITEM hItem, DWORD dwStateAdd, DWORD dwStateRemove);
void ModifyChekcBoxState(HDMTREEITEM hItem, DWORD dwStateAdd, DWORD dwStateRemove);
void ModifyLockState(HDMTREEITEM hItem, DWORD dwStateAdd, DWORD dwStateRemove);
void ModifyEyeState(HDMTREEITEM hItem, DWORD dwStateAdd, DWORD dwStateRemove);
void ItemLButtonDown(HDMTREEITEM hItem, UINT nFlags,CPoint pt,CPoint ptsrc);
void ItemLButtonUp(HDMTREEITEM hItem, UINT nFlags,CPoint pt);
void ItemLButtonDbClick(HDMTREEITEM hItem, UINT nFlags,CPoint pt,CPoint ptsrc);
void ItemMouseMove(HDMTREEITEM hItem, UINT nFlags,CPoint pt,CPoint ptsrc);
void ItemMouseLeave(HDMTREEITEM hItem);
// eye+lock
bool IsParentLocked(HDMTREEITEM hItem);
bool IsParentUnEyed(HDMTREEITEM hItem);
void SetChildrenLockState(HDMTREEITEM hItem,bool bLocked);
void SetChildrenEyeState(HDMTREEITEM hItem,bool bUnEye);
// 位置相关
HDMTREEITEM HitTest(CPoint &pt); ///< 自动修改pt的位置为相对当前项的偏移量(如处于XOffset那一段区域,则pt.x为负值)
int ItemHitTest(HDMTREEITEM hItem,CPoint &pt, CPoint &ptsrc); ///<这里pt已被转换成为相对当前项的偏移量,ptsrc为原始的,只需判断x即可
int GetTotalHeight();
int GetTotalWidth();
int GetItemHeightWithAllChild(HDMTREEITEM hItem); ///< 计算某一项以及它的所有可见子项的总高度
int GetItemWidthWithAllChild(HDMTREEITEM hItem); ///< 计算某一项以及它的所有可见子项的总宽度
int GetItemXOffset(HDMTREEITEM hItem); ///< 计算某项到根结点的偏移(不可见设置为0)
int GetItemYOffset(HDMTREEITEM hItem); ///< 计算某项到根结点的偏移(不可见设置为0)
bool GetItemRect(HDMTREEITEM hItem,CRect &rcItem); ///< 计算某项区域(和rcClient处同一坐标系)
bool GetToggleRect(HDMTREEITEM hItem,CRect &rcToggle); ///< 计算某项toggle区域(和rcClient处同一坐标系)
bool GetCheckBoxRect(HDMTREEITEM hItem,CRect &rcCheckBox); ///< 计算某项checkbox区域(和rcClient处同一坐标系)
bool GetLockRect(HDMTREEITEM hItem,CRect &rcLock); ///< 计算某项lock区域(和rcClient处同一坐标系)
bool GetEyeRect(HDMTREEITEM hItem,CRect &rcEye); ///< 计算某项eye区域(和rcClient处同一坐标系)
void UpdateScrollRangeSize();
public:
DM_BEGIN_ATTRIBUTES()
DM_SKINPTR_ATTRIBUTE(DMAttr::DUITreeAttr::SKIN_toggleskin, m_pToggleSkin, DM_ECODE_NOXMLLOADREFRESH)
DM_SKINPTR_ATTRIBUTE(DMAttr::DUITreeAttr::SKIN_checkskin, m_pCheckSkin, DM_ECODE_NOXMLLOADREFRESH)
DM_SKINPTR_ATTRIBUTE(DMAttr::DUITreeAttr::SKIN_eyeskin, m_pEyeSkin, DM_ECODE_NOXMLLOADREFRESH)
DM_SKINPTR_ATTRIBUTE(DMAttr::DUITreeAttr::SKIN_lockskin, m_pLockSkin, DM_ECODE_NOXMLLOADREFRESH)
DM_SKINPTR_ATTRIBUTE(DMAttr::DUITreeAttr::SKIN_itembgskin, m_pItemBgSkin, DM_ECODE_NOXMLLOADREFRESH)
DM_INT_ATTRIBUTE(DMAttr::DUITreeAttr::INT_childoffset, m_iDefChildOffset, DM_ECODE_NOXMLLOADREFRESH)
DM_INT_ATTRIBUTE(DMAttr::DUITreeAttr::INT_itemheight, m_iDefItemHei, DM_ECODE_NOXMLLOADREFRESH)
DM_INT_ATTRIBUTE(DMAttr::DUITreeAttr::INT_itemwidth, m_iDefItemWid, DM_ECODE_NOXMLLOADREFRESH)
DM_bool_ATTRIBUTE(DMAttr::DUITreeAttr::bool_brightclicksel, m_bRightClickSel, DM_ECODE_NOXMLLOADREFRESH)
DM_bool_ATTRIBUTE(DMAttr::DUITreeAttr::bool_bcheckbox, m_bCheckBox, DM_ECODE_NOXMLLOADREFRESH)
DM_COLOR_ATTRIBUTE(DMAttr::DUITreeAttr::COLOR_clritembg, m_crItemBg[0],DM_ECODE_NOXMLLOADREFRESH)
DM_COLOR_ATTRIBUTE(DMAttr::DUITreeAttr::COLOR_clritemhoverbg,m_crItemBg[1],DM_ECODE_NOXMLLOADREFRESH)
DM_COLOR_ATTRIBUTE(DMAttr::DUITreeAttr::COLOR_clritemselbg, m_crItemBg[2],DM_ECODE_NOXMLLOADREFRESH)
DM_END_ATTRIBUTES()
public:
IDMSkinPtr m_pToggleSkin; ///< 小三角6连图
IDMSkinPtr m_pCheckSkin; ///< checkbox9连图
IDMSkinPtr m_pEyeSkin;
IDMSkinPtr m_pLockSkin;
IDMSkinPtr m_pItemBgSkin; ///< 背景三连图
DMColor m_crItemBg[3]; ///< 背景三连色
int m_iDefItemHei; ///< 项的默认高度
int m_iDefItemWid; ///< 项的默认宽度
int m_iDefChildOffset; ///< 子项相对父项默认偏移
bool m_bRightClickSel; ///< 是否支持右击选中
bool m_bCheckBox; ///< 是否启用checkbox
// 辅助
HDMTREEITEM m_hSelItem; ///< 当前选中项
HDMTREEITEM m_hHoverItem; ///< 当前停留项
HDMTREEITEM m_hCaptureItem; ///< 获得capture项(用于鼠标点击后再回复)
//
int m_nItemHoverBtn; ///< 对应小三角和checkbox
int m_nItemPushDownBtn;
//
DMSmartPtrT<DUIItemPanel> m_pCapturePanel; ///< 当前调用了setcapture的面板,此面板只在鼠标按下的瞬间设置,弹起清空
};
}//namespace DM | [
"80718901@qq.com"
] | 80718901@qq.com |
57b618de9fed3f286a1e8c6f99d50f4b982d8e48 | e0cd9e80e85676284b61aa77ab4cc536ce3a7efc | /src/WebApiMain.h | 758fc117bcc21773a3a51ce90b11b122e58c3a87 | [] | no_license | DanielLiu-326/bedrock-server-manager | 9be3bcadd2a935a7916d0a25e67bf95bedd93f2e | 84acc1e6096473081bfb406ea7960f8692c0b872 | refs/heads/master | 2023-07-23T03:12:28.128783 | 2021-02-01T10:27:35 | 2021-02-01T10:27:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,292 | h | //
// Created by danny on 2021/1/25.
//
#ifndef BEDROCKMGR_WEBAPIMAIN_H
#define BEDROCKMGR_WEBAPIMAIN_H
#include <cppcms/application.h>
#include <cppcms/applications_pool.h>
#include <cppcms/service.h>
#include <cppcms/http_response.h>
#include<cppcms/url_dispatcher.h>
#include<cppcms/url_mapper.h>
#include<cppcms/http_request.h>
#include<cppcms/rpc_json.h>
#include<cppcms/json.h>
#include"ServerMgr.h"
#include<set>
class WebApiMain:public cppcms::rpc::json_rpc_server
{
public:
explicit WebApiMain(cppcms::service &srv,ServerMgr *serverMgr,std::string pass);
void whitelist_list(std::string pass);
void whitelist_ar(std::string player,bool operation , std::string pass);
void command(std::string command,std::string pass);
void op(std::string name,bool operation,std::string pass);
void kick(std::string name,std::string reason,std::string pass);
void kill(std::string name,std::string pass);
void gamemode(std::string name,int mode ,std::string pass);
void permission_set(std::string name,int mode,std::string pass);
void say(std::string words ,std::string pass);
void list();
void start(std::string pass);
void stop(std::string pass);
private:
std::string pass;
ServerMgr* serverMgr;
};
#endif //BEDROCKMGR_WEBAPIMAIN_H
| [
"lhlh326@outlook.com"
] | lhlh326@outlook.com |
98a488e2ca9b48312bcaeeaae5e2c0afc6025251 | c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64 | /Engine/Source/ThirdParty/FakeIt/2.0.2/config/mstest/MsTestFakeit.hpp | 1e9ccadf3dd95feb729b34ba8a2936721b2ff88b | [
"MIT",
"LicenseRef-scancode-proprietary-license"
] | permissive | windystrife/UnrealEngine_NVIDIAGameWorks | c3c7863083653caf1bc67d3ef104fb4b9f302e2a | b50e6338a7c5b26374d66306ebc7807541ff815e | refs/heads/4.18-GameWorks | 2023-03-11T02:50:08.471040 | 2022-01-13T20:50:29 | 2022-01-13T20:50:29 | 124,100,479 | 262 | 179 | MIT | 2022-12-16T05:36:38 | 2018-03-06T15:44:09 | C++ | UTF-8 | C++ | false | false | 2,139 | hpp | #pragma once
#include <ostream>
#include "CppUnitTest.h"
#include "fakeit/DefaultFakeit.hpp"
#include "fakeit/EventHandler.hpp"
#include <CppUnitTestAssert.h>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace fakeit {
class MsTestAdapter: public EventHandler {
EventFormatter& _formatter;
public:
virtual ~MsTestAdapter() = default;
MsTestAdapter(EventFormatter& formatter):_formatter(formatter){}
virtual void handle(const UnexpectedMethodCallEvent& e) override
{
auto formattedMessage = _formatter.format(e);
std::wstring wFormattedMessage = to_wstring(formattedMessage);
Assert::Fail(wFormattedMessage.c_str());
}
virtual void handle(const SequenceVerificationEvent& e) override
{
auto formattedMessage = _formatter.format(e);
std::wstring wFormattedMessage = to_wstring(formattedMessage);
//std::wstring wfile = to_wstring(e.file());
//__LineInfo lineInfo(wfile.c_str(), e.callingMethod().c_str(), e.line());
//Assert::Fail(wFormattedMessage.c_str(), &lineInfo);
Assert::Fail(wFormattedMessage.c_str());
}
virtual void handle(const NoMoreInvocationsVerificationEvent& e) override
{
auto formattedMessage = _formatter.format(e);
std::wstring wFormattedMessage = to_wstring(formattedMessage);
//std::wstring wfile = to_wstring(e.file());
//__LineInfo lineInfo(wfile.c_str(), e.callingMethod().c_str(), e.line());
//Assert::Fail(wFormattedMessage.c_str(), &lineInfo);
Assert::Fail(wFormattedMessage.c_str());
}
std::wstring to_wstring(const std::string string) {
return std::wstring(string.begin(), string.end());
}
};
class MsTestFakeit: public DefaultFakeit {
public:
virtual ~MsTestFakeit() = default;
MsTestFakeit()
: _formatter(), _tpunitAdapter(*this) {
}
static MsTestFakeit &getInstance() {
static MsTestFakeit instance;
return instance;
}
protected:
fakeit::EventHandler &accessTestingFrameworkAdapter() override {
return _tpunitAdapter;
}
EventFormatter &accessEventFormatter() override {
return _formatter;
}
private:
DefaultEventFormatter _formatter;
MsTestAdapter _tpunitAdapter;
};
}
| [
"tungnt.rec@gmail.com"
] | tungnt.rec@gmail.com |
7ba2e1d283c770a6524f3c55143e3fd8357ba9e7 | 3a0d8d450e8fdac0177432081ea86751da594970 | /src/mcu/Response.h | b1743e9809ce5d317772633c029ed44e49373a29 | [
"MIT"
] | permissive | anatoly-kryzhanovsky/weather-informer | 292a90a329035a1ba7ab5a25d79b49280c81eac9 | 8b54871a16985f698637a53de01839c0f2b09d35 | refs/heads/master | 2020-04-08T06:50:50.754753 | 2020-03-10T03:15:42 | 2020-03-10T03:15:42 | 159,115,205 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 171 | h | #pragma once
class Response
{
private:
const int MaxLineLength = 512;
public:
const char* getContent();
int status();
private:
const char* readLine();
};
| [
"anatoly.kryzhanovsky@gmail.com"
] | anatoly.kryzhanovsky@gmail.com |
63ce30a9a940fca001806707dc39eb02415e59db | 55f52e1b94fe7e9e5b5e5c7fb1eca84aed39c42c | /zbSpire.cpp | d1d2ab005f7787c45b46a628b7a063e474b3c86c | [] | no_license | junghoon88/starcraft | 9d2b9e74f026b1a02ca6b09f1fa2d4c7a2cecd00 | 33710f5d079c8e9c3521c7f678f3dc203df84f04 | refs/heads/master | 2021-09-10T16:43:42.007167 | 2018-03-29T13:59:16 | 2018-03-29T13:59:16 | 112,726,773 | 3 | 1 | null | null | null | null | UHC | C++ | false | false | 6,931 | cpp | #include "stdafx.h"
#include "zbSpire.h"
#include "zergDefine.h"
#include "player.h"
zbSpire::zbSpire(PLAYER playerNum)
{
_valid = true;
//플레이어 정보
_playerNum = playerNum;
//종족
_race = RACES_ZERG;
//유닛인지 건물인지
_isBuilding = true;
//유닛 고유 번호
_buildingNumZ = BUILDINGNUM_ZERG_SPIRE;
}
zbSpire::~zbSpire()
{
}
HRESULT zbSpire::init(POINT ptTile)
{
initBaseStatus();
initBattleStatus(ptTile);
return S_OK;
}
void zbSpire::initBaseStatus(void)
{
//Properties
_stprintf(_baseStatus.name, L"Zerg Spire");
TCHAR strKey[100];
_stprintf(strKey, L"ZB-spire-Body%d", _playerNum);
_baseStatus.imgBody = IMAGEMANAGER->findImage(strKey);
_baseStatus.imgFace = IMAGEMANAGER->findImage(L"ZB-Face");
_baseStatus.imgStat1 = IMAGEMANAGER->findImage(L"ZB-spire-Stat1");
_baseStatus.imgStat2 = NULL;
_baseStatus.maxHP = 600.0f;
_baseStatus.useSH = FALSE;
_baseStatus.maxSH = 0.0f;
_baseStatus.useMP = FALSE;
_baseStatus.maxMP = 0.0f;
_baseStatus.sight = 7.0f;
_baseStatus.detector = FALSE;
_baseStatus.isAir = FALSE;
_baseStatus.unitSize = UNITSIZE_LARGE;
_baseStatus.transportslots = 0;
_baseStatus.armor = 1;
//_baseStatus.armorPlus = 1;
//combat
_baseStatus.sameGWAW = FALSE;
_baseStatus.GWable = FALSE;
_baseStatus.AWable = FALSE;
}
void zbSpire::initBattleStatus(POINT ptTile)
{
//BattleStatus
_battleStatus.curCommand = COMMAND_NONE;
_battleStatus.clicked = false;
_battleStatus.curHP = _baseStatus.maxHP; //현재 HP
_battleStatus.maxHP = _baseStatus.maxHP; //최대 HP
POINT buildTileSize = BUILDSIZE_SPIRE;
_battleStatus.ptTile = ptTile;
_battleStatus.rcBody = RectMake(ptTile.x * TILESIZE, ptTile.y * TILESIZE, buildTileSize.x * TILESIZE, buildTileSize.y * TILESIZE);
_battleStatus.pt.set((_battleStatus.rcBody.left + _battleStatus.rcBody.right) * 0.5f, (_battleStatus.rcBody.top + _battleStatus.rcBody.bottom) * 0.5f);
_battleStatus.rcTile = RectMake(ptTile.x, ptTile.y, buildTileSize.x, buildTileSize.y);
_battleStatus.rcEllipse = _battleStatus.rcBody;
}
void zbSpire::release(void)
{
}
void zbSpire::update(void)
{
Building::update();
}
void zbSpire::render(int imgOffsetX, int imgOffsetY)
{
POINT imgOffset = BUILDIMAGEOFFSET_SPIRE;
Building::render(imgOffset.x * TILESIZE, imgOffset.y * TILESIZE);
}
void zbSpire::updateBattleStatus(void)
{
}
void zbSpire::updatePosition(void)
{
}
void zbSpire::updateImageFrame(void)
{
float tick = TIMEMANAGER->getElapsedTime();
_battleStatus.bodyFrameTime += tick;
if (_battleStatus.bodyFrameTime >= UNIT_BODY_FPS_TIME)
{
_battleStatus.bodyFrameTime -= UNIT_BODY_FPS_TIME;
_battleStatus.bodyFrame.x++;
if (_battleStatus.bodyFrame.x > _baseStatus.imgBody->getMaxFrameX())
{
_battleStatus.bodyFrame.x = 0;
}
}
}
void zbSpire::updateProcessing(void)
{
Building::updateProcessing();
}
void zbSpire::updateCommandSet(void)
{
if (_processing.type == PROCESSING_EVOLVING)
{
_baseStatus.commands[0] = COMMAND_NONE;
_baseStatus.commands[1] = COMMAND_NONE;
_baseStatus.commands[6] = COMMAND_NONE;
_baseStatus.commands[8] = COMMAND_ESC;
}
else
{
tagUpgrade upgFlyatk = _player->getZergUpgrade()->getUpgrade()[UPGRADE_ZERG_FLYERATTACKS];
tagUpgrade upgFlydep = _player->getZergUpgrade()->getUpgrade()[UPGRADE_ZERG_FLYERCARAPACE];
if (upgFlyatk.complete || upgFlyatk.isProcessing)
{
_baseStatus.commands[0] = COMMAND_NONE;
}
else
{
_baseStatus.commands[0] = COMMAND_UPGRADE_ZERG_FLYERATTACKS;
}
if (upgFlydep.complete || upgFlydep.isProcessing)
{
_baseStatus.commands[1] = COMMAND_NONE;
}
else
{
_baseStatus.commands[1] = COMMAND_UPGRADE_ZERG_FLYERCARAPACE;
}
_baseStatus.commands[6] = COMMAND_BUILD_GREATERSPIRE;
_baseStatus.commands[8] = COMMAND_NONE;
}
}
void zbSpire::procCommands(void)
{
switch (_battleStatus.curCommand)
{
case COMMAND_UPGRADE_ZERG_FLYERATTACKS:
{
tagUpgrade upgFlyatk = _player->getZergUpgrade()->getUpgrade()[UPGRADE_ZERG_FLYERATTACKS];
if (_player->useResource(upgFlyatk.vCost[upgFlyatk.level].mineral, upgFlyatk.vCost[upgFlyatk.level].gas))
{
//성공
_processing.type = PROCESSING_EVOLVING;
_processing.command = _battleStatus.curCommand;
_processing.img = IMAGEMANAGER->findImage(L"command-upgrade_zerg_flyerattacks");
_processing.curTime = 0.0f;
_processing.maxTime = upgFlyatk.vCost[upgFlyatk.level].duration;
_processing.complete = false;
_player->getZergUpgrade()->setUpgradeIsProcessing(UPGRADE_ZERG_FLYERATTACKS, true);
}
_battleStatus.curCommand = COMMAND_NONE;
}
break;
case COMMAND_UPGRADE_ZERG_FLYERCARAPACE:
{
tagUpgrade upgFlydep = _player->getZergUpgrade()->getUpgrade()[UPGRADE_ZERG_CARAPACE];
if (_player->useResource(upgFlydep.vCost[upgFlydep.level].mineral, upgFlydep.vCost[upgFlydep.level].gas))
{
//성공
_processing.type = PROCESSING_EVOLVING;
_processing.command = _battleStatus.curCommand;
_processing.img = IMAGEMANAGER->findImage(L"command-upgrade_zerg_flyercarapace");
_processing.curTime = 0.0f;
_processing.maxTime = upgFlydep.vCost[upgFlydep.level].duration;
_processing.complete = false;
_player->getZergUpgrade()->setUpgradeIsProcessing(UPGRADE_ZERG_CARAPACE, true);
}
_battleStatus.curCommand = COMMAND_NONE;
}
break;
case COMMAND_BUILD_GREATERSPIRE:
{
tagProduction buildCost = _player->getZergProductionInfo()->getZBProductionInfo(BUILDINGNUM_ZERG_GREATERSPIRE);
if (_player->useResource(buildCost.costMinerals, buildCost.costGas))
{
//성공
zbMutating* nextBuilding = new zbMutating(_playerNum, BUILDINGNUM_ZERG_GREATERSPIRE, this);
nextBuilding->setLinkAdressZergUpgrade(_zergUpgrade);
nextBuilding->setLinkAdressAstar(_aStar);
nextBuilding->setLinkAdressPlayer(_player);
nextBuilding->init(_battleStatus.ptTile);
//HP 업데이트
_player->addBuilding(nextBuilding);
_nextObject = nextBuilding;
_valid = false;
}
_battleStatus.curCommand = COMMAND_NONE;
}
break;
case COMMAND_ESC:
{
if (_processing.command == COMMAND_UPGRADE_ZERG_FLYERATTACKS)
{
tagUpgrade upgFlyatk = _player->getZergUpgrade()->getUpgrade()[UPGRADE_ZERG_FLYERATTACKS];
_player->addResource((UINT)(upgFlyatk.vCost[upgFlyatk.level].mineral * CANCLE_RESOURCE), (UINT)(upgFlyatk.vCost[upgFlyatk.level].gas * CANCLE_RESOURCE));
upgFlyatk.isProcessing = false;
upgFlyatk.complete = false;
}
else if (_processing.command == COMMAND_UPGRADE_ZERG_FLYERCARAPACE)
{
tagUpgrade upgFlydep = _player->getZergUpgrade()->getUpgrade()[UPGRADE_ZERG_FLYERCARAPACE];
_player->addResource((UINT)(upgFlydep.vCost[upgFlydep.level].mineral * CANCLE_RESOURCE), (UINT)(upgFlydep.vCost[upgFlydep.level].gas * CANCLE_RESOURCE));
upgFlydep.isProcessing = false;
upgFlydep.complete = false;
}
ZeroMemory(&_processing, sizeof(tagProcessing));
_battleStatus.curCommand = COMMAND_NONE;
}
break;
}
}
| [
"theking2412@naver.com"
] | theking2412@naver.com |
b9a24f4308ebffba7ca463d14885cc3762f44940 | 7d93200196721592badd48ae583c4f14f5f0c7fb | /BIT4/IPK/Proj1/server.cpp | 0fb6c4a8c84528758684d71fb5d3c1cd6912af93 | [] | no_license | martinagrzybowska/VUT-FIT | cfe2ba425244da3825c8ac1ff447ec4a7eac042f | 0cbe0e086640ff908f4e75777a219790e771de00 | refs/heads/master | 2023-01-29T06:51:27.823461 | 2018-04-27T20:42:24 | 2018-04-27T20:42:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,932 | cpp | #include "shared.h"
#include "ftrestd.h"
/**
* P_args parses command line arguments
*/
int P_args(int argc, char * argv[], int *port, string *directory) {
int out;
char *str_err;
bool flag_r = false, flag_p = false;
while ((out = getopt(argc, argv, "r:p:")) != EOF) {
switch (out) {
case 'r':
if (flag_r == false) {
struct stat buf;
if (stat(optarg, &buf) != -1) {
if (S_ISDIR(buf.st_mode)) {
*directory = optarg;
flag_r = true;
break;
}
}
}
return OPTS_ERR;
case 'p':
if (flag_p == false) {
*port = strtol(optarg, &str_err, 10);
//check range of available ports
if (*str_err != '\0' || *port > 65535 || *port < 1024) {
return OPTS_ERR;
}
flag_p = true;
break;
}
else {
return OPTS_ERR;
}
default:
return OPTS_ERR;
}
}
argc -= optind;
argv += optind;
if (argc != 0) {
return OPTS_ERR;
}
return ALL_OK;
}
/**
* Ch_remote_path performs a check whether the remote path is correct
* in combination with the given command
*/
int Ch_remote_path(string check_path, string root_dir, TS_args *Uni_struct) {
string user_account;
// - - - - - - - - - - - - - - Checking slash
//ditch first slash
check_path = check_path.substr(1);
// if there was no slash after the initial one, only LST is valid
if (check_path.find('/') == string::npos) {
if (Uni_struct->command == LST) {
user_account = '/' + check_path;
}
else {
return FORBIDDEN; //Unknown error
}
}
else {
//if /foo/ and nothing else
if (check_path.substr(check_path.find('/') + 1) == "") {
if (Uni_struct->command == LST) {
user_account = '/' + check_path.substr(0, check_path.length() - 1);
}
else {
return FORBIDDEN; //Unknown error
}
}
//if /foo/boo, take the foo for further checking
else {
user_account = '/' + check_path.substr(0, check_path.find('/'));
}
}
check_path = '/' + check_path;
// if foo is a dir, boo is user, if the last char of root is slash
if (root_dir.substr(root_dir.length() - 1) == "/") {
Uni_struct->path = root_dir.substr(0, root_dir.length() - 1) + check_path;
user_account = root_dir.substr(0, root_dir.length() - 1) + user_account;
}
else {
Uni_struct->path = root_dir + check_path;
user_account = root_dir + user_account;
}
// - - - - - - - - - - - - - - Deleting "%20"
size_t iter;
while ((iter = Uni_struct->path.find("%20")) != string::npos) {
Uni_struct->path = Uni_struct->path.replace(iter, 3, " ");
}
while ((iter = user_account.find("%20")) != string::npos) {
user_account = user_account.replace(iter, 3, " ");
}
// - - - - - - - - - - - - - - Checking user existence
struct stat buf;
if (stat(user_account.c_str(), &buf) != -1) {
if (S_ISDIR(buf.st_mode)) {
;
}
else {
return N_EXIST_USR; //User account not found
}
}
else {
return N_EXIST_USR; //User account not found
}
// - - - - - - - - - - - - - - Forbidding backtracking
if (Uni_struct->path.find("/../") != string::npos) {
return FORBIDDEN;
}
// - - - - - - - - - - - - - - Checking dir/file existence and combinations
if (stat(Uni_struct->path.c_str(), &buf) != -1) {
if (S_ISDIR(buf.st_mode)) {
// "Not a file." when REMOTE-PATH points to a dir, but either DEL or GET was used
// PUT wouldnt know what to name the file, if only dir was specified
if (Uni_struct->command == DEL || Uni_struct->command == GET || Uni_struct->command == PUT) {
return WRONG_TYPE_FILE;
}
// "Already exists." when REMOTE-PATH points to a dir/file that already exists and either MKD or PUT was used
else if (Uni_struct->command == MKD) {
return EXIST;
}
}
else if (S_ISREG(buf.st_mode)) {
// "Not a dir." when REMOTE-PATH points to a file, but either RMD or LST was used
// MKD would not be able to create a dir with a name of an existing file
if (Uni_struct->command == LST || Uni_struct->command == RMD || Uni_struct->command == MKD) {
return WRONG_TYPE_DIR;
}
// "Already exists." when REMOTE-PATH points to a dir/file that already exists and either MKD or PUT was used
else if (Uni_struct->command == PUT) {
return EXIST;
}
}
//something not a file or not a dir
else {
return HTTP_ERR;
}
}
//if it does not exist, it is ok for MKD or PUT so far, will check later
else if (Uni_struct->command == MKD || Uni_struct->command == PUT) {
;
}
// "File not found." file does not exists
else if (Uni_struct->command == DEL || Uni_struct->command == GET) {
return N_EXIST_FILE;
}
// "Directory not found." directory does not exist
else if (Uni_struct->command == LST || Uni_struct->command == RMD) {
return N_EXIST_DIR;
}
// Shouldn't really be able to get here
else {
return HTTP_ERR;
}
return ALL_OK;
}
/**
* P_header parses incoming header string and the contents
*/
int P_header(string parse_header, string root_dir, TS_args *header_struct) {
string tmp_aid, tmp_aid2;
//get content length in order to know number of data bytes
char*str_err;
tmp_aid = parse_header.substr(parse_header.find("Content-Length: ") + 16);
header_struct->content_length = (int) strtol(tmp_aid.substr(0, tmp_aid.find("\r\n")).c_str(), &str_err, 10);
//get the first line
tmp_aid = parse_header.substr(0, parse_header.find("\r\n"));
if (tmp_aid.substr(tmp_aid.length() - 9) != " HTTP/1.1") {
return HTTP_ERR;
}
//ditch " HTTP/1.1"
tmp_aid = tmp_aid.substr(0, tmp_aid.length() - 9);
if (tmp_aid.substr(tmp_aid.length() - 4) == "file") {
header_struct->type = "file";
tmp_aid = tmp_aid.substr(0, (tmp_aid.length() - 10));
}
else if (tmp_aid.substr(tmp_aid.length() - 6) == "folder") {
header_struct->type = "folder";
tmp_aid = tmp_aid.substr(0, tmp_aid.length() - 12);
}
else {
return HTTP_ERR;
}
//load commands
tmp_aid2 = tmp_aid.substr(0, 4);
if (tmp_aid2 == "GET ") {
if (header_struct->type == "file") {
header_struct->command = GET;
}
else {
header_struct->command = LST;
}
}
else if (tmp_aid2 == "PUT ") {
if (header_struct->type == "file") {
header_struct->command = PUT;
}
else {
header_struct->command = MKD;
}
}
else if (tmp_aid2 == "DELE") {
if (header_struct->type == "file") {
header_struct->command = DEL;
}
else {
header_struct->command = RMD;
}
}
else {
return HTTP_ERR;
}
//ditch command
if (header_struct->command == DEL || header_struct->command == RMD) {
tmp_aid = tmp_aid.substr(7);
}
else {
tmp_aid = tmp_aid.substr(4);
}
//get data
header_struct->data = parse_header.substr(parse_header.find("\r\n\r\n") + 4, header_struct->content_length);
//check whether the path is correct and its combination with the current command
int check_err = Ch_remote_path(tmp_aid, root_dir, header_struct);
return check_err;
}
/**
* command_DEL represents DEL
*/
int command_DEL(string path_to_dir) {
return remove(path_to_dir.c_str());
}
/**
* command_MKD represents MKD
*/
int command_MKD(string path_to_dir) {
errno = 0;
if (mkdir(path_to_dir.c_str(), 0755) == -1) {
if (errno == ENOTDIR || errno == ENOENT) {
return N_EXIST_DIR;
}
else {
return COMM_ERR;
}
}
return ALL_OK;
}
/**
* command_RMD represents RMD
*/
int command_RMD(string path_to_dir) {
if (!rmdir(path_to_dir.c_str())) {
return ALL_OK;
}
//"Directory not empty." if remote path points to a dir which is not empty
else {
return COMM_ERR;
}
}
/**
* command_LST represents LST
*/
string command_LST(string path_to_dir) {
DIR *d;
string rollingDung;
struct dirent *dir;
d = opendir(path_to_dir.c_str());
if (d) {
while ((dir = readdir(d)) != NULL) {
string tmp_aid = string(dir->d_name);
if (tmp_aid.substr(0, 1) != ".") {
rollingDung += tmp_aid + '\n';
}
}
closedir(d);
return rollingDung;
}
//if something went wrong, return ".", because it can not be there
rollingDung = ".";
return rollingDung;
}
/**
* command_PUT represents PUT
*/
int command_PUT(TS_args *put_here) {
errno = 0;
FILE *received_file = fopen(put_here->path.c_str(), "w");
if (received_file == NULL) {
if (errno == ENOENT || errno == ENOTDIR) {
return N_EXIST_DIR;
}
else {
return COMM_ERR;
}
}
fwrite(put_here->data.c_str(), sizeof(char), put_here->content_length, received_file);
fclose(received_file);
return ALL_OK;
}
/**
* command_GET represents GET
*/
TS_args command_GET(TS_args *get_this) {
ifstream tmp_aid(get_this->path.c_str(), ios::binary|ios::ate);
ifstream::pos_type tmp_aid2 = tmp_aid.tellg();
std::vector<char> byte_array(tmp_aid2);
tmp_aid.seekg(0, ios::beg);
tmp_aid.read(&byte_array[0], tmp_aid2);
get_this->content_length = byte_array.size();
get_this->data = string(byte_array.begin(), byte_array.end());
return *get_this;
}
/**
* create_response combines gathered information from both structures and
* creates a response string which is to be sent to the client
*/
string create_response(T_post build_struct, TS_args add_struct) {
string rollingDung = "HTTP/1.1 " + build_struct.code_phrase + "\r\n";
char buffer[1024];
time_t timestamp = time(0);
struct tm tm_struct = *localtime(×tamp);
strftime(buffer, sizeof buffer, "%a, %d %b %Y %H:%M:%S %Z", &tm_struct);
rollingDung += "Date: " + string(buffer) + "\r\n";
// - - - - - - - - - - - - - - - - - other commands
if (build_struct.which_comm != GET) {
rollingDung += "Content-Type: text/plain\r\n";
if (build_struct.which_comm == LST) {
rollingDung += "Content-Length: " + to_string(build_struct.text_resp.length()) + "\r\nContent-Encoding: identity\r\n\r\n";
rollingDung += build_struct.text_resp;
}
else if (build_struct.was_error == false) {
rollingDung += "Content-Length: 15\r\nContent-Encoding: identity\r\n\r\nMessage: All ok";
}
else {
rollingDung += "Content-Length: " + to_string(build_struct.text_resp.length()) + "\r\nContent-Encoding: identity\r\n\r\n";
rollingDung += build_struct.text_resp;
}
}
// - - - - - - - - - - - - - - - - - GET command
else {
// if everything was ok, stick data onto the header
if (build_struct.was_error == false) {
rollingDung += "Content-Type: octet/stream\r\n";
rollingDung += "Content-Length: " + to_string(add_struct.content_length) + "\r\nContent-Encoding: identity\r\n\r\n";
rollingDung += add_struct.data;
}
// else add error message
else {
rollingDung += "Content-Type: text/plain\r\n";
rollingDung += "Content-Length: " + to_string(build_struct.text_resp.length()) + "\r\nContent-Encoding: identity\r\n\r\n";
rollingDung += build_struct.text_resp;
}
}
return rollingDung;
}
/**
* evaulate_codes evaulates either number of the error code a which command was used,
* it also calls command functions if everything was correct
*/
void evaulate_codes(int controller, T_post *fill_struct, TS_args *check_struct) {
fill_struct->text_resp = "";
//- - - - - - - - - - - - - - errors
if (controller == HTTP_ERR) {
fill_struct->code_phrase = "406 Not acceptable";
fill_struct->text_resp = "Unknown error.";
fill_struct->was_error = true;
}
else if (controller == WRONG_TYPE_DIR) {
fill_struct->code_phrase = "400 Bad Request";
fill_struct->text_resp = "Not a directory."; //lst rmd
fill_struct->was_error = true;
}
else if (controller == FORBIDDEN) {
fill_struct->code_phrase = "403 Forbidden";
fill_struct->text_resp = "Unknown error."; //lst rmd
fill_struct->was_error = true;
}
else if (controller == N_EXIST_USR) {
fill_struct->code_phrase = "404 Not found";
fill_struct->text_resp = "User account not found."; //lst rmd
fill_struct->was_error = true;
}
else if (controller == WRONG_TYPE_FILE) {
fill_struct->code_phrase = "400 Bad Request";
fill_struct->text_resp = "Not a file."; //del get
fill_struct->was_error = true;
}
else if (controller == EXIST) {
fill_struct->code_phrase = "418 I'm a teapot ¯\\_(ツ)_/¯";
fill_struct->text_resp = "Already exists."; //mkd put
fill_struct->was_error = true;
}
else if (controller == N_EXIST_FILE) {
fill_struct->code_phrase = "404 Not found";
fill_struct->text_resp = "File not found."; //del get
fill_struct->was_error = true;
}
else if (controller == N_EXIST_DIR) {
fill_struct->code_phrase = "404 Not found";
fill_struct->text_resp = "Directory not found."; //lst rmd
fill_struct->was_error = true;
}
//- - - - - - - - - - - - - - command functions
else {
//- - - - - - - DEL
if (check_struct->command == DEL) {
if (command_DEL(check_struct->path)) {
fill_struct->code_phrase = "500 Internal Server Error";
fill_struct->text_resp = "Unknown error.";
fill_struct->was_error = true;
}
else {
fill_struct->code_phrase = "200 OK";
fill_struct->was_error = false;
}
}
//- - - - - - - RMD
else if (check_struct->command == RMD) {
if (command_RMD(check_struct->path) == COMM_ERR) {
fill_struct->code_phrase = "406 Not acceptable";
fill_struct->text_resp = "Directory not empty."; //rmd
fill_struct->was_error = true;
}
else {
fill_struct->code_phrase = "200 OK";
fill_struct->was_error = false;
}
}
//- - - - - - - LST
else if (check_struct->command == LST) {
fill_struct->text_resp = command_LST(check_struct->path);
if (fill_struct->text_resp == ".") {
fill_struct->was_error = true;
fill_struct->code_phrase = "500 Internal Server Error";
fill_struct->text_resp = "Unknown error.";
}
else {
fill_struct->which_comm = LST;
fill_struct->code_phrase = "200 OK";
fill_struct->was_error = false;
}
}
//- - - - - - - MKD
else if (check_struct->command == MKD) {
int temp = command_MKD((check_struct->path));
if (temp == COMM_ERR) {
fill_struct->code_phrase = "500 Internal Server Error";
fill_struct->text_resp = "Unknown error.";
fill_struct->was_error = true;
}
else if (temp == N_EXIST_DIR) {
fill_struct->code_phrase = "404 Not found";
fill_struct->text_resp = "Directory not found.";
fill_struct->was_error = true;
}
else {
fill_struct->code_phrase = "200 OK";
fill_struct->was_error = false;
}
}
//- - - - - - - PUT
else if (check_struct->command == PUT) {
int temp = command_PUT(check_struct);
if (temp == COMM_ERR) {
fill_struct->code_phrase = "500 Internal Server Error";
fill_struct->text_resp = "Unknown error.";
fill_struct->was_error = true;
}
else if (temp == N_EXIST_DIR) {
fill_struct->code_phrase = "404 Not found";
fill_struct->text_resp = "Directory not found.";
fill_struct->was_error = true;
}
else {
fill_struct->code_phrase = "200 OK";
fill_struct->was_error = false;
}
}
//- - - - - - - GET
else if (check_struct->command == GET) {
*check_struct = command_GET(check_struct);
fill_struct->which_comm = GET;
fill_struct->code_phrase = "200 OK";
fill_struct->was_error = false;
}
}
} | [
"xgrzyb00@merlin.fit.vutbr.cz"
] | xgrzyb00@merlin.fit.vutbr.cz |
961a5376733296bc3583cceb3fc2b24cb4ba73cb | 93b24e6296dade8306b88395648377e1b2a7bc8c | /client/SceneEdit/Xerces/src/xercesc/validators/schema/XercesAttGroupInfo.cpp | 4744d3dbe239d1e69857c9d939bc21f19588ce4b | [
"Apache-2.0"
] | permissive | dahahua/pap_wclinet | 79c5ac068cd93cbacca5b3d0b92e6c9cba11a893 | d0cde48be4d63df4c4072d4fde2e3ded28c5040f | refs/heads/master | 2022-01-19T21:41:22.000190 | 2013-10-12T04:27:59 | 2013-10-12T04:27:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,936 | cpp | /*
* Copyright 2001,2004 The Apache Software 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.
*/
/*
* $Id: XercesAttGroupInfo.cpp 191054 2005-06-17 02:56:35Z jberry $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/validators/schema/XercesAttGroupInfo.hpp>
#include <../../../SceneEdit/Xerces/src/xercesc/util/QName.hpp>
#include <xercesc/internal/XTemplateSerializer.hpp>
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// XercesAttGroupInfo: Constructors and Destructor
// ---------------------------------------------------------------------------
XercesAttGroupInfo::XercesAttGroupInfo(MemoryManager* const manager)
: fTypeWithId(false)
, fNameId(0)
, fNamespaceId(0)
, fAttributes(0)
, fAnyAttributes(0)
, fCompleteWildCard(0)
, fMemoryManager(manager)
{
}
XercesAttGroupInfo::XercesAttGroupInfo(unsigned int attGroupNameId,
unsigned int attGroupNamespaceId,
MemoryManager* const manager)
: fTypeWithId(false)
, fNameId(attGroupNameId)
, fNamespaceId(attGroupNamespaceId)
, fAttributes(0)
, fAnyAttributes(0)
, fCompleteWildCard(0)
, fMemoryManager(manager)
{
}
XercesAttGroupInfo::~XercesAttGroupInfo()
{
delete fAttributes;
delete fAnyAttributes;
delete fCompleteWildCard;
}
bool XercesAttGroupInfo::containsAttribute(const XMLCh* const name,
const unsigned int uri) {
if (fAttributes) {
unsigned int attCount = fAttributes->size();
if (attCount) {
for (unsigned int i=0; i < attCount; i++) {
QName* attName = fAttributes->elementAt(i)->getAttName();
if (attName->getURI() == uri &&
XMLString::equals(attName->getLocalPart(),name)) {
return true;
}
}
}
}
return false;
}
// ---------------------------------------------------------------------------
// XercesAttGroupInfo: Getter methods
// ---------------------------------------------------------------------------
const SchemaAttDef* XercesAttGroupInfo::getAttDef(const XMLCh* const baseName,
const int uriId) const {
// If no list, then return a null
if (!fAttributes)
return 0;
unsigned int attSize = fAttributes->size();
for (unsigned int i=0; i<attSize; i++) {
const SchemaAttDef* attDef = fAttributes->elementAt(i);
QName* attName = attDef->getAttName();
if (uriId == (int) attName->getURI() &&
XMLString::equals(baseName, attName->getLocalPart())) {
return attDef;
}
}
return 0;
}
/***
* Support for Serialization/De-serialization
***/
IMPL_XSERIALIZABLE_TOCREATE(XercesAttGroupInfo)
void XercesAttGroupInfo::serialize(XSerializeEngine& serEng)
{
if (serEng.isStoring())
{
serEng<<fTypeWithId;
serEng<<fNameId;
serEng<<fNamespaceId;
/***
*
* Serialize RefVectorOf<SchemaAttDef>* fAttributes;
*
***/
XTemplateSerializer::storeObject(fAttributes, serEng);
/***
*
* Serialize RefVectorOf<SchemaAttDef>* fAnyAttributes;
*
***/
XTemplateSerializer::storeObject(fAnyAttributes, serEng);
serEng<<fCompleteWildCard;
}
else
{
serEng>>fTypeWithId;
serEng>>fNameId;
serEng>>fNamespaceId;
/***
*
* Deserialize RefVectorOf<SchemaAttDef>* fAttributes;
*
***/
XTemplateSerializer::loadObject(&fAttributes, 4, true, serEng);
/***
*
* Deserialize RefVectorOf<SchemaAttDef>* fAnyAttributes;
*
***/
XTemplateSerializer::loadObject(&fAnyAttributes, 2, true, serEng);
serEng>>fCompleteWildCard;
}
}
XERCES_CPP_NAMESPACE_END
/**
* End of file XercesAttGroupInfo.cpp
*/
| [
"viticm@126.com"
] | viticm@126.com |
9cd175791763d71264420dae34333b72e358f532 | 92745756b1d9280222894d6b7ba918c00f76bf3b | /SDK/PUBG_CustomizableObject_classes.hpp | 39b8f1fe869fbd5279d683cdedfc24b1ef7b9860 | [] | no_license | ziyouhaofan/PUBG-SDK | 018b2b28420b762de8c2b7e7142cb4f28647dc7f | 03d5f52e8d4fd7e2bef250217a9a5622366610e2 | refs/heads/master | 2021-07-19T11:34:17.527464 | 2017-10-26T03:42:44 | 2017-10-26T03:42:44 | 108,414,666 | 1 | 0 | null | 2017-10-26T13:24:32 | 2017-10-26T13:24:32 | null | UTF-8 | C++ | false | false | 8,655 | hpp | #pragma once
// PlayerUnknown's Battlegrounds SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace Classes {
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// Class CustomizableObject.CustomizableMeshComponent
// 0x0070 (0x0370 - 0x0300)
class UCustomizableMeshComponent : public USceneComponent {
public:
unsigned char UnknownData00[0x58]; // 0x0300(0x0058) MISSED OFFSET
TArray<TWeakObjectPtr<class UTexture2D>> CreatedTextures; // 0x0358(0x0010) (CPF_ZeroConstructor, CPF_Transient)
unsigned char UnknownData01[0x8]; // 0x0368(0x0008) MISSED OFFSET
static UClass* StaticClass() {
static UClass* ptr = nullptr;
if (!ptr) ptr = UObject::FindClass(0xc6dd67a8);
return ptr;
}
};
// Class CustomizableObject.CustomizableSkeletalComponent
// 0x0050 (0x03C0 - 0x0370)
class UCustomizableSkeletalComponent : public UCustomizableMeshComponent {
public:
class USkeletalMesh* SkeletalMesh; // 0x0370(0x0008) (CPF_Edit, CPF_ZeroConstructor, CPF_Transient, CPF_EditConst, CPF_IsPlainOldData)
unsigned char UnknownData00[0x48]; // 0x0378(0x0048) MISSED OFFSET
static UClass* StaticClass() {
static UClass* ptr = nullptr;
if (!ptr) ptr = UObject::FindClass(0x7819def2);
return ptr;
}
};
// Class CustomizableObject.CustomizableInstancePrivateData
// 0x00D8 (0x0100 - 0x0028)
class UCustomizableInstancePrivateData : public UObject {
public:
unsigned char UnknownData00[0x8]; // 0x0028(0x0008) MISSED OFFSET
TArray<struct FGeneratedMaterial> GeneratedMaterials; // 0x0030(0x0010) (CPF_ZeroConstructor, CPF_Transient)
TArray<struct FGeneratedMesh> GeneratedMeshes; // 0x0040(0x0010) (CPF_ZeroConstructor, CPF_Transient)
TArray<struct FGeneratedTexture> GeneratedTextures; // 0x0050(0x0010) (CPF_ZeroConstructor, CPF_Transient)
unsigned char UnknownData01[0xA0]; // 0x0060(0x00A0) MISSED OFFSET
static UClass* StaticClass() {
static UClass* ptr = nullptr;
if (!ptr) ptr = UObject::FindClass(0x2308bdda);
return ptr;
}
};
// Class CustomizableObject.CustomizableObject
// 0x00C0 (0x00E8 - 0x0028)
class UCustomizableObject : public UObject {
public:
class USkeletalMesh* ReferenceSkeletalMesh; // 0x0028(0x0008) (CPF_Edit, CPF_ZeroConstructor, CPF_IsPlainOldData)
class UStaticMesh* ReferenceStaticMesh; // 0x0030(0x0008) (CPF_ZeroConstructor, CPF_IsPlainOldData)
TArray<class UMaterialInterface*> ReferencedMaterials; // 0x0038(0x0010) (CPF_Edit, CPF_ZeroConstructor, CPF_EditConst)
TArray<struct FMutableModelImageProperties> ImageProperties; // 0x0048(0x0010) (CPF_Edit, CPF_ZeroConstructor, CPF_EditConst)
TMap<struct FString, struct FCustomizableObjectIdPair> GroupNodeMap; // 0x0058(0x0050) (CPF_ZeroConstructor)
struct FCompilationOptions CompileOptions; // 0x00A8(0x000C)
struct FGuid VersionId; // 0x00B4(0x0010) (CPF_ZeroConstructor, CPF_IsPlainOldData)
unsigned char UnknownData00[0x4]; // 0x00C4(0x0004) MISSED OFFSET
TArray<struct FMutableModelParameterProperties> ParameterProperties; // 0x00C8(0x0010) (CPF_ZeroConstructor)
unsigned char UnknownData01[0x10]; // 0x00D8(0x0010) MISSED OFFSET
static UClass* StaticClass() {
static UClass* ptr = nullptr;
if (!ptr) ptr = UObject::FindClass(0xcbbbb06d);
return ptr;
}
};
// Class CustomizableObject.CustomizableObjectInstance
// 0x0108 (0x0130 - 0x0028)
class UCustomizableObjectInstance : public UObject {
public:
class UCustomizableObject* CustomizableObject; // 0x0028(0x0008) (CPF_Edit, CPF_ZeroConstructor, CPF_EditConst, CPF_IsPlainOldData)
int State; // 0x0030(0x0004) (CPF_Edit, CPF_ZeroConstructor, CPF_EditConst, CPF_IsPlainOldData)
unsigned char UnknownData00[0x4]; // 0x0034(0x0004) MISSED OFFSET
TArray<struct FCustomizableObjectBoolParameterValue> BoolParameters; // 0x0038(0x0010) (CPF_Edit, CPF_EditFixedSize, CPF_ZeroConstructor, CPF_EditConst)
TArray<struct FCustomizableObjectIntParameterValue> IntParameters; // 0x0048(0x0010) (CPF_Edit, CPF_EditFixedSize, CPF_ZeroConstructor, CPF_EditConst)
TArray<struct FCustomizableObjectFloatParameterValue> FloatParameters; // 0x0058(0x0010) (CPF_Edit, CPF_EditFixedSize, CPF_ZeroConstructor, CPF_EditConst)
TArray<struct FCustomizableObjectVectorParameterValue> VectorParameters; // 0x0068(0x0010) (CPF_Edit, CPF_EditFixedSize, CPF_ZeroConstructor, CPF_EditConst)
TArray<struct FCustomizableObjectProjectorParameterValue> ProjectorParameters; // 0x0078(0x0010) (CPF_Edit, CPF_EditFixedSize, CPF_ZeroConstructor, CPF_EditConst)
bool bBuildRawData; // 0x0088(0x0001) (CPF_Edit, CPF_ZeroConstructor, CPF_EditConst, CPF_IsPlainOldData)
bool bBuildRenderData; // 0x0089(0x0001) (CPF_Edit, CPF_ZeroConstructor, CPF_EditConst, CPF_IsPlainOldData)
unsigned char UnknownData01[0x96]; // 0x008A(0x0096) MISSED OFFSET
class UCustomizableInstancePrivateData* PrivateData; // 0x0120(0x0008) (CPF_ZeroConstructor, CPF_Transient, CPF_IsPlainOldData)
unsigned char UnknownData02[0x8]; // 0x0128(0x0008) MISSED OFFSET
static UClass* StaticClass() {
static UClass* ptr = nullptr;
if (!ptr) ptr = UObject::FindClass(0xeb5a3a94);
return ptr;
}
void SetRandomValues();
};
// Class CustomizableObject.CustomizableObjectSystem
// 0x00C8 (0x00F0 - 0x0028)
class UCustomizableObjectSystem : public UObject {
public:
unsigned char UnknownData00[0x20]; // 0x0028(0x0020) MISSED OFFSET
TArray<struct FMutableSkeletalMeshTracker> SkeletalMeshTrackerArray; // 0x0048(0x0010) (CPF_ZeroConstructor)
TArray<struct FMutableTextureTracker> TextureTrackerArray; // 0x0058(0x0010) (CPF_ZeroConstructor)
unsigned char UnknownData01[0x20]; // 0x0068(0x0020) MISSED OFFSET
class UCustomizableSkeletalComponent* CurrentBeginUpdateComponent; // 0x0088(0x0008) (CPF_ExportObject, CPF_ZeroConstructor, CPF_InstancedReference, CPF_IsPlainOldData)
unsigned char UnknownData02[0x60]; // 0x0090(0x0060) MISSED OFFSET
static UClass* StaticClass() {
static UClass* ptr = nullptr;
if (!ptr) ptr = UObject::FindClass(0x6dbf909a);
return ptr;
}
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"tj8@live.com.au"
] | tj8@live.com.au |
9b96070e7369ab075ea0a9a94affc22ba377bc87 | 2bc835b044f306fca1affd1c61b8650b06751756 | /setup/ieak5/insedit/dll/customoe.cpp | ee9401b51eb188c1ad0edf129dddddfd31cb4bd3 | [] | no_license | KernelPanic-OpenSource/Win2K3_NT_inetcore | bbb2354d95a51a75ce2dfd67b18cfb6b21c94939 | 75f614d008bfce1ea71e4a727205f46b0de8e1c3 | refs/heads/master | 2023-04-04T02:55:25.139618 | 2021-04-14T05:25:01 | 2021-04-14T05:25:01 | 357,780,123 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 60,573 | cpp | #include "pch.h"
#define MAX_SERVER 256
static const TCHAR c_sz1[] = TEXT("1");
static const TCHAR c_sz0[] = TEXT("0");
static const TCHAR c_szYes[] = TEXT("Yes");
static const TCHAR c_szNo[] = TEXT("No");
static const TCHAR c_szEmpty[] = TEXT("");
static const TCHAR c_szNULL[] = TEXT("NULL");
/////////////////////////////////////////////////////////////////////////////
// MailServer
INT_PTR CALLBACK MailServer(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TCHAR szMailServer[MAX_SERVER],
szSMTPServer[MAX_SERVER],
szNewsServer[MAX_SERVER],
szChoice[16];
LPCTSTR pszKey;
HWND hComboBox;
BOOL fIMAP, fCheckDirtyOnly,
fSPAMail, fSPASMTP, fSPANNTP,
fAcctRO, fNoModify;
switch(msg)
{
case WM_INITDIALOG:
//----- Set up dialog controls -----
EnableDBCSChars(hDlg, IDE_MAILSERVER);
EnableDBCSChars(hDlg, IDE_SMTPSERVER);
EnableDBCSChars(hDlg, IDE_NEWSERVER);
Edit_LimitText(GetDlgItem(hDlg, IDE_MAILSERVER), countof(szMailServer)-1);
Edit_LimitText(GetDlgItem(hDlg, IDE_SMTPSERVER), countof(szSMTPServer)-1);
Edit_LimitText(GetDlgItem(hDlg, IDE_NEWSERVER), countof(szNewsServer)-1);
hComboBox = GetDlgItem(hDlg, IDC_POPIMAP);
ComboBox_ResetContent(hComboBox);
LoadString(g_hInst, IDS_POP3, szChoice, countof(szChoice));
ComboBox_AddString(hComboBox, szChoice);
LoadString(g_hInst, IDS_IMAP, szChoice, countof(szChoice));
ComboBox_AddString(hComboBox, szChoice);
//----- Initialization of fields -----
fIMAP = InsGetYesNo(IS_INTERNETMAIL, IK_USEIMAP, FALSE, g_szInsFile);
pszKey = fIMAP ? IK_IMAPSERVER : IK_POPSERVER;
GetPrivateProfileString(IS_INTERNETMAIL, pszKey, c_szEmpty, szMailServer, countof(szMailServer), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_SMTPSERVER, c_szEmpty, szSMTPServer, countof(szSMTPServer), g_szInsFile);
GetPrivateProfileString(IS_INTERNETNEWS, IK_NNTPSERVER, c_szEmpty, szNewsServer, countof(szNewsServer), g_szInsFile);
StrRemoveWhitespace(szMailServer);
StrRemoveWhitespace(szSMTPServer);
StrRemoveWhitespace(szNewsServer);
fSPAMail = InsGetYesNo(IS_INTERNETMAIL, IK_USESPA, FALSE, g_szInsFile);
fSPASMTP = InsGetYesNo(IS_INTERNETMAIL, IK_SMTPUSESPA, FALSE, g_szInsFile);
fSPANNTP = InsGetYesNo(IS_INTERNETNEWS, IK_USESPA, FALSE, g_szInsFile);
fAcctRO = InsGetYesNo(IS_OEGLOBAL, IK_READONLY, FALSE, g_szInsFile);
fNoModify = InsGetYesNo(IS_OEGLOBAL, IK_NOMODIFYACCTS, FALSE, g_szInsFile);
SetDlgItemText(hDlg, IDE_MAILSERVER, szMailServer);
SetDlgItemText(hDlg, IDE_SMTPSERVER, szSMTPServer);
SetDlgItemText(hDlg, IDE_NEWSERVER, szNewsServer);
CheckDlgButton(hDlg, IDC_USESPAMAIL, fSPAMail);
CheckDlgButton(hDlg, IDC_USESPASMTP, fSPASMTP);
CheckDlgButton(hDlg, IDC_USESPANNTP, fSPANNTP);
CheckDlgButton(hDlg, IDC_ACCTRO, fAcctRO);
CheckDlgButton(hDlg, IDC_ACCTNOCONFIG, fNoModify);
ComboBox_SetCurSel(GetDlgItem(hDlg, IDC_POPIMAP), fIMAP ? 1 : 0);
break;
case UM_SAVE:
fCheckDirtyOnly = (BOOL) lParam;
//----- Read data from controls into internal variables -----
fIMAP = (ComboBox_GetCurSel(GetDlgItem(hDlg, IDC_POPIMAP)) > 0);
GetDlgItemText(hDlg, IDE_MAILSERVER, szMailServer, countof(szMailServer));
GetDlgItemText(hDlg, IDE_SMTPSERVER, szSMTPServer, countof(szSMTPServer));
GetDlgItemText(hDlg, IDE_NEWSERVER, szNewsServer, countof(szNewsServer));
StrRemoveWhitespace(szMailServer);
StrRemoveWhitespace(szSMTPServer);
StrRemoveWhitespace(szNewsServer);
fSPAMail = IsDlgButtonChecked(hDlg, IDC_USESPAMAIL);
fSPASMTP = IsDlgButtonChecked(hDlg, IDC_USESPASMTP);
fSPANNTP = IsDlgButtonChecked(hDlg, IDC_USESPANNTP);
fAcctRO = IsDlgButtonChecked(hDlg, IDC_ACCTRO);
fNoModify = IsDlgButtonChecked(hDlg, IDC_ACCTNOCONFIG);
//----- Handle g_fInsDirty flag -----
if (!g_fInsDirty)
{
TCHAR szWasMailServer[MAX_SERVER],
szWasSMTPServer[MAX_SERVER],
szWasNewsServer[MAX_SERVER];
BOOL fWasIMAP, fWasSPAMail, fWasSPASMTP, fWasSPANNTP,
fWasAcctRO, fWasNoModify;
fWasIMAP = InsGetYesNo(IS_INTERNETMAIL, IK_USEIMAP, FALSE, g_szInsFile);
pszKey = fWasIMAP ? IK_IMAPSERVER : IK_POPSERVER;
GetPrivateProfileString(IS_INTERNETMAIL, pszKey, c_szEmpty, szWasMailServer, countof(szWasMailServer), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_SMTPSERVER, c_szEmpty, szWasSMTPServer, countof(szWasSMTPServer), g_szInsFile);
GetPrivateProfileString(IS_INTERNETNEWS, IK_NNTPSERVER, c_szEmpty, szWasNewsServer, countof(szWasNewsServer), g_szInsFile);
StrRemoveWhitespace(szWasMailServer);
StrRemoveWhitespace(szWasSMTPServer);
StrRemoveWhitespace(szWasNewsServer);
fWasSPAMail = InsGetYesNo(IS_INTERNETMAIL, IK_USESPA, FALSE, g_szInsFile);
fWasSPASMTP = InsGetYesNo(IS_INTERNETMAIL, IK_SMTPUSESPA, FALSE, g_szInsFile);
fWasSPANNTP = InsGetYesNo(IS_INTERNETNEWS, IK_USESPA, FALSE, g_szInsFile);
fWasAcctRO = InsGetYesNo(IS_OEGLOBAL, IK_READONLY, FALSE, g_szInsFile);
fWasNoModify = InsGetYesNo(IS_OEGLOBAL, IK_NOMODIFYACCTS, FALSE, g_szInsFile);
if (fIMAP != fWasIMAP ||
fSPAMail != fWasSPAMail ||
fSPASMTP != fWasSPASMTP ||
fSPANNTP != fWasSPANNTP ||
fAcctRO != fWasAcctRO ||
fNoModify != fWasNoModify ||
StrCmpI(szMailServer, szWasMailServer) != 0 ||
StrCmpI(szSMTPServer, szWasSMTPServer) != 0 ||
StrCmpI(szNewsServer, szWasNewsServer) != 0)
g_fInsDirty = TRUE;
}
//----- Serialize data to the *.ins file -----
if (!fCheckDirtyOnly)
{
WritePrivateProfileString(IS_INTERNETMAIL, IK_USEIMAP, fIMAP ? c_szYes : c_szNo, g_szInsFile);
if (fIMAP)
{
WritePrivateProfileString(IS_INTERNETMAIL, IK_IMAPSERVER, szMailServer, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_POPSERVER, NULL, g_szInsFile);
}
else
{
WritePrivateProfileString(IS_INTERNETMAIL, IK_IMAPSERVER, NULL, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_POPSERVER, szMailServer, g_szInsFile);
}
WritePrivateProfileString(IS_INTERNETMAIL, IK_SMTPSERVER, szSMTPServer, g_szInsFile);
WritePrivateProfileString(IS_INTERNETNEWS, IK_NNTPSERVER, szNewsServer, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_USESPA, fSPAMail ? c_szYes : c_szNo, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_SMTPUSESPA, fSPASMTP ? c_szYes : c_szNo, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_SMTPREQLOGON, fSPASMTP ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_INTERNETNEWS, IK_USESPA, fSPANNTP ? c_szYes : c_szNo, g_szInsFile);
WritePrivateProfileString(IS_INTERNETNEWS, IK_REQLOGON, fSPANNTP ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_OEGLOBAL, IK_READONLY, fAcctRO ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_OEGLOBAL, IK_NOMODIFYACCTS,fNoModify ? c_sz1 : c_sz0, g_szInsFile);
}
*((LPBOOL)wParam) = TRUE;
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
default:
return FALSE;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// IMAPSettings
INT_PTR CALLBACK IMAPSettings(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TCHAR szRFP[MAX_PATH], szSentPath[MAX_PATH], szDrafts[MAX_PATH];
BOOL fSpecial, fCheckNew, fCheckDirtyOnly;
switch(msg)
{
case WM_INITDIALOG:
//----- Set up dialog controls -----
EnableDBCSChars(hDlg, IDE_ROOTPATH);
EnableDBCSChars(hDlg, IDE_SENTPATH);
EnableDBCSChars(hDlg, IDE_DRAFTSPATH);
Edit_LimitText(GetDlgItem(hDlg, IDE_ROOTPATH), countof(szRFP)-1);
Edit_LimitText(GetDlgItem(hDlg, IDE_SENTPATH), countof(szSentPath)-1);
Edit_LimitText(GetDlgItem(hDlg, IDE_DRAFTSPATH), countof(szDrafts)-1);
//----- Initialization of fields -----
GetPrivateProfileString(IS_INTERNETMAIL, IK_RFP, c_szEmpty, szRFP, countof(szRFP), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_SENTITEMS, c_szEmpty, szSentPath, countof(szSentPath), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_DRAFTS, c_szEmpty, szDrafts, countof(szDrafts), g_szInsFile);
StrRemoveWhitespace(szRFP);
StrRemoveWhitespace(szSentPath);
StrRemoveWhitespace(szDrafts);
fCheckNew = GetPrivateProfileInt(IS_INTERNETMAIL, IK_CHECKFORNEW, FALSE, g_szInsFile);
fSpecial = GetPrivateProfileInt(IS_INTERNETMAIL, IK_USESPECIAL, FALSE, g_szInsFile);
SetDlgItemText(hDlg, IDE_ROOTPATH, szRFP);
SetDlgItemText(hDlg, IDE_SENTPATH, szSentPath);
SetDlgItemText(hDlg, IDE_DRAFTSPATH, szDrafts);
CheckDlgButton(hDlg, IDC_STORESPECIAL, fSpecial);
CheckDlgButton(hDlg, IDC_CHECKNEW, fCheckNew);
EnableDlgItem2(hDlg, IDE_SENTPATH, fSpecial);
EnableDlgItem2(hDlg, IDC_SENTPATH_TXT, fSpecial);
EnableDlgItem2(hDlg, IDE_DRAFTSPATH, fSpecial);
EnableDlgItem2(hDlg, IDC_DRAFTSPATH_TXT, fSpecial);
break;
case WM_COMMAND:
if (BN_CLICKED == HIWORD(wParam))
{
switch (LOWORD(wParam))
{
case IDC_STORESPECIAL:
fSpecial = IsDlgButtonChecked(hDlg, IDC_STORESPECIAL);
EnableDlgItem2(hDlg, IDE_SENTPATH, fSpecial);
EnableDlgItem2(hDlg, IDC_SENTPATH_TXT, fSpecial);
EnableDlgItem2(hDlg, IDE_DRAFTSPATH, fSpecial);
EnableDlgItem2(hDlg, IDC_DRAFTSPATH_TXT, fSpecial);
break;
}
}
break;
case UM_SAVE:
fCheckDirtyOnly = (BOOL) lParam;
//----- Read data from controls into internal variables -----
GetDlgItemText(hDlg, IDE_ROOTPATH, szRFP, countof(szRFP));
GetDlgItemText(hDlg, IDE_SENTPATH, szSentPath, countof(szSentPath));
GetDlgItemText(hDlg, IDE_DRAFTSPATH, szDrafts, countof(szDrafts));
StrRemoveWhitespace(szRFP);
StrRemoveWhitespace(szSentPath);
StrRemoveWhitespace(szDrafts);
fCheckNew = IsDlgButtonChecked(hDlg, IDC_CHECKNEW);
fSpecial = IsDlgButtonChecked(hDlg, IDC_STORESPECIAL);
//----- Handle g_fInsDirty flag -----
if (!g_fInsDirty)
{
TCHAR szWasRFP[MAX_PATH], szWasSentPath[MAX_PATH], szWasDrafts[MAX_PATH];
BOOL fWasSpecial, fWasCheckNew;
GetPrivateProfileString(IS_INTERNETMAIL, IK_RFP, c_szEmpty, szWasRFP, countof(szWasRFP), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_SENTITEMS, c_szEmpty, szWasSentPath, countof(szWasSentPath), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_DRAFTS, c_szEmpty, szWasDrafts, countof(szWasDrafts), g_szInsFile);
StrRemoveWhitespace(szWasRFP);
StrRemoveWhitespace(szWasSentPath);
StrRemoveWhitespace(szWasDrafts);
fWasCheckNew = GetPrivateProfileInt(IS_INTERNETMAIL, IK_CHECKFORNEW, FALSE, g_szInsFile);
fWasSpecial = GetPrivateProfileInt(IS_INTERNETMAIL, IK_USESPECIAL, FALSE, g_szInsFile);
if (fCheckNew != fWasCheckNew ||
fSpecial != fWasSpecial ||
StrCmpI(szRFP, szWasRFP) != 0 ||
StrCmpI(szSentPath, szWasSentPath) != 0 ||
StrCmpI(szDrafts, szWasDrafts) != 0)
g_fInsDirty = TRUE;
}
//----- Serialize data to the *.ins file -----
if (!fCheckDirtyOnly)
{
WritePrivateProfileString(IS_INTERNETMAIL, IK_RFP, szRFP, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_SENTITEMS, szSentPath, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_DRAFTS, szDrafts, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_CHECKFORNEW, fCheckNew ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_USESPECIAL, fSpecial ? c_sz1 : c_sz0, g_szInsFile);
}
*((LPBOOL)wParam) = TRUE;
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
default:
return FALSE;
}
return TRUE;
}
void SetTimeoutString(HWND hwnd, UINT pos)
{
UINT cch, csec, cmin;
TCHAR szOut[128], sz[128];
csec = TIMEOUT_SEC_MIN + (pos * TIMEOUT_DSEC);
ASSERT(csec >= TIMEOUT_SEC_MIN && csec <= TIMEOUT_SEC_MAX);
cmin = csec / 60;
csec = csec % 60;
if (cmin > 1)
{
LoadString(g_hInst, IDS_XMINUTES, sz, countof(sz));
wsprintf(szOut, sz, cmin);
cch = lstrlen(szOut);
}
else if (cmin == 1)
{
cch = LoadString(g_hInst, IDS_1MINUTE, szOut, countof(szOut));
}
else
{
cch = 0;
}
if (csec != 0)
{
if (cmin > 0)
{
szOut[cch] = TEXT(' ');
cch++;
}
LoadString(g_hInst, IDS_XSECONDS, sz, countof(sz));
wsprintf(&szOut[cch], sz, csec);
}
SetWindowText(hwnd, szOut);
}
/////////////////////////////////////////////////////////////////////////////
// LDAPServer
INT_PTR CALLBACK LDAPServer(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TCHAR szLDAPServer[MAX_SERVER],
szLDAPHome[INTERNET_MAX_URL_LENGTH],
szLDAPBitmap[MAX_PATH],
szWorkDir[MAX_PATH],
szLDAPFriendly[MAX_SERVER],
szLDAPBase[128];
UINT uTimeout, uMatches, uAuthType;
BOOL fLDAPCheck, fCheckDirtyOnly, fTrans;
switch(msg)
{
case WM_INITDIALOG:
//----- Set up dialog controls -----
EnableDBCSChars(hDlg, IDE_FRIENDLYNAME);
EnableDBCSChars(hDlg, IDE_SEARCHBASE);
EnableDBCSChars(hDlg, IDE_LDAPBITMAP);
EnableDBCSChars(hDlg, IDE_DIRSERVICE);
EnableDBCSChars(hDlg, IDE_LDAPHOMEPAGE);
Edit_LimitText(GetDlgItem(hDlg, IDE_FRIENDLYNAME), countof(szLDAPFriendly) - 1);
Edit_LimitText(GetDlgItem(hDlg, IDE_DIRSERVICE), countof(szLDAPServer) - 1);
Edit_LimitText(GetDlgItem(hDlg, IDE_LDAPHOMEPAGE), countof(szLDAPHome) - 1);
Edit_LimitText(GetDlgItem(hDlg, IDE_SEARCHBASE), countof(szLDAPBase) - 1);
Edit_LimitText(GetDlgItem(hDlg, IDE_LDAPBITMAP), countof(szLDAPBitmap) - 1);
SendDlgItemMessage(hDlg, IDC_TIMEOUTSLD, TBM_SETRANGE, 0, (LPARAM)MAKELONG(0, CTIMEOUT - 1));
SendDlgItemMessage(hDlg, IDC_SPIN1, UDM_SETRANGE, 0, MAKELONG(MATCHES_MAX, MATCHES_MIN));
Edit_LimitText(GetDlgItem(hDlg, IDE_MATCHES), 4);
//----- Initialization of fields -----
GetPrivateProfileString(IS_LDAP, IK_FRIENDLYNAME, c_szEmpty, szLDAPFriendly, countof(szLDAPFriendly), g_szInsFile);
GetPrivateProfileString(IS_LDAP, IK_SERVER, c_szEmpty, szLDAPServer, countof(szLDAPServer), g_szInsFile);
GetPrivateProfileString(IS_LDAP, IK_LDAPHOMEPAGE, c_szEmpty, szLDAPHome, countof(szLDAPHome), g_szInsFile);
GetPrivateProfileString(IS_LDAP, IK_SEARCHBASE, c_szNULL, szLDAPBase, countof(szLDAPBase), g_szInsFile);
GetPrivateProfileString(IS_LDAP, IK_BITMAP, c_szEmpty, szLDAPBitmap, countof(szLDAPBitmap), g_szInsFile);
StrRemoveWhitespace(szLDAPFriendly);
StrRemoveWhitespace(szLDAPServer);
StrRemoveWhitespace(szLDAPHome);
StrRemoveWhitespace(szLDAPBase);
StrRemoveWhitespace(szLDAPBitmap);
fLDAPCheck = (BOOL)GetPrivateProfileInt(IS_LDAP, IK_CHECKNAMES, FALSE, g_szInsFile);
uTimeout = GetPrivateProfileInt(IS_LDAP, IK_TIMEOUT, TIMEOUT_SEC_DEFAULT, g_szInsFile);
if (uTimeout < TIMEOUT_SEC_MIN)
uTimeout = TIMEOUT_SEC_MIN;
else if (uTimeout > TIMEOUT_SEC_MAX)
uTimeout = TIMEOUT_SEC_MAX;
uMatches = GetPrivateProfileInt(IS_LDAP, IK_MATCHES, MATCHES_DEFAULT, g_szInsFile);
if (uMatches < MATCHES_MIN)
uMatches = MATCHES_MIN;
else if (uMatches > MATCHES_MAX)
uMatches = MATCHES_MAX;
uAuthType = GetPrivateProfileInt(IS_LDAP, IK_AUTHTYPE, AUTH_ANONYMOUS, g_szInsFile);
if (uAuthType != AUTH_ANONYMOUS && uAuthType != AUTH_SPA)
uAuthType = AUTH_ANONYMOUS;
SetDlgItemText(hDlg, IDE_FRIENDLYNAME, szLDAPFriendly);
SetDlgItemText(hDlg, IDE_DIRSERVICE, szLDAPServer);
SetDlgItemText(hDlg, IDE_LDAPHOMEPAGE, szLDAPHome);
SetDlgItemText(hDlg, IDE_SEARCHBASE, szLDAPBase);
SetDlgItemText(hDlg, IDE_LDAPBITMAP, szLDAPBitmap);
uTimeout = (uTimeout / TIMEOUT_DSEC) - 1;
SendDlgItemMessage(hDlg, IDC_TIMEOUTSLD, TBM_SETPOS, TRUE, (LPARAM)uTimeout);
SetTimeoutString(GetDlgItem(hDlg, IDC_TIMEOUT), uTimeout);
SetDlgItemInt(hDlg, IDE_MATCHES, uMatches, FALSE);
CheckDlgButton(hDlg, IDC_CHECKNAMES, fLDAPCheck ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_SPA, uAuthType == AUTH_SPA ? BST_CHECKED : BST_UNCHECKED);
break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
switch (LOWORD(wParam))
{
case IDC_BROWSELDAP:
GetDlgItemText(hDlg, IDE_LDAPBITMAP, szLDAPBitmap, countof(szLDAPBitmap));
if (BrowseForFile(hDlg, szLDAPBitmap, countof(szLDAPBitmap), GFN_BMP))
SetDlgItemText(hDlg, IDE_LDAPBITMAP, szLDAPBitmap);
SetFocus(GetDlgItem(hDlg, IDC_BROWSELDAP));
break;
default:
return FALSE;
}
}
break;
case WM_HSCROLL:
SetTimeoutString(GetDlgItem(hDlg, IDC_TIMEOUT), (UINT) SendMessage((HWND)lParam, TBM_GETPOS, 0, 0));
break;
case UM_SAVE:
fCheckDirtyOnly = (BOOL) lParam;
//----- Read data from controls into internal variables -----
GetDlgItemText(hDlg, IDE_FRIENDLYNAME, szLDAPFriendly, countof(szLDAPFriendly));
GetDlgItemText(hDlg, IDE_DIRSERVICE, szLDAPServer, countof(szLDAPServer));
GetDlgItemText(hDlg, IDE_LDAPHOMEPAGE, szLDAPHome, countof(szLDAPHome));
GetDlgItemText(hDlg, IDE_SEARCHBASE, szLDAPBase, countof(szLDAPBase));
GetDlgItemText(hDlg, IDE_LDAPBITMAP, szLDAPBitmap, countof(szLDAPBitmap));
StrRemoveWhitespace(szLDAPFriendly);
StrRemoveWhitespace(szLDAPServer);
StrRemoveWhitespace(szLDAPHome);
StrRemoveWhitespace(szLDAPBase);
StrRemoveWhitespace(szLDAPBitmap);
fLDAPCheck = IsDlgButtonChecked(hDlg, IDC_CHECKNAMES);
uAuthType = IsDlgButtonChecked(hDlg, IDC_SPA) ? AUTH_SPA : AUTH_ANONYMOUS;
uTimeout = (UINT) SendDlgItemMessage(hDlg, IDC_TIMEOUTSLD, TBM_GETPOS, 0, 0);
uTimeout = TIMEOUT_SEC_MIN + (uTimeout * TIMEOUT_DSEC);
uMatches = GetDlgItemInt(hDlg, IDE_MATCHES, &fTrans, FALSE);
// TODO: we should probably display an error msg here
if (!fTrans)
uMatches = MATCHES_DEFAULT;
else if (uMatches < MATCHES_MIN)
uMatches = MATCHES_MIN;
else if (uMatches > MATCHES_MAX)
uMatches = MATCHES_MAX;
//----- Validate the input -----
if (!fCheckDirtyOnly)
{
if (!CheckField(hDlg, IDE_LDAPBITMAP, FC_FILE | FC_EXISTS))
return(TRUE);
if (!CheckField(hDlg, IDE_LDAPHOMEPAGE, FC_URL))
return(TRUE);
}
//----- Handle g_fInsDirty flag -----
if (!g_fInsDirty)
{
TCHAR szWasLDAPServer[MAX_SERVER],
szWasLDAPHome[INTERNET_MAX_URL_LENGTH],
szWasLDAPBitmap[MAX_PATH],
szWasLDAPFriendly[MAX_SERVER],
szWasLDAPBase[128];
UINT uWasTimeout, uWasMatches, uWasAuthType;
BOOL fWasLDAPCheck;
GetPrivateProfileString(IS_LDAP, IK_FRIENDLYNAME, c_szEmpty, szWasLDAPFriendly, countof(szWasLDAPFriendly), g_szInsFile);
GetPrivateProfileString(IS_LDAP, IK_SERVER, c_szEmpty, szWasLDAPServer, countof(szWasLDAPServer), g_szInsFile);
GetPrivateProfileString(IS_LDAP, IK_LDAPHOMEPAGE, c_szEmpty, szWasLDAPHome, countof(szWasLDAPHome), g_szInsFile);
GetPrivateProfileString(IS_LDAP, IK_SEARCHBASE, c_szNULL, szWasLDAPBase, countof(szWasLDAPBase), g_szInsFile);
GetPrivateProfileString(IS_LDAP, IK_BITMAP, c_szEmpty, szWasLDAPBitmap, countof(szWasLDAPBitmap), g_szInsFile);
StrRemoveWhitespace(szWasLDAPFriendly);
StrRemoveWhitespace(szWasLDAPServer);
StrRemoveWhitespace(szWasLDAPHome);
StrRemoveWhitespace(szWasLDAPBase);
StrRemoveWhitespace(szWasLDAPBitmap);
fWasLDAPCheck = (BOOL)GetPrivateProfileInt(IS_LDAP, IK_CHECKNAMES, FALSE, g_szInsFile);
uWasTimeout = GetPrivateProfileInt(IS_LDAP, IK_TIMEOUT, TIMEOUT_SEC_MIN, g_szInsFile);
uWasMatches = GetPrivateProfileInt(IS_LDAP, IK_MATCHES, MATCHES_DEFAULT, g_szInsFile);
uWasAuthType = GetPrivateProfileInt(IS_LDAP, IK_AUTHTYPE, AUTH_ANONYMOUS, g_szInsFile);
if (fLDAPCheck != fWasLDAPCheck ||
uTimeout != uWasTimeout ||
uMatches != uWasMatches ||
uAuthType != uWasAuthType ||
StrCmpI(szLDAPFriendly, szWasLDAPFriendly) != 0 ||
StrCmpI(szLDAPServer, szWasLDAPServer) != 0 ||
StrCmpI(szLDAPHome, szWasLDAPHome) != 0 ||
StrCmpI(szLDAPBase, szWasLDAPBase) != 0 ||
StrCmpI(szLDAPBitmap, szWasLDAPBitmap) != 0)
g_fInsDirty = TRUE;
}
//----- Serialize data to the *.ins file -----
if (!fCheckDirtyOnly)
{
// clear of the old entry and associated image.
ImportLDAPBitmap(g_szInsFile, g_szWorkDir, FALSE);
WritePrivateProfileString(IS_LDAP, IK_FRIENDLYNAME, szLDAPFriendly, g_szInsFile);
WritePrivateProfileString(IS_LDAP, IK_SERVER, szLDAPServer, g_szInsFile);
WritePrivateProfileString(IS_LDAP, IK_LDAPHOMEPAGE, szLDAPHome, g_szInsFile);
InsWriteQuotedString (IS_LDAP, IK_SEARCHBASE, szLDAPBase, g_szInsFile);
WritePrivateProfileString(IS_LDAP, IK_BITMAP, szLDAPBitmap, g_szInsFile);
WritePrivateProfileString(IS_LDAP, IK_CHECKNAMES, fLDAPCheck ? c_sz1 : c_sz0, g_szInsFile);
wsprintf(szWorkDir, TEXT("%i"), uTimeout);
WritePrivateProfileString(IS_LDAP, IK_TIMEOUT, szWorkDir, g_szInsFile);
wsprintf(szWorkDir, TEXT("%i"), uMatches);
WritePrivateProfileString(IS_LDAP, IK_MATCHES, szWorkDir, g_szInsFile);
wsprintf(szWorkDir, TEXT("%i"), uAuthType);
WritePrivateProfileString(IS_LDAP, IK_AUTHTYPE, szWorkDir, g_szInsFile);
PathCombine(szWorkDir, g_szWorkDir, TEXT("ldap.wrk"));
ImportLDAPBitmap(g_szInsFile, szWorkDir, TRUE);
}
*((LPBOOL)wParam) = TRUE;
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
default:
return FALSE;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CustomizeOE
INT_PTR CALLBACK CustomizeOE(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TCHAR szInfopane[INTERNET_MAX_URL_LENGTH],
szInfopaneBmp[MAX_PATH],
szHTMLPath[MAX_PATH],
szWorkDir[MAX_PATH],
szSender[255],
szReply[255];
UINT nID;
BOOL fURL,
fCheckDirtyOnly;
switch(msg)
{
case WM_INITDIALOG:
//----- Set up dialog controls -----
EnableDBCSChars(hDlg, IDE_OELOCALPATH);
EnableDBCSChars(hDlg, IDE_OEIMAGEPATH);
EnableDBCSChars(hDlg, IDE_OEWMPATH);
EnableDBCSChars(hDlg, IDE_OEWMSENDER);
EnableDBCSChars(hDlg, IDE_OEPANEURL);
EnableDBCSChars(hDlg, IDE_OEWMREPLYTO);
Edit_LimitText(GetDlgItem(hDlg, IDE_OEPANEURL), countof(szInfopane) - 1);
Edit_LimitText(GetDlgItem(hDlg, IDE_OELOCALPATH), MAX_PATH);
Edit_LimitText(GetDlgItem(hDlg, IDE_OEIMAGEPATH), countof(szInfopaneBmp) - 1);
Edit_LimitText(GetDlgItem(hDlg, IDE_OEWMPATH), countof(szHTMLPath) - 1);
Edit_LimitText(GetDlgItem(hDlg, IDE_OEWMSENDER), countof(szSender) - 1);
Edit_LimitText(GetDlgItem(hDlg, IDE_OEWMREPLYTO), countof(szReply) - 1);
//----- Initialization of fields (1st phase) -----
GetPrivateProfileString(IS_INTERNETMAIL, IK_INFOPANE, c_szEmpty, szInfopane, countof(szInfopane), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_INFOPANEBMP, c_szEmpty, szInfopaneBmp, countof(szInfopaneBmp), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_WELCOMEMESSAGE, c_szEmpty, szHTMLPath, countof(szHTMLPath), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_WELCOMENAME, c_szEmpty, szSender, countof(szSender), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_WELCOMEADDR, c_szEmpty, szReply, countof(szReply), g_szInsFile);
StrRemoveWhitespace(szInfopane);
StrRemoveWhitespace(szInfopaneBmp);
StrRemoveWhitespace(szHTMLPath);
StrRemoveWhitespace(szSender);
StrRemoveWhitespace(szReply);
//----- Initialization of fields (2nd phase) -----
nID = PathIsURL(szInfopane) ? IDC_OEPANEURL : IDC_OEPANELOCAL;
//----- Set read values in the controls -----
CheckRadioButton(hDlg, IDC_OEPANEURL, IDC_OEPANELOCAL, nID);
SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(nID, BN_CLICKED), (LPARAM)GetDlgItem(hDlg, nID));
if (nID == IDC_OEPANEURL)
{
SetDlgItemText(hDlg, IDE_OEPANEURL, szInfopane);
SetDlgItemText(hDlg, IDE_OELOCALPATH, NULL);
}
else
{
SetDlgItemText(hDlg, IDE_OEPANEURL, NULL);
SetDlgItemText(hDlg, IDE_OELOCALPATH, szInfopane);
}
SetDlgItemText(hDlg, IDE_OEIMAGEPATH, szInfopaneBmp);
SetDlgItemText(hDlg, IDE_OEWMPATH, szHTMLPath);
SetDlgItemText(hDlg, IDE_OEWMSENDER, szSender);
SetDlgItemText(hDlg, IDE_OEWMREPLYTO, szReply);
break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED)
{
switch (LOWORD(wParam))
{
case IDC_OEPANEURL:
case IDC_OEPANELOCAL:
fURL = (LOWORD(wParam) == IDC_OEPANEURL);
EnableDlgItem2(hDlg, IDE_OEPANEURL, fURL);
EnableDlgItem2(hDlg, IDE_OELOCALPATH, !fURL);
EnableDlgItem2(hDlg, IDC_BROWSEOEHTML, !fURL);
EnableDlgItem2(hDlg, IDC_OELOCALPATH_TXT, !fURL);
EnableDlgItem2(hDlg, IDE_OEIMAGEPATH, !fURL);
EnableDlgItem2(hDlg, IDC_BROWSEOEIMAGE, !fURL);
EnableDlgItem2(hDlg, IDC_OEIMAGEPATH_TXT, !fURL);
break;
case IDC_BROWSEOEHTML:
GetDlgItemText(hDlg, IDE_OELOCALPATH, szInfopane, countof(szInfopane));
if (BrowseForFile(hDlg, szInfopane, countof(szInfopane), GFN_LOCALHTM))
SetDlgItemText(hDlg, IDE_OELOCALPATH, szInfopane);
SetFocus(GetDlgItem(hDlg, IDC_BROWSEOEHTML));
break;
case IDC_BROWSEOEIMAGE:
GetDlgItemText(hDlg, IDE_OEIMAGEPATH, szInfopaneBmp, countof(szInfopaneBmp));
if (BrowseForFile(hDlg, szInfopaneBmp, countof(szInfopaneBmp), GFN_PICTURE))
SetDlgItemText(hDlg, IDE_OEIMAGEPATH, szInfopaneBmp);
SetFocus(GetDlgItem(hDlg, IDC_BROWSEOEIMAGE));
break;
case IDC_BROWSEOEWM:
GetDlgItemText(hDlg, IDE_OEWMPATH, szHTMLPath, countof(szHTMLPath));
if (BrowseForFile(hDlg, szHTMLPath, countof(szHTMLPath), GFN_LOCALHTM))
SetDlgItemText(hDlg, IDE_OEWMPATH, szHTMLPath);
SetFocus(GetDlgItem(hDlg, IDC_BROWSEOEWM));
break;
default:
break;
}
}
break;
case UM_SAVE:
fCheckDirtyOnly = (BOOL) lParam;
//----- Read data from controls into internal variables -----
nID = IsDlgButtonChecked(hDlg, IDC_OEPANEURL) == BST_CHECKED ? IDE_OEPANEURL : IDE_OELOCALPATH;
GetDlgItemText(hDlg, nID, szInfopane, countof(szInfopane));
GetDlgItemText(hDlg, IDE_OEWMSENDER, szSender, countof(szSender));
GetDlgItemText(hDlg, IDE_OEWMREPLYTO, szReply, countof(szReply));
GetDlgItemText(hDlg, IDE_OEWMPATH, szHTMLPath, countof(szHTMLPath));
GetDlgItemText(hDlg, IDE_OEIMAGEPATH, szInfopaneBmp, countof(szInfopaneBmp));
StrRemoveWhitespace(szInfopane);
StrRemoveWhitespace(szSender);
StrRemoveWhitespace(szReply);
//----- Validate the input -----
if (!fCheckDirtyOnly)
{
szInfopaneBmp[0] = TEXT('\0');
if (nID == IDE_OEPANEURL)
{
if (!CheckField(hDlg, IDE_OEPANEURL, FC_URL))
return(TRUE);
}
else
{ /* if (nID == IDE_OELOCALPATH) */
if (!CheckField(hDlg, IDE_OELOCALPATH, FC_FILE | FC_EXISTS))
return(TRUE);
if (!CheckField(hDlg, IDE_OEIMAGEPATH, FC_FILE | FC_EXISTS))
return(TRUE);
}
if (!CheckField(hDlg, IDE_OEWMPATH, FC_FILE | FC_EXISTS))
return(TRUE);
if (*szHTMLPath != TEXT('\0') && (!CheckField(hDlg, IDE_OEWMSENDER, FC_NONNULL) ||
!CheckField(hDlg, IDE_OEWMREPLYTO, FC_NONNULL)))
return TRUE;
}
//----- Handle g_fInsDirty flag -----
if (!g_fInsDirty)
{
TCHAR szWasInfopane[INTERNET_MAX_URL_LENGTH],
szWasInfopaneBmp[MAX_PATH],
szWasHTMLPath[MAX_PATH],
szWasSender[255],
szWasReply[255];
GetPrivateProfileString(IS_INTERNETMAIL, IK_INFOPANE, TEXT(""), szWasInfopane, countof(szInfopane), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_INFOPANEBMP, TEXT(""), szWasInfopaneBmp, countof(szInfopaneBmp), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_WELCOMEMESSAGE, TEXT(""), szWasHTMLPath, countof(szHTMLPath), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_WELCOMENAME, TEXT(""), szWasSender, countof(szSender), g_szInsFile);
GetPrivateProfileString(IS_INTERNETMAIL, IK_WELCOMEADDR, TEXT(""), szWasReply, countof(szReply), g_szInsFile);
StrRemoveWhitespace(szWasInfopane);
StrRemoveWhitespace(szWasInfopaneBmp);
StrRemoveWhitespace(szWasHTMLPath);
StrRemoveWhitespace(szWasSender);
StrRemoveWhitespace(szWasReply);
if (StrCmpI(szWasInfopane, szInfopane) != 0 ||
StrCmpI(szWasInfopaneBmp, szInfopaneBmp) != 0 ||
StrCmpI(szWasHTMLPath, szHTMLPath) != 0 ||
StrCmp (szWasSender, szSender) != 0 ||
StrCmpI(szWasReply, szReply) != 0)
g_fInsDirty = TRUE;
}
//----- Serialize data to the *.ins file -----
if (!fCheckDirtyOnly)
{
// clear of the old entries and associated images.
ImportOEInfo(g_szInsFile, g_szWorkDir, FALSE);
WritePrivateProfileString(IS_INTERNETMAIL, IK_INFOPANE, szInfopane, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_INFOPANEBMP, szInfopaneBmp, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_WELCOMEMESSAGE, szHTMLPath, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_WELCOMENAME, szSender, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_WELCOMEADDR, szReply, g_szInsFile);
PathCombine(szWorkDir, g_szWorkDir, TEXT("oe.wrk"));
ImportOEInfo(g_szInsFile, szWorkDir, TRUE);
}
*((LPBOOL)wParam) = TRUE;
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
default:
return FALSE;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// Signature
INT_PTR CALLBACK Signature(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
TCHAR szBuf1[1024],
szBuf2[1024];
BOOL fUseMailForNews,
fDoSig,
fHtmlMail,
fHtmlNews,
fCheckDirtyOnly,
fEnable;
switch (msg)
{
case WM_INITDIALOG:
//----- Set up dialog controls -----
EnableDBCSChars(hDlg, IDE_MAILSIGTEXT);
EnableDBCSChars(hDlg, IDE_NEWSSIGTEXT);
Edit_LimitText(GetDlgItem(hDlg, IDE_MAILSIGTEXT), countof(szBuf1)-1);
Edit_LimitText(GetDlgItem(hDlg, IDE_NEWSSIGTEXT), countof(szBuf1)-1);
//----- Initialization of fields -----
fUseMailForNews = (BOOL)GetPrivateProfileInt(IS_MAILSIG, IK_USEMAILFORNEWS, FALSE, g_szInsFile);
fDoSig = (BOOL)GetPrivateProfileInt(IS_MAILSIG, IK_USESIG, FALSE, g_szInsFile);
fHtmlMail = (BOOL)GetPrivateProfileInt(IS_INTERNETMAIL, IK_HTMLMSGS, TRUE, g_szInsFile);
fHtmlNews = (BOOL)GetPrivateProfileInt(IS_INTERNETNEWS, IK_HTMLMSGS, FALSE, g_szInsFile);
GetPrivateProfileString(IS_MAILSIG, IK_SIGTEXT, c_szEmpty, szBuf1, countof(szBuf1), g_szInsFile);
EncodeSignature(szBuf1, szBuf2, FALSE);
SetDlgItemText(hDlg, IDE_MAILSIGTEXT, szBuf2);
if (!fUseMailForNews)
{
GetPrivateProfileString(IS_SIG, IK_SIGTEXT, c_szEmpty, szBuf1, countof(szBuf1), g_szInsFile);
EncodeSignature(szBuf1, szBuf2, FALSE);
SetDlgItemText(hDlg, IDE_NEWSSIGTEXT, szBuf2);
}
//----- Set up dialog controls -----
// Note. Some of it is done above already;
CheckDlgButton(hDlg, IDC_MAILSIGTEXT, fDoSig ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_NEWSSIGTEXT, (fDoSig && !fUseMailForNews) ? BST_CHECKED : BST_UNCHECKED);
EnableDlgItem2(hDlg, IDE_MAILSIGTEXT, fDoSig);
EnableDlgItem2(hDlg, IDC_NEWSSIGTEXT, fDoSig);
EnableDlgItem2(hDlg, IDE_NEWSSIGTEXT, fDoSig && !fUseMailForNews);
CheckDlgButton(hDlg, IDC_HTMLMAIL, fHtmlMail ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_HTMLNEWS, fHtmlNews ? BST_CHECKED : BST_UNCHECKED);
break;
case WM_COMMAND:
switch (HIWORD(wParam))
{
case BN_CLICKED:
switch (LOWORD(wParam))
{
case IDC_MAILSIGTEXT:
case IDC_NEWSSIGTEXT:
fEnable = (IsDlgButtonChecked(hDlg, IDC_MAILSIGTEXT) == BST_CHECKED);
EnableDlgItem2(hDlg, IDE_MAILSIGTEXT, fEnable);
EnableDlgItem2(hDlg, IDC_NEWSSIGTEXT, fEnable);
fEnable &= (IsDlgButtonChecked(hDlg, IDC_NEWSSIGTEXT) == BST_CHECKED);
EnableDlgItem2(hDlg, IDE_NEWSSIGTEXT, fEnable);
break;
}
break;
default:
return FALSE;
}
break;
case UM_SAVE:
fCheckDirtyOnly = (BOOL) lParam;
//----- Read data from controls into internal variables -----
fUseMailForNews = (IsDlgButtonChecked(hDlg, IDC_NEWSSIGTEXT) != BST_CHECKED);
fDoSig = (IsDlgButtonChecked(hDlg, IDC_MAILSIGTEXT) == BST_CHECKED);
fHtmlMail = (IsDlgButtonChecked(hDlg, IDC_HTMLMAIL) == BST_CHECKED);
fHtmlNews = (IsDlgButtonChecked(hDlg, IDC_HTMLNEWS) == BST_CHECKED);
//----- Handle g_fInsDirty flag -----
if (!g_fInsDirty)
{
BOOL fChgMailSig,
fChgNewsSig,
fWasUseMailForNews,
fWasHtmlMail,
fWasHtmlNews,
fWasDoSig;
GetPrivateProfileString(IS_MAILSIG, IK_SIGTEXT, c_szEmpty, szBuf1, countof(szBuf1), g_szInsFile);
EncodeSignature(szBuf1, szBuf2, FALSE);
GetDlgItemText(hDlg, IDE_MAILSIGTEXT, szBuf1, countof(szBuf1));
fChgMailSig = (StrCmp(szBuf1, szBuf2) != 0);
GetPrivateProfileString(IS_SIG, IK_SIGTEXT, c_szEmpty, szBuf1, countof(szBuf1), g_szInsFile);
EncodeSignature(szBuf1, szBuf2, FALSE);
GetDlgItemText(hDlg, IDE_NEWSSIGTEXT, szBuf1, countof(szBuf1));
fChgNewsSig = (StrCmp(szBuf1, szBuf2) != 0);
fWasUseMailForNews = (BOOL)GetPrivateProfileInt(IS_MAILSIG, IK_USEMAILFORNEWS, FALSE, g_szInsFile);
fWasDoSig = (BOOL)GetPrivateProfileInt(IS_MAILSIG, IK_USESIG, FALSE, g_szInsFile);
fWasHtmlMail = (BOOL)GetPrivateProfileInt(IS_INTERNETMAIL, IK_HTMLMSGS, TRUE, g_szInsFile);
fWasHtmlNews = (BOOL)GetPrivateProfileInt(IS_INTERNETNEWS, IK_HTMLMSGS, FALSE, g_szInsFile);
if (fChgMailSig ||
fChgNewsSig ||
fWasUseMailForNews != fUseMailForNews ||
fWasDoSig != fDoSig ||
fWasHtmlMail != fHtmlMail ||
fWasHtmlNews != fHtmlNews)
g_fInsDirty = TRUE;
}
//----- Serialize data to the *.ins file (main part) -----
if (!fCheckDirtyOnly)
{
GetDlgItemText(hDlg, IDE_MAILSIGTEXT, szBuf1, countof(szBuf1));
EncodeSignature(szBuf1, szBuf2, TRUE);
WritePrivateProfileString(MAIL_SIG, SIG_TEXT, szBuf2, g_szInsFile);
GetDlgItemText(hDlg, IDE_NEWSSIGTEXT, szBuf1, countof(szBuf1));
EncodeSignature(szBuf1, szBuf2, TRUE);
WritePrivateProfileString(SIGNATURE, SIG_TEXT, szBuf2, g_szInsFile);
// Note. Some of it is done above already.
WritePrivateProfileString(IS_MAILSIG, IK_USEMAILFORNEWS, fUseMailForNews ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_MAILSIG, IK_USESIG, fDoSig ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_SIG, IK_USESIG, fDoSig ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_INTERNETMAIL, IK_HTMLMSGS, fHtmlMail ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_INTERNETNEWS, IK_HTMLMSGS, fHtmlNews ? c_sz1 : c_sz0, g_szInsFile);
}
*((LPBOOL)wParam) = TRUE;
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
default:
return FALSE;
}
return TRUE;
}
#define CBSECTION 1024
void InitializeNewsgroups(HWND hwnd, LPCTSTR pszSection, LPCTSTR pszValue, LPCTSTR pszFile)
{
LPTSTR pszGroups, psz, pszDest;
TCHAR szGroupSection[256];
DWORD dw;
dw = GetPrivateProfileString(pszSection, pszValue, c_szEmpty, szGroupSection, countof(szGroupSection), pszFile);
if (dw > 0)
{
pszGroups = (LPTSTR)LocalAlloc(LMEM_FIXED, StrCbFromCch(CBSECTION));
if (pszGroups != NULL)
{
dw = GetPrivateProfileSection(szGroupSection, pszGroups, CBSECTION, pszFile);
if (dw > 0)
{
psz = pszGroups;
pszDest = pszGroups;
while (*psz != 0)
{
while (*psz != 0 && *psz != '=')
{
*pszDest = *psz;
psz++;
pszDest++;
}
if (*psz != 0)
{
psz++;
while (*psz != 0)
psz++;
}
psz++;
*pszDest = 0x0d;
pszDest++;
*pszDest = 0x0a;
pszDest++;
}
*pszDest = 0;
}
SetWindowText(hwnd, pszGroups);
LocalFree(pszGroups);
}
}
}
void SaveNewsgroups(HWND hwnd, LPCTSTR pszSection, LPCTSTR pszValue, LPCTSTR pszFile)
{
LPTSTR pszGroups, psz, pszDest, pszDestT;
TCHAR szGroupSection[256];
DWORD dw, cch;
BOOL fGroups;
fGroups = FALSE;
cch = GetWindowTextLength(hwnd);
if (cch > 0)
{
cch += 4;
pszGroups = (LPTSTR)LocalAlloc(LMEM_FIXED, StrCbFromCch(cch));
if (pszGroups != NULL)
{
cch = GetWindowText(hwnd, pszGroups, cch);
psz = pszGroups;
pszDest = pszGroups;
pszDestT = pszDest;
while (*psz != 0)
{
if (*psz == '\r' && *(psz + 1) == '\n')
{
psz += 2;
if (pszDest > pszDestT)
{
*pszDest = '=';
pszDest++;
*pszDest = 0;
pszDest++;
pszDestT = pszDest;
fGroups = TRUE;
}
continue;
}
else if (*psz != '\t' && *psz != ' ' && *psz != '\r' && *psz != '\n')
{
*pszDest = *psz;
pszDest++;
}
psz++;
}
if (pszDest > pszDestT)
{
*pszDest = '=';
pszDest++;
*pszDest = 0;
pszDest++;
}
*pszDest = 0;
if (fGroups)
{
dw = GetPrivateProfileString(pszSection, pszValue, c_szEmpty, szGroupSection, countof(szGroupSection), pszFile);
if (dw == 0)
lstrcpy(szGroupSection, IK_NEWSGROUPLIST);
WritePrivateProfileString(pszSection, pszValue, szGroupSection, pszFile);
WritePrivateProfileSection(szGroupSection, pszGroups, pszFile);
}
LocalFree(pszGroups);
}
}
if (!fGroups)
{
dw = GetPrivateProfileString(pszSection, pszValue, c_szEmpty, szGroupSection, countof(szGroupSection), pszFile);
if (dw > 0)
WritePrivateProfileSection(szGroupSection, NULL, pszFile);
WritePrivateProfileString(pszSection, pszValue, NULL, pszFile);
}
}
/////////////////////////////////////////////////////////////////////////////
// PreConfigSettings
INT_PTR CALLBACK PreConfigSettings(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL fDefMail,
fDefNews,
#if defined(CONDITIONAL_JUNKMAIL)
fJunkMail,
#endif
fDeleteLinks,
fCheckDirtyOnly;
TCHAR szServiceName[MAX_PATH],
szServiceURL[INTERNET_MAX_URL_LENGTH];
switch(msg)
{
case WM_INITDIALOG:
//----- Set up dialog controls -----
// EnableDBCSChars(hDlg, IDE_NGROUPS);
EnableDBCSChars(hDlg, IDE_SERVICENAME);
EnableDBCSChars(hDlg, IDE_SERVICEURL);
Edit_LimitText(GetDlgItem(hDlg, IDE_SERVICENAME), countof(szServiceName)-1);
Edit_LimitText(GetDlgItem(hDlg, IDE_SERVICEURL), countof(szServiceURL)-1);
#if defined(CONDITIONAL_JUNKMAIL)
//----- Initialization of fields -----
fJunkMail = InsGetYesNo(IS_INTERNETMAIL, IK_JUNKMAIL, FALSE, g_szInsFile);
#endif
fDefMail = InsGetYesNo(IS_INTERNETMAIL, IK_DEFAULTCLIENT, FALSE, g_szInsFile);
fDefNews = InsGetYesNo(IS_INTERNETNEWS, IK_DEFAULTCLIENT, FALSE, g_szInsFile);
fDeleteLinks = InsGetBool(IS_OUTLKEXP, IK_DELETELINKS, FALSE, g_szInsFile);
GetPrivateProfileString(IS_OEGLOBAL, IK_SERVICENAME, c_szEmpty, szServiceName, countof(szServiceName), g_szInsFile);
GetPrivateProfileString(IS_OEGLOBAL, IK_SERVICEURL, c_szEmpty, szServiceURL, countof(szServiceURL), g_szInsFile);
StrRemoveWhitespace(szServiceName);
StrRemoveWhitespace(szServiceURL);
//----- Set up dialog controls -----
CheckDlgButton(hDlg, IDC_DEFMAIL, fDefMail ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_DEFNEWS, fDefNews ? BST_CHECKED : BST_UNCHECKED);
#if defined(CONDITIONAL_JUNKMAIL)
CheckDlgButton(hDlg, IDC_JUNKMAIL,fJunkMail? BST_CHECKED : BST_UNCHECKED);
#endif
CheckDlgButton(hDlg, IDC_DELETELINKS, fDeleteLinks ? BST_CHECKED : BST_UNCHECKED);
InitializeNewsgroups(GetDlgItem(hDlg, IDE_NGROUPS), IS_INTERNETNEWS, IK_NEWSGROUPS, g_szInsFile);
SendDlgItemMessage(hDlg, IDE_NGROUPS, EM_SETMODIFY, 0, 0);
SetDlgItemText(hDlg, IDE_SERVICENAME, szServiceName);
SetDlgItemText(hDlg, IDE_SERVICEURL, szServiceURL);
break;
case UM_SAVE:
fCheckDirtyOnly = (BOOL) lParam;
//----- Read data from controls into internal variables -----
fDefMail = (IsDlgButtonChecked(hDlg, IDC_DEFMAIL) == BST_CHECKED);
fDefNews = (IsDlgButtonChecked(hDlg, IDC_DEFNEWS) == BST_CHECKED);
#if defined(CONDITIONAL_JUNKMAIL)
fJunkMail= (IsDlgButtonChecked(hDlg, IDC_JUNKMAIL) == BST_CHECKED);
#endif
fDeleteLinks = (IsDlgButtonChecked(hDlg, IDC_DELETELINKS) == BST_CHECKED);
GetDlgItemText(hDlg, IDE_SERVICENAME, szServiceName, countof(szServiceName));
GetDlgItemText(hDlg, IDE_SERVICEURL, szServiceURL, countof(szServiceURL));
StrRemoveWhitespace(szServiceName);
StrRemoveWhitespace(szServiceURL);
//----- Validate the input -----
if (!fCheckDirtyOnly)
{
if (ISNONNULL(szServiceName) || ISNONNULL(szServiceURL))
{
if (!CheckField(hDlg, IDE_SERVICENAME, FC_NONNULL))
return(TRUE);
if (!CheckField(hDlg, IDE_SERVICEURL, FC_URL | FC_NONNULL))
return(TRUE);
}
}
//----- Handle g_fInsDirty flag -----
if (!g_fInsDirty)
{
BOOL fWasDefMail,
#if defined(CONDITIONAL_JUNKMAIL)
fWasJunkMail,
#endif
fWasDefNews,
fWasDeleteLinks;
TCHAR szWasRulesFile[MAX_PATH],
szWasServiceName[MAX_PATH],
szWasServiceURL[INTERNET_MAX_URL_LENGTH];
fWasDefMail = InsGetYesNo(IS_INTERNETMAIL, IK_DEFAULTCLIENT, FALSE, g_szInsFile);
fWasDefNews = InsGetYesNo(IS_INTERNETNEWS, IK_DEFAULTCLIENT, FALSE, g_szInsFile);
#if defined(CONDITIONAL_JUNKMAIL)
fWasJunkMail = InsGetYesNo(IS_INTERNETMAIL, IK_JUNKMAIL, FALSE, g_szInsFile);
#endif
fWasDeleteLinks = InsGetBool(IS_OUTLKEXP, IK_DELETELINKS, FALSE, g_szInsFile);
GetPrivateProfileString(IS_OEGLOBAL, IK_SERVICENAME, c_szEmpty, szWasServiceName, countof(szWasServiceName), g_szInsFile);
GetPrivateProfileString(IS_OEGLOBAL, IK_SERVICEURL, c_szEmpty, szWasServiceURL, countof(szWasServiceURL), g_szInsFile);
StrRemoveWhitespace(szWasServiceName);
StrRemoveWhitespace(szWasServiceURL);
StrRemoveWhitespace(szWasRulesFile);
if (fDefMail != fWasDefMail ||
fDefNews != fWasDefNews ||
#if defined(CONDITIONAL_JUNKMAIL)
fJunkMail != fWasJunkMail ||
#endif
fDeleteLinks != fWasDeleteLinks ||
SendDlgItemMessage(hDlg, IDE_NGROUPS, EM_GETMODIFY, 0, 0) ||
StrCmpI(szServiceName, szWasServiceName) != 0 ||
StrCmpI(szServiceURL, szWasServiceURL) != 0)
g_fInsDirty = TRUE;
}
//----- Serialize data to the *.ins file -----
if (!fCheckDirtyOnly)
{
WritePrivateProfileString(IS_INTERNETMAIL, IK_DEFAULTCLIENT, fDefMail ? c_szYes : c_szNo, g_szInsFile);
WritePrivateProfileString(IS_INTERNETNEWS, IK_DEFAULTCLIENT, fDefNews ? c_szYes : c_szNo, g_szInsFile);
#if defined(CONDITIONAL_JUNKMAIL)
WritePrivateProfileString(IS_INTERNETMAIL, IK_JUNKMAIL, fJunkMail? c_sz1 : c_sz0, g_szInsFile);
#endif
InsWriteBool(IS_OUTLKEXP, IK_DELETELINKS, fDeleteLinks? c_sz1 : NULL, g_szInsFile);
SaveNewsgroups(GetDlgItem(hDlg, IDE_NGROUPS), IS_INTERNETNEWS, IK_NEWSGROUPS, g_szInsFile);
WritePrivateProfileString(IS_OEGLOBAL, IK_SERVICENAME, szServiceName, g_szInsFile);
WritePrivateProfileString(IS_OEGLOBAL, IK_SERVICEURL, szServiceURL, g_szInsFile);
}
*((LPBOOL)wParam) = TRUE;
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
default:
return FALSE;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// ViewSettings
INT_PTR CALLBACK ViewSettings(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
BOOL fFolderBar,
fFolderList,
fContacts,
fTip,
fStatus,
fToolbar,
fToolbarText,
fOutlook,
fPreview,
fPreviewHdr,
fPreviewSide,
fCheckDirtyOnly;
LPCTSTR psz;
switch(msg)
{
case WM_INITDIALOG:
//----- Initialization of fields -----
fFolderBar = GetPrivateProfileInt(IS_OUTLKEXP, IK_FOLDERBAR, TRUE, g_szInsFile);
fFolderList = GetPrivateProfileInt(IS_OUTLKEXP, IK_FOLDERLIST, TRUE, g_szInsFile);
fOutlook = GetPrivateProfileInt(IS_OUTLKEXP, IK_OUTLOOKBAR, FALSE, g_szInsFile);
fStatus = GetPrivateProfileInt(IS_OUTLKEXP, IK_STATUSBAR, TRUE, g_szInsFile);
fContacts = GetPrivateProfileInt(IS_OUTLKEXP, IK_CONTACTS, TRUE, g_szInsFile);
fTip = GetPrivateProfileInt(IS_OUTLKEXP, IK_TIPOFTHEDAY, TRUE, g_szInsFile);
fToolbar = GetPrivateProfileInt(IS_OUTLKEXP, IK_TOOLBAR, TRUE, g_szInsFile);
if (fToolbar)
fToolbarText = GetPrivateProfileInt(IS_OUTLKEXP, IK_TOOLBARTEXT, TRUE, g_szInsFile);
else
fToolbarText = TRUE;
fPreview = GetPrivateProfileInt(IS_OUTLKEXP, IK_PREVIEWPANE, TRUE, g_szInsFile);
if (fPreview)
{
fPreviewHdr = GetPrivateProfileInt(IS_OUTLKEXP, IK_PREVIEWHDR, TRUE, g_szInsFile);
fPreviewSide = GetPrivateProfileInt(IS_OUTLKEXP, IK_PREVIEWSIDE, FALSE, g_szInsFile);
}
else
{
fPreviewHdr = TRUE;
fPreviewSide = FALSE;
}
//----- Set up dialog controls -----
CheckDlgButton(hDlg, IDC_FOLDERBAR, fFolderBar ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_FOLDERLIST, fFolderList ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_OUTLOOKBAR, fOutlook ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_STATUSBAR, fStatus ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_CONTACTS, fContacts ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_TIPOFDAY, fTip ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_TOOLBAR, fToolbar ? BST_CHECKED : BST_UNCHECKED);
if (!fToolbar)
SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_TOOLBAR, BN_CLICKED), (LPARAM)GetDlgItem(hDlg, IDC_TOOLBAR));
CheckDlgButton(hDlg, IDC_TBARTEXT, fToolbarText ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hDlg, IDC_PREVIEW, fPreview ? BST_CHECKED : BST_UNCHECKED);
if (!fPreview)
SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDC_PREVIEW, BN_CLICKED), (LPARAM)GetDlgItem(hDlg, IDC_PREVIEW));
CheckDlgButton(hDlg, fPreviewSide ? IDC_SPLITVERT : IDC_SPLITHORZ, BST_CHECKED);
CheckDlgButton(hDlg, IDC_PREVIEWHDR, fPreviewHdr ? BST_CHECKED : BST_UNCHECKED);
break;
case WM_COMMAND:
if (BN_CLICKED == HIWORD(wParam))
{
switch (LOWORD(wParam))
{
case IDC_TOOLBAR:
fToolbar = IsDlgButtonChecked(hDlg, IDC_TOOLBAR);
EnableDlgItem2(hDlg, IDC_TBARTEXT, fToolbar);
break;
case IDC_PREVIEW:
fPreview = IsDlgButtonChecked(hDlg, IDC_PREVIEW);
EnableDlgItem2(hDlg, IDC_SPLITVERT, fPreview);
EnableDlgItem2(hDlg, IDC_SPLITHORZ, fPreview);
EnableDlgItem2(hDlg, IDC_PREVIEWHDR, fPreview);
break;
}
break;
}
break;
case UM_SAVE:
fCheckDirtyOnly = (BOOL) lParam;
//----- Read data from controls into internal variables -----
fFolderBar = (IsDlgButtonChecked(hDlg, IDC_FOLDERBAR) == BST_CHECKED);
fFolderList = (IsDlgButtonChecked(hDlg, IDC_FOLDERLIST) == BST_CHECKED);
fOutlook = (IsDlgButtonChecked(hDlg, IDC_OUTLOOKBAR) == BST_CHECKED);
fStatus = (IsDlgButtonChecked(hDlg, IDC_STATUSBAR) == BST_CHECKED);
fContacts = (IsDlgButtonChecked(hDlg, IDC_CONTACTS) == BST_CHECKED);
fTip = (IsDlgButtonChecked(hDlg, IDC_TIPOFDAY) == BST_CHECKED);
fToolbar = (IsDlgButtonChecked(hDlg, IDC_TOOLBAR) == BST_CHECKED);
fToolbarText = (IsDlgButtonChecked(hDlg, IDC_TBARTEXT) == BST_CHECKED);
fPreview = (IsDlgButtonChecked(hDlg, IDC_PREVIEW) == BST_CHECKED);
fPreviewSide = (IsDlgButtonChecked(hDlg, IDC_SPLITVERT) == BST_CHECKED);
fPreviewHdr = (IsDlgButtonChecked(hDlg, IDC_PREVIEWHDR) == BST_CHECKED);
//----- Handle g_fInsDirty flag -----
if (!g_fInsDirty)
{
BOOL fWasFolderBar,
fWasFolderList,
fWasContacts,
fWasTip,
fWasStatus,
fWasToolbar,
fWasToolbarText,
fWasOutlook,
fWasPreview,
fWasPreviewHdr,
fWasPreviewSide;
fWasFolderBar = GetPrivateProfileInt(IS_OUTLKEXP, IK_FOLDERBAR, TRUE, g_szInsFile);
fWasFolderList = GetPrivateProfileInt(IS_OUTLKEXP, IK_FOLDERLIST, TRUE, g_szInsFile);
fWasOutlook = GetPrivateProfileInt(IS_OUTLKEXP, IK_OUTLOOKBAR, FALSE, g_szInsFile);
fWasStatus = GetPrivateProfileInt(IS_OUTLKEXP, IK_STATUSBAR, TRUE, g_szInsFile);
fWasContacts = GetPrivateProfileInt(IS_OUTLKEXP, IK_CONTACTS, TRUE, g_szInsFile);
fWasTip = GetPrivateProfileInt(IS_OUTLKEXP, IK_TIPOFTHEDAY, TRUE, g_szInsFile);
fWasToolbar = GetPrivateProfileInt(IS_OUTLKEXP, IK_TOOLBAR, TRUE, g_szInsFile);
fWasToolbarText = GetPrivateProfileInt(IS_OUTLKEXP, IK_TOOLBARTEXT, TRUE, g_szInsFile);
fWasPreview = GetPrivateProfileInt(IS_OUTLKEXP, IK_PREVIEWPANE, TRUE, g_szInsFile);
fWasPreviewHdr = GetPrivateProfileInt(IS_OUTLKEXP, IK_PREVIEWHDR, TRUE, g_szInsFile);
fWasPreviewSide = GetPrivateProfileInt(IS_OUTLKEXP, IK_PREVIEWSIDE, FALSE, g_szInsFile);
if (fFolderBar != fWasFolderBar ||
fFolderList != fWasFolderList ||
fContacts != fWasContacts ||
fTip != fWasTip ||
fStatus != fWasStatus ||
fToolbar != fWasToolbar ||
fToolbarText != fWasToolbarText ||
fOutlook != fWasOutlook ||
fPreview != fWasPreview ||
fPreviewHdr != fWasPreviewHdr ||
fPreviewSide != fWasPreviewSide)
g_fInsDirty = TRUE;
}
//----- Serialize data to the *.ins file -----
if (!fCheckDirtyOnly)
{
WritePrivateProfileString(IS_OUTLKEXP, IK_FOLDERBAR, fFolderBar ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_OUTLKEXP, IK_FOLDERLIST, fFolderList ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_OUTLKEXP, IK_OUTLOOKBAR, fOutlook ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_OUTLKEXP, IK_STATUSBAR, fStatus ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_OUTLKEXP, IK_CONTACTS, fContacts ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_OUTLKEXP, IK_TIPOFTHEDAY, fTip ? c_sz1 : c_sz0, g_szInsFile);
WritePrivateProfileString(IS_OUTLKEXP, IK_TOOLBAR, fToolbar ? c_sz1 : c_sz0, g_szInsFile);
if (fToolbar)
psz = fToolbarText ? c_sz1 : c_sz0;
else
psz = NULL;
WritePrivateProfileString(IS_OUTLKEXP, IK_TOOLBARTEXT, psz, g_szInsFile);
WritePrivateProfileString(IS_OUTLKEXP, IK_PREVIEWPANE, fPreview ? c_sz1 : c_sz0, g_szInsFile);
if (fPreview)
psz = fPreviewHdr ? c_sz1 : c_sz0;
else
psz = NULL;
WritePrivateProfileString(IS_OUTLKEXP, IK_PREVIEWHDR, psz, g_szInsFile);
if (fPreview)
psz = fPreviewSide ? c_sz1 : c_sz0;
else
psz = NULL;
WritePrivateProfileString(IS_OUTLKEXP, IK_PREVIEWSIDE, psz, g_szInsFile);
}
*((LPBOOL)wParam) = TRUE;
break;
case WM_CLOSE:
DestroyWindow(hDlg);
break;
default:
return FALSE;
}
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// LDAPFinalCopy
HRESULT LDAPFinalCopy(LPCTSTR pcszDestDir, DWORD dwFlags, LPDWORD pdwCabState)
{
TCHAR szFrom[MAX_PATH];
PathCombine(szFrom, g_szWorkDir, TEXT("ldap.wrk"));
if (HasFlag(dwFlags, PM_CHECK) && pdwCabState != NULL && !PathIsEmptyPath(szFrom, FILES_ONLY))
SetFlag(pdwCabState, CAB_TYPE_CONFIG);
if (HasFlag(dwFlags, PM_COPY))
CopyFileToDir(szFrom, pcszDestDir);
if (HasFlag(dwFlags, PM_CLEAR))
PathRemovePath(szFrom);
return S_OK;
}
/////////////////////////////////////////////////////////////////////////////
// OEFinalCopy
HRESULT OEFinalCopy(LPCTSTR pcszDestDir, DWORD dwFlags, LPDWORD pdwCabState)
{
TCHAR szFrom[MAX_PATH];
PathCombine(szFrom, g_szWorkDir, TEXT("oe.wrk"));
if (HasFlag(dwFlags, PM_CHECK) && pdwCabState != NULL && !PathIsEmptyPath(szFrom, FILES_ONLY))
SetFlag(pdwCabState, CAB_TYPE_CONFIG);
if (HasFlag(dwFlags, PM_COPY))
CopyFileToDir(szFrom, pcszDestDir);
if (HasFlag(dwFlags, PM_CLEAR))
PathRemovePath(szFrom);
return S_OK;
}
| [
"polarisdp@gmail.com"
] | polarisdp@gmail.com |
d381842247268ae3a874500195a1dfc521246e30 | 1e0b54c52aa78b424195b733528f603569e43700 | /UVa problems/solutions/11547/main.cpp | 4ed5a90113b8a7b695b55cb65c72607850852628 | [] | no_license | ahmedfawzy98/Competitive-Programming | 6a732e99e5f2ef23c152cde7fb9c2d19202d6fa4 | c05abafe424ae6ade8a94b6cbfdfcfe143840271 | refs/heads/master | 2022-04-18T10:09:11.802127 | 2020-04-12T20:49:23 | 2020-04-12T20:49:23 | 255,167,843 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 236 | cpp | #include <iostream>
using namespace std;
int main() {
int t , n , tmp;
cin>>t;
while(t--){
cin>>n;
tmp = (((n*567 / 9 + 7492) * 235 / 47) -498 ) / 10;
cout<< abs(tmp%10)<<endl;
}
return 0;
} | [
"ahmedfawzy671998@gmailcom"
] | ahmedfawzy671998@gmailcom |
94efabe1ee5ecfe6fa8e95f8a463ce71b85fd9bd | 11a03459d5ec45605a74e165e8e583a4f44534fc | /chapter3/gallery-core/gallery-core/picture_database.cpp | 33eeb9e941902abcf4ea1e6196d1267526c1fc96 | [] | no_license | brandonsoto/Mastering-Qt5 | 61c79f02b1cdae7a8e6aff03aa53da2e05ef0a43 | d63d94d583bf4cefbf4c902b7ab740f7a1044a6f | refs/heads/master | 2021-01-01T19:31:33.977804 | 2017-07-30T23:11:49 | 2017-07-30T23:11:49 | 98,601,688 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,146 | cpp | #include "picture_database.h"
#include "picture.h"
#include <QSqlDatabase>
#include <QString>
#include <QSqlQuery>
#include <QStringList>
#include <QVariant>
Picture_Database::Picture_Database(QSqlDatabase &database)
: database_{ database }
{ }
void Picture_Database::init() const
{
if ( not database_.tables().contains("pictures" ) ) {
QSqlQuery query( database_ );
query.exec( QString( "CREATE TABLE pictures" )
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, "
+ "album_id INTEGER, "
+ "url TEXT) " );
}
}
void Picture_Database::add_picture_in_album(int albumId, Picture& picture) const
{
QSqlQuery query(database_);
query.prepare(QString("INSERT INTO pictures")
+ " (album_id, url)"
+ " VALUES ("
+ ":album_id, "
+ ":url"
+ ")");
query.bindValue(":album_id", albumId);
query.bindValue(":url", picture.file_url());
query.exec();
picture.set_id(query.lastInsertId().toInt());
picture.set_album_id(albumId);
}
void Picture_Database::remove_picture(int id) const
{
QSqlQuery query(database_);
query.prepare("DELETE FROM pictures WHERE id = (:id)");
query.bindValue(":id", id);
query.exec();
}
void Picture_Database::remove_pictures_for_album(int albumId) const
{
QSqlQuery query(database_);
query.prepare("DELETE FROM pictures WHERE album_id = (:album_id)");
query.bindValue(":album_id", albumId);
query.exec();
}
Picture_Database::picture_list Picture_Database::get_pictures_for_album(int albumId) const
{
QSqlQuery query(database_);
query.prepare("SELECT * FROM pictures WHERE album_id = (:album_id)");
query.bindValue(":album_id", albumId);
query.exec();
picture_list pictures{};
while(query.next()) {
std::unique_ptr<Picture> picture{ std::make_unique<Picture>() };
picture->set_id(query.value("id").toInt());
picture->set_album_id(query.value("album_id").toInt());
picture->set_file_url(query.value("url").toString());
pictures->push_back(std::move(picture));
}
return pictures;
}
| [
"brandon.soto09@gmail.com"
] | brandon.soto09@gmail.com |
6697489521dfc832d4782a01b195056a58d7522a | 1a1ffb9a920ebf7a252433008303dfeac845adab | /Part-I Basic Technieques/Chapter 3 (Sorting)/3_vector_sort_reverse_compare.cpp | 63ec8f1618deac54f5395eb19c356753b43a5b0d | [] | no_license | itsamankrsingh/hritikkumar-cp | 82b06d3d04bb455b783ea6490e979be798865dfa | e5545bf018ce64c852bab9a96240176b15af4916 | refs/heads/master | 2023-03-17T15:58:26.156977 | 2021-03-11T08:02:53 | 2021-03-11T08:02:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 900 | cpp | #include<bits/stdc++.h> // all header files
using namespace std; // namespace created as std
bool compare(char, char); // compare function for sort
int main(void)
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int n;
cin>>n;
vector<int> vt(n); // size has been defined
for(int i=0;i<n;i++)cin>>vt[i];
sort(vt.begin(), vt.end());
// ascending order sorted vector ( vector is simply a dynamic array)
for(int i=0;i<n;i++)cout<<vt[i]<<" ";
cout<<endl;
sort(vt.rbegin(), vt.rend());// reverse(vt.begin(), vt.end());
// sorting in descending order
for(int i=0;i<n;i++)cout<<vt[i]<<" ";
cout<<endl;
// sorting according a compare operator
string s = "nevergiveup";
sort(s.begin(), s.end(), compare);
cout<<s<<endl;
return 0;
}
bool compare(char ch1, char ch2)
{
if((ch1-ch2) > 0)
return false;
else
return true;
}
| [
"hritix@gmail.com"
] | hritix@gmail.com |
941a47a83516632f56ace5ac921188c53af2807d | 1fad1a5416efa0c543afa3441ce197c4ff548aca | /main.cpp | ab81d2cd1e0ec4dd2c12dee8f2cc625e78aee6d7 | [] | no_license | BernardoMartinez08/AlgoritmoPRIM-Grafos | 9b3f03e6ee7a5876d1072fcc36b9b2bee66e64a3 | d2cec1ba3598f61865c7a211233623c9f3468138 | refs/heads/main | 2023-03-15T08:04:35.580565 | 2021-03-17T16:11:54 | 2021-03-17T16:11:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,164 | cpp | #include <iostream>
#include <conio.h>
#include "grafo.h"
// Numero de vertices en el Grafo
#define V 5
/* Esta funcion nos permite buscar y por lo tanto encontrar el vertice con menor
distancia entre los que no se han visitado*/
int minimoVertice(int peso[], bool noVistos[])
{
// El valor minimo sera un INT_MAX porque un vertice puede tener infinito peso,
// Y min_pos que almacenara la pocion de donde se encuentra ese vector con minima distancia.
int min = INT_MAX, min_pos;
for (int v = 0; v < V; v++)
if (noVistos[v] == false && peso[v] < min)
min = peso[v], min_pos = v;
return min_pos;
}
/* La funcion de print nos permite hacer la salida de pantalla de las distancias minimas que nos deja
el arbol recubridor o de distancias minimas.*/
void printMST(int arbolRecubridor[], int grafo[V][V])
{
int pesoTotal = 0;
cout << "Edge \tWeight\n";
for (int i = 1; i < V; i++) {
cout << arbolRecubridor[i] << " - " << i << " \t" << grafo[i][arbolRecubridor[i]] << " \n";
pesoTotal += grafo[i][arbolRecubridor[i]];
}
cout << "El Peso final del arbol es de: " << pesoTotal;
}
/*La funcion primMST, a traves del uso del arbol de distancias/pesos minimos encuentra
las distancias mas cortas para llegar a todos los vertices*/
void primMST(int grafo[V][V])
{
// Aqui se guarda el Arbol Recubridor.
int arbolRecubridor[V];
// Aqui guardamos el peso minimo en cada recorrido por el arbol.
int peso[V];
// Almacena si los vertices se ven representados en el arbol.
bool verticesMTS[V];
// Inicializamos las distancias o pesos del arbol el INT_MAX y
// establecemos que ningun vertice se ve reflejado en el arbol aun.
for (int i = 0; i < V; i++)
peso[i] = INT_MAX, verticesMTS[i] = false;
/* Esta estructura toma el primer vertice siempre para buscar las demas
distancias.*/
peso[0] = 0;
arbolRecubridor[0] = -1;
// EL arbol tendra la cantidas V de vertices que es equivalente al numero
//de vertices de grafo.
for (int count = 0; count < V - 1; count++)
{
/* Buscamos el minimp peso en los vertices no visitados*/
int u = minimoVertice(peso, verticesMTS);
/* agregamos dicho vertice a los visitados o que ya estan representados
en el arbol*/
verticesMTS[u] = true;
/* Se actualiza el peso minimo para el vertice*/
for (int v = 0; v < V; v++)
// grafo[u][v] es diferente de 0 osea que tiene una distancia.
// verticesMTS[v] es falso para los vertices que no estan incluidos en el arbol aun.
// Actualiza el peso solo si grafo[u][v] es mas pequenio que el peso[v]
if (grafo[u][v] && verticesMTS[v] == false && grafo[u][v] < peso[v])
arbolRecubridor[v] = u, peso[v] = grafo[u][v];
}
// Imprecion del resultado del arbol recubridor.
printMST(arbolRecubridor, grafo);
}
int main() {
Grafo grafo;
grafo.agregarVertice('A');
grafo.agregarVertice('B');
grafo.agregarVertice('C');
grafo.agregarVertice('D');
grafo.agregarVertice('E');
grafo.agregarVertice('F');
grafo.agregarVertice('G');
grafo.imprimir();
grafo.agregarArista('A', 'B', 7);
grafo.agregarArista('A', 'D', 5);
grafo.agregarArista('B', 'C', 8);
grafo.agregarArista('C', 'E', 5);
grafo.agregarArista('E', 'G', 9);
grafo.agregarArista('G', 'F', 11);
grafo.agregarArista('F', 'D', 6);
grafo.agregarArista('D', 'E', 15);
grafo.agregarArista('D', 'B', 9);
grafo.agregarArista('B', 'A', 7);
grafo.agregarArista('D', 'A', 5);
grafo.agregarArista('C', 'B', 8);
grafo.agregarArista('E', 'C', 5);
grafo.agregarArista('G', 'E', 9);
grafo.agregarArista('F', 'G', 11);
grafo.agregarArista('D', 'F', 6);
grafo.agregarArista('E', 'D', 15);
grafo.agregarArista('B', 'D', 9);
grafo.imprimir();
grafo.imprimirArbol(grafo.prim());
int graph[V][V] = { { 0, 2, 0, 6, 0 },
{ 2, 0, 3, 8, 5 },
{ 0, 3, 0, 0, 7 },
{ 6, 8, 0, 0, 9 },
{ 0, 5, 7, 9, 0 } };
primMST(graph);
_getch();
} | [
"72817522+BernardoMartinez08@users.noreply.github.com"
] | 72817522+BernardoMartinez08@users.noreply.github.com |
a171043131c941dd4cc67c9393a98005c5b319b5 | f9cdb9b788a4d032f4d0d5ff847209bd71c637e1 | /utils/Collection/ConcreteCollection/BasicList.h | 9f6e2b00ac209d9cf0b01dffe1a3cf677b54dd46 | [] | no_license | charIoT-h2020/chariot-formal-contract-checker | 600622e5a901c2b6aad436770ea561325e0093ab | a2ab3b46289827137b0a355136993d76ae96b994 | refs/heads/master | 2022-12-24T14:50:52.172766 | 2020-09-11T16:12:36 | 2020-09-11T16:12:36 | 297,463,993 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,945 | h | /**************************************************************************/
/* */
/* Copyright (C) 2014-2019 */
/* CEA (Commissariat a l'Energie Atomique et aux Energies */
/* Alternatives) */
/* */
/* you can redistribute it and/or modify it under the terms of the GNU */
/* Lesser General Public License as published by the Free Software */
/* Foundation, version 2.1. */
/* */
/* It is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU Lesser General Public License for more details. */
/* */
/* See the GNU Lesser General Public License version 2.1 */
/* for more details (enclosed in the file LICENSE). */
/* */
/**************************************************************************/
/////////////////////////////////
//
// Library : Collection
// Unit : Concrete collections
// File : BasicList.h
// Description :
// Definition of a list of elements inheriting from VirtualCollection.
// No inheritance relationship is assumed on the elements.
//
#ifndef COL_BasicListH
#define COL_BasicListH
#include "Collection/ConcreteCollection/List.h"
namespace COL {
/*************************************/
/* Definition of the class BasicList */
/*************************************/
class BasicListCursor;
class BasicList : public GenericList {
public:
typedef EnhancedObject Node;
typedef VirtualCollection::InitialValues InitialValues;
typedef VirtualCollection::InitialNewValues InitialNewValues;
protected:
friend class BasicListCursor;
class BasicListElement : public ImplListElement {
private:
EnhancedObject* peoElement;
protected:
virtual ComparisonResult _compare(const EnhancedObject& asource) const override
{ ComparisonResult result = ImplListElement::_compare(asource);
AssumeCondition(peoElement && ((const BasicListElement&) asource).peoElement)
if (result == CREqual)
result = peoElement->compare(*((const BasicListElement&) asource).peoElement);
return result;
}
public:
BasicListElement(EnhancedObject& element) : peoElement(&element) {}
BasicListElement(const BasicListElement& source, bool doesDuplicate=false)
: ImplListElement(source), peoElement(source.peoElement)
{ if (doesDuplicate && peoElement)
peoElement = peoElement->createCopy();
}
BasicListElement& operator=(const BasicListElement& source) = default;
DefineCopy(BasicListElement)
DDefineAssign(BasicListElement)
const PEnhancedObject& element() const { return peoElement; }
const EnhancedObject& getElement() const { AssumeCondition(peoElement) return *peoElement; }
void freeElement()
{ AssumeCondition(peoElement)
delete peoElement; peoElement = nullptr;
}
void releaseElement() { peoElement = nullptr; }
void copyElement(const VirtualCast* retrieveRegistrationFromCopy=nullptr)
{ AssumeCondition(peoElement)
peoElement = retrieveRegistrationFromCopy
? ((const VirtualCastWithElement*) retrieveRegistrationFromCopy)
->castFrom(peoElement->createCopy(), peoElement)
: peoElement->createCopy();
}
void setElement(EnhancedObject& element)
{ AssumeCondition(peoElement == nullptr) peoElement = &element; }
};
const PEnhancedObject& castToElement(EnhancedObject& basicElement) const
{ return ((BasicListElement&) basicElement).element(); }
protected:
void _fullAssign(const BasicList& source, const ExtendedReplaceParameters& parameters);
virtual void _fullAssign(const VirtualCollection& source, const ExtendedReplaceParameters& parameters) override
{ GenericList::_fullAssign(source, parameters); }
// insertion methods
virtual void _add(EnhancedObject* anObject, const ExtendedInsertionParameters& parameters,
VirtualCollectionCursor* cursor) override
{ _add(anObject, parameters, (BasicListCursor*) cursor); }
void _add(EnhancedObject* anObject, const ExtendedInsertionParameters& parameters,
BasicListCursor* cursor=nullptr);
virtual void _addAll(const VirtualCollection& source, const ExtendedInsertionParameters& parameters,
VirtualCollectionCursor* cursor=nullptr, const VirtualCollectionCursor* startSource=nullptr,
const VirtualCollectionCursor* endSource=nullptr) override
{ GenericList::_addAll(source, parameters, cursor, startSource, endSource); }
void _addAll(const BasicList& source, const ExtendedInsertionParameters& parameters,
BasicListCursor* cursor=nullptr, const BasicListCursor* startSource=nullptr,
const BasicListCursor* endSource=nullptr);
// move methods => the same as the GenericList ones
// suppression methods
virtual void _remove(const ExtendedSuppressParameters& parameters, VirtualCollectionCursor* cursor) override
{ _remove(parameters, (BasicListCursor*) cursor); }
void _remove(const ExtendedSuppressParameters& parameters, BasicListCursor* cursor=nullptr);
virtual void _removeAll(const ExtendedSuppressParameters& parameters,
const VirtualCollectionCursor* start, const VirtualCollectionCursor* end=nullptr) override
{ _removeAll(parameters, (const BasicListCursor*) start, (const BasicListCursor*) end); }
void _removeAll(const ExtendedSuppressParameters& parameters,
const BasicListCursor* start=nullptr, const BasicListCursor* end=nullptr);
// replace methods
virtual void _replace(EnhancedObject* anObject, const ExtendedReplaceParameters& parameters,
VirtualCollectionCursor* cursor) override
{ _replace(anObject, parameters, (BasicListCursor*) cursor); }
void _replace(EnhancedObject* newObject, const ExtendedReplaceParameters& parameters,
BasicListCursor* cursor=nullptr);
// query methods
virtual EnhancedObject* _getElement(const ExtendedLocateParameters& parameters,
const VirtualCollectionCursor* cursor) const override
{ return castToElement(*GenericList::_getElement(parameters, cursor)); }
EnhancedObject* _getElement(const ExtendedLocateParameters& parameters,
const BasicListCursor* cursor=nullptr) const
{ return castToElement(*GenericList::_getElement(parameters,
const_cast<GenericListCursor*>((const GenericListCursor*) cursor)));
}
virtual void _gotoReference(const EnhancedObject& element) { AssumeUncalled }
public:
BasicList() {}
BasicList(const InitialValues& initialValues)
{ TInsertInitialValue<BasicList, EnhancedObject, SimpleCast> insertInitialValue(*this);
initialValues.foreachDo(insertInitialValue);
}
BasicList(const InitialNewValues& initialValues)
{ TInsertInitialNewValue<BasicList, EnhancedObject, SimpleCast> insertInitialValue(*this);
initialValues.foreachDo(insertInitialValue);
}
BasicList(const BasicList& source, AddMode dupMode=AMNoDuplicate,
const VirtualCast* retrieveRegistrationFromCopy=nullptr);
BasicList(BasicList&& source) { swap(source); }
DefineCopy(BasicList)
BasicList& operator=(const BasicList& source)
{ GenericList::operator=(source);
GenericList::_fullAssign(source, ExtendedReplaceParameters().setDuplicate());
return *this;
}
BasicList& operator=(BasicList&& source)
{ swap(source); return *this; }
DefineCollectionForAbstractCollect(BasicList, BasicListCursor)
#define DefJustDeclare
#define DefTypeCollection BasicList
#define DefTypeCursor BasicListCursor
#define DefTypeFinal BasicList::
#include "Collection/ELMCollection.inch"
#undef DefTypeCollection
#undef DefTypeCursor
#undef DefTypeFinal
#undef DefJustDeclare
template <class Execute, class TemplateParameters>
class ShiftExecute {
private:
Execute& eFunction;
public:
typedef typename TemplateParameters::Element Element;
typedef typename TemplateParameters::Cast Cast;
ShiftExecute(Execute& function) : eFunction(function) {}
bool operator()(const BasicListElement& node) const
{ return eFunction((Element&) Cast::castFrom(node.getElement())); }
};
template <class Execute, class TemplateParameters> bool foreachDo(TemplateParameters traits, Execute& function) const
{ ShiftExecute<Execute, TemplateParameters> execute(function);
return GenericList::foreachDo(TemplateElementCastParameters<BasicListElement, SimpleCast>(), execute);
}
template <class Execute, class TemplateParameters> bool foreachDo(TemplateParameters traits,
Execute& function, const ExtendedLocateParameters& parameters,
const Cursor* start, const Cursor* end) const
{ ShiftExecute<Execute, TemplateParameters> execute(function);
return GenericList::foreachDo(TemplateElementCastParameters<BasicListElement, SimpleCast>(),
execute, parameters, start, end);
}
template <class Execute, class TemplateParameters> bool foreachReverseDo(TemplateParameters traits, Execute& function) const
{ ShiftExecute<Execute, TemplateParameters> execute(function);
return GenericList::foreachReverseDo(TemplateElementCastParameters<BasicListElement, SimpleCast>(), execute);
}
template <class Execute, class TemplateParameters> bool foreachReverseDo(TemplateParameters traits,
Execute& function, const ExtendedLocateParameters& parameters,
const Cursor* start, const Cursor* end) const
{ ShiftExecute<Execute, TemplateParameters> execute(function);
return GenericList::foreachReverseDo(TemplateElementCastParameters<BasicListElement, SimpleCast>(),
execute, parameters, start, end);
}
};
/*******************************************/
/* Definition of the class BasicListCursor */
/*******************************************/
class BasicListCursor : public GenericListCursor {
protected:
BasicList::BasicListElement* element() const
{ return (BasicList::BasicListElement*) GenericListCursor::element(); }
void setElement(BasicList::BasicListElement* element)
{ GenericListCursor::setElement(element); }
virtual EnhancedObject* _getSElement() const override { return element()->element(); }
public:
BasicListCursor(const BasicList& support) : GenericListCursor(support) {}
BasicListCursor(const BasicListCursor& source) : GenericListCursor(source) {}
DefineCopy(BasicListCursor)
DefineCursorForAbstractCollect(BasicList, BasicListCursor)
};
InlineCollectionForAbstractCollect(BasicList, BasicListCursor)
#define DefJustInline
#define DefTypeCollection BasicList
#define DefTypeCursor BasicListCursor
#define DefTypeFinal BasicList::
#include "Collection/ELMCollection.inch"
#undef DefTypeCollection
#undef DefTypeCursor
#undef DefTypeFinal
#undef DefJustInline
/***********************************************/
/* Definition of the template class TBasicList */
/***********************************************/
template<class TypeElement, class Cast=HandlerCopyCast<TypeElement> >
class TBasicListCursor;
template<class Element, class Cast=HandlerCopyCast<Element> >
class TBasicList : public BasicList {
public:
typedef Element Node;
typedef TInitialValues<Element, Cast> InitialValues;
typedef TInitialNewValues<Element, Cast> InitialNewValues;
TBasicList() {}
TBasicList(const InitialValues& initialValues)
{ VirtualCollection::TInsertInitialValue<TBasicList<Element, Cast>, Element, Cast>
insertInitialValue(*this);
initialValues.foreachDo(insertInitialValue);
}
TBasicList(const InitialNewValues& initialValues)
{ VirtualCollection::TInsertInitialNewValue<TBasicList<Element, Cast>, Element, Cast>
insertInitialValue(*this);
initialValues.foreachDo(insertInitialValue);
}
TBasicList(const TBasicList<Element, Cast>& source, AddMode dupMode=AMNoDuplicate)
: BasicList(source, dupMode) {}
TBasicList(TBasicList<Element, Cast>&& source)
: BasicList(std::move(source)) {}
Template2DefineCopy(TBasicList, Element, Cast)
Template2DefineCollectionForAbstractCollect(TBasicList, TBasicListCursor, Element, Cast)
#define DefTypeElement Element
#define DefTypeCollection TBasicList<Element, Cast>
#define DefTypeCastToCollectHandler (EnhancedObject*) Cast::castTo
#define DefTypeCCastToCollectHandler (const EnhancedObject*) Cast::castTo
#define DefTypeCastFromCollectHandler (Element*) Cast::castFrom
#define DefTypeCCastFromCollectHandler (const Element*) Cast::castFrom
#define DefTypeInheritedCollection BasicList
#define DefTypeCursor TBasicListCursor<Element, Cast>
#include "Collection/ELMCollection.inch"
#undef DefTypeElement
#undef DefTypeCollection
#undef DefTypeCastToCollectHandler
#undef DefTypeCCastToCollectHandler
#undef DefTypeCastFromCollectHandler
#undef DefTypeCCastFromCollectHandler
#undef DefTypeInheritedCollection
#undef DefTypeCursor
TVirtualCollection<Element, Cast>& getInterface()
{ return (TVirtualCollection<Element, Cast>&) (VirtualCollection&) *this; }
const TVirtualCollection<Element, Cast>& getInterface() const
{ return (const TVirtualCollection<Element, Cast>&) (const VirtualCollection&) *this; }
bool foreachDo(std::function<bool (Element&)> function) const
{ return BasicList::foreachDo(TemplateElementCastParameters<Element, Cast>(), function); }
bool foreachSDo(std::function<bool (const Element&)> function) const
{ return BasicList::foreachDo(TemplateElementCastParameters<Element, Cast>(), function); }
template <class Execute> bool foreachDo(Execute& function) const
{ return BasicList::foreachDo(TemplateElementCastParameters<Element, Cast>(), function); }
template <class Execute> bool foreachDo(Execute& function, const ExtendedLocateParameters& parameters,
const Cursor* start, const Cursor* end) const
{ return BasicList::foreachDo(TemplateElementCastParameters<Element, Cast>(), function,
parameters, start, end);
}
bool foreachReverseDo(std::function<bool (Element&)> function) const
{ return BasicList::foreachReverseDo(TemplateElementCastParameters<Element, Cast>(), function); }
bool foreachSReverseDo(std::function<bool (const Element&)> function) const
{ return BasicList::foreachReverseDo(TemplateElementCastParameters<Element, Cast>(), function); }
template <class Execute> bool foreachReverseDo(Execute& function) const
{ return BasicList::foreachReverseDo(TemplateElementCastParameters<Element, Cast>(), function); }
template <class Execute> bool foreachReverseDo(Execute& function, const ExtendedLocateParameters& parameters,
const Cursor* start, const Cursor* end) const
{ return BasicList::foreachReverseDo(TemplateElementCastParameters<Element, Cast>(), function,
parameters, start, end);
}
DeclareCollectionIteratorForConcreteCollect
};
/*****************************************************/
/* Definition of the template class TBasicListCursor */
/*****************************************************/
template<class TypeElement, class Cast>
class TBasicListCursor : public BasicListCursor {
public:
TBasicListCursor(const TBasicList<TypeElement, Cast>& support) : BasicListCursor(support) {}
TBasicListCursor(const TBasicListCursor<TypeElement, Cast>& source) : BasicListCursor(source) {}
Template2DefineCopy(TBasicListCursor, TypeElement, Cast)
Template2DefineCursorForAbstractCollect(TBasicList, TBasicListCursor, TypeElement, Cast)
TypeElement* getSElement() const { return (TypeElement*) Cast::castFrom(BasicListCursor::_getSElement()); }
const TypeElement* getElement() const { return getSElement(); }
const TypeElement& elementAt() const { return *getSElement(); }
TypeElement& elementSAt() const { return *getSElement(); }
};
Template2InlineCollectionForAbstractCollect(TBasicList, TBasicListCursor, TypeElement, Cast)
TemplateInlineCollectionIteratorForConcreteCollect(TBasicList, TypeElement, Cast)
} // end of namespace
#endif // COL_BasicListH
| [
"franck.vedrine@cea.fr"
] | franck.vedrine@cea.fr |
a53358ea61d75296fea6b7462438ecc9d272d42e | ee6bf282e19813553cd8a28e8f09feb7a3195fc3 | /code_cc/new_judge/judge_client/util.h | 64df3b60b4fac35eff5cad254e47452dd629aae3 | [] | no_license | cgy1992/web_hqoj | 49ba6b834381f8faf5491d89bdd99105e802e039 | a283b3edf11d349faf2da89335601cf3bab1927a | refs/heads/master | 2021-01-22T20:17:54.663364 | 2015-10-17T04:35:31 | 2015-10-17T04:35:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 360 | h | #ifndef __UTIL_H__
#define __UTIL_H__
#include <string>
#include <mysql/mysql.h>
using namespace std;
string getLocalTimeAsString(const char *format);
void trim(char *c);
string getFileWithEscape(MYSQL *conn, const char *filename);
int executeCMD(const char *fmt, ...);
long getFilesize(const char *filename);
string getFileExt(const char *filename);
#endif | [
"aozhongxu@anxin365.com"
] | aozhongxu@anxin365.com |
14c460d66883b986562c2fa75f874789d19e8d8e | a3f913b68d3217867ee4eee0e7cf528d03b04605 | /Classes/LogrosScene.cpp | 1731b25da22bad895c228134c0b69f1a10155983 | [] | no_license | ElisabetLargo/RepositorioTCWP | 1a8b16f07c557529d539a01305d37d7fabada6c8 | 9f7cbd4171edae0683add20079794067eec87ce2 | refs/heads/master | 2021-01-10T17:13:42.677387 | 2015-11-23T17:58:40 | 2015-11-23T17:58:40 | 44,635,669 | 0 | 1 | null | 2015-11-19T22:07:14 | 2015-10-20T21:21:42 | C++ | UTF-8 | C++ | false | false | 1,174 | cpp |
#include "LogrosScene.h"
USING_NS_CC;
Scene* LogrosScene::createScene()
{
// 'scene' is an autorelease object
auto scene = Scene::create();
// 'layer' is an autorelease object
auto layer = LogrosScene::create();
// add layer as a child to scene
scene->addChild(layer);
// return the scene
return scene;
}
// on "init" you need to initialize your instance
bool LogrosScene::init()
{
//////////////////////////////
// 1. super init first
if (!Layer::init())
{
return false;
}
Size visibleSize = Director::getInstance()->getVisibleSize();
//menu
auto backBtn = MenuItemImage::create("images/LogrosScene/back_btn.png", "images/LogrosScene/back_btn.png",
CC_CALLBACK_1(LogrosScene::returnToScene, this));
auto menu = Menu::create(backBtn, NULL);
menu->setPosition(Point(visibleSize.width - 20, visibleSize.height - 20));
addChild(menu, 2);
//Fondo
auto background = Sprite::create("images/LogrosScene/fondo_LogrosScene.png");
background->setPosition(Point(visibleSize.width / 2, visibleSize.height / 2));
addChild(background, 0);
return true;
}
void LogrosScene::returnToScene(Ref *pSender){
Director::getInstance()->popScene();
} | [
"elilargo1994@hotmail.com"
] | elilargo1994@hotmail.com |
f81f215a5dc096880d748c8e09afa7bd149db5c3 | e972c781e52ab268ecafd155a5ce063fc6fddf20 | /1033.cc | 3035b984e02e5b5f8d4e8f66f4713c3f225039e7 | [] | no_license | zakilo/pat2 | d4e98f99446119d565b918a0ed96403bae10fa3e | 68f3f8c17afca4e048be8714999e608ee2b5dd2b | refs/heads/master | 2021-01-20T04:29:57.986314 | 2015-04-03T15:59:05 | 2015-04-03T15:59:05 | 31,764,614 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,757 | cc | #include <iostream>
#include <cstdio>
#include <fstream>
#include <vector>
#include <algorithm>
#include <limits>
using namespace std;
struct Station {
double price, pos;
Station() = default;
Station(double pc, double ps) : price(pc), pos(ps) {}
};
bool cmp_pos(const Station &s1, const Station &s2)
{
return s1.pos < s2.pos;
}
int main(void)
{
#ifdef DEBUG
freopen("1033.txt", "r", stdin);
#endif
double mc, dis, avg;
int n;
scanf("%lf%lf%lf%d", &mc, &dis, &avg, &n);
vector<Station> vs;
double tc, tp;
while(n--) {
scanf("%lf%lf", &tc, &tp);
vs.emplace_back(tc, tp);
}
sort(vs.begin(), vs.end(), cmp_pos);
//
double pos = 0, end = 0; // temp position and max poistion can reach
double tpc = numeric_limits<double>::max(); // price
double sum=0, minp = numeric_limits<double>::max();
vector<Station>::iterator cit;
for(auto it=vs.begin(); it!=vs.end(); ++it) {
// find
minp = numeric_limits<double>::max();
cit = vs.end();
for(;it!=vs.end() && it->pos <= end; ++it) {
if(it->price < tpc) { // find the first one whose price is cheaper than previous station
cit = it; break;
}
else if(it->price <= minp) { // find the lowest price
cit = it; minp = it->price;
}
}
if(cit == vs.end())
break;
// cal
if(cit->price >= tpc) {
sum += (end-pos)/avg * tpc;
pos = end;
}
else{
sum += (cit->pos - pos)/avg * tpc;
pos = cit->pos;
}
if(pos >= dis) { // arrived
sum -= tpc * (pos - dis)/avg; break;
}
tpc = cit->price;
end = cit->pos + mc * avg;
it = cit; // important
}
if(pos < dis && end >= dis) {
sum += (dis-pos)/avg * tpc;
pos = dis;
}
//
if(end >= dis)
printf("%.2lf\n", sum);
else
printf("The maximum travel distance = %.2lf\n", end);
return 0;
}
| [
"h@h.com"
] | h@h.com |
3bc9a33ddfdd16b09e5da6ed70e917a494ebf24a | 01370e1d6d628834d00d74d6c27556ff39320410 | /VirtualBox-5.0.12-Thinputer/src/VBox/Runtime/common/path/RTPathParsedReassemble.cpp | 7d4bebbaa345f48408ff8823020081a43ddd5a6b | [] | no_license | stonezk/Thinputer3D_ReadBack | 13ca19c0cfc05af88082321dfc524240961dca7f | 09418b420e82bb7eb6ce76e066145fcf240aaec9 | refs/heads/master | 2021-07-14T05:31:01.057984 | 2017-10-13T01:26:15 | 2017-10-13T01:26:15 | 104,833,018 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,115 | cpp | /* $Id: RTPathParsedReassemble.cpp $ */
/** @file
* IPRT - RTPathParsedReassemble.
*/
/*
* Copyright (C) 2013-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
/*********************************************************************************************************************************
* Header Files *
*********************************************************************************************************************************/
#include "internal/iprt.h"
#include <iprt/path.h>
#include <iprt/assert.h>
#include <iprt/err.h>
#include <iprt/string.h>
RTDECL(int) RTPathParsedReassemble(const char *pszSrcPath, PRTPATHPARSED pParsed, uint32_t fFlags,
char *pszDstPath, size_t cbDstPath)
{
/*
* Input validation.
*/
AssertPtrReturn(pszSrcPath, VERR_INVALID_POINTER);
AssertPtrReturn(pParsed, VERR_INVALID_POINTER);
AssertReturn(pParsed->cComps > 0, VERR_INVALID_PARAMETER);
AssertReturn(RTPATH_STR_F_IS_VALID(fFlags, 0) && !(fFlags & RTPATH_STR_F_MIDDLE), VERR_INVALID_FLAGS);
AssertPtrReturn(pszDstPath, VERR_INVALID_POINTER);
AssertReturn(cbDstPath > pParsed->cchPath, VERR_BUFFER_OVERFLOW);
/*
* Figure which slash to use.
*/
char chSlash;
switch (fFlags & RTPATH_STR_F_STYLE_MASK)
{
case RTPATH_STR_F_STYLE_HOST:
chSlash = RTPATH_SLASH;
break;
case RTPATH_STR_F_STYLE_DOS:
chSlash = '\\';
break;
case RTPATH_STR_F_STYLE_UNIX:
chSlash = '/';
break;
default:
AssertFailedReturn(VERR_INVALID_FLAGS); /* impossible */
}
/*
* Do the joining.
*/
uint32_t const cchOrgPath = pParsed->cchPath;
uint32_t cchDstPath = 0;
uint32_t const cComps = pParsed->cComps;
uint32_t idxComp = 0;
char *pszDst = pszDstPath;
uint32_t cchComp;
if (RTPATH_PROP_HAS_ROOT_SPEC(pParsed->fProps))
{
cchComp = pParsed->aComps[0].cch;
cchDstPath += cchComp;
AssertReturn(cchDstPath <= cchOrgPath, VERR_INVALID_PARAMETER);
memcpy(pszDst, &pszSrcPath[pParsed->aComps[0].off], cchComp);
/* fix the slashes */
char chOtherSlash = chSlash == '\\' ? '/' : '\\';
while (cchComp-- > 0)
{
if (*pszDst == chOtherSlash)
*pszDst = chSlash;
pszDst++;
}
idxComp = 1;
}
while (idxComp < cComps)
{
cchComp = pParsed->aComps[idxComp].cch;
cchDstPath += cchComp;
AssertReturn(cchDstPath <= cchOrgPath, VERR_INVALID_PARAMETER);
memcpy(pszDst, &pszSrcPath[pParsed->aComps[idxComp].off], cchComp);
pszDst += cchComp;
idxComp++;
if (idxComp != cComps || (pParsed->fProps & RTPATH_PROP_DIR_SLASH))
{
cchDstPath++;
AssertReturn(cchDstPath <= cchOrgPath, VERR_INVALID_PARAMETER);
*pszDst++ = chSlash;
}
}
*pszDst = '\0';
return VINF_SUCCESS;
}
| [
"zhengke_stone@foxmail.com"
] | zhengke_stone@foxmail.com |
0d18ea4a7e6a6bec7bfee2f78ddae3b1f95c9f98 | 14aa758222ce6d2e27bb6fa0b52414e830204f9c | /Project/InteriorRoomDesign.cpp | dda05455e7dfb16045f8dde774544de83cb022d4 | [] | no_license | cm2889/Computer-Graphics | de8722562a615990af95b48160855294339a2fed | 6a4b4d98e20861ca888a299461cb74f0341f509c | refs/heads/master | 2021-05-04T05:44:53.011296 | 2018-02-10T09:07:39 | 2018-02-10T09:07:39 | 120,344,922 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 12,915 | cpp |
/****** Md. Hasanuzzaman Dipu ******/
/****** Daffodil International University, CSE Department, 35th Batch ******/
#include<bits/stdc++.h>
#include<math.h>
#include<GL/gl.h>
#include<GL/glu.h>
#include<GL/glut.h>
using namespace std;
int x,y;
void room(void)
{
//Top of the room
x=5,y=50;
glColor3f (0.5, 0.1, 0.5);
glBegin(GL_POLYGON);
glVertex2d (x,y+9);
glVertex2d (x,y+17);
glVertex2d (x+100,y+17);
glVertex2d (x+100,y+14);
glEnd();
//room left wall
x=y=5;
glColor3f (1.0, 0.8, 0.8);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+10,y+15);
glVertex2d (x+10,y+45);
glVertex2d (x,y+60);
glEnd();
x=y=5;
glColor3f (1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x+3,y+25);
glVertex2d (x+7,y+25);
glVertex2d (x+7,y+40);
glVertex2d (x+3,y+45);
glEnd();
x=y=5;
//Window
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y+26);
glVertex2d (x+6,y+26);
glVertex2d (x+6,y+40);
glVertex2d (x+4,y+43);
glEnd();
x=y=5;
//side line
glColor3f (0.5, 0.1, 0.5);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+10,y+15);
glVertex2d (x+10,y+17);
glVertex2d (x,y+4);
glEnd();
//room right wall
x=105;
glColor3f (1.0, 0.8, 0.8);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x-10,y+15);
glVertex2d (x-10,y+45);
glVertex2d (x,y+60);
glEnd();
//side line
x=105;
glColor3f (0.5, 0.1, 0.5);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x-10,y+15);
glVertex2d (x-10,y+17);
glVertex2d (x,y+4);
glEnd();
//room back
//room back wall
x=15;
glColor3f (0.2, 0.3, 0.2);
glBegin(GL_POLYGON);
glVertex2d (x,y+15);
glVertex2d (x,y+45);
glVertex2d (x+80,y+45);
glVertex2d (x+80,y+15);
glEnd();
//buttom line
x=15;
glColor3f (0.5, 0.1, 0.5);
glBegin(GL_POLYGON);
glVertex2d (x,y+9);
glVertex2d (x,y+17);
glVertex2d (x+80,y+17);
glVertex2d (x+80,y+14);
glEnd();
//Bed Back H_D
x=16;
glColor3f (1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x,y+10);
glVertex2d (x,y+18);
glVertex2d (x+14,y+18);
glVertex2d (x+14,y+15);
glEnd();
//room roof
x=15,y=50;
glColor3f (0.2, 0.6, 0.3);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x-10,y+15);
glVertex2d (x+90,y+15);
glVertex2d (x+80,y);
glEnd();
//room floor
x=15,y=20;
glColor3f (0.5,3.0, 0.5);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x-10,y-15);
glVertex2d (x+90,y-15);
glVertex2d (x+80,y);
glEnd();
//2nd floor
x=15,y=20;
glColor3f (0.03,0.5, 0.05);
glBegin(GL_TRIANGLE_STRIP);
glVertex2d (x,y);
glVertex2d (x-10,y-15);
glVertex2d (x+90,y-15);
glVertex2d (x+80,y);
glEnd();
}
void BED(void)
{
// BED leg 1
x=10,y=11;
glColor3f (0.0, 0.2, 0.4);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+15,y);
glVertex2d (x+15,y-3);
glVertex2d (x,y-3);
glEnd();
// BED leg 2
x=24,y=11;
glColor3f (0.0, 0.2, 0.4);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+1,y);
glVertex2d (x+1,y-3);
glVertex2d (x,y-3);
glEnd();
// BED leg 3
x=29,y=19;
glColor3f (0.0, 0.2, 0.4);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+1,y);
glVertex2d (x+1,y-3);
glVertex2d (x,y-3);
glEnd();
// BED BODY
x=10,y=12;
glColor3f (0.3, 0.7, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+6,y+8);
glVertex2d (x+20,y+8);
glVertex2d (x+20,y+7);
glVertex2d (x+15,y-1);
glVertex2d (x,y-1);
glEnd();
//bed shit
x=10,y=13;
glColor3f (0.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+6,y+8);
glVertex2d (x+20,y+8);
glVertex2d (x+20,y+7);
glVertex2d (x+15,y-1);
glVertex2d (x,y-1);
glEnd();
}
/*
void Window(){
//Window
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y+26);
glVertex2d (x+6,y+26);
glVertex2d (x+6,y+40);
glVertex2d (x+4,y+43);
glEnd();
}*/
void almira(void)
{
x=80,y=20;
glColor3f (1.0, 0.9, 0.9);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+8,y-1);
glVertex2d (x+8,y);
glEnd();
// Almira stand
x=78,y=21;
glColor3f (0.3, 0.0, 0.6);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-3);
glVertex2d (x+1,y-3);
glVertex2d (x+1,y-2);
glVertex2d (x+12,y-2);
glVertex2d (x+12,y);
glEnd();
x=89,y=19;
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+1,y-1);
glVertex2d (x+1,y);
glEnd();
// Almira body
x=78,y=42;
glColor3f (0.1, 0.0, 0.1);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-21);
glVertex2d (x+12,y-21);
glVertex2d (x+12,y);
glEnd();
// Almira body line
x=84,y=42;
glColor3f (1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-21);
glVertex2d (x+0.5,y-21);
glVertex2d (x+0.5,y);
glEnd();
x=82,y=32;
glColor3f (0.2, 0.5, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+1,y-1);
glVertex2d (x+1,y);
glEnd();
x=85,y=32;
glColor3f (0.2, 0.5, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+1,y-1);
glVertex2d (x+1,y);
glEnd();
}
void TV()
{
//Tv stand
x=65,y=22;
glColor3f (0.3, 0.6, 0.6);
glBegin(GL_POLYGON);
glVertex2d (x,y+5);
glVertex2d (x,y-3);
glVertex2d (x+1,y-3);
glVertex2d (x+1,y-2);
glVertex2d (x+10,y-2);
glVertex2d (x+10,y+5);
glEnd();
x=74,y=20;
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+1,y-1);
glVertex2d (x+1,y);
glEnd();
// TV body
x=65,y=39;
glColor3f (0.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x,y-8);
glVertex2d (x,y-11.5);
glVertex2d (x+9,y-11.5);
glVertex2d (x+9,y-8);
glEnd();
//white leg
x=66,y=38;
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x,y-10.5);
glVertex2d (x,y-11);
glVertex2d (x+7,y-11);
glVertex2d (x+7,y-10.5);
glEnd();
x=66,y=33;
glColor3f (1.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x,y-8);
glVertex2d (x,y-12);
glVertex2d (x+8,y-12);
glVertex2d (x+8,y-8);
glEnd();
x=66,y=31;
glColor3f (1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+7,y-1);
glVertex2d (x+7,y);
glEnd();
x=80,y=20;
glColor3f (1.0, 0.9, 0.9);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+8,y-1);
glVertex2d (x+8,y);
glEnd();
}
void freezer()
{ //Top of the frz
x=51,y=39;
glColor3f (0.5, 0.5, 0.5);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+8,y-1);
glVertex2d (x+8,y);
glEnd();
//Refrigerator stand
x=50,y=21;
glColor3f (0.3, 0.6, 0.6);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-3);
glVertex2d (x+1,y-3);
glVertex2d (x+1,y-2);
glVertex2d (x+10,y-2);
glVertex2d (x+10,y);
glEnd();
x=59,y=19;
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+1,y-1);
glVertex2d (x+1,y);
glEnd();
//Refrigerator body
x=51,y=38;
glColor3f (0.5, 0.0, 0.1);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-17);
glVertex2d (x+8,y-17);
glVertex2d (x+8,y);
glEnd();
//middle of the frz
x=51,y=31;
glColor3f (0.5, 0.5, 0.5);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+8,y-1);
glVertex2d (x+8,y);
glEnd();
}
void ShowCase()
{ //Top of the S_C
x=33,y=39;
glColor3f (0.1, 0.0, 0.1);
glBegin(GL_POLYGON);
glVertex2d (x,y-8);
glVertex2d (x,y-4);
glVertex2d (x+13,y-4);
glVertex2d (x+13,y-8);
glEnd();
//S_C body
x=33,y=38;
glColor3f (0.3, 0.02, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x,y-4);
glVertex2d (x,y-17);
glVertex2d (x+13,y-17);
glVertex2d (x+13,y-4);
glEnd();
//middel line
x=39,y=35;
glColor3f (0.0, 0.0, 0.1);
glBegin(GL_POLYGON);
glVertex2d (x,y-4);
glVertex2d (x,y-17);
glVertex2d (x+0.5,y-17);
glVertex2d (x+0.5,y-4);
glEnd();
//middle of the S_C
x=33,y=31;
glColor3f (0.1, 0.1, 0.1);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-1);
glVertex2d (x+13,y-1);
glVertex2d (x+13,y);
glEnd();
//Bottom S_C
x=33,y=26;
glColor3f (0.1, 0.0, 0.1);
glBegin(GL_POLYGON);
glVertex2d (x,y-8);
glVertex2d (x,y-4);
glVertex2d (x+13,y-4);
glVertex2d (x+13,y-8);
glEnd();
}
void WallMate()
{
x=16,y=42;
glColor3f (.7, .3, .8);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x,y-12);
glVertex2d (x+15,y-12);
glVertex2d (x+15,y);
glEnd();
x=17,y=42;
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x,y-1);
glVertex2d (x,y-11);
glVertex2d (x+13,y-11);
glVertex2d (x+13,y-1);
glEnd();
x=16,y=33;
glColor3f (1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y+4);
glVertex2d (x+5,y+4);
glVertex2d (x+5,y-2);
glVertex2d (x+4,y-2);
glEnd();
x=18,y=33;
glColor3f (0.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y+6);
glVertex2d (x+5,y+6);
glVertex2d (x+5,y-2);
glVertex2d (x+4,y-2);
glEnd();
x=20,y=33;
glColor3f (1.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y+4);
glVertex2d (x+5,y+4);
glVertex2d (x+5,y-2);
glVertex2d (x+4,y-2);
glEnd();
x=22,y=33;
glColor3f (0.0, 0.8, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y+2);
glVertex2d (x+5,y+2);
glVertex2d (x+5,y-2);
glVertex2d (x+4,y-2);
glEnd();
x=24,y=33;
glColor3f (0.8, 0.8, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y);
glVertex2d (x+5,y);
glVertex2d (x+5,y-2);
glVertex2d (x+4,y-2);
glEnd();
}
void WallMate2()
{
x=50,y=47;
glColor3f (0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+11,y);
glVertex2d (x+11,y-4);
glVertex2d (x,y-4);
glEnd();
x=51,y=46;
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+9,y);
glVertex2d (x+9,y-2);
glVertex2d (x,y-2);
glEnd();
x=51,y=46;
glColor3f (1.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y);
glVertex2d (x+5,y);
glVertex2d (x+5,y-2);
glVertex2d (x+4,y-2);
glEnd();
x=53,y=46;
glColor3f (0.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y);
glVertex2d (x+5,y);
glVertex2d (x+5,y-2);
glVertex2d (x+4,y-2);
glEnd();
x=49,y=46;
glColor3f (0.0, 1.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x+4,y);
glVertex2d (x+5,y);
glVertex2d (x+5,y-2);
glVertex2d (x+4,y-2);
glEnd();
x=63,y=37;
glColor3f (0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+13,y);
glVertex2d (x+13,y-8);
glVertex2d (x,y-8);
glEnd();
x=64,y=36;
glColor3f (1.0, 1.0, 0.6);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+11,y);
glVertex2d (x+11,y-6);
glVertex2d (x,y-6);
glEnd();
}
void door()
{
x=99,y=40;
glColor3f (0.0, 0.0, 1.0);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+4,y+2);
glVertex2d (x+5,y+2);
glVertex2d (x+5,y-30);
glVertex2d (x,y-30);
glEnd();
x=100,y=39;
glColor3f (1, 1, 1);
glBegin(GL_POLYGON);
glVertex2d (x,y);
glVertex2d (x+3,y+2);
glVertex2d (x+3,y-28);
glVertex2d (x,y-28);
glEnd();
}
void display(void)
{
glClear (GL_COLOR_BUFFER_BIT);
room();
BED();
//Window();
almira();
freezer();
TV();
ShowCase();
WallMate();
WallMate2();
door();
glFlush ();
}
void init(void)
{
glClearColor(0, 0, 0, 0);
glMatrixMode(GL_PROJECTION);
// for setting the transformation which here is 2D
gluOrtho2D(0, 110, 0, 70);
}
int main(int agrc, char ** argv)
{
glutInit(&agrc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(100, 50);
glutInitWindowSize(1000, 900);
glutCreateWindow("Shahadat Hossain"); // Change your desire name :)
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
| [
"imam2889@gmail.com"
] | imam2889@gmail.com |
59a55c0d320b9e3b1c5c8e14481fd7b2adfc15b9 | 414de8e84fbd9c27bd9c93ddd9e504605cf8cf5f | /Library/Il2cppBuildCache/Android/armeabi-v7a/il2cppOutput/Il2CppCCFieldValuesTable.cpp | 7c3efd776df7fb430f59beda186351694d329dcd | [] | no_license | danielmqh/Deteccion-de-Piso-AR | af619fd6462197aca3023970176e4e9f7210f03d | c4a8118d1faa1e7a2ec6361a1799964dd639bab6 | refs/heads/master | 2023-07-12T01:23:59.477426 | 2021-08-26T02:07:42 | 2021-08-26T02:07:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 124,285 | cpp | #include "pch-cpp.hpp"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable4[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable5[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable6[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable7[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable8[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable9[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable11[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable13[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable14[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable15[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable16[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable18[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable19[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable20[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable21[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable22[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable25[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable26[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable27[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable28[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable29[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable30[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable31[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable32[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable33[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable34[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable35[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable36[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable37[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable38[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable39[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable40[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable41[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable42[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable43[22];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable46[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable47[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable48[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable49[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable50[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable51[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable53[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable55[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable56[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable65[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable66[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable67[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable68[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable69[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable70[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable74[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable75[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable76[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable77[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable78[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable79[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable80[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable81[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable82[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable83[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable84[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable85[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable99[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable101[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable106[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable107[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable108[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable109[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable110[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable112[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable114[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable115[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable116[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable118[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable119[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable120[145];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable121[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable122[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable123[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable126[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable127[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable128[45];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable129[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable130[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable131[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable132[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable133[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable134[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable138[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable139[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable141[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable142[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable143[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable146[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable147[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable152[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable153[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable155[22];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable156[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable157[40];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable158[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable159[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable160[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable161[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable162[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable163[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable164[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable165[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable166[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable167[33];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable168[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable169[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable170[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable171[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable172[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable184[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable185[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable186[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable191[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable195[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable196[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable202[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable204[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable205[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable206[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable210[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable212[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable214[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable215[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable216[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable217[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable218[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable220[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable222[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable224[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable225[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable226[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable227[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable228[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable232[29];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable233[47];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable235[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable236[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable237[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable238[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable239[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable240[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable241[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable242[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable243[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable245[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable246[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable247[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable248[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable249[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable250[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable251[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable253[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable255[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable256[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable257[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable258[23];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable260[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable261[48];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable262[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable263[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable265[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable267[23];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable268[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable269[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable272[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable274[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable275[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable276[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable277[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable278[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable279[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable280[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable281[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable282[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable283[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable284[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable285[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable286[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable287[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable288[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable290[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable292[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable293[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable294[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable295[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable296[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable298[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable299[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable301[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable302[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable303[26];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable305[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable306[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable307[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable309[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable310[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable311[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable312[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable313[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable314[44];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable315[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable316[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable317[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable318[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable319[35];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable320[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable321[396];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable322[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable323[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable324[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable325[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable330[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable333[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable334[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable335[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable336[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable337[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable339[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable340[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable342[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable343[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable344[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable345[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable346[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable347[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable348[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable350[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable351[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable353[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable354[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable355[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable358[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable359[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable360[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable361[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable362[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable363[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable364[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable365[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable366[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable369[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable370[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable371[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable372[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable373[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable374[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable375[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable376[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable377[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable378[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable379[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable381[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable382[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable383[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable384[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable385[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable386[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable387[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable388[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable389[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable390[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable392[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable393[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable394[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable395[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable396[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable397[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable398[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable399[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable400[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable401[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable402[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable405[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable406[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable408[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable409[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable410[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable411[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable412[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable413[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable414[22];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable415[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable416[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable417[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable420[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable421[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable422[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable423[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable424[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable425[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable426[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable427[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable428[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable429[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable430[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable431[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable432[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable434[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable435[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable436[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable437[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable438[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable439[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable442[23];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable445[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable446[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable447[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable449[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable450[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable452[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable453[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable454[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable455[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable456[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable457[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable461[33];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable465[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable466[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable467[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable468[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable469[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable471[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable472[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable474[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable475[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable477[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable478[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable479[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable482[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable484[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable487[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable488[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable490[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable492[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable497[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable498[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable503[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable504[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable506[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable515[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable521[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable524[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable525[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable526[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable531[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable532[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable534[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable535[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable537[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable538[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable540[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable541[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable542[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable544[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable545[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable547[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable548[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable549[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable550[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable552[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable553[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable554[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable556[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable557[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable558[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable560[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable561[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable562[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable563[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable565[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable567[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable568[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable569[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable570[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable571[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable574[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable575[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable576[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable577[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable578[27];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable579[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable580[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable581[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable582[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable583[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable585[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable586[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable588[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable589[42];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable590[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable591[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable592[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable593[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable594[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable595[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable596[84];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable597[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable598[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable599[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable600[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable601[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable602[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable603[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable604[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable605[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable606[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable607[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable608[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable609[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable610[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable611[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable612[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable613[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable614[36];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable615[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable616[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable617[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable618[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable619[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable620[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable621[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable622[31];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable623[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable624[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable625[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable626[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable627[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable628[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable629[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable630[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable631[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable632[38];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable633[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable634[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable636[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable637[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable638[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable639[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable640[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable641[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable642[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable643[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable644[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable645[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable647[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable648[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable649[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable650[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable652[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable653[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable654[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable656[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable659[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable662[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable663[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable664[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable665[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable666[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable676[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable677[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable678[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable680[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable681[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable682[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable688[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable689[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable690[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable691[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable692[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable693[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable695[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable698[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable700[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable701[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable706[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable707[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable708[39];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable710[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable711[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable714[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable715[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable716[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable717[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable719[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable720[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable722[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable723[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable724[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable725[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable727[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable728[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable729[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable730[22];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable731[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable733[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable734[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable735[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable736[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable739[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable740[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable742[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable743[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable744[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable745[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable746[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable747[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable748[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable749[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable750[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable751[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable753[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable754[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable756[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable758[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable759[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable760[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable763[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable764[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable767[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable768[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable772[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable776[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable777[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable778[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable779[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable783[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable784[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable792[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable793[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable794[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable795[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable796[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable797[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable798[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable799[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable800[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable801[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable802[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable804[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable805[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable811[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable812[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable813[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable814[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable815[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable816[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable817[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable818[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable819[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable820[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable821[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable822[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable823[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable824[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable827[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable828[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable829[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable830[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable831[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable832[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable833[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable834[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable835[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable836[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable837[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable838[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable839[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable840[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable841[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable842[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable843[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable845[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable846[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable847[47];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable848[24];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable849[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable850[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable851[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable852[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable853[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable854[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable855[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable856[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable857[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable858[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable859[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable860[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable861[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable862[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable863[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable864[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable865[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable866[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable867[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable868[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable869[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable870[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable871[24];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable872[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable873[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable874[41];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable875[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable876[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable877[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable878[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable879[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable880[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable881[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable882[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable883[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable884[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable885[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable886[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable890[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable891[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable892[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable893[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable894[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable895[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable896[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable897[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable900[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable901[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable902[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable903[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable906[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable907[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable908[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable909[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable910[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable911[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable912[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable913[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable915[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable917[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable918[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable919[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable923[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable924[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable925[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable926[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable927[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable928[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable929[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable930[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable932[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable944[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable945[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable946[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable947[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable948[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable950[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable958[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable959[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable960[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable962[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable967[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable968[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable969[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable971[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable973[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable974[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable975[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable976[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable977[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable978[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable979[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable980[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable981[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable982[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable983[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable984[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable985[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable986[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable987[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable988[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable989[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable990[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable992[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable993[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1003[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1004[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1005[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1006[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1007[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1008[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1009[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1010[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1014[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1015[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1017[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1018[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1019[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1022[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1024[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1025[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1026[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1027[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1028[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1029[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1030[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1031[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1032[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1033[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1034[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1039[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1040[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1041[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1042[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1043[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1044[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1045[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1046[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1047[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1048[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1049[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1050[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1053[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1054[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1056[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1057[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1060[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1064[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1066[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1068[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1069[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1070[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1071[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1072[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1073[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1074[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1075[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1076[45];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1077[39];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1079[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1084[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1085[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1086[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1087[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1088[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1089[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1090[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1092[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1096[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1097[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1098[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1099[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1100[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1101[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1117[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1118[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1119[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1121[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1122[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1123[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1124[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1125[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1128[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1129[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1130[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1131[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1133[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1134[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1146[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1147[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1148[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1149[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1151[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1152[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1154[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1155[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1157[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1158[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1159[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1160[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1161[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1162[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1163[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1164[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1168[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1171[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1172[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1173[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1174[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1175[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1176[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1177[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1178[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1183[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1184[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1189[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1210[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1211[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1215[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1216[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1217[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1218[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1219[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1220[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1221[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1222[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1223[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1224[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1226[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1268[101];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1278[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1285[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1290[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1295[56];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1296[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1297[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1298[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1299[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1300[29];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1302[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1303[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1304[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1305[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1306[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1307[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1308[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1309[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1311[26];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1316[30];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1317[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1319[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1320[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1322[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1323[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1324[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1325[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1326[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1327[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1328[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1329[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1330[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1332[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1333[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1334[57];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1335[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1336[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1337[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1338[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1339[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1340[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1341[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1342[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1343[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1344[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1345[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1346[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1347[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1348[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1350[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1351[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1352[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1354[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1357[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1359[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1360[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1361[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1369[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1370[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1371[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1373[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1374[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1375[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1376[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1378[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1379[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1380[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1381[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1383[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1384[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1385[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1386[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1387[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1388[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1393[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1394[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1395[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1396[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1397[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1398[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1399[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1400[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1402[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1403[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1404[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1405[32];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1406[48];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1409[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1433[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1434[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1435[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1436[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1437[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1439[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1440[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1441[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1444[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1448[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1451[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1452[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1453[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1454[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1455[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1457[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1459[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1460[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1463[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1464[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1465[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1466[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1468[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1469[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1474[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1475[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1476[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1479[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1483[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1485[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1486[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1487[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1488[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1489[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1492[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1493[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1494[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1495[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1496[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1497[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1504[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1505[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1506[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1507[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1508[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1510[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1511[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1527[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1529[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1530[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1531[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1532[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1535[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1536[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1537[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1538[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1539[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1540[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1542[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1543[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1545[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1546[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1547[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1549[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1551[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1552[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1553[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1554[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1556[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1557[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1558[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1559[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1561[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1565[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1572[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1573[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1575[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1576[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1577[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1578[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1579[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1580[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1581[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1582[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1583[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1584[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1585[71];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1586[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1587[29];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1588[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1589[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1590[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1591[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1592[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1594[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1596[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1604[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1607[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1609[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1610[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1611[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1612[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1613[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1614[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1615[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1616[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1617[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1618[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1622[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1623[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1624[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1626[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1628[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1629[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1631[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1632[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1633[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1638[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1639[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1643[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1646[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1656[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1657[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1659[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1661[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1663[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1665[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1667[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1668[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1669[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1670[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1673[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1684[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1686[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1687[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1691[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1692[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1694[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1695[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1696[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1697[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1699[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1701[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1702[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1703[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1704[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1705[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1706[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1707[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1708[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1709[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1710[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1711[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1713[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1715[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1717[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1719[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1721[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1722[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1725[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1726[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1727[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1728[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1729[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1730[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1731[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1733[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1866[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1867[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1868[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1869[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1870[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1873[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1874[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1875[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1876[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1877[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1878[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1880[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1881[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1882[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1883[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1884[26];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1886[24];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1887[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1888[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1889[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1890[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1891[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1892[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1894[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1895[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1896[27];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1897[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1898[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1900[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1901[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1902[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1903[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1904[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1905[27];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1906[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1907[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1908[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1910[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1911[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1912[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1916[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1920[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1921[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1922[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1923[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1924[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1925[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1926[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1928[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1929[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1930[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1931[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1932[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1933[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1934[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1935[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1936[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1937[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1938[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1939[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1942[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1943[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1944[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1945[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1946[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1947[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1950[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1951[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1952[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1953[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1954[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1955[138];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1958[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1959[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1960[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1961[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1969[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1970[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1975[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1978[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1982[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1984[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1985[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1986[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1988[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1990[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1991[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1993[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1994[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1999[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2000[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2001[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2002[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2003[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2004[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2005[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2006[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2007[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2008[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2009[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2010[59];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2011[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2012[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2013[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2014[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2015[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2016[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2017[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2018[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2020[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2022[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2023[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2025[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2026[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2027[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2028[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2034[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2037[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2038[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2039[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2043[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2044[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2045[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2046[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2047[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2048[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2049[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2052[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2053[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2054[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2056[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2058[31];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2060[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2063[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2064[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2065[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2066[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2067[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2068[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2069[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2072[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2073[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2074[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2075[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2076[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2077[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2080[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2081[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2082[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2083[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2084[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2085[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2087[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2088[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2089[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2092[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2093[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2094[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2098[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2099[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2102[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2106[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2107[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2108[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2109[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2110[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2111[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2113[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2115[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2117[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2119[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2120[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2121[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2123[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2125[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2127[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2130[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2131[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2132[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2136[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2137[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2138[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2139[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2142[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2143[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2145[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2146[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2147[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2148[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2151[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2152[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2154[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2155[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2157[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2159[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2160[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2161[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2162[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2163[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2164[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2166[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2168[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2170[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2171[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2173[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2174[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2175[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2177[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2182[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2183[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2184[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2185[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2186[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2188[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2190[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2191[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2192[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2193[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2194[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2195[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2196[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2197[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2198[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2199[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2202[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2203[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2204[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2206[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2207[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2208[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2209[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2210[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2212[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2213[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2216[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2217[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2218[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2219[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2220[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2221[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2222[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2223[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2224[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2227[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2229[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2230[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2231[30];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2232[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2233[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2234[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2235[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2237[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2243[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2244[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2245[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2246[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2247[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2249[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2250[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2252[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2256[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2257[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2258[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2259[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2260[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2261[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2262[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2263[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2264[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2267[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2268[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2270[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2271[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2272[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2273[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2275[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2278[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2280[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2281[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2284[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2287[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2288[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2289[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2290[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2291[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2292[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2296[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2297[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2299[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2300[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2301[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2302[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2303[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2305[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2306[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2307[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2308[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2309[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2310[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2313[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2314[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2315[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2316[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2317[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2319[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2320[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2323[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2328[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2329[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2331[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2332[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2333[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2334[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2335[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2336[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2337[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2338[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2339[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2340[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2341[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2342[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2343[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2344[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2345[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2346[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2347[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2349[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2350[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2351[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2352[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2354[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2355[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2356[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2357[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2358[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2359[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2360[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2361[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2362[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2363[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2364[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2365[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2366[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2367[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2368[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2369[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2371[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2372[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2373[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2374[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2375[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2376[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2378[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2379[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2380[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2381[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2382[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2383[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2384[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2385[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2386[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2387[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2389[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2390[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2391[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2392[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2393[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2394[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2395[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2396[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2397[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2398[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2403[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2406[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2408[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2412[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2413[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2417[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2418[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2419[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2420[4];
IL2CPP_EXTERN_C_CONST int32_t* g_FieldOffsetTable[2424] =
{
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable4,
g_FieldOffsetTable5,
g_FieldOffsetTable6,
g_FieldOffsetTable7,
g_FieldOffsetTable8,
g_FieldOffsetTable9,
NULL,
g_FieldOffsetTable11,
NULL,
g_FieldOffsetTable13,
g_FieldOffsetTable14,
g_FieldOffsetTable15,
g_FieldOffsetTable16,
NULL,
g_FieldOffsetTable18,
g_FieldOffsetTable19,
g_FieldOffsetTable20,
g_FieldOffsetTable21,
g_FieldOffsetTable22,
NULL,
NULL,
g_FieldOffsetTable25,
g_FieldOffsetTable26,
g_FieldOffsetTable27,
g_FieldOffsetTable28,
g_FieldOffsetTable29,
g_FieldOffsetTable30,
g_FieldOffsetTable31,
g_FieldOffsetTable32,
g_FieldOffsetTable33,
g_FieldOffsetTable34,
g_FieldOffsetTable35,
g_FieldOffsetTable36,
g_FieldOffsetTable37,
g_FieldOffsetTable38,
g_FieldOffsetTable39,
g_FieldOffsetTable40,
g_FieldOffsetTable41,
g_FieldOffsetTable42,
g_FieldOffsetTable43,
NULL,
NULL,
g_FieldOffsetTable46,
g_FieldOffsetTable47,
g_FieldOffsetTable48,
g_FieldOffsetTable49,
g_FieldOffsetTable50,
g_FieldOffsetTable51,
NULL,
g_FieldOffsetTable53,
NULL,
g_FieldOffsetTable55,
g_FieldOffsetTable56,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable65,
g_FieldOffsetTable66,
g_FieldOffsetTable67,
g_FieldOffsetTable68,
g_FieldOffsetTable69,
g_FieldOffsetTable70,
NULL,
NULL,
NULL,
g_FieldOffsetTable74,
g_FieldOffsetTable75,
g_FieldOffsetTable76,
g_FieldOffsetTable77,
g_FieldOffsetTable78,
g_FieldOffsetTable79,
g_FieldOffsetTable80,
g_FieldOffsetTable81,
g_FieldOffsetTable82,
g_FieldOffsetTable83,
g_FieldOffsetTable84,
g_FieldOffsetTable85,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable99,
NULL,
g_FieldOffsetTable101,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable106,
g_FieldOffsetTable107,
g_FieldOffsetTable108,
g_FieldOffsetTable109,
g_FieldOffsetTable110,
NULL,
g_FieldOffsetTable112,
NULL,
g_FieldOffsetTable114,
g_FieldOffsetTable115,
g_FieldOffsetTable116,
NULL,
g_FieldOffsetTable118,
g_FieldOffsetTable119,
g_FieldOffsetTable120,
g_FieldOffsetTable121,
g_FieldOffsetTable122,
g_FieldOffsetTable123,
NULL,
NULL,
g_FieldOffsetTable126,
g_FieldOffsetTable127,
g_FieldOffsetTable128,
g_FieldOffsetTable129,
g_FieldOffsetTable130,
g_FieldOffsetTable131,
g_FieldOffsetTable132,
g_FieldOffsetTable133,
g_FieldOffsetTable134,
NULL,
NULL,
NULL,
g_FieldOffsetTable138,
g_FieldOffsetTable139,
NULL,
g_FieldOffsetTable141,
g_FieldOffsetTable142,
g_FieldOffsetTable143,
NULL,
NULL,
g_FieldOffsetTable146,
g_FieldOffsetTable147,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable152,
g_FieldOffsetTable153,
NULL,
g_FieldOffsetTable155,
g_FieldOffsetTable156,
g_FieldOffsetTable157,
g_FieldOffsetTable158,
g_FieldOffsetTable159,
g_FieldOffsetTable160,
g_FieldOffsetTable161,
g_FieldOffsetTable162,
g_FieldOffsetTable163,
g_FieldOffsetTable164,
g_FieldOffsetTable165,
g_FieldOffsetTable166,
g_FieldOffsetTable167,
g_FieldOffsetTable168,
g_FieldOffsetTable169,
g_FieldOffsetTable170,
g_FieldOffsetTable171,
g_FieldOffsetTable172,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable184,
g_FieldOffsetTable185,
g_FieldOffsetTable186,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable191,
NULL,
NULL,
NULL,
g_FieldOffsetTable195,
g_FieldOffsetTable196,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable202,
NULL,
g_FieldOffsetTable204,
g_FieldOffsetTable205,
g_FieldOffsetTable206,
NULL,
NULL,
NULL,
g_FieldOffsetTable210,
NULL,
g_FieldOffsetTable212,
NULL,
g_FieldOffsetTable214,
g_FieldOffsetTable215,
g_FieldOffsetTable216,
g_FieldOffsetTable217,
g_FieldOffsetTable218,
NULL,
g_FieldOffsetTable220,
NULL,
g_FieldOffsetTable222,
NULL,
g_FieldOffsetTable224,
g_FieldOffsetTable225,
g_FieldOffsetTable226,
g_FieldOffsetTable227,
g_FieldOffsetTable228,
NULL,
NULL,
NULL,
g_FieldOffsetTable232,
g_FieldOffsetTable233,
NULL,
g_FieldOffsetTable235,
g_FieldOffsetTable236,
g_FieldOffsetTable237,
g_FieldOffsetTable238,
g_FieldOffsetTable239,
g_FieldOffsetTable240,
g_FieldOffsetTable241,
g_FieldOffsetTable242,
g_FieldOffsetTable243,
NULL,
g_FieldOffsetTable245,
g_FieldOffsetTable246,
g_FieldOffsetTable247,
g_FieldOffsetTable248,
g_FieldOffsetTable249,
g_FieldOffsetTable250,
g_FieldOffsetTable251,
NULL,
g_FieldOffsetTable253,
NULL,
g_FieldOffsetTable255,
g_FieldOffsetTable256,
g_FieldOffsetTable257,
g_FieldOffsetTable258,
NULL,
g_FieldOffsetTable260,
g_FieldOffsetTable261,
g_FieldOffsetTable262,
g_FieldOffsetTable263,
NULL,
g_FieldOffsetTable265,
NULL,
g_FieldOffsetTable267,
g_FieldOffsetTable268,
g_FieldOffsetTable269,
NULL,
NULL,
g_FieldOffsetTable272,
NULL,
g_FieldOffsetTable274,
g_FieldOffsetTable275,
g_FieldOffsetTable276,
g_FieldOffsetTable277,
g_FieldOffsetTable278,
g_FieldOffsetTable279,
g_FieldOffsetTable280,
g_FieldOffsetTable281,
g_FieldOffsetTable282,
g_FieldOffsetTable283,
g_FieldOffsetTable284,
g_FieldOffsetTable285,
g_FieldOffsetTable286,
g_FieldOffsetTable287,
g_FieldOffsetTable288,
NULL,
g_FieldOffsetTable290,
NULL,
g_FieldOffsetTable292,
g_FieldOffsetTable293,
g_FieldOffsetTable294,
g_FieldOffsetTable295,
g_FieldOffsetTable296,
NULL,
g_FieldOffsetTable298,
g_FieldOffsetTable299,
NULL,
g_FieldOffsetTable301,
g_FieldOffsetTable302,
g_FieldOffsetTable303,
NULL,
g_FieldOffsetTable305,
g_FieldOffsetTable306,
g_FieldOffsetTable307,
NULL,
g_FieldOffsetTable309,
g_FieldOffsetTable310,
g_FieldOffsetTable311,
g_FieldOffsetTable312,
g_FieldOffsetTable313,
g_FieldOffsetTable314,
g_FieldOffsetTable315,
g_FieldOffsetTable316,
g_FieldOffsetTable317,
g_FieldOffsetTable318,
g_FieldOffsetTable319,
g_FieldOffsetTable320,
g_FieldOffsetTable321,
g_FieldOffsetTable322,
g_FieldOffsetTable323,
g_FieldOffsetTable324,
g_FieldOffsetTable325,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable330,
NULL,
NULL,
g_FieldOffsetTable333,
g_FieldOffsetTable334,
g_FieldOffsetTable335,
g_FieldOffsetTable336,
g_FieldOffsetTable337,
NULL,
g_FieldOffsetTable339,
g_FieldOffsetTable340,
NULL,
g_FieldOffsetTable342,
g_FieldOffsetTable343,
g_FieldOffsetTable344,
g_FieldOffsetTable345,
g_FieldOffsetTable346,
g_FieldOffsetTable347,
g_FieldOffsetTable348,
NULL,
g_FieldOffsetTable350,
g_FieldOffsetTable351,
NULL,
g_FieldOffsetTable353,
g_FieldOffsetTable354,
g_FieldOffsetTable355,
NULL,
NULL,
g_FieldOffsetTable358,
g_FieldOffsetTable359,
g_FieldOffsetTable360,
g_FieldOffsetTable361,
g_FieldOffsetTable362,
g_FieldOffsetTable363,
g_FieldOffsetTable364,
g_FieldOffsetTable365,
g_FieldOffsetTable366,
NULL,
NULL,
g_FieldOffsetTable369,
g_FieldOffsetTable370,
g_FieldOffsetTable371,
g_FieldOffsetTable372,
g_FieldOffsetTable373,
g_FieldOffsetTable374,
g_FieldOffsetTable375,
g_FieldOffsetTable376,
g_FieldOffsetTable377,
g_FieldOffsetTable378,
g_FieldOffsetTable379,
NULL,
g_FieldOffsetTable381,
g_FieldOffsetTable382,
g_FieldOffsetTable383,
g_FieldOffsetTable384,
g_FieldOffsetTable385,
g_FieldOffsetTable386,
g_FieldOffsetTable387,
g_FieldOffsetTable388,
g_FieldOffsetTable389,
g_FieldOffsetTable390,
NULL,
g_FieldOffsetTable392,
g_FieldOffsetTable393,
g_FieldOffsetTable394,
g_FieldOffsetTable395,
g_FieldOffsetTable396,
g_FieldOffsetTable397,
g_FieldOffsetTable398,
g_FieldOffsetTable399,
g_FieldOffsetTable400,
g_FieldOffsetTable401,
g_FieldOffsetTable402,
NULL,
NULL,
g_FieldOffsetTable405,
g_FieldOffsetTable406,
NULL,
g_FieldOffsetTable408,
g_FieldOffsetTable409,
g_FieldOffsetTable410,
g_FieldOffsetTable411,
g_FieldOffsetTable412,
g_FieldOffsetTable413,
g_FieldOffsetTable414,
g_FieldOffsetTable415,
g_FieldOffsetTable416,
g_FieldOffsetTable417,
NULL,
NULL,
g_FieldOffsetTable420,
g_FieldOffsetTable421,
g_FieldOffsetTable422,
g_FieldOffsetTable423,
g_FieldOffsetTable424,
g_FieldOffsetTable425,
g_FieldOffsetTable426,
g_FieldOffsetTable427,
g_FieldOffsetTable428,
g_FieldOffsetTable429,
g_FieldOffsetTable430,
g_FieldOffsetTable431,
g_FieldOffsetTable432,
NULL,
g_FieldOffsetTable434,
g_FieldOffsetTable435,
g_FieldOffsetTable436,
g_FieldOffsetTable437,
g_FieldOffsetTable438,
g_FieldOffsetTable439,
NULL,
NULL,
g_FieldOffsetTable442,
NULL,
NULL,
g_FieldOffsetTable445,
g_FieldOffsetTable446,
g_FieldOffsetTable447,
NULL,
g_FieldOffsetTable449,
g_FieldOffsetTable450,
NULL,
g_FieldOffsetTable452,
g_FieldOffsetTable453,
g_FieldOffsetTable454,
g_FieldOffsetTable455,
g_FieldOffsetTable456,
g_FieldOffsetTable457,
NULL,
NULL,
NULL,
g_FieldOffsetTable461,
NULL,
NULL,
NULL,
g_FieldOffsetTable465,
g_FieldOffsetTable466,
g_FieldOffsetTable467,
g_FieldOffsetTable468,
g_FieldOffsetTable469,
NULL,
g_FieldOffsetTable471,
g_FieldOffsetTable472,
NULL,
g_FieldOffsetTable474,
g_FieldOffsetTable475,
NULL,
g_FieldOffsetTable477,
g_FieldOffsetTable478,
g_FieldOffsetTable479,
NULL,
NULL,
g_FieldOffsetTable482,
NULL,
g_FieldOffsetTable484,
NULL,
NULL,
g_FieldOffsetTable487,
g_FieldOffsetTable488,
NULL,
g_FieldOffsetTable490,
NULL,
g_FieldOffsetTable492,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable497,
g_FieldOffsetTable498,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable503,
g_FieldOffsetTable504,
NULL,
g_FieldOffsetTable506,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable515,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable521,
NULL,
NULL,
g_FieldOffsetTable524,
g_FieldOffsetTable525,
g_FieldOffsetTable526,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable531,
g_FieldOffsetTable532,
NULL,
g_FieldOffsetTable534,
g_FieldOffsetTable535,
NULL,
g_FieldOffsetTable537,
g_FieldOffsetTable538,
NULL,
g_FieldOffsetTable540,
g_FieldOffsetTable541,
g_FieldOffsetTable542,
NULL,
g_FieldOffsetTable544,
g_FieldOffsetTable545,
NULL,
g_FieldOffsetTable547,
g_FieldOffsetTable548,
g_FieldOffsetTable549,
g_FieldOffsetTable550,
NULL,
g_FieldOffsetTable552,
g_FieldOffsetTable553,
g_FieldOffsetTable554,
NULL,
g_FieldOffsetTable556,
g_FieldOffsetTable557,
g_FieldOffsetTable558,
NULL,
g_FieldOffsetTable560,
g_FieldOffsetTable561,
g_FieldOffsetTable562,
g_FieldOffsetTable563,
NULL,
g_FieldOffsetTable565,
NULL,
g_FieldOffsetTable567,
g_FieldOffsetTable568,
g_FieldOffsetTable569,
g_FieldOffsetTable570,
g_FieldOffsetTable571,
NULL,
NULL,
g_FieldOffsetTable574,
g_FieldOffsetTable575,
g_FieldOffsetTable576,
g_FieldOffsetTable577,
g_FieldOffsetTable578,
g_FieldOffsetTable579,
g_FieldOffsetTable580,
g_FieldOffsetTable581,
g_FieldOffsetTable582,
g_FieldOffsetTable583,
NULL,
g_FieldOffsetTable585,
g_FieldOffsetTable586,
NULL,
g_FieldOffsetTable588,
g_FieldOffsetTable589,
g_FieldOffsetTable590,
g_FieldOffsetTable591,
g_FieldOffsetTable592,
g_FieldOffsetTable593,
g_FieldOffsetTable594,
g_FieldOffsetTable595,
g_FieldOffsetTable596,
g_FieldOffsetTable597,
g_FieldOffsetTable598,
g_FieldOffsetTable599,
g_FieldOffsetTable600,
g_FieldOffsetTable601,
g_FieldOffsetTable602,
g_FieldOffsetTable603,
g_FieldOffsetTable604,
g_FieldOffsetTable605,
g_FieldOffsetTable606,
g_FieldOffsetTable607,
g_FieldOffsetTable608,
g_FieldOffsetTable609,
g_FieldOffsetTable610,
g_FieldOffsetTable611,
g_FieldOffsetTable612,
g_FieldOffsetTable613,
g_FieldOffsetTable614,
g_FieldOffsetTable615,
g_FieldOffsetTable616,
g_FieldOffsetTable617,
g_FieldOffsetTable618,
g_FieldOffsetTable619,
g_FieldOffsetTable620,
g_FieldOffsetTable621,
g_FieldOffsetTable622,
g_FieldOffsetTable623,
g_FieldOffsetTable624,
g_FieldOffsetTable625,
g_FieldOffsetTable626,
g_FieldOffsetTable627,
g_FieldOffsetTable628,
g_FieldOffsetTable629,
g_FieldOffsetTable630,
g_FieldOffsetTable631,
g_FieldOffsetTable632,
g_FieldOffsetTable633,
g_FieldOffsetTable634,
NULL,
g_FieldOffsetTable636,
g_FieldOffsetTable637,
g_FieldOffsetTable638,
g_FieldOffsetTable639,
g_FieldOffsetTable640,
g_FieldOffsetTable641,
g_FieldOffsetTable642,
g_FieldOffsetTable643,
g_FieldOffsetTable644,
g_FieldOffsetTable645,
NULL,
g_FieldOffsetTable647,
g_FieldOffsetTable648,
g_FieldOffsetTable649,
g_FieldOffsetTable650,
NULL,
g_FieldOffsetTable652,
g_FieldOffsetTable653,
g_FieldOffsetTable654,
NULL,
g_FieldOffsetTable656,
NULL,
NULL,
g_FieldOffsetTable659,
NULL,
NULL,
g_FieldOffsetTable662,
g_FieldOffsetTable663,
g_FieldOffsetTable664,
g_FieldOffsetTable665,
g_FieldOffsetTable666,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable676,
g_FieldOffsetTable677,
g_FieldOffsetTable678,
NULL,
g_FieldOffsetTable680,
g_FieldOffsetTable681,
g_FieldOffsetTable682,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable688,
g_FieldOffsetTable689,
g_FieldOffsetTable690,
g_FieldOffsetTable691,
g_FieldOffsetTable692,
g_FieldOffsetTable693,
NULL,
g_FieldOffsetTable695,
NULL,
NULL,
g_FieldOffsetTable698,
NULL,
g_FieldOffsetTable700,
g_FieldOffsetTable701,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable706,
g_FieldOffsetTable707,
g_FieldOffsetTable708,
NULL,
g_FieldOffsetTable710,
g_FieldOffsetTable711,
NULL,
NULL,
g_FieldOffsetTable714,
g_FieldOffsetTable715,
g_FieldOffsetTable716,
g_FieldOffsetTable717,
NULL,
g_FieldOffsetTable719,
g_FieldOffsetTable720,
NULL,
g_FieldOffsetTable722,
g_FieldOffsetTable723,
g_FieldOffsetTable724,
g_FieldOffsetTable725,
NULL,
g_FieldOffsetTable727,
g_FieldOffsetTable728,
g_FieldOffsetTable729,
g_FieldOffsetTable730,
g_FieldOffsetTable731,
NULL,
g_FieldOffsetTable733,
g_FieldOffsetTable734,
g_FieldOffsetTable735,
g_FieldOffsetTable736,
NULL,
NULL,
g_FieldOffsetTable739,
g_FieldOffsetTable740,
NULL,
g_FieldOffsetTable742,
g_FieldOffsetTable743,
g_FieldOffsetTable744,
g_FieldOffsetTable745,
g_FieldOffsetTable746,
g_FieldOffsetTable747,
g_FieldOffsetTable748,
g_FieldOffsetTable749,
g_FieldOffsetTable750,
g_FieldOffsetTable751,
NULL,
g_FieldOffsetTable753,
g_FieldOffsetTable754,
NULL,
g_FieldOffsetTable756,
NULL,
g_FieldOffsetTable758,
g_FieldOffsetTable759,
g_FieldOffsetTable760,
NULL,
NULL,
g_FieldOffsetTable763,
g_FieldOffsetTable764,
NULL,
NULL,
g_FieldOffsetTable767,
g_FieldOffsetTable768,
NULL,
NULL,
NULL,
g_FieldOffsetTable772,
NULL,
NULL,
NULL,
g_FieldOffsetTable776,
g_FieldOffsetTable777,
g_FieldOffsetTable778,
g_FieldOffsetTable779,
NULL,
NULL,
NULL,
g_FieldOffsetTable783,
g_FieldOffsetTable784,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable792,
g_FieldOffsetTable793,
g_FieldOffsetTable794,
g_FieldOffsetTable795,
g_FieldOffsetTable796,
g_FieldOffsetTable797,
g_FieldOffsetTable798,
g_FieldOffsetTable799,
g_FieldOffsetTable800,
g_FieldOffsetTable801,
g_FieldOffsetTable802,
NULL,
g_FieldOffsetTable804,
g_FieldOffsetTable805,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable811,
g_FieldOffsetTable812,
g_FieldOffsetTable813,
g_FieldOffsetTable814,
g_FieldOffsetTable815,
g_FieldOffsetTable816,
g_FieldOffsetTable817,
g_FieldOffsetTable818,
g_FieldOffsetTable819,
g_FieldOffsetTable820,
g_FieldOffsetTable821,
g_FieldOffsetTable822,
g_FieldOffsetTable823,
g_FieldOffsetTable824,
NULL,
NULL,
g_FieldOffsetTable827,
g_FieldOffsetTable828,
g_FieldOffsetTable829,
g_FieldOffsetTable830,
g_FieldOffsetTable831,
g_FieldOffsetTable832,
g_FieldOffsetTable833,
g_FieldOffsetTable834,
g_FieldOffsetTable835,
g_FieldOffsetTable836,
g_FieldOffsetTable837,
g_FieldOffsetTable838,
g_FieldOffsetTable839,
g_FieldOffsetTable840,
g_FieldOffsetTable841,
g_FieldOffsetTable842,
g_FieldOffsetTable843,
NULL,
g_FieldOffsetTable845,
g_FieldOffsetTable846,
g_FieldOffsetTable847,
g_FieldOffsetTable848,
g_FieldOffsetTable849,
g_FieldOffsetTable850,
g_FieldOffsetTable851,
g_FieldOffsetTable852,
g_FieldOffsetTable853,
g_FieldOffsetTable854,
g_FieldOffsetTable855,
g_FieldOffsetTable856,
g_FieldOffsetTable857,
g_FieldOffsetTable858,
g_FieldOffsetTable859,
g_FieldOffsetTable860,
g_FieldOffsetTable861,
g_FieldOffsetTable862,
g_FieldOffsetTable863,
g_FieldOffsetTable864,
g_FieldOffsetTable865,
g_FieldOffsetTable866,
g_FieldOffsetTable867,
g_FieldOffsetTable868,
g_FieldOffsetTable869,
g_FieldOffsetTable870,
g_FieldOffsetTable871,
g_FieldOffsetTable872,
g_FieldOffsetTable873,
g_FieldOffsetTable874,
g_FieldOffsetTable875,
g_FieldOffsetTable876,
g_FieldOffsetTable877,
g_FieldOffsetTable878,
g_FieldOffsetTable879,
g_FieldOffsetTable880,
g_FieldOffsetTable881,
g_FieldOffsetTable882,
g_FieldOffsetTable883,
g_FieldOffsetTable884,
g_FieldOffsetTable885,
g_FieldOffsetTable886,
NULL,
NULL,
NULL,
g_FieldOffsetTable890,
g_FieldOffsetTable891,
g_FieldOffsetTable892,
g_FieldOffsetTable893,
g_FieldOffsetTable894,
g_FieldOffsetTable895,
g_FieldOffsetTable896,
g_FieldOffsetTable897,
NULL,
NULL,
g_FieldOffsetTable900,
g_FieldOffsetTable901,
g_FieldOffsetTable902,
g_FieldOffsetTable903,
NULL,
NULL,
g_FieldOffsetTable906,
g_FieldOffsetTable907,
g_FieldOffsetTable908,
g_FieldOffsetTable909,
g_FieldOffsetTable910,
g_FieldOffsetTable911,
g_FieldOffsetTable912,
g_FieldOffsetTable913,
NULL,
g_FieldOffsetTable915,
NULL,
g_FieldOffsetTable917,
g_FieldOffsetTable918,
g_FieldOffsetTable919,
NULL,
NULL,
NULL,
g_FieldOffsetTable923,
g_FieldOffsetTable924,
g_FieldOffsetTable925,
g_FieldOffsetTable926,
g_FieldOffsetTable927,
g_FieldOffsetTable928,
g_FieldOffsetTable929,
g_FieldOffsetTable930,
NULL,
g_FieldOffsetTable932,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable944,
g_FieldOffsetTable945,
g_FieldOffsetTable946,
g_FieldOffsetTable947,
g_FieldOffsetTable948,
NULL,
g_FieldOffsetTable950,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable958,
g_FieldOffsetTable959,
g_FieldOffsetTable960,
NULL,
g_FieldOffsetTable962,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable967,
g_FieldOffsetTable968,
g_FieldOffsetTable969,
NULL,
g_FieldOffsetTable971,
NULL,
g_FieldOffsetTable973,
g_FieldOffsetTable974,
g_FieldOffsetTable975,
g_FieldOffsetTable976,
g_FieldOffsetTable977,
g_FieldOffsetTable978,
g_FieldOffsetTable979,
g_FieldOffsetTable980,
g_FieldOffsetTable981,
g_FieldOffsetTable982,
g_FieldOffsetTable983,
g_FieldOffsetTable984,
g_FieldOffsetTable985,
g_FieldOffsetTable986,
g_FieldOffsetTable987,
g_FieldOffsetTable988,
g_FieldOffsetTable989,
g_FieldOffsetTable990,
NULL,
g_FieldOffsetTable992,
g_FieldOffsetTable993,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1003,
g_FieldOffsetTable1004,
g_FieldOffsetTable1005,
g_FieldOffsetTable1006,
g_FieldOffsetTable1007,
g_FieldOffsetTable1008,
g_FieldOffsetTable1009,
g_FieldOffsetTable1010,
NULL,
NULL,
NULL,
g_FieldOffsetTable1014,
g_FieldOffsetTable1015,
NULL,
g_FieldOffsetTable1017,
g_FieldOffsetTable1018,
g_FieldOffsetTable1019,
NULL,
NULL,
g_FieldOffsetTable1022,
NULL,
g_FieldOffsetTable1024,
g_FieldOffsetTable1025,
g_FieldOffsetTable1026,
g_FieldOffsetTable1027,
g_FieldOffsetTable1028,
g_FieldOffsetTable1029,
g_FieldOffsetTable1030,
g_FieldOffsetTable1031,
g_FieldOffsetTable1032,
g_FieldOffsetTable1033,
g_FieldOffsetTable1034,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1039,
g_FieldOffsetTable1040,
g_FieldOffsetTable1041,
g_FieldOffsetTable1042,
g_FieldOffsetTable1043,
g_FieldOffsetTable1044,
g_FieldOffsetTable1045,
g_FieldOffsetTable1046,
g_FieldOffsetTable1047,
g_FieldOffsetTable1048,
g_FieldOffsetTable1049,
g_FieldOffsetTable1050,
NULL,
NULL,
g_FieldOffsetTable1053,
g_FieldOffsetTable1054,
NULL,
g_FieldOffsetTable1056,
g_FieldOffsetTable1057,
NULL,
NULL,
g_FieldOffsetTable1060,
NULL,
NULL,
NULL,
g_FieldOffsetTable1064,
NULL,
g_FieldOffsetTable1066,
NULL,
g_FieldOffsetTable1068,
g_FieldOffsetTable1069,
g_FieldOffsetTable1070,
g_FieldOffsetTable1071,
g_FieldOffsetTable1072,
g_FieldOffsetTable1073,
g_FieldOffsetTable1074,
g_FieldOffsetTable1075,
g_FieldOffsetTable1076,
g_FieldOffsetTable1077,
NULL,
g_FieldOffsetTable1079,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1084,
g_FieldOffsetTable1085,
g_FieldOffsetTable1086,
g_FieldOffsetTable1087,
g_FieldOffsetTable1088,
g_FieldOffsetTable1089,
g_FieldOffsetTable1090,
NULL,
g_FieldOffsetTable1092,
NULL,
NULL,
NULL,
g_FieldOffsetTable1096,
g_FieldOffsetTable1097,
g_FieldOffsetTable1098,
g_FieldOffsetTable1099,
g_FieldOffsetTable1100,
g_FieldOffsetTable1101,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1117,
g_FieldOffsetTable1118,
g_FieldOffsetTable1119,
NULL,
g_FieldOffsetTable1121,
g_FieldOffsetTable1122,
g_FieldOffsetTable1123,
g_FieldOffsetTable1124,
g_FieldOffsetTable1125,
NULL,
NULL,
g_FieldOffsetTable1128,
g_FieldOffsetTable1129,
g_FieldOffsetTable1130,
g_FieldOffsetTable1131,
NULL,
g_FieldOffsetTable1133,
g_FieldOffsetTable1134,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1146,
g_FieldOffsetTable1147,
g_FieldOffsetTable1148,
g_FieldOffsetTable1149,
NULL,
g_FieldOffsetTable1151,
g_FieldOffsetTable1152,
NULL,
g_FieldOffsetTable1154,
g_FieldOffsetTable1155,
NULL,
g_FieldOffsetTable1157,
g_FieldOffsetTable1158,
g_FieldOffsetTable1159,
g_FieldOffsetTable1160,
g_FieldOffsetTable1161,
g_FieldOffsetTable1162,
g_FieldOffsetTable1163,
g_FieldOffsetTable1164,
NULL,
NULL,
NULL,
g_FieldOffsetTable1168,
NULL,
NULL,
g_FieldOffsetTable1171,
g_FieldOffsetTable1172,
g_FieldOffsetTable1173,
g_FieldOffsetTable1174,
g_FieldOffsetTable1175,
g_FieldOffsetTable1176,
g_FieldOffsetTable1177,
g_FieldOffsetTable1178,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1183,
g_FieldOffsetTable1184,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1189,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1210,
g_FieldOffsetTable1211,
NULL,
NULL,
NULL,
g_FieldOffsetTable1215,
g_FieldOffsetTable1216,
g_FieldOffsetTable1217,
g_FieldOffsetTable1218,
g_FieldOffsetTable1219,
g_FieldOffsetTable1220,
g_FieldOffsetTable1221,
g_FieldOffsetTable1222,
g_FieldOffsetTable1223,
g_FieldOffsetTable1224,
NULL,
g_FieldOffsetTable1226,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1268,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1278,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1285,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1290,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1295,
g_FieldOffsetTable1296,
g_FieldOffsetTable1297,
g_FieldOffsetTable1298,
g_FieldOffsetTable1299,
g_FieldOffsetTable1300,
NULL,
g_FieldOffsetTable1302,
g_FieldOffsetTable1303,
g_FieldOffsetTable1304,
g_FieldOffsetTable1305,
g_FieldOffsetTable1306,
g_FieldOffsetTable1307,
g_FieldOffsetTable1308,
g_FieldOffsetTable1309,
NULL,
g_FieldOffsetTable1311,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1316,
g_FieldOffsetTable1317,
NULL,
g_FieldOffsetTable1319,
g_FieldOffsetTable1320,
NULL,
g_FieldOffsetTable1322,
g_FieldOffsetTable1323,
g_FieldOffsetTable1324,
g_FieldOffsetTable1325,
g_FieldOffsetTable1326,
g_FieldOffsetTable1327,
g_FieldOffsetTable1328,
g_FieldOffsetTable1329,
g_FieldOffsetTable1330,
NULL,
g_FieldOffsetTable1332,
g_FieldOffsetTable1333,
g_FieldOffsetTable1334,
g_FieldOffsetTable1335,
g_FieldOffsetTable1336,
g_FieldOffsetTable1337,
g_FieldOffsetTable1338,
g_FieldOffsetTable1339,
g_FieldOffsetTable1340,
g_FieldOffsetTable1341,
g_FieldOffsetTable1342,
g_FieldOffsetTable1343,
g_FieldOffsetTable1344,
g_FieldOffsetTable1345,
g_FieldOffsetTable1346,
g_FieldOffsetTable1347,
g_FieldOffsetTable1348,
NULL,
g_FieldOffsetTable1350,
g_FieldOffsetTable1351,
g_FieldOffsetTable1352,
NULL,
g_FieldOffsetTable1354,
NULL,
NULL,
g_FieldOffsetTable1357,
NULL,
g_FieldOffsetTable1359,
g_FieldOffsetTable1360,
g_FieldOffsetTable1361,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1369,
g_FieldOffsetTable1370,
g_FieldOffsetTable1371,
NULL,
g_FieldOffsetTable1373,
g_FieldOffsetTable1374,
g_FieldOffsetTable1375,
g_FieldOffsetTable1376,
NULL,
g_FieldOffsetTable1378,
g_FieldOffsetTable1379,
g_FieldOffsetTable1380,
g_FieldOffsetTable1381,
NULL,
g_FieldOffsetTable1383,
g_FieldOffsetTable1384,
g_FieldOffsetTable1385,
g_FieldOffsetTable1386,
g_FieldOffsetTable1387,
g_FieldOffsetTable1388,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1393,
g_FieldOffsetTable1394,
g_FieldOffsetTable1395,
g_FieldOffsetTable1396,
g_FieldOffsetTable1397,
g_FieldOffsetTable1398,
g_FieldOffsetTable1399,
g_FieldOffsetTable1400,
NULL,
g_FieldOffsetTable1402,
g_FieldOffsetTable1403,
g_FieldOffsetTable1404,
g_FieldOffsetTable1405,
g_FieldOffsetTable1406,
NULL,
NULL,
g_FieldOffsetTable1409,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1433,
g_FieldOffsetTable1434,
g_FieldOffsetTable1435,
g_FieldOffsetTable1436,
g_FieldOffsetTable1437,
NULL,
g_FieldOffsetTable1439,
g_FieldOffsetTable1440,
g_FieldOffsetTable1441,
NULL,
NULL,
g_FieldOffsetTable1444,
NULL,
NULL,
NULL,
g_FieldOffsetTable1448,
NULL,
NULL,
g_FieldOffsetTable1451,
g_FieldOffsetTable1452,
g_FieldOffsetTable1453,
g_FieldOffsetTable1454,
g_FieldOffsetTable1455,
NULL,
g_FieldOffsetTable1457,
NULL,
g_FieldOffsetTable1459,
g_FieldOffsetTable1460,
NULL,
NULL,
g_FieldOffsetTable1463,
g_FieldOffsetTable1464,
g_FieldOffsetTable1465,
g_FieldOffsetTable1466,
NULL,
g_FieldOffsetTable1468,
g_FieldOffsetTable1469,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1474,
g_FieldOffsetTable1475,
g_FieldOffsetTable1476,
NULL,
NULL,
g_FieldOffsetTable1479,
NULL,
NULL,
NULL,
g_FieldOffsetTable1483,
NULL,
g_FieldOffsetTable1485,
g_FieldOffsetTable1486,
g_FieldOffsetTable1487,
g_FieldOffsetTable1488,
g_FieldOffsetTable1489,
NULL,
NULL,
g_FieldOffsetTable1492,
g_FieldOffsetTable1493,
g_FieldOffsetTable1494,
g_FieldOffsetTable1495,
g_FieldOffsetTable1496,
g_FieldOffsetTable1497,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1504,
g_FieldOffsetTable1505,
g_FieldOffsetTable1506,
g_FieldOffsetTable1507,
g_FieldOffsetTable1508,
NULL,
g_FieldOffsetTable1510,
g_FieldOffsetTable1511,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1527,
NULL,
g_FieldOffsetTable1529,
g_FieldOffsetTable1530,
g_FieldOffsetTable1531,
g_FieldOffsetTable1532,
NULL,
NULL,
g_FieldOffsetTable1535,
g_FieldOffsetTable1536,
g_FieldOffsetTable1537,
g_FieldOffsetTable1538,
g_FieldOffsetTable1539,
g_FieldOffsetTable1540,
NULL,
g_FieldOffsetTable1542,
g_FieldOffsetTable1543,
NULL,
g_FieldOffsetTable1545,
g_FieldOffsetTable1546,
g_FieldOffsetTable1547,
NULL,
g_FieldOffsetTable1549,
NULL,
g_FieldOffsetTable1551,
g_FieldOffsetTable1552,
g_FieldOffsetTable1553,
g_FieldOffsetTable1554,
NULL,
g_FieldOffsetTable1556,
g_FieldOffsetTable1557,
g_FieldOffsetTable1558,
g_FieldOffsetTable1559,
NULL,
g_FieldOffsetTable1561,
NULL,
NULL,
NULL,
g_FieldOffsetTable1565,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1572,
g_FieldOffsetTable1573,
NULL,
g_FieldOffsetTable1575,
g_FieldOffsetTable1576,
g_FieldOffsetTable1577,
g_FieldOffsetTable1578,
g_FieldOffsetTable1579,
g_FieldOffsetTable1580,
g_FieldOffsetTable1581,
g_FieldOffsetTable1582,
g_FieldOffsetTable1583,
g_FieldOffsetTable1584,
g_FieldOffsetTable1585,
g_FieldOffsetTable1586,
g_FieldOffsetTable1587,
g_FieldOffsetTable1588,
g_FieldOffsetTable1589,
g_FieldOffsetTable1590,
g_FieldOffsetTable1591,
g_FieldOffsetTable1592,
NULL,
g_FieldOffsetTable1594,
NULL,
g_FieldOffsetTable1596,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1604,
NULL,
NULL,
g_FieldOffsetTable1607,
NULL,
g_FieldOffsetTable1609,
g_FieldOffsetTable1610,
g_FieldOffsetTable1611,
g_FieldOffsetTable1612,
g_FieldOffsetTable1613,
g_FieldOffsetTable1614,
g_FieldOffsetTable1615,
g_FieldOffsetTable1616,
g_FieldOffsetTable1617,
g_FieldOffsetTable1618,
NULL,
NULL,
NULL,
g_FieldOffsetTable1622,
g_FieldOffsetTable1623,
g_FieldOffsetTable1624,
NULL,
g_FieldOffsetTable1626,
NULL,
g_FieldOffsetTable1628,
g_FieldOffsetTable1629,
NULL,
g_FieldOffsetTable1631,
g_FieldOffsetTable1632,
g_FieldOffsetTable1633,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1638,
g_FieldOffsetTable1639,
NULL,
NULL,
NULL,
g_FieldOffsetTable1643,
NULL,
NULL,
g_FieldOffsetTable1646,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1656,
g_FieldOffsetTable1657,
NULL,
g_FieldOffsetTable1659,
NULL,
g_FieldOffsetTable1661,
NULL,
g_FieldOffsetTable1663,
NULL,
g_FieldOffsetTable1665,
NULL,
g_FieldOffsetTable1667,
g_FieldOffsetTable1668,
g_FieldOffsetTable1669,
g_FieldOffsetTable1670,
NULL,
NULL,
g_FieldOffsetTable1673,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1684,
NULL,
g_FieldOffsetTable1686,
g_FieldOffsetTable1687,
NULL,
NULL,
NULL,
g_FieldOffsetTable1691,
g_FieldOffsetTable1692,
NULL,
g_FieldOffsetTable1694,
g_FieldOffsetTable1695,
g_FieldOffsetTable1696,
g_FieldOffsetTable1697,
NULL,
g_FieldOffsetTable1699,
NULL,
g_FieldOffsetTable1701,
g_FieldOffsetTable1702,
g_FieldOffsetTable1703,
g_FieldOffsetTable1704,
g_FieldOffsetTable1705,
g_FieldOffsetTable1706,
g_FieldOffsetTable1707,
g_FieldOffsetTable1708,
g_FieldOffsetTable1709,
g_FieldOffsetTable1710,
g_FieldOffsetTable1711,
NULL,
g_FieldOffsetTable1713,
NULL,
g_FieldOffsetTable1715,
NULL,
g_FieldOffsetTable1717,
NULL,
g_FieldOffsetTable1719,
NULL,
g_FieldOffsetTable1721,
g_FieldOffsetTable1722,
NULL,
NULL,
g_FieldOffsetTable1725,
g_FieldOffsetTable1726,
g_FieldOffsetTable1727,
g_FieldOffsetTable1728,
g_FieldOffsetTable1729,
g_FieldOffsetTable1730,
g_FieldOffsetTable1731,
NULL,
g_FieldOffsetTable1733,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1866,
g_FieldOffsetTable1867,
g_FieldOffsetTable1868,
g_FieldOffsetTable1869,
g_FieldOffsetTable1870,
NULL,
NULL,
g_FieldOffsetTable1873,
g_FieldOffsetTable1874,
g_FieldOffsetTable1875,
g_FieldOffsetTable1876,
g_FieldOffsetTable1877,
g_FieldOffsetTable1878,
NULL,
g_FieldOffsetTable1880,
g_FieldOffsetTable1881,
g_FieldOffsetTable1882,
g_FieldOffsetTable1883,
g_FieldOffsetTable1884,
NULL,
g_FieldOffsetTable1886,
g_FieldOffsetTable1887,
g_FieldOffsetTable1888,
g_FieldOffsetTable1889,
g_FieldOffsetTable1890,
g_FieldOffsetTable1891,
g_FieldOffsetTable1892,
NULL,
g_FieldOffsetTable1894,
g_FieldOffsetTable1895,
g_FieldOffsetTable1896,
g_FieldOffsetTable1897,
g_FieldOffsetTable1898,
NULL,
g_FieldOffsetTable1900,
g_FieldOffsetTable1901,
g_FieldOffsetTable1902,
g_FieldOffsetTable1903,
g_FieldOffsetTable1904,
g_FieldOffsetTable1905,
g_FieldOffsetTable1906,
g_FieldOffsetTable1907,
g_FieldOffsetTable1908,
NULL,
g_FieldOffsetTable1910,
g_FieldOffsetTable1911,
g_FieldOffsetTable1912,
NULL,
NULL,
NULL,
g_FieldOffsetTable1916,
NULL,
NULL,
NULL,
g_FieldOffsetTable1920,
g_FieldOffsetTable1921,
g_FieldOffsetTable1922,
g_FieldOffsetTable1923,
g_FieldOffsetTable1924,
g_FieldOffsetTable1925,
g_FieldOffsetTable1926,
NULL,
g_FieldOffsetTable1928,
g_FieldOffsetTable1929,
g_FieldOffsetTable1930,
g_FieldOffsetTable1931,
g_FieldOffsetTable1932,
g_FieldOffsetTable1933,
g_FieldOffsetTable1934,
g_FieldOffsetTable1935,
g_FieldOffsetTable1936,
g_FieldOffsetTable1937,
g_FieldOffsetTable1938,
g_FieldOffsetTable1939,
NULL,
NULL,
g_FieldOffsetTable1942,
g_FieldOffsetTable1943,
g_FieldOffsetTable1944,
g_FieldOffsetTable1945,
g_FieldOffsetTable1946,
g_FieldOffsetTable1947,
NULL,
NULL,
g_FieldOffsetTable1950,
g_FieldOffsetTable1951,
g_FieldOffsetTable1952,
g_FieldOffsetTable1953,
g_FieldOffsetTable1954,
g_FieldOffsetTable1955,
NULL,
NULL,
g_FieldOffsetTable1958,
g_FieldOffsetTable1959,
g_FieldOffsetTable1960,
g_FieldOffsetTable1961,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1969,
g_FieldOffsetTable1970,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1975,
NULL,
NULL,
g_FieldOffsetTable1978,
NULL,
NULL,
NULL,
g_FieldOffsetTable1982,
NULL,
g_FieldOffsetTable1984,
g_FieldOffsetTable1985,
g_FieldOffsetTable1986,
NULL,
g_FieldOffsetTable1988,
NULL,
g_FieldOffsetTable1990,
g_FieldOffsetTable1991,
NULL,
g_FieldOffsetTable1993,
g_FieldOffsetTable1994,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1999,
g_FieldOffsetTable2000,
g_FieldOffsetTable2001,
g_FieldOffsetTable2002,
g_FieldOffsetTable2003,
g_FieldOffsetTable2004,
g_FieldOffsetTable2005,
g_FieldOffsetTable2006,
g_FieldOffsetTable2007,
g_FieldOffsetTable2008,
g_FieldOffsetTable2009,
g_FieldOffsetTable2010,
g_FieldOffsetTable2011,
g_FieldOffsetTable2012,
g_FieldOffsetTable2013,
g_FieldOffsetTable2014,
g_FieldOffsetTable2015,
g_FieldOffsetTable2016,
g_FieldOffsetTable2017,
g_FieldOffsetTable2018,
NULL,
g_FieldOffsetTable2020,
NULL,
g_FieldOffsetTable2022,
g_FieldOffsetTable2023,
NULL,
g_FieldOffsetTable2025,
g_FieldOffsetTable2026,
g_FieldOffsetTable2027,
g_FieldOffsetTable2028,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2034,
NULL,
NULL,
g_FieldOffsetTable2037,
g_FieldOffsetTable2038,
g_FieldOffsetTable2039,
NULL,
NULL,
NULL,
g_FieldOffsetTable2043,
g_FieldOffsetTable2044,
g_FieldOffsetTable2045,
g_FieldOffsetTable2046,
g_FieldOffsetTable2047,
g_FieldOffsetTable2048,
g_FieldOffsetTable2049,
NULL,
NULL,
g_FieldOffsetTable2052,
g_FieldOffsetTable2053,
g_FieldOffsetTable2054,
NULL,
g_FieldOffsetTable2056,
NULL,
g_FieldOffsetTable2058,
NULL,
g_FieldOffsetTable2060,
NULL,
NULL,
g_FieldOffsetTable2063,
g_FieldOffsetTable2064,
g_FieldOffsetTable2065,
g_FieldOffsetTable2066,
g_FieldOffsetTable2067,
g_FieldOffsetTable2068,
g_FieldOffsetTable2069,
NULL,
NULL,
g_FieldOffsetTable2072,
g_FieldOffsetTable2073,
g_FieldOffsetTable2074,
g_FieldOffsetTable2075,
g_FieldOffsetTable2076,
g_FieldOffsetTable2077,
NULL,
NULL,
g_FieldOffsetTable2080,
g_FieldOffsetTable2081,
g_FieldOffsetTable2082,
g_FieldOffsetTable2083,
g_FieldOffsetTable2084,
g_FieldOffsetTable2085,
NULL,
g_FieldOffsetTable2087,
g_FieldOffsetTable2088,
g_FieldOffsetTable2089,
NULL,
NULL,
g_FieldOffsetTable2092,
g_FieldOffsetTable2093,
g_FieldOffsetTable2094,
NULL,
NULL,
NULL,
g_FieldOffsetTable2098,
g_FieldOffsetTable2099,
NULL,
NULL,
g_FieldOffsetTable2102,
NULL,
NULL,
NULL,
g_FieldOffsetTable2106,
g_FieldOffsetTable2107,
g_FieldOffsetTable2108,
g_FieldOffsetTable2109,
g_FieldOffsetTable2110,
g_FieldOffsetTable2111,
NULL,
g_FieldOffsetTable2113,
NULL,
g_FieldOffsetTable2115,
NULL,
g_FieldOffsetTable2117,
NULL,
g_FieldOffsetTable2119,
g_FieldOffsetTable2120,
g_FieldOffsetTable2121,
NULL,
g_FieldOffsetTable2123,
NULL,
g_FieldOffsetTable2125,
NULL,
g_FieldOffsetTable2127,
NULL,
NULL,
g_FieldOffsetTable2130,
g_FieldOffsetTable2131,
g_FieldOffsetTable2132,
NULL,
NULL,
NULL,
g_FieldOffsetTable2136,
g_FieldOffsetTable2137,
g_FieldOffsetTable2138,
g_FieldOffsetTable2139,
NULL,
NULL,
g_FieldOffsetTable2142,
g_FieldOffsetTable2143,
NULL,
g_FieldOffsetTable2145,
g_FieldOffsetTable2146,
g_FieldOffsetTable2147,
g_FieldOffsetTable2148,
NULL,
NULL,
g_FieldOffsetTable2151,
g_FieldOffsetTable2152,
NULL,
g_FieldOffsetTable2154,
g_FieldOffsetTable2155,
NULL,
g_FieldOffsetTable2157,
NULL,
g_FieldOffsetTable2159,
g_FieldOffsetTable2160,
g_FieldOffsetTable2161,
g_FieldOffsetTable2162,
g_FieldOffsetTable2163,
g_FieldOffsetTable2164,
NULL,
g_FieldOffsetTable2166,
NULL,
g_FieldOffsetTable2168,
NULL,
g_FieldOffsetTable2170,
g_FieldOffsetTable2171,
NULL,
g_FieldOffsetTable2173,
g_FieldOffsetTable2174,
g_FieldOffsetTable2175,
NULL,
g_FieldOffsetTable2177,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2182,
g_FieldOffsetTable2183,
g_FieldOffsetTable2184,
g_FieldOffsetTable2185,
g_FieldOffsetTable2186,
NULL,
g_FieldOffsetTable2188,
NULL,
g_FieldOffsetTable2190,
g_FieldOffsetTable2191,
g_FieldOffsetTable2192,
g_FieldOffsetTable2193,
g_FieldOffsetTable2194,
g_FieldOffsetTable2195,
g_FieldOffsetTable2196,
g_FieldOffsetTable2197,
g_FieldOffsetTable2198,
g_FieldOffsetTable2199,
NULL,
NULL,
g_FieldOffsetTable2202,
g_FieldOffsetTable2203,
g_FieldOffsetTable2204,
NULL,
g_FieldOffsetTable2206,
g_FieldOffsetTable2207,
g_FieldOffsetTable2208,
g_FieldOffsetTable2209,
g_FieldOffsetTable2210,
NULL,
g_FieldOffsetTable2212,
g_FieldOffsetTable2213,
NULL,
NULL,
g_FieldOffsetTable2216,
g_FieldOffsetTable2217,
g_FieldOffsetTable2218,
g_FieldOffsetTable2219,
g_FieldOffsetTable2220,
g_FieldOffsetTable2221,
g_FieldOffsetTable2222,
g_FieldOffsetTable2223,
g_FieldOffsetTable2224,
NULL,
NULL,
g_FieldOffsetTable2227,
NULL,
g_FieldOffsetTable2229,
g_FieldOffsetTable2230,
g_FieldOffsetTable2231,
g_FieldOffsetTable2232,
g_FieldOffsetTable2233,
g_FieldOffsetTable2234,
g_FieldOffsetTable2235,
NULL,
g_FieldOffsetTable2237,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2243,
g_FieldOffsetTable2244,
g_FieldOffsetTable2245,
g_FieldOffsetTable2246,
g_FieldOffsetTable2247,
NULL,
g_FieldOffsetTable2249,
g_FieldOffsetTable2250,
NULL,
g_FieldOffsetTable2252,
NULL,
NULL,
NULL,
g_FieldOffsetTable2256,
g_FieldOffsetTable2257,
g_FieldOffsetTable2258,
g_FieldOffsetTable2259,
g_FieldOffsetTable2260,
g_FieldOffsetTable2261,
g_FieldOffsetTable2262,
g_FieldOffsetTable2263,
g_FieldOffsetTable2264,
NULL,
NULL,
g_FieldOffsetTable2267,
g_FieldOffsetTable2268,
NULL,
g_FieldOffsetTable2270,
g_FieldOffsetTable2271,
g_FieldOffsetTable2272,
g_FieldOffsetTable2273,
NULL,
g_FieldOffsetTable2275,
NULL,
NULL,
g_FieldOffsetTable2278,
NULL,
g_FieldOffsetTable2280,
g_FieldOffsetTable2281,
NULL,
NULL,
g_FieldOffsetTable2284,
NULL,
NULL,
g_FieldOffsetTable2287,
g_FieldOffsetTable2288,
g_FieldOffsetTable2289,
g_FieldOffsetTable2290,
g_FieldOffsetTable2291,
g_FieldOffsetTable2292,
NULL,
NULL,
NULL,
g_FieldOffsetTable2296,
g_FieldOffsetTable2297,
NULL,
g_FieldOffsetTable2299,
g_FieldOffsetTable2300,
g_FieldOffsetTable2301,
g_FieldOffsetTable2302,
g_FieldOffsetTable2303,
NULL,
g_FieldOffsetTable2305,
g_FieldOffsetTable2306,
g_FieldOffsetTable2307,
g_FieldOffsetTable2308,
g_FieldOffsetTable2309,
g_FieldOffsetTable2310,
NULL,
NULL,
g_FieldOffsetTable2313,
g_FieldOffsetTable2314,
g_FieldOffsetTable2315,
g_FieldOffsetTable2316,
g_FieldOffsetTable2317,
NULL,
g_FieldOffsetTable2319,
g_FieldOffsetTable2320,
NULL,
NULL,
g_FieldOffsetTable2323,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2328,
g_FieldOffsetTable2329,
NULL,
g_FieldOffsetTable2331,
g_FieldOffsetTable2332,
g_FieldOffsetTable2333,
g_FieldOffsetTable2334,
g_FieldOffsetTable2335,
g_FieldOffsetTable2336,
g_FieldOffsetTable2337,
g_FieldOffsetTable2338,
g_FieldOffsetTable2339,
g_FieldOffsetTable2340,
g_FieldOffsetTable2341,
g_FieldOffsetTable2342,
g_FieldOffsetTable2343,
g_FieldOffsetTable2344,
g_FieldOffsetTable2345,
g_FieldOffsetTable2346,
g_FieldOffsetTable2347,
NULL,
g_FieldOffsetTable2349,
g_FieldOffsetTable2350,
g_FieldOffsetTable2351,
g_FieldOffsetTable2352,
NULL,
g_FieldOffsetTable2354,
g_FieldOffsetTable2355,
g_FieldOffsetTable2356,
g_FieldOffsetTable2357,
g_FieldOffsetTable2358,
g_FieldOffsetTable2359,
g_FieldOffsetTable2360,
g_FieldOffsetTable2361,
g_FieldOffsetTable2362,
g_FieldOffsetTable2363,
g_FieldOffsetTable2364,
g_FieldOffsetTable2365,
g_FieldOffsetTable2366,
g_FieldOffsetTable2367,
g_FieldOffsetTable2368,
g_FieldOffsetTable2369,
NULL,
g_FieldOffsetTable2371,
g_FieldOffsetTable2372,
g_FieldOffsetTable2373,
g_FieldOffsetTable2374,
g_FieldOffsetTable2375,
g_FieldOffsetTable2376,
NULL,
g_FieldOffsetTable2378,
g_FieldOffsetTable2379,
g_FieldOffsetTable2380,
g_FieldOffsetTable2381,
g_FieldOffsetTable2382,
g_FieldOffsetTable2383,
g_FieldOffsetTable2384,
g_FieldOffsetTable2385,
g_FieldOffsetTable2386,
g_FieldOffsetTable2387,
NULL,
g_FieldOffsetTable2389,
g_FieldOffsetTable2390,
g_FieldOffsetTable2391,
g_FieldOffsetTable2392,
g_FieldOffsetTable2393,
g_FieldOffsetTable2394,
g_FieldOffsetTable2395,
g_FieldOffsetTable2396,
g_FieldOffsetTable2397,
g_FieldOffsetTable2398,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2403,
NULL,
NULL,
g_FieldOffsetTable2406,
NULL,
g_FieldOffsetTable2408,
NULL,
NULL,
NULL,
g_FieldOffsetTable2412,
g_FieldOffsetTable2413,
NULL,
NULL,
NULL,
g_FieldOffsetTable2417,
g_FieldOffsetTable2418,
g_FieldOffsetTable2419,
g_FieldOffsetTable2420,
NULL,
NULL,
NULL,
};
| [
"danielmqh9@gmail.com"
] | danielmqh9@gmail.com |
d53c3f48b8ebb76c28c7e7a6f633778f248e5c7f | f1601d841b6d4914b8de9056281a0235e981c7f8 | /build-LexicalAnalyzer-Desktop_Qt_5_6_2_MinGW_32bit-Debug/debug/moc_mainwindow.cpp | c4abf747da874901c1e179b4a17e7aa48ef5f095 | [] | no_license | raaul19/LexicalAnalyzer | b91aa0efac82edbb8e22052ee1fb01f2f95d494c | 29b188ffee6e61037c50436f4471e6a3596079db | refs/heads/master | 2023-04-07T06:01:15.888402 | 2021-04-11T23:17:06 | 2021-04-11T23:17:06 | 355,327,070 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,370 | cpp | /****************************************************************************
** Meta object code from reading C++ file 'mainwindow.h'
**
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.6.2)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#include "../../LexicalAnalyzer/mainwindow.h"
#include <QtCore/qbytearray.h>
#include <QtCore/qmetatype.h>
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'mainwindow.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 67
#error "This file was generated using the moc from 5.6.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
QT_BEGIN_MOC_NAMESPACE
struct qt_meta_stringdata_MainWindow_t {
QByteArrayData data[3];
char stringdata0[33];
};
#define QT_MOC_LITERAL(idx, ofs, len) \
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
qptrdiff(offsetof(qt_meta_stringdata_MainWindow_t, stringdata0) + ofs \
- idx * sizeof(QByteArrayData)) \
)
static const qt_meta_stringdata_MainWindow_t qt_meta_stringdata_MainWindow = {
{
QT_MOC_LITERAL(0, 0, 10), // "MainWindow"
QT_MOC_LITERAL(1, 11, 20), // "on_analyzeBT_clicked"
QT_MOC_LITERAL(2, 32, 0) // ""
},
"MainWindow\0on_analyzeBT_clicked\0"
};
#undef QT_MOC_LITERAL
static const uint qt_meta_data_MainWindow[] = {
// content:
7, // revision
0, // classname
0, 0, // classinfo
1, 14, // methods
0, 0, // properties
0, 0, // enums/sets
0, 0, // constructors
0, // flags
0, // signalCount
// slots: name, argc, parameters, tag, flags
1, 0, 19, 2, 0x08 /* Private */,
// slots: parameters
QMetaType::Void,
0 // eod
};
void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, void **_a)
{
if (_c == QMetaObject::InvokeMetaMethod) {
MainWindow *_t = static_cast<MainWindow *>(_o);
Q_UNUSED(_t)
switch (_id) {
case 0: _t->on_analyzeBT_clicked(); break;
default: ;
}
}
Q_UNUSED(_a);
}
const QMetaObject MainWindow::staticMetaObject = {
{ &QMainWindow::staticMetaObject, qt_meta_stringdata_MainWindow.data,
qt_meta_data_MainWindow, qt_static_metacall, Q_NULLPTR, Q_NULLPTR}
};
const QMetaObject *MainWindow::metaObject() const
{
return QObject::d_ptr->metaObject ? QObject::d_ptr->dynamicMetaObject() : &staticMetaObject;
}
void *MainWindow::qt_metacast(const char *_clname)
{
if (!_clname) return Q_NULLPTR;
if (!strcmp(_clname, qt_meta_stringdata_MainWindow.stringdata0))
return static_cast<void*>(const_cast< MainWindow*>(this));
return QMainWindow::qt_metacast(_clname);
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QMainWindow::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
if (_id < 1)
qt_static_metacall(this, _c, _id, _a);
_id -= 1;
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
if (_id < 1)
*reinterpret_cast<int*>(_a[0]) = -1;
_id -= 1;
}
return _id;
}
QT_END_MOC_NAMESPACE
| [
"raul.jaime.garcia.espejo@gmail.com"
] | raul.jaime.garcia.espejo@gmail.com |
f62e108283747829f6910ef82a83cd1356d8b9d7 | e47a03461bb78c5a795e4215627598257dde47ba | /slamdog/slamdog_srv_slam/src/ros_tutorial_srv_server.cpp | 190dae6c9619cd05d3116256e04bb276aa177660 | [] | no_license | SimonLee9/Capstone_SlamDog | fb7f9dd0e2a002521d24a0956e4f001af0b2b102 | 075cc158fb132a92d31ec84c997dd27ce5540784 | refs/heads/master | 2023-03-25T20:38:59.398512 | 2021-03-25T05:21:23 | 2021-03-25T05:21:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 707 | cpp | #include "ros/ros.h"
#include "slamdog_srv_slam/srvTutorial.h"
#include <cstdlib>
bool calculation(slamdog_srv_slam::srvTutorial::Request &req, slamdog_srv_slam::srvTutorial::Response &res)
{
res.result = req.a + req.b;
system("rosrun map_server map_saver -f ~/catkin_ws/src/slamdog/maps/map");
system("rosrun slamdog_srv_slam ros_tutorial_msg_publisher");
ROS_INFO("Map Saved!");
return true;
}
int main(int argc, char **argv)
{
ros::init(argc, argv, "ros_slam_srv_server");
ros::NodeHandle nh;
ros::ServiceServer ros_tutorial_service_server = nh.advertiseService("ros_tutorial_srv", calculation);
ROS_INFO("ready srv server!");
ros::spin();
return 0;
}
| [
"pshsdu75@gmail.com"
] | pshsdu75@gmail.com |
c83d2d5288313d26400acf0816137463e803adcd | 9a3522f8e5f713bf6d59bb3177d64f5f0c3821f1 | /Timus/1263.cpp | 65817741d7039e87832e021d6155591997f9cff1 | [] | no_license | BenjaminBLi/ccc-with-c | 6cbce36ed2cf23949a8ab1a74e85f768096853d8 | 277428e76d45cddf854cc4213f9c97d9099d5466 | refs/heads/master | 2020-06-09T23:44:38.015491 | 2018-04-15T02:13:16 | 2018-04-15T02:13:16 | 76,123,105 | 8 | 3 | null | 2017-11-17T18:27:20 | 2016-12-10T16:08:58 | C++ | UTF-8 | C++ | false | false | 646 | cpp | #include <bits/stdc++.h>
#define fori(i, st, en) for(int i = st; i < (int) (en); i++)
#define rfori(i, st, en) for(int i = st; i >= (int) (en); i--)
#define f first
#define s second
#define pb push_back
#define left(i) (i<<1)
#define right(i) (i<<1|1)
#define mid(l, r) ((l+r)>>1)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ii> vii;
typedef double lf;
int n, m, a[10010];
int main(){
scanf("%d%d", &n, &m);
for(int i = 0, x; i < m; i++){
scanf("%d", &x);
a[x]++;
}
fori(i, 1, n+1){
printf("%.02lf%\n", 100.0*a[i]/m);
}
return 0;
}
| [
"li.benjamin.b@gmail.com"
] | li.benjamin.b@gmail.com |
90375819d1832c39105ff5b42339f8ab408b0d53 | 3666e14d614e2f96426252901700bf620185cb6c | /4. CodeForce/SolvedProblem/261/B.cpp | 79c388af7bee708dee1824d70764f2dd18241a9c | [] | no_license | faijurrahman/pSolving | 5dcd5182ccc8a89d848d1c2dcdc0f4579421b301 | 6b07c9946516ab4e387fe4248ff2eda7edf3f0a4 | refs/heads/master | 2021-01-01T16:12:47.779189 | 2016-09-22T22:26:13 | 2016-09-22T22:26:13 | 23,628,428 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,117 | cpp | #include<climits>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<iostream>
#include <sstream>
using namespace std;
#define LOOP(i,s,n) for(int i=(s);i<(n);i++)
#define loop(i,n) for(int i=0;i<(n);i++)
#define MAX(mVal, oVal) (mVal) = max((mVal),(oVal))
#define MIN(mVal, oVal) (mVal) = min((mVal),(oVal))
#define All(c) (c).begin(),(c).end()
#define ZERO(arr) memset(arr,0,sizeof(arr))
#define FILL(arr,val) memset(arr,val,sizeof(arr))
#define vi vector<int>
#define vii vector<int,int>
#define vl vector<long>
#define vll vector<long,long>
#define vd vector<double>
#define vdd vector<double,double>
#define vs vector<string>
#define vb vector<bool>
#define mp make_pair
#define pb push_back
#define MOD 1000000007
#define _N 100
int dp[_N][_N];
int main()
{
int X;
cin>>X;
int val; vi a;
loop(i,X)
{
cin>>val;
a.pb(val);
}
sort(All(a));
long long i=0, c=0, c2=0;
while(i<X && a[0]==a[i]){ i++;c++;}
i=X-1;
if(c!=X) while(a[X-1]==a[i]){ i--;c2++;}
else {c2=1; c=X*(X-1); c/=2;}
cout<<a[X-1]-a[0]<<" ";
cout<<c*c2;
return 0;
} | [
"faijur@gmail.com"
] | faijur@gmail.com |
7dd0c77b3b75151ed4fb5fcaf67f30e59f283145 | 2cf838b54b556987cfc49f42935f8aa7563ea1f4 | /aws-cpp-sdk-securityhub/include/aws/securityhub/model/AwsDynamoDbTableStreamSpecification.h | 1786ff648bf8b1ba2d51586ba92bcc80a9912113 | [
"MIT",
"Apache-2.0",
"JSON"
] | permissive | QPC-database/aws-sdk-cpp | d11e9f0ff6958c64e793c87a49f1e034813dac32 | 9f83105f7e07fe04380232981ab073c247d6fc85 | refs/heads/main | 2023-06-14T17:41:04.817304 | 2021-07-09T20:28:20 | 2021-07-09T20:28:20 | 384,714,703 | 1 | 0 | Apache-2.0 | 2021-07-10T14:16:41 | 2021-07-10T14:16:41 | null | UTF-8 | C++ | false | false | 3,649 | h | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/securityhub/SecurityHub_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace SecurityHub
{
namespace Model
{
/**
* <p>The current DynamoDB Streams configuration for the table.</p><p><h3>See
* Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/securityhub-2018-10-26/AwsDynamoDbTableStreamSpecification">AWS
* API Reference</a></p>
*/
class AWS_SECURITYHUB_API AwsDynamoDbTableStreamSpecification
{
public:
AwsDynamoDbTableStreamSpecification();
AwsDynamoDbTableStreamSpecification(Aws::Utils::Json::JsonView jsonValue);
AwsDynamoDbTableStreamSpecification& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>Indicates whether DynamoDB Streams is enabled on the table.</p>
*/
inline bool GetStreamEnabled() const{ return m_streamEnabled; }
/**
* <p>Indicates whether DynamoDB Streams is enabled on the table.</p>
*/
inline bool StreamEnabledHasBeenSet() const { return m_streamEnabledHasBeenSet; }
/**
* <p>Indicates whether DynamoDB Streams is enabled on the table.</p>
*/
inline void SetStreamEnabled(bool value) { m_streamEnabledHasBeenSet = true; m_streamEnabled = value; }
/**
* <p>Indicates whether DynamoDB Streams is enabled on the table.</p>
*/
inline AwsDynamoDbTableStreamSpecification& WithStreamEnabled(bool value) { SetStreamEnabled(value); return *this;}
/**
* <p>Determines the information that is written to the table.</p>
*/
inline const Aws::String& GetStreamViewType() const{ return m_streamViewType; }
/**
* <p>Determines the information that is written to the table.</p>
*/
inline bool StreamViewTypeHasBeenSet() const { return m_streamViewTypeHasBeenSet; }
/**
* <p>Determines the information that is written to the table.</p>
*/
inline void SetStreamViewType(const Aws::String& value) { m_streamViewTypeHasBeenSet = true; m_streamViewType = value; }
/**
* <p>Determines the information that is written to the table.</p>
*/
inline void SetStreamViewType(Aws::String&& value) { m_streamViewTypeHasBeenSet = true; m_streamViewType = std::move(value); }
/**
* <p>Determines the information that is written to the table.</p>
*/
inline void SetStreamViewType(const char* value) { m_streamViewTypeHasBeenSet = true; m_streamViewType.assign(value); }
/**
* <p>Determines the information that is written to the table.</p>
*/
inline AwsDynamoDbTableStreamSpecification& WithStreamViewType(const Aws::String& value) { SetStreamViewType(value); return *this;}
/**
* <p>Determines the information that is written to the table.</p>
*/
inline AwsDynamoDbTableStreamSpecification& WithStreamViewType(Aws::String&& value) { SetStreamViewType(std::move(value)); return *this;}
/**
* <p>Determines the information that is written to the table.</p>
*/
inline AwsDynamoDbTableStreamSpecification& WithStreamViewType(const char* value) { SetStreamViewType(value); return *this;}
private:
bool m_streamEnabled;
bool m_streamEnabledHasBeenSet;
Aws::String m_streamViewType;
bool m_streamViewTypeHasBeenSet;
};
} // namespace Model
} // namespace SecurityHub
} // namespace Aws
| [
"aws-sdk-cpp-automation@github.com"
] | aws-sdk-cpp-automation@github.com |
dc9464b32a6ca046df0c621d21256c96c352619a | 7701e62e2250af8534d0aba47b1313419d4e022e | /src/usr/include/string.tcc | 0afa2bdf4ae1f4b7bd0f5bd37df407573c460af0 | [
"Apache-2.0"
] | permissive | reymontero/FuzzyOS | 579bc3de49eb345d026c3ef75af3e3451f70b3e5 | 95a3d5c472c9f94bfd8a66d0d53ed0788dfa9dc2 | refs/heads/master | 2023-08-22T11:20:34.837095 | 2021-10-25T11:00:54 | 2021-10-25T11:00:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,217 | tcc | #pragma once
// This is internal headerfile to be included by string.h only
#include <string.h>
namespace std {
template <typename CharT>
basic_string<CharT>::basic_string() : _data(1, '\0') {}
template <typename CharT>
basic_string<CharT>::basic_string(std::size_t n, CharT c) : _data(n + 1, c) {
this->_data[n] = '\0';
}
template <typename CharT>
basic_string<CharT>::basic_string(const CharT *str)
: _data(std::strlen(str) + 1, '\0') {
for (std::size_t i = 0; i < this->_data.size(); i++) {
this->_data[i] = str[i];
}
}
template <typename CharT>
basic_string<CharT>::basic_string(const CharT *str, std::size_t n)
: _data(n + 1, '\0') {
int str_n = std::strlen(str);
for (std::size_t i = 0; i < n && i < str_n; i++) {
this->_data[i] = str[i];
}
}
template <typename CharT>
basic_string<CharT>::basic_string(const basic_string<CharT> &o)
: _data(o._data) {}
template <typename CharT>
typename basic_string<CharT>::iterator basic_string<CharT>::begin() {
return this->_data.begin();
}
template <typename CharT>
typename basic_string<CharT>::iterator basic_string<CharT>::end() {
return this->_data.end() - 1;
}
template <typename CharT>
typename basic_string<CharT>::const_iterator
basic_string<CharT>::begin() const {
return this->_data.begin();
}
template <typename CharT>
typename basic_string<CharT>::const_iterator basic_string<CharT>::end() const {
return this->_data.end() - 1;
}
template <typename CharT> void basic_string<CharT>::clear() {
this->_data.clear();
this->_data.push_back('\0');
}
template <typename CharT> void basic_string<CharT>::pop_back() {
if (this->_data.size() > 1) {
this->_data.pop_back();
this->_data.last() = '\0';
}
}
template <typename CharT> CharT &basic_string<CharT>::back() {
return this->_data.at(this->_data.size() - 2);
}
template <typename CharT> CharT &basic_string<CharT>::front() {
return this->_data.at(0);
}
template <typename CharT> CharT &basic_string<CharT>::at(std::size_t pos) {
return this->_data.at(pos);
}
template <typename CharT>
CharT &basic_string<CharT>::operator[](std::size_t pos) {
return this->_data[pos];
}
template <typename CharT> const CharT *basic_string<CharT>::c_str() const {
return this->_data.begin();
}
template <typename CharT> std::size_t basic_string<CharT>::length() const {
std::size_t sz = this->_data.size();
if (sz == 0) {
return 0; // should not happen
}
return sz - 1;
}
template <typename CharT> bool basic_string<CharT>::empty() const {
return (this->_data.size() <= 1);
}
template <typename CharT>
std::size_t basic_string<CharT>::find(char c, std::size_t pos) const {
std::size_t len = length();
while (pos < len) {
if (this->_data[pos] == c) {
return pos;
}
pos++;
}
return npos;
}
template <typename CharT>
basic_string<CharT> basic_string<CharT>::substr(int start, std::size_t len) {
std::string sub;
int index = start;
int str_length = length();
for (std::size_t i = 0; i < len && index < str_length; i++, index++) {
sub += this->at(index);
}
return sub;
}
template <typename CharT>
basic_string<CharT> &
basic_string<CharT>::operator=(const basic_string<CharT> &o) {
this->_data = o._data;
return *this;
}
template <typename CharT>
basic_string<CharT> &basic_string<CharT>::operator+=(const CharT c) {
this->_data.back() = c; // replace null character
this->_data.push_back('\0'); // add null character
return *this;
}
template <typename CharT>
basic_string<CharT> &basic_string<CharT>::operator+=(const CharT *o) {
this->_data.pop_back(); // remove null character
while ((*o)) {
this->_data.push_back(*(o++));
}
this->_data.push_back('\0'); // add null character
return *this;
}
template <typename CharT>
basic_string<CharT> &
basic_string<CharT>::operator+=(const basic_string<CharT> &o) {
this->_data.pop_back(); // remove null character
for (const CharT &c : o) {
this->_data.push_back(c);
}
this->_data.push_back('\0'); // add null character
return *this;
}
} // namespace std
| [
"gagan1kumar.cs@gmail.com"
] | gagan1kumar.cs@gmail.com |
e3354f342c8a570252b171f57a687ac036311e79 | 1c9be33c2603c3bfcbd3669872c6dbb5493de6f8 | /src/extract_sub_kmers_good.cpp | d8f1f077567f79494fc1dbf0fde96e67ac2dcf0a | [] | no_license | orzuk/bioinformatics-utilities | f67e4f2d41d511cb9a25058152fbd7022e07afee | 87bafed6beb1c67b590d802ffb6fcb6eb25bbd7b | refs/heads/master | 2020-05-18T16:19:29.110072 | 2014-06-07T06:50:08 | 2014-06-07T06:50:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,569 | cpp | #include <stdlib.h>
#include <stdio.h>
//#include <iostream.h>
#include <time.h>
#include <math.h>
#include <string.h>
#include <matrix.h>
#include <limits.h>
#include "matrix.h"
#include "mex.h"
#include "general.h"
#include "hmm_chrom_funcs.h"
#include "dna_utils_new.h"
#include "markov.h"
#include "uthash.h" // New! hash table (is this causing us all our memory problems???)
#undef uthash_expand_fyi
#define uthash_expand_fyi(tbl) printf("expanded to %d buckets\n", tbl->num_buckets)
// Hash table structures
struct SeqData {
int seqpos;
word seq[MAX_L]; /* need to set the right length */
UT_hash_handle hh; /* makes this structure hashable */
int rand_int; /* temp for debug */
};
struct SeqData *hTable=NULL;
///////////////////////////////////////////////////////////////////////////////////////
/// Divide a set of sequences to kmers
///////////////////////////////////////////////////////////////////////////////////////
//#undef MEX_TO_MATLAB
//#ifdef MEX_TO_MATLAB
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
// printf("REALLY Start mex function\n");
// fflush(stdout);
int nRows, nCols, i, j, K;
long L;
word **seqs;
long *seqs_lens; // New : There may be different sequences lengths
long num_seqs;
// long seqs_len;
// word **kmers; // output kmers
double *in, *inn, *out;
word *in_w, *out_w;
long total_num_kmers = 0;
long kmer_length_in_words;
long unique_flag=0; // do we want unique kmers (and keep their indices)
long num_unique_kmers, num_sparse_matrix_elements;
long hash_flag; // = 1;
long half_word_size = 4*sizeof(word); // half word size in bits (=word size in nucleotides)
long word_size = 2*half_word_size;
long num_coordinates; // counts number of output coordinates
long *kmer_position_inds;
long *kmer_seq_inds; // = new long[total_num_kmers];
long input_position_flag=0; // flag saying
long debug_prints=0;
/**
printf("Start mex function\n");
fflush(stdout);
printf("Size of Word=%ld (bits), Size of long=%ld\n", 8*sizeof(word), 8*sizeof(long)); // print size in bits
fflush(stdout);
**/
/************************************************* Read Input **********************************************************************/
/* Check for proper number of arguments. Should be five 5 (last one is double flag) */
/* Input variables are: pwms, seqs, seqs_lens, -10, is_double */
if(nrhs < 5) {
mexErrMsgTxt("Usage: [seqs_packed], [lens], [K], [unique-flag], [hash-flag]");
}
// (word *)(mxGetPr(prhs[0])); // Get the sequences matrix (in packed form)
in = mxGetPr(prhs[2]); // Get the kmer length (L)
L = in[0];
in = mxGetPr(prhs[3]); // Get the unique flag
unique_flag = in[0];
in = mxGetPr(prhs[4]); // Get the hash flag
hash_flag = in[0];
num_seqs = mxGetM(prhs[0]); // Get number of different sequences (genes)
in_w = (word *)(mxCalloc(num_seqs, sizeof(word))); // allocate memory to read seqs
seqs_lens = new long[num_seqs]; // allocate the lengths array
inn = mxGetPr(prhs[1]); // Get the sequences original lengths in nucleotides (not packed ..)
// seqs_len = (long)(inn[0]); // Give to the function the original lengths (pointer?)
long num_seq_lens = MAX(mxGetM(prhs[1]), mxGetN(prhs[1])); // Get number of different lengths
for(i = 0; i < num_seqs; i++)
{
if(num_seq_lens>1) // read different lengths
seqs_lens[i] = inn[i]; // different seqs_len;
else // All genes are assumed to have the same length
seqs_lens[i] = inn[0]; // all are the same length
total_num_kmers += (seqs_lens[i]-L+1); // don't take from sequences ends
// printf("Current seq-len=%ld, total=%ld, L=%ld num_lens=%ld\n", seqs_lens[i], total_num_kmers, L, num_seq_lens);
// fflush(stdout);
}
// if ( mxIsUint32(prhs[0]) != 1)
// mexErrMsgTxt("Input must be a 32-bit integer!!! ");
if(nrhs > 5) // here we get also input coordinates
{
input_position_flag=1; // here we pick the positions where we extract the kmers
in = mxGetPr(prhs[5]); // Get the kmer length (L)
num_coordinates = MAX(mxGetM(prhs[5]), mxGetN(prhs[5]));
total_num_kmers = num_coordinates;
}
else
num_coordinates = 1;
// printf("Obtaining %ld coordinates, %ld total kmers\n", num_coordinates, total_num_kmers);
// fflush(stdout);
kmer_seq_inds = new long[total_num_kmers];
// if(!input_position_flag)
// kmer_seq_inds = new long[total_num_kmers];
kmer_position_inds = new long[num_coordinates];
if(nrhs > 5) // here we get also input coordinates
{
for(i=0; i<num_coordinates; i++)
kmer_seq_inds[i] = in[i]-1; // subtract one (matlab->c)
in = mxGetPr(prhs[6]); // Get the kmer length (L)
for(i=0; i<num_coordinates; i++)
kmer_position_inds[i] = in[i]-1; // subtract one (matlab->c)
}
if(debug_prints)
{
printf("Allocate seqs lengths %ld\n", num_seqs);
fflush(stdout);
}
// printf("Inputs: kmer-length=%ld, unique-flag=%ld, hash-flag=%ld\n", L, unique_flag, hash_flag);
// fflush(stdout);
// printf("Allocating %ld\n", total_num_kmers);
// fflush(stdout);
word **kmers = new word*[total_num_kmers]; // word **kmers = (word **) mxMalloc( total_num_kmers * sizeof(double));
// printf("Allocated main array kmers %ld\n", total_num_kmers);
// fflush(stdout);
long *kmer_kmer_inds = new long[total_num_kmers];
// printf("Allocated main array indices %ld\n", total_num_kmers);
// fflush(stdout);
// printf("THE SEQS LEN IS : %ld\n", seqs_lens[0]);
// fflush(stdout);
in_w = (word *)(mxGetData(prhs[0])); // Get the sequences matrix (in packed form)
seqs = new word*[num_seqs]; // read input sequences
for(i = 0; i < num_seqs; i++)
{
seqs[i] = new word[seqs_lens[i]]; // allocate memory for every sequence
for(j = 0; j < (seqs_lens[i]-1)/half_word_size+1; j++)
seqs[i][j] = in_w[j*num_seqs + i]; // Copy the sequences matrix (Note that they should be packed for now !!!)
}
// print to see that input came right
if(debug_prints)
{
printf("Print input DNA: First Seq=%ld \n", seqs[0][0]);
for(i=0; i<num_seqs; i++)
print_packed_dna(seqs[i], seqs_lens[i], 1);
fflush(stdout);
}
/************************************************* Finished Read Input ***************************************************************/
kmer_length_in_words = ceil(double(L)/double(half_word_size));
// printf("kmer length in words =%ld\n", kmer_length_in_words);
for(i = 0; i < total_num_kmers; i++)
kmers[i] = new word[kmer_length_in_words]; // (word *) mxMalloc( kmer_length_in_words * sizeof(word));
// *intersect_start_pos = (double *) mxMalloc( (n1+n2) * sizeof(double));
/*
kmers = new word*[total_num_kmers]; // this may be too much - what to do? allocate on the fly?
for(i = 0; i < total_num_kmers; i++)
kmers[i] = new word[kmer_length_in_words];
*/
// printf("L is %d, num_seqs %d, seqs_len %d, total_kmers %d kmer-in-word %d unique_flag %ld\n",
// L, num_seqs, seqs_len, total_num_kmers, kmer_length_in_words, unique_flag);
// printf("Extract sub-kmers\n");
// fflush(stdout);
// if(input_position_flag)
// return;
// else
extract_sub_kmers(L, seqs, seqs_lens, num_seqs, unique_flag,
kmers, kmer_kmer_inds, kmer_seq_inds, kmer_position_inds, &num_unique_kmers,
&num_sparse_matrix_elements, hash_flag, input_position_flag, num_coordinates);
/*
for(i=0; i<num_seqs; i++)
for(j=0; j<5; j++)
printf("original word = %lu\n", seqs[i][j]);
*/
// free memory
for(i=0; i<num_seqs; i++)
delete seqs[i];
delete seqs;
delete seqs_lens;
mwSize mw_total_num_kmers = total_num_kmers;
mwSize mw_kmer_length_in_words = kmer_length_in_words;
/*
for(i=0; i<total_num_kmers; i++)
for(j=0; j<kmer_length_in_words; j++)
printf("%ld\n", kmers[i][j]);
*/
// mwSize mw_dims[2];
// mw_dims[0] = mw_total_num_kmers; mw_dims[1] = mw_kmer_length_in_words;
if(debug_prints)
{
printf("Num. unique kmers=%ld \n", num_unique_kmers);
fflush(stdout);
}
long return_double = 0;
if(return_double)
{
plhs[0] = mxCreateDoubleMatrix(num_unique_kmers, mw_kmer_length_in_words, mxREAL); // plhs[0] = mxCreateNumericArray(2, mw_dims, mxUINT32_CLASS, mxREAL);
out = mxGetPr(plhs[0]); // output the scores array
for(i=0; i<num_unique_kmers; i++)
for(j=0; j<kmer_length_in_words; j++)
out[i+j*num_unique_kmers] = double(kmers[i][j]); // copy kmers array to output // 0*j*total_num_kmers+
}
else // here return integers
{
// printf("Create Output Matrix[%ld,%ld] \n",num_unique_kmers, mw_kmer_length_in_words);
// fflush(stdout);
if(word_size == 32)
plhs[0] = mxCreateNumericMatrix(num_unique_kmers,mw_kmer_length_in_words, mxUINT32_CLASS, mxREAL);
else
plhs[0] = mxCreateNumericMatrix(num_unique_kmers,mw_kmer_length_in_words, mxUINT64_CLASS, mxREAL);
// printf("Copy to Output Matrix[%ld,%ld] \n",num_unique_kmers, mw_kmer_length_in_words);
// fflush(stdout);
out_w = (word *)(mxGetData(plhs[0]));
for(i=0; i<num_unique_kmers; i++)
{
// printf("Copy kmer %ld\n", i);
for(j=0; j<kmer_length_in_words; j++)
out_w[i+j*num_unique_kmers] = (kmers[i][j]); // copy kmers array to output // 0*j*total_num_kmers+
}
}
for(i = 0; i < total_num_kmers; i++)
delete kmers[i];
delete kmers; // mxFree(kmers);
// printf("one Shift 32 is: %lu, and %lu\n", 1UL << 32, 143241231 + (1UL << 32));
plhs[1] = mxCreateDoubleMatrix(num_sparse_matrix_elements, 2, mxREAL); // plhs[1] = mxCreateNumericMatrix(total_num_kmers, 1, mxINT32_CLASS, mxREAL);
out = mxGetPr(plhs[1]); // output the scores array
for(i=0; i<num_sparse_matrix_elements; i++)
{
// for(j=0; j<2; j++)
out[i+0] = double(kmer_kmer_inds[i]+1); // copy scores array to output. add 1 (indices in matlab start at 1)
out[i+num_sparse_matrix_elements] = double(kmer_seq_inds[i]+1); // copy scores array to output. add 1 (indices in matlab start at 1)
}
// for(i = 0; i < total_num_kmers; i++)
// delete kmer_inds[i];
delete kmer_kmer_inds;
delete kmer_seq_inds;
delete kmer_position_inds;
// for(i=0; 0<1; i++) // infinite loop
// j=i; // sleep(1000);
}
//#endif // MEX_TO_MATLAB
// free hash memory
void delete_all() {
struct SeqData *current_user, *tmp;
HASH_ITER(hh, hTable, current_user, tmp) {
HASH_DEL(hTable,current_user); /* delete; users advances to next */
free(current_user); /* optional- if you want to free */
}
}
//
//
////////////////////////////////////////////
//
// function : extract_sub_kmers
//
// input : L - length of kmers to extract (in nucleotides)
// seqs - array of sequences (packed form 2-dimensional array)
// seqs_lens - array of sequences lengths (num. of nucleotides in each sequence)
// hash_flag - do we use hash in program? (currently always use hash)
//
//
// output : kmers - array of unique kmers (in packed form 2-dim array)
// kmer_kmer_inds - array of indices for each kmer. Index in the list of unique kmers
// kmer_seq_inds - array of indices for each kmer. Index is in the list of sequences (species)
// kmer_position_inds - array of indices for each kmer. Index is the position in the sequences (in each species)
// num_unique_kmers - total number of unique kmers
// num_sparse_matrix_elements - total number of (non-unique) kmers to be used in sparse matrix
//
// purpose : Scan sequences and extract all subsequences of length L.
// Use a hash table to speed the process.
//
//
////////////////////////////////////////////
long extract_sub_kmers(long L, word *seqs[MAX_NUM_SEQS], long *seqs_lens, long num_seqs, long unique_flag,
word *kmers[MAX_L], long *kmer_kmer_inds, long *kmer_seq_inds, long *kmer_position_inds,
long *num_unique_kmers, long *num_sparse_matrix_elements, long hash_flag,
long input_position_flag, long num_coordinates)
{
long i, j, k;
long i_seq, j_position;
long num_kmers_enum;
long half_word_size = 4*sizeof(word);
long word_size = 2*half_word_size;
long num_words_in_kmer = ceil(double(L) / double(half_word_size));
long num_bytes_in_kmer = ceil(double(L) / 4.0); // temp - a bit wasteful but easier to make sure it's correct
long num_bytes_in_kmer_ceil = 4 * ceil(double(L) / 16.0); // temp - a bit wasteful but easier to make sure it's correct
long last_word_in_kmer = (L-1)%half_word_size+1;
long kmer_ctr=0; // count which unique kmer are we at
long index_ctr=0; // count which index are we at the sequence (non-unique kmer)
struct SeqData *found_hash_ptr;
struct SeqData *temp_ptr;
long current_idx_in_hash;
word current_kmer[MAX_L]; // save one kmer
long debug_prints = 0;
long rand_int2;
long add_int = 0;
word ones_mask;
if(word_size == 32)
ones_mask = 0xFFFFFFFF;
else // assume it's 64
ones_mask = 0xFFFFFFFFFFFFFFFF;
if(debug_prints)
{
printf("ONES_MASK=%lx\n", ones_mask);
printf("ONES_MASK_DEC=%lu\n", ones_mask);
printf("SIZEOFLONG=%ld (bits)\n", 8*sizeof(long));
printf("kmer_len=%ld, Num. Words in kmer=%ld, num. bytes=%ld\n", L, num_words_in_kmer, num_bytes_in_kmer);
}
long num_seqs_enum = num_seqs;
// printf("Input positions = %ld\n", input_position_flag);
if(input_position_flag)
{
num_seqs_enum = num_coordinates;
if(debug_prints)
{
for(i=0; i<num_coordinates; i++)
printf("Pos %ld=%ld\n", i, kmer_position_inds[i]);
printf("Run on %ld Sequences\n", num_seqs_enum);
for(i = 0; i < num_seqs_enum; i++) // loop on all sequences
{
printf("Before loop position ind %ld= %ld\n", i, kmer_position_inds[i]);
fflush(stdout);
}
}
}
for(i = 0; i < num_seqs_enum; i++) // loop on all sequences
{
if(debug_prints)
{
printf("Run on seq %ld\n", i);
fflush(stdout);
}
if(input_position_flag)
{
i_seq = kmer_seq_inds[i];
num_kmers_enum = 1;
}
else
{
i_seq = i;
num_kmers_enum = seqs_lens[i]-L+1;
}
if(debug_prints)
{ printf("Cur seq ind: %ld\n", i_seq);
fflush(stdout);
}
for(j = 0; j < num_kmers_enum; j++) // loop on all possible kmers in a sequence
{
if(input_position_flag)
{
j_position = kmer_position_inds[i];
// printf("Cur position ind: %ld\n", j_position);
// fflush(stdout);
}
else
j_position = j;
// printf("Use words: %lu %lu, kmer_ctr=%ld \n", seqs[i][j/half_word_size], seqs[i][j/half_word_size+1], kmer_ctr);
for(k = 0; k < num_words_in_kmer; k++) // full words (get 16 nucleotides each time)
{
// printf("run word %ld, i_seq=%ld, j_position=%ld, ind_read=(%ld,%ld,%ld)", k, i_seq,
// j_position, j_position/half_word_size+k, j_position/half_word_size+1+k);
// fflush(stdout);
current_kmer[k] = ((seqs[i_seq][j_position/half_word_size+k] >> (2*(j_position%half_word_size)))&ones_mask) +
(((seqs[i_seq][j_position/half_word_size+1+k]&((1UL << (2*(j_position%half_word_size)))-1)) <<
(2*(half_word_size-(j_position%half_word_size))))&ones_mask); // merge two half words from both adjacent words
// printf(" word_kmer=%ld, ", current_kmer[k]);
// fflush(stdout);
// printf("LAST WORD LEN = %ld\n", last_word_in_kmer);
if((k == num_words_in_kmer-1) && (last_word_in_kmer < half_word_size))
{
current_kmer[k] = current_kmer[k]&((1UL << (2*last_word_in_kmer))-1); // take only L nucleotides from last word
// printf(" Last Word!!!\n");
// fflush(stdout);
}
// kmers[kmer_ctr][k] = kmers[kmer_ctr][k]&((1UL << (2*last_word_in_kmer))-1); // take only L nucleotides
}
if(debug_prints)
{
printf("Extracted Kmer: (L=%ld)\n", L);
print_packed_dna(current_kmer, L, 1); // print extracted kmer
fflush(stdout);
}
if( (!unique_flag) || (!hash_flag) ) // here we just concatenate
{
if(debug_prints)
{
printf("Problem! Not Unique!\n");
fflush(stdout);
printf("seq kmer[%ld]=%ld\n", kmer_ctr, i_seq);
fflush(stdout);
printf("index_ctr=%ld\n", index_ctr);
fflush(stdout);
printf("num_bytes_to_copy=%ld\n", num_bytes_in_kmer_ceil);
fflush(stdout);
}
kmer_kmer_inds[index_ctr] = kmer_ctr; // index where kmer is in the list of all kmers
kmer_seq_inds[index_ctr++] = i_seq; // index of species for this kmer
memcpy(kmers[kmer_ctr++], current_kmer, num_bytes_in_kmer_ceil); // copy kmer into output list
// printf("EEExtracted Kmer: (L=%ld)\n", L);
// print_packed_dna(current_kmer, L, 1); // print extracted kmer
// fflush(stdout);
/**
if(problematic_kmer) // print kmer again
{
printf("Put prob. kmer in list place=%ld: \n", kmer_ctr);
print_packed_dna(kmers[kmer_ctr-1], 32, 1);
}
**/
// kmer_seq_inds[kmer_ctr++] = i_seq; // record which sequence did the kmer come from (there's only one index here) kmer_ctr++;
}
else // keep a unique list by using Hash
{
// if(debug_prints)
// {
// printf("Find in Hash!!!\n");
// fflush(stdout);
// }
if(add_int)
{
rand_int2 = rand();
HASH_FIND_INT(hTable, &rand_int2, found_hash_ptr);
}
else
HASH_FIND(hh, hTable, current_kmer, num_bytes_in_kmer, found_hash_ptr);
// found_hash_ptr = NULL;
// if(debug_prints)
// {
// printf("Find in Hash22222\n");
// fflush(stdout);
// }
if(found_hash_ptr == NULL) // found a new kmer
{
if(i%50 == 0)
{
if(debug_prints)
{
printf("Not found in Hash New ID=%ld, seq=%ld pos=%ld, kmer=%ld\n", kmer_ctr, i, j, current_kmer[0]);
fflush(stdout);
}
}
temp_ptr = (struct SeqData *) calloc(1,sizeof(struct SeqData));
memcpy(kmers[kmer_ctr], current_kmer, num_bytes_in_kmer); // copy kmer into output list
memcpy(temp_ptr->seq, current_kmer, num_bytes_in_kmer); // copy kmer into hash table
temp_ptr->seqpos = kmer_ctr; // copy index (what is this?)
if(add_int)
{
temp_ptr->rand_int = rand();
HASH_ADD_INT(hTable, rand_int, temp_ptr); // add value to Hash table
}
else
{
HASH_ADD(hh, hTable, seq, num_bytes_in_kmer, temp_ptr); // add value to Hash table
}
kmer_kmer_inds[index_ctr] = kmer_ctr++; // save index of this kmer in the kmers long list
}
else // kmer already appears in hash table. Just update indices
{
if(i%50 == 0)
{
if(debug_prints)
{
printf("Found in Hash Before, seq=%ld pos=%ld, kmer=%ld\n", i, j, current_kmer[0]);
fflush(stdout);
printf("Found in Hash OLD ID=%ld\n", found_hash_ptr->seqpos);
fflush(stdout);
}
}
kmer_kmer_inds[index_ctr] = found_hash_ptr->seqpos; // index where kmer was found in hash. save index of this kmer in the kmers long list
// if(debug_prints)
// {
// printf("Found Hash After\n");
// fflush(stdout);
// }
}
kmer_seq_inds[index_ctr++] = i_seq; // save index of species for this kmer
} // end if (non unique or non hash)
// printf("Ind: %ld\n", kmer_inds[kmer_ctr-1]);
// kmers[kmer_ctr][num_words_in_kmer-1] = // last word may be part
// seqs[i][j/HALF_WORD_SIZE+1+k]
}
}
/**/
if( (!hash_flag) && unique_flag ) // perform sort and unique
{
// printf("No hashing used \n");
// word *tmp_kmers;
// tmp_kmers = new word[kmer_ctr];
long *tmp_kmer_perm_indices;
tmp_kmer_perm_indices = new long[kmer_ctr];
long *kmer_keep_inds; kmer_keep_inds = new long[kmer_ctr];
if(debug_prints)
{
printf("Before QSort:\n");
for(i=0; i<10/*kmer_ctr*/; i++)
{
printf("\n i=%ld kmer= ", i);
for(j=0; j<num_words_in_kmer; j++)
printf(" %lu, ", kmers[i][j]);
}
}
/**
for(i=0; i<kmer_ctr; i++)
if(kmers[i][0] == 460002223925673672)
{
printf("Before Qsort Found KMER!! pos=%ld\n", i);
}
**/
DoQuicksort(kmers, kmer_ctr, num_words_in_kmer, num_bytes_in_kmer, tmp_kmer_perm_indices); // sort the ORIGINAL KMERS
/**
for(i=0; i<kmer_ctr; i++)
if(kmers[i][0] == 460002223925673672)
{
printf("Before Qsort Found KMER!! pos=%ld\n", i);
}
**/
if(debug_prints)
{
printf("\n\nAfter QSort:\n");
for(i=0; i<kmer_ctr; i++)
{
// printf("\n i=%ld kmer= ", i);
// for(j=0; j<num_words_in_kmer; j++)
// printf(" %lu, ", kmers[i][j]);
}
printf("LEN WORD USED=%ld\n", num_words_in_kmer);
}
// for(i=0; i<kmer_ctr; i++)
// printf("%ld\n", kmers[i][0]);
DoOrder(kmer_seq_inds, kmer_ctr, tmp_kmer_perm_indices);
delete tmp_kmer_perm_indices;
index_ctr = kmer_ctr;
kmer_ctr = -1; // first time this is incremented to zero
for(i=0; i<index_ctr; i++) // now run over all kmers and do unique
{
// printf("i=%ld kmer=%ld. ", i, tmp_kmers[i]);
if((i>0) && (!memcmp(kmers[i], kmers[i-1], num_bytes_in_kmer))) // same as previous
{
kmer_kmer_inds[i] = kmer_ctr; // index of this kmer in list of all kmers
// kmer_seq_inds[i] = tmp_kmer_inds[1][i]; // index of species for this kmer
if(debug_prints)
{
// printf("Same kmers again!!!!\n");
// fflush(stdout);
}
}
else // found a new value
{
kmer_ctr++;
kmer_keep_inds[kmer_ctr] = i;
// memcpy(kmers[kmer_ctr], kmers[i], num_bytes_in_kmer);
// kmers[kmer_ctr][0] = tmp_kmers[i]; // copy new value
kmer_kmer_inds[i] = kmer_ctr; // index of this kmer in list of all kmers
// kmer_inds[i][1] = tmp_kmer_inds[1][i]; // index of species for this kmer
if(debug_prints)
{
// printf("Incrementing kmers!!!!\n");
// fflush(stdout);
}
}
} // finish loop on all kmers
kmer_ctr++; // true number of found kmers
// printf("NUM UNIQUE KMERS IN EXTRACT FUNCTION: %ld\n", kmer_ctr);
for(i=0; i<kmer_ctr; i++) // copy again into same array
{
if(kmer_keep_inds[i] > i)
memcpy(kmers[i], kmers[kmer_keep_inds[i]], num_bytes_in_kmer);
}
delete kmer_keep_inds;
// DoUnique(kmers);
}
else
{
if(debug_prints)
{
if(hash_flag)
printf("Used hash \n");
else
printf("No unique needed \n");
}
}
/**/
/*
for(i=0; i<kmer_ctr; i++)
printf("kmer[%ld]=%lu\n", i, kmers[i][0]);
printf("Found %ld unique kmers\n", kmer_ctr);
*/
num_unique_kmers[0] = kmer_ctr;
num_sparse_matrix_elements[0] = index_ctr;
delete_all(); // free hash memory
if(hash_flag)
HASH_CLEAR(hh,hTable); // free memory
return 0;
} // end of function extract_sub_kmers
////////////// Temp /////////////////////
// len is in nucleotides
// print_mode: 1 - letters, 0 - just numbers
void print_packed_dna(word *seqs, long len, long print_mode)
{
long i, j;
word tmp;
long half_word_size = 4*sizeof(word);
word ones_mask=0xF;
if(half_word_size == 32)
ones_mask = 0x1F;
for(i = 0; i < len; i++)
{
// printf("\nSeq[i/16]=%ld\n", seqs[i/16]);
tmp = seqs[i/half_word_size];
tmp = tmp >> (2*(i&ones_mask));
tmp = tmp&0x3;
tmp++;
// tmp = ((seqs[i/16] << (2* (i&0xF)))&0x3) + 1;
// tmp = ((seqs[i/16] >> ((i&0xF)*2))&0x3) + 1;
if(print_mode == 0)
printf("%lx ", tmp);
else
{
// printf("%lx ", tmp);
switch (tmp)
{
case 1:
printf("A"); break;
case 2:
printf("C"); break;
case 3:
printf("G"); break;
case 4:
printf("T"); break;
}
}
}
printf("\n");
}
| [
"oorzuk@gmail.com"
] | oorzuk@gmail.com |
2b4196a799697db9afd5fd85cc206eb43674583a | 7c64b971dc3c77d0bba887fce8846c933f944b84 | /Geometry/Geometry/Geometry.cpp | 2fe0cee914ade3d7ff5dd26d81b24fcc349c84e6 | [
"MIT"
] | permissive | NickwideN/Geometry | 097eab3fabb00c6830c770a5c6036b8cd465d598 | 84292d7f78396820ea7530324a4d0527f945502a | refs/heads/master | 2022-03-27T00:11:43.681097 | 2019-11-29T11:54:37 | 2019-11-29T11:54:37 | 127,684,285 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 34,823 | cpp | #include"Geometry.h"
#include<iostream>
#include<cstring> // strcmp
#include<cmath> // sqrt
#include<algorithm> // qsort
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Class Vector {};
Geometry::Vector::Vector() {
for (int i = 0; i < DIMENTION; ++i) {
this->coordinates[i] = default_value;
}
}
Geometry::Vector::Vector(const coordinate_t coor_0, const coordinate_t coor_1, const coordinate_t coor_2) {
coordinates[0] = coor_0;
if (1 < DIMENTION) {
this->coordinates[1] = coor_1;
}
if (2 < DIMENTION) {
this->coordinates[2] = coor_2;
}
for (int i = 3; i < DIMENTION; ++i) {
this->coordinates[i] = default_value;
}
}
Geometry::Vector::Vector(const Point & point_0, const Point & point_1) {
*this = point_1.radius_vector - point_0.radius_vector;
}
Geometry::Vector & Geometry::Vector::operator+=(const Vector & vector) {
for (int i = 0; i < DIMENTION; ++i) {
this->coordinates[i] += vector.coordinates[i];
}
return *this;
}
Geometry::Vector Geometry::operator + (const Vector & vector_0, const Vector & vector_1) {
Vector new_vector(vector_0);
return new_vector += vector_1;
}
Geometry::Vector & Geometry::Vector::operator -= (const Vector & vector){
return *this += -vector;
}
Geometry::Vector Geometry::operator - (const Vector & vector_0, const Vector & vector_1) {
Vector new_vector(vector_0);
return new_vector -= vector_1;
}
Geometry::Vector Geometry::Vector::operator + () const{
return *this;
}
Geometry::Vector Geometry::Vector::operator - () const{
Vector new_vector;
for (int i = 0; i < DIMENTION; ++i) {
new_vector[i] = -this->coordinates[i];
}
return new_vector;
}
Geometry::Vector & Geometry::Vector::operator *= (const scalar_t & coefficient) {
for (int i = 0; i < DIMENTION; ++i) {
this->coordinates[i] *= coefficient;
}
return *this;
}
Geometry::Vector Geometry::operator * (const Vector & vector, const scalar_t & coefficient) {
Vector new_vector(vector);
return new_vector *= coefficient;
}
Geometry::Vector & Geometry::Vector::operator /= (const scalar_t & coefficient) {
return *this *= 1 / coefficient;
}
Geometry::Vector Geometry::operator / (const Vector & vector, const scalar_t & coefficient) {
Vector new_vector(vector);
return new_vector /= coefficient;
}
Geometry::Vector Geometry::operator * (const scalar_t & coefficient, const Vector & vector) {
return vector * coefficient;
}
Geometry::Vector Geometry::operator / (const scalar_t & coefficient, const Vector & vector) {
return vector / coefficient;
}
Geometry::scalar_t Geometry::operator * (const Vector & vector_0, const Vector & vector_1) {
return scalar_product(vector_0, vector_1);
}
Geometry::scalar_t Geometry::scalar_product(const Vector & vector_0, const Vector & vector_1) {
scalar_t product = 0;
for (int i = 0; i < DIMENTION; ++i) {
product += vector_0[i] * vector_1[i];
}
return product;
}
Geometry::Vector Geometry::vector_product(const Vector & vector_0, const Vector & vector_1) {
if (DIMENTION != 3) {
throw "There is no opportunity to take vector product with DIMENTION != 3. For getting an area of parallelogram\
on the vectors use function \"skew_product(vector1, vector2)\"";
}
Vector new_vector;
new_vector[0] = vector_0[1] * vector_1[2] - vector_0[2] * vector_1[1];
new_vector[1] = -vector_0[0] * vector_1[2] + vector_0[2] * vector_1[0];
new_vector[2] = vector_0[0] * vector_1[1] - vector_0[1] * vector_1[0];
return new_vector;
}
Geometry::scalar_t Geometry::skew_product(const Vector & vector_0, const Vector & vector_1) {
// The solution is presented for DIMENTION == (2 & 3);
// TODO: insert solution for DIMENTION > 3;
if (!(DIMENTION == 2 || DIMENTION == 3)) {
throw "There is no opportunity to take an area with 1 >= DIMENTION >= 4 ";
}
if (DIMENTION == 2) {
return vector_0[0] * vector_1[1] - vector_0[1] * vector_1[0];
} else { // DIMENTION == 3
return abs(vector_product(vector_0, vector_1));
}
}
Geometry::Vector Geometry::normal_vector(const Vector & vector) {
if (DIMENTION != 2) {
throw "There is no opportunity to define normal vector to one vector if DIMENTION > 2";
}
return Vector(-vector[1], vector[0]);
}
Geometry::coordinate_t Geometry::Vector::operator[] (const int index) const {
if (index >= DIMENTION) {
throw "Attempt to take not exist coordinate of vector";
}
return this->coordinates[index];
}
Geometry::coordinate_t & Geometry::Vector::operator[] (const int index) {
if (index >= DIMENTION) {
throw "Attempt to take not exist coordinate of vector";
}
return this->coordinates[index];
}
Geometry::scalar_t Geometry::abs(const Vector & vector){
scalar_t abs = 0;
for (int i = 0; i < DIMENTION; ++i) {
abs += vector[i] * vector[i];
}
abs = sqrt(abs);
return abs;
}
double Geometry::sin(const Vector & vector_0, const Vector & vector_1) {
return (double(abs(skew_product(vector_0, vector_1))) / abs(vector_0) / abs(vector_1));
}
double Geometry::cos(const Vector & vector_0, const Vector & vector_1) {
return (double((vector_0 * vector_1)) / abs(vector_0) / abs(vector_1));
}
double Geometry::tan(const Vector & vector_0, const Vector & vector_1) {
return (double(sin(vector_0, vector_1)) / cos(vector_0, vector_1));
}
double Geometry::agl(const Vector & vector_0, const Vector & vector_1) {
return acos(cos(vector_0, vector_1));
}
bool Geometry::are_collinear(const Vector & vector_0, const Vector & vector_1) {
return (skew_product(vector_0, vector_1) == 0);
}
bool Geometry::are_coincident(const Vector & vector_0, const Vector & vector_1) {
bool are_coinc = true;
for (int i = 0; i < DIMENTION; ++i) {
if (vector_0[i] != vector_1[i]) {
are_coinc = false;
break;
}
}
return are_coinc;
}
bool Geometry::are_complanar(const Vector & vector_0, const Vector & vector_1, const Vector & vector_2) {
// The solution is presented for DIMENTION == 2;
// TODO: insert solution for DIMENTION > 2;
if (DIMENTION > 2) {
throw "There is no opportunity to do complanarity test with DIMENTION != 2";
}
return true;
}
bool Geometry::are_co_directed(const Vector & vector_0, const Vector & vector_1) {
if (are_collinear(vector_0, vector_1)) {
for (int i = 0; i < DIMENTION; ++i) {
if (vector_0[i] * vector_1[i] < 0) {
return false;
}
}
return true;
}
return false;
}
bool Geometry::Vector::is_zero() {
for (int i = 0; i < DIMENTION; ++i) {
if (this->coordinates[i]) {
return false;
}
}
return true;
}
std::ostream & Geometry::operator << (std::ostream & os, const Vector & vector) {
for (int i = 0; i < DIMENTION; ++i) {
os << vector[i] << " ";
}
return os;
}
std::istream & Geometry::operator >> (std::istream & is, Vector & vector) {
for (int i = 0; i < DIMENTION; ++i) {
is >> vector[i];
}
return is;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Class Point: public Shape {};
Geometry::Point::Point() :
radius_vector() {
}
Geometry::Point::Point(const coordinate_t & coor_0, const coordinate_t & coor_1) :
radius_vector(coor_0, coor_1) {
}
Geometry::Point::Point(const Vector radius_vector) :
radius_vector(radius_vector) {
}
Geometry::Point & Geometry::Point::move(const Vector & vector) {
this->radius_vector += vector;
return *this;
}
bool Geometry::Point::has_point(const Point & point) const {
return are_coincident(this->radius_vector, point.radius_vector);
}
bool Geometry::Point::has_intarsection_with(const Segment & segment) const {
return segment.has_point(*this);
}
Geometry::scalar_t Geometry::Point::distance_to(const Line & line) const {
Line parallel_line(*this, line.direction);
return distance_between(line, parallel_line);
}
Geometry::scalar_t Geometry::Point::distance_to(const Ray & ray) const {
if (scalar_product(ray.direction, Vector(ray.origin, *this)) < 0) {
return length(*this, ray.origin);
}
else {
return this->distance_to(Line(ray));
}
}
Geometry::scalar_t Geometry::Point::distance_to(const Segment & segment) const {
scalar_t sc_product_0 = scalar_product(Line(segment).direction, Vector(segment.point_0, *this));
scalar_t sc_product_1 = scalar_product(Line(segment).direction, Vector(segment.point_1, *this));
if (sc_product_0 * sc_product_1 <= 0) {
return this->distance_to(Line(segment));
}
else {
scalar_t distance_to_0 = length(*this, segment.point_0);
scalar_t distance_to_1 = length(*this, segment.point_1);
return (distance_to_0 < distance_to_1 ? distance_to_0 : distance_to_1);
}
}
bool Geometry::Point::operator == (const Point & other) const {
for (int i = 0; i < DIMENTION; ++i) {
if (this->radius_vector[i] != other.radius_vector[i]) {
return false;
}
}
return true;
}
Geometry::scalar_t Geometry::length(const Point & point_0, const Point & point_1) {
return abs(Vector(point_0, point_1));
}
std::ostream & Geometry::operator << (std::ostream & os, const Point & point) {
os << point.radius_vector;
return os;
}
std::istream & Geometry::operator >> (std::istream & is, Point & point) {
is >> point.radius_vector;
return is;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Class Segment: public Shape {};
Geometry::Segment::Segment() :
point_0(), point_1() {
}
Geometry::Segment::Segment(const Point & point_0, const Point & point_1) :
point_0(point_0), point_1(point_1) {
}
Geometry::Segment::Segment(const Point & origin, const Vector & direction, const scalar_t & length)
: point_0(origin) {
this->point_1 = origin.radius_vector + direction / abs(direction) * length;
}
Geometry::Segment & Geometry::Segment::move(const Vector & vector) {
this->point_0.move(vector);
this->point_1.move(vector);
return *this;
}
bool Geometry::Segment::has_point(const Point & point) const {
return are_co_directed(Vector(this->point_0, point), Vector(point, this->point_1));
}
bool Geometry::Segment::has_intarsection_with(const Segment & segment) const {
if (segment.is_point()) {
return this->has_point(segment.point_0);
}
if (this->is_point()) {
return segment.has_point(this->point_0);
}
if (are_coincident(Line(segment), Line(*this))) {
if (this->has_point(segment.point_0) || this->has_point(segment.point_1)) {
return true;
} else {
return false;
}
}
return Line(*this).has_intarsection_with(segment) && Line(segment).has_intarsection_with(*this);
}
bool Geometry::Segment::has_intarsection_with(const Ray & ray) const {
return ray.has_intarsection_with(*this);
}
bool Geometry::Segment::is_point() const {
return this->point_0 == this->point_1;
}
Geometry::scalar_t Geometry::length(const Segment & segment) {
return length(segment.point_0, segment.point_1);
}
Geometry::scalar_t Geometry::distance_between(const Segment & segment_0, const Segment & segment_1) {
if (segment_0.has_intarsection_with(segment_1)) {
return 0;
}
scalar_t distance[4] = { segment_0.point_0.distance_to(segment_1), segment_0.point_1.distance_to(segment_1),
segment_1.point_0.distance_to(segment_0), segment_1.point_1.distance_to(segment_0) };
scalar_t min_distance = distance[0];
for (int i = 1; i < 4; ++i) {
if (min_distance > distance[i]) {
min_distance = distance[i];
}
}
return min_distance;
}
std::ostream & Geometry::operator << (std::ostream & os, const Segment & segment) {
os << "point_0: " << segment.point_0 << " point_1: " << segment.point_1;
return os;
}
std::istream & Geometry::operator >> (std::istream & is, Segment & segmant) {
is >> segmant.point_0 >> segmant.point_1;
return is;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Class Line: public Shape {};
Geometry::Line::Line(const Point & point_0, const Point & point_1) :
origin(point_0), direction(Vector(point_0, point_1)) {
if (are_coincident(direction, Vector(0, 0))) {
throw "There is no opportunity to creat a line with direction == vector(0)";
}
}
Geometry::Line::Line(const Point & origin, const Vector & vector, const char * name_vector) :
origin(origin) {
if (!strcmp(name_vector, "direction")) {
this->direction = vector;
if (are_coincident(vector, Vector(0, 0))) {
throw "There is no opportunity to creat a line with direction == vector(0)";
}
} else if (!strcmp(name_vector, "normal")) {
if (DIMENTION == 2) {
this->direction = Vector(-vector[1], vector[0]);
if (are_coincident(vector, Vector(0, 0))) {
throw "There is no opportunity to creat a line with direction == vector(0)";
}
} else {
throw "There is no opportunity to do define normal vector for line with DIMENTION != 2";
}
} else {
throw "Not correct name of vector. You can choose names \"direction\" (default) or \"vector\"";
this->direction = vector;
}
}
Geometry::Line::Line(const coordinate_t & coefficient_of_x, const coordinate_t & coefficient_of_y, const coordinate_t & absolute_term) {
if (DIMENTION != 2) {
throw "There is no able to create line use equation Ax + By + C = 0 with DIMENTION != 2";
}
this->direction = Vector(-coefficient_of_y, coefficient_of_x);
if (are_coincident(this->direction, Vector(0, 0))) {
throw "There is no opportunity to creat a line with direction == vector(0)";
}
if (coefficient_of_y) {
origin = Point(0, -absolute_term / coefficient_of_y);
}
else {
origin = Point(-absolute_term / coefficient_of_x, 0);
}
}
Geometry::Line::Line(const Segment & segment) :
origin(segment.point_0),
direction(Vector(segment.point_0, segment.point_1)) {
if (are_coincident(this->direction, Vector(0, 0))) {
throw "There is no opportunity to creat a line with direction == vector(0)";
}
}
Geometry::Line::Line(const Ray & ray) :
origin(ray.origin), direction(ray.direction) {
}
Geometry::Line & Geometry::Line::move(const Vector & vector) {
this->origin.move(vector);
return *this;
}
bool Geometry::Line::has_point(const Point & point) const {
return are_collinear(direction, origin.radius_vector - point.radius_vector);
}
bool Geometry::Line::has_intarsection_with(const Segment & segment) const {
if (segment.is_point()) {
return this->has_point(segment.point_0);
}
if (are_skew(*this, Line(segment))) {
return false;
}
scalar_t area_0 = skew_product(Vector(segment.point_0, this->origin), this->direction);
scalar_t area_1 = skew_product(Vector(segment.point_1, this->origin), this->direction);
return area_0 * area_1 <= 0;
}
Geometry::Vector Geometry::Line::get_direction() const {
return this->direction;
}
bool Geometry::are_coincident(const Line & line_0, const Line & line_1) {
return are_parallel(line_0, line_1) &&
are_collinear(line_0.origin.radius_vector - line_1.origin.radius_vector, line_0.direction);
}
bool Geometry::are_parallel(const Line & line_0, const Line & line_1) {
return are_collinear(line_0.direction, line_1.direction);;
}
bool Geometry::are_intersecting(const Line & line_0, const Line & line_1){
return are_complanar(line_0.direction, line_1.direction, line_0.origin.radius_vector - line_1.origin.radius_vector) &&
!are_parallel(line_0, line_1);
}
bool Geometry::are_skew(const Line & line_0, const Line & line_1) {
return !are_complanar(line_0.direction, line_1.direction, line_0.origin.radius_vector - line_1.origin.radius_vector);
}
Geometry::Point Geometry::intersection(const Line & line_0, const Line & line_1) {
// The solution is presented for DIMENTION == 2;
// TODO: insert solution for DIMENTION > 2;
if (DIMENTION > 3) {
throw "There is no opportunity to find point of intersection for lines with DIMENTION != 2";
}
if (!are_intersecting(line_0, line_1)) {
throw "The lines are not intersecting";
}
// r_intersection = r_0 + at (t is coefficient, r_0 is origin, a is direction)
if (!(line_0.direction[0] * line_1.direction[1] - line_0.direction[1] * line_1.direction[0])) {
throw "Attempt of division by zero";
}
scalar_t coefficient = scalar_t(line_1.direction[0] * (line_0.origin.radius_vector[1] - line_1.origin.radius_vector[1])
- line_1.direction[1] * (line_0.origin.radius_vector[0] - line_1.origin.radius_vector[0])) /
(line_0.direction[0] * line_1.direction[1] - line_0.direction[1] * line_1.direction[0]);
return line_0.origin.radius_vector + line_0.direction * coefficient;
}
Geometry::scalar_t Geometry::distance_between(const Line & line_0, const Line & line_1) {
if (!are_parallel(line_0, line_1)) {
throw "The lines are not parallel";
}
return abs(skew_product(line_0.origin.radius_vector - line_1.origin.radius_vector, line_0.direction) / abs(line_0.direction));
}
std::ostream & Geometry::operator << (std::ostream & os, const Line & line) {
os << "origin: " << line.origin << " direction: " << line.direction;
return os;
}
std::istream & Geometry::operator >> (std::istream & is, Line & line) {
is >> line.origin >> line.direction;
return is;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Class Ray: public Shape {};
Geometry::Ray::Ray(const Point & origin, const Point & point_of_ray) :
origin(origin), direction(point_of_ray.radius_vector - origin.radius_vector) {
if (are_coincident(this->direction, Vector(0, 0))) {
throw "There is no opportunity to creat a segment with direction == vector(0)";
}
}
Geometry::Ray::Ray(const Point & origin, const Vector & direction) :
origin(origin), direction(direction) {
if (are_coincident(this->direction, Vector(0, 0))) {
throw "There is no opportunity to creat a segment with direction == vector(0)";
}
}
Geometry::Ray & Geometry::Ray::move(const Vector & vector) {
this->origin.move(vector);
return *this;
}
bool Geometry::Ray::has_point(const Point & point) const {
return ((Line(*this).has_point(point)) &&
(are_co_directed(this->direction, Vector(this->origin, point))));
}
bool Geometry::Ray::has_intarsection_with(const Segment & segment) const {
if (segment.is_point()) {
return this->has_point(segment.point_0);
}
if (!Line(*this).has_intarsection_with(segment)) {
return false;
}
Vector check_vector = Vector(this->origin, segment.point_0) + Vector(this->origin, segment.point_1);
if (scalar_product(check_vector, direction) < 0) {
return false;
}
return true;
}
std::ostream & Geometry::operator << (std::ostream & os, const Ray & ray) {
os << "origin: " << ray.origin << " direction :" << ray.direction;
return os;
}
std::istream & Geometry::operator >> (std::istream & is, Ray & ray) {
is >> ray.origin >> ray.direction;
return is;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//Class Polygon: public Shape {};
//private:
Geometry::Polygon & Geometry::Polygon::define_points_cnt(const int & number_of_points) {
this->points_cnt = number_of_points;
this->points = new Point[number_of_points];
return *this;
}
Geometry::Polygon & Geometry::Polygon::copy_points(const int & number_of_points, const Point * points) {
for (int i = 0; i < number_of_points; ++i) {
this->points[i] = points[i];
}
return *this;
}
//public:
Geometry::Polygon::Polygon() {
this->define_points_cnt(1);
this->points[0] = Point();
}
Geometry::Polygon::Polygon(const Polygon & other) {
this->define_points_cnt(other.points_cnt);
this->copy_points(this->points_cnt, other.points);
}
Geometry::Polygon::Polygon(Polygon && other) :
points_cnt(other.points_cnt), points(other.points) {
other.points_cnt = 0; other.points = 0;
}
Geometry::Polygon::Polygon(const int & number_of_points, const Point * points) {
this->define_points_cnt(number_of_points);
this->copy_points(number_of_points, points);
}
Geometry::Polygon::Polygon(const int number_of_points, Point point_0, ...) {
Point * pointer_point = &point_0;
this->define_points_cnt(number_of_points);
for (int i = 0; i < number_of_points; ++i) {
this->points[i] = *pointer_point;
++pointer_point;
}
}
Geometry::Polygon::Polygon(const int & number_of_points) {
this->define_points_cnt(number_of_points);
for (int i = 0; i < this->points_cnt; ++i) {
this->points[i] = Point();
}
}
Geometry::Polygon::~Polygon() {
delete[] this->points;
}
Geometry::Polygon & Geometry::Polygon::operator = (const Polygon & other) {
Point * tmp_points = new Point[other.points_cnt];
delete[] this->points;
this->points = tmp_points;
this->points_cnt = other.points_cnt;
this->copy_points(this->points_cnt, other.points);
return *this;
}
Geometry::Polygon & Geometry::Polygon::operator = (Polygon && other) {
delete[] this->points;
this->points = other.points;
this->points_cnt = other.points_cnt;
other.points = 0;
other.points_cnt = 0;
return *this;
}
Geometry::Polygon Geometry::Polygon::set_point_cnt(const int & point_cnt) {
Polygon new_polygon(point_cnt);
int min_point_cnt = (this->points_cnt < new_polygon.points_cnt ? this->points_cnt : new_polygon.points_cnt);
new_polygon.copy_points(min_point_cnt, this->points);
for (int i = min_point_cnt; i < new_polygon.points_cnt; ++i) {
new_polygon.points[i] = this->points[this->points_cnt - 1];
}
delete[] this->points;
return new_polygon;
}
Geometry::Polygon Geometry::Polygon::add_point(const Point & point) {
Polygon new_poligon(this->points_cnt + 1);
new_poligon.copy_points(this->points_cnt, this->points);
new_poligon.points[new_poligon.points_cnt - 1] = point;
delete[] this->points;
return new_poligon;
}
Geometry::Polygon Geometry::Polygon::remove_point() {
Polygon new_poligon(this->points_cnt - 1);
new_poligon.copy_points(this->points_cnt - 1, this->points);
delete[] this->points;
return new_poligon;
}
int Geometry::Polygon::get_points_cnt() const {
return this->points_cnt;
}
bool Geometry::Polygon::is_convex() const {
if (this->points_cnt < 4) {
return true;
}
if (this->is_star()) {
return false;
}
scalar_t check_product = skew_product(Vector(this->points[this->points_cnt - 1], this->points[0]),
Vector(this->points[0], this->points[1]));
int check_index = 0;
for (; check_index < this->points_cnt - 2 && check_product == 0; check_index++) {
check_product = skew_product(Vector(this->points[check_index], this->points[check_index + 1]),
Vector(this->points[check_index + 1], this->points[check_index + 2]));
}
if (!check_product) {
return true;
}
for (int i = check_index; i < this->points_cnt - 2; ++i) {
if ((check_product * skew_product(Vector(this->points[i], this->points[i + 1]),
Vector(this->points[i + 1], this->points[i + 2]))) < 0) {
return false;
}
}
if ((check_product * skew_product(Vector(this->points[this->points_cnt - 2], this->points[this->points_cnt - 1]),
Vector(this->points[this->points_cnt - 1], this->points[0]))) < 0) {
return false;
}
return true;
}
bool Geometry::Polygon::has_self_intersection() const {
if (this->points_cnt < 4) {
return false;
}
Segment * segments = new Segment[this->points_cnt];
for (int i = 0; i < this->points_cnt - 1; ++i) {
segments[i] = Segment(this->points[i], this->points[i + 1]);
}
segments[this->points_cnt - 1] = Segment(this->points[this->points_cnt - 1], this->points[0]);
for (int i = 0; i < this->points_cnt - 1; ++i) {
for (int j = i + 2; j < this->points_cnt; ++j) {
if (i == 0 && j == this->points_cnt - 1) {
continue;
}
if (segments[i].has_intarsection_with(segments[j])) {
delete[] segments;
return true;
}
}
}
delete[] segments;
return false;
}
bool Geometry::Polygon::is_star() const {
// check only necessary condition
if (this->points_cnt < 5) {
return false;
}
Segment * segments = new Segment[this->points_cnt];
for (int i = 0; i < this->points_cnt - 1; ++i) {
segments[i] = Segment(this->points[i], this->points[i + 1]);
}
segments[this->points_cnt - 1] = Segment(this->points[this->points_cnt - 1], this->points[0]);
for (int i = 2; i < this->points_cnt - 1; ++i) {
if (segments[0].has_intarsection_with(segments[i])) {
delete[] segments;
return true;
}
}
delete[] segments;
return false;
}
Geometry::area_t Geometry::area(const Polygon & polygon) {
scalar_t area = 0;
for (int i = 0; i < polygon.points_cnt - 1; ++i) {
area += skew_product(polygon.points[i].radius_vector, polygon.points[i + 1].radius_vector);
}
area += skew_product(polygon.points[polygon.points_cnt - 1].radius_vector, polygon.points[0].radius_vector);
return std::abs(area / 2);
}
int Geometry::origin_index(const Point * points, const int points_cnt) {
// origin_index -- index of point that is in down left corner of polygon
int origin_index = 0;
for (int i = 1; i < points_cnt; ++i) {
if (points[i].radius_vector[1] < points[origin_index].radius_vector[1]) {
origin_index = i;
}
if (points[i].radius_vector[1] == points[origin_index].radius_vector[1] &&
points[i].radius_vector[0] < points[origin_index].radius_vector[0]) {
origin_index = i;
}
}
return origin_index;
}
int Geometry::compare_vectors(const void * vector_ptr_0, const void * vector_ptr_1) {
if ((*(Vector*)vector_ptr_0).is_zero() && (*(Vector*)vector_ptr_1).is_zero()) {
std::cout << "vector(" << *(Vector*)vector_ptr_0 << ") is zero and vector(" << *(Vector*)vector_ptr_1 << ") is zero\n"; ////////////////////////////////////////
return 0;
}
if ((*(Vector*)vector_ptr_0).is_zero() && !((*(Vector*)vector_ptr_1).is_zero())) {
std::cout << "vector(" << *(Vector*)vector_ptr_0 << ") is zero and vector(" << *(Vector*)vector_ptr_1 << ") is not zero\n"; ////////////////////////////////////////
return -1;
}
if (!((*(Vector*)vector_ptr_0).is_zero()) && (*(Vector*)vector_ptr_1).is_zero()) {
std::cout << "vector(" << *(Vector*)vector_ptr_0 << ") is not zero and vector(" << *(Vector*)vector_ptr_1 << ") is zero\n"; ////////////////////////////////////////
return 1;
}
scalar_t skew_prod = skew_product(*(Vector*)vector_ptr_0, *(Vector*)vector_ptr_1);
if (skew_prod > 0) {
std::cout << "cos_vector(" << *(Vector*)vector_ptr_0 << ") > cos_vector( " << *(Vector*)vector_ptr_1 << "):\n"; ////////////////////////////////////////
return -1;
}
if (skew_prod == 0) {
std::cout << "cos_vector(" << *(Vector*)vector_ptr_0 << ") == cos_vector( "<< *(Vector*)vector_ptr_1 <<"):\n"; ////////////////////////////////////////
scalar_t abs_vector_0 = (*(Vector*)vector_ptr_0)[0] * (*(Vector*)vector_ptr_0)[0] + (*(Vector*)vector_ptr_0)[1] * (*(Vector*)vector_ptr_0)[1];
scalar_t abs_vector_1 = (*(Vector*)vector_ptr_1)[0] * (*(Vector*)vector_ptr_1)[0] + (*(Vector*)vector_ptr_1)[1] * (*(Vector*)vector_ptr_1)[1];
if (abs_vector_0 < abs_vector_1) {
std::cout << "\tabs(" << *(Vector*)vector_ptr_0 << ") < abs(" << *(Vector*)vector_ptr_1 << ")\n"; ////////////////////////////////////////
return -1;
}
if (abs_vector_0 == abs_vector_1) {
std::cout << "\tabs(" << *(Vector*)vector_ptr_0 << ") == abs(" << *(Vector*)vector_ptr_1 << ")\n"; ////////////////////////////////////////
return 0;
}
if (abs_vector_0 > abs_vector_1) {
std::cout << "\tabs(" << *(Vector*)vector_ptr_0 << ") > abs(" << *(Vector*)vector_ptr_1 << ")\n"; ////////////////////////////////////////
return 1;
}
}
if (skew_prod < 0) {
std::cout << "cos_vector(" << *(Vector*)vector_ptr_0 << ") < cos_vector( " << *(Vector*)vector_ptr_1 << "):\n"; ////////////////////////////////////////
return 1;
}
}
Geometry::Polygon Geometry::convex_hull(const Polygon & polygon) {
if (polygon.points_cnt < 2) {
return polygon;
}
// origin_index -- index of point that is in down left corner of polygon
int origin_index = Geometry::origin_index(polygon.points, polygon.points_cnt);
Vector * sorted_vectors = new Vector[polygon.points_cnt]; //vector(origin, point[i])
for (int i = 0; i < polygon.points_cnt; ++i) {
sorted_vectors[i] = Vector(polygon.points[origin_index], polygon.points[i]);
std::cout << "not_sorted_vector_" << i << " = " << sorted_vectors[i] << '\n';//////////////////////////////////////
}
qsort(sorted_vectors, polygon.points_cnt, sizeof(Vector), compare_vectors);
for (int i = 0; i < polygon.points_cnt; ++i) {
std::cout << "sorted_vector_" << i << " = " << sorted_vectors[i] << '\n';//////////////////////////////////////////////
}
Vector ** good_vectors = new Vector*[polygon.points_cnt];
good_vectors[0] = sorted_vectors;
Vector ** last_good_vector = good_vectors;
int good_vectors_cnt = 1;
Vector * curr_vector = sorted_vectors;
for (int i = 1; i < polygon.points_cnt; ++i) {
if (!sorted_vectors[i].is_zero()) {
curr_vector = sorted_vectors + i;
break;
}
}
Vector * next_vector = curr_vector + 1;
if (curr_vector->is_zero()) {
return Polygon(1, polygon.points[origin_index]);
}
while (next_vector != sorted_vectors + polygon.points_cnt) {
if (skew_product(*curr_vector - **last_good_vector,
*next_vector - *curr_vector) > 0) {
last_good_vector[1] = curr_vector;
++next_vector;
curr_vector = next_vector - 1;
++last_good_vector;
++good_vectors_cnt;
}
else {
if (last_good_vector == good_vectors) {
++next_vector;
curr_vector = next_vector - 1;
}
else {
--last_good_vector;
--good_vectors_cnt;
curr_vector = last_good_vector[1];
}
}
}
scalar_t tmp_skew_product = skew_product(*curr_vector - **last_good_vector,
sorted_vectors[0] - *curr_vector);
if (tmp_skew_product > 0 || (last_good_vector == good_vectors && tmp_skew_product == 0)) {
last_good_vector[1] = curr_vector;
++last_good_vector;
++good_vectors_cnt;
}
// we have good_ragius-vectors
Point * good_points = new Point[good_vectors_cnt];
for (int i = 0; i < good_vectors_cnt; ++i) {
good_points[i] = polygon.points[origin_index].radius_vector + good_vectors[i][0];
}
Polygon convex_hull(good_vectors_cnt, good_points);
delete[] good_vectors;
delete[] sorted_vectors;
delete[] good_points;
return convex_hull;
}
Geometry::Point Geometry::Polygon::operator [] (const int index) const {
return this->points[index];
}
Geometry::Point & Geometry::Polygon::operator [] (const int index) {
return this->points[index];
}
Geometry::Polygon & Geometry::Polygon::move(const Vector & vector) {
for (int i = 0; i < this->points_cnt; ++i) {
this->points[i].move(vector);
}
return *this;
}
bool Geometry::Polygon::has_point(const Point & point) const {
for (int i = 0; i < this->points_cnt; ++i) {
if (Segment(this->points[i], this->points[i + 1]).has_point(point)) {
return true;
}
}
if (Segment(this->points[this->points_cnt - 1], this->points[0]).has_point(point)) {
return true;
}
Ray check_ray(point, Vector(1000, 1));
bool ray_has_vertex = false;
do {
for (int i = 0; i < this->points_cnt; ++i) {
if (check_ray.has_point(this->points[i])) {
ray_has_vertex = true;
break;
}
}
if (ray_has_vertex) {
++check_ray.direction[1];
}
} while (ray_has_vertex);
int intersections_cnt = 0;
for (int i = 0; i < this->points_cnt - 1; ++i) {
if (Segment(this->points[i], this->points[i + 1]).has_intarsection_with(check_ray)) {
++intersections_cnt;
}
}
if (Segment(this->points[this->points_cnt - 1], this->points[0]).has_intarsection_with(check_ray)) {
++intersections_cnt;
}
return (intersections_cnt % 2);
}
bool Geometry::Polygon::has_intarsection_with(const Segment & segment) const {
return (this->has_point(segment.point_0) || this->has_point(segment.point_1));
}
std::ostream & Geometry::operator << (std::ostream & os, const Polygon & polygon) {
for (int i = 0; i < polygon.points_cnt - 1; ++i) {
os << polygon.points[i] << '\n';
}
os << polygon.points[polygon.points_cnt - 1];
return os;
}
std::istream & Geometry::operator >> (std::istream & is, Polygon & polygon) {
for (int i = 0; i < polygon.points_cnt; ++i) {
is >> polygon.points[i];
}
return is;
} | [
"37487668+NickwideN@users.noreply.github.com"
] | 37487668+NickwideN@users.noreply.github.com |
fc1b455ad014f71329f8ed27c3a7c3545f18c8fc | 2840004d677486cf16f463972a03aa1eb64f78e0 | /Trees.hpp | 06e1b798e3ba1f50dc37a607a012822556fd0550 | [] | no_license | patschris/IceSkaterScene | fe7f78889de1be84b40cccbd4c5d7f6cced5a5e1 | 7f9f6af9d11dc59c801cf416ed9d5d8a4c973ef7 | refs/heads/master | 2020-03-23T01:45:23.914931 | 2018-09-26T11:41:43 | 2018-09-26T11:41:43 | 140,935,773 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 95 | hpp | #ifndef _Trees_
#define _Trees_
class Trees {
public:
Trees();
~Trees();
};
#endif | [
"chpatsouras@gmail.com"
] | chpatsouras@gmail.com |
e5ac74d8a9cfacc164a48cad0e0aa3057ad9f403 | 5a64f117df8580cda2990db2e6c3c7f22a1783db | /menes/trunk/menes/ios/printwriter.hpp | 53ea2fbaae974673f441d1291b8e124f7d86a5e7 | [] | no_license | xcode2010/saurik-svn-mirror | 5fa87e01a052ed1171c716fe121dc1a8b4d6c7dd | 42aaa83d383dc85faa51733d7da3d2bc3c82de9e | refs/heads/master | 2021-12-12T12:15:03.477067 | 2017-01-06T10:44:46 | 2017-01-06T10:44:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,785 | hpp | /* Menes - C++ High-Level Utility Library
* Copyright (C) 2003-2005 Jay Freeman (saurik)
*/
/*
* Redistribution and use in source and binary
* forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the
* above copyright notice, this list of conditions
* and the following disclaimer.
* 2. Redistributions in binary form must reproduce the
* above copyright notice, this list of conditions
* and the following disclaimer in the documentation
* and/or other materials provided with the
* distribution.
* 3. The name of the author may not be used to endorse
* or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 MENES_IOS_FORMATS_HPP
#define MENES_IOS_FORMATS_HPP
#include "cxx/platform.hpp"
#include "ios/linkage.hpp"
#ifdef MENES_PRAGMA_ONCE
#pragma once
#endif
#include "etl/limits.hpp"
#include "etl/template.hpp"
#include "etl/traits.hpp"
#include "ext/refcount.hpp"
#include "ext/stackref.hpp"
#include "ios/writer.hpp"
namespace ios {
enum Alignment {
Left,
Right,
Center
};
class IOS_DECLARE PrintWriter :
public Writer
{
private:
ext::Buffer buffer_;
unsigned buffered_;
Alignment alignment_;
unsigned base_;
unsigned precision_;
cse::CodePoint fill_;
size_t width_;
cse::String separator_;
virtual void WriteFully_(const byte_t *data, size_t length) = 0;
public:
PrintWriter();
virtual size_t Write(const byte_t *data, size_t length);
virtual void Flush();
void SetAlignment(Alignment alignment) {
alignment_ = alignment;
}
Alignment GetAlignment() const {
return alignment_;
}
void SetBase(unsigned base) {
base_ = base;
}
unsigned GetBase() const {
return base_;
}
void SetPrecision(unsigned precision) {
precision_ = precision;
}
unsigned GetPrecision() const {
return precision_;
}
void SetFill(cse::CodePoint fill) {
fill_ = fill;
}
cse::CodePoint GetFill() const {
return fill_;
}
void SetWidth(unsigned width) {
width_ = width;
}
unsigned GetWidth() const {
return width_;
}
void SetLineSeparator(const cse::String &separator_) {
this->separator_ = separator_;
}
const cse::String &GetLineSeparator() const {
return separator_;
}
void NewLine() {
*this << separator_;
}
void Start() {
++buffered_;
}
void Finish();
template <typename Encoding_, typename Buffer_>
inline PrintWriter &operator <<(const cse::UnicodeString<Encoding_, Buffer_> &rhs) {
cse::UnicodeString<cse::Utf8Encoding, Buffer_> string(rhs);
WriteFully(string.GetData().Begin(), string.GetData().GetSize());
return *this;
}
template <typename Buffer_>
inline PrintWriter &operator <<(const cse::UnicodeString<cse::Utf8Encoding, Buffer_> &rhs) {
WriteFully(rhs.GetData().Begin(), rhs.GetData().GetSize());
return *this;
}
};
class FormatWriter :
public PrintWriter
{
private:
Writer &out_;
virtual void WriteFully_(const byte_t *data, size_t length) {
out_.WriteFully(data, length);
}
public:
FormatWriter(Writer &out) :
out_(out)
{
}
virtual void Flush() {
return out_.Flush();
}
Writer &GetStream() {
return out_;
}
};
class FormatOperation {
public:
virtual void operator()(PrintWriter &out) const = 0;
};
_finline PrintWriter &operator <<(PrintWriter &out, const FormatOperation &operation) {
operation(out);
return out;
}
_finline PrintWriter &operator <<(PrintWriter &out, const ext::Buffer &value) {
out.WriteFully(value.Begin(), value.GetSize());
return out;
}
inline PrintWriter &operator <<(PrintWriter &out, const char *value) {
size_t length(0);
while (value[length] != '\0')
++length;
out.WriteFully(value, length);
return out;
}
namespace be {
static const byte_t Numerals_[] = "0123456789abcdefghijklmnopqrstuvwxyz";
template <typename Type_, bool Signed_ = etl::Limits<Type_>::IsSigned>
struct WriteSign_ {
// XXX: technically this cannot print out the most negative number
_finline static void Execute(PrintWriter &out, Type_ &value) {
if (value < 0) {
value = -value;
out << "-";
}
} };
template <typename Type_>
struct WriteSign_<Type_, false> {
_finline static void Execute (PrintWriter &out, Type_ &value) {
} };
template <typename Type_>
void WriteInteger_(PrintWriter &out, Type_ value) {
unsigned base(out.GetBase());
out.Start();
WriteSign_<Type_>::Execute(out, value);
Type_ divisor(1);
for (Type_ smaller(value / base); smaller >= divisor; divisor *= base);
do {
// XXX: byte_t is just so damned convenient
Put(out, be::Numerals_[value / divisor]);
value %= divisor;
divisor /= base;
} while (divisor != 0);
out.Finish();
}
}
template <typename Type_>
typename etl::IfTrue<etl::IsIntegral<Type_>::value, PrintWriter &>::Result
operator <<(PrintWriter &out, Type_ value) {
be::WriteInteger_(out, value);
return out;
}
template <typename Type_>
typename etl::IfTrue<etl::IsEnum<Type_>::value, PrintWriter &>::Result
operator <<(PrintWriter &out, Type_ value) {
return out << static_cast<unsigned>(value);
}
IOS_DECLARE PrintWriter &operator <<(PrintWriter &out, const void *value);
IOS_DECLARE PrintWriter &operator <<(PrintWriter &out, float value);
IOS_DECLARE PrintWriter &operator <<(PrintWriter &out, double value);
IOS_DECLARE PrintWriter &operator <<(PrintWriter &out, bool value);
#define IOS_FORCEINTEGRAL(Type) \
_finline PrintWriter &operator <<(PrintWriter &out, Type value) { \
be::WriteInteger_(out, value); \
return out; \
}
#define IOS_FORCEINTEGRAL_MODS(Type) \
IOS_FORCEINTEGRAL(unsigned Type) \
IOS_FORCEINTEGRAL(signed Type)
IOS_FORCEINTEGRAL_MODS(short)
IOS_FORCEINTEGRAL_MODS(int)
IOS_FORCEINTEGRAL_MODS(long)
#undef IOS_FORCEINTEGRAL_MODS
#undef IOS_FORCEINTEGRAL
template <size_t Size_>
PrintWriter &operator <<(PrintWriter &out, const byte_t value[Size_]) {
out.WriteFully(value, Size_);
return out;
}
struct FormatFlushOperation :
FormatOperation
{
virtual void operator()(PrintWriter &out) const {
out.Flush();
}
};
struct FormatNewLineOperation :
FormatOperation
{
virtual void operator()(PrintWriter &out) const {
out.NewLine();
out.Flush();
}
};
struct FormatNewLineNoFlushOperation :
FormatOperation
{
virtual void operator()(PrintWriter &out) const {
out.NewLine();
}
};
class SetAlignment :
public FormatOperation
{
private:
Alignment alignment_;
public:
SetAlignment(Alignment alignment) :
alignment_(alignment)
{
}
virtual void operator()(PrintWriter &out) const {
out.SetAlignment(alignment_);
}
};
class SetBase :
public FormatOperation
{
private:
unsigned base_;
public:
SetBase(unsigned base) :
base_(base)
{
}
virtual void operator()(PrintWriter &out) const {
out.SetBase(base_);
}
};
class SetPrecision :
public FormatOperation
{
private:
unsigned precision_;
public:
SetPrecision(unsigned precision) :
precision_(precision)
{
}
virtual void operator()(PrintWriter &out) const {
out.SetPrecision(precision_);
}
};
class SetLineSeparator :
public FormatOperation
{
private:
cse::String separator_;
public:
SetLineSeparator(const cse::String &separator) :
separator_(separator)
{
}
virtual void operator()(PrintWriter &out) const {
out.SetLineSeparator(separator_);
}
};
class SetFill :
public FormatOperation
{
private:
cse::CodePoint fill_;
public:
SetFill(cse::CodePoint fill) :
fill_(fill)
{
}
virtual void operator()(PrintWriter &out) const {
out.SetFill(fill_);
}
};
class SetWidth :
public FormatOperation
{
private:
unsigned width_;
public:
SetWidth(unsigned width) :
width_(width)
{
}
virtual void operator()(PrintWriter &out) const {
out.SetWidth(width_);
}
};
static FormatFlushOperation Flush;
static FormatNewLineOperation NewLine;
static FormatNewLineNoFlushOperation NewLineNoFlush;
}
#endif//MENES_IOS_FORMATS_HPP
| [
"286674783@qq.com"
] | 286674783@qq.com |
1a846d9ad02f9bd1cd356a07207fb9194b9e73b2 | 7a12fbf4a4c5e6017dac3eeb829f7272848ba672 | /WhoAmI_source/src/PhysicsLogic.cpp | 025f7fe0feb38909911c27a125175bf50d31306e | [] | no_license | CH-Kwon/Who_Am_I | 5336f00996b683453828792f8f294cc10fb4bb12 | c21f01b502de36724e3965658575d25ce4740463 | refs/heads/master | 2023-04-11T17:05:46.088709 | 2021-05-04T08:01:19 | 2021-05-04T08:01:19 | 364,178,338 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,063 | cpp | /**
\file PhysicsLogic.cpp
\author jungdae.chur
\par email: wmdhwmdh@gmail.com
\par course: GAM200
\date 12/13/2017
\brief
All content (c) 2017 DigiPen (USA) Corporation, all rights reserved.
*/
#include "PhysicsLogic.h"
#include "Object.h"
#include "Physics.h"
#include "RigidBody.h"
#include "Transform.hpp"
#include "jsonReader.h"
namespace FindersEngine
{
PhysicsLogic* PHYSICS_LOGIC = nullptr;
void PhysicsLogic::SeperateByRoom()
{
for (auto it = PHYSICS->m_vecprb.begin(); it != PHYSICS->m_vecprb.end(); ++it)
{
Transform* it_pos = static_cast<Transform*>((*it)->GetOwner()->GetComponent(CT_TRANSFORM));
if (it_pos->getPosition().y < JSONREADER->getWall2Pos().y)
{
if (it_pos->getPosition().x <= JSONREADER->getWall6Pos().x)
{
(*it)->GetOwner()->room_number = 1; // Room 1
}
else if ((it_pos->getPosition().x >= JSONREADER->getWall6Pos().x) && (it_pos->getPosition().x < JSONREADER->getWall5Pos().x))
{
(*it)->GetOwner()->room_number = 6; // Room 6
}
else if ((it_pos->getPosition().x >= JSONREADER->getWall5Pos().x) && (it_pos->getPosition().x < JSONREADER->getWall7Pos().x))
{
(*it)->GetOwner()->room_number = 7; // Room 7
}
}
if ((it_pos->getPosition().y >= JSONREADER->getWall2Pos().y) && (it_pos->getPosition().y < JSONREADER->getWall1Pos().y))
{
if (it_pos->getPosition().x <= JSONREADER->getWall6Pos().x)
{
(*it)->GetOwner()->room_number = 2; // Room 2
}
else if ((it_pos->getPosition().x >= JSONREADER->getWall6Pos().x) && (it_pos->getPosition().x < JSONREADER->getWall5Pos().x))
{
(*it)->GetOwner()->room_number = 5; // Room 5
}
else if ((it_pos->getPosition().x >= JSONREADER->getWall5Pos().x) && (it_pos->getPosition().x < JSONREADER->getWall7Pos().x))
{
(*it)->GetOwner()->room_number = 8; // Room 8
}
}
if (it_pos->getPosition().y > JSONREADER->getWall1Pos().y)
{
if (it_pos->getPosition().x <= JSONREADER->getWall6Pos().x)
{
(*it)->GetOwner()->room_number = 3; // Room 3
}
else if ((it_pos->getPosition().x >= JSONREADER->getWall6Pos().x) && (it_pos->getPosition().x < JSONREADER->getWall5Pos().x))
{
(*it)->GetOwner()->room_number = 4; // Room 4
}
else if ((it_pos->getPosition().x >= JSONREADER->getWall5Pos().x) && (it_pos->getPosition().x < JSONREADER->getWall7Pos().x))
{
(*it)->GetOwner()->room_number = 9; // Room 9
}
}
}
}
} | [
"chiho.kwn@gmail.com"
] | chiho.kwn@gmail.com |
db360fc5e951449a9242aa2fd5ac8bbe07cb4e9f | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /hardware/qcom/display/msm8974/liboverlay/overlayRotator.h | f551f1d6c272263122d7297e9708b71cc8d7e5bb | [
"MIT"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 8,387 | h | /*
* Copyright (c) 2011,2013 The Linux Foundation. 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 The Linux Foundation. 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 "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
* 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.
*/
#ifndef OVERlAY_ROTATOR_H
#define OVERlAY_ROTATOR_H
#include <stdlib.h>
#include "mdpWrapper.h"
#include "overlayUtils.h"
#include "overlayMem.h"
namespace overlay {
/*
Manages the case where new rotator memory needs to be
allocated, before previous is freed, due to resolution change etc. If we make
rotator memory to be always max size, irrespctive of source resolution then
we don't need this RotMem wrapper. The inner class is sufficient.
*/
struct RotMem {
// Max rotator memory allocations
enum { MAX_ROT_MEM = 2};
//Manages the rotator buffer offsets.
struct Mem {
Mem();
~Mem();
bool valid() { return m.valid(); }
bool close() { return m.close(); }
uint32_t size() const { return m.bufSz(); }
void setReleaseFd(const int& fence);
// Max rotator buffers
enum { ROT_NUM_BUFS = 2 };
// rotator data info dst offset
uint32_t mRotOffset[ROT_NUM_BUFS];
int mRelFence[ROT_NUM_BUFS];
// current offset slot from mRotOffset
uint32_t mCurrOffset;
OvMem m;
};
RotMem() : _curr(0) {}
Mem& curr() { return m[_curr % MAX_ROT_MEM]; }
const Mem& curr() const { return m[_curr % MAX_ROT_MEM]; }
Mem& prev() { return m[(_curr+1) % MAX_ROT_MEM]; }
RotMem& operator++() { ++_curr; return *this; }
void setReleaseFd(const int& fence) { curr().setReleaseFd(fence); }
bool close();
uint32_t _curr;
Mem m[MAX_ROT_MEM];
};
class Rotator
{
public:
enum { TYPE_MDP, TYPE_MDSS };
virtual ~Rotator();
virtual void setSource(const utils::Whf& wfh) = 0;
virtual void setCrop(const utils::Dim& crop) = 0;
virtual void setFlags(const utils::eMdpFlags& flags) = 0;
virtual void setTransform(const utils::eTransform& rot) = 0;
virtual bool commit() = 0;
virtual void setDownscale(int ds) = 0;
virtual int getDstMemId() const = 0;
virtual uint32_t getDstOffset() const = 0;
virtual uint32_t getDstFormat() const = 0;
virtual uint32_t getSessId() const = 0;
virtual bool queueBuffer(int fd, uint32_t offset) = 0;
virtual void dump() const = 0;
virtual void getDump(char *buf, size_t len) const = 0;
void setReleaseFd(const int& fence) { mMem.setReleaseFd(fence); }
static Rotator *getRotator();
protected:
/* Rotator memory manager */
RotMem mMem;
explicit Rotator() {}
static uint32_t calcOutputBufSize(const utils::Whf& destWhf);
private:
/*Returns rotator h/w type */
static int getRotatorHwType();
friend class RotMgr;
};
/*
* MDP rot holds MDP's rotation related structures.
*
* */
class MdpRot : public Rotator {
public:
virtual ~MdpRot();
virtual void setSource(const utils::Whf& wfh);
virtual void setCrop(const utils::Dim& crop);
virtual void setFlags(const utils::eMdpFlags& flags);
virtual void setTransform(const utils::eTransform& rot);
virtual bool commit();
virtual void setDownscale(int ds);
virtual int getDstMemId() const;
virtual uint32_t getDstOffset() const;
virtual uint32_t getDstFormat() const;
virtual uint32_t getSessId() const;
virtual bool queueBuffer(int fd, uint32_t offset);
virtual void dump() const;
virtual void getDump(char *buf, size_t len) const;
private:
explicit MdpRot();
bool init();
bool close();
void setRotations(uint32_t r);
bool enabled () const;
/* remap rot buffers */
bool remap(uint32_t numbufs);
bool open_i(uint32_t numbufs, uint32_t bufsz);
/* Deferred transform calculations */
void doTransform();
/* reset underlying data, basically memset 0 */
void reset();
/* return true if current rotator config is different
* than last known config */
bool rotConfChanged() const;
/* save mRotImgInfo to be last known good config*/
void save();
/* Calculates the rotator's o/p buffer size post the transform calcs and
* knowing the o/p format depending on whether fastYuv is enabled or not */
uint32_t calcOutputBufSize();
/* rot info*/
msm_rotator_img_info mRotImgInfo;
/* Last saved rot info*/
msm_rotator_img_info mLSRotImgInfo;
/* rot data */
msm_rotator_data_info mRotDataInfo;
/* Orientation */
utils::eTransform mOrientation;
/* rotator fd */
OvFD mFd;
friend Rotator* Rotator::getRotator();
};
/*
+* MDSS Rot holds MDSS's rotation related structures.
+*
+* */
class MdssRot : public Rotator {
public:
virtual ~MdssRot();
virtual void setSource(const utils::Whf& wfh);
virtual void setCrop(const utils::Dim& crop);
virtual void setFlags(const utils::eMdpFlags& flags);
virtual void setTransform(const utils::eTransform& rot);
virtual bool commit();
virtual void setDownscale(int ds);
virtual int getDstMemId() const;
virtual uint32_t getDstOffset() const;
virtual uint32_t getDstFormat() const;
virtual uint32_t getSessId() const;
virtual bool queueBuffer(int fd, uint32_t offset);
virtual void dump() const;
virtual void getDump(char *buf, size_t len) const;
private:
explicit MdssRot();
bool init();
bool close();
void setRotations(uint32_t r);
bool enabled () const;
/* remap rot buffers */
bool remap(uint32_t numbufs);
bool open_i(uint32_t numbufs, uint32_t bufsz);
/* Deferred transform calculations */
void doTransform();
/* reset underlying data, basically memset 0 */
void reset();
/* Calculates the rotator's o/p buffer size post the transform calcs and
* knowing the o/p format depending on whether fastYuv is enabled or not */
uint32_t calcOutputBufSize();
// Calculate the compressed o/p buffer size for BWC
uint32_t calcCompressedBufSize(const utils::Whf& destWhf);
/* MdssRot info structure */
mdp_overlay mRotInfo;
/* MdssRot data structure */
msmfb_overlay_data mRotData;
/* Orientation */
utils::eTransform mOrientation;
/* rotator fd */
OvFD mFd;
/* Enable/Disable Mdss Rot*/
bool mEnabled;
friend Rotator* Rotator::getRotator();
};
// Holder of rotator objects. Manages lifetimes
class RotMgr {
public:
//Maximum sessions based on VG pipes, since rotator is used only for videos.
//Even though we can have 4 mixer stages, that much may be unnecessary.
enum { MAX_ROT_SESS = 3 };
RotMgr();
~RotMgr();
void configBegin();
void configDone();
overlay::Rotator *getNext();
void clear(); //Removes all instances
/* Returns rot dump.
* Expects a NULL terminated buffer of big enough size.
*/
void getDump(char *buf, size_t len);
int getRotDevFd();
private:
overlay::Rotator *mRot[MAX_ROT_SESS];
int mUseCount;
int mRotDevFd;
};
} // overlay
#endif // OVERlAY_ROTATOR_H
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
08124e8e543932b7ae9411fd5ae9a39ffaebac94 | 0eff74b05b60098333ad66cf801bdd93becc9ea4 | /second/download/curl/gumtree/curl_old_log_15139.cpp | 6539bfb1603cf65ff9c5ff0d898f3539912dd720 | [] | no_license | niuxu18/logTracker-old | 97543445ea7e414ed40bdc681239365d33418975 | f2b060f13a0295387fe02187543db124916eb446 | refs/heads/master | 2021-09-13T21:39:37.686481 | 2017-12-11T03:36:34 | 2017-12-11T03:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 509 | cpp | fputs(
" initial host. If a redirect takes curl to a different host, it\n"
" won't be able to intercept the user+password. See also --loca-\n"
" tion-trusted on how to change this. You can limit the amount of\n"
" redirects to follow by using the --max-redirs option.\n"
"\n"
" When curl follows a redirect and the request is not a plain GET\n"
" (for example POST or PUT), it will do the following request with\n"
, stdout); | [
"993273596@qq.com"
] | 993273596@qq.com |
13094ec8829007a2a7a990b37c99b63416ae3bde | 010b1e227d8cef27c8c4a85ce6389273c49101ff | /VaccinationRegistration/VRCentreManagerService/thrift/gen-cpp/vr_response_types.cpp | f428709d49eefbd5d4245e427736f944b49f269c | [] | no_license | dangnammta/TiemChung | 667d8df3171812499ca71241e87a13977b216257 | 90e22c6e4b4ec546e0bb84629a8ac2579276f81a | refs/heads/master | 2020-03-21T17:13:02.613332 | 2018-06-27T02:41:31 | 2018-06-27T02:41:31 | 138,820,292 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | true | 39,829 | cpp | /**
* Autogenerated by Thrift Compiler (0.9.1)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
#include "vr_response_types.h"
#include <algorithm>
namespace CRDHN { namespace VR { namespace Response {
int _kTErrorCodeValues[] = {
EC_OK,
EC_SYSTEM,
EC_PARAM_ERROR,
EC_NOT_ALLOWED,
EC_PIN_REGISTERED,
EC_REGISTRATION_FULL,
EC_REGISTRATION_AVAILABLE,
EC_REGISTRATION_PENDING,
EC_REGISTRATION_DISABLE,
EC_EVENT_INFO,
EC_REGISTRATION_INFO,
EC_DAILY_REGISTRATIONS,
EC_DAILY_INJECTION,
EC_LIST_EVENTS,
EC_VACCINE_INFO,
EC_CENTRE_INFO,
EC_COMMON_STORE
};
const char* _kTErrorCodeNames[] = {
"EC_OK",
"EC_SYSTEM",
"EC_PARAM_ERROR",
"EC_NOT_ALLOWED",
"EC_PIN_REGISTERED",
"EC_REGISTRATION_FULL",
"EC_REGISTRATION_AVAILABLE",
"EC_REGISTRATION_PENDING",
"EC_REGISTRATION_DISABLE",
"EC_EVENT_INFO",
"EC_REGISTRATION_INFO",
"EC_DAILY_REGISTRATIONS",
"EC_DAILY_INJECTION",
"EC_LIST_EVENTS",
"EC_VACCINE_INFO",
"EC_CENTRE_INFO",
"EC_COMMON_STORE"
};
const std::map<int, const char*> _TErrorCode_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(17, _kTErrorCodeValues, _kTErrorCodeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL));
const char* TError::ascii_fingerprint = "96705E9A3FD7B072319C71653E0DBB90";
const uint8_t TError::binary_fingerprint[16] = {0x96,0x70,0x5E,0x9A,0x3F,0xD7,0xB0,0x72,0x31,0x9C,0x71,0x65,0x3E,0x0D,0xBB,0x90};
uint32_t TError::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_errorCode = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->errorCode);
isset_errorCode = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->errorMessage);
this->__isset.errorMessage = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_errorCode)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TError::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TError");
xfer += oprot->writeFieldBegin("errorCode", ::apache::thrift::protocol::T_I32, 1);
xfer += oprot->writeI32(this->errorCode);
xfer += oprot->writeFieldEnd();
if (this->__isset.errorMessage) {
xfer += oprot->writeFieldBegin("errorMessage", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->errorMessage);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TError &a, TError &b) {
using ::std::swap;
swap(a.errorCode, b.errorCode);
swap(a.errorMessage, b.errorMessage);
swap(a.__isset, b.__isset);
}
const char* TRMAddRegistrationResponse::ascii_fingerprint = "897791680A24D292AA38F98A67A2321C";
const uint8_t TRMAddRegistrationResponse::binary_fingerprint[16] = {0x89,0x77,0x91,0x68,0x0A,0x24,0xD2,0x92,0xAA,0x38,0xF9,0x8A,0x67,0xA2,0x32,0x1C};
uint32_t TRMAddRegistrationResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
bool isset_registrationCode = false;
bool isset_injectionOrderNumber = false;
bool isset_injectionDate = false;
bool isset_injectionTime = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->registrationCode);
isset_registrationCode = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->injectionOrderNumber);
isset_injectionOrderNumber = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->injectionDate);
isset_injectionDate = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->injectionTime);
isset_injectionTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_registrationCode)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_injectionOrderNumber)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_injectionDate)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_injectionTime)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TRMAddRegistrationResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TRMAddRegistrationResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("registrationCode", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->registrationCode);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("injectionOrderNumber", ::apache::thrift::protocol::T_I32, 3);
xfer += oprot->writeI32(this->injectionOrderNumber);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("injectionDate", ::apache::thrift::protocol::T_I64, 4);
xfer += oprot->writeI64(this->injectionDate);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("injectionTime", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString(this->injectionTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TRMAddRegistrationResponse &a, TRMAddRegistrationResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.registrationCode, b.registrationCode);
swap(a.injectionOrderNumber, b.injectionOrderNumber);
swap(a.injectionDate, b.injectionDate);
swap(a.injectionTime, b.injectionTime);
}
const char* TRMAddExtraRegistrationResponse::ascii_fingerprint = "897791680A24D292AA38F98A67A2321C";
const uint8_t TRMAddExtraRegistrationResponse::binary_fingerprint[16] = {0x89,0x77,0x91,0x68,0x0A,0x24,0xD2,0x92,0xAA,0x38,0xF9,0x8A,0x67,0xA2,0x32,0x1C};
uint32_t TRMAddExtraRegistrationResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
bool isset_registrationCode = false;
bool isset_injectionOrderNumber = false;
bool isset_injectionDate = false;
bool isset_injectionTime = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->registrationCode);
isset_registrationCode = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 3:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->injectionOrderNumber);
isset_injectionOrderNumber = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 4:
if (ftype == ::apache::thrift::protocol::T_I64) {
xfer += iprot->readI64(this->injectionDate);
isset_injectionDate = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 5:
if (ftype == ::apache::thrift::protocol::T_STRING) {
xfer += iprot->readString(this->injectionTime);
isset_injectionTime = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_registrationCode)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_injectionOrderNumber)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_injectionDate)
throw TProtocolException(TProtocolException::INVALID_DATA);
if (!isset_injectionTime)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TRMAddExtraRegistrationResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TRMAddExtraRegistrationResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("registrationCode", ::apache::thrift::protocol::T_STRING, 2);
xfer += oprot->writeString(this->registrationCode);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("injectionOrderNumber", ::apache::thrift::protocol::T_I32, 3);
xfer += oprot->writeI32(this->injectionOrderNumber);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("injectionDate", ::apache::thrift::protocol::T_I64, 4);
xfer += oprot->writeI64(this->injectionDate);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldBegin("injectionTime", ::apache::thrift::protocol::T_STRING, 5);
xfer += oprot->writeString(this->injectionTime);
xfer += oprot->writeFieldEnd();
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TRMAddExtraRegistrationResponse &a, TRMAddExtraRegistrationResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.registrationCode, b.registrationCode);
swap(a.injectionOrderNumber, b.injectionOrderNumber);
swap(a.injectionDate, b.injectionDate);
swap(a.injectionTime, b.injectionTime);
}
const char* TVMCreateEventResponse::ascii_fingerprint = "185E211EF099F86731CDFE27B73C6174";
const uint8_t TVMCreateEventResponse::binary_fingerprint[16] = {0x18,0x5E,0x21,0x1E,0xF0,0x99,0xF8,0x67,0x31,0xCD,0xFE,0x27,0xB7,0x3C,0x61,0x74};
uint32_t TVMCreateEventResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->eventId);
this->__isset.eventId = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TVMCreateEventResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TVMCreateEventResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.eventId) {
xfer += oprot->writeFieldBegin("eventId", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->eventId);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TVMCreateEventResponse &a, TVMCreateEventResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.eventId, b.eventId);
swap(a.__isset, b.__isset);
}
const char* TVMGetEventInfoResponse::ascii_fingerprint = "FCCFAD034D3E733DB29BE0857C29C138";
const uint8_t TVMGetEventInfoResponse::binary_fingerprint[16] = {0xFC,0xCF,0xAD,0x03,0x4D,0x3E,0x73,0x3D,0xB2,0x9B,0xE0,0x85,0x7C,0x29,0xC1,0x38};
uint32_t TVMGetEventInfoResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->eventInfo.read(iprot);
this->__isset.eventInfo = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TVMGetEventInfoResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TVMGetEventInfoResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.eventInfo) {
xfer += oprot->writeFieldBegin("eventInfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->eventInfo.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TVMGetEventInfoResponse &a, TVMGetEventInfoResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.eventInfo, b.eventInfo);
swap(a.__isset, b.__isset);
}
const char* TVMGetEventsResponse::ascii_fingerprint = "5212D0AFDE8D2697E37DFC6FAF39AED9";
const uint8_t TVMGetEventsResponse::binary_fingerprint[16] = {0x52,0x12,0xD0,0xAF,0xDE,0x8D,0x26,0x97,0xE3,0x7D,0xFC,0x6F,0xAF,0x39,0xAE,0xD9};
uint32_t TVMGetEventsResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->events.clear();
uint32_t _size0;
::apache::thrift::protocol::TType _etype3;
xfer += iprot->readListBegin(_etype3, _size0);
this->events.resize(_size0);
uint32_t _i4;
for (_i4 = 0; _i4 < _size0; ++_i4)
{
xfer += this->events[_i4].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.events = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TVMGetEventsResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TVMGetEventsResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.events) {
xfer += oprot->writeFieldBegin("events", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->events.size()));
std::vector< ::CRDHN::VR::Data::TEventBasicInfo> ::const_iterator _iter5;
for (_iter5 = this->events.begin(); _iter5 != this->events.end(); ++_iter5)
{
xfer += (*_iter5).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TVMGetEventsResponse &a, TVMGetEventsResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.events, b.events);
swap(a.__isset, b.__isset);
}
const char* TVMGetRegistrationResponse::ascii_fingerprint = "9CE19CF63B832697EC4305EA81434FA6";
const uint8_t TVMGetRegistrationResponse::binary_fingerprint[16] = {0x9C,0xE1,0x9C,0xF6,0x3B,0x83,0x26,0x97,0xEC,0x43,0x05,0xEA,0x81,0x43,0x4F,0xA6};
uint32_t TVMGetRegistrationResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->registrationInfo.read(iprot);
this->__isset.registrationInfo = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TVMGetRegistrationResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TVMGetRegistrationResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.registrationInfo) {
xfer += oprot->writeFieldBegin("registrationInfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->registrationInfo.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TVMGetRegistrationResponse &a, TVMGetRegistrationResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.registrationInfo, b.registrationInfo);
swap(a.__isset, b.__isset);
}
const char* TVMGetRegistrationsResponse::ascii_fingerprint = "2B5025DA6BD045C7870228CFF60C4A5C";
const uint8_t TVMGetRegistrationsResponse::binary_fingerprint[16] = {0x2B,0x50,0x25,0xDA,0x6B,0xD0,0x45,0xC7,0x87,0x02,0x28,0xCF,0xF6,0x0C,0x4A,0x5C};
uint32_t TVMGetRegistrationsResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->registrations.clear();
uint32_t _size6;
::apache::thrift::protocol::TType _etype9;
xfer += iprot->readListBegin(_etype9, _size6);
this->registrations.resize(_size6);
uint32_t _i10;
for (_i10 = 0; _i10 < _size6; ++_i10)
{
xfer += this->registrations[_i10].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.registrations = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TVMGetRegistrationsResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TVMGetRegistrationsResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.registrations) {
xfer += oprot->writeFieldBegin("registrations", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->registrations.size()));
std::vector< ::CRDHN::VR::Data::TRegistrationInfo> ::const_iterator _iter11;
for (_iter11 = this->registrations.begin(); _iter11 != this->registrations.end(); ++_iter11)
{
xfer += (*_iter11).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TVMGetRegistrationsResponse &a, TVMGetRegistrationsResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.registrations, b.registrations);
swap(a.__isset, b.__isset);
}
const char* TCMCreateCentreResponse::ascii_fingerprint = "185E211EF099F86731CDFE27B73C6174";
const uint8_t TCMCreateCentreResponse::binary_fingerprint[16] = {0x18,0x5E,0x21,0x1E,0xF0,0x99,0xF8,0x67,0x31,0xCD,0xFE,0x27,0xB7,0x3C,0x61,0x74};
uint32_t TCMCreateCentreResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->centreId);
this->__isset.centreId = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TCMCreateCentreResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TCMCreateCentreResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.centreId) {
xfer += oprot->writeFieldBegin("centreId", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->centreId);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TCMCreateCentreResponse &a, TCMCreateCentreResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.centreId, b.centreId);
swap(a.__isset, b.__isset);
}
const char* TCMGetCentreInfoResponse::ascii_fingerprint = "212EC20D868EB822678208066BA36940";
const uint8_t TCMGetCentreInfoResponse::binary_fingerprint[16] = {0x21,0x2E,0xC2,0x0D,0x86,0x8E,0xB8,0x22,0x67,0x82,0x08,0x06,0x6B,0xA3,0x69,0x40};
uint32_t TCMGetCentreInfoResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->centreInfo.read(iprot);
this->__isset.centreInfo = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TCMGetCentreInfoResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TCMGetCentreInfoResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.centreInfo) {
xfer += oprot->writeFieldBegin("centreInfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->centreInfo.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TCMGetCentreInfoResponse &a, TCMGetCentreInfoResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.centreInfo, b.centreInfo);
swap(a.__isset, b.__isset);
}
const char* TCMGetCentresResponse::ascii_fingerprint = "935BB0D445A3FDCB2163DC1AB1902C2B";
const uint8_t TCMGetCentresResponse::binary_fingerprint[16] = {0x93,0x5B,0xB0,0xD4,0x45,0xA3,0xFD,0xCB,0x21,0x63,0xDC,0x1A,0xB1,0x90,0x2C,0x2B};
uint32_t TCMGetCentresResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->centres.clear();
uint32_t _size12;
::apache::thrift::protocol::TType _etype15;
xfer += iprot->readListBegin(_etype15, _size12);
this->centres.resize(_size12);
uint32_t _i16;
for (_i16 = 0; _i16 < _size12; ++_i16)
{
xfer += this->centres[_i16].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.centres = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TCMGetCentresResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TCMGetCentresResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.centres) {
xfer += oprot->writeFieldBegin("centres", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->centres.size()));
std::vector< ::CRDHN::VR::Data::TCentreInfo> ::const_iterator _iter17;
for (_iter17 = this->centres.begin(); _iter17 != this->centres.end(); ++_iter17)
{
xfer += (*_iter17).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TCMGetCentresResponse &a, TCMGetCentresResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.centres, b.centres);
swap(a.__isset, b.__isset);
}
const char* TCMAddVaccineResponse::ascii_fingerprint = "185E211EF099F86731CDFE27B73C6174";
const uint8_t TCMAddVaccineResponse::binary_fingerprint[16] = {0x18,0x5E,0x21,0x1E,0xF0,0x99,0xF8,0x67,0x31,0xCD,0xFE,0x27,0xB7,0x3C,0x61,0x74};
uint32_t TCMAddVaccineResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_I32) {
xfer += iprot->readI32(this->vaccineId);
this->__isset.vaccineId = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TCMAddVaccineResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TCMAddVaccineResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.vaccineId) {
xfer += oprot->writeFieldBegin("vaccineId", ::apache::thrift::protocol::T_I32, 2);
xfer += oprot->writeI32(this->vaccineId);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TCMAddVaccineResponse &a, TCMAddVaccineResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.vaccineId, b.vaccineId);
swap(a.__isset, b.__isset);
}
const char* TCMGetVaccineInfoResponse::ascii_fingerprint = "8B22F7101E72B3B7A3E64E20164F63BB";
const uint8_t TCMGetVaccineInfoResponse::binary_fingerprint[16] = {0x8B,0x22,0xF7,0x10,0x1E,0x72,0xB3,0xB7,0xA3,0xE6,0x4E,0x20,0x16,0x4F,0x63,0xBB};
uint32_t TCMGetVaccineInfoResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->vaccineInfo.read(iprot);
this->__isset.vaccineInfo = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TCMGetVaccineInfoResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TCMGetVaccineInfoResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.vaccineInfo) {
xfer += oprot->writeFieldBegin("vaccineInfo", ::apache::thrift::protocol::T_STRUCT, 2);
xfer += this->vaccineInfo.write(oprot);
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TCMGetVaccineInfoResponse &a, TCMGetVaccineInfoResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.vaccineInfo, b.vaccineInfo);
swap(a.__isset, b.__isset);
}
const char* TCMGetVaccinesResponse::ascii_fingerprint = "51A6666CF84B659D1704D50E108E34EB";
const uint8_t TCMGetVaccinesResponse::binary_fingerprint[16] = {0x51,0xA6,0x66,0x6C,0xF8,0x4B,0x65,0x9D,0x17,0x04,0xD5,0x0E,0x10,0x8E,0x34,0xEB};
uint32_t TCMGetVaccinesResponse::read(::apache::thrift::protocol::TProtocol* iprot) {
uint32_t xfer = 0;
std::string fname;
::apache::thrift::protocol::TType ftype;
int16_t fid;
xfer += iprot->readStructBegin(fname);
using ::apache::thrift::protocol::TProtocolException;
bool isset_error = false;
while (true)
{
xfer += iprot->readFieldBegin(fname, ftype, fid);
if (ftype == ::apache::thrift::protocol::T_STOP) {
break;
}
switch (fid)
{
case 1:
if (ftype == ::apache::thrift::protocol::T_STRUCT) {
xfer += this->error.read(iprot);
isset_error = true;
} else {
xfer += iprot->skip(ftype);
}
break;
case 2:
if (ftype == ::apache::thrift::protocol::T_LIST) {
{
this->vaccines.clear();
uint32_t _size18;
::apache::thrift::protocol::TType _etype21;
xfer += iprot->readListBegin(_etype21, _size18);
this->vaccines.resize(_size18);
uint32_t _i22;
for (_i22 = 0; _i22 < _size18; ++_i22)
{
xfer += this->vaccines[_i22].read(iprot);
}
xfer += iprot->readListEnd();
}
this->__isset.vaccines = true;
} else {
xfer += iprot->skip(ftype);
}
break;
default:
xfer += iprot->skip(ftype);
break;
}
xfer += iprot->readFieldEnd();
}
xfer += iprot->readStructEnd();
if (!isset_error)
throw TProtocolException(TProtocolException::INVALID_DATA);
return xfer;
}
uint32_t TCMGetVaccinesResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
uint32_t xfer = 0;
xfer += oprot->writeStructBegin("TCMGetVaccinesResponse");
xfer += oprot->writeFieldBegin("error", ::apache::thrift::protocol::T_STRUCT, 1);
xfer += this->error.write(oprot);
xfer += oprot->writeFieldEnd();
if (this->__isset.vaccines) {
xfer += oprot->writeFieldBegin("vaccines", ::apache::thrift::protocol::T_LIST, 2);
{
xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->vaccines.size()));
std::vector< ::CRDHN::VR::Data::TVaccineInfo> ::const_iterator _iter23;
for (_iter23 = this->vaccines.begin(); _iter23 != this->vaccines.end(); ++_iter23)
{
xfer += (*_iter23).write(oprot);
}
xfer += oprot->writeListEnd();
}
xfer += oprot->writeFieldEnd();
}
xfer += oprot->writeFieldStop();
xfer += oprot->writeStructEnd();
return xfer;
}
void swap(TCMGetVaccinesResponse &a, TCMGetVaccinesResponse &b) {
using ::std::swap;
swap(a.error, b.error);
swap(a.vaccines, b.vaccines);
swap(a.__isset, b.__isset);
}
}}} // namespace
| [
"dangnam89@gmail.com"
] | dangnam89@gmail.com |
2fdf4b2b8b5d15b079f76f02066d0833316ac2b9 | a5c60be19eb5a2ad490631d294dacbe3cd1018d6 | /history/dirhistory/src/v2/dictionary.cc | 5d5bd83b3c6737ef766e628ee8a893e84eb53f47 | [
"BSD-2-Clause"
] | permissive | nahratzah/monsoon_plus_plus | cd817c9499b5a7667cab9558bc26ea0323fb9c72 | 789082078f1d474d38056518f66613ed1319181b | refs/heads/master | 2021-06-03T05:52:19.346807 | 2020-02-23T02:01:22 | 2020-02-23T02:01:22 | 106,460,792 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 16,056 | cc | #include "dictionary.h"
#include "xdr_primitives.h"
#include <stdexcept>
#include <iterator>
namespace monsoon::history::v2 {
namespace {
// Transformation iterator that maintains the iterator category.
template<typename Iter, typename Fn>
class transform_iterator {
private:
using fn_result_type = decltype(std::invoke(std::declval<Fn>(), *std::declval<Iter>()));
using functor = std::conditional_t<
std::is_copy_assignable_v<Fn> && std::is_copy_constructible_v<Fn>,
Fn,
std::function<fn_result_type(decltype(*std::declval<Iter>()))>>;
public:
using iterator_category = typename std::iterator_traits<Iter>::iterator_category;
using difference_type = typename std::iterator_traits<Iter>::difference_type;
using value_type = std::remove_cv_t<std::remove_reference_t<fn_result_type>>;
using reference = fn_result_type;
private:
class proxy {
public:
proxy(reference v)
: v_(std::move(v))
{}
auto operator*() const
-> std::remove_reference_t<reference>& {
return v_;
}
auto operator->() const
-> std::remove_reference_t<reference>* {
return std::addressof(v_);
}
private:
reference v_;
};
public:
using pointer = std::conditional_t<
std::is_reference_v<reference>,
std::add_pointer_t<std::remove_reference_t<reference>>,
proxy>;
template<typename IterArg, typename FnArg>
transform_iterator(IterArg&& iter, FnArg&& fn)
: iter_(std::forward<IterArg>(iter)),
fn_(std::forward<FnArg>(fn))
{}
auto operator++()
-> transform_iterator& {
++iter_;
return *this;
}
auto operator++(int)
-> transform_iterator {
return transform_iterator(iter_++, fn_);
}
template<typename C>
auto operator+=(C&& c)
-> transform_iterator& {
iter_ += std::forward<C>(c);
return *this;
}
template<typename C>
auto operator-=(C&& c)
-> transform_iterator& {
iter_ -= std::forward<C>(c);
return *this;
}
template<typename C>
auto operator[](C&& c) const
-> reference {
return std::invoke(fn_, iter_[std::forward<C>(c)]);
}
auto operator*() const
-> reference {
return std::invoke(fn_, *iter_);
}
auto operator->() const
-> pointer {
if constexpr(std::is_reference_v<reference>)
return std::addressof(**this);
else
return pointer(**this);
}
auto operator==(const transform_iterator& y) const
-> decltype(std::declval<const Iter&>() == std::declval<const Iter&>()) {
return iter_ == y.iter_;
}
auto operator!=(const transform_iterator& y) const
-> decltype(std::declval<const Iter&>() != std::declval<const Iter&>()) {
return iter_ != y.iter_;
}
template<typename I = const Iter&, typename ResultType = decltype(std::declval<I>() < std::declval<I>())>
auto operator<(const transform_iterator& y) const
-> ResultType {
return iter_ < y.iter_;
}
template<typename I = const Iter&, typename ResultType = decltype(std::declval<I>() > std::declval<I>())>
auto operator>(const transform_iterator& y) const
-> ResultType {
return iter_ > y.iter_;
}
template<typename I = const Iter&, typename ResultType = decltype(std::declval<I>() <= std::declval<I>())>
auto operator<=(const transform_iterator& y) const
-> ResultType {
return iter_ <= y.iter_;
}
template<typename I = const Iter&, typename ResultType = decltype(std::declval<I>() >= std::declval<I>())>
auto operator>=(const transform_iterator& y) const
-> ResultType {
return iter_ >= y.iter_;
}
template<typename I = const Iter&, typename ResultType = decltype(std::declval<I>() - std::declval<I>())>
auto operator-(const transform_iterator& y) const
-> ResultType {
return iter_ - y.iter_;
}
private:
Iter iter_;
functor fn_;
};
template<typename Iter, typename Fn>
auto make_transform_iterator(Iter&& iter, Fn&& fn)
-> transform_iterator<std::decay_t<Iter>, std::decay_t<Fn>> {
return transform_iterator<std::decay_t<Iter>, std::decay_t<Fn>>(std::forward<Iter>(iter), std::forward<Fn>(fn));
}
} /* namespace monsoon::history::v2::<unnamed> */
strval_dictionary::strval_dictionary(allocator_type alloc)
: values_(alloc),
inverse_(std::bind(&strval_dictionary::make_inverse_, this))
{}
strval_dictionary::strval_dictionary(const strval_dictionary& y)
: values_(y.values_),
inverse_(std::bind(&strval_dictionary::make_inverse_, this)),
update_start_(y.update_start_)
{}
strval_dictionary::strval_dictionary(strval_dictionary&& y)
: values_(std::move(y.values_)),
inverse_(std::bind(&strval_dictionary::make_inverse_, this)),
update_start_(y.update_start_)
{}
strval_dictionary& strval_dictionary::operator=(const strval_dictionary& y) {
inverse_.reset();
values_ = y.values_;
update_start_ = y.update_start_;
return *this;
}
strval_dictionary& strval_dictionary::operator=(strval_dictionary&& y) {
inverse_.reset();
values_ = std::move(y.values_);
update_start_ = y.update_start_;
return *this;
}
auto strval_dictionary::operator[](std::uint32_t idx) const
-> std::string_view {
return values_.at(idx);
}
auto strval_dictionary::operator[](std::string_view s) const
-> std::uint32_t {
auto pos = inverse_->find(s);
if (pos == inverse_->end()) throw std::out_of_range("string not present");
return pos->second;
}
auto strval_dictionary::operator[](std::string_view s)
-> std::uint32_t {
auto pos = inverse_->find(s);
if (pos != inverse_->end()) return pos->second;
const bool will_invalidate_refs = (values_.size() == values_.capacity());
values_.emplace_back(s.begin(), s.end());
if (will_invalidate_refs) {
inverse_.reset();
} else {
try {
inverse_->emplace(values_.back(), values_.size() - 1u);
} catch (...) {
inverse_.reset();
}
}
return values_.size() - 1u;
}
auto strval_dictionary::encode_update(xdr::xdr_ostream& out) -> void {
out.put_uint32(update_start_);
out.put_collection(
[](xdr::xdr_ostream& out, std::string_view v) {
out.put_string(v);
},
values_.begin() + update_start_,
values_.end());
update_start_ = values_.size();
}
auto strval_dictionary::decode_update(xdr::xdr_istream& in) -> void {
inverse_.reset();
const std::uint32_t offset = in.get_uint32();
if (offset != values_.size())
throw xdr::xdr_exception("dictionary updates must be contiguous");
try {
std::allocator_traits<decltype(values_.get_allocator())>::rebind_alloc<char> alloc =
values_.get_allocator();
in.get_collection(
[&alloc](xdr::xdr_istream& in) {
return in.get_string(alloc);
},
values_);
if (values_.size() > 0xffffffffU)
throw xdr::xdr_exception("dictionary too large");
} catch (...) {
values_.resize(offset);
throw;
}
update_start_ = values_.size();
}
auto strval_dictionary::make_inverse_() const
-> inverse_map {
inverse_map result(values_.get_allocator());
result.reserve(values_.size());
std::uint32_t idx = 0;
for (std::string_view i : values_)
result.emplace(i, idx++);
return result;
}
path_dictionary::proxy::operator metric_name() const {
return metric_name(
make_transform_iterator(self_.values_[ref_].begin(), make_transform_fn_()),
make_transform_iterator(self_.values_[ref_].end(), make_transform_fn_()));
}
path_dictionary::proxy::operator simple_group() const {
return simple_group(
make_transform_iterator(self_.values_[ref_].begin(), make_transform_fn_()),
make_transform_iterator(self_.values_[ref_].end(), make_transform_fn_()));
}
path_dictionary::path_dictionary(strval_dictionary& str_tbl, allocator_type alloc)
: str_tbl_(str_tbl),
values_(alloc),
inverse_(std::bind(&path_dictionary::make_inverse_, this))
{}
path_dictionary::path_dictionary(const path_dictionary& y, strval_dictionary& str_tbl)
: str_tbl_(str_tbl),
values_(y.values_),
inverse_(std::bind(&path_dictionary::make_inverse_, this)),
update_start_(y.update_start_)
{}
path_dictionary::path_dictionary(path_dictionary&& y, strval_dictionary& str_tbl)
: str_tbl_(str_tbl),
values_(std::move(y.values_)),
inverse_(std::bind(&path_dictionary::make_inverse_, this)),
update_start_(y.update_start_)
{}
path_dictionary& path_dictionary::operator=(const path_dictionary& y) {
inverse_.reset();
values_ = y.values_;
update_start_ = y.update_start_;
return *this;
}
path_dictionary& path_dictionary::operator=(path_dictionary&& y) {
inverse_.reset();
values_ = std::move(y.values_);
update_start_ = y.update_start_;
return *this;
}
auto path_dictionary::operator[](std::uint32_t idx) const
-> proxy {
if (idx >= values_.size()) throw std::out_of_range("path index not in dictionary");
return proxy(*this, idx);
}
auto path_dictionary::operator[](const path_common& pc) const
-> std::uint32_t {
const strval_dictionary& str_tbl = str_tbl_; // Local const-reference, to propagate const-ness.
path p;
std::transform(
pc.begin(),
pc.end(),
std::back_inserter(p),
[&str_tbl](std::string_view s) {
return str_tbl[s];
});
const auto pos = inverse_->find(p);
if (pos == inverse_->end()) throw std::out_of_range("path not found in dictonary");
return pos->second;
}
auto path_dictionary::operator[](const path_common& pc)
-> std::uint32_t {
strval_dictionary& str_tbl = str_tbl_; // Local non-const-reference, to propagate mutable-ness.
path p;
std::transform(
pc.begin(),
pc.end(),
std::back_inserter(p),
[&str_tbl](std::string_view s) {
return str_tbl[s];
});
const auto pos = inverse_->find(p);
if (pos != inverse_->end()) return pos->second;
values_.push_back(p);
try {
inverse_->emplace(std::move(p), values_.size() - 1u);
} catch (...) {
inverse_.reset();
}
return values_.size() - 1u;
}
auto path_dictionary::encode_update(xdr::xdr_ostream& out) -> void {
out.put_uint32(update_start_);
out.put_collection(
[](xdr::xdr_ostream& out, const path& v) {
out.put_collection(
[](xdr::xdr_ostream& out, std::uint32_t v) {
out.put_uint32(v);
},
v.begin(),
v.end());
},
values_.begin() + update_start_,
values_.end());
update_start_ = values_.size();
}
auto path_dictionary::decode_update(xdr::xdr_istream& in) -> void {
inverse_.reset();
const std::uint32_t offset = in.get_uint32();
if (offset != values_.size())
throw xdr::xdr_exception("dictionary updates must be contiguous");
try {
in.get_collection(
[](xdr::xdr_istream& in) {
return in.get_collection<path>(
[](xdr::xdr_istream& in) {
return in.get_uint32();
});
},
values_);
if (values_.size() > 0xffffffffU)
throw xdr::xdr_exception("dictionary too large");
} catch (...) {
values_.resize(offset);
throw;
}
update_start_ = values_.size();
}
auto path_dictionary::make_inverse_() const
-> inverse_map {
inverse_map result(values_.get_allocator());
result.reserve(values_.size());
std::uint32_t idx = 0;
for (const path& e : values_)
result.emplace(e, idx++);
return result;
}
tag_dictionary::tag_dictionary(strval_dictionary& str_tbl, allocator_type alloc)
: str_tbl_(str_tbl),
values_(alloc),
inverse_(std::bind(&tag_dictionary::make_inverse_, this))
{}
tag_dictionary::tag_dictionary(const tag_dictionary& y, strval_dictionary& str_tbl)
: str_tbl_(str_tbl),
values_(y.values_),
inverse_(std::bind(&tag_dictionary::make_inverse_, this)),
update_start_(y.update_start_)
{}
tag_dictionary::tag_dictionary(tag_dictionary&& y, strval_dictionary& str_tbl)
: str_tbl_(str_tbl),
values_(std::move(y.values_)),
inverse_(std::bind(&tag_dictionary::make_inverse_, this)),
update_start_(y.update_start_)
{}
tag_dictionary& tag_dictionary::operator=(const tag_dictionary& y) {
inverse_.reset();
values_ = y.values_;
update_start_ = y.update_start_;
return *this;
}
tag_dictionary& tag_dictionary::operator=(tag_dictionary&& y) {
inverse_.reset();
values_ = std::move(y.values_);
update_start_ = y.update_start_;
return *this;
}
auto tag_dictionary::operator[](std::uint32_t idx) const
-> tags {
const tag_data& data = values_.at(idx);
return tags(
make_transform_iterator(data.begin(), make_transform_fn_()),
make_transform_iterator(data.end(), make_transform_fn_()));
}
auto tag_dictionary::operator[](const tags& t) const
-> std::uint32_t {
const strval_dictionary& str_tbl = str_tbl_; // Local const-reference, to propagate const-ness.
tag_data data;
std::for_each(
t.begin(), t.end(),
[&str_tbl, &data](const auto& elem) {
data.emplace(str_tbl[elem.first], elem.second);
});
const auto pos = inverse_->find(data);
if (pos == inverse_->end()) throw std::out_of_range("tags not found in dictionary");
return pos->second;
}
auto tag_dictionary::operator[](const tags& t)
-> std::uint32_t {
strval_dictionary& str_tbl = str_tbl_; // Local non-const-reference, to propagate mutable-ness.
tag_data data;
std::for_each(
t.begin(), t.end(),
[&str_tbl, &data](const auto& elem) {
data.emplace(str_tbl[elem.first], elem.second);
});
const auto pos = inverse_->find(data);
if (pos != inverse_->end()) return pos->second;
values_.push_back(data);
try {
inverse_->emplace(std::move(data), values_.size() - 1u);
} catch (...) {
inverse_.reset();
}
return values_.size() - 1u;
}
auto tag_dictionary::encode_update(xdr::xdr_ostream& out) -> void {
out.put_uint32(update_start_);
out.put_collection(
[this](xdr::xdr_ostream& out, const tag_data& v) {
// First pass: encode metric name keys.
out.put_collection(
[](xdr::xdr_ostream& out, const tag_data::value_type& v) {
out.put_uint32(v.first);
},
v.begin(),
v.end());
// Second pass: encode metric values.
out.put_collection(
[this](xdr::xdr_ostream& out, const tag_data::value_type& v) {
encode_metric_value(out, v.second, str_tbl_);
},
v.begin(),
v.end());
},
values_.begin() + update_start_,
values_.end());
update_start_ = values_.size();
}
auto tag_dictionary::decode_update(xdr::xdr_istream& in) -> void {
inverse_.reset();
const std::uint32_t offset = in.get_uint32();
if (offset != values_.size())
throw xdr::xdr_exception("dictionary updates must be contiguous");
try {
in.get_collection(
[this](xdr::xdr_istream& in) {
const auto keys = in.get_collection<std::vector<std::uint32_t>>(
[](xdr::xdr_istream& in) {
return in.get_uint32();
});
auto keys_iter = keys.begin();
tag_data result = in.get_collection<tag_data>(
[this, &keys, &keys_iter](xdr::xdr_istream& in) {
// Throw exception if there are too many values.
if (keys_iter == keys.end())
throw xdr::xdr_exception("tag dictionary length mismatch");
return std::make_pair(*keys_iter++, decode_metric_value(in, str_tbl_));
});
// Throw exception if there are insufficient values.
if (keys_iter != keys.end())
throw xdr::xdr_exception("tag dictionary length mismatch");
return result;
},
values_);
if (values_.size() > 0xffffffffU)
throw xdr::xdr_exception("dictionary too large");
} catch (...) {
values_.resize(offset);
throw;
}
update_start_ = values_.size();
}
auto tag_dictionary::make_inverse_() const
-> inverse_map {
inverse_map result(values_.get_allocator());
result.reserve(values_.size());
std::uint32_t idx = 0;
for (const auto& e : values_)
result.emplace(e, idx++);
return result;
}
dictionary::~dictionary() noexcept {}
} /* namespace monsoon::history::v2 */
| [
"ariane@stack.nl"
] | ariane@stack.nl |
6b9c41ca3f3f707ce9046f356f3aacbc1863256d | 30a039fea97f10d731c1545258cc6477896ed8b3 | /c++/factory.cpp | c29939eaf47a849cb62afc8112bbc11167cae1a7 | [] | no_license | GregGarber/JunkDrawer | 3b94ac9d77a0b1a456c6ba66c6aa9f8dc69b18ce | f790cb5c6adde4275354e2a963914881bc4db653 | refs/heads/master | 2021-05-06T22:22:21.876591 | 2017-12-02T06:02:29 | 2017-12-02T06:02:29 | 112,816,582 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,251 | cpp | #include <vector>
#include <iostream>
using namespace std;
class Stooge
{
public:
// Factory Method
static Stooge *make_stooge(int choice);
virtual void slap_stick() = 0;
void nothing(); //normal function okay
int y=1;
};
int main()
{
vector<Stooge*> roles;
int choice;
while (true)
{
cout << "Larry(1) Moe(2) Curly(3) Go(0): ";
cin >> choice;
if (choice == 0)
break;
roles.push_back(Stooge::make_stooge(choice));
}
for (int i = 0; i < roles.size(); i++){
roles[i]->slap_stick();
roles[i]->nothing();
}
for (int i = 0; i < roles.size(); i++)
delete roles[i];
}
class Larry: public Stooge
{
public:
void slap_stick()
{
cout << "Larry: poke eyes\n";
}
};
class Moe: public Stooge
{
public:
void slap_stick()
{
cout << "Moe: slap head\n";
}
};
class Curly: public Stooge
{
public:
void slap_stick()
{
cout << "Curly: suffer abuse\n";
}
};
Stooge *Stooge::make_stooge(int choice)
{
if (choice == 1)
return new Larry;
else if (choice == 2)
return new Moe;
else
return new Curly;
}
void Stooge::nothing(){
static int x=1;
x++;
y++;
cout<<"nothing " << x<<" " << y << endl;
}
| [
"ggarber@cedarmountainsoftware.com"
] | ggarber@cedarmountainsoftware.com |
eded4ad88b581fae2e8af3490032d10cbf51c797 | f1379004b49cee65b7c9fd5c3e3c913ad08c7991 | /markdec04/detect_markers.cpp | 5295dfc4e579e17f5946517945a476ee59d2e5eb | [] | no_license | TwTravel/2DLocation | 513f257a37d9a5b863546a7d4331163bd53e1027 | 24b05c55bb678b41429d9eaf450d9c5780ef22db | refs/heads/master | 2021-10-09T11:39:55.285191 | 2018-12-27T06:16:23 | 2018-12-27T06:16:23 | 159,327,644 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,911 | cpp |
#include <opencv2/highgui.hpp>
#include <opencv2/aruco.hpp>
#include <iostream>
#include <opencv2/calib3d.hpp>
using namespace std;
using namespace cv;
void GetQuaternion(cv::Mat & RotationMat) {
double *Mat0 = RotationMat.ptr<double>(0);//获取第一行的首地址
double *Mat1 = RotationMat.ptr<double>(1);
double *Mat2 = RotationMat.ptr<double>(2);
//double A = data[0], B = data[1], C = data[2], D = data[3], E = data[4], F = data[5];
double w = sqrt(1.0 + Mat0[0] + Mat1[1] + Mat2[2]) / 2.0;
double w4 = (4.0 * w);
double x = (Mat2[1] - Mat1[2]) / w4 ;
double y = (Mat0[2] - Mat2[0]) / w4 ;
double z = (Mat1[0] - Mat0[1]) / w4 ;
printf("####%.3lf, %.3lf, %.3lf, %.3lf #####\n", w, x, y, z);
}
void euler2quaternion(double euler_0, double euler_1, double euler_2) {
/*20130326MK convention: Bunge ZXZ, which represents the (3,1,3) case analyzed in: Diebel 2006
Representing Attitude: Euler Angles, Unit Quaternions, and Rotation Vectors, James Diebel, Stanford University, Stanford, California 94301-9010, Email: diebel@stanford.edu
//cos(a+b) = c(a+b) = cacb-sasb
//cos(a-b) = c(a-b) = cacb+sasb
//sin(a+b) = s(a+b) = sacb+casb
//sin(a-b) = s(a-b) = sacb-casb
*/
double p1 = euler_0;
double t = euler_1;
double p2 = euler_2;
double co1 = cos(t / 2);
double s1 = sin(t / 2);
//double test[4]={0};
//quaternion2Euler( p,test);
double q0,q1,q2,q3;
q0 = co1 * cos((p1 + p2) / 2);
q1 = s1 * cos((p1 - p2) / 2);
q2 = s1 * sin((p1 - p2) / 2);
q3 = co1 * sin((p1 + p2) / 2);
printf("%.4lf, %.4lf, %.4lf, %.4lf\n", q0,q1,q2,q3);
}
namespace {
const char* about = "Basic marker detection";
const char* keys =
"{d | | dictionary: DICT_4X4_50=0, DICT_4X4_100=1, DICT_4X4_250=2,"
"DICT_4X4_1000=3, DICT_5X5_50=4, DICT_5X5_100=5, DICT_5X5_250=6, DICT_5X5_1000=7, "
"DICT_6X6_50=8, DICT_6X6_100=9, DICT_6X6_250=10, DICT_6X6_1000=11, DICT_7X7_50=12,"
"DICT_7X7_100=13, DICT_7X7_250=14, DICT_7X7_1000=15, DICT_ARUCO_ORIGINAL = 16,"
"DICT_APRILTAG_16h5=17, DICT_APRILTAG_25h9=18, DICT_APRILTAG_36h10=19, DICT_APRILTAG_36h11=20}"
"{v | | Input from video file, if ommited, input comes from camera }"
"{ci | 0 | Camera id if input doesnt come from video (-v) }"
"{c | | Camera intrinsic parameters. Needed for camera pose }"
"{l | 0.1 | Marker side lenght (in meters). Needed for correct scale in camera pose }"
"{dp | | File of marker detector parameters }"
"{r | | show rejected candidates too }"
"{refine | | Corner refinement: CORNER_REFINE_NONE=0, CORNER_REFINE_SUBPIX=1,"
"CORNER_REFINE_CONTOUR=2, CORNER_REFINE_APRILTAG=3}";
}
/**
*/
static bool readCameraParameters(string filename, Mat &camMatrix, Mat &distCoeffs) {
FileStorage fs(filename, FileStorage::READ);
if(!fs.isOpened())
return false;
fs["camera_matrix"] >> camMatrix;
fs["distortion_coefficients"] >> distCoeffs;
return true;
}
/***/
static bool readDetectorParameters(string filename, Ptr<aruco::DetectorParameters> ¶ms) {
FileStorage fs(filename, FileStorage::READ);
if(!fs.isOpened())
return false;
fs["adaptiveThreshWinSizeMin"] >> params->adaptiveThreshWinSizeMin;
fs["adaptiveThreshWinSizeMax"] >> params->adaptiveThreshWinSizeMax;
fs["adaptiveThreshWinSizeStep"] >> params->adaptiveThreshWinSizeStep;
fs["adaptiveThreshConstant"] >> params->adaptiveThreshConstant;
fs["minMarkerPerimeterRate"] >> params->minMarkerPerimeterRate;
fs["maxMarkerPerimeterRate"] >> params->maxMarkerPerimeterRate;
fs["polygonalApproxAccuracyRate"] >> params->polygonalApproxAccuracyRate;
fs["minCornerDistanceRate"] >> params->minCornerDistanceRate;
fs["minDistanceToBorder"] >> params->minDistanceToBorder;
fs["minMarkerDistanceRate"] >> params->minMarkerDistanceRate;
fs["cornerRefinementMethod"] >> params->cornerRefinementMethod;
fs["cornerRefinementWinSize"] >> params->cornerRefinementWinSize;
fs["cornerRefinementMaxIterations"] >> params->cornerRefinementMaxIterations;
fs["cornerRefinementMinAccuracy"] >> params->cornerRefinementMinAccuracy;
fs["markerBorderBits"] >> params->markerBorderBits;
fs["perspectiveRemovePixelPerCell"] >> params->perspectiveRemovePixelPerCell;
fs["perspectiveRemoveIgnoredMarginPerCell"] >> params->perspectiveRemoveIgnoredMarginPerCell;
fs["maxErroneousBitsInBorderRate"] >> params->maxErroneousBitsInBorderRate;
fs["minOtsuStdDev"] >> params->minOtsuStdDev;
fs["errorCorrectionRate"] >> params->errorCorrectionRate;
return true;
}
/***/
int main(int argc, char *argv[]) {
CommandLineParser parser(argc, argv, keys);
parser.about(about);
if(argc < 2) {
parser.printMessage();
return 0;
}
int dictionaryId = parser.get<int>("d");
bool showRejected = parser.has("r");
bool estimatePose = parser.has("c");
float markerLength = parser.get<float>("l");
Ptr<aruco::DetectorParameters> detectorParams = aruco::DetectorParameters::create();
if(parser.has("dp")) {
bool readOk = readDetectorParameters(parser.get<string>("dp"), detectorParams);
if(!readOk) {
cerr << "Invalid detector parameters file" << endl;
return 0;
}
}
if (parser.has("refine")) {
//override cornerRefinementMethod read from config file
detectorParams->cornerRefinementMethod = parser.get<int>("refine");
}
std::cout << "Corner refinement method (0: None, 1: Subpixel, 2:contour, 3: AprilTag 2): " << detectorParams->cornerRefinementMethod << std::endl;
int camId = parser.get<int>("ci");
String video;
if(parser.has("v")) {
video = parser.get<String>("v");
}
if(!parser.check()) {
parser.printErrors();
return 0;
}
Ptr<aruco::Dictionary> dictionary =
aruco::getPredefinedDictionary(aruco::PREDEFINED_DICTIONARY_NAME(dictionaryId));
Mat camMatrix, distCoeffs;
if(estimatePose) {
bool readOk = readCameraParameters(parser.get<string>("c"), camMatrix, distCoeffs);
if(!readOk) {
cerr << "Invalid camera file" << endl;
return 0;
}
}
VideoCapture inputVideo;
int waitTime;
if(!video.empty()) {
inputVideo.open(video);
waitTime = 0;
} else {
inputVideo.open(camId);
waitTime = 10;
}
double totalTime = 0;
int totalIterations = 0;
while(inputVideo.grab()) {
Mat image, imageCopy;
inputVideo.retrieve(image);
double tick = (double)getTickCount();
vector< int > ids;
vector< vector< Point2f > > corners, rejected;
vector< Vec3d > rvecs, tvecs;
// detect markers and estimate pose
aruco::detectMarkers(image, dictionary, corners, ids, detectorParams, rejected);
if(estimatePose && ids.size() > 0)
aruco::estimatePoseSingleMarkers(corners, markerLength, camMatrix, distCoeffs, rvecs,
tvecs);
double currentTime = ((double)getTickCount() - tick) / getTickFrequency();
totalTime += currentTime;
totalIterations++;
if(totalIterations % 30 == 0) {
cout << "Detection Time = " << currentTime * 1000 << " ms "
<< "(Mean = " << 1000 * totalTime / double(totalIterations) << " ms)" << endl;
}
// draw results
image.copyTo(imageCopy);
if(ids.size() > 0) {
aruco::drawDetectedMarkers(imageCopy, corners, ids);
if(estimatePose) {
for(unsigned int i = 0; i < ids.size(); i++)
{aruco::drawAxis(imageCopy, camMatrix, distCoeffs, rvecs[i], tvecs[i],
markerLength * 0.5f);
if(ids[i]==26)
{
double position_x, position_y, position_z,
orientation_x, orientation_y, orientation_z, orientation_w ;
position_x = tvecs[i][0];
position_y = tvecs[i][1];
position_z = tvecs[i][2];
double rx,ry,rz;
rx = rvecs[i][0];
ry = rvecs[i][1];
rz = rvecs[i][2];
rvecs[i][1] = rx;
rvecs[i][0] = -ry;
cv::Mat rotationMatrixCv;
Rodrigues(rvecs, rotationMatrixCv);
GetQuaternion(rotationMatrixCv);
//void calib::RodriguesToEuler(const cv::Mat& src, cv::Mat& dst, int argType)
printf("%.4lf,%.4lf,%.4lf,===%.4lf,%.4lf,%.4lf \n", position_x, position_y, position_z, rx, ry, rz);
euler2quaternion(rx, ry, rz);
}
}
}
}
if(showRejected && rejected.size() > 0)
aruco::drawDetectedMarkers(imageCopy, rejected, noArray(), Scalar(100, 0, 255));
imshow("out", imageCopy);
char key = (char)waitKey(waitTime);
if(key == 27) break;
}
return 0;
}
| [
"twtravel@126.com"
] | twtravel@126.com |
a2a264a7c12e021b9e2c84fb8395e3e3767a82a9 | a4814db80d8d7d6ea17a75b22e8a18728a09a614 | /omh_compute/omh.hpp | a221477e30e0a398cd80b28ce6ab29b2273a1fe0 | [
"BSD-3-Clause"
] | permissive | Kingsford-Group/omhismb2019 | a71e23833ba96193d29fe562dd630f58546e02f7 | 63a3496b5d9c075be76c000a7dc25b3a323e7094 | refs/heads/master | 2022-01-18T23:01:30.026786 | 2022-01-02T12:42:07 | 2022-01-02T12:42:07 | 189,441,884 | 23 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 4,863 | hpp | #ifndef __OMH_H__
#define __OMH_H__
#include <cstring>
#include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <random>
#include <limits>
#include <xxhash.hpp>
#include <seeded_prg.hpp>
std::string reverse_complement(const std::string&);
struct mer_info {
size_t pos;
uint64_t hash;
unsigned occ;
mer_info(size_t p, unsigned o, uint64_t h)
: pos(p)
, hash(h)
, occ(o)
{ }
};
// Compute the position in sequence of the k-mers picked by omh, and
// passed them 1 by 1 to block. block takes 3 arguments: i \in [m], j
// \in [l] and the position.
template<typename EngineT, typename BT>
void omh_pos(const std::string& seq, unsigned k, unsigned l, unsigned m, EngineT& prg, BT block) {
if(seq.size() < k) return;
const bool weight = l > 0;
if(l == 0) l = 1;
std::vector<mer_info> mers;
std::unordered_map<std::string, unsigned> occurrences;
size_t pos[l];
// Create list of k-mers with occurrence numbers
for(size_t i = 0; i < seq.size() - k + 1; ++i) {
auto occ = occurrences[seq.substr(i, k)]++;
mers.emplace_back(i, occ, (uint64_t)0);
}
xxhash hash;
for(unsigned i = 0; i < m; ++i) {
const auto seed = prg();
for(auto& meri : mers) {
hash.reset(seed);
hash.update(&seq.data()[meri.pos], k);
if(weight) hash.update(&meri.occ, sizeof(meri.occ));
meri.hash = hash.digest();
}
std::partial_sort(mers.begin(), mers.begin() + l, mers.end(), [&](const mer_info& x, const mer_info& y) { return x.hash < y.hash; });
std::sort(mers.begin(), mers.begin() + l, [&](const mer_info& x, const mer_info& y) { return x.pos < y.pos; });
for(unsigned j = 0; j < l; ++j)
block(i, j, mers[j].pos);
}
}
struct sketch {
std::string name;
unsigned k, l, m;
std::vector<char> data;
std::vector<char> rcdata;
bool operator==(const sketch& rhs) const {
return k == rhs.k && l == rhs.l && m == rhs.m && data == rhs.data && rcdata == rhs.rcdata;
}
// Read a sketch into this
void read(std::istream& is);
// Read a sketch
static sketch from_stream(std::istream& is) {
sketch sk;
sk.read(is);
return sk;
}
// Write sketch
void write(std::ostream& os) const;
};
template<typename EngineT = std::mt19937_64>
class omh_sketcher {
protected:
unsigned m_k, m_l, m_m;
LongSeed<EngineT>& m_seed;
EngineT m_prg;
inline void write_sketch(std::ostream& os, const std::string& seq) {
omh_pos(seq, m_k, m_l, m_m, m_prg, [&os, &seq, this](unsigned i, unsigned j, size_t pos) { os.write(seq.data() + pos, m_k); });
}
inline void compute_sketch(char* ptr, const char* seq) {
omh_pos(seq, m_k, m_l, m_m, m_prg,
[&ptr, &seq, this](unsigned i, unsigned j, size_t pos) { memcpy(ptr, seq + pos, m_k); ptr += m_k; });
}
public:
omh_sketcher(unsigned k, unsigned l, unsigned m, LongSeed<EngineT>& seed)
: m_k(k), m_l(l), m_m(m)
, m_seed(seed)
{ }
// Compute the positions in seq of the k-mers picked by omh and append then to res
void pos(const std::string& seq, std::vector<size_t>& res) {
m_seed(m_prg);
omh_pos(seq, m_k, m_l, m_m, m_prg, [&res](unsigned i, unsigned j, size_t pos) { res.push_back(pos); });
}
// Compute the positions in seq and return vector
inline std::vector<size_t> pos(const std::string& seq) {
std::vector<size_t> res;
pos(seq, res);
return res;
}
// Write sketch to an ostream
void write(std::ostream& os, const std::string& name, const std::string& seq, bool rc = false) {
m_seed(m_prg);
os << '>' << name << ' ' << m_k << ' ' << m_l << ' ' << m_m << ' ' << rc << '\n';
write_sketch(os, seq);
os << '\n';
if(rc) {
m_seed(m_prg);
std::string rcseq = reverse_complement(seq);
write_sketch(os, rcseq);
os << '\n';
}
}
// Sketch from sequence
void compute(const std::string& seq, sketch& sk, bool rc = false) {
sk.k = m_k;
sk.l = m_l;
sk.m = m_m;
sk.data.resize(std::max(sk.l, (unsigned)1) * sk.m * sk.k);
m_seed(m_prg);
compute_sketch(sk.data.data(), seq.data());
if(rc) {
m_seed(m_prg);
std::string rcseq = reverse_complement(seq);
sk.rcdata.resize(sk.l * sk.m * sk.k);
compute_sketch(sk.rcdata.data(), rcseq.data());
}
}
// Sketch from sequence
sketch compute(const std::string& seq, bool rc = false) {
sketch sk;
compute(seq, sk, rc);
return sk;
}
double compare(const std::string& s1, const std::string& s2, bool rc = false) {
const auto sk1 = compute(s1, rc);
const auto sk2 = compute(s2, rc);
return compare_sketches(sk1, sk2);
}
};
// Compare 2 sketches. Return agreement in [0, 1]
double compare_sketches(const sketch& sk1, const sketch& sk2, ssize_t m = -1, bool circular = false);
#endif /* __OMH_H__ */
| [
"gmarcais@cs.cmu.edu"
] | gmarcais@cs.cmu.edu |
5f9876c3da43eadd4d2bec699c908fe47fe7a142 | e2bb8568b21bb305de3b896cf81786650b1a11f9 | /SDK/SCUM_Wooden_Stick_classes.hpp | 336bdc228983085982d45272e8a18937ecdfdd65 | [] | no_license | Buttars/SCUM-SDK | 822e03fe04c30e04df0ba2cb4406fe2c18a6228e | 954f0ab521b66577097a231dab2bdc1dd35861d3 | refs/heads/master | 2020-03-28T02:45:14.719920 | 2018-09-05T17:53:23 | 2018-09-05T17:53:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 904 | hpp | #pragma once
// SCUM (0.1.17) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "SCUM_Wooden_Stick_structs.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass Wooden_Stick.Wooden_Stick_C
// 0x0008 (0x07A8 - 0x07A0)
class AWooden_Stick_C : public AEquipmentItem
{
public:
class UMeleeAttackCollisionCapsule* MeleeAttackCollisionCapsule1; // 0x07A0(0x0008) (CPF_BlueprintVisible, CPF_ZeroConstructor, CPF_InstancedReference, CPF_IsPlainOldData)
static UClass* StaticClass()
{
static auto ptr = UObject::FindObject<UClass>("BlueprintGeneratedClass Wooden_Stick.Wooden_Stick_C");
return ptr;
}
void UserConstructionScript();
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"igromanru@yahoo.de"
] | igromanru@yahoo.de |
e96b3b01ad7f3ad109159c5668b72f4538871cbd | e4f3379add5a033c9c98fec029135742d2d977f6 | /Spectrum_Simulation_Code/outputFileHandler.h | ba05878caf6ec1a5258ca0090a15a56596b1f6ea | [] | no_license | oygx210/LISA-Asteroid-Simulation | cdc711dd299ba8f35adc1e1060411ca058cf5284 | 7eff478a63689db6983588f6a382540c7906bc27 | refs/heads/master | 2022-11-29T14:12:28.286527 | 2020-08-13T15:35:21 | 2020-08-13T15:35:21 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 683 | h | #pragma once
#include <vector>
#include <string>
#include "vec3d.cuh"
namespace lisa{
class outputFileHandler
{
std::vector<cudaUtil::vec3d> relativeAccelData;
std::vector<std::vector<cudaUtil::vec3d>> absoluteAccelData;
std::vector<std::vector<cudaUtil::vec3d>> unitVectorData;
public:
outputFileHandler();
outputFileHandler(
std::vector<cudaUtil::vec3d> inputRelData,
std::vector<std::vector<cudaUtil::vec3d>> inputAbsData,
std::vector<std::vector<cudaUtil::vec3d>> inputUnitVectors);
void writeDataToFile(std::string fileDiscriminator,
std::string headerString,
std::vector<double> fileTimes,
unsigned int seed);
};
}
| [
"davidbron15@gmail.com"
] | davidbron15@gmail.com |
3886d4acc650f6dd5662a6fb3847ae47d731e029 | 34b3623dbd185b9d8e6bc5af787ff656ebb8f837 | /finalProject/results/test/test_height/wedge05/0.5/uniform/time | 0a544f56dd790887621e19c13c1525e71076450a | [] | no_license | kenneth-meyer/COE347 | 6426252133cdb94582b49337d44bdc5759d96cda | a4f1e5f3322031690a180d0815cc8272b6f89726 | refs/heads/master | 2023-04-25T04:03:37.617189 | 2021-05-16T02:40:23 | 2021-05-16T02:40:23 | 339,565,109 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 821 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 7
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "0.5/uniform";
object time;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
value 0.499999999999999944;
name "0.5";
index 10;
deltaT 0.05;
deltaT0 0.05;
// ************************************************************************* //
| [
"kmeyer299@gmail.com"
] | kmeyer299@gmail.com | |
cfa7ae64dd68d5c3f1d2661c611adf8dd803597b | da6fb68b624a07351c6e06020f5818117c0c9edd | /cpp/include/XneloUtils/Testing/TestingStatistics.hpp | 800637be0ceb7a1f9b01c43949b3c29c0a9bf5f9 | [] | no_license | xnelo/XneloUtils | db7514bf2a54e3d302d09a7ae86838431f1a25fc | 234e756b32d8fc18ddf1b1122f391376ce1fa215 | refs/heads/master | 2020-07-15T04:04:31.352500 | 2019-10-16T02:43:18 | 2019-10-16T02:43:18 | 205,474,685 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,148 | hpp | #pragma region Copyright 2019 Spencer Hoffa
/// <file> TestingStatistics.hpp </file>
/// <author> Spencer Hoffa </author>
///
/// <copyright> 2019 Spencer Hoffa </copyright>
///
/// <summary>
/// </summary>
///
/// <license>
/// The zlib/libpng License
/// Copyright(c) 2019 Spencer Hoffa
///
/// 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.
///
/// This liscense can also be found at : http ://opensource.org/licenses/Zlib
/// </license>
#pragma endregion
#ifndef ___XNELO_TEST_TESTSTATISTICS_HPP__5_27_2019___
#define ___XNELO_TEST_TESTSTATISTICS_HPP__5_27_2019___
#include "XneloUtils/Core/BasicTypes.hpp"
namespace XNELO
{
namespace TEST
{
struct TestingStatistics
{
public:
// Test case stats
XNELO::CORE::uint32 TestCasesFailed = 0;
XNELO::CORE::uint32 TestCasesPassed = 0;
XNELO::CORE::uint32 TestCasesRun = 0;
// Test Group stats
XNELO::CORE::uint32 TestGroupFailed = 0;
XNELO::CORE::uint32 TestGroupPassed = 0;
XNELO::CORE::uint32 TestGroupRun = 0;
// Number of asserts
XNELO::CORE::uint32 TotalAssertsFailed = 0;
XNELO::CORE::uint32 TotalAssertsPassed = 0;
XNELO::CORE::uint32 TotalAssertsRun = 0;
};
} // !TEST
} // !XNELO
#endif // !___XNELO_TEST_TESTSTATISTICS_HPP__5_27_2019___
| [
"xnelo.productions@gmail.com"
] | xnelo.productions@gmail.com |
66b6561a38e8194c31e335da6ffd740b9caacde3 | eb1517897d7e9e372538b0982223b7ecaaff46b0 | /chrome/browser/ui/views/location_bar/cookie_controls_icon_view.h | 8896e08e9f869fba148a17311ec132ad87c1e1e6 | [
"BSD-3-Clause"
] | permissive | jiachengii/chromium | c93e9cfa8fb79d6a0b5e66848dc204e87236252c | ead0d3601849269629ff31de4daed20fce453ba7 | refs/heads/master | 2022-11-16T02:35:53.671352 | 2020-06-13T06:43:44 | 2020-06-13T06:43:44 | 271,964,385 | 0 | 0 | BSD-3-Clause | 2020-06-13T07:47:21 | 2020-06-13T07:47:21 | null | UTF-8 | C++ | false | false | 2,222 | h | // Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_COOKIE_CONTROLS_ICON_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_COOKIE_CONTROLS_ICON_VIEW_H_
#include <memory>
#include "base/macros.h"
#include "base/scoped_observer.h"
#include "chrome/browser/ui/cookie_controls/cookie_controls_controller.h"
#include "chrome/browser/ui/cookie_controls/cookie_controls_view.h"
#include "chrome/browser/ui/views/location_bar/cookie_controls_bubble_view.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "components/content_settings/core/common/cookie_controls_status.h"
// View for the cookie control icon in the Omnibox.
class CookieControlsIconView : public PageActionIconView,
public CookieControlsView {
public:
CookieControlsIconView(
IconLabelBubbleView::Delegate* icon_label_bubble_delegate,
PageActionIconView::Delegate* page_action_icon_delegate);
~CookieControlsIconView() override;
// CookieControlsUI:
void OnStatusChanged(CookieControlsStatus status,
CookieControlsEnforcement enforcement,
int blocked_cookies) override;
void OnBlockedCookiesCountChanged(int blocked_cookies) override;
// PageActionIconView:
views::BubbleDialogDelegate* GetBubble() const override;
void UpdateImpl() override;
base::string16 GetTextForTooltipAndAccessibleName() const override;
protected:
void OnExecuting(PageActionIconView::ExecuteSource source) override;
const gfx::VectorIcon& GetVectorIcon() const override;
const char* GetClassName() const override;
private:
bool HasAssociatedBubble() const;
bool ShouldBeVisible() const;
CookieControlsStatus status_ = CookieControlsStatus::kUninitialized;
bool has_blocked_cookies_ = false;
std::unique_ptr<CookieControlsController> controller_;
ScopedObserver<CookieControlsController, CookieControlsView> observer_{this};
DISALLOW_COPY_AND_ASSIGN(CookieControlsIconView);
};
#endif // CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_COOKIE_CONTROLS_ICON_VIEW_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
31d353aeb4887d2c9d2eda0f50c87b530b332676 | 558ba8c1cc35d9fb337828cb12e54688c60a3e37 | /esc-calibration/ESC_testv3/esc.h | 0358bb3b86260bd603b928c72b95043bc40bc6d6 | [] | no_license | Mongosaurusrex/vitaincaelo | 3cb2dfc032aa1c2b977e0020ed6f5dcb9dec3803 | 3a5208042760872c2666e26cebf0d4a9817155bb | refs/heads/master | 2021-01-22T18:42:47.542354 | 2017-04-18T16:38:33 | 2017-04-18T16:38:33 | 85,105,440 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 188 | h | class Esc{
public:
Esc(servo); //constructor
void setSpeed(int);
int getSpeed(void);
private:
int speed;
int pin;
int maxSignal = 2000;
int minSignal = 700;
Servo esc;
} | [
"megajonas20@gmail.com"
] | megajonas20@gmail.com |
66da660dd31d3db5f875e5ba3927d1eb04d26cef | 7958af8e7003c16152d18a20195d0d581e5c0cd1 | /usr/src/linux-headers-3.19.0-25-generic/scripts/kconfig/qconf.cc | 6c9aa8df6c520998f844afcab9b800ec80979032 | [] | no_license | MattheusNiels/BackupCerberus | deca62779fdd038e8e4ca0643d80a3da396edce4 | 7cee8b512255dbde6a9e58868163acbfbccc35c3 | refs/heads/master | 2021-01-10T16:16:15.995111 | 2016-03-04T11:17:09 | 2016-03-04T11:17:09 | 52,680,495 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 57 | cc | ../../../linux-headers-3.19.0-25/scripts/kconfig/qconf.cc | [
"niels.mattheus@student.ucll.be"
] | niels.mattheus@student.ucll.be |
f6c07b7d6c820c843215a6a308cb7d4390d3afaf | 06a20f6b5473600d1264ef235fec4baf8e6f402a | /MidasMiner/Level.h | 2c0b04a1341364551264a72eb601461385aba1a0 | [] | no_license | yingwang/MidasMiner | c023f8215684c59ce7a25cefd651104ce8111890 | f4cb0c224b3204e58d65a0a59ef61e5855caaccb | refs/heads/master | 2020-05-29T15:06:52.850003 | 2016-07-17T20:52:52 | 2016-07-17T20:52:52 | 63,551,825 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 682 | h | //
// Level.h
// MidasMiner
//
// Created by Ying Wang on 07/05/16.
// Copyright © 2016 Ying. All rights reserved.
//
#ifndef Level_h
#define Level_h
#include <vector>
#include "Header.h"
#include "Diamond.h"
using namespace std;
class Level
{
private:
int numOfRow = 8;
int numOfCol = 8;
vector<bool> map =
{
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
};
int time;
int moves;
public:
vector<bool> GetMap();
int GetNumOfRow();
int GetNumOfCol();
};
#endif /* Level_h */
| [
"yingwang@Yings-MacBook-Air-2.local"
] | yingwang@Yings-MacBook-Air-2.local |
3661295635110f809b9f59fbcaa30d42f66f0d12 | 64c7d9713d474b21eb873aff1ba18f2f0ffe238f | /AlgorithmStudy/개인/월간코드챌린지시즌3_2.cpp | ed25a372c72c9666677a6e87aa06897439bd680b | [] | no_license | sweethoneybee/AlgorithmStudy | 829a675e59761dd2e07c253c669d695f5451ab00 | be4ad9c8ce5eefe7feae6b2dc8840a9cd60f92de | refs/heads/main | 2023-08-22T13:44:57.890020 | 2021-10-11T09:15:42 | 2021-10-11T09:15:42 | 347,835,150 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,455 | cpp | //
// 월간코드챌린지시즌3_2.cpp
// AlgorithmStudy
//
// Created by 정성훈 on 2021/09/09.
//
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
using Field = vector<vector<vector<bool>>>;
struct ThreePair {
int first, second, third;
ThreePair(int a, int b, int c) : first(a), second(b), third(c){};
};
unsigned long rowLen = 0;
unsigned long columnLen = 0;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
void bfs(const vector<string>&, Field&, const ThreePair&, vector<int>&);
void optimizeCoord(int&, int&);
vector<int> solution(vector<string> grid) {
vector<int> answer;
rowLen = grid.size();
columnLen = grid.front().size();
Field field(rowLen, vector<vector<bool>>(columnLen, vector<bool>(4, false)));
for (int i = 0; i < rowLen; i++) {
for (int j = 0; j < columnLen; j++) {
for (int k = 0; k < 4; k++) {
if (field[i][j][k] == false) {
ThreePair start(i, j, k);
bfs(grid, field, start, answer);
}
}
}
}
sort(answer.begin(), answer.end());
return answer;
}
void bfs(const vector<string>& grid, Field& field, const ThreePair& start, vector<int>& answer) {
field[start.first][start.second][start.third] = true;
queue<ThreePair> que;
que.push(start);
int cycleLength = 1;
while (!que.empty()) {
int x = que.front().first;
int y = que.front().second;
int dirIndex = que.front().third;
que.pop();
switch (grid[x][y]) {
case 'L':
dirIndex = (dirIndex + 1) % 4;
break;
case 'R':
dirIndex = (dirIndex + 3) % 4;
break;
default:
break;
}
int nx = x + dx[dirIndex];
int ny = y + dy[dirIndex];
optimizeCoord(nx, ny);
if (field[nx][ny][dirIndex] == false) {
field[nx][ny][dirIndex] = true;
que.push(ThreePair(nx, ny, dirIndex));
cycleLength += 1;
}
}
answer.push_back(cycleLength);
}
void optimizeCoord(int& nx, int& ny) {
if (nx < 0) nx += rowLen;
else if (nx >= rowLen) nx -= rowLen;
if (ny < 0) ny += columnLen;
else if (ny >= columnLen) ny -= columnLen;
}
| [
"jsjphone8@gmail.com"
] | jsjphone8@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.