hexsha stringlengths 40 40 | size int64 22 2.4M | ext stringclasses 5
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 260 | max_stars_repo_name stringlengths 5 109 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 260 | max_issues_repo_name stringlengths 5 109 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 260 | max_forks_repo_name stringlengths 5 109 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 22 2.4M | avg_line_length float64 5 169k | max_line_length int64 5 786k | alphanum_fraction float64 0.06 0.95 | matches listlengths 1 11 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
021e89fb443e2f99c321183b38ff730bbc1d7dc2 | 76,351 | h | C | lib/jazz.stream/foreign/linux/gstreamer/gstreamer/include/gstreamer-1.0/gst/codecparsers/gsth265parser.h | jazzscheme/jazz | 2601f257212a0390e89ed6014915baf54c3fdad5 | [
"Condor-1.1"
] | 49 | 2015-03-20T14:59:33.000Z | 2022-01-31T15:42:08.000Z | lib/jazz.stream/foreign/linux/gstreamer/gstreamer/include/gstreamer-1.0/gst/codecparsers/gsth265parser.h | jazzscheme/jazz | 2601f257212a0390e89ed6014915baf54c3fdad5 | [
"Condor-1.1"
] | 8 | 2016-12-14T20:09:41.000Z | 2020-12-10T22:39:19.000Z | lib/jazz.stream/foreign/linux/gstreamer/gstreamer/include/gstreamer-1.0/gst/codecparsers/gsth265parser.h | jazzscheme/jazz | 2601f257212a0390e89ed6014915baf54c3fdad5 | [
"Condor-1.1"
] | 6 | 2017-05-20T06:58:59.000Z | 2021-08-18T17:33:37.000Z | /* Gstreamer H.265 bitstream parser
* Copyright (C) 2013 Intel Corporation
* Copyright (C) 2013 Sreerenj Balachandran <sreerenj.balachandran@intel.com>
*
* Contact: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_H265_PARSER_H__
#define __GST_H265_PARSER_H__
#ifndef GST_USE_UNSTABLE_API
#warning "The H.265 parsing library is unstable API and may change in future."
#warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
#endif
#include <gst/gst.h>
#include <gst/codecparsers/codecparsers-prelude.h>
G_BEGIN_DECLS
#define GST_H265_MAX_SUB_LAYERS 8
#define GST_H265_MAX_VPS_COUNT 16
#define GST_H265_MAX_SPS_COUNT 16
#define GST_H265_MAX_PPS_COUNT 64
#define GST_H265_IS_B_SLICE(slice) ((slice)->type == GST_H265_B_SLICE)
#define GST_H265_IS_P_SLICE(slice) ((slice)->type == GST_H265_P_SLICE)
#define GST_H265_IS_I_SLICE(slice) ((slice)->type == GST_H265_I_SLICE)
/**
* GST_H265_IS_NAL_TYPE_IDR:
* @nal_type: a #GstH265NalUnitType
*
* Check whether @nal_type is IDR or not
*
* Since: 1.18
*/
#define GST_H265_IS_NAL_TYPE_IDR(nal_type) \
((nal_type) == GST_H265_NAL_SLICE_IDR_W_RADL || (nal_type) == GST_H265_NAL_SLICE_IDR_N_LP)
/**
* GST_H265_IS_NAL_TYPE_IRAP:
* @nal_type: a #GstH265NalUnitType
*
* Check whether @nal_type is IRAP or not
*
* Since: 1.18
*/
#define GST_H265_IS_NAL_TYPE_IRAP(nal_type) \
((nal_type) >= GST_H265_NAL_SLICE_BLA_W_LP && (nal_type) <= RESERVED_IRAP_NAL_TYPE_MAX)
/**
* GST_H265_IS_NAL_TYPE_BLA:
* @nal_type: a #GstH265NalUnitType
*
* Check whether @nal_type is BLA or not
*
* Since: 1.18
*/
#define GST_H265_IS_NAL_TYPE_BLA(nal_type) \
((nal_type) >= GST_H265_NAL_SLICE_BLA_W_LP && (nal_type) <= GST_H265_NAL_SLICE_BLA_N_LP)
/**
* GST_H265_IS_NAL_TYPE_CRA:
* @nal_type: a #GstH265NalUnitType
*
* Check whether @nal_type is CRA or not
*
* Since: 1.18
*/
#define GST_H265_IS_NAL_TYPE_CRA(nal_type) \
((nal_type) == GST_H265_NAL_SLICE_CRA_NUT)
/**
* GST_H265_IS_NAL_TYPE_RADL:
* @nal_type: a #GstH265NalUnitType
*
* Check whether @nal_type is RADL or not
*
* Since: 1.18
*/
#define GST_H265_IS_NAL_TYPE_RADL(nal_type) \
((nal_type) == GST_H265_NAL_SLICE_RADL_N || (nal_type) == GST_H265_NAL_SLICE_RADL_R)
/**
* GST_H265_IS_NAL_TYPE_RASL:
* @nal_type: a #GstH265NalUnitType
*
* Check whether @nal_type is RASL or not
*
* Since: 1.18
*/
#define GST_H265_IS_NAL_TYPE_RASL(nal_type) \
((nal_type) == GST_H265_NAL_SLICE_RASL_N || (nal_type) == GST_H265_NAL_SLICE_RASL_R)
/**
* GstH265Profile:
* @GST_H265_PROFILE_MAIN: Main profile (A.3.2)
* @GST_H265_PROFILE_MAIN_10: Main 10 profile (A.3.3)
* @GST_H265_PROFILE_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
* @GST_H265_PROFILE_MONOCHROME: Monochrome profile (A.3.4)
* @GST_H265_PROFILE_MONOCHROME_12: Monochrome 12-bits profile (A.3.4)
* @GST_H265_PROFILE_MONOCHROME_16: Monochrome 16-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_12: Main profile 12-bits (A.3.4)
* @GST_H265_PROFILE_MAIN_422_10: Main 4:2:2 profile 10-bits (A.3.4)
* @GST_H265_PROFILE_MAIN_422_12: Main 4:2:2 profile 12-bits (A.3.4)
* @GST_H265_PROFILE_MAIN_444: Main 4:4:4 profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_10: Main 4:4:4 10-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_12: Main 4:4:4 12-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_INTRA: Main Intra profile (A.3.4)
* @GST_H265_PROFILE_MAIN_10_INTRA: Main Intra 10-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_12_INTRA: Main Intra 12-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_422_10_INTRA: Main Intra 4:2:2 10-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_422_12_INTRA: Main Intra 4:2:2 12-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_INTRA: Main Intra 4:4:4 profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_10_INTRA: Main Intra 4:4:4 10-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_12_INTRA: Main Intra 4:4:4 12-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_16_INTRA: Main Intra 4:4:4 16-bits profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_STILL_PICTURE: Main 4:4:4 Still Picture profile (A.3.4)
* @GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE: Main 4:4:4 16-bits Still Picture profile (A.3.4)
* @GST_H265_PROFILE_MONOCHROME_10: Monochrome 10-bits profile (A.3.5) (Since: 1.18)
* @GST_H265_PROFILE_HIGH_THROUGHPUT_444: High Throughput 4:4:4 profile (A.3.6) (Since: 1.18)
* @GST_H265_PROFILE_HIGH_THROUGHPUT_444_10: High Throughput 4:4:4 10-bits profile (A.3.6) (Since: 1.18)
* @GST_H265_PROFILE_HIGH_THROUGHPUT_444_14: High Throughput 4:4:4 14-bits profile (A.3.6) (Since: 1.18)
* @GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA: High Throughput 4:4:4 16-bits Intra profile (A.3.6) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN: Screen-Extended Main profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10: Screen-Extended Main 10-bits profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444: Screen-Extended Main 4:4:4 profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10: Screen-Extended Main 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444: Screen-Extended High Throughput 4:4:4 profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10: Screen-Extended High Throughput 4:4:4 10-bits profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14: Screen-Extended High Throughput 4:4:4 14-bits profile (A.3.7) (Since: 1.18)
* @GST_H265_PROFILE_MULTIVIEW_MAIN: Multiview Main profile (G.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MAIN: Scalable Main profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MAIN_10: Scalable Main 10-bits profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MONOCHROME: Scalable Monochrome profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MONOCHROME_12: Scalable Monochrome 12-bits profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MONOCHROME_16: Scalable Monochrome 16-bits profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_SCALABLE_MAIN_444: Scalable Main 4:4:4 profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_3D_MAIN: 3D Main 4:4:4 profile (I.11.1) (Since: 1.18)
*
* H.265 Profiles.
*
*/
typedef enum {
GST_H265_PROFILE_INVALID = -1,
GST_H265_PROFILE_MAIN = 1,
GST_H265_PROFILE_MAIN_10 = 2,
GST_H265_PROFILE_MAIN_STILL_PICTURE = 3,
GST_H265_PROFILE_MONOCHROME,
GST_H265_PROFILE_MONOCHROME_12,
GST_H265_PROFILE_MONOCHROME_16,
GST_H265_PROFILE_MAIN_12,
GST_H265_PROFILE_MAIN_422_10,
GST_H265_PROFILE_MAIN_422_12,
GST_H265_PROFILE_MAIN_444,
GST_H265_PROFILE_MAIN_444_10,
GST_H265_PROFILE_MAIN_444_12,
GST_H265_PROFILE_MAIN_INTRA,
GST_H265_PROFILE_MAIN_10_INTRA,
GST_H265_PROFILE_MAIN_12_INTRA,
GST_H265_PROFILE_MAIN_422_10_INTRA,
GST_H265_PROFILE_MAIN_422_12_INTRA,
GST_H265_PROFILE_MAIN_444_INTRA,
GST_H265_PROFILE_MAIN_444_10_INTRA,
GST_H265_PROFILE_MAIN_444_12_INTRA,
GST_H265_PROFILE_MAIN_444_16_INTRA,
GST_H265_PROFILE_MAIN_444_STILL_PICTURE,
GST_H265_PROFILE_MAIN_444_16_STILL_PICTURE,
GST_H265_PROFILE_MONOCHROME_10,
GST_H265_PROFILE_HIGH_THROUGHPUT_444,
GST_H265_PROFILE_HIGH_THROUGHPUT_444_10,
GST_H265_PROFILE_HIGH_THROUGHPUT_444_14,
GST_H265_PROFILE_HIGH_THROUGHPUT_444_16_INTRA,
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN,
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_10,
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444,
GST_H265_PROFILE_SCREEN_EXTENDED_MAIN_444_10,
GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444,
GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_10,
GST_H265_PROFILE_SCREEN_EXTENDED_HIGH_THROUGHPUT_444_14,
GST_H265_PROFILE_MULTIVIEW_MAIN,
GST_H265_PROFILE_SCALABLE_MAIN,
GST_H265_PROFILE_SCALABLE_MAIN_10,
GST_H265_PROFILE_SCALABLE_MONOCHROME,
GST_H265_PROFILE_SCALABLE_MONOCHROME_12,
GST_H265_PROFILE_SCALABLE_MONOCHROME_16,
GST_H265_PROFILE_SCALABLE_MAIN_444,
GST_H265_PROFILE_3D_MAIN,
/* end of the profiles */
GST_H265_PROFILE_MAX
} GstH265Profile;
/**
* GstH265ProfileIDC:
* @GST_H265_PROFILE_IDC_MAIN: Main profile (A.3.2)
* @GST_H265_PROFILE_IDC_MAIN_10: Main 10 profile (A.3.3)
* @GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE: Main Still Picture profile (A.3.4)
* @GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION: Format range extensions profile (A.3.5)
* @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT: High throughput profiles (A.3.6)
* @GST_H265_PROFILE_IDC_MULTIVIEW_MAIN: Multiview Main profiles (G.11.1) (Since: 1.18)
* @GST_H265_PROFILE_IDC_SCALABLE_MAIN: Scalable Main and Scalable Main 10 profile (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING: Screen content coding extensions profiles (A.3.7)
* @GST_H265_PROFILE_IDC_3D_MAIN: 3D Main profile (I.11.1) (Since: 1.18)
* @GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION: Scalable Format range extensions profiles (H.11.1) (Since: 1.18)
* @GST_H265_PROFILE_IDC_HIGH_THROUGHPUT_SCREEN_CONTENT_CODING_EXTENSION: High throughput screen content coding extensions profiles (A.3.8) (Since: 1.18)
*
* Valid values for the profile_idc field. This is different from
* #GstH265Profile as an extension idc can be used to encode a whole variety of
* profiles.
*
*/
typedef enum {
GST_H265_PROFILE_IDC_MAIN = 1,
GST_H265_PROFILE_IDC_MAIN_10 = 2,
GST_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3,
GST_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSION = 4,
GST_H265_PROFILE_IDC_HIGH_THROUGHPUT = 5,
GST_H265_PROFILE_IDC_MULTIVIEW_MAIN = 6,
GST_H265_PROFILE_IDC_SCALABLE_MAIN = 7,
GST_H265_PROFILE_IDC_3D_MAIN = 8,
GST_H265_PROFILE_IDC_SCREEN_CONTENT_CODING = 9,
GST_H265_PROFILE_IDC_SCALABLE_FORMAT_RANGE_EXTENSION = 10,
GST_H265_PROFILE_IDC_HIGH_THROUGHPUT_SCREEN_CONTENT_CODING_EXTENSION = 11,
} GstH265ProfileIDC;
/**
* GstH265NalUnitType:
* @GST_H265_NAL_SLICE_TRAIL_N: Slice nal of a non-TSA, non-STSA trailing picture
* @GST_H265_NAL_SLICE_TRAIL_R: Slice nal of a non-TSA, non-STSA trailing picture
* @GST_H265_NAL_SLICE_TSA_N: Slice nal of a TSA picture
* @GST_H265_NAL_SLICE_TSA_R: Slice nal of a TSA picture
* @GST_H265_NAL_SLICE_STSA_N: Slice nal of a STSA picture
* @GST_H265_NAL_SLICE_STSA_R: Slice nal of a STSA picture
* @GST_H265_NAL_SLICE_RADL_N: Slice nal of a RADL picture
* @GST_H265_NAL_SLICE_RADL_R: Slice nal of a RADL piicture
* @GST_H265_NAL_SLICE_RASL_N: Slice nal of a RASL picture
* @GST_H265_NAL_SLICE_RASL_R: Slice nal of a RASL picture
* @GST_H265_NAL_SLICE_BLA_W_LP: Slice nal of a BLA picture
* @GST_H265_NAL_SLICE_BLA_W_RADL: Slice nal of a BLA picture
* @GST_H265_NAL_SLICE_BLA_N_LP: Slice nal of a BLA picture
* @GST_H265_NAL_SLICE_IDR_W_RADL: Slice nal of an IDR picture
* @GST_H265_NAL_SLICE_IDR_N_LP: Slice nal of an IDR picture
* @GST_H265_NAL_SLICE_CRA_NUT: Slice nal of a CRA picture
* @GST_H265_NAL_VPS: Video parameter set(VPS) nal unit
* @GST_H265_NAL_SPS: Sequence parameter set (SPS) nal unit
* @GST_H265_NAL_PPS: Picture parameter set (PPS) nal unit
* @GST_H265_NAL_AUD: Access unit (AU) delimiter nal unit
* @GST_H265_NAL_EOS: End of sequence (EOS) nal unit
* @GST_H265_NAL_EOB: End of bitstream (EOB) nal unit
* @GST_H265_NAL_FD: Filler data (FD) nal lunit
* @GST_H265_NAL_PREFIX_SEI: Supplemental enhancement information prefix nal unit
* @GST_H265_NAL_SUFFIX_SEI: Suppliemental enhancement information suffix nal unit
*
* Indicates the type of H265 Nal Units
*/
typedef enum
{
GST_H265_NAL_SLICE_TRAIL_N = 0,
GST_H265_NAL_SLICE_TRAIL_R = 1,
GST_H265_NAL_SLICE_TSA_N = 2,
GST_H265_NAL_SLICE_TSA_R = 3,
GST_H265_NAL_SLICE_STSA_N = 4,
GST_H265_NAL_SLICE_STSA_R = 5,
GST_H265_NAL_SLICE_RADL_N = 6,
GST_H265_NAL_SLICE_RADL_R = 7,
GST_H265_NAL_SLICE_RASL_N = 8,
GST_H265_NAL_SLICE_RASL_R = 9,
GST_H265_NAL_SLICE_BLA_W_LP = 16,
GST_H265_NAL_SLICE_BLA_W_RADL = 17,
GST_H265_NAL_SLICE_BLA_N_LP = 18,
GST_H265_NAL_SLICE_IDR_W_RADL = 19,
GST_H265_NAL_SLICE_IDR_N_LP = 20,
GST_H265_NAL_SLICE_CRA_NUT = 21,
GST_H265_NAL_VPS = 32,
GST_H265_NAL_SPS = 33,
GST_H265_NAL_PPS = 34,
GST_H265_NAL_AUD = 35,
GST_H265_NAL_EOS = 36,
GST_H265_NAL_EOB = 37,
GST_H265_NAL_FD = 38,
GST_H265_NAL_PREFIX_SEI = 39,
GST_H265_NAL_SUFFIX_SEI = 40
} GstH265NalUnitType;
#define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MIN 10
#define RESERVED_NON_IRAP_SUBLAYER_NAL_TYPE_MAX 15
#define RESERVED_IRAP_NAL_TYPE_MIN 22
#define RESERVED_IRAP_NAL_TYPE_MAX 23
#define RESERVED_NON_IRAP_NAL_TYPE_MIN 24
#define RESERVED_NON_IRAP_NAL_TYPE_MAX 31
#define RESERVED_NON_VCL_NAL_TYPE_MIN 41
#define RESERVED_NON_VCL_NAL_TYPE_MAX 47
#define UNSPECIFIED_NON_VCL_NAL_TYPE_MIN 48
#define UNSPECIFIED_NON_VCL_NAL_TYPE_MAX 63
/**
* GstH265ParserResult:
* @GST_H265_PARSER_OK: The parsing succeeded
* @GST_H265_PARSER_BROKEN_DATA: The data to parse is broken
* @GST_H265_PARSER_BROKEN_LINK: The link to structure needed for the parsing couldn't be found
* @GST_H265_PARSER_ERROR: An error accured when parsing
* @GST_H265_PARSER_NO_NAL: No nal found during the parsing
* @GST_H265_PARSER_NO_NAL_END: Start of the nal found, but not the end.
*
* The result of parsing H265 data.
*/
typedef enum
{
GST_H265_PARSER_OK,
GST_H265_PARSER_BROKEN_DATA,
GST_H265_PARSER_BROKEN_LINK,
GST_H265_PARSER_ERROR,
GST_H265_PARSER_NO_NAL,
GST_H265_PARSER_NO_NAL_END
} GstH265ParserResult;
/**
* GstH265SEIPayloadType:
* @GST_H265_SEI_BUF_PERIOD: Buffering Period SEI Message
* @GST_H265_SEI_PIC_TIMING: Picture Timing SEI Message
* @GST_H265_SEI_REGISTERED_USER_DATA: Registered user data (D.2.5)
* @GST_H265_SEI_RECOVERY_POINT: Recovery Point SEI Message (D.3.8)
* @GST_H265_SEI_TIME_CODE: Time code SEI message (D.2.27) (Since: 1.16)
* @GST_H265_SEI_MASTERING_DISPLAY_COLOUR_VOLUME: Mastering display colour volume information SEI message (D.2.28) (Since: 1.18)
* @GST_H265_SEI_CONTENT_LIGHT_LEVEL: Content light level information SEI message (D.2.35) (Since: 1.18)
* ...
*
* The type of SEI message.
*/
typedef enum
{
GST_H265_SEI_BUF_PERIOD = 0,
GST_H265_SEI_PIC_TIMING = 1,
GST_H265_SEI_REGISTERED_USER_DATA = 4,
GST_H265_SEI_RECOVERY_POINT = 6,
GST_H265_SEI_TIME_CODE = 136,
GST_H265_SEI_MASTERING_DISPLAY_COLOUR_VOLUME = 137,
GST_H265_SEI_CONTENT_LIGHT_LEVEL = 144,
/* and more... */
} GstH265SEIPayloadType;
/**
* GstH265SEIPicStructType:
* @GST_H265_SEI_PIC_STRUCT_FRAME: Picture is a frame
* @GST_H265_SEI_PIC_STRUCT_TOP_FIELD: Top field of frame
* @GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD: Botom field of frame
* @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM: Top bottom field of frame
* @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP: bottom top field of frame
* @GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP: top bottom top field of frame
* @GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: bottom top bottom field of frame
* @GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING: indicates that the frame should
* be displayed two times consecutively
* @GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING: indicates that the frame should be
* displayed three times consecutively
* @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM: top field paired with
* previous bottom field in output order
* @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP: bottom field paried with
* previous top field in output order
* @GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM: top field paired with next
* bottom field in output order
* @GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP: bottom field paired with
* next top field in output order
*
* SEI pic_struct type
*/
typedef enum
{
GST_H265_SEI_PIC_STRUCT_FRAME = 0,
GST_H265_SEI_PIC_STRUCT_TOP_FIELD = 1,
GST_H265_SEI_PIC_STRUCT_BOTTOM_FIELD = 2,
GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM = 3,
GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP = 4,
GST_H265_SEI_PIC_STRUCT_TOP_BOTTOM_TOP = 5,
GST_H265_SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM = 6,
GST_H265_SEI_PIC_STRUCT_FRAME_DOUBLING = 7,
GST_H265_SEI_PIC_STRUCT_FRAME_TRIPLING = 8,
GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_PREVIOUS_BOTTOM = 9,
GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_PREVIOUS_TOP = 10,
GST_H265_SEI_PIC_STRUCT_TOP_PAIRED_NEXT_BOTTOM = 11,
GST_H265_SEI_PIC_STRUCT_BOTTOM_PAIRED_NEXT_TOP = 12
} GstH265SEIPicStructType;
/**
* GstH265SliceType:
*
* Type of Picture slice
*/
typedef enum
{
GST_H265_B_SLICE = 0,
GST_H265_P_SLICE = 1,
GST_H265_I_SLICE = 2
} GstH265SliceType;
typedef enum
{
GST_H265_QUANT_MATIX_4X4 = 0,
GST_H265_QUANT_MATIX_8X8 = 1,
GST_H265_QUANT_MATIX_16X16 = 2,
GST_H265_QUANT_MATIX_32X32 = 3
} GstH265QuantMatrixSize;
typedef struct _GstH265Parser GstH265Parser;
typedef struct _GstH265NalUnit GstH265NalUnit;
typedef struct _GstH265VPS GstH265VPS;
typedef struct _GstH265SPS GstH265SPS;
typedef struct _GstH265PPS GstH265PPS;
typedef struct _GstH265ProfileTierLevel GstH265ProfileTierLevel;
typedef struct _GstH265SubLayerHRDParams GstH265SubLayerHRDParams;
typedef struct _GstH265HRDParams GstH265HRDParams;
typedef struct _GstH265VUIParams GstH265VUIParams;
typedef struct _GstH265SPSExtensionParams GstH265SPSExtensionParams;
typedef struct _GstH265SPSSccExtensionParams GstH265SPSSccExtensionParams;
typedef struct _GstH265PPSExtensionParams GstH265PPSExtensionParams;
typedef struct _GstH265PPSSccExtensionParams GstH265PPSSccExtensionParams;
typedef struct _GstH265ScalingList GstH265ScalingList;
typedef struct _GstH265RefPicListModification GstH265RefPicListModification;
typedef struct _GstH265PredWeightTable GstH265PredWeightTable;
typedef struct _GstH265ShortTermRefPicSet GstH265ShortTermRefPicSet;
typedef struct _GstH265SliceHdr GstH265SliceHdr;
typedef struct _GstH265PicTiming GstH265PicTiming;
typedef struct _GstH265RegisteredUserData GstH265RegisteredUserData;
typedef struct _GstH265BufferingPeriod GstH265BufferingPeriod;
typedef struct _GstH265RecoveryPoint GstH265RecoveryPoint;
typedef struct _GstH265TimeCode GstH265TimeCode;
typedef struct _GstH265MasteringDisplayColourVolume GstH265MasteringDisplayColourVolume;
typedef struct _GstH265ContentLightLevel GstH265ContentLightLevel;
typedef struct _GstH265SEIMessage GstH265SEIMessage;
/**
* GstH265NalUnit:
* @type: A #GstH265NalUnitType
* @layer_id: A nal unit layer id
* @temporal_id_plus1: A nal unit temporal identifier
* @size: The size of the nal unit starting from @offset
* @offset: The offset of the actual start of the nal unit
* @sc_offset:The offset of the start code of the nal unit
* @valid: If the nal unit is valid, which mean it has
* already been parsed
* @data: The data from which the Nalu has been parsed
*
* Structure defining the Nal unit headers
*/
struct _GstH265NalUnit
{
guint8 type;
guint8 layer_id;
guint8 temporal_id_plus1;
/* calculated values */
guint size;
guint offset;
guint sc_offset;
gboolean valid;
guint8 *data;
guint8 header_bytes;
};
/**
* GstH265ProfileTierLevel:
* @profile_space: specifies the context for the interpretation of
* general_profile_idc and general_profile_combatibility_flag
* @tier_flag: the tier context for the interpretation of general_level_idc
* @profile_idc: profile id
* @profile_compatibility_flag: compatibility flags
* @progressive_source_flag: flag to indicate the type of stream
* @interlaced_source_flag: flag to indicate the type of stream
* @non_packed_constraint_flag: indicate the presence of frame packing
* arrangement sei message
* @frame_only_constraint_flag: recognize the field_seq_flag
* @max_12bit_constraint_flag: used to define profile extensions, see Annex A
* @max_10bit_constraint_flag: used to define profile extensions, see Annex A
* @max_8bit_constraint_flag: used to define profile extensions, see Annex A
* @max_422chroma_constraint_flag: used to define profile extensions, see Annex A
* @max_420chroma_constraint_flag: used to define profile extensions, see Annex A
* @max_monochrome_constraint_flag: used to define profile extensions, see Annex A
* @intra_constraint_flag: used to define profile extensions, see Annex A
* @one_picture_only_constraint_flag: used to define profile extensions, see Annex A
* @lower_bit_rate_constraint_flag: used to define profile extensions, see Annex A
* @max_14bit_constraint_flag: used to define profile extensions, see Annex A
* @level idc: indicate the level which the CVS confirms
* @sub_layer_profile_present_flag: sublayer profile presence ind
* @sub_layer_level_present_flag:sublayer level presence indicator.
* @sub_layer_profile_space: profile space for sublayers
* @sub_layer_tier_flag: tier flags for sublayers.
* @sub_layer_profile_idc: conformant profile indicator for sublayers.
* @sub_layer_profile_compatibility_flag[6][32]: compatibility flags for sublayers
* @sub_layer_progressive_source_flag:progressive stream indicator for sublayer
* @sub_layer_interlaced_source_flag: interlaced stream indicator for sublayer
* @sub_layer_non_packed_constraint_flag: indicate the presence of
* frame packing arrangement sei message with in sublayers
* @sub_layer_frame_only_constraint_flag:recognize the sublayer
* specific field_seq_flag
* @sub_layer_level_idc:indicate the sublayer specific level
*
* Define ProfileTierLevel parameters
*/
struct _GstH265ProfileTierLevel {
guint8 profile_space;
guint8 tier_flag;
guint8 profile_idc;
guint8 profile_compatibility_flag[32];
guint8 progressive_source_flag;
guint8 interlaced_source_flag;
guint8 non_packed_constraint_flag;
guint8 frame_only_constraint_flag;
guint8 max_12bit_constraint_flag;
guint8 max_10bit_constraint_flag;
guint8 max_8bit_constraint_flag;
guint8 max_422chroma_constraint_flag;
guint8 max_420chroma_constraint_flag;
guint8 max_monochrome_constraint_flag;
guint8 intra_constraint_flag;
guint8 one_picture_only_constraint_flag;
guint8 lower_bit_rate_constraint_flag;
guint8 max_14bit_constraint_flag;
guint8 level_idc;
guint8 sub_layer_profile_present_flag[6];
guint8 sub_layer_level_present_flag[6];
guint8 sub_layer_profile_space[6];
guint8 sub_layer_tier_flag[6];
guint8 sub_layer_profile_idc[6];
guint8 sub_layer_profile_compatibility_flag[6][32];
guint8 sub_layer_progressive_source_flag[6];
guint8 sub_layer_interlaced_source_flag[6];
guint8 sub_layer_non_packed_constraint_flag[6];
guint8 sub_layer_frame_only_constraint_flag[6];
guint8 sub_layer_level_idc[6];
};
/**
* GstH265SubLayerHRDParams:
* @bit_rate_value_minus1:togeter with bit_rate_scale, it specifies
* the maximum input bitrate when the CPB operates at the access
* unit level
* @cpb_size_value_minus1: is used together with cpb_size_scale to
* specify the CPB size when the CPB operates at the access unit
* level
* @cpb_size_du_value_minus1: is used together with cpb_size_du_scale
* to specify the CPB size when the CPB operates at sub-picture
* level
* @bit_rate_du_value_minus1: together with bit_rate_scale, it
* specifies the maximum input bit rate when the CPB operates at the
* sub-picture level
* @cbr_flag: indicate whether HSS operates in intermittent bit rate
* mode or constant bit rate mode.
*
* Defines the Sublayer HRD parameters
*/
struct _GstH265SubLayerHRDParams
{
guint32 bit_rate_value_minus1[32];
guint32 cpb_size_value_minus1[32];
guint32 cpb_size_du_value_minus1[32];
guint32 bit_rate_du_value_minus1[32];
guint8 cbr_flag[32];
};
/**
* GstH265HRDParams:
* @nal_hrd_parameters_present_flag: indicate the presence of NAL HRD parameters
* @vcl_hrd_parameters_present_flag: indicate the presence of VCL HRD parameters
* @sub_pic_hrd_params_present_flag: indicate the presence of sub_pic_hrd_params
* @tick_divisor_minus2: is used to specify the clock sub-tick
* @du_cpb_removal_delay_increment_length_minus1: specifies the length,
* in bits, of the nal_initial_cpb_removal_delay
* @sub_pic_cpb_params_in_pic_timing_sei_flag: specifies the length, in bits, of
* the cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements.
* @dpb_output_delay_du_length_minu1: specifies the length, in bits, of the
* dpb_delay_offset and the pic_dpb_output_delay syntax elements
* @bit_rate_scale: maximum input bitrate
* @cpb_size_scale: CPB size when operates in access unit level
* @cpb_size_du_scale: CPB size when operates in sub-picture level
* @initial_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
* nal_initial_cpb_removal_delay, nal_initial_cpb_removal_offset,
* vcl_initial_cpb_removal_delay and vcl_initial_cpb_removal_offset.
* @au_cpb_removal_delay_length_minus1: specifies the length, in bits, of the
* cpb_delay_offset and the au_cpb_removal_delay_minus1 syntax elements
* @dpb_output_delay_length_minus1: specifies the length, in bits, of the
* dpb_delay_offset and the pic_dpb_output_delay syntax elements
* @fixed_pic_rate_general_flag: flag to indicate the presence of constraint
* on the temporal distance between the HRD output times of consecutive
* pictures in output order
* @fixed_pic_rate_within_cvs_flag: same as fixed_pic_rate_general_flag
* @elemental_duration_in_tc_minus1: temporal distance in clock ticks
* @low_delay_hrd_flag: specifies the HRD operational mode
* @cpb_cnt_minus1:specifies the number of alternative CPS specifications.
* @sublayer_hrd_params: Sublayer HRD parameters.
*
* Defines the HRD parameters
*/
struct _GstH265HRDParams
{
guint8 nal_hrd_parameters_present_flag;
guint8 vcl_hrd_parameters_present_flag;
guint8 sub_pic_hrd_params_present_flag;
guint8 tick_divisor_minus2;
guint8 du_cpb_removal_delay_increment_length_minus1;
guint8 sub_pic_cpb_params_in_pic_timing_sei_flag;
guint8 dpb_output_delay_du_length_minus1;
guint8 bit_rate_scale;
guint8 cpb_size_scale;
guint8 cpb_size_du_scale;
guint8 initial_cpb_removal_delay_length_minus1;
guint8 au_cpb_removal_delay_length_minus1;
guint8 dpb_output_delay_length_minus1;
guint8 fixed_pic_rate_general_flag [7];
guint8 fixed_pic_rate_within_cvs_flag [7];
guint16 elemental_duration_in_tc_minus1 [7];
guint8 low_delay_hrd_flag [7];
guint8 cpb_cnt_minus1[7];
GstH265SubLayerHRDParams sublayer_hrd_params[7];
};
/**
* GstH265VPS:
* @id: vps id
* @base_layer_internal_flag and @base_layer_available_flag:
* specify availability of base layer
* @max_layers_minus1: should be zero, but can be other values in future
* @max_sub_layers_minus1:specifies the maximum number of temporal sub-layers
* @temporal_id_nesting_flag: specifies whether inter prediction is
* additionally restricted
* @profile_tier_level: ProfileTierLevel info
* @sub_layer_ordering_info_present_flag: indicates the presence of
* vps_max_dec_pic_buffering_minus1, vps_max_num_reorder_pics and
* vps_max_latency_increase_plus1
* @max_dec_pic_buffering_minus1: specifies the maximum required size
* of the decoded picture buffer
* @max_num_reorder_pics: indicates the maximum allowed number of
* pictures that can precede any picture in the CVS in decoding
* order
* @max_latency_increase_plus1: is used to compute the value of
* VpsMaxLatencyPictures
* @max_layer_id: specifies the maximum allowed value of nuh_layer_id
* @num_layer_sets_minus1: specifies the number of layer sets
* @layer_id_included_flag: specifies whether a nuh_layer_id included
* in the layer identifier list
* @timing_info_present_flag: indicate the presence of
* num_units_in_tick, time_scale, poc_proportional_to_timing_flag
* and num_hrd_parameters
* @num_units_in_tick: number of time units in a tick
* @time_scale: number of time units that pass in one second
* @poc_proportional_to_timing_flag: indicate whether the picture
* order count is proportional to output timin
* @num_ticks_poc_diff_one_minus1: specifies the number of clock ticks
* corresponding to a difference of picture order count values equal
* to 1
* @num_hrd_parameters: number of hrd_parameters present
* @hrd_layer_set_idx: index to the list of layer hrd params.
* @hrd_params: the GstH265HRDParams list
*
* Defines the VPS parameters
*/
struct _GstH265VPS {
guint8 id;
guint8 base_layer_internal_flag;
guint8 base_layer_available_flag;
guint8 max_layers_minus1;
guint8 max_sub_layers_minus1;
guint8 temporal_id_nesting_flag;
GstH265ProfileTierLevel profile_tier_level;
guint8 sub_layer_ordering_info_present_flag;
guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
guint32 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
guint8 max_layer_id;
guint16 num_layer_sets_minus1;
guint8 timing_info_present_flag;
guint32 num_units_in_tick;
guint32 time_scale;
guint8 poc_proportional_to_timing_flag;
guint32 num_ticks_poc_diff_one_minus1;
guint16 num_hrd_parameters;
/* FIXME: following HRD related info should be an array */
guint16 hrd_layer_set_idx;
guint8 cprms_present_flag;
GstH265HRDParams hrd_params;
guint8 vps_extension;
gboolean valid;
};
/**
* GstH265ShortTermRefPicSet:
* @inter_ref_pic_set_prediction_flag: %TRUE specifies that the stRpsIdx-th candidate
* short-term RPS is predicted from another candidate short-term RPS
* @delta_idx_minus1: plus 1 specifies the difference between the value of source and
* candidate short term RPS.
* @delta_rps_sign: delta_rps_sign and abs_delta_rps_minus1 together specify
* the value of the variable deltaRps.
* @abs_delta_rps_minus1: delta_rps_sign and abs_delta_rps_minus1 together specify
* the value of the variable deltaRps
* @NumDeltaPocs: sum of @NumNegativePics and @NumPositivePics.
* @NumNegativePics: Derived value depending on inter_ref_pic_set_prediction_flag.
* If inter_ref_pic_set_prediction_flag is equal to 0, this specifies
* the number of entries in the stRpsIdx-th candidate
* short-term RPS that have poc values less than the poc of the current picture.
* @NumPositivePics: Derived value depending on inter_ref_pic_set_prediction_flag.
* If inter_ref_pic_set_prediction_flag is equal to 0, this specifies
* the number of entires in the stRpsIdx-th candidate
* short-term RPS that have poc values greater than the poc value of the current picture.
* @UsedByCurrPicS0: Derived value depending on inter_ref_pic_set_prediction_flag.
* If inter_ref_pic_set_prediction_flag is equal to 0,
* equal to zero specifies that the i-th entry in the stRpsIdx-th
* candidate short-term RPS that has poc value less than of the current picture
* is not used for reference by the current picture
* @UsedByCurrPicS1: Derived value depending on inter_ref_pic_set_prediction_flag.
* If inter_ref_pic_set_prediction_flag is equal to 0,
* equal to zero specifies that the i-th entry in the current
* candidate short-term RPS that has poc value greater than that of the current picture
* is not used for reference by the current picture.
* @DeltaPocS0: Derived value depending on inter_ref_pic_set_prediction_flag.
* See 7.4.8 Short-term reference picture set semantics
* @DeltaPocS1: Derived value depending on inter_ref_pic_set_prediction_flag.
* See 7.4.8 Short-term reference picture set semantics
* @NumDeltaPocsOfRefRpsIdx: The value of NumDeltaPocs[RefRpsIdx].
* If inter_ref_pic_set_prediction_flag is equal to 0,
* this value should be ignored (Since: 1.18)
*
* Defines the #GstH265ShortTermRefPicSet params
*/
struct _GstH265ShortTermRefPicSet
{
guint8 inter_ref_pic_set_prediction_flag;
guint8 delta_idx_minus1;
guint8 delta_rps_sign;
guint16 abs_delta_rps_minus1;
/* calculated values */
guint8 NumDeltaPocs;
guint8 NumNegativePics;
guint8 NumPositivePics;
guint8 UsedByCurrPicS0[16];
guint8 UsedByCurrPicS1[16];
gint32 DeltaPocS0[16];
gint32 DeltaPocS1[16];
guint8 NumDeltaPocsOfRefRpsIdx;
};
/**
* GstH265VUIParams:
* @aspect_ratio_info_present_flag: %TRUE specifies that aspect_ratio_idc is present.
* %FALSE specifies that aspect_ratio_idc is not present
* @aspect_ratio_idc specifies the value of the sample aspect ratio of the luma samples
* @sar_width indicates the horizontal size of the sample aspect ratio
* @sar_height indicates the vertical size of the sample aspect ratio
* @overscan_info_present_flag: %TRUE overscan_appropriate_flag is present %FALSE otherwise
* @overscan_appropriate_flag: %TRUE indicates that the cropped decoded pictures
* output are suitable for display using overscan. %FALSE the cropped decoded pictures
* output contain visually important information
* @video_signal_type_present_flag: %TRUE specifies that video_format, video_full_range_flag and
* colour_description_present_flag are present.
* @video_format: indicates the representation of the picture
* @video_full_range_flag: indicates the black level and range of the luma and chroma signals
* @colour_description_present_flag: %TRUE specifies that colour_primaries,
* transfer_characteristics and matrix_coefficients are present
* @colour_primaries: indicates the chromaticity coordinates of the source primaries
* @transfer_characteristics: indicates the opto-electronic transfer characteristic
* @matrix_coefficients: describes the matrix coefficients used in deriving luma and chroma signals
* @chroma_loc_info_present_flag: %TRUE specifies that chroma_sample_loc_type_top_field and
* chroma_sample_loc_type_bottom_field are present, %FALSE otherwise
* @chroma_sample_loc_type_top_field: specify the location of chroma for top field
* @chroma_sample_loc_type_bottom_field specify the location of chroma for bottom field
* @neutral_chroma_indication_flag: %TRUE indicate that the value of chroma samples is equla
* to 1<<(BitDepthchrom-1).
* @field_seq_flag: %TRUE indicate field and %FALSE indicate frame
* @frame_field_info_present_flag: %TRUE indicate picture timing SEI messages are present for every
* picture and include the pic_struct, source_scan_type, and duplicate_flag syntax elements.
* @default_display_window_flag: %TRUE indicate that the default display window parameters present
* def_disp_win_left_offset:left offset of display rect
* def_disp_win_right_offset: right offset of display rect
* def_disp_win_top_offset: top offset of display rect
* def_disp_win_bottom_offset: bottom offset of display rect
* @timing_info_present_flag: %TRUE specifies that num_units_in_tick,
* time_scale and fixed_frame_rate_flag are present in the bitstream
* @num_units_in_tick: is the number of time units of a clock operating at the frequency time_scale Hz
* @time_scale: is the number of time units that pass in one second
* @poc_proportional_to_timing_flag: %TRUE indicates that the picture order count value for each picture
* in the CVS that is not the first picture in the CVS, in decoding order, is proportional to the output
* time of the picture relative to the output time of the first picture in the CVS.
* @num_ticks_poc_diff_one_minus1: plus 1 specifies the number of clock ticks corresponding to a
* difference of picture order count values equal to 1
* @hrd_parameters_present_flag: %TRUE if hrd parameters present in the bitstream
* @bitstream_restriction_flag: %TRUE specifies that the following coded video sequence bitstream restriction
* parameters are present
* @tiles_fixed_structure_flag: %TRUE indicates that each PPS that is active in the CVS has the same value
* of the syntax elements num_tile_columns_minus1, num_tile_rows_minus1, uniform_spacing_flag,
* column_width_minus1, row_height_minus1 and loop_filter_across_tiles_enabled_flag, when present
* @motion_vectors_over_pic_boundaries_flag: %FALSE indicates that no sample outside the
* picture boundaries and no sample at a fractional sample position, %TRUE indicates that one or more
* samples outside picture boundaries may be used in inter prediction
* @restricted_ref_pic_list_flag: %TRUE indicates that all P and B slices (when present) that belong to
* the same picture have an identical reference picture list 0, and that all B slices (when present)
* that belong to the same picture have an identical reference picture list 1
* @min_spatial_segmentation_idc: when not equal to 0, establishes a bound on the maximum possible size
* of distinct coded spatial segmentation regions in the pictures of the CVS
* @max_bytes_per_pic_denom: indicates a number of bytes not exceeded by the sum of the sizes of
* the VCL NAL units associated with any coded picture in the coded video sequence.
* @max_bits_per_min_cu_denom: indicates an upper bound for the number of coded bits of coding_unit
* data for any coding block in any picture of the CVS
* @log2_max_mv_length_horizontal: indicate the maximum absolute value of a decoded horizontal
* motion vector component
* @log2_max_mv_length_vertical: indicate the maximum absolute value of a decoded vertical
* motion vector component
*
* The structure representing the VUI parameters.
*/
struct _GstH265VUIParams
{
guint8 aspect_ratio_info_present_flag;
guint8 aspect_ratio_idc;
/* if aspect_ratio_idc == 255 */
guint16 sar_width;
guint16 sar_height;
guint8 overscan_info_present_flag;
/* if overscan_info_present_flag */
guint8 overscan_appropriate_flag;
guint8 video_signal_type_present_flag;
guint8 video_format;
guint8 video_full_range_flag;
guint8 colour_description_present_flag;
guint8 colour_primaries;
guint8 transfer_characteristics;
guint8 matrix_coefficients;
guint8 chroma_loc_info_present_flag;
guint8 chroma_sample_loc_type_top_field;
guint8 chroma_sample_loc_type_bottom_field;
guint8 neutral_chroma_indication_flag;
guint8 field_seq_flag;
guint8 frame_field_info_present_flag;
guint8 default_display_window_flag;
guint32 def_disp_win_left_offset;
guint32 def_disp_win_right_offset;
guint32 def_disp_win_top_offset;
guint32 def_disp_win_bottom_offset;
guint8 timing_info_present_flag;
/* if timing_info_present_flag */
guint32 num_units_in_tick;
guint32 time_scale;
guint8 poc_proportional_to_timing_flag;
/* if poc_proportional_to_timing_flag */
guint32 num_ticks_poc_diff_one_minus1;
guint8 hrd_parameters_present_flag;
/*if hrd_parameters_present_flat */
GstH265HRDParams hrd_params;
guint8 bitstream_restriction_flag;
/* if bitstream_restriction_flag */
guint8 tiles_fixed_structure_flag;
guint8 motion_vectors_over_pic_boundaries_flag;
guint8 restricted_ref_pic_lists_flag;
guint16 min_spatial_segmentation_idc;
guint8 max_bytes_per_pic_denom;
guint8 max_bits_per_min_cu_denom;
guint8 log2_max_mv_length_horizontal;
guint8 log2_max_mv_length_vertical;
/* calculated values */
guint par_n;
guint par_d;
};
/**
* GstH265SPSExtensionParams:
* @transform_skip_rotation_enabled_flag: %TRUE specifies that a rotation is applied to
* the residual data block from intra 4X4 blocks coded using a transform skip operation.
* @transform_skip_context_enabled_flag: %TRUE specifies tspecifies that a particular
* context is used for the parsing of the sig_coeff_flag for transform blocks with a skipped
* transform.
* @implicit_residual_dpcm_enabled_flag: %TRUE specifies that the residual modification process
* for blocks using a transform bypass may be used for intra blocks in the CVS
* @explicit_residual_dpcm_enabled_flag: %TRUE specifies that the residual modification process
* for blocks using a transform bypass may be used for inter blocks in the CVS
* @extended_precision_processing_flag: %TRUE specifies that an extended dynamic range is used
* for coefficient parsing and inverse transform processing
* @intra_smoothing_disabled_flag: %TRUE specifies that the filtering process of neighbouring
* samples is unconditionally disabled for intra prediction
* @high_precision_offsets_enabled_flag: %TRUE specifies that weighted prediction offset values
* are signalled using a bit-depth-dependent precision.
* @persistent_rice_adaptation_enabled_flag: %TRUE specifies that the Rice parameter derivation
* for the binarization of coeff_abs_level_remaining[] is initialized at the start of each
* sub-block using mode dependent statistics accumulated from previous sub-blocks.
* @cabac_bypass_alignment_enabled_flag: %TRUE specifies that a context-based adaptive binary
* arithmetic coding (CABAC) alignment process is used prior to bypass decoding of the syntax
* elements coeff_sign_flag[] and coeff_abs_level_remaining[]
*
* Defines the GstH265SPSExtensionParams
*/
struct _GstH265SPSExtensionParams {
guint8 transform_skip_rotation_enabled_flag;
guint8 transform_skip_context_enabled_flag;
guint8 implicit_rdpcm_enabled_flag;
guint8 explicit_rdpcm_enabled_flag;
guint8 extended_precision_processing_flag;
guint8 intra_smoothing_disabled_flag;
guint8 high_precision_offsets_enabled_flag;
guint8 persistent_rice_adaptation_enabled_flag;
guint8 cabac_bypass_alignment_enabled_flag;
};
/**
* GstH265SPSSccExtensionParams:
* @sps_curr_pic_ref_enabled_flag: equal to 1 specifies that a picture in the CVS may be
* included in a reference picture list of a slice of the picture itself.
* @palette_mode_enabled_flag: equal to 1 specifies that the decoding process for palette mode
* may be used for intra blocks. Equal to 0 specifies that the decoding process for palette
* mode is not applied.
* @palette_max_size: specifies the maximum allowed palette size.
* @delta_palette_max_predictor_size: specifies the difference between the maximum allowed
* palette predictor size and the maximum allowed palette size.
* @sps_palette_predictor_initializers_present_flag: equal to 1 specifies that the sequence
* palette predictors are initialized using the sps_palette_predictor_initializer specified
* in clause 7.3.2.2.3.
* @sps_num_palette_predictor_initializer_minus1: plus 1 specifies the number of entries in
* the sequence palette predictor initializer.
* @sps_palette_predictor_initializer: specifies the value of the comp-th component of the
* i-th palette entry in the SPS that is used to initialize the array PredictorPaletteEntries.
* @motion_vector_resolution_control_idc: controls the presence and inference of the
* use_integer_mv_flag that specifies the resolution of motion vectors for inter prediction.
* @intra_boundary_filtering_disabled_flag: equal to 1 specifies that the intra boundary
* filtering process is unconditionally disabled for intra prediction.
* Defines the _GstH265SPSSccExtensionParams
*
* Since: 1.18
*/
struct _GstH265SPSSccExtensionParams {
guint8 sps_curr_pic_ref_enabled_flag;
guint8 palette_mode_enabled_flag;
guint8 palette_max_size;
guint8 delta_palette_max_predictor_size;
guint8 sps_palette_predictor_initializers_present_flag;
guint8 sps_num_palette_predictor_initializer_minus1;
guint32 sps_palette_predictor_initializer[3][128];
guint8 motion_vector_resolution_control_idc;
guint8 intra_boundary_filtering_disabled_flag;
};
/**
* GstH265PPSExtensionParams:
* @log2_max_transform_skip_block_size_minus2: plus 2 specifies the maximum transform block size for which
* transform_skip_flag may be present in coded pictures referring to the PPS.
* @cross_component_prediction_enabled_flag: equal to 1 specifies that log2_res_scale_abs_plus1 and
* res_scale_sign_flag may be present in the transform unit syntax for pictures referring to the PPS.
* @chroma_qp_offset_list_enabled_flag: equal to 1 specifies that the cu_chroma_qp_offset_flag may be
* present in the transform unit syntax.
* @diff_cu_chroma_qp_offset_depth: specifies the difference between the luma coding tree block size and
* the minimum luma coding block size of coding units that convey cu_chroma_qp_offset_flag.
* @chroma_qp_offset_list_len_minus1: plus 1 specifies the number of cb_qp_offset_list[] and
* cr_qp_offset_list[] syntax elements that are present in the PPS.
* @cb_qp_offset_list: specify offsets used in the derivation of qp cb.
* @cr_qp_offset_list: specify offsets used in the derivation of qp cr.
* @log2_sao_offset_scale_luma: the base 2 logarithm of the scaling parameter that is used to scale sample
* adaptive offset (SAO) offset values for luma samples.
* @log2_sao_offset_scale_chroma: the base 2 logarithm of the scaling parameter that is used to scale SAO
* offset values for chroma samples.
*
* Defines the GstH265SPSExtensionParams
*/
struct _GstH265PPSExtensionParams {
guint32 log2_max_transform_skip_block_size_minus2;
guint8 cross_component_prediction_enabled_flag;
guint8 chroma_qp_offset_list_enabled_flag;
guint8 diff_cu_chroma_qp_offset_depth;
guint8 chroma_qp_offset_list_len_minus1;
gint8 cb_qp_offset_list[6];
gint8 cr_qp_offset_list[6];
guint8 log2_sao_offset_scale_luma;
guint8 log2_sao_offset_scale_chroma;
};
/**
* GstH265PPSSccExtensionParams:
* @pps_curr_pic_ref_enabled_flag: equal to 1 specifies that a picture referring to the PPS may
* be included in a reference picture list of a slice of the picture itself.
* @residual_adaptive_colour_transform_enabled_flag: equal to 1 specifies that an adaptive
* colour transform may be applied to the residual in the decoding process.
* @pps_slice_act_qp_offsets_present_flag: equal to 1 specifies that slice_act_y_qp_offset,
* slice_act_cb_qp_offset, slice_act_cr_qp_offset are present in the slice header.
* @pps_act_y_qp_offset_plus5 @pps_act_cb_qp_offset_plus5 @pps_act_cr_qp_offset_plus3:
* are used to determine the offsets that are applied to the quantization parameter values
* qp derived in clause 8.6.2 for the luma, Cb and Cr components, respectively, when
* tu_residual_act_flag[ xTbY ][ yTbY ] is equal to 1.
* @pps_palette_predictor_initializers_present_flag: equal to 1 specifies that the palette
* predictor initializers used for the pictures referring to the PPS are derived based on
* the palette predictor initializers specified by the PPS.
* @pps_num_palette_predictor_initializer: specifies the number of entries in the picture
* palette predictor initializer.
* @monochrome_palette_flag: equal to 1 specifies that the pictures that refer to this PPS
* are monochrome. Equal to 0 specifies that the pictures that refer to this PPS have
* multiple components.
* @luma_bit_depth_entry_minus8: plus 8 specifies the bit depth of the luma component of the
* entries of the palette predictor initializer.
* @chroma_bit_depth_entry_minus8: plus 8 specifies the bit depth of the chroma components of
* the entries of the palette predictor initializer.
* @pps_palette_predictor_initializer: specifies the value of the comp-th component of the
* i-th palette entry in the PPS that is used to initialize the array PredictorPaletteEntries.
* Defines the _GstH265PPSSccExtensionParams
*
* Since: 1.18
*/
struct _GstH265PPSSccExtensionParams {
guint8 pps_curr_pic_ref_enabled_flag;
guint8 residual_adaptive_colour_transform_enabled_flag;
guint8 pps_slice_act_qp_offsets_present_flag;
guint8 pps_act_y_qp_offset_plus5;
guint8 pps_act_cb_qp_offset_plus5;
guint8 pps_act_cr_qp_offset_plus3;
guint8 pps_palette_predictor_initializers_present_flag;
guint8 pps_num_palette_predictor_initializer;
guint8 monochrome_palette_flag;
guint8 luma_bit_depth_entry_minus8;
guint32 chroma_bit_depth_entry_minus8;
guint32 pps_palette_predictor_initializer[3][128];
};
/**
* GstH265ScalingList:
* @scaling_list_dc_coef_minus8_16x16: this plus 8 specifies the DC
* Coefficient values for 16x16 scaling list
* @scaling_list_dc_coef_minus8_32x32: this plus 8 specifies the DC
* Coefficient values for 32x32 scaling list
* @scaling_lists_4x4: 4x4 scaling list
* @scaling_lists_8x8: 8x8 scaling list
* @scaling_lists_16x16: 16x16 scaling list
* @guint8 scaling_lists_32x32: 32x32 scaling list
*
* Defines the GstH265ScalingList
*/
struct _GstH265ScalingList {
gint16 scaling_list_dc_coef_minus8_16x16[6];
gint16 scaling_list_dc_coef_minus8_32x32[2];
guint8 scaling_lists_4x4 [6][16];
guint8 scaling_lists_8x8 [6][64];
guint8 scaling_lists_16x16 [6][64];
guint8 scaling_lists_32x32 [2][64];
};
/**
* GstH265SPS:
* @id: The ID of the sequence parameter set
* @profile_idc: indicate the profile to which the coded video sequence conforms
*
* H265 Sequence Parameter Set (SPS)
*/
struct _GstH265SPS
{
guint8 id;
GstH265VPS *vps;
guint8 max_sub_layers_minus1;
guint8 temporal_id_nesting_flag;
GstH265ProfileTierLevel profile_tier_level;
guint8 chroma_format_idc;
guint8 separate_colour_plane_flag;
guint16 pic_width_in_luma_samples;
guint16 pic_height_in_luma_samples;
guint8 conformance_window_flag;
/* if conformance_window_flag */
guint32 conf_win_left_offset;
guint32 conf_win_right_offset;
guint32 conf_win_top_offset;
guint32 conf_win_bottom_offset;
guint8 bit_depth_luma_minus8;
guint8 bit_depth_chroma_minus8;
guint8 log2_max_pic_order_cnt_lsb_minus4;
guint8 sub_layer_ordering_info_present_flag;
guint8 max_dec_pic_buffering_minus1[GST_H265_MAX_SUB_LAYERS];
guint8 max_num_reorder_pics[GST_H265_MAX_SUB_LAYERS];
guint8 max_latency_increase_plus1[GST_H265_MAX_SUB_LAYERS];
guint8 log2_min_luma_coding_block_size_minus3;
guint8 log2_diff_max_min_luma_coding_block_size;
guint8 log2_min_transform_block_size_minus2;
guint8 log2_diff_max_min_transform_block_size;
guint8 max_transform_hierarchy_depth_inter;
guint8 max_transform_hierarchy_depth_intra;
guint8 scaling_list_enabled_flag;
/* if scaling_list_enabled_flag */
guint8 scaling_list_data_present_flag;
GstH265ScalingList scaling_list;
guint8 amp_enabled_flag;
guint8 sample_adaptive_offset_enabled_flag;
guint8 pcm_enabled_flag;
/* if pcm_enabled_flag */
guint8 pcm_sample_bit_depth_luma_minus1;
guint8 pcm_sample_bit_depth_chroma_minus1;
guint8 log2_min_pcm_luma_coding_block_size_minus3;
guint8 log2_diff_max_min_pcm_luma_coding_block_size;
guint8 pcm_loop_filter_disabled_flag;
guint8 num_short_term_ref_pic_sets;
GstH265ShortTermRefPicSet short_term_ref_pic_set[65];
guint8 long_term_ref_pics_present_flag;
/* if long_term_ref_pics_present_flag */
guint8 num_long_term_ref_pics_sps;
guint16 lt_ref_pic_poc_lsb_sps[32];
guint8 used_by_curr_pic_lt_sps_flag[32];
guint8 temporal_mvp_enabled_flag;
guint8 strong_intra_smoothing_enabled_flag;
guint8 vui_parameters_present_flag;
/* if vui_parameters_present_flat */
GstH265VUIParams vui_params;
guint8 sps_extension_flag;
/* if sps_extension_present_flag */
guint8 sps_range_extension_flag;
guint8 sps_multilayer_extension_flag;
guint8 sps_3d_extension_flag;
guint8 sps_scc_extension_flag;
guint8 sps_extension_4bits;
/* if sps_range_extension_flag */
GstH265SPSExtensionParams sps_extnsion_params;
/* if sps_scc_extension_flag */
GstH265SPSSccExtensionParams sps_scc_extension_params;
/* calculated values */
guint8 chroma_array_type;
gint width, height;
gint crop_rect_width, crop_rect_height;
gint crop_rect_x, crop_rect_y;
gint fps_num, fps_den;
gboolean valid;
};
/**
* GstH265PPS:
*
* H265 Picture Parameter Set
*/
struct _GstH265PPS
{
guint id;
GstH265SPS *sps;
guint8 dependent_slice_segments_enabled_flag;
guint8 output_flag_present_flag;
guint8 num_extra_slice_header_bits;
guint8 sign_data_hiding_enabled_flag;
guint8 cabac_init_present_flag;
guint8 num_ref_idx_l0_default_active_minus1;
guint8 num_ref_idx_l1_default_active_minus1;
gint8 init_qp_minus26;
guint8 constrained_intra_pred_flag;
guint8 transform_skip_enabled_flag;
guint8 cu_qp_delta_enabled_flag;
/*if cu_qp_delta_enabled_flag */
guint8 diff_cu_qp_delta_depth;
gint8 cb_qp_offset;
gint8 cr_qp_offset;
guint8 slice_chroma_qp_offsets_present_flag;
guint8 weighted_pred_flag;
guint8 weighted_bipred_flag;
guint8 transquant_bypass_enabled_flag;
guint8 tiles_enabled_flag;
guint8 entropy_coding_sync_enabled_flag;
guint8 num_tile_columns_minus1;
guint8 num_tile_rows_minus1;
guint8 uniform_spacing_flag;
guint32 column_width_minus1[19];
guint32 row_height_minus1[21];
guint8 loop_filter_across_tiles_enabled_flag;
guint8 loop_filter_across_slices_enabled_flag;
guint8 deblocking_filter_control_present_flag;
guint8 deblocking_filter_override_enabled_flag;
guint8 deblocking_filter_disabled_flag;
gint8 beta_offset_div2;
gint8 tc_offset_div2;
guint8 scaling_list_data_present_flag;
GstH265ScalingList scaling_list;
guint8 lists_modification_present_flag;
guint8 log2_parallel_merge_level_minus2;
guint8 slice_segment_header_extension_present_flag;
guint8 pps_extension_flag;
/* if pps_extension_flag*/
guint8 pps_range_extension_flag;
guint8 pps_multilayer_extension_flag;
guint8 pps_3d_extension_flag;
guint8 pps_scc_extension_flag;
guint8 pps_extension_4bits;
/* if pps_range_extension_flag*/
GstH265PPSExtensionParams pps_extension_params;
/* if pps_scc_extension_flag*/
GstH265PPSSccExtensionParams pps_scc_extension_params;
/* calculated values */
guint32 PicWidthInCtbsY;
guint32 PicHeightInCtbsY;
gboolean valid;
};
struct _GstH265RefPicListModification
{
guint8 ref_pic_list_modification_flag_l0;
guint32 list_entry_l0[15];
guint8 ref_pic_list_modification_flag_l1;
guint32 list_entry_l1[15];
};
struct _GstH265PredWeightTable
{
guint8 luma_log2_weight_denom;
gint8 delta_chroma_log2_weight_denom;
guint8 luma_weight_l0_flag[15];
guint8 chroma_weight_l0_flag[15];
gint8 delta_luma_weight_l0[15];
gint8 luma_offset_l0[15];
gint8 delta_chroma_weight_l0 [15][2];
gint16 delta_chroma_offset_l0 [15][2];
guint8 luma_weight_l1_flag[15];
guint8 chroma_weight_l1_flag[15];
gint8 delta_luma_weight_l1[15];
gint8 luma_offset_l1[15];
gint8 delta_chroma_weight_l1[15][2];
gint16 delta_chroma_offset_l1[15][2];
};
/**
* GstH265SliceHdr:
* @first_slice_segment_in_pic_flag: equal to 1 if this slice segment is
* the first slice segment of the picture in decoding order
* @no_output_of_prior_pics_flag: affects the output of previously-decoded pictures
* in the decoded picture buffer after the decoding of an IDR or a BLA picture
* that is not the first picture in the bitstream as specified in Annex C
* @pps: a #GstH265PPS
* @dependent_slice_segment_flag: equal to 1 if the value of each slice segment header
* syntax element that is not present is inferred to be equal to the value of corresponding
* slice segment header syntax element in the slice header.
* @segment_address: the address of the first CTB in the slice segment
* @type: slice type (B, P, or I)
* @pic_output_flag: affects the decoded picture output and removal processes
* as specified in Annex C.
* @colour_plane_id: specifies the colour plane associated with the current slice RBSP
* when separate_colour_plane_flag is equal to 1
* @pic_order_cnt_lsb: the picture order count modulo MaxPicOrderCntLsb for the current picture
* @short_term_ref_pic_set_sps_flag: equal to 1 specifies that the short-term RPS
* of the current picture is derived based on the active SPS.
* @short_term_ref_pic_sets: a #GstH265ShortTermRefPicSet structure
* @short_term_ref_pic_set_idx: the index of st_ref_pic_set syntax structure
* that is used for derivation of the short-term RPS of the current picture.
* @num_long_term_sps: the number of entries in the long-term RPS of current picture
* that are derived based on the syntax in active SPS.
* @num_long_term_pics: the number of entries in the long-term RPS of the current picture
* that are directly signalled in the slice header.
* @lt_idx_sps: the index of candidate long-term reference pictures
* specified in the active SPS.
* @poc_lsb_lt: the value of the picture order count modulo MaxPicOrderCntLsb
* of the each entry in the long-term RPS of the current picture.
* @used_by_curr_pic_lt_flag: equal to 0 if the entry in the long-term RPS
* of the current picture is not used for reference by the current picture.
* @delta_poc_msb_present_flag: equal to 1 if i-th delta_poc_msb_cycle_lt[] is present.
* @delta_poc_msb_cycle_lt: used to determine the value of the most significant bits
* of the picture order count value of the i-th entry in the long-term RPS of the current picture.
* @temporal_mvp_enabled_flag: whether temporal motion vector predictors can be used for inter prediction.
* @sao_luma_flag: equal to 1 if SAO is enabled for the luma component in the current slice.
* @sao_chroma_flag: equal to 1 if SAO is enabled for the chroma component in the current slice.
* @num_ref_idx_active_override_flag: equal to 1 specifies that the syntax elements
* num_ref_idx_l0_active_minus1 and num_ref_idx_l1_active_minus1 are present.
* @num_ref_idx_l0_active_minus1: the maximum reference index for reference picture list 0
* that may be used to decode the slice.
* @num_ref_idx_l1_active_minus1: the maximum reference index for reference picture list 1
* that may be used to decode the slice.
* @ref_pic_list_modification: a #GstH265RefPicListModification
* @mvd_l1_zero_flag: equal to 1 if the mvd_coding sytanx structure is not parsed
* @cabac_init_flag: specifies the method for determining the initialization table
* used in the initialization process for context variables.
* @collocated_from_l0_flag: equal to 1 specifies that the collocated picture
* used for temporal motion vector prediction is derived from reference picture list 0.
* @collocated_ref_idx: the reference index of the collocated picture
* used for temporal motion vector prediction.
* @pred_weight_table: a #GstH265PredWeightTable
* @five_minus_max_num_merge_cand: specifies the maximum number of merging motion vector prediction (MVP)
* candidates supported in the slice.
* @use_integer_mv_flag: equal to 1 specifies that the resolution of motion vectors for inter
* prediction in the current slice is integer. (Since: 1.18)
* @qp_delta: specifies the inital value of QPy to be used for the coding blocks in the slice.
* @cb_qp_offset: a difference to be added to the value of pps_cb_qp_offset.
* @cr_qp_offset: a difference to be added to the value of pps_cr_qp_offset.
* @slice_act_y_qp_offset: specify offsets to the quantization parameter values qP derived in
* clause 8.6.2 for luma components. (Since: 1.18)
* @slice_act_cb_qp_offset: specify offsets to the quantization parameter values qP derived in
* clause 8.6.2 for Cb components. (Since: 1.18)
* @slice_act_cr_qp_offset: specify offsets to the quantization parameter values qP derived in
* clause 8.6.2 for Cr components. (Since: 1.18)
* @cu_chroma_qp_offset_enabled_flag: equal to 1 if the cu_chroma_qp_offset_flag
* may be present in the transform unit syntax. (Since: 1.18)
* @deblocking_filter_override_flag: equal to 1 if deblocking paramertes are present in the slice header.
* @deblocking_filter_disabled_flag: equal to 1 specifies that the operation of
* the deblocking filter is not applied for the current slice.
* @beta_offset_div2: deblocking parameter offset for beta divided by 2 for the current slice.
* @tc_offset_div2: deblocking parameter offset for tC divided by 2 for the current slice.
* @loop_filter_across_slices_enabled_flag: equal to 1 specifies that in-loop filtering
* operation may be performed across the left and upper boundaries of the current slice.
* @num_entry_point_offsets: specifies the number of entry_point_offset_minus1 syntax elements
* in the slice header.
* @offset_len_minus1: specifies the length of the entry_point_minus1 syntax elements
* in bits.
* @entry_point_offset_minus1: the entry point offset in bytes.
* @NumPocTotalCurr: calculated NumPocTotalCurr which is used for
* decoding process for reference picture set
* @header_size: the calculated size of the slice_header\() in bits.
* @n_emulation_prevention_bytes: number of emulation prevention bytes (EPB)
* in this slice_header\()
* @short_term_ref_pic_set_size: the calculated size of short_term_ref_pic_set\()
* in bits. (Since: 1.18)
*/
struct _GstH265SliceHdr
{
guint8 first_slice_segment_in_pic_flag;
guint8 no_output_of_prior_pics_flag;
GstH265PPS *pps;
guint8 dependent_slice_segment_flag;
guint32 segment_address;
guint8 type;
guint8 pic_output_flag;
guint8 colour_plane_id;
guint16 pic_order_cnt_lsb;
guint8 short_term_ref_pic_set_sps_flag;
GstH265ShortTermRefPicSet short_term_ref_pic_sets;
guint8 short_term_ref_pic_set_idx;
guint8 num_long_term_sps;
guint8 num_long_term_pics;
guint8 lt_idx_sps[16];
guint32 poc_lsb_lt[16];
guint8 used_by_curr_pic_lt_flag[16];
guint8 delta_poc_msb_present_flag[16];
guint32 delta_poc_msb_cycle_lt[16];
guint8 temporal_mvp_enabled_flag;
guint8 sao_luma_flag;
guint8 sao_chroma_flag;
guint8 num_ref_idx_active_override_flag;
guint8 num_ref_idx_l0_active_minus1;
guint8 num_ref_idx_l1_active_minus1;
GstH265RefPicListModification ref_pic_list_modification;
guint8 mvd_l1_zero_flag;
guint8 cabac_init_flag;
guint8 collocated_from_l0_flag;
guint8 collocated_ref_idx;
GstH265PredWeightTable pred_weight_table;
guint8 five_minus_max_num_merge_cand;
guint8 use_integer_mv_flag;
gint8 qp_delta;
gint8 cb_qp_offset;
gint8 cr_qp_offset;
gint8 slice_act_y_qp_offset;
gint8 slice_act_cb_qp_offset;
gint8 slice_act_cr_qp_offset;
guint8 cu_chroma_qp_offset_enabled_flag;
guint8 deblocking_filter_override_flag;
guint8 deblocking_filter_disabled_flag;
gint8 beta_offset_div2;
gint8 tc_offset_div2;
guint8 loop_filter_across_slices_enabled_flag;
guint32 num_entry_point_offsets;
guint8 offset_len_minus1;
guint32 *entry_point_offset_minus1;
/* calculated values */
gint NumPocTotalCurr;
/* Size of the slice_header() in bits */
guint header_size;
/* Number of emulation prevention bytes (EPB) in this slice_header() */
guint n_emulation_prevention_bytes;
/* Size of short_term_ref_pic_set() in bits */
guint short_term_ref_pic_set_size;
};
struct _GstH265PicTiming
{
guint8 pic_struct;
guint8 source_scan_type;
guint8 duplicate_flag;
guint8 au_cpb_removal_delay_minus1;
guint8 pic_dpb_output_delay;
guint8 pic_dpb_output_du_delay;
guint32 num_decoding_units_minus1;
guint8 du_common_cpb_removal_delay_flag;
guint8 du_common_cpb_removal_delay_increment_minus1;
guint32 *num_nalus_in_du_minus1;
guint8 *du_cpb_removal_delay_increment_minus1;
};
struct _GstH265BufferingPeriod
{
GstH265SPS *sps;
guint8 irap_cpb_params_present_flag;
guint8 cpb_delay_offset;
guint8 dpb_delay_offset;
guint8 concatenation_flag;
guint8 au_cpb_removal_delay_delta_minus1;
/* seq->vui_parameters->nal_hrd_parameters_present_flag */
guint8 nal_initial_cpb_removal_delay[32];
guint8 nal_initial_cpb_removal_offset[32];
guint8 nal_initial_alt_cpb_removal_delay[32];
guint8 nal_initial_alt_cpb_removal_offset [32];
/* seq->vui_parameters->vcl_hrd_parameters_present_flag */
guint8 vcl_initial_cpb_removal_delay[32];
guint8 vcl_initial_cpb_removal_offset[32];
guint8 vcl_initial_alt_cpb_removal_delay[32];
guint8 vcl_initial_alt_cpb_removal_offset[32];
};
struct _GstH265RecoveryPoint
{
gint32 recovery_poc_cnt;
guint8 exact_match_flag;
guint8 broken_link_flag;
};
/**
* GstH265RegisteredUserData:
* The User data registered by Rec. ITU-T T.35 SEI message.
* @country_code: an itu_t_t35_country_code.
* @country_code_extension: an itu_t_t35_country_code_extension_byte.
* Should be ignored when @country_code is not 0xff
* @data: the data of itu_t_t35_payload_byte
* excluding @country_code and @country_code_extension
* @size: the size of @data in bytes
*
* Since: 1.18
*/
struct _GstH265RegisteredUserData
{
guint8 country_code;
guint8 country_code_extension;
const guint8 *data;
guint size;
};
/**
* GstH265TimeCode:
* The time code SEI message provides time code information similar to that
* defined by SMPTE ST 12-1 (2014) for field(s) or frame(s) of the current
* picture.
*
* D.2.27
*
* Since: 1.16
*/
struct _GstH265TimeCode
{
guint8 num_clock_ts;
guint8 clock_timestamp_flag[3];
guint8 units_field_based_flag[3];
guint8 counting_type[3];
guint8 full_timestamp_flag[3];
guint8 discontinuity_flag[3];
guint8 cnt_dropped_flag[3];
guint16 n_frames[3];
guint8 seconds_flag[3];
guint8 seconds_value[3];
guint8 minutes_flag[3];
guint8 minutes_value[3];
guint8 hours_flag[3];
guint8 hours_value[3];
guint8 time_offset_length[3];
guint32 time_offset_value[3];
};
/**
* GstH265MasteringDisplayColourVolume:
* The colour volume (primaries, white point and luminance range) of display
* defined by SMPTE ST 2086.
*
* D.2.28
*
* Since: 1.18
*/
struct _GstH265MasteringDisplayColourVolume
{
guint16 display_primaries_x[3];
guint16 display_primaries_y[3];
guint16 white_point_x;
guint16 white_point_y;
guint32 max_display_mastering_luminance;
guint32 min_display_mastering_luminance;
};
/**
* GstH265ContentLightLevel:
* The upper bounds for the nominal target brightness light level
* as specified in CEA-861.3
*
* D.2.35
*
* Since: 1.18
*/
struct _GstH265ContentLightLevel
{
guint16 max_content_light_level;
guint16 max_pic_average_light_level;
};
struct _GstH265SEIMessage
{
GstH265SEIPayloadType payloadType;
union {
GstH265BufferingPeriod buffering_period;
GstH265PicTiming pic_timing;
GstH265RegisteredUserData registered_user_data;
GstH265RecoveryPoint recovery_point;
GstH265TimeCode time_code;
GstH265MasteringDisplayColourVolume mastering_display_colour_volume;
GstH265ContentLightLevel content_light_level;
/* ... could implement more */
} payload;
};
/**
* GstH265Parser:
*
* H265 NAL Parser (opaque structure).
*/
struct _GstH265Parser
{
/*< private >*/
GstH265VPS vps[GST_H265_MAX_VPS_COUNT];
GstH265SPS sps[GST_H265_MAX_SPS_COUNT];
GstH265PPS pps[GST_H265_MAX_PPS_COUNT];
GstH265VPS *last_vps;
GstH265SPS *last_sps;
GstH265PPS *last_pps;
};
GST_CODEC_PARSERS_API
GstH265Parser * gst_h265_parser_new (void);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_identify_nalu (GstH265Parser * parser,
const guint8 * data,
guint offset,
gsize size,
GstH265NalUnit * nalu);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_identify_nalu_unchecked (GstH265Parser * parser,
const guint8 * data,
guint offset,
gsize size,
GstH265NalUnit * nalu);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_identify_nalu_hevc (GstH265Parser * parser,
const guint8 * data,
guint offset,
gsize size,
guint8 nal_length_size,
GstH265NalUnit * nalu);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_parse_nal (GstH265Parser * parser,
GstH265NalUnit * nalu);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_parse_slice_hdr (GstH265Parser * parser,
GstH265NalUnit * nalu,
GstH265SliceHdr * slice);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_parse_vps (GstH265Parser * parser,
GstH265NalUnit * nalu,
GstH265VPS * vps);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_parse_sps (GstH265Parser * parser,
GstH265NalUnit * nalu,
GstH265SPS * sps,
gboolean parse_vui_params);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_parse_pps (GstH265Parser * parser,
GstH265NalUnit * nalu,
GstH265PPS * pps);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_parse_sei (GstH265Parser * parser,
GstH265NalUnit * nalu,
GArray **messages);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_update_vps (GstH265Parser * parser,
GstH265VPS * vps);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_update_sps (GstH265Parser * parser,
GstH265SPS * sps);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parser_update_pps (GstH265Parser * parser,
GstH265PPS * pps);
GST_CODEC_PARSERS_API
void gst_h265_parser_free (GstH265Parser * parser);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parse_vps (GstH265NalUnit * nalu,
GstH265VPS * vps);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parse_sps (GstH265Parser * parser,
GstH265NalUnit * nalu,
GstH265SPS * sps,
gboolean parse_vui_params);
GST_CODEC_PARSERS_API
GstH265ParserResult gst_h265_parse_pps (GstH265Parser * parser,
GstH265NalUnit * nalu,
GstH265PPS * pps);
GST_CODEC_PARSERS_API
gboolean gst_h265_slice_hdr_copy (GstH265SliceHdr * dst_slice,
const GstH265SliceHdr * src_slice);
GST_CODEC_PARSERS_API
void gst_h265_slice_hdr_free (GstH265SliceHdr * slice_hdr);
GST_CODEC_PARSERS_API
gboolean gst_h265_sei_copy (GstH265SEIMessage * dest_sei,
const GstH265SEIMessage * src_sei);
GST_CODEC_PARSERS_API
void gst_h265_sei_free (GstH265SEIMessage * sei);
GST_CODEC_PARSERS_API
void gst_h265_quant_matrix_4x4_get_zigzag_from_raster (guint8 out_quant[16],
const guint8 quant[16]);
GST_CODEC_PARSERS_API
void gst_h265_quant_matrix_4x4_get_raster_from_zigzag (guint8 out_quant[16],
const guint8 quant[16]);
GST_CODEC_PARSERS_API
void gst_h265_quant_matrix_8x8_get_zigzag_from_raster (guint8 out_quant[64],
const guint8 quant[64]);
GST_CODEC_PARSERS_API
void gst_h265_quant_matrix_8x8_get_raster_from_zigzag (guint8 out_quant[64],
const guint8 quant[64]);
#define gst_h265_quant_matrix_16x16_get_zigzag_from_raster \
gst_h265_quant_matrix_8x8_get_zigzag_from_raster
#define gst_h265_quant_matrix_16x16_get_raster_from_zigzag \
gst_h265_quant_matrix_8x8_get_raster_from_zigzag
#define gst_h265_quant_matrix_32x32_get_zigzag_from_raster \
gst_h265_quant_matrix_8x8_get_zigzag_from_raster
#define gst_h265_quant_matrix_32x32_get_raster_from_zigzag \
gst_h265_quant_matrix_8x8_get_raster_from_zigzag
GST_CODEC_PARSERS_API
void gst_h265_quant_matrix_4x4_get_uprightdiagonal_from_raster (guint8 out_quant[16],
const guint8 quant[16]);
GST_CODEC_PARSERS_API
void gst_h265_quant_matrix_4x4_get_raster_from_uprightdiagonal (guint8 out_quant[16],
const guint8 quant[16]);
GST_CODEC_PARSERS_API
void gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster (guint8 out_quant[64],
const guint8 quant[64]);
GST_CODEC_PARSERS_API
void gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal (guint8 out_quant[64],
const guint8 quant[64]);
#define gst_h265_quant_matrix_16x16_get_uprightdiagonal_from_raster \
gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
#define gst_h265_quant_matrix_16x16_get_raster_from_uprightdiagonal\
gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
#define gst_h265_quant_matrix_32x32_get_uprightdiagonal_from_raster \
gst_h265_quant_matrix_8x8_get_uprightdiagonal_from_raster
#define gst_h265_quant_matrix_32x32_get_raster_from_uprightdiagonal\
gst_h265_quant_matrix_8x8_get_raster_from_uprightdiagonal
GST_CODEC_PARSERS_API
GstH265Profile gst_h265_profile_tier_level_get_profile (GstH265ProfileTierLevel * ptl);
GST_CODEC_PARSERS_API
const gchar * gst_h265_profile_to_string (GstH265Profile profile);
GST_CODEC_PARSERS_API
GstH265Profile gst_h265_profile_from_string (const gchar * string);
GST_CODEC_PARSERS_API
GstMemory * gst_h265_create_sei_memory (guint8 layer_id,
guint8 temporal_id_plus1,
guint8 start_code_prefix_length,
GArray * messages);
GST_CODEC_PARSERS_API
GstMemory * gst_h265_create_sei_memory_hevc (guint8 layer_id,
guint8 temporal_id_plus1,
guint8 nal_length_size,
GArray * messages);
GST_CODEC_PARSERS_API
GstBuffer * gst_h265_parser_insert_sei (GstH265Parser * parser,
GstBuffer * au,
GstMemory * sei);
GST_CODEC_PARSERS_API
GstBuffer * gst_h265_parser_insert_sei_hevc (GstH265Parser * parser,
guint8 nal_length_size,
GstBuffer * au,
GstMemory * sei);
G_END_DECLS
#endif
| 42.113072 | 153 | 0.766591 | [
"vector",
"transform",
"3d"
] |
02254e6cd069f2dc5018f605791d291cd116df0d | 12,245 | h | C | tem/include/tencentcloud/tem/v20210701/model/IngressInfo.h | tencentcloudapi-test/tencentcloud-sdk-cpp | cee20ccd3b7d2e1aeaefbbe7231c8a89d7eb837d | [
"Apache-2.0"
] | null | null | null | tem/include/tencentcloud/tem/v20210701/model/IngressInfo.h | tencentcloudapi-test/tencentcloud-sdk-cpp | cee20ccd3b7d2e1aeaefbbe7231c8a89d7eb837d | [
"Apache-2.0"
] | null | null | null | tem/include/tencentcloud/tem/v20210701/model/IngressInfo.h | tencentcloudapi-test/tencentcloud-sdk-cpp | cee20ccd3b7d2e1aeaefbbe7231c8a89d7eb837d | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TENCENTCLOUD_TEM_V20210701_MODEL_INGRESSINFO_H_
#define TENCENTCLOUD_TEM_V20210701_MODEL_INGRESSINFO_H_
#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/utils/rapidjson/document.h>
#include <tencentcloud/core/utils/rapidjson/writer.h>
#include <tencentcloud/core/utils/rapidjson/stringbuffer.h>
#include <tencentcloud/core/AbstractModel.h>
#include <tencentcloud/tem/v20210701/model/IngressRule.h>
#include <tencentcloud/tem/v20210701/model/IngressTls.h>
namespace TencentCloud
{
namespace Tem
{
namespace V20210701
{
namespace Model
{
/**
* Ingress 配置
*/
class IngressInfo : public AbstractModel
{
public:
IngressInfo();
~IngressInfo() = default;
void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const;
CoreInternalOutcome Deserialize(const rapidjson::Value &value);
/**
* 获取环境ID
注意:此字段可能返回 null,表示取不到有效值。
* @return EnvironmentId 环境ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetEnvironmentId() const;
/**
* 设置环境ID
注意:此字段可能返回 null,表示取不到有效值。
* @param EnvironmentId 环境ID
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetEnvironmentId(const std::string& _environmentId);
/**
* 判断参数 EnvironmentId 是否已赋值
* @return EnvironmentId 是否已赋值
*/
bool EnvironmentIdHasBeenSet() const;
/**
* 获取环境namespace
* @return ClusterNamespace 环境namespace
*/
std::string GetClusterNamespace() const;
/**
* 设置环境namespace
* @param ClusterNamespace 环境namespace
*/
void SetClusterNamespace(const std::string& _clusterNamespace);
/**
* 判断参数 ClusterNamespace 是否已赋值
* @return ClusterNamespace 是否已赋值
*/
bool ClusterNamespaceHasBeenSet() const;
/**
* 获取ip version
* @return AddressIPVersion ip version
*/
std::string GetAddressIPVersion() const;
/**
* 设置ip version
* @param AddressIPVersion ip version
*/
void SetAddressIPVersion(const std::string& _addressIPVersion);
/**
* 判断参数 AddressIPVersion 是否已赋值
* @return AddressIPVersion 是否已赋值
*/
bool AddressIPVersionHasBeenSet() const;
/**
* 获取ingress name
* @return IngressName ingress name
*/
std::string GetIngressName() const;
/**
* 设置ingress name
* @param IngressName ingress name
*/
void SetIngressName(const std::string& _ingressName);
/**
* 判断参数 IngressName 是否已赋值
* @return IngressName 是否已赋值
*/
bool IngressNameHasBeenSet() const;
/**
* 获取rules 配置
* @return Rules rules 配置
*/
std::vector<IngressRule> GetRules() const;
/**
* 设置rules 配置
* @param Rules rules 配置
*/
void SetRules(const std::vector<IngressRule>& _rules);
/**
* 判断参数 Rules 是否已赋值
* @return Rules 是否已赋值
*/
bool RulesHasBeenSet() const;
/**
* 获取clb ID
注意:此字段可能返回 null,表示取不到有效值。
* @return ClbId clb ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetClbId() const;
/**
* 设置clb ID
注意:此字段可能返回 null,表示取不到有效值。
* @param ClbId clb ID
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetClbId(const std::string& _clbId);
/**
* 判断参数 ClbId 是否已赋值
* @return ClbId 是否已赋值
*/
bool ClbIdHasBeenSet() const;
/**
* 获取tls 配置
注意:此字段可能返回 null,表示取不到有效值。
* @return Tls tls 配置
注意:此字段可能返回 null,表示取不到有效值。
*/
std::vector<IngressTls> GetTls() const;
/**
* 设置tls 配置
注意:此字段可能返回 null,表示取不到有效值。
* @param Tls tls 配置
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetTls(const std::vector<IngressTls>& _tls);
/**
* 判断参数 Tls 是否已赋值
* @return Tls 是否已赋值
*/
bool TlsHasBeenSet() const;
/**
* 获取环境集群ID
注意:此字段可能返回 null,表示取不到有效值。
* @return ClusterId 环境集群ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetClusterId() const;
/**
* 设置环境集群ID
注意:此字段可能返回 null,表示取不到有效值。
* @param ClusterId 环境集群ID
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetClusterId(const std::string& _clusterId);
/**
* 判断参数 ClusterId 是否已赋值
* @return ClusterId 是否已赋值
*/
bool ClusterIdHasBeenSet() const;
/**
* 获取clb ip
注意:此字段可能返回 null,表示取不到有效值。
* @return Vip clb ip
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetVip() const;
/**
* 设置clb ip
注意:此字段可能返回 null,表示取不到有效值。
* @param Vip clb ip
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetVip(const std::string& _vip);
/**
* 判断参数 Vip 是否已赋值
* @return Vip 是否已赋值
*/
bool VipHasBeenSet() const;
/**
* 获取创建时间
注意:此字段可能返回 null,表示取不到有效值。
* @return CreateTime 创建时间
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetCreateTime() const;
/**
* 设置创建时间
注意:此字段可能返回 null,表示取不到有效值。
* @param CreateTime 创建时间
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetCreateTime(const std::string& _createTime);
/**
* 判断参数 CreateTime 是否已赋值
* @return CreateTime 是否已赋值
*/
bool CreateTimeHasBeenSet() const;
/**
* 获取是否混合 https,默认 false,可选值 true 代表有 https 协议监听
* @return Mixed 是否混合 https,默认 false,可选值 true 代表有 https 协议监听
*/
bool GetMixed() const;
/**
* 设置是否混合 https,默认 false,可选值 true 代表有 https 协议监听
* @param Mixed 是否混合 https,默认 false,可选值 true 代表有 https 协议监听
*/
void SetMixed(const bool& _mixed);
/**
* 判断参数 Mixed 是否已赋值
* @return Mixed 是否已赋值
*/
bool MixedHasBeenSet() const;
/**
* 获取重定向模式,可选值:
- AUTO(自动重定向http到https)
- NONE(不使用重定向)
注意:此字段可能返回 null,表示取不到有效值。
* @return RewriteType 重定向模式,可选值:
- AUTO(自动重定向http到https)
- NONE(不使用重定向)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string GetRewriteType() const;
/**
* 设置重定向模式,可选值:
- AUTO(自动重定向http到https)
- NONE(不使用重定向)
注意:此字段可能返回 null,表示取不到有效值。
* @param RewriteType 重定向模式,可选值:
- AUTO(自动重定向http到https)
- NONE(不使用重定向)
注意:此字段可能返回 null,表示取不到有效值。
*/
void SetRewriteType(const std::string& _rewriteType);
/**
* 判断参数 RewriteType 是否已赋值
* @return RewriteType 是否已赋值
*/
bool RewriteTypeHasBeenSet() const;
private:
/**
* 环境ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_environmentId;
bool m_environmentIdHasBeenSet;
/**
* 环境namespace
*/
std::string m_clusterNamespace;
bool m_clusterNamespaceHasBeenSet;
/**
* ip version
*/
std::string m_addressIPVersion;
bool m_addressIPVersionHasBeenSet;
/**
* ingress name
*/
std::string m_ingressName;
bool m_ingressNameHasBeenSet;
/**
* rules 配置
*/
std::vector<IngressRule> m_rules;
bool m_rulesHasBeenSet;
/**
* clb ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_clbId;
bool m_clbIdHasBeenSet;
/**
* tls 配置
注意:此字段可能返回 null,表示取不到有效值。
*/
std::vector<IngressTls> m_tls;
bool m_tlsHasBeenSet;
/**
* 环境集群ID
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_clusterId;
bool m_clusterIdHasBeenSet;
/**
* clb ip
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_vip;
bool m_vipHasBeenSet;
/**
* 创建时间
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_createTime;
bool m_createTimeHasBeenSet;
/**
* 是否混合 https,默认 false,可选值 true 代表有 https 协议监听
*/
bool m_mixed;
bool m_mixedHasBeenSet;
/**
* 重定向模式,可选值:
- AUTO(自动重定向http到https)
- NONE(不使用重定向)
注意:此字段可能返回 null,表示取不到有效值。
*/
std::string m_rewriteType;
bool m_rewriteTypeHasBeenSet;
};
}
}
}
}
#endif // !TENCENTCLOUD_TEM_V20210701_MODEL_INGRESSINFO_H_
| 31.157761 | 116 | 0.426051 | [
"vector",
"model"
] |
0225dfede07a4d40e7c4799d99591f7bb56d9859 | 1,313 | h | C | deps/src/gropt/incl/SolversTR.h | JuliaPackageMirrors/ElasticFDA.jl | fe9852231d04672c0792f2ca7adf754da0874f0a | [
"MIT"
] | null | null | null | deps/src/gropt/incl/SolversTR.h | JuliaPackageMirrors/ElasticFDA.jl | fe9852231d04672c0792f2ca7adf754da0874f0a | [
"MIT"
] | null | null | null | deps/src/gropt/incl/SolversTR.h | JuliaPackageMirrors/ElasticFDA.jl | fe9852231d04672c0792f2ca7adf754da0874f0a | [
"MIT"
] | null | null | null |
#ifndef SOLVERSTR_H
#define SOLVERSTR_H
#include "Solvers.h"
#include "def.h"
enum tCGstatusSet{TR_NEGCURVTURE, TR_EXCREGION, TR_LCON, TR_SCON, TR_MAXITER, TCGSTATUSSETLENGTH};
class SolversTR : public Solvers{
public:
virtual void CheckParams();
virtual void Run();
virtual void SetParams(PARAMSMAP params);
// parameters
double Acceptence_Rho;
double Shrinked_tau;
double Magnified_tau;
double minimum_Delta;
double maximum_Delta;
bool useRand;
integer Max_Inner_Iter;
integer Min_Inner_Iter;
double theta;
double kappa;
double initial_Delta;
protected:
virtual ~SolversTR();
virtual void HessianEta(Vector *Eta, Vector *result) = 0; // required to be overloaded in derived class
virtual void InitialVector();
virtual void tCG_TR();
virtual void PreConditioner(Variable *x, Vector *eta, Vector *result);
virtual void Initialization(const Problem *prob, const Variable *initialx, const Vector *EMPTYETA);
virtual void UpdateData();
virtual void Acceptence();
// algorithm-related variables:
Vector *eta1, *eta2;
Vector *zeta; // temp storage
Vector *r, *z, *delta, *Hd;
double rho;
double Delta;
integer innerIter;
tCGstatusSet tCGstatus;
std::string *tCGstatusSetnames;
private:
virtual void PrintGenInfo();
};
#endif
| 24.773585 | 105 | 0.733435 | [
"vector"
] |
02262e749ac0cce62d81e91f2ff31b58f7049f6f | 7,345 | h | C | libopenrv/orvvncclientshareddata.h | monumentsoftware/openrv | 4fa5a8b2cb3178041e94afd332571e3064fd5cd2 | [
"Apache-2.0"
] | 2 | 2018-04-10T00:43:45.000Z | 2018-06-07T06:35:45.000Z | libopenrv/orvvncclientshareddata.h | monumentsoftware/openrv | 4fa5a8b2cb3178041e94afd332571e3064fd5cd2 | [
"Apache-2.0"
] | null | null | null | libopenrv/orvvncclientshareddata.h | monumentsoftware/openrv | 4fa5a8b2cb3178041e94afd332571e3064fd5cd2 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (C) 2018 Monument-Software GmbH
*
* 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 OPENRV_ORVVNCCLIENTSHAREDDATA_H
#define OPENRV_ORVVNCCLIENTSHAREDDATA_H
#include <libopenrv/libopenrv.h>
#include "rfbtypes.h"
#include <mutex>
#include <condition_variable>
#include <list>
/**
* @file orvvncclientshareddata.h
*
* Definition of the @ref OrvVncClientSharedData class and related types that are used by both the @ref
* OrvVncClient and the connection thread created by the @ref OrvVncClient.
**/
namespace openrv {
namespace vnc {
enum class ConnectionState
{
NotConnected = 0,
/**
* Set by OrvVncClient to initiate a connection.
*
* Only valid if previous state was @ref NotConnected.
**/
StartConnection,
/**
* Set internally by the openrv::vnc::ConnectionThread when the @ref StartConnection state was
* encountered and has been handled.
**/
ConnectionPending,
Connected,
};
struct ConnectionInfo
{
/**
* Highest protocol version supported by both, client and server.
**/
ProtocolVersion mSelectedProtocolVersion = ProtocolVersion::Unknown;
char mSelectedProtocolVersionString[ORV_VNC_PROTOCOL_VERSION_STRING_LENGTH + 1] = {};
/**
* The @re SecurityType that has been selected by the client from the set of types supported
* by the server.
**/
SecurityType mSelectedVNCSecurityType = SecurityType::Invalid;
//orv_vnc_tight_capability_t mSelectedTightAuthType; // only valid if mSelectedVNCSecurityType==SecurityType::Tight // TODO
//orv_vnc_tight_capability_t mSelectedTightTunnelCapability; // only valid if mSelectedVNCSecurityType==SecurityType::Tight // TODO
orv_communication_pixel_format_t mDefaultPixelFormat; // as reported by server on initial connect
uint16_t mDefaultFramebufferWidth = 0;
uint16_t mDefaultFramebufferHeight = 0;
/**
* Name of the desktop as reported by the server.
**/
char* mDesktopName = nullptr;
public:
ConnectionInfo()
{
orv_communication_pixel_format_reset(&mDefaultPixelFormat);
}
~ConnectionInfo()
{
free(mDesktopName);
}
void reset()
{
free(mDesktopName);
*this = ConnectionInfo();
}
void copy(ConnectionInfo* dst);
};
/**
* Internal helper struct that stores information about an event the client sends to the server.
* Normally pointer or key events.
**/
struct ClientSendEvent
{
enum class Type
{
Invalid,
Pointer,
Key,
};
// for type==Type::Pointer
ClientSendEvent(Type type, uint16_t x, uint16_t y, uint8_t buttonMask)
: mType(type),
mX(x),
mY(y),
mButtonMask(buttonMask),
mDown(false),
mKey(0)
{
}
// for type==Type::Key
ClientSendEvent(Type type, bool down, uint32_t key)
: mType(type),
mX(0),
mY(0),
mButtonMask(0),
mDown(down),
mKey(key)
{
}
Type mType = Type::Invalid;
// Pointer events:
uint16_t mX = 0;
uint16_t mY = 0;
uint8_t mButtonMask = 0;
// Key events:
bool mDown = false;
uint32_t mKey = 0;
};
/**
* Helper struct for @ref OrvVncClient and the connection thread to store information for a single
* framebuffer update request.
**/
struct RequestFramebuffer
{
RequestFramebuffer() = default;
RequestFramebuffer(bool incremental, uint16_t x, uint16_t y, uint16_t w, uint16_t h)
: mIncremental(incremental),
mX(x),
mY(y),
mW(w),
mH(h)
{
}
bool mIncremental = true;
uint16_t mX = 0;
uint16_t mY = 0;
uint16_t mW = 0;
uint16_t mH = 0;
};
bool operator==(const RequestFramebuffer& p1, const RequestFramebuffer& p2);
bool operator!=(const RequestFramebuffer& p1, const RequestFramebuffer& p2);
/**
* Data of @ref OrvVncClient shared between the @ref OrvVncClient and the connection thread that the @ref
* OrvVncClient controls.
*
* All data in this struct is protected by @p mMutex.
**/
struct OrvVncClientSharedData
{
mutable std::mutex mMutex;
std::condition_variable mStartupWaitCondition; // Used on thread startup only
bool mWantQuitThread = false; // NOTE: If set to true, mAbortFlag must be set to true as well!
bool mUserRequestedDisconnect = false;
bool mAbortFlag = false; // Set to true if user requested disconnect, or if thread is being finished. Both are handled as user-requested disconnect.
ConnectionState mState = ConnectionState::NotConnected;
char mHostName[ORV_MAX_HOSTNAME_LEN + 1] = {};
uint16_t mPort = 0;
char* mUser = nullptr;
char* mPassword = nullptr;
size_t mPasswordLength = 0;
orv_communication_quality_profile_t mRequestQualityProfile = ORV_COMM_QUALITY_PROFILE_SERVER;
orv_communication_pixel_format_t mRequestFormat;
bool mWantSendRequestFormat = false;
bool mWantSendFramebufferUpdateRequest = false;
std::list<ClientSendEvent> mClientSendEvents;
RequestFramebuffer mRequestFramebuffer;
orv_framebuffer_t mFramebuffer; // NOTE: normally NOT the same bpp format as sent by server (we normally use RGB internally only)
orv_cursor_t mCursorData;
bool mHaveFramebufferUpdateResponse = false;
/**
* Copy of @ref openrv::vnc::ConnectionThread::mServerCapabilities, so that other threads can query
* it.
*
* Only valid if @ref mState is @ref ConnectionState::mConnected.
**/
orv_vnc_server_capabilities_t mServerCapabilities;
/**
* Copy of @ref openrv::vnc::ConnectionThread::mConnectionInfo, so that other threads can
* query it.
*
* ALL data in this object is meant to be kept in sync with corresponding data in @ref
* openrv::vnc::ConnectionThread.
*
* Only valid if @ref mState is @ref ConnectionState::mConnected.
**/
ConnectionInfo mConnectionInfo;
/**
* Copy of @ref openrv::vnc::ConnectionThread::mCurrentPixelFormat, so that other threads can
* query it.
*
* Only valid if @ref mState is @ref ConnectionState::mConnected.
**/
orv_communication_pixel_format_t mCommunicationPixelFormat;
/**
* Copy of @ref openrv::vnc::ConnectionThread::mReceivedBytes
*
* This value is not synced after every recv() call, so it may lag behind a little bit.
**/
size_t mReceivedBytes = 0;
/**
* Copy of @ref openrv::vnc::ConnectionThread::mSentBytes
*
* This value is not synced after every send() call, so it may lag behind a little bit.
**/
size_t mSentBytes = 0;
public:
OrvVncClientSharedData();
virtual ~OrvVncClientSharedData();
void clearPasswordMutexLocked();
};
} // namespace vnc
} // namespace openrv
#endif
| 29.979592 | 157 | 0.684139 | [
"object"
] |
02281a3dc958812c8a08f44f6760b61d23292045 | 4,153 | h | C | src/inst_info.h | JiaoMaWHU/scarab | 03f311520acdd91caafc8d59436ff4352cfb6b0c | [
"MIT"
] | 33 | 2020-02-22T00:08:05.000Z | 2022-03-19T18:10:48.000Z | src/inst_info.h | JiaoMaWHU/scarab | 03f311520acdd91caafc8d59436ff4352cfb6b0c | [
"MIT"
] | 32 | 2020-04-27T18:06:08.000Z | 2022-03-09T03:19:16.000Z | src/inst_info.h | JiaoMaWHU/scarab | 03f311520acdd91caafc8d59436ff4352cfb6b0c | [
"MIT"
] | 26 | 2020-02-22T01:04:07.000Z | 2022-03-03T00:30:10.000Z | /* Copyright 2020 HPS/SAFARI Research Groups
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/***************************************************************************************
* File : inst_info.h
* Author : HPS Research Group
* Date : 2/19/2001
* Description :
***************************************************************************************/
#ifndef __INST_INFO_H__
#define __INST_INFO_H__
#include "ctype_pin_inst.h"
#include "table_info.h"
/**************************************************************************************/
// Defines
#define MAX_SRCS 32 // up to 16 for a gather instruction
#define MAX_DESTS 6
/**************************************************************************************/
// {{{ Reg_Type
typedef enum Reg_Type_enum {
INT_REG,
FP_REG,
SPEC_REG,
EXTRA_REG,
NUM_REG_MAPS,
} Reg_Type;
// }}}
/*------------------------------------------------------------------------------------*/
// {{{ Reg_Info
typedef struct Reg_Info_struct {
#if 1
uns16 reg; // register number within the register set
Reg_Type type; // integer, floating point, extra
#endif
uns16 id; // flattened register number (unique across sets)
} Reg_Info;
// }}}
/**************************************************************************************/
// static trace info
typedef struct Trace_Info_struct {
uns8 inst_size; // instruction size in x86 instructions
uns8 num_uop; // number of uop for x86 instructions
Flag is_gather_scatter; // is a gather or scatter instruction
uns8 load_seq_num; // sequence number for load uops (0 is the first load, 1
// the second, etc.)
uns store_seq_num; // sequence number for store uops (0 is the first store, 1
// the second, etc.)
} Trace_info;
/**************************************************************************************/
// {{{ Inst_Info
// The 'Inst_Info' type is made up of information that is unique to a
// static instruction (eg. address).
// typedef in globals/global_types.h
struct Inst_Info_struct {
Addr addr; // address of the instruction
uns uop_seq_num; // static op num used to differentiate ops with same pc
Table_Info* table_info; // pointer into the table of static instruction
// information
Reg_Info srcs[MAX_SRCS]; // source register information
Reg_Info dests[MAX_DESTS]; // destination register information
int latency; // The normal latency of this instruction
Flag trigger_op_fetched_hook; // if true, the op will trigger the model's
// fetch hook
int extra_ld_latency; // extra latency this load instruction should incurr
struct Trace_Info_struct trace_info; // trace_info;
Flag fake_inst; // is a fake op that PIN execution-driven frontend generates
// for handling exceptions and uninstrumented code.
Wrongpath_Nop_Mode_Reason fake_inst_reason;
};
// }}}
/**************************************************************************************/
#endif /* #ifndef __INST_INFO_H__ */
| 37.754545 | 89 | 0.586082 | [
"model"
] |
0229f5e8c7bfce9428d0c624988fffe6232556f4 | 1,220 | h | C | moses/mert/TerScorer.h | anshsarkar/TailBench | 25845756aee9a892229c25b681051591c94daafd | [
"MIT"
] | 3 | 2018-01-25T00:51:56.000Z | 2022-01-07T15:09:38.000Z | moses/mert/TerScorer.h | anshsarkar/TailBench | 25845756aee9a892229c25b681051591c94daafd | [
"MIT"
] | 1 | 2021-11-25T18:08:22.000Z | 2021-11-25T18:08:22.000Z | moses/mert/TerScorer.h | anshsarkar/TailBench | 25845756aee9a892229c25b681051591c94daafd | [
"MIT"
] | 3 | 2018-06-08T08:36:27.000Z | 2021-12-26T20:36:16.000Z | #ifndef MERT_TER_SCORER_H_
#define MERT_TER_SCORER_H_
#include <set>
#include <string>
#include <vector>
#include "Types.h"
#include "StatisticsBasedScorer.h"
namespace MosesTuning
{
class ScoreStats;
/**
* TER scoring
*/
class TerScorer: public StatisticsBasedScorer
{
public:
explicit TerScorer(const std::string& config = "");
~TerScorer();
virtual void setReferenceFiles(const std::vector<std::string>& referenceFiles);
virtual void prepareStats(std::size_t sid, const std::string& text, ScoreStats& entry);
virtual std::size_t NumberOfScores() const {
// cerr << "TerScorer: " << (LENGTH + 1) << endl;
return kLENGTH + 1;
}
virtual float calculateScore(const std::vector<int>& comps) const;
private:
const int kLENGTH;
std::string m_java_env;
std::string m_ter_com_env;
// data extracted from reference files
std::vector<std::size_t> m_ref_lengths;
std::vector<std::multiset<int> > m_ref_tokens;
std::vector<std::vector<int> > m_references;
std::vector<std::vector<std::vector<int> > > m_multi_references;
std::string m_pid;
// no copying allowed
TerScorer(const TerScorer&);
TerScorer& operator=(const TerScorer&);
};
}
#endif // MERT_TER_SCORER_H_
| 21.403509 | 89 | 0.713934 | [
"vector"
] |
022f6f6f6b6035baf52f96d50aac984e4f428200 | 6,171 | h | C | Plugin/WebRTCPlugin/PeerConnectionObject.h | topdev907/new2 | 7700b5b03ed632468bdaa629ff7c49eb182ee198 | [
"RSA-MD"
] | 2 | 2021-12-11T23:23:52.000Z | 2021-12-23T03:48:09.000Z | Plugin/WebRTCPlugin/PeerConnectionObject.h | topdev907/Grover | 7700b5b03ed632468bdaa629ff7c49eb182ee198 | [
"RSA-MD"
] | null | null | null | Plugin/WebRTCPlugin/PeerConnectionObject.h | topdev907/Grover | 7700b5b03ed632468bdaa629ff7c49eb182ee198 | [
"RSA-MD"
] | null | null | null | #pragma once
#include "WebRTCPlugin.h"
#include "DataChannelObject.h"
namespace WebRTC
{
using DelegateCreateSDSuccess = void(*)(RTCSdpType, const char*);
using DelegateCreateSDFailure = void(*)();
using DelegateSetSDSuccess = void(*)();
using DelegateSetSDFailure = void(*)();
using DelegateLocalSdpReady = void(*)(const char*, const char*);
using DelegateIceCandidate = void(*)(const char*, const char*, const int);
using DelegateOnIceConnectionChange = void(*)(webrtc::PeerConnectionInterface::IceConnectionState);
using DelegateOnDataChannel = void(*)(DataChannelObject*);
using DelegateOnRenegotiationNeeded = void(*)();
using DelegateOnTrack = void(*)(webrtc::RtpTransceiverInterface*);
class PeerConnectionObject
: public webrtc::CreateSessionDescriptionObserver
, public webrtc::PeerConnectionObserver
{
public:
PeerConnectionObject(int id);
~PeerConnectionObject();
void Close();
void SetLocalDescription(const RTCSessionDescription& desc);
void GetLocalDescription(RTCSessionDescription& desc) const;
void SetRemoteDescription(const RTCSessionDescription& desc);
webrtc::RTCErrorType SetConfiguration(const std::string& config);
void GetConfiguration(std::string& config) const;
void CreateOffer(const RTCOfferOptions& options);
void CreateAnswer(const RTCAnswerOptions& options);
void AddIceCandidate(const RTCIceCandidate& candidate);
DataChannelObject* CreateDataChannel(const char* label, const RTCDataChannelInit& options);
void RegisterCallbackSetSD(DelegateSetSDSuccess onSuccess, DelegateSetSDFailure onFailure)
{
onSetSDSuccess = onSuccess;
onSetSDFailure = onFailure;
}
void RegisterCallbackCreateSD(DelegateCreateSDSuccess onSuccess, DelegateCreateSDFailure onFailure)
{
onCreateSDSuccess = onSuccess;
onCreateSDFailure = onFailure;
}
void RegisterLocalSdpReady(DelegateLocalSdpReady callback) { onLocalSdpReady = callback; }
void RegisterIceCandidate(DelegateIceCandidate callback) { onIceCandidate = callback; }
void RegisterIceConnectionChange(DelegateOnIceConnectionChange callback) { onIceConnectionChange = callback; };
void RegisterOnDataChannel(DelegateOnDataChannel callback) { onDataChannel = callback; }
void RegisterOnRenegotiationNeeded(DelegateOnRenegotiationNeeded callback) { onRenegotiationNeeded = callback; }
void RegisterOnTrack(DelegateOnTrack callback) { onTrack = callback; }
RTCPeerConnectionState GetConnectionState();
RTCIceConnectionState GetIceCandidateState();
//webrtc::CreateSessionDescriptionObserver
// This callback transfers the ownership of the |desc|.
void OnSuccess(webrtc::SessionDescriptionInterface* desc) override;
// The OnFailure callback takes an RTCError, which consists of an
// error code and a string.
void OnFailure(webrtc::RTCError error) override;
// webrtc::PeerConnectionObserver
// Triggered when the SignalingState changed.
void OnSignalingChange(webrtc::PeerConnectionInterface::SignalingState new_state) override;
// Triggered when media is received on a new stream from remote peer.
void OnAddStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override;
// Triggered when a remote peer closes a stream.
void OnRemoveStream(rtc::scoped_refptr<webrtc::MediaStreamInterface> stream) override;
// Triggered when a remote peer opens a data channel.
void OnDataChannel(rtc::scoped_refptr<webrtc::DataChannelInterface> data_channel) override;
// Triggered when renegotiation is needed. For example, an ICE restart
// has begun.
void OnRenegotiationNeeded() override;
// Called any time the IceConnectionState changes.
void OnIceConnectionChange(webrtc::PeerConnectionInterface::IceConnectionState new_state) override;
// Called any time the IceGatheringState changes.
void OnIceGatheringChange(webrtc::PeerConnectionInterface::IceGatheringState new_state) override;
// A new ICE candidate has been gathered.
void OnIceCandidate(const webrtc::IceCandidateInterface* candidate) override;
// Ice candidates have been removed.
void OnIceCandidatesRemoved(const std::vector<cricket::Candidate>& candidates) override {}
// Called when the ICE connection receiving status changes.
void OnIceConnectionReceivingChange(bool Receiving) override {}
// This is called when signaling indicates a transceiver will be receiving
// media from the remote endpoint. This is fired during a call to
// SetRemoteDescription. The receiving track can be accessed by:
// |transceiver->receiver()->track()| and its associated streams by
// |transceiver->receiver()->streams()|.
// Note: This will only be called if Unified Plan semantics are specified.
// This behavior is specified in section 2.2.8.2.5 of the "Set the
// RTCSessionDescription" algorithm:
// https://w3c.github.io/webrtc-pc/#set-description
void OnTrack(
rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver);
friend class DataChannelObject;
public:
DelegateCreateSDSuccess onCreateSDSuccess;
DelegateCreateSDFailure onCreateSDFailure;
DelegateSetSDSuccess onSetSDSuccess;
DelegateSetSDFailure onSetSDFailure;
DelegateLocalSdpReady onLocalSdpReady;
DelegateIceCandidate onIceCandidate;
DelegateOnIceConnectionChange onIceConnectionChange;
DelegateOnDataChannel onDataChannel;
DelegateOnRenegotiationNeeded onRenegotiationNeeded;
DelegateOnTrack onTrack;
rtc::scoped_refptr<webrtc::PeerConnectionInterface> connection;
private:
std::map<int, DataChannelObject*> localDataChannels;
std::map<int, DataChannelObject*> remoteDataChannels;
int32 id;
};
}
| 52.29661 | 120 | 0.721115 | [
"vector"
] |
02302f116a74f92c0aa21c7b5535aa5c88287cbf | 785 | h | C | byond-extools/src/datum_socket/datum_socket.h | Altoids1/extools-old | a86dc3694495ef31b86e2b3d9e6da69460a995c3 | [
"MIT"
] | null | null | null | byond-extools/src/datum_socket/datum_socket.h | Altoids1/extools-old | a86dc3694495ef31b86e2b3d9e6da69460a995c3 | [
"MIT"
] | null | null | null | byond-extools/src/datum_socket/datum_socket.h | Altoids1/extools-old | a86dc3694495ef31b86e2b3d9e6da69460a995c3 | [
"MIT"
] | null | null | null | #pragma once
#include <string>
#include "../core/socket/socket.h"
#include <mutex>
class DatumSocket
{
public:
DatumSocket();
DatumSocket(const DatumSocket& other);
~DatumSocket();
bool connect(std::string addr, std::string port);
bool send(std::string data);
std::string recv(int len);
void close();
bool has_data() { std::lock_guard<std::mutex> lk(buffer_lock); return !buffer.empty() || !open; }
void set_awaiter(SuspendedProc* proc) { data_awaiter = proc; }
protected:
void recv_loop();
#ifdef _WIN32
TcpStream stream;
#endif
std::string buffer;
std::mutex buffer_lock;
SuspendedProc* data_awaiter = nullptr;
bool open = false;
};
extern std::unordered_map<unsigned int, std::unique_ptr<DatumSocket>> sockets;
extern std::vector<SuspendedProc*> timers_to_reset; | 24.53125 | 99 | 0.732484 | [
"vector"
] |
02336d2320ceb4b4b434102025fa8615d81f4394 | 12,472 | h | C | apps/batch_router/Batch_Router_Implementation.h | osu-sim/ANL_polaris | a7b96f908017d02af3a79a510c813f45c2373c84 | [
"BSD-3-Clause"
] | null | null | null | apps/batch_router/Batch_Router_Implementation.h | osu-sim/ANL_polaris | a7b96f908017d02af3a79a510c813f45c2373c84 | [
"BSD-3-Clause"
] | null | null | null | apps/batch_router/Batch_Router_Implementation.h | osu-sim/ANL_polaris | a7b96f908017d02af3a79a510c813f45c2373c84 | [
"BSD-3-Clause"
] | null | null | null | #pragma once
#include "Batch_Router_Prototype.h"
#include "Movement_Plan_Prototype.h"
#include "Routing_Prototype.h"
namespace Batch_Router_Components
{
namespace Types
{
}
namespace Concepts
{
}
namespace Implementations
{
implementation struct Routed_Trip_Implementation : public Polaris_Component<MasterType,INHERIT(Routed_Trip_Implementation),Execution_Object>
{
// Tag as implementation
typedef typename Polaris_Component<MasterType,INHERIT(Routed_Trip_Implementation),Execution_Object>::Component_Type ComponentType;
//=============================================
// Primary events
//---------------------------------------------
static void Trip_Conditional(ComponentType* _this, Event_Response& response)
{
typedef Prototypes::Routed_Trip<ComponentType> _This_Interface;
ComponentType* _pthis = (ComponentType*)_this;
_This_Interface* this_ptr = (_This_Interface*)_pthis;
this_ptr->Get_Results<NT>();
response.next._iteration = END;
response.next._sub_iteration = END;
}
m_prototype(Network_Components::Prototypes::Network,typename MasterType::network_type, network_reference, NONE, NONE);
m_prototype(Routing_Components::Prototypes::Routing,typename MasterType::routing_type, router, NONE, NONE);
m_prototype(Activity_Location_Components::Prototypes::Activity_Location,typename MasterType::activity_location_type, origin, NONE, NONE);
m_prototype(Activity_Location_Components::Prototypes::Activity_Location,typename MasterType::activity_location_type, destination, NONE, NONE);
typedef origin_interface location_interface;
m_data(Vehicle_Components::Types::Vehicle_Type_Keys, mode, NONE,NONE);
member_component_and_feature_accessor(departure_time, Value, Basic_Units::Prototypes::Time, Basic_Units::Implementations::Time_Implementation<NT>);
m_data(bool, link_failure,NONE,NONE);
m_data(bool, turn_failure,NONE,NONE);
m_data(int, ID, NONE, NONE);
m_data(_lock, write_lock, NONE, NONE);
m_container(concat(std::vector<pair<bool,location_interface*>>),origin_routing_results, NONE, NONE);
m_container(concat(std::vector<pair<bool,location_interface*>>),destination_routing_results, NONE, NONE);
typedef strip_modifiers(network_reference_type) network_itf;
typedef strip_modifiers(router_type) router_itf;
typedef Pair_Associative_Container<typename network_itf::get_type_of(zones_container)> zones_itf;
typedef Zone_Components::Prototypes::Zone<get_mapped_component_type(zones_itf)> zone_itf;
typedef Activity_Location_Components::Prototypes::Activity_Location<typename remove_pointer<typename zone_itf::get_type_of(origin_activity_locations)::value_type>::type> location_itf;
typedef Random_Access_Sequence<typename zone_itf::get_type_of(origin_activity_locations),location_itf*> locations_itf;
typedef Random_Access_Sequence<typename location_itf::get_type_of(origin_links)> links_itf;
typedef Link_Components::Prototypes::Link<get_component_type(links_itf)> link_itf;
typedef Random_Access_Sequence<typename link_itf::get_type_of(outbound_turn_movements)> turns_itf;
typedef Turn_Movement_Components::Prototypes::Movement<get_component_type(turns_itf)> turn_itf;
typedef Movement_Plan_Components::Prototypes::Movement_Plan< typename router_itf::get_type_of(movement_plan)> _Movement_Plan_Interface;
typedef Random_Access_Sequence<typename _Movement_Plan_Interface::get_type_of(trajectory_container)> _Trajectory_Container_Interface;
typedef Movement_Plan_Components::Prototypes::Trajectory_Unit<get_component_type(_Trajectory_Container_Interface)> _Trajectory_Unit_Interface;
template<typename NetworkType, typename LocationType, typename TimeType> void Initialize(string mode, int Trip_Id, NetworkType network_ref, LocationType orig, LocationType dest, TimeType depart, requires(LocationType, check(LocationType, is_pointer) && check(strip_modifiers(LocationType), Activity_Location_Components::Concepts::Is_Activity_Location_Prototype)))
{
typedef Network_Components::Prototypes::Network< typename get_type_of(network_reference)> _Network_Interface;
typedef Activity_Location_Components::Prototypes::Activity_Location<typename remove_pointer< typename _Network_Interface::get_type_of(activity_locations_container)::value_type>::type> _Activity_Location_Interface;
typedef Random_Access_Sequence< typename _Network_Interface::get_type_of(activity_locations_container), _Activity_Location_Interface*> _Activity_Locations_Container_Interface;
typedef Link_Components::Prototypes::Link<typename MasterType::link_type> _Link_Interface;
typedef Random_Access_Sequence< typename _Activity_Location_Interface::get_type_of(origin_links), _Link_Interface*> _Links_Container_Interface;
typedef Zone_Components::Prototypes::Zone<typename remove_pointer< typename _Network_Interface::get_type_of(zones_container)::data_type>::type> _Zone_Interface;
typedef Random_Access_Sequence< typename _Network_Interface::get_type_of(zones_container), _Zone_Interface*> _Zones_Container_Interface;
typedef Turn_Movement_Components::Prototypes::Movement<typename remove_pointer< typename _Link_Interface::get_type_of(outbound_turn_movements)::value_type>::type> _Movement_Interface;
typedef Random_Access_Sequence< typename _Link_Interface::get_type_of(outbound_turn_movements), _Movement_Interface*> _Movements_Container_Interface;
typedef Routing_Components::Prototypes::Routing< get_type_of(router) > _Routing_Interface;
typedef Movement_Plan_Components::Prototypes::Movement_Plan< typename MasterType::movement_plan_type> _Movement_Plan_Interface;
typedef Scenario_Components::Prototypes::Scenario<typename MasterType::scenario_type> _Scenario_Interface;
this->network_reference<_Network_Interface*>(network_ref);
_Network_Interface* network = network_reference<_Network_Interface*>();
_Scenario_Interface* scenario = (_Scenario_Interface*)_global_scenario;
_Activity_Locations_Container_Interface& activity_locations = network->template activity_locations_container<_Activity_Locations_Container_Interface&>();
_ID = Trip_Id;
// Validate departure time
int departed_time = GLOBALS::Time_Converter.Convert_Value<TimeType, Simulation_Timestep_Increment>(depart);
this->departure_time<TimeType>(depart);
int simulation_start_time = scenario->template simulation_start_time<int>();
int simulation_end_time = scenario->template simulation_end_time<int>();
if (departed_time < simulation_start_time || departed_time >= simulation_end_time)
{
results_by_thread[0] << Trip_Id << ": Trip start time is out of bounds - skipped.";
return;
}
// Validate that origin/destination pair is routable
_Activity_Location_Interface* origin_activity_location = orig;
this->origin<_Activity_Location_Interface*>(orig);
_Activity_Location_Interface* destination_activity_location = dest;
this->destination<_Activity_Location_Interface*>(dest);
_Link_Interface* origin_link = origin_activity_location->template origin_links<_Links_Container_Interface&>()[0];
_Link_Interface* destination_link = destination_activity_location->template destination_links<_Links_Container_Interface&>()[0];
if (origin_link->template internal_id<int>() == destination_link->template internal_id<int>() || (origin_link->template outbound_turn_movements<_Movements_Container_Interface&>().size() == 0 || destination_link->template inbound_turn_movements<_Movements_Container_Interface&>().size() == 0))
{
results_by_thread[0] << Trip_Id << "Origin/Destination pair is not routable - skipped.";
return;
}
// Allocate linked classes
_Routing_Interface* router = (_Routing_Interface*)Allocate<typename _Routing_Interface::Component_Type>();
_Movement_Plan_Interface* movement_plan = (_Movement_Plan_Interface*)Allocate<typename _Movement_Plan_Interface::Component_Type>();
this->router<_Routing_Interface*>(router);
// Assign values to sub-classes used in routing
movement_plan->network<_Network_Interface*>(network);
movement_plan->template origin<_Link_Interface*>(origin_link);
movement_plan->template destination<_Link_Interface*>(destination_link);
movement_plan->template origin<_Activity_Location_Interface*>(orig);
movement_plan->template destination<_Activity_Location_Interface*>(dest);
movement_plan->template departed_time<Time_Seconds>(departed_time);
movement_plan->template initialize_trajectory<NULLTYPE>();
if (strcmp(mode.c_str(),"rail")==0 || strcmp(mode.c_str(), "Rail")==0 || strcmp(mode.c_str(), "RAIL")==0) movement_plan->mode(Vehicle_Components::Types::Vehicle_Type_Keys::RAIL);
else if (strcmp(mode.c_str(), "bus")==0 || strcmp(mode.c_str(), "Bus") == 0 || strcmp(mode.c_str(), "BUS") == 0) movement_plan->mode(Vehicle_Components::Types::Vehicle_Type_Keys::BUS);
else if (strcmp(mode.c_str(), "walk")==0 || strcmp(mode.c_str(), "Walk") == 0 || strcmp(mode.c_str(), "WALK") == 0) movement_plan->mode(Vehicle_Components::Types::Vehicle_Type_Keys::WALK);
else if (strcmp(mode.c_str(), "bike") == 0 || strcmp(mode.c_str(), "Bike") == 0 || strcmp(mode.c_str(), "BIKE") == 0) movement_plan->mode(Vehicle_Components::Types::Vehicle_Type_Keys::BICYCLE);
else if (strcmp(mode.c_str(), "bicycle") == 0 || strcmp(mode.c_str(), "Bicycle") == 0 || strcmp(mode.c_str(), "BICYCLE") == 0) movement_plan->mode(Vehicle_Components::Types::Vehicle_Type_Keys::BICYCLE);
else if (strcmp(mode.c_str(), "pnr") == 0 || strcmp(mode.c_str(), "Pnr") == 0 || strcmp(mode.c_str(), "PNR") == 0) movement_plan->mode(Vehicle_Components::Types::Vehicle_Type_Keys::PARK_AND_RIDE);
else movement_plan->mode(Vehicle_Components::Types::Vehicle_Type_Keys::SOV);
router->template network<_Network_Interface*>(network);
router->Attach_New_Movement_Plan<typename _Movement_Plan_Interface::Component_Type>(movement_plan);
// Get a random timestep in which to perform route calculation
Simulation_Timestep_Increment dt = GLOBALS::Uniform_RNG.Next_Rand<double>() * (END - 6 - iteration());
Simulation_Timestep_Increment t = GLOBALS::Simulation_Time.Future_Time<Simulation_Timestep_Increment, Simulation_Timestep_Increment>(dt);
// Schedule routing at timestep t + 1
router->Schedule_Route_Computation(departed_time, t + 1);
// Load the trip conditional at timestep t + 5, which fills the trip results after routing is completed
//TODO Omer: Check t + 2 vs t+ 5 does not affect things badly.
//Load_Event<ComponentType>(Trip_Conditional, t + 5, Types::SUB_ITERATIONS::INITIALIZE);
Load_Event<ComponentType>(Trip_Conditional, t + 2, Types::SUB_ITERATIONS::INITIALIZE);
}
template<typename TargetType> void Get_Results()
{
_Movement_Plan_Interface* movement = this->_router->movement_plan<_Movement_Plan_Interface*>();
if (movement->valid_trajectory<bool>())
{
summary_by_thread[__thread_id] << __thread_id << "\t" << movement->summary_string<std::string>() ;
details_by_thread[__thread_id] << movement->detail_string<std::string>();
results_by_thread[__thread_id] << movement->routed_travel_time<float>() << ": ";
_Trajectory_Container_Interface* trajectory = movement->trajectory_container<_Trajectory_Container_Interface*>();
for (_Trajectory_Container_Interface::iterator itr = trajectory->begin(); itr != trajectory->end(); ++itr)
{
_Trajectory_Unit_Interface* tu = (_Trajectory_Unit_Interface*)*itr;
link_itf* link = tu->link<link_itf*>();
results_by_thread[__thread_id]<<_ID<<": (" << link->dbid<int>()<<"."<<link->direction<int>()<<") "<<tu->estimated_link_accepting_time<int>()<<", ";
}
results_by_thread[__thread_id] << endl;
}
else
{
results_by_thread[__thread_id] << _ID <<": Error, movement was not routable."<<endl;
summary_by_thread[__thread_id] << __thread_id << "\t" << movement->summary_string<std::string>();
}
object_count_by_thread[__thread_id]++;
if (object_count_by_thread[__thread_id] >= 100)
{
LOCK(_write_lock);
fw_output.Write(results_by_thread[__thread_id]);
fw_mm_sp_summary.Write_NoDelim(summary_by_thread[__thread_id]);
fw_mm_sp_details.Write_NoDelim(details_by_thread[__thread_id]);
object_count_by_thread[__thread_id] = 0;
UNLOCK(_write_lock);
}
}
};
}
}
| 60.251208 | 366 | 0.770125 | [
"vector"
] |
0239110391d3f72a8febc6e4d5f3c9244181d1b0 | 222,711 | c | C | example/unity/DemoApp/iii_BackUpThisFolder_ButDontShipItWithYourGame/il2cppOutput/Unity.XR.ARCore_CodeGen.c | Augmented-Future/flutter-unity-view-widget | b7036974249ff5e5a26fed3fc85167c607775a49 | [
"MIT"
] | null | null | null | example/unity/DemoApp/iii_BackUpThisFolder_ButDontShipItWithYourGame/il2cppOutput/Unity.XR.ARCore_CodeGen.c | Augmented-Future/flutter-unity-view-widget | b7036974249ff5e5a26fed3fc85167c607775a49 | [
"MIT"
] | null | null | null | example/unity/DemoApp/iii_BackUpThisFolder_ButDontShipItWithYourGame/il2cppOutput/Unity.XR.ARCore_CodeGen.c | Augmented-Future/flutter-unity-view-widget | b7036974249ff5e5a26fed3fc85167c607775a49 | [
"MIT"
] | null | null | null | #include "pch-c.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include "codegen/il2cpp-codegen-metadata.h"
extern const RuntimeMethod* ARCoreProvider_CameraPermissionRequestProvider_m52520DB26683512123C6B56B7E2A28269DF7C310_RuntimeMethod_var;
extern const RuntimeMethod* ARCoreProvider_GenerateGuid_m406A7A02F96253CB573818EA5FF3E5AF66B91CDC_RuntimeMethod_var;
extern const RuntimeMethod* ARCoreProvider_OnApkInstallation_mE3B31805C325D8C7F0FC2BC00F8249A759AE5B98_RuntimeMethod_var;
extern const RuntimeMethod* ARCoreProvider_OnBeforeGetCameraConfiguration_m2C314F5FC174CB06131BFADE7B5C0378E530C70C_RuntimeMethod_var;
extern const RuntimeMethod* ARCoreProvider_OnCheckApkAvailability_m0C786C7B24238176AC42E8CEF62BA1D84EB9C1DB_RuntimeMethod_var;
extern const RuntimeMethod* ARCoreProvider_SetConfigurationCallback_m21110C590C44E78936908B4D2198452803E2330B_RuntimeMethod_var;
// 0x00000001 System.Void UnityEngine.XR.ARCore.ArCameraConfig::.ctor(System.IntPtr)
extern void ArCameraConfig__ctor_m03B7CCBE0A6A9F8C9CF14EBBCB1517566DA47015 (void);
// 0x00000002 UnityEngine.XR.ARCore.ArCameraConfig UnityEngine.XR.ARCore.ArCameraConfig::FromIntPtr(System.IntPtr)
extern void ArCameraConfig_FromIntPtr_mA19D247EBA63FC5B9E3446BDE14A5EF262B31494 (void);
// 0x00000003 UnityEngine.XR.ARCore.ArCameraConfig UnityEngine.XR.ARCore.ArCameraConfig::get_Null()
extern void ArCameraConfig_get_Null_mA60A9CA8C06888A217777F3300F435992151987A (void);
// 0x00000004 System.Boolean UnityEngine.XR.ARCore.ArCameraConfig::get_IsNull()
extern void ArCameraConfig_get_IsNull_m0E09F4D2B8C7F7159FBF65FCA7486A8C79741ED6 (void);
// 0x00000005 System.IntPtr UnityEngine.XR.ARCore.ArCameraConfig::AsIntPtr()
extern void ArCameraConfig_AsIntPtr_m319C668BCFE412C0D53FF26D97EDB93249B39444 (void);
// 0x00000006 System.Void UnityEngine.XR.ARCore.ArCameraConfig::.ctor(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfig__ctor_mE14FEFC3215FE2A052D06E5A43C619D320B9AA19 (void);
// 0x00000007 System.Void UnityEngine.XR.ARCore.ArCameraConfig::Dispose()
extern void ArCameraConfig_Dispose_m165F78DBFE34B76060059B7BFC7EB367E0D626CC (void);
// 0x00000008 System.String UnityEngine.XR.ARCore.ArCameraConfig::GetCameraId(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfig_GetCameraId_mE547D5D96CFA540BE2631831CB839D3D907DAC90 (void);
// 0x00000009 UnityEngine.XR.ARCore.ArCameraConfigDepthSensorUsage UnityEngine.XR.ARCore.ArCameraConfig::GetDepthSensorUsage(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfig_GetDepthSensorUsage_m5F136C8F9C5B3044C503580EB45DBC2671EC7C4F (void);
// 0x0000000A UnityEngine.XR.ARCore.ArCameraConfigFacingDirection UnityEngine.XR.ARCore.ArCameraConfig::GetFacingDirection(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfig_GetFacingDirection_m3C022FA6AC02ED9BBBE8B4923E9CA397E72FB7A4 (void);
// 0x0000000B System.ValueTuple`2<System.Int32,System.Int32> UnityEngine.XR.ARCore.ArCameraConfig::GetFpsRange(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfig_GetFpsRange_mF9215E84CF0CF2EB05D2ACD0CFDE02899C9F2533 (void);
// 0x0000000C System.ValueTuple`2<System.Int32,System.Int32> UnityEngine.XR.ARCore.ArCameraConfig::GetImageDimensions(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfig_GetImageDimensions_m3746D40ABD8902AEA59C72E1F6B23635A1A2C2C6 (void);
// 0x0000000D System.ValueTuple`2<System.Int32,System.Int32> UnityEngine.XR.ARCore.ArCameraConfig::GetTextureDimensions(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfig_GetTextureDimensions_mA0E9C970FDEE0847B4FC7AABC35D82B0259648AE (void);
// 0x0000000E System.IntPtr UnityEngine.XR.ARCore.ArCameraConfig::op_Explicit(UnityEngine.XR.ARCore.ArCameraConfig)
extern void ArCameraConfig_op_Explicit_m75C16A3BEDDA4D9395023DC116B9AE3D3E70BB0D (void);
// 0x0000000F System.Boolean UnityEngine.XR.ARCore.ArCameraConfig::Equals(UnityEngine.XR.ARCore.ArCameraConfig)
extern void ArCameraConfig_Equals_m970EB204E68B633C9E34D1ED6A06EDCCD7E461E9 (void);
// 0x00000010 System.Boolean UnityEngine.XR.ARCore.ArCameraConfig::Equals(System.Object)
extern void ArCameraConfig_Equals_m475848DB0C28F764CAFC0F44E27B06BEB7564041 (void);
// 0x00000011 System.Int32 UnityEngine.XR.ARCore.ArCameraConfig::GetHashCode()
extern void ArCameraConfig_GetHashCode_m12BD55CF30C1466B45155A17224C4AA9AB16C4E0 (void);
// 0x00000012 System.Boolean UnityEngine.XR.ARCore.ArCameraConfig::op_Equality(UnityEngine.XR.ARCore.ArCameraConfig,UnityEngine.XR.ARCore.ArCameraConfig)
extern void ArCameraConfig_op_Equality_m3B386ECFAF0794C36A1394BBF7C21F9162F9BA38 (void);
// 0x00000013 System.Boolean UnityEngine.XR.ARCore.ArCameraConfig::op_Inequality(UnityEngine.XR.ARCore.ArCameraConfig,UnityEngine.XR.ARCore.ArCameraConfig)
extern void ArCameraConfig_op_Inequality_m0CBACD131638FB61B37871920FC737A5367FDE86 (void);
// 0x00000014 System.Boolean UnityEngine.XR.ARCore.ArCameraConfig::op_Equality(System.Nullable`1<UnityEngine.XR.ARCore.ArCameraConfig>,System.Nullable`1<UnityEngine.XR.ARCore.ArCameraConfig>)
extern void ArCameraConfig_op_Equality_mAFA54C0D4D41652098C1F9DFDC1179490D9EFDE0 (void);
// 0x00000015 System.Boolean UnityEngine.XR.ARCore.ArCameraConfig::op_Inequality(System.Nullable`1<UnityEngine.XR.ARCore.ArCameraConfig>,System.Nullable`1<UnityEngine.XR.ARCore.ArCameraConfig>)
extern void ArCameraConfig_op_Inequality_mCAF214A16A446C0C3B0FFD30FA055FB4CC7088CA (void);
// 0x00000016 System.Void UnityEngine.XR.ARCore.ArCameraConfig::Create(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfig&)
extern void ArCameraConfig_Create_m170C242CBD91B2B4B3F3E740F1D72FCD76F68584 (void);
// 0x00000017 System.Void UnityEngine.XR.ARCore.ArCameraConfig::Destroy(UnityEngine.XR.ARCore.ArCameraConfig)
extern void ArCameraConfig_Destroy_m0D4FC9FC4D4AEE2027A91119BD199463B9433058 (void);
// 0x00000018 System.Void UnityEngine.XR.ARCore.ArCameraConfig::GetCameraId(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfig,UnityEngine.XR.ARCore.ArString&)
extern void ArCameraConfig_GetCameraId_m446B0307DC42BC3B01663083F4B2860F563669BD (void);
// 0x00000019 System.Void UnityEngine.XR.ARCore.ArCameraConfig::GetDepthSensorUsage(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfig,UnityEngine.XR.ARCore.ArCameraConfigDepthSensorUsage&)
extern void ArCameraConfig_GetDepthSensorUsage_m4D78136CAFEBF3D9CF7CD79D6A3CCC6115AA001B (void);
// 0x0000001A System.Void UnityEngine.XR.ARCore.ArCameraConfig::GetFacingDirection(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfig,UnityEngine.XR.ARCore.ArCameraConfigFacingDirection&)
extern void ArCameraConfig_GetFacingDirection_mE1D3ABC879DBA98EA977AB70F4EBA66F83B13100 (void);
// 0x0000001B System.Void UnityEngine.XR.ARCore.ArCameraConfig::GetFpsRange(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfig,System.Int32&,System.Int32&)
extern void ArCameraConfig_GetFpsRange_m018C3FB75E73D7A830C4ABE35965A0E54882A401 (void);
// 0x0000001C System.Void UnityEngine.XR.ARCore.ArCameraConfig::GetImageDimensions(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfig,System.Int32&,System.Int32&)
extern void ArCameraConfig_GetImageDimensions_m8059D0A20AC5D7F738432B5ECE733A846567713B (void);
// 0x0000001D System.Void UnityEngine.XR.ARCore.ArCameraConfig::GetTextureDimensions(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfig,System.Int32&,System.Int32&)
extern void ArCameraConfig_GetTextureDimensions_m31F81DC0D4AE324A6B07F0B7A20F1E8806CBF44A (void);
// 0x0000001E UnityEngine.XR.ARCore.ArCameraConfig UnityEngine.XR.ARCore.XRCameraConfigurationExtensions::AsArCameraConfig(UnityEngine.XR.ARSubsystems.XRCameraConfiguration)
extern void XRCameraConfigurationExtensions_AsArCameraConfig_mD016A86F7C0F48ED8195F6DC60F2DCA6EA06B1EE (void);
// 0x0000001F System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::.ctor(System.IntPtr)
extern void ArCameraConfigFilter__ctor_mAFDDE747B063B59B3DA2DD79FC20A16D497C07FA (void);
// 0x00000020 UnityEngine.XR.ARCore.ArCameraConfigFilter UnityEngine.XR.ARCore.ArCameraConfigFilter::FromIntPtr(System.IntPtr)
extern void ArCameraConfigFilter_FromIntPtr_mC4B4D4342CD2A608DD5DD74AA0712D4B41E2BDC3 (void);
// 0x00000021 UnityEngine.XR.ARCore.ArCameraConfigFilter UnityEngine.XR.ARCore.ArCameraConfigFilter::get_Null()
extern void ArCameraConfigFilter_get_Null_m054B7CE9A1E97478F17FD6DA9F4F02A9FBD39394 (void);
// 0x00000022 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::.ctor(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfigFilter__ctor_mF486A6AFC61683CFC3E52B7E5494E983D4DE83E7 (void);
// 0x00000023 System.IntPtr UnityEngine.XR.ARCore.ArCameraConfigFilter::AsIntPtr()
extern void ArCameraConfigFilter_AsIntPtr_mC26AD4E33C4D07ED7C4970BC7C75456AC84D62BF (void);
// 0x00000024 System.Boolean UnityEngine.XR.ARCore.ArCameraConfigFilter::get_IsNull()
extern void ArCameraConfigFilter_get_IsNull_m0C4936F2612BC0BB7B4BAF08F9F0947D69EDC383 (void);
// 0x00000025 UnityEngine.XR.ARCore.ArCameraConfigDepthSensorUsage UnityEngine.XR.ARCore.ArCameraConfigFilter::GetDepthSensorUsage(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfigFilter_GetDepthSensorUsage_mAD042C592CA038A62E72173B8B0E9224067C7C12 (void);
// 0x00000026 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::SetDepthSensorUsage(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigDepthSensorUsage)
extern void ArCameraConfigFilter_SetDepthSensorUsage_m92C45E574F2383B585B96C7FEC9FF2CCEABC68E3 (void);
// 0x00000027 UnityEngine.XR.ARCore.ArCameraConfigTargetFps UnityEngine.XR.ARCore.ArCameraConfigFilter::GetTargetFps(UnityEngine.XR.ARCore.ArSession)
extern void ArCameraConfigFilter_GetTargetFps_m8A00967A664541D6702D5256F048DC56EBB74983 (void);
// 0x00000028 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::SetTargetFps(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigTargetFps)
extern void ArCameraConfigFilter_SetTargetFps_mD09E6CDC671DB61E9FC443F99A26EF4C716C9766 (void);
// 0x00000029 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::Dispose()
extern void ArCameraConfigFilter_Dispose_m71514EB30557871157FCA62921F794E10EC3BD59 (void);
// 0x0000002A System.IntPtr UnityEngine.XR.ARCore.ArCameraConfigFilter::op_Explicit(UnityEngine.XR.ARCore.ArCameraConfigFilter)
extern void ArCameraConfigFilter_op_Explicit_m1E9A2D7922582033C2890A10FC3CF58001EA3250 (void);
// 0x0000002B System.Boolean UnityEngine.XR.ARCore.ArCameraConfigFilter::Equals(UnityEngine.XR.ARCore.ArCameraConfigFilter)
extern void ArCameraConfigFilter_Equals_m7A03616AACBC45070F8F65ACE805CF16ADF65494 (void);
// 0x0000002C System.Boolean UnityEngine.XR.ARCore.ArCameraConfigFilter::Equals(System.Object)
extern void ArCameraConfigFilter_Equals_mF6B858B3A8FC33E7912163F338B1CC71C59744ED (void);
// 0x0000002D System.Int32 UnityEngine.XR.ARCore.ArCameraConfigFilter::GetHashCode()
extern void ArCameraConfigFilter_GetHashCode_mAB06AE4573E43FB7802536BD3809666832F1348A (void);
// 0x0000002E System.Boolean UnityEngine.XR.ARCore.ArCameraConfigFilter::op_Equality(UnityEngine.XR.ARCore.ArCameraConfigFilter,UnityEngine.XR.ARCore.ArCameraConfigFilter)
extern void ArCameraConfigFilter_op_Equality_m57B80CEB767D5B0079E6EA109D9DDF28DE17DDE4 (void);
// 0x0000002F System.Boolean UnityEngine.XR.ARCore.ArCameraConfigFilter::op_Inequality(UnityEngine.XR.ARCore.ArCameraConfigFilter,UnityEngine.XR.ARCore.ArCameraConfigFilter)
extern void ArCameraConfigFilter_op_Inequality_m1CC6CD803B2F2331904A69D5E3721D79EFADF3BB (void);
// 0x00000030 System.Boolean UnityEngine.XR.ARCore.ArCameraConfigFilter::op_Equality(System.Nullable`1<UnityEngine.XR.ARCore.ArCameraConfigFilter>,System.Nullable`1<UnityEngine.XR.ARCore.ArCameraConfigFilter>)
extern void ArCameraConfigFilter_op_Equality_mF57F2BDCDC340DF652AEF95CB18D696F9A841C51 (void);
// 0x00000031 System.Boolean UnityEngine.XR.ARCore.ArCameraConfigFilter::op_Inequality(System.Nullable`1<UnityEngine.XR.ARCore.ArCameraConfigFilter>,System.Nullable`1<UnityEngine.XR.ARCore.ArCameraConfigFilter>)
extern void ArCameraConfigFilter_op_Inequality_mAD9AB2B35F3C7C52AFEE6A98AB7DBDFC6EBD33DA (void);
// 0x00000032 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::Create(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigFilter&)
extern void ArCameraConfigFilter_Create_mD896208F08CA2FE2C898937D243AACECABF4E395 (void);
// 0x00000033 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::Destroy(UnityEngine.XR.ARCore.ArCameraConfigFilter)
extern void ArCameraConfigFilter_Destroy_m984E11076B9CE909CB77CFAB318B272EA021EF7D (void);
// 0x00000034 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::GetDepthSensorUsage(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigFilter,UnityEngine.XR.ARCore.ArCameraConfigDepthSensorUsage&)
extern void ArCameraConfigFilter_GetDepthSensorUsage_m64691545465CBFF2610CB25D67FE0E25BCE50631 (void);
// 0x00000035 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::SetDepthSensorUsage(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigFilter,UnityEngine.XR.ARCore.ArCameraConfigDepthSensorUsage)
extern void ArCameraConfigFilter_SetDepthSensorUsage_mFFD25F9117C2AF5F94E99709083D229CF4C5B660 (void);
// 0x00000036 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::GetTargetFps(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigFilter,UnityEngine.XR.ARCore.ArCameraConfigTargetFps&)
extern void ArCameraConfigFilter_GetTargetFps_m2AE7B5F6ACB3C048646DC7FA519A921976711351 (void);
// 0x00000037 System.Void UnityEngine.XR.ARCore.ArCameraConfigFilter::SetTargetFps(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigFilter,UnityEngine.XR.ARCore.ArCameraConfigTargetFps)
extern void ArCameraConfigFilter_SetTargetFps_m7B28B95555C26E701C6071F39D2594E99B4EF161 (void);
// 0x00000038 System.Void UnityEngine.XR.ARCore.ArConfig::.ctor(System.IntPtr)
extern void ArConfig__ctor_m0E326EEBB3B5154A7BA864AF3B31CA153C4AC072 (void);
// 0x00000039 System.Void UnityEngine.XR.ARCore.ArConfig::.ctor(UnityEngine.XR.ARCore.ArSession)
extern void ArConfig__ctor_m807FC812AF15E78B8FD5025A164FF214A030F793 (void);
// 0x0000003A UnityEngine.XR.ARCore.ArConfig UnityEngine.XR.ARCore.ArConfig::FromIntPtr(System.IntPtr)
extern void ArConfig_FromIntPtr_m32208DEC75FA2D344888E9077071F4C43A52BDEF (void);
// 0x0000003B UnityEngine.XR.ARCore.ArConfig UnityEngine.XR.ARCore.ArConfig::get_Null()
extern void ArConfig_get_Null_m998AD100991D45E3BD7F659CA4F1A78A556306A2 (void);
// 0x0000003C System.Boolean UnityEngine.XR.ARCore.ArConfig::get_IsNull()
extern void ArConfig_get_IsNull_mC16E8E4A5FD7562D365B3CED6F6195F6D3A4BA98 (void);
// 0x0000003D System.IntPtr UnityEngine.XR.ARCore.ArConfig::AsIntPtr()
extern void ArConfig_AsIntPtr_m9CFB8A76A4BB209848A58B8CB8CC7481BF763A42 (void);
// 0x0000003E System.IntPtr UnityEngine.XR.ARCore.ArConfig::op_Explicit(UnityEngine.XR.ARCore.ArConfig)
extern void ArConfig_op_Explicit_m0B8CAA6B7B355EE6EAC0F901D95484A2E47E785B (void);
// 0x0000003F System.Boolean UnityEngine.XR.ARCore.ArConfig::Equals(UnityEngine.XR.ARCore.ArConfig)
extern void ArConfig_Equals_mCE8CA68F242CF012255732C5387E953EFB7C7572 (void);
// 0x00000040 System.Boolean UnityEngine.XR.ARCore.ArConfig::Equals(System.Object)
extern void ArConfig_Equals_mAF04B9E9552EAF1D2DE31F107EF45BBC9CF8BBA4 (void);
// 0x00000041 System.Int32 UnityEngine.XR.ARCore.ArConfig::GetHashCode()
extern void ArConfig_GetHashCode_m2AA440E48A34FDA2186E99FDF0630578AB433DC4 (void);
// 0x00000042 System.Boolean UnityEngine.XR.ARCore.ArConfig::op_Equality(UnityEngine.XR.ARCore.ArConfig,UnityEngine.XR.ARCore.ArConfig)
extern void ArConfig_op_Equality_m5A9111D49C9DBD1A479D5D3025DB27F4EB0C43B3 (void);
// 0x00000043 System.Boolean UnityEngine.XR.ARCore.ArConfig::op_Inequality(UnityEngine.XR.ARCore.ArConfig,UnityEngine.XR.ARCore.ArConfig)
extern void ArConfig_op_Inequality_mA7474C880461CA7A8568EC0C1C47E4888CB7FC08 (void);
// 0x00000044 System.Void UnityEngine.XR.ARCore.ArConfig::Dispose()
extern void ArConfig_Dispose_m7AFD805848963702EA520A205BF9E3AC79BFA37B (void);
// 0x00000045 System.Boolean UnityEngine.XR.ARCore.ArConfig::op_Equality(System.Nullable`1<UnityEngine.XR.ARCore.ArConfig>,System.Nullable`1<UnityEngine.XR.ARCore.ArConfig>)
extern void ArConfig_op_Equality_m39D3CA59FEDF21CB6A61B060A707BDA75CD3861C (void);
// 0x00000046 System.Boolean UnityEngine.XR.ARCore.ArConfig::op_Inequality(System.Nullable`1<UnityEngine.XR.ARCore.ArConfig>,System.Nullable`1<UnityEngine.XR.ARCore.ArConfig>)
extern void ArConfig_op_Inequality_m81FB0A8466E6E7E06F09BA424C0D1672B8C9ACD4 (void);
// 0x00000047 System.Void UnityEngine.XR.ARCore.ArConfig::Create(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArConfig&)
extern void ArConfig_Create_m78CF4C4E2A45690040017968D4BD2ECD00253372 (void);
// 0x00000048 System.Void UnityEngine.XR.ARCore.ArConfig::Destroy(UnityEngine.XR.ARCore.ArConfig)
extern void ArConfig_Destroy_m0C59C48FB5A2B23C97EA7E8663366BF3B91CE643 (void);
// 0x00000049 System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem::RegisterDescriptor()
extern void ARCoreAnchorSubsystem_RegisterDescriptor_m222ADF940BFE39EBF46A5C451EB817DAC7A68D66 (void);
// 0x0000004A System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem::.ctor()
extern void ARCoreAnchorSubsystem__ctor_mC98DC11B6F123B0FC0EA5ADFF88B8FA0E8A8D08B (void);
// 0x0000004B System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_mD07637BF200496D0C3615BB8CDB276EAF57A9901 (void);
// 0x0000004C System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_mEA426F258151A7C2A8D1E638C02C6208A3583DB1 (void);
// 0x0000004D System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_m2C54D63343AAAA27AE6CA3A9AD64A45E0DFA5148 (void);
// 0x0000004E UnityEngine.XR.ARSubsystems.TrackableChanges`1<UnityEngine.XR.ARSubsystems.XRAnchor> UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::GetChanges(UnityEngine.XR.ARSubsystems.XRAnchor,Unity.Collections.Allocator)
extern void ARCoreProvider_GetChanges_mDF33BE46E05FE3C966FBA1250EB5025782AD01DA (void);
// 0x0000004F System.Boolean UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::TryAddAnchor(UnityEngine.Pose,UnityEngine.XR.ARSubsystems.XRAnchor&)
extern void ARCoreProvider_TryAddAnchor_m943778D8A0B7D1A12C866ED6C4C2E8C20749D3EC (void);
// 0x00000050 System.Boolean UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::TryAttachAnchor(UnityEngine.XR.ARSubsystems.TrackableId,UnityEngine.Pose,UnityEngine.XR.ARSubsystems.XRAnchor&)
extern void ARCoreProvider_TryAttachAnchor_m0199986FA5941EE3C5265B5BE24B60EAC0F3526C (void);
// 0x00000051 System.Boolean UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::TryRemoveAnchor(UnityEngine.XR.ARSubsystems.TrackableId)
extern void ARCoreProvider_TryRemoveAnchor_mB6B7A1248155B29CACE8626014BCDD37FDD4FB05 (void);
// 0x00000052 System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::UnityARCore_refPoints_start()
extern void ARCoreProvider_UnityARCore_refPoints_start_m0EFC245DF28ACF16A3CC83329DDE23F76F3C75EB (void);
// 0x00000053 System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::UnityARCore_refPoints_stop()
extern void ARCoreProvider_UnityARCore_refPoints_stop_mB5765EBDE3CB39895AD2B9C4203C2A3F63E9BBEB (void);
// 0x00000054 System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::UnityARCore_refPoints_onDestroy()
extern void ARCoreProvider_UnityARCore_refPoints_onDestroy_m2EBA966EE22D704D66F30F7A4EC5528385E8ACF9 (void);
// 0x00000055 System.Void* UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::UnityARCore_refPoints_acquireChanges(System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Int32&)
extern void ARCoreProvider_UnityARCore_refPoints_acquireChanges_m623C01ECB87A5201A406C4DF8F7F758E3B776CB0 (void);
// 0x00000056 System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::UnityARCore_refPoints_releaseChanges(System.Void*)
extern void ARCoreProvider_UnityARCore_refPoints_releaseChanges_m653E4BF642061F192D25D4469D4F0CE7CED6F857 (void);
// 0x00000057 System.Boolean UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::UnityARCore_refPoints_tryAdd(UnityEngine.Pose,UnityEngine.XR.ARSubsystems.XRAnchor&)
extern void ARCoreProvider_UnityARCore_refPoints_tryAdd_mF08935E8B709A9B2F85A815D73FEC03C759276F5 (void);
// 0x00000058 System.Boolean UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::UnityARCore_refPoints_tryAttach(UnityEngine.XR.ARSubsystems.TrackableId,UnityEngine.Pose,UnityEngine.XR.ARSubsystems.XRAnchor&)
extern void ARCoreProvider_UnityARCore_refPoints_tryAttach_mB7B11969703FBD9D11182BF12531671803FA9C13 (void);
// 0x00000059 System.Boolean UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::UnityARCore_refPoints_tryRemove(UnityEngine.XR.ARSubsystems.TrackableId)
extern void ARCoreProvider_UnityARCore_refPoints_tryRemove_mCAA0C7F75F120F155201DD07952CD9A6CB71784E (void);
// 0x0000005A System.Void UnityEngine.XR.ARCore.ARCoreAnchorSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_m77B4C1ACBC5FE569D98454C3530E26CF11089C6A (void);
// 0x0000005B System.Void UnityEngine.XR.ARCore.Api::SetFeatureRequested(UnityEngine.XR.ARSubsystems.Feature,System.Boolean)
extern void Api_SetFeatureRequested_mA919C6960B5ED720C79350D0A5A3D7350B8D39C4 (void);
// 0x0000005C UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.Api::GetRequestedFeatures()
extern void Api_GetRequestedFeatures_m86552830716E05C2AD916C753C43D476CF898101 (void);
// 0x0000005D System.Boolean UnityEngine.XR.ARCore.Api::get_platformAndroid()
extern void Api_get_platformAndroid_mF3BEC29392C482694A6B778CDEB0C8AACE67664F (void);
// 0x0000005E UnityEngine.XR.ARCore.ARCoreLoader UnityEngine.XR.ARCore.Api::FindLoader()
extern void Api_FindLoader_mA87703BE138C6413A6F56AB3B014613164936E5A (void);
// 0x0000005F System.Boolean UnityEngine.XR.ARCore.Api::get_loaderPresent()
extern void Api_get_loaderPresent_m0D20256DBEF79FABAB5469220149A2D77FD09DFD (void);
// 0x00000060 System.Void UnityEngine.XR.ARCore.Api::.cctor()
extern void Api__cctor_m40E65FF7756DED0AC8A863B7A85159753EFE9ABF (void);
// 0x00000061 UnityEngine.XR.ARCore.ArSession UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::get_session()
extern void ARCoreBeforeGetCameraConfigurationEventArgs_get_session_mCC2430CFD657AA39475EC7F94D12E94602318773 (void);
// 0x00000062 System.Void UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::set_session(UnityEngine.XR.ARCore.ArSession)
extern void ARCoreBeforeGetCameraConfigurationEventArgs_set_session_m0E5A8E5B0E3D93A3CAD6F54F7E44C732FCE8686A (void);
// 0x00000063 UnityEngine.XR.ARCore.ArCameraConfigFilter UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::get_filter()
extern void ARCoreBeforeGetCameraConfigurationEventArgs_get_filter_mF91BB4DDE06DAD980576BE33973865F4CAD2C702 (void);
// 0x00000064 System.Void UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::set_filter(UnityEngine.XR.ARCore.ArCameraConfigFilter)
extern void ARCoreBeforeGetCameraConfigurationEventArgs_set_filter_m136097E18565BAB7B14635A951EF75F91208BB08 (void);
// 0x00000065 System.Boolean UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::Equals(UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs)
extern void ARCoreBeforeGetCameraConfigurationEventArgs_Equals_m967BC71D3DF0590295A53C8BFA897626CC513EFC (void);
// 0x00000066 System.Boolean UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::Equals(System.Object)
extern void ARCoreBeforeGetCameraConfigurationEventArgs_Equals_m08904E4BE8373C7A8930D51AF33F2EF8F60BA528 (void);
// 0x00000067 System.Int32 UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::GetHashCode()
extern void ARCoreBeforeGetCameraConfigurationEventArgs_GetHashCode_mBF1B9E848558FCF41FFA006B2A67018D2F405899 (void);
// 0x00000068 System.Boolean UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::op_Equality(UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs,UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs)
extern void ARCoreBeforeGetCameraConfigurationEventArgs_op_Equality_m879F389ACFEF2CA8B34C77008F59C0C825CB1D72 (void);
// 0x00000069 System.Boolean UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs::op_Inequality(UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs,UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs)
extern void ARCoreBeforeGetCameraConfigurationEventArgs_op_Inequality_mF92B58DFBC27BDEE9324823BA4C4740227783A39 (void);
// 0x0000006A System.IntPtr UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::get_session()
extern void ARCoreBeforeSetConfigurationEventArgs_get_session_mFB401F61257971B12D20BA2C2A13427ADF110405 (void);
// 0x0000006B UnityEngine.XR.ARCore.ArSession UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::get_arSession()
extern void ARCoreBeforeSetConfigurationEventArgs_get_arSession_mFD007DB2BB188809848E2E6F699A87C4041137B9 (void);
// 0x0000006C System.IntPtr UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::get_config()
extern void ARCoreBeforeSetConfigurationEventArgs_get_config_mABF124F70ED16AECD48A7AD0758798446A53DF31 (void);
// 0x0000006D UnityEngine.XR.ARCore.ArConfig UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::get_arConfig()
extern void ARCoreBeforeSetConfigurationEventArgs_get_arConfig_m1EE2C53DDF02FA08DF8EEC1C016B7C4F5BBFC598 (void);
// 0x0000006E System.Void UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::.ctor(System.IntPtr,System.IntPtr)
extern void ARCoreBeforeSetConfigurationEventArgs__ctor_mDEADF5D3E5BD90B0D3715FE63350F8B23475B297 (void);
// 0x0000006F System.Void UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::.ctor(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArConfig)
extern void ARCoreBeforeSetConfigurationEventArgs__ctor_mE6E334059D83C27B306C1F72CD68C86E6DA4FED2 (void);
// 0x00000070 System.Boolean UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::Equals(UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs)
extern void ARCoreBeforeSetConfigurationEventArgs_Equals_m4B4E1CC09BDDC6E0259BAC9D254FE94F81E336BB (void);
// 0x00000071 System.Int32 UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::GetHashCode()
extern void ARCoreBeforeSetConfigurationEventArgs_GetHashCode_m6E3BC2573D8D619B0E86CCF48EB8F27283F41349 (void);
// 0x00000072 System.Boolean UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::Equals(System.Object)
extern void ARCoreBeforeSetConfigurationEventArgs_Equals_m8969624DBC58D203BE709765D5623E86DAAAC90B (void);
// 0x00000073 System.Boolean UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::op_Equality(UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs,UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs)
extern void ARCoreBeforeSetConfigurationEventArgs_op_Equality_m4E11D637723A4B77FF4E0DDFADBD67ADAD6B11DB (void);
// 0x00000074 System.Boolean UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs::op_Inequality(UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs,UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs)
extern void ARCoreBeforeSetConfigurationEventArgs_op_Inequality_m965ABC7FA4C1EE083EA0056ACEF53E9A8359E81D (void);
// 0x00000075 System.String UnityEngine.XR.ARCore.ARCoreCameraSubsystem::get_backgroundShaderName()
extern void ARCoreCameraSubsystem_get_backgroundShaderName_m95DE9225CB8CA43D39B279EA70648A05DCCAC7FC (void);
// 0x00000076 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem::Register()
extern void ARCoreCameraSubsystem_Register_mD67C78E43675679BB4A9C531FF313D9138C774A7 (void);
// 0x00000077 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem::add_beforeGetCameraConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs>)
extern void ARCoreCameraSubsystem_add_beforeGetCameraConfiguration_mEF3CC67CF983EDDA871ACE63A8F93B6643526F53 (void);
// 0x00000078 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem::remove_beforeGetCameraConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs>)
extern void ARCoreCameraSubsystem_remove_beforeGetCameraConfiguration_mBAD3DB452B748425BECB242DAAE2CDA672B95C06 (void);
// 0x00000079 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem::TryGetCurrentConfiguration(UnityEngine.XR.ARSubsystems.XRCameraConfiguration&)
extern void ARCoreCameraSubsystem_TryGetCurrentConfiguration_m66BFC2C3C5EC6759AC3FC85197CCF607EBE7A3FE (void);
// 0x0000007A System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem::.ctor()
extern void ARCoreCameraSubsystem__ctor_mBD839198513F7B370BA4BC7523726EBF762BC83E (void);
// 0x0000007B UnityEngine.Material UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_cameraMaterial()
extern void ARCoreProvider_get_cameraMaterial_m43BB6CB876819A670E99E2AF819F21F093E825AF (void);
// 0x0000007C System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_permissionGranted()
extern void ARCoreProvider_get_permissionGranted_m3A14A077F17265C42FE4F0C056EC08AA5BECE474 (void);
// 0x0000007D System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_invertCulling()
extern void ARCoreProvider_get_invertCulling_m12A9EF15FB1037990513A6E8729B266F38760405 (void);
// 0x0000007E UnityEngine.XR.ARSubsystems.XRCpuImage/Api UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_cpuImageApi()
extern void ARCoreProvider_get_cpuImageApi_m24D27620E1001943EF0A520D1D3DD21D08BDBFF1 (void);
// 0x0000007F System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_mB3641D95DB0A7353E5F3C987660BA2282151A3A2 (void);
// 0x00000080 UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_currentCamera()
extern void ARCoreProvider_get_currentCamera_mDFD20E6CA1F40F899A04DF4EC99FE4ADED02BF21 (void);
// 0x00000081 UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_requestedCamera()
extern void ARCoreProvider_get_requestedCamera_m87CE71EFDF07B0D4A00F4ED55E2F58BBE6FA7B4A (void);
// 0x00000082 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::set_requestedCamera(UnityEngine.XR.ARSubsystems.Feature)
extern void ARCoreProvider_set_requestedCamera_m20BBB626E437F07057452F1F89441268CA217CA8 (void);
// 0x00000083 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_m7622EA81D53C25844D9EC8990A0927D3E144C8EB (void);
// 0x00000084 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_m28914ABC564DB03341B5FA1B384BBBC2FA5B2689 (void);
// 0x00000085 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_m97DEF45E2DD070C2DA43C7D0C42B6B119973A484 (void);
// 0x00000086 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::TryGetFrame(UnityEngine.XR.ARSubsystems.XRCameraParams,UnityEngine.XR.ARSubsystems.XRCameraFrame&)
extern void ARCoreProvider_TryGetFrame_m5DBFF8050E393426C025DC027812000FDECDCFD5 (void);
// 0x00000087 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_autoFocusRequested()
extern void ARCoreProvider_get_autoFocusRequested_m1DC365A076DD9E57832CAB0D9C8E3AC31807D317 (void);
// 0x00000088 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::set_autoFocusRequested(System.Boolean)
extern void ARCoreProvider_set_autoFocusRequested_mC8A88C6393A2738B39DB3DCDB70674BCA83DDC61 (void);
// 0x00000089 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_autoFocusEnabled()
extern void ARCoreProvider_get_autoFocusEnabled_m048D6D0D465785EB8DEFD70BFC57DCFCFF010EDA (void);
// 0x0000008A System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::OnBeforeBackgroundRender(System.Int32)
extern void ARCoreProvider_OnBeforeBackgroundRender_m93F93BFCE712FC6CF12F3407DA175A0D1A1BB204 (void);
// 0x0000008B UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_requestedLightEstimation()
extern void ARCoreProvider_get_requestedLightEstimation_mA5865DCE9DDC79B34007981126D8C0CC6C0969DF (void);
// 0x0000008C System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::set_requestedLightEstimation(UnityEngine.XR.ARSubsystems.Feature)
extern void ARCoreProvider_set_requestedLightEstimation_m8D927B6282C8DDA7BD4365148AF597EAC02E9E46 (void);
// 0x0000008D UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_currentLightEstimation()
extern void ARCoreProvider_get_currentLightEstimation_mA0829B77045555BF2B50BC73BD536AFF48E789B9 (void);
// 0x0000008E System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::TryGetIntrinsics(UnityEngine.XR.ARSubsystems.XRCameraIntrinsics&)
extern void ARCoreProvider_TryGetIntrinsics_m13E64DDA943B4179334A01D9821C7EB53455EB7D (void);
// 0x0000008F Unity.Collections.NativeArray`1<UnityEngine.XR.ARSubsystems.XRCameraConfiguration> UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::GetConfigurations(UnityEngine.XR.ARSubsystems.XRCameraConfiguration,Unity.Collections.Allocator)
extern void ARCoreProvider_GetConfigurations_m9D7C215C704B94C838518874CA90A3B62D7CCCD3 (void);
// 0x00000090 System.Nullable`1<UnityEngine.XR.ARSubsystems.XRCameraConfiguration> UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::get_currentConfiguration()
extern void ARCoreProvider_get_currentConfiguration_mD5373EEAA8C48033E3B2F3D892B0C384E2B9D67C (void);
// 0x00000091 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::set_currentConfiguration(System.Nullable`1<UnityEngine.XR.ARSubsystems.XRCameraConfiguration>)
extern void ARCoreProvider_set_currentConfiguration_m687F79EC299F69E1A227CE4FE4AE4CE7DC07F305 (void);
// 0x00000092 Unity.Collections.NativeArray`1<UnityEngine.XR.ARSubsystems.XRTextureDescriptor> UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::GetTextureDescriptors(UnityEngine.XR.ARSubsystems.XRTextureDescriptor,Unity.Collections.Allocator)
extern void ARCoreProvider_GetTextureDescriptors_m3CDF78C26FAD8C70D183EC23001E4BFA872AC4C5 (void);
// 0x00000093 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::TryAcquireLatestCpuImage(UnityEngine.XR.ARSubsystems.XRCpuImage/Cinfo&)
extern void ARCoreProvider_TryAcquireLatestCpuImage_m092583292CFCF7D6AB32DACA59817991B5644839 (void);
// 0x00000094 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::add_m_BeforeGetCameraConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs>)
extern void ARCoreProvider_add_m_BeforeGetCameraConfiguration_mB56992655281D83A97D444CDD8CFBCBE843C38AA (void);
// 0x00000095 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::remove_m_BeforeGetCameraConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs>)
extern void ARCoreProvider_remove_m_BeforeGetCameraConfiguration_mCC65AEBA7C580EF96F2DBE05418BC9674A5EF417 (void);
// 0x00000096 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::add_beforeGetCameraConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs>)
extern void ARCoreProvider_add_beforeGetCameraConfiguration_mD986481F241B18D60730DE4979BDF5214F614453 (void);
// 0x00000097 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::remove_beforeGetCameraConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeGetCameraConfigurationEventArgs>)
extern void ARCoreProvider_remove_beforeGetCameraConfiguration_m5C92FF8B21BD98B983C858D6707B27E657CF45AC (void);
// 0x00000098 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::OnBeforeGetCameraConfiguration(System.IntPtr,UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigFilter)
extern void ARCoreProvider_OnBeforeGetCameraConfiguration_m2C314F5FC174CB06131BFADE7B5C0378E530C70C (void);
// 0x00000099 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/ARCoreProvider::.cctor()
extern void ARCoreProvider__cctor_m57A7DFB09A89C987C94B948AD7630C78B9138976 (void);
// 0x0000009A System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::SetOnBeforeGetCameraConfigurationCallback(System.Action`3<System.IntPtr,UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArCameraConfigFilter>,System.IntPtr)
extern void NativeApi_SetOnBeforeGetCameraConfigurationCallback_mEDFAFBB855FB1A7182007E51CC2F751FFCFF4115 (void);
// 0x0000009B System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_Construct(System.Int32)
extern void NativeApi_UnityARCore_Camera_Construct_m0517006B7A03A7F856A00902C10D0F44F3D3F3DD (void);
// 0x0000009C System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_Destruct()
extern void NativeApi_UnityARCore_Camera_Destruct_mAA40F18C55D3989DC798236D6BBD92AAE0494775 (void);
// 0x0000009D System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_Start()
extern void NativeApi_UnityARCore_Camera_Start_mBD993590EF0176DBC1611E3CC5C35A936EDF6FF3 (void);
// 0x0000009E System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_Stop()
extern void NativeApi_UnityARCore_Camera_Stop_mDE9807C0596B52E1E7FAC39ACEE51FB32DBD3856 (void);
// 0x0000009F System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_TryGetFrame(UnityEngine.XR.ARSubsystems.XRCameraParams,UnityEngine.XR.ARSubsystems.XRCameraFrame&)
extern void NativeApi_UnityARCore_Camera_TryGetFrame_m795C0283BCC4B4795EEADD821756472EBC0BF8AE (void);
// 0x000000A0 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::GetAutoFocusEnabled()
extern void NativeApi_GetAutoFocusEnabled_m4005F7A9E3D05858513773026EA743B4D761D502 (void);
// 0x000000A1 UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::GetCurrentLightEstimation()
extern void NativeApi_GetCurrentLightEstimation_mAD44109CAF29070B260C3A8A14B94EF0960CF2E2 (void);
// 0x000000A2 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_TryGetIntrinsics(UnityEngine.XR.ARSubsystems.XRCameraIntrinsics&)
extern void NativeApi_UnityARCore_Camera_TryGetIntrinsics_mD48F2AAA82B1B3F25C2642F1826C3FE1DD0A53E6 (void);
// 0x000000A3 System.IntPtr UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_AcquireConfigurations(System.Int32&,System.Int32&)
extern void NativeApi_UnityARCore_Camera_AcquireConfigurations_m88201D12F6E4084486798C19380A4761AA583E12 (void);
// 0x000000A4 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_ReleaseConfigurations(System.IntPtr)
extern void NativeApi_UnityARCore_Camera_ReleaseConfigurations_m0EDBE305F38D43C80C58AAC4F86118569B681058 (void);
// 0x000000A5 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_TryGetCurrentConfiguration(UnityEngine.XR.ARSubsystems.XRCameraConfiguration&)
extern void NativeApi_UnityARCore_Camera_TryGetCurrentConfiguration_mAA3C4DF7A6CDB9A6EF1506E1EE872CC875220AA1 (void);
// 0x000000A6 UnityEngine.XR.ARCore.ARCoreCameraSubsystem/CameraConfigurationResult UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_TrySetCurrentConfiguration(UnityEngine.XR.ARSubsystems.XRCameraConfiguration)
extern void NativeApi_UnityARCore_Camera_TrySetCurrentConfiguration_m7AA7ECDC82F2654C2920E0F49D6FA7AF2FDD75ED (void);
// 0x000000A7 System.Void* UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_AcquireTextureDescriptors(System.Int32&,System.Int32&)
extern void NativeApi_UnityARCore_Camera_AcquireTextureDescriptors_mED6C13F0AF0F2B3F782E403C7F4ABA87F22BC37C (void);
// 0x000000A8 System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_ReleaseTextureDescriptors(System.Void*)
extern void NativeApi_UnityARCore_Camera_ReleaseTextureDescriptors_m1AB5843A884D1B23C8C7BA3B03153ACACF128A73 (void);
// 0x000000A9 System.Boolean UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_ShouldInvertCulling()
extern void NativeApi_UnityARCore_Camera_ShouldInvertCulling_mA9745C5244B5B03872C157F57F709899C42D4853 (void);
// 0x000000AA UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::GetCurrentFacingDirection()
extern void NativeApi_GetCurrentFacingDirection_m1D2C3AF12C8AB513720A5A328ECF27C0F7E5DBBD (void);
// 0x000000AB System.Void UnityEngine.XR.ARCore.ARCoreCameraSubsystem/NativeApi::UnityARCore_Camera_GetFenceWaitHandler(System.Int32)
extern void NativeApi_UnityARCore_Camera_GetFenceWaitHandler_mE3322D48FE63CFCF29B7AB0911962A9D3112E5E2 (void);
// 0x000000AC UnityEngine.XR.ARCore.ARCoreCpuImageApi UnityEngine.XR.ARCore.ARCoreCpuImageApi::get_instance()
extern void ARCoreCpuImageApi_get_instance_m5B9C701B0F5012FC10378257D6D2C1AC4E2D3AFA (void);
// 0x000000AD System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi::TryAcquireLatestImage(UnityEngine.XR.ARCore.ARCoreCpuImageApi/ImageType,UnityEngine.XR.ARSubsystems.XRCpuImage/Cinfo&)
extern void ARCoreCpuImageApi_TryAcquireLatestImage_m990C9DF992F56F6B2B0534A3346876B92578C618 (void);
// 0x000000AE UnityEngine.XR.ARSubsystems.XRCpuImage/AsyncConversionStatus UnityEngine.XR.ARCore.ARCoreCpuImageApi::GetAsyncRequestStatus(System.Int32)
extern void ARCoreCpuImageApi_GetAsyncRequestStatus_m3353734BAFE73783A6400AE409D99D4BD6F95261 (void);
// 0x000000AF System.Void UnityEngine.XR.ARCore.ARCoreCpuImageApi::DisposeImage(System.Int32)
extern void ARCoreCpuImageApi_DisposeImage_mB7DFA6357901007B40AB836685665DF868A50A48 (void);
// 0x000000B0 System.Void UnityEngine.XR.ARCore.ARCoreCpuImageApi::DisposeAsyncRequest(System.Int32)
extern void ARCoreCpuImageApi_DisposeAsyncRequest_m1C836B0DFC1351EC84ED75B00C72B36B878E7208 (void);
// 0x000000B1 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi::TryGetPlane(System.Int32,System.Int32,UnityEngine.XR.ARSubsystems.XRCpuImage/Plane/Cinfo&)
extern void ARCoreCpuImageApi_TryGetPlane_m9336AE63158D11FCB0454F8D984B0AA7EF1F07E2 (void);
// 0x000000B2 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi::NativeHandleValid(System.Int32)
extern void ARCoreCpuImageApi_NativeHandleValid_m0A091EF7277486E0AA8CD4AE07DA678D166F73E9 (void);
// 0x000000B3 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi::TryGetConvertedDataSize(System.Int32,UnityEngine.Vector2Int,UnityEngine.TextureFormat,System.Int32&)
extern void ARCoreCpuImageApi_TryGetConvertedDataSize_m2CBCAFAABF0F11B1F5E822CC68B76DF46419D95A (void);
// 0x000000B4 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi::TryConvert(System.Int32,UnityEngine.XR.ARSubsystems.XRCpuImage/ConversionParams,System.IntPtr,System.Int32)
extern void ARCoreCpuImageApi_TryConvert_m73099E871C6073CF094D502ACEA729F7608F791E (void);
// 0x000000B5 System.Int32 UnityEngine.XR.ARCore.ARCoreCpuImageApi::ConvertAsync(System.Int32,UnityEngine.XR.ARSubsystems.XRCpuImage/ConversionParams)
extern void ARCoreCpuImageApi_ConvertAsync_m47508107848E58A4F8D3E2A7269E13253D357BED (void);
// 0x000000B6 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi::TryGetAsyncRequestData(System.Int32,System.IntPtr&,System.Int32&)
extern void ARCoreCpuImageApi_TryGetAsyncRequestData_m3518605946425B8BBF80F7B97384F561DB95E9B5 (void);
// 0x000000B7 System.Void UnityEngine.XR.ARCore.ARCoreCpuImageApi::ConvertAsync(System.Int32,UnityEngine.XR.ARSubsystems.XRCpuImage/ConversionParams,UnityEngine.XR.ARSubsystems.XRCpuImage/Api/OnImageRequestCompleteDelegate,System.IntPtr)
extern void ARCoreCpuImageApi_ConvertAsync_mCB3F9F6299DB7CF6812DC1E1FDC38E5A891563D0 (void);
// 0x000000B8 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi::FormatSupported(UnityEngine.XR.ARSubsystems.XRCpuImage,UnityEngine.TextureFormat)
extern void ARCoreCpuImageApi_FormatSupported_m668336D4CFC1D2A98637ED8524387E67267967E1 (void);
// 0x000000B9 System.Void UnityEngine.XR.ARCore.ARCoreCpuImageApi::.ctor()
extern void ARCoreCpuImageApi__ctor_m16F0D8727C47B3BCAA39133E46AF6199C646F427 (void);
// 0x000000BA System.Void UnityEngine.XR.ARCore.ARCoreCpuImageApi::.cctor()
extern void ARCoreCpuImageApi__cctor_m9569623A711FF42A34490708A84FAE447E6C50FE (void);
// 0x000000BB System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_TryAcquireLatestImage(UnityEngine.XR.ARCore.ARCoreCpuImageApi/ImageType,UnityEngine.XR.ARSubsystems.XRCpuImage/Cinfo&)
extern void NativeApi_UnityARCore_CpuImage_TryAcquireLatestImage_m0ED2AC947A04B999988DCD288B70039F36230193 (void);
// 0x000000BC UnityEngine.XR.ARSubsystems.XRCpuImage/AsyncConversionStatus UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_GetAsyncRequestStatus(System.Int32)
extern void NativeApi_UnityARCore_CpuImage_GetAsyncRequestStatus_m74BC9ED8D99D2314E91D2B42B14CE64907282695 (void);
// 0x000000BD System.Void UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_DisposeImage(System.Int32)
extern void NativeApi_UnityARCore_CpuImage_DisposeImage_m89126F9420E46C87C6C4C56EC597AFFEB999F402 (void);
// 0x000000BE System.Void UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_DisposeAsyncRequest(System.Int32)
extern void NativeApi_UnityARCore_CpuImage_DisposeAsyncRequest_m52544AA6CD2A4BA5EF05618DD817B29F32BB935C (void);
// 0x000000BF System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_TryGetPlane(System.Int32,System.Int32,UnityEngine.XR.ARSubsystems.XRCpuImage/Plane/Cinfo&)
extern void NativeApi_UnityARCore_CpuImage_TryGetPlane_mA41D41E304473D93D188FB19D7AC3387F5464287 (void);
// 0x000000C0 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_HandleValid(System.Int32)
extern void NativeApi_UnityARCore_CpuImage_HandleValid_m9756C7954034342D4A452EBBE643D3E0237418AC (void);
// 0x000000C1 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_TryGetConvertedDataSize(System.Int32,UnityEngine.Vector2Int,UnityEngine.TextureFormat,System.Int32&)
extern void NativeApi_UnityARCore_CpuImage_TryGetConvertedDataSize_m08F8699C0D6087D03F6751460969674DD9E18348 (void);
// 0x000000C2 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_TryConvert(System.Int32,UnityEngine.XR.ARSubsystems.XRCpuImage/ConversionParams,System.IntPtr,System.Int32)
extern void NativeApi_UnityARCore_CpuImage_TryConvert_mD3D818D20CB3A82F9670C56D201374BDD1B5D3E1 (void);
// 0x000000C3 System.Int32 UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_CreateAsyncConversionRequest(System.Int32,UnityEngine.XR.ARSubsystems.XRCpuImage/ConversionParams)
extern void NativeApi_UnityARCore_CpuImage_CreateAsyncConversionRequest_m951F2FAFED83B60872A2C386D8B2D3FF6BB5C1B4 (void);
// 0x000000C4 System.Boolean UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_TryGetAsyncRequestData(System.Int32,System.IntPtr&,System.Int32&)
extern void NativeApi_UnityARCore_CpuImage_TryGetAsyncRequestData_m74E67E13997DC51C477393CC17D4B7C43796326A (void);
// 0x000000C5 System.Void UnityEngine.XR.ARCore.ARCoreCpuImageApi/NativeApi::UnityARCore_CpuImage_CreateAsyncConversionRequestWithCallback(System.Int32,UnityEngine.XR.ARSubsystems.XRCpuImage/ConversionParams,UnityEngine.XR.ARSubsystems.XRCpuImage/Api/OnImageRequestCompleteDelegate,System.IntPtr)
extern void NativeApi_UnityARCore_CpuImage_CreateAsyncConversionRequestWithCallback_mB8EAAEE8C4E29CC301C10F6C497D70F44A44002F (void);
// 0x000000C6 System.Void UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem::Register()
extern void ARCoreEnvironmentProbeSubsystem_Register_mCAD9D9C619F453F702B47994D465E6EB2974E729 (void);
// 0x000000C7 System.Void UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem::.ctor()
extern void ARCoreEnvironmentProbeSubsystem__ctor_m89DECFC44829DEFA9B37B205F2DCD73080ED78B0 (void);
// 0x000000C8 System.Void UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_mA174658BF6BFB950970E9076BB5F166FE696C264 (void);
// 0x000000C9 System.Void UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_mD152BD0A62302F3C7AEFB38AB10BDE64D25CDF73 (void);
// 0x000000CA System.Void UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_mF4D5343658FFDA68F481D8E998C8859B05E5A353 (void);
// 0x000000CB System.Void UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_m10827FBF253B47F6B6134DC64DBB0A0D6E43F8AD (void);
// 0x000000CC System.Boolean UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::get_automaticPlacementRequested()
extern void ARCoreProvider_get_automaticPlacementRequested_m8DB8F64671B4DD9C57A7FE7B42F0595E681AC456 (void);
// 0x000000CD System.Void UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::set_automaticPlacementRequested(System.Boolean)
extern void ARCoreProvider_set_automaticPlacementRequested_m18F7D90E52BBE1656F004B3CAA4F6CBF9B5000D4 (void);
// 0x000000CE System.Boolean UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::get_automaticPlacementEnabled()
extern void ARCoreProvider_get_automaticPlacementEnabled_m60D0A0EA74B9C86D7F0EFBF02BF0CA385A2CBC1F (void);
// 0x000000CF System.Boolean UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::get_environmentTextureHDRRequested()
extern void ARCoreProvider_get_environmentTextureHDRRequested_mC7E1DEED9E31F26A4089FDCC7BF7DB10352A5732 (void);
// 0x000000D0 System.Void UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::set_environmentTextureHDRRequested(System.Boolean)
extern void ARCoreProvider_set_environmentTextureHDRRequested_mB9DFB8284C97AC4D77505C872D3E471C436C77E8 (void);
// 0x000000D1 System.Boolean UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::get_environmentTextureHDREnabled()
extern void ARCoreProvider_get_environmentTextureHDREnabled_m7F547DA0179CEBE47CA9A123E2D01007F8429F3F (void);
// 0x000000D2 UnityEngine.XR.ARSubsystems.TrackableChanges`1<UnityEngine.XR.ARSubsystems.XREnvironmentProbe> UnityEngine.XR.ARCore.ARCoreEnvironmentProbeSubsystem/ARCoreProvider::GetChanges(UnityEngine.XR.ARSubsystems.XREnvironmentProbe,Unity.Collections.Allocator)
extern void ARCoreProvider_GetChanges_mAC7FEC7A1AD00B7207342CDD2654505031F48728 (void);
// 0x000000D3 System.Void UnityEngine.XR.ARCore.NativeApi::UnityARCore_EnvironmentProbeProvider_Construct(UnityEngine.ColorSpace)
extern void NativeApi_UnityARCore_EnvironmentProbeProvider_Construct_m1BDEC676C3C3ACE65AF627728975777AB2FC4B07 (void);
// 0x000000D4 System.Void UnityEngine.XR.ARCore.NativeApi::UnityARCore_EnvironmentProbeProvider_Start()
extern void NativeApi_UnityARCore_EnvironmentProbeProvider_Start_mB77C2D91570EB2198B3969E500E0C403CB7BA327 (void);
// 0x000000D5 System.Void UnityEngine.XR.ARCore.NativeApi::UnityARCore_EnvironmentProbeProvider_Stop()
extern void NativeApi_UnityARCore_EnvironmentProbeProvider_Stop_mF4E2242B94F51D2F7B5AB7FAE3944001D37DB807 (void);
// 0x000000D6 System.Void UnityEngine.XR.ARCore.NativeApi::UnityARCore_EnvironmentProbeProvider_Destroy()
extern void NativeApi_UnityARCore_EnvironmentProbeProvider_Destroy_m26B2CF5A7270EC1B4ADA5DA0498B2906BAC2F7AE (void);
// 0x000000D7 System.Void UnityEngine.XR.ARCore.NativeApi::UnityARCore_EnvironmentProbeProvider_SetAutomaticPlacementEnabled()
extern void NativeApi_UnityARCore_EnvironmentProbeProvider_SetAutomaticPlacementEnabled_m448DB924ECDB549D59DC594236E8B0929042BB19 (void);
// 0x000000D8 System.Void UnityEngine.XR.ARCore.NativeApi::UnityARCore_EnvironmentProbeProvider_TrySetEnvironmentTextureHDREnabled()
extern void NativeApi_UnityARCore_EnvironmentProbeProvider_TrySetEnvironmentTextureHDREnabled_mACF1FE1A5AF1B821B585E3139902513FB63C7803 (void);
// 0x000000D9 System.Void UnityEngine.XR.ARCore.NativeApi::UnityARCore_EnvironmentProbeProvider_GetChanges(System.Int32&,System.Int32&,System.Int32&,UnityEngine.XR.ARSubsystems.XREnvironmentProbe&)
extern void NativeApi_UnityARCore_EnvironmentProbeProvider_GetChanges_m04B26BB3BF9EAF45CF42F3DF97BEBB4B4B747688 (void);
// 0x000000DA UnityEngine.XR.ARCore.ARCoreFaceRegion UnityEngine.XR.ARCore.ARCoreFaceRegionData::get_region()
extern void ARCoreFaceRegionData_get_region_m7CD0AB1C423FD7A964F41C4CCCD14857C08177FE (void);
// 0x000000DB UnityEngine.Pose UnityEngine.XR.ARCore.ARCoreFaceRegionData::get_pose()
extern void ARCoreFaceRegionData_get_pose_m8B0A57A837D75EC314AE73F2931075A0F10A3775 (void);
// 0x000000DC System.Void UnityEngine.XR.ARCore.ARCoreFaceRegionData::.ctor(UnityEngine.XR.ARCore.ARCoreFaceRegion,UnityEngine.Pose)
extern void ARCoreFaceRegionData__ctor_m589405112E30EB33BE5D5E10C0F5CC67D24FBB49 (void);
// 0x000000DD System.Boolean UnityEngine.XR.ARCore.ARCoreFaceRegionData::Equals(UnityEngine.XR.ARCore.ARCoreFaceRegionData)
extern void ARCoreFaceRegionData_Equals_m2056862DD1AD264FBDD1C54E254871098B6995DC (void);
// 0x000000DE System.Int32 UnityEngine.XR.ARCore.ARCoreFaceRegionData::GetHashCode()
extern void ARCoreFaceRegionData_GetHashCode_mC1E01B54503EADB48B6927CF2074C7FA4D426ECE (void);
// 0x000000DF System.Boolean UnityEngine.XR.ARCore.ARCoreFaceRegionData::Equals(System.Object)
extern void ARCoreFaceRegionData_Equals_m17225C794C37005208BCDAAEB9DDE4F9B664D126 (void);
// 0x000000E0 System.String UnityEngine.XR.ARCore.ARCoreFaceRegionData::ToString()
extern void ARCoreFaceRegionData_ToString_m01A02559D50A9AB69A98601C0DC8E707ECDDB02F (void);
// 0x000000E1 System.Boolean UnityEngine.XR.ARCore.ARCoreFaceRegionData::op_Equality(UnityEngine.XR.ARCore.ARCoreFaceRegionData,UnityEngine.XR.ARCore.ARCoreFaceRegionData)
extern void ARCoreFaceRegionData_op_Equality_mF6F5B7089D3C94AEFA28DF8F33EA1DAC8651854C (void);
// 0x000000E2 System.Boolean UnityEngine.XR.ARCore.ARCoreFaceRegionData::op_Inequality(UnityEngine.XR.ARCore.ARCoreFaceRegionData,UnityEngine.XR.ARCore.ARCoreFaceRegionData)
extern void ARCoreFaceRegionData_op_Inequality_mEEC847F643FBEE49A1DFBB5536B3145430108FCB (void);
// 0x000000E3 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem::GetRegionPoses(UnityEngine.XR.ARSubsystems.TrackableId,Unity.Collections.Allocator,Unity.Collections.NativeArray`1<UnityEngine.XR.ARCore.ARCoreFaceRegionData>&)
extern void ARCoreFaceSubsystem_GetRegionPoses_m86783D41F79D1D4E8811CABE414E1F12437F21C5 (void);
// 0x000000E4 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem::UnityARCore_faceTracking_Start()
extern void ARCoreFaceSubsystem_UnityARCore_faceTracking_Start_mCAA8106354E3539174AEB5B9A7D9EC8D80D6A0D8 (void);
// 0x000000E5 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem::UnityARCore_faceTracking_Stop()
extern void ARCoreFaceSubsystem_UnityARCore_faceTracking_Stop_mDF758DBD00B884036ECDDA44684DB309D6AAF777 (void);
// 0x000000E6 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem::UnityARCore_faceTracking_Destroy()
extern void ARCoreFaceSubsystem_UnityARCore_faceTracking_Destroy_m2C02A75C6C59CF424B212450B1660916C1C81380 (void);
// 0x000000E7 System.Boolean UnityEngine.XR.ARCore.ARCoreFaceSubsystem::UnityARCore_faceTracking_TryGetFaceData(UnityEngine.XR.ARSubsystems.TrackableId,System.Void*&,System.Void*&,System.Void*&,System.Int32&,System.Void*&,System.Int32&)
extern void ARCoreFaceSubsystem_UnityARCore_faceTracking_TryGetFaceData_m9F117AA3A29554900494235EA1F41602CC059015 (void);
// 0x000000E8 System.Void* UnityEngine.XR.ARCore.ARCoreFaceSubsystem::UnityARCore_faceTracking_AcquireChanges(System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Int32&)
extern void ARCoreFaceSubsystem_UnityARCore_faceTracking_AcquireChanges_m3D7B9907A222926FA9A545C6B9979343FC2013DF (void);
// 0x000000E9 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem::UnityARCore_faceTracking_ReleaseChanges(System.Void*)
extern void ARCoreFaceSubsystem_UnityARCore_faceTracking_ReleaseChanges_mE975B10D5BF9D1AE1D447741BED766AB0C1B5A49 (void);
// 0x000000EA System.Void* UnityEngine.XR.ARCore.ARCoreFaceSubsystem::UnityARCore_faceTracking_acquireRegions(UnityEngine.XR.ARSubsystems.TrackableId,System.Int32&)
extern void ARCoreFaceSubsystem_UnityARCore_faceTracking_acquireRegions_mEDFC7BC2E6FAB18E8D8735FA1846523F491F24B0 (void);
// 0x000000EB System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem::UnityARCore_faceTracking_deallocateTemp(System.Void*)
extern void ARCoreFaceSubsystem_UnityARCore_faceTracking_deallocateTemp_mE14A581F67225A4D33059B3F7777C91377E64D63 (void);
// 0x000000EC System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem::RegisterDescriptor()
extern void ARCoreFaceSubsystem_RegisterDescriptor_m424198963114A2E00F811D5ABB02B323933AF9DC (void);
// 0x000000ED System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem::.ctor()
extern void ARCoreFaceSubsystem__ctor_mE994B52DC28CB49FDBC336E54C3510FEDF663138 (void);
// 0x000000EE System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCorePose::.ctor(UnityEngine.Vector3,UnityEngine.Quaternion)
extern void ARCorePose__ctor_m1328D26F798D034CBD7F0402528B873D5994D5AF (void);
// 0x000000EF System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/FaceRegionWithARCorePose::.ctor(UnityEngine.XR.ARCore.ARCoreFaceRegion,UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCorePose)
extern void FaceRegionWithARCorePose__ctor_m1021176D2016468413133E87B6F50884A240E76D (void);
// 0x000000F0 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/TransformPoseJob::Execute(System.Int32)
extern void TransformPoseJob_Execute_m7EBE008B308EEF99D66204836A8954E1C6F6F1D3 (void);
// 0x000000F1 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_m674E115A338FF9DABC486AEF8E2B2B469D68452C (void);
// 0x000000F2 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_m67BF08E9D1BA2C4C31060C97F2B6324AF74FA4DF (void);
// 0x000000F3 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_m3B9CEC2B8C99C1AB440C8434965D002153639BE5 (void);
// 0x000000F4 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider::GetFaceMesh(UnityEngine.XR.ARSubsystems.TrackableId,Unity.Collections.Allocator,UnityEngine.XR.ARSubsystems.XRFaceMesh&)
extern void ARCoreProvider_GetFaceMesh_mE8C775C1B20E2648524995615154E24D8312559D (void);
// 0x000000F5 UnityEngine.XR.ARSubsystems.TrackableChanges`1<UnityEngine.XR.ARSubsystems.XRFace> UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider::GetChanges(UnityEngine.XR.ARSubsystems.XRFace,Unity.Collections.Allocator)
extern void ARCoreProvider_GetChanges_m3F0274A1E1E2BCFACB2CB91032CD40ACE21E2710 (void);
// 0x000000F6 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_m7212DC6DFC295E14FECF45D31586ED62BE00E52D (void);
// 0x000000F7 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider/TransformVerticesJob::Execute(System.Int32)
extern void TransformVerticesJob_Execute_mB25F13AA4AB3152365B51B0C2ACA31FFC756D74F (void);
// 0x000000F8 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider/TransformUVsJob::Execute(System.Int32)
extern void TransformUVsJob_Execute_m3A9C954126E9929C947C66111DC50B1A4EB8478A (void);
// 0x000000F9 System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider/Triangle`1::.ctor(T,T,T)
// 0x000000FA System.Void UnityEngine.XR.ARCore.ARCoreFaceSubsystem/ARCoreProvider/TransformIndicesJob::Execute(System.Int32)
extern void TransformIndicesJob_Execute_m20C5A48E77A83348D5BD86AD436EBC581C5F0AAB (void);
// 0x000000FB System.Byte[] UnityEngine.XR.ARCore.ARCoreImageDatabase::GetLibraryData(UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary)
extern void ARCoreImageDatabase_GetLibraryData_m09B32DB063E260028276620B3FD92544BF56B657 (void);
// 0x000000FC System.Void UnityEngine.XR.ARCore.ARCoreImageDatabase::.ctor(UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary)
extern void ARCoreImageDatabase__ctor_m088924D76C9D933AAD4ACAA904D5077384B9FBE5 (void);
// 0x000000FD System.IntPtr UnityEngine.XR.ARCore.ARCoreImageDatabase::op_Explicit(UnityEngine.XR.ARCore.ARCoreImageDatabase)
extern void ARCoreImageDatabase_op_Explicit_mB2B13A4132FAD73DFF2DBAFFD4FB5D1752B57AF8 (void);
// 0x000000FE System.Void UnityEngine.XR.ARCore.ARCoreImageDatabase::Finalize()
extern void ARCoreImageDatabase_Finalize_m1A668727FF90C396A2501036A38C4BA412212F8F (void);
// 0x000000FF System.Boolean UnityEngine.XR.ARCore.ARCoreImageDatabase::get_supportsValidation()
extern void ARCoreImageDatabase_get_supportsValidation_mCD44728F3EBAD0F56E9B016C009DAADFDB6E3379 (void);
// 0x00000100 System.Int32 UnityEngine.XR.ARCore.ARCoreImageDatabase::get_supportedTextureFormatCount()
extern void ARCoreImageDatabase_get_supportedTextureFormatCount_mAED9D8669DE36B2AA73C7143C24BD620548ABC52 (void);
// 0x00000101 UnityEngine.TextureFormat UnityEngine.XR.ARCore.ARCoreImageDatabase::GetSupportedTextureFormatAtImpl(System.Int32)
extern void ARCoreImageDatabase_GetSupportedTextureFormatAtImpl_m1D2F965E4E7F58B0FE7BA6262ECBC994F73BE9C2 (void);
// 0x00000102 UnityEngine.XR.ARSubsystems.AddReferenceImageJobStatus UnityEngine.XR.ARCore.ARCoreImageDatabase::GetAddReferenceImageJobStatus(UnityEngine.XR.ARSubsystems.AddReferenceImageJobState)
extern void ARCoreImageDatabase_GetAddReferenceImageJobStatus_m1BBD7DD51F11B3FD80A4E0CD21D085399471BEB7 (void);
// 0x00000103 Unity.Collections.NativeArray`1<System.Byte> UnityEngine.XR.ARCore.ARCoreImageDatabase::GetUTF8Bytes(System.String)
extern void ARCoreImageDatabase_GetUTF8Bytes_mDF50981E4D87ABAC80566B234E197207BCD4074A (void);
// 0x00000104 UnityEngine.XR.ARSubsystems.AddReferenceImageJobState UnityEngine.XR.ARCore.ARCoreImageDatabase::ScheduleAddImageWithValidationJobImpl(Unity.Collections.NativeSlice`1<System.Byte>,UnityEngine.Vector2Int,UnityEngine.TextureFormat,UnityEngine.XR.ARSubsystems.XRReferenceImage,Unity.Jobs.JobHandle)
extern void ARCoreImageDatabase_ScheduleAddImageWithValidationJobImpl_m8458FC816306C31C531AEDF9342441B13FE85577 (void);
// 0x00000105 Unity.Jobs.JobHandle UnityEngine.XR.ARCore.ARCoreImageDatabase::ScheduleAddImageJobImpl(Unity.Collections.NativeSlice`1<System.Byte>,UnityEngine.Vector2Int,UnityEngine.TextureFormat,UnityEngine.XR.ARSubsystems.XRReferenceImage,Unity.Jobs.JobHandle)
extern void ARCoreImageDatabase_ScheduleAddImageJobImpl_m443DE86ADBC43475425A2C26ABE5EC6B3D78FA20 (void);
// 0x00000106 UnityEngine.XR.ARSubsystems.XRReferenceImage UnityEngine.XR.ARCore.ARCoreImageDatabase::GetReferenceImageAt(System.Int32)
extern void ARCoreImageDatabase_GetReferenceImageAt_m9319449DB183EAA9CB1F16CDF886E7601B798E56 (void);
// 0x00000107 System.Int32 UnityEngine.XR.ARCore.ARCoreImageDatabase::get_count()
extern void ARCoreImageDatabase_get_count_m97A7B403F0B4544C7CD6DE8B860DBEA9AB1E4F99 (void);
// 0x00000108 System.Int32 UnityEngine.XR.ARCore.ARCoreImageDatabase::GetHashCode()
extern void ARCoreImageDatabase_GetHashCode_mA4D7878527E9FC94B5F3AFD8E946C7CBBDDA6DC2 (void);
// 0x00000109 System.Boolean UnityEngine.XR.ARCore.ARCoreImageDatabase::Equals(System.Object)
extern void ARCoreImageDatabase_Equals_m49780C2062A4B7D7A72D24F93B242DBC1CC8336C (void);
// 0x0000010A System.Boolean UnityEngine.XR.ARCore.ARCoreImageDatabase::Equals(UnityEngine.XR.ARCore.ARCoreImageDatabase)
extern void ARCoreImageDatabase_Equals_m00A589ECD8847528CCA00E2AC42863D9437C492E (void);
// 0x0000010B System.Boolean UnityEngine.XR.ARCore.ARCoreImageDatabase::op_Equality(UnityEngine.XR.ARCore.ARCoreImageDatabase,UnityEngine.XR.ARCore.ARCoreImageDatabase)
extern void ARCoreImageDatabase_op_Equality_mAFA987BAAC11A64987131EE3D909D4315F84717C (void);
// 0x0000010C System.Boolean UnityEngine.XR.ARCore.ARCoreImageDatabase::op_Inequality(UnityEngine.XR.ARCore.ARCoreImageDatabase,UnityEngine.XR.ARCore.ARCoreImageDatabase)
extern void ARCoreImageDatabase_op_Inequality_m8AF7BAADDE5543D1A217B7E0E1310D1F8105A34C (void);
// 0x0000010D UnityEngine.XR.ARCore.ManagedReferenceImage UnityEngine.XR.ARCore.ARCoreImageDatabase::GetReferenceImage(System.IntPtr,System.Int32)
extern void ARCoreImageDatabase_GetReferenceImage_m9616BA3F15A866F3460D306D53E83615AC2D12DB (void);
// 0x0000010E System.Int32 UnityEngine.XR.ARCore.ARCoreImageDatabase::GetReferenceImageCount(System.IntPtr)
extern void ARCoreImageDatabase_GetReferenceImageCount_mC6F29847B98972FBA7DB3151EA3DC481123E8981 (void);
// 0x0000010F System.IntPtr UnityEngine.XR.ARCore.ARCoreImageDatabase::Deserialize(UnityEngine.XR.ARCore.NativeView,UnityEngine.XR.ARCore.NativeView)
extern void ARCoreImageDatabase_Deserialize_m445DB9A6898B8F2CDA2EF2C83609EAEC05B82E0C (void);
// 0x00000110 System.IntPtr UnityEngine.XR.ARCore.ARCoreImageDatabase::CreateValidator(System.IntPtr)
extern void ARCoreImageDatabase_CreateValidator_mC2D9A0DA9FD2C1998A80E6CF973C8E5AA773E939 (void);
// 0x00000111 UnityEngine.XR.ARSubsystems.AddReferenceImageJobStatus UnityEngine.XR.ARCore.ARCoreImageDatabase::GetStatus(System.IntPtr)
extern void ARCoreImageDatabase_GetStatus_m4FC25E68348C5F3B80317D72D2ADFA7511F41C6F (void);
// 0x00000112 System.Void UnityEngine.XR.ARCore.ARCoreImageDatabase::.cctor()
extern void ARCoreImageDatabase__cctor_mA4B4303F9D54DDF2957F1C5226201D614FC99324 (void);
// 0x00000113 System.Void UnityEngine.XR.ARCore.ARCoreImageDatabase/AddImageJob::Execute()
extern void AddImageJob_Execute_mFF2FF44D70D3647AF25843519E6B767A99BAAF36 (void);
// 0x00000114 System.Void UnityEngine.XR.ARCore.ARCoreImageDatabase/AddImageJob::AddImage(System.IntPtr,System.IntPtr,UnityEngine.XR.ARCore.ManagedReferenceImage&,System.Void*,System.Int32,System.Int32,System.Void*)
extern void AddImageJob_AddImage_mD2622F0CCF10A5990A7BB922A8A7B44B1B54A853 (void);
// 0x00000115 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingProvider::.ctor()
extern void ARCoreImageTrackingProvider__ctor_m3723734EBBE4F0EF169C7E2F50F01CF2904E4F2C (void);
// 0x00000116 System.String UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem::GetPathForLibrary(UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary)
extern void ARCoreImageTrackingSubsystem_GetPathForLibrary_mDA79328E2F862A0CA781C6E03B8ACE0F59C096AB (void);
// 0x00000117 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem::RegisterDescriptor()
extern void ARCoreImageTrackingSubsystem_RegisterDescriptor_m9207361727119F670A8BD7475DEF31E6F46640CA (void);
// 0x00000118 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem::.ctor()
extern void ARCoreImageTrackingSubsystem__ctor_m8B8F027237262EB2944D5678C3B5FEF4389A20C5 (void);
// 0x00000119 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem::.cctor()
extern void ARCoreImageTrackingSubsystem__cctor_mEF7EFD589F13293724E4C0390EABF44D015E525E (void);
// 0x0000011A System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_m95DD106DD54DAAEE54CA17B159AFF4331272FCCC (void);
// 0x0000011B System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_mEDF427A8C78A9AE6C0F91AD82FC0BC92E127C728 (void);
// 0x0000011C System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::set_imageLibrary(UnityEngine.XR.ARSubsystems.RuntimeReferenceImageLibrary)
extern void ARCoreProvider_set_imageLibrary_m5E48BF05853F210F48F84F820AE48C4B02A63633 (void);
// 0x0000011D UnityEngine.XR.ARSubsystems.RuntimeReferenceImageLibrary UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::CreateRuntimeLibrary(UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary)
extern void ARCoreProvider_CreateRuntimeLibrary_m578F5264A70564E1A0B21D060F40CEA4C15657B7 (void);
// 0x0000011E UnityEngine.XR.ARSubsystems.TrackableChanges`1<UnityEngine.XR.ARSubsystems.XRTrackedImage> UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::GetChanges(UnityEngine.XR.ARSubsystems.XRTrackedImage,Unity.Collections.Allocator)
extern void ARCoreProvider_GetChanges_mBD6B8435337693F22D58AC045B036DB668985F37 (void);
// 0x0000011F System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_m3CAE3DD73B251AADAAA18E255A50D979BDD4574E (void);
// 0x00000120 System.Int32 UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::get_requestedMaxNumberOfMovingImages()
extern void ARCoreProvider_get_requestedMaxNumberOfMovingImages_m9136442725D06CDB5469F07BAF880A163B70266B (void);
// 0x00000121 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::set_requestedMaxNumberOfMovingImages(System.Int32)
extern void ARCoreProvider_set_requestedMaxNumberOfMovingImages_m75E4CAEB39E571F7F50F0D77AAF134DC8466912C (void);
// 0x00000122 System.Int32 UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::get_currentMaxNumberOfMovingImages()
extern void ARCoreProvider_get_currentMaxNumberOfMovingImages_m40F817E6DB85D560F08C853FA45E9B15AE4D8E90 (void);
// 0x00000123 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::UnityARCore_imageTracking_setDatabase(System.IntPtr)
extern void ARCoreProvider_UnityARCore_imageTracking_setDatabase_m36BC5D81616450BA54F49F948EDAAA8B85A32F99 (void);
// 0x00000124 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::UnityARCore_imageTracking_destroy()
extern void ARCoreProvider_UnityARCore_imageTracking_destroy_mA72B87FC060A88E0AFC3D5F102282C225B07E097 (void);
// 0x00000125 System.Void* UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::UnityARCore_imageTracking_acquireChanges(System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Int32&)
extern void ARCoreProvider_UnityARCore_imageTracking_acquireChanges_m31E4F3E57692882A54F769D2E0FB9B0FCEAE68E8 (void);
// 0x00000126 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::UnityARCore_imageTracking_releaseChanges(System.Void*)
extern void ARCoreProvider_UnityARCore_imageTracking_releaseChanges_m46F194D4DD7AAA080EC24E4611C0CC31F5D7AA61 (void);
// 0x00000127 System.Int32 UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::GetNumberOfTrackedImages()
extern void ARCoreProvider_GetNumberOfTrackedImages_mCA15E49A92B4C043D053612CA27041AC0E229501 (void);
// 0x00000128 System.Void UnityEngine.XR.ARCore.ARCoreImageTrackingSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_m6D2C8A015DB244077C5C82EA873B7AEE23DC926C (void);
// 0x00000129 UnityEngine.XR.ARSubsystems.XRSessionSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_sessionSubsystem()
extern void ARCoreLoader_get_sessionSubsystem_mB719854EF11ED7529B060881E078347967098818 (void);
// 0x0000012A UnityEngine.XR.ARSubsystems.XRCameraSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_cameraSubsystem()
extern void ARCoreLoader_get_cameraSubsystem_mA7423C7021CC4D3D47589BB1374C8C3D2FFAFC5F (void);
// 0x0000012B UnityEngine.XR.ARSubsystems.XRDepthSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_depthSubsystem()
extern void ARCoreLoader_get_depthSubsystem_m3ED669F0F0517001E746FC4E4CC5E1B5816DD9CD (void);
// 0x0000012C UnityEngine.XR.ARSubsystems.XRPlaneSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_planeSubsystem()
extern void ARCoreLoader_get_planeSubsystem_m795EB938590D1B0D3ACF396C6EF51CCE279D311A (void);
// 0x0000012D UnityEngine.XR.ARSubsystems.XRAnchorSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_anchorSubsystem()
extern void ARCoreLoader_get_anchorSubsystem_mC42CCAA64AA29DB7E7AC0D76B6D3979935807A31 (void);
// 0x0000012E UnityEngine.XR.ARSubsystems.XRRaycastSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_raycastSubsystem()
extern void ARCoreLoader_get_raycastSubsystem_m908C2D2156F387879196FA0ADF530EB02366F6BF (void);
// 0x0000012F UnityEngine.XR.ARSubsystems.XRImageTrackingSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_imageTrackingSubsystem()
extern void ARCoreLoader_get_imageTrackingSubsystem_m3DBC8FB6CAEF6D6BEFC56115C1611BB515647190 (void);
// 0x00000130 UnityEngine.XR.XRInputSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_inputSubsystem()
extern void ARCoreLoader_get_inputSubsystem_mC96B3C65EF908BE1E4B5CC5F3F9C27631C314242 (void);
// 0x00000131 UnityEngine.XR.ARSubsystems.XRFaceSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_faceSubsystem()
extern void ARCoreLoader_get_faceSubsystem_mBE92A8D0FA340647A4BBED7D37EE3E753A4022D5 (void);
// 0x00000132 UnityEngine.XR.ARSubsystems.XREnvironmentProbeSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_environmentProbeSubsystem()
extern void ARCoreLoader_get_environmentProbeSubsystem_m3BF82CA0654C4963BAB3C41DC8CD3CE488C7135E (void);
// 0x00000133 UnityEngine.XR.ARSubsystems.XROcclusionSubsystem UnityEngine.XR.ARCore.ARCoreLoader::get_occlusionSubsystem()
extern void ARCoreLoader_get_occlusionSubsystem_m20523A3C486A422505823C97EABC56AF165358F0 (void);
// 0x00000134 System.Boolean UnityEngine.XR.ARCore.ARCoreLoader::Initialize()
extern void ARCoreLoader_Initialize_m7958140B0AD77F780834F1CB4CE76468A1A4EB1F (void);
// 0x00000135 System.Boolean UnityEngine.XR.ARCore.ARCoreLoader::Start()
extern void ARCoreLoader_Start_mC2E2B5ED50FD4747F02545B18115DDC30DA4F924 (void);
// 0x00000136 System.Boolean UnityEngine.XR.ARCore.ARCoreLoader::Stop()
extern void ARCoreLoader_Stop_mF234BEB25E607B591CADD9C0AAF511F5F162C9DD (void);
// 0x00000137 System.Boolean UnityEngine.XR.ARCore.ARCoreLoader::Deinitialize()
extern void ARCoreLoader_Deinitialize_m34E45DD93616D53D953992DB28C1C379CE69DEAF (void);
// 0x00000138 System.Void UnityEngine.XR.ARCore.ARCoreLoader::.ctor()
extern void ARCoreLoader__ctor_mA1E8D67717DEB72A3CEEEF54E8F360B2EAAAF1AF (void);
// 0x00000139 System.Void UnityEngine.XR.ARCore.ARCoreLoader::.cctor()
extern void ARCoreLoader__cctor_m8EEC8C4AB4C66FF792C43DDCFBC1F952A6EBF837 (void);
// 0x0000013A System.Void UnityEngine.XR.ARCore.ARCoreLoaderSettings::.ctor()
extern void ARCoreLoaderSettings__ctor_mBBD3002FC45E720F566E60290D60C3C332739AC9 (void);
// 0x0000013B System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem::Register()
extern void ARCoreOcclusionSubsystem_Register_m0BA27DC58FB4D824542DEEB092541C535ABF06C4 (void);
// 0x0000013C System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem::.ctor()
extern void ARCoreOcclusionSubsystem__ctor_m16B5A395AC5676532E8AEBF4360F919348883755 (void);
// 0x0000013D System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_m740EFF84FFF6B9B2C7C4FD5F28A95A78568D2AE7 (void);
// 0x0000013E System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_m75EEF8FA8584F7501A752662804FB39A888552D7 (void);
// 0x0000013F System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_m748C215A4A853B42DFC52A223F826A9DD7E638F2 (void);
// 0x00000140 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_m1FB0B254074AF688C79F6CBC4F313AF374003F47 (void);
// 0x00000141 UnityEngine.XR.ARSubsystems.EnvironmentDepthMode UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::get_requestedEnvironmentDepthMode()
extern void ARCoreProvider_get_requestedEnvironmentDepthMode_m7285AE1918DD6EF69250D54747E7620CA6FA9166 (void);
// 0x00000142 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::set_requestedEnvironmentDepthMode(UnityEngine.XR.ARSubsystems.EnvironmentDepthMode)
extern void ARCoreProvider_set_requestedEnvironmentDepthMode_m4284137A5F92528C355BB811D43624F722EE3CD3 (void);
// 0x00000143 UnityEngine.XR.ARSubsystems.EnvironmentDepthMode UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::get_currentEnvironmentDepthMode()
extern void ARCoreProvider_get_currentEnvironmentDepthMode_m13ECB4DF298101AD41CCF0A5EF8F465B029F8B61 (void);
// 0x00000144 System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::get_environmentDepthTemporalSmoothingEnabled()
extern void ARCoreProvider_get_environmentDepthTemporalSmoothingEnabled_m0AAA4E5B48A1217AEC938D2E6F51982382737322 (void);
// 0x00000145 System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::get_environmentDepthTemporalSmoothingRequested()
extern void ARCoreProvider_get_environmentDepthTemporalSmoothingRequested_m7BE8092F27B40CE259C447BDFA11D3B031EA0645 (void);
// 0x00000146 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::set_environmentDepthTemporalSmoothingRequested(System.Boolean)
extern void ARCoreProvider_set_environmentDepthTemporalSmoothingRequested_m35D777A806EBC1F3380775E872707026BF49016F (void);
// 0x00000147 System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::TryGetEnvironmentDepth(UnityEngine.XR.ARSubsystems.XRTextureDescriptor&)
extern void ARCoreProvider_TryGetEnvironmentDepth_m78238FE8CD7D4AAE21D15E288563FFFA94E50890 (void);
// 0x00000148 System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::TryAcquireEnvironmentDepthCpuImage(UnityEngine.XR.ARSubsystems.XRCpuImage/Cinfo&)
extern void ARCoreProvider_TryAcquireEnvironmentDepthCpuImage_m425D9F8AE24B409C5BDF7E959B30245A9336AE23 (void);
// 0x00000149 System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::TryAcquireRawEnvironmentDepthCpuImage(UnityEngine.XR.ARSubsystems.XRCpuImage/Cinfo&)
extern void ARCoreProvider_TryAcquireRawEnvironmentDepthCpuImage_m438FEF338186F8B8D9CF5587B30318168D3C7407 (void);
// 0x0000014A System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::TryAcquireSmoothedEnvironmentDepthCpuImage(UnityEngine.XR.ARSubsystems.XRCpuImage/Cinfo&)
extern void ARCoreProvider_TryAcquireSmoothedEnvironmentDepthCpuImage_m90DF281C8FBC87903E3BA776A46F3B6F0F11C22F (void);
// 0x0000014B UnityEngine.XR.ARSubsystems.XRCpuImage/Api UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::get_environmentDepthCpuImageApi()
extern void ARCoreProvider_get_environmentDepthCpuImageApi_m61FB1F4AE16ABCA3AA8A07DCCBB149603E7137B7 (void);
// 0x0000014C System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::TryGetEnvironmentDepthConfidence(UnityEngine.XR.ARSubsystems.XRTextureDescriptor&)
extern void ARCoreProvider_TryGetEnvironmentDepthConfidence_m944FA850E27746FE2B692979C35BC4EB1C3B21BC (void);
// 0x0000014D System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::TryAcquireEnvironmentDepthConfidenceCpuImage(UnityEngine.XR.ARSubsystems.XRCpuImage/Cinfo&)
extern void ARCoreProvider_TryAcquireEnvironmentDepthConfidenceCpuImage_mB3A215787E01AF6E90DE3E35D23A3E5EFA627F83 (void);
// 0x0000014E UnityEngine.XR.ARSubsystems.XRCpuImage/Api UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::get_environmentDepthConfidenceCpuImageApi()
extern void ARCoreProvider_get_environmentDepthConfidenceCpuImageApi_mA3E737368FBC38050E3620505E826949899B1F36 (void);
// 0x0000014F Unity.Collections.NativeArray`1<UnityEngine.XR.ARSubsystems.XRTextureDescriptor> UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::GetTextureDescriptors(UnityEngine.XR.ARSubsystems.XRTextureDescriptor,Unity.Collections.Allocator)
extern void ARCoreProvider_GetTextureDescriptors_m93940B7502A6A2E218259EF3B26C2ABEA5114070 (void);
// 0x00000150 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::GetMaterialKeywords(System.Collections.Generic.List`1<System.String>&,System.Collections.Generic.List`1<System.String>&)
extern void ARCoreProvider_GetMaterialKeywords_m830087C8188384A42E71AAA5B2B09C97BCA5D73A (void);
// 0x00000151 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/ARCoreProvider::.cctor()
extern void ARCoreProvider__cctor_mED1B1180C2800E7B16CDC99112FD708B25CF6D54 (void);
// 0x00000152 UnityEngine.XR.ARSubsystems.Supported UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_DoesSupportEnvironmentDepth()
extern void NativeApi_UnityARCore_OcclusionProvider_DoesSupportEnvironmentDepth_m50EAA4F6C8B907A90583D95576268969BED53838 (void);
// 0x00000153 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_Construct(System.Int32,System.Boolean)
extern void NativeApi_UnityARCore_OcclusionProvider_Construct_m8FCDBA2D3F3EB61E04C220AF2AC50FDF54283292 (void);
// 0x00000154 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_Start()
extern void NativeApi_UnityARCore_OcclusionProvider_Start_m56923FBD75E7E7C68AEFD78EC09AF6F09DBE15D0 (void);
// 0x00000155 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_Stop()
extern void NativeApi_UnityARCore_OcclusionProvider_Stop_mF642AEFCEEE2A62323C9F73C07C4888F776F9697 (void);
// 0x00000156 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_Destruct()
extern void NativeApi_UnityARCore_OcclusionProvider_Destruct_m1D048734A723C4CE7D6CE91EC70C178A38B163E7 (void);
// 0x00000157 UnityEngine.XR.ARSubsystems.EnvironmentDepthMode UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_GetRequestedEnvironmentDepthMode()
extern void NativeApi_UnityARCore_OcclusionProvider_GetRequestedEnvironmentDepthMode_m1ED900D8AD45D1472042A171C12D38BB297D4DF6 (void);
// 0x00000158 System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_SetRequestedEnvironmentDepthMode(UnityEngine.XR.ARSubsystems.EnvironmentDepthMode)
extern void NativeApi_UnityARCore_OcclusionProvider_SetRequestedEnvironmentDepthMode_mA766ADC677847B1BEF1DCBB1C915E672A3AF0976 (void);
// 0x00000159 UnityEngine.XR.ARSubsystems.EnvironmentDepthMode UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_GetCurrentEnvironmentDepthMode()
extern void NativeApi_UnityARCore_OcclusionProvider_GetCurrentEnvironmentDepthMode_m396A1E71F487E2CB7E726BDBCA9DB5F6F2FEA5C8 (void);
// 0x0000015A System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_TryGetEnvironmentDepth(UnityEngine.XR.ARSubsystems.XRTextureDescriptor&)
extern void NativeApi_UnityARCore_OcclusionProvider_TryGetEnvironmentDepth_m4E7B3BB56CEFAAF46BE4E970ECB4289AAB133874 (void);
// 0x0000015B System.Void* UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_AcquireTextureDescriptors(System.Int32&,System.Int32&)
extern void NativeApi_UnityARCore_OcclusionProvider_AcquireTextureDescriptors_m03EC98586480BD0563208632F69F86290FE70E03 (void);
// 0x0000015C System.Void UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_ReleaseTextureDescriptors(System.Void*)
extern void NativeApi_UnityARCore_OcclusionProvider_ReleaseTextureDescriptors_mF948E01FE0E4B0A2FF5D0AD23B03A125949C4E60 (void);
// 0x0000015D System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_IsEnvironmentDepthEnabled()
extern void NativeApi_UnityARCore_OcclusionProvider_IsEnvironmentDepthEnabled_m998A83A2409FEAA5E5342FB03A536B80B4A8BF46 (void);
// 0x0000015E System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_GetEnvironmentDepthTemporalSmoothingEnabled()
extern void NativeApi_UnityARCore_OcclusionProvider_GetEnvironmentDepthTemporalSmoothingEnabled_m20341EE9585DB0AAFCB9BF9B03F099BBD8F1F8DB (void);
// 0x0000015F System.Boolean UnityEngine.XR.ARCore.ARCoreOcclusionSubsystem/NativeApi::UnityARCore_OcclusionProvider_TryGetEnvironmentDepthConfidence(UnityEngine.XR.ARSubsystems.XRTextureDescriptor&)
extern void NativeApi_UnityARCore_OcclusionProvider_TryGetEnvironmentDepthConfidence_mB7F68F009E707CF7080BB5FAE70252D3256FF94A (void);
// 0x00000160 System.Boolean UnityEngine.XR.ARCore.ARCorePermissionManager::IsPermissionGranted(System.String)
extern void ARCorePermissionManager_IsPermissionGranted_m25B8E28D19B5C41A1EBC6BE59883F2B16D1BABA1 (void);
// 0x00000161 System.Void UnityEngine.XR.ARCore.ARCorePermissionManager::RequestPermission(System.String,System.Action`2<System.String,System.Boolean>)
extern void ARCorePermissionManager_RequestPermission_mB489AC1E1323A7943E7E353159373107C5746A48 (void);
// 0x00000162 System.Void UnityEngine.XR.ARCore.ARCorePermissionManager::OnPermissionGranted(System.String)
extern void ARCorePermissionManager_OnPermissionGranted_m6F977C06DFFDA17DB3D82BDD28EBA57ADAE68FD5 (void);
// 0x00000163 System.Void UnityEngine.XR.ARCore.ARCorePermissionManager::OnPermissionDenied(System.String)
extern void ARCorePermissionManager_OnPermissionDenied_m84D8B52092834DE931A3D6F8C0AE7F56FAA75091 (void);
// 0x00000164 System.Void UnityEngine.XR.ARCore.ARCorePermissionManager::OnActivityResult()
extern void ARCorePermissionManager_OnActivityResult_m7FBB087DEC75D2315A9D06FA5D4A5C238096BB2B (void);
// 0x00000165 System.Void UnityEngine.XR.ARCore.ARCorePermissionManager::.ctor()
extern void ARCorePermissionManager__ctor_m995B52F67EB43FB3BBDC858DFDA0C6FD5D1293AC (void);
// 0x00000166 UnityEngine.XR.ARCore.ARCorePermissionManager UnityEngine.XR.ARCore.ARCorePermissionManager::get_instance()
extern void ARCorePermissionManager_get_instance_m4D7BE6B8462B41D65B58AB757C37962AFFB02E2F (void);
// 0x00000167 UnityEngine.AndroidJavaObject UnityEngine.XR.ARCore.ARCorePermissionManager::get_activity()
extern void ARCorePermissionManager_get_activity_m90003FAD75C18019B97172A412136B4CB87D6BFC (void);
// 0x00000168 UnityEngine.AndroidJavaObject UnityEngine.XR.ARCore.ARCorePermissionManager::get_permissionsService()
extern void ARCorePermissionManager_get_permissionsService_mF404525CE335D896696FB973195D84558CADE4EC (void);
// 0x00000169 System.Void UnityEngine.XR.ARCore.ARCorePermissionManager::.cctor()
extern void ARCorePermissionManager__cctor_m8EDF11C1CB83D6B33640F8DDA06C48726E331CF6 (void);
// 0x0000016A System.Void UnityEngine.XR.ARCore.ARCorePlaneProvider::.ctor()
extern void ARCorePlaneProvider__ctor_m5F934EED6F89578541F5E9C0586DC2902B2A41FB (void);
// 0x0000016B System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem::RegisterDescriptor()
extern void ARCorePlaneSubsystem_RegisterDescriptor_m58E0D2BBAC2CE029CED4643F99F0F387A552C0DE (void);
// 0x0000016C System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem::.ctor()
extern void ARCorePlaneSubsystem__ctor_m1F0CD932244651913C931C181530A3FC960B65D7 (void);
// 0x0000016D System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_m7595EF6D1E7A0E2C7D6ADC620BDA5FDB21320E8E (void);
// 0x0000016E System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_mA8989B03BBF873DA74AD51D17C3E7AA0A5A8C5EF (void);
// 0x0000016F System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::GetBoundary(UnityEngine.XR.ARSubsystems.TrackableId,Unity.Collections.Allocator,Unity.Collections.NativeArray`1<UnityEngine.Vector2>&)
extern void ARCoreProvider_GetBoundary_m8ED3BC09C3970185A93CEB06B1B2A63868CC7588 (void);
// 0x00000170 UnityEngine.XR.ARSubsystems.TrackableChanges`1<UnityEngine.XR.ARSubsystems.BoundedPlane> UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::GetChanges(UnityEngine.XR.ARSubsystems.BoundedPlane,Unity.Collections.Allocator)
extern void ARCoreProvider_GetChanges_mD605EB86F5978B7A8B2DC635138BA1ABB95634EF (void);
// 0x00000171 System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_m89EE9E1820BAD6DFDD0F87BCE4515DDAB3E89E57 (void);
// 0x00000172 UnityEngine.XR.ARSubsystems.PlaneDetectionMode UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::get_requestedPlaneDetectionMode()
extern void ARCoreProvider_get_requestedPlaneDetectionMode_m39697C78C2C6A8644CC860B4D94C4C68B647B19F (void);
// 0x00000173 System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::set_requestedPlaneDetectionMode(UnityEngine.XR.ARSubsystems.PlaneDetectionMode)
extern void ARCoreProvider_set_requestedPlaneDetectionMode_mF523936701717C8EC4B55E19024933A549A535D3 (void);
// 0x00000174 UnityEngine.XR.ARSubsystems.PlaneDetectionMode UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::get_currentPlaneDetectionMode()
extern void ARCoreProvider_get_currentPlaneDetectionMode_m2C19714D6760548615A29FC3D3945A008EC1A973 (void);
// 0x00000175 System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::UnityARCore_planeTracking_startTracking()
extern void ARCoreProvider_UnityARCore_planeTracking_startTracking_m43961D18BB4347A1DA73255350AE019047C3F47A (void);
// 0x00000176 System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::UnityARCore_planeTracking_stopTracking()
extern void ARCoreProvider_UnityARCore_planeTracking_stopTracking_m2A2C678E6066850CF7897AD926083D3A9CFBCA36 (void);
// 0x00000177 System.Void* UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::UnityARCore_planeTracking_acquireChanges(System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Int32&)
extern void ARCoreProvider_UnityARCore_planeTracking_acquireChanges_mF1CC91EAF5C0A4DC0560D014FA79A3F2F1974DFE (void);
// 0x00000178 System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::UnityARCore_planeTracking_releaseChanges(System.Void*)
extern void ARCoreProvider_UnityARCore_planeTracking_releaseChanges_m78BA280D5131A19A845AC7987D0DE017EEC4F9BA (void);
// 0x00000179 UnityEngine.XR.ARSubsystems.PlaneDetectionMode UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::GetRequestedPlaneDetectionMode()
extern void ARCoreProvider_GetRequestedPlaneDetectionMode_m24A46AE0238BCC7978880D9C2FB272F7B022E752 (void);
// 0x0000017A System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::SetRequestedPlaneDetectionMode(UnityEngine.XR.ARSubsystems.PlaneDetectionMode)
extern void ARCoreProvider_SetRequestedPlaneDetectionMode_m55D6003C240EFCC1E7B46E98E1A2EBA410B42B85 (void);
// 0x0000017B UnityEngine.XR.ARSubsystems.PlaneDetectionMode UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::GetCurrentPlaneDetectionMode()
extern void ARCoreProvider_GetCurrentPlaneDetectionMode_m8E5F857E7A295412B449A6AC48AD2F2A78CEA782 (void);
// 0x0000017C System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::UnityARCore_planeTracking_destroy()
extern void ARCoreProvider_UnityARCore_planeTracking_destroy_m122DD7EA315470EA8349426FB84083D464988B67 (void);
// 0x0000017D System.Void* UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::UnityARCore_planeTracking_acquireBoundary(UnityEngine.XR.ARSubsystems.TrackableId,System.Int32&)
extern void ARCoreProvider_UnityARCore_planeTracking_acquireBoundary_m97E1FECBEA8912A125081A810B56A987AF520469 (void);
// 0x0000017E System.Boolean UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::UnityARCore_planeTracking_tryCopyBoundary(System.Void*,System.Void*)
extern void ARCoreProvider_UnityARCore_planeTracking_tryCopyBoundary_m14B963060CC277350127E15999245256447E30A9 (void);
// 0x0000017F System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_mCBE59A924070B5444C25F0DDBE7F1D05E118EAA2 (void);
// 0x00000180 System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider/FlipBoundaryWindingJob::Execute()
extern void FlipBoundaryWindingJob_Execute_m1A3A43413FBCA81A1ABDC145DC35AA533E86BC9D (void);
// 0x00000181 System.Void UnityEngine.XR.ARCore.ARCorePlaneSubsystem/ARCoreProvider/FlipBoundaryHandednessJob::Execute(System.Int32)
extern void FlipBoundaryHandednessJob_Execute_mBDA83F26E0D4DE330FB14E62DDFB7A52219B8CA9 (void);
// 0x00000182 System.Void UnityEngine.XR.ARCore.ARCorePromise`1::OnKeepWaiting()
// 0x00000183 System.Void UnityEngine.XR.ARCore.ARCorePromise`1::Resolve(T)
// 0x00000184 System.Void UnityEngine.XR.ARCore.ARCorePromise`1::.ctor()
// 0x00000185 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem::RegisterDescriptor()
extern void ARCoreRaycastSubsystem_RegisterDescriptor_mDD54FF0A77EC2A3DC0D6C2FE4A9B4CD236E6CEDF (void);
// 0x00000186 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem::.ctor()
extern void ARCoreRaycastSubsystem__ctor_mC3D3E27326C788CF7404644A8041D2BCB6FFF2ED (void);
// 0x00000187 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_m2C3CFF618C62BC4DB9A1DAB8A23B0407E0E1FE88 (void);
// 0x00000188 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_m6DE4D49F0BD5C936116DCDD2371700266568E58F (void);
// 0x00000189 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_m3FDF8D419C9B3A7BBBE1ABA88A4588DCCB2C372B (void);
// 0x0000018A UnityEngine.XR.ARSubsystems.TrackableChanges`1<UnityEngine.XR.ARSubsystems.XRRaycast> UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::GetChanges(UnityEngine.XR.ARSubsystems.XRRaycast,Unity.Collections.Allocator)
extern void ARCoreProvider_GetChanges_m629D4E64616243D68CA87318EC5346E4122FED72 (void);
// 0x0000018B System.Boolean UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::TryAddRaycast(UnityEngine.Vector2,System.Single,UnityEngine.XR.ARSubsystems.XRRaycast&)
extern void ARCoreProvider_TryAddRaycast_m30632AD57E0DAD3CE858EAB81353D8FE151F4541 (void);
// 0x0000018C System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::RemoveRaycast(UnityEngine.XR.ARSubsystems.TrackableId)
extern void ARCoreProvider_RemoveRaycast_m8A81C2C1BAEFEA1EF19764853ABC215D5C67F866 (void);
// 0x0000018D Unity.Collections.NativeArray`1<UnityEngine.XR.ARSubsystems.XRRaycastHit> UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::Raycast(UnityEngine.XR.ARSubsystems.XRRaycastHit,UnityEngine.Ray,UnityEngine.XR.ARSubsystems.TrackableType,Unity.Collections.Allocator)
extern void ARCoreProvider_Raycast_mEEE649E1F6280D29A8623F617D87E406E5C86509 (void);
// 0x0000018E Unity.Collections.NativeArray`1<UnityEngine.XR.ARSubsystems.XRRaycastHit> UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::Raycast(UnityEngine.XR.ARSubsystems.XRRaycastHit,UnityEngine.Vector2,UnityEngine.XR.ARSubsystems.TrackableType,Unity.Collections.Allocator)
extern void ARCoreProvider_Raycast_mBF08914AA765BA9C84A022D8E0F04A8B3DCAB105 (void);
// 0x0000018F System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_acquireHitResults(UnityEngine.Vector2,UnityEngine.XR.ARSubsystems.TrackableType,System.Void*&,System.Int32&,System.Int32&)
extern void ARCoreProvider_UnityARCore_raycast_acquireHitResults_mC8535E0A7DDD2EECA1E6E43A4F2413FD3792E93C (void);
// 0x00000190 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_acquireHitResultsRay(UnityEngine.Vector3,UnityEngine.Vector3,UnityEngine.XR.ARSubsystems.TrackableType,System.Void*&,System.Int32&,System.Int32&)
extern void ARCoreProvider_UnityARCore_raycast_acquireHitResultsRay_m2843461933333E37442B0AC815AD2EB66DC72158 (void);
// 0x00000191 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_releaseHitResults(System.Void*)
extern void ARCoreProvider_UnityARCore_raycast_releaseHitResults_m29B6961D52EE0B40FF2618698F7A20F6D8A3E807 (void);
// 0x00000192 System.Boolean UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_tryAddRaycast(UnityEngine.Vector2,System.Single,UnityEngine.XR.ARSubsystems.XRRaycast&)
extern void ARCoreProvider_UnityARCore_raycast_tryAddRaycast_m1DC1F4DD474422F9072C758DAF5C193CD25556C8 (void);
// 0x00000193 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_removeRaycast(UnityEngine.XR.ARSubsystems.TrackableId)
extern void ARCoreProvider_UnityARCore_raycast_removeRaycast_mDD035162FABEF90686EF988CB7E91FAD667A58B9 (void);
// 0x00000194 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_startTracking()
extern void ARCoreProvider_UnityARCore_raycast_startTracking_m50F8B4931725DDD8C114688E653F2D65315D4B4A (void);
// 0x00000195 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_stopTracking()
extern void ARCoreProvider_UnityARCore_raycast_stopTracking_mFFC1AE64E4A37D0EF5C5206D454339861B32D0B2 (void);
// 0x00000196 System.Void* UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_acquireChanges(System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Int32&)
extern void ARCoreProvider_UnityARCore_raycast_acquireChanges_m7DBBA926EEDE6FC01400E90E3EA3AE673F57A2CB (void);
// 0x00000197 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_releaseChanges(System.Void*)
extern void ARCoreProvider_UnityARCore_raycast_releaseChanges_mC9360EB666186079E87C70C36AFFC07EF69BDEF3 (void);
// 0x00000198 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::UnityARCore_raycast_destroy()
extern void ARCoreProvider_UnityARCore_raycast_destroy_m05A5F0011882F8D5E90876A5C0BEA1D6D0AEC22A (void);
// 0x00000199 System.Void UnityEngine.XR.ARCore.ARCoreRaycastSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_mCEED9DE66DCD9BB6AB1F30F80AD6044DF568C209 (void);
// 0x0000019A System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem::OnCreate()
extern void ARCoreSessionSubsystem_OnCreate_mF8F1CEBDBBA6C5EB2DE36E7DF3FC114415BB4536 (void);
// 0x0000019B System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem::ConfigurationChangedFromProvider(UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs)
extern void ARCoreSessionSubsystem_ConfigurationChangedFromProvider_mCDCA9342D2919733A299E64B3DBF4F908C048722 (void);
// 0x0000019C System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem::SetConfigurationDirty()
extern void ARCoreSessionSubsystem_SetConfigurationDirty_m589BAB1CB66E9C17CFEF26FADC620AC122AAFA10 (void);
// 0x0000019D UnityEngine.XR.ARCore.ArSession UnityEngine.XR.ARCore.ARCoreSessionSubsystem::get_session()
extern void ARCoreSessionSubsystem_get_session_m30DEF5F507F37ADBA33992040DF96C29A035DE20 (void);
// 0x0000019E UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem::StartRecording(UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ARCoreSessionSubsystem_StartRecording_m5FEAD096A36F54B317747AC4C7CDFCEED5D73930 (void);
// 0x0000019F UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem::StopRecording()
extern void ARCoreSessionSubsystem_StopRecording_m80EBB7C1996C30ACBCF2AD953FA340F2CCC9D00A (void);
// 0x000001A0 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem::StartPlayback(System.String)
extern void ARCoreSessionSubsystem_StartPlayback_mAD4B827E1C37E2BDC536D93A624A8CA4DFA1FBBE (void);
// 0x000001A1 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem::StopPlayback()
extern void ARCoreSessionSubsystem_StopPlayback_mB7CCEABF538062686665646E7CD89AA6DAAADD63 (void);
// 0x000001A2 UnityEngine.XR.ARCore.ArRecordingStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem::get_recordingStatus()
extern void ARCoreSessionSubsystem_get_recordingStatus_m407E01258C262F5FF877D8E4BCB52C97AF3431D9 (void);
// 0x000001A3 UnityEngine.XR.ARCore.ArPlaybackStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem::get_playbackStatus()
extern void ARCoreSessionSubsystem_get_playbackStatus_mB849FC26DC9496B81C9B3FEE9BE3352AFD2AA9C7 (void);
// 0x000001A4 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem::add_beforeSetConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs>)
extern void ARCoreSessionSubsystem_add_beforeSetConfiguration_mA1649A6E88E8D431B34DC24E6E8C171D8F957B6A (void);
// 0x000001A5 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem::remove_beforeSetConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs>)
extern void ARCoreSessionSubsystem_remove_beforeSetConfiguration_m21286B32C3760C722A3820C34A5F202C6CD67F16 (void);
// 0x000001A6 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem::RegisterDescriptor()
extern void ARCoreSessionSubsystem_RegisterDescriptor_m337F5E521FF309C976A81D092E59A77B64CD6201 (void);
// 0x000001A7 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem::.ctor()
extern void ARCoreSessionSubsystem__ctor_m5B001429D8D5F84602D8D9B80B1CF759BA0E108E (void);
// 0x000001A8 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::SetPlaybackDataset(System.String)
extern void ARCoreProvider_SetPlaybackDataset_mA5007E7F4190891CBCD26808D1C384940F65D111 (void);
// 0x000001A9 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_m4ED89ECF6C019BEEED85579209B5949941D4829D (void);
// 0x000001AA System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_mEE70994E30DE0D74573DC0B4581D478EEF5214CB (void);
// 0x000001AB System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_m6289CF316BA0BECFC520FFAC102ED245BD242711 (void);
// 0x000001AC System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::Update(UnityEngine.XR.ARSubsystems.XRSessionUpdateParams,UnityEngine.XR.ARSubsystems.Configuration)
extern void ARCoreProvider_Update_m1DD2D8BEB10DDDBE586ADF2833C7E31AE18776CB (void);
// 0x000001AD UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::StartRecording(UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ARCoreProvider_StartRecording_m2083E756A5F0C25B984A2D457DCC71790A190D26 (void);
// 0x000001AE UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::StopRecording()
extern void ARCoreProvider_StopRecording_m7C7E4B579AA98397137BCC25C8B4F69A88AEE115 (void);
// 0x000001AF UnityEngine.XR.ARCore.ArRecordingStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_recordingStatus()
extern void ARCoreProvider_get_recordingStatus_mFDA170E040FD1AAFBCC0BB35A52E23030A0A7D76 (void);
// 0x000001B0 UnityEngine.XR.ARCore.ArPlaybackStatus UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_playbackStatus()
extern void ARCoreProvider_get_playbackStatus_mB42156FBF5149C57277A8D5EA77D414328411B4A (void);
// 0x000001B1 UnityEngine.XR.ARCore.ArSession UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_session()
extern void ARCoreProvider_get_session_m2FF87072719F576B2C36DF66A1AAA185E493646C (void);
// 0x000001B2 Unity.Collections.NativeArray`1<UnityEngine.XR.ARSubsystems.ConfigurationDescriptor> UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::GetConfigurationDescriptors(Unity.Collections.Allocator)
extern void ARCoreProvider_GetConfigurationDescriptors_m4738ABEFDAB96DFFA917C9DD12113E29A2D955E2 (void);
// 0x000001B3 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::add_beforeSetConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs>)
extern void ARCoreProvider_add_beforeSetConfiguration_m7782F6ED649007DE9D8526072F90B03335EE5E24 (void);
// 0x000001B4 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::remove_beforeSetConfiguration(System.Action`1<UnityEngine.XR.ARCore.ARCoreBeforeSetConfigurationEventArgs>)
extern void ARCoreProvider_remove_beforeSetConfiguration_m31C541FCAAC258A6529E5D1F67633C7D0C241840 (void);
// 0x000001B5 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::SetConfigurationCallback(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArConfig,System.IntPtr)
extern void ARCoreProvider_SetConfigurationCallback_m21110C590C44E78936908B4D2198452803E2330B (void);
// 0x000001B6 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_mC45316C60AC9FB9BF1418DB042F2BB8FA09D44ED (void);
// 0x000001B7 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::Reset()
extern void ARCoreProvider_Reset_m4904D98C5694D128705E3B4FFB7B2806340A11AD (void);
// 0x000001B8 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::OnApplicationPause()
extern void ARCoreProvider_OnApplicationPause_m602CC93754E61B3EBBF3BE77BC1C6DFCE607E0B9 (void);
// 0x000001B9 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::OnApplicationResume()
extern void ARCoreProvider_OnApplicationResume_mC57FD74CC28674FD9F27CDFC89D48544101797CA (void);
// 0x000001BA UnityEngine.XR.ARSubsystems.Promise`1<UnityEngine.XR.ARSubsystems.SessionAvailability> UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::GetAvailabilityAsync()
extern void ARCoreProvider_GetAvailabilityAsync_m979FCD1FFFAFB2C5040E4BFE327677F3C80D6CBF (void);
// 0x000001BB UnityEngine.XR.ARSubsystems.Promise`1<UnityEngine.XR.ARSubsystems.SessionInstallationStatus> UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::InstallAsync()
extern void ARCoreProvider_InstallAsync_m168BAF5F2DE9C10641C221D995E21AB9788CF181 (void);
// 0x000001BC System.IntPtr UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_nativePtr()
extern void ARCoreProvider_get_nativePtr_mF93BE814C215A6AFC2F61A7674370E8B48C58CD5 (void);
// 0x000001BD UnityEngine.XR.ARSubsystems.TrackingState UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_trackingState()
extern void ARCoreProvider_get_trackingState_mEC4ED0D514E183E746B13D33E18013F3C262380A (void);
// 0x000001BE UnityEngine.XR.ARSubsystems.NotTrackingReason UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_notTrackingReason()
extern void ARCoreProvider_get_notTrackingReason_mB7E41389B11F85EEFD09F70CD3C9547690E9B1DC (void);
// 0x000001BF UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_requestedFeatures()
extern void ARCoreProvider_get_requestedFeatures_m6FEF431FD8F404DFB3C4D123CE6F29FFD0ECF581 (void);
// 0x000001C0 UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_requestedTrackingMode()
extern void ARCoreProvider_get_requestedTrackingMode_m5A589D5586E0010B62CBDC7C1A2A904F53920E24 (void);
// 0x000001C1 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::set_requestedTrackingMode(UnityEngine.XR.ARSubsystems.Feature)
extern void ARCoreProvider_set_requestedTrackingMode_mE071EC7020FD5FE2DE9716583CDC0785B7C294D4 (void);
// 0x000001C2 UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_currentTrackingMode()
extern void ARCoreProvider_get_currentTrackingMode_m7787C51BDAEC4C0BECCF949E5167EA9CE2B167F2 (void);
// 0x000001C3 System.Boolean UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_matchFrameRateEnabled()
extern void ARCoreProvider_get_matchFrameRateEnabled_m69389E0BF3F0C505377DD41CFD76D6A1171A4336 (void);
// 0x000001C4 System.Boolean UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_matchFrameRateRequested()
extern void ARCoreProvider_get_matchFrameRateRequested_mFAA42AF98B9E52864A2580A4BA69A7F032AA8DD1 (void);
// 0x000001C5 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::set_matchFrameRateRequested(System.Boolean)
extern void ARCoreProvider_set_matchFrameRateRequested_m4E81D03C9640EC1026C30982C6F9E4D51A3F40F3 (void);
// 0x000001C6 System.Int32 UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::get_frameRate()
extern void ARCoreProvider_get_frameRate_mA33383747900A3E5A6303CD8B1369E59EE982D25 (void);
// 0x000001C7 UnityEngine.XR.ARSubsystems.Promise`1<T> UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::ExecuteAsync(System.Action`1<System.IntPtr>)
// 0x000001C8 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::OnApkInstallation(UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/ArPrestoApkInstallStatus,System.IntPtr)
extern void ARCoreProvider_OnApkInstallation_mE3B31805C325D8C7F0FC2BC00F8249A759AE5B98 (void);
// 0x000001C9 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::OnCheckApkAvailability(UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/ArAvailability,System.IntPtr)
extern void ARCoreProvider_OnCheckApkAvailability_m0C786C7B24238176AC42E8CEF62BA1D84EB9C1DB (void);
// 0x000001CA System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::CameraPermissionRequestProvider(UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionsResultCallbackDelegate,System.IntPtr)
extern void ARCoreProvider_CameraPermissionRequestProvider_m52520DB26683512123C6B56B7E2A28269DF7C310 (void);
// 0x000001CB System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::ResolvePromise(System.IntPtr,T)
// 0x000001CC System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::IssueRenderEventAndWaitForCompletion(UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/RenderEvent)
extern void ARCoreProvider_IssueRenderEventAndWaitForCompletion_mE8F32C2E68F7720D35BD8E2588D711F37DEDA45F (void);
// 0x000001CD System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::CreateTexture()
extern void ARCoreProvider_CreateTexture_m2276885716E7619E56DE079F26F3BCD9A8DB0F19 (void);
// 0x000001CE System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider::DeleteTexture()
extern void ARCoreProvider_DeleteTexture_mA1B6EF45277ED86092FA33651D3E71B757D2765E (void);
// 0x000001CF System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider/<>c::.cctor()
extern void U3CU3Ec__cctor_m4A13C36A2DF38460379152261D45F482872D0043 (void);
// 0x000001D0 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider/<>c::.ctor()
extern void U3CU3Ec__ctor_m3637F367C80968CD4BF62CC49619A5E47A405FF7 (void);
// 0x000001D1 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider/<>c::<GetAvailabilityAsync>b__24_0(System.IntPtr)
extern void U3CU3Ec_U3CGetAvailabilityAsyncU3Eb__24_0_m1C4FCBC446E6CE9AA042D2D5C302A7C55C73917C (void);
// 0x000001D2 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider/<>c::<InstallAsync>b__25_0(System.IntPtr)
extern void U3CU3Ec_U3CInstallAsyncU3Eb__25_0_m733F2E5B5EE87A2217388F6D03CE104E7EEFF2EA (void);
// 0x000001D3 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider/<>c__DisplayClass49_0::.ctor()
extern void U3CU3Ec__DisplayClass49_0__ctor_m117E39D5AB1AD3E8F62AAEBF1A7CBF5FD674C8B8 (void);
// 0x000001D4 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/ARCoreProvider/<>c__DisplayClass49_0::<CameraPermissionRequestProvider>b__0(System.String,System.Boolean)
extern void U3CU3Ec__DisplayClass49_0_U3CCameraPermissionRequestProviderU3Eb__0_m1552073AEBE7BE5A0FEEFC21A5474D71687EC66F (void);
// 0x000001D5 System.IntPtr UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_getNativePtr()
extern void NativeApi_UnityARCore_session_getNativePtr_m2CB6F0392DD51B4B60110824545C93B2831975D1 (void);
// 0x000001D6 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::ArPresto_checkApkAvailability(System.Action`2<UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/ArAvailability,System.IntPtr>,System.IntPtr)
extern void NativeApi_ArPresto_checkApkAvailability_mDFA94461C41E99996AD28EFD11AAFFBA0E0951D7 (void);
// 0x000001D7 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::ArPresto_requestApkInstallation(System.Boolean,System.Action`2<UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/ArPrestoApkInstallStatus,System.IntPtr>,System.IntPtr)
extern void NativeApi_ArPresto_requestApkInstallation_m991347A021A41EA22FFE857F078CDE9B9BF751FB (void);
// 0x000001D8 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_update(UnityEngine.ScreenOrientation,UnityEngine.Vector2Int,System.IntPtr,UnityEngine.XR.ARSubsystems.Feature)
extern void NativeApi_UnityARCore_session_update_m8151C99662460FB0FAA0F4634467DB5C2B619184 (void);
// 0x000001D9 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_getConfigurationDescriptors(System.IntPtr&,System.Int32&,System.Int32&)
extern void NativeApi_UnityARCore_session_getConfigurationDescriptors_m924A443FFEE770DE222C1271F790F2C53E2458D5 (void);
// 0x000001DA System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_construct(UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionRequestProviderDelegate)
extern void NativeApi_UnityARCore_session_construct_m171873253E4D8D8737F1FC498F0A3F67FF184AA4 (void);
// 0x000001DB System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_destroy()
extern void NativeApi_UnityARCore_session_destroy_mEB1AE84A44EBAE3F809AC34346EF2C9986080E08 (void);
// 0x000001DC System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_resume(System.Guid)
extern void NativeApi_UnityARCore_session_resume_mF228DF0E287D9412E143626EA26C67525FFC5598 (void);
// 0x000001DD System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_pause()
extern void NativeApi_UnityARCore_session_pause_m03EC1D9DFBD0BE7B520478B2B1033BEFEF153F54 (void);
// 0x000001DE System.Boolean UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::IsPauseDesired()
extern void NativeApi_IsPauseDesired_mF2CA79D0E3CB0CA7282253BCBAD325DEB8B84B03 (void);
// 0x000001DF System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_onApplicationResume()
extern void NativeApi_UnityARCore_session_onApplicationResume_mA4D68B2A905D8CBDC015A00B17F22E031F5E0A47 (void);
// 0x000001E0 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_onApplicationPause()
extern void NativeApi_UnityARCore_session_onApplicationPause_m205AB77E32CC550217C0BEDF287C1CCCA4211E46 (void);
// 0x000001E1 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_reset()
extern void NativeApi_UnityARCore_session_reset_m0CFFAA1EBF350276985E4F0A80A9C7C582E892D4 (void);
// 0x000001E2 UnityEngine.XR.ARSubsystems.TrackingState UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_getTrackingState()
extern void NativeApi_UnityARCore_session_getTrackingState_mB17780C17A2ED37B8F7F562E5E9CCF28E83D7527 (void);
// 0x000001E3 UnityEngine.XR.ARSubsystems.NotTrackingReason UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_getNotTrackingReason()
extern void NativeApi_UnityARCore_session_getNotTrackingReason_m97EE7E51F04581B4EF003AF85F3A33DF9206ECDB (void);
// 0x000001E4 System.IntPtr UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_getRenderEventFunc()
extern void NativeApi_UnityARCore_session_getRenderEventFunc_mDBE116665853086B011B7A80AABB6A25E277CDFF (void);
// 0x000001E5 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_setRenderEventPending()
extern void NativeApi_UnityARCore_session_setRenderEventPending_mB74C10E36898E8CDD252B17EFD72C6DA95D53524 (void);
// 0x000001E6 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_waitForRenderEvent()
extern void NativeApi_UnityARCore_session_waitForRenderEvent_mCF32BBACBCEEF3155CE400A9ACFE6C102B3C8A5A (void);
// 0x000001E7 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_createTextureMainThread()
extern void NativeApi_UnityARCore_session_createTextureMainThread_mE26921845FFC8894191CD8D20371C5A738377E9C (void);
// 0x000001E8 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_deleteTextureMainThread()
extern void NativeApi_UnityARCore_session_deleteTextureMainThread_m0C1472F22B08B53BDD87FDF2C72A096718423526 (void);
// 0x000001E9 System.Boolean UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_getMatchFrameRateEnabled()
extern void NativeApi_UnityARCore_session_getMatchFrameRateEnabled_m6C162ED9A6F7978410F7CD7AB2E26F1412C3A3D0 (void);
// 0x000001EA System.Boolean UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_getMatchFrameRateRequested()
extern void NativeApi_UnityARCore_session_getMatchFrameRateRequested_mEAD3F6B163A8E6F29E647F6436D55FC487388DA7 (void);
// 0x000001EB System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_setMatchFrameRateRequested(System.Boolean)
extern void NativeApi_UnityARCore_session_setMatchFrameRateRequested_m42F919D37263A8E9F9A02262A5D58A546F1E2683 (void);
// 0x000001EC UnityEngine.XR.ARSubsystems.Feature UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::GetCurrentTrackingMode()
extern void NativeApi_GetCurrentTrackingMode_mB5234088AF8B5C68A6B029D440B42FFDD00B0A76 (void);
// 0x000001ED System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_setConfigurationDirty()
extern void NativeApi_UnityARCore_session_setConfigurationDirty_m50949B860D15405FA2C87990C31D9C66B8B7F84A (void);
// 0x000001EE System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi::UnityARCore_session_setConfigCallback(System.Action`3<UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArConfig,System.IntPtr>,System.IntPtr)
extern void NativeApi_UnityARCore_session_setConfigCallback_m525549EF8EAE00F177171C1858BBA7E6E41F642F (void);
// 0x000001EF System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionRequestProviderDelegate::.ctor(System.Object,System.IntPtr)
extern void CameraPermissionRequestProviderDelegate__ctor_m2FA75F6A973B17CA18B4BF6BAE20702655339E27 (void);
// 0x000001F0 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionRequestProviderDelegate::Invoke(UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionsResultCallbackDelegate,System.IntPtr)
extern void CameraPermissionRequestProviderDelegate_Invoke_m05261FB991CE8933EA8041F56122E659E160E68E (void);
// 0x000001F1 System.IAsyncResult UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionRequestProviderDelegate::BeginInvoke(UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionsResultCallbackDelegate,System.IntPtr,System.AsyncCallback,System.Object)
extern void CameraPermissionRequestProviderDelegate_BeginInvoke_m7A8B194D3BB3C4F6431A5D462099362A1AB8F3CA (void);
// 0x000001F2 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionRequestProviderDelegate::EndInvoke(System.IAsyncResult)
extern void CameraPermissionRequestProviderDelegate_EndInvoke_mB4D4796BA3D426AA561782B3BF4283FC456A207D (void);
// 0x000001F3 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionsResultCallbackDelegate::.ctor(System.Object,System.IntPtr)
extern void CameraPermissionsResultCallbackDelegate__ctor_mEDD148B83FBC25FEBD30084B824D552055F1A1FC (void);
// 0x000001F4 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionsResultCallbackDelegate::Invoke(System.Boolean,System.IntPtr)
extern void CameraPermissionsResultCallbackDelegate_Invoke_m1BB16747C0F77B3FB2038F05EFB05E21F9100AE4 (void);
// 0x000001F5 System.IAsyncResult UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionsResultCallbackDelegate::BeginInvoke(System.Boolean,System.IntPtr,System.AsyncCallback,System.Object)
extern void CameraPermissionsResultCallbackDelegate_BeginInvoke_mA3D872A3C5F09EAD519B46A11F43670BFBAE25AA (void);
// 0x000001F6 System.Void UnityEngine.XR.ARCore.ARCoreSessionSubsystem/NativeApi/CameraPermissionsResultCallbackDelegate::EndInvoke(System.IAsyncResult)
extern void CameraPermissionsResultCallbackDelegate_EndInvoke_m83C4C5BD7B5353B02F0C0F73FE20B85A2F507C72 (void);
// 0x000001F7 System.Boolean UnityEngine.XR.ARCore.ArPlaybackStatusExtensions::Playing(UnityEngine.XR.ARCore.ArPlaybackStatus)
extern void ArPlaybackStatusExtensions_Playing_m426CED6273FD330E2F62F77EB15EFF4730D6FDA0 (void);
// 0x000001F8 System.Void UnityEngine.XR.ARCore.ArPrestoApi::ArPresto_update()
extern void ArPrestoApi_ArPresto_update_m7BF3DB90C52EA0AB24B5A6DADD519B85842E98C1 (void);
// 0x000001F9 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::.ctor(System.IntPtr)
extern void ArRecordingConfig__ctor_mFB056D108F9F2F1F95700E06ECF338AB67DE5543 (void);
// 0x000001FA UnityEngine.XR.ARCore.ArRecordingConfig UnityEngine.XR.ARCore.ArRecordingConfig::FromIntPtr(System.IntPtr)
extern void ArRecordingConfig_FromIntPtr_mC45CC978BE05629D8ECDD75C8DD9ED6314B0B2C6 (void);
// 0x000001FB System.IntPtr UnityEngine.XR.ARCore.ArRecordingConfig::AsIntPtr()
extern void ArRecordingConfig_AsIntPtr_m1ACE1150822FE9A799E42E6FEEC115FC67DB59F5 (void);
// 0x000001FC System.IntPtr UnityEngine.XR.ARCore.ArRecordingConfig::op_Explicit(UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ArRecordingConfig_op_Explicit_mF252DBD16133AA5DE90CB03564B2AC3A00C3D7E5 (void);
// 0x000001FD System.Boolean UnityEngine.XR.ARCore.ArRecordingConfig::Equals(UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ArRecordingConfig_Equals_m700366138DCCEF48563D46A885A66749A7EAFE8E (void);
// 0x000001FE System.Boolean UnityEngine.XR.ARCore.ArRecordingConfig::Equals(System.Object)
extern void ArRecordingConfig_Equals_m46B9FD5ED0BA1F8EB0DE3B0263F86C4EC34D83E5 (void);
// 0x000001FF System.Int32 UnityEngine.XR.ARCore.ArRecordingConfig::GetHashCode()
extern void ArRecordingConfig_GetHashCode_mC90EE60365D20D0958B7A9AA756D964107BAAA4D (void);
// 0x00000200 System.Boolean UnityEngine.XR.ARCore.ArRecordingConfig::op_Equality(UnityEngine.XR.ARCore.ArRecordingConfig,UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ArRecordingConfig_op_Equality_m631C76610F404A78A61A9D4CCEEEBD8149659B01 (void);
// 0x00000201 System.Boolean UnityEngine.XR.ARCore.ArRecordingConfig::op_Inequality(UnityEngine.XR.ARCore.ArRecordingConfig,UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ArRecordingConfig_op_Inequality_mEC8689EDDD323D7E96AB49288F61D7376F911FBD (void);
// 0x00000202 System.Boolean UnityEngine.XR.ARCore.ArRecordingConfig::op_Equality(System.Nullable`1<UnityEngine.XR.ARCore.ArRecordingConfig>,System.Nullable`1<UnityEngine.XR.ARCore.ArRecordingConfig>)
extern void ArRecordingConfig_op_Equality_m6A1C8A291986AF3C931FBC660C003AF7E3126E8F (void);
// 0x00000203 System.Boolean UnityEngine.XR.ARCore.ArRecordingConfig::op_Inequality(System.Nullable`1<UnityEngine.XR.ARCore.ArRecordingConfig>,System.Nullable`1<UnityEngine.XR.ARCore.ArRecordingConfig>)
extern void ArRecordingConfig_op_Inequality_mA2A7220A5E338EFF9D66378F15AC20676B70DD8A (void);
// 0x00000204 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::.ctor(UnityEngine.XR.ARCore.ArSession)
extern void ArRecordingConfig__ctor_m1FC781FAD6F26382FFB4BD225C6E97D3404F6201 (void);
// 0x00000205 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::Create(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingConfig&)
extern void ArRecordingConfig_Create_m04F7C02818D176812EA4A49B49BDBFE8E3A0BC58 (void);
// 0x00000206 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::Dispose()
extern void ArRecordingConfig_Dispose_mC038E6DF18BFFC5CF53C92981959209499F60F8A (void);
// 0x00000207 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::Destroy(UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ArRecordingConfig_Destroy_mA0AB849DAAA10939E1A01F7A7A90E99D5AC16DB2 (void);
// 0x00000208 System.String UnityEngine.XR.ARCore.ArRecordingConfig::GetMp4DatasetFilePath(UnityEngine.XR.ARCore.ArSession)
extern void ArRecordingConfig_GetMp4DatasetFilePath_m4914727C5AB42734B16097D5922DCAD6B018C230 (void);
// 0x00000209 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::GetMp4DatasetFilePath(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingConfig,UnityEngine.XR.ARCore.ArString&)
extern void ArRecordingConfig_GetMp4DatasetFilePath_m0B34E607C2B821C99AD9587B20BD6C51E5A90BEF (void);
// 0x0000020A System.Void UnityEngine.XR.ARCore.ArRecordingConfig::SetMp4DatasetFilePath(UnityEngine.XR.ARCore.ArSession,System.String)
extern void ArRecordingConfig_SetMp4DatasetFilePath_m4AB1F048A648E5A18330B326231950FCFC562C7D (void);
// 0x0000020B System.Void UnityEngine.XR.ARCore.ArRecordingConfig::SetMp4DatasetFilePath(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingConfig,System.Byte*)
extern void ArRecordingConfig_SetMp4DatasetFilePath_mA190E0291CB562A02B3A98F7206C83C2AEB25790 (void);
// 0x0000020C System.Boolean UnityEngine.XR.ARCore.ArRecordingConfig::GetAutoStopOnPause(UnityEngine.XR.ARCore.ArSession)
extern void ArRecordingConfig_GetAutoStopOnPause_m9A7A960FBD8F80AEE2BE64F948645BB713FC6589 (void);
// 0x0000020D System.Void UnityEngine.XR.ARCore.ArRecordingConfig::GetAutoStopOnPause(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingConfig,System.Int32&)
extern void ArRecordingConfig_GetAutoStopOnPause_mA5DAE6C68CD1B8287AF0C76B2DBA71940F632EE8 (void);
// 0x0000020E System.Void UnityEngine.XR.ARCore.ArRecordingConfig::SetAutoStopOnPause(UnityEngine.XR.ARCore.ArSession,System.Boolean)
extern void ArRecordingConfig_SetAutoStopOnPause_m8EA51CD64BE495E44E17F25BF25FDF16496B317E (void);
// 0x0000020F System.Void UnityEngine.XR.ARCore.ArRecordingConfig::SetAutoStopOnPause(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingConfig,System.Int32)
extern void ArRecordingConfig_SetAutoStopOnPause_m6C11BA37A63AABEF37F3063923FB97B7E8267859 (void);
// 0x00000210 System.Int32 UnityEngine.XR.ARCore.ArRecordingConfig::GetRecordingRotation(UnityEngine.XR.ARCore.ArSession)
extern void ArRecordingConfig_GetRecordingRotation_mDFD704E14CEC23CC39C9AD1C787CF9AF2D46204B (void);
// 0x00000211 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::GetRecordingRotation(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingConfig,System.Int32&)
extern void ArRecordingConfig_GetRecordingRotation_m6B7015C220C92205E5612039CC6DE28BAE122BDD (void);
// 0x00000212 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::SetRecordingRotation(UnityEngine.XR.ARCore.ArSession,System.Int32)
extern void ArRecordingConfig_SetRecordingRotation_m0AB920806E19B8313DA5D2D9A5467F753FA7DCEF (void);
// 0x00000213 System.Void UnityEngine.XR.ARCore.ArRecordingConfig::SetRecordingRotation(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingConfig,System.Int32)
extern void ArRecordingConfig_SetRecordingRotation_mD40648B54224AE8AF2104A2503B7401C7B2DAD3A (void);
// 0x00000214 System.Boolean UnityEngine.XR.ARCore.ArRecordingStatusExtensions::Recording(UnityEngine.XR.ARCore.ArRecordingStatus)
extern void ArRecordingStatusExtensions_Recording_mBE4200D74B16B1C18E5412646BA6FC9B6647BBBC (void);
// 0x00000215 System.Void UnityEngine.XR.ARCore.ArSession::.ctor(System.IntPtr)
extern void ArSession__ctor_m71349A9234C25226F1128347856956BE42878C23 (void);
// 0x00000216 UnityEngine.XR.ARCore.ArSession UnityEngine.XR.ARCore.ArSession::FromIntPtr(System.IntPtr)
extern void ArSession_FromIntPtr_m34BF262FC3F3236332692EFED765039E1D6B04A0 (void);
// 0x00000217 UnityEngine.XR.ARCore.ArSession UnityEngine.XR.ARCore.ArSession::get_Null()
extern void ArSession_get_Null_mAFE2D9B06995B6C62CD2C17E4F63018B1D1F93AB (void);
// 0x00000218 System.Boolean UnityEngine.XR.ARCore.ArSession::get_IsNull()
extern void ArSession_get_IsNull_m05BB739DEE4AF829CC1D2EFE8E0CEC2771CF01C4 (void);
// 0x00000219 System.IntPtr UnityEngine.XR.ARCore.ArSession::AsIntPtr()
extern void ArSession_AsIntPtr_m73675297C396024E6179B8D4476CE2DE242B662A (void);
// 0x0000021A System.IntPtr UnityEngine.XR.ARCore.ArSession::op_Explicit(UnityEngine.XR.ARCore.ArSession)
extern void ArSession_op_Explicit_m3BB162CFBE033F77327BECD82E36F6FD7E893271 (void);
// 0x0000021B System.Boolean UnityEngine.XR.ARCore.ArSession::Equals(UnityEngine.XR.ARCore.ArSession)
extern void ArSession_Equals_m23B510198BAD7E0B9A1484ECFCF5BF41B7DC7748 (void);
// 0x0000021C System.Boolean UnityEngine.XR.ARCore.ArSession::Equals(System.Object)
extern void ArSession_Equals_m55E7D8A043929991C0F0874F2AC63F16B4EF8122 (void);
// 0x0000021D System.Int32 UnityEngine.XR.ARCore.ArSession::GetHashCode()
extern void ArSession_GetHashCode_m5D362BBA3F33B01AC2C68D04FD433DB71CBDF21E (void);
// 0x0000021E System.Boolean UnityEngine.XR.ARCore.ArSession::op_Equality(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArSession)
extern void ArSession_op_Equality_m609FE3E139CFDA789F6A231A2146DDAE82020B97 (void);
// 0x0000021F System.Boolean UnityEngine.XR.ARCore.ArSession::op_Inequality(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArSession)
extern void ArSession_op_Inequality_m6D1477A67B93677F09DCDFCA60B324BB3714175E (void);
// 0x00000220 System.Boolean UnityEngine.XR.ARCore.ArSession::op_Equality(System.Nullable`1<UnityEngine.XR.ARCore.ArSession>,System.Nullable`1<UnityEngine.XR.ARCore.ArSession>)
extern void ArSession_op_Equality_m25B429B95EBDB1268A48744722DE8D5889E2BA94 (void);
// 0x00000221 System.Boolean UnityEngine.XR.ARCore.ArSession::op_Inequality(System.Nullable`1<UnityEngine.XR.ARCore.ArSession>,System.Nullable`1<UnityEngine.XR.ARCore.ArSession>)
extern void ArSession_op_Inequality_mD63C339935AD0D73358724F180C5B41E503019D8 (void);
// 0x00000222 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ArSession::SetPlaybackDataset(System.String)
extern void ArSession_SetPlaybackDataset_mC0C2D822F6267EA04C3586B10AD7BA96B48D5971 (void);
// 0x00000223 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ArSession::SetPlaybackDataset(UnityEngine.XR.ARCore.ArSession,System.Byte*)
extern void ArSession_SetPlaybackDataset_m9B08EFA7A2B5B55F57AB20311DA07A6999605295 (void);
// 0x00000224 UnityEngine.XR.ARCore.ArPlaybackStatus UnityEngine.XR.ARCore.ArSession::get_playbackStatus()
extern void ArSession_get_playbackStatus_m532E4AB78BBE269DD6635E21E7C84BAEF28FEF9B (void);
// 0x00000225 System.Void UnityEngine.XR.ARCore.ArSession::GetPlaybackStatus(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArPlaybackStatus&)
extern void ArSession_GetPlaybackStatus_m711CFB4507ADAA9053029EF99A69DED9563CFF3E (void);
// 0x00000226 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ArSession::StartRecording(UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ArSession_StartRecording_m4E1E63E462A28E2582928B7780E77FC91A6B74AD (void);
// 0x00000227 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ArSession::StartRecording(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingConfig)
extern void ArSession_StartRecording_m8F79541DADDC652F51AAB39F51D7E8C7E03FB59F (void);
// 0x00000228 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ArSession::StopRecording()
extern void ArSession_StopRecording_m29D650C26A1CF6074DD6EAB28D811306CEFFC674 (void);
// 0x00000229 UnityEngine.XR.ARCore.ArStatus UnityEngine.XR.ARCore.ArSession::StopRecording(UnityEngine.XR.ARCore.ArSession)
extern void ArSession_StopRecording_m88A80EB54F7D99FB2DB606E18991AE5F9D0A0991 (void);
// 0x0000022A UnityEngine.XR.ARCore.ArRecordingStatus UnityEngine.XR.ARCore.ArSession::get_recordingStatus()
extern void ArSession_get_recordingStatus_m8D8B1CE7BD5A413E8EAACFFA910548B69273AF3C (void);
// 0x0000022B System.Void UnityEngine.XR.ARCore.ArSession::GetRecordingStatus(UnityEngine.XR.ARCore.ArSession,UnityEngine.XR.ARCore.ArRecordingStatus&)
extern void ArSession_GetRecordingStatus_m22CD41FFE06BC160C7B6901185C6B08C3571B70B (void);
// 0x0000022C System.String UnityEngine.XR.ARCore.ArString::ToString()
extern void ArString_ToString_m58566F4EAB0BEC069B61795B57AF890F9AF05961 (void);
// 0x0000022D System.String UnityEngine.XR.ARCore.ArString::ToString(System.Text.Encoding)
extern void ArString_ToString_m245F2065FC557EDD10CD96632E4BD5B2A7CE63FC (void);
// 0x0000022E System.Void UnityEngine.XR.ARCore.ArString::Dispose()
extern void ArString_Dispose_m2D9E29EC3E98FE828F7FEAB806341561A8A193AA (void);
// 0x0000022F System.Int32 UnityEngine.XR.ARCore.ArString::CalculateNullTerminatedByteCount()
extern void ArString_CalculateNullTerminatedByteCount_m89C0AAFB8D621F7D1A92FF9334DC8CA6FA526EB1 (void);
// 0x00000230 System.Void UnityEngine.XR.ARCore.ArString::Release(System.Byte*)
extern void ArString_Release_m27459842D47D71753784F31A66BC9AB8749E26E5 (void);
// 0x00000231 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem::RegisterDescriptor()
extern void ARCoreXRDepthSubsystem_RegisterDescriptor_m7169EDD4BA7BD072FA983005A865E28B3F634A36 (void);
// 0x00000232 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem::.ctor()
extern void ARCoreXRDepthSubsystem__ctor_mEDFE4948894B6C0B169A7960449503CD9D104477 (void);
// 0x00000233 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::UnityARCore_depth_Create(System.Func`1<System.Guid>)
extern void ARCoreProvider_UnityARCore_depth_Create_m7529DFC5E1E9B09F6488A04944ECC238CD53DF68 (void);
// 0x00000234 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::UnityARCore_depth_Start()
extern void ARCoreProvider_UnityARCore_depth_Start_m46D68D01CC9B9986C4CBA24C2AE04697C27C9769 (void);
// 0x00000235 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::UnityARCore_depth_Stop()
extern void ARCoreProvider_UnityARCore_depth_Stop_m26CB7C7FE276E4E4924E6342641D2F3DAE726E6F (void);
// 0x00000236 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::UnityARCore_depth_Destroy()
extern void ARCoreProvider_UnityARCore_depth_Destroy_m2BDDBF674C36D3B6E0468DBDFC753988B78EEA0F (void);
// 0x00000237 System.Void* UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::UnityARCore_depth_AcquireChanges(System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Void*&,System.Int32&,System.Int32&)
extern void ARCoreProvider_UnityARCore_depth_AcquireChanges_mD7EE79AE441405BDEC567663BF4C6326DCDEB33A (void);
// 0x00000238 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::UnityARCore_depth_ReleaseChanges(System.Void*)
extern void ARCoreProvider_UnityARCore_depth_ReleaseChanges_m2AED120AA993C4FCACDDDC95FA771B7062239049 (void);
// 0x00000239 System.Int32 UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::UnityARCore_depth_getPointCloudPtrs(UnityEngine.XR.ARSubsystems.TrackableId,System.Void*&,System.Void*&)
extern void ARCoreProvider_UnityARCore_depth_getPointCloudPtrs_mBF4EDD60330CDB42FF68FB76B9AE70A8DAEFDEA0 (void);
// 0x0000023A UnityEngine.XR.ARSubsystems.TrackableChanges`1<UnityEngine.XR.ARSubsystems.XRPointCloud> UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::GetChanges(UnityEngine.XR.ARSubsystems.XRPointCloud,Unity.Collections.Allocator)
extern void ARCoreProvider_GetChanges_m19155AA444BC46A6C38F7BD4B45C5EB1E13A6B58 (void);
// 0x0000023B UnityEngine.XR.ARSubsystems.XRPointCloudData UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::GetPointCloudData(UnityEngine.XR.ARSubsystems.TrackableId,Unity.Collections.Allocator)
extern void ARCoreProvider_GetPointCloudData_m8D457677921836A41A273609B8DFA43314DD8850 (void);
// 0x0000023C System.Guid UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::GenerateGuid()
extern void ARCoreProvider_GenerateGuid_m406A7A02F96253CB573818EA5FF3E5AF66B91CDC (void);
// 0x0000023D System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::.ctor()
extern void ARCoreProvider__ctor_m0341088DD918C0C66148DA578DD6FCBD193EC575 (void);
// 0x0000023E System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::Destroy()
extern void ARCoreProvider_Destroy_mBF4A7CB6ADFACF9EFF6291F20DAB539A8DFD686C (void);
// 0x0000023F System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::Start()
extern void ARCoreProvider_Start_m326B11169F3055941C51D585904C683B3FDA74FE (void);
// 0x00000240 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::Stop()
extern void ARCoreProvider_Stop_m4FAB7B9AF53CE6AB27B68A239F1D7F80456E4B35 (void);
// 0x00000241 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider::.cctor()
extern void ARCoreProvider__cctor_mEA701BB50F9380F49A84C3A6DB482B5E7DC9E982 (void);
// 0x00000242 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider/CopyIdentifiersJob::Execute(System.Int32)
extern void CopyIdentifiersJob_Execute_mD5F4057E3560C7ABD74EBCEA89EFF89A64695D3C (void);
// 0x00000243 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider/ExtractConfidenceValuesJob::Execute(System.Int32)
extern void ExtractConfidenceValuesJob_Execute_m261E6D89CD79EA5CF89F594039AC47FB4812D6D1 (void);
// 0x00000244 System.Void UnityEngine.XR.ARCore.ARCoreXRDepthSubsystem/ARCoreProvider/TransformPositionsJob::Execute(System.Int32)
extern void TransformPositionsJob_Execute_m892589A8D6347D174D643A86AB646B2DFE94A66A (void);
// 0x00000245 System.Int32 UnityEngine.XR.ARCore.HashCodeUtil::Combine(System.Int32,System.Int32)
extern void HashCodeUtil_Combine_mAA1A7737A9FFAE9120CEA037BFDEDE29A0C07BA3 (void);
// 0x00000246 System.Int32 UnityEngine.XR.ARCore.HashCodeUtil::ReferenceHash(System.Object)
extern void HashCodeUtil_ReferenceHash_m647089DCAD744E3C37CDA7C20FED7D8178186317 (void);
// 0x00000247 System.Int32 UnityEngine.XR.ARCore.HashCodeUtil::Combine(System.Int32,System.Int32,System.Int32)
extern void HashCodeUtil_Combine_m43D09B71E5BF7CF79C818FE0AEC3FB03D2C3B666 (void);
// 0x00000248 System.Int32 UnityEngine.XR.ARCore.HashCodeUtil::Combine(System.Int32,System.Int32,System.Int32,System.Int32)
extern void HashCodeUtil_Combine_m3197B269976A801D91AC6028A8123C199D7D3BA6 (void);
// 0x00000249 System.Int32 UnityEngine.XR.ARCore.HashCodeUtil::Combine(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
extern void HashCodeUtil_Combine_mA2CBA1C4D73089F8E851270E0278C3EA4572FCA6 (void);
// 0x0000024A System.Int32 UnityEngine.XR.ARCore.HashCodeUtil::Combine(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
extern void HashCodeUtil_Combine_mBDCCE07563AA420711AF3BA79355D72F77B0104C (void);
// 0x0000024B System.Int32 UnityEngine.XR.ARCore.HashCodeUtil::Combine(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
extern void HashCodeUtil_Combine_m9FE1386242CE4687B74DB3527AC0632565068A60 (void);
// 0x0000024C System.Int32 UnityEngine.XR.ARCore.HashCodeUtil::Combine(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32)
extern void HashCodeUtil_Combine_m7A0E2E3777C97DA3F7A43FD70E27112FDB53E638 (void);
// 0x0000024D System.Void UnityEngine.XR.ARCore.FlipVerticalJob::Execute(System.Int32)
extern void FlipVerticalJob_Execute_mD0741C407C244AEE8696FF8D8EAB2DCE8EB676EA (void);
// 0x0000024E System.Void UnityEngine.XR.ARCore.ConvertRFloatToGrayscaleJob::Execute(System.Int32)
extern void ConvertRFloatToGrayscaleJob_Execute_mD576D88F5CA87BA7658352FF375620774927BE7E (void);
// 0x0000024F System.Void UnityEngine.XR.ARCore.ConvertBGRA32ToGrayscaleJob::Execute(System.Int32)
extern void ConvertBGRA32ToGrayscaleJob_Execute_mA1B5222E6CE669BFCABC309634A1058FD0318D49 (void);
// 0x00000250 System.Void UnityEngine.XR.ARCore.ConvertARGB32ToGrayscaleJob::Execute(System.Int32)
extern void ConvertARGB32ToGrayscaleJob_Execute_m273542FF7E241207A99C0FC3FAF3070825F9E4FD (void);
// 0x00000251 System.Void UnityEngine.XR.ARCore.ConvertStridedToGrayscaleJob::Execute(System.Int32)
extern void ConvertStridedToGrayscaleJob_Execute_m74E512D24E8A627CC8C269B50D359650929B44CF (void);
// 0x00000252 Unity.Jobs.JobHandle UnityEngine.XR.ARCore.ConversionJob::Schedule(Unity.Collections.NativeSlice`1<System.Byte>,UnityEngine.Vector2Int,UnityEngine.TextureFormat,Unity.Collections.NativeArray`1<System.Byte>,Unity.Jobs.JobHandle)
extern void ConversionJob_Schedule_mF270AC8E82EBA0579E4A4C687970FAAD7225D2A7 (void);
// 0x00000253 System.Void UnityEngine.XR.ARCore.ManagedReferenceImage::.ctor(UnityEngine.XR.ARSubsystems.XRReferenceImage)
extern void ManagedReferenceImage__ctor_m7909E7255E06256DB90E301F1C5A75A834B60738 (void);
// 0x00000254 UnityEngine.XR.ARSubsystems.XRReferenceImage UnityEngine.XR.ARCore.ManagedReferenceImage::ToReferenceImage()
extern void ManagedReferenceImage_ToReferenceImage_m6E37905684A97C30C332AEB8BD57E67128CBF3F1 (void);
// 0x00000255 System.Void UnityEngine.XR.ARCore.ManagedReferenceImage::Dispose()
extern void ManagedReferenceImage_Dispose_mED4FBEB981766408C3E96556E5C311B893760C50 (void);
// 0x00000256 UnityEngine.XR.ARSubsystems.SerializableGuid UnityEngine.XR.ARCore.ManagedReferenceImage::AsSerializedGuid(System.Guid)
extern void ManagedReferenceImage_AsSerializedGuid_m11A3D420BD4FA6196F7AE1AAC40527B3FD393073 (void);
// 0x00000257 T UnityEngine.XR.ARCore.ManagedReferenceImage::ResolveGCHandle(System.IntPtr)
// 0x00000258 Unity.Collections.NativeArray`1<UnityEngine.XR.ARCore.ManagedReferenceImage> UnityEngine.XR.ARCore.ManagedReferenceImageExtensions::ToNativeArray(UnityEngine.XR.ARSubsystems.XRReferenceImageLibrary,Unity.Collections.Allocator)
extern void ManagedReferenceImageExtensions_ToNativeArray_m66CAB6205121E4D60926518B254D061EB17F2D16 (void);
// 0x00000259 System.Boolean UnityEngine.XR.ARCore.NativeObject::ArePointersEqual(System.Nullable`1<System.IntPtr>,System.Nullable`1<System.IntPtr>)
extern void NativeObject_ArePointersEqual_mC0BFF100E3AAD60E362DED0441365800D7A13538 (void);
// 0x0000025A UnityEngine.XR.ARCore.NativeView UnityEngine.XR.ARCore.NativeViewExtensions::AsNativeView(Unity.Collections.NativeArray`1<T>)
// 0x0000025B UnityEngine.XR.ARCore.NativeView UnityEngine.XR.ARCore.NativeViewExtensions::AsNativeView(Unity.Collections.NativeSlice`1<T>)
// 0x0000025C System.Int32 UnityEngine.XR.ARCore.RcoApi::Retain(System.IntPtr)
extern void RcoApi_Retain_m33EBE09AE7E4B914A003EBD2F8FCCAD8754EF2DA (void);
// 0x0000025D System.Int32 UnityEngine.XR.ARCore.RcoApi::Release(System.IntPtr)
extern void RcoApi_Release_mD384FEAAB2A01C8398D198AD828D895358D39409 (void);
// 0x0000025E System.Int32 UnityEngine.XR.ARCore.RcoApi::RetainCount(System.IntPtr)
extern void RcoApi_RetainCount_m6F9674C2E247BEB3EE2FF227D2E46E84C6EB2ECD (void);
// 0x0000025F Unity.Collections.NativeArray`1<System.Byte> UnityEngine.XR.ARCore.StringExtensions::ToBytes(System.String,System.Text.Encoding,Unity.Collections.Allocator)
extern void StringExtensions_ToBytes_m7ADEB91D1FE5DEC0EF373FAE3F33B0007982EF0E (void);
static Il2CppMethodPointer s_methodPointers[607] =
{
ArCameraConfig__ctor_m03B7CCBE0A6A9F8C9CF14EBBCB1517566DA47015,
ArCameraConfig_FromIntPtr_mA19D247EBA63FC5B9E3446BDE14A5EF262B31494,
ArCameraConfig_get_Null_mA60A9CA8C06888A217777F3300F435992151987A,
ArCameraConfig_get_IsNull_m0E09F4D2B8C7F7159FBF65FCA7486A8C79741ED6,
ArCameraConfig_AsIntPtr_m319C668BCFE412C0D53FF26D97EDB93249B39444,
ArCameraConfig__ctor_mE14FEFC3215FE2A052D06E5A43C619D320B9AA19,
ArCameraConfig_Dispose_m165F78DBFE34B76060059B7BFC7EB367E0D626CC,
ArCameraConfig_GetCameraId_mE547D5D96CFA540BE2631831CB839D3D907DAC90,
ArCameraConfig_GetDepthSensorUsage_m5F136C8F9C5B3044C503580EB45DBC2671EC7C4F,
ArCameraConfig_GetFacingDirection_m3C022FA6AC02ED9BBBE8B4923E9CA397E72FB7A4,
ArCameraConfig_GetFpsRange_mF9215E84CF0CF2EB05D2ACD0CFDE02899C9F2533,
ArCameraConfig_GetImageDimensions_m3746D40ABD8902AEA59C72E1F6B23635A1A2C2C6,
ArCameraConfig_GetTextureDimensions_mA0E9C970FDEE0847B4FC7AABC35D82B0259648AE,
ArCameraConfig_op_Explicit_m75C16A3BEDDA4D9395023DC116B9AE3D3E70BB0D,
ArCameraConfig_Equals_m970EB204E68B633C9E34D1ED6A06EDCCD7E461E9,
ArCameraConfig_Equals_m475848DB0C28F764CAFC0F44E27B06BEB7564041,
ArCameraConfig_GetHashCode_m12BD55CF30C1466B45155A17224C4AA9AB16C4E0,
ArCameraConfig_op_Equality_m3B386ECFAF0794C36A1394BBF7C21F9162F9BA38,
ArCameraConfig_op_Inequality_m0CBACD131638FB61B37871920FC737A5367FDE86,
ArCameraConfig_op_Equality_mAFA54C0D4D41652098C1F9DFDC1179490D9EFDE0,
ArCameraConfig_op_Inequality_mCAF214A16A446C0C3B0FFD30FA055FB4CC7088CA,
ArCameraConfig_Create_m170C242CBD91B2B4B3F3E740F1D72FCD76F68584,
ArCameraConfig_Destroy_m0D4FC9FC4D4AEE2027A91119BD199463B9433058,
ArCameraConfig_GetCameraId_m446B0307DC42BC3B01663083F4B2860F563669BD,
ArCameraConfig_GetDepthSensorUsage_m4D78136CAFEBF3D9CF7CD79D6A3CCC6115AA001B,
ArCameraConfig_GetFacingDirection_mE1D3ABC879DBA98EA977AB70F4EBA66F83B13100,
ArCameraConfig_GetFpsRange_m018C3FB75E73D7A830C4ABE35965A0E54882A401,
ArCameraConfig_GetImageDimensions_m8059D0A20AC5D7F738432B5ECE733A846567713B,
ArCameraConfig_GetTextureDimensions_m31F81DC0D4AE324A6B07F0B7A20F1E8806CBF44A,
XRCameraConfigurationExtensions_AsArCameraConfig_mD016A86F7C0F48ED8195F6DC60F2DCA6EA06B1EE,
ArCameraConfigFilter__ctor_mAFDDE747B063B59B3DA2DD79FC20A16D497C07FA,
ArCameraConfigFilter_FromIntPtr_mC4B4D4342CD2A608DD5DD74AA0712D4B41E2BDC3,
ArCameraConfigFilter_get_Null_m054B7CE9A1E97478F17FD6DA9F4F02A9FBD39394,
ArCameraConfigFilter__ctor_mF486A6AFC61683CFC3E52B7E5494E983D4DE83E7,
ArCameraConfigFilter_AsIntPtr_mC26AD4E33C4D07ED7C4970BC7C75456AC84D62BF,
ArCameraConfigFilter_get_IsNull_m0C4936F2612BC0BB7B4BAF08F9F0947D69EDC383,
ArCameraConfigFilter_GetDepthSensorUsage_mAD042C592CA038A62E72173B8B0E9224067C7C12,
ArCameraConfigFilter_SetDepthSensorUsage_m92C45E574F2383B585B96C7FEC9FF2CCEABC68E3,
ArCameraConfigFilter_GetTargetFps_m8A00967A664541D6702D5256F048DC56EBB74983,
ArCameraConfigFilter_SetTargetFps_mD09E6CDC671DB61E9FC443F99A26EF4C716C9766,
ArCameraConfigFilter_Dispose_m71514EB30557871157FCA62921F794E10EC3BD59,
ArCameraConfigFilter_op_Explicit_m1E9A2D7922582033C2890A10FC3CF58001EA3250,
ArCameraConfigFilter_Equals_m7A03616AACBC45070F8F65ACE805CF16ADF65494,
ArCameraConfigFilter_Equals_mF6B858B3A8FC33E7912163F338B1CC71C59744ED,
ArCameraConfigFilter_GetHashCode_mAB06AE4573E43FB7802536BD3809666832F1348A,
ArCameraConfigFilter_op_Equality_m57B80CEB767D5B0079E6EA109D9DDF28DE17DDE4,
ArCameraConfigFilter_op_Inequality_m1CC6CD803B2F2331904A69D5E3721D79EFADF3BB,
ArCameraConfigFilter_op_Equality_mF57F2BDCDC340DF652AEF95CB18D696F9A841C51,
ArCameraConfigFilter_op_Inequality_mAD9AB2B35F3C7C52AFEE6A98AB7DBDFC6EBD33DA,
ArCameraConfigFilter_Create_mD896208F08CA2FE2C898937D243AACECABF4E395,
ArCameraConfigFilter_Destroy_m984E11076B9CE909CB77CFAB318B272EA021EF7D,
ArCameraConfigFilter_GetDepthSensorUsage_m64691545465CBFF2610CB25D67FE0E25BCE50631,
ArCameraConfigFilter_SetDepthSensorUsage_mFFD25F9117C2AF5F94E99709083D229CF4C5B660,
ArCameraConfigFilter_GetTargetFps_m2AE7B5F6ACB3C048646DC7FA519A921976711351,
ArCameraConfigFilter_SetTargetFps_m7B28B95555C26E701C6071F39D2594E99B4EF161,
ArConfig__ctor_m0E326EEBB3B5154A7BA864AF3B31CA153C4AC072,
ArConfig__ctor_m807FC812AF15E78B8FD5025A164FF214A030F793,
ArConfig_FromIntPtr_m32208DEC75FA2D344888E9077071F4C43A52BDEF,
ArConfig_get_Null_m998AD100991D45E3BD7F659CA4F1A78A556306A2,
ArConfig_get_IsNull_mC16E8E4A5FD7562D365B3CED6F6195F6D3A4BA98,
ArConfig_AsIntPtr_m9CFB8A76A4BB209848A58B8CB8CC7481BF763A42,
ArConfig_op_Explicit_m0B8CAA6B7B355EE6EAC0F901D95484A2E47E785B,
ArConfig_Equals_mCE8CA68F242CF012255732C5387E953EFB7C7572,
ArConfig_Equals_mAF04B9E9552EAF1D2DE31F107EF45BBC9CF8BBA4,
ArConfig_GetHashCode_m2AA440E48A34FDA2186E99FDF0630578AB433DC4,
ArConfig_op_Equality_m5A9111D49C9DBD1A479D5D3025DB27F4EB0C43B3,
ArConfig_op_Inequality_mA7474C880461CA7A8568EC0C1C47E4888CB7FC08,
ArConfig_Dispose_m7AFD805848963702EA520A205BF9E3AC79BFA37B,
ArConfig_op_Equality_m39D3CA59FEDF21CB6A61B060A707BDA75CD3861C,
ArConfig_op_Inequality_m81FB0A8466E6E7E06F09BA424C0D1672B8C9ACD4,
ArConfig_Create_m78CF4C4E2A45690040017968D4BD2ECD00253372,
ArConfig_Destroy_m0C59C48FB5A2B23C97EA7E8663366BF3B91CE643,
ARCoreAnchorSubsystem_RegisterDescriptor_m222ADF940BFE39EBF46A5C451EB817DAC7A68D66,
ARCoreAnchorSubsystem__ctor_mC98DC11B6F123B0FC0EA5ADFF88B8FA0E8A8D08B,
ARCoreProvider_Start_mD07637BF200496D0C3615BB8CDB276EAF57A9901,
ARCoreProvider_Stop_mEA426F258151A7C2A8D1E638C02C6208A3583DB1,
ARCoreProvider_Destroy_m2C54D63343AAAA27AE6CA3A9AD64A45E0DFA5148,
ARCoreProvider_GetChanges_mDF33BE46E05FE3C966FBA1250EB5025782AD01DA,
ARCoreProvider_TryAddAnchor_m943778D8A0B7D1A12C866ED6C4C2E8C20749D3EC,
ARCoreProvider_TryAttachAnchor_m0199986FA5941EE3C5265B5BE24B60EAC0F3526C,
ARCoreProvider_TryRemoveAnchor_mB6B7A1248155B29CACE8626014BCDD37FDD4FB05,
ARCoreProvider_UnityARCore_refPoints_start_m0EFC245DF28ACF16A3CC83329DDE23F76F3C75EB,
ARCoreProvider_UnityARCore_refPoints_stop_mB5765EBDE3CB39895AD2B9C4203C2A3F63E9BBEB,
ARCoreProvider_UnityARCore_refPoints_onDestroy_m2EBA966EE22D704D66F30F7A4EC5528385E8ACF9,
ARCoreProvider_UnityARCore_refPoints_acquireChanges_m623C01ECB87A5201A406C4DF8F7F758E3B776CB0,
ARCoreProvider_UnityARCore_refPoints_releaseChanges_m653E4BF642061F192D25D4469D4F0CE7CED6F857,
ARCoreProvider_UnityARCore_refPoints_tryAdd_mF08935E8B709A9B2F85A815D73FEC03C759276F5,
ARCoreProvider_UnityARCore_refPoints_tryAttach_mB7B11969703FBD9D11182BF12531671803FA9C13,
ARCoreProvider_UnityARCore_refPoints_tryRemove_mCAA0C7F75F120F155201DD07952CD9A6CB71784E,
ARCoreProvider__ctor_m77B4C1ACBC5FE569D98454C3530E26CF11089C6A,
Api_SetFeatureRequested_mA919C6960B5ED720C79350D0A5A3D7350B8D39C4,
Api_GetRequestedFeatures_m86552830716E05C2AD916C753C43D476CF898101,
Api_get_platformAndroid_mF3BEC29392C482694A6B778CDEB0C8AACE67664F,
Api_FindLoader_mA87703BE138C6413A6F56AB3B014613164936E5A,
Api_get_loaderPresent_m0D20256DBEF79FABAB5469220149A2D77FD09DFD,
Api__cctor_m40E65FF7756DED0AC8A863B7A85159753EFE9ABF,
ARCoreBeforeGetCameraConfigurationEventArgs_get_session_mCC2430CFD657AA39475EC7F94D12E94602318773,
ARCoreBeforeGetCameraConfigurationEventArgs_set_session_m0E5A8E5B0E3D93A3CAD6F54F7E44C732FCE8686A,
ARCoreBeforeGetCameraConfigurationEventArgs_get_filter_mF91BB4DDE06DAD980576BE33973865F4CAD2C702,
ARCoreBeforeGetCameraConfigurationEventArgs_set_filter_m136097E18565BAB7B14635A951EF75F91208BB08,
ARCoreBeforeGetCameraConfigurationEventArgs_Equals_m967BC71D3DF0590295A53C8BFA897626CC513EFC,
ARCoreBeforeGetCameraConfigurationEventArgs_Equals_m08904E4BE8373C7A8930D51AF33F2EF8F60BA528,
ARCoreBeforeGetCameraConfigurationEventArgs_GetHashCode_mBF1B9E848558FCF41FFA006B2A67018D2F405899,
ARCoreBeforeGetCameraConfigurationEventArgs_op_Equality_m879F389ACFEF2CA8B34C77008F59C0C825CB1D72,
ARCoreBeforeGetCameraConfigurationEventArgs_op_Inequality_mF92B58DFBC27BDEE9324823BA4C4740227783A39,
ARCoreBeforeSetConfigurationEventArgs_get_session_mFB401F61257971B12D20BA2C2A13427ADF110405,
ARCoreBeforeSetConfigurationEventArgs_get_arSession_mFD007DB2BB188809848E2E6F699A87C4041137B9,
ARCoreBeforeSetConfigurationEventArgs_get_config_mABF124F70ED16AECD48A7AD0758798446A53DF31,
ARCoreBeforeSetConfigurationEventArgs_get_arConfig_m1EE2C53DDF02FA08DF8EEC1C016B7C4F5BBFC598,
ARCoreBeforeSetConfigurationEventArgs__ctor_mDEADF5D3E5BD90B0D3715FE63350F8B23475B297,
ARCoreBeforeSetConfigurationEventArgs__ctor_mE6E334059D83C27B306C1F72CD68C86E6DA4FED2,
ARCoreBeforeSetConfigurationEventArgs_Equals_m4B4E1CC09BDDC6E0259BAC9D254FE94F81E336BB,
ARCoreBeforeSetConfigurationEventArgs_GetHashCode_m6E3BC2573D8D619B0E86CCF48EB8F27283F41349,
ARCoreBeforeSetConfigurationEventArgs_Equals_m8969624DBC58D203BE709765D5623E86DAAAC90B,
ARCoreBeforeSetConfigurationEventArgs_op_Equality_m4E11D637723A4B77FF4E0DDFADBD67ADAD6B11DB,
ARCoreBeforeSetConfigurationEventArgs_op_Inequality_m965ABC7FA4C1EE083EA0056ACEF53E9A8359E81D,
ARCoreCameraSubsystem_get_backgroundShaderName_m95DE9225CB8CA43D39B279EA70648A05DCCAC7FC,
ARCoreCameraSubsystem_Register_mD67C78E43675679BB4A9C531FF313D9138C774A7,
ARCoreCameraSubsystem_add_beforeGetCameraConfiguration_mEF3CC67CF983EDDA871ACE63A8F93B6643526F53,
ARCoreCameraSubsystem_remove_beforeGetCameraConfiguration_mBAD3DB452B748425BECB242DAAE2CDA672B95C06,
ARCoreCameraSubsystem_TryGetCurrentConfiguration_m66BFC2C3C5EC6759AC3FC85197CCF607EBE7A3FE,
ARCoreCameraSubsystem__ctor_mBD839198513F7B370BA4BC7523726EBF762BC83E,
ARCoreProvider_get_cameraMaterial_m43BB6CB876819A670E99E2AF819F21F093E825AF,
ARCoreProvider_get_permissionGranted_m3A14A077F17265C42FE4F0C056EC08AA5BECE474,
ARCoreProvider_get_invertCulling_m12A9EF15FB1037990513A6E8729B266F38760405,
ARCoreProvider_get_cpuImageApi_m24D27620E1001943EF0A520D1D3DD21D08BDBFF1,
ARCoreProvider__ctor_mB3641D95DB0A7353E5F3C987660BA2282151A3A2,
ARCoreProvider_get_currentCamera_mDFD20E6CA1F40F899A04DF4EC99FE4ADED02BF21,
ARCoreProvider_get_requestedCamera_m87CE71EFDF07B0D4A00F4ED55E2F58BBE6FA7B4A,
ARCoreProvider_set_requestedCamera_m20BBB626E437F07057452F1F89441268CA217CA8,
ARCoreProvider_Start_m7622EA81D53C25844D9EC8990A0927D3E144C8EB,
ARCoreProvider_Stop_m28914ABC564DB03341B5FA1B384BBBC2FA5B2689,
ARCoreProvider_Destroy_m97DEF45E2DD070C2DA43C7D0C42B6B119973A484,
ARCoreProvider_TryGetFrame_m5DBFF8050E393426C025DC027812000FDECDCFD5,
ARCoreProvider_get_autoFocusRequested_m1DC365A076DD9E57832CAB0D9C8E3AC31807D317,
ARCoreProvider_set_autoFocusRequested_mC8A88C6393A2738B39DB3DCDB70674BCA83DDC61,
ARCoreProvider_get_autoFocusEnabled_m048D6D0D465785EB8DEFD70BFC57DCFCFF010EDA,
ARCoreProvider_OnBeforeBackgroundRender_m93F93BFCE712FC6CF12F3407DA175A0D1A1BB204,
ARCoreProvider_get_requestedLightEstimation_mA5865DCE9DDC79B34007981126D8C0CC6C0969DF,
ARCoreProvider_set_requestedLightEstimation_m8D927B6282C8DDA7BD4365148AF597EAC02E9E46,
ARCoreProvider_get_currentLightEstimation_mA0829B77045555BF2B50BC73BD536AFF48E789B9,
ARCoreProvider_TryGetIntrinsics_m13E64DDA943B4179334A01D9821C7EB53455EB7D,
ARCoreProvider_GetConfigurations_m9D7C215C704B94C838518874CA90A3B62D7CCCD3,
ARCoreProvider_get_currentConfiguration_mD5373EEAA8C48033E3B2F3D892B0C384E2B9D67C,
ARCoreProvider_set_currentConfiguration_m687F79EC299F69E1A227CE4FE4AE4CE7DC07F305,
ARCoreProvider_GetTextureDescriptors_m3CDF78C26FAD8C70D183EC23001E4BFA872AC4C5,
ARCoreProvider_TryAcquireLatestCpuImage_m092583292CFCF7D6AB32DACA59817991B5644839,
ARCoreProvider_add_m_BeforeGetCameraConfiguration_mB56992655281D83A97D444CDD8CFBCBE843C38AA,
ARCoreProvider_remove_m_BeforeGetCameraConfiguration_mCC65AEBA7C580EF96F2DBE05418BC9674A5EF417,
ARCoreProvider_add_beforeGetCameraConfiguration_mD986481F241B18D60730DE4979BDF5214F614453,
ARCoreProvider_remove_beforeGetCameraConfiguration_m5C92FF8B21BD98B983C858D6707B27E657CF45AC,
ARCoreProvider_OnBeforeGetCameraConfiguration_m2C314F5FC174CB06131BFADE7B5C0378E530C70C,
ARCoreProvider__cctor_m57A7DFB09A89C987C94B948AD7630C78B9138976,
NativeApi_SetOnBeforeGetCameraConfigurationCallback_mEDFAFBB855FB1A7182007E51CC2F751FFCFF4115,
NativeApi_UnityARCore_Camera_Construct_m0517006B7A03A7F856A00902C10D0F44F3D3F3DD,
NativeApi_UnityARCore_Camera_Destruct_mAA40F18C55D3989DC798236D6BBD92AAE0494775,
NativeApi_UnityARCore_Camera_Start_mBD993590EF0176DBC1611E3CC5C35A936EDF6FF3,
NativeApi_UnityARCore_Camera_Stop_mDE9807C0596B52E1E7FAC39ACEE51FB32DBD3856,
NativeApi_UnityARCore_Camera_TryGetFrame_m795C0283BCC4B4795EEADD821756472EBC0BF8AE,
NativeApi_GetAutoFocusEnabled_m4005F7A9E3D05858513773026EA743B4D761D502,
NativeApi_GetCurrentLightEstimation_mAD44109CAF29070B260C3A8A14B94EF0960CF2E2,
NativeApi_UnityARCore_Camera_TryGetIntrinsics_mD48F2AAA82B1B3F25C2642F1826C3FE1DD0A53E6,
NativeApi_UnityARCore_Camera_AcquireConfigurations_m88201D12F6E4084486798C19380A4761AA583E12,
NativeApi_UnityARCore_Camera_ReleaseConfigurations_m0EDBE305F38D43C80C58AAC4F86118569B681058,
NativeApi_UnityARCore_Camera_TryGetCurrentConfiguration_mAA3C4DF7A6CDB9A6EF1506E1EE872CC875220AA1,
NativeApi_UnityARCore_Camera_TrySetCurrentConfiguration_m7AA7ECDC82F2654C2920E0F49D6FA7AF2FDD75ED,
NativeApi_UnityARCore_Camera_AcquireTextureDescriptors_mED6C13F0AF0F2B3F782E403C7F4ABA87F22BC37C,
NativeApi_UnityARCore_Camera_ReleaseTextureDescriptors_m1AB5843A884D1B23C8C7BA3B03153ACACF128A73,
NativeApi_UnityARCore_Camera_ShouldInvertCulling_mA9745C5244B5B03872C157F57F709899C42D4853,
NativeApi_GetCurrentFacingDirection_m1D2C3AF12C8AB513720A5A328ECF27C0F7E5DBBD,
NativeApi_UnityARCore_Camera_GetFenceWaitHandler_mE3322D48FE63CFCF29B7AB0911962A9D3112E5E2,
ARCoreCpuImageApi_get_instance_m5B9C701B0F5012FC10378257D6D2C1AC4E2D3AFA,
ARCoreCpuImageApi_TryAcquireLatestImage_m990C9DF992F56F6B2B0534A3346876B92578C618,
ARCoreCpuImageApi_GetAsyncRequestStatus_m3353734BAFE73783A6400AE409D99D4BD6F95261,
ARCoreCpuImageApi_DisposeImage_mB7DFA6357901007B40AB836685665DF868A50A48,
ARCoreCpuImageApi_DisposeAsyncRequest_m1C836B0DFC1351EC84ED75B00C72B36B878E7208,
ARCoreCpuImageApi_TryGetPlane_m9336AE63158D11FCB0454F8D984B0AA7EF1F07E2,
ARCoreCpuImageApi_NativeHandleValid_m0A091EF7277486E0AA8CD4AE07DA678D166F73E9,
ARCoreCpuImageApi_TryGetConvertedDataSize_m2CBCAFAABF0F11B1F5E822CC68B76DF46419D95A,
ARCoreCpuImageApi_TryConvert_m73099E871C6073CF094D502ACEA729F7608F791E,
ARCoreCpuImageApi_ConvertAsync_m47508107848E58A4F8D3E2A7269E13253D357BED,
ARCoreCpuImageApi_TryGetAsyncRequestData_m3518605946425B8BBF80F7B97384F561DB95E9B5,
ARCoreCpuImageApi_ConvertAsync_mCB3F9F6299DB7CF6812DC1E1FDC38E5A891563D0,
ARCoreCpuImageApi_FormatSupported_m668336D4CFC1D2A98637ED8524387E67267967E1,
ARCoreCpuImageApi__ctor_m16F0D8727C47B3BCAA39133E46AF6199C646F427,
ARCoreCpuImageApi__cctor_m9569623A711FF42A34490708A84FAE447E6C50FE,
NativeApi_UnityARCore_CpuImage_TryAcquireLatestImage_m0ED2AC947A04B999988DCD288B70039F36230193,
NativeApi_UnityARCore_CpuImage_GetAsyncRequestStatus_m74BC9ED8D99D2314E91D2B42B14CE64907282695,
NativeApi_UnityARCore_CpuImage_DisposeImage_m89126F9420E46C87C6C4C56EC597AFFEB999F402,
NativeApi_UnityARCore_CpuImage_DisposeAsyncRequest_m52544AA6CD2A4BA5EF05618DD817B29F32BB935C,
NativeApi_UnityARCore_CpuImage_TryGetPlane_mA41D41E304473D93D188FB19D7AC3387F5464287,
NativeApi_UnityARCore_CpuImage_HandleValid_m9756C7954034342D4A452EBBE643D3E0237418AC,
NativeApi_UnityARCore_CpuImage_TryGetConvertedDataSize_m08F8699C0D6087D03F6751460969674DD9E18348,
NativeApi_UnityARCore_CpuImage_TryConvert_mD3D818D20CB3A82F9670C56D201374BDD1B5D3E1,
NativeApi_UnityARCore_CpuImage_CreateAsyncConversionRequest_m951F2FAFED83B60872A2C386D8B2D3FF6BB5C1B4,
NativeApi_UnityARCore_CpuImage_TryGetAsyncRequestData_m74E67E13997DC51C477393CC17D4B7C43796326A,
NativeApi_UnityARCore_CpuImage_CreateAsyncConversionRequestWithCallback_mB8EAAEE8C4E29CC301C10F6C497D70F44A44002F,
ARCoreEnvironmentProbeSubsystem_Register_mCAD9D9C619F453F702B47994D465E6EB2974E729,
ARCoreEnvironmentProbeSubsystem__ctor_m89DECFC44829DEFA9B37B205F2DCD73080ED78B0,
ARCoreProvider__ctor_mA174658BF6BFB950970E9076BB5F166FE696C264,
ARCoreProvider_Start_mD152BD0A62302F3C7AEFB38AB10BDE64D25CDF73,
ARCoreProvider_Stop_mF4D5343658FFDA68F481D8E998C8859B05E5A353,
ARCoreProvider_Destroy_m10827FBF253B47F6B6134DC64DBB0A0D6E43F8AD,
ARCoreProvider_get_automaticPlacementRequested_m8DB8F64671B4DD9C57A7FE7B42F0595E681AC456,
ARCoreProvider_set_automaticPlacementRequested_m18F7D90E52BBE1656F004B3CAA4F6CBF9B5000D4,
ARCoreProvider_get_automaticPlacementEnabled_m60D0A0EA74B9C86D7F0EFBF02BF0CA385A2CBC1F,
ARCoreProvider_get_environmentTextureHDRRequested_mC7E1DEED9E31F26A4089FDCC7BF7DB10352A5732,
ARCoreProvider_set_environmentTextureHDRRequested_mB9DFB8284C97AC4D77505C872D3E471C436C77E8,
ARCoreProvider_get_environmentTextureHDREnabled_m7F547DA0179CEBE47CA9A123E2D01007F8429F3F,
ARCoreProvider_GetChanges_mAC7FEC7A1AD00B7207342CDD2654505031F48728,
NativeApi_UnityARCore_EnvironmentProbeProvider_Construct_m1BDEC676C3C3ACE65AF627728975777AB2FC4B07,
NativeApi_UnityARCore_EnvironmentProbeProvider_Start_mB77C2D91570EB2198B3969E500E0C403CB7BA327,
NativeApi_UnityARCore_EnvironmentProbeProvider_Stop_mF4E2242B94F51D2F7B5AB7FAE3944001D37DB807,
NativeApi_UnityARCore_EnvironmentProbeProvider_Destroy_m26B2CF5A7270EC1B4ADA5DA0498B2906BAC2F7AE,
NativeApi_UnityARCore_EnvironmentProbeProvider_SetAutomaticPlacementEnabled_m448DB924ECDB549D59DC594236E8B0929042BB19,
NativeApi_UnityARCore_EnvironmentProbeProvider_TrySetEnvironmentTextureHDREnabled_mACF1FE1A5AF1B821B585E3139902513FB63C7803,
NativeApi_UnityARCore_EnvironmentProbeProvider_GetChanges_m04B26BB3BF9EAF45CF42F3DF97BEBB4B4B747688,
ARCoreFaceRegionData_get_region_m7CD0AB1C423FD7A964F41C4CCCD14857C08177FE,
ARCoreFaceRegionData_get_pose_m8B0A57A837D75EC314AE73F2931075A0F10A3775,
ARCoreFaceRegionData__ctor_m589405112E30EB33BE5D5E10C0F5CC67D24FBB49,
ARCoreFaceRegionData_Equals_m2056862DD1AD264FBDD1C54E254871098B6995DC,
ARCoreFaceRegionData_GetHashCode_mC1E01B54503EADB48B6927CF2074C7FA4D426ECE,
ARCoreFaceRegionData_Equals_m17225C794C37005208BCDAAEB9DDE4F9B664D126,
ARCoreFaceRegionData_ToString_m01A02559D50A9AB69A98601C0DC8E707ECDDB02F,
ARCoreFaceRegionData_op_Equality_mF6F5B7089D3C94AEFA28DF8F33EA1DAC8651854C,
ARCoreFaceRegionData_op_Inequality_mEEC847F643FBEE49A1DFBB5536B3145430108FCB,
ARCoreFaceSubsystem_GetRegionPoses_m86783D41F79D1D4E8811CABE414E1F12437F21C5,
ARCoreFaceSubsystem_UnityARCore_faceTracking_Start_mCAA8106354E3539174AEB5B9A7D9EC8D80D6A0D8,
ARCoreFaceSubsystem_UnityARCore_faceTracking_Stop_mDF758DBD00B884036ECDDA44684DB309D6AAF777,
ARCoreFaceSubsystem_UnityARCore_faceTracking_Destroy_m2C02A75C6C59CF424B212450B1660916C1C81380,
ARCoreFaceSubsystem_UnityARCore_faceTracking_TryGetFaceData_m9F117AA3A29554900494235EA1F41602CC059015,
ARCoreFaceSubsystem_UnityARCore_faceTracking_AcquireChanges_m3D7B9907A222926FA9A545C6B9979343FC2013DF,
ARCoreFaceSubsystem_UnityARCore_faceTracking_ReleaseChanges_mE975B10D5BF9D1AE1D447741BED766AB0C1B5A49,
ARCoreFaceSubsystem_UnityARCore_faceTracking_acquireRegions_mEDFC7BC2E6FAB18E8D8735FA1846523F491F24B0,
ARCoreFaceSubsystem_UnityARCore_faceTracking_deallocateTemp_mE14A581F67225A4D33059B3F7777C91377E64D63,
ARCoreFaceSubsystem_RegisterDescriptor_m424198963114A2E00F811D5ABB02B323933AF9DC,
ARCoreFaceSubsystem__ctor_mE994B52DC28CB49FDBC336E54C3510FEDF663138,
ARCorePose__ctor_m1328D26F798D034CBD7F0402528B873D5994D5AF,
FaceRegionWithARCorePose__ctor_m1021176D2016468413133E87B6F50884A240E76D,
TransformPoseJob_Execute_m7EBE008B308EEF99D66204836A8954E1C6F6F1D3,
ARCoreProvider_Start_m674E115A338FF9DABC486AEF8E2B2B469D68452C,
ARCoreProvider_Stop_m67BF08E9D1BA2C4C31060C97F2B6324AF74FA4DF,
ARCoreProvider_Destroy_m3B9CEC2B8C99C1AB440C8434965D002153639BE5,
ARCoreProvider_GetFaceMesh_mE8C775C1B20E2648524995615154E24D8312559D,
ARCoreProvider_GetChanges_m3F0274A1E1E2BCFACB2CB91032CD40ACE21E2710,
ARCoreProvider__ctor_m7212DC6DFC295E14FECF45D31586ED62BE00E52D,
TransformVerticesJob_Execute_mB25F13AA4AB3152365B51B0C2ACA31FFC756D74F,
TransformUVsJob_Execute_m3A9C954126E9929C947C66111DC50B1A4EB8478A,
NULL,
TransformIndicesJob_Execute_m20C5A48E77A83348D5BD86AD436EBC581C5F0AAB,
ARCoreImageDatabase_GetLibraryData_m09B32DB063E260028276620B3FD92544BF56B657,
ARCoreImageDatabase__ctor_m088924D76C9D933AAD4ACAA904D5077384B9FBE5,
ARCoreImageDatabase_op_Explicit_mB2B13A4132FAD73DFF2DBAFFD4FB5D1752B57AF8,
ARCoreImageDatabase_Finalize_m1A668727FF90C396A2501036A38C4BA412212F8F,
ARCoreImageDatabase_get_supportsValidation_mCD44728F3EBAD0F56E9B016C009DAADFDB6E3379,
ARCoreImageDatabase_get_supportedTextureFormatCount_mAED9D8669DE36B2AA73C7143C24BD620548ABC52,
ARCoreImageDatabase_GetSupportedTextureFormatAtImpl_m1D2F965E4E7F58B0FE7BA6262ECBC994F73BE9C2,
ARCoreImageDatabase_GetAddReferenceImageJobStatus_m1BBD7DD51F11B3FD80A4E0CD21D085399471BEB7,
ARCoreImageDatabase_GetUTF8Bytes_mDF50981E4D87ABAC80566B234E197207BCD4074A,
ARCoreImageDatabase_ScheduleAddImageWithValidationJobImpl_m8458FC816306C31C531AEDF9342441B13FE85577,
ARCoreImageDatabase_ScheduleAddImageJobImpl_m443DE86ADBC43475425A2C26ABE5EC6B3D78FA20,
ARCoreImageDatabase_GetReferenceImageAt_m9319449DB183EAA9CB1F16CDF886E7601B798E56,
ARCoreImageDatabase_get_count_m97A7B403F0B4544C7CD6DE8B860DBEA9AB1E4F99,
ARCoreImageDatabase_GetHashCode_mA4D7878527E9FC94B5F3AFD8E946C7CBBDDA6DC2,
ARCoreImageDatabase_Equals_m49780C2062A4B7D7A72D24F93B242DBC1CC8336C,
ARCoreImageDatabase_Equals_m00A589ECD8847528CCA00E2AC42863D9437C492E,
ARCoreImageDatabase_op_Equality_mAFA987BAAC11A64987131EE3D909D4315F84717C,
ARCoreImageDatabase_op_Inequality_m8AF7BAADDE5543D1A217B7E0E1310D1F8105A34C,
ARCoreImageDatabase_GetReferenceImage_m9616BA3F15A866F3460D306D53E83615AC2D12DB,
ARCoreImageDatabase_GetReferenceImageCount_mC6F29847B98972FBA7DB3151EA3DC481123E8981,
ARCoreImageDatabase_Deserialize_m445DB9A6898B8F2CDA2EF2C83609EAEC05B82E0C,
ARCoreImageDatabase_CreateValidator_mC2D9A0DA9FD2C1998A80E6CF973C8E5AA773E939,
ARCoreImageDatabase_GetStatus_m4FC25E68348C5F3B80317D72D2ADFA7511F41C6F,
ARCoreImageDatabase__cctor_mA4B4303F9D54DDF2957F1C5226201D614FC99324,
AddImageJob_Execute_mFF2FF44D70D3647AF25843519E6B767A99BAAF36,
AddImageJob_AddImage_mD2622F0CCF10A5990A7BB922A8A7B44B1B54A853,
ARCoreImageTrackingProvider__ctor_m3723734EBBE4F0EF169C7E2F50F01CF2904E4F2C,
ARCoreImageTrackingSubsystem_GetPathForLibrary_mDA79328E2F862A0CA781C6E03B8ACE0F59C096AB,
ARCoreImageTrackingSubsystem_RegisterDescriptor_m9207361727119F670A8BD7475DEF31E6F46640CA,
ARCoreImageTrackingSubsystem__ctor_m8B8F027237262EB2944D5678C3B5FEF4389A20C5,
ARCoreImageTrackingSubsystem__cctor_mEF7EFD589F13293724E4C0390EABF44D015E525E,
ARCoreProvider_Start_m95DD106DD54DAAEE54CA17B159AFF4331272FCCC,
ARCoreProvider_Stop_mEDF427A8C78A9AE6C0F91AD82FC0BC92E127C728,
ARCoreProvider_set_imageLibrary_m5E48BF05853F210F48F84F820AE48C4B02A63633,
ARCoreProvider_CreateRuntimeLibrary_m578F5264A70564E1A0B21D060F40CEA4C15657B7,
ARCoreProvider_GetChanges_mBD6B8435337693F22D58AC045B036DB668985F37,
ARCoreProvider_Destroy_m3CAE3DD73B251AADAAA18E255A50D979BDD4574E,
ARCoreProvider_get_requestedMaxNumberOfMovingImages_m9136442725D06CDB5469F07BAF880A163B70266B,
ARCoreProvider_set_requestedMaxNumberOfMovingImages_m75E4CAEB39E571F7F50F0D77AAF134DC8466912C,
ARCoreProvider_get_currentMaxNumberOfMovingImages_m40F817E6DB85D560F08C853FA45E9B15AE4D8E90,
ARCoreProvider_UnityARCore_imageTracking_setDatabase_m36BC5D81616450BA54F49F948EDAAA8B85A32F99,
ARCoreProvider_UnityARCore_imageTracking_destroy_mA72B87FC060A88E0AFC3D5F102282C225B07E097,
ARCoreProvider_UnityARCore_imageTracking_acquireChanges_m31E4F3E57692882A54F769D2E0FB9B0FCEAE68E8,
ARCoreProvider_UnityARCore_imageTracking_releaseChanges_m46F194D4DD7AAA080EC24E4611C0CC31F5D7AA61,
ARCoreProvider_GetNumberOfTrackedImages_mCA15E49A92B4C043D053612CA27041AC0E229501,
ARCoreProvider__ctor_m6D2C8A015DB244077C5C82EA873B7AEE23DC926C,
ARCoreLoader_get_sessionSubsystem_mB719854EF11ED7529B060881E078347967098818,
ARCoreLoader_get_cameraSubsystem_mA7423C7021CC4D3D47589BB1374C8C3D2FFAFC5F,
ARCoreLoader_get_depthSubsystem_m3ED669F0F0517001E746FC4E4CC5E1B5816DD9CD,
ARCoreLoader_get_planeSubsystem_m795EB938590D1B0D3ACF396C6EF51CCE279D311A,
ARCoreLoader_get_anchorSubsystem_mC42CCAA64AA29DB7E7AC0D76B6D3979935807A31,
ARCoreLoader_get_raycastSubsystem_m908C2D2156F387879196FA0ADF530EB02366F6BF,
ARCoreLoader_get_imageTrackingSubsystem_m3DBC8FB6CAEF6D6BEFC56115C1611BB515647190,
ARCoreLoader_get_inputSubsystem_mC96B3C65EF908BE1E4B5CC5F3F9C27631C314242,
ARCoreLoader_get_faceSubsystem_mBE92A8D0FA340647A4BBED7D37EE3E753A4022D5,
ARCoreLoader_get_environmentProbeSubsystem_m3BF82CA0654C4963BAB3C41DC8CD3CE488C7135E,
ARCoreLoader_get_occlusionSubsystem_m20523A3C486A422505823C97EABC56AF165358F0,
ARCoreLoader_Initialize_m7958140B0AD77F780834F1CB4CE76468A1A4EB1F,
ARCoreLoader_Start_mC2E2B5ED50FD4747F02545B18115DDC30DA4F924,
ARCoreLoader_Stop_mF234BEB25E607B591CADD9C0AAF511F5F162C9DD,
ARCoreLoader_Deinitialize_m34E45DD93616D53D953992DB28C1C379CE69DEAF,
ARCoreLoader__ctor_mA1E8D67717DEB72A3CEEEF54E8F360B2EAAAF1AF,
ARCoreLoader__cctor_m8EEC8C4AB4C66FF792C43DDCFBC1F952A6EBF837,
ARCoreLoaderSettings__ctor_mBBD3002FC45E720F566E60290D60C3C332739AC9,
ARCoreOcclusionSubsystem_Register_m0BA27DC58FB4D824542DEEB092541C535ABF06C4,
ARCoreOcclusionSubsystem__ctor_m16B5A395AC5676532E8AEBF4360F919348883755,
ARCoreProvider__ctor_m740EFF84FFF6B9B2C7C4FD5F28A95A78568D2AE7,
ARCoreProvider_Start_m75EEF8FA8584F7501A752662804FB39A888552D7,
ARCoreProvider_Stop_m748C215A4A853B42DFC52A223F826A9DD7E638F2,
ARCoreProvider_Destroy_m1FB0B254074AF688C79F6CBC4F313AF374003F47,
ARCoreProvider_get_requestedEnvironmentDepthMode_m7285AE1918DD6EF69250D54747E7620CA6FA9166,
ARCoreProvider_set_requestedEnvironmentDepthMode_m4284137A5F92528C355BB811D43624F722EE3CD3,
ARCoreProvider_get_currentEnvironmentDepthMode_m13ECB4DF298101AD41CCF0A5EF8F465B029F8B61,
ARCoreProvider_get_environmentDepthTemporalSmoothingEnabled_m0AAA4E5B48A1217AEC938D2E6F51982382737322,
ARCoreProvider_get_environmentDepthTemporalSmoothingRequested_m7BE8092F27B40CE259C447BDFA11D3B031EA0645,
ARCoreProvider_set_environmentDepthTemporalSmoothingRequested_m35D777A806EBC1F3380775E872707026BF49016F,
ARCoreProvider_TryGetEnvironmentDepth_m78238FE8CD7D4AAE21D15E288563FFFA94E50890,
ARCoreProvider_TryAcquireEnvironmentDepthCpuImage_m425D9F8AE24B409C5BDF7E959B30245A9336AE23,
ARCoreProvider_TryAcquireRawEnvironmentDepthCpuImage_m438FEF338186F8B8D9CF5587B30318168D3C7407,
ARCoreProvider_TryAcquireSmoothedEnvironmentDepthCpuImage_m90DF281C8FBC87903E3BA776A46F3B6F0F11C22F,
ARCoreProvider_get_environmentDepthCpuImageApi_m61FB1F4AE16ABCA3AA8A07DCCBB149603E7137B7,
ARCoreProvider_TryGetEnvironmentDepthConfidence_m944FA850E27746FE2B692979C35BC4EB1C3B21BC,
ARCoreProvider_TryAcquireEnvironmentDepthConfidenceCpuImage_mB3A215787E01AF6E90DE3E35D23A3E5EFA627F83,
ARCoreProvider_get_environmentDepthConfidenceCpuImageApi_mA3E737368FBC38050E3620505E826949899B1F36,
ARCoreProvider_GetTextureDescriptors_m93940B7502A6A2E218259EF3B26C2ABEA5114070,
ARCoreProvider_GetMaterialKeywords_m830087C8188384A42E71AAA5B2B09C97BCA5D73A,
ARCoreProvider__cctor_mED1B1180C2800E7B16CDC99112FD708B25CF6D54,
NativeApi_UnityARCore_OcclusionProvider_DoesSupportEnvironmentDepth_m50EAA4F6C8B907A90583D95576268969BED53838,
NativeApi_UnityARCore_OcclusionProvider_Construct_m8FCDBA2D3F3EB61E04C220AF2AC50FDF54283292,
NativeApi_UnityARCore_OcclusionProvider_Start_m56923FBD75E7E7C68AEFD78EC09AF6F09DBE15D0,
NativeApi_UnityARCore_OcclusionProvider_Stop_mF642AEFCEEE2A62323C9F73C07C4888F776F9697,
NativeApi_UnityARCore_OcclusionProvider_Destruct_m1D048734A723C4CE7D6CE91EC70C178A38B163E7,
NativeApi_UnityARCore_OcclusionProvider_GetRequestedEnvironmentDepthMode_m1ED900D8AD45D1472042A171C12D38BB297D4DF6,
NativeApi_UnityARCore_OcclusionProvider_SetRequestedEnvironmentDepthMode_mA766ADC677847B1BEF1DCBB1C915E672A3AF0976,
NativeApi_UnityARCore_OcclusionProvider_GetCurrentEnvironmentDepthMode_m396A1E71F487E2CB7E726BDBCA9DB5F6F2FEA5C8,
NativeApi_UnityARCore_OcclusionProvider_TryGetEnvironmentDepth_m4E7B3BB56CEFAAF46BE4E970ECB4289AAB133874,
NativeApi_UnityARCore_OcclusionProvider_AcquireTextureDescriptors_m03EC98586480BD0563208632F69F86290FE70E03,
NativeApi_UnityARCore_OcclusionProvider_ReleaseTextureDescriptors_mF948E01FE0E4B0A2FF5D0AD23B03A125949C4E60,
NativeApi_UnityARCore_OcclusionProvider_IsEnvironmentDepthEnabled_m998A83A2409FEAA5E5342FB03A536B80B4A8BF46,
NativeApi_UnityARCore_OcclusionProvider_GetEnvironmentDepthTemporalSmoothingEnabled_m20341EE9585DB0AAFCB9BF9B03F099BBD8F1F8DB,
NativeApi_UnityARCore_OcclusionProvider_TryGetEnvironmentDepthConfidence_mB7F68F009E707CF7080BB5FAE70252D3256FF94A,
ARCorePermissionManager_IsPermissionGranted_m25B8E28D19B5C41A1EBC6BE59883F2B16D1BABA1,
ARCorePermissionManager_RequestPermission_mB489AC1E1323A7943E7E353159373107C5746A48,
ARCorePermissionManager_OnPermissionGranted_m6F977C06DFFDA17DB3D82BDD28EBA57ADAE68FD5,
ARCorePermissionManager_OnPermissionDenied_m84D8B52092834DE931A3D6F8C0AE7F56FAA75091,
ARCorePermissionManager_OnActivityResult_m7FBB087DEC75D2315A9D06FA5D4A5C238096BB2B,
ARCorePermissionManager__ctor_m995B52F67EB43FB3BBDC858DFDA0C6FD5D1293AC,
ARCorePermissionManager_get_instance_m4D7BE6B8462B41D65B58AB757C37962AFFB02E2F,
ARCorePermissionManager_get_activity_m90003FAD75C18019B97172A412136B4CB87D6BFC,
ARCorePermissionManager_get_permissionsService_mF404525CE335D896696FB973195D84558CADE4EC,
ARCorePermissionManager__cctor_m8EDF11C1CB83D6B33640F8DDA06C48726E331CF6,
ARCorePlaneProvider__ctor_m5F934EED6F89578541F5E9C0586DC2902B2A41FB,
ARCorePlaneSubsystem_RegisterDescriptor_m58E0D2BBAC2CE029CED4643F99F0F387A552C0DE,
ARCorePlaneSubsystem__ctor_m1F0CD932244651913C931C181530A3FC960B65D7,
ARCoreProvider_Start_m7595EF6D1E7A0E2C7D6ADC620BDA5FDB21320E8E,
ARCoreProvider_Stop_mA8989B03BBF873DA74AD51D17C3E7AA0A5A8C5EF,
ARCoreProvider_GetBoundary_m8ED3BC09C3970185A93CEB06B1B2A63868CC7588,
ARCoreProvider_GetChanges_mD605EB86F5978B7A8B2DC635138BA1ABB95634EF,
ARCoreProvider_Destroy_m89EE9E1820BAD6DFDD0F87BCE4515DDAB3E89E57,
ARCoreProvider_get_requestedPlaneDetectionMode_m39697C78C2C6A8644CC860B4D94C4C68B647B19F,
ARCoreProvider_set_requestedPlaneDetectionMode_mF523936701717C8EC4B55E19024933A549A535D3,
ARCoreProvider_get_currentPlaneDetectionMode_m2C19714D6760548615A29FC3D3945A008EC1A973,
ARCoreProvider_UnityARCore_planeTracking_startTracking_m43961D18BB4347A1DA73255350AE019047C3F47A,
ARCoreProvider_UnityARCore_planeTracking_stopTracking_m2A2C678E6066850CF7897AD926083D3A9CFBCA36,
ARCoreProvider_UnityARCore_planeTracking_acquireChanges_mF1CC91EAF5C0A4DC0560D014FA79A3F2F1974DFE,
ARCoreProvider_UnityARCore_planeTracking_releaseChanges_m78BA280D5131A19A845AC7987D0DE017EEC4F9BA,
ARCoreProvider_GetRequestedPlaneDetectionMode_m24A46AE0238BCC7978880D9C2FB272F7B022E752,
ARCoreProvider_SetRequestedPlaneDetectionMode_m55D6003C240EFCC1E7B46E98E1A2EBA410B42B85,
ARCoreProvider_GetCurrentPlaneDetectionMode_m8E5F857E7A295412B449A6AC48AD2F2A78CEA782,
ARCoreProvider_UnityARCore_planeTracking_destroy_m122DD7EA315470EA8349426FB84083D464988B67,
ARCoreProvider_UnityARCore_planeTracking_acquireBoundary_m97E1FECBEA8912A125081A810B56A987AF520469,
ARCoreProvider_UnityARCore_planeTracking_tryCopyBoundary_m14B963060CC277350127E15999245256447E30A9,
ARCoreProvider__ctor_mCBE59A924070B5444C25F0DDBE7F1D05E118EAA2,
FlipBoundaryWindingJob_Execute_m1A3A43413FBCA81A1ABDC145DC35AA533E86BC9D,
FlipBoundaryHandednessJob_Execute_mBDA83F26E0D4DE330FB14E62DDFB7A52219B8CA9,
NULL,
NULL,
NULL,
ARCoreRaycastSubsystem_RegisterDescriptor_mDD54FF0A77EC2A3DC0D6C2FE4A9B4CD236E6CEDF,
ARCoreRaycastSubsystem__ctor_mC3D3E27326C788CF7404644A8041D2BCB6FFF2ED,
ARCoreProvider_Start_m2C3CFF618C62BC4DB9A1DAB8A23B0407E0E1FE88,
ARCoreProvider_Stop_m6DE4D49F0BD5C936116DCDD2371700266568E58F,
ARCoreProvider_Destroy_m3FDF8D419C9B3A7BBBE1ABA88A4588DCCB2C372B,
ARCoreProvider_GetChanges_m629D4E64616243D68CA87318EC5346E4122FED72,
ARCoreProvider_TryAddRaycast_m30632AD57E0DAD3CE858EAB81353D8FE151F4541,
ARCoreProvider_RemoveRaycast_m8A81C2C1BAEFEA1EF19764853ABC215D5C67F866,
ARCoreProvider_Raycast_mEEE649E1F6280D29A8623F617D87E406E5C86509,
ARCoreProvider_Raycast_mBF08914AA765BA9C84A022D8E0F04A8B3DCAB105,
ARCoreProvider_UnityARCore_raycast_acquireHitResults_mC8535E0A7DDD2EECA1E6E43A4F2413FD3792E93C,
ARCoreProvider_UnityARCore_raycast_acquireHitResultsRay_m2843461933333E37442B0AC815AD2EB66DC72158,
ARCoreProvider_UnityARCore_raycast_releaseHitResults_m29B6961D52EE0B40FF2618698F7A20F6D8A3E807,
ARCoreProvider_UnityARCore_raycast_tryAddRaycast_m1DC1F4DD474422F9072C758DAF5C193CD25556C8,
ARCoreProvider_UnityARCore_raycast_removeRaycast_mDD035162FABEF90686EF988CB7E91FAD667A58B9,
ARCoreProvider_UnityARCore_raycast_startTracking_m50F8B4931725DDD8C114688E653F2D65315D4B4A,
ARCoreProvider_UnityARCore_raycast_stopTracking_mFFC1AE64E4A37D0EF5C5206D454339861B32D0B2,
ARCoreProvider_UnityARCore_raycast_acquireChanges_m7DBBA926EEDE6FC01400E90E3EA3AE673F57A2CB,
ARCoreProvider_UnityARCore_raycast_releaseChanges_mC9360EB666186079E87C70C36AFFC07EF69BDEF3,
ARCoreProvider_UnityARCore_raycast_destroy_m05A5F0011882F8D5E90876A5C0BEA1D6D0AEC22A,
ARCoreProvider__ctor_mCEED9DE66DCD9BB6AB1F30F80AD6044DF568C209,
ARCoreSessionSubsystem_OnCreate_mF8F1CEBDBBA6C5EB2DE36E7DF3FC114415BB4536,
ARCoreSessionSubsystem_ConfigurationChangedFromProvider_mCDCA9342D2919733A299E64B3DBF4F908C048722,
ARCoreSessionSubsystem_SetConfigurationDirty_m589BAB1CB66E9C17CFEF26FADC620AC122AAFA10,
ARCoreSessionSubsystem_get_session_m30DEF5F507F37ADBA33992040DF96C29A035DE20,
ARCoreSessionSubsystem_StartRecording_m5FEAD096A36F54B317747AC4C7CDFCEED5D73930,
ARCoreSessionSubsystem_StopRecording_m80EBB7C1996C30ACBCF2AD953FA340F2CCC9D00A,
ARCoreSessionSubsystem_StartPlayback_mAD4B827E1C37E2BDC536D93A624A8CA4DFA1FBBE,
ARCoreSessionSubsystem_StopPlayback_mB7CCEABF538062686665646E7CD89AA6DAAADD63,
ARCoreSessionSubsystem_get_recordingStatus_m407E01258C262F5FF877D8E4BCB52C97AF3431D9,
ARCoreSessionSubsystem_get_playbackStatus_mB849FC26DC9496B81C9B3FEE9BE3352AFD2AA9C7,
ARCoreSessionSubsystem_add_beforeSetConfiguration_mA1649A6E88E8D431B34DC24E6E8C171D8F957B6A,
ARCoreSessionSubsystem_remove_beforeSetConfiguration_m21286B32C3760C722A3820C34A5F202C6CD67F16,
ARCoreSessionSubsystem_RegisterDescriptor_m337F5E521FF309C976A81D092E59A77B64CD6201,
ARCoreSessionSubsystem__ctor_m5B001429D8D5F84602D8D9B80B1CF759BA0E108E,
ARCoreProvider_SetPlaybackDataset_mA5007E7F4190891CBCD26808D1C384940F65D111,
ARCoreProvider__ctor_m4ED89ECF6C019BEEED85579209B5949941D4829D,
ARCoreProvider_Start_mEE70994E30DE0D74573DC0B4581D478EEF5214CB,
ARCoreProvider_Stop_m6289CF316BA0BECFC520FFAC102ED245BD242711,
ARCoreProvider_Update_m1DD2D8BEB10DDDBE586ADF2833C7E31AE18776CB,
ARCoreProvider_StartRecording_m2083E756A5F0C25B984A2D457DCC71790A190D26,
ARCoreProvider_StopRecording_m7C7E4B579AA98397137BCC25C8B4F69A88AEE115,
ARCoreProvider_get_recordingStatus_mFDA170E040FD1AAFBCC0BB35A52E23030A0A7D76,
ARCoreProvider_get_playbackStatus_mB42156FBF5149C57277A8D5EA77D414328411B4A,
ARCoreProvider_get_session_m2FF87072719F576B2C36DF66A1AAA185E493646C,
ARCoreProvider_GetConfigurationDescriptors_m4738ABEFDAB96DFFA917C9DD12113E29A2D955E2,
ARCoreProvider_add_beforeSetConfiguration_m7782F6ED649007DE9D8526072F90B03335EE5E24,
ARCoreProvider_remove_beforeSetConfiguration_m31C541FCAAC258A6529E5D1F67633C7D0C241840,
ARCoreProvider_SetConfigurationCallback_m21110C590C44E78936908B4D2198452803E2330B,
ARCoreProvider_Destroy_mC45316C60AC9FB9BF1418DB042F2BB8FA09D44ED,
ARCoreProvider_Reset_m4904D98C5694D128705E3B4FFB7B2806340A11AD,
ARCoreProvider_OnApplicationPause_m602CC93754E61B3EBBF3BE77BC1C6DFCE607E0B9,
ARCoreProvider_OnApplicationResume_mC57FD74CC28674FD9F27CDFC89D48544101797CA,
ARCoreProvider_GetAvailabilityAsync_m979FCD1FFFAFB2C5040E4BFE327677F3C80D6CBF,
ARCoreProvider_InstallAsync_m168BAF5F2DE9C10641C221D995E21AB9788CF181,
ARCoreProvider_get_nativePtr_mF93BE814C215A6AFC2F61A7674370E8B48C58CD5,
ARCoreProvider_get_trackingState_mEC4ED0D514E183E746B13D33E18013F3C262380A,
ARCoreProvider_get_notTrackingReason_mB7E41389B11F85EEFD09F70CD3C9547690E9B1DC,
ARCoreProvider_get_requestedFeatures_m6FEF431FD8F404DFB3C4D123CE6F29FFD0ECF581,
ARCoreProvider_get_requestedTrackingMode_m5A589D5586E0010B62CBDC7C1A2A904F53920E24,
ARCoreProvider_set_requestedTrackingMode_mE071EC7020FD5FE2DE9716583CDC0785B7C294D4,
ARCoreProvider_get_currentTrackingMode_m7787C51BDAEC4C0BECCF949E5167EA9CE2B167F2,
ARCoreProvider_get_matchFrameRateEnabled_m69389E0BF3F0C505377DD41CFD76D6A1171A4336,
ARCoreProvider_get_matchFrameRateRequested_mFAA42AF98B9E52864A2580A4BA69A7F032AA8DD1,
ARCoreProvider_set_matchFrameRateRequested_m4E81D03C9640EC1026C30982C6F9E4D51A3F40F3,
ARCoreProvider_get_frameRate_mA33383747900A3E5A6303CD8B1369E59EE982D25,
NULL,
ARCoreProvider_OnApkInstallation_mE3B31805C325D8C7F0FC2BC00F8249A759AE5B98,
ARCoreProvider_OnCheckApkAvailability_m0C786C7B24238176AC42E8CEF62BA1D84EB9C1DB,
ARCoreProvider_CameraPermissionRequestProvider_m52520DB26683512123C6B56B7E2A28269DF7C310,
NULL,
ARCoreProvider_IssueRenderEventAndWaitForCompletion_mE8F32C2E68F7720D35BD8E2588D711F37DEDA45F,
ARCoreProvider_CreateTexture_m2276885716E7619E56DE079F26F3BCD9A8DB0F19,
ARCoreProvider_DeleteTexture_mA1B6EF45277ED86092FA33651D3E71B757D2765E,
U3CU3Ec__cctor_m4A13C36A2DF38460379152261D45F482872D0043,
U3CU3Ec__ctor_m3637F367C80968CD4BF62CC49619A5E47A405FF7,
U3CU3Ec_U3CGetAvailabilityAsyncU3Eb__24_0_m1C4FCBC446E6CE9AA042D2D5C302A7C55C73917C,
U3CU3Ec_U3CInstallAsyncU3Eb__25_0_m733F2E5B5EE87A2217388F6D03CE104E7EEFF2EA,
U3CU3Ec__DisplayClass49_0__ctor_m117E39D5AB1AD3E8F62AAEBF1A7CBF5FD674C8B8,
U3CU3Ec__DisplayClass49_0_U3CCameraPermissionRequestProviderU3Eb__0_m1552073AEBE7BE5A0FEEFC21A5474D71687EC66F,
NativeApi_UnityARCore_session_getNativePtr_m2CB6F0392DD51B4B60110824545C93B2831975D1,
NativeApi_ArPresto_checkApkAvailability_mDFA94461C41E99996AD28EFD11AAFFBA0E0951D7,
NativeApi_ArPresto_requestApkInstallation_m991347A021A41EA22FFE857F078CDE9B9BF751FB,
NativeApi_UnityARCore_session_update_m8151C99662460FB0FAA0F4634467DB5C2B619184,
NativeApi_UnityARCore_session_getConfigurationDescriptors_m924A443FFEE770DE222C1271F790F2C53E2458D5,
NativeApi_UnityARCore_session_construct_m171873253E4D8D8737F1FC498F0A3F67FF184AA4,
NativeApi_UnityARCore_session_destroy_mEB1AE84A44EBAE3F809AC34346EF2C9986080E08,
NativeApi_UnityARCore_session_resume_mF228DF0E287D9412E143626EA26C67525FFC5598,
NativeApi_UnityARCore_session_pause_m03EC1D9DFBD0BE7B520478B2B1033BEFEF153F54,
NativeApi_IsPauseDesired_mF2CA79D0E3CB0CA7282253BCBAD325DEB8B84B03,
NativeApi_UnityARCore_session_onApplicationResume_mA4D68B2A905D8CBDC015A00B17F22E031F5E0A47,
NativeApi_UnityARCore_session_onApplicationPause_m205AB77E32CC550217C0BEDF287C1CCCA4211E46,
NativeApi_UnityARCore_session_reset_m0CFFAA1EBF350276985E4F0A80A9C7C582E892D4,
NativeApi_UnityARCore_session_getTrackingState_mB17780C17A2ED37B8F7F562E5E9CCF28E83D7527,
NativeApi_UnityARCore_session_getNotTrackingReason_m97EE7E51F04581B4EF003AF85F3A33DF9206ECDB,
NativeApi_UnityARCore_session_getRenderEventFunc_mDBE116665853086B011B7A80AABB6A25E277CDFF,
NativeApi_UnityARCore_session_setRenderEventPending_mB74C10E36898E8CDD252B17EFD72C6DA95D53524,
NativeApi_UnityARCore_session_waitForRenderEvent_mCF32BBACBCEEF3155CE400A9ACFE6C102B3C8A5A,
NativeApi_UnityARCore_session_createTextureMainThread_mE26921845FFC8894191CD8D20371C5A738377E9C,
NativeApi_UnityARCore_session_deleteTextureMainThread_m0C1472F22B08B53BDD87FDF2C72A096718423526,
NativeApi_UnityARCore_session_getMatchFrameRateEnabled_m6C162ED9A6F7978410F7CD7AB2E26F1412C3A3D0,
NativeApi_UnityARCore_session_getMatchFrameRateRequested_mEAD3F6B163A8E6F29E647F6436D55FC487388DA7,
NativeApi_UnityARCore_session_setMatchFrameRateRequested_m42F919D37263A8E9F9A02262A5D58A546F1E2683,
NativeApi_GetCurrentTrackingMode_mB5234088AF8B5C68A6B029D440B42FFDD00B0A76,
NativeApi_UnityARCore_session_setConfigurationDirty_m50949B860D15405FA2C87990C31D9C66B8B7F84A,
NativeApi_UnityARCore_session_setConfigCallback_m525549EF8EAE00F177171C1858BBA7E6E41F642F,
CameraPermissionRequestProviderDelegate__ctor_m2FA75F6A973B17CA18B4BF6BAE20702655339E27,
CameraPermissionRequestProviderDelegate_Invoke_m05261FB991CE8933EA8041F56122E659E160E68E,
CameraPermissionRequestProviderDelegate_BeginInvoke_m7A8B194D3BB3C4F6431A5D462099362A1AB8F3CA,
CameraPermissionRequestProviderDelegate_EndInvoke_mB4D4796BA3D426AA561782B3BF4283FC456A207D,
CameraPermissionsResultCallbackDelegate__ctor_mEDD148B83FBC25FEBD30084B824D552055F1A1FC,
CameraPermissionsResultCallbackDelegate_Invoke_m1BB16747C0F77B3FB2038F05EFB05E21F9100AE4,
CameraPermissionsResultCallbackDelegate_BeginInvoke_mA3D872A3C5F09EAD519B46A11F43670BFBAE25AA,
CameraPermissionsResultCallbackDelegate_EndInvoke_m83C4C5BD7B5353B02F0C0F73FE20B85A2F507C72,
ArPlaybackStatusExtensions_Playing_m426CED6273FD330E2F62F77EB15EFF4730D6FDA0,
ArPrestoApi_ArPresto_update_m7BF3DB90C52EA0AB24B5A6DADD519B85842E98C1,
ArRecordingConfig__ctor_mFB056D108F9F2F1F95700E06ECF338AB67DE5543,
ArRecordingConfig_FromIntPtr_mC45CC978BE05629D8ECDD75C8DD9ED6314B0B2C6,
ArRecordingConfig_AsIntPtr_m1ACE1150822FE9A799E42E6FEEC115FC67DB59F5,
ArRecordingConfig_op_Explicit_mF252DBD16133AA5DE90CB03564B2AC3A00C3D7E5,
ArRecordingConfig_Equals_m700366138DCCEF48563D46A885A66749A7EAFE8E,
ArRecordingConfig_Equals_m46B9FD5ED0BA1F8EB0DE3B0263F86C4EC34D83E5,
ArRecordingConfig_GetHashCode_mC90EE60365D20D0958B7A9AA756D964107BAAA4D,
ArRecordingConfig_op_Equality_m631C76610F404A78A61A9D4CCEEEBD8149659B01,
ArRecordingConfig_op_Inequality_mEC8689EDDD323D7E96AB49288F61D7376F911FBD,
ArRecordingConfig_op_Equality_m6A1C8A291986AF3C931FBC660C003AF7E3126E8F,
ArRecordingConfig_op_Inequality_mA2A7220A5E338EFF9D66378F15AC20676B70DD8A,
ArRecordingConfig__ctor_m1FC781FAD6F26382FFB4BD225C6E97D3404F6201,
ArRecordingConfig_Create_m04F7C02818D176812EA4A49B49BDBFE8E3A0BC58,
ArRecordingConfig_Dispose_mC038E6DF18BFFC5CF53C92981959209499F60F8A,
ArRecordingConfig_Destroy_mA0AB849DAAA10939E1A01F7A7A90E99D5AC16DB2,
ArRecordingConfig_GetMp4DatasetFilePath_m4914727C5AB42734B16097D5922DCAD6B018C230,
ArRecordingConfig_GetMp4DatasetFilePath_m0B34E607C2B821C99AD9587B20BD6C51E5A90BEF,
ArRecordingConfig_SetMp4DatasetFilePath_m4AB1F048A648E5A18330B326231950FCFC562C7D,
ArRecordingConfig_SetMp4DatasetFilePath_mA190E0291CB562A02B3A98F7206C83C2AEB25790,
ArRecordingConfig_GetAutoStopOnPause_m9A7A960FBD8F80AEE2BE64F948645BB713FC6589,
ArRecordingConfig_GetAutoStopOnPause_mA5DAE6C68CD1B8287AF0C76B2DBA71940F632EE8,
ArRecordingConfig_SetAutoStopOnPause_m8EA51CD64BE495E44E17F25BF25FDF16496B317E,
ArRecordingConfig_SetAutoStopOnPause_m6C11BA37A63AABEF37F3063923FB97B7E8267859,
ArRecordingConfig_GetRecordingRotation_mDFD704E14CEC23CC39C9AD1C787CF9AF2D46204B,
ArRecordingConfig_GetRecordingRotation_m6B7015C220C92205E5612039CC6DE28BAE122BDD,
ArRecordingConfig_SetRecordingRotation_m0AB920806E19B8313DA5D2D9A5467F753FA7DCEF,
ArRecordingConfig_SetRecordingRotation_mD40648B54224AE8AF2104A2503B7401C7B2DAD3A,
ArRecordingStatusExtensions_Recording_mBE4200D74B16B1C18E5412646BA6FC9B6647BBBC,
ArSession__ctor_m71349A9234C25226F1128347856956BE42878C23,
ArSession_FromIntPtr_m34BF262FC3F3236332692EFED765039E1D6B04A0,
ArSession_get_Null_mAFE2D9B06995B6C62CD2C17E4F63018B1D1F93AB,
ArSession_get_IsNull_m05BB739DEE4AF829CC1D2EFE8E0CEC2771CF01C4,
ArSession_AsIntPtr_m73675297C396024E6179B8D4476CE2DE242B662A,
ArSession_op_Explicit_m3BB162CFBE033F77327BECD82E36F6FD7E893271,
ArSession_Equals_m23B510198BAD7E0B9A1484ECFCF5BF41B7DC7748,
ArSession_Equals_m55E7D8A043929991C0F0874F2AC63F16B4EF8122,
ArSession_GetHashCode_m5D362BBA3F33B01AC2C68D04FD433DB71CBDF21E,
ArSession_op_Equality_m609FE3E139CFDA789F6A231A2146DDAE82020B97,
ArSession_op_Inequality_m6D1477A67B93677F09DCDFCA60B324BB3714175E,
ArSession_op_Equality_m25B429B95EBDB1268A48744722DE8D5889E2BA94,
ArSession_op_Inequality_mD63C339935AD0D73358724F180C5B41E503019D8,
ArSession_SetPlaybackDataset_mC0C2D822F6267EA04C3586B10AD7BA96B48D5971,
ArSession_SetPlaybackDataset_m9B08EFA7A2B5B55F57AB20311DA07A6999605295,
ArSession_get_playbackStatus_m532E4AB78BBE269DD6635E21E7C84BAEF28FEF9B,
ArSession_GetPlaybackStatus_m711CFB4507ADAA9053029EF99A69DED9563CFF3E,
ArSession_StartRecording_m4E1E63E462A28E2582928B7780E77FC91A6B74AD,
ArSession_StartRecording_m8F79541DADDC652F51AAB39F51D7E8C7E03FB59F,
ArSession_StopRecording_m29D650C26A1CF6074DD6EAB28D811306CEFFC674,
ArSession_StopRecording_m88A80EB54F7D99FB2DB606E18991AE5F9D0A0991,
ArSession_get_recordingStatus_m8D8B1CE7BD5A413E8EAACFFA910548B69273AF3C,
ArSession_GetRecordingStatus_m22CD41FFE06BC160C7B6901185C6B08C3571B70B,
ArString_ToString_m58566F4EAB0BEC069B61795B57AF890F9AF05961,
ArString_ToString_m245F2065FC557EDD10CD96632E4BD5B2A7CE63FC,
ArString_Dispose_m2D9E29EC3E98FE828F7FEAB806341561A8A193AA,
ArString_CalculateNullTerminatedByteCount_m89C0AAFB8D621F7D1A92FF9334DC8CA6FA526EB1,
ArString_Release_m27459842D47D71753784F31A66BC9AB8749E26E5,
ARCoreXRDepthSubsystem_RegisterDescriptor_m7169EDD4BA7BD072FA983005A865E28B3F634A36,
ARCoreXRDepthSubsystem__ctor_mEDFE4948894B6C0B169A7960449503CD9D104477,
ARCoreProvider_UnityARCore_depth_Create_m7529DFC5E1E9B09F6488A04944ECC238CD53DF68,
ARCoreProvider_UnityARCore_depth_Start_m46D68D01CC9B9986C4CBA24C2AE04697C27C9769,
ARCoreProvider_UnityARCore_depth_Stop_m26CB7C7FE276E4E4924E6342641D2F3DAE726E6F,
ARCoreProvider_UnityARCore_depth_Destroy_m2BDDBF674C36D3B6E0468DBDFC753988B78EEA0F,
ARCoreProvider_UnityARCore_depth_AcquireChanges_mD7EE79AE441405BDEC567663BF4C6326DCDEB33A,
ARCoreProvider_UnityARCore_depth_ReleaseChanges_m2AED120AA993C4FCACDDDC95FA771B7062239049,
ARCoreProvider_UnityARCore_depth_getPointCloudPtrs_mBF4EDD60330CDB42FF68FB76B9AE70A8DAEFDEA0,
ARCoreProvider_GetChanges_m19155AA444BC46A6C38F7BD4B45C5EB1E13A6B58,
ARCoreProvider_GetPointCloudData_m8D457677921836A41A273609B8DFA43314DD8850,
ARCoreProvider_GenerateGuid_m406A7A02F96253CB573818EA5FF3E5AF66B91CDC,
ARCoreProvider__ctor_m0341088DD918C0C66148DA578DD6FCBD193EC575,
ARCoreProvider_Destroy_mBF4A7CB6ADFACF9EFF6291F20DAB539A8DFD686C,
ARCoreProvider_Start_m326B11169F3055941C51D585904C683B3FDA74FE,
ARCoreProvider_Stop_m4FAB7B9AF53CE6AB27B68A239F1D7F80456E4B35,
ARCoreProvider__cctor_mEA701BB50F9380F49A84C3A6DB482B5E7DC9E982,
CopyIdentifiersJob_Execute_mD5F4057E3560C7ABD74EBCEA89EFF89A64695D3C,
ExtractConfidenceValuesJob_Execute_m261E6D89CD79EA5CF89F594039AC47FB4812D6D1,
TransformPositionsJob_Execute_m892589A8D6347D174D643A86AB646B2DFE94A66A,
HashCodeUtil_Combine_mAA1A7737A9FFAE9120CEA037BFDEDE29A0C07BA3,
HashCodeUtil_ReferenceHash_m647089DCAD744E3C37CDA7C20FED7D8178186317,
HashCodeUtil_Combine_m43D09B71E5BF7CF79C818FE0AEC3FB03D2C3B666,
HashCodeUtil_Combine_m3197B269976A801D91AC6028A8123C199D7D3BA6,
HashCodeUtil_Combine_mA2CBA1C4D73089F8E851270E0278C3EA4572FCA6,
HashCodeUtil_Combine_mBDCCE07563AA420711AF3BA79355D72F77B0104C,
HashCodeUtil_Combine_m9FE1386242CE4687B74DB3527AC0632565068A60,
HashCodeUtil_Combine_m7A0E2E3777C97DA3F7A43FD70E27112FDB53E638,
FlipVerticalJob_Execute_mD0741C407C244AEE8696FF8D8EAB2DCE8EB676EA,
ConvertRFloatToGrayscaleJob_Execute_mD576D88F5CA87BA7658352FF375620774927BE7E,
ConvertBGRA32ToGrayscaleJob_Execute_mA1B5222E6CE669BFCABC309634A1058FD0318D49,
ConvertARGB32ToGrayscaleJob_Execute_m273542FF7E241207A99C0FC3FAF3070825F9E4FD,
ConvertStridedToGrayscaleJob_Execute_m74E512D24E8A627CC8C269B50D359650929B44CF,
ConversionJob_Schedule_mF270AC8E82EBA0579E4A4C687970FAAD7225D2A7,
ManagedReferenceImage__ctor_m7909E7255E06256DB90E301F1C5A75A834B60738,
ManagedReferenceImage_ToReferenceImage_m6E37905684A97C30C332AEB8BD57E67128CBF3F1,
ManagedReferenceImage_Dispose_mED4FBEB981766408C3E96556E5C311B893760C50,
ManagedReferenceImage_AsSerializedGuid_m11A3D420BD4FA6196F7AE1AAC40527B3FD393073,
NULL,
ManagedReferenceImageExtensions_ToNativeArray_m66CAB6205121E4D60926518B254D061EB17F2D16,
NativeObject_ArePointersEqual_mC0BFF100E3AAD60E362DED0441365800D7A13538,
NULL,
NULL,
RcoApi_Retain_m33EBE09AE7E4B914A003EBD2F8FCCAD8754EF2DA,
RcoApi_Release_mD384FEAAB2A01C8398D198AD828D895358D39409,
RcoApi_RetainCount_m6F9674C2E247BEB3EE2FF227D2E46E84C6EB2ECD,
StringExtensions_ToBytes_m7ADEB91D1FE5DEC0EF373FAE3F33B0007982EF0E,
};
extern void ArCameraConfig__ctor_m03B7CCBE0A6A9F8C9CF14EBBCB1517566DA47015_AdjustorThunk (void);
extern void ArCameraConfig_get_IsNull_m0E09F4D2B8C7F7159FBF65FCA7486A8C79741ED6_AdjustorThunk (void);
extern void ArCameraConfig_AsIntPtr_m319C668BCFE412C0D53FF26D97EDB93249B39444_AdjustorThunk (void);
extern void ArCameraConfig__ctor_mE14FEFC3215FE2A052D06E5A43C619D320B9AA19_AdjustorThunk (void);
extern void ArCameraConfig_Dispose_m165F78DBFE34B76060059B7BFC7EB367E0D626CC_AdjustorThunk (void);
extern void ArCameraConfig_GetCameraId_mE547D5D96CFA540BE2631831CB839D3D907DAC90_AdjustorThunk (void);
extern void ArCameraConfig_GetDepthSensorUsage_m5F136C8F9C5B3044C503580EB45DBC2671EC7C4F_AdjustorThunk (void);
extern void ArCameraConfig_GetFacingDirection_m3C022FA6AC02ED9BBBE8B4923E9CA397E72FB7A4_AdjustorThunk (void);
extern void ArCameraConfig_GetFpsRange_mF9215E84CF0CF2EB05D2ACD0CFDE02899C9F2533_AdjustorThunk (void);
extern void ArCameraConfig_GetImageDimensions_m3746D40ABD8902AEA59C72E1F6B23635A1A2C2C6_AdjustorThunk (void);
extern void ArCameraConfig_GetTextureDimensions_mA0E9C970FDEE0847B4FC7AABC35D82B0259648AE_AdjustorThunk (void);
extern void ArCameraConfig_Equals_m970EB204E68B633C9E34D1ED6A06EDCCD7E461E9_AdjustorThunk (void);
extern void ArCameraConfig_Equals_m475848DB0C28F764CAFC0F44E27B06BEB7564041_AdjustorThunk (void);
extern void ArCameraConfig_GetHashCode_m12BD55CF30C1466B45155A17224C4AA9AB16C4E0_AdjustorThunk (void);
extern void ArCameraConfigFilter__ctor_mAFDDE747B063B59B3DA2DD79FC20A16D497C07FA_AdjustorThunk (void);
extern void ArCameraConfigFilter__ctor_mF486A6AFC61683CFC3E52B7E5494E983D4DE83E7_AdjustorThunk (void);
extern void ArCameraConfigFilter_AsIntPtr_mC26AD4E33C4D07ED7C4970BC7C75456AC84D62BF_AdjustorThunk (void);
extern void ArCameraConfigFilter_get_IsNull_m0C4936F2612BC0BB7B4BAF08F9F0947D69EDC383_AdjustorThunk (void);
extern void ArCameraConfigFilter_GetDepthSensorUsage_mAD042C592CA038A62E72173B8B0E9224067C7C12_AdjustorThunk (void);
extern void ArCameraConfigFilter_SetDepthSensorUsage_m92C45E574F2383B585B96C7FEC9FF2CCEABC68E3_AdjustorThunk (void);
extern void ArCameraConfigFilter_GetTargetFps_m8A00967A664541D6702D5256F048DC56EBB74983_AdjustorThunk (void);
extern void ArCameraConfigFilter_SetTargetFps_mD09E6CDC671DB61E9FC443F99A26EF4C716C9766_AdjustorThunk (void);
extern void ArCameraConfigFilter_Dispose_m71514EB30557871157FCA62921F794E10EC3BD59_AdjustorThunk (void);
extern void ArCameraConfigFilter_Equals_m7A03616AACBC45070F8F65ACE805CF16ADF65494_AdjustorThunk (void);
extern void ArCameraConfigFilter_Equals_mF6B858B3A8FC33E7912163F338B1CC71C59744ED_AdjustorThunk (void);
extern void ArCameraConfigFilter_GetHashCode_mAB06AE4573E43FB7802536BD3809666832F1348A_AdjustorThunk (void);
extern void ArConfig__ctor_m0E326EEBB3B5154A7BA864AF3B31CA153C4AC072_AdjustorThunk (void);
extern void ArConfig__ctor_m807FC812AF15E78B8FD5025A164FF214A030F793_AdjustorThunk (void);
extern void ArConfig_get_IsNull_mC16E8E4A5FD7562D365B3CED6F6195F6D3A4BA98_AdjustorThunk (void);
extern void ArConfig_AsIntPtr_m9CFB8A76A4BB209848A58B8CB8CC7481BF763A42_AdjustorThunk (void);
extern void ArConfig_Equals_mCE8CA68F242CF012255732C5387E953EFB7C7572_AdjustorThunk (void);
extern void ArConfig_Equals_mAF04B9E9552EAF1D2DE31F107EF45BBC9CF8BBA4_AdjustorThunk (void);
extern void ArConfig_GetHashCode_m2AA440E48A34FDA2186E99FDF0630578AB433DC4_AdjustorThunk (void);
extern void ArConfig_Dispose_m7AFD805848963702EA520A205BF9E3AC79BFA37B_AdjustorThunk (void);
extern void ARCoreBeforeGetCameraConfigurationEventArgs_get_session_mCC2430CFD657AA39475EC7F94D12E94602318773_AdjustorThunk (void);
extern void ARCoreBeforeGetCameraConfigurationEventArgs_set_session_m0E5A8E5B0E3D93A3CAD6F54F7E44C732FCE8686A_AdjustorThunk (void);
extern void ARCoreBeforeGetCameraConfigurationEventArgs_get_filter_mF91BB4DDE06DAD980576BE33973865F4CAD2C702_AdjustorThunk (void);
extern void ARCoreBeforeGetCameraConfigurationEventArgs_set_filter_m136097E18565BAB7B14635A951EF75F91208BB08_AdjustorThunk (void);
extern void ARCoreBeforeGetCameraConfigurationEventArgs_Equals_m967BC71D3DF0590295A53C8BFA897626CC513EFC_AdjustorThunk (void);
extern void ARCoreBeforeGetCameraConfigurationEventArgs_Equals_m08904E4BE8373C7A8930D51AF33F2EF8F60BA528_AdjustorThunk (void);
extern void ARCoreBeforeGetCameraConfigurationEventArgs_GetHashCode_mBF1B9E848558FCF41FFA006B2A67018D2F405899_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs_get_session_mFB401F61257971B12D20BA2C2A13427ADF110405_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs_get_arSession_mFD007DB2BB188809848E2E6F699A87C4041137B9_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs_get_config_mABF124F70ED16AECD48A7AD0758798446A53DF31_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs_get_arConfig_m1EE2C53DDF02FA08DF8EEC1C016B7C4F5BBFC598_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs__ctor_mDEADF5D3E5BD90B0D3715FE63350F8B23475B297_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs__ctor_mE6E334059D83C27B306C1F72CD68C86E6DA4FED2_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs_Equals_m4B4E1CC09BDDC6E0259BAC9D254FE94F81E336BB_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs_GetHashCode_m6E3BC2573D8D619B0E86CCF48EB8F27283F41349_AdjustorThunk (void);
extern void ARCoreBeforeSetConfigurationEventArgs_Equals_m8969624DBC58D203BE709765D5623E86DAAAC90B_AdjustorThunk (void);
extern void ARCoreFaceRegionData_get_region_m7CD0AB1C423FD7A964F41C4CCCD14857C08177FE_AdjustorThunk (void);
extern void ARCoreFaceRegionData_get_pose_m8B0A57A837D75EC314AE73F2931075A0F10A3775_AdjustorThunk (void);
extern void ARCoreFaceRegionData__ctor_m589405112E30EB33BE5D5E10C0F5CC67D24FBB49_AdjustorThunk (void);
extern void ARCoreFaceRegionData_Equals_m2056862DD1AD264FBDD1C54E254871098B6995DC_AdjustorThunk (void);
extern void ARCoreFaceRegionData_GetHashCode_mC1E01B54503EADB48B6927CF2074C7FA4D426ECE_AdjustorThunk (void);
extern void ARCoreFaceRegionData_Equals_m17225C794C37005208BCDAAEB9DDE4F9B664D126_AdjustorThunk (void);
extern void ARCoreFaceRegionData_ToString_m01A02559D50A9AB69A98601C0DC8E707ECDDB02F_AdjustorThunk (void);
extern void ARCorePose__ctor_m1328D26F798D034CBD7F0402528B873D5994D5AF_AdjustorThunk (void);
extern void FaceRegionWithARCorePose__ctor_m1021176D2016468413133E87B6F50884A240E76D_AdjustorThunk (void);
extern void TransformPoseJob_Execute_m7EBE008B308EEF99D66204836A8954E1C6F6F1D3_AdjustorThunk (void);
extern void TransformVerticesJob_Execute_mB25F13AA4AB3152365B51B0C2ACA31FFC756D74F_AdjustorThunk (void);
extern void TransformUVsJob_Execute_m3A9C954126E9929C947C66111DC50B1A4EB8478A_AdjustorThunk (void);
extern void TransformIndicesJob_Execute_m20C5A48E77A83348D5BD86AD436EBC581C5F0AAB_AdjustorThunk (void);
extern void AddImageJob_Execute_mFF2FF44D70D3647AF25843519E6B767A99BAAF36_AdjustorThunk (void);
extern void FlipBoundaryWindingJob_Execute_m1A3A43413FBCA81A1ABDC145DC35AA533E86BC9D_AdjustorThunk (void);
extern void FlipBoundaryHandednessJob_Execute_mBDA83F26E0D4DE330FB14E62DDFB7A52219B8CA9_AdjustorThunk (void);
extern void ArRecordingConfig__ctor_mFB056D108F9F2F1F95700E06ECF338AB67DE5543_AdjustorThunk (void);
extern void ArRecordingConfig_AsIntPtr_m1ACE1150822FE9A799E42E6FEEC115FC67DB59F5_AdjustorThunk (void);
extern void ArRecordingConfig_Equals_m700366138DCCEF48563D46A885A66749A7EAFE8E_AdjustorThunk (void);
extern void ArRecordingConfig_Equals_m46B9FD5ED0BA1F8EB0DE3B0263F86C4EC34D83E5_AdjustorThunk (void);
extern void ArRecordingConfig_GetHashCode_mC90EE60365D20D0958B7A9AA756D964107BAAA4D_AdjustorThunk (void);
extern void ArRecordingConfig__ctor_m1FC781FAD6F26382FFB4BD225C6E97D3404F6201_AdjustorThunk (void);
extern void ArRecordingConfig_Dispose_mC038E6DF18BFFC5CF53C92981959209499F60F8A_AdjustorThunk (void);
extern void ArRecordingConfig_GetMp4DatasetFilePath_m4914727C5AB42734B16097D5922DCAD6B018C230_AdjustorThunk (void);
extern void ArRecordingConfig_SetMp4DatasetFilePath_m4AB1F048A648E5A18330B326231950FCFC562C7D_AdjustorThunk (void);
extern void ArRecordingConfig_GetAutoStopOnPause_m9A7A960FBD8F80AEE2BE64F948645BB713FC6589_AdjustorThunk (void);
extern void ArRecordingConfig_SetAutoStopOnPause_m8EA51CD64BE495E44E17F25BF25FDF16496B317E_AdjustorThunk (void);
extern void ArRecordingConfig_GetRecordingRotation_mDFD704E14CEC23CC39C9AD1C787CF9AF2D46204B_AdjustorThunk (void);
extern void ArRecordingConfig_SetRecordingRotation_m0AB920806E19B8313DA5D2D9A5467F753FA7DCEF_AdjustorThunk (void);
extern void ArSession__ctor_m71349A9234C25226F1128347856956BE42878C23_AdjustorThunk (void);
extern void ArSession_get_IsNull_m05BB739DEE4AF829CC1D2EFE8E0CEC2771CF01C4_AdjustorThunk (void);
extern void ArSession_AsIntPtr_m73675297C396024E6179B8D4476CE2DE242B662A_AdjustorThunk (void);
extern void ArSession_Equals_m23B510198BAD7E0B9A1484ECFCF5BF41B7DC7748_AdjustorThunk (void);
extern void ArSession_Equals_m55E7D8A043929991C0F0874F2AC63F16B4EF8122_AdjustorThunk (void);
extern void ArSession_GetHashCode_m5D362BBA3F33B01AC2C68D04FD433DB71CBDF21E_AdjustorThunk (void);
extern void ArSession_SetPlaybackDataset_mC0C2D822F6267EA04C3586B10AD7BA96B48D5971_AdjustorThunk (void);
extern void ArSession_get_playbackStatus_m532E4AB78BBE269DD6635E21E7C84BAEF28FEF9B_AdjustorThunk (void);
extern void ArSession_StartRecording_m4E1E63E462A28E2582928B7780E77FC91A6B74AD_AdjustorThunk (void);
extern void ArSession_StopRecording_m29D650C26A1CF6074DD6EAB28D811306CEFFC674_AdjustorThunk (void);
extern void ArSession_get_recordingStatus_m8D8B1CE7BD5A413E8EAACFFA910548B69273AF3C_AdjustorThunk (void);
extern void ArString_ToString_m58566F4EAB0BEC069B61795B57AF890F9AF05961_AdjustorThunk (void);
extern void ArString_ToString_m245F2065FC557EDD10CD96632E4BD5B2A7CE63FC_AdjustorThunk (void);
extern void ArString_Dispose_m2D9E29EC3E98FE828F7FEAB806341561A8A193AA_AdjustorThunk (void);
extern void ArString_CalculateNullTerminatedByteCount_m89C0AAFB8D621F7D1A92FF9334DC8CA6FA526EB1_AdjustorThunk (void);
extern void CopyIdentifiersJob_Execute_mD5F4057E3560C7ABD74EBCEA89EFF89A64695D3C_AdjustorThunk (void);
extern void ExtractConfidenceValuesJob_Execute_m261E6D89CD79EA5CF89F594039AC47FB4812D6D1_AdjustorThunk (void);
extern void TransformPositionsJob_Execute_m892589A8D6347D174D643A86AB646B2DFE94A66A_AdjustorThunk (void);
extern void FlipVerticalJob_Execute_mD0741C407C244AEE8696FF8D8EAB2DCE8EB676EA_AdjustorThunk (void);
extern void ConvertRFloatToGrayscaleJob_Execute_mD576D88F5CA87BA7658352FF375620774927BE7E_AdjustorThunk (void);
extern void ConvertBGRA32ToGrayscaleJob_Execute_mA1B5222E6CE669BFCABC309634A1058FD0318D49_AdjustorThunk (void);
extern void ConvertARGB32ToGrayscaleJob_Execute_m273542FF7E241207A99C0FC3FAF3070825F9E4FD_AdjustorThunk (void);
extern void ConvertStridedToGrayscaleJob_Execute_m74E512D24E8A627CC8C269B50D359650929B44CF_AdjustorThunk (void);
extern void ManagedReferenceImage__ctor_m7909E7255E06256DB90E301F1C5A75A834B60738_AdjustorThunk (void);
extern void ManagedReferenceImage_ToReferenceImage_m6E37905684A97C30C332AEB8BD57E67128CBF3F1_AdjustorThunk (void);
extern void ManagedReferenceImage_Dispose_mED4FBEB981766408C3E96556E5C311B893760C50_AdjustorThunk (void);
extern void ManagedReferenceImage_AsSerializedGuid_m11A3D420BD4FA6196F7AE1AAC40527B3FD393073_AdjustorThunk (void);
static Il2CppTokenAdjustorThunkPair s_adjustorThunks[106] =
{
{ 0x06000001, ArCameraConfig__ctor_m03B7CCBE0A6A9F8C9CF14EBBCB1517566DA47015_AdjustorThunk },
{ 0x06000004, ArCameraConfig_get_IsNull_m0E09F4D2B8C7F7159FBF65FCA7486A8C79741ED6_AdjustorThunk },
{ 0x06000005, ArCameraConfig_AsIntPtr_m319C668BCFE412C0D53FF26D97EDB93249B39444_AdjustorThunk },
{ 0x06000006, ArCameraConfig__ctor_mE14FEFC3215FE2A052D06E5A43C619D320B9AA19_AdjustorThunk },
{ 0x06000007, ArCameraConfig_Dispose_m165F78DBFE34B76060059B7BFC7EB367E0D626CC_AdjustorThunk },
{ 0x06000008, ArCameraConfig_GetCameraId_mE547D5D96CFA540BE2631831CB839D3D907DAC90_AdjustorThunk },
{ 0x06000009, ArCameraConfig_GetDepthSensorUsage_m5F136C8F9C5B3044C503580EB45DBC2671EC7C4F_AdjustorThunk },
{ 0x0600000A, ArCameraConfig_GetFacingDirection_m3C022FA6AC02ED9BBBE8B4923E9CA397E72FB7A4_AdjustorThunk },
{ 0x0600000B, ArCameraConfig_GetFpsRange_mF9215E84CF0CF2EB05D2ACD0CFDE02899C9F2533_AdjustorThunk },
{ 0x0600000C, ArCameraConfig_GetImageDimensions_m3746D40ABD8902AEA59C72E1F6B23635A1A2C2C6_AdjustorThunk },
{ 0x0600000D, ArCameraConfig_GetTextureDimensions_mA0E9C970FDEE0847B4FC7AABC35D82B0259648AE_AdjustorThunk },
{ 0x0600000F, ArCameraConfig_Equals_m970EB204E68B633C9E34D1ED6A06EDCCD7E461E9_AdjustorThunk },
{ 0x06000010, ArCameraConfig_Equals_m475848DB0C28F764CAFC0F44E27B06BEB7564041_AdjustorThunk },
{ 0x06000011, ArCameraConfig_GetHashCode_m12BD55CF30C1466B45155A17224C4AA9AB16C4E0_AdjustorThunk },
{ 0x0600001F, ArCameraConfigFilter__ctor_mAFDDE747B063B59B3DA2DD79FC20A16D497C07FA_AdjustorThunk },
{ 0x06000022, ArCameraConfigFilter__ctor_mF486A6AFC61683CFC3E52B7E5494E983D4DE83E7_AdjustorThunk },
{ 0x06000023, ArCameraConfigFilter_AsIntPtr_mC26AD4E33C4D07ED7C4970BC7C75456AC84D62BF_AdjustorThunk },
{ 0x06000024, ArCameraConfigFilter_get_IsNull_m0C4936F2612BC0BB7B4BAF08F9F0947D69EDC383_AdjustorThunk },
{ 0x06000025, ArCameraConfigFilter_GetDepthSensorUsage_mAD042C592CA038A62E72173B8B0E9224067C7C12_AdjustorThunk },
{ 0x06000026, ArCameraConfigFilter_SetDepthSensorUsage_m92C45E574F2383B585B96C7FEC9FF2CCEABC68E3_AdjustorThunk },
{ 0x06000027, ArCameraConfigFilter_GetTargetFps_m8A00967A664541D6702D5256F048DC56EBB74983_AdjustorThunk },
{ 0x06000028, ArCameraConfigFilter_SetTargetFps_mD09E6CDC671DB61E9FC443F99A26EF4C716C9766_AdjustorThunk },
{ 0x06000029, ArCameraConfigFilter_Dispose_m71514EB30557871157FCA62921F794E10EC3BD59_AdjustorThunk },
{ 0x0600002B, ArCameraConfigFilter_Equals_m7A03616AACBC45070F8F65ACE805CF16ADF65494_AdjustorThunk },
{ 0x0600002C, ArCameraConfigFilter_Equals_mF6B858B3A8FC33E7912163F338B1CC71C59744ED_AdjustorThunk },
{ 0x0600002D, ArCameraConfigFilter_GetHashCode_mAB06AE4573E43FB7802536BD3809666832F1348A_AdjustorThunk },
{ 0x06000038, ArConfig__ctor_m0E326EEBB3B5154A7BA864AF3B31CA153C4AC072_AdjustorThunk },
{ 0x06000039, ArConfig__ctor_m807FC812AF15E78B8FD5025A164FF214A030F793_AdjustorThunk },
{ 0x0600003C, ArConfig_get_IsNull_mC16E8E4A5FD7562D365B3CED6F6195F6D3A4BA98_AdjustorThunk },
{ 0x0600003D, ArConfig_AsIntPtr_m9CFB8A76A4BB209848A58B8CB8CC7481BF763A42_AdjustorThunk },
{ 0x0600003F, ArConfig_Equals_mCE8CA68F242CF012255732C5387E953EFB7C7572_AdjustorThunk },
{ 0x06000040, ArConfig_Equals_mAF04B9E9552EAF1D2DE31F107EF45BBC9CF8BBA4_AdjustorThunk },
{ 0x06000041, ArConfig_GetHashCode_m2AA440E48A34FDA2186E99FDF0630578AB433DC4_AdjustorThunk },
{ 0x06000044, ArConfig_Dispose_m7AFD805848963702EA520A205BF9E3AC79BFA37B_AdjustorThunk },
{ 0x06000061, ARCoreBeforeGetCameraConfigurationEventArgs_get_session_mCC2430CFD657AA39475EC7F94D12E94602318773_AdjustorThunk },
{ 0x06000062, ARCoreBeforeGetCameraConfigurationEventArgs_set_session_m0E5A8E5B0E3D93A3CAD6F54F7E44C732FCE8686A_AdjustorThunk },
{ 0x06000063, ARCoreBeforeGetCameraConfigurationEventArgs_get_filter_mF91BB4DDE06DAD980576BE33973865F4CAD2C702_AdjustorThunk },
{ 0x06000064, ARCoreBeforeGetCameraConfigurationEventArgs_set_filter_m136097E18565BAB7B14635A951EF75F91208BB08_AdjustorThunk },
{ 0x06000065, ARCoreBeforeGetCameraConfigurationEventArgs_Equals_m967BC71D3DF0590295A53C8BFA897626CC513EFC_AdjustorThunk },
{ 0x06000066, ARCoreBeforeGetCameraConfigurationEventArgs_Equals_m08904E4BE8373C7A8930D51AF33F2EF8F60BA528_AdjustorThunk },
{ 0x06000067, ARCoreBeforeGetCameraConfigurationEventArgs_GetHashCode_mBF1B9E848558FCF41FFA006B2A67018D2F405899_AdjustorThunk },
{ 0x0600006A, ARCoreBeforeSetConfigurationEventArgs_get_session_mFB401F61257971B12D20BA2C2A13427ADF110405_AdjustorThunk },
{ 0x0600006B, ARCoreBeforeSetConfigurationEventArgs_get_arSession_mFD007DB2BB188809848E2E6F699A87C4041137B9_AdjustorThunk },
{ 0x0600006C, ARCoreBeforeSetConfigurationEventArgs_get_config_mABF124F70ED16AECD48A7AD0758798446A53DF31_AdjustorThunk },
{ 0x0600006D, ARCoreBeforeSetConfigurationEventArgs_get_arConfig_m1EE2C53DDF02FA08DF8EEC1C016B7C4F5BBFC598_AdjustorThunk },
{ 0x0600006E, ARCoreBeforeSetConfigurationEventArgs__ctor_mDEADF5D3E5BD90B0D3715FE63350F8B23475B297_AdjustorThunk },
{ 0x0600006F, ARCoreBeforeSetConfigurationEventArgs__ctor_mE6E334059D83C27B306C1F72CD68C86E6DA4FED2_AdjustorThunk },
{ 0x06000070, ARCoreBeforeSetConfigurationEventArgs_Equals_m4B4E1CC09BDDC6E0259BAC9D254FE94F81E336BB_AdjustorThunk },
{ 0x06000071, ARCoreBeforeSetConfigurationEventArgs_GetHashCode_m6E3BC2573D8D619B0E86CCF48EB8F27283F41349_AdjustorThunk },
{ 0x06000072, ARCoreBeforeSetConfigurationEventArgs_Equals_m8969624DBC58D203BE709765D5623E86DAAAC90B_AdjustorThunk },
{ 0x060000DA, ARCoreFaceRegionData_get_region_m7CD0AB1C423FD7A964F41C4CCCD14857C08177FE_AdjustorThunk },
{ 0x060000DB, ARCoreFaceRegionData_get_pose_m8B0A57A837D75EC314AE73F2931075A0F10A3775_AdjustorThunk },
{ 0x060000DC, ARCoreFaceRegionData__ctor_m589405112E30EB33BE5D5E10C0F5CC67D24FBB49_AdjustorThunk },
{ 0x060000DD, ARCoreFaceRegionData_Equals_m2056862DD1AD264FBDD1C54E254871098B6995DC_AdjustorThunk },
{ 0x060000DE, ARCoreFaceRegionData_GetHashCode_mC1E01B54503EADB48B6927CF2074C7FA4D426ECE_AdjustorThunk },
{ 0x060000DF, ARCoreFaceRegionData_Equals_m17225C794C37005208BCDAAEB9DDE4F9B664D126_AdjustorThunk },
{ 0x060000E0, ARCoreFaceRegionData_ToString_m01A02559D50A9AB69A98601C0DC8E707ECDDB02F_AdjustorThunk },
{ 0x060000EE, ARCorePose__ctor_m1328D26F798D034CBD7F0402528B873D5994D5AF_AdjustorThunk },
{ 0x060000EF, FaceRegionWithARCorePose__ctor_m1021176D2016468413133E87B6F50884A240E76D_AdjustorThunk },
{ 0x060000F0, TransformPoseJob_Execute_m7EBE008B308EEF99D66204836A8954E1C6F6F1D3_AdjustorThunk },
{ 0x060000F7, TransformVerticesJob_Execute_mB25F13AA4AB3152365B51B0C2ACA31FFC756D74F_AdjustorThunk },
{ 0x060000F8, TransformUVsJob_Execute_m3A9C954126E9929C947C66111DC50B1A4EB8478A_AdjustorThunk },
{ 0x060000FA, TransformIndicesJob_Execute_m20C5A48E77A83348D5BD86AD436EBC581C5F0AAB_AdjustorThunk },
{ 0x06000113, AddImageJob_Execute_mFF2FF44D70D3647AF25843519E6B767A99BAAF36_AdjustorThunk },
{ 0x06000180, FlipBoundaryWindingJob_Execute_m1A3A43413FBCA81A1ABDC145DC35AA533E86BC9D_AdjustorThunk },
{ 0x06000181, FlipBoundaryHandednessJob_Execute_mBDA83F26E0D4DE330FB14E62DDFB7A52219B8CA9_AdjustorThunk },
{ 0x060001F9, ArRecordingConfig__ctor_mFB056D108F9F2F1F95700E06ECF338AB67DE5543_AdjustorThunk },
{ 0x060001FB, ArRecordingConfig_AsIntPtr_m1ACE1150822FE9A799E42E6FEEC115FC67DB59F5_AdjustorThunk },
{ 0x060001FD, ArRecordingConfig_Equals_m700366138DCCEF48563D46A885A66749A7EAFE8E_AdjustorThunk },
{ 0x060001FE, ArRecordingConfig_Equals_m46B9FD5ED0BA1F8EB0DE3B0263F86C4EC34D83E5_AdjustorThunk },
{ 0x060001FF, ArRecordingConfig_GetHashCode_mC90EE60365D20D0958B7A9AA756D964107BAAA4D_AdjustorThunk },
{ 0x06000204, ArRecordingConfig__ctor_m1FC781FAD6F26382FFB4BD225C6E97D3404F6201_AdjustorThunk },
{ 0x06000206, ArRecordingConfig_Dispose_mC038E6DF18BFFC5CF53C92981959209499F60F8A_AdjustorThunk },
{ 0x06000208, ArRecordingConfig_GetMp4DatasetFilePath_m4914727C5AB42734B16097D5922DCAD6B018C230_AdjustorThunk },
{ 0x0600020A, ArRecordingConfig_SetMp4DatasetFilePath_m4AB1F048A648E5A18330B326231950FCFC562C7D_AdjustorThunk },
{ 0x0600020C, ArRecordingConfig_GetAutoStopOnPause_m9A7A960FBD8F80AEE2BE64F948645BB713FC6589_AdjustorThunk },
{ 0x0600020E, ArRecordingConfig_SetAutoStopOnPause_m8EA51CD64BE495E44E17F25BF25FDF16496B317E_AdjustorThunk },
{ 0x06000210, ArRecordingConfig_GetRecordingRotation_mDFD704E14CEC23CC39C9AD1C787CF9AF2D46204B_AdjustorThunk },
{ 0x06000212, ArRecordingConfig_SetRecordingRotation_m0AB920806E19B8313DA5D2D9A5467F753FA7DCEF_AdjustorThunk },
{ 0x06000215, ArSession__ctor_m71349A9234C25226F1128347856956BE42878C23_AdjustorThunk },
{ 0x06000218, ArSession_get_IsNull_m05BB739DEE4AF829CC1D2EFE8E0CEC2771CF01C4_AdjustorThunk },
{ 0x06000219, ArSession_AsIntPtr_m73675297C396024E6179B8D4476CE2DE242B662A_AdjustorThunk },
{ 0x0600021B, ArSession_Equals_m23B510198BAD7E0B9A1484ECFCF5BF41B7DC7748_AdjustorThunk },
{ 0x0600021C, ArSession_Equals_m55E7D8A043929991C0F0874F2AC63F16B4EF8122_AdjustorThunk },
{ 0x0600021D, ArSession_GetHashCode_m5D362BBA3F33B01AC2C68D04FD433DB71CBDF21E_AdjustorThunk },
{ 0x06000222, ArSession_SetPlaybackDataset_mC0C2D822F6267EA04C3586B10AD7BA96B48D5971_AdjustorThunk },
{ 0x06000224, ArSession_get_playbackStatus_m532E4AB78BBE269DD6635E21E7C84BAEF28FEF9B_AdjustorThunk },
{ 0x06000226, ArSession_StartRecording_m4E1E63E462A28E2582928B7780E77FC91A6B74AD_AdjustorThunk },
{ 0x06000228, ArSession_StopRecording_m29D650C26A1CF6074DD6EAB28D811306CEFFC674_AdjustorThunk },
{ 0x0600022A, ArSession_get_recordingStatus_m8D8B1CE7BD5A413E8EAACFFA910548B69273AF3C_AdjustorThunk },
{ 0x0600022C, ArString_ToString_m58566F4EAB0BEC069B61795B57AF890F9AF05961_AdjustorThunk },
{ 0x0600022D, ArString_ToString_m245F2065FC557EDD10CD96632E4BD5B2A7CE63FC_AdjustorThunk },
{ 0x0600022E, ArString_Dispose_m2D9E29EC3E98FE828F7FEAB806341561A8A193AA_AdjustorThunk },
{ 0x0600022F, ArString_CalculateNullTerminatedByteCount_m89C0AAFB8D621F7D1A92FF9334DC8CA6FA526EB1_AdjustorThunk },
{ 0x06000242, CopyIdentifiersJob_Execute_mD5F4057E3560C7ABD74EBCEA89EFF89A64695D3C_AdjustorThunk },
{ 0x06000243, ExtractConfidenceValuesJob_Execute_m261E6D89CD79EA5CF89F594039AC47FB4812D6D1_AdjustorThunk },
{ 0x06000244, TransformPositionsJob_Execute_m892589A8D6347D174D643A86AB646B2DFE94A66A_AdjustorThunk },
{ 0x0600024D, FlipVerticalJob_Execute_mD0741C407C244AEE8696FF8D8EAB2DCE8EB676EA_AdjustorThunk },
{ 0x0600024E, ConvertRFloatToGrayscaleJob_Execute_mD576D88F5CA87BA7658352FF375620774927BE7E_AdjustorThunk },
{ 0x0600024F, ConvertBGRA32ToGrayscaleJob_Execute_mA1B5222E6CE669BFCABC309634A1058FD0318D49_AdjustorThunk },
{ 0x06000250, ConvertARGB32ToGrayscaleJob_Execute_m273542FF7E241207A99C0FC3FAF3070825F9E4FD_AdjustorThunk },
{ 0x06000251, ConvertStridedToGrayscaleJob_Execute_m74E512D24E8A627CC8C269B50D359650929B44CF_AdjustorThunk },
{ 0x06000253, ManagedReferenceImage__ctor_m7909E7255E06256DB90E301F1C5A75A834B60738_AdjustorThunk },
{ 0x06000254, ManagedReferenceImage_ToReferenceImage_m6E37905684A97C30C332AEB8BD57E67128CBF3F1_AdjustorThunk },
{ 0x06000255, ManagedReferenceImage_Dispose_mED4FBEB981766408C3E96556E5C311B893760C50_AdjustorThunk },
{ 0x06000256, ManagedReferenceImage_AsSerializedGuid_m11A3D420BD4FA6196F7AE1AAC40527B3FD393073_AdjustorThunk },
};
static const int32_t s_InvokerIndices[607] =
{
3651,
6698,
7157,
4393,
4438,
3599,
4549,
3227,
3008,
3008,
2275,
2275,
2275,
6842,
2525,
2601,
4436,
6041,
6041,
6003,
6003,
6509,
7064,
5883,
5883,
5883,
5419,
5419,
5419,
6699,
3651,
6700,
7158,
3599,
4438,
4393,
3008,
1668,
3008,
1668,
4549,
6843,
2526,
2601,
4436,
6042,
6042,
6004,
6004,
6509,
7065,
5884,
5885,
5884,
5885,
3651,
3599,
6701,
7159,
4393,
4438,
6844,
2527,
2601,
4436,
6043,
6043,
4549,
6005,
6005,
6509,
7066,
7213,
4549,
4549,
4549,
4549,
1195,
1290,
883,
2666,
7213,
7213,
7213,
4706,
7063,
6089,
5567,
6727,
4549,
6557,
7209,
7166,
7186,
7166,
7213,
4387,
3599,
4384,
3596,
2511,
2601,
4436,
6036,
6036,
4438,
4387,
4438,
4385,
2001,
1666,
2512,
4436,
2601,
6037,
6037,
7186,
7213,
3667,
3667,
6710,
4549,
4459,
4393,
4393,
4459,
4549,
4537,
4537,
3732,
4549,
4549,
4549,
1347,
4393,
3604,
4393,
3649,
4537,
3732,
4537,
2510,
1179,
4312,
3528,
1180,
2510,
3667,
3667,
3667,
3667,
5902,
7213,
6536,
7073,
7213,
7213,
7213,
6141,
7166,
7209,
6710,
6271,
7075,
6710,
6823,
5980,
7063,
7166,
7209,
7073,
7186,
6069,
3043,
3649,
3649,
848,
2580,
453,
454,
1448,
846,
738,
1348,
4549,
7213,
6069,
6813,
7073,
7073,
5543,
6716,
5171,
5172,
6240,
5542,
5435,
7213,
4549,
4549,
4549,
4549,
4549,
4393,
3604,
4393,
4393,
3604,
4393,
1196,
7073,
7213,
7213,
7213,
7213,
7213,
5396,
4436,
4468,
1866,
2513,
4436,
2601,
4459,
6038,
6038,
1158,
7213,
7213,
7213,
4718,
4706,
7063,
5987,
7063,
7213,
4549,
2079,
1939,
3649,
4549,
4549,
4549,
1158,
1197,
4549,
3649,
3649,
0,
3649,
6915,
3667,
6851,
4549,
4393,
4436,
3043,
3006,
2187,
248,
341,
3861,
4436,
4436,
2601,
2601,
6083,
6083,
6289,
6815,
6277,
6850,
6815,
7213,
4549,
4741,
4549,
6915,
7213,
4549,
7213,
4549,
4549,
3667,
3239,
1200,
4549,
4436,
3649,
4436,
7075,
7213,
4706,
7063,
7179,
4549,
4459,
4459,
4459,
4459,
4459,
4459,
4459,
4459,
4459,
4459,
4459,
4393,
4393,
4393,
4393,
4549,
7213,
4549,
7213,
4549,
4549,
4549,
4549,
4549,
4436,
3649,
4436,
4393,
4393,
3604,
2510,
2510,
2510,
2510,
4459,
2510,
2510,
4459,
1180,
1659,
7213,
7179,
6516,
7213,
7213,
7213,
7179,
7073,
7179,
6710,
5980,
7063,
7166,
7166,
6710,
6719,
6538,
3667,
3667,
4549,
4549,
7186,
7186,
7186,
7213,
4549,
7213,
4549,
4549,
4549,
1158,
1194,
4549,
4436,
3649,
4436,
7213,
7213,
4706,
7063,
7179,
7073,
7179,
7213,
5987,
6026,
4549,
4549,
3649,
0,
0,
0,
7213,
4549,
4549,
4549,
4549,
1199,
891,
3723,
439,
440,
5129,
4823,
7063,
5571,
7085,
7213,
7213,
4706,
7063,
7213,
4549,
4549,
3591,
4549,
4387,
3007,
4436,
3060,
4436,
4436,
4436,
3667,
3667,
7213,
4549,
3060,
4549,
4549,
4549,
2082,
3007,
4436,
4436,
4436,
4387,
2188,
3667,
3667,
5886,
4549,
4549,
4549,
4549,
4459,
4459,
4438,
4436,
4436,
4537,
4537,
3732,
4537,
4393,
4393,
3604,
4436,
0,
6518,
6518,
6536,
0,
3649,
4549,
4549,
7213,
4549,
3651,
3651,
4549,
2010,
7181,
6536,
5891,
5434,
5823,
7077,
7213,
7072,
7213,
7166,
7213,
7213,
7213,
7179,
7179,
7181,
7213,
7213,
7213,
7213,
7166,
7166,
7068,
7209,
7213,
6536,
2019,
2019,
666,
3667,
2019,
1678,
653,
3667,
6716,
7213,
3651,
6702,
4438,
6845,
2528,
2601,
4436,
6044,
6044,
6006,
6006,
3599,
6509,
4549,
7067,
3227,
5887,
1669,
5887,
2529,
5887,
1667,
5888,
3008,
5887,
1668,
5888,
6716,
3651,
6703,
7160,
4393,
4438,
6846,
2529,
2601,
4436,
6045,
6045,
6007,
6007,
3060,
6233,
4436,
6509,
3007,
6234,
4436,
6806,
4436,
6509,
4459,
3239,
4549,
4436,
7063,
7213,
4549,
7077,
7213,
7213,
7213,
4706,
7063,
5642,
1198,
2094,
7177,
4549,
4549,
4549,
4549,
7213,
3649,
3649,
3649,
6237,
6817,
5612,
5220,
4886,
4768,
4719,
4684,
3649,
3649,
3649,
3649,
3649,
4966,
3762,
4566,
4549,
3291,
0,
5966,
6008,
0,
0,
6815,
6815,
6815,
5480,
};
static const Il2CppTokenIndexMethodTuple s_reversePInvokeIndices[6] =
{
{ 0x06000098, 10, (void**)&ARCoreProvider_OnBeforeGetCameraConfiguration_m2C314F5FC174CB06131BFADE7B5C0378E530C70C_RuntimeMethod_var, 0 },
{ 0x060001B5, 14, (void**)&ARCoreProvider_SetConfigurationCallback_m21110C590C44E78936908B4D2198452803E2330B_RuntimeMethod_var, 0 },
{ 0x060001C8, 12, (void**)&ARCoreProvider_OnApkInstallation_mE3B31805C325D8C7F0FC2BC00F8249A759AE5B98_RuntimeMethod_var, 0 },
{ 0x060001C9, 13, (void**)&ARCoreProvider_OnCheckApkAvailability_m0C786C7B24238176AC42E8CEF62BA1D84EB9C1DB_RuntimeMethod_var, 0 },
{ 0x060001CA, 11, (void**)&ARCoreProvider_CameraPermissionRequestProvider_m52520DB26683512123C6B56B7E2A28269DF7C310_RuntimeMethod_var, 0 },
{ 0x0600023C, 15, (void**)&ARCoreProvider_GenerateGuid_m406A7A02F96253CB573818EA5FF3E5AF66B91CDC_RuntimeMethod_var, 0 },
};
static const Il2CppTokenRangePair s_rgctxIndices[6] =
{
{ 0x02000034, { 0, 4 } },
{ 0x060001C7, { 4, 2 } },
{ 0x060001CB, { 6, 2 } },
{ 0x06000257, { 8, 1 } },
{ 0x0600025A, { 9, 1 } },
{ 0x0600025B, { 10, 2 } },
};
extern const uint32_t g_rgctx_ARCorePromise_1_t39173C769B9641ED7F517E029E150FAD6E0B6D86;
extern const uint32_t g_rgctx_Promise_1_t0F357053732069509DB5351016A7B790C898D1A7;
extern const uint32_t g_rgctx_Promise_1_Resolve_mE3AD425DBD70265B5F2726E09B058A33B6CCD869;
extern const uint32_t g_rgctx_Promise_1__ctor_mF90270485F2AA6FFA057B436D291F61A72FBE631;
extern const uint32_t g_rgctx_ARCorePromise_1_t8C67B79F3BE7421243BD4C6A13D209DD1EDF32F6;
extern const uint32_t g_rgctx_ARCorePromise_1__ctor_m8FAAE77B5E7596D3BCBC5343903F5DB34407837F;
extern const uint32_t g_rgctx_ARCorePromise_1_t1805CA5BC6317A02908907C361BFD7ADB1B44FE5;
extern const uint32_t g_rgctx_ARCorePromise_1_Resolve_m37A69BE7188648E09E5A3BD3F8F3E1BE1A57C4F0;
extern const uint32_t g_rgctx_T_tD187E75AD2C1339312C8A5957C49E77BAEE059F0;
extern const uint32_t g_rgctx_NativeArrayUnsafeUtility_GetUnsafePtr_TisT_t3A476C5CA3B2D221789870551B92F8C9B650CBB9_m9D2FA1637FDA44D1724C29804F772BF66D03A8A5;
extern const uint32_t g_rgctx_NativeSliceUnsafeUtility_GetUnsafePtr_TisT_tBDCC48F0E06F08974F46FC639C059E7D80B82025_m09C67DD22A053C5134EA25F39F69D47D74E5EE53;
extern const uint32_t g_rgctx_NativeSlice_1_get_Length_mC1AA65DD06761E05AC2411BFFF158331142852C7;
static const Il2CppRGCTXDefinition s_rgctxValues[12] =
{
{ (Il2CppRGCTXDataType)2, (const void *)&g_rgctx_ARCorePromise_1_t39173C769B9641ED7F517E029E150FAD6E0B6D86 },
{ (Il2CppRGCTXDataType)2, (const void *)&g_rgctx_Promise_1_t0F357053732069509DB5351016A7B790C898D1A7 },
{ (Il2CppRGCTXDataType)3, (const void *)&g_rgctx_Promise_1_Resolve_mE3AD425DBD70265B5F2726E09B058A33B6CCD869 },
{ (Il2CppRGCTXDataType)3, (const void *)&g_rgctx_Promise_1__ctor_mF90270485F2AA6FFA057B436D291F61A72FBE631 },
{ (Il2CppRGCTXDataType)2, (const void *)&g_rgctx_ARCorePromise_1_t8C67B79F3BE7421243BD4C6A13D209DD1EDF32F6 },
{ (Il2CppRGCTXDataType)3, (const void *)&g_rgctx_ARCorePromise_1__ctor_m8FAAE77B5E7596D3BCBC5343903F5DB34407837F },
{ (Il2CppRGCTXDataType)2, (const void *)&g_rgctx_ARCorePromise_1_t1805CA5BC6317A02908907C361BFD7ADB1B44FE5 },
{ (Il2CppRGCTXDataType)3, (const void *)&g_rgctx_ARCorePromise_1_Resolve_m37A69BE7188648E09E5A3BD3F8F3E1BE1A57C4F0 },
{ (Il2CppRGCTXDataType)2, (const void *)&g_rgctx_T_tD187E75AD2C1339312C8A5957C49E77BAEE059F0 },
{ (Il2CppRGCTXDataType)3, (const void *)&g_rgctx_NativeArrayUnsafeUtility_GetUnsafePtr_TisT_t3A476C5CA3B2D221789870551B92F8C9B650CBB9_m9D2FA1637FDA44D1724C29804F772BF66D03A8A5 },
{ (Il2CppRGCTXDataType)3, (const void *)&g_rgctx_NativeSliceUnsafeUtility_GetUnsafePtr_TisT_tBDCC48F0E06F08974F46FC639C059E7D80B82025_m09C67DD22A053C5134EA25F39F69D47D74E5EE53 },
{ (Il2CppRGCTXDataType)3, (const void *)&g_rgctx_NativeSlice_1_get_Length_mC1AA65DD06761E05AC2411BFFF158331142852C7 },
};
IL2CPP_EXTERN_C const Il2CppCodeGenModule g_Unity_XR_ARCore_CodeGenModule;
const Il2CppCodeGenModule g_Unity_XR_ARCore_CodeGenModule =
{
"Unity.XR.ARCore.dll",
607,
s_methodPointers,
106,
s_adjustorThunks,
s_InvokerIndices,
6,
s_reversePInvokeIndices,
6,
s_rgctxIndices,
12,
s_rgctxValues,
NULL,
NULL, // module initializer,
NULL,
NULL,
NULL,
};
| 81.668867 | 309 | 0.903619 | [
"object"
] |
023b3a052055952c64206092381ea8001f6a23a3 | 171,940 | h | C | java/jog/libraries/jog/jog.h | r-lyeh/scriptorium | cd7b259ccbd14d05c8d8fec1a33af9de5337e60c | [
"Unlicense"
] | 303 | 2015-07-11T17:12:55.000Z | 2018-01-08T03:02:37.000Z | java/jog/libraries/jog/jog.h | r-lyeh/script-it | cd7b259ccbd14d05c8d8fec1a33af9de5337e60c | [
"Unlicense"
] | 13 | 2016-05-12T16:51:22.000Z | 2018-01-10T22:33:25.000Z | java/jog/libraries/jog/jog.h | r-lyeh/script-it | cd7b259ccbd14d05c8d8fec1a33af9de5337e60c | [
"Unlicense"
] | 26 | 2018-01-18T09:15:33.000Z | 2022-02-07T13:09:14.000Z |
// lexical structure:
// http://java.sun.com/docs/books/jls/third_edition/html/lexical.html
#ifndef JOG_H
#define JOG_H
// 2010.05.17 by Abe Pralle
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <map>
#include <ctime>
using namespace std;
#include "ref_counted.h"
#include "string_builder.h"
#include "array_list.h"
typedef long long int JogInt64;
typedef int JogInt32;
typedef short int JogInt16;
typedef char JogInt8;
typedef unsigned short int JogChar;
struct JogMethodInfo;
struct ASCIIString : RefCounted
{
char* data;
int count;
ASCIIString( const char* st )
{
if (st)
{
count = strlen(st);
data = new char[count+1];
int c = count + 1;
char* dest = data-1;
st--;
while (--c) *(++dest) = *(++st);
data[count] = 0;
}
else
{
count = 0;
data = NULL;
}
}
~ASCIIString()
{
if (data) delete data;
}
bool operator==( Ref<ASCIIString> other )
{
return 0 == strcmp(data,other->data);
}
bool operator!=( Ref<ASCIIString> other )
{
return 0 != strcmp(data,other->data);
}
};
struct JogString : RefCounted
{
short int* data;
int count;
JogString( const char* st )
{
if (st)
{
count = strlen(st);
data = new short int[count];
int c = count + 1;
short int* dest = data-1;
st--;
while (--c) *(++dest) = *(++st);
}
else
{
count = 0;
data = NULL;
}
}
JogString( short int* st, int _count=-1 )
{
if (st)
{
count = _count;
if (count == -1)
{
count = 0;
while (st[count]) ++count;
}
data = new short int[count];
int c = count + 1;
short int* dest = data-1;
st--;
while (--c) *(++dest) = *(++st);
}
else
{
count = 0;
data = NULL;
}
}
JogString( Ref<JogString> other )
{
if (*other)
{
count = other->count;
data = new short int[count];
memcpy( data, other->data, count*2 );
}
else
{
count = 0;
data = NULL;
}
}
~JogString()
{
if (data) delete data;
}
/*
int operator[]( int index )
{
return data[index];
}
*/
int get( int index )
{
if (index < 0) index += count;
return data[index];
}
Ref<ASCIIString> to_ascii()
{
StringBuilder buffer;
for (int i=0; i<count; ++i)
{
buffer.print( (char) data[i] );
}
return new ASCIIString(buffer.to_string());
}
void print()
{
for (int i=0; i<count; ++i)
{
putc( data[i], stdout );
}
}
void print( StringBuilder &buffer )
{
for (int i=0; i<count; ++i)
{
buffer.print((char)data[i]);
}
}
void print( UnicodeStringBuilder &buffer )
{
for (int i=0; i<count; ++i)
{
buffer.print(data[i]);
}
}
long long int to_int64()
{
long long int value = 0;
for (int i=0; i<count; ++i)
{
value <<= 4;
int ch;
ch = data[i];
if (ch <= '9') value |= (ch - '0');
else value |= (ch - ('A'-10));
}
return value;
}
int compare_to( Ref<JogString> other_ref )
{
JogString* other = *other_ref;
int c = other->count;
if (c > count) c = count;
short int* ptr1 = data - 1;
short int* ptr2 = other->data - 1;
++c;
while (--c)
{
if (*(++ptr1) != *(++ptr2))
{
if (*ptr1 < *ptr2) return int(data - ptr1) - 1;
else return int(ptr1 - data) + 1;
}
}
if (count < other->count) return -(count + 1);
else if (other->count < count) return other->count + 1;
return 0;
}
void add( const char* st )
{
int len = strlen(st);
short int* new_data = new short int[count + len];
short int* dest = new_data - 1;
{
short int* src = data - 1;
int c = count + 1;
while (--c) *(++dest) = *(++src);
}
{
const char* src = st - 1;
int c = len + 1;
while (--c) *(++dest) = *(++src);
}
if (data) delete data;
data = new_data;
count += len;
}
void add( Ref<JogString> other )
{
if (other->count == 0) return;
short int* new_data = new short int[count + other->count];
short int* src = data - 1;
short int* dest = new_data - 1;
int c = count + 1;
while (--c) *(++dest) = *(++src);
src = other->data - 1;
c = other->count + 1;
while (--c) *(++dest) = *(++src);
if (data) delete data;
data = new_data;
count += other->count;
}
bool equals( Ref<JogString> other )
{
if (count != other->count) return false;
short int* st1 = data - 1;
short int* st2 = other->data - 1;
int c = count + 1;
while (--c)
{
if (*(++st1) != *(++st2)) return false;
}
return true;
}
bool equals( const char* st )
{
int len = strlen(st);
if (count != len) return false;
short int* st1 = data - 1;
const char* st2 = st - 1;
int c = count + 1;
while (--c)
{
if (*(++st1) != *(++st2)) return false;
}
return true;
}
Ref<JogString> before_first( int ch )
{
int i = 0;
while (i < count)
{
if (data[i] == ch) break;
++i;
}
return new JogString( data, i );
}
Ref<JogString> substring( int i1 )
{
return new JogString( data+i1, count-i1 );
}
Ref<JogString> substring( int i1, int i2 )
{
return new JogString( data+i1, (i2-i1)+1 );
}
void split( int ch, RefList<JogString>& list )
{
int i1 = 0;
int i2 = i1;
while (i2 < count)
{
if (data[i2] == ',')
{
list.add( substring(i1,i2-1) );
i1 = i2 + 1;
i2 = i1;
}
else
{
++i2;
}
}
if (i2 > i1)
{
list.add( substring(i1,i2-1) );
}
}
};
struct JogStringComparator
{
bool operator()( Ref<JogString> a, Ref<JogString> b ) const
{
return a->compare_to(b) < 0;
}
};
struct JogError : RefCounted
{
Ref<ASCIIString> message;
Ref<RefCounted> reader;
int line, column;
JogError( const char* message, Ref<RefCounted> reader, int line, int column )
: reader(reader), line(line), column(column)
{
this->message = new ASCIIString(message);
}
JogError( const char* message )
: reader(NULL), line(0), column(0)
{
this->message = new ASCIIString(message);
}
JogError( Ref<ASCIIString> message, Ref<RefCounted> reader, int line, int column )
: message(message), reader(reader), line(line), column(column)
{
}
~JogError()
{
}
void print();
Ref<ASCIIString> context();
};
int jog_char_to_value( int ch );
int jog_is_digit( int ch, int base );
struct JogReader : RefCounted
{
static string random_seed;
Ref<ASCIIString> filename;
int line, column;
short int* data;
int remaining;
int pos;
int original_size;
JogReader( const char* filename );
JogReader( const char* filename, const char* data, int size );
JogReader( Ref<JogReader> existing );
void init( const char* filename, const char* data, int size );
~JogReader();
int peek();
int peek( int num_ahead );
int read();
bool consume( int ch );
};
#define TOKEN_EOF 1
#define TOKEN_EOL 2
#define TOKEN_ID 3
#define TOKEN_LITERAL_CHAR 4
#define TOKEN_LITERAL_DOUBLE 5
#define TOKEN_LITERAL_FLOAT 6
#define TOKEN_LITERAL_LONG 7
#define TOKEN_LITERAL_INT 8
#define TOKEN_LITERAL_INT_V 9
#define TOKEN_LITERAL_LONG_V 10
// INT_V is -2^31
// LONG_V is -2^63
// These work around a special case overflow check.
#define TOKEN_STRING 11
#define TOKEN_UNKNOWN 12
#define TOKEN_BANG 13
#define TOKEN_PERCENT 14
#define TOKEN_AMPERSAND 15
#define TOKEN_LPAREN 16
#define TOKEN_RPAREN 17
#define TOKEN_STAR 18
#define TOKEN_PLUS 19
#define TOKEN_COMMA 20
#define TOKEN_MINUS 21
#define TOKEN_PERIOD 22
#define TOKEN_SLASH 23
#define TOKEN_COLON 24
#define TOKEN_SEMICOLON 25
#define TOKEN_LT 26
#define TOKEN_ASSIGN 27
#define TOKEN_GT 28
#define TOKEN_QUESTIONMARK 29
#define TOKEN_LBRACKET 30
#define TOKEN_BACKSLASH 31
#define TOKEN_RBRACKET 32
#define TOKEN_CARET 33
#define TOKEN_LCURLY 34
#define TOKEN_PIPE 35
#define TOKEN_RCURLY 36
#define TOKEN_TILDE 37
#define TOKEN_NE 38
#define TOKEN_MOD_ASSIGN 39
#define TOKEN_LOGICAL_AND 40
#define TOKEN_AND_ASSIGN 41
#define TOKEN_MUL_ASSIGN 42
#define TOKEN_ADD_ASSIGN 43
#define TOKEN_INCREMENT 44
#define TOKEN_DECREMENT 45
#define TOKEN_SUB_ASSIGN 46
#define TOKEN_DIV_ASSIGN 47
#define TOKEN_SHL 48
#define TOKEN_SHL_ASSIGN 49
#define TOKEN_LE 50
#define TOKEN_EQ 51
#define TOKEN_GE 52
#define TOKEN_SHRX 53
#define TOKEN_SHRX_ASSIGN 54
#define TOKEN_SHR 55
#define TOKEN_SHR_ASSIGN 56
#define TOKEN_XOR_ASSIGN 57
#define TOKEN_OR_ASSIGN 58
#define TOKEN_LOGICAL_OR 59
#define TOKEN_ABSTRACT 60
#define TOKEN_ASSERT 61
#define TOKEN_BREAK 62
#define TOKEN_CASE 63
#define TOKEN_CATCH 64
#define TOKEN_CLASS 65
#define TOKEN_CONST 66
#define TOKEN_CONTINUE 67
#define TOKEN_DEFAULT 68
#define TOKEN_DO 69
#define TOKEN_ELSE 70
#define TOKEN_ENUM 71
#define TOKEN_EXTENDS 72
#define TOKEN_FALSE 73
#define TOKEN_FINAL 74
#define TOKEN_FINALLY 75
#define TOKEN_FOR 76
#define TOKEN_GOTO 77
#define TOKEN_IF 78
#define TOKEN_IMPLEMENTS 79
#define TOKEN_IMPORT 80
#define TOKEN_INSTANCEOF 81
#define TOKEN_INTERFACE 82
#define TOKEN_NATIVE 83
#define TOKEN_NEW 84
#define TOKEN_NULL 85
#define TOKEN_PACKAGE 86
#define TOKEN_PRIVATE 87
#define TOKEN_PROTECTED 88
#define TOKEN_PUBLIC 89
#define TOKEN_RETURN 90
#define TOKEN_STATIC 91
#define TOKEN_STRICTFP 92
#define TOKEN_SUPER 93
#define TOKEN_SWITCH 94
#define TOKEN_SYNCHRONIZED 95
#define TOKEN_THROW 96
#define TOKEN_THROWS 97
#define TOKEN_TRANSIENT 98
#define TOKEN_TRUE 99
#define TOKEN_TRY 100
#define TOKEN_VOLATILE 101
#define TOKEN_WHILE 102
#define JOG_SHR( type, value, bits ) \
(bits) ? ((value >> bits) & ((((type)1) << ((sizeof(type)*8)-bits)) - 1)) : value
struct StringComparator
{
bool operator()( const char* a, const char* b ) const
{
return strcmp(a,b) < 0;
}
};
typedef map<const char*,int,StringComparator> KeywordMap;
extern KeywordMap keywords;
extern const char* token_name_lookup[];
struct JogToken : RefCounted
{
Ref<JogReader> reader;
Ref<JogString> content;
int line, column, type;
JogToken( Ref<JogReader> reader, int line=0, int column=0 ) :
reader(reader), line(line), column(column), type(0)
{
}
~JogToken()
{
}
void print()
{
switch (type)
{
case TOKEN_ID: printf( "%s\n", content->to_ascii()->data ); break;
case TOKEN_LITERAL_CHAR: printf( "char(%s)\n", content->to_ascii()->data ); break;
case TOKEN_LITERAL_DOUBLE:
case TOKEN_LITERAL_FLOAT:
case TOKEN_LITERAL_LONG:
case TOKEN_LITERAL_INT:
printf( "#%s\n", content->to_ascii()->data ); break;
case TOKEN_LITERAL_INT_V:
printf( "#2^31\n" ); break;
case TOKEN_LITERAL_LONG_V:
printf( "#2^63\n" ); break;
case TOKEN_STRING: printf( "\"%s\"\n", content->to_ascii()->data ); break;
default: printf( "%s\n", token_name_lookup[type] ); break;
}
}
Ref<JogError> error( const char* message )
{
return new JogError(message,*reader,line,column);
}
Ref<JogError> error( Ref<ASCIIString> message )
{
return new JogError(message,*reader,line,column);
}
};
struct JogScanner : RefCounted
{
Ref<JogReader> reader;
Ref<JogToken> next;
RefList<JogToken> pending_stack;
RefList<JogToken> history_stack;
ArrayList<int> marks;
StringBuilder buffer;
UnicodeStringBuilder unicode_buffer;
JogScanner( Ref<JogReader> reader );
JogScanner( RefList<JogToken>& tokens );
static void set_up_keywords();
void consume_ws();
bool has_another();
Ref<JogToken> peek();
Ref<JogToken> peek( int num_ahead );
Ref<JogToken> read();
void set_mark();
void clear_mark();
void rewind_to_mark();
bool next_is( int token_type );
bool next_is( const char* identifier );
bool consume( int token_type );
bool consume( const char* identifier );
void must_consume( int token_type, const char* error_mesg );
void must_consume_semicolon( Ref<JogToken> t );
Ref<JogString> must_read_id( const char* error_mesg );
void prep_next();
void error( const char* mesg );
bool consume_char( int ch );
void must_consume_char( int ch );
void scan_number();
void scan_real();
Ref<JogString> to_hex_string( long long int n, int bits );
void scan_string();
int scan_char();
};
//=============================================================================
// JogCmd
//=============================================================================
struct JogTypeInfo;
struct JogVM;
struct JogCmd : RefCounted
{
//static Ref<JogCmd> cmd_push_dummy_ref;
virtual int node_type() { return __LINE__; }
Ref<JogToken> t;
JogCmd( Ref<JogToken> t ) : t(t) { }
virtual void print() = 0;
virtual bool is_literal() { return false; }
virtual bool is_literal_int() { return false; }
virtual bool is_loop() { return false; }
virtual void on_continue( JogVM* vm ) { }
virtual JogTypeInfo* reinterpret_as_type() { return NULL; }
JogTypeInfo* as_type();
virtual JogTypeInfo* type() = 0;
JogTypeInfo* require_value();
Ref<JogCmd> discarding_result();
virtual Ref<JogCmd> resolve( Ref<JogCmd> context )
{
throw t->error( "[Internal] Resolve-in-context not supported by this node." );
}
virtual Ref<JogCmd> resolve( JogTypeInfo* class_context, Ref<JogCmd> context )
{
throw t->error( "No such class member." );
}
virtual Ref<JogCmd> resolve_assignment( Ref<JogCmd> context, Ref<JogCmd> new_value )
{
throw t->error( "Illegal assignment." );
}
virtual Ref<JogCmd> resolve_assignment( JogTypeInfo* class_context, Ref<JogCmd> context,
Ref<JogCmd> new_value )
{
throw t->error( "Illegal assignment." );
}
virtual Ref<JogCmd> resolve_op_assign( int op_type, Ref<JogCmd> context, Ref<JogCmd> rhs )
{
throw t->error( "Illegal assignment." );
}
virtual Ref<JogCmd> resolve_op_assign( int op_type, JogTypeInfo* class_context,
Ref<JogCmd> context, Ref<JogCmd> rhs )
{
throw t->error( "Illegal assignment." );
}
virtual Ref<JogCmd> resolve_stepcount_access( int when, int modifier )
{
throw t->error( "++/-- operand must be a single variable." );
}
virtual Ref<JogCmd> resolve_stepcount_access( int when, int modifier,
JogTypeInfo* class_context, Ref<JogCmd> context )
{
throw t->error( "++/-- operand must be a single variable." );
}
virtual Ref<JogCmd> resolve_stepcount_access( int when, int modifier, Ref<JogCmd> context )
{
throw t->error( "++/-- operand must be a single variable." );
}
virtual Ref<JogCmd> resolve();
virtual Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
virtual void on_push( JogVM* vm );
virtual void execute( JogVM* vm );
void require_boolean();
JogTypeInfo* require_integer();
JogTypeInfo* require_integer_or_boolean();
JogTypeInfo* require_reference();
JogTypeInfo* require_instance_of( JogTypeInfo* base_type );
JogTypeInfo* require_primitive();
virtual Ref<JogCmd> box( JogTypeInfo* as_type );
Ref<JogError> error( const char* mesg ) { return t->error(mesg); }
JogInt64 zero_check( JogInt64 value )
{
if (value == 0) throw t->error( "Illegal division by zero." );
return value;
}
JogInt32 zero_check( JogInt32 value )
{
if (value == 0) throw t->error( "Illegal division by zero." );
return value;
}
JogInt16 zero_check( JogInt16 value )
{
if (value == 0) throw t->error( "Illegal division by zero." );
return value;
}
JogInt8 zero_check( JogInt8 value )
{
if (value == 0) throw t->error( "Illegal division by zero." );
return value;
}
JogChar zero_check( JogChar value )
{
if (value == 0) throw t->error( "Illegal division by zero." );
return value;
}
JogMethodInfo* resolve_call( Ref<JogToken> t, JogTypeInfo* context_type,
Ref<JogString> name, Ref<JogCmd> args, bool allow_object_methods=true );
};
//=============================================================================
// JogInstruction
//=============================================================================
struct JogInstruction
{
JogCmd* command;
int state; // command-specific state
JogInstruction() : command(NULL), state(0)
{
}
JogInstruction( JogCmd* cmd ) : command(cmd), state(0)
{
}
JogInstruction( JogCmd* cmd, int state ) : command(cmd), state(state)
{
}
};
//=============================================================================
// JogObject, JogRef
//=============================================================================
struct JogObject
{
int reference_count;
int count; // number of elements for an array, unused for other objects
JogObject* next_object;
JogTypeInfo* type;
JogInt64 data[1]; // may actually be any size
// Note: all object data is externally memset to 0 when it is declared.
~JogObject();
inline void retain()
{
++reference_count;
}
inline void release()
{
if ( !--reference_count ) release_refs();
}
void release_refs();
int total_object_bytes();
void index_check( Ref<JogToken> t, int index )
{
if ( (unsigned int) index >= (unsigned int) count )
{
throw t->error( "Array index out of bounds." );
}
}
};
struct JogRef
{
JogObject* object;
JogRef() : object(NULL) { }
JogRef( JogObject* object ) : object(object)
{
if (object) object->retain();
}
JogRef( const JogRef& existing )
{
object = NULL;
operator=(existing);
}
~JogRef()
{
if (object)
{
object->release();
object = NULL;
}
}
JogObject* null_check( Ref<JogToken> t )
{
if (object == NULL) throw t->error( "Null Pointer Exception." );
return object;
}
void operator=( const JogRef& other )
{
if (other.object) other.object->retain();
if (object) object->release();
object = other.object;
}
void operator=( JogObject* new_object )
{
if (object) object->release();
object = new_object;
if (object) object->retain();
}
JogObject* operator*()
{
return (JogObject*) object;
}
JogObject* operator->()
{
return (JogObject*) object;
}
bool operator==( void* other )
{
return object == other;
}
bool operator==( JogRef other )
{
return object == other.object;
}
bool operator!=( void* other )
{
return object != other;
}
bool operator!=( JogRef other )
{
return object != other.object;
}
bool operator!()
{
return object ? false : true;
}
};
//=============================================================================
// JogStackFrame
//=============================================================================
struct JogStackFrame
{
JogInstruction* instruction_stack_ptr;
JogInt64* data_stack_ptr;
JogRef* ref_stack_ptr;
JogMethodInfo* called_method;
JogStackFrame()
{
}
void init( JogInstruction* instruction, JogInt64* data, JogRef* ref,
JogMethodInfo* called_method )
{
instruction_stack_ptr = instruction;
data_stack_ptr = data;
ref_stack_ptr = ref;
this->called_method = called_method;
}
};
//=============================================================================
// JogVM
//=============================================================================
#define JOG_INSTRUCTION_STACK_CAPACITY 1024
#define JOG_DATA_STACK_CAPACITY 8192
#define JOG_REF_STACK_CAPACITY 8192
#define JOG_FRAME_STACK_CAPACITY 1024
typedef void (*JogNativeMethodHandler)(JogVM*);
class JogNativeMethodLookup : public map<Ref<JogString>,JogNativeMethodHandler,JogStringComparator>
{
public:
bool contains( Ref<JogString> sig )
{
return (map<Ref<JogString>,JogNativeMethodHandler,JogStringComparator>::find(sig) != end());
}
JogNativeMethodHandler find( Ref<JogString> sig )
{
JogNativeMethodLookup::iterator entry = map<Ref<JogString>,JogNativeMethodHandler,JogStringComparator>::find(sig);
if (entry == end()) return NULL;
return entry->second;
}
};
struct JogParser;
struct JogVM : RefCounted
{
int max_object_bytes; // set as desired
int cur_object_bytes; // internal
JogObject* all_objects;
JogInstruction instruction_stack[JOG_INSTRUCTION_STACK_CAPACITY];
JogInstruction* instruction_stack_ptr;
JogInstruction* instruction_stack_limit;
JogInt64 data_stack[JOG_DATA_STACK_CAPACITY];
JogInt64* data_stack_ptr;
JogInt64* data_stack_limit;
JogRef ref_stack[JOG_REF_STACK_CAPACITY];
JogRef* ref_stack_ptr;
JogRef* ref_stack_limit;
JogStackFrame frames[JOG_FRAME_STACK_CAPACITY];
JogStackFrame* frame_ptr;
JogStackFrame* frame_stack_limit;
JogNativeMethodLookup native_methods;
ArrayList<JogTypeInfo*> parsed_types;
void* user_context;
int timeout_seconds; // default 0 (no timeout)
int random_seed;
JogVM();
~JogVM() { reset(); }
void reset();
void parse( string filename );
void parse( string filename, string content );
void parse( Ref<JogParser> parser );
void compile();
void run( const char* main_class_name );
void add_native_handlers();
void add_native_handler( const char* signature, JogNativeMethodHandler handler )
{
add_native_handler( new JogString(signature), handler );
}
void add_native_handler( Ref<JogString> signature, JogNativeMethodHandler handler );
JogRef create_object( JogTypeInfo* of_type );
JogRef create_array( JogTypeInfo* of_type, int count );
JogRef create_string( JogChar* data, int count );
// Note: makes a copy of 'data'.
JogRef create_string( JogRef array );
void force_garbage_collection();
void delete_all_objects();
void register_object( JogObject* obj, int byte_size );
void push_frame( JogMethodInfo* method_info );
void pop_frame()
{
if (frame_ptr == frame_stack_limit)
{
Ref<JogError> err = new JogError("[Internal] Frame stack underflow.");
throw err;
}
instruction_stack_ptr = frame_ptr->instruction_stack_ptr;
data_stack_ptr = frame_ptr->data_stack_ptr;
JogRef* target_ptr = frame_ptr->ref_stack_ptr;
JogRef* cur_ptr = ref_stack_ptr;
while (cur_ptr != target_ptr) *(cur_ptr++) = NULL;
ref_stack_ptr = cur_ptr;
++frame_ptr;
}
void push( JogCmd* cmd )
{
if (instruction_stack_ptr == instruction_stack)
{
throw cmd->error("Instruction stack limit reached during recursion.");
}
*(--instruction_stack_ptr) = JogInstruction(cmd);
cmd->on_push(this);
}
void push( JogCmd* cmd, int execution_state )
{
if (instruction_stack_ptr == instruction_stack)
{
throw cmd->error("Instruction stack limit reached during recursion.");
}
*(--instruction_stack_ptr) = JogInstruction(cmd,execution_state);
}
void push( JogInt64 value )
{
if (data_stack_ptr == data_stack)
{
Ref<JogError> err = new JogError("Data stack limit reached during recursion.");
throw err;
}
*(--data_stack_ptr) = value;
}
void push( int value )
{
if (data_stack_ptr == data_stack)
{
Ref<JogError> err = new JogError("Data stack limit reached during recursion.");
throw err;
}
*(--data_stack_ptr) = value;
}
void push( double value )
{
if (data_stack_ptr == data_stack)
{
Ref<JogError> err = new JogError("Data stack limit reached during recursion.");
throw err;
}
*(--data_stack_ptr) = *((JogInt64*)&value);
}
void push( JogRef object );
JogInt64 pop_data()
{
if (data_stack_ptr == data_stack_limit)
{
Ref<JogError> err = new JogError("[Internal] Data stack underflow.");
throw err;
}
return *(data_stack_ptr++);
}
double pop_data_as_Real64()
{
if (data_stack_ptr == data_stack_limit)
{
Ref<JogError> err = new JogError("[Internal] Data stack underflow.");
throw err;
}
JogInt64 result = *(data_stack_ptr++);
return *((double*)&result);
}
JogInt64 pop_long()
{
if (data_stack_ptr == data_stack_limit)
{
Ref<JogError> err = new JogError("[Internal] Data stack underflow.");
throw err;
}
return *(data_stack_ptr++);
}
int pop_int()
{
if (data_stack_ptr == data_stack_limit)
{
Ref<JogError> err = new JogError("[Internal] Data stack underflow.");
throw err;
}
return (int) *(data_stack_ptr++);
}
double pop_double()
{
if (data_stack_ptr == data_stack_limit)
{
Ref<JogError> err = new JogError("[Internal] Data stack underflow.");
throw err;
}
JogInt64 result = *(data_stack_ptr++);
return *((double*)&result);
}
JogRef pop_ref()
{
if (ref_stack_ptr == ref_stack_limit)
{
Ref<JogError> err = new JogError("[Internal] Ref stack underflow.");
throw err;
}
JogRef result = *ref_stack_ptr;
*(ref_stack_ptr++) = NULL;
return result;
}
JogInt64 peek_data()
{
return *data_stack_ptr;
}
double peek_data_as_Real64()
{
JogInt64 result = *data_stack_ptr;
return *((double*)&result);
}
JogRef peek_ref()
{
return *ref_stack_ptr;
}
int execution_state()
{
// Returns and increments the execution state of the current
// instruction. 0 will be the first value returned.
return instruction_stack_ptr[-1].state++;
}
void run_this_again()
{
// The current instruction was just popped off the stack, so
// bumping up the stack position will run it again.
// CAUTION: run_this_again() must be called before any new
// commands are pushed on the stack.
--instruction_stack_ptr;
}
JogInt64 cur_time()
{
return time(0);
}
void execute()
{
JogInt64 timeout_target = timeout_seconds;
if (timeout_target) timeout_target += cur_time();
while (instruction_stack_ptr != instruction_stack_limit)
{
if (timeout_target && timeout_target <= cur_time())
{
throw instruction_stack_ptr->command->t->error(
"Timeout - your program is taking too long. Do you have an infinite loop?" );
}
JogCmd* cmd = (instruction_stack_ptr++)->command;
cmd->execute(this);
}
}
void execute_until( JogInstruction* target_pos )
{
JogInt64 timeout_target = timeout_seconds;
if (timeout_target) timeout_target += cur_time();
while (instruction_stack_ptr < target_pos)
{
if (timeout_target && timeout_target <= cur_time())
{
throw instruction_stack_ptr->command->t->error(
"Timeout - your program is taking too long. Do you have an infinite loop?" );
}
JogCmd* cmd = (instruction_stack_ptr++)->command;
cmd->execute(this);
}
}
void call_native( JogMethodInfo* m );
// internal use
void call_void_method( JogRef context, const char* signature );
};
//=============================================================================
// JogCmdList
//=============================================================================
struct JogCmdList : JogCmd
{
int node_type() { return __LINE__; }
RefList<JogCmd> commands;
JogCmdList( Ref<JogToken> t ) : JogCmd(t)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
for (int i=0; i<commands.count; ++i)
{
printf(" ");
commands[i]->print();
printf("\n");
}
}
void add( Ref<JogCmd> cmd )
{
commands.add( cmd );
}
int count() { return commands.count; }
Ref<JogCmd> operator[]( int index )
{
return commands[index];
}
Ref<JogCmd> resolve();
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogStatementList : JogCmdList
{
int node_type() { return __LINE__; }
JogStatementList( Ref<JogToken> t ) : JogCmdList(t)
{
}
Ref<JogCmd> resolve();
};
#define JOG_QUALIFIER_PUBLIC 1
#define JOG_QUALIFIER_PROTECTED 2
#define JOG_QUALIFIER_PRIVATE 4
#define JOG_QUALIFIER_STATIC 8
#define JOG_QUALIFIER_NATIVE 16
#define JOG_QUALIFIER_CLASS 32
#define JOG_QUALIFIER_INTERFACE 64
#define JOG_QUALIFIER_PRIMITIVE 128
#define JOG_QUALIFIER_CONSTRUCTOR 256
#define JOG_QUALIFIER_ABSTRACT 512
#define JOG_QUALIFIER_REFERENCE (JOG_QUALIFIER_CLASS | JOG_QUALIFIER_INTERFACE)
//=============================================================================
// JogPropertyInfo
//=============================================================================
struct JogPropertyInfo : RefCounted
{
Ref<JogToken> t;
int qualifiers;
int index; // in object data
JogTypeInfo* type_context;
JogTypeInfo* type;
Ref<JogString> name;
Ref<JogCmd> initial_value;
JogPropertyInfo( Ref<JogToken> t, int qualifiers, JogTypeInfo* type_context,
JogTypeInfo* type, Ref<JogString> name, Ref<JogCmd> initial_value );
bool is_static() { return (qualifiers & JOG_QUALIFIER_STATIC) != 0; }
void print();
/*
JogPropertyInfo* duplicate()
{
JogPropertyInfo* result = new JogPropertyInfo( t, qualifiers, type, name, NULL );
result->index = index;
return result;
}
*/
};
//=============================================================================
// JogLocalVarInfo
//=============================================================================
struct JogLocalVarInfo : RefCounted
{
Ref<JogToken> t;
JogTypeInfo* type;
Ref<JogString> name;
int index;
int offset; // relative to stack frame
JogLocalVarInfo( Ref<JogToken> t, JogTypeInfo* type, Ref<JogString> name );
void print();
};
//=============================================================================
// JogMethodInfo
//=============================================================================
struct JogMethodInfo : RefCounted
{
static int next_method_id;
Ref<JogToken> t;
int qualifiers;
JogTypeInfo* type_context;
JogTypeInfo* return_type;
bool calls_super_constructor;
Ref<JogString> name;
Ref<JogString> signature;
Ref<JogString> full_signature;
RefList<JogLocalVarInfo> parameters;
RefList<JogLocalVarInfo> locals; // Includes parameters
Ref<JogStatementList> statements;
int method_id;
int dispatch_id;
JogNativeMethodHandler native_handler;
int param_data_count;
int param_ref_count; // includes object context
int local_data_count;
int local_ref_count;
bool organized;
bool resolved;
JogMethodInfo( Ref<JogToken> t, int qualifiers, JogTypeInfo* type_context,
JogTypeInfo* return_type, Ref<JogString> name );
void print();
bool is_static() { return (qualifiers & JOG_QUALIFIER_STATIC) != 0; }
bool is_native() { return (qualifiers & JOG_QUALIFIER_NATIVE) != 0; }
bool is_constructor() { return (qualifiers & JOG_QUALIFIER_CONSTRUCTOR) != 0; }
bool is_abstract() { return (qualifiers & JOG_QUALIFIER_ABSTRACT) != 0; }
bool is_less_specific_than( JogMethodInfo* other );
bool is_inherited( JogTypeInfo* by_type );
void organize();
void resolve();
};
//=============================================================================
// JogTypeInfo
//=============================================================================
class JogPropertyLookup : public map<Ref<JogString>,JogPropertyInfo*,JogStringComparator>
{
public:
bool contains( Ref<JogString> name )
{
return ((*this)[name] != NULL);
}
};
class JogDispatchIDLookup : public map<Ref<JogString>,int,JogStringComparator>
{
public:
int next_id;
JogDispatchIDLookup() : next_id(1) { }
int& operator[]( Ref<JogString> sig )
{
int& result = map<Ref<JogString>,int,JogStringComparator>::operator[](sig);
if (result == 0)
{
result = next_id++;
}
return result;
}
};
class JogMethodLookup : public map<Ref<JogString>,JogMethodInfo*,JogStringComparator>
{
public:
bool contains( Ref<JogString> signature )
{
return (find(signature) != end());
}
bool contains( const char* st )
{
Ref<JogString> signature = new JogString(st);
return contains( signature );
}
JogMethodInfo*& operator[]( Ref<JogString> st )
{
return map<Ref<JogString>,JogMethodInfo*,JogStringComparator>::operator[](st);
}
JogMethodInfo*& operator[]( const char* st )
{
Ref<JogString> signature = new JogString(st);
return operator[](signature);
}
};
class JogMethodSet : public map<Ref<JogString>,ArrayList<JogMethodInfo*>*,JogStringComparator>
{
public:
bool contains( Ref<JogString> name )
{
return (find(name) != end());
}
};
struct JogPlaceholderType
{
JogTypeInfo* type;
JogPlaceholderType( JogTypeInfo* type ) : type(type) { }
};
struct JogTypeInfo : RefCounted
{
int qualifiers; // Bitwise combination of JOG_QUALIFIER_X
// in bytes
int class_data_count;
int data_count;
int object_size;
int element_size;
JogInt64* class_data;
Ref<JogToken> t;
Ref<JogString> name;
RefList<JogPropertyInfo> class_properties;
RefList<JogMethodInfo> class_methods;
RefList<JogPropertyInfo> properties;
RefList<JogMethodInfo> methods;
RefList<JogMethodInfo> static_initializers;
Ref<JogMethodInfo> m_init_object;
Ref<JogCmd> call_init_object;
ArrayList<JogMethodInfo*> dispatch_table;
JogTypeInfo* element_type; // Only non-NULL for arrays.
JogTypeInfo* base_class; // set to NULL for Object, set to Object for aspects
ArrayList<JogTypeInfo*> interfaces;
ArrayList<JogPlaceholderType> placeholder_types;
RefList<JogToken> template_tokens;
JogPropertyLookup class_properties_by_name;
JogPropertyLookup properties_by_name;
JogMethodSet class_methods_by_name;
JogMethodSet methods_by_name;
JogMethodLookup class_methods_by_signature;
JogMethodLookup methods_by_signature;
bool organized;
bool prepped;
bool resolved;
static JogTypeInfo* create( Ref<JogToken> t, int qualifiers, Ref<JogString> name );
static JogTypeInfo* create( Ref<JogToken> t, int qualifiers, const char* name );
static JogTypeInfo* reference( Ref<JogToken> t, Ref<JogString> name );
static JogTypeInfo* reference_array( Ref<JogToken> t, Ref<JogString> name, int dimensions );
static JogTypeInfo* find( Ref<JogString> name );
static JogTypeInfo* find( const char* name ) { return find(new JogString(name)); }
JogTypeInfo() :
class_data(NULL),
element_type(NULL),
base_class(NULL),
organized(false), prepped(false), resolved(false)
{
}
~JogTypeInfo()
{
if (class_data)
{
delete class_data;
class_data = NULL;
}
}
JogRef create_instance( JogVM* vm )
{
JogObject* obj = (JogObject*) new char[object_size];
memset( obj, 0, object_size );
obj->type = this;
JogRef result(obj);
vm->register_object(obj,object_size);
return result;
}
JogRef create_array( JogVM* vm, int count );
bool is_type() { return (qualifiers != 0); }
bool is_array() { return element_type != NULL; }
bool is_template() { return placeholder_types.count > 0; }
bool instance_of( JogTypeInfo* base_type );
bool is_class() { return (qualifiers & JOG_QUALIFIER_CLASS) != 0; }
bool is_interface() { return (qualifiers & JOG_QUALIFIER_INTERFACE) != 0; }
bool is_primitive() { return (qualifiers & JOG_QUALIFIER_PRIMITIVE) != 0; }
bool is_reference() { return (qualifiers & JOG_QUALIFIER_REFERENCE) != 0; }
bool is_abstract() { return (qualifiers & JOG_QUALIFIER_ABSTRACT) != 0; }
bool is_boolean();
bool is_real();
bool is_integer();
int precision();
bool is_compatible_with( JogTypeInfo* other );
JogTypeInfo* wrapper_type();
void print()
{
name->print();
}
void print_members()
{
name->print();
printf("\n");
for (int i=0; i<properties.count; ++i) properties[i]->print();
for (int i=0; i<class_methods.count; ++i) class_methods[i]->print();
for (int i=0; i<methods.count; ++i) methods[i]->print();
}
void organize();
void prep();
void add( Ref<JogMethodInfo> m );
void resolve();
};
//=============================================================================
// JogTypeManager
//=============================================================================
class JogTypeLookup : public map<Ref<JogString>,Ref<JogTypeInfo>,JogStringComparator>
{
public:
bool contains( Ref<JogString> name ) const
{
return (find(name) != end());
}
};
struct JogTypeManager
{
JogTypeLookup type_lookup;
JogDispatchIDLookup dispatch_id_lookup;
JogTypeInfo* type_void;
JogTypeInfo* type_real64;
JogTypeInfo* type_real32;
JogTypeInfo* type_int64;
JogTypeInfo* type_int32;
JogTypeInfo* type_int16;
JogTypeInfo* type_int8;
JogTypeInfo* type_char;
JogTypeInfo* type_boolean;
JogTypeInfo* type_number;
JogTypeInfo* type_real64_wrapper;
JogTypeInfo* type_real32_wrapper;
JogTypeInfo* type_int64_wrapper;
JogTypeInfo* type_int32_wrapper;
JogTypeInfo* type_int16_wrapper;
JogTypeInfo* type_int8_wrapper;
JogTypeInfo* type_char_wrapper;
JogTypeInfo* type_boolean_wrapper;
JogTypeInfo* type_object;
JogTypeInfo* type_null;
JogTypeInfo* type_string;
JogTypeInfo* type_char_array;
JogTypeManager()
{
init();
}
~JogTypeManager()
{
clear();
}
void init()
{
clear();
Ref<JogReader> reader = new JogReader( "[INTERNAL]", NULL, 0 );
Ref<JogToken> t = new JogToken( reader, 0, 0 );
int quals = JOG_QUALIFIER_PRIMITIVE;
type_void = JogTypeInfo::create( t, quals, "void" );
type_real64 = JogTypeInfo::create( t, quals, "double" );
type_real32 = JogTypeInfo::create( t, quals, "float" );
type_int64 = JogTypeInfo::create( t, quals, "long" );
type_int32 = JogTypeInfo::create( t, quals, "int" );
type_int16 = JogTypeInfo::create( t, quals, "short" );
type_int8 = JogTypeInfo::create( t, quals, "byte" );
type_char = JogTypeInfo::create( t, quals, "char" );
type_boolean = JogTypeInfo::create( t, quals, "boolean" );
type_null = JogTypeInfo::create( t, JOG_QUALIFIER_CLASS|JOG_QUALIFIER_PUBLIC, "null" );
type_real64->organized = true;
type_real32->organized = true;
type_int64->organized = true;
type_int32->organized = true;
type_int16->organized = true;
type_int8->organized = true;
type_char->organized = true;
type_boolean->organized = true;
type_real64->element_size = 8;
type_real32->element_size = 4;
type_int64->element_size = 8;
type_int32->element_size = 4;
type_int16->element_size = 2;
type_int8->element_size = 1;
type_char->element_size = 2;
type_boolean->element_size = 1;
}
void clear()
{
type_lookup.clear();
dispatch_id_lookup.clear();
type_void = NULL;
type_real64 = NULL;
type_real32 = NULL;
type_int64 = NULL;
type_int32 = NULL;
type_int16 = NULL;
type_int8 = NULL;
type_char = NULL;
type_boolean = NULL;
type_number = NULL;
type_real64_wrapper = NULL;;
type_real32_wrapper = NULL;
type_int64_wrapper = NULL;
type_int32_wrapper = NULL;
type_int16_wrapper = NULL;
type_int8_wrapper = NULL;
type_char_wrapper = NULL;
type_boolean_wrapper = NULL;
type_object = NULL;
type_null = NULL;
type_string = NULL;
type_char_array = NULL;
}
JogTypeInfo* must_find_type( const char* name );
JogTypeInfo* find_common_type( JogToken* t, JogCmd* cmd1, JogCmd* cmd2, bool min32=false );
JogTypeInfo* find_common_type( JogToken* t, JogTypeInfo* type1, JogTypeInfo* type2,
bool min32=false );
};
extern JogTypeManager jog_type_manager;
struct JogCmdLiteralReal64 : JogCmd
{
int node_type() { return __LINE__; }
double value;
JogCmdLiteralReal64( Ref<JogToken> t, double value ) : JogCmd(t), value(value) { }
JogCmdLiteralReal64( Ref<JogToken> t, Ref<JogString> hex_string ) : JogCmd(t)
{
long long int n = hex_string->to_int64();
value = *((double*)&n);
}
JogTypeInfo* type() { return jog_type_manager.type_real64; }
void print()
{
printf("%.4lf",value);
}
bool is_literal() { return true; }
Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralReal32 : JogCmd
{
int node_type() { return __LINE__; }
float value;
JogCmdLiteralReal32( Ref<JogToken> t, float value ) : JogCmd(t), value(value) { }
JogCmdLiteralReal32( Ref<JogToken> t, Ref<JogString> hex_string ) : JogCmd(t)
{
JogInt32 n = (JogInt32) hex_string->to_int64();
value = *((float*)&n);
}
JogTypeInfo* type() { return jog_type_manager.type_real32; }
void print()
{
printf("%.4ff",value);
}
bool is_literal() { return true; }
Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralInt64 : JogCmd
{
int node_type() { return __LINE__; }
JogInt64 value;
JogCmdLiteralInt64( Ref<JogToken> t, JogInt64 value ) : JogCmd(t), value(value) { }
JogCmdLiteralInt64( Ref<JogToken> t, Ref<JogString> hex_string ) : JogCmd(t)
{
value = hex_string->to_int64();
}
JogTypeInfo* type() { return jog_type_manager.type_int64; }
void print()
{
printf("%lldL",value);
}
bool is_literal() { return true; }
Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralInt32 : JogCmd
{
int node_type() { return __LINE__; }
int value;
JogCmdLiteralInt32( Ref<JogToken> t, int value ) : JogCmd(t), value(value) { }
JogCmdLiteralInt32( Ref<JogToken> t, Ref<JogString> hex_string ) : JogCmd(t)
{
value = int(hex_string->to_int64());
}
JogTypeInfo* type() { return jog_type_manager.type_int32; }
void print()
{
printf("%d",value);
}
bool is_literal() { return true; }
bool is_literal_int() { return true; }
Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralInt16 : JogCmd
{
int node_type() { return __LINE__; }
JogInt16 value;
JogCmdLiteralInt16( Ref<JogToken> t, int value ) : JogCmd(t), value(value) { }
JogCmdLiteralInt16( Ref<JogToken> t, Ref<JogString> hex_string ) : JogCmd(t)
{
value = JogInt16(hex_string->to_int64());
}
JogTypeInfo* type() { return jog_type_manager.type_int16; }
void print()
{
printf("%dS",(int)value);
}
bool is_literal() { return true; }
Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralInt8 : JogCmd
{
int node_type() { return __LINE__; }
JogInt8 value;
JogCmdLiteralInt8( Ref<JogToken> t, int value ) : JogCmd(t), value(value) { }
JogCmdLiteralInt8( Ref<JogToken> t, Ref<JogString> hex_string ) : JogCmd(t)
{
value = JogInt8(hex_string->to_int64());
}
JogTypeInfo* type() { return jog_type_manager.type_int8; }
void print()
{
printf("%dB",value);
}
bool is_literal() { return true; }
Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralChar : JogCmd
{
int node_type() { return __LINE__; }
int value;
JogCmdLiteralChar( Ref<JogToken> t, int value ) : JogCmd(t), value(value) { }
JogCmdLiteralChar( Ref<JogToken> t, Ref<JogString> hex_string ) : JogCmd(t)
{
value = JogChar(hex_string->to_int64());
}
JogTypeInfo* type() { return jog_type_manager.type_char; }
void print()
{
if (value >= 32 && value <= 126) printf("'%c'",value);
else printf("'%d'",value);
}
bool is_literal() { return true; }
bool is_literal_int() { return true; }
Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralBoolean : JogCmd
{
int node_type() { return __LINE__; }
bool value;
JogCmdLiteralBoolean( Ref<JogToken> t, bool value ) : JogCmd(t), value(value) { }
JogTypeInfo* type() { return jog_type_manager.type_boolean; }
void print()
{
printf( value ? "true" : "false" );
}
bool is_literal() { return true; }
Ref<JogCmd> cast_to_type( JogTypeInfo* to_type );
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralString : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogString> value;
JogRef runtime_object;
JogCmdLiteralString( Ref<JogToken> t, Ref<JogString> value ) : JogCmd(t), value(value) { }
JogTypeInfo* type() { return jog_type_manager.type_string; }
void print()
{
printf("\"");
value->print();
printf("\"");
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdArgs : JogCmdList
{
int node_type() { return __LINE__; }
JogCmdArgs( Ref<JogToken> t ) : JogCmdList(t)
{
}
void print()
{
printf("(");
if (commands.count > 0)
{
for (int i=0; i<commands.count; ++i)
{
if (i > 0 )printf(",");
commands[i]->print();
}
}
printf(")");
}
};
struct JogCmdLocalVarDeclarations : JogCmdList
{
int node_type() { return __LINE__; }
JogCmdLocalVarDeclarations( Ref<JogToken> t ) : JogCmdList(t)
{
}
void print()
{
for (int i=0; i<commands.count; ++i)
{
commands[i]->print();
printf("\n");
}
}
};
struct JogCmdAssert : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> expression;
Ref<ASCIIString> message;
bool resolved;
JogCmdAssert( Ref<JogToken> t, Ref<JogCmd> expression )
: JogCmd(t), expression(expression), resolved(false)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("assert (");
expression->print();
printf(")\n");
}
Ref<JogCmd> resolve();
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdBlock : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogStatementList> statements;
JogCmdBlock( Ref<JogToken> t ) : JogCmd(t)
{
statements = new JogStatementList(t);
}
JogTypeInfo* type() { return NULL; }
JogCmdBlock* add( Ref<JogCmd> cmd )
{
statements->add(cmd);
return this;
}
void print()
{
printf("{\n");
statements->print();
printf("}");
}
Ref<JogCmd> resolve();
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdControlStructure : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> body;
JogCmdControlStructure( Ref<JogToken> t ) : JogCmd(t)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
body->print();
}
};
struct JogCmdIf : JogCmdControlStructure
{
int node_type() { return __LINE__; }
Ref<JogCmd> expression;
Ref<JogCmd> else_body;
JogCmdIf( Ref<JogToken> t, Ref<JogCmd> expression )
: JogCmdControlStructure(t), expression(expression)
{
}
Ref<JogCmd> resolve();
void print()
{
printf("if (");
expression->print();
printf(")\n");
if (*body) body->print();
if (*else_body)
{
printf("else");
else_body->print();
}
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLoop : JogCmdControlStructure
{
int node_type() { return __LINE__; }
JogCmdLoop( Ref<JogToken> t ) : JogCmdControlStructure(t)
{
}
bool is_loop() { return true; }
};
struct JogCmdWhile : JogCmdLoop
{
int node_type() { return __LINE__; }
Ref<JogCmd> expression;
JogCmdWhile( Ref<JogToken> t, Ref<JogCmd> expression )
: JogCmdLoop(t), expression(expression)
{
}
void print()
{
printf("while (");
expression->print();
printf(")\n");
JogCmdControlStructure::print();
}
Ref<JogCmd> resolve();
void on_push( JogVM* vm );
void execute( JogVM* vm );
void on_continue( JogVM* vm );
};
struct JogCmdFor : JogCmdLoop
{
int node_type() { return __LINE__; }
Ref<JogCmd> initialization;
Ref<JogCmd> condition;
Ref<JogCmd> var_mod;
JogCmdFor( Ref<JogToken> t,
Ref<JogCmd> initialization, Ref<JogCmd> condition, Ref<JogCmd> var_mod )
: JogCmdLoop(t),
initialization(initialization), condition(condition), var_mod(var_mod)
{
}
void print()
{
printf("for (");
initialization->print();
printf(";");
condition->print();
printf(";");
var_mod->print();
printf(")\n");
JogCmdControlStructure::print();
}
Ref<JogCmd> resolve();
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdForEach : JogCmdLoop
{
int node_type() { return __LINE__; }
JogTypeInfo* local_type;
Ref<JogString> local_name;
Ref<JogCmd> iterable_expr;
JogCmdForEach( Ref<JogToken> t,
JogTypeInfo* local_type, Ref<JogString> local_name, Ref<JogCmd> iterable_expr )
: JogCmdLoop(t),
local_type(local_type), local_name(local_name), iterable_expr(iterable_expr)
{
}
void print()
{
printf("for (");
local_type->name->print();
printf(" ");
local_name->print();
printf(" : ");
iterable_expr->print();
printf(")\n");
JogCmdControlStructure::print();
}
Ref<JogCmd> resolve();
};
struct JogCmdBreak : JogCmd
{
int node_type() { return __LINE__; }
JogCmdBreak( Ref<JogToken> t ) : JogCmd(t)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("break");
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm ) { }
void execute( JogVM* vm );
};
struct JogCmdContinue : JogCmd
{
int node_type() { return __LINE__; }
JogCmdContinue( Ref<JogToken> t ) : JogCmd(t)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("continue");
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm ) { }
void execute( JogVM* vm );
};
struct JogCmdUnary : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> operand;
JogCmdUnary( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmd(t), operand(operand)
{
}
JogTypeInfo* type() { return operand->type(); }
void on_push( JogVM* vm );
};
struct JogCmdCast : JogCmdUnary
{
int node_type() { return __LINE__; }
JogTypeInfo* to_type;
JogCmdCast( Ref<JogToken> t, Ref<JogCmd> operand, JogTypeInfo* to_type )
: JogCmdUnary(t,operand), to_type(to_type)
{
}
JogTypeInfo* type() { return to_type; }
void print()
{
printf( "(" );
to_type->print();
printf( ")" );
operand->print();
}
Ref<JogCmd> cast_to_type( JogTypeInfo* new_type )
{
if (new_type == to_type) return this; // already cast
return JogCmd::cast_to_type(new_type);
}
Ref<JogCmd> resolve();
};
struct JogCmdAssign : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> location, new_value;
JogCmdAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> new_value )
: JogCmd(t), location(location), new_value(new_value)
{
/*
JogTypeInfo* storage_type = location->require_value();
JogTypeInfo* value_type = new_value->require_value();
if (storage_type->is_primitive() != value_type->is_primitive())
{
if (value_type->is_primitive())
{
throw error( "Cannot assign a primitive value to an object reference." );
}
else
{
throw error( "Cannot assign an object reference to a primitive value." );
}
}
if (storage_type->is_boolean() ^ value_type->is_boolean())
{
if (value_type->is_boolean())
{
throw error( "Cannot assign a boolean to a non-boolean value." );
}
else
{
throw error( "Cannot assign a non-boolean to a boolean value." );
}
}
if (value_type->precision() > storage_type->precision())
{
throw error( "The type of the value being assigned has greater precision than the variable it is being assigned to. Add a type cast (e.g. \"int i = x;\" -> \"int i = (int) x;\") to explicitly allow this loss of precision." );
}
this->new_value = new_value->cast_to_type( storage_type );
*/
}
JogTypeInfo* type() { return location->type(); }
void print()
{
printf( "(" );
location->print();
printf( "=" );
new_value->print();
printf( ")" );
}
Ref<JogCmd> resolve();
};
struct JogCmdOpAssign : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> location, rhs;
JogCmdOpAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmd(t), location(location), rhs(rhs)
{
/*
JogTypeInfo* storage_type = location->require_value();
JogTypeInfo* value_type = rhs->require_value();
if (storage_type->is_primitive() != value_type->is_primitive())
{
throw error( "Illegal operation between an object reference and a primitive." );
}
if (storage_type->is_boolean() ^ value_type->is_boolean())
{
throw error( "Illegal operation between a boolean and a non-boolean value." );
}
this->rhs = rhs->cast_to_type( storage_type );
*/
}
JogTypeInfo* type() { return location->type(); }
virtual const char* symbol() { return "???"; }
void print()
{
printf( "(" );
location->print();
printf( "%s", symbol() );
rhs->print();
printf( ")" );
}
};
struct JogCmdAddAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdAddAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "+="; }
Ref<JogCmd> resolve();
};
struct JogCmdSubAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdSubAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "-="; }
Ref<JogCmd> resolve();
};
struct JogCmdMulAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdMulAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "*="; }
Ref<JogCmd> resolve();
};
struct JogCmdDivAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdDivAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "/="; }
Ref<JogCmd> resolve();
};
struct JogCmdModAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdModAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "%%="; }
Ref<JogCmd> resolve();
};
struct JogCmdAndAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdAndAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "&="; }
Ref<JogCmd> resolve();
};
struct JogCmdOrAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdOrAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "|="; }
Ref<JogCmd> resolve();
};
struct JogCmdXorAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdXorAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "^="; }
Ref<JogCmd> resolve();
};
struct JogCmdLeftShiftAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdLeftShiftAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return "<<="; }
Ref<JogCmd> resolve();
};
struct JogCmdRightXShiftAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdRightXShiftAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return ">>="; }
Ref<JogCmd> resolve();
};
struct JogCmdRightShiftAssign : JogCmdOpAssign
{
int node_type() { return __LINE__; }
JogCmdRightShiftAssign( Ref<JogToken> t, Ref<JogCmd> location, Ref<JogCmd> rhs )
: JogCmdOpAssign( t, location, rhs )
{
}
const char* symbol() { return ">>>="; }
Ref<JogCmd> resolve();
};
struct JogCmdConditional : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> condition, true_value, false_value;
JogCmdConditional( Ref<JogToken> t, Ref<JogCmd> condition,
Ref<JogCmd> true_value, Ref<JogCmd> false_value )
: JogCmd(t), condition(condition), true_value(true_value), false_value(false_value)
{
}
JogTypeInfo* type() { return true_value->type(); }
void print()
{
printf("(");
condition->print();
printf("?");
true_value->print();
printf(":");
false_value->print();
printf(")");
}
Ref<JogCmd> resolve();
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdBinary : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> lhs, rhs;
JogCmdBinary( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmd(t), lhs(lhs), rhs(rhs)
{
}
JogTypeInfo* type() { return lhs->type(); }
void validate();
void on_push( JogVM* vm );
};
struct JogCmdLogicalOp : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdLogicalOp( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBinary(t,lhs,rhs) { }
JogTypeInfo* type() { return jog_type_manager.type_boolean; }
};
struct JogCmdLogicalOr : JogCmdLogicalOp
{
int node_type() { return __LINE__; }
JogCmdLogicalOr( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs ) : JogCmdLogicalOp(t,lhs,rhs)
{
}
void print()
{
lhs->print();
printf("||");
rhs->print();
}
Ref<JogCmd> resolve();
void execute( JogVM* vm );
};
struct JogCmdLogicalAnd : JogCmdLogicalOp
{
int node_type() { return __LINE__; }
JogCmdLogicalAnd( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs ) : JogCmdLogicalOp(t,lhs,rhs)
{
/*
lhs->require_boolean();
rhs->require_boolean();
*/
}
void print()
{
lhs->print();
printf("&&");
rhs->print();
}
Ref<JogCmd> resolve();
void execute( JogVM* vm );
};
struct JogCmdBitwiseOr : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdBitwiseOr( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBinary(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("|");
rhs->print();
}
Ref<JogCmd> resolve();
void execute( JogVM* vm );
};
struct JogCmdBitwiseXor : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdBitwiseXor( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBinary(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("^");
rhs->print();
}
Ref<JogCmd> resolve();
void execute( JogVM* vm );
};
struct JogCmdBitwiseAnd : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdBitwiseAnd( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBinary(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("&");
rhs->print();
}
Ref<JogCmd> resolve();
void execute( JogVM* vm );
};
struct JogCmdEQ : JogCmdLogicalOp
{
int node_type() { return __LINE__; }
JogCmdEQ( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLogicalOp(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("==");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdNE : JogCmdLogicalOp
{
int node_type() { return __LINE__; }
JogCmdNE( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLogicalOp(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("!=");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdLT : JogCmdLogicalOp
{
int node_type() { return __LINE__; }
JogCmdLT( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLogicalOp(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("<");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdLE : JogCmdLogicalOp
{
int node_type() { return __LINE__; }
JogCmdLE( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLogicalOp(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("<=");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdGT : JogCmdLogicalOp
{
int node_type() { return __LINE__; }
JogCmdGT( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLogicalOp(t,lhs,rhs) { }
void print()
{
lhs->print();
printf(">");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdGE : JogCmdLogicalOp
{
int node_type() { return __LINE__; }
JogCmdGE( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLogicalOp(t,lhs,rhs) { }
void print()
{
lhs->print();
printf(">=");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdInstanceOf : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> operand;
JogTypeInfo* of_type;
JogCmdInstanceOf( Ref<JogToken> t, Ref<JogCmd> operand, JogTypeInfo* of_type )
: JogCmd(t), operand(operand), of_type(of_type)
{
//operand->require_reference();
}
JogTypeInfo* type() { return jog_type_manager.type_boolean; }
void print()
{
operand->print();
printf(" instanceof ");
of_type->print();
}
};
struct JogCmdShift : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> operand;
Ref<JogCmd> shift_amount;
JogCmdShift( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmd(t), operand(operand), shift_amount(shift_amount)
{
//operand->require_integer();
//this->shift_amount = shift_amount->cast_to_type( jog_type_manager.type_int32 );
}
JogTypeInfo* type() { return operand->type(); }
void on_push( JogVM* vm );
};
struct JogCmdLeftShift : JogCmdShift
{
int node_type() { return __LINE__; }
JogCmdLeftShift( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve();
void print()
{
operand->print();
printf("<<");
shift_amount->print();
}
};
struct JogCmdRightShift : JogCmdShift
{
int node_type() { return __LINE__; }
JogCmdRightShift( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve();
void print()
{
operand->print();
printf(">>>");
shift_amount->print();
}
};
struct JogCmdRightXShift : JogCmdShift
{
int node_type() { return __LINE__; }
JogCmdRightXShift( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve();
void print()
{
operand->print();
printf(">>");
shift_amount->print();
}
};
struct JogCmdAdd : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdAdd( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs ) : JogCmdBinary(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("+");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdSub : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdSub( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs ) : JogCmdBinary(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("-");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdMul : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdMul( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs ) : JogCmdBinary(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("*");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdDiv : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdDiv( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs ) : JogCmdBinary(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("/");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdMod : JogCmdBinary
{
int node_type() { return __LINE__; }
JogCmdMod( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs ) : JogCmdBinary(t,lhs,rhs) { }
void print()
{
lhs->print();
printf("%%");
rhs->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdDataType : JogCmd
{
int node_type() { return __LINE__; }
JogTypeInfo* data_type;
JogCmdDataType( Ref<JogToken> t, JogTypeInfo* data_type ) : JogCmd(t), data_type(data_type)
{
}
JogTypeInfo* type() { return data_type; }
void print()
{
data_type->print();
}
};
struct JogCmdIdentifier : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogString> name;
JogCmdIdentifier( Ref<JogToken> t, Ref<JogString> name ) : JogCmd(t), name(name)
{
}
JogTypeInfo* type() { return NULL; }
JogTypeInfo* reinterpret_as_type()
{
return (JogTypeInfo::reference( t, name ));
}
void print()
{
name->print();
}
Ref<JogCmd> resolve();
Ref<JogCmd> resolve( Ref<JogCmd> context );
Ref<JogCmd> resolve( JogTypeInfo* class_context, Ref<JogCmd> context );
Ref<JogCmd> resolve_assignment( Ref<JogCmd> context, Ref<JogCmd> new_value );
Ref<JogCmd> resolve_assignment( JogTypeInfo* class_context, Ref<JogCmd> context,
Ref<JogCmd> new_value );
Ref<JogCmd> resolve_op_assign( int op_type, Ref<JogCmd> context, Ref<JogCmd> rhs );
Ref<JogCmd> resolve_op_assign( int op_type, JogTypeInfo* class_context,
Ref<JogCmd> context, Ref<JogCmd> rhs );
Ref<JogCmd> resolve_stepcount_access( int when, int modifier );
Ref<JogCmd> resolve_stepcount_access( int when, int modifier,
JogTypeInfo* class_context, Ref<JogCmd> context );
Ref<JogCmd> resolve_stepcount_access( int when, int modifier, Ref<JogCmd> context );
};
struct JogCmdLocalVarDeclaration : JogCmdIdentifier
{
int node_type() { return __LINE__; }
JogTypeInfo* of_type;
Ref<JogCmd> initial_value;
JogLocalVarInfo* var_info;
JogCmdLocalVarDeclaration( Ref<JogToken> t, JogTypeInfo* of_type, Ref<JogString> name )
: JogCmdIdentifier(t,name), of_type(of_type), initial_value(NULL), var_info(NULL)
{
}
JogTypeInfo* reinterpret_as_type() { return NULL; }
void print()
{
of_type->print();
printf(" ");
JogCmdIdentifier::print();
if (*initial_value)
{
printf("=");
initial_value->print();
}
}
Ref<JogCmd> resolve();
};
struct JogCmdMethodCall : JogCmdIdentifier
{
int node_type() { return __LINE__; }
Ref<JogCmdList> args;
JogCmdMethodCall( Ref<JogToken> t, Ref<JogString> name, Ref<JogCmdList> args )
: JogCmdIdentifier(t,name), args(args)
{
}
JogTypeInfo* reinterpret_as_type() { return NULL; }
void print()
{
JogCmdIdentifier::print();
args->print();
}
Ref<JogCmd> resolve();
Ref<JogCmd> resolve( Ref<JogCmd> context );
Ref<JogCmd> resolve( JogTypeInfo* class_context, Ref<JogCmd> context );
};
struct JogCmdSuperCall : JogCmdMethodCall
{
int node_type() { return __LINE__; }
JogCmdSuperCall( Ref<JogToken> t, Ref<JogString> name, Ref<JogCmdList> args )
: JogCmdMethodCall(t,name,args)
{
}
void print()
{
printf("super.");
JogCmdIdentifier::print();
args->print();
}
Ref<JogCmd> resolve();
Ref<JogCmd> resolve( Ref<JogCmd> context );
Ref<JogCmd> resolve( JogTypeInfo* class_context, Ref<JogCmd> context );
};
struct JogCmdNewObject : JogCmd
{
int node_type() { return __LINE__; }
JogTypeInfo* of_type;
Ref<JogCmdList> args;
JogMethodInfo* method_info;
JogCmdNewObject( Ref<JogToken> t, JogTypeInfo* of_type, Ref<JogCmdList> args )
: JogCmd(t), of_type(of_type), args(args), method_info(NULL)
{
}
JogTypeInfo* type() { return of_type; }
void print()
{
printf("new ");
of_type->print();
args->print();
}
Ref<JogCmd> resolve();
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdNewArray : JogCmd
{
JogTypeInfo* of_type;
Ref<JogCmd> size_expr;
Ref<JogCmd> element_expr;
bool resolved;
JogCmdNewArray( Ref<JogToken> t, JogTypeInfo* of_type, Ref<JogCmd> size_expr,
Ref<JogCmd> element_expr=NULL )
: JogCmd(t), of_type(of_type), size_expr(size_expr), element_expr(element_expr), resolved(false)
{
}
JogTypeInfo* type() { return of_type; }
void print()
{
printf("new ");
of_type->print();
printf("[");
size_expr->print();
printf("]");
if (*element_expr)
{
printf("<-");
element_expr->print();
}
}
Ref<JogCmd> resolve();
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdLiteralArray : JogCmd
{
JogTypeInfo* of_type;
Ref<JogCmdList> terms;
bool resolved;
JogCmdLiteralArray( Ref<JogToken> t, JogTypeInfo* of_type, Ref<JogCmdList> terms )
: JogCmd(t), of_type(of_type), terms(terms), resolved(false)
{
}
JogTypeInfo* type() { return of_type; }
void print()
{
printf( "new " );
of_type->name->print();
printf( "{" );
terms->print();
printf( "}" );
}
Ref<JogCmd> resolve();
virtual void store_value( JogVM* vm, int index, JogInt64 value ) { }
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
template <typename DataType>
struct JogCmdLiteralArrayPrimitive : JogCmdLiteralArray
{
JogCmdLiteralArrayPrimitive( Ref<JogToken> t, JogTypeInfo* of_type, Ref<JogCmdList> terms )
: JogCmdLiteralArray(t,of_type,terms)
{
}
Ref<JogCmd> resolve() { return this; }
void store_value( JogVM* vm, int index, JogInt64 value )
{
((DataType*)vm->peek_ref()->data)[index] = (DataType) value;
}
};
struct JogCmdStepCount : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> operand;
JogCmdStepCount( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmd(t), operand(operand)
{
}
JogTypeInfo* type() { return operand->type(); }
};
struct JogCmdPreIncrement : JogCmdStepCount
{
int node_type() { return __LINE__; }
JogCmdPreIncrement( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdStepCount(t,operand)
{
}
void print()
{
printf("++");
operand->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdPreDecrement : JogCmdStepCount
{
int node_type() { return __LINE__; }
JogCmdPreDecrement( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdStepCount(t,operand)
{
}
void print()
{
printf("--");
operand->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdPostIncrement : JogCmdStepCount
{
int node_type() { return __LINE__; }
JogCmdPostIncrement( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdStepCount(t,operand)
{
}
void print()
{
operand->print();
printf("++");
}
Ref<JogCmd> resolve();
};
struct JogCmdPostDecrement : JogCmdStepCount
{
int node_type() { return __LINE__; }
JogCmdPostDecrement( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdStepCount(t,operand)
{
}
void print()
{
operand->print();
printf("--");
}
Ref<JogCmd> resolve();
};
struct JogCmdNegate : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdNegate( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
Ref<JogCmd> resolve();
void print()
{
printf("-");
operand->print();
}
};
struct JogCmdLogicalNot : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdLogicalNot( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
void print()
{
printf("!");
operand->print();
}
Ref<JogCmd> resolve();
void execute( JogVM* vm );
};
struct JogCmdBitwiseNot : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdBitwiseNot( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
void print()
{
printf("~");
operand->print();
}
Ref<JogCmd> resolve();
void execute( JogVM* vm );
};
struct JogCmdMemberAccess : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
Ref<JogCmd> member;
JogCmdMemberAccess( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> member )
: JogCmd(t), context(context), member(member)
{
}
void print()
{
context->print();
printf(".");
member->print();
}
JogTypeInfo* type() { return NULL; }
Ref<JogCmd> resolve();
Ref<JogCmd> resolve_assignment( Ref<JogCmd> assignment_context, Ref<JogCmd> new_value );
Ref<JogCmd> resolve_op_assign( int op_type, Ref<JogCmd> assignment_context, Ref<JogCmd> rhs );
Ref<JogCmd> resolve_stepcount_access( int when, int modifier );
};
struct JogCmdArrayAccess : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
Ref<JogCmd> index_expr;
JogCmdArrayAccess( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmd(t), context(context), index_expr(index_expr)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
context->print();
printf("[");
index_expr->print();
printf("]");
}
Ref<JogCmd> resolve();
Ref<JogCmd> resolve_assignment( Ref<JogCmd> context, Ref<JogCmd> new_value );
Ref<JogCmd> resolve_op_assign( int op_type, Ref<JogCmd> context, Ref<JogCmd> rhs );
Ref<JogCmd> resolve_stepcount_access( int when, int modifier );
};
struct JogCmdReturnVoid : JogCmd
{
int node_type() { return __LINE__; }
JogCmdReturnVoid( Ref<JogToken> t ) : JogCmd(t)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("return");
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdReturnValue : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdReturnValue( Ref<JogToken> t, Ref<JogCmd> operand ) : JogCmdUnary(t,operand)
{
}
void print()
{
printf("return ");
operand->print();
}
Ref<JogCmd> resolve();
};
struct JogCmdCallSuperConstructor : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmdList> args;
JogCmdCallSuperConstructor( Ref<JogToken> t, Ref<JogCmdList> args ) : JogCmd(t), args(args)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("super");
args->print();
}
Ref<JogCmd> resolve();
};
//=============================================================================
// VM Commands
//=============================================================================
struct JogCmdCastReal32ToReal64 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastReal32ToReal64( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_real64; }
void print()
{
printf( "(double)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastIntegerToReal64 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastIntegerToReal64( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_real64; }
void print()
{
printf( "(double)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastReal64ToReal32 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastReal64ToReal32( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_real32; }
void print()
{
printf( "(float)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastIntegerToReal32 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastIntegerToReal32( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_real32; }
void print()
{
printf( "(float)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastRealToInt64 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastRealToInt64( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int64; }
void print()
{
printf( "(long)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastIntegerToInt64 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastIntegerToInt64( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int64; }
void print()
{
printf( "(long)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastRealToInt32 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastRealToInt32( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int32; }
void print()
{
printf( "(int)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastIntegerToInt32 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastIntegerToInt32( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int32; }
void print()
{
printf( "(int)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastIntegerToInt16 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastIntegerToInt16( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int16; }
void print()
{
printf( "(short)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastIntegerToInt8 : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastIntegerToInt8( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int8; }
void print()
{
printf( "(byte)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdCastIntegerToChar : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdCastIntegerToChar( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return jog_type_manager.type_char; }
void print()
{
printf( "(char)" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdWideningCast : JogCmdUnary
{
JogTypeInfo* to_type;
int node_type() { return __LINE__; }
JogCmdWideningCast( Ref<JogToken> t, Ref<JogCmd> operand, JogTypeInfo* to_type )
: JogCmdUnary(t,operand), to_type(to_type)
{
}
JogTypeInfo* type() { return to_type; }
void print()
{
printf( "(" );
to_type->name->print();
printf( ")" );
operand->print();
}
void execute( JogVM* vm );
};
struct JogCmdNarrowingCast : JogCmdUnary
{
JogTypeInfo* to_type;
int node_type() { return __LINE__; }
JogCmdNarrowingCast( Ref<JogToken> t, Ref<JogCmd> operand, JogTypeInfo* to_type )
: JogCmdUnary(t,operand), to_type(to_type)
{
}
JogTypeInfo* type() { return to_type; }
void print()
{
printf( "(" );
to_type->name->print();
printf( ")" );
operand->print();
}
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// Add
//------------------------------------------------------------------------------
struct JogCmdAddReal64 : JogCmdAdd
{
int node_type() { return __LINE__; }
JogCmdAddReal64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdAdd(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdAddReal32 : JogCmdAdd
{
int node_type() { return __LINE__; }
JogCmdAddReal32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdAdd(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdAddInt64 : JogCmdAdd
{
int node_type() { return __LINE__; }
JogCmdAddInt64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdAdd(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdAddInt32 : JogCmdAdd
{
int node_type() { return __LINE__; }
JogCmdAddInt32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdAdd(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// Sub
//------------------------------------------------------------------------------
struct JogCmdSubReal64 : JogCmdSub
{
int node_type() { return __LINE__; }
JogCmdSubReal64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdSub(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdSubReal32 : JogCmdSub
{
int node_type() { return __LINE__; }
JogCmdSubReal32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdSub(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdSubInt64 : JogCmdSub
{
int node_type() { return __LINE__; }
JogCmdSubInt64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdSub(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdSubInt32 : JogCmdSub
{
int node_type() { return __LINE__; }
JogCmdSubInt32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdSub(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// Mul
//------------------------------------------------------------------------------
struct JogCmdMulReal64 : JogCmdMul
{
int node_type() { return __LINE__; }
JogCmdMulReal64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdMul(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdMulReal32 : JogCmdMul
{
int node_type() { return __LINE__; }
JogCmdMulReal32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdMul(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdMulInt64 : JogCmdMul
{
int node_type() { return __LINE__; }
JogCmdMulInt64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdMul(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdMulInt32 : JogCmdMul
{
int node_type() { return __LINE__; }
JogCmdMulInt32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdMul(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// Div
//------------------------------------------------------------------------------
struct JogCmdDivReal64 : JogCmdDiv
{
int node_type() { return __LINE__; }
JogCmdDivReal64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdDiv(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdDivReal32 : JogCmdDiv
{
int node_type() { return __LINE__; }
JogCmdDivReal32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdDiv(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdDivInt64 : JogCmdDiv
{
int node_type() { return __LINE__; }
JogCmdDivInt64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdDiv(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdDivInt32 : JogCmdDiv
{
int node_type() { return __LINE__; }
JogCmdDivInt32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdDiv(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// Mod
//------------------------------------------------------------------------------
struct JogCmdModInt64 : JogCmdMod
{
int node_type() { return __LINE__; }
JogCmdModInt64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdMod(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdModInt32 : JogCmdMod
{
int node_type() { return __LINE__; }
JogCmdModInt32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdMod(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// And
//------------------------------------------------------------------------------
struct JogCmdAndInt64 : JogCmdBitwiseAnd
{
int node_type() { return __LINE__; }
JogCmdAndInt64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBitwiseAnd(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdAndInt32 : JogCmdBitwiseAnd
{
int node_type() { return __LINE__; }
JogCmdAndInt32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBitwiseAnd(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// Or
//------------------------------------------------------------------------------
struct JogCmdOrInt64 : JogCmdBitwiseOr
{
int node_type() { return __LINE__; }
JogCmdOrInt64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBitwiseOr(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdOrInt32 : JogCmdBitwiseOr
{
int node_type() { return __LINE__; }
JogCmdOrInt32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBitwiseOr(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// Xor
//------------------------------------------------------------------------------
struct JogCmdXorInt64 : JogCmdBitwiseXor
{
int node_type() { return __LINE__; }
JogCmdXorInt64( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBitwiseXor(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdXorInt32 : JogCmdBitwiseXor
{
int node_type() { return __LINE__; }
JogCmdXorInt32( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdBitwiseXor(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// EQ
//------------------------------------------------------------------------------
struct JogCmdEQReal : JogCmdEQ
{
int node_type() { return __LINE__; }
JogCmdEQReal( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdEQ(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdEQInteger : JogCmdEQ
{
int node_type() { return __LINE__; }
JogCmdEQInteger( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdEQ(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdEQRef : JogCmdEQ
{
int node_type() { return __LINE__; }
JogCmdEQRef( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdEQ(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// NE
//------------------------------------------------------------------------------
struct JogCmdNEReal : JogCmdNE
{
int node_type() { return __LINE__; }
JogCmdNEReal( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdNE(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdNEInteger : JogCmdNE
{
int node_type() { return __LINE__; }
JogCmdNEInteger( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdNE(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdNERef : JogCmdNE
{
int node_type() { return __LINE__; }
JogCmdNERef( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdNE(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// LT
//------------------------------------------------------------------------------
struct JogCmdLTReal : JogCmdLT
{
int node_type() { return __LINE__; }
JogCmdLTReal( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLT(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdLTInteger : JogCmdLT
{
int node_type() { return __LINE__; }
JogCmdLTInteger( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLT(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// LE
//------------------------------------------------------------------------------
struct JogCmdLEReal : JogCmdLE
{
int node_type() { return __LINE__; }
JogCmdLEReal( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLE(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdLEInteger : JogCmdLE
{
int node_type() { return __LINE__; }
JogCmdLEInteger( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdLE(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// GT
//------------------------------------------------------------------------------
struct JogCmdGTReal : JogCmdGT
{
int node_type() { return __LINE__; }
JogCmdGTReal( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdGT(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdGTInteger : JogCmdGT
{
int node_type() { return __LINE__; }
JogCmdGTInteger( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdGT(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//------------------------------------------------------------------------------
// GE
//------------------------------------------------------------------------------
struct JogCmdGEReal : JogCmdGE
{
int node_type() { return __LINE__; }
JogCmdGEReal( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdGE(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdGEInteger : JogCmdGE
{
int node_type() { return __LINE__; }
JogCmdGEInteger( Ref<JogToken> t, Ref<JogCmd> lhs, Ref<JogCmd> rhs )
: JogCmdGE(t,lhs,rhs)
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//-----------------------------------------------------------------------------
// LeftShift
//-----------------------------------------------------------------------------
struct JogCmdLeftShiftInt64 : JogCmdLeftShift
{
int node_type() { return __LINE__; }
JogCmdLeftShiftInt64( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdLeftShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdLeftShiftInt32 : JogCmdLeftShift
{
int node_type() { return __LINE__; }
JogCmdLeftShiftInt32( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdLeftShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//-----------------------------------------------------------------------------
// RightShift
//-----------------------------------------------------------------------------
struct JogCmdRightShiftInt64 : JogCmdRightShift
{
int node_type() { return __LINE__; }
JogCmdRightShiftInt64( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdRightShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdRightShiftInt32 : JogCmdRightShift
{
int node_type() { return __LINE__; }
JogCmdRightShiftInt32( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdRightShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//-----------------------------------------------------------------------------
// RightXShift
//-----------------------------------------------------------------------------
struct JogCmdRightXShiftInt64 : JogCmdRightXShift
{
int node_type() { return __LINE__; }
JogCmdRightXShiftInt64( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdRightXShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdRightXShiftInt32 : JogCmdRightXShift
{
int node_type() { return __LINE__; }
JogCmdRightXShiftInt32( Ref<JogToken> t, Ref<JogCmd> operand, Ref<JogCmd> shift_amount )
: JogCmdRightXShift( t, operand, shift_amount )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
//-----------------------------------------------------------------------------
// Negate
//-----------------------------------------------------------------------------
struct JogCmdNegateReal64 : JogCmdNegate
{
int node_type() { return __LINE__; }
JogCmdNegateReal64( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdNegate( t, operand )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdNegateReal32 : JogCmdNegate
{
int node_type() { return __LINE__; }
JogCmdNegateReal32( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdNegate( t, operand )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdNegateInt64 : JogCmdNegate
{
int node_type() { return __LINE__; }
JogCmdNegateInt64( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdNegate( t, operand )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdNegateInt32 : JogCmdNegate
{
int node_type() { return __LINE__; }
JogCmdNegateInt32( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdNegate( t, operand )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdNegateInt16 : JogCmdNegate
{
int node_type() { return __LINE__; }
JogCmdNegateInt16( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdNegate( t, operand )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdNegateInt8 : JogCmdNegate
{
int node_type() { return __LINE__; }
JogCmdNegateInt8( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdNegate( t, operand )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
struct JogCmdNegateChar : JogCmdNegate
{
int node_type() { return __LINE__; }
JogCmdNegateChar( Ref<JogToken> t, Ref<JogCmd> operand )
: JogCmdNegate( t, operand )
{
}
Ref<JogCmd> resolve() { return this; }
void execute( JogVM* vm );
};
/*
while (x++ < 8)
{
if (x == 7) break;
}
*/
struct JogCmdThis : JogCmd
{
int node_type() { return __LINE__; }
JogTypeInfo* this_type;
JogCmdThis( Ref<JogToken> t, JogTypeInfo* this_type );
JogTypeInfo* type() { return this_type; }
void print()
{
printf("this");
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdNullRef : JogCmd
{
int node_type() { return __LINE__; }
JogTypeInfo* of_type;
JogCmdNullRef( Ref<JogToken> t ) : JogCmd(t)
{
of_type = jog_type_manager.type_null;
}
JogTypeInfo* type() { return of_type; }
void print()
{
if (of_type == jog_type_manager.type_null) printf("null");
else
{
printf("(");
of_type->name->print();
printf(")null");
}
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdObjectRef : JogCmd
{
int node_type() { return __LINE__; }
JogRef ref;
JogCmdObjectRef( Ref<JogToken> t, JogRef ref ) : JogCmd(t), ref(ref)
{
}
JogTypeInfo* type() { return (*ref) ? ref->type : NULL; }
void print()
{
printf("(objref)");
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdCallInitObject : JogCmd
{
int node_type() { return __LINE__; }
JogMethodInfo* method_info;
JogCmdCallInitObject( Ref<JogToken> t, JogMethodInfo* method_info )
: JogCmd(t), method_info(method_info)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
method_info->name->print();
printf("()");
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdStaticCall : JogCmd
{
int node_type() { return __LINE__; }
JogMethodInfo* method_info;
Ref<JogCmd> context;
Ref<JogCmdList> args;
JogCmdStaticCall( Ref<JogToken> t, JogMethodInfo* method_info,
Ref<JogCmd> context, Ref<JogCmdList> args )
: JogCmd(t), method_info(method_info), context(context), args(args)
{
}
JogTypeInfo* type() { return method_info->return_type; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
method_info->name->print();
if (*args) args->print();
else printf("()");
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdDynamicCall : JogCmdStaticCall
{
int node_type() { return __LINE__; }
JogCmdDynamicCall( Ref<JogToken> t, JogMethodInfo* method_info,
Ref<JogCmd> context, Ref<JogCmdList> args )
: JogCmdStaticCall( t, method_info, context, args )
{
}
void execute( JogVM* vm );
};
struct JogCmdClassCall : JogCmd
{
int node_type() { return __LINE__; }
JogMethodInfo* method_info;
Ref<JogCmd> context;
Ref<JogCmdList> args;
JogCmdClassCall( Ref<JogToken> t, JogMethodInfo* method_info,
Ref<JogCmd> context, Ref<JogCmdList> args )
: JogCmd(t), method_info(method_info), context(context), args(args)
{
if (*context) this->context = context->discarding_result();
}
JogTypeInfo* type() { return method_info->return_type; }
void print()
{
method_info->name->print();
if (*args) args->print();
else printf("()");
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdReturnData : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdReturnData( Ref<JogToken> t, Ref<JogCmd> operand ) : JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("returnData ");
operand->print();
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdReturnRef : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdReturnRef( Ref<JogToken> t, Ref<JogCmd> operand ) : JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("returnRef ");
operand->print();
}
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
struct JogCmdDiscardDataResult : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdDiscardDataResult( Ref<JogToken> t, Ref<JogCmd> operand ) : JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("discardData:");
operand->print();
}
Ref<JogCmd> resolve()
{
operand = operand->resolve();
return this;
}
void execute( JogVM* vm );
};
struct JogCmdDiscardRefResult : JogCmdUnary
{
int node_type() { return __LINE__; }
JogCmdDiscardRefResult( Ref<JogToken> t, Ref<JogCmd> operand ) : JogCmdUnary(t,operand)
{
}
JogTypeInfo* type() { return NULL; }
void print()
{
printf("discardRef:");
operand->print();
}
Ref<JogCmd> resolve()
{
operand = operand->resolve();
return this;
}
void execute( JogVM* vm );
};
//=============================================================================
// ReadClassProperty
//=============================================================================
struct JogCmdReadClassProperty : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context; // can be null
JogPropertyInfo* var_info;
JogCmdReadClassProperty( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info )
: JogCmd(t), context(context), var_info(var_info)
{
if (*context) this->context = context->discarding_result();
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
if (*context) context->print();
else var_info->type_context->name->print();
printf(".");
var_info->name->print();
}
void on_push( JogVM* vm );
};
struct JogCmdReadClassPropertyData : JogCmdReadClassProperty
{
int node_type() { return __LINE__; }
JogCmdReadClassPropertyData( Ref<JogToken> t, Ref<JogCmd> context,
JogPropertyInfo* var_info )
: JogCmdReadClassProperty(t,context,var_info)
{
}
void execute( JogVM* vm );
};
struct JogCmdReadClassPropertyRef : JogCmdReadClassProperty
{
int node_type() { return __LINE__; }
JogCmdReadClassPropertyRef( Ref<JogToken> t,
Ref<JogCmd> context, JogPropertyInfo* var_info )
: JogCmdReadClassProperty(t,context,var_info)
{
}
void execute( JogVM* vm );
};
//=============================================================================
// WriteClassProperty
//=============================================================================
struct JogCmdWriteClassProperty : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context, new_value;
JogPropertyInfo* var_info;
JogCmdWriteClassProperty( Ref<JogToken> t,
Ref<JogCmd> context, JogPropertyInfo* var_info,
Ref<JogCmd> new_value )
: JogCmd(t), context(context),
new_value(new_value), var_info(var_info)
{
if (*context)
{
JogTypeInfo* result_type = context->type();
if (result_type)
{
if (result_type->is_primitive())
{
this->context = new JogCmdDiscardDataResult(context->t,context);
}
else
{
this->context = new JogCmdDiscardRefResult(context->t,context);
}
}
}
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
if (*context) context->print();
else var_info->type_context->name->print();
printf(".");
var_info->name->print();
printf(" = ");
new_value->print();
}
void on_push( JogVM* vm );
};
struct JogCmdWriteClassPropertyData : JogCmdWriteClassProperty
{
int node_type() { return __LINE__; }
JogCmdWriteClassPropertyData( Ref<JogToken> t,
Ref<JogCmd> context, JogPropertyInfo* var_info,
Ref<JogCmd> new_value )
: JogCmdWriteClassProperty(t,context,var_info,new_value)
{
}
void execute( JogVM* vm );
};
struct JogCmdWriteClassPropertyRef : JogCmdWriteClassProperty
{
int node_type() { return __LINE__; }
JogCmdWriteClassPropertyRef( Ref<JogToken> t,
Ref<JogCmd> context, JogPropertyInfo* var_info,
Ref<JogCmd> new_value )
: JogCmdWriteClassProperty(t,context,var_info,new_value)
{
}
void execute( JogVM* vm );
};
//=============================================================================
// ReadProperty
//=============================================================================
struct JogCmdReadProperty : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
JogPropertyInfo* var_info;
JogCmdReadProperty( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info )
: JogCmd(t), context(context), var_info(var_info)
{
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
context->print();
printf(".");
var_info->name->print();
}
void on_push( JogVM* vm );
};
struct JogCmdReadPropertyData : JogCmdReadProperty
{
int node_type() { return __LINE__; }
JogCmdReadPropertyData( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info )
: JogCmdReadProperty(t,context,var_info)
{
}
void execute( JogVM* vm );
};
struct JogCmdReadPropertyRef : JogCmdReadProperty
{
int node_type() { return __LINE__; }
JogCmdReadPropertyRef( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info )
: JogCmdReadProperty(t,context,var_info)
{
}
void execute( JogVM* vm );
};
//=============================================================================
// WriteProperty
//=============================================================================
struct JogCmdWriteProperty : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context, new_value;
JogPropertyInfo* var_info;
JogCmdWriteProperty( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info,
Ref<JogCmd> new_value )
: JogCmd(t), context(context), new_value(new_value), var_info(var_info)
{
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" = ");
new_value->print();
}
void on_push( JogVM* vm );
};
struct JogCmdWritePropertyData : JogCmdWriteProperty
{
int node_type() { return __LINE__; }
JogCmdWritePropertyData( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info,
Ref<JogCmd> new_value )
: JogCmdWriteProperty(t,context,var_info,new_value)
{
}
void execute( JogVM* vm );
};
struct JogCmdWritePropertyRef : JogCmdWriteProperty
{
int node_type() { return __LINE__; }
JogCmdWritePropertyRef( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info,
Ref<JogCmd> new_value )
: JogCmdWriteProperty(t,context,var_info,new_value)
{
}
void execute( JogVM* vm );
};
//=============================================================================
// ReadLocal
//=============================================================================
struct JogCmdReadLocal : JogCmd
{
int node_type() { return __LINE__; }
JogLocalVarInfo* var_info;
JogCmdReadLocal( Ref<JogToken> t, JogLocalVarInfo* var_info )
: JogCmd(t), var_info(var_info)
{
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
printf("(local:");
var_info->name->print();
printf(")");
}
void on_push( JogVM* vm );
};
struct JogCmdReadLocalData : JogCmdReadLocal
{
int node_type() { return __LINE__; }
JogCmdReadLocalData( Ref<JogToken> t, JogLocalVarInfo* var_info )
: JogCmdReadLocal(t,var_info)
{
}
void execute( JogVM* vm );
};
struct JogCmdReadLocalRef : JogCmdReadLocal
{
int node_type() { return __LINE__; }
JogCmdReadLocalRef( Ref<JogToken> t, JogLocalVarInfo* var_info )
: JogCmdReadLocal(t,var_info)
{
}
void execute( JogVM* vm );
};
//=============================================================================
// WriteLocal
//=============================================================================
struct JogCmdWriteLocal : JogCmd
{
int node_type() { return __LINE__; }
JogLocalVarInfo* var_info;
Ref<JogCmd> new_value;
JogCmdWriteLocal( Ref<JogToken> t, JogLocalVarInfo* var_info, Ref<JogCmd> new_value ) :
JogCmd(t), var_info(var_info), new_value(new_value)
{
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
printf("local:");
var_info->name->print();
printf(" = ");
new_value->print();
}
void on_push( JogVM* vm );
};
struct JogCmdWriteLocalData : JogCmdWriteLocal
{
int node_type() { return __LINE__; }
JogCmdWriteLocalData( Ref<JogToken> t, JogLocalVarInfo* var_info, Ref<JogCmd> new_value )
: JogCmdWriteLocal(t,var_info,new_value)
{
}
void execute( JogVM* vm );
};
struct JogCmdWriteLocalRef : JogCmdWriteLocal
{
int node_type() { return __LINE__; }
JogCmdWriteLocalRef( Ref<JogToken> t, JogLocalVarInfo* var_info, Ref<JogCmd> new_value )
: JogCmdWriteLocal(t,var_info,new_value)
{
}
void execute( JogVM* vm );
};
//====================================================================
// Op-Assign Local
//====================================================================
struct JogCmdOpAssignLocal : JogCmd
{
int node_type() { return __LINE__; }
JogLocalVarInfo* var_info;
Ref<JogCmd> operand;
JogCmdOpAssignLocal() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, JogLocalVarInfo* var_info, Ref<JogCmd> operand )
{
this->t = t;
this->var_info = var_info;
this->operand = operand;
return this;
}
JogTypeInfo* type() { return var_info->type; }
void on_push( JogVM* vm )
{
vm->push( *operand );
}
};
template <typename DataType>
struct JogCmdAddAssignLocalReal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
double& local = ((double*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local + vm->pop_double());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdAddAssignLocalInteger : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local + vm->pop_data());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSubAssignLocalReal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" -= ");
operand->print();
}
void execute( JogVM* vm )
{
double& local = ((double*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local - vm->pop_double());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSubAssignLocalInteger : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" -= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local - vm->pop_data());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdMulAssignLocalReal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" *= ");
operand->print();
}
void execute( JogVM* vm )
{
double& local = ((double*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local * vm->pop_double());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdMulAssignLocalInteger : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" *= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local * vm->pop_data());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdDivAssignLocalReal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" /= ");
operand->print();
}
void execute( JogVM* vm )
{
double& local = ((double*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local / vm->pop_double());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdDivAssignLocalInteger : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" /= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local / zero_check(vm->pop_data()));
vm->push( local );
}
};
template <typename DataType>
struct JogCmdModAssignLocal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" %%= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local % zero_check(vm->pop_data()));
vm->push( local );
}
};
template <typename DataType>
struct JogCmdAndAssignLocal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" &= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local & vm->pop_data());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdOrAssignLocal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" |= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local | vm->pop_data());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdXorAssignLocal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" ^= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local ^ vm->pop_data());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHLAssignLocal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" <<= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local << vm->pop_data());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHRXAssignLocal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" >>= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local >> vm->pop_data());
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHRAssignLocal : JogCmdOpAssignLocal
{
int node_type() { return __LINE__; }
void print()
{
var_info->name->print();
printf(" >>>= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
int bits = (int) vm->pop_data();
local = JOG_SHR( DataType, local, bits );
vm->push( local );
}
};
//=============================================================================
// Op-Assign Property
//=============================================================================
struct JogCmdOpAssignProperty : JogCmd
{
int node_type() { return __LINE__; }
JogPropertyInfo* var_info;
Ref<JogCmd> context, operand;
JogCmdOpAssignProperty() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context,
JogPropertyInfo* var_info, Ref<JogCmd> operand )
{
this->t = t;
this->context = context;
this->var_info = var_info;
this->operand = operand;
return this;
}
JogTypeInfo* type() { return var_info->type; }
void on_push( JogVM* vm )
{
vm->push( *operand );
vm->push( *context );
}
};
struct JogCmdAddAssignPropertyString : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
JogRef st2 = vm->pop_ref();
JogRef context = vm->pop_ref();
JogObject** location = (JogObject**)&(context.null_check(t)->data[var_info->index]);
if (*location == NULL)
{
throw error( "Null Pointer Exception." );
}
if (*st2 == NULL)
{
JogChar data[] = {'n','u','l','l'};
st2 = vm->create_string( data, 4 );
}
JogObject* array1 = *((JogObject**)&((*location)->data[0]));
JogObject* array2 = *((JogObject**)&(st2->data[0]));
int count1 = array1->count;
int count2 = array2->count;
if (count2 == 0)
{
// original string is result
vm->push( *location );
}
else if (count1 == 0)
{
// right-hand string is result
(*location)->release();
*location = *st2;
st2->retain();
vm->push( st2 );
}
else
{
JogRef new_data = vm->create_array( jog_type_manager.type_char_array, count1+count2 );
memcpy( new_data->data, array1->data, count1*2 );
memcpy( ((JogChar*) new_data->data) + count1, array2->data, count2*2 );
JogRef new_string = vm->create_string( new_data );
(*location)->release();
*location = *new_string;
new_string->retain();
vm->push( new_string );
}
}
};
template <typename DataType>
struct JogCmdAddAssignPropertyReal : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
JogRef context = vm->pop_ref();
double& local = ((double*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local + operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdAddAssignPropertyInteger : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local + operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSubAssignPropertyReal : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" -= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
JogRef context = vm->pop_ref();
double& local = ((double*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local - operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSubAssignPropertyInteger : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" -= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local - operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdMulAssignPropertyReal : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" *= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
JogRef context = vm->pop_ref();
double& local = ((double*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local * operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdMulAssignPropertyInteger : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" *= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local * operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdDivAssignPropertyReal : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" /= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
JogRef context = vm->pop_ref();
double& local = ((double*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local / operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdDivAssignPropertyInteger : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" /= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local / zero_check(operand));
vm->push( local );
}
};
template <typename DataType>
struct JogCmdModAssignProperty : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" %%= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local % zero_check(operand));
vm->push( local );
}
};
template <typename DataType>
struct JogCmdAndAssignProperty : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" &= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local & operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdOrAssignProperty : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" |= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local | operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdXorAssignProperty : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" ^= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local ^ operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHLAssignProperty : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" <<= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local << operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHRXAssignProperty : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" >>= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local >> operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHRAssignProperty : JogCmdOpAssignProperty
{
int node_type() { return __LINE__; }
void print()
{
context->print();
printf(".");
var_info->name->print();
printf(" >>>= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = JOG_SHR( DataType, local, operand );
vm->push( local );
}
};
//=============================================================================
// Op-Assign Class Property
//=============================================================================
struct JogCmdOpAssignClassProperty : JogCmd
{
int node_type() { return __LINE__; }
JogPropertyInfo* var_info;
Ref<JogCmd> context, operand;
JogCmdOpAssignClassProperty() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context,
JogPropertyInfo* var_info, Ref<JogCmd> operand )
{
this->t = t;
if (*context != NULL) this->context = context->discarding_result();
else this->context = context;
this->var_info = var_info;
this->operand = operand;
return this;
}
JogTypeInfo* type() { return var_info->type; }
void on_push( JogVM* vm )
{
vm->push( *operand );
if (*context) vm->push( *context );
}
};
struct JogCmdAddAssignClassPropertyString : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
JogRef st2 = vm->pop_ref();
JogRef context = vm->pop_ref();
JogObject** location = (JogObject**)&(context.null_check(t)->data[var_info->index]);
if (*location == NULL)
{
throw error( "Null Pointer Exception." );
}
if (*st2 == NULL)
{
JogChar data[] = {'n','u','l','l'};
st2 = vm->create_string( data, 4 );
}
JogObject* array1 = *((JogObject**)&((*location)->data[0]));
JogObject* array2 = *((JogObject**)&(st2->data[0]));
int count1 = array1->count;
int count2 = array2->count;
if (count2 == 0)
{
// original string is result
vm->push( *location );
}
else if (count1 == 0)
{
// right-hand string is result
(*location)->release();
*location = *st2;
st2->retain();
vm->push( st2 );
}
else
{
JogRef new_data = vm->create_array( jog_type_manager.type_char_array, count1+count2 );
memcpy( new_data->data, array1->data, count1*2 );
memcpy( ((JogChar*) new_data->data) + count1, array2->data, count2*2 );
JogRef new_string = vm->create_string( new_data );
(*location)->release();
*location = *new_string;
new_string->retain();
vm->push( new_string );
}
}
};
template <typename DataType>
struct JogCmdAddAssignClassPropertyReal : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
JogRef context = vm->pop_ref();
double& local = ((double*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local + operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdAddAssignClassPropertyInteger : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local + operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSubAssignClassPropertyReal : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" -= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
JogRef context = vm->pop_ref();
double& local = ((double*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local - operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSubAssignClassPropertyInteger : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" -= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local - operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdMulAssignClassPropertyReal : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" *= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
JogRef context = vm->pop_ref();
double& local = ((double*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local * operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdMulAssignClassPropertyInteger : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" *= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local * operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdDivAssignClassPropertyReal : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" /= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
JogRef context = vm->pop_ref();
double& local = ((double*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local / operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdDivAssignClassPropertyInteger : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" /= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local / zero_check(operand));
vm->push( local );
}
};
template <typename DataType>
struct JogCmdModAssignClassProperty : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" %%= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local % zero_check(operand));
vm->push( local );
}
};
template <typename DataType>
struct JogCmdAndAssignClassProperty : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" &= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local & operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdOrAssignClassProperty : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" |= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local | operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdXorAssignClassProperty : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" ^= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local ^ operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHLAssignClassProperty : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" <<= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local << operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHRXAssignClassProperty : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" >>= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = (DataType) (local >> operand);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdSHRAssignClassProperty : JogCmdOpAssignClassProperty
{
int node_type() { return __LINE__; }
void print()
{
if (*context)
{
context->print();
printf(".");
}
var_info->name->print();
printf(" >>>= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
JogRef context = vm->pop_ref();
JogInt64& local = ((JogInt64*)context.null_check(t)->data)[var_info->index];
local = JOG_SHR( DataType, local, operand );
vm->push( local );
}
};
//====================================================================
// Op-Assign Array
//====================================================================
struct JogCmdOpAssignArray : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
Ref<JogCmd> index_expr;
Ref<JogCmd> operand;
JogCmdOpAssignArray() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> operand )
{
this->t = t;
this->context = context;
this->index_expr = index_expr;
this->operand = operand;
return this;
}
JogTypeInfo* type() { return context->type()->element_type; }
void print()
{
context->print();
printf("[");
index_expr->print();
printf("]");
}
void on_push( JogVM* vm )
{
vm->push( *operand );
vm->push( *index_expr );
vm->push( *context );
}
};
struct JogCmdAddAssignArrayString : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
JogRef st2 = vm->pop_ref();
if (*st2 == NULL)
{
JogChar data[] = {'n','u','l','l'};
st2 = vm->create_string( data, 4 );
}
int index = vm->pop_int();
JogRef obj = vm->pop_ref();
JogObject* array = obj.null_check(t);
array->index_check(t,index);
JogObject** location = &((JogObject**)array->data)[index];
JogRef st1 = *location;
st1.null_check(t);
JogObject* array1 = *((JogObject**)&(st1->data[0]));
JogObject* array2 = *((JogObject**)&(st2->data[0]));
int count1 = array1->count;
int count2 = array2->count;
if (count2 == 0)
{
// original string is result
vm->push( st1 );
}
else if (count1 == 0)
{
// right-hand string is result
st1->release();
*location = *st2;
st2->retain();
vm->push( st2 );
}
else
{
JogRef new_data = vm->create_array( jog_type_manager.type_char_array, count1+count2 );
memcpy( new_data->data, array1->data, count1*2 );
memcpy( ((JogChar*) new_data->data) + count1, array2->data, count2*2 );
JogRef new_string = vm->create_string( new_data );
st1->release();
*location = *new_string;
new_string->retain();
vm->push( new_string );
}
}
};
template <typename DataType>
struct JogCmdAddAssignArrayReal : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location + operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdAddAssignArrayInteger : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" += ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location + operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdSubAssignArrayReal : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" -= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location - operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdSubAssignArrayInteger : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" -= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location - operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdMulAssignArrayReal : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" *= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location * operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdMulAssignArrayInteger : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" *= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location * operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdDivAssignArrayReal : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" /= ");
operand->print();
}
void execute( JogVM* vm )
{
double operand = vm->pop_double();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location / operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdDivAssignArrayInteger : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" /= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location / zero_check(operand));
vm->push( location );
}
};
template <typename DataType>
struct JogCmdModAssignArray : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" %%= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location % zero_check(operand));
vm->push( location );
}
};
template <typename DataType>
struct JogCmdAndAssignArray : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" &= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location & operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdOrAssignArray : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" |= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location | operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdXorAssignArray : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" ^= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location ^ operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdSHLAssignArray : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" <<= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location << operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdSHRXAssignArray : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" >>= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = (DataType) (location >> operand);
vm->push( location );
}
};
template <typename DataType>
struct JogCmdSHRAssignArray : JogCmdOpAssignArray
{
int node_type() { return __LINE__; }
void print()
{
JogCmdOpAssignArray::print();
printf(" >>>= ");
operand->print();
}
void execute( JogVM* vm )
{
JogInt64 operand = vm->pop_data();
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& location = ((DataType*)array->data)[index];
location = JOG_SHR( DataType, location, operand );
vm->push( location );
}
};
//====================================================================
// StepAccess
//====================================================================
struct JogCmdPreStepLocal : JogCmd
{
int node_type() { return __LINE__; }
JogLocalVarInfo* var_info;
int modifier;
JogCmdPreStepLocal() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, JogLocalVarInfo* var_info, int modifier )
{
this->t = t;
this->var_info = var_info;
this->modifier = modifier;
return this;
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
if (modifier > 0) printf("++");
else printf("--");
var_info->name->print();
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm ) { }
};
template <typename DataType>
struct JogCmdPreStepLocalReal : JogCmdPreStepLocal
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
double& local = ((double*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local += modifier);
vm->push( local );
}
};
template <typename DataType>
struct JogCmdPreStepLocalInteger : JogCmdPreStepLocal
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
local = (DataType)(local += modifier);
vm->push( local );
}
};
struct JogCmdPostStepLocal : JogCmd
{
int node_type() { return __LINE__; }
JogLocalVarInfo* var_info;
int modifier;
JogCmdPostStepLocal() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, JogLocalVarInfo* var_info, int modifier )
{
this->t = t;
this->var_info = var_info;
this->modifier = modifier;
return this;
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
var_info->name->print();
if (modifier > 0) printf("++");
else printf("--");
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm ) { }
};
template <typename DataType>
struct JogCmdPostStepLocalReal : JogCmdPostStepLocal
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
double& local = ((double*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
vm->push( local );
local = (DataType)(local += modifier);
}
};
template <typename DataType>
struct JogCmdPostStepLocalInteger : JogCmdPostStepLocal
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
JogInt64& local = ((JogInt64*)vm->frame_ptr->data_stack_ptr)[var_info->offset];
vm->push( local );
local = (DataType)(local += modifier);
}
};
//--------------------------------------------------------------------
struct JogCmdPreStepProperty : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
JogPropertyInfo* var_info;
int modifier;
JogCmdPreStepProperty() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info,
int modifier )
{
this->t = t;
this->context = context;
this->var_info = var_info;
this->modifier = modifier;
return this;
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
if (modifier > 0) printf("++");
else printf("--");
var_info->name->print();
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm )
{
vm->push( *context );
}
};
template <typename DataType>
struct JogCmdPreStepPropertyReal : JogCmdPreStepProperty
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
JogObject* context = vm->pop_ref().null_check(t);
double& v = ((double*)context->data)[var_info->index];
v = (DataType) (v + modifier);
vm->push( v );
}
};
template <typename DataType>
struct JogCmdPreStepPropertyInteger : JogCmdPreStepProperty
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
JogObject* context = vm->pop_ref().null_check(t);
JogInt64& v = ((JogInt64*)context->data)[var_info->index];
v = (DataType) (v + modifier);
vm->push( v );
}
};
struct JogCmdPostStepProperty : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
JogPropertyInfo* var_info;
int modifier;
JogCmdPostStepProperty() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info,
int modifier )
{
this->t = t;
this->context = context;
this->var_info = var_info;
this->modifier = modifier;
return this;
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
var_info->name->print();
if (modifier > 0) printf("++");
else printf("--");
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm )
{
vm->push( *context );
}
};
template <typename DataType>
struct JogCmdPostStepPropertyReal : JogCmdPostStepProperty
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
JogObject* context = vm->pop_ref().null_check(t);
double& v = ((double*)context->data)[var_info->index];
vm->push( v );
v = (DataType) (v + modifier);
}
};
template <typename DataType>
struct JogCmdPostStepPropertyInteger : JogCmdPostStepProperty
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
JogObject* context = vm->pop_ref().null_check(t);
JogInt64& v = ((JogInt64*)context->data)[var_info->index];
vm->push( v );
v = (DataType) (v + modifier);
}
};
//--------------------------------------------------------------------
struct JogCmdPreStepClassProperty : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
JogPropertyInfo* var_info;
int modifier;
JogCmdPreStepClassProperty() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info,
int modifier )
{
this->t = t;
this->context = context;
this->var_info = var_info;
this->modifier = modifier;
if (*context) context = context->discarding_result();
return this;
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
if (modifier > 0) printf("++");
else printf("--");
var_info->name->print();
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm )
{
if (*context) vm->push( *context );
}
};
template <typename DataType>
struct JogCmdPreStepClassPropertyReal : JogCmdPreStepClassProperty
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
double& v = ((double*)var_info->type_context->class_data)[var_info->index];
v = (DataType) (v + modifier);
vm->push( v );
}
};
template <typename DataType>
struct JogCmdPreStepClassPropertyInteger : JogCmdPreStepClassProperty
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
JogInt64& v = var_info->type_context->class_data[var_info->index];
v = (DataType) (v + modifier);
vm->push( v );
}
};
struct JogCmdPostStepClassProperty : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
JogPropertyInfo* var_info;
int modifier;
JogCmdPostStepClassProperty() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context, JogPropertyInfo* var_info,
int modifier )
{
this->t = t;
this->context = context;
this->var_info = var_info;
this->modifier = modifier;
if (*context) context = context->discarding_result();
return this;
}
JogTypeInfo* type() { return var_info->type; }
void print()
{
var_info->name->print();
if (modifier > 0) printf("++");
else printf("--");
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm )
{
if (*context) vm->push( *context );
}
};
template <typename DataType>
struct JogCmdPostStepClassPropertyReal : JogCmdPostStepClassProperty
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
double& v = ((double*)var_info->type_context->class_data)[var_info->index];
vm->push( v );
v = (DataType) (v + modifier);
}
};
template <typename DataType>
struct JogCmdPostStepClassPropertyInteger : JogCmdPostStepClassProperty
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
JogInt64& v = var_info->type_context->class_data[var_info->index];
vm->push( v );
v = (DataType) (v + modifier);
}
};
//=============================================================================
// JogCmdArray
//=============================================================================
struct JogCmdArraySize : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
JogCmdArraySize( Ref<JogToken> t, Ref<JogCmd> context )
: JogCmd(t), context(context)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int32; }
void print()
{
context->print();
printf(".length");
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm );
void execute( JogVM* vm );
};
//-----------------------------------------------------------------------------
struct JogCmdArrayRead : JogCmdArrayAccess
{
int node_type() { return __LINE__; }
JogCmdArrayRead( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayAccess(t,context,index_expr)
{
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm );
};
struct JogCmdArrayReadRef : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadRef( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return context->type()->element_type; }
void execute( JogVM* vm );
};
struct JogCmdArrayReadReal64 : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadReal64( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return jog_type_manager.type_real64; }
void execute( JogVM* vm );
};
struct JogCmdArrayReadReal32 : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadReal32( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return jog_type_manager.type_real32; }
void execute( JogVM* vm );
};
struct JogCmdArrayReadInt64 : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadInt64( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int64; }
void execute( JogVM* vm );
};
struct JogCmdArrayReadInt32 : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadInt32( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int32; }
void execute( JogVM* vm );
};
struct JogCmdArrayReadInt16 : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadInt16( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int16; }
void execute( JogVM* vm );
};
struct JogCmdArrayReadInt8 : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadInt8( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int8; }
void execute( JogVM* vm );
};
struct JogCmdArrayReadChar : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadChar( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return jog_type_manager.type_char; }
void execute( JogVM* vm );
};
struct JogCmdArrayReadBoolean : JogCmdArrayRead
{
int node_type() { return __LINE__; }
JogCmdArrayReadBoolean( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr )
: JogCmdArrayRead(t,context,index_expr)
{
}
JogTypeInfo* type() { return jog_type_manager.type_boolean; }
void execute( JogVM* vm );
};
//-----------------------------------------------------------------------------
struct JogCmdArrayWrite : JogCmdArrayAccess
{
int node_type() { return __LINE__; }
Ref<JogCmd> new_value;
JogCmdArrayWrite( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayAccess(t,context,index_expr), new_value(new_value)
{
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm );
};
struct JogCmdArrayWriteRef : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteRef( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return context->type()->element_type; }
void execute( JogVM* vm );
};
struct JogCmdArrayWriteReal64 : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteReal64( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return jog_type_manager.type_real64; }
void execute( JogVM* vm );
};
struct JogCmdArrayWriteReal32 : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteReal32( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return jog_type_manager.type_real32; }
void execute( JogVM* vm );
};
struct JogCmdArrayWriteInt64 : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteInt64( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int64; }
void execute( JogVM* vm );
};
struct JogCmdArrayWriteInt32 : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteInt32( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int32; }
void execute( JogVM* vm );
};
struct JogCmdArrayWriteInt16 : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteInt16( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int16; }
void execute( JogVM* vm );
};
struct JogCmdArrayWriteInt8 : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteInt8( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return jog_type_manager.type_int8; }
void execute( JogVM* vm );
};
struct JogCmdArrayWriteChar : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteChar( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return jog_type_manager.type_char; }
void execute( JogVM* vm );
};
struct JogCmdArrayWriteBoolean : JogCmdArrayWrite
{
int node_type() { return __LINE__; }
JogCmdArrayWriteBoolean( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
Ref<JogCmd> new_value )
: JogCmdArrayWrite(t,context,index_expr,new_value)
{
}
JogTypeInfo* type() { return jog_type_manager.type_boolean; }
void execute( JogVM* vm );
};
//--------------------------------------------------------------------
struct JogCmdPreStepArray : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
Ref<JogCmd> index_expr;
int modifier;
JogCmdPreStepArray() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
int modifier )
{
this->t = t;
this->context = context;
this->index_expr = index_expr;
this->modifier = modifier;
return this;
}
JogTypeInfo* type() { return context->type()->element_type; }
void print()
{
if (modifier > 0) printf("++");
else printf("--");
context->print();
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm )
{
vm->push( *index_expr );
vm->push( *context );
}
};
template <typename DataType>
struct JogCmdPreStepArrayReal : JogCmdPreStepArray
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& v = ((DataType*)array->data)[index];
v = (DataType) (v + modifier);
vm->push( v );
}
};
template <typename DataType>
struct JogCmdPreStepArrayInteger : JogCmdPreStepArray
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& v = ((DataType*)array->data)[index];
v = (DataType) (v + modifier);
vm->push( v );
}
};
struct JogCmdPostStepArray : JogCmd
{
int node_type() { return __LINE__; }
Ref<JogCmd> context;
Ref<JogCmd> index_expr;
int modifier;
JogCmdPostStepArray() : JogCmd(NULL) { }
Ref<JogCmd> init( Ref<JogToken> t, Ref<JogCmd> context, Ref<JogCmd> index_expr,
int modifier )
{
this->t = t;
this->context = context;
this->index_expr = index_expr;
this->modifier = modifier;
return this;
}
JogTypeInfo* type() { return context->type()->element_type; }
void print()
{
context->print();
if (modifier > 0) printf("++");
else printf("--");
}
Ref<JogCmd> resolve() { return this; }
void on_push( JogVM* vm )
{
vm->push( *index_expr );
vm->push( *context );
}
};
template <typename DataType>
struct JogCmdPostStepArrayReal : JogCmdPostStepArray
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& v = ((DataType*)array->data)[index];
vm->push( v );
v = (DataType) (v + modifier);
}
};
template <typename DataType>
struct JogCmdPostStepArrayInteger : JogCmdPostStepArray
{
int node_type() { return __LINE__; }
void execute( JogVM* vm )
{
int index = vm->pop_int();
JogObject* array = vm->pop_ref().null_check(t);
array->index_check(t,index);
DataType& v = ((DataType*)array->data)[index];
vm->push( v );
v = (DataType) (v + modifier);
}
};
//=============================================================================
// JogParser
//=============================================================================
struct JogParser : RefCounted
{
Ref<JogScanner> scanner;
JogMethodInfo* this_method;
ArrayList<JogTypeInfo*> parsed_types;
JogParser( const char* filename );
JogParser( Ref<JogScanner> scanner );
JogTypeInfo* parse_type_def();
JogTypeInfo* parse_type_def( Ref<JogToken> t, int quals, const char* missing_name_mesg );
void parse_type_def( Ref<JogToken> t, JogTypeInfo* type );
JogPlaceholderType parse_placeholder_type();
int parse_type_qualifiers();
int parse_member_qualifiers();
bool parse_member( JogTypeInfo* type );
void parse_params( Ref<JogMethodInfo> m );
JogTypeInfo* parse_data_type( bool parse_brackets=true );
Ref<JogCmd> parse_initial_value( JogTypeInfo* of_type );
Ref<JogCmd> parse_statement( bool require_semicolon=true );
Ref<JogCmd> parse_local_var_decl( Ref<JogToken> t, JogTypeInfo* var_type, bool require_semicolon );
Ref<JogCmd> parse_expression();
Ref<JogCmd> parse_assignment();
Ref<JogCmd> parse_conditional();
Ref<JogCmd> parse_logical_or();
Ref<JogCmd> parse_logical_or( Ref<JogCmd> lhs );
Ref<JogCmd> parse_logical_and();
Ref<JogCmd> parse_logical_and( Ref<JogCmd> lhs );
Ref<JogCmd> parse_bitwise_or();
Ref<JogCmd> parse_bitwise_or( Ref<JogCmd> lhs );
Ref<JogCmd> parse_bitwise_xor();
Ref<JogCmd> parse_bitwise_xor( Ref<JogCmd> lhs );
Ref<JogCmd> parse_bitwise_and();
Ref<JogCmd> parse_bitwise_and( Ref<JogCmd> lhs );
Ref<JogCmd> parse_equality();
Ref<JogCmd> parse_equality( Ref<JogCmd> lhs );
Ref<JogCmd> parse_relational();
Ref<JogCmd> parse_relational( Ref<JogCmd> lhs );
Ref<JogCmd> parse_shift();
Ref<JogCmd> parse_shift( Ref<JogCmd> lhs );
Ref<JogCmd> parse_translate();
Ref<JogCmd> parse_translate( Ref<JogCmd> lhs );
Ref<JogCmd> parse_scale();
Ref<JogCmd> parse_scale( Ref<JogCmd> lhs );
Ref<JogCmd> parse_prefix_unary();
Ref<JogCmd> parse_array_decl( Ref<JogToken> t, JogTypeInfo* array_type );
Ref<JogCmd> parse_postfix_unary();
Ref<JogCmd> parse_postfix_unary( Ref<JogCmd> operand );
Ref<JogCmd> parse_term();
Ref<JogCmd> parse_construct();
Ref<JogCmdList> parse_args( bool required );
Ref<JogCmd> parse_literal_array( JogTypeInfo* of_type );
};
//=============================================================================
// JogContext
//=============================================================================
struct JogContext;
extern JogContext* jog_context;
struct JogContext
{
JogContext* previous_context;
JogTypeInfo* this_type;
JogMethodInfo* this_method;
ArrayList<JogLocalVarInfo*> locals;
JogContext( JogMethodInfo* m ) : this_method(m)
{
previous_context = jog_context;
this_type = this_method->type_context;
jog_context = this;
for (int i=0; i<m->parameters.count; ++i)
{
add( m->parameters[i] );
}
}
JogLocalVarInfo* find_local( Ref<JogString> name )
{
int count = locals.count;
for (int i=0; i<count; ++i)
{
if (locals[i]->name->equals(name)) return locals[i];
}
return NULL;
}
void add( Ref<JogLocalVarInfo> info )
{
if (find_local(info->name))
{
StringBuilder buffer;
buffer.print( "A local variable named '" );
info->name->print( buffer );
buffer.print( "' already exists in the current scope." );
throw info->t->error( (const char*) buffer.to_string() );
}
info->index = this_method->locals.count;
locals.add( *info );
this_method->locals.add( info );
}
~JogContext()
{
jog_context = previous_context;
}
};
#endif //JOG_H
| 21.600503 | 232 | 0.607712 | [
"object"
] |
023e3c90efed967e2eb69602f157ef93f1866868 | 4,273 | h | C | HiroCamSDK/src/main/cpp/dependence/src/libmp4v2/src/itmf/CoverArtBox.h | shirleyyuqi/UIFySim | 15810480022003f5f84509229ef5acbd47e54172 | [
"Apache-2.0"
] | 1 | 2019-12-25T17:38:30.000Z | 2019-12-25T17:38:30.000Z | HiroCamSDK/src/main/cpp/dependence/src/libmp4v2/src/itmf/CoverArtBox.h | shirleyyuqi/UIFySim | 15810480022003f5f84509229ef5acbd47e54172 | [
"Apache-2.0"
] | 1 | 2020-03-18T10:20:43.000Z | 2020-03-18T10:20:43.000Z | mp4v2-2.0.0/src/itmf/CoverArtBox.h | nichesuch/AirOrche | ab048fe01eb85633464ab676ff33e06c7fef1097 | [
"MIT"
] | null | null | null | ///////////////////////////////////////////////////////////////////////////////
//
// The contents of this file are subject to the Mozilla Public License
// Version 1.1 (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.mozilla.org/MPL/
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is MP4v2.
//
// The Initial Developer of the Original Code is Kona Blend.
// Portions created by Kona Blend are Copyright (C) 2008.
// All Rights Reserved.
//
// Contributors:
// Kona Blend, kona8lend@@gmail.com
//
///////////////////////////////////////////////////////////////////////////////
#ifndef MP4V2_IMPL_ITMF_COVERARTBOX_H
#define MP4V2_IMPL_ITMF_COVERARTBOX_H
namespace mp4v2 { namespace impl { namespace itmf {
///////////////////////////////////////////////////////////////////////////////
/// Functional class for covr-box (Cover-art Box) support.
///
class MP4V2_EXPORT CoverArtBox
{
public:
/// Data object for covr-box item.
/// This object correlates to one covr->data atom and offers automatic
/// memory freeing when <b>autofree</b> is true.
///
class MP4V2_EXPORT Item
{
public:
Item();
Item( const Item& );
~Item();
Item& operator=( const Item& );
/// Reset to state of newly constructed object.
/// If <b>buffer</b> is not NULL and <b>autofree</b> is true the
/// buffer will be free'd.
void reset();
BasicType type; ///< covr-box type.
uint8_t* buffer; ///< buffer point to raw covr-box data.
uint32_t size; ///< size of covr-box buffer size in bytes.
bool autofree; ///< when true invoke free(buffer) upon destruction.
};
/// Object representing a list of covr-box items.
typedef vector<Item> ItemList;
/// Fetch list of covr-box items from file.
///
/// @param hFile on which to operate.
/// @param out vector of ArtItem objects.
///
/// @return <b>true</b> on failure, <b>false</b> on success.
///
static bool list( MP4FileHandle hFile, ItemList& out );
/// Add covr-box item to file.
/// Any necessary metadata atoms are first created.
/// Additionally, if an empty data-atom exists it will be used,
/// otherwise a new data-atom is added to <b>covr-atom</b>.
///
/// @param hFile on which to operate.
/// @param item covr-box object to place in file.
///
/// @return <b>true</b> on failure, <b>false</b> on success.
///
static bool add( MP4FileHandle hFile, const Item& item );
/// Replace covr-box item in file.
///
/// @param hFile on which to operate.
/// @param item covr-box object to place in file.
/// @param index 0-based index of image to replace.
///
/// @return <b>true</b> on failure, <b>false</b> on success.
///
static bool set( MP4FileHandle hFile, const Item& item, uint32_t index );
/// Fetch covr-box item from file.
///
/// @param hFile on which to operate.
/// @param item covr-box object populated with data.
/// The resulting object owns the malloc'd buffer and <b>item.autofree</b>
/// is set to true for convenient memory management.
/// @param index 0-based index of image to fetch.
///
/// @return <b>true</b> on failure, <b>false</b> on success.
///
static bool get( MP4FileHandle hFile, Item& item, uint32_t index );
/// Remove covr-box item from file.
///
/// @param hFile on which to operate.
/// @param index 0-based index of image to remove.
/// Default value indicates wildcard behavior to remove all items.
///
/// @return <b>true</b> on failure, <b>false</b> on success.
///
static bool remove( MP4FileHandle hFile, uint32_t index = numeric_limits<uint32_t>::max() );
};
///////////////////////////////////////////////////////////////////////////////
}}} // namespace mp4v2::impl::itmf
#endif // MP4V2_IMPL_ITMF_COVERARTBOX_H
| 35.02459 | 96 | 0.586239 | [
"object",
"vector"
] |
02420b8fd14dd31bfbada1bafaebf769ca6349ee | 1,588 | h | C | examples/tv-app/android/java/OnOffManager.h | mrninhvn/matter | c577b233db9d2f3a6f87108a062b1699a40c5169 | [
"Apache-2.0"
] | 4 | 2020-09-11T04:32:44.000Z | 2022-03-11T09:06:07.000Z | examples/tv-app/android/java/OnOffManager.h | mrninhvn/matter | c577b233db9d2f3a6f87108a062b1699a40c5169 | [
"Apache-2.0"
] | 6 | 2022-01-19T03:58:32.000Z | 2022-01-21T06:49:15.000Z | examples/tv-app/android/java/OnOffManager.h | mrninhvn/matter | c577b233db9d2f3a6f87108a062b1699a40c5169 | [
"Apache-2.0"
] | 2 | 2021-12-02T09:08:00.000Z | 2021-12-03T07:31:44.000Z | /*
*
* Copyright (c) 2022 Project CHIP Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <app-common/zap-generated/cluster-objects.h>
#include <jni.h>
/**
* @brief Handles interfacing between java code and C++ code for the purposes of On/Off clusters.
*/
class OnOffManager
{
public:
// installed a bridege for a On/Off cluster endpoint and java object
static void NewManager(jint endpoint, jobject manager);
// helps for java to set attributes::OnOff of OnOff cluster
static jboolean SetOnOff(jint endpoint, bool value);
// posts a OnOffChanged event to suitable OnOffManager
static void PostOnOffChanged(chip::EndpointId endpoint, bool value);
// handles `Changed` callbacks by calling the java `void HandleOnOffChanged()` method
void HandleOnOffChanged(bool value);
private:
// init with java objects
CHIP_ERROR InitializeWithObjects(jobject managerObject);
jobject mOnOffManagerObject = nullptr;
jmethodID mHandleOnOffChangedMethod = nullptr;
};
| 34.521739 | 97 | 0.724181 | [
"object"
] |
024e72113ebff84fcfdf511e45b26cb16c7f5cb2 | 2,542 | h | C | src/TNL/Meshes/Writers/VTKWriter.h | GregTheMadMonk/tnl-noa | d7d57962decf579a89797816e7d564350157cbf2 | [
"MIT"
] | null | null | null | src/TNL/Meshes/Writers/VTKWriter.h | GregTheMadMonk/tnl-noa | d7d57962decf579a89797816e7d564350157cbf2 | [
"MIT"
] | null | null | null | src/TNL/Meshes/Writers/VTKWriter.h | GregTheMadMonk/tnl-noa | d7d57962decf579a89797816e7d564350157cbf2 | [
"MIT"
] | null | null | null | // Copyright (c) 2004-2022 Tomáš Oberhuber et al.
//
// This file is part of TNL - Template Numerical Library (https://tnl-project.org/)
//
// SPDX-License-Identifier: MIT
#pragma once
#include <ostream>
#include <noa/3rdparty/tnl-noa/src/TNL/Meshes/VTKTraits.h>
namespace noa::TNL {
namespace Meshes {
//! \brief Namespace for mesh writers.
namespace Writers {
template< typename Mesh >
class VTKWriter
{
static_assert( Mesh::getMeshDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
// TODO: check also space dimension when grids allow it
// static_assert( Mesh::getSpaceDimension() <= 3, "The VTK format supports only 1D, 2D and 3D meshes." );
public:
VTKWriter() = delete;
VTKWriter( std::ostream& str, VTK::FileFormat format = VTK::FileFormat::binary ) : str( str.rdbuf() ), format( format )
{
if( format != VTK::FileFormat::ascii && format != VTK::FileFormat::binary )
throw std::domain_error( "The Legacy VTK file formats support only ASCII and BINARY formats." );
}
// If desired, cycle and time of the simulation can put into the file. This follows the instructions at
// http://www.visitusers.org/index.php?title=Time_and_Cycle_in_VTK_files
void
writeMetadata( std::int32_t cycle = -1, double time = -1 );
template< int EntityDimension = Mesh::getMeshDimension() >
void
writeEntities( const Mesh& mesh );
template< typename Array >
void
writePointData( const Array& array, const std::string& name, int numberOfComponents = 1 );
template< typename Array >
void
writeCellData( const Array& array, const std::string& name, int numberOfComponents = 1 );
template< typename Array >
void
writeDataArray( const Array& array, const std::string& name, int numberOfComponents = 1 );
protected:
void
writePoints( const Mesh& mesh );
void
writeHeader();
std::ostream str;
VTK::FileFormat format;
// number of cells (in the VTK sense) written to the file
std::uint64_t cellsCount = 0;
// number of points written to the file
std::uint64_t pointsCount = 0;
// indicator if the header has been written
bool headerWritten = false;
// number of data arrays written in each section
int cellDataArrays = 0;
int pointDataArrays = 0;
// indicator of the current section
VTK::DataType currentSection = VTK::DataType::CellData;
};
} // namespace Writers
} // namespace Meshes
} // namespace noa::TNL
#include <noa/3rdparty/tnl-noa/src/TNL/Meshes/Writers/VTKWriter.hpp>
| 28.886364 | 122 | 0.694729 | [
"mesh",
"3d"
] |
0252772cb0a64dff2ed072dc479461b8ef8c1857 | 9,667 | c | C | src/sslcompat.c | geertj/gruvi | 1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8 | [
"MIT"
] | 47 | 2015-01-06T06:35:32.000Z | 2021-11-11T16:11:42.000Z | src/sslcompat.c | geertj/gruvi | 1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8 | [
"MIT"
] | 10 | 2015-02-17T13:15:12.000Z | 2017-09-05T11:28:11.000Z | src/sslcompat.c | geertj/gruvi | 1d77ca439600b6ea7a19aa1ee85dca0f3be3f3f8 | [
"MIT"
] | 10 | 2015-05-27T09:53:53.000Z | 2017-11-17T11:56:21.000Z | /*
* This file is part of Gruvi. Gruvi is free software available under the
* terms of the MIT license. See the file "LICENSE" that was provided
* together with this source file for the licensing terms.
*
* Copyright (c) 2012-2017 the Gruvi authors. See the file "AUTHORS" for a
* complete list.
*/
#include <Python.h>
/*
* This module backports the async SSL support from Python 3.5 to earlier
* versions. It supports Python 2.7, 3.3 and 3.4.
* */
#if !(PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7) \
&& !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 3) \
&& !(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION == 4)
# error "This module is for Python 2.7, 3.3 and 3.4 only."
#endif
#include <string.h>
#include <openssl/ssl.h>
/* Some useful error handling macros. */
#define RETURN_ERROR(fmt, ...) \
do { \
if ((fmt) != NULL) PyErr_Format(SSLError, fmt, ## __VA_ARGS__); \
goto error; \
} while (0)
#define RETURN_NONE(dest) \
do { Py_INCREF(Py_None); dest = Py_None; goto error; } while (0)
/* Useful Python 2/3 portability macros. Kudos to
* http://python3porting.com/cextensions.html. */
#if PY_MAJOR_VERSION >= 3
# define MOD_OK(val) (val)
# define MOD_ERROR NULL
# define MOD_INITFUNC(name) PyMODINIT_FUNC PyInit_ ## name(void)
# define INIT_MODULE(mod, name, methods, doc) \
do { \
static struct PyModuleDef moduledef = { \
PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \
mod = PyModule_Create(&moduledef); \
} while (0)
# define BUF_FMT "y*"
#else
# define MOD_OK(value)
# define MOD_ERROR
# define MOD_INITFUNC(name) void init ## name(void)
# define INIT_MODULE(mod, name, methods, doc) \
do { mod = Py_InitModule3(name, methods, doc); } while (0)
# define BUF_FMT "s*"
#endif
/* Globals */
static PyObject *SSLError = NULL;
/* The MemoryBIO object has been copied and adapted from Python 3.5 */
typedef struct {
PyObject_HEAD
BIO *bio;
int eof_written;
} PySSLMemoryBIO;
static PyTypeObject PySSLMemoryBIO_Type;
/* Define a structure that has the same layout as PySSLObject in the _ssl
* module. This allows us to compile this module separately from the Python
* source tree.
*
* Of course we need to be very careful here that things match.
*/
typedef struct
{
PyObject_HEAD
PyObject *Socket;
#if PY_MAJOR_VERSION == 2
SSL_CTX *ctx;
#endif
SSL *ssl;
} PySSLObject;
#if PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7 && PY_MICRO_VERSION < 9
# define SSL_OBJ_NAME "ssl.SSLContext"
#else
# define SSL_OBJ_NAME "_ssl._SSLSocket"
#endif
#define CHECK_SSL_OBJ(obj) \
do { \
if (strcmp(Py_TYPE(obj)->tp_name, SSL_OBJ_NAME)) \
RETURN_ERROR("expecting a " SSL_OBJ_NAME " instance"); \
} while (0)
/* MemoryBIO type */
static PyObject *
memory_bio_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
BIO *bio = NULL;
PySSLMemoryBIO *self = NULL;
if (!PyArg_ParseTuple(args, ":MemoryBIO"))
RETURN_ERROR(NULL);
bio = BIO_new(BIO_s_mem());
if (bio == NULL)
RETURN_ERROR("failed to allocate BIO");
/* Since our BIO is non-blocking an empty read() does not indicate EOF,
* just that no data is currently available. The SSL routines should retry
* the read, which we can achieve by calling BIO_set_retry_read(). */
BIO_set_retry_read(bio);
BIO_set_mem_eof_return(bio, -1);
self = (PySSLMemoryBIO *) type->tp_alloc(type, 0);
if (self == NULL)
RETURN_ERROR(NULL);
self->bio = bio; bio = NULL;
self->eof_written = 0;
error:
if (bio != NULL) BIO_free(bio);
return (PyObject *) self;
}
static void
memory_bio_dealloc(PySSLMemoryBIO *self)
{
BIO_free(self->bio);
Py_TYPE(self)->tp_free(self);
}
static PyObject *
memory_bio_get_pending(PySSLMemoryBIO *self, void *c)
{
return PyLong_FromLong(BIO_ctrl_pending(self->bio));
}
static PyObject *
memory_bio_get_eof(PySSLMemoryBIO *self, void *c)
{
return PyBool_FromLong((BIO_ctrl_pending(self->bio) == 0) && self->eof_written);
}
static PyObject *
memory_bio_read(PySSLMemoryBIO *self, PyObject *args)
{
int len = -1, avail, nbytes;
PyObject *Pret = NULL;
if (!PyArg_ParseTuple(args, "|i:read", &len))
RETURN_ERROR(NULL);
avail = BIO_ctrl_pending(self->bio);
if ((len < 0) || (len > avail))
len = avail;
Pret = PyBytes_FromStringAndSize(NULL, len);
if (Pret == NULL)
RETURN_ERROR(NULL);
if (len > 0) {
nbytes = BIO_read(self->bio, PyBytes_AS_STRING(Pret), len);
/* There should never be any short reads but check anyway. */
if ((nbytes < len) && (_PyBytes_Resize(&Pret, len) < 0)) {
Py_DECREF(Pret); Pret = NULL;
RETURN_ERROR(NULL);
}
}
error:
return Pret;
}
static PyObject *
memory_bio_write(PySSLMemoryBIO *self, PyObject *args)
{
PyObject *Pret = NULL;
Py_buffer buf;
int nbytes;
buf.buf = NULL;
if (!PyArg_ParseTuple(args, BUF_FMT ":write", &buf))
RETURN_ERROR(NULL);
if (buf.len > INT_MAX)
RETURN_ERROR("string longer than %d bytes", INT_MAX);
if (self->eof_written)
RETURN_ERROR("cannot write() after write_eof()");
nbytes = BIO_write(self->bio, buf.buf, buf.len);
if (nbytes < 0)
RETURN_ERROR("BIO_write() failed");
Pret = PyLong_FromLong(nbytes);
error:
if (buf.buf != NULL) PyBuffer_Release(&buf);
return Pret;
}
static PyObject *
memory_bio_write_eof(PySSLMemoryBIO *self, PyObject *args)
{
self->eof_written = 1;
/* After an EOF is written, a zero return from read() should be a real EOF
* i.e. it should not be retried. Clear the SHOULD_RETRY flag. */
BIO_clear_retry_flags(self->bio);
BIO_set_mem_eof_return(self->bio, 0);
Py_RETURN_NONE;
}
static PyGetSetDef memory_bio_getsetlist[] =
{
{"pending", (getter) memory_bio_get_pending, NULL, NULL},
{"eof", (getter) memory_bio_get_eof, NULL, NULL},
{NULL, NULL}
};
static PyMethodDef memory_bio_methods[] =
{
{"read", (PyCFunction) memory_bio_read, METH_VARARGS, NULL},
{"write", (PyCFunction) memory_bio_write, METH_VARARGS, NULL},
{"write_eof", (PyCFunction) memory_bio_write_eof, METH_NOARGS, NULL},
{NULL, NULL}
};
static PyTypeObject PySSLMemoryBIO_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"_sslcompat.MemoryBIO", /*tp_name*/
sizeof(PySSLMemoryBIO), /*tp_basicsize*/
0, /*tp_itemsize*/
(destructor)memory_bio_dealloc, /*tp_dealloc*/
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
Py_TPFLAGS_DEFAULT, /*tp_flags*/
0, 0, 0, 0, 0, 0, 0,
memory_bio_methods, /*tp_methods*/
0, /*tp_members*/
memory_bio_getsetlist, /*tp_getset*/
0, 0, 0, 0, 0, 0, 0,
memory_bio_new, /*tp_new*/
};
/* This method is where the money it. It replaces the BIO on the SSL
* structure that the PySSLSocket is managing, without any knowledge or
* cooperation from PySSLSocket itself.
*
* For this to work it is important that the socket is in non-blocking
* mode. Otherwise _ssl will attempt to select on it which would be
* meaningless.
* */
static PyObject *
sslcompat_replace_bio(PyObject *self, PyObject *args)
{
PyObject *Pret = NULL;
PySSLObject *sslob;
PySSLMemoryBIO *inbio, *outbio;
if (!PyArg_ParseTuple(args, "OO!O!:replace_bio", &sslob, &PySSLMemoryBIO_Type,
&inbio, &PySSLMemoryBIO_Type, &outbio))
RETURN_ERROR(NULL);
CHECK_SSL_OBJ(sslob);
/* BIOs are reference counted and SSL_set_bio borrows our reference.
* To prevent a double free in memory_bio_dealloc() we need to take an
* extra reference here. */
CRYPTO_add(&inbio->bio->references, 1, CRYPTO_LOCK_BIO);
CRYPTO_add(&outbio->bio->references, 1, CRYPTO_LOCK_BIO);
/* Now replace the socket BIO with the memory BIOs */
SSL_set_bio(sslob->ssl, inbio->bio, outbio->bio);
RETURN_NONE(Pret);
error:
return Pret;
}
static PyMethodDef sslcompat_methods[] =
{
{"replace_bio", (PyCFunction) sslcompat_replace_bio, METH_VARARGS},
{NULL, NULL}
};
/* Main module */
PyDoc_STRVAR(sslcompat_doc, "Backport of Python 3.5+ async ssl support");
MOD_INITFUNC(_sslcompat)
{
PyObject *Pmodule, *Pdict, *Perrors, *Pstr;
INIT_MODULE(Pmodule, "_sslcompat", sslcompat_methods, sslcompat_doc);
if (!((Pdict = PyModule_GetDict(Pmodule))))
return MOD_ERROR;
if (!(SSLError = PyErr_NewException("_sslcompat.Error", NULL, NULL)))
return MOD_ERROR;
if (PyDict_SetItemString(Pdict, "Error", SSLError) < 0)
return MOD_ERROR;
if (PyType_Ready(&PySSLMemoryBIO_Type) < 0)
return MOD_ERROR;
if (PyDict_SetItemString(Pdict, "MemoryBIO", (PyObject *) &PySSLMemoryBIO_Type) < 0)
return MOD_ERROR;
/* Expose error codes that are needed (just 1 for now). */
if (!(Perrors = PyDict_New()))
return MOD_ERROR;
if (!(Pstr = PyBytes_FromString("PROTOCOL_IS_SHUTDOWN")))
return MOD_ERROR;
if (PyDict_SetItem(Perrors, PyLong_FromLong(SSL_R_PROTOCOL_IS_SHUTDOWN), Pstr) < 0)
return MOD_ERROR;
if (PyDict_SetItemString(Pdict, "errorcode", Perrors) < 0)
return MOD_ERROR;
/* Don't initialize the SSL library here. The following is done by _ssl:
SSL_load_error_strings();
SSL_library_init();
*/
return MOD_OK(Pmodule);
}
| 27.230986 | 88 | 0.644978 | [
"object"
] |
0259422f8059c69bccebcc7b35583ffb0894a694 | 2,548 | h | C | aws-cpp-sdk-codeguru-reviewer/include/aws/codeguru-reviewer/model/DescribeRecommendationFeedbackResult.h | orinem/aws-sdk-cpp | f38413cc1f278689ef14e9ebdd74a489a48776be | [
"Apache-2.0"
] | 1 | 2020-07-16T19:02:58.000Z | 2020-07-16T19:02:58.000Z | aws-cpp-sdk-codeguru-reviewer/include/aws/codeguru-reviewer/model/DescribeRecommendationFeedbackResult.h | novaquark/aws-sdk-cpp | a0969508545bec9ae2864c9e1e2bb9aff109f90c | [
"Apache-2.0"
] | null | null | null | aws-cpp-sdk-codeguru-reviewer/include/aws/codeguru-reviewer/model/DescribeRecommendationFeedbackResult.h | novaquark/aws-sdk-cpp | a0969508545bec9ae2864c9e1e2bb9aff109f90c | [
"Apache-2.0"
] | null | null | null | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/codeguru-reviewer/CodeGuruReviewer_EXPORTS.h>
#include <aws/codeguru-reviewer/model/RecommendationFeedback.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace CodeGuruReviewer
{
namespace Model
{
class AWS_CODEGURUREVIEWER_API DescribeRecommendationFeedbackResult
{
public:
DescribeRecommendationFeedbackResult();
DescribeRecommendationFeedbackResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
DescribeRecommendationFeedbackResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p> The recommendation feedback given by the user. </p>
*/
inline const RecommendationFeedback& GetRecommendationFeedback() const{ return m_recommendationFeedback; }
/**
* <p> The recommendation feedback given by the user. </p>
*/
inline void SetRecommendationFeedback(const RecommendationFeedback& value) { m_recommendationFeedback = value; }
/**
* <p> The recommendation feedback given by the user. </p>
*/
inline void SetRecommendationFeedback(RecommendationFeedback&& value) { m_recommendationFeedback = std::move(value); }
/**
* <p> The recommendation feedback given by the user. </p>
*/
inline DescribeRecommendationFeedbackResult& WithRecommendationFeedback(const RecommendationFeedback& value) { SetRecommendationFeedback(value); return *this;}
/**
* <p> The recommendation feedback given by the user. </p>
*/
inline DescribeRecommendationFeedbackResult& WithRecommendationFeedback(RecommendationFeedback&& value) { SetRecommendationFeedback(std::move(value)); return *this;}
private:
RecommendationFeedback m_recommendationFeedback;
};
} // namespace Model
} // namespace CodeGuruReviewer
} // namespace Aws
| 32.666667 | 169 | 0.749608 | [
"model"
] |
02632328516125397d5941968343f8c884ac6fa2 | 39,187 | h | C | lib/seismic/libseispp/seispp.h | chad-iris/antelope_contrib | d4cb83d433f30fd76ee7416f3106a4074a7206d4 | [
"BSD-2-Clause",
"MIT"
] | 30 | 2015-02-20T21:44:29.000Z | 2021-09-27T02:53:14.000Z | lib/seismic/libseispp/seispp.h | chad-iris/antelope_contrib | d4cb83d433f30fd76ee7416f3106a4074a7206d4 | [
"BSD-2-Clause",
"MIT"
] | 14 | 2015-07-07T19:17:24.000Z | 2020-12-19T19:18:53.000Z | lib/seismic/libseispp/seispp.h | chad-iris/antelope_contrib | d4cb83d433f30fd76ee7416f3106a4074a7206d4 | [
"BSD-2-Clause",
"MIT"
] | 46 | 2015-02-06T16:22:41.000Z | 2022-03-30T11:46:37.000Z | #ifndef _SEISPP_H_
#define _SEISPP_H_
// Seismic C++ Library (SEISPP).
// This is a collection of C++ objects used for processing seismic data.
// Objects define some common seismological concepts including time series
// data, three component seismograms, ensembles of seismograms, velocity
// models, hypocenters, slowness vectors, and others.
// The library has a strong dependence on Antelope in implementation, but
// the API design was intended to be more general.
#ifdef sun
#include <sunmath.h>
#endif
#include <limits.h>
//
// These STL includes are needed for templates in this file
//
#include <vector>
#include <algorithm>
//
// Antelope includes required
//
#include "stock.h"
#ifndef NO_ANTELOPE
#include "db.h"
#include "tr.h"
#include "pf.h"
//
// These are glp stuff external to this library
//
#include "pfstream.h"
#endif
//
// Library internal includes files required for the seispp.h include
//
#include "gclgrid.h"
#include "SeisppKeywords.h"
#include "TimeSeries.h"
#include "ThreeComponentSeismogram.h"
#ifndef NO_ANTELOPE
//#include "ComplexTimeSeries.h"
#include "seismicarray.h"
#endif
#include "ensemble.h"
namespace SEISPP
{
using namespace SEISPP;
using namespace std;
/*!
Turns verbose mode on and off.
**/
extern bool SEISPP_verbose;
/*! List of allowed attribute data types.
Binary data types are an essential component of all seismic data
processing as binary data are used universally in external data formats.
This lists the allowed attributes that can be extracted from header
data. It is also used in the interface to extract sample data from
raw external format inputs.*/
enum AttributeType {INT64, INT32, INT16, BYTE, REAL32, REAL64,
STRING, BOOL, HDRINVALID};
/*! Apply a simple static time shift based on elevation.
Applies a time shift called a geometric static to BasicTimeSeries object ts
using velocity vel and elevation elev. This is a simple elev/vel correction.
Note this method can be applied to any data object that inherits
BasicTimeSeries so this should be considered a generic method to do this
process. It is very important to note, however, that it is the
caller responsibility to do any bookeeping if it is important to
keep track of the time shift applid by this procedure.
\param ts data to which the static should be applied.
\param vel surface velocity to use for static computation.
\param elev elevation of station.
**/
void ApplyGeometricStatic(BasicTimeSeries *ts, double vel, double elev);
/*!
// Applies a time shift called a geometric static to TimeSeries object ts
// using velocity and elevation extracted from the metadata area of ts.
// The function requires that attributes "elev" and "surface_velocity"
// be defined in the object. If these attributes are not defined the
// data are not altered but a diagnostic is issued to stderr.
**/
void ApplyGeometricStatic(TimeSeries *ts);
#ifndef NO_ANTELOPE
/*!
// Pfstream method for getting a time series object from an input stream.
// Useful only in a pfstream environment which is currently not well developed
// for this application.
**/
TimeSeries* GetNextTimeSeries(Pfstream_handle *pfh);
/*!
// Companion to GetNextTimeSeries.
// Useful only in a pfstream environment which is currently not well developed
// for this application.
**/
TimeSeries *LoadTimeSeriesUsingPf(Pf *pf);
/*!
// Load an ensemble through a pfstream.
**/
TimeSeriesEnsemble *GetNextEnsemble(Pfstream_handle *pfh,
char *tag,MetadataList& mdlist) throw(SeisppError);
/*!
// Load a 3c ensemble through a pfstream.
**/
ThreeComponentEnsemble *GetNext3cEnsemble(Pfstream_handle *pfh,
char *tag,MetadataList& mdlist) throw(SeisppError);
/*!
// Save a 3c seismgram using a pfstream output.
**/
void PfstreamSave3cseis(ThreeComponentSeismogram *seis,string tag,
string dir, string dfile, Pfstream_handle *pfh) throw(SeisppError);
/*!
// Used by TimeSeries constructors to set data gaps using Antelope methods.
**/
void SetGaps(TimeSeries&,Trsample *,int, string)
throw(SeisppError);
#endif
/*!
// Return direction of particle motion for a P wave with
// slowness (ux,uy) at a surface with P velocity vp0 and
// S velocity vs0.
**/
SphericalCoordinate PMHalfspaceModel(double vp0,double vs0,
double ux,double uy);
/*!
// Returns a new seismogram in an arrival time reference.
// An arrival time reference means that the time is set to relative and
// zero is defined as an arrival time extracted from the metadata area of
// the object. The key used to extract the arrival time used for the
// conversion is passed as a variable as this requires some flexibility.
// To preserve the absolute time standard in this conversion the 0 time
// computed from the arrival time field is used to compute the absolute
// time of the start of the output seismogram as atime+t0. This result
// is stored in the metadata field keyed by the word "time". This allows
// one to convert the data back to an absolute time standard if they so
// desire, but it is less flexible than the input key method.
//
//\exception SeisppError for errors in extracting required information from metadata area.
//
//\param din is input seismogram
//\param key is the metadata key used to find the arrival time to use as a reference.
//\param tw is a TimeWindow object that defines the window of data to extract around
// the desired arrival time.
**/
shared_ptr<ThreeComponentSeismogram> ArrivalTimeReference(ThreeComponentSeismogram& din,
string key, TimeWindow tw);
/*!
// Returns a gather of ThreeComponentSeismograms in an arrival time reference fram.
// An arrival time refernce means that the time is set to relative and
// zero is defined as an arrival time extracted from the metadata area of
// each member object.
//
//\exception SeisppError for errors in extracting required information from metadata area.
//
//\param din is input gather
//\param key is the metadata key used to find the arrival time to use as a reference.
//\param tw is a TimeWindow object that defines the window of data to extract around
// the desired arrival time.
**/
shared_ptr<ThreeComponentEnsemble> ArrivalTimeReference(ThreeComponentEnsemble& din,
string key, TimeWindow tw);
/*!
// Returns a new TimeSeries seismogram in an arrival time reference.
// An arrival time reference means that the time is set to relative and
// zero is defined as an arrival time extracted from the metadata area of
// the object. The key used to extract the arrival time used for the
// conversion is passed as a variable as this requires some flexibility.
// To preserve the absolute time standard in this conversion the 0 time
// computed from the arrival time field is used to compute the absolute
// time of the start of the output seismogram as atime+t0. This result
// is stored in the metadata field keyed by the word "time". This allows
// one to convert the data back to an absolute time standard if they so
// desire, but it is less flexible than the input key method.
//
//\exception SeisppError for errors in extracting required information from metadata area.
//
//\param din is input seismogram
//\param key is the metadata key used to find the arrival time to use as a reference.
//\param tw is a TimeWindow object that defines the window of data to extract around
// the desired arrival time.
**/
shared_ptr<TimeSeries> ArrivalTimeReference(TimeSeries& din,
string key, TimeWindow tw);
/*!
// Returns a gather of TimeSeries objects in an arrival time reference frame.
// An arrival time refernce means that the time is set to relative and
// zero is defined as an arrival time extracted from the metadata area of
// each member object.
//
//\exception SeisppError for errors in extracting required information from metadata area.
//
//\param din is input gather
//\param key is the metadata key used to find the arrival time to use as a reference.
//\param tw is a TimeWindow object that defines the window of data to extract around
// the desired arrival time.
**/
shared_ptr<TimeSeriesEnsemble> ArrivalTimeReference(TimeSeriesEnsemble& din,
string key, TimeWindow tw);
/*!
// Bombproof low level write routine for a vector of doubles.
// Uses fwrite to write vector x to the file dir+"/"+dfile.
//
//\exception SeisppError object if there are problems saving data to requested file.
//\param x vector of data to be saved.
//\param n length of vector x
//\param dir directory to place file. If empty assumes current directory.
//\param dfile file name
**/
long int vector_fwrite(double *x,int n, string dir, string dfile) throw(SeisppError);
/*!
// Bombproof low level write routine for a vector of doubles.
// Uses fwrite to write vector x to the file fname
//
//\exception SeisppError object if there are problems saving data to requested file.
//\param x vector of data to be saved.
//\param n length of vector x
//\param fname file name
**/
long int vector_fwrite(double *x,int n, string fname) throw(SeisppError);
/*!
// Bombproof low level write routine for a vector of floats.
// Uses fwrite to write vector x to the file dir+"/"+dfile.
//
//\exception SeisppError object if there are problems saving data to requested file.
//\param x vector of data to be saved.
//\param n length of vector x
//\param dir directory to place file. If empty assumes current directory.
//\param dfile file name
**/
long int vector_fwrite(float *x,int n, string dir, string dfile) throw(SeisppError);
/*!
// Bombproof low level write routine for a vector of floats.
// Uses fwrite to write vector x to the file fname
//
//\exception SeisppError object if there are problems saving data to requested file.
//\param x vector of data to be saved.
//\param n length of vector x
//\param fname file name
**/
long int vector_fwrite(float *x,int n, string fname) throw(SeisppError);
#ifndef NO_ANTELOPE
/*!
// Save the data in a TimeSeries object to a database.
// This function works only with an Antelope (Datascope) database but the
// design is aimed to be schema independent. That is, most raw
// earthquake seismology data is indexed with a table defined in css3.0
// called wfdisc. This function will work with a css3.0 wfdisc, but it
// will work with any other table as well provided you set up the
// interface correctly. This is done through the MetadataList object
// which tells the function what attributes are to be saved to the
// output database along with the time series data.
//
// A TimeSeries object contains a Metadata object it acquires by
// inheritance. The Metadata area is assumed to contain attributes
// listed in the MetadataList object passed to this function. The
// basic algorithm is that the list of metadata in mdl are processed in order.
// They are translated to the database namespace using the AttributeMap
// object am and pushed to an output record using the Datascope dbputv
// function one attribute at a time. The data are saved to files
// whose name and location are driven by two (frozen) standard names
// extracted from the metadata area: dir and dfile. The filename
// for output is created as dir+"/"+dfile or simply dfile if dir
// is not defined (assumes current directory).
//
// This function is dogmatic about four database output names.
// It always translates it's internal t0 to be a "time" database
// attribute, the ns variable is saved as "nsamp", the sample
// interval (dt) is always converted to 1/dt and called "samprate",
// and an endtime (computed as this->endtime()) is computed and
// saved as the database attribute "endtime". These are the css3.0
// name conventions and I chose to leave them as frozen names.
// Note also that if the "live" boolean in the object is set false
// this function silently returns immediately doing nothing.
//
//\exception SeisppError object if there are any problems saving the data or
// writing attributes into the database.
//
//\return -1 if live is false, record number of added row otherwise
//
//\param ts is the TimeSeries object to be saved.
//\param db is a Datascope database pointer. It need only point at a valid
// open database.
//\param table is the name of the table to index this time series data
// (e.g. "wfdisc").
//\param md is the list of metadata to be dumped to the database as described above.
//\param am is a mapping operator that defines how internal names are to be mapped
// to database attribute names and tables.
**/
long dbsave(TimeSeries& ts,Dbptr db,string table, MetadataList& md, AttributeMap& am)
throw(SeisppError);
/*!
// Save the data in a ThreeComponentSeismogram object to a database.
// This function works only with an Antelope (Datascope) database but the
// design is aimed to be schema independent. That is, most raw
// earthquake seismology data is indexed with a table defined in css3.0
// called wfdisc. This function will work with a css3.0 wfdisc, but it
// will work with any other table as well provided you set up the
// interface correctly. This is done through the MetadataList object
// which tells the function what attributes are to be saved to the
// output database along with the time series data.
//
// A ThreeComponentSeismogram object contains a Metadata object it acquires by
// inheritance. The Metadata area is assumed to contain attributes
// listed in the MetadataList object passed to this function. The
// basic algorithm is that the list of metadata in mdl are processed in order.
// They are translated to the database namespace using the AttributeMap
// object am and pushed to an output record using the Datascope dbputv
// function one attribute at a time. The data are saved to files
// whose name and location are driven by two (frozen) standard names
// extracted from the metadata area: dir and dfile. The filename
// for output is created as dir+"/"+dfile or simply dfile if dir
// is not defined (assumes current directory).
//
// This function is dogmatic about four database output names.
// It always translates it's internal t0 to be a "time" database
// attribute, the ns variable is saved as "nsamp", the sample
// interval (dt) is always converted to 1/dt and called "samprate",
// and an endtime (computed as this->endtime()) is computed and
// saved as the database attribute "endtime". These are the css3.0
// name conventions and I chose to leave them as frozen names.
// Note also that if the "live" boolean in the object is set false
// this function silently returns immediately doing nothing.
//
// This function differs in a significant way from an overloaded function
// with the same name. The other has a "chanmap" argument to tell the
// function how to split up the 3 components into channel codes. This
// function takes a very different approach and saves data by dumping
// the internal 3xns matrix as the basic output data series. As a result
// this function will write ONE AND ONLY ONE DATABASE ROW PER OBJECT.
// This means somewhat by definition that the output table CANNOT be
// wfdisc if this function is called. Consequently, this routine will
// throw an exception and do nothing if table!="wfprocess".
//
//\exception SeisppError object if there are any problems saving the data or
// writing attributes into the database.
//
//\return -1 if live is false, record number of added row otherwise
//
//\param ts is the TimeSeries object to be saved.
//\param db is a Datascope database pointer. It need only point at a valid
// open database.
//\param table is the name of the table to index this time series data
// (e.g. "wfdisc").
//\param md is the list of metadata to be dumped to the database as described above.
//\param am is a mapping operator that defines how internal names are to be mapped
// to database attribute names and tables.
**/
long dbsave(ThreeComponentSeismogram& ts,Dbptr db,string table,
MetadataList& md, AttributeMap& am);
/*! \brief Save the data in a ThreeComponentSeismogram object
to a database with orientation data.
This procedure is identical to the dbsave procedure with the
same argument signature. The difference is that the data are
save directly without an automatic reorientation to cardinal
directions used in that procedure. This procedure requires
an extension table called tmatrix to save the orientation data.
This procedure actually calls the plain dbsave routine in
a mode where the automatic reorientation is disabled.
Details described there apply here too.
\exception SeisppError object if there are any problems saving the data or
writing attributes into the database.
\return -1 if live is false, record number of added row otherwise
\param ts is the ThreeComponentSeismogram object to be saved.
\param db is a Datascope database pointer. It need only point at a valid
open database.
\param table is the name of the table to index this time series data
(e.g. "wfdisc").
\param md is the list of metadata to be dumped to the database as described above.
\param am is a mapping operator that defines how internal names are to be mapped
to database attribute names and tables.
\param chanmap is a set of channel names to map each component to channel code (see above)
**/
long dbsave_oriented(ThreeComponentSeismogram& ts,Dbptr db,
string table, MetadataList& md,
AttributeMap& am);
/*!
// Save the data in a ThreeComponentSeismogram object to a database.
// This function works only with an Antelope (Datascope) database but the
// design is aimed to be schema independent. That is, most raw
// earthquake seismology data is indexed with a table defined in css3.0
// called wfdisc. This function will work with a css3.0 wfdisc, but it
// will work with any other table as well provided you set up the
// interface correctly. This is done through the MetadataList object
// which tells the function what attributes are to be saved to the
// output database along with the time series data.
//
// A ThreeComponentSeismogram object contains a Metadata object it acquires by
// inheritance. The Metadata area is assumed to contain attributes
// listed in the MetadataList object passed to this function. The
// basic algorithm is that the list of metadata in mdl are processed in order.
// They are translated to the database namespace using the AttributeMap
// object am and pushed to an output record using the Datascope dbputv
// function one attribute at a time. The data are saved to files
// whose name and location are driven by two (frozen) standard names
// extracted from the metadata area: dir and dfile. The filename
// for output is created as dir+"/"+dfile or simply dfile if dir
// is not defined (assumes current directory).
//
// This function is dogmatic about four database output names.
// It always translates it's internal t0 to be a "time" database
// attribute, the ns variable is saved as "nsamp", the sample
// interval (dt) is always converted to 1/dt and called "samprate",
// and an endtime (computed as this->endtime()) is computed and
// saved as the database attribute "endtime". These are the css3.0
// name conventions and I chose to leave them as frozen names.
// Note also that if the "live" boolean in the object is set false
// this function silently returns immediately doing nothing.
//
// The chanmap and output_to_standard variables control how the
// data are saved externally. If output_as_standard is set true
// (highly recommended in general) the data are restored (if necessary)
// to standard 3c data geometry (ew,ns,z) before being written to
// output. In that case vang and hang are set accordingly in
// case the output algorithm requires these to be stored.
// The components are then extraced from the 3c object one by
// one and written in three successive database rows with the
// channel code ("chan" attribute in css3.0) derived from the
// chanmap array (chanmap[0]=channel name for component 0,
// chanmap[1]=component 1, and chanmap[2]=component 2).
//
//\exception SeisppError object if there are any problems saving the data or
// writing attributes into the database.
//
//\return -1 if live is false, record number of added row otherwise
//
//\param ts is the TimeSeries object to be saved.
//\param db is a Datascope database pointer. It need only point at a valid
// open database.
//\param table is the name of the table to index this time series data
// (e.g. "wfdisc").
// \param md is the list of metadata to be dumped to the database as described above.
// \param am is a mapping operator that defines how internal names are to be mapped
// to database attribute names and tables.
//\param chanmap is a set of channel names to map each component to channel code (see above)
//\param output_as_standard when true forces data to be converted to ew,ns, z system
**/
long dbsave(ThreeComponentSeismogram& ts,Dbptr db,
string table, MetadataList& md,
AttributeMap& am, vector<string>chanmap,bool output_as_standard);
/*!
// Save the data in a ComplexTimeSeries object to a database.
// This function works only with an Antelope (Datascope) database but the
// design is aimed to be schema and database independdent.
// It does this by assuming each object will generate one row in
// some table. What is written to the row that is associated with
// this object is assumed to be present in the Metadata area of the
// object. The attributes to be written are controlled by the
// contents of the MetadataList passed as an argument.
// The internal names in the MetadataList are translated
// translated to the database namespace using the AttributeMap
// object am and pushed to an output record using the Datascope dbputv
// function one attribute at a time. The data are saved to files
// whose name and location are driven by two (frozen) standard names
// extracted from the metadata area: dir and dfile. The filename
// for output is created as dir+"/"+dfile or simply dfile if dir
// is not defined (assumes current directory).
//
// This function is dogmatic about four database output names.
// It always translates it's internal t0 to be a "time" database
// attribute, the ns variable is saved as "nsamp", the sample
// interval (dt) is always converted to 1/dt and called "samprate",
// and an endtime (computed as this->endtime()) is computed and
// saved as the database attribute "endtime". These are the css3.0
// name conventions and I chose to leave them as frozen names.
// The current implemenation ALWAYS saves the result as a
// host-specific (i.e. not portable across platform)
// vector of double complex values (real,imag). i.e. real and
// imaginary parts are multiplexed and stored externally as
// doubles. This will NOT work if data like this are passed
// between different hosts with incompatible binary double
// formats (infamous endian problem).
// The "datatype" is ALWAYS saved and is ALWAYS set to cx.
// Finally note that if the "live" boolean in the object is set false
// this function silently returns immediately doing nothing.
//
//\exception SeisppError object if there are any problems saving the data or
// writing attributes into the database.
//
//\return -1 if live is false, record number of added row otherwise
//
//\param ts is the ComplexTimeSeries object to be saved.
//\param db is a Datascope database pointer. It need only point at a valid
// open database.
//\param table is the name of the table to index this time series data
// (generally wfprocess for this procedure)
//\param md is the list of metadata to be dumped to the database as described above.
//\param am is a mapping operator that defines how internal names are to be mapped
// to database attribute names and tables.
**/
/*
long dbsave(ComplexTimeSeries& ts,Dbptr db,
string table, MetadataList& md,
AttributeMap& am);
*/
#endif
/*!
// Extracts a requested time window of data from a parent TimeSeries object.
//
// It is common to need to extract a smaller segment of data from a larger
// time window of data. This function accomplishes this in a nifty method that
// takes advantage of the methods contained in the BasicTimeSeries object for
// handling time and data gaps.
//
//\return new TimeSeries object derived from parent but windowed by input
// time window range.
//
//\exception SeisppError object if the requested time window does not overlap data
//
//\param parent is the larger TimeSeries object to be windowed
//\param tw defines the data range to be extracted from parent.
//\author Gary L. Pavlis
**/
TimeSeries WindowData(const TimeSeries& parent, const TimeWindow& tw);
/*!
// Extracts a requested time window of data from a parent ThreeComponentSeismogram object.
//
// It is common to need to extract a smaller segment of data from a larger
// time window of data. This function accomplishes this in a nifty method that
// takes advantage of the methods contained in the BasicTimeSeries object for
// handling time and data gaps.
//
//\return new ThreeComponentSeismogram object derived from parent but windowed by input
// time window range.
//
//\exception SeisppError object if the requested time window does not overlap data
//
//\param parent is the larger ThreeComponentSeismogram object to be windowed
//\param tw defines the data range to be extracted from parent.
//\author Gary L. Pavlis
**/
ThreeComponentSeismogram WindowData(const ThreeComponentSeismogram& parent, const TimeWindow& tw);
/*! Extract a specified time window from an ensemble.
// The seispp library defines a fairly generic ensemble object that
// uses an STL vector container to hold an array of objects
// (currently TimeSeries or ThreeComponentSeismogram objects) with the
// generic symbol "member". This template applies a comparable
// WindowData function to each member of the ensemble returning a
// new ensemble cut to the specified window.
//
//\exception SeisppError exception if TimeWindow is not consistent
// with input data.
//
//\param parent input ensemble
//\param tw TimeWindow to cut parent to produce output.
//
//\return new ensemble T as an shared_ptr cut to desired window.
**/
//template <class T> shared_ptr<T>WindowData(T& parent, TimeWindow& tw);
/*!
// Sorts an ensemble by station:channel.
// In earthquake seismic data processing sorting data by station name
// and channel code is a very common operation. This procedure implements
// this using the STL sort algorithm. It depends upon the metadata
// fields keyed by "sta" and "chan" being defined in each member of the
// input ensemble.
//
//\param ensemble is the input data to be sorted. The STL algorithm
// sorts this in place so the result is altered. Any indices using
// subscripts will no longer be valid on exit.
**/
void StaChanSort(TimeSeriesEnsemble& ensemble);
/*! \brief Builds a general station:channel subset ensemble.
Builds a new ensemble of members that satisfy unix regular expression
for sta and chan attributes passed as sta_expr and chan_expr.
\param parent original ensemble to be subsetted
\param sta_expr unix regular expression to apply to sta Metadata
attribute
\param chan_expr unix regular expression to apply to chan Metadata
attribute
\author Gary L. Pavlis
**/
shared_ptr<TimeSeriesEnsemble> StaChanRegExSubset(TimeSeriesEnsemble& parent,
string sta_expr, string chan_expr);
#ifndef NO_ANTELOPE
/*!
\brief Return a subset of an ensemble that match a specified array.
It is sometimes useful to reduce an ensemble of data to only those
matching a particular receiver geometry. This is done here by comparing
station names in the ensemble with those found in a pattern SeismicArray
object. Algorithm is a selective copy from parent to output.
The Metadata for the output ensemble will be a duplicate of the parent.
Note the algorithm used is linear in the ensemble. That is the station
name is extracted for each data member and compared to the contents of
the SeismicArray object. Members not in the array are ignored and those
that match are copied to the output.
\param parent is the input data ensemble.
\param array contains the stations defining the array that will be used
to form the output ensemble.
\return shared_ptr<TimeSeriesEnsemble> containing data subset.
Note be warned that the function may return an empty
ensemble if the parent does not have the sta attribute defined.
It will not be silent about this, however, as it will blast
numerous messages to stderr if this happens.
**/
shared_ptr<TimeSeriesEnsemble> ArraySubset(TimeSeriesEnsemble& parent,
SeismicArray& array);
#endif
/*! Sparse convolution routine.
Sometimes a time series is made up initially of only a relatively
small number of impulses. A case in point is some simple synthetic
In that case, standard convolution methods are unnecessarily slow.
This specialized function can sometimes be useful in such a context.
\param wavelet is assumed to be the nonsparse wavelet that will
be replicated with appropriate lags for each impulse in d
\param d is the sparse ThreeComponentSeismogram object that to which
the wavelet function is to be convolved. The contents of this
object are assumed to be mostly zeros or the algorithm is not
very efficient. It will work for data that is not sparse, but it will
be slow compared to convolution by Fourier transforms.
\return ThreeComponentSeismogram object that is the convolution of
wavelet with d. Result will have more samples than d by 2 times
the length of wavelet
*/
ThreeComponentSeismogram sparse_convolve(TimeSeries& wavelet,
ThreeComponentSeismogram& d);
/*! Generic routine to compute a median.
// This template can be used to compute the median of a vector
// of objects for any class which has the default comparison
// operator needed by STL sort. It is most likely to be used
// for standard numerical types (int, float, double) where it
// is guaranteed to work. If T is more exotic, you need to understand
// the rules of what sort expects.
//
//\param x - input STL vector of data to be compute median.
// x is not altered. We make a copy of this input and sort it.
// Not the best algorithm if the sorted output is desired
**/
template <class T> T median(vector<T>& x)
{
int count=x.size();
if(count<=1)return(x[0]);
int medposition=count/2;
T result;
vector<T> copyx(x);
sort(copyx.begin(),copyx.end());
if(count%2)
result=copyx[medposition];
else
result=(copyx[medposition]+copyx[medposition-1])/2.0;
return (result);
}
/*!
// Aligns an ensemble of data by moveout.
//
// A common theme in multichannel processing is alignment of data
// by a static shift. That is, the entire trace is shifted by a fixed
// time amount. This generic method does this for ensembles with a
// vector of objects held in a variable called "member". It uses
// a special keyword to extract a "moveout" value from the data objects
// metadata and applies this to forever shift the 0 time reference for
// that data object. For this reason it always returns a copy of the
// original data.
//
//\param d - input data ensemble.
//
//\return copy of ensemble but with t0 values modified by moveout.
**/
template <class Tensemble> Tensemble MoveoutTimeShift(Tensemble& d)
{
Tensemble dshift(d);
try {
for(int i=0;i<d.member.size();++i)
{
double tshift;
if(d.member[i].live)
{
tshift=d.member[i].get_double(moveout_keyword);
dshift.member[i].t0-=tshift;
}
}
} catch (MetadataGetError mde)
{
throw SeisppError(string("MoveoutTimeShift: moveout keyword")
+ moveout_keyword
+string(" not defined for one or members of input ensemble") );
}
return (dshift);
}
/*!
\brief Align an ensemble by a set of lag estimates.
We often want to shift the time base for a set of data in relative
time coordinates. An example is application of statics of any kind.
Another is display of aligned traces after cross-correlation.
This function handles this for any of the family of time series
ensemble objects. It requires the input be in a relative time
reference frame to allow the application of the BasicTimeSeries
methods to deal with data gaps. The basic algorithm is to
get the original t0 time stamp (could be anything really, but
the trefkeyword Metadata field must be set or an error will
follow), restore the data to an absolute time frame, shift
the original t0 shift value by lag extracted from the object
with the lagkey field, and then return the data to relative
time scale using the modified t0. This algorithm retains the
integrity of the original absolute time stamp so the data are
altered in place. This is in contrast to a similar template
function MoveoutTimeShift which is destructive.
On the flip side, the attribute defined by trefkeyword is incremented
by the extracted lag value. This keeps this key attribute with the
0 time reference. This is a design choice which causes the trefkeyword
value to be retained as a true time reference.
\param d input data ensemble of generic time series objects.
\param lagkey keyword used to extract the lag values from the
Metadata (generalized header) field of the ensemble members.
\param trefkeyword keyword used to extract the absolute time 0 stamp
for each member of the ensemble. This field is not altered
in the Metadata but is required to redefine t0 with an
applied lag value.
*/
template <class Tensemble> void LagShift(Tensemble& d,
const string lagkey,
const string trefkeyword)
{
string error1("LagShift: Input ensemble contains data with UTC time. Must be relative.");
string error2("LagShift: Metadata error. See previous error message.");
try {
for(int i=0;i<d.member.size();++i)
{
double tshift,lag;
if(d.member[i].live)
{
if(d.member[i].tref==absolute)
throw SeisppError(error1);
tshift=d.member[i].get_double(trefkeyword);
lag=d.member[i].get_double(lagkey);
// We do nothing to traces with moveout
// marked as bad by this test
if(lag<MoveoutBadTest)
{
d.member[i].rtoa(tshift);
tshift+=lag;
d.member[i].ator(tshift);
d.member[i].put(trefkeyword,tshift);
}
}
}
} catch (MetadataGetError mde)
{
mde.log_error();
throw SeisppError(error2);
}
}
template <class Tensemble> Tensemble remove_dead(Tensemble& d)
{
Tensemble dedit(dynamic_cast<Metadata&>(d),1);
int nd=d.member.size();
int i;
for(i=0;i<nd;++i)
{
if(d.member[i].live)
dedit.member.push_back(d.member[i]);
}
return dedit;
}
/*! \brief Test a generic time series object for sample rate match with standard.
With real data there is often an issue about the actual sample rate of data
versus the nominal sample rate. e.g. in the resample procedures in the SEISPP
library it is necessary to ask this question as a trigger to know if data need
to be resample or not. The question is not just common, but prone to variations
because what is considered good enough is context dependent. This template
regularizes this test for any time series object (child of BasicTimeSeries).
A default is used to allow for a fairly common standard so most applications
can drop the third argument for this litle procedure.
The actual test is a simple fractional difference formula like percentage
error but not converted to percent (e.g. 10% here is 0.1).
\param seis generic time series whose sample interval is to be tested against standard.
\param target_dt standard sample interval for test
\param tolerance relative error tolerance (default 0.001)
*/
template <class T> bool SampleIntervalsMatch(T& seis, double target_dt,
double tolerance=0.001)
{
double normalized_error=fabs( (seis.dt-target_dt)/target_dt);
if(normalized_error<tolerance)
return true;
else
return false;
}
/*!
// Convert a velocity model in flattened earth geometry to true geometry.
//
// Multiple programs exist in seismology that use a flattening transformation
// to convert spherical geometry into a regular grid. The main reason
// for this in all examples I know of is to allow standard finite difference
// algorithms to used. This is essential since standard finite differences
// demand regular grid geometries and the flattening transformation provides
// a convenient way to turn a spherical shell problem into a standard
// finite different grid. A GCLgrid3d object is aimed at getting the
// true geometry correct, however, so using velocity models defined on
// a flattened coordinate system requires a conversion. This function
// does this for a complete grid of points. This algorithm assumes
// a 3D model has been loaded into a GCLgrid3d object, BUT the coordinates
// and velocities stored in the grid have not been corrected by the
// inverse flattening transformation. That is, the assumption is that
// the original model was defined in on flattened coordinate system but
// the points were converted to lat,lon, and (flattened) depth in building
// the input GCLscalarfield3d object. The algorithm used here then just
// passes through the grid doing two things: (1) the depth() method is
// called for the parent grid and the uflatz (see gclgrid.h) function is
// called to convert this to true depth; and (2) the velocity value at each
// point is altered by in inverse flattening transformation. Thus the
// net effect is a depth dependent change in velocity values and a nonlinear
// distortion of the depth of each point in the grid.
//
//\param vmodel is the parent grid. It is altered in place to convert
// flattened to true geometry as described above.
//
//\author Gary L. Pavlis
**/
void ConvertFlatModelToSpherical(GCLscalarfield3d& vmodel);
// for linux only
int nint(double);
/*! \brief Test for little endian condition.
To handle mixed processors it is essential to know if the
word structure of this machine you are on is little or big
endian. Intel processors are dominate today and are little
endian while Sun machines, which are commonly used in geophysics,
are big endian. Because it is common today to mix these platforms
on the same network a way to detect which byte order the current
machine is, is necessary.
\return true if this processor is little endian (Intel byte order).
Conversely returns false if the processor is big endian.
\author Gary L. Pavlis with the core algorithm stolen from the
University of Texas supercomputer web site.
*/
bool IntelByteOrder();
/*! \brief Architecture indedependent procedure
to byte swap a vector of doubles.
In the seispp library most data are stored internally as doubles.
External data representations, however, are subject to byte order
issues. This routine will take a vector of doubles and automatically
swap bytes using a method appropriate for the parent architecture.
It should always be preceded by logic to decide if byte swapping
is necessary as this will always swap bytes one way or the other.
\param x pointer to array of doubles to be byte swapped.
\param nx number of elements in x. This is quietly assumed
to be correct and not bounds checking is done by this procedure.
*/
void swapdvec(double *x,int nx);
}
#endif
| 44.581342 | 98 | 0.756986 | [
"geometry",
"object",
"vector",
"model",
"3d"
] |
02651617a1fea6594b3a47e62dd6273598d5b957 | 4,590 | h | C | include/expansion_table.h | briancairl/mmpl | 0e5ca9297944ccbda9e8f995918b60a358a6e0dc | [
"MIT"
] | null | null | null | include/expansion_table.h | briancairl/mmpl | 0e5ca9297944ccbda9e8f995918b60a358a6e0dc | [
"MIT"
] | null | null | null | include/expansion_table.h | briancairl/mmpl | 0e5ca9297944ccbda9e8f995918b60a358a6e0dc | [
"MIT"
] | null | null | null | #ifndef MMPL_EXPANSION_TABLE_H
#define MMPL_EXPANSION_TABLE_H
// MMPL
#include <mmpl/crtp.h>
#include <mmpl/state.h>
#include <mmpl/support.h>
#include <mmpl/value.h>
namespace mmpl
{
template <typename ExpansionTableT> struct ExpansionTableTraits;
template <typename ExpansionTableT>
using expansion_table_state_t = typename ExpansionTableTraits<ExpansionTableT>::StateType;
template <typename ExpansionTableT>
using expansion_table_value_t = typename ExpansionTableTraits<ExpansionTableT>::ValueType;
/**
* @brief Defines and interface for an object used to query state expansion
*/
template <typename DerivedT> struct ExpansionTableBase
{
public:
/// Planning state type
using StateType = expansion_table_state_t<DerivedT>;
/// Planning metric value type
using ValueType = expansion_table_value_t<DerivedT>;
/**
* @brief Resets internal state of table
*/
inline void reset() { this->derived()->reset_impl(); }
/**
* @brief Sets next expanded state
*
* @param parent parent state
* @param child parent state
* @param total_value total value associated with \p child
*
* @retval true if <code>child</code> state was expanded
* @retval false otherwise
*/
inline bool expand(const StateType& parent, const StateType& child, const ValueType& total_value)
{
return this->derived()->expand_impl(parent, child, total_value);
}
/**
* @brief Check if state has been previously expanded
*
* @param query query state
*
* @retval true if <code>query</code> state has been expanded
* @retval false otherwise
*/
inline bool is_expanded(const StateType& query) const { return this->derived()->is_expanded_impl(query); }
/**
* @brief Returns predecessor state for a given <code>query</code> state
*
* @param query query state
*
* @return returns a predecessor state of <code>query</code>
*/
inline StateType get_parent(const StateType& query) const
{
MMPL_RUNTIME_ASSERT(is_expanded(query));
return this->derived()->get_parent_impl(query);
}
/**
* @brief Returns accumulated metric value <code>query</code> state
*
* @param query query state
*
* @return returns total value accumulated up to <code>query</code>
*
* @warn Expects the following precondition to be satisfied: <code>is_expanded(query) == true</code>
*/
inline ValueType get_total_value(const StateType& query) const
{
MMPL_RUNTIME_ASSERT(is_expanded(query));
return this->derived()->get_total_value_impl(query);
}
/**
* @brief Returns accumulated metric value <code>query</code> state
*
* @param query query state
*
* @return returns total value accumulated up to <code>query</code>
* @note Returns max cost value if state is not expanded
*/
inline ValueType try_get_total_value(const StateType& query) const
{
return is_expanded(query) ? this->derived()->get_total_value_impl(query) : Invalid<ValueType>::value;
}
private:
static_assert(is_value<ValueType>(), MMPL_STATIC_ASSERT_MSG("ValueType must be a valid metric value type"));
IMPLEMENT_CRTP_BASE_CLASS(ExpansionTableBase, DerivedT);
};
template <typename OutputIteratorT, typename ExpansionTableT>
OutputIteratorT generate_reverse_path(
OutputIteratorT output,
expansion_table_state_t<ExpansionTableT> terminal,
const ExpansionTableBase<ExpansionTableT>& expansion_table)
{
using ValueType = expansion_table_value_t<ExpansionTableT>;
*(++output) = terminal;
while (expansion_table.get_total_value(terminal) != Null<ValueType>::value)
{
terminal = expansion_table.get_parent(terminal);
*(++output) = terminal;
}
return output;
}
template <typename OutputIteratorT, typename LastOutputIteratorT, typename ExpansionTableT>
OutputIteratorT generate_reverse_path(
OutputIteratorT output,
LastOutputIteratorT last,
expansion_table_state_t<ExpansionTableT> terminal,
const ExpansionTableBase<ExpansionTableT>& expansion_table)
{
using ValueType = expansion_table_value_t<ExpansionTableT>;
if (output == last)
{
return output;
}
else
{
*(++output) = terminal;
}
while (output != last and expansion_table.get_total_value(terminal) != Null<ValueType>::value)
{
terminal = expansion_table.get_parent(terminal);
*(++output) = terminal;
}
return output;
}
template <typename ExpansionTableT>
struct is_expansion_table
: std::integral_constant<bool, std::is_base_of<ExpansionTableBase<ExpansionTableT>, ExpansionTableT>::value>
{};
} // namespace mmpl
#endif // MMPL_EXPANSION_TABLE_H
| 27.48503 | 112 | 0.730283 | [
"object"
] |
9d1939084717a9874f33635d910eb6c793b52dea | 1,252 | h | C | map.h | Sandalmoth/moran-automaton | a65a1caef64c6c566a98670c65529bc7cfb4b2bc | [
"MIT"
] | null | null | null | map.h | Sandalmoth/moran-automaton | a65a1caef64c6c566a98670c65529bc7cfb4b2bc | [
"MIT"
] | null | null | null | map.h | Sandalmoth/moran-automaton | a65a1caef64c6c566a98670c65529bc7cfb4b2bc | [
"MIT"
] | null | null | null | #ifndef __MAP_H__
#define __MAP_H__
#include <random>
#include <vector>
#include <cassert>
#include <iostream>
#include "cell.h"
const size_t MAX_WIDTH = 512;
const size_t MAX_HEIGHT = 512;
// template <size_t N>
// using Vector = Matrix<N, 1>;
using Stategrid = std::vector<std::vector<std::vector<size_t> > >;
class Map {
public:
Map(size_t x, size_t y, std::vector<double> fitness, double mixing_probability)
: x_dim(x)
, y_dim(y)
, fitness(fitness)
, mixing_probability(mixing_probability) {
assert(x <= MAX_WIDTH && x > 0);
assert(y <= MAX_HEIGHT && y > 0);
for (size_t i = 0; i < x*y; ++i) {
map.emplace_back(Cell(pop_per_cell, 3, fitness, mutations, rng));
}
std::random_device device;
rng.seed(device());
// std::cout << "\tmixing probability: " << mixing_probability << std::endl;
// std::cout << "\tfitness: " << fitness[0] << ' ' << fitness[1] << ' ' << fitness[2] << std::endl;
}
Stategrid get_state();
void next();
private:
size_t x_dim;
size_t y_dim;
std::vector<Cell> map;
std::mt19937 rng;
std::vector<double> fitness;
std::vector<std::vector<double>> mutations{{200, 10, 10}, {10, 200, 10}, {10, 10, 200}};
size_t pop_per_cell = 3*4*10;
double mixing_probability;
};
#endif | 19.873016 | 101 | 0.646166 | [
"vector"
] |
9d1c69c540abf80d0101e53493326f9f5f281af4 | 3,558 | h | C | Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainPartitionImageWithKdTree.h | arobert01/ITK | 230d319fdeaa3877273fab5d409dd6c11f0a6874 | [
"Apache-2.0"
] | 1 | 2021-08-19T14:33:55.000Z | 2021-08-19T14:33:55.000Z | Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainPartitionImageWithKdTree.h | arobert01/ITK | 230d319fdeaa3877273fab5d409dd6c11f0a6874 | [
"Apache-2.0"
] | null | null | null | Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainPartitionImageWithKdTree.h | arobert01/ITK | 230d319fdeaa3877273fab5d409dd6c11f0a6874 | [
"Apache-2.0"
] | 1 | 2022-02-16T08:20:20.000Z | 2022-02-16T08:20:20.000Z | /*=========================================================================
*
* Copyright NumFOCUS
*
* 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.txt
*
* 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 itkLevelSetDomainPartitionImageWithKdTree_h
#define itkLevelSetDomainPartitionImageWithKdTree_h
#include "itkLevelSetDomainPartitionImage.h"
#include "itkListSample.h"
#include "itkKdTreeGenerator.h"
namespace itk
{
/**
*\class LevelSetDomainPartitionImageWithKdTree
*
* \brief Helper class used to share data in the ScalarChanAndVeseLevelSetFunction.
* \ingroup ITKLevelSetsv4
*/
template <typename TImage>
class ITK_TEMPLATE_EXPORT LevelSetDomainPartitionImageWithKdTree : public LevelSetDomainPartitionImage<TImage>
{
public:
ITK_DISALLOW_COPY_AND_MOVE(LevelSetDomainPartitionImageWithKdTree);
using Self = LevelSetDomainPartitionImageWithKdTree;
using Superclass = LevelSetDomainPartitionImage<TImage>;
using Pointer = SmartPointer<Self>;
using ConstPointer = SmartPointer<const Self>;
static constexpr unsigned int ImageDimension = Superclass::ImageDimension;
/** Method for creation through the object factory. */
itkNewMacro(Self);
itkTypeMacro(LevelSetDomainPartitionImageWithKdTree, LevelSetDomainPartitionImage);
using ImageType = TImage;
using ListIndexType = typename Superclass::ListIndexType;
using ListRegionType = typename Superclass::ListRegionType;
using ListPointType = typename Superclass::ListPointType;
using ListIteratorType = typename Superclass::ListIteratorType;
using IdentifierListType = typename Superclass::IdentifierListType;
using CentroidVectorType = typename ListPointType::VectorType;
using SampleType = typename Statistics::ListSample<CentroidVectorType>;
using TreeGeneratorType = typename Statistics::KdTreeGenerator<SampleType>;
using TreePointer = typename TreeGeneratorType::Pointer;
using TreeType = typename TreeGeneratorType::KdTreeType;
using KdTreePointer = typename TreeType::Pointer;
/** Initialize with a precomputed kd-tree */
itkSetObjectMacro(KdTree, TreeType);
/** Number of neighbors level sets connected to this level set. */
using NeighborsIdType = unsigned int;
/** Get/Set number of neighbors in the kd-tree leaf node */
itkSetMacro(NumberOfNeighbors, NeighborsIdType);
itkGetMacro(NumberOfNeighbors, NeighborsIdType);
/** Populate a list image with each pixel being a list of overlapping
* level set support at that pixel */
void
PopulateListDomain() override;
protected:
LevelSetDomainPartitionImageWithKdTree();
~LevelSetDomainPartitionImageWithKdTree() override = default;
/** Populate a list image with each pixel being a list of overlapping
* level set support at that pixel */
void
PopulateDomainWithKdTree();
private:
KdTreePointer m_KdTree;
NeighborsIdType m_NumberOfNeighbors{ 10 };
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
# include "itkLevelSetDomainPartitionImageWithKdTree.hxx"
#endif
#endif
| 34.882353 | 110 | 0.752389 | [
"object"
] |
9d23ddca3198e47c41b6edf057330b5596a78a2f | 332 | h | C | OpenGL/src/Shape.h | Zaangetsuu/OpenGL | 9f01092bdee14aff7e8716728e40021dd6772851 | [
"MIT"
] | null | null | null | OpenGL/src/Shape.h | Zaangetsuu/OpenGL | 9f01092bdee14aff7e8716728e40021dd6772851 | [
"MIT"
] | null | null | null | OpenGL/src/Shape.h | Zaangetsuu/OpenGL | 9f01092bdee14aff7e8716728e40021dd6772851 | [
"MIT"
] | null | null | null | #pragma once
#include "VertexArray.h"
#include "IndexBuffer.h"
class Shape
{
friend class Renderer;
private:
VertexArray m_VAO;
VertexBuffer m_VBO;
IndexBuffer m_IBO;
public:
Shape(float* vertices, unsigned int verticesSize, const VertexBufferLayout& layout, unsigned int* indices, unsigned int indicesNb);
~Shape();
};
| 17.473684 | 132 | 0.759036 | [
"shape"
] |
9d296ef60cd6739bd040e25d353c3203653f8b5a | 33,897 | h | C | include/tom/LinearAlgebra.h | m7thon/tom | fde3e934083c8c91256350b00e4128e48b351a8c | [
"MIT"
] | 7 | 2017-10-04T05:41:46.000Z | 2021-07-18T01:31:36.000Z | include/tom/LinearAlgebra.h | m7thon/tom | fde3e934083c8c91256350b00e4128e48b351a8c | [
"MIT"
] | 1 | 2021-05-16T16:16:55.000Z | 2021-05-20T09:21:30.000Z | include/tom/LinearAlgebra.h | m7thon/tom | fde3e934083c8c91256350b00e4128e48b351a8c | [
"MIT"
] | 1 | 2017-10-04T05:41:59.000Z | 2017-10-04T05:41:59.000Z | namespace tom {
/** Devide the given `matrix` by its element-sum, i.e., normalize the matrix to have an element-sum of one, and return the element-sum.
*/
template<typename T>
double normalize(const DenseBase<T> &matrix) {
double mat_sum = matrix.sum();
const_cast< DenseBase<T> & >(matrix) /= mat_sum;
return mat_sum;
}
SWIGCODE(%template(normalize) normalize<MatrixMd>;)
/** Devide each column of the given `matrix` by its sum, i.e., normalize the columns to have column-sum one. Return `true` if successful, or `false` if a column could not be normalized due to a zero column-sum.
*/
template<typename T>
bool normalizeCols(const DenseBase<T> &matrix) {
double col_sum;
bool success = true;
for (int j = 0; j < matrix.cols(); ++j) {
col_sum = matrix.col(j).sum();
if (col_sum == 0) { success = false; }
const_cast< DenseBase<T> & >(matrix).col(j) /= col_sum;
}
return success;
}
SWIGCODE(%template(normalizeCols) normalizeCols<MatrixMd>;)
/** Devide each row of the given `matrix` by its sum, i.e., normalize the rows to have row-sum one. Return `true` if successful, or `false` if a row could not be normalized due to a zero row-sum.
*/
template<typename T>
bool normalizeRows(const DenseBase<T> &matrix) {
double row_sum;
bool success = true;
for (int i = 0; i < matrix.rows(); ++i) {
row_sum = matrix.row(i).sum();
if (row_sum == 0) { success = false; }
const_cast< DenseBase<T> & >(matrix).row(i) /= row_sum;
}
return success;
}
SWIGCODE(%template(normalizeRows) normalizeRows<MatrixMd>;)
/**
* Return the Kronecker-product \f$A\otimes B\f$ of the matrices `A` and `B`. */
template< typename D1, typename D2 >
MatrixXd kron(const MatrixBase<D1>& A, const MatrixBase<D2>& B) {
MatrixXd result(A.rows() * B.rows(), A.cols() * B.cols());
for (long j = 0; j < A.cols(); ++j) {
for (long i = 0; i < A.rows(); ++i) {
result.block(i * B.rows(), j * B.cols(), B.rows(), B.cols()) = A(i,j) * B;
}
}
return result;
}
SWIGCODE(%template(kron) kron<MatrixMd, MatrixMd>;)
SWIGCODE(%kwargs;)
/** Return the column-wise generalized mean with exponent `p` (default 1) of the given `matrix`. For `p` = 1, 0, -1 this is the arithmetic, geometric and harmonic mean, respectively.
*
* Note that for values of `p` other than {1, 2k} this requires all matrix entries to be positive.
*/
template<typename T>
RowVectorXd colwiseMean(const MatrixBase <T> &matrix, double p = 1.0) {
RowVectorXd result(matrix.cols());
if (p == std::numeric_limits<double>::infinity()) { result = matrix.array().colwise().maxCoeff(); }
else if (p == - std::numeric_limits<double>::infinity()) { result = matrix.array().colwise().minCoeff(); }
else if (p == 0) { // geometric mean
result = matrix.array().abs().log().colwise().sum() / matrix.rows();
result = result.array().exp();
} else if (p == 1) { // arithmetic mean
result = matrix.array().colwise().sum() / matrix.rows();
} else {
result = matrix.array().pow(p).colwise().sum() / matrix.rows();
result = result.array().pow(1.0 / p);
}
return result;
}
SWIGCODE(%template(colwiseMean) colwiseMean<MatrixMd>;)
/** Return the row-wise generalized mean with exponent `p` (default 1) of the given `matrix`. For `p` = 1, 0, -1 this is the arithmetic, geometric and harmonic mean, respectively.
*
* Note that for values of `p` other than {1, 2k} this requires all matrix entries to be positive.
*/
template<typename T>
VectorXd rowwiseMean(const MatrixBase <T> &matrix, double p = 1.0) { return colwiseMean(matrix.transpose(), p).transpose(); }
SWIGCODE(%template(rowwiseMean) rowwiseMean<MatrixMd>;)
/** Return the weighted norm of `M` with weights given in `W`, or the squared weighted norm if `squared` is set to `true`.
* Depending on the size of `W`, the given weights are interpreted in different ways, assuming `M` is of size m x n:
*
* - if `W` is of size zero, then no weights are used and the Frobenius norm |M|_F is computed
* - if `W` is of size m+n x 1, then row and column weights [w_r; w_c] = W are assumed and |M|_D(w_r w_c^T) is computed
* - if `W` is of size m x n, then element-wise weights are assumed and |M|_D(W) is computed
* - if `W` is of size m x mn, then a block-diagonal weight matrix is assumed and |M|_D(W1,...,Wn) is computed
* - if `W` is of size mn x mn, then a full weight matrix is assumed and |M|_W is computed
*/
template<typename T, typename T1>
double weightedNorm(const MatrixBase<T> &M, const MatrixBase<T1> &W, bool squared = false) throw(std::invalid_argument) {
double result = 0;
if (W.size() == 0) { result = M.squaredNorm(); }
else if (W.cols() == 1 and W.rows() == M.rows() + M.cols()) {
result = (W.col(0).head(M.rows()).asDiagonal() * M * W.col(0).tail(M.cols()).asDiagonal()).squaredNorm();
} else if (W.rows() == M.rows()) {
if (W.cols() == M.cols()) { result = (W.array() * M.array().square()).sum(); }
else if (W.cols() == M.cols() * W.rows()) {
for (long j = 0; j < M.cols(); ++j) {
result += M.col(j).transpose() * W.middleCols(j * W.rows(), W.rows()) * M.col(j);
}
} else { throw std::invalid_argument("size mismatch for W and M"); }
} else if (W.cols() == M.size() and W.rows() == M.size()) {
MatrixXd Mcopy = M;
Map<VectorXd, 1> vecM(Mcopy.data(), Mcopy.size());
result = vecM.transpose() * W * vecM;
} else { throw std::invalid_argument("size mismatch for W and M"); }
result /= M.size();
return squared ? result : std::sqrt(result);
}
SWIGCODE(%template(weightedNorm) weightedNorm<MatrixMd, MatrixMd>;)
SWIGCODE(%apply const MatrixBase<MatrixXd>& OUTPUT { const MatrixBase<MatrixXd>& X };)
//<editor-fold desc="Solve implementations">
/**
* Return
* \ifnot PY
* in the output-argument `X`
* \endif
* the ordinary least-squares (OLS) solution to the problem `A` * `X` = `M` (or if `transposed` to `X` * `A` = `M`) using a `method` from {"Cholesky", "LDLT", "QR" (default), "SVD", "JacobiSVD"}.
*
* The "Cholesky" method solves the normal equations using a Cholesky decomposition. This is the fastest method, but loses most precision and requires the problem to be overdetermined and `A` to have full rank.
*
* The "LDLT" method is essentially the same as "Cholesky", but uses a more robust Cholesky decomposition with pivoting that also avoids taking a square root. This method is recommended over "Cholesky" by Eigen3.
*
* The "QR" method uses a QR decomposition. This is slower than "Cholesky", but gives more precision. The marix `A` should have full rank.
*
* The "SVD" uses an SVD decomposition. This is the slowest, but gives best precision. Also, the matrix `A` does not need to have full rank, and in the case of an underdetermined problem, the least-squares solution with the smallest norm is returned.
*
* The "JacobiSVD" method is similar to the "SVD" method, but uses a different (slower, but potentially more accurate) svd algorithm.
*/
template< typename D, typename D1, typename D2 >
C1(void) PY1(MatrixXd)
solveOLS(C2(const MatrixBase<D> &X,) const MatrixBase<D1> &A, const MatrixBase<D2> &M, bool transposed = false, const std::string& method = "QR") {
if (transposed) {
if (method == "Cholesky" or method == "iCholesky") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = (A * A.transpose()).llt().solve(A * M.transpose()).transpose();
} else if (method == "LDLT") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = (A * A.transpose()).ldlt().solve(A * M.transpose()).transpose();
} else if (method == "QR") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = A.transpose().colPivHouseholderQr().solve(M.transpose()).transpose();
} else if (method == "SVD") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = A.transpose().bdcSvd(ComputeThinU | ComputeThinV).solve(M.transpose()).transpose();
} else if (method == "JacobiSVD") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = A.transpose().jacobiSvd(ComputeThinU | ComputeThinV).solve(M.transpose()).transpose();
} else { throw std::invalid_argument("unrecognized method"); }
} else {
if (method == "Cholesky" or method == "iCholesky") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = (A.transpose() * A).llt().solve(A.transpose() * M);
} else if (method == "LDLT") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = (A.transpose() * A).ldlt().solve(A.transpose() * M);
} else if (method == "QR") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = A.colPivHouseholderQr().solve(M);
} else if (method == "SVD") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = A.bdcSvd(ComputeThinU | ComputeThinV).solve(M);
} else if (method == "JacobiSVD") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = A.jacobiSvd(ComputeThinU | ComputeThinV).solve(M);
} else { throw std::invalid_argument("unrecognized method"); }
}
}
SWIGCODE(%template(solveOLS) solveOLS<MatrixXd, MatrixMd, MatrixMd>;)
/**
* Return
* \ifnot PY
* in the output-argument `X`,
* \endif
* the row or column weighted least-squares solution to the problem `A` * `X` = `M` with row-weights given in the column vector `W` (or if `transposed` to `X` * `A` = `M` with column-weights given in the row vector `W`) using a `method` from {"Cholesky", "LDLT" (default), "QR", "SVD", "JacobiSVD"}.
*
* This computes `X` that minimizes |D(sqrt_W) * (`A` * `X` - `M`)|_F (or |(`X` * `A` - `M`) * D(sqrt_W)|_F if `transposed`), where `sqrt_W` is the element-wise square-root of `W`, i.e., `W` = `sqrt_W` .* `sqrt_W`, and `.*` denotes the element-wise product. The computation is done by reducing the problem to an OLS problem that is then solved according to the given `method` as detailed below (see also `solveOLS()`). Note that the weights in `W` must be strictly greater than zero.
*
* Note that column weights have no effect in the default case, and row weight have no effect if `transposed`, and are therefore ommitted.
*
* The "Cholesky" method solves the normal equations using a Cholesky decomposition. This is the fastest method, but loses most precision and requires the problem to be overdetermined and `A` to have full rank.
*
* The "LDLT" method is essentially the same as "Cholesky", but uses a more robust Cholesky decomposition with pivoting that also avoids taking a square root. This method is recommended over "Cholesky" by Eigen3.
*
* The "QR" method uses a QR decomposition. This is slower than "Cholesky", but gives more precision. The marix `A` should have full rank.
*
* The "SVD" uses an SVD decomposition. This is the slowest, but gives best precision. Also, the matrix `A` does not need to have full rank, and in the case of an underdetermined problem, the least-squares solution with the smallest norm is returned.
*
* The "JacobiSVD" method is similar to the "SVD" method, but uses a different (slower, but potentially more accurate) svd algorithm.
*/
template< typename D, typename D1, typename D2, typename D3>
C1(void) PY1(MatrixXd)
solveRowColWLS(C2(const MatrixBase<D> &X,) const MatrixBase<D1>&A, const MatrixBase<D2>& M, const MatrixBase<D3>& W, bool transposed = false, const std::string &method = "LDLT") {
if (transposed) {
if (method == "Cholesky" or method == "iCholesky") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = (A * W.asDiagonal() * A.transpose()).llt().solve(
A * W.asDiagonal() * M.transpose()).transpose();
} else if (method == "LDLT") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = (A * W.asDiagonal() * A.transpose()).ldlt().solve(
A * W.asDiagonal() * M.transpose()).transpose();
} else {
RowVectorXd sqrt_W = W.cwiseSqrt();
solveOLS(X, A * sqrt_W.asDiagonal(), M * sqrt_W.asDiagonal(), transposed, method);
}
} else {
if (method == "Cholesky" or method == "iCholesky") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = (A.transpose() * W.asDiagonal() * A).llt().solve(
A.transpose() * W.asDiagonal() * M);
} else if (method == "LDLT") {
const_cast<MatrixBase<D> &>(X).derived().noalias() = (A.transpose() * W.asDiagonal() * A).ldlt().solve(
A.transpose() * W.asDiagonal() * M);
} else {
VectorXd sqrt_W = W.cwiseSqrt();
solveOLS(X, sqrt_W.asDiagonal() * A, sqrt_W.asDiagonal() * M, transposed, method);
}
}
}
SWIGCODE(%template(solveRowColWLS) solveRowColWLS<MatrixXd, MatrixMd, MatrixMd, MatrixMd>;)
/**
* Return
* \ifnot PY
* in the output-argument `X`,
* \endif
* the (element-wise) D(`W`)-weighted least-squares (WLS) solution to the problem `A` * `X` = `M` (or to `X` * `A` = `M` if `transposed`) using a `method` from {"Cholesky", "LDLT" (default), "QR", "SVD", "JacobiSVD"}.
*
* This computes `X` that minimizes |`A` * `X` - `M`|_D(`W`) (or |`X` * `A` - `M`|_D(`W`) if `transposed`). The computation is done by reducing the problem to a set of OLS problems that are then solved according to the given `method` as detailed below (see also `solveOLS()`). Note that the weights in `W` must be strictly greater than zero.
*
* The "Cholesky" method solves the normal equations using a Cholesky decomposition. This is the fastest method, but loses most precision and requires the problem to be overdetermined and `A` to have full rank.
*
* The "LDLT" method is essentially the same as "Cholesky", but uses a more robust Cholesky decomposition with pivoting that also avoids taking a square root. This method is recommended over "Cholesky" by Eigen3.
*
* The "QR" method uses a QR decomposition. This is slower than "Cholesky", but gives more precision. The marix `A` should have full rank.
*
* The "SVD" uses an SVD decomposition. This is the slowest, but gives best precision. Also, the matrix `A` does not need to have full rank, and in the case of an underdetermined problem, the least-squares solution with the smallest norm is returned.
*
* The "JacobiSVD" method is similar to the "SVD" method, but uses a different (slower, but potentially more accurate) svd algorithm.
*/
template< typename D, typename D1, typename D2, typename D3>
C1(void) PY1(MatrixXd)
solveWLS(C2(const MatrixBase<D> &X,) const MatrixBase<D1>& A, const MatrixBase<D2>& M, const MatrixBase<D3>& W, bool transposed = false, const std::string &method = "LDLT") {
if (transposed) {
const_cast<MatrixBase<D> &>(X).derived().resize(M.rows(), A.rows());
if (method == "Cholesky" or method == "iCholesky") {
LLT<MatrixXd> llt;
MatrixXd A_WMT = A * (W.array() * M.array()).matrix().transpose();
for (int i = 0; i < M.rows(); ++i) {
llt.compute(A * W.row(i).asDiagonal() * A.transpose());
const_cast<MatrixBase<D> &>(X).row(i).noalias() = llt.solve(A_WMT.col(i)).transpose();
}
} else if (method == "LDLT") {
LDLT<MatrixXd> ldlt;
MatrixXd A_WMT = A * (W.array() * M.array()).matrix().transpose();
for (int i = 0; i < M.rows(); ++i) {
ldlt.compute(A * W.row(i).asDiagonal() * A.transpose());
const_cast<MatrixBase<D> &>(X).row(i).noalias() = ldlt.solve(A_WMT.col(i)).transpose();
}
} else {
MatrixXd sqrt_W = W.cwiseSqrt();
for (int i = 0; i < M.rows(); ++i) {
solveOLS(const_cast<MatrixBase<D> &>(X).row(i), A * sqrt_W.row(i).asDiagonal(), M.row(i) * sqrt_W.row(i).asDiagonal(), transposed, method);
}
}
} else {
const_cast<MatrixBase<D> &>(X).derived().resize(A.cols(), M.cols());
if (method == "Cholesky" or method == "iCholesky") {
LLT<MatrixXd> llt;
MatrixXd AT_WM = A.transpose() * (W.array() * M.array()).matrix();
for (int j = 0; j < M.cols(); ++j) {
llt.compute(A.transpose() * W.col(j).asDiagonal() * A);
const_cast<MatrixBase<D> &>(X).col(j).noalias() = llt.solve(AT_WM.col(j));
}
} else if (method == "LDLT") {
LDLT<MatrixXd> ldlt;
MatrixXd AT_WM = A.transpose() * (W.array() * M.array()).matrix();
for (int j = 0; j < M.cols(); ++j) {
ldlt.compute(A.transpose() * W.col(j).asDiagonal() * A);
const_cast<MatrixBase<D> &>(X).col(j).noalias() = ldlt.solve(AT_WM.col(j));
}
} else {
MatrixXd sqrt_W = W.cwiseSqrt();
for (int j = 0; j < M.cols(); ++j) {
solveOLS(const_cast<MatrixBase<D> &>(X).col(j), sqrt_W.col(j).asDiagonal() * A, sqrt_W.col(j).asDiagonal() * M.col(j), transposed, method);
}
}
}
}
SWIGCODE(%template(solveWLS) solveWLS<MatrixXd, MatrixXd, MatrixXd, MatrixXd>;)
/**
* Return
* \ifnot PY
* in the output-argument `X`,
* \endif
* the D(W1,..., Wm)-weighted least-squares (GLS) solution to the overdetermined problem `A` * `X` = `M` (or to `X` * `A` = `M` if `transposed`) using a `method` from {"Cholesky", "LDLT" (default)}, where the block-diagonal symmetric and positive definite weight matrix is given by:
* `W` = [[W1]_1,...,[Wn]_1, ..., [W1]_m,...,[Wn]_m], where each `Wj` is the full weight matrix for the column j of `M`.
*
* This computes `X` that minimizes |`A` * `X` - `M`|_D(W1,...,Wn) (or |`X` * `A` - `M`|_D(W1,...,Wn) if `transposed`).
*
* Note that the "LDLT" method is essentially the same as "Cholesky", but uses a more robust Cholesky decomposition with pivoting that also avoids taking a square root. This method is recommended over "Cholesky" by Eigen3.
*/
template< typename D, typename D1, typename D2, typename D3>
C1(void) PY1(MatrixXd)
solveGLS(C2(const MatrixBase<D> &X,) const MatrixBase<D1> &A, const MatrixBase<D2>& M, const MatrixBase<D3>& W, bool transposed = false, const std::string &method = "LDLT") {
assert(W.rows() == M.rows() and W.cols() == M.cols() * M.rows()); // Block-diagonal weight matrix
Map<const MatrixXd> W_reshaped(W.derived().data(), W.cols(), W.rows());
if (transposed) {
// solve XA≈M by solving [\sum_j AjAj^T ⊗ Wj] vec(X) = vec( [W1M1, W2M2, ..., WnMn] A^T )
MatrixXd AT = A.transpose();
MatrixXd AtI_W_ATtI(A.rows() * W.rows(), A.rows() * W.rows()); // we only compute lower triagonal part
#ifdef _OPENMP
#pragma omp parallel
#endif
{
VectorXd ATii_ATjj(W.rows());
for (long jj = 0; jj < A.rows(); ++jj) {
for (long j = 0; j < M.rows(); ++j) {
#ifdef _OPENMP
#pragma omp for
#endif
for (long ii = jj; ii < A.rows(); ++ii) {
ATii_ATjj = AT.col(ii).cwiseProduct(AT.col(jj));
AtI_W_ATtI.block(ii * W.rows(), jj * W.rows() + j, W.rows(), 1).noalias() =
W.middleCols(j * M.cols(), M.cols()) * ATii_ATjj;
}
}
}
}
MatrixXd WM = MatrixXd(W.rows(), M.cols());
for (int j = 0; j < M.cols(); ++j) {
WM.col(j).noalias() = W_reshaped.middleRows(j*W.rows(), W.rows()) * M.col(j);
}
WM *= A.transpose();
const Map<const VectorXd> vecWMAT(WM.data(),WM.size());
MatrixXd vecX;
if (method == "LDLT") { vecX.noalias() = AtI_W_ATtI.ldlt().solve(vecWMAT); }
else if (method == "Cholesky") { vecX.noalias() = AtI_W_ATtI.llt().solve(vecWMAT); }
else if (method == "iCholesky") { LLT<Ref<MatrixXd> > llt(AtI_W_ATtI); vecX.noalias() = llt.solve(vecWMAT); }
else { throw std::invalid_argument("unrecognized method"); }
vecX.resize(M.rows(), A.rows());
const_cast<MatrixBase<D>&>(X).derived() = std::move(vecX);
} else {
// solve AX≈M by solving SjAXj ≈ SjMj for each column j
if (method == "Cholesky" or method == "iCholesky") {
LLT<MatrixXd> llt;
const_cast<MatrixBase<D> &>(X).derived().resize(A.cols(), M.cols());
for (int j = 0; j < X.cols(); ++j) {
llt.compute(A.transpose() * W_reshaped.middleRows(j * W.rows(), W.rows()) * A);
const_cast<MatrixBase<D> &>(X).col(j).noalias() = llt.solve(
A.transpose() * (W_reshaped.middleRows(j * W.rows(), W.rows()) * M.col(j)));
}
} else if (method == "LDLT") {
LDLT<MatrixXd> ldlt;
const_cast<MatrixBase<D> &>(X).derived().resize(A.cols(), M.cols());
for (int j = 0; j < X.cols(); ++j) {
ldlt.compute(A.transpose() * W_reshaped.middleRows(j * W.rows(), W.rows()) * A);
const_cast<MatrixBase<D> &>(X).col(j).noalias() = ldlt.solve(
A.transpose() * (W_reshaped.middleRows(j * W.rows(), W.rows()) * M.col(j)));
}
}
}
}
SWIGCODE(%template(solveGLS) solveGLS<MatrixXd, MatrixXd, MatrixXd, MatrixXd>;)
//</editor-fold>
/**
* Return
* \ifnot PY
* in the output-argument `X`,
* \endif
* the generalized weighted least-squares (GLS) solution to the overdetermined problem `A` * `X` = `M` (or to the problem `X` * `A` = `M` if `transposed`) with the given weights `W` using a `method` from {"Cholesky", "LDLT" (default), "QR", "SVD", "JacobiSVD"}.
*
* This computes `X` that minimizes the weighted norm |`A` * `X` - `M`|_W (or |`X` * `A` - `M`|_W if `transposed`), utilizing the structure of W that depends on the size of the supplied weights `W` in the following way, assuming `M` is of size m x n:
*
* - If `W` is of size zero (default), then no weights are used and the ordinary least squares (OLS) solution minimizing the Frobenius norm is returned.
* - If `W` is of size m x n, then element-wise weights are assumed, i.e., W = D(`W`), resulting in the weighted least squares (WLS) solution.
* - If `W` is of size m x nm, then a block-diagonal structure for W is assumed, i.e., W = D(`W`_1, ..., `W`_m), where `W`_j is the j-th (m x m)-block of `W` corresponding to the weights for [`M`]_j, which must be symmetric an positive definite.
* - If `W` is of size m x 1, then these are regarded as row-weights, which only make sense if not `transposed`.
* - If `W` is of size 1 x n, then these are regarded as column-weights, which only make sense if `transposed`.
* - If `W` is of size m+n x 1 then `W`[:m] are regarded as row-weights and `W`[m:] as column-weights. If `transposed` the row-weights, else the column-weights, have no effect.
*
* Note that solving GLS with full weight matrix is expensive, and therefore only solving with block-diagonal structured weight matrix is supported, and then only the methods "Cholesky" and "LDLT" which can make use of extra simplifications.
*
* The computation is done by reducing the problem to a set of OLS problems that are then solved according to the given `method` as detailed below. Note that the weights in `W` must be strictly greater than zero.
*
* The "Cholesky" method solves the normal equations using a Cholesky decomposition. This is the fastest method, but loses most precision and requires the problem to be overdetermined and `A` to have full rank.
*
* The "LDLT" method is essentially the same as "Cholesky", but uses a more robust Cholesky decomposition with pivoting that also avoids taking a square root. This method is recommended over "Cholesky" by Eigen3.
*
* The "QR" method uses a QR decomposition. This is slower than "Cholesky", but gives more precision. The marix `A` should have full rank.
*
* The "SVD" uses an SVD decomposition. This is the slowest, but gives best precision. Also, the matrix `A` does not need to have full rank in which case the least-squares solution with the smallest norm is returned.
*
* The "JacobiSVD" method is similar to the "SVD" method, but uses a different (slower, but potentially more accurate) svd algorithm.
*
*/
template< typename D>
C1(void) PY1(MatrixXd)
solveLS(C2(const MatrixBase<D> &X,) const MatrixXd &A, const MatrixXd &M, const MatrixXd &W = MatrixXd(), bool transposed = false, std::string method = "LDLT") throw(std::invalid_argument) {
if (not (method == "Cholesky" or method == "iCholesky" or method == "LDLT" or method == "QR" or method == "SVD" or method == "JacobiSVD")) throw std::invalid_argument("method not recognized");
if (not transposed) { // solve AX=M
if (A.rows() != M.rows()) throw std::invalid_argument("LHS rows != RHS rows");
if (A.cols() > A.rows()) throw std::invalid_argument("system must be overdetermined");
if (W.size() == 0) { solveOLS(X, A, M, transposed, method); }
else if (W.rows() == M.rows() and W.cols() == M.cols()) { solveWLS(X, A, M, W, transposed, method); }
else if (W.rows() == M.rows() and W.cols() == M.rows() * M.cols()) {
if (method != "Cholesky" and method != "LDLT" and method != "iCholesky") throw std::invalid_argument("GLS only supported with method 'Cholesky' or 'LDLT'");
solveGLS(X, A, M, W, transposed, method); }
else if (W.rows() == W.cols() and W.cols() == M.rows() * M.cols()) throw std::invalid_argument("GLS with full weight matrix not implemented");
else if (W.rows() == M.rows() and W.cols() == 1) { solveRowColWLS(X, A, M, W, transposed, method); }
else if (W.cols() == 1 and W.rows() == M.rows() + M.cols()) { solveRowColWLS(X, A, M, W.col(0).head(M.rows()), transposed, method); }
else { throw std::invalid_argument("size mismatch for M and W"); }
} else { // solve XA=M
if (A.cols() != M.cols()) throw std::invalid_argument("LHS cols != RHS cols");
if (A.rows() > A.cols()) throw std::invalid_argument("system must be overdetermined");
if (W.size() == 0) { solveOLS(X, A, M, transposed, method); }
else if (W.rows() == M.rows() and W.cols() == M.cols()) { solveWLS(X, A, M, W, transposed, method); }
else if (W.rows() == M.rows() and W.cols() == M.rows() * M.cols()) {
if (method != "Cholesky" and method != "LDLT" and method != "iCholesky") throw std::invalid_argument("GLS only supported with method 'Cholesky' or 'LDLT'");
solveGLS(X, A, M, W, transposed, method); }
else if (W.rows() == W.cols() and W.cols() == M.rows() * M.cols()) throw std::invalid_argument("LS with full weight matrix not implemented");
else if (W.rows() == 1 and W.cols() == M.cols()) { solveRowColWLS(X, A, M, W, transposed, method); }
else if (W.cols() == 1 and W.rows() == M.rows() + M.cols()) { solveRowColWLS(X, A, M, W.col(0).tail(M.cols()).transpose(), transposed, method); }
else { throw std::invalid_argument("size mismatch for M and W"); }
}
}
SWIGCODE(%template(solveLS) solveLS<MatrixXd>;)
/**
* Return a new weight matrix for `X`, assuming `X` is a solution to the D(`W`)-weighted WLS problem `B` * `X` = `M`.
*
* Note that the columns of `X` can be regarded as coordinate representations for the columns of `M` with respect to a basis given by the columns of `B`. This function transforms the given weights for the columns of `M` to appropriate weights for the coordinates in the columns of `X`. The resulting weight matrix for `X` will therefore be block-diagonal in general, but if `covariances` is set to `false`, the off-diagonal weights are ignored, resulting in element-wise weights for `X`.
*
* The returned matrix will therefore be
*
* - [[tW_1]_1, ..., [tW_m]_1, ..., [tW_1]_{B.cols}, ..., [tW_m]_{B.cols}] of size (B.cols x M.cols) * B.cols if `covariances`, where
* tW_j = B^T * D([W]_j) * B
* - [diag(B^T * D([W]_1) * B), ..., diag(B^T * D([W]_m) * B)] of size B.cols() x M.cols() otherwise.
*/
template< typename D1, typename D2 >
MatrixXd transformWeights(const MatrixBase<D1> &W, const MatrixBase<D2> &B, bool covariances = true) {
MatrixXd newWeights(B.cols(), W.cols() * (covariances ? B.cols() : 1));
for (int j = 0; j < W.cols(); ++j) {
if (covariances) {
MatrixXd::Map(newWeights.data(), B.cols() * W.cols(), B.cols()).middleRows(j * B.cols(), B.cols()).noalias() =
B.transpose() * W.col(j).asDiagonal() * B;
} else {
newWeights.col(j).noalias() = (B.transpose() * W.col(j).asDiagonal() * B).diagonal();
}
}
return newWeights;
}
SWIGCODE(%template(transformWeights) transformWeights<MatrixMd, MatrixMd>;)
/**
* \ifnot PY
* Compute in the arguments `U`,`s` and `VT`
* \else
* Return in a tuple [U,s,VT]
* \endif
* the singular value decomposition of the given matrix `M`, such that `M = U D(s) VT`, using the given `method` ('bdc' | 'jacobi').
*/
SWIGCODE(%apply const MatrixXd& OUTPUT { const MatrixXd &U, const MatrixXd &VT };)
SWIGCODE(%apply const ArrayXd& OUTPUT { const ArrayXd &s };)
template<typename D >
C1(void) PY3(tuple<MatrixXd, ArrayXd, MatrixXd>)
svd(C4(const MatrixXd &U, const ArrayXd &s, const MatrixXd &VT,) const MatrixBase<D> &M, const std::string &method="bdc") {
if (method == "bdc") {
BDCSVD<MatrixXd> svd(M, ComputeThinU | ComputeThinV);
const_cast<MatrixXd&>(U) = svd.matrixU();
const_cast<ArrayXd&>(s) = svd.singularValues();
const_cast<MatrixXd&>(VT) = svd.matrixV().transpose();
} else if (method == "jacobi") {
JacobiSVD<MatrixXd> svd(M, ComputeThinU | ComputeThinV);
const_cast<MatrixXd&>(U) = svd.matrixU();
const_cast<ArrayXd&>(s) = svd.singularValues();
const_cast<MatrixXd&>(VT) = svd.matrixV().transpose();
}
}
SWIGCODE(%template(svd) svd<MatrixMd >;)
SWIGCODE(%clear const MatrixXd &U, const ArrayXd &s, const MatrixXd &VT;)
/**
* Return the pseudo-inverse of the given matrix `M` computed according to the given `method` from {"Cholesky", "QR", "SVD" (default), "JacobiSVD"}.
*
* If `method` is "SVD" or "JacobiSVD", the classical pseudo-inverse is computed from the svd of `M`.
*
* If `method` is "QR", the pseudo-inverse is computed from the QR-factorization of `M`, which requires `M` to have full rank.
*
* If `method` is "Cholesky" or "LDLT", the pseudo-inverse is computed as \f$(M^\top M)^{-1} M^\top\f$ or \f$M^\top (M M^\top)^{-1}\f$ depending on the size of `M`, which requires `M` to have full rank.
*/
template<typename D>
MatrixXd pinv(const MatrixBase<D> &M, const std::string &method = "SVD") {
MatrixXd result;
unsigned long I_size = M.rows();
bool transpose = false;
if ((method == "LDLT" or method == "Cholesky" or method == "iCholesky" or method == "QR") and (M.rows() < M.cols())) {
I_size = M.cols();
transpose = true;
}
solveOLS(result, M, MatrixXd::Identity(I_size, I_size), transpose, method);
return result;
}
SWIGCODE(%template(pinv) pinv<MatrixMd>;)
/**
* Compute in the arguments `B` and `A` (an approximation to) the best weighted rank-d approximation to `M` with element-wise weights `W` such that |`B` * `A` - `M`|_D(W) is minimized. This is computed iteratively starting from an initial approximation given by `B` * `A` using "alternating projections" solved via the given `method`. The termination of the iteration is controlled by the given `stopCondition`.
* \ifnot PY
* See `StopCondition`.
* \else
* See `tom.util.StopCondition`.
* \endif
*/
template<typename D1, typename D2, typename D3, typename D4>
void improveWLRA(const MatrixBase<D1> &B, const MatrixBase<D2> &A, const MatrixBase<D3> &M, const MatrixBase<D4> &W,
const StopCondition& stopCondition = StopCondition(50, 1e-5, 1e-12), const std::string &method = "Cholesky") {
const_cast<StopCondition&>(stopCondition).reset();
while (not const_cast<StopCondition&>(stopCondition)(weightedNorm(M - B * A, W))) {
solveWLS(B, A, M, W, true, method);
solveWLS(A, B, M, W, false, method);
}
}
SWIGCODE(%template(improveWLRA) improveWLRA<MatrixMd, MatrixMd, MatrixXd, MatrixXd >;)
/**
* \ifnot PY
* Compute in the arguments `B` and `A`
* \else
* Return in a tuple [B,A]
* \endif
* (an approximation to) the best weighted rank-d approximation to `M` with element-wise weights `W` such that |`B` * `A` - `M`|_D(vect(W)) is minimized. This is computed iteratively starting from an initial approximation given by `B_init` using "alternating projections", which are in turn solved via the given `method`. The termination of the iteration is controlled by the given `stopCondition`.
* \ifnot PY
* See `StopCondition`.
* \else
* See `tom.util.StopCondition`.
* \endif
*/
SWIGCODE(%apply const MatrixBase<MatrixXd>& OUTPUT { const MatrixBase<MatrixXd> &B, const MatrixBase<MatrixXd> &A };)
template<typename D1, typename D2, typename D3, typename D4, typename D5>
C1(void) PY2(tuple<MatrixXd, MatrixXd>)
computeWLRA(C3(const MatrixBase<D1> &B, const MatrixBase<D2> &A,) const MatrixBase<D3> &M, const MatrixBase<D4> &W, const MatrixBase<D5> &B_init, const StopCondition& stopCondition = StopCondition(50, 1e-5, 1e-12), const std::string &method = "Cholesky") throw(std::invalid_argument) {
if (W.rows() != M.rows() or W.cols() != M.cols() or B_init.rows() != M.rows() or B_init.cols() > M.cols()) {
throw std::invalid_argument("size mismatch");
}
const_cast<MatrixBase<D1>&>(B).derived() = B_init;
solveWLS(A, B, M, W, false, method);
improveWLRA(B, A, M, W, stopCondition, method);
}
SWIGCODE(%template(computeWLRA) computeWLRA<MatrixXd, MatrixXd, MatrixXd, MatrixXd, MatrixXd >;)
SWIGCODE(%clear const MatrixBase<MatrixXd> &X, const MatrixBase<MatrixXd> &B, const MatrixBase<MatrixXd> &A;)
SWIGCODE(%clearkwargs;)
} // namespace tom
| 60.856373 | 487 | 0.630321 | [
"vector"
] |
9d2a10895729c182ba8cbe9ff5f3e3ee5700bc3e | 1,483 | h | C | Engine/TextComponent.h | scottvermast/2DGameEngine | ee2d6ddcffcc5cb0abfdc40119526f291fd8a986 | [
"Apache-2.0"
] | null | null | null | Engine/TextComponent.h | scottvermast/2DGameEngine | ee2d6ddcffcc5cb0abfdc40119526f291fd8a986 | [
"Apache-2.0"
] | null | null | null | Engine/TextComponent.h | scottvermast/2DGameEngine | ee2d6ddcffcc5cb0abfdc40119526f291fd8a986 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "BaseComponent.h"
#include "TextureComponent.h"
#include "TransformComponent.h"
#include <glm.hpp>
#include <SDL.h>
#include "Font.h"
class TextComponent : public BaseComponent
{
public:
TextComponent(const std::string& text, unsigned int size, const std::string& file = "../Resources/Roboto-Regular.ttf");
~TextComponent();
TextComponent(const TextComponent& other) = delete;
TextComponent(TextComponent&& other) noexcept = delete;
TextComponent& operator=(const TextComponent& other) = delete;
TextComponent& operator=(TextComponent&& other) noexcept = delete;
void SetText(const std::string& text);
void SetFont(const std::pair<std::string, unsigned int>& fontData);
void SetColor(const SDL_Color& color);
void SetPivot(const glm::vec3& pivot);
const glm::vec3& GetPivot() { return m_Pivot; };
Texture2D* GetTexture() const { return m_pTexture; }
void SetTransform(TransformComponent* pTransformComponent);
protected:
void Initialize() override;
void Update() override;
void Render() override;
private:
TransformComponent* m_pTransformComponent;
std::pair<std::string, unsigned int> m_FontData{};
std::string m_Text;
bool m_UpdateText;
Font* m_pFont;
Texture2D* m_pTexture;
SDL_Color m_Color;
glm::vec3 m_Pivot;
Renderer* m_Renderer;
};
inline std::ostream& operator<<(std::ostream& os, const std::pair<std::string, unsigned int>& fontData)
{
return os << "[" << fontData.first << ", " << fontData.second << "]";
}
| 26.017544 | 120 | 0.733648 | [
"render"
] |
9d2d1359efff125a17a001426ab28ec6eb360fe6 | 3,615 | h | C | test/test_custom.h | benjamin-fukdawurld/FDXml | f024d77859cc610d36e5544559e227fd6a7feeed | [
"Apache-2.0"
] | null | null | null | test/test_custom.h | benjamin-fukdawurld/FDXml | f024d77859cc610d36e5544559e227fd6a7feeed | [
"Apache-2.0"
] | null | null | null | test/test_custom.h | benjamin-fukdawurld/FDXml | f024d77859cc610d36e5544559e227fd6a7feeed | [
"Apache-2.0"
] | null | null | null | #ifndef FDXML_TEST_CUSTOM_H
#define FDXML_TEST_CUSTOM_H
#include <gtest/gtest.h>
#include <FDXml/FDXml.h>
#include <FDXml/Xml_fwd.h>
#include <FDXml/XmlValue.h>
struct TestClass
{
int i;
float f;
char c;
std::string str;
TestClass(int i = 42, float f = 3.14f, char c = 'A', const std::string &str = "toto"):
i(i), f(f), c(c), str(str)
{}
};
namespace FDXml
{
XmlValue serialize(TestClass &&c, FDXml::Serializer &serializer);
XmlValue serialize(const TestClass &c);
bool unserialize(const XmlValue &val, TestClass &str, std::string *err = nullptr);
}
#include <FDXml/Xml_utils.h>
#include <FDXml/XmlSerializer.h>
namespace FDXml
{
XmlValue serialize(TestClass &&c, Serializer &serializer)
{
XmlValue val("TestClass", serializer);
XmlValue i = FDXml::serialize(c.i, serializer);
i.setName("i");
val.addChildNode(i);
XmlValue f = FDXml::serialize(c.f, serializer);
f.setName("f");
val.addChildNode(f);
XmlValue ch = FDXml::serialize(c.c, serializer);
ch.setName("c");
val.addChildNode(ch);
XmlValue str = FDXml::serialize(c.str, serializer);
str.setName("str");
val.addChildNode(str);
return val;
}
XmlValue serialize(const TestClass &c, Serializer &serializer)
{
XmlValue val("TestClass", serializer);
XmlValue i = FDXml::serialize(c.i, serializer);
i.setName("i");
val.addChildNode(i);
XmlValue f = FDXml::serialize(c.f, serializer);
f.setName("f");
val.addChildNode(f);
XmlValue ch = FDXml::serialize(c.c, serializer);
ch.setName("c");
val.addChildNode(ch);
XmlValue str = FDXml::serialize(c.str, serializer);
str.setName("str");
val.addChildNode(str);
return val;
}
bool unserialize(const XmlValue &val, TestClass &c, Serializer &tag, std::string *err)
{
if(!val.isObject())
{
if(err)
*err = "Value is not an object";
return false;
}
if(val.getObjectType() != "TestClass")
{
if(err)
*err = "Value is not an TestClass";
return false;
}
return FDXml::unserialize(val["i"], c.i, tag, err)
&& FDXml::unserialize(val["f"], c.f, tag, err)
&& FDXml::unserialize(val["c"], c.c, tag, err)
&& FDXml::unserialize(val["str"], c.str, tag, err);
}
}
#include <FDCore/FileUtils.h>
#include <fstream>
#include <cstdio>
TEST(TestJsonCustom, TestSerializeCustomType)
{
FDXml::Serializer serializer;
std::ofstream file("TestClass.xml");
FDXml::XmlValue val = FDXml::serialize(TestClass(), serializer);
ASSERT_EQ(val["i"].getValue(), "42");
ASSERT_EQ(val["f"].getValue(), std::to_string(3.14f));
ASSERT_EQ(val["c"].getValue(), "A");
ASSERT_EQ(val["str"].getValue(), "toto");
serializer.save(val, "TestClass.xml");
}
TEST(TestJsonCustom, TestUnserializeReflectConfig)
{
FDXml::Serializer serializer;
std::unique_ptr<char[]> text = FDCore::readFile("TestClass.xml");
rapidxml::xml_document<> doc; // character type defaults to char
doc.parse<0>(text.get());
FDXml::XmlValue val(doc.first_node(), serializer);
TestClass c;
std::string err;
ASSERT_TRUE(FDXml::unserialize(val, c, serializer, &err)) << err;
ASSERT_EQ(c.i, 42);
ASSERT_FLOAT_EQ(c.f, 3.14f);
ASSERT_EQ(c.c, 'A');
ASSERT_EQ(c.str, "toto");
}
#endif // FDXML_TEST_CUSTOM_H
| 25.27972 | 90 | 0.595297 | [
"object"
] |
9d2ebd30953dc7fbadeb8f23c860184dd2cf4871 | 1,435 | c | C | src/string.c | jdp/compoze | c16de02e96b82243760caa495d3e9797c89d8bf2 | [
"0BSD"
] | 3 | 2015-05-05T21:59:37.000Z | 2021-01-26T18:15:29.000Z | src/string.c | jdp/compoze | c16de02e96b82243760caa495d3e9797c89d8bf2 | [
"0BSD"
] | null | null | null | src/string.c | jdp/compoze | c16de02e96b82243760caa495d3e9797c89d8bf2 | [
"0BSD"
] | null | null | null | #include "compoze.h"
OBJ
Symbol_intern_(CzState *cz, char *string)
{
CzSymbol *symbol;
CzPair *pair;
OBJ hash;
hash = djb2_hash(string, strlen(string));
pair = CZ_AS(Pair, cz->symbols->items[hash % cz->symbols->cap]);
while (!CZ_IS_NIL(pair)) {
if (strcmp((char *)pair->key, string) == 0) {
return pair->value;
}
pair = pair->next;
}
symbol = CZ_MAKE_OBJECT(Symbol);
symbol->hash = hash;
symbol->frozen = CZ_FALSE;
symbol->string = strdup(string);
symbol->len = strlen(string);
Table_insert_(cz, cz->symbols, hash, (OBJ)string, (OBJ)symbol);
return (OBJ)symbol;
}
OBJ
String_create_(CzState *cz, const char *str, size_t len)
{
CzString *string = CZ_MAKE_OBJECT(String);
string->string = strdup(str);
string->len = len;
string->hash = (OBJ)djb2_hash((void *)str, strlen(str));
string->frozen = CZ_FALSE;
return (OBJ)string;
}
OBJ
String_create2_(CzState *cz, const char *str)
{
return String_create_(cz, str, strlen(str));
}
OBJ
String_throw(CzState *cz, OBJ self)
{
return self;
}
OBJ
cz_sprintf(CzState *cz, const char *fmt, ...) {
va_list arg;
va_start(arg, fmt);
int len = vsnprintf(NULL, 0, fmt, arg);
char *ptr = CZ_ALLOC_N(char, len);
va_end(arg);
va_start(arg, fmt);
vsprintf(ptr, fmt, arg);
va_end(arg);
OBJ str = String_create_(cz, ptr, len);
CZ_FREE(ptr);
return str;
}
void
cz_bootstrap_string(CzState *cz)
{
CZ_VTABLE(String) = VTable_delegated_(cz, CZ_VTABLE(Object));
}
| 20.5 | 65 | 0.68223 | [
"object"
] |
9d32a3ab22a2724cc92a99d4ddb4ab78429fb850 | 7,410 | h | C | gns/sequence_sobol.h | i05nagai/generalized_niederreiter_sequence | dccf2d00c7e4648b76be8408af17104efd0d5c30 | [
"MIT"
] | null | null | null | gns/sequence_sobol.h | i05nagai/generalized_niederreiter_sequence | dccf2d00c7e4648b76be8408af17104efd0d5c30 | [
"MIT"
] | 6 | 2017-05-22T23:09:50.000Z | 2017-08-21T12:39:39.000Z | gns/sequence_sobol.h | i05nagai/generalized_niederreiter_sequence | dccf2d00c7e4648b76be8408af17104efd0d5c30 | [
"MIT"
] | null | null | null | #pragma once
#include <memory>
#include <utility>
#include <vector>
#include "gns/irreducible_polynomial.h"
#include "gns/laurent_series.h"
#include "gns/matrix.h"
#include "gns/matrix_operator.h"
#include "gns/util.h"
#include "gns/vector.h"
namespace gns {
/**
* @brief
*
*
* @tparam Base
* @param dim dimension of generator polynomial. 1 to maximum dimension.
* @param i
* @param k
*
* @return
*/
template <int Base>
GaloisFieldPolynomial<Base> GetSobolGeneratorPolynomial(const size_t dim,
const size_t i,
const size_t k) {
assert(dim > 0);
// k is degree
std::unique_ptr<GaloisField<Base>[]> data(new GaloisField<Base>[k + 1]);
data[k] = 1;
return GaloisFieldPolynomial<Base>(k, std::move(data));
}
/**
* @brief
*
* @tparam Base
* @param dim dimension of generator matrix. 1 to maximum dimension.
* @param irreducibles
* @param max_bit
*
* @return
*/
template <int Base>
Matrix<Base> MakeSobolGeneratorMatrix(
const size_t dim,
const std::vector<GaloisFieldPolynomial<Base>>& irreducibles,
const size_t max_bit) {
assert(dim > 0);
std::unique_ptr<GaloisField<Base>[]> data(
new GaloisField<Base>[max_bit * max_bit]);
const size_t degree = irreducibles[dim - 1].degree();
// calcualte denominators in advance
std::vector<GaloisFieldPolynomial<Base>> denominator;
GaloisFieldPolynomial<Base> irreducible = irreducibles[dim - 1];
const size_t max_quotient = static_cast<size_t>(max_bit / degree);
for (size_t q = 0; q <= max_quotient; ++q) {
denominator.push_back(irreducible);
irreducible *= irreducibles[dim - 1];
}
// for each row
for (size_t row = 0; row < max_bit; ++row) {
const size_t q = row / degree;
const size_t k = row % degree;
GaloisFieldPolynomial<Base> numerator =
GetSobolGeneratorPolynomial<Base>(dim, q, k);
std::unique_ptr<GaloisField<Base>[]> laurent_series =
SolveLaurentSeriesDivision(numerator, denominator[q], max_bit + 1);
for (size_t col = 0; col < max_bit; ++col) {
data[row * max_bit + col] = laurent_series[col + 1];
}
}
return Matrix<Base>(max_bit, max_bit, std::move(data));
}
/**
* @brief
*
* @tparam Base
*
* @return
*/
template <int Base>
std::vector<Matrix<Base>> MakeSobolGeneratorMatrices(const size_t dimension,
const size_t max_bit) {
std::vector<Matrix<Base>> generator_matrix(0);
IrreduciblePolynomialGenerator<Base> generator;
std::vector<GaloisFieldPolynomial<Base>> irreducibles = generator(dimension);
for (size_t dim = 0; dim < dimension; ++dim) {
Matrix<Base>&& matrix =
MakeSobolGeneratorMatrix<Base>(dim + 1, irreducibles, max_bit);
generator_matrix.push_back(std::move(matrix));
}
return generator_matrix;
}
/**
* @brief
*
* @tparam Base
*/
template <int Base>
class Sobol {
// private typedef
private:
// public typedef
public:
// public function
public:
Sobol(const size_t dimension, const size_t seed = 0,
const size_t max_bit = 32)
: dimension_(dimension),
seed_(seed),
max_bit_(max_bit),
generator_matrix_(0) {
assert(dimension_ > 0);
generator_matrix_ = MakeSobolGeneratorMatrices<Base>(dimension_, max_bit_);
}
std::unique_ptr<double[]> Next() {
std::unique_ptr<double[]> result(new double[dimension_]);
// if seed_ is zero, point is zero.
if (seed_ == 0) {
++seed_;
std::fill(result.get(), result.get() + dimension_, 0);
return result;
}
// calc base adic expansion of seed_
std::pair<size_t, std::unique_ptr<GaloisField<Base>[]>> data =
CalculateBaseAdic<Base>(seed_);
Vector<Base> n(data.first, std::move(data.second));
// get generator matrix
for (size_t dim = 0; dim < dimension_; ++dim) {
// multiply generator matrix
const Vector<Base>& vec = generator_matrix_[dim] * n;
result[dim] = BaseAdicToDouble(vec);
}
// update seed
++seed_;
return result;
}
// private function
private:
// private members
private:
size_t dimension_;
size_t seed_;
size_t max_bit_;
std::vector<Matrix<Base>> generator_matrix_;
};
/**
* @brief
*
* @tparam Base
*/
template <int Base>
class SobolGrayMap {
// private typedef
private:
// public typedef
public:
// public function
public:
SobolGrayMap(const size_t dimension, const size_t seed = 0,
const size_t max_bit = 32)
: dimension_(dimension),
seed_(seed),
max_bit_(max_bit),
cache_(new double[dimension]),
points_(0),
generator_matrix_(0) {
assert(dimension_ > 0);
// for storing
for (size_t dim = 0; dim < dimension_; ++dim) {
points_.push_back(Vector<Base>(max_bit_));
std::fill(points_[dim].begin(), points_[dim].end(), 0);
}
generator_matrix_ = MakeSobolGeneratorMatrices<Base>(dimension_, max_bit_);
}
const std::unique_ptr<double[]>& Next() {
// if seed_ is zero, point is zero.
if (seed_ == 0) {
++seed_;
std::fill(cache_.get(), cache_.get() + dimension_, 0);
return cache_;
}
// get generator matrix
for (size_t dim = 0; dim < dimension_; ++dim) {
size_t l = 0;
const GaloisField<Base> coeff = FindCoefficient(seed_, l);
for (size_t row = 0; row < max_bit_; ++row) {
points_[dim][row] += coeff * generator_matrix_[dim](row, l);
}
cache_[dim] = BaseAdicToDouble(points_[dim]);
}
// update seed
++seed_;
return cache_;
}
/**
@brief
$b$ is Base and $b = p^{n}$.
$$n = \sum_{i=0}^{k} a_{i}b^{i}, a_{i} \in \{0, \ldots, b-1\}$$,
$$l(n) := \min\{i \mid a_{i} \neq b - 1\}$$
$$ a = \sum_{i=0}^{k} d_{i}p^{i}$$, $$d_{i} \in \{0, \ldots, p-1}\}$$, $$k <
n$$,
$$ \alpha(a) := \min\{i \mid d_{i} \neq p - 1\}$$,
then coefficient $c$ is given by
$$
c
=
\sum_{i=0}^{\alpha(a_{l(n)} - a_{l(n)+1})}
x^{i}
$$
@param n
@param l $l(n)$
@return
*/
GaloisField<Base> FindCoefficient(const size_t num, size_t& l) const {
assert(num > 0);
constexpr size_t mask = Base - 1;
size_t n = num;
// l(n)
size_t a0 = 0;
size_t a1 = 0;
const size_t num_loop = (std::log2(num) / std::log2(Base)) + 1;
for (l = 0; l < num_loop; ++l) {
a0 = n & mask;
// a(l) == b - 1
if (a0 != 0) {
a1 = BitRightShift<Base>(n) & mask;
break;
}
n = BitRightShift<Base>(n);
}
// a = a_{l(n)} - a_{l(n)+1} (mod Base)
int a = a0 - a1;
if (a < 0) {
a += Base;
}
const size_t carry_bit = FindCarryBit<Base>(a);
return GaloisField<Base>(carry_bit);
}
// private function
private:
// private members
private:
size_t dimension_;
size_t seed_;
size_t max_bit_;
std::unique_ptr<double[]> cache_;
std::vector<Vector<Base>> points_;
std::vector<Matrix<Base>> generator_matrix_;
};
template <>
GaloisField<2> SobolGrayMap<2>::FindCoefficient(const size_t num,
size_t& l) const {
assert(num > 0);
size_t n = num;
// l(n)
for (l = 0; l < max_bit_; ++l) {
// a(l) != 0
if ((n & 1) != 0) {
return 1;
}
n >>= 1;
}
return 1;
}
} // namespace gns
| 26.091549 | 80 | 0.594062 | [
"vector"
] |
9d3343277522028a42ef76f34719017733d0226f | 1,476 | h | C | TopLoop/EDM/Tau.h | douglasdavis/TopLoop | a48cfb09526d0163ba151c4a2fc3ff1497080b76 | [
"MIT"
] | 2 | 2016-03-19T19:42:43.000Z | 2016-03-19T21:39:02.000Z | TopLoop/EDM/Tau.h | douglasdavis/TopLoop | a48cfb09526d0163ba151c4a2fc3ff1497080b76 | [
"MIT"
] | null | null | null | TopLoop/EDM/Tau.h | douglasdavis/TopLoop | a48cfb09526d0163ba151c4a2fc3ff1497080b76 | [
"MIT"
] | null | null | null | /** @file Tau.h
* @brief TL::EDM::Tau class header
* @class TL::EDM::Tau
* @brief A class for tau information
*
* This class is part of the TopLoop event data model (EDM). It
* contains the properties of a tau
*
* @author Tanja Holm <Tanja.Holm@cern.ch>
*/
#ifndef TL_EDM_Tau_h
#define TL_EDM_Tau_h
#include <TopLoop/EDM/Lepton.h>
namespace TL {
namespace EDM {
class Tau : public TL::EDM::Lepton {
private:
float m_ptvarcone30;
bool m_isManualTruthPrompt{false};
public:
/// default constructor
Tau() : TL::EDM::Lepton(15) {}
/// default destructor
virtual ~Tau() = default;
/// default copy constructor
Tau(const Tau&) = default;
/// default assignement operator
Tau& operator=(const Tau&) = default;
/// default move copy constructor
Tau(Tau&&) = default;
/// default move assignment operator
Tau& operator=(Tau&&) = default;
/// @name setters
/// @{
void set_ptvarcone30(const float val) { m_ptvarcone30 = val; }
void set_isManualTruthPrompt(const bool val) { m_isManualTruthPrompt = val; }
/// @}
/// @name getters
/// @{
float ptvarcone30() const { return m_ptvarcone30; }
/// if the tau is matched to an IsoTau in MC
bool isTruthPrompt() const {
return true_type() == MCTruthPartClassifier::ParticleType::IsoTau;
}
/// if the manual promptness is flag
bool isManualTruthPrompt() const { return m_isManualTruthPrompt; }
/// @}
};
} // namespace EDM
} // namespace TL
#endif
| 21.705882 | 79 | 0.666667 | [
"model"
] |
9d3763c4576d71bd3e78f943da62729c43677929 | 36,813 | c | C | src/parse.c | joyflo/mod_auth_openidc | 3844fa9aece8e7c8f75e905b6f9bb5fb86586653 | [
"Apache-2.0"
] | null | null | null | src/parse.c | joyflo/mod_auth_openidc | 3844fa9aece8e7c8f75e905b6f9bb5fb86586653 | [
"Apache-2.0"
] | null | null | null | src/parse.c | joyflo/mod_auth_openidc | 3844fa9aece8e7c8f75e905b6f9bb5fb86586653 | [
"Apache-2.0"
] | null | null | null | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/***************************************************************************
* Copyright (C) 2017-2018 ZmartZone IAM
* Copyright (C) 2013-2017 Ping Identity Corporation
* All rights reserved.
*
* For further information please contact:
*
* Ping Identity Corporation
* 1099 18th St Suite 2950
* Denver, CO 80202
* 303.468.2900
* http://www.pingidentity.com
*
* DISCLAIMER OF WARRANTIES:
*
* THE SOFTWARE PROVIDED HEREUNDER IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
* ANY WARRANTIES OR REPRESENTATIONS EXPRESS, IMPLIED OR STATUTORY; INCLUDING,
* WITHOUT LIMITATION, WARRANTIES OF QUALITY, PERFORMANCE, NONINFRINGEMENT,
* MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. NOR ARE THERE ANY
* WARRANTIES CREATED BY A COURSE OR DEALING, COURSE OF PERFORMANCE OR TRADE
* USAGE. FURTHERMORE, THERE ARE NO WARRANTIES THAT THE SOFTWARE WILL MEET
* YOUR NEEDS OR BE FREE FROM ERRORS, OR THAT THE OPERATION OF THE SOFTWARE
* WILL BE UNINTERRUPTED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES 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.
*
* Validation and parsing of configuration values.
*
* @Author: Hans Zandbelt - hans.zandbelt@zmartzone.eu
*/
#include <apr_base64.h>
#include "mod_auth_openidc.h"
#include "parse.h"
#include "jose.h"
/*
* parse a URL according to one of two schemes (NULL for any)
*/
static const char * oidc_valid_url_scheme(apr_pool_t *pool, const char *arg,
const char *scheme1, const char *scheme2) {
apr_uri_t uri;
if (apr_uri_parse(pool, arg, &uri) != APR_SUCCESS) {
return apr_psprintf(pool, "'%s' cannot be parsed as a URL", arg);
}
if (uri.scheme == NULL) {
return apr_psprintf(pool,
"'%s' cannot be parsed as a URL (no scheme set)", arg);
}
if ((scheme1 != NULL) && (apr_strnatcmp(uri.scheme, scheme1) != 0)) {
if ((scheme2 != NULL) && (apr_strnatcmp(uri.scheme, scheme2) != 0)) {
return apr_psprintf(pool,
"'%s' cannot be parsed as a \"%s\" or \"%s\" URL (scheme == %s)!",
arg, scheme1, scheme2, uri.scheme);
} else if (scheme2 == NULL) {
return apr_psprintf(pool,
"'%s' cannot be parsed as a \"%s\" URL (scheme == %s)!",
arg, scheme1, uri.scheme);
}
}
if (uri.hostname == NULL) {
return apr_psprintf(pool,
"'%s' cannot be parsed as a valid URL (no hostname set, check your slashes)",
arg);
}
return NULL;
}
/*
* parse a URL according to a scheme
*/
const char *oidc_valid_url(apr_pool_t *pool, const char *arg,
const char *scheme) {
return oidc_valid_url_scheme(pool, arg, scheme, NULL);
}
/*
* parse a URL that should conform to any HTTP scheme (http/https)
*/
const char *oidc_valid_http_url(apr_pool_t *pool, const char *arg) {
return oidc_valid_url_scheme(pool, arg, "https", "http");
}
#define STR_ERROR_MAX 128
/*
* check if arg is a valid directory on the file system
*/
const char *oidc_valid_dir(apr_pool_t *pool, const char *arg) {
char s_err[STR_ERROR_MAX];
apr_dir_t *dir = NULL;
apr_status_t rc = APR_SUCCESS;
/* ensure the directory exists */
if ((rc = apr_dir_open(&dir, arg, pool)) != APR_SUCCESS) {
return apr_psprintf(pool, "cannot access directory '%s' (%s)", arg,
apr_strerror(rc, s_err, STR_ERROR_MAX));
}
/* and cleanup... */
if ((rc = apr_dir_close(dir)) != APR_SUCCESS) {
return apr_psprintf(pool, "cannot close directory '%s' (%s)", arg,
apr_strerror(rc, s_err, STR_ERROR_MAX));
}
return NULL;
}
/*
* check if arg is a valid cookie domain value
*/
const char *oidc_valid_cookie_domain(apr_pool_t *pool, const char *arg) {
size_t sz, limit;
char d;
limit = strlen(arg);
for (sz = 0; sz < limit; sz++) {
d = arg[sz];
if ((d < '0' || d > '9') && (d < 'a' || d > 'z') && (d < 'A' || d > 'Z')
&& d != '.' && d != '-') {
return (apr_psprintf(pool,
"invalid character '%c' in cookie domain value: %s", d, arg));
}
}
return NULL;
}
/*
* parse an integer value from a string
*/
const char *oidc_parse_int(apr_pool_t *pool, const char *arg, int *int_value) {
char *endptr;
int v = strtol(arg, &endptr, 10);
if ((*arg == '\0') || (*endptr != '\0')) {
return apr_psprintf(pool, "invalid integer value: %s", arg);
}
*int_value = v;
return NULL;
}
/*
* check if the provided integer value is between a specified minimum and maximum
*/
static const char *oidc_valid_int_min_max(apr_pool_t *pool, int value,
int min_value, int max_value) {
if (value < min_value) {
return apr_psprintf(pool,
"integer value %d is smaller than the minimum allowed value %d",
value, min_value);
}
if (value > max_value) {
return apr_psprintf(pool,
"integer value %d is greater than the maximum allowed value %d",
value, max_value);
}
return NULL;
}
/*
* parse an integer and check validity
*/
static const char *oidc_parse_int_valid(apr_pool_t *pool, const char *arg,
int *int_value, oidc_valid_int_function_t valid_int_function) {
int v = 0;
const char *rv = NULL;
rv = oidc_parse_int(pool, arg, &v);
if (rv != NULL)
return rv;
rv = valid_int_function(pool, v);
if (rv != NULL)
return rv;
*int_value = v;
return NULL;
}
/*
* parse an integer value from a string that must be between a specified minimum and maximum
*/
static const char *oidc_parse_int_min_max(apr_pool_t *pool, const char *arg,
int *int_value, int min_value, int max_value) {
int v = 0;
const char *rv = NULL;
rv = oidc_parse_int(pool, arg, &v);
if (rv != NULL)
return rv;
rv = oidc_valid_int_min_max(pool, v, min_value, max_value);
if (rv != NULL)
return rv;
*int_value = v;
return NULL;
}
#define OIDC_LIST_OPTIONS_START "["
#define OIDC_LIST_OPTIONS_END "]"
#define OIDC_LIST_OPTIONS_SEPARATOR "|"
#define OIDC_LIST_OPTIONS_QUOTE "'"
/*
* flatten the list of string options, separated by the specified separator char
*/
static char *oidc_flatten_list_options(apr_pool_t *pool, char *options[]) {
int i = 0;
char *result = OIDC_LIST_OPTIONS_START;
while (options[i] != NULL) {
if (i == 0)
result = apr_psprintf(pool, "%s%s%s%s", OIDC_LIST_OPTIONS_START,
OIDC_LIST_OPTIONS_QUOTE, options[i],
OIDC_LIST_OPTIONS_QUOTE);
else
result = apr_psprintf(pool, "%s%s%s%s%s", result,
OIDC_LIST_OPTIONS_SEPARATOR, OIDC_LIST_OPTIONS_QUOTE, options[i],
OIDC_LIST_OPTIONS_QUOTE);
i++;
}
result = apr_psprintf(pool, "%s%s", result, OIDC_LIST_OPTIONS_END);
return result;
}
/*
* check if arg is a valid option in the list of provided string options
*/
static const char *oidc_valid_string_option(apr_pool_t *pool, const char *arg,
char *options[]) {
int i = 0;
while (options[i] != NULL) {
if (apr_strnatcmp(arg, options[i]) == 0)
break;
i++;
}
if (options[i] == NULL) {
return apr_psprintf(pool, "invalid value %s%s%s, must be one of %s",
OIDC_LIST_OPTIONS_QUOTE, arg, OIDC_LIST_OPTIONS_QUOTE,
oidc_flatten_list_options(pool, options));
}
return NULL;
}
#define OIDC_CACHE_TYPE_SHM "shm"
#define OIDC_CACHE_TYPE_MEMCACHE "memcache"
#define OIDC_CACHE_TYPE_REDIS "redis"
#define OIDC_CACHE_TYPE_FILE "file"
/*
* parse the cache backend type
*/
const char *oidc_parse_cache_type(apr_pool_t *pool, const char *arg,
oidc_cache_t **type) {
static char *options[] = {
OIDC_CACHE_TYPE_SHM,
OIDC_CACHE_TYPE_MEMCACHE,
#ifdef USE_LIBHIREDIS
OIDC_CACHE_TYPE_REDIS,
#endif
OIDC_CACHE_TYPE_FILE,
NULL };
const char *rv = oidc_valid_string_option(pool, arg, options);
if (rv != NULL)
return rv;
if (apr_strnatcmp(arg, OIDC_CACHE_TYPE_SHM) == 0) {
*type = &oidc_cache_shm;
} else if (apr_strnatcmp(arg, OIDC_CACHE_TYPE_MEMCACHE) == 0) {
*type = &oidc_cache_memcache;
} else if (apr_strnatcmp(arg, OIDC_CACHE_TYPE_FILE) == 0) {
*type = &oidc_cache_file;
#ifdef USE_LIBHIREDIS
} else if (apr_strnatcmp(arg, OIDC_CACHE_TYPE_REDIS) == 0) {
*type = &oidc_cache_redis;
#endif
}
return NULL;
}
#define OIDC_SESSION_TYPE_SERVER_CACHE_STR "server-cache"
#define OIDC_SESSION_TYPE_CLIENT_COOKIE_STR "client-cookie"
#define OIDC_SESSION_TYPE_PERSISTENT "persistent"
#define OIDC_SESSION_TYPE_SEPARATOR ":"
/*
* parse the session mechanism type and the cookie persistency property
*/
const char *oidc_parse_session_type(apr_pool_t *pool, const char *arg,
int *type, int *persistent) {
static char *options[] =
{
OIDC_SESSION_TYPE_SERVER_CACHE_STR,
OIDC_SESSION_TYPE_SERVER_CACHE_STR OIDC_SESSION_TYPE_SEPARATOR OIDC_SESSION_TYPE_PERSISTENT,
OIDC_SESSION_TYPE_CLIENT_COOKIE_STR,
OIDC_SESSION_TYPE_CLIENT_COOKIE_STR OIDC_SESSION_TYPE_SEPARATOR OIDC_SESSION_TYPE_PERSISTENT,
NULL };
const char *rv = oidc_valid_string_option(pool, arg, options);
if (rv != NULL)
return rv;
char *s = apr_pstrdup(pool, arg);
char *p = strstr(s, OIDC_SESSION_TYPE_SEPARATOR);
if (p) {
*persistent = 1;
*p = '\0';
}
if (apr_strnatcmp(s, OIDC_SESSION_TYPE_SERVER_CACHE_STR) == 0) {
*type = OIDC_SESSION_TYPE_SERVER_CACHE;
} else if (apr_strnatcmp(s, OIDC_SESSION_TYPE_CLIENT_COOKIE_STR) == 0) {
*type = OIDC_SESSION_TYPE_CLIENT_COOKIE;
}
return NULL;
}
/* minimum size of a SHM cache entry */
#define OIDC_MINIMUM_CACHE_SHM_ENTRY_SIZE_MAX 8192 + 512 + 17 // 8Kb plus overhead
/* maximum size of a SHM cache entry */
#define OIDC_MAXIMUM_CACHE_SHM_ENTRY_SIZE_MAX 1024 * 512 // 512Kb incl. overhead
/*
* parse the slot size of a SHM cache entry
*/
const char *oidc_parse_cache_shm_entry_size_max(apr_pool_t *pool,
const char *arg, int *int_value) {
return oidc_parse_int_min_max(pool, arg, int_value,
OIDC_MINIMUM_CACHE_SHM_ENTRY_SIZE_MAX,
OIDC_MAXIMUM_CACHE_SHM_ENTRY_SIZE_MAX);
}
/*
* parse a boolean value from a provided string
*/
const char *oidc_parse_boolean(apr_pool_t *pool, const char *arg,
int *bool_value) {
if ((apr_strnatcasecmp(arg, "true") == 0)
|| (apr_strnatcasecmp(arg, "on") == 0)
|| (apr_strnatcasecmp(arg, "yes") == 0)
|| (apr_strnatcasecmp(arg, "1") == 0)) {
*bool_value = TRUE;
return NULL;
}
if ((apr_strnatcasecmp(arg, "false") == 0)
|| (apr_strnatcasecmp(arg, "off") == 0)
|| (apr_strnatcasecmp(arg, "no") == 0)
|| (apr_strnatcasecmp(arg, "0") == 0)) {
*bool_value = FALSE;
return NULL;
}
return apr_psprintf(pool,
"oidc_parse_boolean: could not parse boolean value from \"%s\"",
arg);
}
#define OIDC_ENDPOINT_AUTH_CLIENT_SECRET_POST "client_secret_post"
#define OIDC_ENDPOINT_AUTH_CLIENT_SECRET_BASIC "client_secret_basic"
#define OIDC_ENDPOINT_AUTH_CLIENT_SECRET_JWT "client_secret_jwt"
#define OIDC_ENDPOINT_AUTH_PRIVATE_KEY_JWT "private_key_jwt"
#define OIDC_ENDPOINT_AUTH_BEARER_ACCESS_TOKEN "bearer_access_token"
#define OIDC_ENDPOINT_AUTH_NONE "none"
/*
* check if the provided endpoint authentication method is supported
*/
static const char *oidc_valid_endpoint_auth_method_impl(apr_pool_t *pool,
const char *arg, apr_byte_t has_private_key) {
static char *options[] = {
OIDC_ENDPOINT_AUTH_CLIENT_SECRET_POST,
OIDC_ENDPOINT_AUTH_CLIENT_SECRET_BASIC,
OIDC_ENDPOINT_AUTH_CLIENT_SECRET_JWT,
OIDC_ENDPOINT_AUTH_NONE,
OIDC_ENDPOINT_AUTH_BEARER_ACCESS_TOKEN,
NULL,
NULL };
if (has_private_key)
options[5] = OIDC_ENDPOINT_AUTH_PRIVATE_KEY_JWT;
return oidc_valid_string_option(pool, arg, options);
}
const char *oidc_valid_endpoint_auth_method(apr_pool_t *pool, const char *arg) {
return oidc_valid_endpoint_auth_method_impl(pool, arg, TRUE);
}
const char *oidc_valid_endpoint_auth_method_no_private_key(apr_pool_t *pool,
const char *arg) {
return oidc_valid_endpoint_auth_method_impl(pool, arg, FALSE);
}
/*
* check if the provided OAuth/OIDC response type is supported
*/
const char *oidc_valid_response_type(apr_pool_t *pool, const char *arg) {
if (oidc_proto_flow_is_supported(pool, arg) == FALSE) {
return apr_psprintf(pool,
"oidc_valid_response_type: type must be one of %s",
apr_array_pstrcat(pool, oidc_proto_supported_flows(pool),
OIDC_CHAR_PIPE));
}
return NULL;
}
/*
* check if the provided PKCE method is supported
*/
const char *oidc_valid_pkce_method(apr_pool_t *pool, const char *arg) {
static char *options[] = {
OIDC_PKCE_METHOD_PLAIN,
OIDC_PKCE_METHOD_S256,
OIDC_PKCE_METHOD_REFERRED_TB,
NULL };
return oidc_valid_string_option(pool, arg, options);
}
#define OIDC_RESPONSE_TYPE_FRAGMENT "fragment"
#define OIDC_RESPONSE_TYPE_QUERY "query"
#define OIDC_RESPONSE_TYPE_FORM_POST "form_post"
/*
* check if the provided OAuth 2.0 response mode is supported
*/
const char *oidc_valid_response_mode(apr_pool_t *pool, const char *arg) {
static char *options[] = {
OIDC_RESPONSE_TYPE_FRAGMENT,
OIDC_RESPONSE_TYPE_QUERY,
OIDC_RESPONSE_TYPE_FORM_POST,
NULL };
return oidc_valid_string_option(pool, arg, options);
}
/*
* check if the provided JWT signature algorithm is supported
*/
const char *oidc_valid_signed_response_alg(apr_pool_t *pool, const char *arg) {
if (oidc_jose_jws_algorithm_is_supported(pool, arg) == FALSE) {
return apr_psprintf(pool,
"unsupported/invalid signing algorithm '%s'; must be one of [%s]",
arg,
apr_array_pstrcat(pool,
oidc_jose_jws_supported_algorithms(pool),
OIDC_CHAR_PIPE));
}
return NULL;
}
/*
* check if the provided JWT content key encryption algorithm is supported
*/
const char *oidc_valid_encrypted_response_alg(apr_pool_t *pool, const char *arg) {
if (oidc_jose_jwe_algorithm_is_supported(pool, arg) == FALSE) {
return apr_psprintf(pool,
"unsupported/invalid encryption algorithm '%s'; must be one of [%s]",
arg,
apr_array_pstrcat(pool,
oidc_jose_jwe_supported_algorithms(pool),
OIDC_CHAR_PIPE));
}
return NULL;
}
/*
* check if the provided JWT encryption cipher is supported
*/
const char *oidc_valid_encrypted_response_enc(apr_pool_t *pool, const char *arg) {
if (oidc_jose_jwe_encryption_is_supported(pool, arg) == FALSE) {
return apr_psprintf(pool,
"unsupported/invalid encryption type '%s'; must be one of [%s]",
arg,
apr_array_pstrcat(pool,
oidc_jose_jwe_supported_encryptions(pool),
OIDC_CHAR_PIPE));
}
return NULL;
}
#define OIDC_SESSION_INACTIVITY_TIMEOUT_MIN 10
#define OIDC_SESSION_INACTIVITY_TIMEOUT_MAX 3600 * 24 * 365
/*
* parse a session inactivity timeout value from the provided string
*/
const char *oidc_parse_session_inactivity_timeout(apr_pool_t *pool,
const char *arg, int *int_value) {
return oidc_parse_int_min_max(pool, arg, int_value,
OIDC_SESSION_INACTIVITY_TIMEOUT_MIN,
OIDC_SESSION_INACTIVITY_TIMEOUT_MAX);
}
#define OIDC_SESSION_MAX_DURATION_MIN 15
#define OIDC_SESSION_MAX_DURATION_MAX 3600 * 24 * 365
/*
* check the boundaries for session max lifetime
*/
const char *oidc_valid_session_max_duration(apr_pool_t *pool, int v) {
if (v == 0) {
return NULL;
}
if (v < OIDC_SESSION_MAX_DURATION_MIN) {
return apr_psprintf(pool, "value must not be less than %d seconds",
OIDC_SESSION_MAX_DURATION_MIN);
}
if (v > OIDC_SESSION_MAX_DURATION_MAX) {
return apr_psprintf(pool, "value must not be greater than %d seconds",
OIDC_SESSION_MAX_DURATION_MAX);
}
return NULL;
}
/*
* parse a session max duration value from the provided string
*/
const char *oidc_parse_session_max_duration(apr_pool_t *pool, const char *arg,
int *int_value) {
return oidc_parse_int_valid(pool, arg, int_value,
oidc_valid_session_max_duration);
}
/*
* parse a base64 encoded binary value from the provided string
*/
char *oidc_parse_base64(apr_pool_t *pool, const char *input,
char **output, int *output_len) {
int len = apr_base64_decode_len(input);
*output = apr_palloc(pool, len);
*output_len = apr_base64_decode(*output, input);
if (*output_len <= 0)
return apr_psprintf(pool, "base64-decoding of \"%s\" failed", input);
return NULL;
}
/*
* parse a base64url encoded binary value from the provided string
*/
static char *oidc_parse_base64url(apr_pool_t *pool, const char *input,
char **output, int *output_len) {
*output_len = oidc_base64url_decode(pool, output, input);
if (*output_len <= 0)
return apr_psprintf(pool, "base64url-decoding of \"%s\" failed", input);
return NULL;
}
/*
* parse a hexadecimal encoded binary value from the provided string
*/
static char *oidc_parse_hex(apr_pool_t *pool, const char *input, char **output,
int *output_len) {
*output_len = strlen(input) / 2;
const char *pos = input;
unsigned char *val = apr_palloc(pool, *output_len);
size_t count = 0;
for (count = 0; count < (*output_len) / sizeof(unsigned char); count++) {
sscanf(pos, "%2hhx", &val[count]);
pos += 2;
}
*output = (char*) val;
return NULL;
}
#define OIDC_KEY_ENCODING_BASE64 "b64"
#define OIDC_KEY_ENCODING_BASE64_URL "b64url"
#define OIDC_KEY_ENCODING_HEX "hex"
#define OIDC_KEY_ENCODING_PLAIN "plain"
/*
* parse a key value based on the provided encoding: b64|b64url|hex|plain
*/
static const char *oidc_parse_key_value(apr_pool_t *pool, const char *enc,
const char *input, char **key, int *key_len) {
static char *options[] = {
OIDC_KEY_ENCODING_BASE64,
OIDC_KEY_ENCODING_BASE64_URL,
OIDC_KEY_ENCODING_HEX,
OIDC_KEY_ENCODING_PLAIN,
NULL };
const char *rv = oidc_valid_string_option(pool, enc, options);
if (rv != NULL)
return rv;
if (apr_strnatcmp(enc, OIDC_KEY_ENCODING_BASE64) == 0)
return oidc_parse_base64(pool, input, key, key_len);
if (apr_strnatcmp(enc, OIDC_KEY_ENCODING_BASE64_URL) == 0)
return oidc_parse_base64url(pool, input, key, key_len);
if (apr_strnatcmp(enc, OIDC_KEY_ENCODING_HEX) == 0)
return oidc_parse_hex(pool, input, key, key_len);
if (apr_strnatcmp(enc, OIDC_KEY_ENCODING_PLAIN) == 0) {
*key = apr_pstrdup(pool, input);
*key_len = strlen(*key);
}
return NULL;
}
#define OIDC_KEY_TUPLE_SEPARATOR "#"
/*
* parse a <encoding>#<key-identifier>#<key> tuple
*/
const char *oidc_parse_enc_kid_key_tuple(apr_pool_t *pool, const char *tuple,
char **kid, char **key, int *key_len, apr_byte_t triplet) {
const char *rv = NULL;
char *s = NULL, *p = NULL, *q = NULL, *enc = NULL;
if ((tuple == NULL) || (apr_strnatcmp(tuple, "") == 0))
return "tuple value not set";
s = apr_pstrdup(pool, tuple);
p = strstr(s, OIDC_KEY_TUPLE_SEPARATOR);
if (p && triplet)
q = strstr(p + 1, OIDC_KEY_TUPLE_SEPARATOR);
if (p) {
if (q) {
*p = '\0';
*q = '\0';
enc = s;
p++;
if (p != q)
*kid = apr_pstrdup(pool, p);
rv = oidc_parse_key_value(pool, enc, q + 1, key, key_len);
} else {
*p = '\0';
*kid = s;
*key = p + 1;
*key_len = strlen(*key);
}
} else {
*kid = NULL;
*key = s;
*key_len = strlen(*key);
}
return rv;
}
#define OIDC_PASS_ID_TOKEN_AS_CLAIMS_STR "claims"
#define OIDC_PASS_IDTOKEN_AS_PAYLOAD_STR "payload"
#define OIDC_PASS_IDTOKEN_AS_SERIALIZED_STR "serialized"
/*
* convert a "pass id token as" value to an integer
*/
static int oidc_parse_pass_idtoken_as_str2int(const char *v) {
if (apr_strnatcmp(v, OIDC_PASS_ID_TOKEN_AS_CLAIMS_STR) == 0)
return OIDC_PASS_IDTOKEN_AS_CLAIMS;
if (apr_strnatcmp(v, OIDC_PASS_IDTOKEN_AS_PAYLOAD_STR) == 0)
return OIDC_PASS_IDTOKEN_AS_PAYLOAD;
if (apr_strnatcmp(v, OIDC_PASS_IDTOKEN_AS_SERIALIZED_STR) == 0)
return OIDC_PASS_IDTOKEN_AS_SERIALIZED;
return -1;
}
/*
* parse a "pass id token as" value from the provided strings
*/
const char *oidc_parse_pass_idtoken_as(apr_pool_t *pool, const char *v1,
const char *v2, const char *v3, int *int_value) {
static char *options[] = {
OIDC_PASS_ID_TOKEN_AS_CLAIMS_STR,
OIDC_PASS_IDTOKEN_AS_PAYLOAD_STR,
OIDC_PASS_IDTOKEN_AS_SERIALIZED_STR,
NULL };
const char *rv = NULL;
rv = oidc_valid_string_option(pool, v1, options);
if (rv != NULL)
return rv;
*int_value = oidc_parse_pass_idtoken_as_str2int(v1);
if (v2 == NULL)
return NULL;
rv = oidc_valid_string_option(pool, v2, options);
if (rv != NULL)
return rv;
*int_value |= oidc_parse_pass_idtoken_as_str2int(v2);
if (v3 == NULL)
return NULL;
rv = oidc_valid_string_option(pool, v3, options);
if (rv != NULL)
return rv;
*int_value |= oidc_parse_pass_idtoken_as_str2int(v3);
return NULL;
}
#define OIDC_PASS_USERINFO_AS_CLAIMS_STR "claims"
#define OIDC_PASS_USERINFO_AS_JSON_OBJECT_STR "json"
#define OIDC_PASS_USERINFO_AS_JWT_STR "jwt"
/*
* convert a "pass userinfo as" value to an integer
*/
static int oidc_parse_pass_userinfo_as_str2int(const char *v) {
if (apr_strnatcmp(v, OIDC_PASS_USERINFO_AS_CLAIMS_STR) == 0)
return OIDC_PASS_USERINFO_AS_CLAIMS;
if (apr_strnatcmp(v, OIDC_PASS_USERINFO_AS_JSON_OBJECT_STR) == 0)
return OIDC_PASS_USERINFO_AS_JSON_OBJECT;
if (apr_strnatcmp(v, OIDC_PASS_USERINFO_AS_JWT_STR) == 0)
return OIDC_PASS_USERINFO_AS_JWT;
return -1;
}
/*
* parse a "pass id token as" value from the provided strings
*/
const char *oidc_parse_pass_userinfo_as(apr_pool_t *pool, const char *v1,
const char *v2, const char *v3, int *int_value) {
static char *options[] = {
OIDC_PASS_USERINFO_AS_CLAIMS_STR,
OIDC_PASS_USERINFO_AS_JSON_OBJECT_STR,
OIDC_PASS_USERINFO_AS_JWT_STR,
NULL };
const char *rv = NULL;
rv = oidc_valid_string_option(pool, v1, options);
if (rv != NULL)
return rv;
*int_value = oidc_parse_pass_userinfo_as_str2int(v1);
if (v2 == NULL)
return NULL;
rv = oidc_valid_string_option(pool, v2, options);
if (rv != NULL)
return rv;
*int_value |= oidc_parse_pass_userinfo_as_str2int(v2);
if (v3 == NULL)
return NULL;
rv = oidc_valid_string_option(pool, v3, options);
if (rv != NULL)
return rv;
*int_value |= oidc_parse_pass_userinfo_as_str2int(v3);
return NULL;
}
#define OIDC_OAUTH_ACCEPT_TOKEN_IN_HEADER_STR "header"
#define OIDC_OAUTH_ACCEPT_TOKEN_IN_POST_STR "post"
#define OIDC_OAUTH_ACCEPT_TOKEN_IN_QUERY_STR "query"
#define OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE_STR "cookie"
#define OIDC_OAUTH_ACCEPT_TOKEN_IN_BASIC_STR "basic"
/*
* convert an "accept OAuth 2.0 token in" byte value to a string representation
*/
const char *oidc_accept_oauth_token_in2str(apr_pool_t *pool, apr_byte_t v) {
static char *options[] = { NULL, NULL, NULL, NULL, NULL };
int i = 0;
if (v & OIDC_OAUTH_ACCEPT_TOKEN_IN_HEADER) {
options[i] = OIDC_OAUTH_ACCEPT_TOKEN_IN_HEADER_STR;
i++;
}
if (v & OIDC_OAUTH_ACCEPT_TOKEN_IN_POST) {
options[i] = OIDC_OAUTH_ACCEPT_TOKEN_IN_POST_STR;
i++;
}
if (v & OIDC_OAUTH_ACCEPT_TOKEN_IN_QUERY) {
options[i] = OIDC_OAUTH_ACCEPT_TOKEN_IN_QUERY_STR;
i++;
}
if (v & OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE) {
options[i] = OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE_STR;
i++;
}
if (v & OIDC_OAUTH_ACCEPT_TOKEN_IN_BASIC) {
options[i] = OIDC_OAUTH_ACCEPT_TOKEN_IN_BASIC_STR;
i++;
}
return oidc_flatten_list_options(pool, options);
}
/*
* convert an "accept OAuth 2.0 token in" value to an integer
*/
static apr_byte_t oidc_parse_oauth_accept_token_in_str2byte(const char *v) {
if (apr_strnatcmp(v, OIDC_OAUTH_ACCEPT_TOKEN_IN_HEADER_STR) == 0)
return OIDC_OAUTH_ACCEPT_TOKEN_IN_HEADER;
if (apr_strnatcmp(v, OIDC_OAUTH_ACCEPT_TOKEN_IN_POST_STR) == 0)
return OIDC_OAUTH_ACCEPT_TOKEN_IN_POST;
if (apr_strnatcmp(v, OIDC_OAUTH_ACCEPT_TOKEN_IN_QUERY_STR) == 0)
return OIDC_OAUTH_ACCEPT_TOKEN_IN_QUERY;
if (strstr(v, OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE_STR) == v)
return OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE;
if (strstr(v, OIDC_OAUTH_ACCEPT_TOKEN_IN_BASIC_STR) == v)
return OIDC_OAUTH_ACCEPT_TOKEN_IN_BASIC;
return OIDC_OAUTH_ACCEPT_TOKEN_IN_DEFAULT;
}
#define OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE_NAME_DEFAULT "PA.global"
#define OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE_SEPARATOR ":"
/*
* parse an "accept OAuth 2.0 token in" value from the provided string
*/
const char *oidc_parse_accept_oauth_token_in(apr_pool_t *pool, const char *arg,
int *b_value, apr_hash_t *list_options) {
static char *options[] = {
OIDC_OAUTH_ACCEPT_TOKEN_IN_HEADER_STR,
OIDC_OAUTH_ACCEPT_TOKEN_IN_POST_STR,
OIDC_OAUTH_ACCEPT_TOKEN_IN_QUERY_STR,
OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE_STR,
OIDC_OAUTH_ACCEPT_TOKEN_IN_BASIC_STR,
NULL };
const char *rv = NULL;
const char *s = apr_pstrdup(pool, arg);
char *p = strstr(s, OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE_SEPARATOR);
if (p != NULL) {
*p = '\0';
p++;
} else {
p = OIDC_OAUTH_ACCEPT_TOKEN_IN_COOKIE_NAME_DEFAULT;
}
apr_hash_set(list_options, OIDC_OAUTH_ACCEPT_TOKEN_IN_OPTION_COOKIE_NAME,
APR_HASH_KEY_STRING, p);
rv = oidc_valid_string_option(pool, s, options);
if (rv != NULL)
return rv;
int v = oidc_parse_oauth_accept_token_in_str2byte(s);
if (*b_value == OIDC_CONFIG_POS_INT_UNSET)
*b_value = v;
else
*b_value |= v;
return NULL;
}
/*
* check if the specified string is a valid claim formatting configuration value
*/
const char *oidc_valid_claim_format(apr_pool_t *pool, const char *arg) {
static char *options[] = {
OIDC_CLAIM_FORMAT_RELATIVE,
OIDC_CLAIM_FORMAT_ABSOLUTE,
NULL };
return oidc_valid_string_option(pool, arg, options);
}
/*
* parse a "claim required" value from the provided string
*/
const char *oidc_parse_claim_required(apr_pool_t *pool, const char *arg,
int *is_required) {
static char *options[] = {
OIDC_CLAIM_REQUIRED_MANDATORY,
OIDC_CLAIM_REQUIRED_OPTIONAL,
NULL };
const char *rv = oidc_valid_string_option(pool, arg, options);
if (rv != NULL)
return rv;
*is_required = (apr_strnatcmp(arg, OIDC_CLAIM_REQUIRED_MANDATORY) == 0);
return NULL;
}
/*
* check if the provided string is a valid HTTP method for the OAuth token introspection endpoint
*/
const char *oidc_valid_introspection_method(apr_pool_t *pool, const char *arg) {
static char *options[] = {
OIDC_INTROSPECTION_METHOD_GET,
OIDC_INTROSPECTION_METHOD_POST,
NULL };
return oidc_valid_string_option(pool, arg, options);
}
#define OIDC_PASS_CLAIMS_AS_BOTH "both"
#define OIDC_PASS_CLAIMS_AS_HEADERS "headers"
#define OIDC_PASS_CLAIMS_AS_ENV "environment"
#define OIDC_PASS_CLAIMS_AS_NONE "none"
/*
* parse a "set claims as" value from the provided string
*/
const char *oidc_parse_set_claims_as(apr_pool_t *pool, const char *arg,
int *in_headers, int *in_env_vars) {
static char *options[] = {
OIDC_PASS_CLAIMS_AS_BOTH,
OIDC_PASS_CLAIMS_AS_HEADERS,
OIDC_PASS_CLAIMS_AS_ENV,
OIDC_PASS_CLAIMS_AS_NONE,
NULL };
const char *rv = oidc_valid_string_option(pool, arg, options);
if (rv != NULL)
return rv;
if (apr_strnatcmp(arg, OIDC_PASS_CLAIMS_AS_BOTH) == 0) {
*in_headers = 1;
*in_env_vars = 1;
} else if (apr_strnatcmp(arg, OIDC_PASS_CLAIMS_AS_HEADERS) == 0) {
*in_headers = 1;
*in_env_vars = 0;
} else if (apr_strnatcmp(arg, OIDC_PASS_CLAIMS_AS_ENV) == 0) {
*in_headers = 0;
*in_env_vars = 1;
} else if (apr_strnatcmp(arg, OIDC_PASS_CLAIMS_AS_NONE) == 0) {
*in_headers = 0;
*in_env_vars = 0;
}
return NULL;
}
#define OIDC_UNAUTH_ACTION_AUTH_STR "auth"
#define OIDC_UNAUTH_ACTION_PASS_STR "pass"
#define OIDC_UNAUTH_ACTION_401_STR "401"
#define OIDC_UNAUTH_ACTION_410_STR "410"
/*
* parse an "unauthenticated action" value from the provided string
*/
const char *oidc_parse_unauth_action(apr_pool_t *pool, const char *arg,
int *action) {
static char *options[] = {
OIDC_UNAUTH_ACTION_AUTH_STR,
OIDC_UNAUTH_ACTION_PASS_STR,
OIDC_UNAUTH_ACTION_401_STR,
OIDC_UNAUTH_ACTION_410_STR,
NULL };
const char *rv = oidc_valid_string_option(pool, arg, options);
if (rv != NULL)
return rv;
if (apr_strnatcmp(arg, OIDC_UNAUTH_ACTION_AUTH_STR) == 0)
*action = OIDC_UNAUTH_AUTHENTICATE;
else if (apr_strnatcmp(arg, OIDC_UNAUTH_ACTION_PASS_STR) == 0)
*action = OIDC_UNAUTH_PASS;
else if (apr_strnatcmp(arg, OIDC_UNAUTH_ACTION_401_STR) == 0)
*action = OIDC_UNAUTH_RETURN401;
else if (apr_strnatcmp(arg, OIDC_UNAUTH_ACTION_410_STR) == 0)
*action = OIDC_UNAUTH_RETURN410;
return NULL;
}
#define OIDC_UNAUTZ_ACTION_AUTH_STR "auth"
#define OIDC_UNAUTZ_ACTION_401_STR "401"
#define OIDC_UNAUTZ_ACTION_403_STR "403"
/*
* parse an "unauthorized action" value from the provided string
*/
const char *oidc_parse_unautz_action(apr_pool_t *pool, const char *arg,
int *action) {
static char *options[] = {
OIDC_UNAUTZ_ACTION_AUTH_STR,
OIDC_UNAUTZ_ACTION_401_STR,
OIDC_UNAUTZ_ACTION_403_STR,
NULL };
const char *rv = oidc_valid_string_option(pool, arg, options);
if (rv != NULL)
return rv;
if (apr_strnatcmp(arg, OIDC_UNAUTZ_ACTION_AUTH_STR) == 0)
*action = OIDC_UNAUTZ_AUTHENTICATE;
else if (apr_strnatcmp(arg, OIDC_UNAUTZ_ACTION_401_STR) == 0)
*action = OIDC_UNAUTZ_RETURN401;
else if (apr_strnatcmp(arg, OIDC_UNAUTZ_ACTION_403_STR) == 0)
*action = OIDC_UNAUTZ_RETURN403;
return NULL;
}
/*
* check if there's one valid entry in a string of arrays
*/
const char *oidc_valid_string_in_array(apr_pool_t *pool, json_t *json,
const char *key, oidc_valid_function_t valid_function, char **value,
apr_byte_t optional) {
int i = 0;
json_t *json_arr = json_object_get(json, key);
if ((json_arr != NULL) && (json_is_array(json_arr))) {
for (i = 0; i < json_array_size(json_arr); i++) {
json_t *elem = json_array_get(json_arr, i);
if (!json_is_string(elem)) {
return apr_psprintf(pool,
"unhandled in-array JSON non-string object type [%d]",
elem->type);
continue;
}
if (valid_function(pool, json_string_value(elem)) == NULL) {
if (value != NULL)
*value = apr_pstrdup(pool, json_string_value(elem));
break;
}
}
if (i == json_array_size(json_arr)) {
return apr_psprintf(pool,
"could not find a valid array string element for entry \"%s\"",
key);
}
} else if (optional == FALSE) {
return apr_psprintf(pool, "JSON object did not contain a \"%s\" array",
key);
}
return NULL;
}
#define OIDC_JWKS_REFRESH_INTERVAL_MIN 300
#define OIDC_JWKS_REFRESH_INTERVAL_MAX 3600 * 24 * 365
/*
* check the boundaries for JWKs refresh interval
*/
const char *oidc_valid_jwks_refresh_interval(apr_pool_t *pool, int v) {
return oidc_valid_int_min_max(pool, v, OIDC_JWKS_REFRESH_INTERVAL_MIN,
OIDC_JWKS_REFRESH_INTERVAL_MAX);
}
/*
* parse a JWKs refresh interval from the provided string
*/
const char *oidc_parse_jwks_refresh_interval(apr_pool_t *pool, const char *arg,
int *int_value) {
return oidc_parse_int_valid(pool, arg, int_value,
oidc_valid_jwks_refresh_interval);
}
#define OIDC_IDTOKEN_IAT_SLACK_MIN 0
#define OIDC_IDTOKEN_IAT_SLACK_MAX 3600
/*
* check the boundaries for ID token "issued-at" (iat) timestamp slack
*/
const char *oidc_valid_idtoken_iat_slack(apr_pool_t *pool, int v) {
return oidc_valid_int_min_max(pool, v, OIDC_IDTOKEN_IAT_SLACK_MIN,
OIDC_IDTOKEN_IAT_SLACK_MAX);
}
/*
* parse an ID token "iat" slack interval
*/
const char *oidc_parse_idtoken_iat_slack(apr_pool_t *pool, const char *arg,
int *int_value) {
return oidc_parse_int_valid(pool, arg, int_value,
oidc_valid_idtoken_iat_slack);
}
#define OIDC_USERINFO_REFRESH_INTERVAL_MIN 0
#define OIDC_USERINFO_REFRESH_INTERVAL_MAX 3600 * 24 * 365
/*
* check the boundaries for the userinfo refresh interval
*/
const char *oidc_valid_userinfo_refresh_interval(apr_pool_t *pool, int v) {
return oidc_valid_int_min_max(pool, v, OIDC_USERINFO_REFRESH_INTERVAL_MIN,
OIDC_USERINFO_REFRESH_INTERVAL_MAX);
}
/*
* parse a userinfo refresh interval from the provided string
*/
const char *oidc_parse_userinfo_refresh_interval(apr_pool_t *pool,
const char *arg, int *int_value) {
return oidc_parse_int_valid(pool, arg, int_value,
oidc_valid_userinfo_refresh_interval);
}
#define OIDC_USER_INFO_TOKEN_METHOD_HEADER_STR "authz_header"
#define OIDC_USER_INFO_TOKEN_METHOD_POST_STR "post_param"
/*
* check if the provided string is a valid userinfo token presentation method
*/
const char *oidc_valid_userinfo_token_method(apr_pool_t *pool, const char *arg) {
static char *options[] = {
OIDC_USER_INFO_TOKEN_METHOD_HEADER_STR,
OIDC_USER_INFO_TOKEN_METHOD_POST_STR,
NULL };
return oidc_valid_string_option(pool, arg, options);
}
/*
* parse a userinfo token method string value to an integer
*/
const char *oidc_parse_userinfo_token_method(apr_pool_t *pool, const char *arg,
int *int_value) {
const char *rv = oidc_valid_userinfo_token_method(pool, arg);
if (rv != NULL)
return rv;
if (apr_strnatcmp(arg, OIDC_USER_INFO_TOKEN_METHOD_HEADER_STR) == 0)
*int_value = OIDC_USER_INFO_TOKEN_METHOD_HEADER;
if (apr_strnatcmp(arg, OIDC_USER_INFO_TOKEN_METHOD_POST_STR) == 0)
*int_value = OIDC_USER_INFO_TOKEN_METHOD_POST;
return NULL;
}
/*
* parse an "info hook data" value from the provided string
*/
const char *oidc_parse_info_hook_data(apr_pool_t *pool, const char *arg,
apr_hash_t **hook_data) {
static char *options[] = {
OIDC_HOOK_INFO_TIMESTAMP,
OIDC_HOOK_INFO_ACCES_TOKEN,
OIDC_HOOK_INFO_ACCES_TOKEN_EXP,
OIDC_HOOK_INFO_ID_TOKEN,
OIDC_HOOK_INFO_USER_INFO,
OIDC_HOOK_INFO_REFRESH_TOKEN,
OIDC_HOOK_INFO_SESSION,
NULL };
const char *rv = oidc_valid_string_option(pool, arg, options);
if (rv != NULL)
return rv;
if (*hook_data == NULL)
*hook_data = apr_hash_make(pool);
apr_hash_set(*hook_data, arg, APR_HASH_KEY_STRING, arg);
return NULL;
}
#define OIDC_TOKEN_BINDING_POLICY_DISABLED_STR "disabled"
#define OIDC_TOKEN_BINDING_POLICY_OPTIONAL_STR "optional"
#define OIDC_TOKEN_BINDING_POLICY_REQUIRED_STR "required"
#define OIDC_TOKEN_BINDING_POLICY_ENFORCED_STR "enforced"
const char *oidc_token_binding_policy2str(apr_pool_t *pool, int v) {
if (v == OIDC_TOKEN_BINDING_POLICY_DISABLED)
return OIDC_TOKEN_BINDING_POLICY_DISABLED;
if (v == OIDC_TOKEN_BINDING_POLICY_OPTIONAL)
return OIDC_TOKEN_BINDING_POLICY_OPTIONAL_STR;
if (v == OIDC_TOKEN_BINDING_POLICY_REQUIRED)
return OIDC_TOKEN_BINDING_POLICY_REQUIRED_STR;
if (v == OIDC_TOKEN_BINDING_POLICY_ENFORCED)
return OIDC_TOKEN_BINDING_POLICY_ENFORCED_STR;
return NULL;
}
/*
* check token binding policy string value
*/
const char *oidc_valid_token_binding_policy(apr_pool_t *pool, const char *arg) {
static char *options[] = {
OIDC_TOKEN_BINDING_POLICY_DISABLED_STR,
OIDC_TOKEN_BINDING_POLICY_OPTIONAL_STR,
OIDC_TOKEN_BINDING_POLICY_REQUIRED_STR,
OIDC_TOKEN_BINDING_POLICY_ENFORCED_STR,
NULL };
return oidc_valid_string_option(pool, arg, options);
}
/*
* parse token binding policy
*/
const char *oidc_parse_token_binding_policy(apr_pool_t *pool, const char *arg,
int *policy) {
const char *rv = oidc_valid_token_binding_policy(pool, arg);
if (rv != NULL)
return rv;
if (apr_strnatcmp(arg, OIDC_TOKEN_BINDING_POLICY_DISABLED_STR) == 0)
*policy = OIDC_TOKEN_BINDING_POLICY_DISABLED;
else if (apr_strnatcmp(arg, OIDC_TOKEN_BINDING_POLICY_OPTIONAL_STR) == 0)
*policy = OIDC_TOKEN_BINDING_POLICY_OPTIONAL;
else if (apr_strnatcmp(arg, OIDC_TOKEN_BINDING_POLICY_REQUIRED_STR) == 0)
*policy = OIDC_TOKEN_BINDING_POLICY_REQUIRED;
else if (apr_strnatcmp(arg, OIDC_TOKEN_BINDING_POLICY_ENFORCED_STR) == 0)
*policy = OIDC_TOKEN_BINDING_POLICY_ENFORCED;
return NULL;
}
#define OIDC_AUTH_REQUEST_METHOD_GET_STR "GET"
#define OIDC_AUTH_REQEUST_METHOD_POST_STR "POST"
/*
* parse method for sending the authentication request
*/
const char *oidc_valid_auth_request_method(apr_pool_t *pool, const char *arg) {
static char *options[] = {
OIDC_AUTH_REQUEST_METHOD_GET_STR,
OIDC_AUTH_REQEUST_METHOD_POST_STR,
NULL };
return oidc_valid_string_option(pool, arg, options);
}
/*
* parse method for sending the authentication request
*/
const char *oidc_parse_auth_request_method(apr_pool_t *pool, const char *arg,
int *method) {
const char *rv = oidc_valid_auth_request_method(pool, arg);
if (rv != NULL)
return rv;
if (apr_strnatcmp(arg, OIDC_AUTH_REQUEST_METHOD_GET_STR) == 0)
*method = OIDC_AUTH_REQUEST_METHOD_GET;
else if (apr_strnatcmp(arg, OIDC_AUTH_REQEUST_METHOD_POST_STR) == 0)
*method = OIDC_AUTH_REQUEST_METHOD_POST;
return NULL;
}
| 30.149877 | 97 | 0.734958 | [
"object"
] |
9d3c9d4fad7cae4fae18b4205c5b9a58eebc925c | 107,917 | c | C | exercises/ex08/glib-2.60.0/_build/gio/tests/gdbus-object-manager-example/objectmanager-gen.c | Athmika/ExercisesInC | 19ccc846debd8588340a3d39d828ded05407295f | [
"MIT"
] | null | null | null | exercises/ex08/glib-2.60.0/_build/gio/tests/gdbus-object-manager-example/objectmanager-gen.c | Athmika/ExercisesInC | 19ccc846debd8588340a3d39d828ded05407295f | [
"MIT"
] | null | null | null | exercises/ex08/glib-2.60.0/_build/gio/tests/gdbus-object-manager-example/objectmanager-gen.c | Athmika/ExercisesInC | 19ccc846debd8588340a3d39d828ded05407295f | [
"MIT"
] | null | null | null | /*
* Generated by gdbus-codegen 2.60.0 from gdbus-example-objectmanager.xml. DO NOT EDIT.
*
* The license of this code is the same as for the D-Bus interface description
* it was derived from.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "objectmanager-gen.h"
#include <string.h>
#ifdef G_OS_UNIX
# include <gio/gunixfdlist.h>
#endif
typedef struct
{
GDBusArgInfo parent_struct;
gboolean use_gvariant;
} _ExtendedGDBusArgInfo;
typedef struct
{
GDBusMethodInfo parent_struct;
const gchar *signal_name;
gboolean pass_fdlist;
} _ExtendedGDBusMethodInfo;
typedef struct
{
GDBusSignalInfo parent_struct;
const gchar *signal_name;
} _ExtendedGDBusSignalInfo;
typedef struct
{
GDBusPropertyInfo parent_struct;
const gchar *hyphen_name;
guint use_gvariant : 1;
guint emits_changed_signal : 1;
} _ExtendedGDBusPropertyInfo;
typedef struct
{
GDBusInterfaceInfo parent_struct;
const gchar *hyphen_name;
} _ExtendedGDBusInterfaceInfo;
typedef struct
{
const _ExtendedGDBusPropertyInfo *info;
guint prop_id;
GValue orig_value; /* the value before the change */
} ChangedProperty;
static void
_changed_property_free (ChangedProperty *data)
{
g_value_unset (&data->orig_value);
g_free (data);
}
static gboolean
_g_strv_equal0 (gchar **a, gchar **b)
{
gboolean ret = FALSE;
guint n;
if (a == NULL && b == NULL)
{
ret = TRUE;
goto out;
}
if (a == NULL || b == NULL)
goto out;
if (g_strv_length (a) != g_strv_length (b))
goto out;
for (n = 0; a[n] != NULL; n++)
if (g_strcmp0 (a[n], b[n]) != 0)
goto out;
ret = TRUE;
out:
return ret;
}
static gboolean
_g_variant_equal0 (GVariant *a, GVariant *b)
{
gboolean ret = FALSE;
if (a == NULL && b == NULL)
{
ret = TRUE;
goto out;
}
if (a == NULL || b == NULL)
goto out;
ret = g_variant_equal (a, b);
out:
return ret;
}
G_GNUC_UNUSED static gboolean
_g_value_equal (const GValue *a, const GValue *b)
{
gboolean ret = FALSE;
g_assert (G_VALUE_TYPE (a) == G_VALUE_TYPE (b));
switch (G_VALUE_TYPE (a))
{
case G_TYPE_BOOLEAN:
ret = (g_value_get_boolean (a) == g_value_get_boolean (b));
break;
case G_TYPE_UCHAR:
ret = (g_value_get_uchar (a) == g_value_get_uchar (b));
break;
case G_TYPE_INT:
ret = (g_value_get_int (a) == g_value_get_int (b));
break;
case G_TYPE_UINT:
ret = (g_value_get_uint (a) == g_value_get_uint (b));
break;
case G_TYPE_INT64:
ret = (g_value_get_int64 (a) == g_value_get_int64 (b));
break;
case G_TYPE_UINT64:
ret = (g_value_get_uint64 (a) == g_value_get_uint64 (b));
break;
case G_TYPE_DOUBLE:
{
/* Avoid -Wfloat-equal warnings by doing a direct bit compare */
gdouble da = g_value_get_double (a);
gdouble db = g_value_get_double (b);
ret = memcmp (&da, &db, sizeof (gdouble)) == 0;
}
break;
case G_TYPE_STRING:
ret = (g_strcmp0 (g_value_get_string (a), g_value_get_string (b)) == 0);
break;
case G_TYPE_VARIANT:
ret = _g_variant_equal0 (g_value_get_variant (a), g_value_get_variant (b));
break;
default:
if (G_VALUE_TYPE (a) == G_TYPE_STRV)
ret = _g_strv_equal0 (g_value_get_boxed (a), g_value_get_boxed (b));
else
g_critical ("_g_value_equal() does not handle type %s", g_type_name (G_VALUE_TYPE (a)));
break;
}
return ret;
}
/* ------------------------------------------------------------------------
* Code for interface org.gtk.GDBus.Example.ObjectManager.Animal
* ------------------------------------------------------------------------
*/
/**
* SECTION:ExampleAnimal
* @title: ExampleAnimal
* @short_description: Generated C code for the org.gtk.GDBus.Example.ObjectManager.Animal D-Bus interface
*
* This section contains code for working with the <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link> D-Bus interface in C.
*/
/* ---- Introspection data for org.gtk.GDBus.Example.ObjectManager.Animal ---- */
static const _ExtendedGDBusArgInfo _example_animal_method_info_poke_IN_ARG_make_sad =
{
{
-1,
(gchar *) "make_sad",
(gchar *) "b",
NULL
},
FALSE
};
static const _ExtendedGDBusArgInfo _example_animal_method_info_poke_IN_ARG_make_happy =
{
{
-1,
(gchar *) "make_happy",
(gchar *) "b",
NULL
},
FALSE
};
static const GDBusArgInfo * const _example_animal_method_info_poke_IN_ARG_pointers[] =
{
&_example_animal_method_info_poke_IN_ARG_make_sad.parent_struct,
&_example_animal_method_info_poke_IN_ARG_make_happy.parent_struct,
NULL
};
static const _ExtendedGDBusMethodInfo _example_animal_method_info_poke =
{
{
-1,
(gchar *) "Poke",
(GDBusArgInfo **) &_example_animal_method_info_poke_IN_ARG_pointers,
NULL,
NULL
},
"handle-poke",
FALSE
};
static const GDBusMethodInfo * const _example_animal_method_info_pointers[] =
{
&_example_animal_method_info_poke.parent_struct,
NULL
};
static const _ExtendedGDBusArgInfo _example_animal_signal_info_jumped_ARG_height =
{
{
-1,
(gchar *) "height",
(gchar *) "d",
NULL
},
FALSE
};
static const GDBusArgInfo * const _example_animal_signal_info_jumped_ARG_pointers[] =
{
&_example_animal_signal_info_jumped_ARG_height.parent_struct,
NULL
};
static const _ExtendedGDBusSignalInfo _example_animal_signal_info_jumped =
{
{
-1,
(gchar *) "Jumped",
(GDBusArgInfo **) &_example_animal_signal_info_jumped_ARG_pointers,
NULL
},
"jumped"
};
static const GDBusSignalInfo * const _example_animal_signal_info_pointers[] =
{
&_example_animal_signal_info_jumped.parent_struct,
NULL
};
static const _ExtendedGDBusPropertyInfo _example_animal_property_info_mood =
{
{
-1,
(gchar *) "Mood",
(gchar *) "s",
G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
NULL
},
"mood",
FALSE,
TRUE
};
static const _ExtendedGDBusPropertyInfo _example_animal_property_info_foo =
{
{
-1,
(gchar *) "Foo",
(gchar *) "s",
G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
NULL
},
"foo",
FALSE,
TRUE
};
static const _ExtendedGDBusPropertyInfo _example_animal_property_info_bar =
{
{
-1,
(gchar *) "Bar",
(gchar *) "s",
G_DBUS_PROPERTY_INFO_FLAGS_READABLE,
NULL
},
"bar",
FALSE,
TRUE
};
static const GDBusPropertyInfo * const _example_animal_property_info_pointers[] =
{
&_example_animal_property_info_mood.parent_struct,
&_example_animal_property_info_foo.parent_struct,
&_example_animal_property_info_bar.parent_struct,
NULL
};
static const _ExtendedGDBusInterfaceInfo _example_animal_interface_info =
{
{
-1,
(gchar *) "org.gtk.GDBus.Example.ObjectManager.Animal",
(GDBusMethodInfo **) &_example_animal_method_info_pointers,
(GDBusSignalInfo **) &_example_animal_signal_info_pointers,
(GDBusPropertyInfo **) &_example_animal_property_info_pointers,
NULL
},
"animal",
};
/**
* example_animal_interface_info:
*
* Gets a machine-readable description of the <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link> D-Bus interface.
*
* Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
*
* Since: 2.30
*/
GDBusInterfaceInfo *
example_animal_interface_info (void)
{
return (GDBusInterfaceInfo *) &_example_animal_interface_info.parent_struct;
}
/**
* example_animal_override_properties:
* @klass: The class structure for a #GObject derived class.
* @property_id_begin: The property id to assign to the first overridden property.
*
* Overrides all #GObject properties in the #ExampleAnimal interface for a concrete class.
* The properties are overridden in the order they are defined.
*
* Returns: The last property id.
*
* Since: 2.30
*/
guint
example_animal_override_properties (GObjectClass *klass, guint property_id_begin)
{
g_object_class_override_property (klass, property_id_begin++, "mood");
g_object_class_override_property (klass, property_id_begin++, "foo");
g_object_class_override_property (klass, property_id_begin++, "bar");
return property_id_begin - 1;
}
/**
* ExampleAnimal:
*
* Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link>.
*
* Since: 2.30
*/
/**
* ExampleAnimalIface:
* @parent_iface: The parent interface.
* @handle_poke: Handler for the #ExampleAnimal::handle-poke signal.
* @get_foo: Getter for the #ExampleAnimal:foo property.
* @get_mood: Getter for the #ExampleAnimal:mood property.
* @jumped: Handler for the #ExampleAnimal::jumped signal.
* @get_bar: Getter for the #ExampleAnimal:bar property.
*
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link>.
*
* Since: 2.30
*/
typedef ExampleAnimalIface ExampleAnimalInterface;
G_DEFINE_INTERFACE (ExampleAnimal, example_animal, G_TYPE_OBJECT)
static void
example_animal_default_init (ExampleAnimalIface *iface)
{
/* GObject signals for incoming D-Bus method calls: */
/**
* ExampleAnimal::handle-poke:
* @object: A #ExampleAnimal.
* @invocation: A #GDBusMethodInvocation.
* @arg_make_sad: Argument passed by remote caller.
* @arg_make_happy: Argument passed by remote caller.
*
* Signal emitted when a remote caller is invoking the <link linkend="gdbus-method-org-gtk-GDBus-Example-ObjectManager-Animal.Poke">Poke()</link> D-Bus method.
*
* If a signal handler returns %TRUE, it means the signal handler will handle the invocation (e.g. take a reference to @invocation and eventually call example_animal_complete_poke() or e.g. g_dbus_method_invocation_return_error() on it) and no order signal handlers will run. If no signal handler handles the invocation, the %G_DBUS_ERROR_UNKNOWN_METHOD error is returned.
*
* Returns: %TRUE if the invocation was handled, %FALSE to let other signal handlers run.
*
* Since: 2.30
*/
g_signal_new ("handle-poke",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ExampleAnimalIface, handle_poke),
g_signal_accumulator_true_handled,
NULL,
g_cclosure_marshal_generic,
G_TYPE_BOOLEAN,
3,
G_TYPE_DBUS_METHOD_INVOCATION, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN);
/* GObject signals for received D-Bus signals: */
/**
* ExampleAnimal::jumped:
* @object: A #ExampleAnimal.
* @arg_height: Argument.
*
* On the client-side, this signal is emitted whenever the D-Bus signal <link linkend="gdbus-signal-org-gtk-GDBus-Example-ObjectManager-Animal.Jumped">"Jumped"</link> is received.
*
* On the service-side, this signal can be used with e.g. g_signal_emit_by_name() to make the object emit the D-Bus signal.
*
* Since: 2.30
*/
g_signal_new ("jumped",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (ExampleAnimalIface, jumped),
NULL,
NULL,
g_cclosure_marshal_generic,
G_TYPE_NONE,
1, G_TYPE_DOUBLE);
/* GObject properties for D-Bus properties: */
/**
* ExampleAnimal:mood:
*
* Represents the D-Bus property <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Mood">"Mood"</link>.
*
* Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
*
* Since: 2.30
*/
g_object_interface_install_property (iface,
g_param_spec_string ("mood", "Mood", "Mood", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* ExampleAnimal:foo:
*
* Represents the D-Bus property <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Foo">"Foo"</link>.
*
* Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
*
* Since: 2.30
*/
g_object_interface_install_property (iface,
g_param_spec_string ("foo", "Foo", "Foo", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* ExampleAnimal:bar:
*
* Represents the D-Bus property <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Bar">"Bar"</link>.
*
* Since the D-Bus property for this #GObject property is readable but not writable, it is meaningful to read from it on both the client- and service-side. It is only meaningful, however, to write to it on the service-side.
*
* Since: 2.36
*/
g_object_interface_install_property (iface,
g_param_spec_string ("bar", "Bar", "Bar", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
/**
* example_animal_get_mood: (skip)
* @object: A #ExampleAnimal.
*
* Gets the value of the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Mood">"Mood"</link> D-Bus property.
*
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
*
* <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use example_animal_dup_mood() if on another thread.</warning>
*
* Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
*
* Since: 2.30
*/
const gchar *
example_animal_get_mood (ExampleAnimal *object)
{
return EXAMPLE_ANIMAL_GET_IFACE (object)->get_mood (object);
}
/**
* example_animal_dup_mood: (skip)
* @object: A #ExampleAnimal.
*
* Gets a copy of the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Mood">"Mood"</link> D-Bus property.
*
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
*
* Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
*
* Since: 2.30
*/
gchar *
example_animal_dup_mood (ExampleAnimal *object)
{
gchar *value;
g_object_get (G_OBJECT (object), "mood", &value, NULL);
return value;
}
/**
* example_animal_set_mood: (skip)
* @object: A #ExampleAnimal.
* @value: The value to set.
*
* Sets the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Mood">"Mood"</link> D-Bus property to @value.
*
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
*
* Since: 2.30
*/
void
example_animal_set_mood (ExampleAnimal *object, const gchar *value)
{
g_object_set (G_OBJECT (object), "mood", value, NULL);
}
/**
* example_animal_get_foo: (skip)
* @object: A #ExampleAnimal.
*
* Gets the value of the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Foo">"Foo"</link> D-Bus property.
*
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
*
* <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use example_animal_dup_foo() if on another thread.</warning>
*
* Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
*
* Since: 2.30
*/
const gchar *
example_animal_get_foo (ExampleAnimal *object)
{
return EXAMPLE_ANIMAL_GET_IFACE (object)->get_foo (object);
}
/**
* example_animal_dup_foo: (skip)
* @object: A #ExampleAnimal.
*
* Gets a copy of the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Foo">"Foo"</link> D-Bus property.
*
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
*
* Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
*
* Since: 2.30
*/
gchar *
example_animal_dup_foo (ExampleAnimal *object)
{
gchar *value;
g_object_get (G_OBJECT (object), "foo", &value, NULL);
return value;
}
/**
* example_animal_set_foo: (skip)
* @object: A #ExampleAnimal.
* @value: The value to set.
*
* Sets the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Foo">"Foo"</link> D-Bus property to @value.
*
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
*
* Since: 2.30
*/
void
example_animal_set_foo (ExampleAnimal *object, const gchar *value)
{
g_object_set (G_OBJECT (object), "foo", value, NULL);
}
/**
* example_animal_get_bar: (skip)
* @object: A #ExampleAnimal.
*
* Gets the value of the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Bar">"Bar"</link> D-Bus property.
*
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
*
* <warning>The returned value is only valid until the property changes so on the client-side it is only safe to use this function on the thread where @object was constructed. Use example_animal_dup_bar() if on another thread.</warning>
*
* Returns: (transfer none) (nullable): The property value or %NULL if the property is not set. Do not free the returned value, it belongs to @object.
*
* Since: 2.36
*/
const gchar *
example_animal_get_bar (ExampleAnimal *object)
{
return EXAMPLE_ANIMAL_GET_IFACE (object)->get_bar (object);
}
/**
* example_animal_dup_bar: (skip)
* @object: A #ExampleAnimal.
*
* Gets a copy of the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Bar">"Bar"</link> D-Bus property.
*
* Since this D-Bus property is readable, it is meaningful to use this function on both the client- and service-side.
*
* Returns: (transfer full) (nullable): The property value or %NULL if the property is not set. The returned value should be freed with g_free().
*
* Since: 2.36
*/
gchar *
example_animal_dup_bar (ExampleAnimal *object)
{
gchar *value;
g_object_get (G_OBJECT (object), "bar", &value, NULL);
return value;
}
/**
* example_animal_set_bar: (skip)
* @object: A #ExampleAnimal.
* @value: The value to set.
*
* Sets the <link linkend="gdbus-property-org-gtk-GDBus-Example-ObjectManager-Animal.Bar">"Bar"</link> D-Bus property to @value.
*
* Since this D-Bus property is not writable, it is only meaningful to use this function on the service-side.
*
* Since: 2.36
*/
void
example_animal_set_bar (ExampleAnimal *object, const gchar *value)
{
g_object_set (G_OBJECT (object), "bar", value, NULL);
}
/**
* example_animal_emit_jumped:
* @object: A #ExampleAnimal.
* @arg_height: Argument to pass with the signal.
*
* Emits the <link linkend="gdbus-signal-org-gtk-GDBus-Example-ObjectManager-Animal.Jumped">"Jumped"</link> D-Bus signal.
*
* Since: 2.30
*/
void
example_animal_emit_jumped (
ExampleAnimal *object,
gdouble arg_height)
{
g_signal_emit_by_name (object, "jumped", arg_height);
}
/**
* example_animal_call_poke:
* @proxy: A #ExampleAnimalProxy.
* @arg_make_sad: Argument to pass with the method invocation.
* @arg_make_happy: Argument to pass with the method invocation.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied or %NULL.
* @user_data: User data to pass to @callback.
*
* Asynchronously invokes the <link linkend="gdbus-method-org-gtk-GDBus-Example-ObjectManager-Animal.Poke">Poke()</link> D-Bus method on @proxy.
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* You can then call example_animal_call_poke_finish() to get the result of the operation.
*
* See example_animal_call_poke_sync() for the synchronous, blocking version of this method.
*
* Since: 2.30
*/
void
example_animal_call_poke (
ExampleAnimal *proxy,
gboolean arg_make_sad,
gboolean arg_make_happy,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_dbus_proxy_call (G_DBUS_PROXY (proxy),
"Poke",
g_variant_new ("(bb)",
arg_make_sad,
arg_make_happy),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
callback,
user_data);
}
/**
* example_animal_call_poke_finish:
* @proxy: A #ExampleAnimalProxy.
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to example_animal_call_poke().
* @error: Return location for error or %NULL.
*
* Finishes an operation started with example_animal_call_poke().
*
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
*
* Since: 2.30
*/
gboolean
example_animal_call_poke_finish (
ExampleAnimal *proxy,
GAsyncResult *res,
GError **error)
{
GVariant *_ret;
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"()");
g_variant_unref (_ret);
_out:
return _ret != NULL;
}
/**
* example_animal_call_poke_sync:
* @proxy: A #ExampleAnimalProxy.
* @arg_make_sad: Argument to pass with the method invocation.
* @arg_make_happy: Argument to pass with the method invocation.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @error: Return location for error or %NULL.
*
* Synchronously invokes the <link linkend="gdbus-method-org-gtk-GDBus-Example-ObjectManager-Animal.Poke">Poke()</link> D-Bus method on @proxy. The calling thread is blocked until a reply is received.
*
* See example_animal_call_poke() for the asynchronous version of this method.
*
* Returns: (skip): %TRUE if the call succeded, %FALSE if @error is set.
*
* Since: 2.30
*/
gboolean
example_animal_call_poke_sync (
ExampleAnimal *proxy,
gboolean arg_make_sad,
gboolean arg_make_happy,
GCancellable *cancellable,
GError **error)
{
GVariant *_ret;
_ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy),
"Poke",
g_variant_new ("(bb)",
arg_make_sad,
arg_make_happy),
G_DBUS_CALL_FLAGS_NONE,
-1,
cancellable,
error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"()");
g_variant_unref (_ret);
_out:
return _ret != NULL;
}
/**
* example_animal_complete_poke:
* @object: A #ExampleAnimal.
* @invocation: (transfer full): A #GDBusMethodInvocation.
*
* Helper function used in service implementations to finish handling invocations of the <link linkend="gdbus-method-org-gtk-GDBus-Example-ObjectManager-Animal.Poke">Poke()</link> D-Bus method. If you instead want to finish handling an invocation by returning an error, use g_dbus_method_invocation_return_error() or similar.
*
* This method will free @invocation, you cannot use it afterwards.
*
* Since: 2.30
*/
void
example_animal_complete_poke (
ExampleAnimal *object,
GDBusMethodInvocation *invocation)
{
g_dbus_method_invocation_return_value (invocation,
g_variant_new ("()"));
}
/* ------------------------------------------------------------------------ */
/**
* ExampleAnimalProxy:
*
* The #ExampleAnimalProxy structure contains only private data and should only be accessed using the provided API.
*
* Since: 2.30
*/
/**
* ExampleAnimalProxyClass:
* @parent_class: The parent class.
*
* Class structure for #ExampleAnimalProxy.
*
* Since: 2.30
*/
struct _ExampleAnimalProxyPrivate
{
GData *qdata;
};
static void example_animal_proxy_iface_init (ExampleAnimalIface *iface);
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE (ExampleAnimalProxy, example_animal_proxy, G_TYPE_DBUS_PROXY,
G_ADD_PRIVATE (ExampleAnimalProxy)
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_ANIMAL, example_animal_proxy_iface_init))
#else
G_DEFINE_TYPE_WITH_CODE (ExampleAnimalProxy, example_animal_proxy, G_TYPE_DBUS_PROXY,
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_ANIMAL, example_animal_proxy_iface_init))
#endif
static void
example_animal_proxy_finalize (GObject *object)
{
ExampleAnimalProxy *proxy = EXAMPLE_ANIMAL_PROXY (object);
g_datalist_clear (&proxy->priv->qdata);
G_OBJECT_CLASS (example_animal_proxy_parent_class)->finalize (object);
}
static void
example_animal_proxy_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec G_GNUC_UNUSED)
{
const _ExtendedGDBusPropertyInfo *info;
GVariant *variant;
g_assert (prop_id != 0 && prop_id - 1 < 3);
info = (const _ExtendedGDBusPropertyInfo *) _example_animal_property_info_pointers[prop_id - 1];
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (object), info->parent_struct.name);
if (info->use_gvariant)
{
g_value_set_variant (value, variant);
}
else
{
if (variant != NULL)
g_dbus_gvariant_to_gvalue (variant, value);
}
if (variant != NULL)
g_variant_unref (variant);
}
static void
example_animal_proxy_set_property_cb (GDBusProxy *proxy,
GAsyncResult *res,
gpointer user_data)
{
const _ExtendedGDBusPropertyInfo *info = user_data;
GError *error;
GVariant *_ret;
error = NULL;
_ret = g_dbus_proxy_call_finish (proxy, res, &error);
if (!_ret)
{
g_warning ("Error setting property '%s' on interface org.gtk.GDBus.Example.ObjectManager.Animal: %s (%s, %d)",
info->parent_struct.name,
error->message, g_quark_to_string (error->domain), error->code);
g_error_free (error);
}
else
{
g_variant_unref (_ret);
}
}
static void
example_animal_proxy_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec G_GNUC_UNUSED)
{
const _ExtendedGDBusPropertyInfo *info;
GVariant *variant;
g_assert (prop_id != 0 && prop_id - 1 < 3);
info = (const _ExtendedGDBusPropertyInfo *) _example_animal_property_info_pointers[prop_id - 1];
variant = g_dbus_gvalue_to_gvariant (value, G_VARIANT_TYPE (info->parent_struct.signature));
g_dbus_proxy_call (G_DBUS_PROXY (object),
"org.freedesktop.DBus.Properties.Set",
g_variant_new ("(ssv)", "org.gtk.GDBus.Example.ObjectManager.Animal", info->parent_struct.name, variant),
G_DBUS_CALL_FLAGS_NONE,
-1,
NULL, (GAsyncReadyCallback) example_animal_proxy_set_property_cb, (GDBusPropertyInfo *) &info->parent_struct);
g_variant_unref (variant);
}
static void
example_animal_proxy_g_signal (GDBusProxy *proxy,
const gchar *sender_name G_GNUC_UNUSED,
const gchar *signal_name,
GVariant *parameters)
{
_ExtendedGDBusSignalInfo *info;
GVariantIter iter;
GVariant *child;
GValue *paramv;
gsize num_params;
gsize n;
guint signal_id;
info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_example_animal_interface_info.parent_struct, signal_name);
if (info == NULL)
return;
num_params = g_variant_n_children (parameters);
paramv = g_new0 (GValue, num_params + 1);
g_value_init (¶mv[0], EXAMPLE_TYPE_ANIMAL);
g_value_set_object (¶mv[0], proxy);
g_variant_iter_init (&iter, parameters);
n = 1;
while ((child = g_variant_iter_next_value (&iter)) != NULL)
{
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
if (arg_info->use_gvariant)
{
g_value_init (¶mv[n], G_TYPE_VARIANT);
g_value_set_variant (¶mv[n], child);
n++;
}
else
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
g_variant_unref (child);
}
signal_id = g_signal_lookup (info->signal_name, EXAMPLE_TYPE_ANIMAL);
g_signal_emitv (paramv, signal_id, 0, NULL);
for (n = 0; n < num_params + 1; n++)
g_value_unset (¶mv[n]);
g_free (paramv);
}
static void
example_animal_proxy_g_properties_changed (GDBusProxy *_proxy,
GVariant *changed_properties,
const gchar *const *invalidated_properties)
{
ExampleAnimalProxy *proxy = EXAMPLE_ANIMAL_PROXY (_proxy);
guint n;
const gchar *key;
GVariantIter *iter;
_ExtendedGDBusPropertyInfo *info;
g_variant_get (changed_properties, "a{sv}", &iter);
while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
{
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_example_animal_interface_info.parent_struct, key);
g_datalist_remove_data (&proxy->priv->qdata, key);
if (info != NULL)
g_object_notify (G_OBJECT (proxy), info->hyphen_name);
}
g_variant_iter_free (iter);
for (n = 0; invalidated_properties[n] != NULL; n++)
{
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_example_animal_interface_info.parent_struct, invalidated_properties[n]);
g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
if (info != NULL)
g_object_notify (G_OBJECT (proxy), info->hyphen_name);
}
}
static const gchar *
example_animal_proxy_get_mood (ExampleAnimal *object)
{
ExampleAnimalProxy *proxy = EXAMPLE_ANIMAL_PROXY (object);
GVariant *variant;
const gchar *value = NULL;
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Mood");
if (variant != NULL)
{
value = g_variant_get_string (variant, NULL);
g_variant_unref (variant);
}
return value;
}
static const gchar *
example_animal_proxy_get_foo (ExampleAnimal *object)
{
ExampleAnimalProxy *proxy = EXAMPLE_ANIMAL_PROXY (object);
GVariant *variant;
const gchar *value = NULL;
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Foo");
if (variant != NULL)
{
value = g_variant_get_string (variant, NULL);
g_variant_unref (variant);
}
return value;
}
static const gchar *
example_animal_proxy_get_bar (ExampleAnimal *object)
{
ExampleAnimalProxy *proxy = EXAMPLE_ANIMAL_PROXY (object);
GVariant *variant;
const gchar *value = NULL;
variant = g_dbus_proxy_get_cached_property (G_DBUS_PROXY (proxy), "Bar");
if (variant != NULL)
{
value = g_variant_get_string (variant, NULL);
g_variant_unref (variant);
}
return value;
}
static void
example_animal_proxy_init (ExampleAnimalProxy *proxy)
{
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
proxy->priv = example_animal_proxy_get_instance_private (proxy);
#else
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, EXAMPLE_TYPE_ANIMAL_PROXY, ExampleAnimalProxyPrivate);
#endif
g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), example_animal_interface_info ());
}
static void
example_animal_proxy_class_init (ExampleAnimalProxyClass *klass)
{
GObjectClass *gobject_class;
GDBusProxyClass *proxy_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = example_animal_proxy_finalize;
gobject_class->get_property = example_animal_proxy_get_property;
gobject_class->set_property = example_animal_proxy_set_property;
proxy_class = G_DBUS_PROXY_CLASS (klass);
proxy_class->g_signal = example_animal_proxy_g_signal;
proxy_class->g_properties_changed = example_animal_proxy_g_properties_changed;
example_animal_override_properties (gobject_class, 1);
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
g_type_class_add_private (klass, sizeof (ExampleAnimalProxyPrivate));
#endif
}
static void
example_animal_proxy_iface_init (ExampleAnimalIface *iface)
{
iface->get_mood = example_animal_proxy_get_mood;
iface->get_foo = example_animal_proxy_get_foo;
iface->get_bar = example_animal_proxy_get_bar;
}
/**
* example_animal_proxy_new:
* @connection: A #GDBusConnection.
* @flags: Flags from the #GDBusProxyFlags enumeration.
* @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
* @user_data: User data to pass to @callback.
*
* Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link>. See g_dbus_proxy_new() for more details.
*
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* You can then call example_animal_proxy_new_finish() to get the result of the operation.
*
* See example_animal_proxy_new_sync() for the synchronous, blocking version of this constructor.
*
* Since: 2.30
*/
void
example_animal_proxy_new (
GDBusConnection *connection,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_async_initable_new_async (EXAMPLE_TYPE_ANIMAL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gtk.GDBus.Example.ObjectManager.Animal", NULL);
}
/**
* example_animal_proxy_new_finish:
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to example_animal_proxy_new().
* @error: Return location for error or %NULL
*
* Finishes an operation started with example_animal_proxy_new().
*
* Returns: (transfer full) (type ExampleAnimalProxy): The constructed proxy object or %NULL if @error is set.
*
* Since: 2.30
*/
ExampleAnimal *
example_animal_proxy_new_finish (
GAsyncResult *res,
GError **error)
{
GObject *ret;
GObject *source_object;
source_object = g_async_result_get_source_object (res);
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
g_object_unref (source_object);
if (ret != NULL)
return EXAMPLE_ANIMAL (ret);
else
return NULL;
}
/**
* example_animal_proxy_new_sync:
* @connection: A #GDBusConnection.
* @flags: Flags from the #GDBusProxyFlags enumeration.
* @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @error: Return location for error or %NULL
*
* Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link>. See g_dbus_proxy_new_sync() for more details.
*
* The calling thread is blocked until a reply is received.
*
* See example_animal_proxy_new() for the asynchronous version of this constructor.
*
* Returns: (transfer full) (type ExampleAnimalProxy): The constructed proxy object or %NULL if @error is set.
*
* Since: 2.30
*/
ExampleAnimal *
example_animal_proxy_new_sync (
GDBusConnection *connection,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GError **error)
{
GInitable *ret;
ret = g_initable_new (EXAMPLE_TYPE_ANIMAL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gtk.GDBus.Example.ObjectManager.Animal", NULL);
if (ret != NULL)
return EXAMPLE_ANIMAL (ret);
else
return NULL;
}
/**
* example_animal_proxy_new_for_bus:
* @bus_type: A #GBusType.
* @flags: Flags from the #GDBusProxyFlags enumeration.
* @name: A bus name (well-known or unique).
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
* @user_data: User data to pass to @callback.
*
* Like example_animal_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
*
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* You can then call example_animal_proxy_new_for_bus_finish() to get the result of the operation.
*
* See example_animal_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
*
* Since: 2.30
*/
void
example_animal_proxy_new_for_bus (
GBusType bus_type,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_async_initable_new_async (EXAMPLE_TYPE_ANIMAL_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gtk.GDBus.Example.ObjectManager.Animal", NULL);
}
/**
* example_animal_proxy_new_for_bus_finish:
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to example_animal_proxy_new_for_bus().
* @error: Return location for error or %NULL
*
* Finishes an operation started with example_animal_proxy_new_for_bus().
*
* Returns: (transfer full) (type ExampleAnimalProxy): The constructed proxy object or %NULL if @error is set.
*
* Since: 2.30
*/
ExampleAnimal *
example_animal_proxy_new_for_bus_finish (
GAsyncResult *res,
GError **error)
{
GObject *ret;
GObject *source_object;
source_object = g_async_result_get_source_object (res);
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
g_object_unref (source_object);
if (ret != NULL)
return EXAMPLE_ANIMAL (ret);
else
return NULL;
}
/**
* example_animal_proxy_new_for_bus_sync:
* @bus_type: A #GBusType.
* @flags: Flags from the #GDBusProxyFlags enumeration.
* @name: A bus name (well-known or unique).
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @error: Return location for error or %NULL
*
* Like example_animal_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
*
* The calling thread is blocked until a reply is received.
*
* See example_animal_proxy_new_for_bus() for the asynchronous version of this constructor.
*
* Returns: (transfer full) (type ExampleAnimalProxy): The constructed proxy object or %NULL if @error is set.
*
* Since: 2.30
*/
ExampleAnimal *
example_animal_proxy_new_for_bus_sync (
GBusType bus_type,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GError **error)
{
GInitable *ret;
ret = g_initable_new (EXAMPLE_TYPE_ANIMAL_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gtk.GDBus.Example.ObjectManager.Animal", NULL);
if (ret != NULL)
return EXAMPLE_ANIMAL (ret);
else
return NULL;
}
/* ------------------------------------------------------------------------ */
/**
* ExampleAnimalSkeleton:
*
* The #ExampleAnimalSkeleton structure contains only private data and should only be accessed using the provided API.
*
* Since: 2.30
*/
/**
* ExampleAnimalSkeletonClass:
* @parent_class: The parent class.
*
* Class structure for #ExampleAnimalSkeleton.
*
* Since: 2.30
*/
struct _ExampleAnimalSkeletonPrivate
{
GValue *properties;
GList *changed_properties;
GSource *changed_properties_idle_source;
GMainContext *context;
GMutex lock;
};
static void
_example_animal_skeleton_handle_method_call (
GDBusConnection *connection G_GNUC_UNUSED,
const gchar *sender G_GNUC_UNUSED,
const gchar *object_path G_GNUC_UNUSED,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (user_data);
_ExtendedGDBusMethodInfo *info;
GVariantIter iter;
GVariant *child;
GValue *paramv;
gsize num_params;
guint num_extra;
gsize n;
guint signal_id;
GValue return_value = G_VALUE_INIT;
info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
g_assert (info != NULL);
num_params = g_variant_n_children (parameters);
num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
n = 0;
g_value_init (¶mv[n], EXAMPLE_TYPE_ANIMAL);
g_value_set_object (¶mv[n++], skeleton);
g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
g_value_set_object (¶mv[n++], invocation);
if (info->pass_fdlist)
{
#ifdef G_OS_UNIX
g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
#else
g_assert_not_reached ();
#endif
}
g_variant_iter_init (&iter, parameters);
while ((child = g_variant_iter_next_value (&iter)) != NULL)
{
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
if (arg_info->use_gvariant)
{
g_value_init (¶mv[n], G_TYPE_VARIANT);
g_value_set_variant (¶mv[n], child);
n++;
}
else
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
g_variant_unref (child);
}
signal_id = g_signal_lookup (info->signal_name, EXAMPLE_TYPE_ANIMAL);
g_value_init (&return_value, G_TYPE_BOOLEAN);
g_signal_emitv (paramv, signal_id, 0, &return_value);
if (!g_value_get_boolean (&return_value))
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
g_value_unset (&return_value);
for (n = 0; n < num_params + num_extra; n++)
g_value_unset (¶mv[n]);
g_free (paramv);
}
static GVariant *
_example_animal_skeleton_handle_get_property (
GDBusConnection *connection G_GNUC_UNUSED,
const gchar *sender G_GNUC_UNUSED,
const gchar *object_path G_GNUC_UNUSED,
const gchar *interface_name G_GNUC_UNUSED,
const gchar *property_name,
GError **error,
gpointer user_data)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (user_data);
GValue value = G_VALUE_INIT;
GParamSpec *pspec;
_ExtendedGDBusPropertyInfo *info;
GVariant *ret;
ret = NULL;
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_example_animal_interface_info.parent_struct, property_name);
g_assert (info != NULL);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
if (pspec == NULL)
{
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
}
else
{
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
g_value_unset (&value);
}
return ret;
}
static gboolean
_example_animal_skeleton_handle_set_property (
GDBusConnection *connection G_GNUC_UNUSED,
const gchar *sender G_GNUC_UNUSED,
const gchar *object_path G_GNUC_UNUSED,
const gchar *interface_name G_GNUC_UNUSED,
const gchar *property_name,
GVariant *variant,
GError **error,
gpointer user_data)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (user_data);
GValue value = G_VALUE_INIT;
GParamSpec *pspec;
_ExtendedGDBusPropertyInfo *info;
gboolean ret;
ret = FALSE;
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_example_animal_interface_info.parent_struct, property_name);
g_assert (info != NULL);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
if (pspec == NULL)
{
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
}
else
{
if (info->use_gvariant)
g_value_set_variant (&value, variant);
else
g_dbus_gvariant_to_gvalue (variant, &value);
g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
g_value_unset (&value);
ret = TRUE;
}
return ret;
}
static const GDBusInterfaceVTable _example_animal_skeleton_vtable =
{
_example_animal_skeleton_handle_method_call,
_example_animal_skeleton_handle_get_property,
_example_animal_skeleton_handle_set_property,
{NULL}
};
static GDBusInterfaceInfo *
example_animal_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
{
return example_animal_interface_info ();
}
static GDBusInterfaceVTable *
example_animal_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
{
return (GDBusInterfaceVTable *) &_example_animal_skeleton_vtable;
}
static GVariant *
example_animal_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (_skeleton);
GVariantBuilder builder;
guint n;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
if (_example_animal_interface_info.parent_struct.properties == NULL)
goto out;
for (n = 0; _example_animal_interface_info.parent_struct.properties[n] != NULL; n++)
{
GDBusPropertyInfo *info = _example_animal_interface_info.parent_struct.properties[n];
if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
{
GVariant *value;
value = _example_animal_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.gtk.GDBus.Example.ObjectManager.Animal", info->name, NULL, skeleton);
if (value != NULL)
{
g_variant_take_ref (value);
g_variant_builder_add (&builder, "{sv}", info->name, value);
g_variant_unref (value);
}
}
}
out:
return g_variant_builder_end (&builder);
}
static gboolean _example_animal_emit_changed (gpointer user_data);
static void
example_animal_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (_skeleton);
gboolean emit_changed = FALSE;
g_mutex_lock (&skeleton->priv->lock);
if (skeleton->priv->changed_properties_idle_source != NULL)
{
g_source_destroy (skeleton->priv->changed_properties_idle_source);
skeleton->priv->changed_properties_idle_source = NULL;
emit_changed = TRUE;
}
g_mutex_unlock (&skeleton->priv->lock);
if (emit_changed)
_example_animal_emit_changed (skeleton);
}
static void
_example_animal_on_signal_jumped (
ExampleAnimal *object,
gdouble arg_height)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (object);
GList *connections, *l;
GVariant *signal_variant;
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
signal_variant = g_variant_ref_sink (g_variant_new ("(d)",
arg_height));
for (l = connections; l != NULL; l = l->next)
{
GDBusConnection *connection = l->data;
g_dbus_connection_emit_signal (connection,
NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.gtk.GDBus.Example.ObjectManager.Animal", "Jumped",
signal_variant, NULL);
}
g_variant_unref (signal_variant);
g_list_free_full (connections, g_object_unref);
}
static void example_animal_skeleton_iface_init (ExampleAnimalIface *iface);
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE (ExampleAnimalSkeleton, example_animal_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
G_ADD_PRIVATE (ExampleAnimalSkeleton)
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_ANIMAL, example_animal_skeleton_iface_init))
#else
G_DEFINE_TYPE_WITH_CODE (ExampleAnimalSkeleton, example_animal_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_ANIMAL, example_animal_skeleton_iface_init))
#endif
static void
example_animal_skeleton_finalize (GObject *object)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (object);
guint n;
for (n = 0; n < 3; n++)
g_value_unset (&skeleton->priv->properties[n]);
g_free (skeleton->priv->properties);
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
if (skeleton->priv->changed_properties_idle_source != NULL)
g_source_destroy (skeleton->priv->changed_properties_idle_source);
g_main_context_unref (skeleton->priv->context);
g_mutex_clear (&skeleton->priv->lock);
G_OBJECT_CLASS (example_animal_skeleton_parent_class)->finalize (object);
}
static void
example_animal_skeleton_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec G_GNUC_UNUSED)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (object);
g_assert (prop_id != 0 && prop_id - 1 < 3);
g_mutex_lock (&skeleton->priv->lock);
g_value_copy (&skeleton->priv->properties[prop_id - 1], value);
g_mutex_unlock (&skeleton->priv->lock);
}
static gboolean
_example_animal_emit_changed (gpointer user_data)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (user_data);
GList *l;
GVariantBuilder builder;
GVariantBuilder invalidated_builder;
guint num_changes;
g_mutex_lock (&skeleton->priv->lock);
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));
for (l = skeleton->priv->changed_properties, num_changes = 0; l != NULL; l = l->next)
{
ChangedProperty *cp = l->data;
GVariant *variant;
const GValue *cur_value;
cur_value = &skeleton->priv->properties[cp->prop_id - 1];
if (!_g_value_equal (cur_value, &cp->orig_value))
{
variant = g_dbus_gvalue_to_gvariant (cur_value, G_VARIANT_TYPE (cp->info->parent_struct.signature));
g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);
g_variant_unref (variant);
num_changes++;
}
}
if (num_changes > 0)
{
GList *connections, *ll;
GVariant *signal_variant;
signal_variant = g_variant_ref_sink (g_variant_new ("(sa{sv}as)", "org.gtk.GDBus.Example.ObjectManager.Animal",
&builder, &invalidated_builder));
connections = g_dbus_interface_skeleton_get_connections (G_DBUS_INTERFACE_SKELETON (skeleton));
for (ll = connections; ll != NULL; ll = ll->next)
{
GDBusConnection *connection = ll->data;
g_dbus_connection_emit_signal (connection,
NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
signal_variant,
NULL);
}
g_variant_unref (signal_variant);
g_list_free_full (connections, g_object_unref);
}
else
{
g_variant_builder_clear (&builder);
g_variant_builder_clear (&invalidated_builder);
}
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
skeleton->priv->changed_properties = NULL;
skeleton->priv->changed_properties_idle_source = NULL;
g_mutex_unlock (&skeleton->priv->lock);
return FALSE;
}
static void
_example_animal_schedule_emit_changed (ExampleAnimalSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, guint prop_id, const GValue *orig_value)
{
ChangedProperty *cp;
GList *l;
cp = NULL;
for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)
{
ChangedProperty *i_cp = l->data;
if (i_cp->info == info)
{
cp = i_cp;
break;
}
}
if (cp == NULL)
{
cp = g_new0 (ChangedProperty, 1);
cp->prop_id = prop_id;
cp->info = info;
skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);
g_value_init (&cp->orig_value, G_VALUE_TYPE (orig_value));
g_value_copy (orig_value, &cp->orig_value);
}
}
static void
example_animal_skeleton_notify (GObject *object,
GParamSpec *pspec G_GNUC_UNUSED)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (object);
g_mutex_lock (&skeleton->priv->lock);
if (skeleton->priv->changed_properties != NULL &&
skeleton->priv->changed_properties_idle_source == NULL)
{
skeleton->priv->changed_properties_idle_source = g_idle_source_new ();
g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);
g_source_set_callback (skeleton->priv->changed_properties_idle_source, _example_animal_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);
g_source_set_name (skeleton->priv->changed_properties_idle_source, "[generated] _example_animal_emit_changed");
g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);
g_source_unref (skeleton->priv->changed_properties_idle_source);
}
g_mutex_unlock (&skeleton->priv->lock);
}
static void
example_animal_skeleton_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
const _ExtendedGDBusPropertyInfo *info;
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (object);
g_assert (prop_id != 0 && prop_id - 1 < 3);
info = (const _ExtendedGDBusPropertyInfo *) _example_animal_property_info_pointers[prop_id - 1];
g_mutex_lock (&skeleton->priv->lock);
g_object_freeze_notify (object);
if (!_g_value_equal (value, &skeleton->priv->properties[prop_id - 1]))
{
if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL &&
info->emits_changed_signal)
_example_animal_schedule_emit_changed (skeleton, info, prop_id, &skeleton->priv->properties[prop_id - 1]);
g_value_copy (value, &skeleton->priv->properties[prop_id - 1]);
g_object_notify_by_pspec (object, pspec);
}
g_mutex_unlock (&skeleton->priv->lock);
g_object_thaw_notify (object);
}
static void
example_animal_skeleton_init (ExampleAnimalSkeleton *skeleton)
{
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
skeleton->priv = example_animal_skeleton_get_instance_private (skeleton);
#else
skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, EXAMPLE_TYPE_ANIMAL_SKELETON, ExampleAnimalSkeletonPrivate);
#endif
g_mutex_init (&skeleton->priv->lock);
skeleton->priv->context = g_main_context_ref_thread_default ();
skeleton->priv->properties = g_new0 (GValue, 3);
g_value_init (&skeleton->priv->properties[0], G_TYPE_STRING);
g_value_init (&skeleton->priv->properties[1], G_TYPE_STRING);
g_value_init (&skeleton->priv->properties[2], G_TYPE_STRING);
}
static const gchar *
example_animal_skeleton_get_mood (ExampleAnimal *object)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (object);
const gchar *value;
g_mutex_lock (&skeleton->priv->lock);
value = g_value_get_string (&(skeleton->priv->properties[0]));
g_mutex_unlock (&skeleton->priv->lock);
return value;
}
static const gchar *
example_animal_skeleton_get_foo (ExampleAnimal *object)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (object);
const gchar *value;
g_mutex_lock (&skeleton->priv->lock);
value = g_value_get_string (&(skeleton->priv->properties[1]));
g_mutex_unlock (&skeleton->priv->lock);
return value;
}
static const gchar *
example_animal_skeleton_get_bar (ExampleAnimal *object)
{
ExampleAnimalSkeleton *skeleton = EXAMPLE_ANIMAL_SKELETON (object);
const gchar *value;
g_mutex_lock (&skeleton->priv->lock);
value = g_value_get_string (&(skeleton->priv->properties[2]));
g_mutex_unlock (&skeleton->priv->lock);
return value;
}
static void
example_animal_skeleton_class_init (ExampleAnimalSkeletonClass *klass)
{
GObjectClass *gobject_class;
GDBusInterfaceSkeletonClass *skeleton_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = example_animal_skeleton_finalize;
gobject_class->get_property = example_animal_skeleton_get_property;
gobject_class->set_property = example_animal_skeleton_set_property;
gobject_class->notify = example_animal_skeleton_notify;
example_animal_override_properties (gobject_class, 1);
skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
skeleton_class->get_info = example_animal_skeleton_dbus_interface_get_info;
skeleton_class->get_properties = example_animal_skeleton_dbus_interface_get_properties;
skeleton_class->flush = example_animal_skeleton_dbus_interface_flush;
skeleton_class->get_vtable = example_animal_skeleton_dbus_interface_get_vtable;
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
g_type_class_add_private (klass, sizeof (ExampleAnimalSkeletonPrivate));
#endif
}
static void
example_animal_skeleton_iface_init (ExampleAnimalIface *iface)
{
iface->jumped = _example_animal_on_signal_jumped;
iface->get_mood = example_animal_skeleton_get_mood;
iface->get_foo = example_animal_skeleton_get_foo;
iface->get_bar = example_animal_skeleton_get_bar;
}
/**
* example_animal_skeleton_new:
*
* Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link>.
*
* Returns: (transfer full) (type ExampleAnimalSkeleton): The skeleton object.
*
* Since: 2.30
*/
ExampleAnimal *
example_animal_skeleton_new (void)
{
return EXAMPLE_ANIMAL (g_object_new (EXAMPLE_TYPE_ANIMAL_SKELETON, NULL));
}
/* ------------------------------------------------------------------------
* Code for interface org.gtk.GDBus.Example.ObjectManager.Cat
* ------------------------------------------------------------------------
*/
/**
* SECTION:ExampleCat
* @title: ExampleCat
* @short_description: Generated C code for the org.gtk.GDBus.Example.ObjectManager.Cat D-Bus interface
*
* This section contains code for working with the <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link> D-Bus interface in C.
*/
/* ---- Introspection data for org.gtk.GDBus.Example.ObjectManager.Cat ---- */
static const _ExtendedGDBusInterfaceInfo _example_cat_interface_info =
{
{
-1,
(gchar *) "org.gtk.GDBus.Example.ObjectManager.Cat",
NULL,
NULL,
NULL,
NULL
},
"cat",
};
/**
* example_cat_interface_info:
*
* Gets a machine-readable description of the <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link> D-Bus interface.
*
* Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
*/
GDBusInterfaceInfo *
example_cat_interface_info (void)
{
return (GDBusInterfaceInfo *) &_example_cat_interface_info.parent_struct;
}
/**
* example_cat_override_properties:
* @klass: The class structure for a #GObject derived class.
* @property_id_begin: The property id to assign to the first overridden property.
*
* Overrides all #GObject properties in the #ExampleCat interface for a concrete class.
* The properties are overridden in the order they are defined.
*
* Returns: The last property id.
*/
guint
example_cat_override_properties (GObjectClass *klass, guint property_id_begin)
{
return property_id_begin - 1;
}
/**
* ExampleCat:
*
* Abstract interface type for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link>.
*/
/**
* ExampleCatIface:
* @parent_iface: The parent interface.
*
* Virtual table for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link>.
*/
typedef ExampleCatIface ExampleCatInterface;
G_DEFINE_INTERFACE (ExampleCat, example_cat, G_TYPE_OBJECT)
static void
example_cat_default_init (ExampleCatIface *iface)
{
}
/* ------------------------------------------------------------------------ */
/**
* ExampleCatProxy:
*
* The #ExampleCatProxy structure contains only private data and should only be accessed using the provided API.
*/
/**
* ExampleCatProxyClass:
* @parent_class: The parent class.
*
* Class structure for #ExampleCatProxy.
*/
struct _ExampleCatProxyPrivate
{
GData *qdata;
};
static void example_cat_proxy_iface_init (ExampleCatIface *iface);
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE (ExampleCatProxy, example_cat_proxy, G_TYPE_DBUS_PROXY,
G_ADD_PRIVATE (ExampleCatProxy)
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_CAT, example_cat_proxy_iface_init))
#else
G_DEFINE_TYPE_WITH_CODE (ExampleCatProxy, example_cat_proxy, G_TYPE_DBUS_PROXY,
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_CAT, example_cat_proxy_iface_init))
#endif
static void
example_cat_proxy_finalize (GObject *object)
{
ExampleCatProxy *proxy = EXAMPLE_CAT_PROXY (object);
g_datalist_clear (&proxy->priv->qdata);
G_OBJECT_CLASS (example_cat_proxy_parent_class)->finalize (object);
}
static void
example_cat_proxy_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec G_GNUC_UNUSED)
{
}
static void
example_cat_proxy_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec G_GNUC_UNUSED)
{
}
static void
example_cat_proxy_g_signal (GDBusProxy *proxy,
const gchar *sender_name G_GNUC_UNUSED,
const gchar *signal_name,
GVariant *parameters)
{
_ExtendedGDBusSignalInfo *info;
GVariantIter iter;
GVariant *child;
GValue *paramv;
gsize num_params;
gsize n;
guint signal_id;
info = (_ExtendedGDBusSignalInfo *) g_dbus_interface_info_lookup_signal ((GDBusInterfaceInfo *) &_example_cat_interface_info.parent_struct, signal_name);
if (info == NULL)
return;
num_params = g_variant_n_children (parameters);
paramv = g_new0 (GValue, num_params + 1);
g_value_init (¶mv[0], EXAMPLE_TYPE_CAT);
g_value_set_object (¶mv[0], proxy);
g_variant_iter_init (&iter, parameters);
n = 1;
while ((child = g_variant_iter_next_value (&iter)) != NULL)
{
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.args[n - 1];
if (arg_info->use_gvariant)
{
g_value_init (¶mv[n], G_TYPE_VARIANT);
g_value_set_variant (¶mv[n], child);
n++;
}
else
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
g_variant_unref (child);
}
signal_id = g_signal_lookup (info->signal_name, EXAMPLE_TYPE_CAT);
g_signal_emitv (paramv, signal_id, 0, NULL);
for (n = 0; n < num_params + 1; n++)
g_value_unset (¶mv[n]);
g_free (paramv);
}
static void
example_cat_proxy_g_properties_changed (GDBusProxy *_proxy,
GVariant *changed_properties,
const gchar *const *invalidated_properties)
{
ExampleCatProxy *proxy = EXAMPLE_CAT_PROXY (_proxy);
guint n;
const gchar *key;
GVariantIter *iter;
_ExtendedGDBusPropertyInfo *info;
g_variant_get (changed_properties, "a{sv}", &iter);
while (g_variant_iter_next (iter, "{&sv}", &key, NULL))
{
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_example_cat_interface_info.parent_struct, key);
g_datalist_remove_data (&proxy->priv->qdata, key);
if (info != NULL)
g_object_notify (G_OBJECT (proxy), info->hyphen_name);
}
g_variant_iter_free (iter);
for (n = 0; invalidated_properties[n] != NULL; n++)
{
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_example_cat_interface_info.parent_struct, invalidated_properties[n]);
g_datalist_remove_data (&proxy->priv->qdata, invalidated_properties[n]);
if (info != NULL)
g_object_notify (G_OBJECT (proxy), info->hyphen_name);
}
}
static void
example_cat_proxy_init (ExampleCatProxy *proxy)
{
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
proxy->priv = example_cat_proxy_get_instance_private (proxy);
#else
proxy->priv = G_TYPE_INSTANCE_GET_PRIVATE (proxy, EXAMPLE_TYPE_CAT_PROXY, ExampleCatProxyPrivate);
#endif
g_dbus_proxy_set_interface_info (G_DBUS_PROXY (proxy), example_cat_interface_info ());
}
static void
example_cat_proxy_class_init (ExampleCatProxyClass *klass)
{
GObjectClass *gobject_class;
GDBusProxyClass *proxy_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = example_cat_proxy_finalize;
gobject_class->get_property = example_cat_proxy_get_property;
gobject_class->set_property = example_cat_proxy_set_property;
proxy_class = G_DBUS_PROXY_CLASS (klass);
proxy_class->g_signal = example_cat_proxy_g_signal;
proxy_class->g_properties_changed = example_cat_proxy_g_properties_changed;
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
g_type_class_add_private (klass, sizeof (ExampleCatProxyPrivate));
#endif
}
static void
example_cat_proxy_iface_init (ExampleCatIface *iface)
{
}
/**
* example_cat_proxy_new:
* @connection: A #GDBusConnection.
* @flags: Flags from the #GDBusProxyFlags enumeration.
* @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
* @user_data: User data to pass to @callback.
*
* Asynchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link>. See g_dbus_proxy_new() for more details.
*
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* You can then call example_cat_proxy_new_finish() to get the result of the operation.
*
* See example_cat_proxy_new_sync() for the synchronous, blocking version of this constructor.
*/
void
example_cat_proxy_new (
GDBusConnection *connection,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_async_initable_new_async (EXAMPLE_TYPE_CAT_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gtk.GDBus.Example.ObjectManager.Cat", NULL);
}
/**
* example_cat_proxy_new_finish:
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to example_cat_proxy_new().
* @error: Return location for error or %NULL
*
* Finishes an operation started with example_cat_proxy_new().
*
* Returns: (transfer full) (type ExampleCatProxy): The constructed proxy object or %NULL if @error is set.
*/
ExampleCat *
example_cat_proxy_new_finish (
GAsyncResult *res,
GError **error)
{
GObject *ret;
GObject *source_object;
source_object = g_async_result_get_source_object (res);
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
g_object_unref (source_object);
if (ret != NULL)
return EXAMPLE_CAT (ret);
else
return NULL;
}
/**
* example_cat_proxy_new_sync:
* @connection: A #GDBusConnection.
* @flags: Flags from the #GDBusProxyFlags enumeration.
* @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @error: Return location for error or %NULL
*
* Synchronously creates a proxy for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link>. See g_dbus_proxy_new_sync() for more details.
*
* The calling thread is blocked until a reply is received.
*
* See example_cat_proxy_new() for the asynchronous version of this constructor.
*
* Returns: (transfer full) (type ExampleCatProxy): The constructed proxy object or %NULL if @error is set.
*/
ExampleCat *
example_cat_proxy_new_sync (
GDBusConnection *connection,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GError **error)
{
GInitable *ret;
ret = g_initable_new (EXAMPLE_TYPE_CAT_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-connection", connection, "g-object-path", object_path, "g-interface-name", "org.gtk.GDBus.Example.ObjectManager.Cat", NULL);
if (ret != NULL)
return EXAMPLE_CAT (ret);
else
return NULL;
}
/**
* example_cat_proxy_new_for_bus:
* @bus_type: A #GBusType.
* @flags: Flags from the #GDBusProxyFlags enumeration.
* @name: A bus name (well-known or unique).
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
* @user_data: User data to pass to @callback.
*
* Like example_cat_proxy_new() but takes a #GBusType instead of a #GDBusConnection.
*
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* You can then call example_cat_proxy_new_for_bus_finish() to get the result of the operation.
*
* See example_cat_proxy_new_for_bus_sync() for the synchronous, blocking version of this constructor.
*/
void
example_cat_proxy_new_for_bus (
GBusType bus_type,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_async_initable_new_async (EXAMPLE_TYPE_CAT_PROXY, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gtk.GDBus.Example.ObjectManager.Cat", NULL);
}
/**
* example_cat_proxy_new_for_bus_finish:
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to example_cat_proxy_new_for_bus().
* @error: Return location for error or %NULL
*
* Finishes an operation started with example_cat_proxy_new_for_bus().
*
* Returns: (transfer full) (type ExampleCatProxy): The constructed proxy object or %NULL if @error is set.
*/
ExampleCat *
example_cat_proxy_new_for_bus_finish (
GAsyncResult *res,
GError **error)
{
GObject *ret;
GObject *source_object;
source_object = g_async_result_get_source_object (res);
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
g_object_unref (source_object);
if (ret != NULL)
return EXAMPLE_CAT (ret);
else
return NULL;
}
/**
* example_cat_proxy_new_for_bus_sync:
* @bus_type: A #GBusType.
* @flags: Flags from the #GDBusProxyFlags enumeration.
* @name: A bus name (well-known or unique).
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @error: Return location for error or %NULL
*
* Like example_cat_proxy_new_sync() but takes a #GBusType instead of a #GDBusConnection.
*
* The calling thread is blocked until a reply is received.
*
* See example_cat_proxy_new_for_bus() for the asynchronous version of this constructor.
*
* Returns: (transfer full) (type ExampleCatProxy): The constructed proxy object or %NULL if @error is set.
*/
ExampleCat *
example_cat_proxy_new_for_bus_sync (
GBusType bus_type,
GDBusProxyFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GError **error)
{
GInitable *ret;
ret = g_initable_new (EXAMPLE_TYPE_CAT_PROXY, cancellable, error, "g-flags", flags, "g-name", name, "g-bus-type", bus_type, "g-object-path", object_path, "g-interface-name", "org.gtk.GDBus.Example.ObjectManager.Cat", NULL);
if (ret != NULL)
return EXAMPLE_CAT (ret);
else
return NULL;
}
/* ------------------------------------------------------------------------ */
/**
* ExampleCatSkeleton:
*
* The #ExampleCatSkeleton structure contains only private data and should only be accessed using the provided API.
*/
/**
* ExampleCatSkeletonClass:
* @parent_class: The parent class.
*
* Class structure for #ExampleCatSkeleton.
*/
struct _ExampleCatSkeletonPrivate
{
GValue *properties;
GList *changed_properties;
GSource *changed_properties_idle_source;
GMainContext *context;
GMutex lock;
};
static void
_example_cat_skeleton_handle_method_call (
GDBusConnection *connection G_GNUC_UNUSED,
const gchar *sender G_GNUC_UNUSED,
const gchar *object_path G_GNUC_UNUSED,
const gchar *interface_name,
const gchar *method_name,
GVariant *parameters,
GDBusMethodInvocation *invocation,
gpointer user_data)
{
ExampleCatSkeleton *skeleton = EXAMPLE_CAT_SKELETON (user_data);
_ExtendedGDBusMethodInfo *info;
GVariantIter iter;
GVariant *child;
GValue *paramv;
gsize num_params;
guint num_extra;
gsize n;
guint signal_id;
GValue return_value = G_VALUE_INIT;
info = (_ExtendedGDBusMethodInfo *) g_dbus_method_invocation_get_method_info (invocation);
g_assert (info != NULL);
num_params = g_variant_n_children (parameters);
num_extra = info->pass_fdlist ? 3 : 2; paramv = g_new0 (GValue, num_params + num_extra);
n = 0;
g_value_init (¶mv[n], EXAMPLE_TYPE_CAT);
g_value_set_object (¶mv[n++], skeleton);
g_value_init (¶mv[n], G_TYPE_DBUS_METHOD_INVOCATION);
g_value_set_object (¶mv[n++], invocation);
if (info->pass_fdlist)
{
#ifdef G_OS_UNIX
g_value_init (¶mv[n], G_TYPE_UNIX_FD_LIST);
g_value_set_object (¶mv[n++], g_dbus_message_get_unix_fd_list (g_dbus_method_invocation_get_message (invocation)));
#else
g_assert_not_reached ();
#endif
}
g_variant_iter_init (&iter, parameters);
while ((child = g_variant_iter_next_value (&iter)) != NULL)
{
_ExtendedGDBusArgInfo *arg_info = (_ExtendedGDBusArgInfo *) info->parent_struct.in_args[n - num_extra];
if (arg_info->use_gvariant)
{
g_value_init (¶mv[n], G_TYPE_VARIANT);
g_value_set_variant (¶mv[n], child);
n++;
}
else
g_dbus_gvariant_to_gvalue (child, ¶mv[n++]);
g_variant_unref (child);
}
signal_id = g_signal_lookup (info->signal_name, EXAMPLE_TYPE_CAT);
g_value_init (&return_value, G_TYPE_BOOLEAN);
g_signal_emitv (paramv, signal_id, 0, &return_value);
if (!g_value_get_boolean (&return_value))
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD, "Method %s is not implemented on interface %s", method_name, interface_name);
g_value_unset (&return_value);
for (n = 0; n < num_params + num_extra; n++)
g_value_unset (¶mv[n]);
g_free (paramv);
}
static GVariant *
_example_cat_skeleton_handle_get_property (
GDBusConnection *connection G_GNUC_UNUSED,
const gchar *sender G_GNUC_UNUSED,
const gchar *object_path G_GNUC_UNUSED,
const gchar *interface_name G_GNUC_UNUSED,
const gchar *property_name,
GError **error,
gpointer user_data)
{
ExampleCatSkeleton *skeleton = EXAMPLE_CAT_SKELETON (user_data);
GValue value = G_VALUE_INIT;
GParamSpec *pspec;
_ExtendedGDBusPropertyInfo *info;
GVariant *ret;
ret = NULL;
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_example_cat_interface_info.parent_struct, property_name);
g_assert (info != NULL);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
if (pspec == NULL)
{
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
}
else
{
g_value_init (&value, pspec->value_type);
g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);
ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));
g_value_unset (&value);
}
return ret;
}
static gboolean
_example_cat_skeleton_handle_set_property (
GDBusConnection *connection G_GNUC_UNUSED,
const gchar *sender G_GNUC_UNUSED,
const gchar *object_path G_GNUC_UNUSED,
const gchar *interface_name G_GNUC_UNUSED,
const gchar *property_name,
GVariant *variant,
GError **error,
gpointer user_data)
{
ExampleCatSkeleton *skeleton = EXAMPLE_CAT_SKELETON (user_data);
GValue value = G_VALUE_INIT;
GParamSpec *pspec;
_ExtendedGDBusPropertyInfo *info;
gboolean ret;
ret = FALSE;
info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_example_cat_interface_info.parent_struct, property_name);
g_assert (info != NULL);
pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);
if (pspec == NULL)
{
g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %s", property_name);
}
else
{
if (info->use_gvariant)
g_value_set_variant (&value, variant);
else
g_dbus_gvariant_to_gvalue (variant, &value);
g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);
g_value_unset (&value);
ret = TRUE;
}
return ret;
}
static const GDBusInterfaceVTable _example_cat_skeleton_vtable =
{
_example_cat_skeleton_handle_method_call,
_example_cat_skeleton_handle_get_property,
_example_cat_skeleton_handle_set_property,
{NULL}
};
static GDBusInterfaceInfo *
example_cat_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
{
return example_cat_interface_info ();
}
static GDBusInterfaceVTable *
example_cat_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton G_GNUC_UNUSED)
{
return (GDBusInterfaceVTable *) &_example_cat_skeleton_vtable;
}
static GVariant *
example_cat_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)
{
ExampleCatSkeleton *skeleton = EXAMPLE_CAT_SKELETON (_skeleton);
GVariantBuilder builder;
guint n;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
if (_example_cat_interface_info.parent_struct.properties == NULL)
goto out;
for (n = 0; _example_cat_interface_info.parent_struct.properties[n] != NULL; n++)
{
GDBusPropertyInfo *info = _example_cat_interface_info.parent_struct.properties[n];
if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)
{
GVariant *value;
value = _example_cat_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "org.gtk.GDBus.Example.ObjectManager.Cat", info->name, NULL, skeleton);
if (value != NULL)
{
g_variant_take_ref (value);
g_variant_builder_add (&builder, "{sv}", info->name, value);
g_variant_unref (value);
}
}
}
out:
return g_variant_builder_end (&builder);
}
static void
example_cat_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)
{
}
static void example_cat_skeleton_iface_init (ExampleCatIface *iface);
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
G_DEFINE_TYPE_WITH_CODE (ExampleCatSkeleton, example_cat_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
G_ADD_PRIVATE (ExampleCatSkeleton)
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_CAT, example_cat_skeleton_iface_init))
#else
G_DEFINE_TYPE_WITH_CODE (ExampleCatSkeleton, example_cat_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_CAT, example_cat_skeleton_iface_init))
#endif
static void
example_cat_skeleton_finalize (GObject *object)
{
ExampleCatSkeleton *skeleton = EXAMPLE_CAT_SKELETON (object);
g_list_free_full (skeleton->priv->changed_properties, (GDestroyNotify) _changed_property_free);
if (skeleton->priv->changed_properties_idle_source != NULL)
g_source_destroy (skeleton->priv->changed_properties_idle_source);
g_main_context_unref (skeleton->priv->context);
g_mutex_clear (&skeleton->priv->lock);
G_OBJECT_CLASS (example_cat_skeleton_parent_class)->finalize (object);
}
static void
example_cat_skeleton_init (ExampleCatSkeleton *skeleton)
{
#if GLIB_VERSION_MAX_ALLOWED >= GLIB_VERSION_2_38
skeleton->priv = example_cat_skeleton_get_instance_private (skeleton);
#else
skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, EXAMPLE_TYPE_CAT_SKELETON, ExampleCatSkeletonPrivate);
#endif
g_mutex_init (&skeleton->priv->lock);
skeleton->priv->context = g_main_context_ref_thread_default ();
}
static void
example_cat_skeleton_class_init (ExampleCatSkeletonClass *klass)
{
GObjectClass *gobject_class;
GDBusInterfaceSkeletonClass *skeleton_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = example_cat_skeleton_finalize;
skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);
skeleton_class->get_info = example_cat_skeleton_dbus_interface_get_info;
skeleton_class->get_properties = example_cat_skeleton_dbus_interface_get_properties;
skeleton_class->flush = example_cat_skeleton_dbus_interface_flush;
skeleton_class->get_vtable = example_cat_skeleton_dbus_interface_get_vtable;
#if GLIB_VERSION_MAX_ALLOWED < GLIB_VERSION_2_38
g_type_class_add_private (klass, sizeof (ExampleCatSkeletonPrivate));
#endif
}
static void
example_cat_skeleton_iface_init (ExampleCatIface *iface)
{
}
/**
* example_cat_skeleton_new:
*
* Creates a skeleton object for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link>.
*
* Returns: (transfer full) (type ExampleCatSkeleton): The skeleton object.
*/
ExampleCat *
example_cat_skeleton_new (void)
{
return EXAMPLE_CAT (g_object_new (EXAMPLE_TYPE_CAT_SKELETON, NULL));
}
/* ------------------------------------------------------------------------
* Code for Object, ObjectProxy and ObjectSkeleton
* ------------------------------------------------------------------------
*/
/**
* SECTION:ExampleObject
* @title: ExampleObject
* @short_description: Specialized GDBusObject types
*
* This section contains the #ExampleObject, #ExampleObjectProxy, and #ExampleObjectSkeleton types which make it easier to work with objects implementing generated types for D-Bus interfaces.
*/
/**
* ExampleObject:
*
* The #ExampleObject type is a specialized container of interfaces.
*/
/**
* ExampleObjectIface:
* @parent_iface: The parent interface.
*
* Virtual table for the #ExampleObject interface.
*/
typedef ExampleObjectIface ExampleObjectInterface;
G_DEFINE_INTERFACE_WITH_CODE (ExampleObject, example_object, G_TYPE_OBJECT, g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_DBUS_OBJECT);)
static void
example_object_default_init (ExampleObjectIface *iface)
{
/**
* ExampleObject:animal:
*
* The #ExampleAnimal instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link>, if any.
*
* Connect to the #GObject::notify signal to get informed of property changes.
*
* Since: 2.30
*/
g_object_interface_install_property (iface, g_param_spec_object ("animal", "animal", "animal", EXAMPLE_TYPE_ANIMAL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
* ExampleObject:cat:
*
* The #ExampleCat instance corresponding to the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link>, if any.
*
* Connect to the #GObject::notify signal to get informed of property changes.
*/
g_object_interface_install_property (iface, g_param_spec_object ("cat", "cat", "cat", EXAMPLE_TYPE_CAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
}
/**
* example_object_get_animal:
* @object: A #ExampleObject.
*
* Gets the #ExampleAnimal instance for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link> on @object, if any.
*
* Returns: (transfer full) (nullable): A #ExampleAnimal that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
*
* Since: 2.30
*/
ExampleAnimal *example_object_get_animal (ExampleObject *object)
{
GDBusInterface *ret;
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gtk.GDBus.Example.ObjectManager.Animal");
if (ret == NULL)
return NULL;
return EXAMPLE_ANIMAL (ret);
}
/**
* example_object_get_cat:
* @object: A #ExampleObject.
*
* Gets the #ExampleCat instance for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link> on @object, if any.
*
* Returns: (transfer full) (nullable): A #ExampleCat that must be freed with g_object_unref() or %NULL if @object does not implement the interface.
*/
ExampleCat *example_object_get_cat (ExampleObject *object)
{
GDBusInterface *ret;
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gtk.GDBus.Example.ObjectManager.Cat");
if (ret == NULL)
return NULL;
return EXAMPLE_CAT (ret);
}
/**
* example_object_peek_animal: (skip)
* @object: A #ExampleObject.
*
* Like example_object_get_animal() but doesn't increase the reference count on the returned object.
*
* <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
*
* Returns: (transfer none) (nullable): A #ExampleAnimal or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
*
* Since: 2.30
*/
ExampleAnimal *example_object_peek_animal (ExampleObject *object)
{
GDBusInterface *ret;
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gtk.GDBus.Example.ObjectManager.Animal");
if (ret == NULL)
return NULL;
g_object_unref (ret);
return EXAMPLE_ANIMAL (ret);
}
/**
* example_object_peek_cat: (skip)
* @object: A #ExampleObject.
*
* Like example_object_get_cat() but doesn't increase the reference count on the returned object.
*
* <warning>It is not safe to use the returned object if you are on another thread than the one where the #GDBusObjectManagerClient or #GDBusObjectManagerServer for @object is running.</warning>
*
* Returns: (transfer none) (nullable): A #ExampleCat or %NULL if @object does not implement the interface. Do not free the returned object, it is owned by @object.
*/
ExampleCat *example_object_peek_cat (ExampleObject *object)
{
GDBusInterface *ret;
ret = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gtk.GDBus.Example.ObjectManager.Cat");
if (ret == NULL)
return NULL;
g_object_unref (ret);
return EXAMPLE_CAT (ret);
}
static void
example_object_notify (GDBusObject *object, GDBusInterface *interface)
{
_ExtendedGDBusInterfaceInfo *info = (_ExtendedGDBusInterfaceInfo *) g_dbus_interface_get_info (interface);
/* info can be NULL if the other end is using a D-Bus interface we don't know
* anything about, for example old generated code in this process talking to
* newer generated code in the other process. */
if (info != NULL)
g_object_notify (G_OBJECT (object), info->hyphen_name);
}
/**
* ExampleObjectProxy:
*
* The #ExampleObjectProxy structure contains only private data and should only be accessed using the provided API.
*/
/**
* ExampleObjectProxyClass:
* @parent_class: The parent class.
*
* Class structure for #ExampleObjectProxy.
*/
static void
example_object_proxy__example_object_iface_init (ExampleObjectIface *iface G_GNUC_UNUSED)
{
}
static void
example_object_proxy__g_dbus_object_iface_init (GDBusObjectIface *iface)
{
iface->interface_added = example_object_notify;
iface->interface_removed = example_object_notify;
}
G_DEFINE_TYPE_WITH_CODE (ExampleObjectProxy, example_object_proxy, G_TYPE_DBUS_OBJECT_PROXY,
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_OBJECT, example_object_proxy__example_object_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, example_object_proxy__g_dbus_object_iface_init))
static void
example_object_proxy_init (ExampleObjectProxy *object G_GNUC_UNUSED)
{
}
static void
example_object_proxy_set_property (GObject *gobject,
guint prop_id,
const GValue *value G_GNUC_UNUSED,
GParamSpec *pspec)
{
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
}
static void
example_object_proxy_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ExampleObjectProxy *object = EXAMPLE_OBJECT_PROXY (gobject);
GDBusInterface *interface;
switch (prop_id)
{
case 1:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gtk.GDBus.Example.ObjectManager.Animal");
g_value_take_object (value, interface);
break;
case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gtk.GDBus.Example.ObjectManager.Cat");
g_value_take_object (value, interface);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
example_object_proxy_class_init (ExampleObjectProxyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = example_object_proxy_set_property;
gobject_class->get_property = example_object_proxy_get_property;
g_object_class_override_property (gobject_class, 1, "animal");
g_object_class_override_property (gobject_class, 2, "cat");
}
/**
* example_object_proxy_new:
* @connection: A #GDBusConnection.
* @object_path: An object path.
*
* Creates a new proxy object.
*
* Returns: (transfer full): The proxy object.
*/
ExampleObjectProxy *
example_object_proxy_new (GDBusConnection *connection,
const gchar *object_path)
{
g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), NULL);
g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
return EXAMPLE_OBJECT_PROXY (g_object_new (EXAMPLE_TYPE_OBJECT_PROXY, "g-connection", connection, "g-object-path", object_path, NULL));
}
/**
* ExampleObjectSkeleton:
*
* The #ExampleObjectSkeleton structure contains only private data and should only be accessed using the provided API.
*/
/**
* ExampleObjectSkeletonClass:
* @parent_class: The parent class.
*
* Class structure for #ExampleObjectSkeleton.
*/
static void
example_object_skeleton__example_object_iface_init (ExampleObjectIface *iface G_GNUC_UNUSED)
{
}
static void
example_object_skeleton__g_dbus_object_iface_init (GDBusObjectIface *iface)
{
iface->interface_added = example_object_notify;
iface->interface_removed = example_object_notify;
}
G_DEFINE_TYPE_WITH_CODE (ExampleObjectSkeleton, example_object_skeleton, G_TYPE_DBUS_OBJECT_SKELETON,
G_IMPLEMENT_INTERFACE (EXAMPLE_TYPE_OBJECT, example_object_skeleton__example_object_iface_init)
G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, example_object_skeleton__g_dbus_object_iface_init))
static void
example_object_skeleton_init (ExampleObjectSkeleton *object G_GNUC_UNUSED)
{
}
static void
example_object_skeleton_set_property (GObject *gobject,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
ExampleObjectSkeleton *object = EXAMPLE_OBJECT_SKELETON (gobject);
GDBusInterfaceSkeleton *interface;
switch (prop_id)
{
case 1:
interface = g_value_get_object (value);
if (interface != NULL)
{
g_warn_if_fail (EXAMPLE_IS_ANIMAL (interface));
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
}
else
{
g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.gtk.GDBus.Example.ObjectManager.Animal");
}
break;
case 2:
interface = g_value_get_object (value);
if (interface != NULL)
{
g_warn_if_fail (EXAMPLE_IS_CAT (interface));
g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object), interface);
}
else
{
g_dbus_object_skeleton_remove_interface_by_name (G_DBUS_OBJECT_SKELETON (object), "org.gtk.GDBus.Example.ObjectManager.Cat");
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
example_object_skeleton_get_property (GObject *gobject,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
ExampleObjectSkeleton *object = EXAMPLE_OBJECT_SKELETON (gobject);
GDBusInterface *interface;
switch (prop_id)
{
case 1:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gtk.GDBus.Example.ObjectManager.Animal");
g_value_take_object (value, interface);
break;
case 2:
interface = g_dbus_object_get_interface (G_DBUS_OBJECT (object), "org.gtk.GDBus.Example.ObjectManager.Cat");
g_value_take_object (value, interface);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
break;
}
}
static void
example_object_skeleton_class_init (ExampleObjectSkeletonClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->set_property = example_object_skeleton_set_property;
gobject_class->get_property = example_object_skeleton_get_property;
g_object_class_override_property (gobject_class, 1, "animal");
g_object_class_override_property (gobject_class, 2, "cat");
}
/**
* example_object_skeleton_new:
* @object_path: An object path.
*
* Creates a new skeleton object.
*
* Returns: (transfer full): The skeleton object.
*/
ExampleObjectSkeleton *
example_object_skeleton_new (const gchar *object_path)
{
g_return_val_if_fail (g_variant_is_object_path (object_path), NULL);
return EXAMPLE_OBJECT_SKELETON (g_object_new (EXAMPLE_TYPE_OBJECT_SKELETON, "g-object-path", object_path, NULL));
}
/**
* example_object_skeleton_set_animal:
* @object: A #ExampleObjectSkeleton.
* @interface_: (nullable): A #ExampleAnimal or %NULL to clear the interface.
*
* Sets the #ExampleAnimal instance for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Animal.top_of_page">org.gtk.GDBus.Example.ObjectManager.Animal</link> on @object.
*
* Since: 2.30
*/
void example_object_skeleton_set_animal (ExampleObjectSkeleton *object, ExampleAnimal *interface_)
{
g_object_set (G_OBJECT (object), "animal", interface_, NULL);
}
/**
* example_object_skeleton_set_cat:
* @object: A #ExampleObjectSkeleton.
* @interface_: (nullable): A #ExampleCat or %NULL to clear the interface.
*
* Sets the #ExampleCat instance for the D-Bus interface <link linkend="gdbus-interface-org-gtk-GDBus-Example-ObjectManager-Cat.top_of_page">org.gtk.GDBus.Example.ObjectManager.Cat</link> on @object.
*/
void example_object_skeleton_set_cat (ExampleObjectSkeleton *object, ExampleCat *interface_)
{
g_object_set (G_OBJECT (object), "cat", interface_, NULL);
}
/* ------------------------------------------------------------------------
* Code for ObjectManager client
* ------------------------------------------------------------------------
*/
/**
* SECTION:ExampleObjectManagerClient
* @title: ExampleObjectManagerClient
* @short_description: Generated GDBusObjectManagerClient type
*
* This section contains a #GDBusObjectManagerClient that uses example_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc.
*/
/**
* ExampleObjectManagerClient:
*
* The #ExampleObjectManagerClient structure contains only private data and should only be accessed using the provided API.
*/
/**
* ExampleObjectManagerClientClass:
* @parent_class: The parent class.
*
* Class structure for #ExampleObjectManagerClient.
*/
G_DEFINE_TYPE (ExampleObjectManagerClient, example_object_manager_client, G_TYPE_DBUS_OBJECT_MANAGER_CLIENT)
static void
example_object_manager_client_init (ExampleObjectManagerClient *manager G_GNUC_UNUSED)
{
}
static void
example_object_manager_client_class_init (ExampleObjectManagerClientClass *klass G_GNUC_UNUSED)
{
}
/**
* example_object_manager_client_get_proxy_type:
* @manager: A #GDBusObjectManagerClient.
* @object_path: The object path of the remote object (unused).
* @interface_name: (nullable): Interface name of the remote object or %NULL to get the object proxy #GType.
* @user_data: User data (unused).
*
* A #GDBusProxyTypeFunc that maps @interface_name to the generated #GDBusObjectProxy derived and #GDBusProxy derived types.
*
* Returns: A #GDBusProxy derived #GType if @interface_name is not %NULL, otherwise the #GType for #ExampleObjectProxy.
*/
GType
example_object_manager_client_get_proxy_type (GDBusObjectManagerClient *manager G_GNUC_UNUSED, const gchar *object_path G_GNUC_UNUSED, const gchar *interface_name, gpointer user_data G_GNUC_UNUSED)
{
static gsize once_init_value = 0;
static GHashTable *lookup_hash;
GType ret;
if (interface_name == NULL)
return EXAMPLE_TYPE_OBJECT_PROXY;
if (g_once_init_enter (&once_init_value))
{
lookup_hash = g_hash_table_new (g_str_hash, g_str_equal);
g_hash_table_insert (lookup_hash, (gpointer) "org.gtk.GDBus.Example.ObjectManager.Animal", GSIZE_TO_POINTER (EXAMPLE_TYPE_ANIMAL_PROXY));
g_hash_table_insert (lookup_hash, (gpointer) "org.gtk.GDBus.Example.ObjectManager.Cat", GSIZE_TO_POINTER (EXAMPLE_TYPE_CAT_PROXY));
g_once_init_leave (&once_init_value, 1);
}
ret = (GType) GPOINTER_TO_SIZE (g_hash_table_lookup (lookup_hash, interface_name));
if (ret == (GType) 0)
ret = G_TYPE_DBUS_PROXY;
return ret;
}
/**
* example_object_manager_client_new:
* @connection: A #GDBusConnection.
* @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
* @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
* @user_data: User data to pass to @callback.
*
* Asynchronously creates #GDBusObjectManagerClient using example_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new() for more details.
*
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* You can then call example_object_manager_client_new_finish() to get the result of the operation.
*
* See example_object_manager_client_new_sync() for the synchronous, blocking version of this constructor.
*/
void
example_object_manager_client_new (
GDBusConnection *connection,
GDBusObjectManagerClientFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_async_initable_new_async (EXAMPLE_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", example_object_manager_client_get_proxy_type, NULL);
}
/**
* example_object_manager_client_new_finish:
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to example_object_manager_client_new().
* @error: Return location for error or %NULL
*
* Finishes an operation started with example_object_manager_client_new().
*
* Returns: (transfer full) (type ExampleObjectManagerClient): The constructed object manager client or %NULL if @error is set.
*/
GDBusObjectManager *
example_object_manager_client_new_finish (
GAsyncResult *res,
GError **error)
{
GObject *ret;
GObject *source_object;
source_object = g_async_result_get_source_object (res);
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
g_object_unref (source_object);
if (ret != NULL)
return G_DBUS_OBJECT_MANAGER (ret);
else
return NULL;
}
/**
* example_object_manager_client_new_sync:
* @connection: A #GDBusConnection.
* @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
* @name: (nullable): A bus name (well-known or unique) or %NULL if @connection is not a message bus connection.
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @error: Return location for error or %NULL
*
* Synchronously creates #GDBusObjectManagerClient using example_object_manager_client_get_proxy_type() as the #GDBusProxyTypeFunc. See g_dbus_object_manager_client_new_sync() for more details.
*
* The calling thread is blocked until a reply is received.
*
* See example_object_manager_client_new() for the asynchronous version of this constructor.
*
* Returns: (transfer full) (type ExampleObjectManagerClient): The constructed object manager client or %NULL if @error is set.
*/
GDBusObjectManager *
example_object_manager_client_new_sync (
GDBusConnection *connection,
GDBusObjectManagerClientFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GError **error)
{
GInitable *ret;
ret = g_initable_new (EXAMPLE_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "connection", connection, "object-path", object_path, "get-proxy-type-func", example_object_manager_client_get_proxy_type, NULL);
if (ret != NULL)
return G_DBUS_OBJECT_MANAGER (ret);
else
return NULL;
}
/**
* example_object_manager_client_new_for_bus:
* @bus_type: A #GBusType.
* @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
* @name: A bus name (well-known or unique).
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @callback: A #GAsyncReadyCallback to call when the request is satisfied.
* @user_data: User data to pass to @callback.
*
* Like example_object_manager_client_new() but takes a #GBusType instead of a #GDBusConnection.
*
* When the operation is finished, @callback will be invoked in the <link linkend="g-main-context-push-thread-default">thread-default main loop</link> of the thread you are calling this method from.
* You can then call example_object_manager_client_new_for_bus_finish() to get the result of the operation.
*
* See example_object_manager_client_new_for_bus_sync() for the synchronous, blocking version of this constructor.
*/
void
example_object_manager_client_new_for_bus (
GBusType bus_type,
GDBusObjectManagerClientFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_async_initable_new_async (EXAMPLE_TYPE_OBJECT_MANAGER_CLIENT, G_PRIORITY_DEFAULT, cancellable, callback, user_data, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", example_object_manager_client_get_proxy_type, NULL);
}
/**
* example_object_manager_client_new_for_bus_finish:
* @res: The #GAsyncResult obtained from the #GAsyncReadyCallback passed to example_object_manager_client_new_for_bus().
* @error: Return location for error or %NULL
*
* Finishes an operation started with example_object_manager_client_new_for_bus().
*
* Returns: (transfer full) (type ExampleObjectManagerClient): The constructed object manager client or %NULL if @error is set.
*/
GDBusObjectManager *
example_object_manager_client_new_for_bus_finish (
GAsyncResult *res,
GError **error)
{
GObject *ret;
GObject *source_object;
source_object = g_async_result_get_source_object (res);
ret = g_async_initable_new_finish (G_ASYNC_INITABLE (source_object), res, error);
g_object_unref (source_object);
if (ret != NULL)
return G_DBUS_OBJECT_MANAGER (ret);
else
return NULL;
}
/**
* example_object_manager_client_new_for_bus_sync:
* @bus_type: A #GBusType.
* @flags: Flags from the #GDBusObjectManagerClientFlags enumeration.
* @name: A bus name (well-known or unique).
* @object_path: An object path.
* @cancellable: (nullable): A #GCancellable or %NULL.
* @error: Return location for error or %NULL
*
* Like example_object_manager_client_new_sync() but takes a #GBusType instead of a #GDBusConnection.
*
* The calling thread is blocked until a reply is received.
*
* See example_object_manager_client_new_for_bus() for the asynchronous version of this constructor.
*
* Returns: (transfer full) (type ExampleObjectManagerClient): The constructed object manager client or %NULL if @error is set.
*/
GDBusObjectManager *
example_object_manager_client_new_for_bus_sync (
GBusType bus_type,
GDBusObjectManagerClientFlags flags,
const gchar *name,
const gchar *object_path,
GCancellable *cancellable,
GError **error)
{
GInitable *ret;
ret = g_initable_new (EXAMPLE_TYPE_OBJECT_MANAGER_CLIENT, cancellable, error, "flags", flags, "name", name, "bus-type", bus_type, "object-path", object_path, "get-proxy-type-func", example_object_manager_client_get_proxy_type, NULL);
if (ret != NULL)
return G_DBUS_OBJECT_MANAGER (ret);
else
return NULL;
}
| 34.434269 | 374 | 0.729116 | [
"object"
] |
9d3cc87d7799f4a92844cffa4fcb16424035689a | 4,020 | h | C | Station/ui.h | kamsza/WeatherStation | 97d5133148fc0ccfefd2b0c66b136bacaeaee807 | [
"MIT"
] | null | null | null | Station/ui.h | kamsza/WeatherStation | 97d5133148fc0ccfefd2b0c66b136bacaeaee807 | [
"MIT"
] | null | null | null | Station/ui.h | kamsza/WeatherStation | 97d5133148fc0ccfefd2b0c66b136bacaeaee807 | [
"MIT"
] | null | null | null | /**
* @author Jakub Tkacz
*
* The MIT License
*
* 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 SW_UI
#define SW_UI
#include "station.h"
#include "tft.h"
class UI;
class Scene;
class Scene
{
protected:
void (*_draw)(TFT *, Station *, Station, bool);
void (*_onEnter)(UI *);
void (*_onBack)(UI *);
void (*_onNext)(UI *);
void (*_onPrev)(UI *);
Station oldStation;
public:
/**
* @brief Construct a new Scene object
*
* Empty constructor that shouldn't be used in code
*/
Scene();
/**
* @brief Construct a new Scene object
*
* @param _draw - function which will draw scene. Draw function should take four arguments: pointer to display, pointer to current station, old station, is scene in init mode
* @param _onNext - function which will be fired when next button is pressed
* @param _onPrev - function which will be fired when prev button is pressed
* @param _onEnter - function which will be fired when enter button is pressed
* @param _onBack - function which will be fired when back button is pressed
*/
Scene(void (*_draw)(TFT *, Station *, Station, bool), void (*_onNext)(UI *), void (*_onPrev)(UI *), void (*_onEnter)(UI *), void (*_onBack)(UI *));
/**
* @brief Function drawing scene
*
* @param tft
* @param station
* @param isInit
*/
void draw(TFT *tft, Station *station, bool isInit);
/**
* @brief Function informing scene that next button is pressed
*
* @param ui - UI which informs scene of that event
*/
void onNext(UI *ui);
/**
* @brief Function informing scene that prev button is pressed
*
* @param ui - UI which informs scene of that event
*/
void onPrev(UI *ui);
/**
* @brief Function informing scene that enter button is pressed
*
* @param ui - UI which informs scene of that event
*/
void onEnter(UI *ui);
/**
* @brief Function informing scene that back button is pressed
*
* @param ui - UI which informs scene of that event
*/
void onBack(UI *ui);
};
class UI
{
protected:
Scene *scenes;
int numberOfScenes;
TFT *tft;
int currentSceneId;
Station *station;
bool refreshed = false;
bool *isInit;
public:
/**
* @brief Construct a new UI object
*
* @param scenes - array of scenes
* @param numberOfScenes
* @param tft
* @param station
*/
UI(Scene *scenes, int numberOfScenes, TFT *tft, Station *station);
/**
* @brief Go to next scene
*
*/
void next();
/**
* @brief Go to previous scene
*
*/
void prev();
/**
* @brief Draw current scene
*
*/
void draw();
/**
* @brief Inform UI that next button is pressed
*
*/
void onNext();
/**
* @brief Inform UI that prev button is pressed
*
*/
void onPrev();
/**
* @brief Inform UI that enter button is pressed
*
*/
void onEnter();
/**
* @brief Inform UI that back button is pressed
*
*/
void onBack();
};
#endif
| 24.216867 | 176 | 0.656965 | [
"object"
] |
9d3e6df1bc97231fff5fbb9f81bc61d8a2da4ecb | 651 | h | C | src/persistence/IDAOBlockchain.h | vincenzopalazzo/SpyCblock | a6c241ed03b03832287fd42f62ebf458f4432c08 | [
"Apache-2.0"
] | 18 | 2019-12-16T09:30:58.000Z | 2022-03-29T15:14:53.000Z | src/persistence/IDAOBlockchain.h | vincenzopalazzo/SpyCblock | a6c241ed03b03832287fd42f62ebf458f4432c08 | [
"Apache-2.0"
] | 8 | 2019-12-16T09:54:40.000Z | 2021-10-09T11:13:05.000Z | src/persistence/IDAOBlockchain.h | vincenzopalazzo/SpyCblock | a6c241ed03b03832287fd42f62ebf458f4432c08 | [
"Apache-2.0"
] | 2 | 2020-04-15T08:36:06.000Z | 2021-04-10T18:11:53.000Z | // Copyright (c) 2018-2019 Vincenzo Palazzo vicenzopalazzodev@gmail.com
// Distributed under the Apache License Version 2.0 software license,
// see https://www.apache.org/licenses/LICENSE-2.0.txt
#ifndef SPYCBLOCK_IDAOBLOCKCHAIN_H
#define SPYCBLOCK_IDAOBLOCKCHAIN_H
#include <vector>
#include "../structure/block/block.h"
namespace spyCBlock
{
class IDAOBlockchain
{
public:
virtual bool saveBlock(const std::string &inputPath, const std::string &outputPath) = 0;
virtual bool saveBlockCompress(const std::string &inputPath, const std::string &outputPath) = 0;
};
}
#endif //SPYCBLOCK_IDAOBLOCKCHAIN_H
| 23.25 | 106 | 0.731183 | [
"vector"
] |
9d3eed9272d3fca44d02da1e2366261a4e41c84b | 1,729 | h | C | src/include/util/thrust_transform_functions.h | h-vetinari/tsne-cuda | b740a7d46a07ca9415f072001839fb66a582a3fa | [
"BSD-3-Clause"
] | 1,400 | 2018-05-09T17:17:59.000Z | 2022-03-31T14:17:59.000Z | src/include/util/thrust_transform_functions.h | h-vetinari/tsne-cuda | b740a7d46a07ca9415f072001839fb66a582a3fa | [
"BSD-3-Clause"
] | 104 | 2018-06-06T09:21:31.000Z | 2022-03-05T03:11:35.000Z | src/include/util/thrust_transform_functions.h | h-vetinari/tsne-cuda | b740a7d46a07ca9415f072001839fb66a582a3fa | [
"BSD-3-Clause"
] | 113 | 2018-08-01T23:45:28.000Z | 2022-03-20T08:46:23.000Z | /**
* @brief Various transformations for thrust::transform
*
* @file thrust_transform_functions.h
* @author David Chan
* @date 2018-05-05
* Copyright (c) 2018, Regents of the University of California
*/
#ifndef SRC_INCLUDE_UTIL_THRUST_TRANSFORM_FUNCTIONS_H_
#define SRC_INCLUDE_UTIL_THRUST_TRANSFORM_FUNCTIONS_H_
namespace tsnecuda {
namespace util {
struct FunctionalExp {
__host__ __device__ float operator()(const float &x) const {
return exp(x);
}
};
struct FunctionalIncrementInverse {
__host__ __device__ float operator()(const float &x) const {
return 1 / (x + 1);
}
};
struct FunctionalKlDivergence {
__host__ __device__ float operator()(const float &x,
const float &y) const {
return x == 0.0f ? 0.0f : x * (log(x) - log(y));
}
};
struct FunctionalEntropy {
__host__ __device__ float operator()(const float &x) const {
float val = x*log(x);
return (val != val || isinf(val)) ? 0 : val;
}
};
struct FunctionalPower2 {
__host__ __device__ float operator()(const float &x) const {
return pow(2, x);
}
};
struct FunctionalSqrt {
__host__ __device__ float operator()(const float &x) const {
return pow(x, 0.5);
}
};
struct FunctionalSquare {
__host__ __device__ float operator()(const float &x) const {
return x * x;
}
};
struct FunctionalAbs {
__host__ __device__ float operator()(const float &x) const {
return fabsf(x);
}
};
struct FunctionalNanOrInf {
__host__ __device__ bool operator()(const float &x) const {
return isnan(x) || isinf(x);
}
};
} // namespace util
} // namespace tsnecuda
#endif // SRC_INCLUDE_UTIL_THRUST_TRANSFORM_FUNCTIONS_H_
| 25.426471 | 64 | 0.663389 | [
"transform"
] |
9d4bb751bfc83e962b57f330708fc9440e11beaf | 31,374 | h | C | media/capture/video/win/d3d_capture_test_utils.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | media/capture/video/win/d3d_capture_test_utils.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | media/capture/video/win/d3d_capture_test_utils.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | // Copyright 2021 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 MEDIA_CAPTURE_VIDEO_WIN_D3D_CAPTURE_TEST_UTILS_H_
#define MEDIA_CAPTURE_VIDEO_WIN_D3D_CAPTURE_TEST_UTILS_H_
#include <d3d11_4.h>
#include <wrl.h>
#include "base/memory/ref_counted.h"
#include "media/base/win/test_utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace media {
template <class... Interface>
class MockInterface
: public base::RefCountedThreadSafe<MockInterface<Interface...>> {
public:
// IUnknown
IFACEMETHODIMP QueryInterface(REFIID riid, void** object) {
if (riid == __uuidof(IUnknown)) {
this->AddRef();
*object = this;
return S_OK;
}
return E_NOINTERFACE;
}
IFACEMETHODIMP_(ULONG) AddRef() {
base::RefCountedThreadSafe<MockInterface<Interface...>>::AddRef();
return 1U;
}
IFACEMETHODIMP_(ULONG) Release() {
base::RefCountedThreadSafe<MockInterface<Interface...>>::Release();
return 1U;
}
protected:
friend class base::RefCountedThreadSafe<MockInterface<Interface...>>;
virtual ~MockInterface() = default;
};
template <class Interface, class... Interfaces>
class MockInterface<Interface, Interfaces...>
: public MockInterface<Interfaces...>, public Interface {
public:
IFACEMETHODIMP QueryInterface(REFIID riid, void** object) override {
if (riid == __uuidof(Interface)) {
this->AddRef();
*object = static_cast<Interface*>(this);
return S_OK;
}
return MockInterface<Interfaces...>::QueryInterface(riid, object);
}
IFACEMETHODIMP_(ULONG) AddRef() override {
return MockInterface<Interfaces...>::AddRef();
}
IFACEMETHODIMP_(ULONG) Release() override {
return MockInterface<Interfaces...>::Release();
}
};
class MockD3D11DeviceContext final : public MockInterface<ID3D11DeviceContext> {
public:
MockD3D11DeviceContext();
// ID3D11DeviceContext
IFACEMETHODIMP_(void)
VSSetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer* const* constant_buffers_out) override;
IFACEMETHODIMP_(void)
PSSetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView* const* shader_resource_views_out) override;
IFACEMETHODIMP_(void)
PSSetShader(ID3D11PixelShader* pixel_shader,
ID3D11ClassInstance* const* class_instances,
UINT num_class_instances) override;
IFACEMETHODIMP_(void)
PSSetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState* const* samplers_out) override;
IFACEMETHODIMP_(void)
VSSetShader(ID3D11VertexShader* vertex_shader,
ID3D11ClassInstance* const* class_instances,
UINT num_class_instances) override;
IFACEMETHODIMP_(void)
DrawIndexed(UINT index_count,
UINT start_index_location,
INT base_vertex_location) override;
IFACEMETHODIMP_(void)
Draw(UINT vertex_count, UINT start_vertex_location) override;
MOCK_METHOD5(OnMap,
HRESULT(ID3D11Resource*,
UINT,
D3D11_MAP,
UINT,
D3D11_MAPPED_SUBRESOURCE*));
IFACEMETHODIMP Map(ID3D11Resource* resource,
UINT subresource,
D3D11_MAP MapType,
UINT MapFlags,
D3D11_MAPPED_SUBRESOURCE* mapped_resource) override;
MOCK_METHOD2(OnUnmap, void(ID3D11Resource*, UINT));
IFACEMETHODIMP_(void)
Unmap(ID3D11Resource* resource, UINT subresource) override;
IFACEMETHODIMP_(void)
PSSetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer* const* constant_buffers) override;
IFACEMETHODIMP_(void)
IASetInputLayout(ID3D11InputLayout* input_layout) override;
IFACEMETHODIMP_(void)
IASetVertexBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer* const* vertex_buffers,
const UINT* strides,
const UINT* offsets) override;
IFACEMETHODIMP_(void)
IASetIndexBuffer(ID3D11Buffer* index_buffer,
DXGI_FORMAT format,
UINT offset) override;
IFACEMETHODIMP_(void)
DrawIndexedInstanced(UINT index_count_per_instance,
UINT instance_count,
UINT start_index_location,
INT base_vertex_location,
UINT start_instance_location) override;
IFACEMETHODIMP_(void)
DrawInstanced(UINT vertex_count_per_instance,
UINT instance_count,
UINT start_vertex_location,
UINT start_instance_location) override;
IFACEMETHODIMP_(void)
GSSetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer* const* constant_buffers) override;
IFACEMETHODIMP_(void)
GSSetShader(ID3D11GeometryShader* shader,
ID3D11ClassInstance* const* class_instances,
UINT num_class_instances) override;
IFACEMETHODIMP_(void)
IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY topology) override;
IFACEMETHODIMP_(void)
VSSetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView* const* shader_resource_views) override;
IFACEMETHODIMP_(void)
VSSetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState* const* samplers) override;
IFACEMETHODIMP_(void) Begin(ID3D11Asynchronous* async) override;
IFACEMETHODIMP_(void) End(ID3D11Asynchronous* async) override;
IFACEMETHODIMP GetData(ID3D11Asynchronous* async,
void* data,
UINT data_size,
UINT get_data_flags) override;
IFACEMETHODIMP_(void)
SetPredication(ID3D11Predicate* pPredicate, BOOL PredicateValue) override;
IFACEMETHODIMP_(void)
GSSetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView* const* shader_resource_views) override;
IFACEMETHODIMP_(void)
GSSetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState* const* samplers) override;
IFACEMETHODIMP_(void)
OMSetRenderTargets(UINT num_views,
ID3D11RenderTargetView* const* render_target_views,
ID3D11DepthStencilView* depth_stencil_view) override;
IFACEMETHODIMP_(void)
OMSetRenderTargetsAndUnorderedAccessViews(
UINT num_rtvs,
ID3D11RenderTargetView* const* render_target_views,
ID3D11DepthStencilView* depth_stencil_view,
UINT uav_start_slot,
UINT num_uavs,
ID3D11UnorderedAccessView* const* unordered_access_views,
const UINT* uav_initial_counts) override;
IFACEMETHODIMP_(void)
OMSetBlendState(ID3D11BlendState* blend_state,
const FLOAT blend_factor[4],
UINT sample_mask) override;
IFACEMETHODIMP_(void)
OMSetDepthStencilState(ID3D11DepthStencilState* depth_stencil_state,
UINT stencil_ref) override;
IFACEMETHODIMP_(void)
SOSetTargets(UINT num_buffers,
ID3D11Buffer* const* so_targets,
const UINT* offsets) override;
IFACEMETHODIMP_(void) DrawAuto() override;
IFACEMETHODIMP_(void)
DrawIndexedInstancedIndirect(ID3D11Buffer* buffer_for_args,
UINT aligned_byte_offset_for_args) override;
IFACEMETHODIMP_(void)
DrawInstancedIndirect(ID3D11Buffer* buffer_for_args,
UINT aligned_byte_offset_for_args) override;
IFACEMETHODIMP_(void)
Dispatch(UINT thread_group_count_x,
UINT thread_group_count_y,
UINT thread_group_count_z) override;
IFACEMETHODIMP_(void)
DispatchIndirect(ID3D11Buffer* buffer_for_args,
UINT aligned_byte_offset_for_args) override;
IFACEMETHODIMP_(void)
RSSetState(ID3D11RasterizerState* rasterizer_state) override;
IFACEMETHODIMP_(void)
RSSetViewports(UINT num_viewports, const D3D11_VIEWPORT* viewports) override;
IFACEMETHODIMP_(void)
RSSetScissorRects(UINT num_rects, const D3D11_RECT* rects) override;
IFACEMETHODIMP_(void)
CopySubresourceRegion(ID3D11Resource* dest_resource,
UINT dest_subresource,
UINT dest_x,
UINT dest_y,
UINT dest_z,
ID3D11Resource* source_resource,
UINT source_subresource,
const D3D11_BOX* source_box) override;
MOCK_METHOD8(OnCopySubresourceRegion,
void(ID3D11Resource*,
UINT,
UINT,
UINT,
UINT,
ID3D11Resource*,
UINT,
const D3D11_BOX*));
IFACEMETHODIMP_(void)
CopyResource(ID3D11Resource* dest_resource,
ID3D11Resource* source_resource) override;
IFACEMETHODIMP_(void)
UpdateSubresource(ID3D11Resource* dest_resource,
UINT dest_subresource,
const D3D11_BOX* dest_box,
const void* source_data,
UINT source_row_pitch,
UINT source_depth_pitch) override;
IFACEMETHODIMP_(void)
CopyStructureCount(ID3D11Buffer* dest_buffer,
UINT dest_aligned_byte_offset,
ID3D11UnorderedAccessView* source_view) override;
IFACEMETHODIMP_(void)
ClearRenderTargetView(ID3D11RenderTargetView* render_target_view,
const FLOAT color_rgba[4]) override;
IFACEMETHODIMP_(void)
ClearUnorderedAccessViewUint(ID3D11UnorderedAccessView* unordered_access_view,
const UINT values[4]) override;
IFACEMETHODIMP_(void)
ClearUnorderedAccessViewFloat(
ID3D11UnorderedAccessView* unordered_access_view,
const FLOAT values[4]) override;
IFACEMETHODIMP_(void)
ClearDepthStencilView(ID3D11DepthStencilView* depth_stencil_view,
UINT clear_flags,
FLOAT depth,
UINT8 stencil) override;
IFACEMETHODIMP_(void)
GenerateMips(ID3D11ShaderResourceView* shader_resource_view) override;
IFACEMETHODIMP_(void)
SetResourceMinLOD(ID3D11Resource* resource, FLOAT min_lod) override;
IFACEMETHODIMP_(FLOAT) GetResourceMinLOD(ID3D11Resource* resource) override;
IFACEMETHODIMP_(void)
ResolveSubresource(ID3D11Resource* dest_resource,
UINT dest_subresource,
ID3D11Resource* source_resource,
UINT source_subresource,
DXGI_FORMAT format) override;
IFACEMETHODIMP_(void)
ExecuteCommandList(ID3D11CommandList* command_list,
BOOL restore_context_state) override;
IFACEMETHODIMP_(void)
HSSetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView* const* shader_resource_views) override;
IFACEMETHODIMP_(void)
HSSetShader(ID3D11HullShader* hull_shader,
ID3D11ClassInstance* const* class_instances,
UINT num_class_instances) override;
IFACEMETHODIMP_(void)
HSSetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState* const* samplers) override;
IFACEMETHODIMP_(void)
HSSetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer* const* constant_buffers) override;
IFACEMETHODIMP_(void)
DSSetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView* const* shader_resource_views) override;
IFACEMETHODIMP_(void)
DSSetShader(ID3D11DomainShader* domain_shader,
ID3D11ClassInstance* const* class_instances,
UINT num_class_instances) override;
IFACEMETHODIMP_(void)
DSSetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState* const* samplers) override;
IFACEMETHODIMP_(void)
DSSetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer* const* constant_buffers) override;
IFACEMETHODIMP_(void)
CSSetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView* const* shader_resource_views) override;
IFACEMETHODIMP_(void)
CSSetUnorderedAccessViews(
UINT start_slot,
UINT num_uavs,
ID3D11UnorderedAccessView* const* unordered_access_views,
const UINT* uav_initial_counts) override;
IFACEMETHODIMP_(void)
CSSetShader(ID3D11ComputeShader* computer_shader,
ID3D11ClassInstance* const* class_instances,
UINT num_class_instances) override;
IFACEMETHODIMP_(void)
CSSetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState* const* samplers) override;
IFACEMETHODIMP_(void)
CSSetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer* const* constant_buffers) override;
IFACEMETHODIMP_(void)
VSGetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer** constant_buffers) override;
IFACEMETHODIMP_(void)
PSGetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView** shader_resource_views) override;
IFACEMETHODIMP_(void)
PSGetShader(ID3D11PixelShader** pixel_shader,
ID3D11ClassInstance** class_instances,
UINT* num_class_instances) override;
IFACEMETHODIMP_(void)
PSGetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState** samplers) override;
IFACEMETHODIMP_(void)
VSGetShader(ID3D11VertexShader** vertex_shader,
ID3D11ClassInstance** class_instances,
UINT* num_class_instances) override;
IFACEMETHODIMP_(void)
PSGetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer** constant_buffers) override;
IFACEMETHODIMP_(void)
IAGetInputLayout(ID3D11InputLayout** input_layout) override;
IFACEMETHODIMP_(void)
IAGetVertexBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer** vertex_buffers,
UINT* strides,
UINT* offsets) override;
IFACEMETHODIMP_(void)
IAGetIndexBuffer(ID3D11Buffer** index_buffer,
DXGI_FORMAT* format,
UINT* offset) override;
IFACEMETHODIMP_(void)
GSGetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer** constant_buffers) override;
IFACEMETHODIMP_(void)
GSGetShader(ID3D11GeometryShader** geometry_shader,
ID3D11ClassInstance** class_instances,
UINT* num_class_instances) override;
IFACEMETHODIMP_(void)
IAGetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY* topology) override;
IFACEMETHODIMP_(void)
VSGetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView** shader_resource_views) override;
IFACEMETHODIMP_(void)
VSGetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState** samplers) override;
IFACEMETHODIMP_(void)
GetPredication(ID3D11Predicate** predicate, BOOL* predicate_value) override;
IFACEMETHODIMP_(void)
GSGetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView** shader_resource_views) override;
IFACEMETHODIMP_(void)
GSGetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState** samplers) override;
IFACEMETHODIMP_(void)
OMGetRenderTargets(UINT num_views,
ID3D11RenderTargetView** render_target_views,
ID3D11DepthStencilView** depth_stencil_view) override;
IFACEMETHODIMP_(void)
OMGetRenderTargetsAndUnorderedAccessViews(
UINT num_rtvs,
ID3D11RenderTargetView** render_target_views,
ID3D11DepthStencilView** depth_stencil_view,
UINT uav_start_slot,
UINT num_uavs,
ID3D11UnorderedAccessView** unordered_access_views) override;
IFACEMETHODIMP_(void)
OMGetBlendState(ID3D11BlendState** blend_state,
FLOAT blend_factor[4],
UINT* sample_mask) override;
IFACEMETHODIMP_(void)
OMGetDepthStencilState(ID3D11DepthStencilState** depth_stencil_state,
UINT* stencil_ref) override;
IFACEMETHODIMP_(void)
SOGetTargets(UINT num_buffers, ID3D11Buffer** so_targets) override;
IFACEMETHODIMP_(void)
RSGetState(ID3D11RasterizerState** rasterizer_state) override;
IFACEMETHODIMP_(void)
RSGetViewports(UINT* num_viewports, D3D11_VIEWPORT* viewports) override;
IFACEMETHODIMP_(void)
RSGetScissorRects(UINT* num_rects, D3D11_RECT* rects) override;
IFACEMETHODIMP_(void)
HSGetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView** shader_resource_views) override;
IFACEMETHODIMP_(void)
HSGetShader(ID3D11HullShader** hull_shader,
ID3D11ClassInstance** class_instances,
UINT* num_class_instances) override;
IFACEMETHODIMP_(void)
HSGetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState** samplers) override;
IFACEMETHODIMP_(void)
HSGetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer** constant_buffers) override;
IFACEMETHODIMP_(void)
DSGetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView** shader_resource_views) override;
IFACEMETHODIMP_(void)
DSGetShader(ID3D11DomainShader** domain_shader,
ID3D11ClassInstance** class_instances,
UINT* num_class_instances) override;
IFACEMETHODIMP_(void)
DSGetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState** samplers) override;
IFACEMETHODIMP_(void)
DSGetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer** constant_buffers) override;
IFACEMETHODIMP_(void)
CSGetShaderResources(
UINT start_slot,
UINT num_views,
ID3D11ShaderResourceView** shader_resource_views) override;
IFACEMETHODIMP_(void)
CSGetUnorderedAccessViews(
UINT start_slot,
UINT num_uavs,
ID3D11UnorderedAccessView** unordered_access_views) override;
IFACEMETHODIMP_(void)
CSGetShader(ID3D11ComputeShader** pcomputer_shader,
ID3D11ClassInstance** class_instances,
UINT* num_class_instances) override;
IFACEMETHODIMP_(void)
CSGetSamplers(UINT start_slot,
UINT num_samplers,
ID3D11SamplerState** samplers) override;
IFACEMETHODIMP_(void)
CSGetConstantBuffers(UINT start_slot,
UINT num_buffers,
ID3D11Buffer** constant_buffers) override;
IFACEMETHODIMP_(void) ClearState() override;
IFACEMETHODIMP_(void) Flush() override;
IFACEMETHODIMP_(D3D11_DEVICE_CONTEXT_TYPE) GetType() override;
IFACEMETHODIMP_(UINT) GetContextFlags() override;
IFACEMETHODIMP FinishCommandList(BOOL restore_deferred_context_state,
ID3D11CommandList** command_list) override;
// ID3D11DeviceChild
IFACEMETHODIMP_(void) GetDevice(ID3D11Device** device) override;
IFACEMETHODIMP GetPrivateData(REFGUID guid,
UINT* data_size,
void* data) override;
IFACEMETHODIMP SetPrivateData(REFGUID guid,
UINT data_size,
const void* data) override;
IFACEMETHODIMP SetPrivateDataInterface(REFGUID guid,
const IUnknown* data) override;
private:
~MockD3D11DeviceContext() override;
};
class MockD3D11Device final : public MockInterface<ID3D11Device1> {
public:
MockD3D11Device();
IFACEMETHODIMP QueryInterface(REFIID riid, void** object) override {
if (riid == __uuidof(ID3D11Device)) {
this->AddRef();
*object = static_cast<ID3D11Device*>(this);
return S_OK;
}
return MockInterface::QueryInterface(riid, object);
}
// ID3D11Device
IFACEMETHODIMP CreateBuffer(const D3D11_BUFFER_DESC* desc,
const D3D11_SUBRESOURCE_DATA* initial_data,
ID3D11Buffer** ppBuffer);
IFACEMETHODIMP CreateTexture1D(const D3D11_TEXTURE1D_DESC* desc,
const D3D11_SUBRESOURCE_DATA* initial_data,
ID3D11Texture1D** texture1D);
IFACEMETHODIMP CreateTexture2D(const D3D11_TEXTURE2D_DESC* desc,
const D3D11_SUBRESOURCE_DATA* initial_data,
ID3D11Texture2D** texture2D);
MOCK_METHOD3(OnCreateTexture2D,
HRESULT(const D3D11_TEXTURE2D_DESC*,
const D3D11_SUBRESOURCE_DATA*,
ID3D11Texture2D**));
IFACEMETHODIMP CreateTexture3D(const D3D11_TEXTURE3D_DESC* desc,
const D3D11_SUBRESOURCE_DATA* initial_data,
ID3D11Texture3D** texture2D);
IFACEMETHODIMP CreateShaderResourceView(
ID3D11Resource* resource,
const D3D11_SHADER_RESOURCE_VIEW_DESC* desc,
ID3D11ShaderResourceView** srv);
IFACEMETHODIMP CreateUnorderedAccessView(
ID3D11Resource* resource,
const D3D11_UNORDERED_ACCESS_VIEW_DESC* desc,
ID3D11UnorderedAccessView** uaview);
IFACEMETHODIMP CreateRenderTargetView(
ID3D11Resource* resource,
const D3D11_RENDER_TARGET_VIEW_DESC* desc,
ID3D11RenderTargetView** rtv);
IFACEMETHODIMP CreateDepthStencilView(
ID3D11Resource* resource,
const D3D11_DEPTH_STENCIL_VIEW_DESC* desc,
ID3D11DepthStencilView** depth_stencil_view);
IFACEMETHODIMP CreateInputLayout(
const D3D11_INPUT_ELEMENT_DESC* input_element_descs,
UINT num_elements,
const void* shader_bytecode,
SIZE_T bytecode_length,
ID3D11InputLayout** input_layout);
IFACEMETHODIMP CreateVertexShader(const void* shader_bytecode,
SIZE_T bytecode_length,
ID3D11ClassLinkage* class_linkage,
ID3D11VertexShader** vertex_shader);
IFACEMETHODIMP CreateGeometryShader(const void* shader_bytecode,
SIZE_T bytecode_length,
ID3D11ClassLinkage* class_linkage,
ID3D11GeometryShader** geometry_shader);
IFACEMETHODIMP CreateGeometryShaderWithStreamOutput(
const void* shader_bytecode,
SIZE_T bytecode_length,
const D3D11_SO_DECLARATION_ENTRY* so_declaration,
UINT num_entries,
const UINT* buffer_strides,
UINT num_strides,
UINT rasterized_stream,
ID3D11ClassLinkage* class_linkage,
ID3D11GeometryShader** geometry_shader);
IFACEMETHODIMP CreatePixelShader(const void* shader_bytecode,
SIZE_T bytecode_length,
ID3D11ClassLinkage* class_linkage,
ID3D11PixelShader** pixel_shader);
IFACEMETHODIMP CreateHullShader(const void* shader_bytecode,
SIZE_T bytecode_length,
ID3D11ClassLinkage* class_linkage,
ID3D11HullShader** hull_shader);
IFACEMETHODIMP CreateDomainShader(const void* shader_bytecode,
SIZE_T bytecode_length,
ID3D11ClassLinkage* class_linkage,
ID3D11DomainShader** domain_shader);
IFACEMETHODIMP CreateComputeShader(const void* shader_bytecode,
SIZE_T bytecode_length,
ID3D11ClassLinkage* class_linkage,
ID3D11ComputeShader** compute_shader);
IFACEMETHODIMP CreateClassLinkage(ID3D11ClassLinkage** linkage);
IFACEMETHODIMP CreateBlendState(const D3D11_BLEND_DESC* blend_state_desc,
ID3D11BlendState** blend_state);
IFACEMETHODIMP CreateDepthStencilState(
const D3D11_DEPTH_STENCIL_DESC* depth_stencil_desc,
ID3D11DepthStencilState** depth_stencil_state);
IFACEMETHODIMP CreateRasterizerState(
const D3D11_RASTERIZER_DESC* rasterizer_desc,
ID3D11RasterizerState** rasterizer_state);
IFACEMETHODIMP CreateSamplerState(const D3D11_SAMPLER_DESC* sampler_desc,
ID3D11SamplerState** sampler_state);
IFACEMETHODIMP CreateQuery(const D3D11_QUERY_DESC* query_desc,
ID3D11Query** query);
IFACEMETHODIMP CreatePredicate(const D3D11_QUERY_DESC* predicate_desc,
ID3D11Predicate** predicate);
IFACEMETHODIMP CreateCounter(const D3D11_COUNTER_DESC* counter_desc,
ID3D11Counter** counter);
IFACEMETHODIMP CreateDeferredContext(UINT context_flags,
ID3D11DeviceContext** deferred_context);
IFACEMETHODIMP OpenSharedResource(HANDLE resource,
REFIID returned_interface,
void** resource_out);
IFACEMETHODIMP CheckFormatSupport(DXGI_FORMAT format, UINT* format_support);
IFACEMETHODIMP CheckMultisampleQualityLevels(DXGI_FORMAT format,
UINT sample_count,
UINT* num_quality_levels);
IFACEMETHODIMP_(void) CheckCounterInfo(D3D11_COUNTER_INFO* counter_info);
IFACEMETHODIMP CheckCounter(const D3D11_COUNTER_DESC* desc,
D3D11_COUNTER_TYPE* type,
UINT* active_counters,
LPSTR name,
UINT* name_length,
LPSTR units,
UINT* units_length,
LPSTR description,
UINT* description_length);
IFACEMETHODIMP CheckFeatureSupport(D3D11_FEATURE feature,
void* feature_support_data,
UINT feature_support_data_size);
IFACEMETHODIMP GetPrivateData(REFGUID guid, UINT* data_size, void* data);
IFACEMETHODIMP SetPrivateData(REFGUID guid, UINT data_size, const void* data);
IFACEMETHODIMP SetPrivateDataInterface(REFGUID guid, const IUnknown* data);
IFACEMETHODIMP_(D3D_FEATURE_LEVEL) GetFeatureLevel();
IFACEMETHODIMP_(UINT) GetCreationFlags();
IFACEMETHODIMP GetDeviceRemovedReason();
MOCK_METHOD0(OnGetDeviceRemovedReason, HRESULT());
IFACEMETHODIMP_(void)
GetImmediateContext(ID3D11DeviceContext** immediate_context);
IFACEMETHODIMP SetExceptionMode(UINT raise_flags);
IFACEMETHODIMP_(UINT) GetExceptionMode();
// ID3D11Device1
IFACEMETHODIMP_(void)
GetImmediateContext1(ID3D11DeviceContext1** immediate_context);
IFACEMETHODIMP CreateDeferredContext1(
UINT context_flags,
ID3D11DeviceContext1** deferred_context);
IFACEMETHODIMP CreateBlendState1(const D3D11_BLEND_DESC1* blend_state_desc,
ID3D11BlendState1** blend_state);
IFACEMETHODIMP CreateRasterizerState1(
const D3D11_RASTERIZER_DESC1* rasterizer_desc,
ID3D11RasterizerState1** rasterizer_state);
IFACEMETHODIMP CreateDeviceContextState(
UINT flags,
const D3D_FEATURE_LEVEL* feature_levels,
UINT feature_level_count,
UINT sdk_version,
REFIID emulated_interface,
D3D_FEATURE_LEVEL* chosen_feature_level,
ID3DDeviceContextState** context_state);
IFACEMETHODIMP OpenSharedResource1(HANDLE resource,
REFIID returned_interface,
void** resource_out);
MOCK_METHOD3(DoOpenSharedResource1, HRESULT(HANDLE, REFIID, void**));
IFACEMETHODIMP OpenSharedResourceByName(LPCWSTR name,
DWORD desired_access,
REFIID returned_interface,
void** resource_out);
void SetupDefaultMocks();
Microsoft::WRL::ComPtr<MockD3D11DeviceContext> mock_immediate_context_;
private:
~MockD3D11Device();
};
class MockDXGIResource final
: public MockInterface<IDXGIResource1, IDXGIKeyedMutex> {
public:
// IDXGIResource1
IFACEMETHODIMP CreateSubresourceSurface(UINT index, IDXGISurface2** surface);
IFACEMETHODIMP CreateSharedHandle(const SECURITY_ATTRIBUTES* attributes,
DWORD access,
LPCWSTR name,
HANDLE* handle);
// IDXGIResource
IFACEMETHODIMP GetSharedHandle(HANDLE* shared_handle);
IFACEMETHODIMP GetUsage(DXGI_USAGE* usage);
IFACEMETHODIMP SetEvictionPriority(UINT eviction_priority);
IFACEMETHODIMP GetEvictionPriority(UINT* eviction_priority);
// IDXGIDeviceSubObject
IFACEMETHODIMP GetDevice(REFIID riid, void** device);
// IDXGIObject
IFACEMETHODIMP SetPrivateData(REFGUID name, UINT data_size, const void* data);
IFACEMETHODIMP SetPrivateDataInterface(REFGUID name, const IUnknown* unknown);
IFACEMETHODIMP GetPrivateData(REFGUID name, UINT* data_size, void* data);
IFACEMETHODIMP GetParent(REFIID riid, void** parent);
// IDXGIKeyedMutex
IFACEMETHODIMP AcquireSync(UINT64 key, DWORD milliseconds) override;
IFACEMETHODIMP ReleaseSync(UINT64 key) override;
private:
~MockDXGIResource() override;
};
class MockD3D11Texture2D final : public MockInterface<ID3D11Texture2D> {
public:
MockD3D11Texture2D(D3D11_TEXTURE2D_DESC desc, ID3D11Device* device);
MockD3D11Texture2D();
// IUnknown
IFACEMETHODIMP QueryInterface(REFIID riid, void** object) override;
// ID3D11Texture2D
IFACEMETHODIMP_(void) GetDesc(D3D11_TEXTURE2D_DESC* desc);
// ID3D11Resource
IFACEMETHODIMP_(void) GetType(D3D11_RESOURCE_DIMENSION* resource_dimension);
IFACEMETHODIMP_(void) SetEvictionPriority(UINT eviction_priority);
IFACEMETHODIMP_(UINT) GetEvictionPriority();
// ID3D11DeviceChild
IFACEMETHODIMP_(void) GetDevice(ID3D11Device** device);
IFACEMETHODIMP GetPrivateData(REFGUID guid, UINT* data_size, void* data);
MOCK_STDCALL_METHOD3(SetPrivateData,
HRESULT(REFGUID guid, UINT data_size, const void* data));
IFACEMETHODIMP SetPrivateDataInterface(REFGUID guid, const IUnknown* data);
void SetupDefaultMocks();
Microsoft::WRL::ComPtr<MockDXGIResource> mock_resource_;
private:
~MockD3D11Texture2D() override;
D3D11_TEXTURE2D_DESC desc_ = {};
Microsoft::WRL::ComPtr<ID3D11Device> device_;
};
} // namespace media
#endif // MEDIA_CAPTURE_VIDEO_WIN_D3D_CAPTURE_TEST_UTILS_H_
| 42.22611 | 80 | 0.672786 | [
"object"
] |
9d4ea1c31074ef71bcb1deeef5f1c02ab5ef8d96 | 8,234 | h | C | B2G/gecko/content/events/src/nsDOMEventTargetHelper.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-08-31T15:24:31.000Z | 2020-04-24T20:31:29.000Z | B2G/gecko/content/events/src/nsDOMEventTargetHelper.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | null | null | null | B2G/gecko/content/events/src/nsDOMEventTargetHelper.h | wilebeast/FireFox-OS | 43067f28711d78c429a1d6d58c77130f6899135f | [
"Apache-2.0"
] | 3 | 2015-07-29T07:17:15.000Z | 2020-11-04T06:55:37.000Z | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsDOMEventTargetHelper_h_
#define nsDOMEventTargetHelper_h_
#include "nsCOMPtr.h"
#include "nsGkAtoms.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMEventListener.h"
#include "nsCycleCollectionParticipant.h"
#include "nsPIDOMWindow.h"
#include "nsIScriptGlobalObject.h"
#include "nsEventListenerManager.h"
#include "nsIScriptContext.h"
#include "nsWrapperCache.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/Attributes.h"
class nsDOMEvent;
class nsDOMEventTargetHelper : public nsIDOMEventTarget,
public nsWrapperCache
{
public:
nsDOMEventTargetHelper() : mOwner(nullptr), mHasOrHasHadOwner(false) {}
virtual ~nsDOMEventTargetHelper();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS(nsDOMEventTargetHelper)
NS_DECL_NSIDOMEVENTTARGET
void AddEventListener(const nsAString& aType,
nsIDOMEventListener* aCallback, // XXX nullable
bool aCapture, Nullable<bool>& aWantsUntrusted,
mozilla::ErrorResult& aRv)
{
aRv = AddEventListener(aType, aCallback, aCapture,
!aWantsUntrusted.IsNull() && aWantsUntrusted.Value(),
aWantsUntrusted.IsNull() ? 1 : 2);
}
void RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aCallback,
bool aCapture, mozilla::ErrorResult& aRv)
{
aRv = RemoveEventListener(aType, aCallback, aCapture);
}
bool DispatchEvent(nsIDOMEvent* aEvent, mozilla::ErrorResult& aRv)
{
bool result = false;
aRv = DispatchEvent(aEvent, &result);
return result;
}
void GetParentObject(nsIScriptGlobalObject **aParentObject)
{
if (mOwner) {
CallQueryInterface(mOwner, aParentObject);
}
else {
*aParentObject = nullptr;
}
}
static nsDOMEventTargetHelper* FromSupports(nsISupports* aSupports)
{
nsIDOMEventTarget* target =
static_cast<nsIDOMEventTarget*>(aSupports);
#ifdef DEBUG
{
nsCOMPtr<nsIDOMEventTarget> target_qi =
do_QueryInterface(aSupports);
// If this assertion fires the QI implementation for the object in
// question doesn't use the nsIDOMEventTarget pointer as the
// nsISupports pointer. That must be fixed, or we'll crash...
NS_ASSERTION(target_qi == target, "Uh, fix QI!");
}
#endif
return static_cast<nsDOMEventTargetHelper*>(target);
}
void Init(JSContext* aCx = nullptr);
bool HasListenersFor(const nsAString& aType)
{
return mListenerManager && mListenerManager->HasListenersFor(aType);
}
nsresult SetEventHandler(nsIAtom* aType,
JSContext* aCx,
const JS::Value& aValue);
void GetEventHandler(nsIAtom* aType,
JSContext* aCx,
JS::Value* aValue);
nsresult CheckInnerWindowCorrectness()
{
NS_ENSURE_STATE(!mHasOrHasHadOwner || mOwner);
if (mOwner) {
NS_ASSERTION(mOwner->IsInnerWindow(), "Should have inner window here!\n");
nsPIDOMWindow* outer = mOwner->GetOuterWindow();
if (!outer || outer->GetCurrentInnerWindow() != mOwner) {
return NS_ERROR_FAILURE;
}
}
return NS_OK;
}
void BindToOwner(nsPIDOMWindow* aOwner);
void BindToOwner(nsDOMEventTargetHelper* aOther);
virtual void DisconnectFromOwner();
nsPIDOMWindow* GetOwner() const { return mOwner; }
bool HasOrHasHadOwner() { return mHasOrHasHadOwner; }
protected:
nsRefPtr<nsEventListenerManager> mListenerManager;
// Dispatch a trusted, non-cancellable and non-bubbling event to |this|.
nsresult DispatchTrustedEvent(const nsAString& aEventName);
// Make |event| trusted and dispatch |aEvent| to |this|.
nsresult DispatchTrustedEvent(nsIDOMEvent* aEvent);
private:
// These may be null (native callers or xpcshell).
nsPIDOMWindow* mOwner; // Inner window.
bool mHasOrHasHadOwner;
};
#define NS_IMPL_EVENT_HANDLER(_class, _event) \
NS_IMETHODIMP _class::GetOn##_event(JSContext* aCx, JS::Value* aValue) \
{ \
GetEventHandler(nsGkAtoms::on##_event, aCx, aValue); \
return NS_OK; \
} \
NS_IMETHODIMP _class::SetOn##_event(JSContext* aCx, \
const JS::Value& aValue) \
{ \
return SetEventHandler(nsGkAtoms::on##_event, aCx, aValue); \
}
#define NS_IMPL_FORWARD_EVENT_HANDLER(_class, _event, _baseclass) \
NS_IMETHODIMP _class::GetOn##_event(JSContext* aCx, JS::Value* aValue) \
{ \
return _baseclass::GetOn##_event(aCx, aValue); \
} \
NS_IMETHODIMP _class::SetOn##_event(JSContext* aCx, \
const JS::Value& aValue) \
{ \
return _baseclass::SetOn##_event(aCx, aValue); \
}
/* Use this macro to declare functions that forward the behavior of this
* interface to another object.
* This macro doesn't forward PreHandleEvent because sometimes subclasses
* want to override it.
*/
#define NS_FORWARD_NSIDOMEVENTTARGET_NOPREHANDLEEVENT(_to) \
NS_IMETHOD AddEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture, bool wantsUntrusted, uint8_t _argc) { \
return _to AddEventListener(type, listener, useCapture, wantsUntrusted, _argc); \
} \
NS_IMETHOD AddSystemEventListener(const nsAString & type, nsIDOMEventListener *listener, bool aUseCapture, bool aWantsUntrusted, uint8_t _argc) { \
return _to AddSystemEventListener(type, listener, aUseCapture, aWantsUntrusted, _argc); \
} \
NS_IMETHOD RemoveEventListener(const nsAString & type, nsIDOMEventListener *listener, bool useCapture) { \
return _to RemoveEventListener(type, listener, useCapture); \
} \
NS_IMETHOD RemoveSystemEventListener(const nsAString & type, nsIDOMEventListener *listener, bool aUseCapture) { \
return _to RemoveSystemEventListener(type, listener, aUseCapture); \
} \
NS_IMETHOD DispatchEvent(nsIDOMEvent *evt, bool *_retval) { \
return _to DispatchEvent(evt, _retval); \
} \
virtual nsIDOMEventTarget * GetTargetForDOMEvent(void) { \
return _to GetTargetForDOMEvent(); \
} \
virtual nsIDOMEventTarget * GetTargetForEventTargetChain(void) { \
return _to GetTargetForEventTargetChain(); \
} \
virtual nsresult WillHandleEvent(nsEventChainPostVisitor & aVisitor) { \
return _to WillHandleEvent(aVisitor); \
} \
virtual nsresult PostHandleEvent(nsEventChainPostVisitor & aVisitor) { \
return _to PostHandleEvent(aVisitor); \
} \
virtual nsresult DispatchDOMEvent(nsEvent *aEvent, nsIDOMEvent *aDOMEvent, nsPresContext *aPresContext, nsEventStatus *aEventStatus) { \
return _to DispatchDOMEvent(aEvent, aDOMEvent, aPresContext, aEventStatus); \
} \
virtual nsEventListenerManager * GetListenerManager(bool aMayCreate) { \
return _to GetListenerManager(aMayCreate); \
} \
virtual nsIScriptContext * GetContextForEventHandlers(nsresult *aRv) { \
return _to GetContextForEventHandlers(aRv); \
} \
virtual JSContext * GetJSContextForEventHandlers(void) { \
return _to GetJSContextForEventHandlers(); \
}
#endif // nsDOMEventTargetHelper_h_
| 41.376884 | 149 | 0.634928 | [
"object"
] |
9d63ba4b5eb860556fba2c11fead94d6e14624ce | 1,357 | h | C | src/comp_snake.h | m-pushkar/CppND-Capstone-Snake-Game | e69783f76a3a92ec0ba53a02867f83fccb491602 | [
"MIT"
] | 1 | 2020-07-09T17:49:50.000Z | 2020-07-09T17:49:50.000Z | src/comp_snake.h | m-pushkar/CppND-Capstone-Snake-Game | e69783f76a3a92ec0ba53a02867f83fccb491602 | [
"MIT"
] | null | null | null | src/comp_snake.h | m-pushkar/CppND-Capstone-Snake-Game | e69783f76a3a92ec0ba53a02867f83fccb491602 | [
"MIT"
] | null | null | null | #ifndef COMP_SNAKE_H
#define COMP_SNAKE_H
#include "snake.h"
#include <iostream>
#include <vector>
#include <thread>
#include <chrono>
#include <algorithm>
#include <mutex>
#include <utility>
class Comp_snake : public Snake
{
public:
Comp_snake(const int &grid_width, const int &grid_height, int &&num) : Snake(grid_width, grid_height, std::move(num))
{
speed = 0.1f;
}
void Update(const Snake &other) override;
void record_food(const SDL_Point &position);
void new_path() { update_path = true; }
private:
bool update_path{false};
SDL_Point _food{0, 0};
Direction _last_dir{unknown};
struct Change
{
int x;
int y;
Direction action;
};
struct Find
{
public:
Find() : x(-1), y(-1){};
Find(int current_x, int current_y) : x(current_x), y(current_y){};
int x;
int y;
int cost{0};
bool visited{false};
Direction action{unknown};
SDL_Point parent{-1, -1};
// Functions
bool operator<(Find const &a) const
{
return (cost > a.cost) ? true : false;
}
};
bool path_search(std::vector<std::vector<Direction>> &direction_arr, const SDL_Point &food, const SDL_Point &head, int &&grid_width, int &&grid_height);
std::vector<Change> change_list = {{0, -1, kUp}, {0, 1, kDown}, {-1, 0, kLeft}, {1, 0, kRight}}; /*move: up, down, left, right */
};
#endif
| 22.245902 | 154 | 0.642594 | [
"vector"
] |
9d699eddf8c336b4172951ef955d53490946785e | 10,351 | c | C | Cpp-C/Eta/Impl/Transport/ripcssldh.c | TransFICC/Elektron-SDK | 4323249c24c8105e41fd8cd9ba5dd9661e1b2b0e | [
"Apache-2.0"
] | null | null | null | Cpp-C/Eta/Impl/Transport/ripcssldh.c | TransFICC/Elektron-SDK | 4323249c24c8105e41fd8cd9ba5dd9661e1b2b0e | [
"Apache-2.0"
] | null | null | null | Cpp-C/Eta/Impl/Transport/ripcssldh.c | TransFICC/Elektron-SDK | 4323249c24c8105e41fd8cd9ba5dd9661e1b2b0e | [
"Apache-2.0"
] | null | null | null | /*|-----------------------------------------------------------------------------
*| This source code is provided under the Apache 2.0 license --
*| and is provided AS IS with no warranty or guarantee of fit for purpose. --
*| See the project's LICENSE.md for details. --
*| Copyright Thomson Reuters 2018. All rights reserved. --
*|-----------------------------------------------------------------------------
*/
#include "rtr/ripcsslutils.h"
#include "rtr/ripcssljit.h"
/* ----BEGIN GENERATED SECTION-------- */
/*
** Diffie-Hellman-Parameters: (512 bit)
** prime:
** 00:d4:bc:d5:24:06:f6:9b:35:99:4b:88:de:5d:b8:
** 96:82:c8:15:7f:62:d8:f3:36:33:ee:57:72:f1:1f:
** 05:ab:22:d6:b5:14:5b:9f:24:1e:5a:cc:31:ff:09:
** 0a:4b:c7:11:48:97:6f:76:79:50:94:e7:1e:79:03:
** 52:9f:5a:82:4b
** generator: 2 (0x2)
** Diffie-Hellman-Parameters: (1024 bit)
** prime:
** 00:e6:96:9d:3d:49:5b:e3:2c:7c:f1:80:c3:bd:d4:
** 79:8e:91:b7:81:82:51:bb:05:5e:2a:20:64:90:4a:
** 79:a7:70:fa:15:a2:59:cb:d5:23:a6:a6:ef:09:c4:
** 30:48:d5:a2:2f:97:1f:3c:20:12:9b:48:00:0e:6e:
** dd:06:1c:bc:05:3e:37:1d:79:4e:53:27:df:61:1e:
** bb:be:1b:ac:9b:5c:60:44:cf:02:3d:76:e0:5e:ea:
** 9b:ad:99:1b:13:a6:3c:97:4e:9e:f1:83:9e:b5:db:
** 12:51:36:f7:26:2e:56:a8:87:15:38:df:d8:23:c6:
** 50:50:85:e2:1f:0d:d5:c8:6b
** generator: 2 (0x2)
** Diffie-Hellman-Parameters: (2048 bit)
** prime:
** :D4:6F:16:44:97:C1:BD:6A:43:A4:A0:96:87:2D:0D:
** 4B:6E:21:AB:82:50:70:5A:27:72:03:BE:80:4C:71:
** 31:16:34:06:68:BC:1A:7D:D5:30:3D:7C:42:F9:C2:
** 92:D5:D8:45:22:2B:07:4A:D1:72:A9:4B:5D:A8:58:
** B9:38:CF:16:E0:68:5F:89:8D:CB:00:52:6C:AC:9A:
** 61:83:5C:CC:47:6A:84:17:A2:C1:CE:FB:17:56:F2:
** C4:20:B4:ED:EB:EC:5B:24:B9:78:39:4A:A6:E8:BD:
** 3B:FB:40:C9:82:56:C5:1F:D3:1F:8B:9C:81:24:D5:
** 2C:43:45:91:EB:B2:E3:92:08:C9:89:32:AB:33:5E:
** 7D:8F:0F:C2:D3:E0:2D:D6:E2:F4:C4:0C:44:50:AC:
** D8:C6:8E:E9:81:8F:3E:91:D4:4B:A1:5D:B7:1C:A2:
** 66:69:BE:4F:CE:87:A5:CE:2D:C8:DF:C8:13:63:0A:
** 81:A1:D2:3C:37:C9:3D:5E:2C:EA:A0:5D:8B:C6:5A:
** 7E:D0:A8:50:1E:0F:F8:AD:6D:DE:9B:DE:E2:51:39:
** 07:CD:F8:6D:3F:4F:83:A5:F8:A5:08:F1:5C:4D:13:
** 3A:14:7C:C4:8F:27:E2:EA:05:B5:AD:E3:26:4D:3F:
** AC:C4:D3:3D:1B:F8:72:44:90:44:B4:90:35:AF:46:
** 5F
** generator: 2 (0x2)
*/
static unsigned char dh512_p[] =
{
0xD4, 0xBC, 0xD5, 0x24, 0x06, 0xF6, 0x9B, 0x35, 0x99, 0x4B, 0x88, 0xDE,
0x5D, 0xB8, 0x96, 0x82, 0xC8, 0x15, 0x7F, 0x62, 0xD8, 0xF3, 0x36, 0x33,
0xEE, 0x57, 0x72, 0xF1, 0x1F, 0x05, 0xAB, 0x22, 0xD6, 0xB5, 0x14, 0x5B,
0x9F, 0x24, 0x1E, 0x5A, 0xCC, 0x31, 0xFF, 0x09, 0x0A, 0x4B, 0xC7, 0x11,
0x48, 0x97, 0x6F, 0x76, 0x79, 0x50, 0x94, 0xE7, 0x1E, 0x79, 0x03, 0x52,
0x9F, 0x5A, 0x82, 0x4B,
};
static unsigned char dh512_g[] =
{
0x02,
};
static OPENSSL_DH *get_dh512(ripcCryptoApiFuncs* cryptoFuncs)
{
OPENSSL_DH *dh;
if ((dh = (*(cryptoFuncs->dh_new))()) == NULL)
return (NULL);
/* dh->p = (*(cryptoFuncs->bin2bn))(dh512_p, sizeof(dh512_p), NULL);
dh->g = (*(cryptoFuncs->bin2bn))(dh512_g, sizeof(dh512_g), NULL);
if ((dh->p == NULL) || (dh->g == NULL))
{
(*(cryptoFuncs->dh_free))(dh);
return (NULL);
}*/
return (dh);
}
static unsigned char dh1024_p[] =
{
0xE6, 0x96, 0x9D, 0x3D, 0x49, 0x5B, 0xE3, 0x2C, 0x7C, 0xF1, 0x80, 0xC3,
0xBD, 0xD4, 0x79, 0x8E, 0x91, 0xB7, 0x81, 0x82, 0x51, 0xBB, 0x05, 0x5E,
0x2A, 0x20, 0x64, 0x90, 0x4A, 0x79, 0xA7, 0x70, 0xFA, 0x15, 0xA2, 0x59,
0xCB, 0xD5, 0x23, 0xA6, 0xA6, 0xEF, 0x09, 0xC4, 0x30, 0x48, 0xD5, 0xA2,
0x2F, 0x97, 0x1F, 0x3C, 0x20, 0x12, 0x9B, 0x48, 0x00, 0x0E, 0x6E, 0xDD,
0x06, 0x1C, 0xBC, 0x05, 0x3E, 0x37, 0x1D, 0x79, 0x4E, 0x53, 0x27, 0xDF,
0x61, 0x1E, 0xBB, 0xBE, 0x1B, 0xAC, 0x9B, 0x5C, 0x60, 0x44, 0xCF, 0x02,
0x3D, 0x76, 0xE0, 0x5E, 0xEA, 0x9B, 0xAD, 0x99, 0x1B, 0x13, 0xA6, 0x3C,
0x97, 0x4E, 0x9E, 0xF1, 0x83, 0x9E, 0xB5, 0xDB, 0x12, 0x51, 0x36, 0xF7,
0x26, 0x2E, 0x56, 0xA8, 0x87, 0x15, 0x38, 0xDF, 0xD8, 0x23, 0xC6, 0x50,
0x50, 0x85, 0xE2, 0x1F, 0x0D, 0xD5, 0xC8, 0x6B,
};
static unsigned char dh1024_g[] =
{
0x02,
};
static OPENSSL_DH *get_dh1024(ripcCryptoApiFuncs* cryptoFuncs)
{
OPENSSL_DH *dh;
if ((dh = (*(cryptoFuncs->dh_new))()) == NULL)
return (NULL);
/*dh->p = (*(cryptoFuncs->bin2bn))(dh1024_p, sizeof(dh1024_p), NULL);
dh->g = (*(cryptoFuncs->bin2bn))(dh1024_g, sizeof(dh1024_g), NULL);
if ((dh->p == NULL) || (dh->g == NULL))
{
(*(cryptoFuncs->dh_free))(dh);
return (NULL);
}*/
return (dh);
}
static unsigned char dh2048_p[] =
{
0xD4, 0x6F, 0x16, 0x44, 0x97, 0xC1, 0xBD, 0x6A, 0x43, 0xA4, 0xA0, 0x96,
0x87, 0x2D, 0x0D, 0x4B, 0x6E, 0x21, 0xAB, 0x82, 0x50, 0x70, 0x5A, 0x27,
0x72, 0x03, 0xBE, 0x80, 0x4C, 0x71, 0x31, 0x16, 0x34, 0x06, 0x68, 0xBC,
0x1A, 0x7D, 0xD5, 0x30, 0x3D, 0x7C, 0x42, 0xF9, 0xC2, 0x92, 0xD5, 0xD8,
0x45, 0x22, 0x2B, 0x07, 0x4A, 0xD1, 0x72, 0xA9, 0x4B, 0x5D, 0xA8, 0x58,
0xB9, 0x38, 0xCF, 0x16, 0xE0, 0x68, 0x5F, 0x89, 0x8D, 0xCB, 0x00, 0x52,
0x6C, 0xAC, 0x9A, 0x61, 0x83, 0x5C, 0xCC, 0x47, 0x6A, 0x84, 0x17, 0xA2,
0xC1, 0xCE, 0xFB, 0x17, 0x56, 0xF2, 0xC4, 0x20, 0xB4, 0xED, 0xEB, 0xEC,
0x5B, 0x24, 0xB9, 0x78, 0x39, 0x4A, 0xA6, 0xE8, 0xBD, 0x3B, 0xFB, 0x40,
0xC9, 0x82, 0x56, 0xC5, 0x1F, 0xD3, 0x1F, 0x8B, 0x9C, 0x81, 0x24, 0xD5,
0x2C, 0x43, 0x45, 0x91, 0xEB, 0xB2, 0xE3, 0x92, 0x08, 0xC9, 0x89, 0x32,
0xAB, 0x33, 0x5E, 0x7D, 0x8F, 0x0F, 0xC2, 0xD3, 0xE0, 0x2D, 0xD6, 0xE2,
0xF4, 0xC4, 0x0C, 0x44, 0x50, 0xAC, 0xD8, 0xC6, 0x8E, 0xE9, 0x81, 0x8F,
0x3E, 0x91, 0xD4, 0x4B, 0xA1, 0x5D, 0xB7, 0x1C, 0xA2, 0x66, 0x69, 0xBE,
0x4F, 0xCE, 0x87, 0xA5, 0xCE, 0x2D, 0xC8, 0xDF, 0xC8, 0x13, 0x63, 0x0A,
0x81, 0xA1, 0xD2, 0x3C, 0x37, 0xC9, 0x3D, 0x5E, 0x2C, 0xEA, 0xA0, 0x5D,
0x8B, 0xC6, 0x5A, 0x7E, 0xD0, 0xA8, 0x50, 0x1E, 0x0F, 0xF8, 0xAD, 0x6D,
0xDE, 0x9B, 0xDE, 0xE2, 0x51, 0x39, 0x07, 0xCD, 0xF8, 0x6D, 0x3F, 0x4F,
0x83, 0xA5, 0xF8, 0xA5, 0x08, 0xF1, 0x5C, 0x4D, 0x13, 0x3A, 0x14, 0x7C,
0xC4, 0x8F, 0x27, 0xE2, 0xEA, 0x05, 0xB5, 0xAD, 0xE3, 0x26, 0x4D, 0x3F,
0xAC, 0xC4, 0xD3, 0x3D, 0x1B, 0xF8, 0x72, 0x44, 0x90, 0x44, 0xB4, 0x90,
0x35, 0xAF, 0x46, 0x5F,
};
static unsigned char dh2048_g[] =
{
0x02,
};
static OPENSSL_DH *get_dh2048(ripcCryptoApiFuncs* cryptoFuncs)
{
OPENSSL_DH *dh;
if ((dh = (*(cryptoFuncs->dh_new))()) == NULL)
return (NULL);
/*dh->p = (*(cryptoFuncs->bin2bn))(dh1024_p, sizeof(dh1024_p), NULL);
dh->g = (*(cryptoFuncs->bin2bn))(dh1024_g, sizeof(dh1024_g), NULL);
if ((dh->p == NULL) || (dh->g == NULL))
{
(*(cryptoFuncs->dh_free))(dh);
return (NULL);
}*/
return (dh);
}
/*
static unsigned char dh4096_p[] =
{
};
static unsigned char dh4096_g[] =
{
0x02,
};
static DH *get_dh4096()
{
DH *dh;
if ((dh = DH_new()) == NULL)
return (NULL);
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
if ((dh->p == NULL) || (dh->g == NULL))
{
DH_free(dh);
return (NULL);
}
return (dh);
}
static unsigned char dh8192_p[] =
{
};
static unsigned char dh8192_g[] =
{
0x02,
};
static DH *get_dh8192()
{
DH *dh;
if ((dh = DH_new()) == NULL)
return (NULL);
dh->p = BN_bin2bn(dh1024_p, sizeof(dh1024_p), NULL);
dh->g = BN_bin2bn(dh1024_g, sizeof(dh1024_g), NULL);
if ((dh->p == NULL) || (dh->g == NULL))
{
DH_free(dh);
return (NULL);
}
return (dh);
}
*/
/* ----END GENERATED SECTION---------- */
OPENSSL_DH *ripcSSLDHGetTmpParam(int nKeyLen, ripcSSLApiFuncs* sslFuncs, ripcCryptoApiFuncs* cryptoFuncs)
{
OPENSSL_DH *dh;
if (nKeyLen == 512)
dh = get_dh512(cryptoFuncs);
else if (nKeyLen == 1024)
dh = get_dh1024(cryptoFuncs);
else if (nKeyLen == 2048)
dh = get_dh2048(cryptoFuncs);
else
dh = get_dh2048(cryptoFuncs);
return dh;
}
OPENSSL_DH *ripcSSLDHGetParamFile( char *file, ripcSSLApiFuncs* sslFuncs, ripcCryptoApiFuncs* cryptoFuncs)
{
OPENSSL_DH *dh = NULL;
OPENSSL_BIO *bio;
if ((bio = (*(sslFuncs->BIO_new_file))(file, "r")) == NULL)
return NULL;
dh = (*(cryptoFuncs->read_bio_dhparams))(bio, NULL, NULL, NULL);
(*(sslFuncs->BIO_free))(bio);
return (dh);
}
/*
=cut
##
## Embedded Perl script for generating the temporary DH parameters
##
require 5.003;
use strict;
# configuration
my $file = $0;
my $begin = '----BEGIN GENERATED SECTION--------';
my $end = '----END GENERATED SECTION----------';
# read ourself and keep a backup
open(FP, "<$file") || die;
my $source = '';
$source .= $_ while (<FP>);
close(FP);
open(FP, ">$file.bak") || die;
print FP $source;
close(FP);
# generate the DH parameters
print "1. Generate 512 and 1024 bit Diffie-Hellman parameters (p, g)\n";
my $rand = '';
foreach $file (qw(/var/log/messages /var/adm/messages
/kernel /vmunix /vmlinuz /etc/hosts /etc/resolv.conf)) {
if (-f $file) {
$rand = $file if ($rand eq '');
$rand .= ":$file" if ($rand ne '');
}
}
$rand = "-rand $rand" if ($rand ne '');
system("openssl gendh $rand -out dh512.pem 512");
system("openssl gendh $rand -out dh1024.pem 1024");
# generate DH param info
my $dhinfo = '';
open(FP, "openssl dh -noout -text -in dh512.pem |") || die;
$dhinfo .= $_ while (<FP>);
close(FP);
open(FP, "openssl dh -noout -text -in dh1024.pem |") || die;
$dhinfo .= $_ while (<FP>);
close(FP);
$dhinfo =~ s|^|** |mg;
$dhinfo = "\n\/\*\n$dhinfo\*\/\n\n";
# generate C source from DH params
my $dhsource = '';
open(FP, "openssl dh -noout -C -in dh512.pem | indent | expand -8 |") || die;
$dhsource .= $_ while (<FP>);
close(FP);
open(FP, "openssl dh -noout -C -in dh1024.pem | indent | expand -8 |") || die;
$dhsource .= $_ while (<FP>);
close(FP);
$dhsource =~ s|(DH\s+\*get_dh)|static $1|sg;
# generate output
my $o = $dhinfo . $dhsource;
# insert the generated code at the target location
$source =~ s|(\/\* $begin.+?\n).*\n(.*?\/\* $end)|$1$o$2|s;
# and update the source on disk
print "Updating file `$file'\n";
open(FP, ">$file") || die;
print FP $source;
close(FP);
# cleanup
unlink("dh512.pem");
unlink("dh1024.pem");
=pod
*/
| 31.557927 | 106 | 0.586513 | [
"3d"
] |
9d7225c3a43156adde30b4077e7ea3189cf61a74 | 6,359 | c | C | common/yael_v260_modif/progs/kmeans.c | yijiuzai/videosearch | 01cc522de94509a9401310220d1ffa477a03b93f | [
"MIT"
] | 297 | 2015-02-02T06:48:13.000Z | 2022-03-25T06:53:33.000Z | base_engine/lib/yael_v260_modif/progs/kmeans.c | AiPratice/VideoAnalysisTool | e6aa67e5b0d08d6b3ae1b63988982ef31e60bf7a | [
"Apache-2.0"
] | 18 | 2015-09-08T14:03:25.000Z | 2020-05-14T18:53:47.000Z | base_engine/lib/yael_v260_modif/progs/kmeans.c | AiPratice/VideoAnalysisTool | e6aa67e5b0d08d6b3ae1b63988982ef31e60bf7a | [
"Apache-2.0"
] | 109 | 2015-01-23T23:41:13.000Z | 2022-01-11T09:06:47.000Z | /*
Copyright © INRIA 2010-2011.
Authors: Matthijs Douze & Herve Jegou
Contact: matthijs.douze@inria.fr herve.jegou@inria.fr
This software is a computer program whose purpose is to provide
efficient tools for basic yet computationally demanding tasks,
such as find k-nearest neighbors using exhaustive search
and kmeans clustering.
This software is governed by the CeCILL license under French law and
abiding by the rules of distribution of free software. You can use,
modify and/ or redistribute the software under the terms of the CeCILL
license as circulated by CEA, CNRS and INRIA at the following URL
"http://www.cecill.info".
As a counterpart to the access to the source code and rights to copy,
modify and redistribute granted by the license, users are provided only
with a limited warranty and the software's author, the holder of the
economic rights, and the successive licensors have only limited
liability.
In this respect, the user's attention is drawn to the risks associated
with loading, using, modifying and/or developing or reproducing the
software by the user in light of its specific status of free software,
that may mean that it is complicated to manipulate, and that also
therefore means that it is reserved for developers and experienced
professionals having in-depth computer knowledge. Users are therefore
encouraged to load and test the software's suitability as regards their
requirements in conditions enabling the security of their systems and/or
data to be ensured and, more generally, to use and operate it in the
same conditions as regards security.
The fact that you are presently reading this means that you have had
knowledge of the CeCILL license and that you accept its terms.
*/
/* C front-end for the kmeans function */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <yael/vector.h>
#include <yael/machinedeps.h>
#include <yael/kmeans.h>
#define FMT_FVEC 0
#define FMT_TEXT 1
#define DEFAULT_NITER 40
#define DEFAULT_NREDO 1
void usage(const char * cmd)
{
printf ("Usage: %s [options]\n", cmd);
printf (
" Input\n"
" -i filename input set of vectors to cluster (fvec file format)\n"
" -itxt filename the same but for an input text file\n"
" -n # use n points from the file. Default: all the vectors\n"
" -d # dimension of the vector (used with -itxt only)\n"
" Clustering parameters\n"
" -k # number of centroids to produce\n"
" -niter # maximum number of iterations. Default: %d\n"
" -nredo # number of runs to perform. Default: %d\n"
" -seed # initialize the random generate with a number\n"
" -nt # number of threads used. Default: nt=all\n"
" Ouput\n"
" -o clustfile output cluster file (fvec format)\n"
" -otxt clustfile output cluster file (text format)\n",
DEFAULT_NITER, DEFAULT_NREDO);
exit (0);
}
int main (int argc, char ** argv)
{
int i;
int k = 10;
int d = 0;
int n = 0;
int niter = DEFAULT_NITER;
int nredo = DEFAULT_NREDO;
int nt = count_cpu();
int seed = 0;
int ret;
int fmt_in = FMT_FVEC;
int fmt_out = FMT_FVEC;
const char * fi_name = NULL;
const char * fo_name = NULL;
if (argc == 1)
usage (argv[0]);
for (i = 1 ; i < argc ; i++) {
char *a = argv[i];
if (!strcmp (a, "-h") || !strcmp (a, "--help"))
usage (argv[0]);
if (!strcmp (a, "-k") && i+1 < argc) {
ret = sscanf (argv[++i], "%d", &k);
assert (ret);
}
if (!strcmp (a, "-d") && i+1 < argc) {
ret = sscanf (argv[++i], "%d", &d);
assert (ret);
}
else if (!strcmp (a, "-n") && i+1 < argc) {
ret = sscanf (argv[++i], "%d", &n);
assert (ret);
}
else if (!strcmp (a, "-niter") && i+1 < argc) {
ret = sscanf (argv[++i], "%d", &niter);
assert (ret);
}
else if (!strcmp (a, "-nt") && i+1 < argc) {
ret = sscanf (argv[++i], "%d", &nt);
assert (ret);
}
else if (!strcmp (a, "-nredo") && i+1 < argc) {
ret = sscanf (argv[++i], "%d", &nredo);
assert (ret);
}
else if (!strcmp (a, "-seed") && i+1 < argc) {
ret = sscanf (argv[++i], "%d", &seed);
assert (ret);
}
else if (!strcmp (a, "-i") && i+1 < argc) {
fi_name = argv[++i];
}
else if (!strcmp (a, "-itxt") && i+1 < argc) {
fi_name = argv[++i];
fmt_in = FMT_TEXT;
}
else if (!strcmp (a, "-o") && i+1 < argc) {
fo_name = argv[++i];
}
else if (!strcmp (a, "-otxt") && i+1 < argc) {
fo_name = argv[++i];
fmt_out = FMT_TEXT;
}
}
assert (fi_name && fo_name);
fprintf (stderr, "k = %d\nd = %d\nn = %d\nniter = %d\nnredo = %d\n",
k, d, n, niter, nredo);
fprintf (stderr, "nt = %d\nseed = %d\n", nt, seed);
fprintf (stderr, "fi = %s (fmt = %s)\n", fi_name,
(fmt_in == FMT_FVEC ? "fvec" : "txt"));
fprintf (stderr, "fo = %s (fmt = %s)\n", fo_name,
(fmt_out == FMT_FVEC ? "fvec" : "txt"));
/* read the input vectors */
float * v;
/* read the vectors from the input file, and sanitize them if needed */
if (fmt_in == FMT_FVEC) {
if (d == 0 || n == 0) {/* automatically read the dimension */
int ret = fvecs_fsize (fi_name, &d, &n);
fprintf (stderr, "File %s contains (%d bytes) %d vectors of dimension %d\n", fi_name, ret, n, d);
assert (ret);
}
v = fvec_new (n * d);
ret = fvecs_read (fi_name, d, n, v);
}
else if (fmt_in == FMT_TEXT) {
v = fvec_new (n * d);
ret = fvecs_read_txt (fi_name, d, n, v);
}
else exit (1);
assert (ret >= n);
/* Remove the Nan values */
int nNaN = fvec_purge_nans (v, n * d, 2);
if (nNaN > 0)
fprintf (stderr, "found %d NaN values\n", nNaN);
/* k-means! */
float * centroids = fvec_new (k * d);
int * nassign = ivec_new (k);
kmeans (d, n, k, niter, v, nt, seed, nredo, centroids, NULL, NULL, nassign);
/* write the output file */
if (fmt_out == FMT_FVEC)
ret = fvecs_write (fo_name, d, k, centroids);
else if (fmt_out == FMT_TEXT)
ret = fvecs_write_txt (fo_name, d, k, centroids);
else exit (2);
assert (ret == k);
free (centroids);
free (nassign);
free (v);
return 0;
}
| 30.868932 | 103 | 0.597893 | [
"vector"
] |
9d8f2da38bedd47bdff3c51bd06a41fa22d82648 | 423 | h | C | rdp/include/examples.h | wmacevoy/languages-wmacevoy | fe80126597a652f7c480c81d12b2764395a7c5b5 | [
"MIT"
] | null | null | null | rdp/include/examples.h | wmacevoy/languages-wmacevoy | fe80126597a652f7c480c81d12b2764395a7c5b5 | [
"MIT"
] | null | null | null | rdp/include/examples.h | wmacevoy/languages-wmacevoy | fe80126597a652f7c480c81d12b2764395a7c5b5 | [
"MIT"
] | 1 | 2022-02-17T16:43:06.000Z | 2022-02-17T16:43:06.000Z | #pragma once
#include "port.h"
#include "token.h"
#include "ast.h"
struct Example {
typedef std::shared_ptr<Example> Ptr;
static std::size_t size();
static Ptr example(int k);
const std::string input;
const std::vector < Token::Ptr > tokens;
const AST::Ptr ast;
const double ans;
Example(const std::string &_input, const std::vector<Token::Ptr> &_tokens, const AST::Ptr &_ast, const double &_ans);
};
| 20.142857 | 119 | 0.683215 | [
"vector"
] |
9d900c76af5936fdee43abe89534766e3f00725e | 9,756 | h | C | src/LanczosVectors.h | npatel37/PsimagLiteORNL | ffa0ffad75c5db218a9edea1a9581fed98c2648f | [
"Unlicense"
] | 1 | 2019-11-13T22:13:51.000Z | 2019-11-13T22:13:51.000Z | src/LanczosVectors.h | npatel37/PsimagLiteORNL | ffa0ffad75c5db218a9edea1a9581fed98c2648f | [
"Unlicense"
] | null | null | null | src/LanczosVectors.h | npatel37/PsimagLiteORNL | ffa0ffad75c5db218a9edea1a9581fed98c2648f | [
"Unlicense"
] | null | null | null | /*
Copyright (c) 2009-2013, UT-Battelle, LLC
All rights reserved
[PsimagLite, Version 1.0.0]
[by G.A., Oak Ridge National Laboratory]
UT Battelle Open Source Software License 11242008
OPEN SOURCE LICENSE
Subject to the conditions of this License, each
contributor to this software hereby grants, free of
charge, to any person obtaining a copy of this software
and associated documentation files (the "Software"), a
perpetual, worldwide, non-exclusive, no-charge,
royalty-free, irrevocable copyright license to use, copy,
modify, merge, publish, distribute, and/or sublicense
copies of the Software.
1. Redistributions of Software must retain the above
copyright and license notices, this list of conditions,
and the following disclaimer. Changes or modifications
to, or derivative works of, the Software should be noted
with comments and the contributor and organization's
name.
2. Neither the names of UT-Battelle, LLC or the
Department of Energy nor the names of the Software
contributors may be used to endorse or promote products
derived from this software without specific prior written
permission of UT-Battelle.
3. The software and the end-user documentation included
with the redistribution, with or without modification,
must include the following acknowledgment:
"This product includes software produced by UT-Battelle,
LLC under Contract No. DE-AC05-00OR22725 with the
Department of Energy."
*********************************************************
DISCLAIMER
THE SOFTWARE IS SUPPLIED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER, CONTRIBUTORS, UNITED STATES GOVERNMENT,
OR THE UNITED STATES DEPARTMENT OF ENERGY 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.
NEITHER THE UNITED STATES GOVERNMENT, NOR THE UNITED
STATES DEPARTMENT OF ENERGY, NOR THE COPYRIGHT OWNER, NOR
ANY OF THEIR EMPLOYEES, REPRESENTS THAT THE USE OF ANY
INFORMATION, DATA, APPARATUS, PRODUCT, OR PROCESS
DISCLOSED WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.
*********************************************************
*/
/** \ingroup PsimagLite */
/*@{*/
/*! \file LanczosVectors.h
*
* to store or not to store lanczos vectors
*
*/
#ifndef LANCZOS_VECTORS_HEADER_H
#define LANCZOS_VECTORS_HEADER_H
#include "ProgressIndicator.h"
#include <cassert>
#include "Vector.h"
#include "Matrix.h"
#include "Random48.h"
#include "ContinuedFraction.h"
namespace PsimagLite {
template<typename MatrixType_,typename VectorType_>
class LanczosVectors {
typedef typename VectorType_::value_type ComplexOrRealType;
typedef typename Real<ComplexOrRealType>::Type RealType;
typedef LanczosVectors<MatrixType_, VectorType_> ThisType;
public:
typedef MatrixType_ MatrixType;
typedef VectorType_ VectorType;
typedef TridiagonalMatrix<RealType> TridiagonalMatrixType;
typedef typename VectorType::value_type VectorElementType;
typedef Matrix<VectorElementType> DenseMatrixType;
typedef Matrix<RealType> DenseMatrixRealType;
typedef ContinuedFraction<TridiagonalMatrixType> PostProcType;
enum {WITH_INFO=1,DEBUG=2,ALLOWS_ZERO=4};
LanczosVectors(const MatrixType& mat,
bool lotaMemory,
SizeType steps,
bool isReorthoEnabled,
DenseMatrixType* storage)
: progress_("LanczosVectors"),
mat_(mat),
lotaMemory_(lotaMemory),
isReorthoEnabled_(isReorthoEnabled),
dummy_(0),
needsDelete_(false),
ysaved_(0),
data_(storage),
overlap_(0)
{
dealWithStorageOfV(steps);
dealWithOverlapStorage(steps);
}
~LanczosVectors()
{
delete overlap_;
overlap_ = 0;
if (!needsDelete_) return;
delete data_;
data_ = 0;
}
void resize(SizeType matrixRank,SizeType steps)
{
if (!lotaMemory_) return;
data_->reset(matrixRank,steps);
if (overlap_)
overlap_->resize(steps, 0);
else
overlap_ = new VectorType(steps, 0);
}
void reset(SizeType matrixRank,SizeType steps)
{
if (!lotaMemory_) return;
data_->reset(matrixRank,steps);
if (overlap_)
overlap_->resize(steps);
else
overlap_ = new VectorType(steps, 0);
}
const DenseMatrixType* data() const
{
return data_;
}
DenseMatrixType* data()
{
return data_;
}
SizeType cols() const { return data_->cols(); }
SizeType rows() const { return data_->rows(); }
bool lotaMemory() const { return lotaMemory_; }
void saveInitialVector(const VectorType& y)
{
ysaved_ = y;
}
void hookForZ(VectorType& z,
const typename Vector<RealType>::Type& c,
const TridiagonalMatrixType&)
{
if (!lotaMemory_) {
VectorType x(z.size(),0.0);
VectorType y = ysaved_;
for (SizeType i = 0; i < z.size(); i++)
z[i] = 0.0;
RealType atmp = 0.0;
for (SizeType j=0; j < c.size(); j++) {
RealType ctmp = c[j];
for (SizeType i = 0; i < y.size(); i++)
z[i] += ctmp * y[i];
RealType btmp = 0;
oneStepDecomposition(x,y,atmp,btmp, j);
}
return;
}
for (SizeType j = 0; j < data_->cols(); j++) {
RealType ctmp = c[j];
for (SizeType i = 0; i < data_->rows(); i++) {
z[i] += ctmp * data_->operator()(i,j);
}
}
}
// provides a gracious way to exit if Ay == 0 (we assume that then A=0)
bool isHyZero(const VectorType& y,
TridiagonalMatrixType& ab)
{
if (!lotaMemory_) return false;
OstringStream msg;
msg<<"Testing whether matrix is zero...";
progress_.printline(msg,std::cout);
VectorType x(mat_.rows());
for (SizeType i = 0; i < x.size(); i++) x[i] = 0.0;
mat_.matrixVectorProduct (x, y); // x+= Hy
for (SizeType i = 0; i < x.size(); i++)
if (PsimagLite::real(x[i]*PsimagLite::conj(x[i]))!=0) return false;
for (SizeType j=0; j < data_->cols(); j++) {
for (SizeType i = 0; i < mat_.rows(); i++) {
data_->operator()(i,j) = (i==j) ? 0.0 : 1.1;
}
ab.a(j) = 0.0;
ab.b(j) = 0.0;
}
return true;
}
void oneStepDecomposition(VectorType& x,
VectorType& y,
RealType& atmp,
RealType& btmp,
SizeType it) const
{
mat_.matrixVectorProduct (x, y); // x+= Hy
atmp = 0.0;
for (SizeType i = 0; i < mat_.rows(); i++)
atmp += PsimagLite::real(y[i]*PsimagLite::conj(x[i]));
btmp = 0.0;
for (SizeType i = 0; i < mat_.rows(); i++) {
x[i] -= atmp * y[i];
btmp += PsimagLite::real(x[i]*PsimagLite::conj(x[i]));
}
btmp = sqrt (btmp);
if (fabs(btmp)<1e-10) {
for (SizeType i = 0; i < mat_.rows(); i++) {
VectorElementType tmp = y[i];
y[i] = x[i];
x[i] = -btmp * tmp;
}
return;
}
assert(btmp >= 1e-12);
RealType inverseBtmp = 1.0/btmp;
for (SizeType i = 0; i < mat_.rows(); i++) {
//lanczosVectors(i,j) = y[i];
VectorElementType tmp = y[i];
y[i] = x[i] * inverseBtmp;
x[i] = -btmp * tmp;
}
reorthoIfNecessary(x, it);
}
private:
void reorthoIfNecessary(VectorType& x, SizeType it) const
{
if (!isReorthoEnabled_) return;
if (!overlap_ || overlap_->size() <= it)
throw RuntimeError("reorthoIfNecessary failed\n");
for (SizeType j = 0; j < it; ++j) {
overlap_->operator[](j) = 0;
for (SizeType i = 0; i < x.size(); ++i)
overlap_->operator[](j) += PsimagLite::conj(data_->operator()(i, j))*x[i];
}
RealType oldNorm = 0;
RealType newNorm = 0;
for (SizeType i = 0; i < x.size(); ++i) {
ComplexOrRealType sum = 0.0;
for (SizeType j = 0; j < it; ++j)
sum -= overlap_->operator[](j)*data_->operator()(i, j);
ComplexOrRealType tmp = x[i];
oldNorm += PsimagLite::real(tmp*PsimagLite::conj(tmp));
tmp += sum;
x[i] = tmp;
newNorm += PsimagLite::real(tmp*PsimagLite::conj(tmp));
}
RealType factor = oldNorm/newNorm;
for (SizeType i = 0; i < x.size(); ++i) x[i] *= factor;
}
void dealWithStorageOfV(SizeType steps)
{
if (data_ || !lotaMemory_) return;
// if lotaMemory is set, we still degrade gracefully if we can't allocate
SizeType maxNstep = std::min(steps , mat_.rows());
try {
data_ = new DenseMatrixType(mat_.rows(),maxNstep);
needsDelete_ = true;
OstringStream msg;
msg<<"lotaMemory_=true";
progress_.printline(msg,std::cout);
} catch (std::exception&) {
// FIXME: option to store in secondary
OstringStream msg;
msg<<"Memory allocation failed, setting lotaMemory_=false\n";
progress_.printline(msg,std::cout);
lotaMemory_ = false;
data_ = 0;
}
}
void dealWithOverlapStorage(SizeType steps)
{
if (!isReorthoEnabled_) return;
OstringStream msg;
msg<<"Reortho enabled";
progress_.printline(msg,std::cout);
return;
SizeType maxNstep = std::min(steps , mat_.rows());
overlap_ = new VectorType(maxNstep, 0);
}
//! copy ctor and assigment operator are invalid
//! because this class contains a pointer:
ThisType& operator=(const ThisType& other);
LanczosVectors(const ThisType& copy);
ProgressIndicator progress_;
const MatrixType& mat_;
bool lotaMemory_;
bool isReorthoEnabled_;
VectorElementType dummy_;
bool needsDelete_;
VectorType ysaved_;
DenseMatrixType* data_;
VectorType* overlap_;
}; // class LanczosVectors
} // namespace PsimagLite
/*@}*/
#endif // LANCZOS_VECTORS_HEADER_H
| 26.439024 | 78 | 0.670459 | [
"vector"
] |
9d91a7eaa77155a7425039dadc920bdb70f56812 | 2,463 | h | C | Examples/include/Aspose.Font.Cpp/src/Glyphs/IGlyphAccessor.h | aspose-font/Aspose.Font-for-C | a11ab131d32235086670875e7ac6a223098d587f | [
"MIT"
] | null | null | null | Examples/include/Aspose.Font.Cpp/src/Glyphs/IGlyphAccessor.h | aspose-font/Aspose.Font-for-C | a11ab131d32235086670875e7ac6a223098d587f | [
"MIT"
] | null | null | null | Examples/include/Aspose.Font.Cpp/src/Glyphs/IGlyphAccessor.h | aspose-font/Aspose.Font-for-C | a11ab131d32235086670875e7ac6a223098d587f | [
"MIT"
] | 1 | 2021-02-10T15:25:07.000Z | 2021-02-10T15:25:07.000Z | #pragma once
// Copyright (c) 2001-2020 Aspose Pty Ltd. All Rights Reserved.
#include <system/string.h>
#include <system/shared_ptr.h>
#include <system/object.h>
#include <system/array.h>
#include "Aspose.Font.Cpp/aspose_font_api_defs.h"
namespace Aspose { namespace Font { namespace Glyphs { enum class GlyphIdType; } } }
namespace Aspose { namespace Font { namespace Glyphs { class GlyphId; } } }
namespace Aspose { namespace Font { namespace Glyphs { class Glyph; } } }
namespace Aspose {
namespace Font {
namespace Glyphs {
/// <summary>
/// Defines functionality to retrieve specified glyph identifiers and glyphs.
/// </summary>
class ASPOSE_FONT_SHARED_CLASS IGlyphAccessor : public virtual System::Object
{
typedef IGlyphAccessor ThisType;
typedef System::Object BaseType;
typedef ::System::BaseTypesInfo<BaseType> ThisTypeBaseTypesInfo;
ASPOSE_FONT_SHARED_RTTI_INFO_DECL();
public:
/// <summary>
/// Glyph id type specification.
/// </summary>
virtual Aspose::Font::Glyphs::GlyphIdType get_GlyphIdType() = 0;
/// <summary>
/// Returns all glyph ids, available in the Font.
/// Glyph id is a unique number for a glyph, which is font type dependent.
/// For example:
/// Type1's id is a glyph name, instance of (<see cref="GlyphStringId"></see>) class.
/// TTF's id is an int index, instance of (<see cref="GlyphUInt32Id"></see>) class.
/// </summary>
/// <returns>Glyph identifiers.</returns>
virtual System::ArrayPtr<System::SharedPtr<GlyphId>> GetAllGlyphIds() = 0;
/// <summary>
/// Get glyphs representation for text.
/// </summary>
/// <param name="text">Input text.</param>
/// <returns>GlyphId array.</returns>
virtual System::ArrayPtr<System::SharedPtr<GlyphId>> GetGlyphsForText(System::String text) = 0;
/// <summary>
/// Returns glyph by glyph id.
/// Glyph id is a unique number for a glyph, which is font type dependent. GlyphId - derived object.
/// For example:
/// Type1's id is a glyph name, instance of (<see cref="GlyphStringId"></see>) class.
/// TTF's id is an int index, instance of (<see cref="GlyphUInt32Id"></see>) class.
/// </summary>
/// <param name="id">glyph ID.</param>
/// <returns>Glyph</returns>
virtual System::SharedPtr<Glyph> GetGlyphById(System::SharedPtr<GlyphId> id) = 0;
};
} // namespace Glyphs
} // namespace Font
} // namespace Aspose
| 34.208333 | 104 | 0.670727 | [
"object"
] |
9d95d321fc9441fe16a47345467b0f15ac1c70e3 | 187 | h | C | addons/benchmark/Human36Model.h | ju6ge/rbdl-orb | 321e20e80e2859a3a2ab43629c7c26c1020cb6f6 | [
"Zlib"
] | 21 | 2019-01-12T17:59:41.000Z | 2022-03-08T17:42:56.000Z | addons/benchmark/Human36Model.h | ju6ge/rbdl-orb | 321e20e80e2859a3a2ab43629c7c26c1020cb6f6 | [
"Zlib"
] | 7 | 2019-01-24T11:44:58.000Z | 2020-04-21T21:13:37.000Z | addons/benchmark/Human36Model.h | ju6ge/rbdl-orb | 321e20e80e2859a3a2ab43629c7c26c1020cb6f6 | [
"Zlib"
] | 10 | 2020-02-01T20:38:18.000Z | 2021-06-01T22:28:24.000Z | #ifndef _HUMAN36MODEL_H
#define _HUMAN36MODEL_H
namespace RigidBodyDynamics {
class Model;
}
void generate_human36model (RigidBodyDynamics::Model *model);
/* _HUMAN36MODEL_H */
#endif
| 15.583333 | 61 | 0.802139 | [
"model"
] |
9da0b1265effdbbb57efd0585c16bac90c3f7e96 | 22,721 | c | C | plow/PlowTest.c | wisehackermonkey/magic | fb85e97b9233cff352d964823173c18527c714aa | [
"TCL",
"X11",
"MIT"
] | null | null | null | plow/PlowTest.c | wisehackermonkey/magic | fb85e97b9233cff352d964823173c18527c714aa | [
"TCL",
"X11",
"MIT"
] | null | null | null | plow/PlowTest.c | wisehackermonkey/magic | fb85e97b9233cff352d964823173c18527c714aa | [
"TCL",
"X11",
"MIT"
] | null | null | null | /*
* PlowTest.c --
*
* Plowing.
* Debugging and testing.
*
* *********************************************************************
* * Copyright (C) 1985, 1990 Regents of the University of California. *
* * Permission to use, copy, modify, and distribute this *
* * software and its documentation for any purpose and without *
* * fee is hereby granted, provided that the above copyright *
* * notice appear in all copies. The University of California *
* * makes no representations about the suitability of this *
* * software for any purpose. It is provided "as is" without *
* * express or implied warranty. Export of this software outside *
* * of the United States of America may require an export license. *
* *********************************************************************
*/
#ifndef lint
static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/plow/PlowTest.c,v 1.1.1.1 2008/02/03 20:43:50 tim Exp $";
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
#include "utils/magic.h"
#include "utils/styles.h"
#include "utils/utils.h"
#include "utils/geometry.h"
#include "tiles/tile.h"
#include "utils/hash.h"
#include "utils/undo.h"
#include "database/database.h"
#include "windows/windows.h"
#include "graphics/graphics.h"
#include "dbwind/dbwind.h"
#include "utils/main.h"
#include "commands/commands.h"
#include "drc/drc.h"
#include "debug/debug.h"
#include "plow/plowInt.h"
#include "textio/textio.h"
#include "textio/txcommands.h"
/* Forward declarations */
extern void plowShowShadow();
extern int plowShowOutline();
extern void plowTestJog();
extern void plowDebugMore();
/* Imports from PlowMain.c */
extern CellDef *plowYankDef;
extern CellUse *plowDummyUse;
/* Debugging flags */
ClientData plowDebugID;
int plowDebAdd;
int plowDebMove;
int plowDebNext;
int plowDebTime;
int plowDebWidth;
int plowDebJogs;
int plowDebYankAll;
/* Other debugging info */
bool plowWhenTop, plowWhenBot;
Point plowWhenTopPoint, plowWhenBotPoint;
/* Imports */
extern CellDef *plowSpareDef;
/*
* ----------------------------------------------------------------------------
*
* PlowTest --
*
* Real command interface for debugging plowing.
*
* Results:
* None.
*
* Side effects:
* See individual commands.
*
* ----------------------------------------------------------------------------
*/
typedef enum
{
PC_HELP, PC_ERROR,
PC_PLOW,
PC_JOG,
PC_RANDOM,
PC_TECHSHOW,
PC_OUTLINE, PC_LSHADOW, PC_SHADOW, PC_WIDTH, PC_LWIDTH,
PC_SPLIT, PC_MERGEUP, PC_MERGEDOWN, PC_MOVE, PC_TRAIL, PC_PRINT,
PC_WHENTOP, PC_WHENBOT,
PC_SETD, PC_CLRD, PC_SHOWD
} pCmd;
struct
{
char *p_name;
pCmd p_cmd;
char *p_help;
} plowCmds[] = {
"clrdebug", PC_CLRD, "flags",
"help", PC_HELP, "",
"jogreduce", PC_JOG, "",
"lwidth", PC_LWIDTH, "layers",
"lshadow", PC_LSHADOW, "layers",
"mergedown", PC_MERGEDOWN, "",
"mergeup", PC_MERGEUP, "",
"move", PC_MOVE, "",
"outline", PC_OUTLINE, "direction layers",
"plow", PC_PLOW, "direction [layers]",
"print", PC_PRINT, "",
"random", PC_RANDOM, "",
"setdebug", PC_SETD, "flags",
"shadow", PC_SHADOW, "layers",
"showdebug", PC_SHOWD, "",
"split", PC_SPLIT, "",
"techshow", PC_TECHSHOW, "[file]",
"trail", PC_TRAIL, "[value]",
"whenbot", PC_WHENBOT, "[xbot ybot]",
"whentop", PC_WHENTOP, "[xtop ytop]",
"width", PC_WIDTH, "layers",
0,
};
void
PlowTest(w, cmd)
MagWindow *w;
TxCommand *cmd;
{
pCmd plowCmd, plowGetCommand();
Rect editArea, dummyRect, rootBox, area2;
CellDef *def, *rootBoxDef, *saveDef;
TileTypeBitMask okTypes;
int dir, n, trail;
Point editPoint;
Plane *plane;
Edge edge;
Tile *tp;
FILE *f;
if (!ToolGetEditBox(&editArea) || !ToolGetBox(&rootBoxDef, &rootBox))
return;
(void) CmdGetEditPoint(&editPoint, &dummyRect);
if ((plowCmd = plowGetCommand(cmd)) == PC_ERROR)
return;
def = EditCellUse->cu_def;
plane = def->cd_planes[PL_TECHDEPBASE];
switch (plowCmd)
{
case PC_HELP:
TxPrintf("Usage: *plow cmd [args]\n");
TxPrintf("Valid plowing command are:\n");
for (n = 0; plowCmds[n].p_name; n++)
TxPrintf("%-15s %s\n", plowCmds[n].p_name, plowCmds[n].p_help);
break;
case PC_RANDOM:
PlowRandomTest(def);
break;
case PC_JOG:
plowTestJog(def, &editArea);
break;
case PC_SETD:
DebugSet(plowDebugID, cmd->tx_argc - 2, &cmd->tx_argv[2], TRUE);
break;
case PC_CLRD:
DebugSet(plowDebugID, cmd->tx_argc - 2, &cmd->tx_argv[2], FALSE);
break;
case PC_SHOWD:
DebugShow(plowDebugID);
break;
case PC_OUTLINE:
if (cmd->tx_argc < 4)
{
TxError("Usage: *plow outline direction layers\n");
return;
}
dir = GeoNameToPos(cmd->tx_argv[2], TRUE, TRUE);
if (dir != GEO_NORTH && dir != GEO_SOUTH)
{
TxError("Only legal starting directions are north or south\n");
return;
}
if (!CmdParseLayers(cmd->tx_argv[3], &okTypes))
return;
(void) plowSrOutline(PL_TECHDEPBASE, &editArea.r_ll, okTypes, dir,
GMASK_NORTH|GMASK_SOUTH|GMASK_EAST|GMASK_WEST,
plowShowOutline, (ClientData) &editArea);
break;
case PC_PLOW:
if (cmd->tx_argc < 3)
{
TxError("Usage: *plow plow direction [layers]\n");
return;
}
dir = GeoNameToPos(cmd->tx_argv[2], TRUE, TRUE);
okTypes = DBAllTypeBits;
if (cmd->tx_argc > 3 && !CmdParseLayers(cmd->tx_argv[3], &okTypes))
return;
if (!Plow(def, &editArea, okTypes, dir))
{
TxPrintf("Reduced plow size since we ran into the barrier.\n");
GeoTransRect(&EditToRootTransform, &editArea, &rootBox);
ToolMoveBox(TOOL_BL, &rootBox.r_ll, FALSE, rootBoxDef);
ToolMoveCorner(TOOL_TR, &rootBox.r_ur, FALSE, rootBoxDef);
}
break;
case PC_LSHADOW:
if (cmd->tx_argc < 3)
{
TxError("Usage: *plow lshadow layers\n");
return;
}
if (!CmdParseLayers(cmd->tx_argv[2], &okTypes))
return;
saveDef = plowYankDef;
plowYankDef = def;
(void) plowSrShadowBack(PL_TECHDEPBASE, &editArea,
okTypes, plowShowShadow, (ClientData) def);
plowYankDef = saveDef;
break;
case PC_SHADOW:
if (cmd->tx_argc < 3)
{
TxError("Usage: *plow shadow layers\n");
return;
}
if (!CmdParseLayers(cmd->tx_argv[2], &okTypes))
return;
saveDef = plowYankDef;
plowYankDef = def;
(void) plowSrShadow(PL_TECHDEPBASE, &editArea,
okTypes, plowShowShadow, (ClientData) def);
plowYankDef = saveDef;
break;
case PC_TECHSHOW:
f = stdout;
if (cmd->tx_argc >= 3)
{
f = fopen(cmd->tx_argv[2], "w");
if (f == NULL)
{
perror(cmd->tx_argv[2]);
break;
}
}
plowTechShow(f);
if (f != stdout)
(void) fclose(f);
break;
case PC_WIDTH:
if (cmd->tx_argc < 3)
{
TxError("Usage: *plow width layers\n");
return;
}
if (!CmdParseLayers(cmd->tx_argv[2], &okTypes))
return;
edge.e_rect = editArea;
edge.e_pNum = PL_TECHDEPBASE;
TxPrintf("Box: X: %d .. %d Y: %d .. %d\n",
editArea.r_xbot, editArea.r_xtop,
editArea.r_ybot, editArea.r_ytop);
saveDef = plowYankDef;
plowYankDef = def;
(void) plowFindWidth(&edge, okTypes, &def->cd_bbox, &editArea);
plowYankDef = saveDef;
GeoTransRect(&EditToRootTransform, &editArea, &rootBox);
ToolMoveBox(TOOL_BL, &rootBox.r_ll, FALSE, rootBoxDef);
ToolMoveCorner(TOOL_TR, &rootBox.r_ur, FALSE, rootBoxDef);
break;
case PC_LWIDTH:
if (cmd->tx_argc < 3)
{
TxError("Usage: *plow lwidth layers\n");
return;
}
if (!CmdParseLayers(cmd->tx_argv[2], &okTypes))
return;
edge.e_rect = editArea;
edge.e_pNum = PL_TECHDEPBASE;
TxPrintf("Box: X: %d .. %d Y: %d .. %d\n",
editArea.r_xbot, editArea.r_xtop,
editArea.r_ybot, editArea.r_ytop);
saveDef = plowYankDef;
plowYankDef = def;
(void) plowFindWidthBack(&edge, okTypes, &def->cd_bbox, &editArea);
plowYankDef = saveDef;
GeoTransRect(&EditToRootTransform, &editArea, &rootBox);
ToolMoveBox(TOOL_BL, &rootBox.r_ll, FALSE, rootBoxDef);
ToolMoveCorner(TOOL_TR, &rootBox.r_ur, FALSE, rootBoxDef);
break;
case PC_TRAIL:
if (cmd->tx_argc > 3)
{
TxError("Usage: *plow trail [value]\n");
return;
}
tp = TiSrPointNoHint(plane, &editArea.r_ll);
if (cmd->tx_argc == 3) trail = atoi(cmd->tx_argv[2]);
else trail = editArea.r_xtop;
TxPrintf("Trailing coordinate of tile 0x%x updated from %d to %d\n",
tp, TRAILING(tp), trail);
plowSetTrailing(tp, trail);
break;
case PC_MOVE:
edge.e_pNum = PL_TECHDEPBASE;
edge.e_rect = editArea;
TxPrintf("Moving edge from %d to %d\n",
editArea.r_xbot, editArea.r_xtop);
plowMoveEdge(&edge);
editArea.r_xbot--;
DBWAreaChanged(def, &editArea, DBW_ALLWINDOWS, &DBAllButSpaceBits);
break;
case PC_SPLIT:
tp = TiSrPointNoHint(plane, &editArea.r_ll);
if (editArea.r_ybot == BOTTOM(tp) || editArea.r_ybot == TOP(tp))
{
TxError("Can't split at top or bottom of tile\n");
return;
}
TiToRect(tp, &area2);
TxPrintf("Splitting tile 0x%x at y=%d yielding 0x%x\n",
tp, editArea.r_ybot, plowSplitY(tp, editArea.r_ybot));
DBWAreaChanged(def, &area2, DBW_ALLWINDOWS, &DBAllButSpaceBits);
break;
case PC_MERGEDOWN:
tp = TiSrPointNoHint(plane, &editArea.r_ll);
TxPrintf("Merging tile 0x%x below\n", tp);
TiToRect(tp, &editArea);
TiToRect(RT(tp), &area2);
(void) GeoInclude(&area2, &editArea);
plowMergeBottom(tp, plane);
DBWAreaChanged(def, &editArea, DBW_ALLWINDOWS, &DBAllButSpaceBits);
break;
case PC_MERGEUP:
tp = TiSrPointNoHint(plane, &editArea.r_ll);
TxPrintf("Merging tile 0x%x above\n", tp);
TiToRect(tp, &editArea);
TiToRect(RT(tp), &area2);
(void) GeoInclude(&area2, &editArea);
plowMergeTop(tp, plane);
DBWAreaChanged(def, &editArea, DBW_ALLWINDOWS, &DBAllButSpaceBits);
break;
case PC_PRINT:
tp = TiSrPointNoHint(plane, &editArea.r_ll);
TxPrintf("Tile 0x%x LEFT=%d RIGHT=%d BOTTOM=%d TOP=%d\n",
tp, LEFT(tp), RIGHT(tp), BOTTOM(tp), TOP(tp));
TxPrintf(" TRAILING=%d LEADING=%d TYPE=%s\n",
TRAILING(tp), LEADING(tp), DBTypeLongName(TiGetTypeExact(tp)));
break;
case PC_WHENTOP:
if (cmd->tx_argc == 2)
{
plowWhenTop = FALSE;
break;
}
if (cmd->tx_argc != 4)
{
TxError("Usage: *plow whentop xtop ytop\n");
break;
}
plowWhenTopPoint.p_x = atoi(cmd->tx_argv[2]);
plowWhenTopPoint.p_y = atoi(cmd->tx_argv[3]);
plowWhenTop = TRUE;
break;
case PC_WHENBOT:
if (cmd->tx_argc == 2)
{
plowWhenBot = FALSE;
break;
}
if (cmd->tx_argc != 4)
{
TxError("Usage: *plow whenbot xbot ybot\n");
break;
}
plowWhenBotPoint.p_x = atoi(cmd->tx_argv[2]);
plowWhenBotPoint.p_y = atoi(cmd->tx_argv[3]);
plowWhenBot = TRUE;
break;
}
}
/*
* ----------------------------------------------------------------------------
*
* plowGetCommand --
*
* Pull off the subcommand from the TxCommand passed to PlowTest()
* above. Verify that it is a valid command.
*
* Results:
* Returns PC_ERROR on error; otherwise, returns the command
* code (pCmd) corresponding to the command in cmd->tx_argv[1].
*
* Side effects:
* None.
*
* ----------------------------------------------------------------------------
*/
pCmd
plowGetCommand(cmd)
TxCommand *cmd;
{
int plowIndex;
if (cmd->tx_argc <= 1)
{
TxError("Usage: *plow cmd [args]\n");
return (PC_ERROR);
}
plowIndex = LookupStruct(cmd->tx_argv[1],
(LookupTable *) plowCmds, sizeof plowCmds[0]);
if (plowIndex < 0)
{
TxError("Bad plowing command '%s'.\n", cmd->tx_argv[1]);
TxError("Try '*plow help' for a list of commands.\n");
return (PC_ERROR);
}
return (plowCmds[plowIndex].p_cmd);
}
/*
* ----------------------------------------------------------------------------
*
* plowDebugInit --
*
* Initialize debugging flags.
*
* Results:
* None.
*
* Side effects:
* Registers various debugging flags with the debugging module.
*
* ----------------------------------------------------------------------------
*/
void
plowDebugInit()
{
int n;
static struct
{
char *di_name;
int *di_id;
} debug[] = {
"addedge", &plowDebAdd,
"jogs", &plowDebJogs,
"moveedge", &plowDebMove,
"nextedge", &plowDebNext,
"time", &plowDebTime,
"width", &plowDebWidth,
"yankall", &plowDebYankAll,
0
};
/* Register ourselves with the debugging module */
plowDebugID = DebugAddClient("plow", sizeof debug/sizeof debug[0]);
for (n = 0; debug[n].di_name; n++)
*(debug[n].di_id) = DebugAddFlag(plowDebugID, debug[n].di_name);
}
/*
* ----------------------------------------------------------------------------
*
* plowShowShadow --
*
* Debug shadow search. Called for each edge found, we display
* feedback over the area of the edge.
*
* Results:
* None.
*
* Side effects:
* Leaves feedback.
*
* ----------------------------------------------------------------------------
*/
void
plowShowShadow(edge, def)
Edge *edge;
CellDef *def;
{
char mesg[512];
int scaleFactor = 10;
Rect edgeArea;
(void) sprintf(mesg, "Edge between %s and %s",
DBTypeLongName(edge->e_ltype), DBTypeLongName(edge->e_rtype));
edgeArea.r_xbot = edge->e_x * scaleFactor - 1;
edgeArea.r_xtop = edge->e_x * scaleFactor + 1;
edgeArea.r_ybot = edge->e_ybot * scaleFactor;
edgeArea.r_ytop = edge->e_ytop * scaleFactor;
DBWFeedbackAdd(&edgeArea, mesg, def, scaleFactor, STYLE_SOLIDHIGHLIGHTS);
}
/*
* ----------------------------------------------------------------------------
*
* plowTestJog --
*
* Test jog elimination.
* Yank the area enclosed by the box, plus a TechHalo-lambda halo around it,
* into plowYankDef, and then call plowCleanupJogs() to reduce jogs in this
* yank buffer.
*
* Results:
* None.
*
* Side effects:
* Modifies plowYankDef.
* Redisplays.
*
* ----------------------------------------------------------------------------
*/
void
plowTestJog(def, area)
CellDef *def;
Rect *area;
{
extern CellUse *plowYankUse;
extern Rect plowYankedArea;
extern CellDef *plowYankDef;
Rect changedArea;
SearchContext scx;
PaintUndoInfo ui;
/* Make sure the yank buffers exist */
plowYankCreate();
/* Yank into yank buffer */
UndoDisable();
DBCellClearDef(plowYankDef);
plowDummyUse->cu_def = def;
scx.scx_use = plowDummyUse;
scx.scx_trans = GeoIdentityTransform;
scx.scx_area.r_xbot = area->r_xbot - DRCTechHalo;
scx.scx_area.r_ybot = area->r_ybot - DRCTechHalo;
scx.scx_area.r_xtop = area->r_xtop + DRCTechHalo;
scx.scx_area.r_ytop = area->r_ytop + DRCTechHalo;
(void) DBCellCopyPaint(&scx, &DBAllButSpaceAndDRCBits, 0, plowYankUse);
DBReComputeBbox(plowYankDef);
DBWAreaChanged(plowYankDef,&TiPlaneRect,DBW_ALLWINDOWS,&DBAllButSpaceBits);
plowYankedArea = TiPlaneRect;
/* Reduce jogs */
changedArea.r_xbot = changedArea.r_xtop = 0;
changedArea.r_ybot = changedArea.r_ytop = 0;
plowCleanupJogs(area, &changedArea);
DBReComputeBbox(plowYankDef);
DBWAreaChanged(plowYankDef,&changedArea,DBW_ALLWINDOWS,&DBAllButSpaceBits);
UndoEnable();
/* Erase area in original def */
ui.pu_def = def;
for (ui.pu_pNum = PL_TECHDEPBASE; ui.pu_pNum < DBNumPlanes; ui.pu_pNum++)
DBPaintPlane(def->cd_planes[ui.pu_pNum], area,
DBWriteResultTbl[TT_SPACE], &ui);
/* Stuff from yank buffer back into original def */
scx.scx_area = *area;
scx.scx_use = plowYankUse;
scx.scx_trans = GeoIdentityTransform;
(void) DBCellCopyPaint(&scx, &DBAllButSpaceAndDRCBits, 0, plowDummyUse);
DBReComputeBbox(def);
DBWAreaChanged(def, area, DBW_ALLWINDOWS, &DBAllButSpaceBits);
DRCCheckThis(def, TT_CHECKPAINT, area);
}
/*
* ----------------------------------------------------------------------------
*
* plowDebugEdge --
*
* Display an edge for debugging purposes.
* This consists of showing the edge, and its final position, highlighted
* with feedback, then erasing the feedback after requesting "more" from
* the user.
*
* If the user responds with "d" to the "more" request, everything is forcibly
* redisplayed.
*
* Results:
* None.
*
* Side effects:
* None permanent.
*
* ----------------------------------------------------------------------------
*/
void
plowDebugEdge(edge, rtePtr, mesg)
Edge *edge;
RuleTableEntry *rtePtr;
char *mesg;
{
int scaleFactor = 10;
Rect edgeArea;
if (rtePtr)
TxPrintf("Rule being applied: \"%s\"\n", rtePtr->rte_name);
TxPrintf("%s edge (%s :: %s) YL=%d YH=%d X=%d XNEW=%d", mesg,
DBTypeShortName(edge->e_ltype), DBTypeShortName(edge->e_rtype),
edge->e_ybot, edge->e_ytop, edge->e_x, edge->e_newx);
/* LHS */
edgeArea.r_xbot = edge->e_x * scaleFactor - 1;
edgeArea.r_xtop = edge->e_x * scaleFactor + 1;
edgeArea.r_ybot = edge->e_ybot * scaleFactor;
edgeArea.r_ytop = edge->e_ytop * scaleFactor;
DBWFeedbackAdd(&edgeArea, "", plowYankDef,
scaleFactor, STYLE_SOLIDHIGHLIGHTS);
/* RHS */
edgeArea.r_xbot = edge->e_newx * scaleFactor - 1;
edgeArea.r_xtop = edge->e_newx * scaleFactor + 1;
edgeArea.r_ybot = edge->e_ybot * scaleFactor;
edgeArea.r_ytop = edge->e_ytop * scaleFactor;
DBWFeedbackAdd(&edgeArea, "", plowYankDef,
scaleFactor, STYLE_MEDIUMHIGHLIGHTS);
/* TOP */
edgeArea.r_xbot = edge->e_x * scaleFactor;
edgeArea.r_xtop = edge->e_newx * scaleFactor;
edgeArea.r_ybot = edge->e_ytop * scaleFactor - 1;
edgeArea.r_ytop = edge->e_ytop * scaleFactor + 1;
DBWFeedbackAdd(&edgeArea, "", plowYankDef,
scaleFactor, STYLE_MEDIUMHIGHLIGHTS);
/* BOTTOM */
edgeArea.r_xbot = edge->e_x * scaleFactor;
edgeArea.r_xtop = edge->e_newx * scaleFactor;
edgeArea.r_ybot = edge->e_ybot * scaleFactor - 1;
edgeArea.r_ytop = edge->e_ybot * scaleFactor + 1;
DBWFeedbackAdd(&edgeArea, "", plowYankDef,
scaleFactor, STYLE_MEDIUMHIGHLIGHTS);
WindUpdate();
plowDebugMore();
DBWFeedbackClear(NULL);
WindUpdate();
}
/*
* ----------------------------------------------------------------------------
*
* plowDebugMore --
*
* Request "more" from the user.
* If the user responds with "d" to the "more" request,
* everything is forcibly redisplayed.
*
* Results:
* None.
*
* Side effects:
* May cause redisplay.
*
* ----------------------------------------------------------------------------
*/
void
plowDebugMore()
{
char answer[100];
again:
if (TxGetLinePrompt(answer, sizeof answer, " -- more -- ") == NULL)
return;
if (answer[0] == 'd')
{
DBWAreaChanged(plowYankDef, &TiPlaneRect,
DBW_ALLWINDOWS, &DBAllButSpaceBits);
WindUpdate();
goto again;
}
}
/*
* ----------------------------------------------------------------------------
*
* plowShowOutline --
*
* Debug outline search. Called for each outline segment found, we display
* feedback over the area of the segment and then ask for more.
*
* Results:
* Normally returns 0, but will return 1 if the boundary segment
* leaves the clipping rectangle clipArea, or if its endpoint is
* the lower-left of the clipping rectangle.
*
* Side effects:
* Leaves feedback.
*
* ----------------------------------------------------------------------------
*/
int
plowShowOutline(outline, clipArea)
Outline *outline;
Rect *clipArea;
{
static char *dirNames[] = {
"center", "north", "northeast", "east",
"southeast", "south", "southwest", "west",
"northwest", "eastnorth", "eastsouth", "westnorth",
"westsouth"
};
char mesg[512], prompt[612], answer[128];
int scaleFactor = 10;
Rect edgeArea;
(void) sprintf(mesg, "%s/%s/%s segment in=%s out=%s",
dirNames[outline->o_prevDir],
dirNames[outline->o_currentDir],
dirNames[outline->o_nextDir],
DBTypeLongName(TiGetTypeExact(outline->o_inside)),
DBTypeLongName(TiGetTypeExact(outline->o_outside)));
switch (outline->o_currentDir)
{
case GEO_NORTH:
case GEO_SOUTH:
edgeArea.r_xbot = outline->o_rect.r_xbot * scaleFactor - 1;
edgeArea.r_xtop = outline->o_rect.r_xbot * scaleFactor + 1;
edgeArea.r_ybot = outline->o_rect.r_ybot * scaleFactor;
edgeArea.r_ytop = outline->o_rect.r_ytop * scaleFactor;
break;
case GEO_EAST:
case GEO_WEST:
edgeArea.r_xbot = outline->o_rect.r_xbot * scaleFactor;
edgeArea.r_xtop = outline->o_rect.r_xtop * scaleFactor;
edgeArea.r_ybot = outline->o_rect.r_ybot * scaleFactor - 1;
edgeArea.r_ytop = outline->o_rect.r_ytop * scaleFactor + 1;
break;
}
DBWFeedbackAdd(&edgeArea, mesg, EditCellUse->cu_def,
scaleFactor, STYLE_SOLIDHIGHLIGHTS);
WindUpdate();
(void) sprintf(prompt, "%s --more--", mesg);
(void) TxGetLinePrompt(answer, sizeof answer, prompt);
if (answer[0] == 'n')
return (1);
#ifdef notdef
/* Does this segment cross the clipping area? */
if (outline->o_rect.r_xtop >= clipArea->r_xtop
|| outline->o_rect.r_ytop >= clipArea->r_ytop
|| outline->o_rect.r_xbot < clipArea->r_xbot
|| outline->o_rect.r_ybot < clipArea->r_ybot)
return (1);
#endif /* notdef */
/* Are we back at the starting point? */
switch (outline->o_currentDir)
{
case GEO_NORTH:
case GEO_EAST:
if (outline->o_rect.r_xtop == clipArea->r_xbot
&& outline->o_rect.r_ytop == clipArea->r_ybot)
return (1);
break;
case GEO_SOUTH:
case GEO_WEST:
if (outline->o_rect.r_xbot == clipArea->r_xbot
&& outline->o_rect.r_ybot == clipArea->r_ybot)
return (1);
break;
}
return (0);
}
/*
* ----------------------------------------------------------------------------
*
* plowDisplay --
*
* Debugging procedure to redisplay the yank and spare buffers.
* If 'dodef' is TRUE, we also redisplay the original cell.
*
* Results:
* None.
*
* Side effects:
* Forces redisplay.
*
* ----------------------------------------------------------------------------
*/
void
plowDisplay(dodef)
bool dodef;
{
if (dodef)
DBWAreaChanged(plowDummyUse->cu_def, &TiPlaneRect,
DBW_ALLWINDOWS, &DBAllButSpaceBits);
DBWAreaChanged(plowYankDef, &TiPlaneRect,
DBW_ALLWINDOWS, &DBAllButSpaceBits);
DBWAreaChanged(plowSpareDef, &TiPlaneRect,
DBW_ALLWINDOWS, &DBAllButSpaceBits);
WindUpdate();
}
| 27.574029 | 137 | 0.605343 | [
"geometry"
] |
9da6760799c634f7dc2225bb5bdd2db27a0c735f | 2,811 | h | C | lib/friends_struct_data.h | lugia-kun/friends | 22303e51f469ee48ae8411799eaec7cf68ddb9bc | [
"MIT"
] | null | null | null | lib/friends_struct_data.h | lugia-kun/friends | 22303e51f469ee48ae8411799eaec7cf68ddb9bc | [
"MIT"
] | null | null | null | lib/friends_struct_data.h | lugia-kun/friends | 22303e51f469ee48ae8411799eaec7cf68ddb9bc | [
"MIT"
] | null | null | null | /**
* @file friends_struct_data.h
*/
/* -*- mode: c -*- */
/* vim: set ft=c: */
#ifndef FRIENDS_STRUCT_DATA_H
#define FRIENDS_STRUCT_DATA_H
#include <stdint.h>
#include "friends_defs.h"
struct friendsDataFunctions
{
friendsObjectDeleter *deleter; /*!< データの削除関数 */
friendsDataCompareFunc *comparator; /*!< データの比較関数 */
friendsTextDeleter *txt_deleter; /*!< 文字列データの削除関数 */
friendsTextCreator *txt_creator; /*!< 文字列データの作成関数 */
};
/**
* @typedef friendsMaxAlignType
* @brief アライメントの最も大きい型
*
* もしコンパイラが C11 に対応していれば `max_align_t` を使うのです。C11
* に対応していない場合は、基本的な型を `union` で固めた型を使っているの
* です (ただし、不十分かもしれません)。
*/
#if defined(HAVE_MAX_ALIGN_T)
typedef max_align_t friendsMaxAlignType;
#else
typedef union {
short s; int i; long int l; long long int ll; intmax_t im;
float f; double d; long double ld;
void *p; void (*fp)(void);
} friendsMaxAlignType;
#endif
struct friendsDataObject
{
friendsType type; /*!< データの種類 */
const friendsDataFunctions *funcs; /*!< データの処理関数 */
friendsChar *txt; /*!< 文字列データ */
friendsSize refc; /*!< 参照個数 */
friendsSize size; /*!< データのサイズ */
friendsHash hash; /*!< ハッシュ値 */
friendsMaxAlignType data[]; /*!< データ */
};
typedef struct friendsDataObject friendsDataObject;
struct friendsData
{
friendsPark *park; /*!< 所属するパーク */
friendsDataObject *object;
};
union friendsAtomInternal
{
int n; /*!< 数値アトムの値 */
friendsChar *t; /*!< 文字列アトムの値 */
};
struct friendsAtomData
{
friendsAtomType type; /*!< アトムの型 */
union friendsAtomInternal data; /*!< アトムのデータ */
};
struct friendsVariableData
{
friendsChar *text; /*!< 変数名 */
friendsBool tail;
};
struct friendsPropositionData
{
friendsDataList *conditions; /*!< 前提条件 */
friendsDataList *arguments; /*!< パラメータのリスト */
friendsChar *verb; /*!< 述語 */
friendsPropositionMode mode; /*!< モード */
};
struct friendsMatchData
{
friendsBool t;
};
struct friendsPark
{
friendsDataSet *friends; /*!< 命題のリスト(述語ごとに区分け) */
friendsDataSet *atoms;
friendsMemory *allocs;
friendsParser *parser;
friendsBool deleting;
};
struct friendsLineColumn
{
long line;
long column;
};
struct friendsParser
{
friendsPark *park;
void *parserData;
friendsToken *tokens;
friendsToken *tokencur;
friendsDataList *parsed_data;
friendsStringList *buffer_list;
friendsStringList *listcur;
size_t bufp_size;
friendsChar *bufp;
const friendsChar *cur;
const friendsChar *mark;
const friendsChar *cmark;
const friendsChar *limit;
const friendsChar *token;
const friendsChar *stoken;
friendsLineColumn curpos;
friendsLineColumn tokpos;
friendsLineColumn errpos;
friendsLexerState lexer_state;
int last_type;
const char* filename;
friendsError err;
};
#endif /* FRIENDS_STRUCT_DATA_H */
| 21.458015 | 60 | 0.689079 | [
"object"
] |
776b3816665066cfb65018d62f6567412d66e14d | 3,680 | h | C | RecordManager/RecordManager.h | ZSYTY/MiniSQL | 69115d8a5d7f2e0b70a4da331066dfd1a5c4a8f6 | [
"MIT"
] | 1 | 2020-06-30T23:53:51.000Z | 2020-06-30T23:53:51.000Z | RecordManager/RecordManager.h | MagicAtom/MiniSQL | 69115d8a5d7f2e0b70a4da331066dfd1a5c4a8f6 | [
"MIT"
] | null | null | null | RecordManager/RecordManager.h | MagicAtom/MiniSQL | 69115d8a5d7f2e0b70a4da331066dfd1a5c4a8f6 | [
"MIT"
] | 1 | 2020-06-30T23:53:28.000Z | 2020-06-30T23:53:28.000Z | /*
* @Author: Tianyu You
* @Date: 2020-05-24 18:21:25
* @Last Modified by: Tianyu You
* @Last Modified time: 2020-05-24 21:06:08
*/
#ifndef MINISQL_RECORD_MANAGER_H
#define MINISQL_RECORD_MANAGER_H
#include "../BufferManager/BufferManager.h"
#include "../IndexManager/IndexManager.h"
#include "../CatalogManager/CatalogManager.h"
#include "../Common/Common.h"
#include <functional>
#include <iostream>
#include <memory>
#include <cstdlib>
using namespace MiniSQL;
class RecordManager
{
private:
/* data */
BufferManager *bufferManager;
IndexManager *indexManager;
CatalogManager *catalogManager;
// Check if there is a type conflicts when insert
bool checkType(TableInfo &tableInfo,const Tuple record);
// Check if primary key duplicates
//bool checkUnique(const std::vector<Tuple> &tuples,const Tuple record,TableInfo &tableInfo);
// Check if predicates match
bool checkConditions(TableInfo &tableInfo,const std::vector<SqlCondition> conditions,std::shared_ptr<std::vector<SqlValue> > record);
bool writeRecord(TableInfo &tableInfo,const Tuple record,char* ptr);
bool insertOneRecord(const std::string &tableName, const Tuple record);
unsigned int getRecordSize(const std::string tableName);
std::shared_ptr<std::vector<SqlValue>> readRecord(TableInfo &tableInfo,BYTE* ptr);
void printResult(TableInfo& tableInfo,const std::vector<Tuple> &results);
SqlValue getValue(TableInfo &tableInfo,int indexOffset,int indexPos);
public:
RecordManager(BufferManager *_bufferManager, IndexManager *_indexManager, CatalogManager *_catalogManager): bufferManager(_bufferManager), indexManager(_indexManager),catalogManager(_catalogManager) {};
~RecordManager();
void createTable(const std::string &tableName);
void dropTable(const std::string &tableName);
bool insertRecord(const std::string &tableName,const std::vector<Tuple> records);
int deleteRecord(const std::string &tableName, const std::vector<SqlCondition> &conditions);
bool deleteRecord(const std::string &tableName);
// To avoid large data copy in memory, print result here instead of returning values
bool selectRecord(const std::string &tableName, const std::vector<SqlCondition> &conditions);
// Large memory copy, un-efficiency
//std::vector<Tuple> getTuples(const std::string &tableName);
void tableTraversal(
TableInfo &tableInfo,
const std::vector<SqlCondition>& conditions,
std::function<bool(BYTE*,size_t,size_t,std::shared_ptr<std::vector<SqlValue>>)> consumer
);
void linearTraversal(
TableInfo &tableInfo,
const std::vector<SqlCondition>& conditions,
std::function<bool(BYTE*,size_t,size_t,std::shared_ptr<std::vector<SqlValue>>)> consumer
);
template <class T>
inline T getAsType(SqlValue* sqlValue,SqlValueBaseType){
T a;
switch(sqlValue->type){
case SqlValueBaseType::MiniSQL_int: a = (T*)sqlValue->int_val; break;
case SqlValueBaseType::MiniSQL_char:a = (T*)sqlValue->char_val; break;
case SqlValueBaseType::MiniSQL_float: a = (T*)sqlValue->float_val; break;
}
return a;
}
void indexTraversal(
TableInfo& tableInfo,
int indexOffset, // This offset marks the index of the record in the table
std::vector<SqlCondition> conditions,
std::function<bool(BYTE*,size_t,size_t,std::shared_ptr<std::vector<SqlValue>>)> consumer
);
void freeRecord(std::shared_ptr<std::vector<SqlValue>> record);
void saveIndexes(TableInfo &tableInfo,const Tuple record,int offset);
};
#endif | 34.392523 | 206 | 0.712228 | [
"vector"
] |
776c4d4170dbb9b49bcf7b80dacdf0aff2b5b4c1 | 1,723 | h | C | src/solar/windows/dialogs/dialog_window.h | jseward/solar | a0b76e3c945679a8fcb4cc94160298788b96e4a5 | [
"MIT"
] | 4 | 2017-04-02T07:56:14.000Z | 2021-10-01T18:23:33.000Z | src/solar/windows/dialogs/dialog_window.h | jseward/solar | a0b76e3c945679a8fcb4cc94160298788b96e4a5 | [
"MIT"
] | null | null | null | src/solar/windows/dialogs/dialog_window.h | jseward/solar | a0b76e3c945679a8fcb4cc94160298788b96e4a5 | [
"MIT"
] | 1 | 2021-10-01T18:23:38.000Z | 2021-10-01T18:23:38.000Z | #pragma once
#include "solar/windows/window.h"
#include "solar/windows/layout/window_layout.h"
#include "solar/text/text_id.h"
#include "dialog_window_style.h"
#include "dialog_frame_window.h"
#include "dialog_content_window.h"
#include "dialog_title_window.h"
#include "dialog_close_button.h"
namespace solar {
class dialog_window : public window {
private:
dialog_window_style_id _style;
window_layout _frame_layout;
text_id _title_text;
dialog_frame_window _frame_window;
dialog_content_window _content_window;
dialog_title_window _title_window;
dialog_close_button _close_button;
bool _is_closable_ever;
bool _is_open;
public:
dialog_window(const char* id);
virtual ~dialog_window();
void set_is_closable_ever(bool is_closable_ever);
bool is_closable_ever() const;
bool is_closable_now() const;
const dialog_window_style& get_style() const;
const window_layout& get_frame_layout() const;
const wchar_t* get_title_text() const;
void add_child_to_content_window(window* child);
void remove_all_children_from_content_window();
void open();
void close();
bool try_close();
virtual void on_parent_area_changed() override;
virtual bool on_key_down_anywhere(const window_key_event_params& params) override;
virtual bool on_mouse_button_down(const window_mouse_button_event_params& params) override;
virtual bool on_mouse_button_up(const window_mouse_button_event_params& params) override;
virtual void render(const window_render_params& params) override;
virtual void read_from_archive(archive_reader& reader) override;
virtual void write_to_archive(archive_writer& writer) const override;
virtual void on_opened();
virtual void on_closed();
};
} | 28.716667 | 93 | 0.799768 | [
"render"
] |
776ca2ee8859beb981baaaf982676292e4f3eca0 | 16,794 | h | C | dev/src/lobster/slaballoc.h | sgraham/lobster | a7654d347f3642523264f74450403f44f5ecd33c | [
"Apache-1.1"
] | null | null | null | dev/src/lobster/slaballoc.h | sgraham/lobster | a7654d347f3642523264f74450403f44f5ecd33c | [
"Apache-1.1"
] | null | null | null | dev/src/lobster/slaballoc.h | sgraham/lobster | a7654d347f3642523264f74450403f44f5ecd33c | [
"Apache-1.1"
] | null | null | null | // Copyright 2014 Wouter van Oortmerssen. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*
Very fast, low overhead slab allocator.
In the common case, each size of allocation has its own bucket (a linked list of blocks of exactly
that size), meaning allocation is almost as fast as de-linking an element.
It acquires new blocks by allocating a page from the system, and subdividing that page into blocks
of the same size, which it then adds to the bucket all at once.
Each page has a page header that keeps track of how much of the page is in use. The allocator can
access the page header from any memory block because pages are allocated aligned to their sizes
(by clearing the lower bits of any pointer therein). To do this alignment, many pages at once are
allocated from the system, which wastes 1 page on alignment, currently representing 1% of memory.
Because each page tracks the number of blocks in use, the moment any page becomes empty, it will
remove all blocks therein from its bucket, and then make the page available to a different size
allocation. This avoids that if at some point a lot of blocks of a certain size were allocated that
they will always be allocated.
There aren't a lot of realistic worst cases for this allocator. To achieve a hypothetical worst
case, you'd have to:
- allocate lots of objects of size N
- deallocate most of them, but not all
- the ones that you don't deallocate would have to each exactly keep 1 page "alive"
(i.e. if N = 100, there will be 20 blocks to a page, meaning if you didn't deallocate every 20th
object allocated, that would create maximum waste.)
- never use objects of size N again after this.
This allocator can offer major cache advantages, because objects of the same type are often
allocated closer to eachother.
Alloc/dealloc do NOT store the size of the object, for a savings of size_t per object.
This assumes you know the size of the object when deallocating.
alloc_sized/dealloc_sized instead do store the size, if a more drop-in replacement for malloc/free
is desired.
*/
#ifndef NDEBUG
// Uncomment if debugging with crtdbg functionality is required (for finding memory corruption).
//#define PASSTHRUALLOC
#define COLLECT_STATS
#endif
class SlabAlloc {
// Must be ^2. lower means more blocks have to go thru the traditional allocator (slower).
// Higher means you may get pages with only few allocs of that unique size (memory wasted).
// On 32bit, 32 means all allocations <= 256 bytes go into buckets (in increments of 8 bytes
// each).
static const iint MAXBUCKETS = 32;
// Depends on how much you want to take from the OS at once: PAGEATONCE*PAGESIZEF
// You will waste 1 page to alignment with MAXBUCKETS at 32 on a 32bit system, PAGESIZEF is
// 2048, so this is 202k.
static const iint PAGESATONCE = 101;
// "64bit should be enough for everyone". Everything is twice as big on 64bit: alignment,
// memory blocks, and pages.
static const iint PTRBITS = sizeof(void *) == 4 ? 2 : 3;
// Must fit 2 pointers in smallest block for doubly linked list.
static const iint ALIGNBITS = PTRBITS + 1;
static const iint ALIGN = 1 << ALIGNBITS;
static const iint ALIGNMASK = ALIGN - 1;
static const iint MAXREUSESIZE = (MAXBUCKETS - 1) * ALIGN;
// The largest block will fit almost 8 times.
static const iint PAGESIZEF = MAXBUCKETS * ALIGN * 8;
static const iint PAGEMASK = (~(PAGESIZEF - 1));
static const iint PAGEBLOCKSIZE = PAGESIZEF * PAGESATONCE;
struct PageHeader : DLNodeRaw {
iint refc;
iint size;
char *isfree;
};
inline iint bucket(iint s) {
return (s + ALIGNMASK) >> ALIGNBITS;
}
inline PageHeader *ppage(const void *p) {
return (PageHeader *)(((size_t)p) & (size_t)PAGEMASK);
}
inline iint numobjs(iint size) { return (PAGESIZEF - isizeof<PageHeader>()) / size; }
DLList<DLNodeRaw> reuse[MAXBUCKETS];
DLList<PageHeader> freepages, usedpages;
void **blocks = nullptr;
DLList<DLNodeRaw> largeallocs;
#ifdef COLLECT_STATS
int64_t stats[MAXBUCKETS] = { 0 };
#endif
int64_t statbig = 0;
void putinbuckets(char *start, char *end, iint b, iint size) {
assert(isizeof<DLNodeRaw>() <= size);
for (end -= size; start <= end; start += size) {
reuse[b].InsertAfterThis((DLNodeRaw *)start);
}
}
void oom() {
exit(0xBADA110C);
}
void newpageblocks() {
// If we could get page aligned memory here, that would be even better.
auto b = (void **)malloc((size_t)PAGEBLOCKSIZE + sizeof(void *));
if (!b) oom();
*b = (void *)blocks;
blocks = b;
b++;
char *first = ((char *)ppage(b)) + PAGESIZEF;
for (iint i = 0; i < PAGESATONCE - 1; i++) {
PageHeader *p = (PageHeader *)(first + i * PAGESIZEF);
freepages.InsertAfterThis(p);
}
}
void newpage(iint b) {
assert(b);
if (freepages.Empty()) newpageblocks();
PageHeader *page = freepages.Get();
usedpages.InsertAfterThis(page);
page->refc = 0;
page->size = b*ALIGN;
putinbuckets((char *)(page+1), ((char *)page) + PAGESIZEF, b, page->size);
}
void freepage(PageHeader *page, iint size) {
for (char *b = (char *)(page + 1); b + size <= ((char *)page) + PAGESIZEF; b += size) {
((DLNodeRaw *)b)->Remove();
}
page->Remove();
freepages.InsertAfterThis(page);
}
void *alloc_large(iint size) {
statbig++;
auto buf = (DLNodeRaw *)malloc((size_t)size + sizeof(DLNodeRaw));
if (!buf) oom();
largeallocs.InsertAfterThis(buf);
return ++buf;
}
void dealloc_large(void *p) {
auto buf = (DLNodeRaw *)p;
--buf;
buf->Remove();
free(buf);
}
public:
SlabAlloc() {}
~SlabAlloc() {
while(blocks) {
auto next = *blocks;
free(blocks);
blocks = (void **)next;
}
while (!largeallocs.Empty()) free(largeallocs.Get());
}
// These are the most basic allocation functions, only useable if you know for sure
// that your allocated size is <= MAXREUSESIZE (i.e. single objects).
// They know their own size efficiently thanks to the pageheader, and are VERY fast.
void *alloc_small(iint size) {
#ifdef PASSTHRUALLOC
return alloc_large(size);
#endif
assert(size <= MAXREUSESIZE); // If you hit this, use alloc() below instead.
auto b = bucket(size);
#ifdef COLLECT_STATS
stats[b]++;
#endif
if (reuse[b].Empty()) newpage(b);
auto r = reuse[b].Get();
ppage(r)->refc++;
return r;
}
void dealloc_small(void *p) {
#ifdef PASSTHRUALLOC
dealloc_large(p);
return;
#endif
PageHeader *page = ppage(p);
#ifndef NDEBUG
memset(p, 0xBA, (size_t)page->size);
#endif
auto b = page->size >> ALIGNBITS;
reuse[b].InsertAfterThis((DLNodeRaw *)p);
if (!--page->refc) freepage(page, page->size);
}
iint size_of_small_allocation(const void *p) {
return ppage(p)->size;
}
template<typename T> iint size_of_small_allocation_typed(const T *p) {
return size_of_small_allocation(p) / isizeof<T>();
}
// Unlike the _small functions, these functions can deal with any size,
// but require you to know the size you allocated upon deallocation.
void *alloc(iint size) {
return size > MAXREUSESIZE ? alloc_large(size)
: alloc_small(size);
}
void dealloc(void *p, iint size) {
if (size > MAXREUSESIZE) dealloc_large(p);
else dealloc_small(p);
}
void *resize(void *p, iint oldsize, iint size) {
void *np = alloc(size);
memcpy(np, p, (size_t)(size > oldsize ? oldsize : size));
dealloc(p, oldsize);
return np;
}
// Versions of the above functions that track size for you, if you need drop-in free/malloc
// style functionality.
void *alloc_sized(iint size) {
auto p = (iint *)alloc(size + isizeof<iint>());
*p++ = size; // Stores 2 sizes for big objects!
return p;
}
void dealloc_sized(void *p) {
auto t = (iint *)p;
auto size = *--t;
size += isizeof<size_t>();
dealloc(t, size);
}
static iint size_of_allocation(const void *p) {
return ((iint *)p)[-1];
}
template<typename T> static iint size_of_allocation_typed(const T *p) {
return size_of_allocation(p) / isizeof<T>();
}
void *resize_sized(void *p, iint size) {
auto np = alloc_sized(size);
auto oldsize = size_of_allocation(p);
memcpy(np, p, (size_t)(size > oldsize ? oldsize : size));
dealloc_sized(p);
return np;
}
void *clone_sized(const void *p) {
auto len = size_of_allocation(p);
auto buf = alloc_sized(len);
memcpy(buf, p, (size_t)len);
return buf;
}
// Convenient string allocation, dealloc with dealloc_sized.
char *alloc_string_sized(string_view from) {
auto len = ssize(from);
auto buf = (char *)alloc_sized(len + 1);
memcpy(buf, from.data(), len);
buf[len] = 0;
return buf;
}
static iint size_of_string(const void *p) {
return size_of_allocation(p) - 1;
}
// Typed helpers.
template<typename T> T *alloc_obj_small() { // T must fit inside MAXREUSESIZE.
return (T *)alloc_small(isizeof<T>());
}
template<typename T> T *clone_obj_small(const T *from) {
assert(from);
auto to = (T *)alloc_small(sizeof(T));
memcpy(to, from, sizeof(T));
return to;
}
template<typename T> T *alloc_array(iint numelems) {
return (T *)alloc(isizeof<T>() * numelems);
}
template<typename T> void dealloc_array(T *array, iint numelems) {
dealloc(array, isizeof<T>() * numelems);
}
// Clones anything regardless of what it is, finds out size itself.
void *clone_obj_small_unknown(const void *from) {
assert(from);
auto sz = size_of_small_allocation(from);
auto to = alloc_small(sz);
memcpy(to, from, (size_t)sz);
return to;
}
// Will even work with a derived class of T, assuming it was also allocated with
// alloc_obj_small().
template<typename T> void destruct_obj_small(T *obj) {
obj->~T();
dealloc_small(obj);
}
// Can get size of copied vector with size_of_allocation, and deallocate with dealloc_sized.
template<typename T> T *vector_copy_sized(vector<T> from) {
auto buf = (T *)alloc_sized(isizeof<T>() * isize(from));
memcpy(buf, &from[0], sizeof(T) * from.size());
return buf;
}
// For diagnostics and GC.
iint count_small_allocs() {
iint sum = 0;
loopdllist(usedpages, h) sum += h->refc;
return sum;
}
bool pointer_is_in_allocator(void *p) {
for (auto b = blocks; b; b = (void **)*b) {
if (p > b && p <= ((char *)b) + PAGEBLOCKSIZE) return true;
}
return false;
}
vector<void *> findleaks() {
vector<void *> leaks;
loopdllist(usedpages, h) {
h->isfree = (char *)calloc((size_t)numobjs(h->size), 1);
}
for (iint i = 0; i < MAXBUCKETS; i++) {
loopdllist(reuse[i], n) {
PageHeader *page = ppage(n);
page->isfree[(((char *)n) - ((char *)(page + 1))) / (i * ALIGN)] = 1;
}
}
loopdllist(usedpages, h) {
for (iint i = 0; i < numobjs(h->size); i++) {
if (!h->isfree[i]) {
leaks.push_back(((char *)(h + 1)) + i * h->size);
}
}
free(h->isfree);
h->isfree = nullptr;
}
loopdllist(largeallocs, n) leaks.push_back(n + 1);
return leaks;
}
void printstats(bool full = false) {
iint totalwaste = 0;
long long totalallocs = 0;
for (iint i = 0; i < MAXBUCKETS; i++) {
iint num = 0;
loopdllist(reuse[i], n) num++;
#ifdef COLLECT_STATS
if (num || stats[i]) {
auto waste = (i * ALIGN * num + 512)/1024;
totalwaste += waste;
totalallocs += stats[i];
if (full || num) {
LOG_INFO("bucket ", i * ALIGN, " -> freelist ", num, " (",
waste, " k), ", stats[i], " total allocs");
}
}
#endif
}
iint numfree = 0, numused = 0, numlarge = 0;
loopdllist(freepages, h) numfree++;
loopdllist(usedpages, h) numused++;
loopdllist(largeallocs, n) numlarge++;
if (full || numused || numlarge || totalallocs) {
LOG_INFO("totalwaste ", totalwaste, " k, pages ", numfree, " empty / ",
numused, " used, ", numlarge, " big alloc live, ", totalallocs,
" total allocs made, ", statbig, " big allocs made");
}
}
};
/* TODO / improvements:
If we could distinguish a big alloc pointer from a slab allocated one, we could read the size of
the block from the pageheader, giving the functionality of the _sized() functions without their
overhead to all allocations. Ways this could be done:
- Cooperate with the OS to have small pages mapped to a separate virtual memory area so we can do a
simple pointer comparison
- Have magic numbers in the page header to distinguish it.. still not totally safe, and potentially
access unused memory could be a pointer to itself. this guarantees that it can't be any other
pointer.
what are the chances that a float/int or other random data has the same value as the location its
stored in? small, but still..
of course could up the ante by having 2 such pointers, another one at the end of the page or
whatever or could up it even further by having all big allocations have a magic number at the
start of their buffer (not the page), so you'd first check that, then the page header... still
not fool proof and many checks means slower
- Write a large block allocator that also always has page headers for the start of any allocation
this means multi-page allocations can't reuse the remaining space in the last page. They also
generally need to allocate their own pages, so unless you can acquire page aligned mem from the
system, this would be anothe page of overhead and allocations that fit in a single page can
possibly share a page (sizes roughly between MAXREUSESIZE and PAGESIZE). this category would
share the page pool with the small allocs. Generally, large allocators that waste memory should
make allocations that are as large as possible, then allow the client to query the size it
actually got: this is useful for vectors etc that can actually use the extra space. This idea
could even be useful for small allocs to some extend, especially if you start doing non-linear
bucket sizes This all could be made specific to a programming language interpreter, since all
large blocks are long strings or vectors, esp vectors, which make sense to make em just fill
pages.
- Have a bit array for all pages of the entire 32bit address space that say if it is a small page
block or not. at 2K pages, there's 2^21 pages, needing 2^18 bytes, i.e. 256K
Doesn't work in 64bit mode, and 256K fixed overhead is not great but doable. Accessing that 256k
might be a cache issue but the bulk of those pages sit really close. Can of course increase the
page size to 4K or 8K, TC-Malloc thinks everything below 32k alloc is small, so we're probably
being too careful. Or if you can get aligned memory
from the OS, you could make this table really small, even if our pages are smaller than the OS
ones.
*/
| 37.909707 | 100 | 0.624092 | [
"object",
"vector"
] |
776ed788d32cdb069f6d462a9e5859f04382c62d | 4,123 | h | C | lib/Cinder/include/cinder/app/WinRTApp.h | timmb/HarmonicMotion | 4ddf8ce98377260e57b6293d093a144a25ce3132 | [
"MIT"
] | 1 | 2018-07-20T03:56:15.000Z | 2018-07-20T03:56:15.000Z | lib/Cinder/include/cinder/app/WinRTApp.h | timmb/HarmonicMotion | 4ddf8ce98377260e57b6293d093a144a25ce3132 | [
"MIT"
] | null | null | null | lib/Cinder/include/cinder/app/WinRTApp.h | timmb/HarmonicMotion | 4ddf8ce98377260e57b6293d093a144a25ce3132 | [
"MIT"
] | null | null | null | // The copyright in this software is being made available under the BSD License, included below.
// This software may be subject to other third party and contributor rights, including patent rights,
// and no such rights are granted under this license.
//
// Copyright (c) 2013, Microsoft Open Technologies, Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - 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 Microsoft Open Technologies, Inc. nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include "cinder/app/AppImplWinRTBasic.h"
ref class WinRTApp sealed : public Windows::ApplicationModel::Core::IFrameworkView
{
public:
WinRTApp();
// IFrameworkView Methods.
virtual void Initialize(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView);
virtual void SetWindow(Windows::UI::Core::CoreWindow^ window);
virtual void Load(Platform::String^ entryPoint);
virtual void Run();
virtual void Uninitialize();
void EnableMultiTouch(BOOL bEnable);
protected:
// Event Handlers.
void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
void OnLogicalDpiChanged(Platform::Object^ sender);
void OnActivated(Windows::ApplicationModel::Core::CoreApplicationView^ applicationView, Windows::ApplicationModel::Activation::IActivatedEventArgs^ args);
void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ args);
void OnResuming(Platform::Object^ sender, Platform::Object^ args);
void OnWindowClosed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CoreWindowEventArgs^ args);
void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args);
void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerMoved(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnKeyDown(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
void OnKeyUp(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args);
void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args);
private:
cinder::app::AppImplWinRTBasic *mApp;
bool m_windowClosed;
bool m_windowVisible;
};
ref class Direct3DApplicationSource sealed : Windows::ApplicationModel::Core::IFrameworkViewSource
{
public:
Direct3DApplicationSource() {};
virtual Windows::ApplicationModel::Core::IFrameworkView^ CreateView();
};
| 54.973333 | 156 | 0.76522 | [
"object"
] |
7775c200074678466a8edd7449d33e051362a6e5 | 7,393 | h | C | cplusplus/level2_simple_inference/0_data_process/vdecandvenc/src/common/inc/atlas_utils.h | Dedederek/samples | 31d99de20af2f7046556e0f48c4b789b99e422f8 | [
"Apache-2.0"
] | 5 | 2021-02-26T17:58:12.000Z | 2022-03-15T06:21:28.000Z | cplusplus/level2_simple_inference/0_data_process/vdecandvenc/src/common/inc/atlas_utils.h | Dedederek/samples | 31d99de20af2f7046556e0f48c4b789b99e422f8 | [
"Apache-2.0"
] | null | null | null | cplusplus/level2_simple_inference/0_data_process/vdecandvenc/src/common/inc/atlas_utils.h | Dedederek/samples | 31d99de20af2f7046556e0f48c4b789b99e422f8 | [
"Apache-2.0"
] | 5 | 2021-03-22T21:13:11.000Z | 2021-09-24T06:52:33.000Z | /**
* Copyright 2020 Huawei Technologies Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* File utils.h
* Description: handle file operations
*/
#pragma once
#include <iostream>
#include <vector>
#include <memory>
#include <mutex>
#include <unistd.h>
#include <vector>
#include "acl/acl.h"
#include "acl/ops/acl_dvpp.h"
#include "atlas_error.h"
#include "atlas_type.h"
using namespace std;
/**
* @brief calculate RGB 24bits image size
* @param [in] width: image width
* @param [in] height: image height
* @return bytes size of image
*/
#define RGBU8_IMAGE_SIZE(width, height) ((width) * (height) * 3)
/**
* @brief calculate YUVSP420 image size
* @param [in] width: image width
* @param [in] height: image height
* @return bytes size of image
*/
#define YUV420SP_SIZE(width, height) ((width) * (height) * 3 / 2)
/**
* @brief generate shared pointer of dvpp memory
* @param [in] buf: memory pointer, malloc by acldvppMalloc
* @return shared pointer of input buffer
*/
#define SHARED_PRT_DVPP_BUF(buf) (shared_ptr<uint8_t>((uint8_t *)(buf), [](uint8_t* p) { acldvppFree(p); }))
/**
* @brief generate shared pointer of memory
* @param [in] buf memory pointer, malloc by new
* @return shared pointer of input buffer
*/
#define SHARED_PRT_U8_BUF(buf) (shared_ptr<uint8_t>((uint8_t *)(buf), [](uint8_t* p) { delete[](p); }))
/**
* @brief calculate aligned number
* @param [in] num: the original number that to aligned
* @param [in] align: the align factor
* @return the number after aligned
*/
#define ALIGN_UP(num, align) (((num) + (align) - 1) & ~((align) - 1))
/**
* @brief calculate number align with 2
* @param [in] num: the original number that to aligned
* @return the number after aligned
*/
#define ALIGN_UP2(num) ALIGN_UP(num, 2)
/**
* @brief calculate number align with 16
* @param [in] num: the original number that to aligned
* @return the number after aligned
*/
#define ALIGN_UP16(num) ALIGN_UP(num, 16)
/**
* @brief calculate number align with 128
* @param [in] num: the original number that to aligned
* @return the number after aligned
*/
#define ALIGN_UP128(num) ALIGN_UP(num, 128)
/**
* @brief Write acl error level log to host log
* @param [in] fmt: the input format string
* @return none
*/
#define ATLAS_LOG_ERROR(fmt, ...) \
do{aclAppLog(ACL_ERROR, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
fprintf(stdout, "[ERROR] " fmt "\n", ##__VA_ARGS__);}while(0)
/**
* @brief Write acl info level log to host log
* @param [in] fmt: the input format string
* @return none
*/
#define ATLAS_LOG_INFO(fmt, ...) \
do{aclAppLog(ACL_INFO, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
fprintf(stdout, "[INFO] " fmt "\n", ##__VA_ARGS__);}while(0)
/**
* @brief Write acl debug level log to host log
* @param [in] fmt: the input format string
* @return none
*/
#define ATLAS_LOG_DEBUG(fmt, ...) \
do{aclAppLog(ACL_DEBUG, __FUNCTION__, __FILE__, __LINE__, fmt, ##__VA_ARGS__); \
fprintf(stdout, "[INFO] " fmt "\n", ##__VA_ARGS__);}while(0)
/**
* @brief Recognize the string is a accessable directory or not
* @param [in] path: the input string
* @return bool true: is directory; false: not directory
*/
bool IsDirectory(const string &path);
/**
* @brief Copy data to device
* @param [in] data: The data to be copy
* @param [in] size: The data bytes size
* @param [in] curRunMode: The run mode, get by aclrtGetRunMode,
* Atlas200DK is ACL_DEVICE, Atlas300 is ACL_HOST
* @param [in] memType: The dest memory type:MEMORY_NORMAL(in Atlas200DK),
* MEMORY_DEVICE, MEMORY_DVPP
* @return void* The dest memory pointer
*/
void* CopyDataToDevice(void* data, uint32_t size,
aclrtRunMode curRunMode, MemoryType memType);
/**
* @brief Copy data to host
* @param [in] data: The data to be copy
* @param [in] size: The data bytes size
* @param [in] curRunMode: The run mode, get by aclrtGetRunMode,
* Atlas200DK is ACL_DEVICE, Atlas300 is ACL_HOST
* @param [in] memType: The dest memory type:MEMORY_NORMAL, MEMORY_HOST
* @return void* The dest memory pointer
*/
void* CopyDataToHost(void* data, uint32_t size,
aclrtRunMode curRunMode, MemoryType memType);
/**
* @brief Copy data to memory
* @param [in] data: The data to be copy
* @param [in] size: The data bytes size
* @param [in] policy: the kind of sync,
* typedef enum aclrtMemcpyKind {
* ACL_MEMCPY_HOST_TO_HOST, // Host内的内存复制
* ACL_MEMCPY_HOST_TO_DEVICE, // Host到Device的内存复制
* ACL_MEMCPY_DEVICE_TO_HOST, // Device到Host的内存复制
* ACL_MEMCPY_DEVICE_TO_DEVICE, // Device内的内存复制
* } aclrtMemcpyKind;
* @param [in] memType: The dest memory type
* @return void* The dest memory pointer
*/
void* CopyData(void* data, uint32_t size,
aclrtMemcpyKind policy, MemoryType memType);
/**
* @brief Read image file
* @param [out] image: image data read from file. If the image is jpeg,
* the image.width and image.height is the image
* resolution, otherwise is 0
* @param [in] fileName: The data bytes size
* @return AtlasError ATLAS_OK: read success
* others: read failed
*/
AtlasError ReadImageFile(ImageData& image, std::string& fileName);
/**
* @brief Get all files from file list string
* @param [in] path: files list string, seperate by ',',
* the element could be file path or directory
* @param [in] fileName: The data bytes size
* @return AtlasError ATLAS_OK: read success
* others: read failed
*/
void GetAllFiles(const string &path, vector<string> &file_vec);
/**
* @brief Save data to binary file
* @param [in] filename: binary file name with path
* @param [in] data: binary data
* @param [in] size: bytes size of data
* @return AtlasError ATLAS_OK: read success
* others: read failed
*/
void SaveBinFile(const string& filename, void* data, uint32_t size);
/**
* @brief Save data to binary file
* @param [in] filename: binary file name with path
* @param [in] data: binary data
* @param [in] size: bytes size of data
* @return AtlasError ATLAS_OK: read success
* others: read failed
*/
AtlasError ReadBinFile(const string& filename, void*& data, uint32_t& size);
AtlasError CopyImageToLocal(ImageData& destImage,
ImageData& srcImage, aclrtRunMode curRunMode);
bool IsIpAddrWithPort(const string& addrStr);
void ParseIpAddr(string& ip, string& port, const string& addr);
bool IsVideoFile(const string& str);
bool IsRtspAddr(const string &str);
bool IsDigitStr(const string& str);
bool IsPathExist(const string &path); | 34.069124 | 108 | 0.665765 | [
"vector"
] |
7777abd99e9d9b013f939947f3349c38b8ea9e92 | 4,369 | h | C | patch/cfs/apps/eyassat_if/fsw/src/eyassat_if_app.h | cypher-me/HAS-Qualifier-Challenges | bb795303716155dad4a930880a58fecb5d9b50c5 | [
"MIT"
] | 75 | 2020-07-20T20:54:00.000Z | 2022-03-09T09:18:37.000Z | patch/cfs/apps/eyassat_if/fsw/src/eyassat_if_app.h | cypher-me/HAS-Qualifier-Challenges | bb795303716155dad4a930880a58fecb5d9b50c5 | [
"MIT"
] | 3 | 2020-09-13T00:46:49.000Z | 2021-07-06T16:18:22.000Z | patch/cfs/apps/eyassat_if/fsw/src/eyassat_if_app.h | cypher-me/HAS-Qualifier-Challenges | bb795303716155dad4a930880a58fecb5d9b50c5 | [
"MIT"
] | 14 | 2020-07-22T16:34:51.000Z | 2021-09-13T12:19:59.000Z | /*
** Purpose: Define a Eyassat_if application.
**
** Notes:
** None
**
** License:
** Template written by David McComas and licensed under the GNU
** Lesser General Public License (LGPL).
**
** References:
** 1. OpenSatKit Object-based Application Developer's Guide.
** 2. cFS Application Developer's Guide.
**
*/
#ifndef _eyassat_if_app_
#define _eyassat_if_app_
/*
** Includes
*/
#include "app_cfg.h"
#include "eyassat_obj.h"
#include "eyassat_tbl.h"
/*
** Macro Definitions
*/
#define EYASSAT_IF_INIT_INFO_EID (EYASSAT_IF_BASE_EID + 0)
#define EYASSAT_IF_EXIT_ERR_EID (EYASSAT_IF_BASE_EID + 1)
#define EYASSAT_IF_CMD_NOOP_INFO_EID (EYASSAT_IF_BASE_EID + 2)
#define EYASSAT_IF_CMD_INVALID_MID_ERR_EID (EYASSAT_IF_BASE_EID + 3)
/*
** Type Definitions
*/
typedef struct
{
CMDMGR_Class CmdMgr;
TBLMGR_Class TblMgr;
EYASSATOBJ_Class EyasSatObj;
EYASSATTBL_Class EyasSatTbl;
CFE_SB_PipeId_t CmdPipe;
} EYASSAT_IF_Class;
typedef struct
{
uint8 Header[CFE_SB_TLM_HDR_SIZE];
/*
** CMDMGR Data
*/
uint16 ValidCmdCnt;
uint16 InvalidCmdCnt;
/*
** Example Table Data
** - Loaded with status from the last table action
*/
uint8 LastAction;
uint8 LastActionStatus;
/*
** EXOBJ Data
*/
uint16 EyasSatObjExecCnt;
} OS_PACK EYASSAT_IF_HkPkt;
#define EYASSAT_IF_TLM_HK_LEN sizeof (EYASSAT_IF_HkPkt)
typedef struct
{
uint8 Header[CFE_SB_TLM_HDR_SIZE];
uint8 PacketId;
char CallSign[3];
char TimeString[8];
uint8 TimeDelay;
uint16 CmdTimeOut;
uint8 PwrTlm;
uint8 AdcsTlm;
uint8 ExpTlm;
} OS_PACK EYASSAT_IF_InternalPkt;
#define EYASSAT_IF_TLM_INTERNAL_LEN sizeof (EYASSAT_IF_InternalPkt)
typedef struct
{
uint8 Header[CFE_SB_TLM_HDR_SIZE];
uint8 PacketId;
char CallSign[3];
char TimeString[8];
float DHTemp;
float ExpTemp;
float RefTemp;
float PanelATemp;
float PanelBTemp;
float BaseTemp;
float TopATemp;
float TopBTemp;
} OS_PACK EYASSAT_IF_TempPkt;
#define EYASSAT_IF_TLM_TEMP_LEN sizeof (EYASSAT_IF_TempPkt)
typedef struct
{
uint8 Header[CFE_SB_TLM_HDR_SIZE];
uint8 PacketId;
char CallSign[3];
char TimeString[8];
uint8 SepStatus;
float VBatt;
float IBatt;
float VSA;
float ISA;
float IMB;
float V5V;
float I5V;
float V3V;
float I3V;
uint16 SwitchStatus;
float BattTemp;
float SA1Temp;
float SA2Temp;
// PWR_3V, PWR_ADCS, PWR_EXP, PWR_HTR1, PWR_HTR2 are derived telemetry points
} OS_PACK EYASSAT_IF_PowerPkt;
#define EYASSAT_IF_TLM_POWER_LEN sizeof (EYASSAT_IF_PowerPkt)
typedef struct
{
uint8 Header[CFE_SB_TLM_HDR_SIZE];
uint8 PacketId;
char CallSign[3];
char TimeString[8];
uint8 SepStatus;
uint16 VBatt;
uint16 IBatt;
uint16 VSA;
uint16 ISA;
uint16 IMB;
uint16 V5V;
uint16 I5V;
uint16 V3V;
uint16 I3V;
uint16 SwitchStatus;
uint16 BattTemp;
uint16 SA1Temp;
uint16 SA2Temp;
} OS_PACK EYASSAT_IF_UnscaledPowerPkt;
#define EYASSAT_IF_TLM_UNSCALED_POWER_LEN sizeof (EYASSAT_IF_UnscaledPowerPkt)
typedef struct
{
uint8 Header[CFE_SB_TLM_HDR_SIZE];
uint8 PacketId;
char CallSign[3];
char TimeString[8];
uint16 SunTop;
uint16 SunBottom;
uint16 Sun0;
uint16 Sun90;
uint16 Sun180;
uint16 Sun270;
float YawAng;
float SunOffset;
float MagX;
float MagY;
float MagZ;
float AccX;
float AccY;
float AccZ;
uint8 XRod;
uint8 YRod;
float ActWheelSpd;
float CmdWheelSpd;
uint16 PWM;
uint16 CtrlAlg;
float PConst;
float IConst;
float DConst;
float DeltaT;
float DeadBand;
float Slope;
float Offset;
float Extra;
float RPSHyst;
} OS_PACK EYASSAT_IF_ADCSPkt;
#define EYASSAT_IF_TLM_ADCS_LEN sizeof (EYASSAT_IF_ADCSPkt)
/*
** Exported Data
*/
extern EYASSAT_IF_Class Eyassat_if;
/*
** Exported Functions
*/
/******************************************************************************
** Function: EYASSAT_IF_AppMain
**
*/
void EYASSAT_IF_AppMain(void);
#endif /* _eyassat_if_app_ */
| 19.331858 | 80 | 0.648432 | [
"object"
] |
77791360b0c3f081c04e85a2d2f69f13f7cc4a15 | 117,016 | c | C | src/tests/kits/net/netperf/netlib.c | deep-1/haiku | b273e9733d25babe5e6702dc1e24f3dff1ffd6dc | [
"MIT"
] | 4 | 2016-03-29T21:45:21.000Z | 2016-12-20T00:50:38.000Z | src/tests/kits/net/netperf/netlib.c | jessicah/haiku | c337460525c39e870d31221d205a299d9cd79c6a | [
"MIT"
] | null | null | null | src/tests/kits/net/netperf/netlib.c | jessicah/haiku | c337460525c39e870d31221d205a299d9cd79c6a | [
"MIT"
] | 1 | 2019-12-29T12:00:51.000Z | 2019-12-29T12:00:51.000Z | char netlib_id[]="\
@(#)netlib.c (c) Copyright 1993-2007 Hewlett-Packard Company. Version 2.4.3";
/****************************************************************/
/* */
/* netlib.c */
/* */
/* the common utility routines available to all... */
/* */
/* establish_control() establish the control socket */
/* calibrate_local_cpu() do local cpu calibration */
/* calibrate_remote_cpu() do remote cpu calibration */
/* send_request() send a request to the remote */
/* recv_response() receive a response from remote */
/* send_response() send a response to the remote */
/* recv_request() recv a request from the remote */
/* dump_request() dump request contents */
/* dump_response() dump response contents */
/* cpu_start() start measuring cpu */
/* cpu_stop() stop measuring cpu */
/* calc_cpu_util() calculate the cpu utilization */
/* calc_service_demand() calculate the service demand */
/* calc_thruput() calulate the tput in units */
/* calibrate() really calibrate local cpu */
/* identify_local() print local host information */
/* identify_remote() print remote host information */
/* format_number() format the number (KB, MB,etc) */
/* format_units() return the format in english */
/* msec_sleep() sleep for some msecs */
/* start_timer() start a timer */
/* */
/* the routines you get when WANT_DLPI is defined... */
/* */
/* dl_open() open a file descriptor and */
/* attach to the card */
/* dl_mtu() find the MTU of the card */
/* dl_bind() bind the sap do the card */
/* dl_connect() sender's have of connect */
/* dl_accpet() receiver's half of connect */
/* dl_set_window() set the window size */
/* dl_stats() retrieve statistics */
/* dl_send_disc() initiate disconnect (sender) */
/* dl_recv_disc() accept disconnect (receiver) */
/****************************************************************/
/****************************************************************/
/* */
/* Global include files */
/* */
/****************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* It would seem that most of the includes being done here from */
/* "sys/" actually have higher-level wrappers at just /usr/include. */
/* This is based on a spot-check of a couple systems at my disposal. */
/* If you have trouble compiling you may want to add "sys/" raj 10/95 */
#include <limits.h>
#include <signal.h>
#ifdef MPE
# define NSIG _NSIG
#endif /* MPE */
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <assert.h>
#ifdef HAVE_ENDIAN_H
#include <endian.h>
#endif
#ifndef WIN32
/* at some point, I would like to get rid of all these "sys/" */
/* includes where appropriate. if you have a system that requires */
/* them, speak now, or your system may not comile later revisions of */
/* netperf. raj 1/96 */
#include <unistd.h>
#include <sys/stat.h>
#include <sys/times.h>
#ifndef MPE
#include <time.h>
#include <sys/time.h>
#endif /* MPE */
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
#include <sys/utsname.h>
#if !defined(MPE) && !defined(__VMS)
#include <sys/param.h>
#endif /* MPE */
#else /* WIN32 */
#include <process.h>
#include <time.h>
#include <winsock2.h>
#define netperf_socklen_t socklen_t
#include <windows.h>
/* the only time someone should need to define DONT_IPV6 in the
"sources" file is if they are trying to compile on Windows 2000 or
NT4 and I suspect this may not be their only problem :) */
#ifndef DONT_IPV6
#include <ws2tcpip.h>
#endif
#include <windows.h>
#define SIGALRM (14)
#define sleep(x) Sleep((x)*1000)
#endif /* WIN32 */
#ifdef _AIX
#include <sys/select.h>
#include <sys/sched.h>
#include <sys/pri.h>
#define PRIORITY PRI_LOW
#else/* _AIX */
#ifdef __sgi
#include <sys/prctl.h>
#include <sys/schedctl.h>
#define PRIORITY NDPLOMIN
#endif /* __sgi */
#endif /* _AIX */
#ifdef WANT_DLPI
#include <sys/stream.h>
#include <sys/stropts.h>
#include <sys/poll.h>
#ifdef __osf__
#include <sys/dlpihdr.h>
#else /* __osf__ */
#include <sys/dlpi.h>
#ifdef __hpux
#include <sys/dlpi_ext.h>
#endif /* __hpux */
#endif /* __osf__ */
#endif /* WANT_DLPI */
#ifdef HAVE_MPCTL
#include <sys/mpctl.h>
#endif
#if !defined(HAVE_GETADDRINFO) || !defined(HAVE_GETNAMEINFO)
# include "missing/getaddrinfo.h"
#endif
#ifdef WANT_HISTOGRAM
#include "hist.h"
#endif /* WANT_HISTOGRAM */
/****************************************************************/
/* */
/* Local Include Files */
/* */
/****************************************************************/
#define NETLIB
#include "netlib.h"
#include "netsh.h"
#include "netcpu.h"
/****************************************************************/
/* */
/* Global constants, macros and variables */
/* */
/****************************************************************/
#if defined(WIN32) || defined(__VMS)
struct timezone {
int dummy ;
} ;
#ifndef __VMS
SOCKET win_kludge_socket = INVALID_SOCKET;
SOCKET win_kludge_socket2 = INVALID_SOCKET;
#endif /* __VMS */
#endif /* WIN32 || __VMS */
#ifndef LONG_LONG_MAX
#define LONG_LONG_MAX 9223372036854775807LL
#endif /* LONG_LONG_MAX */
/* older versions of netperf knew about the HP kernel IDLE counter. */
/* this is now obsolete - in favor of either pstat(), times, or a */
/* process-level looper process. we also now require support for the */
/* "long" integer type. raj 4/95. */
int
lib_num_loc_cpus, /* the number of cpus in the system */
lib_num_rem_cpus; /* how many we think are in the remote */
#define PAGES_PER_CHILD 2
int lib_use_idle;
int cpu_method;
struct timeval time1, time2;
struct timezone tz;
float lib_elapsed,
lib_local_maxrate,
lib_remote_maxrate,
lib_local_cpu_util,
lib_remote_cpu_util;
float lib_local_per_cpu_util[MAXCPUS];
int lib_cpu_map[MAXCPUS];
int *request_array;
int *response_array;
/* INVALID_SOCKET == INVALID_HANDLE_VALUE == (unsigned int)(~0) == -1 */
SOCKET netlib_control = INVALID_SOCKET;
SOCKET server_sock = INVALID_SOCKET;
/* global variables to hold the value for processor affinity */
int local_proc_affinity,remote_proc_affinity = -1;
/* these are to allow netperf to be run easily through those evil,
end-to-end breaking things known as firewalls */
char local_data_port[10];
char remote_data_port[10];
char *local_data_address=NULL;
char *remote_data_address=NULL;
int local_data_family=AF_UNSPEC;
int remote_data_family=AF_UNSPEC;
/* in the past, I was overlaying a structure on an array of ints. now */
/* I am going to have a "real" structure, and point an array of ints */
/* at it. the real structure will be forced to the same alignment as */
/* the type "double." this change will mean that pre-2.1 netperfs */
/* cannot be mixed with 2.1 and later. raj 11/95 */
union netperf_request_struct netperf_request;
union netperf_response_struct netperf_response;
FILE *where;
char libfmt = '?';
#ifdef WANT_DLPI
/* some stuff for DLPI control messages */
#define DLPI_DATA_SIZE 2048
unsigned long control_data[DLPI_DATA_SIZE];
struct strbuf control_message = {DLPI_DATA_SIZE, 0, (char *)control_data};
#endif /* WANT_DLPI */
#ifdef WIN32
HANDLE hAlarm = INVALID_HANDLE_VALUE;
#endif
int times_up;
#ifdef WIN32
/* we use a getopt implementation from net.sources */
/*
* get option letter from argument vector
*/
int
opterr = 1, /* should error messages be printed? */
optind = 1, /* index into parent argv vector */
optopt; /* character checked for validity */
char
*optarg; /* argument associated with option */
#define EMSG ""
#endif /* WIN32 */
static int measuring_cpu;
int
netlib_get_page_size(void) {
/* not all systems seem to have the sysconf for page size. for
those which do not, we will assume that the page size is 8192
bytes. this should be more than enough to be sure that there is
no page or cache thrashing by looper processes on MP
systems. otherwise that's really just too bad - such systems
should define _SC_PAGE_SIZE - raj 4/95 */
#ifndef _SC_PAGE_SIZE
#ifdef WIN32
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
return SystemInfo.dwPageSize;
#else
return(8192L);
#endif /* WIN32 */
#else
return(sysconf(_SC_PAGE_SIZE));
#endif /* _SC_PAGE_SIZE */
}
#ifdef WANT_INTERVALS
static unsigned int usec_per_itvl;
void
stop_itimer()
{
struct itimerval new_interval;
struct itimerval old_interval;
new_interval.it_interval.tv_sec = 0;
new_interval.it_interval.tv_usec = 0;
new_interval.it_value.tv_sec = 0;
new_interval.it_value.tv_usec = 0;
if (setitimer(ITIMER_REAL,&new_interval,&old_interval) != 0) {
/* there was a problem arming the interval timer */
perror("netperf: setitimer");
exit(1);
}
return;
}
#endif /* WANT_INTERVALS */
#ifdef WIN32
static void
error(char *pch)
{
if (!opterr) {
return; /* without printing */
}
fprintf(stderr, "%s: %s: %c\n",
(NULL != program) ? program : "getopt", pch, optopt);
}
int
getopt(int argc, char **argv, char *ostr)
{
static char *place = EMSG; /* option letter processing */
register char *oli; /* option letter list index */
if (!*place) {
/* update scanning pointer */
if (optind >= argc || *(place = argv[optind]) != '-' || !*++place) {
return EOF;
}
if (*place == '-') {
/* found "--" */
++optind;
place = EMSG ; /* Added by shiva for Netperf */
return EOF;
}
}
/* option letter okay? */
if ((optopt = (int)*place++) == (int)':'
|| !(oli = strchr(ostr, optopt))) {
if (!*place) {
++optind;
}
error("illegal option");
return BADCH;
}
if (*++oli != ':') {
/* don't need argument */
optarg = NULL;
if (!*place)
++optind;
} else {
/* need an argument */
if (*place) {
optarg = place; /* no white space */
} else if (argc <= ++optind) {
/* no arg */
place = EMSG;
error("option requires an argument");
return BADCH;
} else {
optarg = argv[optind]; /* white space */
}
place = EMSG;
++optind;
}
return optopt; /* return option letter */
}
#endif /* WIN32 */
/*----------------------------------------------------------------------------
* WIN32 implementation of perror, does not deal very well with WSA errors
* The stdlib.h version of perror only deals with the ancient XENIX error codes.
*
* +*+SAF Why can't all WSA errors go through GetLastError? Most seem to...
*--------------------------------------------------------------------------*/
#ifdef WIN32
void PrintWin32Error(FILE *stream, LPSTR text)
{
LPSTR szTemp;
DWORD dwResult;
DWORD dwError;
dwError = GetLastError();
dwResult = FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_ARGUMENT_ARRAY,
NULL,
dwError,
LANG_NEUTRAL,
(LPTSTR)&szTemp,
0,
NULL );
if (dwResult)
fprintf(stream, "%s: %s\n", text, szTemp);
else
fprintf(stream, "%s: error 0x%x\n", text, dwError);
fflush(stream);
if (szTemp)
LocalFree((HLOCAL)szTemp);
}
#endif /* WIN32 */
char *
inet_ttos(int type)
{
switch (type) {
case SOCK_DGRAM:
return("SOCK_DGRAM");
break;
case SOCK_STREAM:
return("SOCK_STREAM");
break;
default:
return("SOCK_UNKNOWN");
}
}
char unknown[32];
char *
inet_ptos(int protocol) {
switch (protocol) {
case IPPROTO_TCP:
return("IPPROTO_TCP");
break;
case IPPROTO_UDP:
return("IPPROTO_UDP");
break;
#if defined(IPPROTO_SCTP)
case IPPROTO_SCTP:
return("IPPROTO_SCTP");
break;
#endif
default:
snprintf(unknown,sizeof(unknown),"IPPROTO_UNKNOWN(%d)",protocol);
return(unknown);
}
}
/* one of these days, this should not be required */
#ifndef AF_INET_SDP
#define AF_INET_SDP 27
#define PF_INET_SDP AF_INET_SDP
#endif
char *
inet_ftos(int family)
{
switch(family) {
case AF_INET:
return("AF_INET");
break;
#if defined(AF_INET6)
case AF_INET6:
return("AF_INET6");
break;
#endif
#if defined(AF_INET_SDP)
case AF_INET_SDP:
return("AF_INET_SDP");
break;
#endif
default:
return("AF_UNSPEC");
}
}
int
inet_nton(int af, const void *src, char *dst, int cnt)
{
switch (af) {
case AF_INET:
/* magic constants again... :) */
if (cnt >= 4) {
memcpy(dst,src,4);
return 4;
}
else {
Set_errno(ENOSPC);
return(-1);
}
break;
#if defined(AF_INET6)
case AF_INET6:
if (cnt >= 16) {
memcpy(dst,src,16);
return(16);
}
else {
Set_errno(ENOSPC);
return(-1);
}
break;
#endif
default:
Set_errno(EAFNOSUPPORT);
return(-1);
}
}
double
ntohd(double net_double)
{
/* we rely on things being nicely packed */
union {
double whole_thing;
unsigned int words[2];
unsigned char bytes[8];
} conv_rec;
unsigned char scratch;
int i;
/* on those systems where ntohl is a no-op, we want to return the */
/* original value, unchanged */
if (ntohl(1L) == 1L) {
return(net_double);
}
conv_rec.whole_thing = net_double;
/* we know that in the message passing routines that ntohl will have */
/* been called on the 32 bit quantities. we need to put those back */
/* the way they belong before we swap */
conv_rec.words[0] = htonl(conv_rec.words[0]);
conv_rec.words[1] = htonl(conv_rec.words[1]);
/* now swap */
for (i=0; i<= 3; i++) {
scratch = conv_rec.bytes[i];
conv_rec.bytes[i] = conv_rec.bytes[7-i];
conv_rec.bytes[7-i] = scratch;
}
#if defined(__FLOAT_WORD_ORDER) && defined(__BYTE_ORDER)
if (__FLOAT_WORD_ORDER != __BYTE_ORDER) {
/* Fixup mixed endian floating point machines */
unsigned int scratch = conv_rec.words[0];
conv_rec.words[0] = conv_rec.words[1];
conv_rec.words[1] = scratch;
}
#endif
return(conv_rec.whole_thing);
}
double
htond(double host_double)
{
/* we rely on things being nicely packed */
union {
double whole_thing;
unsigned int words[2];
unsigned char bytes[8];
} conv_rec;
unsigned char scratch;
int i;
/* on those systems where ntohl is a no-op, we want to return the */
/* original value, unchanged */
if (ntohl(1L) == 1L) {
return(host_double);
}
conv_rec.whole_thing = host_double;
/* now swap */
for (i=0; i<= 3; i++) {
scratch = conv_rec.bytes[i];
conv_rec.bytes[i] = conv_rec.bytes[7-i];
conv_rec.bytes[7-i] = scratch;
}
#if defined(__FLOAT_WORD_ORDER) && defined(__BYTE_ORDER)
if (__FLOAT_WORD_ORDER != __BYTE_ORDER) {
/* Fixup mixed endian floating point machines */
unsigned int scratch = conv_rec.words[0];
conv_rec.words[0] = conv_rec.words[1];
conv_rec.words[1] = scratch;
}
#endif
/* we know that in the message passing routines htonl will */
/* be called on the 32 bit quantities. we need to set things up so */
/* that when this happens, the proper order will go out on the */
/* network */
conv_rec.words[0] = htonl(conv_rec.words[0]);
conv_rec.words[1] = htonl(conv_rec.words[1]);
return(conv_rec.whole_thing);
}
/* one of these days, this should be abstracted-out just like the CPU
util stuff. raj 2005-01-27 */
int
get_num_cpus()
{
/* on HP-UX, even when we use the looper procs we need the pstat */
/* call */
int temp_cpus;
#ifdef __hpux
#include <sys/pstat.h>
struct pst_dynamic psd;
if (pstat_getdynamic((struct pst_dynamic *)&psd,
(size_t)sizeof(psd), (size_t)1, 0) != -1) {
temp_cpus = psd.psd_proc_cnt;
}
else {
temp_cpus = 1;
}
#else
/* MW: <unistd.h> was included for non-Windows systems above. */
/* Thus if _SC_NPROC_ONLN is defined, we should be able to use sysconf. */
#ifdef _SC_NPROCESSORS_ONLN
temp_cpus = sysconf(_SC_NPROCESSORS_ONLN);
#ifdef USE_PERFSTAT
temp_cpus = perfstat_cpu(NULL,NULL, sizeof(perfstat_cpu_t), 0);
#endif /* USE_PERFSTAT */
#else /* no _SC_NPROCESSORS_ONLN */
#ifdef WIN32
SYSTEM_INFO SystemInfo;
GetSystemInfo(&SystemInfo);
temp_cpus = SystemInfo.dwNumberOfProcessors;
#else
/* we need to know some other ways to do this, or just fall-back on */
/* a global command line option - raj 4/95 */
temp_cpus = shell_num_cpus;
#endif /* WIN32 */
#endif /* _SC_NPROCESSORS_ONLN */
#endif /* __hpux */
if (temp_cpus > MAXCPUS) {
fprintf(where,
"Sorry, this system has more CPUs (%d) than I can handle (%d).\n",
temp_cpus,
MAXCPUS);
fprintf(where,
"Please alter MAXCPUS in netlib.h and recompile.\n");
fflush(where);
exit(1);
}
return(temp_cpus);
}
#ifdef WIN32
#ifdef __GNUC__
#define S64_SUFFIX(x) x##LL
#else
#define S64_SUFFIX(x) x##i64
#endif
/*
* Number of 100 nanosecond units from 1/1/1601 to 1/1/1970
*/
#define EPOCH_BIAS S64_SUFFIX(116444736000000000)
/*
* Union to facilitate converting from FILETIME to unsigned __int64
*/
typedef union {
unsigned __int64 ft_scalar;
FILETIME ft_struct;
} FT;
void
gettimeofday( struct timeval *tv , struct timezone *not_used )
{
FT nt_time;
__int64 UnixTime; /* microseconds since 1/1/1970 */
GetSystemTimeAsFileTime( &(nt_time.ft_struct) );
UnixTime = ((nt_time.ft_scalar - EPOCH_BIAS) / S64_SUFFIX(10));
tv->tv_sec = (long)(time_t)(UnixTime / S64_SUFFIX(1000000));
tv->tv_usec = (unsigned long)(UnixTime % S64_SUFFIX(1000000));
}
#endif /* WIN32 */
/************************************************************************/
/* */
/* signal catcher */
/* */
/************************************************************************/
void
#if defined(__hpux)
catcher(sig, code, scp)
int sig;
int code;
struct sigcontext *scp;
#else
catcher(int sig)
#endif /* __hpux || __VMS */
{
#ifdef __hpux
if (debug > 2) {
fprintf(where,"caught signal %d ",sig);
if (scp) {
fprintf(where,"while in syscall %d\n",
scp->sc_syscall);
}
else {
fprintf(where,"null scp\n");
}
fflush(where);
}
#endif /* RAJ_DEBUG */
switch(sig) {
case SIGINT:
fprintf(where,"netperf: caught SIGINT\n");
fflush(where);
exit(1);
break;
case SIGALRM:
if (--test_len_ticks == 0) {
/* the test is over */
if (times_up != 0) {
fprintf(where,"catcher: timer popped with times_up != 0\n");
fflush(where);
}
times_up = 1;
#if defined(WANT_INTERVALS) && !defined(WANT_SPIN)
stop_itimer();
#endif /* WANT_INTERVALS */
break;
}
else {
#ifdef WANT_INTERVALS
#ifdef __hpux
/* the test is not over yet and we must have been using the */
/* interval timer. if we were in SYS_SIGSUSPEND we want to */
/* re-start the system call. Otherwise, we want to get out of */
/* the sigsuspend call. I NEED TO KNOW HOW TO DO THIS FOR OTHER */
/* OPERATING SYSTEMS. If you know how, please let me know. rick */
/* jones <raj@cup.hp.com> */
if (scp->sc_syscall != SYS_SIGSUSPEND) {
if (debug > 2) {
fprintf(where,
"catcher: Time to send burst > interval!\n");
fflush(where);
}
scp->sc_syscall_action = SIG_RESTART;
}
#endif /* __hpux */
#else /* WANT_INTERVALS */
fprintf(where,
"catcher: interval timer running unexpectedly!\n");
fflush(where);
times_up = 1;
#endif /* WANT_INTERVALS */
break;
}
}
return;
}
void
install_signal_catchers()
{
/* just a simple little routine to catch a bunch of signals */
#ifndef WIN32
struct sigaction action;
int i;
fprintf(where,"installing catcher for all signals\n");
fflush(where);
sigemptyset(&(action.sa_mask));
action.sa_handler = catcher;
#ifdef SA_INTERRUPT
action.sa_flags = SA_INTERRUPT;
#else /* SA_INTERRUPT */
action.sa_flags = 0;
#endif /* SA_INTERRUPT */
for (i = 1; i <= NSIG; i++) {
if (i != SIGALRM) {
if (sigaction(i,&action,NULL) != 0) {
fprintf(where,
"Could not install signal catcher for sig %d, errno %d\n",
i,
errno);
fflush(where);
}
}
}
#else
return;
#endif /* WIN32 */
}
#ifdef WIN32
#define SIGALRM (14)
void
emulate_alarm( int seconds )
{
DWORD ErrorCode;
/* Wait on this event for parm seconds. */
ErrorCode = WaitForSingleObject(hAlarm, seconds*1000);
if (ErrorCode == WAIT_FAILED)
{
perror("WaitForSingleObject failed");
exit(1);
}
if (ErrorCode == WAIT_TIMEOUT)
{
/* WaitForSingleObject timed out; this means the timer
wasn't canceled. */
times_up = 1;
/* We have yet to find a good way to fully emulate the effects */
/* of signals and getting EINTR from system calls under */
/* winsock, so what we do here is close the socket out from */
/* under the other thread. It is rather kludgy, but should be */
/* sufficient to get this puppy shipped. The concept can be */
/* attributed/blamed :) on Robin raj 1/96 */
if (win_kludge_socket != INVALID_SOCKET) {
closesocket(win_kludge_socket);
}
if (win_kludge_socket2 != INVALID_SOCKET) {
closesocket(win_kludge_socket2);
}
}
}
#endif /* WIN32 */
void
start_timer(int time)
{
#ifdef WIN32
/*+*+SAF What if StartTimer is called twice without the first timer */
/*+*+SAF expiring? */
DWORD thread_id ;
HANDLE tHandle;
if (hAlarm == (HANDLE) INVALID_HANDLE_VALUE)
{
/* Create the Alarm event object */
hAlarm = CreateEvent(
(LPSECURITY_ATTRIBUTES) NULL, /* no security */
FALSE, /* auto reset event */
FALSE, /* init. state = reset */
(void *)NULL); /* unnamed event object */
if (hAlarm == (HANDLE) INVALID_HANDLE_VALUE)
{
perror("CreateEvent failure");
exit(1);
}
}
else
{
ResetEvent(hAlarm);
}
tHandle = CreateThread(0,
0,
(LPTHREAD_START_ROUTINE)emulate_alarm,
(LPVOID)(ULONG_PTR)time,
0,
&thread_id ) ;
CloseHandle(tHandle);
#else /* not WIN32 */
struct sigaction action;
if (debug) {
fprintf(where,"About to start a timer for %d seconds.\n",time);
fflush(where);
}
action.sa_handler = catcher;
sigemptyset(&(action.sa_mask));
sigaddset(&(action.sa_mask),SIGALRM);
#ifdef SA_INTERRUPT
/* on some systems (SunOS 4.blah), system calls are restarted. we do */
/* not want that */
action.sa_flags = SA_INTERRUPT;
#else /* SA_INTERRUPT */
action.sa_flags = 0;
#endif /* SA_INTERRUPT */
if (sigaction(SIGALRM, &action, NULL) < 0) {
fprintf(where,"start_timer: error installing alarm handler ");
fprintf(where,"errno %d\n",errno);
fflush(where);
exit(1);
}
/* this is the easy case - just set the timer for so many seconds */
if (alarm(time) != 0) {
fprintf(where,
"error starting alarm timer, errno %d\n",
errno);
fflush(where);
}
#endif /* WIN32 */
test_len_ticks = 1;
}
/* this routine will disable any running timer */
void
stop_timer()
{
#ifndef WIN32
alarm(0);
#else
/* at some point we may need some win32 equivalent */
if (hAlarm != (HANDLE) INVALID_HANDLE_VALUE)
{
SetEvent(hAlarm);
}
#endif /* WIN32 */
}
#ifdef WANT_INTERVALS
/* this routine will enable the interval timer and set things up so */
/* that for a timed test the test will end at the proper time. it */
/* should detect the presence of POSIX.4 timer_* routines one of */
/* these days */
void
start_itimer(unsigned int interval_len_msec )
{
unsigned int ticks_per_itvl;
struct itimerval new_interval;
struct itimerval old_interval;
/* if -DWANT_INTERVALS was used, we will use the ticking of the itimer to */
/* tell us when the test is over. while the user will be specifying */
/* some number of milliseconds, we know that the interval timer is */
/* really in units of 1/HZ. so, to prevent the test from running */
/* "long" it would be necessary to keep this in mind when calculating */
/* the number of itimer events */
ticks_per_itvl = ((interval_wate * sysconf(_SC_CLK_TCK) * 1000) /
1000000);
if (ticks_per_itvl == 0) ticks_per_itvl = 1;
/* how many usecs in each interval? */
usec_per_itvl = ticks_per_itvl * (1000000 / sysconf(_SC_CLK_TCK));
/* how many times will the timer pop before the test is over? */
if (test_time > 0) {
/* this was a timed test */
test_len_ticks = (test_time * 1000000) / usec_per_itvl;
}
else {
/* this was not a timed test, use MAXINT */
test_len_ticks = INT_MAX;
}
if (debug) {
fprintf(where,"setting the interval timer to %d sec %d usec ",
usec_per_itvl / 1000000,
usec_per_itvl % 1000000);
fprintf(where,"test len %d ticks\n",
test_len_ticks);
fflush(where);
}
/* if this was not a timed test, then we really aught to enable the */
/* signal catcher raj 2/95 */
new_interval.it_interval.tv_sec = usec_per_itvl / 1000000;
new_interval.it_interval.tv_usec = usec_per_itvl % 1000000;
new_interval.it_value.tv_sec = usec_per_itvl / 1000000;
new_interval.it_value.tv_usec = usec_per_itvl % 1000000;
if (setitimer(ITIMER_REAL,&new_interval,&old_interval) != 0) {
/* there was a problem arming the interval timer */
perror("netperf: setitimer");
exit(1);
}
}
#endif /* WANT_INTERVALS */
void
netlib_init_cpu_map() {
int i;
#ifdef HAVE_MPCTL
int num;
i = 0;
/* I go back and forth on whether this should be the system-wide set
of calls, or if the processor set versions (sans the _SYS) should
be used. at the moment I believe that the system-wide version
should be used. raj 2006-04-03 */
num = mpctl(MPC_GETNUMSPUS_SYS,0,0);
lib_cpu_map[i] = mpctl(MPC_GETFIRSTSPU_SYS,0,0);
for (i = 1;((i < num) && (i < MAXCPUS)); i++) {
lib_cpu_map[i] = mpctl(MPC_GETNEXTSPU_SYS,lib_cpu_map[i-1],0);
}
/* from here, we set them all to -1 because if we launch more
loopers than actual CPUs, well, I'm not sure why :) */
for (; i < MAXCPUS; i++) {
lib_cpu_map[i] = -1;
}
#else
/* we assume that there is indeed a contiguous mapping */
for (i = 0; i < MAXCPUS; i++) {
lib_cpu_map[i] = i;
}
#endif
}
/****************************************************************/
/* */
/* netlib_init() */
/* */
/* initialize the performance library... */
/* */
/****************************************************************/
void
netlib_init()
{
int i;
where = stdout;
request_array = (int *)(&netperf_request);
response_array = (int *)(&netperf_response);
for (i = 0; i < MAXCPUS; i++) {
lib_local_per_cpu_util[i] = 0.0;
}
/* on those systems where we know that CPU numbers may not start at
zero and be contiguous, we provide a way to map from a
contiguous, starting from 0 CPU id space to the actual CPU ids.
at present this is only used for the netcpu_looper stuff because
we ass-u-me that someone setting processor affinity from the
netperf commandline will provide a "proper" CPU identifier. raj
2006-04-03 */
netlib_init_cpu_map();
if (debug) {
fprintf(where,
"netlib_init: request_array at %p\n",
request_array);
fprintf(where,
"netlib_init: response_array at %p\n",
response_array);
fflush(where);
}
}
/* this routine will conver the string into an unsigned integer. it */
/* is used primarily for the command-line options taking a number */
/* (such as the socket size) which could be rather large. If someone */
/* enters 32M, then the number will be converted to 32 * 1024 * 1024. */
/* If they inter 32m, the number will be converted to 32 * 1000 * */
/* 1000 */
unsigned int
convert(char *string)
{
unsigned int base;
base = atoi(string);
if (strstr(string,"K")) {
base *= 1024;
}
if (strstr(string,"M")) {
base *= (1024 * 1024);
}
if (strstr(string,"G")) {
base *= (1024 * 1024 * 1024);
}
if (strstr(string,"k")) {
base *= (1000);
}
if (strstr(string,"m")) {
base *= (1000 * 1000);
}
if (strstr(string,"g")) {
base *= (1000 * 1000 * 1000);
}
return(base);
}
/* this routine is like convert, but it is used for an interval time
specification instead of stuff like socket buffer or send sizes.
it converts everything to microseconds for internal use. if there
is an 'm' at the end it assumes the user provided milliseconds, s
will imply seconds, u will imply microseconds. in the future n
will imply nanoseconds but for now it will be ignored. if there is
no suffix or an unrecognized suffix, it will be assumed the user
provided milliseconds, which was the long-time netperf default. one
of these days, we should probably revisit that nanosecond business
wrt the return value being just an int rather than a uint64_t or
something. raj 2006-02-06 */
unsigned int
convert_timespec(char *string) {
unsigned int base;
base = atoi(string);
if (strstr(string,"m")) {
base *= 1000;
}
else if (strstr(string,"u")) {
base *= (1);
}
else if (strstr(string,"s")) {
base *= (1000 * 1000);
}
else {
base *= (1000);
}
return(base);
}
/* this routine will allocate a circular list of buffers for either */
/* send or receive operations. each of these buffers will be aligned */
/* and offset as per the users request. the circumference of this */
/* ring will be controlled by the setting of send_width. the buffers */
/* will be filled with data from the file specified in fill_file. if */
/* fill_file is an empty string, the buffers will not be filled with */
/* any particular data */
struct ring_elt *
allocate_buffer_ring(int width, int buffer_size, int alignment, int offset)
{
struct ring_elt *first_link = NULL;
struct ring_elt *temp_link = NULL;
struct ring_elt *prev_link;
int i;
int malloc_size;
int bytes_left;
int bytes_read;
int do_fill;
FILE *fill_source;
char default_fill[] = "netperf";
int fill_cursor = 0;
malloc_size = buffer_size + alignment + offset;
/* did the user wish to have the buffers pre-filled with data from a */
/* particular source? */
if (strcmp(fill_file,"") == 0) {
do_fill = 0;
fill_source = NULL;
}
else {
do_fill = 1;
fill_source = (FILE *)fopen(fill_file,"r");
if (fill_source == (FILE *)NULL) {
perror("Could not open requested fill file");
exit(1);
}
}
assert(width >= 1);
prev_link = NULL;
for (i = 1; i <= width; i++) {
/* get the ring element */
temp_link = (struct ring_elt *)malloc(sizeof(struct ring_elt));
if (temp_link == NULL) {
printf("malloc(%u) failed!\n", sizeof(struct ring_elt));
exit(1);
}
/* remember the first one so we can close the ring at the end */
if (i == 1) {
first_link = temp_link;
}
temp_link->buffer_base = (char *)malloc(malloc_size);
if (temp_link == NULL) {
printf("malloc(%d) failed!\n", malloc_size);
exit(1);
}
#ifndef WIN32
temp_link->buffer_ptr = (char *)(( (long)(temp_link->buffer_base) +
(long)alignment - 1) &
~((long)alignment - 1));
#else
temp_link->buffer_ptr = (char *)(( (ULONG_PTR)(temp_link->buffer_base) +
(ULONG_PTR)alignment - 1) &
~((ULONG_PTR)alignment - 1));
#endif
temp_link->buffer_ptr += offset;
/* is where the buffer fill code goes. */
if (do_fill) {
char *bufptr = temp_link->buffer_ptr;
bytes_left = buffer_size;
while (bytes_left) {
if (((bytes_read = (int)fread(bufptr,
1,
bytes_left,
fill_source)) == 0) &&
(feof(fill_source))){
rewind(fill_source);
}
bufptr += bytes_read;
bytes_left -= bytes_read;
}
}
else {
/* use the default fill to ID our data traffic on the
network. it ain't exactly pretty, but it should work */
int j;
char *bufptr = temp_link->buffer_ptr;
for (j = 0; j < buffer_size; j++) {
bufptr[j] = default_fill[fill_cursor];
fill_cursor += 1;
/* the Windows DDK compiler with an x86_64 target wants a cast
here */
if (fill_cursor > (int)strlen(default_fill)) {
fill_cursor = 0;
}
}
}
temp_link->next = prev_link;
prev_link = temp_link;
}
if (first_link) { /* SAF Prefast made me do it... */
first_link->next = temp_link;
}
return(first_link); /* it's a circle, doesn't matter which we return */
}
/* this routine will dirty the first dirty_count bytes of the
specified buffer and/or read clean_count bytes from the buffer. it
will go N bytes at a time, the only question is how large should N
be and if we should be going continguously, or based on some
assumption of cache line size */
void
access_buffer(char *buffer_ptr,int length, int dirty_count, int clean_count) {
char *temp_buffer;
char *limit;
int i, dirty_totals;
temp_buffer = buffer_ptr;
limit = temp_buffer + length;
dirty_totals = 0;
for (i = 0;
((i < dirty_count) && (temp_buffer < limit));
i++) {
*temp_buffer += (char)i;
dirty_totals += *temp_buffer;
temp_buffer++;
}
for (i = 0;
((i < clean_count) && (temp_buffer < limit));
i++) {
dirty_totals += *temp_buffer;
temp_buffer++;
}
if (debug > 100) {
fprintf(where,
"This was here to try to avoid dead-code elimination %d\n",
dirty_totals);
fflush(where);
}
}
#ifdef HAVE_ICSC_EXS
#include <sys/mman.h>
#include <sys/exs.h>
/* this routine will allocate a circular list of buffers for either */
/* send or receive operations. each of these buffers will be aligned */
/* and offset as per the users request. the circumference of this */
/* ring will be controlled by the setting of send_width. the buffers */
/* will be filled with data from the file specified in fill_file. if */
/* fill_file is an empty string, the buffers will not be filled with */
/* any particular data */
struct ring_elt *
allocate_exs_buffer_ring (int width, int buffer_size, int alignment, int offset, exs_mhandle_t *mhandlep)
{
struct ring_elt *first_link;
struct ring_elt *temp_link;
struct ring_elt *prev_link;
int i;
int malloc_size;
int bytes_left;
int bytes_read;
int do_fill;
FILE *fill_source;
int mmap_size;
char *mmap_buffer, *mmap_buffer_aligned;
malloc_size = buffer_size + alignment + offset;
/* did the user wish to have the buffers pre-filled with data from a */
/* particular source? */
if (strcmp (fill_file, "") == 0) {
do_fill = 0;
fill_source = NULL;
} else {
do_fill = 1;
fill_source = (FILE *) fopen (fill_file, "r");
if (fill_source == (FILE *) NULL) {
perror ("Could not open requested fill file");
exit (1);
}
}
assert (width >= 1);
if (debug) {
fprintf (where, "allocate_exs_buffer_ring: "
"width=%d buffer_size=%d alignment=%d offset=%d\n",
width, buffer_size, alignment, offset);
}
/* allocate shared memory */
mmap_size = width * malloc_size;
mmap_buffer = (char *) mmap ((caddr_t)NULL, mmap_size+NBPG-1,
PROT_READ|PROT_WRITE,
MAP_SHARED|MAP_ANONYMOUS, -1, 0);
if (mmap_buffer == NULL) {
perror ("allocate_exs_buffer_ring: mmap failed");
exit (1);
}
mmap_buffer_aligned = (char *) ((uintptr_t)mmap_buffer & ~(NBPG-1));
if (debug) {
fprintf (where, "allocate_exs_buffer_ring: "
"mmap buffer size=%d address=0x%p aligned=0x%p\n",
mmap_size, mmap_buffer, mmap_buffer_aligned);
}
/* register shared memory */
*mhandlep = exs_mregister ((void *)mmap_buffer_aligned, (size_t)mmap_size, 0);
if (*mhandlep == EXS_MHANDLE_INVALID) {
perror ("allocate_exs_buffer_ring: exs_mregister failed");
exit (1);
}
if (debug) {
fprintf (where, "allocate_exs_buffer_ring: mhandle=%d\n",
*mhandlep);
}
/* allocate ring elements */
first_link = (struct ring_elt *) malloc (width * sizeof (struct ring_elt));
if (first_link == NULL) {
printf ("malloc(%d) failed!\n", width * sizeof (struct ring_elt));
exit (1);
}
/* initialize buffer ring */
prev_link = first_link + width - 1;
for (i = 0, temp_link = first_link; i < width; i++, temp_link++) {
temp_link->buffer_base = (char *) mmap_buffer_aligned + (i*malloc_size);
#ifndef WIN32
temp_link->buffer_ptr = (char *)
(((long)temp_link->buffer_base + (long)alignment - 1) &
~((long)alignment - 1));
#else
temp_link->buffer_ptr = (char *)
(((ULONG_PTR)temp_link->buffer_base + (ULONG_PTR)alignment - 1) &
~((ULONG_PTR)alignment - 1));
#endif
temp_link->buffer_ptr += offset;
if (debug) {
fprintf (where, "allocate_exs_buffer_ring: "
"buffer: index=%d base=0x%p ptr=0x%p\n",
i, temp_link->buffer_base, temp_link->buffer_ptr);
}
/* is where the buffer fill code goes. */
if (do_fill) {
bytes_left = buffer_size;
while (bytes_left) {
if (((bytes_read = (int) fread (temp_link->buffer_ptr,
1,
bytes_left,
fill_source)) == 0) &&
(feof (fill_source))) {
rewind (fill_source);
}
bytes_left -= bytes_read;
}
}
/* do linking */
prev_link->next = temp_link;
prev_link = temp_link;
}
return (first_link); /* it's a circle, doesn't matter which we return */
}
#endif /* HAVE_ICSC_EXS */
#ifdef HAVE_SENDFILE
/* this routine will construct a ring of sendfile_ring_elt structs
that the routine sendfile_tcp_stream() will use to get parameters
to its calls to sendfile(). It will setup the ring to point at the
file specified in the global -F option that is already used to
pre-fill buffers in the send() case. 08/2000
if there is no file specified in a global -F option, we will create
a tempoarary file and fill it with random data and use that
instead. raj 2007-08-09 */
struct sendfile_ring_elt *
alloc_sendfile_buf_ring(int width,
int buffer_size,
int alignment,
int offset)
{
struct sendfile_ring_elt *first_link = NULL;
struct sendfile_ring_elt *temp_link = NULL;
struct sendfile_ring_elt *prev_link;
int i;
int fildes;
struct stat statbuf;
/* if the user has not specified a file with the -F option, we will
fail the test. otherwise, go ahead and try to open the
file. 08/2000 */
if (strcmp(fill_file,"") == 0) {
/* use an temp file for the fill file */
char *temp_file;
int *temp_buffer;
/* make sure we have at least an ints worth, even if the user is
using an insane buffer size for a sendfile test. we are
ass-u-me-ing that malloc will return something at least aligned
on an int boundary... */
temp_buffer = (int *) malloc(buffer_size + sizeof(int));
if (temp_buffer) {
/* ok, we have the buffer we are going to write, lets get a
temporary filename */
temp_file = tmpnam(NULL);
if (NULL != temp_file) {
fildes = open(temp_file,O_RDWR | O_EXCL | O_CREAT,0600);
if (-1 != fildes) {
int count;
int *int_ptr;
/* initialize the random number generator */
srand(getpid());
/* unlink the file so it goes poof when we
exit. unless/until shown to be a problem we will
blissfully ignore the return value. raj 2007-08-09 */
unlink(temp_file);
/* now fill-out the file with at least buffer_size * width bytes */
for (count = 0; count < width; count++) {
/* fill the buffer with random data. it doesn't have to be
really random, just "random enough" :) we do this here rather
than up above because we want each write to the file to be
different random data */
int_ptr = temp_buffer;
for (i = 0; i <= buffer_size/sizeof(int); i++) {
*int_ptr = rand();
int_ptr++;
}
if (write(fildes,temp_buffer,buffer_size+sizeof(int)) !=
buffer_size + sizeof(int)) {
perror("allocate_sendfile_buf_ring: incomplete write");
exit(-1);
}
}
}
else {
perror("allocate_sendfile_buf_ring: could not open tempfile");
exit(-1);
}
}
else {
perror("allocate_sendfile_buf_ring: could not allocate temp name");
exit(-1);
}
}
else {
perror("alloc_sendfile_buf_ring: could not allocate buffer for file");
exit(-1);
}
}
else {
/* the user pointed us at a file, so try it */
fildes = open(fill_file , O_RDONLY);
if (fildes == -1){
perror("alloc_sendfile_buf_ring: Could not open requested file");
exit(1);
}
/* make sure there is enough file there to allow us to make a
complete ring. that way we do not need additional logic in the
ring setup to deal with wrap-around issues. we might want that
someday, but not just now. 08/2000 */
if (stat(fill_file,&statbuf) != 0) {
perror("alloc_sendfile_buf_ring: could not stat file");
exit(1);
}
if (statbuf.st_size < (width * buffer_size)) {
/* the file is too short */
fprintf(stderr,"alloc_sendfile_buf_ring: specified file too small.\n");
fprintf(stderr,"file must be larger than send_width * send_size\n");
fflush(stderr);
exit(1);
}
}
/* so, at this point we know that fildes is a descriptor which
references a file of sufficient size for our nefarious
porpoises. raj 2007-08-09 */
prev_link = NULL;
for (i = 1; i <= width; i++) {
/* get the ring element. we should probably make sure the malloc()
was successful, but for now we'll just let the code bomb
mysteriously. 08/2000 */
temp_link = (struct sendfile_ring_elt *)
malloc(sizeof(struct sendfile_ring_elt));
if (temp_link == NULL) {
printf("malloc(%u) failed!\n", sizeof(struct sendfile_ring_elt));
exit(1);
}
/* remember the first one so we can close the ring at the end */
if (i == 1) {
first_link = temp_link;
}
/* now fill-in the fields of the structure with the apropriate
stuff. just how should we deal with alignment and offset I
wonder? until something better comes-up, I think we will just
ignore them. 08/2000 */
temp_link->fildes = fildes; /* from which file do we send? */
temp_link->offset = offset; /* starting at which offset? */
offset += buffer_size; /* get ready for the next elt */
temp_link->length = buffer_size; /* how many bytes to send */
temp_link->hdtrl = NULL; /* no header or trailer */
temp_link->flags = 0; /* no flags */
/* is where the buffer fill code went. */
temp_link->next = prev_link;
prev_link = temp_link;
}
/* close the ring */
first_link->next = temp_link;
return(first_link); /* it's a dummy ring */
}
#endif /* HAVE_SENDFILE */
/***********************************************************************/
/* */
/* dump_request() */
/* */
/* display the contents of the request array to the user. it will */
/* display the contents in decimal, hex, and ascii, with four bytes */
/* per line. */
/* */
/***********************************************************************/
void
dump_request()
{
int counter = 0;
fprintf(where,"request contents:\n");
for (counter = 0; counter < ((sizeof(netperf_request)/4)-3); counter += 4) {
fprintf(where,"%d:\t%8x %8x %8x %8x \t|%4.4s| |%4.4s| |%4.4s| |%4.4s|\n",
counter,
request_array[counter],
request_array[counter+1],
request_array[counter+2],
request_array[counter+3],
(char *)&request_array[counter],
(char *)&request_array[counter+1],
(char *)&request_array[counter+2],
(char *)&request_array[counter+3]);
}
fflush(where);
}
/***********************************************************************/
/* */
/* dump_response() */
/* */
/* display the content of the response array to the user. it will */
/* display the contents in decimal, hex, and ascii, with four bytes */
/* per line. */
/* */
/***********************************************************************/
void
dump_response()
{
int counter = 0;
fprintf(where,"response contents\n");
for (counter = 0; counter < ((sizeof(netperf_response)/4)-3); counter += 4) {
fprintf(where,"%d:\t%8x %8x %8x %8x \t>%4.4s< >%4.4s< >%4.4s< >%4.4s<\n",
counter,
response_array[counter],
response_array[counter+1],
response_array[counter+2],
response_array[counter+3],
(char *)&response_array[counter],
(char *)&response_array[counter+1],
(char *)&response_array[counter+2],
(char *)&response_array[counter+3]);
}
fflush(where);
}
/*
format_number()
return a pointer to a formatted string containing the value passed
translated into the units specified. It assumes that the base units
are bytes. If the format calls for bits, it will use SI units (10^)
if the format calls for bytes, it will use CS units (2^)... This
routine should look familiar to uses of the latest ttcp...
we would like to use "t" or "T" for transactions, but probably
should leave those for terabits and terabytes respectively, so for
transactions, we will use "x" which will, by default, do absolutely
nothing to the result. why? so we don't have to special case code
elsewhere such as in the TCP_RR-as-bidirectional test case.
*/
char *
format_number(double number)
{
static char fmtbuf[64];
switch (libfmt) {
case 'K':
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f" , number / 1024.0);
break;
case 'M':
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f", number / 1024.0 / 1024.0);
break;
case 'G':
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f", number / 1024.0 / 1024.0 / 1024.0);
break;
case 'k':
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f", number * 8 / 1000.0);
break;
case 'm':
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f", number * 8 / 1000.0 / 1000.0);
break;
case 'g':
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f", number * 8 / 1000.0 / 1000.0 / 1000.0);
break;
case 'x':
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f", number);
break;
default:
snprintf(fmtbuf, sizeof(fmtbuf), "%-7.2f", number / 1024.0);
}
return fmtbuf;
}
char
format_cpu_method(int method)
{
char method_char;
switch (method) {
case CPU_UNKNOWN:
method_char = 'U';
break;
case HP_IDLE_COUNTER:
method_char = 'I';
break;
case PSTAT:
method_char = 'P';
break;
case KSTAT:
method_char = 'K';
break;
case KSTAT_10:
method_char = 'M';
break;
case PERFSTAT:
method_char = 'E';
break;
case TIMES: /* historical only, completely unsuitable
for netperf's purposes */
method_char = 'T';
break;
case GETRUSAGE: /* historical only, completely unsuitable
for netperf;s purposes */
method_char = 'R';
break;
case LOOPER:
method_char = 'L';
break;
case NT_METHOD:
method_char = 'N';
break;
case PROC_STAT:
method_char = 'S';
break;
case SYSCTL:
method_char = 'C';
break;
case OSX:
method_char = 'O';
break;
default:
method_char = '?';
}
return method_char;
}
char *
format_units()
{
static char unitbuf[64];
switch (libfmt) {
case 'K':
strcpy(unitbuf, "KBytes");
break;
case 'M':
strcpy(unitbuf, "MBytes");
break;
case 'G':
strcpy(unitbuf, "GBytes");
break;
case 'k':
strcpy(unitbuf, "10^3bits");
break;
case 'm':
strcpy(unitbuf, "10^6bits");
break;
case 'g':
strcpy(unitbuf, "10^9bits");
break;
case 'x':
strcpy(unitbuf, "Trans");
break;
default:
strcpy(unitbuf, "KBytes");
}
return unitbuf;
}
/****************************************************************/
/* */
/* shutdown_control() */
/* */
/* tear-down the control connection between me and the server. */
/****************************************************************/
void
shutdown_control()
{
char *buf = (char *)&netperf_response;
int buflen = sizeof(netperf_response);
/* stuff for select, use fd_set for better compliance */
fd_set readfds;
struct timeval timeout;
if (debug) {
fprintf(where,
"shutdown_control: shutdown of control connection requested.\n");
fflush(where);
}
/* first, we say that we will be sending no more data on the */
/* connection */
if (shutdown(netlib_control,1) == SOCKET_ERROR) {
Print_errno(where,
"shutdown_control: error in shutdown");
fflush(where);
exit(1);
}
/* Now, we hang on a select waiting for the socket to become */
/* readable to receive the shutdown indication from the remote. this */
/* will be "just" like the recv_response() code */
/* we only select once. it is assumed that if the response is split */
/* (which should not be happening, that we will receive the whole */
/* thing and not have a problem ;-) */
FD_ZERO(&readfds);
FD_SET(netlib_control,&readfds);
timeout.tv_sec = 60; /* wait one minute then punt */
timeout.tv_usec = 0;
/* select had better return one, or there was either a problem or a */
/* timeout... */
if (select(FD_SETSIZE,
&readfds,
0,
0,
&timeout) != 1) {
Print_errno(where,
"shutdown_control: no response received");
fflush(where);
exit(1);
}
/* we now assume that the socket has come ready for reading */
recv(netlib_control, buf, buflen,0);
}
/*
bind_to_specific_processor will bind the calling process to the
processor in "processor" It has lots of ugly ifdefs to deal with
all the different ways systems do processor affinity. this is a
generalization of work initially done by stephen burger. raj
2004/12/13 */
void
bind_to_specific_processor(int processor_affinity, int use_cpu_map)
{
int mapped_affinity;
/* this is in place because the netcpu_looper processor affinity
ass-u-me-s a contiguous CPU id space starting with 0. for the
regular netperf/netserver affinity, we ass-u-me the user has used
a suitable CPU id even when the space is not contiguous and
starting from zero */
if (use_cpu_map) {
mapped_affinity = lib_cpu_map[processor_affinity];
}
else {
mapped_affinity = processor_affinity;
}
#ifdef HAVE_MPCTL
/* indeed, at some point it would be a good idea to check the return
status and pass-along notification of error... raj 2004/12/13 */
mpctl(MPC_SETPROCESS_FORCE, mapped_affinity, getpid());
#elif HAVE_PROCESSOR_BIND
#include <sys/types.h>
#include <sys/processor.h>
#include <sys/procset.h>
processor_bind(P_PID,P_MYID,mapped_affinity,NULL);
#elif HAVE_BINDPROCESSOR
#include <sys/processor.h>
/* this is the call on AIX. It takes a "what" of BINDPROCESS or
BINDTHRAD, then "who" and finally "where" which is a CPU number
or it seems PROCESSOR_CLASS_ANY there also seems to be a mycpu()
call to return the current CPU assignment. this is all based on
the sys/processor.h include file. from empirical testing, it
would seem that the my_cpu() call returns the current CPU on
which we are running rather than the CPU binding, so it's return
value will not tell you if you are bound vs unbound. */
bindprocessor(BINDPROCESS,getpid(),(cpu_t)mapped_affinity);
#elif HAVE_SCHED_SETAFFINITY
#include <sched.h>
/* in theory this should cover systems with more CPUs than bits in a
long, without having to specify __USE_GNU. we "cheat" by taking
defines from /usr/include/bits/sched.h, which we ass-u-me is
included by <sched.h>. If they are not there we will just
fall-back on what we had before, which is to use just the size of
an unsigned long. raj 2006-09-14 */
#if defined(__CPU_SETSIZE)
#define NETPERF_CPU_SETSIZE __CPU_SETSIZE
#define NETPERF_CPU_SET(cpu, cpusetp) __CPU_SET(cpu, cpusetp)
#define NETPERF_CPU_ZERO(cpusetp) __CPU_ZERO (cpusetp)
typedef cpu_set_t netperf_cpu_set_t;
#else
#define NETPERF_CPU_SETSIZE sizeof(unsigned long)
#define NETPERF_CPU_SET(cpu, cpusetp) *cpusetp = 1 << cpu
#define NETPERF_CPU_ZERO(cpusetp) *cpusetp = (unsigned long)0
typedef unsigned long netperf_cpu_set_t;
#endif
netperf_cpu_set_t netperf_cpu_set;
unsigned int len = sizeof(netperf_cpu_set);
if (mapped_affinity < 8*sizeof(netperf_cpu_set)) {
NETPERF_CPU_ZERO(&netperf_cpu_set);
NETPERF_CPU_SET(mapped_affinity,&netperf_cpu_set);
if (sched_setaffinity(getpid(), len, &netperf_cpu_set)) {
if (debug) {
fprintf(stderr, "failed to set PID %d's CPU affinity errno %d\n",
getpid(),errno);
fflush(stderr);
}
}
}
else {
if (debug) {
fprintf(stderr,
"CPU number larger than pre-compiled limits. Consider a recompile.\n");
fflush(stderr);
}
}
#elif HAVE_BIND_TO_CPU_ID
/* this is the one for Tru64 */
#include <sys/types.h>
#include <sys/resource.h>
#include <sys/processor.h>
/* really should be checking a return code one of these days. raj
2005/08/31 */
bind_to_cpu_id(getpid(), mapped_affinity,0);
#elif WIN32
{
ULONG_PTR AffinityMask;
ULONG_PTR ProcessAffinityMask;
ULONG_PTR SystemAffinityMask;
if ((mapped_affinity < 0) ||
(mapped_affinity > MAXIMUM_PROCESSORS)) {
fprintf(where,
"Invalid processor_affinity specified: %d\n", mapped_affinity); fflush(where);
return;
}
if (!GetProcessAffinityMask(
GetCurrentProcess(),
&ProcessAffinityMask,
&SystemAffinityMask))
{
perror("GetProcessAffinityMask failed");
fflush(stderr);
exit(1);
}
AffinityMask = (ULONG_PTR)1 << mapped_affinity;
if (AffinityMask & ProcessAffinityMask) {
if (!SetThreadAffinityMask( GetCurrentThread(), AffinityMask)) {
perror("SetThreadAffinityMask failed");
fflush(stderr);
}
} else if (debug) {
fprintf(where,
"Processor affinity set to CPU# %d\n", mapped_affinity);
fflush(where);
}
}
#else
if (debug) {
fprintf(where,
"Processor affinity not available for this platform!\n");
fflush(where);
}
#endif
}
/*
* Sets a socket to non-blocking operation.
*/
int
set_nonblock (SOCKET sock)
{
#ifdef WIN32
unsigned long flags = 1;
return (ioctlsocket(sock, FIONBIO, &flags) != SOCKET_ERROR);
#else
return (fcntl(sock, F_SETFL, O_NONBLOCK) != -1);
#endif
}
/***********************************************************************/
/* */
/* send_request() */
/* */
/* send a netperf request on the control socket to the remote half of */
/* the connection. to get us closer to intervendor interoperability, */
/* we will call htonl on each of the int that compose the message to */
/* be sent. the server-half of the connection will call the ntohl */
/* routine to undo any changes that may have been made... */
/* */
/***********************************************************************/
void
send_request()
{
int counter=0;
/* display the contents of the request if the debug level is high */
/* enough. otherwise, just send the darned thing ;-) */
if (debug > 1) {
fprintf(where,"entered send_request...contents before htonl:\n");
dump_request();
}
/* pass the processor affinity request value to netserver */
/* this is a kludge and I know it. sgb 8/11/04 */
netperf_request.content.dummy = remote_proc_affinity;
/* put the entire request array into network order. We do this */
/* arbitrarily rather than trying to figure-out just how much */
/* of the request array contains real information. this should */
/* be simpler, and at any rate, the performance of sending */
/* control messages for this benchmark is not of any real */
/* concern. */
for (counter=0;counter < sizeof(netperf_request)/4; counter++) {
request_array[counter] = htonl(request_array[counter]);
}
if (debug > 1) {
fprintf(where,"send_request...contents after htonl:\n");
dump_request();
fprintf(where,
"\nsend_request: about to send %u bytes from %p\n",
sizeof(netperf_request),
&netperf_request);
fflush(where);
}
if (send(netlib_control,
(char *)&netperf_request,
sizeof(netperf_request),
0) != sizeof(netperf_request)) {
perror("send_request: send call failure");
exit(1);
}
}
/***********************************************************************/
/* */
/* send_response() */
/* */
/* send a netperf response on the control socket to the remote half of */
/* the connection. to get us closer to intervendor interoperability, */
/* we will call htonl on each of the int that compose the message to */
/* be sent. the other half of the connection will call the ntohl */
/* routine to undo any changes that may have been made... */
/* */
/***********************************************************************/
void
send_response()
{
int counter=0;
int bytes_sent;
/* display the contents of the request if the debug level is high */
/* enough. otherwise, just send the darned thing ;-) */
if (debug > 1) {
fprintf(where,
"send_response: contents of %u ints before htonl\n",
sizeof(netperf_response)/4);
dump_response();
}
/* put the entire response_array into network order. We do this */
/* arbitrarily rather than trying to figure-out just how much of the */
/* request array contains real information. this should be simpler, */
/* and at any rate, the performance of sending control messages for */
/* this benchmark is not of any real concern. */
for (counter=0;counter < sizeof(netperf_response)/4; counter++) {
response_array[counter] = htonl(response_array[counter]);
}
if (debug > 1) {
fprintf(where,
"send_response: contents after htonl\n");
dump_response();
fprintf(where,
"about to send %u bytes from %p\n",
sizeof(netperf_response),
&netperf_response);
fflush(where);
}
/*KC*/
if ((bytes_sent = send(server_sock,
(char *)&netperf_response,
sizeof(netperf_response),
0)) != sizeof(netperf_response)) {
perror("send_response: send call failure");
fprintf(where, "BytesSent: %d\n", bytes_sent);
exit(1);
}
}
/***********************************************************************/
/* */
/* recv_request() */
/* */
/* receive the remote's request on the control socket. we will put */
/* the entire response into host order before giving it to the */
/* calling routine. hopefully, this will go most of the way to */
/* insuring intervendor interoperability. if there are any problems, */
/* we will just punt the entire situation. */
/* */
/***********************************************************************/
void
recv_request()
{
int tot_bytes_recvd,
bytes_recvd,
bytes_left;
char *buf = (char *)&netperf_request;
int buflen = sizeof(netperf_request);
int counter;
tot_bytes_recvd = 0;
bytes_recvd = 0; /* nt_lint; bytes_recvd uninitialized if buflen == 0 */
bytes_left = buflen;
while ((tot_bytes_recvd != buflen) &&
((bytes_recvd = recv(server_sock, buf, bytes_left,0)) > 0 )) {
tot_bytes_recvd += bytes_recvd;
buf += bytes_recvd;
bytes_left -= bytes_recvd;
}
/* put the request into host order */
for (counter = 0; counter < sizeof(netperf_request)/sizeof(int); counter++) {
request_array[counter] = ntohl(request_array[counter]);
}
if (debug) {
fprintf(where,
"recv_request: received %d bytes of request.\n",
tot_bytes_recvd);
fflush(where);
}
if (bytes_recvd == SOCKET_ERROR) {
Print_errno(where,
"recv_request: error on recv");
fflush(where);
exit(1);
}
if (bytes_recvd == 0) {
/* the remote has shutdown the control connection, we should shut it */
/* down as well and exit */
if (debug) {
fprintf(where,
"recv_request: remote requested shutdown of control\n");
fflush(where);
}
if (netlib_control != INVALID_SOCKET) {
shutdown_control();
}
exit(0);
}
if (tot_bytes_recvd < buflen) {
if (debug > 1)
dump_request();
fprintf(where,
"recv_request: partial request received of %d bytes\n",
tot_bytes_recvd);
fflush(where);
exit(1);
}
if (debug > 1) {
dump_request();
}
/* get the processor affinity request value from netperf */
/* this is a kludge and I know it. sgb 8/11/04 */
local_proc_affinity = netperf_request.content.dummy;
if (local_proc_affinity != -1) {
bind_to_specific_processor(local_proc_affinity,0);
}
}
/*
recv_response_timed()
receive the remote's response on the control socket. we will put the
entire response into host order before giving it to the calling
routine. hopefully, this will go most of the way to insuring
intervendor interoperability. if there are any problems, we will just
punt the entire situation.
The call to select at the beginning is to get us out of hang
situations where the remote gives-up but we don't find-out about
it. This seems to happen only rarely, but it would be nice to be
somewhat robust ;-)
The "_timed" part is to allow the caller to add (or I suppose
subtract) from the length of timeout on the select call. this was
added since not all the CPU utilization mechanisms require a 40
second calibration, and we used to have an aribtrary 40 second sleep
in "calibrate_remote_cpu" - since we don't _always_ need that, we
want to simply add 40 seconds to the select() timeout from that call,
but don't want to change all the "recv_response" calls in the code
right away. sooo, we push the functionality of the old
recv_response() into a new recv_response_timed(addl_timout) call, and
have recv_response() call recv_response_timed(0). raj 2005-05-16
*/
void
recv_response_timed(int addl_time)
{
int tot_bytes_recvd,
bytes_recvd = 0,
bytes_left;
char *buf = (char *)&netperf_response;
int buflen = sizeof(netperf_response);
int counter;
/* stuff for select, use fd_set for better compliance */
fd_set readfds;
struct timeval timeout;
tot_bytes_recvd = 0;
bytes_left = buflen;
/* zero out the response structure */
/* BUG FIX SJB 2/4/93 - should be < not <= */
for (counter = 0; counter < sizeof(netperf_response)/sizeof(int); counter++) {
response_array[counter] = 0;
}
/* we only select once. it is assumed that if the response is split */
/* (which should not be happening, that we will receive the whole */
/* thing and not have a problem ;-) */
FD_ZERO(&readfds);
FD_SET(netlib_control,&readfds);
timeout.tv_sec = 120 + addl_time; /* wait at least two minutes
before punting - the USE_LOOPER
CPU stuff may cause remote's to
have a bit longer time of it
than 60 seconds would allow.
triggered by fix from Jeff
Dwork. */
timeout.tv_usec = 0;
/* select had better return one, or there was either a problem or a */
/* timeout... */
if ((counter = select(FD_SETSIZE,
&readfds,
0,
0,
&timeout)) != 1) {
fprintf(where,
"netperf: receive_response: no response received. errno %d counter %d\n",
errno,
counter);
exit(1);
}
while ((tot_bytes_recvd != buflen) &&
((bytes_recvd = recv(netlib_control, buf, bytes_left,0)) > 0 )) {
tot_bytes_recvd += bytes_recvd;
buf += bytes_recvd;
bytes_left -= bytes_recvd;
}
if (debug) {
fprintf(where,"recv_response: received a %d byte response\n",
tot_bytes_recvd);
fflush(where);
}
/* put the response into host order */
for (counter = 0; counter < sizeof(netperf_response)/sizeof(int); counter++) {
response_array[counter] = ntohl(response_array[counter]);
}
if (bytes_recvd == SOCKET_ERROR) {
perror("recv_response");
exit(1);
}
if (tot_bytes_recvd < buflen) {
fprintf(stderr,
"recv_response: partial response received: %d bytes\n",
tot_bytes_recvd);
fflush(stderr);
if (debug > 1)
dump_response();
exit(1);
}
if (debug > 1) {
dump_response();
}
}
void
recv_response()
{
recv_response_timed(0);
}
#if defined(USE_PSTAT) || defined (USE_SYSCTL)
int
hi_32(big_int)
long long *big_int;
{
union overlay_u {
long long dword;
long words[2];
} *overlay;
overlay = (union overlay_u *)big_int;
/* on those systems which are byte swapped, we really wish to */
/* return words[1] - at least I think so - raj 4/95 */
if (htonl(1L) == 1L) {
/* we are a "normal" :) machine */
return(overlay->words[0]);
}
else {
return(overlay->words[1]);
}
}
int
lo_32(big_int)
long long *big_int;
{
union overlay_u {
long long dword;
long words[2];
} *overlay;
overlay = (union overlay_u *)big_int;
/* on those systems which are byte swapped, we really wish to */
/* return words[0] - at least I think so - raj 4/95 */
if (htonl(1L) == 1L) {
/* we are a "normal" :) machine */
return(overlay->words[1]);
}
else {
return(overlay->words[0]);
}
}
#endif /* USE_PSTAT || USE_SYSCTL */
void libmain()
{
fprintf(where,"hello world\n");
fprintf(where,"debug: %d\n",debug);
}
void
set_sock_buffer (SOCKET sd, enum sock_buffer which, int requested_size, int *effective_sizep)
{
#ifdef SO_SNDBUF
int optname = (which == SEND_BUFFER) ? SO_SNDBUF : SO_RCVBUF;
netperf_socklen_t sock_opt_len;
/* seems that under Windows, setting a value of zero is how one
tells the stack you wish to enable copy-avoidance. Knuth only
knows what it will do on other stacks, but it might be
interesting to find-out, so we won't bother #ifdef'ing the change
to allow asking for 0 bytes. Courtesy of SAF, 2007-05 raj
2007-05-31 */
if (requested_size >= 0) {
if (setsockopt(sd, SOL_SOCKET, optname,
(char *)&requested_size, sizeof(int)) < 0) {
fprintf(where, "netperf: set_sock_buffer: %s option: errno %d\n",
(which == SEND_BUFFER) ? "SO_SNDBUF" : "SO_RCVBUF",
errno);
fflush(where);
exit(1);
}
if (debug > 1) {
fprintf(where, "netperf: set_sock_buffer: %s of %d requested.\n",
(which == SEND_BUFFER) ? "SO_SNDBUF" : "SO_RCVBUF",
requested_size);
fflush(where);
}
}
/* Now, we will find-out what the size actually became, and report */
/* that back to the user. If the call fails, we will just report a -1 */
/* back to the initiator for the recv buffer size. */
sock_opt_len = sizeof(netperf_socklen_t);
if (getsockopt(sd, SOL_SOCKET, optname, (char *)effective_sizep,
&sock_opt_len) < 0) {
fprintf(where, "netperf: set_sock_buffer: getsockopt %s: errno %d\n",
(which == SEND_BUFFER) ? "SO_SNDBUF" : "SO_RCVBUF", errno);
fflush(where);
*effective_sizep = -1;
}
if (debug) {
fprintf(where, "netperf: set_sock_buffer: "
"%s socket size determined to be %d\n",
(which == SEND_BUFFER) ? "send" : "receive", *effective_sizep);
fflush(where);
}
#else /* SO_SNDBUF */
*effective_size = -1;
#endif /* SO_SNDBUF */
}
void
dump_addrinfo(FILE *dumploc, struct addrinfo *info,
char *host, char *port, int family)
{
struct sockaddr *ai_addr;
struct addrinfo *temp;
temp=info;
fprintf(dumploc, "getaddrinfo returned the following for host '%s' ", host);
fprintf(dumploc, "port '%s' ", port);
fprintf(dumploc, "family %s\n", inet_ftos(family));
while (temp) {
/* seems that Solaris 10 GA bits will not give a canonical name
for ::0 or 0.0.0.0, and their fprintf() cannot deal with a null
pointer, so we have to check for a null pointer. probably a
safe thing to do anyway, eventhough it was not necessary on
linux or hp-ux. raj 2005-02-09 */
if (temp->ai_canonname) {
fprintf(dumploc,
"\tcannonical name: '%s'\n",temp->ai_canonname);
}
else {
fprintf(dumploc,
"\tcannonical name: '%s'\n","(nil)");
}
fprintf(dumploc,
"\tflags: %x family: %s: socktype: %s protocol %s addrlen %d\n",
temp->ai_flags,
inet_ftos(temp->ai_family),
inet_ttos(temp->ai_socktype),
inet_ptos(temp->ai_protocol),
temp->ai_addrlen);
ai_addr = temp->ai_addr;
if (ai_addr != NULL) {
fprintf(dumploc,
"\tsa_family: %s sadata: %d %d %d %d %d %d\n",
inet_ftos(ai_addr->sa_family),
(u_char)ai_addr->sa_data[0],
(u_char)ai_addr->sa_data[1],
(u_char)ai_addr->sa_data[2],
(u_char)ai_addr->sa_data[3],
(u_char)ai_addr->sa_data[4],
(u_char)ai_addr->sa_data[5]);
}
temp = temp->ai_next;
}
fflush(dumploc);
}
/*
establish_control()
set-up the control connection between netperf and the netserver so we
can actually run some tests. if we cannot establish the control
connection, that may or may not be a good thing, so we will let the
caller decide what to do.
to assist with pesky end-to-end-unfriendly things like firewalls, we
allow the caller to specify both the remote hostname and port, and the
local addressing info. i believe that in theory it is possible to
have an IPv4 endpoint and an IPv6 endpoint communicate with one
another, but for the time being, we are only going to take-in one
requested address family parameter. this means that the only way
(iirc) that we might get a mixed-mode connection would be if the
address family is specified as AF_UNSPEC, and getaddrinfo() returns
different families for the local and server names.
the "names" can also be IP addresses in ASCII string form.
raj 2003-02-27 */
SOCKET
establish_control_internal(char *hostname,
char *port,
int remfam,
char *localhost,
char *localport,
int locfam)
{
int not_connected;
SOCKET control_sock;
int count;
int error;
struct addrinfo hints;
struct addrinfo *local_res;
struct addrinfo *remote_res;
struct addrinfo *local_res_temp;
struct addrinfo *remote_res_temp;
if (debug) {
fprintf(where,
"establish_control called with host '%s' port '%s' remfam %s\n",
hostname,
port,
inet_ftos(remfam));
fprintf(where,
"\t\tlocal '%s' port '%s' locfam %s\n",
localhost,
localport,
inet_ftos(locfam));
fflush(where);
}
/* first, we do the remote */
memset(&hints, 0, sizeof(hints));
hints.ai_family = remfam;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = 0|AI_CANONNAME;
count = 0;
do {
error = getaddrinfo((char *)hostname,
(char *)port,
&hints,
&remote_res);
count += 1;
if (error == EAI_AGAIN) {
if (debug) {
fprintf(where,"Sleeping on getaddrinfo EAI_AGAIN\n");
fflush(where);
}
sleep(1);
}
} while ((error == EAI_AGAIN) && (count <= 5));
if (error) {
printf("establish control: could not resolve remote '%s' port '%s' af %s",
hostname,
port,
inet_ftos(remfam));
printf("\n\tgetaddrinfo returned %d %s\n",
error,
gai_strerror(error));
return(INVALID_SOCKET);
}
if (debug) {
dump_addrinfo(where, remote_res, hostname, port, remfam);
}
/* now we do the local */
memset(&hints, 0, sizeof(hints));
hints.ai_family = locfam;
hints.ai_socktype = SOCK_STREAM;
hints.ai_protocol = IPPROTO_TCP;
hints.ai_flags = AI_PASSIVE|AI_CANONNAME;
count = 0;
do {
count += 1;
error = getaddrinfo((char *)localhost,
(char *)localport,
&hints,
&local_res);
if (error == EAI_AGAIN) {
if (debug) {
fprintf(where,
"Sleeping on getaddrinfo(%s,%s) EAI_AGAIN count %d \n",
localhost,
localport,
count);
fflush(where);
}
sleep(1);
}
} while ((error == EAI_AGAIN) && (count <= 5));
if (error) {
printf("establish control: could not resolve local '%s' port '%s' af %s",
localhost,
localport,
inet_ftos(locfam));
printf("\n\tgetaddrinfo returned %d %s\n",
error,
gai_strerror(error));
return(INVALID_SOCKET);
}
if (debug) {
dump_addrinfo(where, local_res, localhost, localport, locfam);
}
not_connected = 1;
local_res_temp = local_res;
remote_res_temp = remote_res;
/* we want to loop through all the possibilities. looping on the
local addresses will be handled within the while loop. I suppose
these is some more "C-expert" way to code this, but it has not
lept to mind just yet :) raj 2003-02024 */
while (remote_res_temp != NULL) {
/* I am guessing that we should use the address family of the
local endpoint, and we will not worry about mixed family types
- presumeably the stack or other transition mechanisms will be
able to deal with that for us. famous last words :) raj 2003-02-26 */
control_sock = socket(local_res_temp->ai_family,
SOCK_STREAM,
0);
if (control_sock == INVALID_SOCKET) {
/* at some point we'll need a more generic "display error"
message for when/if we use GUIs and the like. unlike a bind
or connect failure, failure to allocate a socket is
"immediately fatal" and so we return to the caller. raj 2003-02-24 */
if (debug) {
perror("establish_control: unable to allocate control socket");
}
return(INVALID_SOCKET);
}
/* if we are going to control the local enpoint addressing, we
need to call bind. of course, we should probably be setting one
of the SO_REUSEmumble socket options? raj 2005-02-04 */
if (bind(control_sock,
local_res_temp->ai_addr,
local_res_temp->ai_addrlen) == 0) {
if (debug) {
fprintf(where,
"bound control socket to %s and %s\n",
localhost,
localport);
}
if (connect(control_sock,
remote_res_temp->ai_addr,
remote_res_temp->ai_addrlen) == 0) {
/* we have successfully connected to the remote netserver */
if (debug) {
fprintf(where,
"successful connection to remote netserver at %s and %s\n",
hostname,
port);
}
not_connected = 0;
/* this should get us out of the while loop */
break;
} else {
/* the connect call failed */
if (debug) {
fprintf(where,
"establish_control: connect failed, errno %d %s\n",
errno,
strerror(errno));
fprintf(where, " trying next address combination\n");
fflush(where);
}
}
}
else {
/* the bind failed */
if (debug) {
fprintf(where,
"establish_control: bind failed, errno %d %s\n",
errno,
strerror(errno));
fprintf(where, " trying next address combination\n");
fflush(where);
}
}
if ((local_res_temp = local_res_temp->ai_next) == NULL) {
/* wrap the local and move to the next server, don't forget to
close the current control socket. raj 2003-02-24 */
local_res_temp = local_res;
/* the outer while conditions will deal with the case when we
get to the end of all the possible remote addresses. */
remote_res_temp = remote_res_temp->ai_next;
/* it is simplest here to just close the control sock. since
this is not a performance critical section of code, we
don't worry about overheads for socket allocation or
close. raj 2003-02-24 */
}
close(control_sock);
}
/* we no longer need the addrinfo stuff */
freeaddrinfo(local_res);
freeaddrinfo(remote_res);
/* so, we are either connected or not */
if (not_connected) {
fprintf(where, "establish control: are you sure there is a netserver listening on %s at port %s?\n",hostname,port);
fflush(where);
return(INVALID_SOCKET);
}
/* at this point, we are connected. we probably want some sort of
version check with the remote at some point. raj 2003-02-24 */
return(control_sock);
}
void
establish_control(char *hostname,
char *port,
int remfam,
char *localhost,
char *localport,
int locfam)
{
netlib_control = establish_control_internal(hostname,
port,
remfam,
localhost,
localport,
locfam);
if (netlib_control == INVALID_SOCKET) {
fprintf(where,
"establish_control could not establish the control connection from %s port %s address family %s to %s port %s address family %s\n",
localhost,localport,inet_ftos(locfam),
hostname,port,inet_ftos(remfam));
fflush(where);
exit(INVALID_SOCKET);
}
}
/***********************************************************************/
/* */
/* get_id() */
/* */
/* Return a string to the calling routine that contains the */
/* identifying information for the host we are running on. This */
/* information will then either be displayed locally, or returned to */
/* a remote caller for display there. */
/* */
/***********************************************************************/
char *
get_id()
{
static char id_string[80];
#ifdef WIN32
char system_name[MAX_COMPUTERNAME_LENGTH+1] ;
DWORD name_len = MAX_COMPUTERNAME_LENGTH + 1 ;
#else
struct utsname system_name;
#endif /* WIN32 */
#ifdef WIN32
SYSTEM_INFO SystemInfo;
GetSystemInfo( &SystemInfo ) ;
if ( !GetComputerName(system_name , &name_len) )
strcpy(system_name , "no_name") ;
#else
if (uname(&system_name) <0) {
perror("identify_local: uname");
exit(1);
}
#endif /* WIN32 */
snprintf(id_string, sizeof(id_string),
#ifdef WIN32
"%-15s%-15s%d.%d%d",
"Windows NT",
system_name ,
GetVersion() & 0xFF ,
GetVersion() & 0xFF00 ,
SystemInfo.dwProcessorType
#else
"%-15s%-15s%-15s%-15s%-15s",
system_name.sysname,
system_name.nodename,
system_name.release,
system_name.version,
system_name.machine
#endif /* WIN32 */
);
return (id_string);
}
/***********************************************************************/
/* */
/* identify_local() */
/* */
/* Display identifying information about the local host to the user. */
/* At first release, this information will be the same as that which */
/* is returned by the uname -a command, with the exception of the */
/* idnumber field, which seems to be a non-POSIX item, and hence */
/* non-portable. */
/* */
/***********************************************************************/
void
identify_local()
{
char *local_id;
local_id = get_id();
fprintf(where,"Local Information \n\
Sysname Nodename Release Version Machine\n");
fprintf(where,"%s\n",
local_id);
}
/***********************************************************************/
/* */
/* identify_remote() */
/* */
/* Display identifying information about the remote host to the user. */
/* At first release, this information will be the same as that which */
/* is returned by the uname -a command, with the exception of the */
/* idnumber field, which seems to be a non-POSIX item, and hence */
/* non-portable. A request is sent to the remote side, which will */
/* return a string containing the utsname information in a */
/* pre-formatted form, which is then displayed after the header. */
/* */
/***********************************************************************/
void
identify_remote()
{
char *remote_id="";
/* send a request for node info to the remote */
netperf_request.content.request_type = NODE_IDENTIFY;
send_request();
/* and now wait for the reply to come back */
recv_response();
if (netperf_response.content.serv_errno) {
Set_errno(netperf_response.content.serv_errno);
perror("identify_remote: on remote");
exit(1);
}
fprintf(where,"Remote Information \n\
Sysname Nodename Release Version Machine\n");
fprintf(where,"%s",
remote_id);
}
void
cpu_start(int measure_cpu)
{
gettimeofday(&time1,
&tz);
if (measure_cpu) {
cpu_util_init();
measuring_cpu = 1;
cpu_method = get_cpu_method();
cpu_start_internal();
}
}
void
cpu_stop(int measure_cpu, float *elapsed)
{
int sec,
usec;
if (measure_cpu) {
cpu_stop_internal();
cpu_util_terminate();
}
gettimeofday(&time2,
&tz);
if (time2.tv_usec < time1.tv_usec) {
time2.tv_usec += 1000000;
time2.tv_sec -= 1;
}
sec = time2.tv_sec - time1.tv_sec;
usec = time2.tv_usec - time1.tv_usec;
lib_elapsed = (float)sec + ((float)usec/(float)1000000.0);
*elapsed = lib_elapsed;
}
double
calc_thruput_interval(double units_received,double elapsed)
{
double divisor;
/* We will calculate the thruput in libfmt units/second */
switch (libfmt) {
case 'K':
divisor = 1024.0;
break;
case 'M':
divisor = 1024.0 * 1024.0;
break;
case 'G':
divisor = 1024.0 * 1024.0 * 1024.0;
break;
case 'k':
divisor = 1000.0 / 8.0;
break;
case 'm':
divisor = 1000.0 * 1000.0 / 8.0;
break;
case 'g':
divisor = 1000.0 * 1000.0 * 1000.0 / 8.0;
break;
default:
divisor = 1024.0;
}
return (units_received / divisor / elapsed);
}
double
calc_thruput(double units_received)
{
return(calc_thruput_interval(units_received,lib_elapsed));
}
/* these "_omni" versions are ones which understand 'x' as a unit,
meaning transactions/s. we have a separate routine rather than
convert the existing routine so we don't have to go and change
_all_ the nettest_foo.c files at one time. raj 2007-06-08 */
double
calc_thruput_interval_omni(double units_received,double elapsed)
{
double divisor;
/* We will calculate the thruput in libfmt units/second */
switch (libfmt) {
case 'K':
divisor = 1024.0;
break;
case 'M':
divisor = 1024.0 * 1024.0;
break;
case 'G':
divisor = 1024.0 * 1024.0 * 1024.0;
break;
case 'k':
divisor = 1000.0 / 8.0;
break;
case 'm':
divisor = 1000.0 * 1000.0 / 8.0;
break;
case 'g':
divisor = 1000.0 * 1000.0 * 1000.0 / 8.0;
break;
case 'x':
divisor = 1.0;
break;
default:
fprintf(where,
"WARNING calc_throughput_internal_omni: unknown units %c\n",
libfmt);
fflush(where);
divisor = 1024.0;
}
return (units_received / divisor / elapsed);
}
double
calc_thruput_omni(double units_received)
{
return(calc_thruput_interval_omni(units_received,lib_elapsed));
}
float
calc_cpu_util(float elapsed_time)
{
return(calc_cpu_util_internal(elapsed_time));
}
float
calc_service_demand_internal(double unit_divisor,
double units_sent,
float elapsed_time,
float cpu_utilization,
int num_cpus)
{
double service_demand;
double thruput;
if (debug) {
fprintf(where,"calc_service_demand called: units_sent = %f\n",
units_sent);
fprintf(where," elapsed_time = %f\n",
elapsed_time);
fprintf(where," cpu_util = %f\n",
cpu_utilization);
fprintf(where," num cpu = %d\n",
num_cpus);
fflush(where);
}
if (num_cpus == 0) num_cpus = lib_num_loc_cpus;
if (elapsed_time == 0.0) {
elapsed_time = lib_elapsed;
}
if (cpu_utilization == 0.0) {
cpu_utilization = lib_local_cpu_util;
}
thruput = (units_sent /
(double) unit_divisor /
(double) elapsed_time);
/* on MP systems, it is necessary to multiply the service demand by */
/* the number of CPU's. at least, I believe that to be the case:) */
/* raj 10/95 */
/* thruput has a "per second" component. if we were using 100% ( */
/* 100.0) of the CPU in a second, that would be 1 second, or 1 */
/* millisecond, so we multiply cpu_utilization by 10 to go to */
/* milliseconds, or 10,000 to go to micro seconds. With revision */
/* 2.1, the service demand measure goes to microseconds per unit. */
/* raj 12/95 */
service_demand = (cpu_utilization*10000.0/thruput) *
(float) num_cpus;
if (debug) {
fprintf(where,"calc_service_demand using: units_sent = %f\n",
units_sent);
fprintf(where," elapsed_time = %f\n",
elapsed_time);
fprintf(where," cpu_util = %f\n",
cpu_utilization);
fprintf(where," num cpu = %d\n",
num_cpus);
fprintf(where,"calc_service_demand got: thruput = %f\n",
thruput);
fprintf(where," servdem = %f\n",
service_demand);
fflush(where);
}
return (float)service_demand;
}
float calc_service_demand(double units_sent,
float elapsed_time,
float cpu_utilization,
int num_cpus)
{
double unit_divisor = (double)1024.0;
return(calc_service_demand_internal(unit_divisor,
units_sent,
elapsed_time,
cpu_utilization,
num_cpus));
}
float calc_service_demand_trans(double units_sent,
float elapsed_time,
float cpu_utilization,
int num_cpus)
{
double unit_divisor = (double)1.0;
return(calc_service_demand_internal(unit_divisor,
units_sent,
elapsed_time,
cpu_utilization,
num_cpus));
}
float
calibrate_local_cpu(float local_cpu_rate)
{
lib_num_loc_cpus = get_num_cpus();
lib_use_idle = 0;
#ifdef USE_LOOPER
cpu_util_init();
lib_use_idle = 1;
#endif /* USE_LOOPER */
if (local_cpu_rate > 0) {
/* The user think that he knows what the cpu rate is. We assume */
/* that all the processors of an MP system are essentially the */
/* same - for this reason we do not have a per processor maxrate. */
/* if the machine has processors which are different in */
/* performance, the CPU utilization will be skewed. raj 4/95 */
lib_local_maxrate = local_cpu_rate;
}
else {
/* if neither USE_LOOPER nor USE_PSTAT are defined, we return a */
/* 0.0 to indicate that times or getrusage should be used. raj */
/* 4/95 */
lib_local_maxrate = (float)0.0;
#if defined(USE_PROC_STAT) || defined(USE_LOOPER) || defined(USE_PSTAT) || defined(USE_KSTAT) || defined(USE_PERFSTAT) || defined(USE_SYSCTL)
lib_local_maxrate = calibrate_idle_rate(4,10);
#endif
}
return lib_local_maxrate;
}
float
calibrate_remote_cpu()
{
float remrate;
netperf_request.content.request_type = CPU_CALIBRATE;
send_request();
/* we know that calibration will last at least 40 seconds, so go to */
/* sleep for that long so the 60 second select in recv_response will */
/* not pop. raj 7/95 */
/* we know that CPU calibration may last as long as 40 seconds, so
make sure we "select" for at least that long while looking for
the response. raj 2005-05-16 */
recv_response_timed(40);
if (netperf_response.content.serv_errno) {
/* initially, silently ignore remote errors and pass */
/* back a zero to the caller this should allow us to */
/* mix rev 1.0 and rev 1.1 netperfs... */
return((float)0.0);
}
else {
/* the rate is the first word of the test_specific data */
bcopy((char *)netperf_response.content.test_specific_data,
(char *)&remrate,
sizeof(remrate));
bcopy((char *)netperf_response.content.test_specific_data + sizeof(remrate),
(char *)&lib_num_rem_cpus,
sizeof(lib_num_rem_cpus));
/* remrate = (float) netperf_response.content.test_specific_data[0]; */
return(remrate);
}
}
#ifndef WIN32
/* WIN32 requires that at least one of the file sets to select be non-null. */
/* Since msec_sleep routine is only called by nettest_dlpi & nettest_unix, */
/* let's duck this issue. */
int
msec_sleep( int msecs )
{
int rval ;
struct timeval timeout;
timeout.tv_sec = msecs / 1000;
timeout.tv_usec = (msecs - (msecs/1000) *1000) * 1000;
if ((rval = select(0,
0,
0,
0,
&timeout))) {
if ( SOCKET_EINTR(rval) ) {
return(1);
}
perror("msec_sleep: select");
exit(1);
}
return(0);
}
#endif /* WIN32 */
#ifdef WANT_HISTOGRAM
/* hist.c
Given a time difference in microseconds, increment one of 61
different buckets:
0 - 9 in increments of 1 usec
0 - 9 in increments of 10 usecs
0 - 9 in increments of 100 usecs
1 - 9 in increments of 1 msec
1 - 9 in increments of 10 msecs
1 - 9 in increments of 100 msecs
1 - 9 in increments of 1 sec
1 - 9 in increments of 10 sec
> 100 secs
This will allow any time to be recorded to within an accuracy of
10%, and provides a compact representation for capturing the
distribution of a large number of time differences (e.g.
request-response latencies).
Colin Low 10/6/93
Rick Jones 2004-06-15 extend to unit and ten usecs
*/
/* #include "sys.h" */
/*#define HIST_TEST*/
HIST
HIST_new(void){
HIST h;
if((h = (HIST) malloc(sizeof(struct histogram_struct))) == NULL) {
perror("HIST_new - malloc failed");
exit(1);
}
HIST_clear(h);
return h;
}
void
HIST_clear(HIST h){
int i;
for(i = 0; i < 10; i++){
h->unit_usec[i] = 0;
h->ten_usec[i] = 0;
h->hundred_usec[i] = 0;
h->unit_msec[i] = 0;
h->ten_msec[i] = 0;
h->hundred_msec[i] = 0;
h->unit_sec[i] = 0;
h->ten_sec[i] = 0;
}
h->ridiculous = 0;
h->total = 0;
}
void
HIST_add(register HIST h, int time_delta){
register int val;
h->total++;
val = time_delta;
if(val <= 9) h->unit_usec[val]++;
else {
val = val/10;
if(val <= 9) h->ten_usec[val]++;
else {
val = val/10;
if(val <= 9) h->hundred_usec[val]++;
else {
val = val/10;
if(val <= 9) h->unit_msec[val]++;
else {
val = val/10;
if(val <= 9) h->ten_msec[val]++;
else {
val = val/10;
if(val <= 9) h->hundred_msec[val]++;
else {
val = val/10;
if(val <= 9) h->unit_sec[val]++;
else {
val = val/10;
if(val <= 9) h->ten_sec[val]++;
else h->ridiculous++;
}
}
}
}
}
}
}
}
#define RB_printf printf
void
output_row(FILE *fd, char *title, int *row){
register int i;
RB_printf("%s", title);
for(i = 0; i < 10; i++) RB_printf(": %4d", row[i]);
RB_printf("\n");
}
int
sum_row(int *row) {
int sum = 0;
int i;
for (i = 0; i < 10; i++) sum += row[i];
return(sum);
}
void
HIST_report(HIST h){
#ifndef OLD_HISTOGRAM
output_row(stdout, "UNIT_USEC ", h->unit_usec);
output_row(stdout, "TEN_USEC ", h->ten_usec);
output_row(stdout, "HUNDRED_USEC ", h->hundred_usec);
#else
h->hundred_usec[0] += sum_row(h->unit_usec);
h->hundred_usec[0] += sum_row(h->ten_usec);
output_row(stdout, "TENTH_MSEC ", h->hundred_usec);
#endif
output_row(stdout, "UNIT_MSEC ", h->unit_msec);
output_row(stdout, "TEN_MSEC ", h->ten_msec);
output_row(stdout, "HUNDRED_MSEC ", h->hundred_msec);
output_row(stdout, "UNIT_SEC ", h->unit_sec);
output_row(stdout, "TEN_SEC ", h->ten_sec);
RB_printf(">100_SECS: %d\n", h->ridiculous);
RB_printf("HIST_TOTAL: %d\n", h->total);
}
#endif
/* with the advent of sit-and-spin intervals support, we might as well
make these things available all the time, not just for demo or
histogram modes. raj 2006-02-06 */
#ifdef HAVE_GETHRTIME
void
HIST_timestamp(hrtime_t *timestamp)
{
*timestamp = gethrtime();
}
int
delta_micro(hrtime_t *begin, hrtime_t *end)
{
long nsecs;
nsecs = (*end) - (*begin);
return(nsecs/1000);
}
#elif defined(HAVE_GET_HRT)
#include "hrt.h"
void
HIST_timestamp(hrt_t *timestamp)
{
*timestamp = get_hrt();
}
int
delta_micro(hrt_t *begin, hrt_t *end)
{
return((int)get_hrt_delta(*end,*begin));
}
#elif defined(WIN32)
void HIST_timestamp(LARGE_INTEGER *timestamp)
{
QueryPerformanceCounter(timestamp);
}
int delta_micro(LARGE_INTEGER *begin, LARGE_INTEGER *end)
{
LARGE_INTEGER DeltaTimestamp;
static LARGE_INTEGER TickHz = {0,0};
if (TickHz.QuadPart == 0)
{
QueryPerformanceFrequency(&TickHz);
}
/*+*+ Rick; this will overflow after ~2000 seconds, is that
good enough? Spencer: Yes, that should be more than good
enough for histogram support */
DeltaTimestamp.QuadPart = (end->QuadPart - begin->QuadPart) *
1000000/TickHz.QuadPart;
assert((DeltaTimestamp.HighPart == 0) &&
((int)DeltaTimestamp.LowPart >= 0));
return (int)DeltaTimestamp.LowPart;
}
#else
void
HIST_timestamp(struct timeval *timestamp)
{
gettimeofday(timestamp,NULL);
}
/* return the difference (in micro seconds) between two timeval */
/* timestamps */
int
delta_micro(struct timeval *begin,struct timeval *end)
{
int usecs, secs;
if (end->tv_usec < begin->tv_usec) {
/* borrow a second from the tv_sec */
end->tv_usec += 1000000;
end->tv_sec--;
}
usecs = end->tv_usec - begin->tv_usec;
secs = end->tv_sec - begin->tv_sec;
usecs += (secs * 1000000);
return(usecs);
}
#endif /* HAVE_GETHRTIME */
#ifdef WANT_DLPI
int
put_control(fd, len, pri, ack)
int fd, len, pri, ack;
{
int error;
int flags = 0;
dl_error_ack_t *err_ack = (dl_error_ack_t *)control_data;
control_message.len = len;
if ((error = putmsg(fd, &control_message, 0, pri)) < 0 ) {
fprintf(where,"put_control: putmsg error %d\n",error);
fflush(where);
return(-1);
}
if ((error = getmsg(fd, &control_message, 0, &flags)) < 0) {
fprintf(where,"put_control: getsmg error %d\n",error);
fflush(where);
return(-1);
}
if (err_ack->dl_primitive != ack) {
fprintf(where,"put_control: acknowledgement error wanted %u got %u \n",
ack,err_ack->dl_primitive);
if (err_ack->dl_primitive == DL_ERROR_ACK) {
fprintf(where," dl_error_primitive: %u\n",
err_ack->dl_error_primitive);
fprintf(where," dl_errno: %u\n",
err_ack->dl_errno);
fprintf(where," dl_unix_errno %u\n",
err_ack->dl_unix_errno);
}
fflush(where);
return(-1);
}
return(0);
}
int
dl_open(char devfile[], int ppa)
{
int fd;
dl_attach_req_t *attach_req = (dl_attach_req_t *)control_data;
if ((fd = open(devfile, O_RDWR)) == -1) {
fprintf(where,"netperf: dl_open: open of %s failed, errno = %d\n",
devfile,
errno);
return(-1);
}
attach_req->dl_primitive = DL_ATTACH_REQ;
attach_req->dl_ppa = ppa;
if (put_control(fd, sizeof(dl_attach_req_t), 0, DL_OK_ACK) < 0) {
fprintf(where,
"netperf: dl_open: could not send control message, errno = %d\n",
errno);
return(-1);
}
return(fd);
}
int
dl_bind(int fd, int sap, int mode, char *dlsap_ptr, int *dlsap_len)
{
dl_bind_req_t *bind_req = (dl_bind_req_t *)control_data;
dl_bind_ack_t *bind_ack = (dl_bind_ack_t *)control_data;
bind_req->dl_primitive = DL_BIND_REQ;
bind_req->dl_sap = sap;
bind_req->dl_max_conind = 1;
bind_req->dl_service_mode = mode;
bind_req->dl_conn_mgmt = 0;
bind_req->dl_xidtest_flg = 0;
if (put_control(fd, sizeof(dl_bind_req_t), 0, DL_BIND_ACK) < 0) {
fprintf(where,
"netperf: dl_bind: could not send control message, errno = %d\n",
errno);
return(-1);
}
/* at this point, the control_data portion of the control message */
/* structure should contain a DL_BIND_ACK, which will have a full */
/* DLSAP in it. we want to extract this and pass it up so that */
/* it can be passed around. */
if (*dlsap_len >= bind_ack->dl_addr_length) {
bcopy((char *)bind_ack+bind_ack->dl_addr_offset,
dlsap_ptr,
bind_ack->dl_addr_length);
*dlsap_len = bind_ack->dl_addr_length;
return(0);
}
else {
return (-1);
}
}
int
dl_connect(int fd, unsigned char *remote_addr, int remote_addr_len)
{
dl_connect_req_t *connection_req = (dl_connect_req_t *)control_data;
dl_connect_con_t *connection_con = (dl_connect_con_t *)control_data;
struct pollfd pinfo;
int flags = 0;
/* this is here on the off chance that we really want some data */
u_long data_area[512];
struct strbuf data_message;
int error;
data_message.maxlen = 2048;
data_message.len = 0;
data_message.buf = (char *)data_area;
connection_req->dl_primitive = DL_CONNECT_REQ;
connection_req->dl_dest_addr_length = remote_addr_len;
connection_req->dl_dest_addr_offset = sizeof(dl_connect_req_t);
connection_req->dl_qos_length = 0;
connection_req->dl_qos_offset = 0;
bcopy (remote_addr,
(unsigned char *)control_data + sizeof(dl_connect_req_t),
remote_addr_len);
/* well, I would call the put_control routine here, but the sequence */
/* of connection stuff with DLPI is a bit screwey with all this */
/* message passing - Toto, I don't think were in Berkeley anymore. */
control_message.len = sizeof(dl_connect_req_t) + remote_addr_len;
if ((error = putmsg(fd,&control_message,0,0)) !=0) {
fprintf(where,"dl_connect: putmsg failure, errno = %d, error 0x%x \n",
errno,error);
fflush(where);
return(-1);
};
pinfo.fd = fd;
pinfo.events = POLLIN | POLLPRI;
pinfo.revents = 0;
if ((error = getmsg(fd,&control_message,&data_message,&flags)) != 0) {
fprintf(where,"dl_connect: getmsg failure, errno = %d, error 0x%x \n",
errno,error);
fflush(where);
return(-1);
}
while (control_data[0] == DL_TEST_CON) {
/* i suppose we spin until we get an error, or a connection */
/* indication */
if((error = getmsg(fd,&control_message,&data_message,&flags)) !=0) {
fprintf(where,"dl_connect: getmsg failure, errno = %d, error = 0x%x\n",
errno,error);
fflush(where);
return(-1);
}
}
/* we are out - it either worked or it didn't - which was it? */
if (control_data[0] == DL_CONNECT_CON) {
return(0);
}
else {
return(-1);
}
}
int
dl_accept(fd, remote_addr, remote_addr_len)
int fd;
unsigned char *remote_addr;
int remote_addr_len;
{
dl_connect_ind_t *connect_ind = (dl_connect_ind_t *)control_data;
dl_connect_res_t *connect_res = (dl_connect_res_t *)control_data;
int tmp_cor;
int flags = 0;
/* hang around and wait for a connection request */
getmsg(fd,&control_message,0,&flags);
while (control_data[0] != DL_CONNECT_IND) {
getmsg(fd,&control_message,0,&flags);
}
/* now respond to the request. at some point, we may want to be sure */
/* that the connection came from the correct station address, but */
/* will assume that we do not have to worry about it just now. */
tmp_cor = connect_ind->dl_correlation;
connect_res->dl_primitive = DL_CONNECT_RES;
connect_res->dl_correlation = tmp_cor;
connect_res->dl_resp_token = 0;
connect_res->dl_qos_length = 0;
connect_res->dl_qos_offset = 0;
connect_res->dl_growth = 0;
return(put_control(fd, sizeof(dl_connect_res_t), 0, DL_OK_ACK));
}
int
dl_set_window(fd, window)
int fd, window;
{
return(0);
}
void
dl_stats(fd)
int fd;
{
}
int
dl_send_disc(fd)
int fd;
{
}
int
dl_recv_disc(fd)
int fd;
{
}
#endif /* WANT_DLPI*/
/* these routines for confidence intervals are courtesy of IBM. They */
/* have been modified slightly for more general usage beyond TCP/UDP */
/* tests. raj 11/94 I would suspect that this code carries an IBM */
/* copyright that is much the same as that for the original HP */
/* netperf code */
int confidence_iterations; /* for iterations */
double
result_confid=-10.0,
loc_cpu_confid=-10.0,
rem_cpu_confid=-10.0,
measured_sum_result=0.0,
measured_square_sum_result=0.0,
measured_mean_result=0.0,
measured_var_result=0.0,
measured_sum_local_cpu=0.0,
measured_square_sum_local_cpu=0.0,
measured_mean_local_cpu=0.0,
measured_var_local_cpu=0.0,
measured_sum_remote_cpu=0.0,
measured_square_sum_remote_cpu=0.0,
measured_mean_remote_cpu=0.0,
measured_var_remote_cpu=0.0,
measured_sum_local_service_demand=0.0,
measured_square_sum_local_service_demand=0.0,
measured_mean_local_service_demand=0.0,
measured_var_local_service_demand=0.0,
measured_sum_remote_service_demand=0.0,
measured_square_sum_remote_service_demand=0.0,
measured_mean_remote_service_demand=0.0,
measured_var_remote_service_demand=0.0,
measured_sum_local_time=0.0,
measured_square_sum_local_time=0.0,
measured_mean_local_time=0.0,
measured_var_local_time=0.0,
measured_mean_remote_time=0.0,
measured_fails,
measured_local_results,
confidence=-10.0;
/* interval=0.1; */
/************************************************************************/
/* */
/* Constants for Confidence Intervals */
/* */
/************************************************************************/
void
init_stat()
{
measured_sum_result=0.0;
measured_square_sum_result=0.0;
measured_mean_result=0.0;
measured_var_result=0.0;
measured_sum_local_cpu=0.0;
measured_square_sum_local_cpu=0.0;
measured_mean_local_cpu=0.0;
measured_var_local_cpu=0.0;
measured_sum_remote_cpu=0.0;
measured_square_sum_remote_cpu=0.0;
measured_mean_remote_cpu=0.0;
measured_var_remote_cpu=0.0;
measured_sum_local_service_demand=0.0;
measured_square_sum_local_service_demand=0.0;
measured_mean_local_service_demand=0.0;
measured_var_local_service_demand=0.0;
measured_sum_remote_service_demand=0.0;
measured_square_sum_remote_service_demand=0.0;
measured_mean_remote_service_demand=0.0;
measured_var_remote_service_demand=0.0;
measured_sum_local_time=0.0;
measured_square_sum_local_time=0.0;
measured_mean_local_time=0.0;
measured_var_local_time=0.0;
measured_mean_remote_time=0.0;
measured_fails = 0.0;
measured_local_results=0.0,
confidence=-10.0;
}
/* this routine does a simple table lookup for some statistical */
/* function that I would remember if I stayed awake in my probstats */
/* class... raj 11/94 */
double
confid(int level, int freedom)
{
double t99[35],t95[35];
t95[1]=12.706;
t95[2]= 4.303;
t95[3]= 3.182;
t95[4]= 2.776;
t95[5]= 2.571;
t95[6]= 2.447;
t95[7]= 2.365;
t95[8]= 2.306;
t95[9]= 2.262;
t95[10]= 2.228;
t95[11]= 2.201;
t95[12]= 2.179;
t95[13]= 2.160;
t95[14]= 2.145;
t95[15]= 2.131;
t95[16]= 2.120;
t95[17]= 2.110;
t95[18]= 2.101;
t95[19]= 2.093;
t95[20]= 2.086;
t95[21]= 2.080;
t95[22]= 2.074;
t95[23]= 2.069;
t95[24]= 2.064;
t95[25]= 2.060;
t95[26]= 2.056;
t95[27]= 2.052;
t95[28]= 2.048;
t95[29]= 2.045;
t95[30]= 2.042;
t99[1]=63.657;
t99[2]= 9.925;
t99[3]= 5.841;
t99[4]= 4.604;
t99[5]= 4.032;
t99[6]= 3.707;
t99[7]= 3.499;
t99[8]= 3.355;
t99[9]= 3.250;
t99[10]= 3.169;
t99[11]= 3.106;
t99[12]= 3.055;
t99[13]= 3.012;
t99[14]= 2.977;
t99[15]= 2.947;
t99[16]= 2.921;
t99[17]= 2.898;
t99[18]= 2.878;
t99[19]= 2.861;
t99[20]= 2.845;
t99[21]= 2.831;
t99[22]= 2.819;
t99[23]= 2.807;
t99[24]= 2.797;
t99[25]= 2.787;
t99[26]= 2.779;
t99[27]= 2.771;
t99[28]= 2.763;
t99[29]= 2.756;
t99[30]= 2.750;
if(level==95){
return(t95[freedom]);
} else if(level==99){
return(t99[freedom]);
} else{
return(0);
}
}
void
calculate_confidence(int confidence_iterations,
float time,
double result,
float loc_cpu,
float rem_cpu,
float loc_sd,
float rem_sd)
{
if (debug) {
fprintf(where,
"calculate_confidence: itr %d; time %f; res %f\n",
confidence_iterations,
time,
result);
fprintf(where,
" lcpu %f; rcpu %f\n",
loc_cpu,
rem_cpu);
fprintf(where,
" lsdm %f; rsdm %f\n",
loc_sd,
rem_sd);
fflush(where);
}
/* the test time */
measured_sum_local_time +=
(double) time;
measured_square_sum_local_time +=
(double) time*time;
measured_mean_local_time =
(double) measured_sum_local_time/confidence_iterations;
measured_var_local_time =
(double) measured_square_sum_local_time/confidence_iterations
-measured_mean_local_time*measured_mean_local_time;
/* the test result */
measured_sum_result +=
(double) result;
measured_square_sum_result +=
(double) result*result;
measured_mean_result =
(double) measured_sum_result/confidence_iterations;
measured_var_result =
(double) measured_square_sum_result/confidence_iterations
-measured_mean_result*measured_mean_result;
/* local cpu utilization */
measured_sum_local_cpu +=
(double) loc_cpu;
measured_square_sum_local_cpu +=
(double) loc_cpu*loc_cpu;
measured_mean_local_cpu =
(double) measured_sum_local_cpu/confidence_iterations;
measured_var_local_cpu =
(double) measured_square_sum_local_cpu/confidence_iterations
-measured_mean_local_cpu*measured_mean_local_cpu;
/* remote cpu util */
measured_sum_remote_cpu +=
(double) rem_cpu;
measured_square_sum_remote_cpu+=
(double) rem_cpu*rem_cpu;
measured_mean_remote_cpu =
(double) measured_sum_remote_cpu/confidence_iterations;
measured_var_remote_cpu =
(double) measured_square_sum_remote_cpu/confidence_iterations
-measured_mean_remote_cpu*measured_mean_remote_cpu;
/* local service demand */
measured_sum_local_service_demand +=
(double) loc_sd;
measured_square_sum_local_service_demand+=
(double) loc_sd*loc_sd;
measured_mean_local_service_demand =
(double) measured_sum_local_service_demand/confidence_iterations;
measured_var_local_service_demand =
(double) measured_square_sum_local_service_demand/confidence_iterations
-measured_mean_local_service_demand*measured_mean_local_service_demand;
/* remote service demand */
measured_sum_remote_service_demand +=
(double) rem_sd;
measured_square_sum_remote_service_demand+=
(double) rem_sd*rem_sd;
measured_mean_remote_service_demand =
(double) measured_sum_remote_service_demand/confidence_iterations;
measured_var_remote_service_demand =
(double) measured_square_sum_remote_service_demand/confidence_iterations
-measured_mean_remote_service_demand*measured_mean_remote_service_demand;
if(confidence_iterations>1){
result_confid= (double) interval -
2.0 * confid(confidence_level,confidence_iterations-1)*
sqrt(measured_var_result/(confidence_iterations-1.0)) /
measured_mean_result;
loc_cpu_confid= (double) interval -
2.0 * confid(confidence_level,confidence_iterations-1)*
sqrt(measured_var_local_cpu/(confidence_iterations-1.0)) /
measured_mean_local_cpu;
rem_cpu_confid= (double) interval -
2.0 * confid(confidence_level,confidence_iterations-1)*
sqrt(measured_var_remote_cpu/(confidence_iterations-1.0)) /
measured_mean_remote_cpu;
if(debug){
printf("Conf_itvl %2d: results:%4.1f%% loc_cpu:%4.1f%% rem_cpu:%4.1f%%\n",
confidence_iterations,
(interval-result_confid)*100.0,
(interval-loc_cpu_confid)*100.0,
(interval-rem_cpu_confid)*100.0);
}
/* if the user has requested that we only wait for the result to
be confident rather than the result and CPU util(s) then do
so. raj 2007-08-08 */
if (!result_confidence_only) {
confidence = min(min(result_confid,loc_cpu_confid),rem_cpu_confid);
}
else {
confidence = result_confid;
}
}
}
/* here ends the IBM code */
void
retrieve_confident_values(float *elapsed_time,
double *thruput,
float *local_cpu_utilization,
float *remote_cpu_utilization,
float *local_service_demand,
float *remote_service_demand)
{
*elapsed_time = (float)measured_mean_local_time;
*thruput = measured_mean_result;
*local_cpu_utilization = (float)measured_mean_local_cpu;
*remote_cpu_utilization = (float)measured_mean_remote_cpu;
*local_service_demand = (float)measured_mean_local_service_demand;
*remote_service_demand = (float)measured_mean_remote_service_demand;
}
/* display_confidence() is called when we could not achieve the */
/* desirec confidence in the results. it will print the achieved */
/* confidence to "where" raj 11/94 */
void
display_confidence()
{
fprintf(where,
"!!! WARNING\n");
fprintf(where,
"!!! Desired confidence was not achieved within ");
fprintf(where,
"the specified iterations.\n");
fprintf(where,
"!!! This implies that there was variability in ");
fprintf(where,
"the test environment that\n");
fprintf(where,
"!!! must be investigated before going further.\n");
fprintf(where,
"!!! Confidence intervals: Throughput : %4.1f%%\n",
100.0 * (interval - result_confid));
fprintf(where,
"!!! Local CPU util : %4.1f%%\n",
100.0 * (interval - loc_cpu_confid));
fprintf(where,
"!!! Remote CPU util : %4.1f%%\n\n",
100.0 * (interval - rem_cpu_confid));
}
| 28.115329 | 141 | 0.592124 | [
"object",
"vector"
] |
778b1a25e00ec82c4809466bfa5c9bc5d4c09571 | 2,475 | h | C | Include/Events/apOpenCLErrorEvent.h | GPUOpen-Tools/common-src-AMDTAPIClasses | 33c696c3b9d17d621675645bfa1437d67dc27d0b | [
"MIT"
] | 1 | 2017-01-28T14:12:29.000Z | 2017-01-28T14:12:29.000Z | Include/Events/apOpenCLErrorEvent.h | GPUOpen-Tools/common-src-AMDTAPIClasses | 33c696c3b9d17d621675645bfa1437d67dc27d0b | [
"MIT"
] | null | null | null | Include/Events/apOpenCLErrorEvent.h | GPUOpen-Tools/common-src-AMDTAPIClasses | 33c696c3b9d17d621675645bfa1437d67dc27d0b | [
"MIT"
] | 2 | 2016-09-21T12:28:23.000Z | 2019-11-01T23:07:02.000Z | //==================================================================================
// Copyright (c) 2016 , Advanced Micro Devices, Inc. All rights reserved.
//
/// \author AMD Developer Tools Team
/// \file apOpenCLErrorEvent.h
///
//==================================================================================
//------------------------------ apOpenCLErrorEvent.h ------------------------------
#ifndef __APOPENCLERROREVENT_H
#define __APOPENCLERROREVENT_H
// Forward declarations:
template <class TransferableObjectType> class osTransferableObjectCreator;
class apFunctionCall;
// Infra:
#include <AMDTBaseTools/Include/gtString.h>
#include <AMDTAPIClasses/Include/apOpenCLErrorParameters.h>
// Local:
#include <AMDTAPIClasses/Include/Events/apEvent.h>
// ----------------------------------------------------------------------------------
// Class Name: AP_API apOpenCLErrorEvent
// General Description:
// Is thrown when an OpenCL error has occurred
// Author: AMD Developer Tools Team
// Creation Date: 21/2/2010
// ----------------------------------------------------------------------------------
class AP_API apOpenCLErrorEvent : public apEvent
{
public:
apOpenCLErrorEvent(osThreadId triggeringThreadId, const apOpenCLErrorParameters& openCLErrorsParameter, bool wasGeneratedByBreak);
virtual ~apOpenCLErrorEvent();
\
// Overrides osTransferableObject:
virtual osTransferableObjectType type() const;
virtual bool writeSelfIntoChannel(osChannel& ipcChannel) const;
virtual bool readSelfFromChannel(osChannel& ipcChannel);
const apOpenCLErrorParameters& openCLErrorParameters() const {return _openCLErrorParameters;}
const apFunctionCall* breakedOnFunctionCall() const { return _openCLErrorParameters._aptrBreakedOnFunctionCall.pointedObject(); };
// Overrides apEvent:
virtual EventType eventType() const;
virtual apEvent* clone() const;
// Was the event generated by break?
bool wasGeneratedByBreak() const {return _wasGeneratedByBreak;};
private:
// Only the transferable object creator should be able to call my default constructor:
friend class osTransferableObjectCreator<apOpenCLErrorEvent>;
apOpenCLErrorEvent();
private:
// Contains the OpenCL error parameters:
apOpenCLErrorParameters _openCLErrorParameters;
// Contain true iff the event was generated by a breakpoint:
bool _wasGeneratedByBreak;
};
#endif //__APOPENCLERROREVENT_H
| 36.397059 | 134 | 0.646061 | [
"object"
] |
7790b743f0c44db49e1b121b12a3e4961ed9d129 | 2,348 | c | C | vice/src/objects/dataset.c | astrobeard/VICEdev | c78804ec63b48a760ce3e50b8d3afc7b699ec75f | [
"MIT"
] | null | null | null | vice/src/objects/dataset.c | astrobeard/VICEdev | c78804ec63b48a760ce3e50b8d3afc7b699ec75f | [
"MIT"
] | null | null | null | vice/src/objects/dataset.c | astrobeard/VICEdev | c78804ec63b48a760ce3e50b8d3afc7b699ec75f | [
"MIT"
] | null | null | null | /*
* This file implements memory management for the dataset object
*/
#include <stdlib.h>
#include "dataset.h"
/* ---------- static function comment headers not duplicated here ---------- */
static void dataset_data_free(double **data, unsigned long n_rows,
unsigned short n_cols);
/*
* Allocate memory for and return a pointer to a dataset object
*
* header: dataset.h
*/
extern DATASET *dataset_initialize(void) {
DATASET *ds = (DATASET *) malloc (sizeof(DATASET));
ds -> data = NULL;
ds -> errors = NULL;
ds -> inv_cov = NULL;
ds -> predictions = NULL;
ds -> labels = NULL;
ds -> n_quantities = 0u;
ds -> n_points = 0ul;
return ds;
}
/*
* Free the memory stored in a dataset object
*
* header: dataset.h
*/
extern void dataset_free(DATASET *ds) {
if (ds != NULL) {
dataset_reset(ds);
free(ds);
ds = NULL;
} else {}
}
/*
* Clear all of the memory stored in a dataset object, but leave it intact so
* that it may store new data
*
* Parameters
* ==========
* ds: The dataset object to reset
*
* header: dataset.h
*/
extern void dataset_reset(DATASET *ds) {
if (ds != NULL) {
dataset_data_free(ds -> data, (*ds).n_points, (*ds).n_quantities);
dataset_data_free(ds -> errors, (*ds).n_points, (*ds).n_quantities);
dataset_data_free(ds -> inv_cov, (*ds).n_quantities, (*ds).n_quantities);
dataset_data_free(ds -> predictions, (*ds).n_points, (*ds).n_quantities);
if ((*ds).labels != NULL) {
unsigned short i;
for (i = 0u; i < (*ds).n_quantities; i++) {
if ((*ds).labels[i] != NULL) {
free(ds -> labels[i]);
ds -> labels[i] = NULL;
} else {}
}
free(ds -> labels);
ds -> labels = NULL;
} else {}
ds -> n_quantities = 0u;
ds -> n_points = 0ul;
}
}
/*
* Free up the memory stored in a double pointer in a dataset object
*
* Parameters
* ==========
* data: The data itself
* n_rows: The number of rows in the table
* n_cols: The number of columns in the table
*/
static void dataset_data_free(double **data, unsigned long n_rows,
unsigned short n_cols) {
if (data != NULL) {
unsigned long i;
for (i = 0ul; i < n_rows; i++) {
if (data[i] != NULL) {
free(data[i]);
data[i] = NULL;
} else {}
}
free(data);
data = NULL;
}
}
| 20.241379 | 80 | 0.59029 | [
"object"
] |
779ebef3f01b3ced77efc37cc695945bc102001c | 1,342 | h | C | kubernetes/model/v2alpha1_cron_job_spec.h | brendandburns/c | ea2fb243e1fd71e96a1ae470b728c3767bf0f328 | [
"Apache-2.0"
] | 1 | 2020-03-25T19:45:53.000Z | 2020-03-25T19:45:53.000Z | kubernetes/model/v2alpha1_cron_job_spec.h | brendandburns/c | ea2fb243e1fd71e96a1ae470b728c3767bf0f328 | [
"Apache-2.0"
] | null | null | null | kubernetes/model/v2alpha1_cron_job_spec.h | brendandburns/c | ea2fb243e1fd71e96a1ae470b728c3767bf0f328 | [
"Apache-2.0"
] | null | null | null | /*
* v2alpha1_cron_job_spec.h
*
* CronJobSpec describes how the job execution will look like and when it will actually run.
*/
#ifndef _v2alpha1_cron_job_spec_H_
#define _v2alpha1_cron_job_spec_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "v2alpha1_job_template_spec.h"
typedef struct v2alpha1_cron_job_spec_t {
char *concurrency_policy; // string
int failed_jobs_history_limit; //numeric
struct v2alpha1_job_template_spec_t *job_template; //model
char *schedule; // string
long starting_deadline_seconds; //numeric
int successful_jobs_history_limit; //numeric
int suspend; //boolean
} v2alpha1_cron_job_spec_t;
v2alpha1_cron_job_spec_t *v2alpha1_cron_job_spec_create(
char *concurrency_policy,
int failed_jobs_history_limit,
v2alpha1_job_template_spec_t *job_template,
char *schedule,
long starting_deadline_seconds,
int successful_jobs_history_limit,
int suspend
);
void v2alpha1_cron_job_spec_free(v2alpha1_cron_job_spec_t *v2alpha1_cron_job_spec);
v2alpha1_cron_job_spec_t *v2alpha1_cron_job_spec_parseFromJSON(cJSON *v2alpha1_cron_job_specJSON);
cJSON *v2alpha1_cron_job_spec_convertToJSON(v2alpha1_cron_job_spec_t *v2alpha1_cron_job_spec);
#endif /* _v2alpha1_cron_job_spec_H_ */
| 28.553191 | 98 | 0.799553 | [
"model"
] |
779fa139d4b16802b4108caaa6e345cb36448393 | 13,774 | h | C | include/neuralnet/base_layer.h | chonho/singa-web | d6e5354af3d641753a730b3d1ad31b1002fa61c1 | [
"Apache-2.0"
] | null | null | null | include/neuralnet/base_layer.h | chonho/singa-web | d6e5354af3d641753a730b3d1ad31b1002fa61c1 | [
"Apache-2.0"
] | null | null | null | include/neuralnet/base_layer.h | chonho/singa-web | d6e5354af3d641753a730b3d1ad31b1002fa61c1 | [
"Apache-2.0"
] | null | null | null | #ifndef SINGA_NEURALNET_BASE_LAYER_H_
#define SINGA_NEURALNET_BASE_LAYER_H_
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <memory>
#include <thread>
#include <unordered_map>
#include "proto/job.pb.h"
#include "proto/common.pb.h"
#include "utils/param.h"
#include "utils/common.h"
#include "utils/blob.h"
namespace singa {
using std::vector;
using std::string;
using std::map;
class Layer;
/**
* Base layer class.
*
* Children should implement at least
* Layer::ComputeFeature() and Layer::ComputGradient()
* functions for contrastive-divergence/back-propagation algorithm.
*/
class Layer {
public:
Layer() { }
virtual ~Layer() {}
/**
* Setup layer properties.
*
* Setup the shapes for data and parameters, also setup some properties
* based on the layer configuration and connected layers.
*
* @param proto layer configuration.
* @param npartitions num of total partitions of the original layer. This
* layer should be setup as one partition.
*/
virtual void Setup(const LayerProto& proto, int npartitions = 1);
/**
* Compute features of this layer based on connected layers.
*
* @param phase kTrain, kTest, kPositive, etc.
*/
virtual void ComputeFeature(Phase phase, Metric* perf) = 0;
/**
* Extract features which will be visulaized/analyzed by external programs.
* It is called after ComptueFeature().
*
* The extraction is done in mini-batches, i.e., one call of this function
* adds features of records from one mini-batch.
*
* @param step
* @param blobs features from all layers to be extracted. Every feature
* BlobProto would have the same number of records.
*/
virtual void ExtractFeature(int step, BlobProtos *blobs);
/**
*
* Extract weight param which will be visulaized/analyzed by external programs
*
* The extraction is done at once, each Param object from this layer is fully
* converted into a BlobProto object.
*
* @param step
* @param blobs BlobProto for all Param objects to be extracted from the net.
*/
virtual void ExtractParam(int step, BlobProtos *blobs) {};
/**
* Compute gradients for parameters and connected layers.
*
* @param phase kTrain, kTest, kPositive, etc.
*/
virtual void ComputeLoss(Metric* perf) {}
virtual void ComputeGradient(Phase phase) = 0;
/**
* For print debug info about each layer, e.g., norm of feature vector,
* norm of parameters.
*
* @param step training/test/validation step
* @param phase forward/backward/positive/negative...
* @return debug info about this layer.
*/
const string DebugString(int step, Phase phase);
/**
* Layers that have paramters must override this function.
*
* @return parameters associated with this layer
*/
virtual const vector<Param*> GetParams() const {
return vector<Param*> {};
}
/**
* Return the connection type between one neuron of this layer and
* its source layer.
* Currently support two connection types: kOneToOne, and kOneToAll.
* kOneToOne indicates the neuron depends on only one neuron from src layer.
* kOneToAll indicates the neuron depends on all neurons from src layer.
* TODO support kOneToMany.
*
* @param k index of source layer (current only support k = 0.
* @param connection type.
*/
virtual ConnectionType src_neuron_connection(int k) const {
// CHECK_LT(k, srclayers_.size());
return kOneToOne;
}
/**
* Return the connection type of this layer and all dst layers.
*
* Currently support two connection types: kOneToOne, and kOneToMany.
* kOneToOne indicates the users implement the ComputeFeature and
* ComputeGradient function considering only one dest layer. In this case,
* a SplitLayer will be added automatically to connect this layer with all
* dest layer.
* kOneToMany indicates the users has already considered multiple dest layers
* in the implementation.
* @return connection type default is kOneToOne.
*/
virtual ConnectionType dst_layer_connection() const {
return kOneToOne;
}
/**
* @return partition dimension of this layer.
* -1 for no partition;
* 0 for partition the mini-batch into sub-mini-batch.
* 1 for partition the layer feature vector into sub-vector.
*/
virtual int partition_dim() const {
return layer_proto_.partition_dim();
}
virtual int partition_id() const {
return layer_proto_.partition_id();
}
virtual int type() const {
return layer_proto_.type();
}
/**
* Return name of this layer
*/
const std::string &name() const {
return layer_proto_.name();
}
bool vis_feature() const {
return layer_proto_.vis();
}
/**
* @return name of src data blob, used by prefetch layer to locate the data
* blob in parser layers; The default value is "unknown"; If the
* src layer is the prefetch layer and there are more than one parser layers,
* this value be set.
*/
const std::string &datablob() const {
return layer_proto_.datablob();
}
/**
* @return a const ref for Blob storing neuron values of this layer for BP
*/
virtual const Blob<float>& data(const Layer* from, Phase = kPositive) const {
return data_;
}
virtual Blob<float>* mutable_data(const Layer* from, Phase = kPositive) {
return &data_;
}
virtual const Blob<float>& grad(const Layer* from) const {
return grad_;
}
/**
* @return a pointer to storing neuron grads of this layer for BP
*/
virtual Blob<float>* mutable_grad(const Layer* from) {
return &grad_;
}
/**
* return LayerS that connected to this layer
*/
virtual const vector<Layer*> srclayers() const {
return srclayers_;
}
/**
* return LayerS that this layer connected to
*/
virtual const vector<Layer*> dstlayers() const {
return dstlayers_;
}
virtual int srclayers_size() const {
return srclayers_.size();
}
virtual int dstlayers_size() const {
return dstlayers_.size();
}
virtual void clear_dstlayers() {
dstlayers_.clear();
}
virtual void clear_srclayers() {
srclayers_.clear();
}
virtual void add_srclayer(Layer* src) {
srclayers_.push_back(src);
}
virtual void add_dstlayer(Layer* dst) {
dstlayers_.push_back(dst);
}
virtual bool is_datalayer() const {
return false;
}
virtual bool is_parserlayer() const {
return false;
}
virtual bool is_losslayer() const {
return false;
}
virtual bool is_bridgesrclayer() const {
return false;
}
virtual bool is_bridgedstlayer() const {
return false;
}
virtual bool is_bridgelayer() const {
return false;
}
virtual bool is_vislayer() const {
return false;
}
virtual bool is_hidlayer() const {
return false;
}
protected:
LayerProto layer_proto_;
Blob<float> data_, grad_;
vector<Layer*> srclayers_, dstlayers_;
};
class BridgeLayer : public Layer {
public:
void set_ready(bool a) {
ready_ = a;
}
bool ready() const {
return ready_;
}
bool is_bridgelayer() const override {
return true;
}
protected:
//!< true if received grad from BridgeDstLayer
bool ready_;
};
/**
* For sending data to layer on other threads which may resident on other nodes
* due to layer/data partition.
*/
class BridgeSrcLayer: public BridgeLayer {
public:
using Layer::ComputeFeature;
using Layer::ComputeGradient;
void ComputeFeature(Phase phase, Metric* perf) override {}
void ComputeGradient(Phase phase) override {
ready_ = false;
}
const Blob<float>& data(const Layer* from, Phase phase) const override {
return srclayers_[0]->data(this);
}
Blob<float>* mutable_data(const Layer* from, Phase phase) override {
return srclayers_[0]->mutable_data(this);
}
const Blob<float>& grad(const Layer* from) const override {
return srclayers_[0]->grad(this);
}
Blob<float>* mutable_grad(const Layer* from) override {
return srclayers_[0]->mutable_grad(this);
}
bool is_bridgesrclayer() const override {
return true;
}
};
/**
* For recv data from layer on other threads which may resident on other nodes
* due to layer/data partiton
*/
class BridgeDstLayer: public BridgeLayer {
public:
using Layer::ComputeFeature;
using Layer::ComputeGradient;
void Setup(const LayerProto& proto, int npartitions) override;
void ComputeFeature(Phase phase, Metric* perf) override {
// reset ready_ for next iteration.
ready_ = false;
}
void ComputeGradient(Phase phase) override {}
bool is_bridgedstlayer() const {
return true;
}
};
/**
* Concate src layers on one dimension
*/
class ConcateLayer: public Layer {
public:
using Layer::ComputeFeature;
using Layer::ComputeGradient;
void Setup(const LayerProto& proto, int npartitions) override;
void ComputeFeature(Phase phase, Metric* perf) override;
void ComputeGradient(Phase phase) override;
};
/**
* Base layer for reading records from local Shard, HDFS, lmdb, etc.
*/
class DataLayer: public Layer{
public:
using Layer::ComputeGradient;
using Layer::mutable_data;
using Layer::mutable_grad;
using Layer::dst_layer_connection;
void ComputeGradient(Phase phase) override {}
bool is_datalayer() const override {
return true;
}
Blob<float>* mutable_data(const Layer* layer, Phase phase) override {
return nullptr;
}
Blob<float>* mutable_grad(const Layer* layer) override {
return nullptr;
}
ConnectionType dst_layer_connection() const override {
return kOneToMany;
}
int batchsize() const {
return batchsize_;
}
virtual const Record& sample() const {
return sample_;
}
/**
* @return the loaded records
*/
virtual const vector<Record>& records() const {
return records_;
}
protected:
int random_skip_, batchsize_;
Record sample_;
vector<Record> records_;
};
/**
* Layer for prefetching data records and parsing them.
*
* The data loading and parsing work is done by internal DataLayer and
* ParserLayer respectively. This layer controls the prefetching thread, i.e.,
* creating and joining the prefetching thread.
*/
class PrefetchLayer : public Layer {
public:
using Layer::ComputeFeature;
using Layer::ComputeGradient;
void Setup(const LayerProto& proto, int npartitions) override;
void ComputeFeature(Phase phase, Metric* perf) override;
void ComputeGradient(Phase phase) override {};
const Blob<float>& data(const Layer* from, Phase phase) const override;
Blob<float>* mutable_data(const Layer* layer, Phase phase) override;
Blob<float>* mutable_grad(const Layer* layer) override {
return nullptr;
}
const Blob<float>& grad(const Layer* from) const override {
CHECK(false) << "Loss layer has not gradient blob";
return grad_;
}
void Prefetch(Phase phase);
virtual ~PrefetchLayer();
protected:
vector<Layer*> sublayers_;
map<string, Blob<float>> datablobs_;
std::thread thread_;
};
/**
* Slice the source layer into multiple dst layers on one dimension
*/
class SliceLayer: public Layer {
public:
using Layer::ComputeFeature;
using Layer::ComputeGradient;
void Setup(const LayerProto& proto, int npartitions) override;
void ComputeFeature(Phase phase, Metric* perf) override;
void ComputeGradient(Phase phase) override;
ConnectionType dst_layer_connection() const override {
return kOneToMany;
}
const Blob<float>& data(const Layer* layer, Phase phase) const override;
const Blob<float>& grad(const Layer* layer) const override;
Blob<float>* mutable_data(const Layer* layer, Phase phase) override;
Blob<float>* mutable_grad(const Layer* layer) override;
protected:
int SliceID(const Layer* layer) const;
private:
vector<Blob<float>> datavec_, gradvec_;
int slice_dim_, slice_num_;
};
/**
* Connect the source layer with multiple dst layers.
* Pass source layer's data blob directly to dst layers.
* Aggregate dst layer's gradients into source layer's gradient.
*/
class SplitLayer: public Layer {
public:
using Layer::ComputeFeature;
using Layer::ComputeGradient;
void Setup(const LayerProto& proto, int npartitions) override;
void ComputeFeature(Phase phase, Metric* perf) override;
void ComputeGradient(Phase phase) override;
ConnectionType dst_layer_connection() const override {
return kOneToMany;
}
protected:
Blob<float> grads_;
};
/**
* Loss layer to calculate loss and other metrics, e.g., precison.
*/
class LossLayer: public Layer{
public:
using Layer::mutable_grad;
using Layer::grad;
using Layer::is_losslayer;
Blob<float>* mutable_grad(const Layer* layer) override {
return nullptr;
}
const Blob<float>& grad(const Layer* from) const override {
CHECK(false) << "Loss layer has not gradient blob";
return grad_;
}
bool is_losslayer() const override {
return true;
}
protected:
Blob<float> metric_;
};
/**
* parse the input records into Blobs.
*/
class ParserLayer: public Layer {
public:
using Layer::ComputeFeature;
using Layer::ComputeGradient;
using Layer::is_parserlayer;
using Layer::mutable_grad;
using Layer::grad;
void ComputeFeature(Phase phase, Metric* perf) override;
void ComputeGradient(Phase phase) override {};
/**
* Parse records from DataLayer into blob.
*/
virtual void ParseRecords(Phase phase, const vector<Record>& records,
Blob<float>* blob) = 0;
bool is_parserlayer() const override {
return true;
}
Blob<float>* mutable_grad(const Layer* layer) override {
return nullptr;
}
const Blob<float>& grad(const Layer* from) const override {
CHECK(false) << "Parser layer has not gradient blob";
return grad_;
}
};
} // namespace singa
#endif // SINGA_NEURALNET_BASE_LAYER_H_
| 26.849903 | 80 | 0.701902 | [
"object",
"vector"
] |
77a5b77b8fe615c7faca8b633975749ba9d312ce | 12,979 | h | C | FaceAzure/Classes/Operations/CSFA_LargeFaceLists.h | vladimir-shcherbakov/FaceAzure | c8771b1cfc03d4395773ba882abb842de7533aad | [
"MIT"
] | null | null | null | FaceAzure/Classes/Operations/CSFA_LargeFaceLists.h | vladimir-shcherbakov/FaceAzure | c8771b1cfc03d4395773ba882abb842de7533aad | [
"MIT"
] | null | null | null | FaceAzure/Classes/Operations/CSFA_LargeFaceLists.h | vladimir-shcherbakov/FaceAzure | c8771b1cfc03d4395773ba882abb842de7533aad | [
"MIT"
] | null | null | null | /**
* Code generated by Microsoft (R) AutoRest Code Generator.
* Changes may cause incorrect behavior and will be lost if the code is
* regenerated.
*/
#import <AzureClientRuntime/AzureClientRuntime.h>
#import "CSFA_LargeFaceList.h"
#import "CSFA_PersistedFace.h"
#import "CSFA_TrainingStatus.h"
@class AZOperationError;
/**
* An protocol provides access to all CSFA_LargeFaceLists operations
*/
@protocol CSFA_LargeFaceListsProtocol
/**
* Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)createWithLargeFaceListId:(NSString *)largeFaceListId withCallback:(void(^)(AZOperationError *))callback;
/**
* Create an empty large face list. Up to 64 large face lists are allowed to exist in one subscription.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param name User defined name, maximum length is 128.
* @param userData User specified data. Length should not exceed 16KB.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)createWithLargeFaceListId:(NSString *)largeFaceListId withName:(NSString *)name withUserData:(NSString *)userData withCallback:(void(^)(AZOperationError *))callback;
/**
* Retrieve a large face list's information.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param callback A block where CSFA_LargeFaceList is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)getWithLargeFaceListId:(NSString *)largeFaceListId withCallback:(void(^)(CSFA_LargeFaceList *, AZOperationError *))callback;
/**
* Update information of a large face list.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)updateWithLargeFaceListId:(NSString *)largeFaceListId withCallback:(void(^)(AZOperationError *))callback;
/**
* Update information of a large face list.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param name User defined name, maximum length is 128.
* @param userData User specified data. Length should not exceed 16KB.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)updateWithLargeFaceListId:(NSString *)largeFaceListId withName:(NSString *)name withUserData:(NSString *)userData withCallback:(void(^)(AZOperationError *))callback;
/**
* Delete an existing large face list according to faceListId. Persisted face images in the large face list will also be deleted.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)deleteWithLargeFaceListId:(NSString *)largeFaceListId withCallback:(void(^)(AZOperationError *))callback;
/**
* Retrieve the training status of a large face list (completed or ongoing).
*
* @param largeFaceListId Id referencing a particular large face list.
* @param callback A block where CSFA_TrainingStatus is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)getTrainingStatusWithLargeFaceListId:(NSString *)largeFaceListId withCallback:(void(^)(CSFA_TrainingStatus *, AZOperationError *))callback;
/**
* Retrieve information about all existing large face lists. Only largeFaceListId, name and userData will be returned.
*
* @param callback A block where NSArray<CSFA_LargeFaceList*> is a result object and AZOperationError is nil, if the operation is successful
*/
- (void)listWithCallback:(void(^)(NSArray<CSFA_LargeFaceList *>*, AZOperationError *))callback;
/**
* Queue a large face list training task, the training task may not be started immediately.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)trainWithLargeFaceListId:(NSString *)largeFaceListId withCallback:(void(^)(AZOperationError *))callback;
/**
* Delete an existing face from a large face list (given by a persisitedFaceId and a largeFaceListId). Persisted image related to the face will also be deleted.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param persistedFaceId Id referencing a particular persistedFaceId of an existing face.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)deleteFaceWithLargeFaceListId:(NSString *)largeFaceListId withPersistedFaceId:(NSUUID *)persistedFaceId withCallback:(void(^)(AZOperationError *))callback;
/**
* Retrieve information about a persisted face (specified by persistedFaceId and its belonging largeFaceListId).
*
* @param largeFaceListId Id referencing a particular large face list.
* @param persistedFaceId Id referencing a particular persistedFaceId of an existing face.
* @param callback A block where CSFA_PersistedFace is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)getFaceWithLargeFaceListId:(NSString *)largeFaceListId withPersistedFaceId:(NSUUID *)persistedFaceId withCallback:(void(^)(CSFA_PersistedFace *, AZOperationError *))callback;
/**
* Update a persisted face's userData field.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param persistedFaceId Id referencing a particular persistedFaceId of an existing face.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)updateFaceWithLargeFaceListId:(NSString *)largeFaceListId withPersistedFaceId:(NSUUID *)persistedFaceId withCallback:(void(^)(AZOperationError *))callback;
/**
* Update a persisted face's userData field.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param persistedFaceId Id referencing a particular persistedFaceId of an existing face.
* @param userData User-provided data attached to the face. The size limit is 1KB.
* @param callback A block where AZOperationError is nil if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)updateFaceWithLargeFaceListId:(NSString *)largeFaceListId withPersistedFaceId:(NSUUID *)persistedFaceId withUserData:(NSString *)userData withCallback:(void(^)(AZOperationError *))callback;
/**
* Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param url Publicly reachable URL of an image
* @param callback A block where CSFA_PersistedFace is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)addFaceFromUrlWithLargeFaceListId:(NSString *)largeFaceListId withUrl:(NSString *)url withCallback:(void(^)(CSFA_PersistedFace *, AZOperationError *))callback;
/**
* Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param url Publicly reachable URL of an image
* @param userData User-specified data about the face for any purpose. The maximum length is 1KB.
* @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image.
* @param callback A block where CSFA_PersistedFace is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)addFaceFromUrlWithLargeFaceListId:(NSString *)largeFaceListId withUrl:(NSString *)url withUserData:(NSString *)userData withTargetFace:(NSArray<AZInteger*> *)targetFace withCallback:(void(^)(CSFA_PersistedFace *, AZOperationError *))callback;
/**
* List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face).
*
* @param largeFaceListId Id referencing a particular large face list.
* @param callback A block where NSArray<CSFA_PersistedFace*> is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)listFacesWithLargeFaceListId:(NSString *)largeFaceListId withCallback:(void(^)(NSArray<CSFA_PersistedFace*> *, AZOperationError *))callback;
/**
* List all faces in a large face list, and retrieve face information (including userData and persistedFaceIds of registered faces of the face).
*
* @param largeFaceListId Id referencing a particular large face list.
* @param start Starting face id to return (used to list a range of faces).
* @param top Number of faces to return starting with the face id indicated by the 'start' parameter.
* @param callback A block where NSArray<CSFA_PersistedFace*> is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)listFacesWithLargeFaceListId:(NSString *)largeFaceListId withStart:(NSString *)start withTop:(AZInteger *)top withCallback:(void(^)(NSArray<CSFA_PersistedFace*> *, AZOperationError *))callback;
/**
* Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param image An image stream.
* @param callback A block where CSFA_PersistedFace is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)addFaceFromStreamWithLargeFaceListId:(NSString *)largeFaceListId withImage:(AZStream *)image withCallback:(void(^)(CSFA_PersistedFace *, AZOperationError *))callback;
/**
* Add a face to a large face list. The input face is specified as an image with a targetFace rectangle. It returns a persistedFaceId representing the added face, and persistedFaceId will not expire.
*
* @param largeFaceListId Id referencing a particular large face list.
* @param image An image stream.
* @param userData User-specified data about the face for any purpose. The maximum length is 1KB.
* @param targetFace A face rectangle to specify the target face to be added to a person in the format of "targetFace=left,top,width,height". E.g. "targetFace=10,10,100,100". If there is more than one face in the image, targetFace is required to specify which face to add. No targetFace means there is only one face detected in the entire image.
* @param callback A block where CSFA_PersistedFace is a result object and AZOperationError is nil, if the operation is successful
* @throws IllegalArgumentException if a required parameter is not provided.
*/
- (void)addFaceFromStreamWithLargeFaceListId:(NSString *)largeFaceListId withImage:(AZStream *)image withUserData:(NSString *)userData withTargetFace:(NSArray<AZInteger*> *)targetFace withCallback:(void(^)(CSFA_PersistedFace *, AZOperationError *))callback;
@end
/**
* The protocol implementation
*/
@class CSFA_FaceClientService;
@interface CSFA_LargeFaceLists : NSObject <CSFA_LargeFaceListsProtocol>
@property (readonly) CSFA_FaceClientService *service;
- (instancetype)initWithService:(CSFA_FaceClientService *)service;
@end
| 59.81106 | 345 | 0.78758 | [
"object"
] |
77a78346f33f1829778923f7a23b7a99caf190f5 | 961 | h | C | PrivateFrameworks/MusicLibrary/ML3QueryResultSet_BackingStore.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 17 | 2018-11-13T04:02:58.000Z | 2022-01-20T09:27:13.000Z | PrivateFrameworks/MusicLibrary/ML3QueryResultSet_BackingStore.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 3 | 2018-04-06T02:02:27.000Z | 2018-10-02T01:12:10.000Z | PrivateFrameworks/MusicLibrary/ML3QueryResultSet_BackingStore.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 1 | 2018-09-28T13:54:23.000Z | 2018-09-28T13:54:23.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
__attribute__((visibility("hidden")))
@interface ML3QueryResultSet_BackingStore : NSObject
{
vector_bbba3654 _persistentIDs;
struct vector<unsigned char, std::__1::allocator<unsigned char>> _sections;
}
- (id).cxx_construct;
- (void).cxx_destruct;
- (id)backingStoreByRemovingPersistentIDs:(const unordered_set_da619913 *)arg1;
- (void)reverseEnumerateSectionsUsingBlock:(CDUnknownBlockType)arg1;
- (void)enumerateSectionsUsingBlock:(CDUnknownBlockType)arg1;
- (BOOL)containsPersistentIDs:(const unordered_set_da619913 *)arg1;
- (void)reverseEnumeratePersistentIDsUsingBlock:(CDUnknownBlockType)arg1;
- (void)enumeratePersistentIDsUsingBlock:(CDUnknownBlockType)arg1;
- (long long)persistentIDAtIndex:(unsigned long long)arg1;
@property(readonly, nonatomic) unsigned long long count;
@end
| 33.137931 | 83 | 0.782518 | [
"vector"
] |
77a7ba0354ed0e399b0fe7fbfbde673b773a8bf1 | 909 | h | C | Multi_agent_planning/multi_agent_planning.h | elegantcoin/Multi_agent_planning | 42d98d382a13aa954712b4c8a4f811d6947043c1 | [
"Apache-2.0"
] | null | null | null | Multi_agent_planning/multi_agent_planning.h | elegantcoin/Multi_agent_planning | 42d98d382a13aa954712b4c8a4f811d6947043c1 | [
"Apache-2.0"
] | null | null | null | Multi_agent_planning/multi_agent_planning.h | elegantcoin/Multi_agent_planning | 42d98d382a13aa954712b4c8a4f811d6947043c1 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <vector>
#include <map>
using namespace std;
struct Node_Coord
{
int x;
int y;
float degree;
int cost;
int parent_index;
};
struct A_Graph
{
public:
int grid_size; // grid resolution, unit: m
double agent_radius; //agent radius
int min_x;
int min_y;
int rows;
int cols;
vector<vector<int>> directions;
vector<int> x_boundaries;
vector<int> y_boundaries;
Node_Coord nstart;
Node_Coord ndest;
void gen_boundries(int n_row, int n_col);
// build 4 directions
void get_directions();
int cal_xy_index(int pos,int min_pos);
int gen_unique_key(Node_Coord node);
int calc_weight_distance(Node_Coord n1,Node_Coord n2);
bool is_legal_node(Node_Coord node);
void gen_final_path(Node_Coord ndest, map<int,Node_Coord> closedset,vector<int> *res_x,vector<int> *res_y);
void agent_planing(int (*start)[3],int (*des)[3], vector<int> *res_x,vector<int> *res_y);
}; | 18.18 | 108 | 0.734873 | [
"vector"
] |
77aeb9afd79c93d648846f3d8dd068189737d87d | 3,741 | h | C | components/media/include/cgv/media/image/image_writer.h | tobias-haenel/cgv-density-estimation | 3be1b07a7b21d1cfd956fb19b5f0d83fb51bd308 | [
"BSD-3-Clause"
] | 1 | 2020-07-26T10:54:41.000Z | 2020-07-26T10:54:41.000Z | components/media/include/cgv/media/image/image_writer.h | tobias-haenel/cgv-density-estimation | 3be1b07a7b21d1cfd956fb19b5f0d83fb51bd308 | [
"BSD-3-Clause"
] | null | null | null | components/media/include/cgv/media/image/image_writer.h | tobias-haenel/cgv-density-estimation | 3be1b07a7b21d1cfd956fb19b5f0d83fb51bd308 | [
"BSD-3-Clause"
] | null | null | null | #pragma once
#include <cgv/base/base.h>
#include <cgv/data/data_view.h>
#include "lib_begin.h"
using namespace cgv::data;
namespace cgv {
namespace media {
namespace image {
class CGV_API image_writer;
/// abstract interface for image readers
class CGV_API abst_image_writer : public cgv::base::base
{
public:
friend class image_writer;
/// construct a copy of the reader
virtual abst_image_writer* clone() const = 0;
/// return a string containing a colon separated list of extensions that can be read with this reader
virtual const char* get_supported_extensions() const = 0;
/// check if the chosen writer supports the given component format
virtual bool is_format_supported(const component_format& cf, const std::vector<component_format>* palette_formats) const = 0;
/// return a reference to the last error message
virtual const std::string& get_last_error() const = 0;
/// return whether multiple images are supported, default implementation returns false
virtual bool supports_multiple_images() const;
/// open image file to write
virtual bool open(const std::string& file_name) = 0;
/// write one image
virtual bool write_image(const const_data_view& dv, const std::vector<const_data_view>* palettes, double duration) = 0;
/// close image [stream]
virtual bool close() = 0;
};
/// the image writer chooses a specific writer automatically based on the extension of the given file name
class CGV_API image_writer : public cgv::base::base
{
protected:
/// store a pointer to the chosen reader
abst_image_writer* wr;
/// whether file has been opened
bool is_opened;
/// store the file name
std::string file_name;
/// store the last error not resulting from writer implementations
std::string last_error;
/// abstract interface for the setter, by default it simply returns false
bool set_void(const std::string& property, const std::string& type, const void* value);
/// abstract interface for the getter, by default it simply returns false
bool get_void(const std::string& property, const std::string& type, void* value);
public:
/// construct an image writer from a file name and choose a writer from the extension
image_writer(const std::string& file_name);
/// close file on destruction
~image_writer();
/// overload to return the type name of this object
std::string get_type_name() const;
/// return a string with a list of supported extensions, where the list entries are separated with the passed character that defaults to a semicolon
static const std::string& get_supported_extensions(char sep = ';');
/// use this to generate a file_open_dialog or file_save_dialog
static std::string construct_filter_string();
/// return a semicolon separated list of property declarations of the form "name:type", by default an empty list is returned
std::string get_property_declarations();
/// check if the chosen writer supports the given component format
bool is_format_supported(const component_format& cf, const std::vector<component_format>* palette_formats = 0) const;
/// return a colon separated list of supported options
std::string get_options() const;
/// return a reference to the last error message
const std::string& get_last_error() const;
/** write the data stored in the data view to a file with the file name given in the constructor.
In case a vector of data views for palettes is given, write the image in paletted format. */
bool write_image(const const_data_view& dv, const std::vector<const_data_view>* palettes = 0, double duration = 0);
/// close image file;
bool close();
/// return whether multiple images are supported, default implementation returns false
bool supports_multiple_images() const;
};
}
}
}
#include <cgv/config/lib_end.h>
| 42.511364 | 149 | 0.760492 | [
"object",
"vector"
] |
77b5159cef6d61ac748ad8d325f6102c68a81d1f | 2,221 | h | C | beringei/client/RequestBatchingQueue.h | pidb/Gorilla | 75c3002b179d99c8709323d605e7d4b53484035c | [
"BSD-3-Clause"
] | 2,780 | 2016-12-22T19:25:26.000Z | 2018-05-21T11:29:42.000Z | beringei/client/RequestBatchingQueue.h | pidb/Gorilla | 75c3002b179d99c8709323d605e7d4b53484035c | [
"BSD-3-Clause"
] | 57 | 2016-12-23T09:22:18.000Z | 2018-05-04T06:26:48.000Z | beringei/client/RequestBatchingQueue.h | pidb/Gorilla | 75c3002b179d99c8709323d605e7d4b53484035c | [
"BSD-3-Clause"
] | 254 | 2016-12-22T20:53:12.000Z | 2018-05-16T06:14:10.000Z | /**
* Copyright (c) 2016-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
#pragma once
#include <functional>
#include <vector>
#include <folly/MPMCQueue.h>
#include "beringei/if/gen-cpp2/beringei_data_types.h"
namespace facebook {
namespace gorilla {
// This class acts as a queue but batches similar items together.
class RequestBatchingQueue {
public:
// Capacity is the the total number of DataPoint objects that the
// queue can hold.
explicit RequestBatchingQueue(size_t queueCapacity, size_t queueSize)
: capacity_(queueCapacity), queue_(queueSize), numQueuedDataPoints_(0) {}
// Pushes points in the queue. Returns true when all the points were
// pushed to the queue. Returns false when the points were not
// pushed. The vector is modified (points are moved) on a successful
// call.
bool push(std::vector<DataPoint>& points);
// Pops elements from the queue and calls the callback for each data
// point. Callback should return false when popping should be
// stopped. Some items will still be sent to the callback after this
// because the queue actually stores vectors and not individual data
// points.
//
// Returns the number of points popped and whether the caller should continue
// asking for more data in the future.
std::pair<bool, int> pop(std::function<bool(DataPoint& dp)> popCallback);
// Same as pop but it doesn't return anything and keeps popping until the
// popCallback returns false, even if the queue is empty.
void popForever(
std::function<bool(DataPoint& dp)> popCallback,
std::function<bool()> timeoutCallback);
// Causes n future calls to pop() to return false once everything currently in
// the queue has been processed.
void flush(int n);
int size() {
return numQueuedDataPoints_;
}
private:
const size_t capacity_;
folly::MPMCQueue<std::vector<DataPoint>> queue_;
std::atomic<int> numQueuedDataPoints_;
};
} // namespace gorilla
} // namespace facebook
| 32.661765 | 80 | 0.732103 | [
"vector"
] |
77b8473e962e182d735a80b9c491d58e1afc23a4 | 17,560 | c | C | _code/os/kernel/src/chevents.c | microwan/spc5-chibios | 7b155e37974cfeb36bc09c2be09133d957dd0cac | [
"Apache-2.0"
] | 1 | 2018-03-19T02:38:48.000Z | 2018-03-19T02:38:48.000Z | _code/os/kernel/src/chevents.c | microwan/spc5-chibios | 7b155e37974cfeb36bc09c2be09133d957dd0cac | [
"Apache-2.0"
] | null | null | null | _code/os/kernel/src/chevents.c | microwan/spc5-chibios | 7b155e37974cfeb36bc09c2be09133d957dd0cac | [
"Apache-2.0"
] | null | null | null | /*
ChibiOS/RT - Copyright (C) 2006,2007,2008,2009,2010,
2011,2012,2013 Giovanni Di Sirio.
This file is part of ChibiOS/RT.
ChibiOS/RT is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
ChibiOS/RT is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
---
A special exception to the GPL can be applied should you wish to distribute
a combined work that includes ChibiOS/RT, without being obliged to provide
the source code for any proprietary components. See the file exception.txt
for full details of how and when the exception can be applied.
*/
/*
Concepts and parts of this file have been contributed by Scott (skute).
*/
/**
* @file chevents.c
* @brief Events code.
*
* @addtogroup events
* @details Event Flags, Event Sources and Event Listeners.
* <h2>Operation mode</h2>
* Each thread has a mask of pending event flags inside its @p Thread
* structure.
* Operations defined for event flags:
* - <b>Wait</b>, the invoking thread goes to sleep until a certain
* AND/OR combination of event flags becomes pending.
* - <b>Clear</b>, a mask of event flags is cleared from the pending
* events mask, the cleared event flags mask is returned (only the
* flags that were actually pending and then cleared).
* - <b>Signal</b>, an event mask is directly ORed to the mask of the
* signaled thread.
* - <b>Broadcast</b>, each thread registered on an Event Source is
* signaled with the event flags specified in its Event Listener.
* - <b>Dispatch</b>, an events mask is scanned and for each bit set
* to one an associated handler function is invoked. Bit masks are
* scanned from bit zero upward.
* .
* An Event Source is a special object that can be "broadcasted" by
* a thread or an interrupt service routine. Broadcasting an Event
* Source has the effect that all the threads registered on the
* Event Source will be signaled with an events mask.<br>
* An unlimited number of Event Sources can exists in a system and
* each thread can be listening on an unlimited number of
* them.
* @pre In order to use the Events APIs the @p CH_USE_EVENTS option must be
* enabled in @p chconf.h.
* @post Enabling events requires 1-4 (depending on the architecture)
* extra bytes in the @p Thread structure.
* @{
*/
#include "ch.h"
#if CH_USE_EVENTS || defined(__DOXYGEN__)
/**
* @brief Registers an Event Listener on an Event Source.
* @details Once a thread has registered as listener on an event source it
* will be notified of all events broadcasted there.
* @note Multiple Event Listeners can specify the same bits to be ORed to
* different threads.
*
* @param[in] esp pointer to the @p EventSource structure
* @param[out] elp pointer to the @p EventListener structure
* @param[in] mask the mask of event flags to be ORed to the thread when
* the event source is broadcasted
*
* @api
*/
void chEvtRegisterMask(EventSource *esp, EventListener *elp, eventmask_t mask) {
chDbgCheck((esp != NULL) && (elp != NULL), "chEvtRegisterMask");
chSysLock();
elp->el_next = esp->es_next;
esp->es_next = elp;
elp->el_listener = currp;
elp->el_mask = mask;
elp->el_flags = 0;
chSysUnlock();
}
/**
* @brief Unregisters an Event Listener from its Event Source.
* @note If the event listener is not registered on the specified event
* source then the function does nothing.
* @note For optimal performance it is better to perform the unregister
* operations in inverse order of the register operations (elements
* are found on top of the list).
*
* @param[in] esp pointer to the @p EventSource structure
* @param[in] elp pointer to the @p EventListener structure
*
* @api
*/
void chEvtUnregister(EventSource *esp, EventListener *elp) {
EventListener *p;
chDbgCheck((esp != NULL) && (elp != NULL), "chEvtUnregister");
p = (EventListener *)esp;
chSysLock();
while (p->el_next != (EventListener *)esp) {
if (p->el_next == elp) {
p->el_next = elp->el_next;
break;
}
p = p->el_next;
}
chSysUnlock();
}
/**
* @brief Clears the pending events specified in the mask.
*
* @param[in] mask the events to be cleared
* @return The pending events that were cleared.
*
* @api
*/
eventmask_t chEvtGetAndClearEvents(eventmask_t mask) {
eventmask_t m;
chSysLock();
m = currp->p_epending & mask;
currp->p_epending &= ~mask;
chSysUnlock();
return m;
}
/**
* @brief Adds (OR) a set of event flags on the current thread, this is
* @b much faster than using @p chEvtBroadcast() or @p chEvtSignal().
*
* @param[in] mask the event flags to be added
* @return The current pending events mask.
*
* @api
*/
eventmask_t chEvtAddEvents(eventmask_t mask) {
chSysLock();
mask = (currp->p_epending |= mask);
chSysUnlock();
return mask;
}
/**
* @brief Signals all the Event Listeners registered on the specified Event
* Source.
* @details This function variants ORs the specified event flags to all the
* threads registered on the @p EventSource in addition to the event
* flags specified by the threads themselves in the
* @p EventListener objects.
* @post This function does not reschedule so a call to a rescheduling
* function must be performed before unlocking the kernel. Note that
* interrupt handlers always reschedule on exit so an explicit
* reschedule must not be performed in ISRs.
*
* @param[in] esp pointer to the @p EventSource structure
* @param[in] flags the flags set to be added to the listener flags mask
*
* @iclass
*/
void chEvtBroadcastFlagsI(EventSource *esp, flagsmask_t flags) {
EventListener *elp;
chDbgCheckClassI();
chDbgCheck(esp != NULL, "chEvtBroadcastMaskI");
elp = esp->es_next;
while (elp != (EventListener *)esp) {
elp->el_flags |= flags;
chEvtSignalI(elp->el_listener, elp->el_mask);
elp = elp->el_next;
}
}
/**
* @brief Returns the flags associated to an @p EventListener.
* @details The flags are returned and the @p EventListener flags mask is
* cleared.
*
* @param[in] elp pointer to the @p EventListener structure
* @return The flags added to the listener by the associated
* event source.
*
* @api
*/
flagsmask_t chEvtGetAndClearFlags(EventListener *elp) {
flagsmask_t flags;
chSysLock();
flags = elp->el_flags;
elp->el_flags = 0;
chSysUnlock();
return flags;
}
/**
* @brief Adds a set of event flags directly to specified @p Thread.
*
* @param[in] tp the thread to be signaled
* @param[in] mask the event flags set to be ORed
*
* @api
*/
void chEvtSignal(Thread *tp, eventmask_t mask) {
chDbgCheck(tp != NULL, "chEvtSignal");
chSysLock();
chEvtSignalI(tp, mask);
chSchRescheduleS();
chSysUnlock();
}
/**
* @brief Adds a set of event flags directly to specified @p Thread.
* @post This function does not reschedule so a call to a rescheduling
* function must be performed before unlocking the kernel. Note that
* interrupt handlers always reschedule on exit so an explicit
* reschedule must not be performed in ISRs.
*
* @param[in] tp the thread to be signaled
* @param[in] mask the event flags set to be ORed
*
* @iclass
*/
void chEvtSignalI(Thread *tp, eventmask_t mask) {
chDbgCheckClassI();
chDbgCheck(tp != NULL, "chEvtSignalI");
tp->p_epending |= mask;
/* Test on the AND/OR conditions wait states.*/
if (((tp->p_state == THD_STATE_WTOREVT) &&
((tp->p_epending & tp->p_u.ewmask) != 0)) ||
((tp->p_state == THD_STATE_WTANDEVT) &&
((tp->p_epending & tp->p_u.ewmask) == tp->p_u.ewmask)))
chSchReadyI(tp)->p_u.rdymsg = RDY_OK;
}
/**
* @brief Signals all the Event Listeners registered on the specified Event
* Source.
* @details This function variants ORs the specified event flags to all the
* threads registered on the @p EventSource in addition to the event
* flags specified by the threads themselves in the
* @p EventListener objects.
*
* @param[in] esp pointer to the @p EventSource structure
* @param[in] flags the flags set to be added to the listener flags mask
*
* @api
*/
void chEvtBroadcastFlags(EventSource *esp, flagsmask_t flags) {
chSysLock();
chEvtBroadcastFlagsI(esp, flags);
chSchRescheduleS();
chSysUnlock();
}
/**
* @brief Returns the flags associated to an @p EventListener.
* @details The flags are returned and the @p EventListener flags mask is
* cleared.
*
* @param[in] elp pointer to the @p EventListener structure
* @return The flags added to the listener by the associated
* event source.
*
* @iclass
*/
flagsmask_t chEvtGetAndClearFlagsI(EventListener *elp) {
flagsmask_t flags;
flags = elp->el_flags;
elp->el_flags = 0;
return flags;
}
/**
* @brief Invokes the event handlers associated to an event flags mask.
*
* @param[in] mask mask of the event flags to be dispatched
* @param[in] handlers an array of @p evhandler_t. The array must have size
* equal to the number of bits in eventmask_t.
*
* @api
*/
void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask) {
eventid_t eid;
chDbgCheck(handlers != NULL, "chEvtDispatch");
eid = 0;
while (mask) {
if (mask & EVENT_MASK(eid)) {
chDbgAssert(handlers[eid] != NULL,
"chEvtDispatch(), #1",
"null handler");
mask &= ~EVENT_MASK(eid);
handlers[eid](eid);
}
eid++;
}
}
#if CH_OPTIMIZE_SPEED || !CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
/**
* @brief Waits for exactly one of the specified events.
* @details The function waits for one event among those specified in
* @p mask to become pending then the event is cleared and returned.
* @note One and only one event is served in the function, the one with the
* lowest event id. The function is meant to be invoked into a loop in
* order to serve all the pending events.<br>
* This means that Event Listeners with a lower event identifier have
* an higher priority.
*
* @param[in] mask mask of the event flags that the function should wait
* for, @p ALL_EVENTS enables all the events
* @return The mask of the lowest id served and cleared event.
*
* @api
*/
eventmask_t chEvtWaitOne(eventmask_t mask) {
Thread *ctp = currp;
eventmask_t m;
chSysLock();
if ((m = (ctp->p_epending & mask)) == 0) {
ctp->p_u.ewmask = mask;
chSchGoSleepS(THD_STATE_WTOREVT);
m = ctp->p_epending & mask;
}
m ^= m & (m - 1);
ctp->p_epending &= ~m;
chSysUnlock();
return m;
}
/**
* @brief Waits for any of the specified events.
* @details The function waits for any event among those specified in
* @p mask to become pending then the events are cleared and returned.
*
* @param[in] mask mask of the event flags that the function should wait
* for, @p ALL_EVENTS enables all the events
* @return The mask of the served and cleared events.
*
* @api
*/
eventmask_t chEvtWaitAny(eventmask_t mask) {
Thread *ctp = currp;
eventmask_t m;
chSysLock();
if ((m = (ctp->p_epending & mask)) == 0) {
ctp->p_u.ewmask = mask;
chSchGoSleepS(THD_STATE_WTOREVT);
m = ctp->p_epending & mask;
}
ctp->p_epending &= ~m;
chSysUnlock();
return m;
}
/**
* @brief Waits for all the specified events.
* @details The function waits for all the events specified in @p mask to
* become pending then the events are cleared and returned.
*
* @param[in] mask mask of the event flags that the function should wait
* for, @p ALL_EVENTS requires all the events
* @return The mask of the served and cleared events.
*
* @api
*/
eventmask_t chEvtWaitAll(eventmask_t mask) {
Thread *ctp = currp;
chSysLock();
if ((ctp->p_epending & mask) != mask) {
ctp->p_u.ewmask = mask;
chSchGoSleepS(THD_STATE_WTANDEVT);
}
ctp->p_epending &= ~mask;
chSysUnlock();
return mask;
}
#endif /* CH_OPTIMIZE_SPEED || !CH_USE_EVENTS_TIMEOUT */
#if CH_USE_EVENTS_TIMEOUT || defined(__DOXYGEN__)
/**
* @brief Waits for exactly one of the specified events.
* @details The function waits for one event among those specified in
* @p mask to become pending then the event is cleared and returned.
* @note One and only one event is served in the function, the one with the
* lowest event id. The function is meant to be invoked into a loop in
* order to serve all the pending events.<br>
* This means that Event Listeners with a lower event identifier have
* an higher priority.
*
* @param[in] mask mask of the event flags that the function should wait
* for, @p ALL_EVENTS enables all the events
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The mask of the lowest id served and cleared event.
* @retval 0 if the operation has timed out.
*
* @api
*/
eventmask_t chEvtWaitOneTimeout(eventmask_t mask, systime_t time) {
Thread *ctp = currp;
eventmask_t m;
chSysLock();
if ((m = (ctp->p_epending & mask)) == 0) {
if (TIME_IMMEDIATE == time) {
chSysUnlock();
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
if (chSchGoSleepTimeoutS(THD_STATE_WTOREVT, time) < RDY_OK) {
chSysUnlock();
return (eventmask_t)0;
}
m = ctp->p_epending & mask;
}
m ^= m & (m - 1);
ctp->p_epending &= ~m;
chSysUnlock();
return m;
}
/**
* @brief Waits for any of the specified events.
* @details The function waits for any event among those specified in
* @p mask to become pending then the events are cleared and
* returned.
*
* @param[in] mask mask of the event flags that the function should wait
* for, @p ALL_EVENTS enables all the events
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The mask of the served and cleared events.
* @retval 0 if the operation has timed out.
*
* @api
*/
eventmask_t chEvtWaitAnyTimeout(eventmask_t mask, systime_t time) {
Thread *ctp = currp;
eventmask_t m;
chSysLock();
if ((m = (ctp->p_epending & mask)) == 0) {
if (TIME_IMMEDIATE == time) {
chSysUnlock();
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
if (chSchGoSleepTimeoutS(THD_STATE_WTOREVT, time) < RDY_OK) {
chSysUnlock();
return (eventmask_t)0;
}
m = ctp->p_epending & mask;
}
ctp->p_epending &= ~m;
chSysUnlock();
return m;
}
/**
* @brief Waits for all the specified events.
* @details The function waits for all the events specified in @p mask to
* become pending then the events are cleared and returned.
*
* @param[in] mask mask of the event flags that the function should wait
* for, @p ALL_EVENTS requires all the events
* @param[in] time the number of ticks before the operation timeouts,
* the following special values are allowed:
* - @a TIME_IMMEDIATE immediate timeout.
* - @a TIME_INFINITE no timeout.
* .
* @return The mask of the served and cleared events.
* @retval 0 if the operation has timed out.
*
* @api
*/
eventmask_t chEvtWaitAllTimeout(eventmask_t mask, systime_t time) {
Thread *ctp = currp;
chSysLock();
if ((ctp->p_epending & mask) != mask) {
if (TIME_IMMEDIATE == time) {
chSysUnlock();
return (eventmask_t)0;
}
ctp->p_u.ewmask = mask;
if (chSchGoSleepTimeoutS(THD_STATE_WTANDEVT, time) < RDY_OK) {
chSysUnlock();
return (eventmask_t)0;
}
}
ctp->p_epending &= ~mask;
chSysUnlock();
return mask;
}
#endif /* CH_USE_EVENTS_TIMEOUT */
#endif /* CH_USE_EVENTS */
/** @} */
| 31.582734 | 80 | 0.634567 | [
"object"
] |
77bca4712f66fbe11f1ed2d0c4daeb30db1979ea | 4,370 | h | C | ttk-0.9.7/ttk_install/include/ttk/vtk/ttkUserInterfaceBase.h | DaVisLab/PersistenceCycles | b68ae3ebc218ed69babeee5c1e4ac7f5a89564cd | [
"MIT"
] | null | null | null | ttk-0.9.7/ttk_install/include/ttk/vtk/ttkUserInterfaceBase.h | DaVisLab/PersistenceCycles | b68ae3ebc218ed69babeee5c1e4ac7f5a89564cd | [
"MIT"
] | null | null | null | ttk-0.9.7/ttk_install/include/ttk/vtk/ttkUserInterfaceBase.h | DaVisLab/PersistenceCycles | b68ae3ebc218ed69babeee5c1e4ac7f5a89564cd | [
"MIT"
] | 1 | 2021-12-24T15:05:31.000Z | 2021-12-24T15:05:31.000Z | /// \ingroup vtk
/// \class ttkUserInterfaceBase
/// \author Julien Tierny <julien.tierny@lip6.fr>.
/// \date March 2017.
///
/// \brief Interactions and rendering.
#ifndef _TTK_USERINTERFACE_BASE_H
#define _TTK_USERINTERFACE_BASE_H
#include <ttkProgramBase.h>
// VTK includes
#include <vtkDataSetSurfaceFilter.h>
#include <vtkInteractorStyleSwitch.h>
#include <vtkInteractorStyleTrackballCamera.h>
#include <vtkObjectFactory.h>
#include <vtkPNGReader.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <ttkTextureMapFromField.h>
#include <vtkVRMLExporter.h>
// forward declaration
class ttkUserInterfaceBase;
// Custom interactors
class ttkCustomInteractor : public vtkInteractorStyleTrackballCamera{
public:
static ttkCustomInteractor* New();
vtkTypeMacro(ttkCustomInteractor, vtkInteractorStyleTrackballCamera);
virtual void OnKeyPress();
inline int setUserInterface(ttkUserInterfaceBase *userInterface){
userInterface_ = userInterface;
return 0;
};
protected:
ttkUserInterfaceBase *userInterface_;
};
class ttkKeyHandler : public ttk::Debug{
public:
virtual int OnKeyPress(
vtkRenderWindowInteractor *interactor, std::string &key) = 0;
};
class VTKFILTERSCORE_EXPORT ttkUserInterfaceBase : public ttkProgramBase {
public:
ttkUserInterfaceBase();
~ttkUserInterfaceBase();
int exportScene(const std::string &fileName = "output.wrl") const;
ttkKeyHandler* getKeyHandler() { return keyHandler_;};
int hideOutputs(const std::vector<int> &outputList){
for(int i = 0; i < (int) outputList.size(); i++){
bool isAlreadyIn = false;
for(int j = 0; j < (int) hiddenOutputs_.size(); j++){
if(outputList[i] == hiddenOutputs_[j]){
isAlreadyIn = true;
break;
}
}
if(!isAlreadyIn)
hiddenOutputs_.push_back(outputList[i]);
}
return 0;
}
int init(int &argc, char **argv);
int refresh();
int run();
int setKeyHandler(ttkKeyHandler *handler){
keyHandler_ = handler;
return 0;
}
int switchOutput(const int &outputId);
int switchTransparency();
protected:
bool hasTexture_, isUp_, repeat_, transparency_, fullscreen_;
std::vector<bool> visibleOutputs_;
std::vector<int> hiddenOutputs_;
ttkKeyHandler *keyHandler_;
std::vector<vtkPolyData *> surfaces_;
vtkSmartPointer<ttkCustomInteractor>
customInteractor_;
std::vector<vtkSmartPointer<vtkActor> >
mainActors_;
std::vector<vtkSmartPointer<vtkDataSetSurfaceFilter> >
boundaryFilters_;
vtkSmartPointer<vtkPNGReader> pngReader_;
std::vector<vtkSmartPointer<vtkPolyDataMapper> >
boundaryMappers_;
vtkSmartPointer<vtkRenderer> renderer_;
vtkSmartPointer<vtkRenderWindow>
renderWindow_;
vtkSmartPointer<vtkRenderWindowInteractor>
interactor_;
vtkSmartPointer<vtkTexture> texture_;
std::vector<vtkSmartPointer<ttkTextureMapFromField> >
textureMapFromFields_;
int updateScalarFieldTexture();
};
template <class ttkModule>
class vtkUserInterface : public ttkUserInterfaceBase{
public:
vtkUserInterface(){
ttkObject_ = vtkSmartPointer<ttkModule>::New();
vtkWrapper_ = (vtkDataSetAlgorithm *) ttkObject_.GetPointer();
ttkModule_ = (Debug *) ttkObject_.GetPointer();
};
virtual int run(){
ttkObject_->setDebugLevel(ttk::globalDebugLevel_);
ttkObject_->setThreadNumber(parser_.getThreadNumber());
return ttkUserInterfaceBase::run();
}
vtkSmartPointer<ttkModule> ttkObject_;
};
#endif //_TTK_USERINTERFACE_BASE_H
| 28.376623 | 90 | 0.611213 | [
"vector"
] |
77c19040c93c9b5ed8ba22c107d0370dce93b175 | 186 | h | C | Artsy/Views/Collection_View_Cells/ARFavoriteItemViewCell.h | TribeMedia/eigen | 8a48e793bee2acb76e49af2a9e0f5134782bd684 | [
"MIT"
] | null | null | null | Artsy/Views/Collection_View_Cells/ARFavoriteItemViewCell.h | TribeMedia/eigen | 8a48e793bee2acb76e49af2a9e0f5134782bd684 | [
"MIT"
] | 3 | 2021-05-21T00:41:23.000Z | 2022-02-26T10:51:08.000Z | Artsy/Views/Collection_View_Cells/ARFavoriteItemViewCell.h | TribeMedia/eigen | 8a48e793bee2acb76e49af2a9e0f5134782bd684 | [
"MIT"
] | null | null | null |
@interface ARFavoriteItemViewCell : UICollectionViewCell
+ (CGSize)sizeForCellwithSize:(CGSize)size insets:(UIEdgeInsets)insets;
- (void)setupWithRepresentedObject:(id)object;
@end
| 18.6 | 71 | 0.811828 | [
"object"
] |
77c3ab0d1f7721f4c2c04af779c3d9ee604b8095 | 2,429 | h | C | lib/src/util.h | tvolkert/dart-glfw | aec0d84a25e575a5d24c363da4ef173eb64fb899 | [
"BSD-3-Clause"
] | 40 | 2015-08-19T20:07:20.000Z | 2021-11-16T19:19:45.000Z | lib/src/util.h | tvolkert/dart-glfw | aec0d84a25e575a5d24c363da4ef173eb64fb899 | [
"BSD-3-Clause"
] | 15 | 2016-04-09T19:13:30.000Z | 2022-03-06T07:45:38.000Z | lib/src/util.h | tvolkert/dart-glfw | aec0d84a25e575a5d24c363da4ef173eb64fb899 | [
"BSD-3-Clause"
] | 21 | 2016-04-09T19:09:11.000Z | 2020-11-26T17:02:02.000Z | // Copyright (c) 2015, the Dart GLFW extension authors. All rights reserved.
// Please see the AUTHORS file for details. Use of this source code is governed
// by a BSD-style license that can be found in the LICENSE file or at
// https://developers.google.com/open-source/licenses/bsd
#ifndef DART_GLFW_LIB_SRC_UTIL_H_
#define DART_GLFW_LIB_SRC_UTIL_H_
#include "dart_api.h"
#if defined(GLFW_TRACING)
#include "dart_tools_api.h"
#define TRACE_START(name) \
Dart_TimelineEvent(#name, Dart_TimelineGetMicros(), 0, \
Dart_Timeline_Event_Begin, 0, NULL, NULL)
#define TRACE_END(name) \
Dart_TimelineEvent(#name, Dart_TimelineGetMicros(), 0, \
Dart_Timeline_Event_End, 0, NULL, NULL)
#else
#define TRACE_START(name) \
do { \
} while (0)
#define TRACE_END(name) \
do { \
} while (0)
#endif
Dart_Handle HandleError(Dart_Handle handle);
#if defined(GLFW_TESTING)
#define HANDLE(handle) HandleError(handle)
#define HANDLE_INVOKE(handle) HandleError(handle)
#else
#define HANDLE(handle) handle
#define HANDLE_INVOKE(handle) (void)handle
#endif
// Constructs a new Dart List of integers with the given size and data.
template <typename T>
Dart_Handle NewDartIntList(int size, T* array) {
Dart_Handle list_handle = Dart_NewList(size);
for (int i = 0; i < size; i++) {
Dart_ListSetAt(list_handle, i,
Dart_NewInteger(static_cast<int64_t>(array[i])));
}
return list_handle;
}
// Extracts a pointer to a GLFW object from a Dart wrapper class.
template <typename T>
T* GetNativePointer(Dart_Handle obj) {
if (Dart_IsNull(obj)) {
return nullptr;
}
Dart_Handle wrapper =
HANDLE(Dart_GetField(obj, Dart_NewStringFromCString("_native_pointer")));
int64_t native_value;
HANDLE(Dart_IntegerToInt64(wrapper, &native_value));
intptr_t ptr_value = static_cast<intptr_t>(native_value);
return reinterpret_cast<T*>(ptr_value);
}
Dart_Handle Dart_IntegerToInt(Dart_Handle integer, int* value);
// NOLINTNEXTLINE
Dart_Handle Dart_IntegerToUShort(Dart_Handle integer, unsigned short* value);
Dart_Handle Dart_IntegerToUInt(Dart_Handle integer, unsigned int* value);
Dart_Handle Dart_IntegerToUChar(Dart_Handle integer, unsigned char* value);
void CreateSwapBuffersServicePort(Dart_NativeArguments args);
#endif // DART_GLFW_LIB_SRC_UTIL_H_
| 33.736111 | 79 | 0.719226 | [
"object"
] |
77c7ab976d5197869debdcc12d57b949660449f4 | 2,435 | h | C | include/maxscale/statistics.h | seibert-media/MaxScale | 6c1dc21ca4e3c8dc1828812afeff87894eab817d | [
"MIT"
] | null | null | null | include/maxscale/statistics.h | seibert-media/MaxScale | 6c1dc21ca4e3c8dc1828812afeff87894eab817d | [
"MIT"
] | null | null | null | include/maxscale/statistics.h | seibert-media/MaxScale | 6c1dc21ca4e3c8dc1828812afeff87894eab817d | [
"MIT"
] | null | null | null | #pragma once
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl11.
*
* Change Date: 2020-01-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
/**
* @file statistics.h - Lock-free statistics gathering
*/
#include <maxscale/cdefs.h>
#include <stdint.h>
MXS_BEGIN_DECLS
typedef void* ts_stats_t;
/** Enum values for ts_stats_get */
enum ts_stats_type
{
TS_STATS_MAX, /**< Maximum value */
TS_STATS_MIX, /**< Minimum value */
TS_STATS_SUM, /**< Sum of all value */
TS_STATS_AVG /**< Average of all values */
};
/**
* @brief Allocate a new statistics object
*
* @return New statistics object or NULL if memory allocation failed
*/
ts_stats_t ts_stats_alloc();
/**
* @brief Free statistics
*
* @param stats Statistics to free
*/
void ts_stats_free(ts_stats_t stats);
/**
* @brief Get statistics
*
* @param stats Statistics to read
* @param type Type of statistics to get
* @return Statistics value
*
* @see enum ts_stats_type
*/
int64_t ts_stats_get(ts_stats_t stats, enum ts_stats_type type);
/**
* @brief Increment thread statistics by one
*
* @param stats Statistics to add to
* @param thread_id ID of thread
*/
void ts_stats_increment(ts_stats_t stats, int thread_id);
/**
* @brief Assign a value to a statistics element
*
* This sets the value for the specified thread.
*
* @param stats Statistics to set
* @param value Value to set to
* @param thread_id ID of thread
*/
void ts_stats_set(ts_stats_t stats, int value, int thread_id);
/**
* @brief Assign the maximum value to a statistics element
*
* This sets the value for the specified thread if the current value is smaller.
*
* @param stats Statistics to set
* @param value Value to set to
* @param thread_id ID of thread
*/
void ts_stats_set_max(ts_stats_t stats, int value, int thread_id);
/**
* @brief Assign the minimum value to a statistics element
*
* This sets the value for the specified thread if the current value is larger.
*
* @param stats Statistics to set
* @param value Value to set to
* @param thread_id ID of thread
*/
void ts_stats_set_min(ts_stats_t stats, int value, int thread_id);
MXS_END_DECLS
| 23.872549 | 80 | 0.707187 | [
"object"
] |
77ce571abba8db3c1bce45eaf4df29d424c5132c | 8,075 | h | C | Source/UnitTests/TestUtils.h | Adelost/AberrantEngine | 1282bfd1aaae6b197253ab6c2a1e7878e84ac769 | [
"CC-BY-4.0"
] | null | null | null | Source/UnitTests/TestUtils.h | Adelost/AberrantEngine | 1282bfd1aaae6b197253ab6c2a1e7878e84ac769 | [
"CC-BY-4.0"
] | null | null | null | Source/UnitTests/TestUtils.h | Adelost/AberrantEngine | 1282bfd1aaae6b197253ab6c2a1e7878e84ac769 | [
"CC-BY-4.0"
] | null | null | null | #pragma once
#include <Utils/UnitTest.h>
#include <Utils/Console.h>
#include <Utils/Array.h>
using namespace ae;
#include <Utils/IndexableContainer.h>
TEST_CASE("Custom container")
{
IndexableContainer<int> c;
}
TEST_CASE("Array")
{
Array<int> a;
a << 0 << 1 << 2 << 3 << 4;
SECTION("add()")
{
REQUIRE(a.count() == 5);
REQUIRE(a[0] == 0);
REQUIRE(a[4] == 4);
}
SECTION("removeAt()")
{
a.removeAt(0);
REQUIRE(a.count() == 4);
REQUIRE(a[0] == 1);
REQUIRE(a[3] == 4);
}
SECTION("addAt()")
{
a.addAt(0, -1);
REQUIRE(a.count() == 6);
REQUIRE(a[0] == -1);
REQUIRE(a[5] == 4);
}
SECTION("Iterator")
{
int total = 0;
for (int i : a)
total += i;
REQUIRE(total == 10);
for (auto it = a.begin(); it != a.end(); ++it)
total += *it;
REQUIRE(total == 20);
}
SECTION("deep copy")
{
Array<int> b = a;
a.clear();
int total;
total = 0;
for (int i : a)
total += i;
REQUIRE(total == 0);
total = 0;
for (int i : b)
total += i;
REQUIRE(total == 10);
}
}
#include <Utils/List.h>
TEST_CASE("List")
{
List<int> l;
l.resize(1);
}
//#include <Utils/Random.h>
//#include <Utils/Algorithm.h>
//TEST_CASE("Random")
//{
// SECTION("next()")
// {
// REQUIRE(Random::next(1) == 0);
// REQUIRE(Random::nextUniform(0, 0) == 0);
// REQUIRE(Algorithm::any(Random::nextBool(), false, true));
//
// float f;
// f = Random::nextFloat();
// REQUIRE(f >= 0.0f);
// REQUIRE(f <= 1.0f);
// f = Random::nextFloat(0.0f, 0.0f);
// REQUIRE(f == 0.0f);
// };
//
// SECTION("rand max()")
// {
// REQUIRE(Random::next(1) == 0);
// REQUIRE(Random::nextUniform(0, 0) == 0);
// REQUIRE(Algorithm::any(Random::nextBool(), false, true));
//
// float f;
// f = Random::nextFloat();
// REQUIRE(f >= 0.0f);
// REQUIRE(f <= 1.0f);
// f = Random::nextFloat(0.0f, 0.0f);
// REQUIRE(f == 0.0f);
// };
//
// SECTION("initSeed()")
// {
// int seed = Random::next(100);
// Random::setSeed(seed);
// int r1 = Random::next(100);
// Random::setSeed(seed);
// int r2 = Random::next(100);
// REQUIRE(r1 == r2);
// };
//}
//
//#include <Utils/Algorithm.h>
//
//TEST_CASE("Algorithm")
//{
// SECTION("reordering")
// {
// Array<int> a;
// a << 0 << 1 << 2;
//
// SECTION("shuffle()")
// {
// Algorithm::shuffle(a.raw(), a.count());
// }
//
// SECTION("sort()")
// {
// a << 4 << -1;
// Algorithm::sort(a.raw(), a.count());
// REQUIRE(a.first() == -1);
// REQUIRE(a.last() == 4);
// }
//
// SECTION("stableSort()")
// {
// a << 4 << -1;
// Algorithm::stableSort(a.raw(), a.count());
// REQUIRE(a.first() == -1);
// REQUIRE(a.last() == 4);
// }
// }
//
// SECTION("maximum()")
// {
// REQUIRE(Algorithm::maximum(1) == 1);
// REQUIRE(Algorithm::maximum(1, 2) == 2);
// REQUIRE(Algorithm::maximum(2, 1) == 2);
// REQUIRE(Algorithm::maximum(1, 2, 3) == 3);
// REQUIRE(Algorithm::maximum(2, 3, 1) == 3);
// REQUIRE(Algorithm::maximum(3, 1, 2) == 3);
// }
//
// SECTION("any()")
// {
// REQUIRE(Algorithm::any(std::string("a"), "b", "c", "a"));
// REQUIRE(Algorithm::any(std::string("a"), "b", "c", "d") == false);
//
// REQUIRE(Algorithm::any("a", "a"));
// REQUIRE(Algorithm::any("a", "b") == false);
// REQUIRE(Algorithm::any("a", "b", "a", "c"));
// REQUIRE(Algorithm::any("a", "b", "c", "a"));
// REQUIRE(Algorithm::any("a", "b", "c", "d") == false);
//
// REQUIRE(Algorithm::any(2, 1, 2, 3));
// REQUIRE(Algorithm::any(2, 1, 3) == false);
// }
//}
//
//#include <Utils/StablePoolArray.h>
//
//TEST_CASE("StablePoolArray")
//{
// StablePoolArray<int> a;
//
// SECTION("add")
// {
// a.add(0);
// a.add(1);
//
// REQUIRE(a[1] == 1);
//
// a.add(2);
// a.remove(1);
// a.add(3);
//
// REQUIRE(a[1] == 3);
// }
//
// SECTION("Iterator")
// {
// a.add(1);
// a.add(2);
// a.add(3);
//
// int total = 0;
// for (int i : a)
// total += i;
//
// REQUIRE(total == 6);
// }
//}
//
//#include <Utils/IdPoolArray.h>
//
//TEST_CASE("IdPoolArray")
//{
// IdPoolArray<int> a;
//
// SECTION("add()")
// {
// REQUIRE(a[0] == nullptr);
//
// a.add(0, 0);
//
// REQUIRE(a[0]);
// REQUIRE(*a[0] == 0);
//
// a.add(0, 1);
// a.add(1, 1);
// a.add(2, 2);
//
// REQUIRE(*a[0] == 1);
// REQUIRE(*a[2] == 2);
//
// a.count();
// }
//
// SECTION("Iterator")
// {
// a.add(0, 1);
// a.add(1, 2);
// a.add(2, 3);
//
// int total = 0;
//
// for (auto i : a)
// total += *i;
//
// REQUIRE(total == 6);
// }
//}
//
//#include <Utils/PoolPtr.h>
//
//TEST_CASE("PoolPtr")
//{
// SECTION("single object allocation")
// {
// PoolPtr<int> p = 42;
//
// REQUIRE(*p == 42);
//
// p.release();
// }
//
// SECTION("array allocation")
// {
// Array<PoolPtr<int>> a;
// a << 0 << 1 << 2 << 3 << 4;
//
// int total = 0;
// for (PoolPtr<int> i : a)
// total += *i;
//
// REQUIRE(total == 10);
//
// for (PoolPtr<int> i : a)
// i.release();
// }
//}
//
//#include <Utils/Format.h>
//
//TEST_CASE("string formatting")
//{
// SECTION("maches found")
// {
// std::string s;
//
// s = Format::string("%1, %2, %4, %3, %1")
// % "text"
// % 42
// % 3.14f
// % true;
//
// REQUIRE(s == "text, 42, true, 3.14, text");
// }
//
// SECTION("no matches found")
// {
// std::string s;
//
// s = Format::string("")
// % "text";
//
// REQUIRE(s == "");
//
// s = Format::string("%a %b %c")
// % "text";
//
// REQUIRE(s == "%a %b %c");
// }
//}
//
//#include <Utils/Inspectable.h>
//
//class InspectExample : Inspectable
//{
//public:
// INSPECTABLE
// ("InspectExample",
// MEMBER(Member::Int, m_int, "MyInt")
// MEMBER(Member::Bool, m_bool, "MyBool")
// MEMBER_AUTONAMED(Member::Float, m_float)
// )
//
// InspectExample()
// {
// m_int = 42;
// m_bool = true;
// m_float = 3.14f;
// }
//
//private:
// int m_int;
// bool m_bool;
// float m_float;
//};
//
//TEST_CASE("introspection")
//{
// InspectExample i;
//
// REQUIRE(i.inspect().name() == "InspectExample");
// REQUIRE(i.inspect().member("MyBool")->valueAsString() == "true");
// REQUIRE(i.inspect().member("m_float")->valueAsString() == "3.14");
//
// Member* m = i.inspect().member("MyInt");
//
// REQUIRE(m->valueAsString() == "42");
// REQUIRE(m->typeName() == "Int");
// REQUIRE(m->type() == Member::Int);
// REQUIRE(m->value<int>() == 42);
//
// std::string values;
// for (Member* m : i.inspect())
// values += m->valueAsString() + " ";
//
// REQUIRE(values == "42 true 3.14 ");
//}
//
//TEST_CASE("messages")
//{
//}
//
//#include <Utils/StringRef.h>
//
//TEST_CASE("StringRef")
//{
// SECTION("compare")
// {
// std::string s = "ab";
//
// StringRef ab(&s);
// StringRef a(&s, 0, 1);
// StringRef b(&s, 1, 1);
//
// REQUIRE(ab == s);
// REQUIRE(a != s);
//
// REQUIRE(ab != "a");
// REQUIRE(ab != "abc");
// REQUIRE(ab == "ab");
//
// REQUIRE(a == a);
// REQUIRE(a == "a");
// REQUIRE("a" == a);
//
// REQUIRE(a != b);
// REQUIRE(a != "b");
// REQUIRE("a" != b);
//
// REQUIRE(a < b);
// REQUIRE(a < "b");
// REQUIRE("a" < b);
//
// REQUIRE(b > a);
// REQUIRE(b > "a");
// REQUIRE("b" > a);
// }
//}
//
////#include <Utils/CppParser.h>
////
////TEST_CASE("CppParser")
////{
//// std::string in = "abc\"/*abc*/\"/*ab\nc*/";
//// CppParser parser(in);
////
//// //CppParser parse;
////}
//
//
//#include <Utils/PoolAllocator.h>
//
//TEST_CASE("CppParser")
//{
// //PoolAllocator<int> p;
//
// //p.add(1);
// //p.
// //CppParser parse;
//}
//
//template <class T>
//class PoolObject
//{
//public:
// PoolObject()
// {
// }
//
// void* operator new(size_t size)
// {
// //m_storage = T();
//
// //return &(*s_storage);
// return nullptr;
// }
// void operator delete(void* p)
// {
// }
// void* operator new[](size_t size)
// {
// }
// void operator delete[](void* p)
// {
// }
//
//private:
// //static PoolPtr<PoolObject> s_storage;
//};
//
////template <class T>
////PoolPtr<T> PoolObject::s_storage;
//
//class Allan : public PoolObject<Allan>
//{
//public:
// Allan()
// {
// i = 0;
// }
//
//private:
// int i;
// int y;
//};
//
//TEST_CASE("Alloc")
//{
// Allan* a = new Allan();
// Console::print() << "Hello";
//}
//
//
//
//
//
//
//
//
//
//
//
| 16.247485 | 70 | 0.500929 | [
"object"
] |
77d0ea2f024caf2530e269810af48d70b127d211 | 9,503 | h | C | es/ESCell.h | Yacoby/mw-mesh-gen | acc7c3e91c231361bd593211bd7c90c26cfc44ae | [
"Unlicense"
] | 1 | 2017-08-25T04:09:57.000Z | 2017-08-25T04:09:57.000Z | es/ESCell.h | Yacoby/mw-mesh-gen | acc7c3e91c231361bd593211bd7c90c26cfc44ae | [
"Unlicense"
] | null | null | null | es/ESCell.h | Yacoby/mw-mesh-gen | acc7c3e91c231361bd593211bd7c90c26cfc44ae | [
"Unlicense"
] | 3 | 2016-05-02T17:42:07.000Z | 2021-03-08T03:54:30.000Z | /*_LICENCE_BLOCK_
------------------------------------------------------------------
This source file is part of Morrowind Remake
Copyright (c) 2007 Jacob Essex
Also see acknowledgements in the readme
Morrowind Remake is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Morrowind Remake is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA, or go to
http://www.gnu.org/licenses/gpl.txt
------------------------------------------------------------------
_LICENCE_BLOCK_*/
#ifndef _ESCELL_H_
#define _ESCELL_H_
#include "ESRecord.h"
#include "ESRecordSectionLoader.h"
#include "ESSubString.h"
#include "ESSubFloat.h"
#include "ESSubCellData.h"
#include "ESSubCellFRMR.h"
#include "ESSubAmbi.h"
namespace ES3{
class ESCellListener{
public:
virtual void FRMRAdded(ESSubCellFRMRRef ref) = 0;
};
class ESCell;
typedef ESRef<ESCell> ESCellRef;
/**
* Contains all data releating to a cell...
*/
class ESCell : public ESRecordSectionLoader{
private:
ESSubLong mColour;
ESSubString mCellName;
///Contains data about the cell, e.g. region, gridx, gridy ...
ESSubCellData mCellData;
///Region
ESSubString mRegn;
///Water height
ESSubFloat mWaterHeight;
///Light data
ESSubAmbi mAmbiData;
std::map<unsigned, ESSubCellFRMRRef>::iterator refIter;
/**
* Data on every ref in the cell
* \todo Change to map?
*/
std::map<unsigned, ESSubCellFRMRRef> mCellESRef;
//std::vector<ESSubCellFRMR*> mCellESRef;
/**
* the mutex lock for all the data.
* \todo Split this up into segments
*/
// boost::mutex mMutexAllData;
/**
* Stores the offset of the point in the file where the frmrecords start
*/
//long mFRMRStartOffset;
//long mFRMREndOffset;
/**
* Loads the cell frm records.
*/
/*
bool doThreadLoad(){
if ( mDataStart == -1 ) //obviously no FRMRs found.
return false;
boost::mutex::scoped_lock scoped_lock(mMutexAllData);
//go to the place in the file
std::ifstream ifs(mFileName.c_str(), std::ios::in | std::ios::binary);
ifs.seekg(mDataStart);
ESSubCellFRMRRef newCellESRef = NULL;
while ( ifs.tellg() < mDataEnd ){
char dataType[5];
ifs.read(dataType, 4);
//string must be null terminated.
dataType[4] = '\0';
if ( strcmp(dataType, "FRMR") == 0){
if ( newCellESRef != NULL ){
mCellESRef[newCellESRef->getFRMR()] = newCellESRef;
}
newCellESRef = new ESSubCellFRMR;
}
if ( strcmp(dataType, "FRMR") == 0)
newCellESRef->mFRMR.read(ifs);
else if ( strcmp(dataType, "NAME") == 0)
newCellESRef->mName.read(ifs);
else if ( strcmp(dataType, "XSCL") == 0)
newCellESRef->mScale.read(ifs);
else if ( strcmp(dataType, "DELE") == 0)
newCellESRef->mDel.read(ifs);
else if ( strcmp(dataType, "DATA") == 0)
newCellESRef->mPos.read(ifs);
else
handelUnknownRecord(ifs);
}
//add the last cell record...
if ( newCellESRef != NULL ){
mCellESRef[newCellESRef->getFRMR()] = newCellESRef;
}
ifs.close();
return true;
}
*/
ESCellListener* mClass;
public:
ESCell(){
mClass = NULL;
}
~ESCell(){
//boost::mutex::scoped_lock scoped_lock(mMutexAllData);
//for ( unsigned i = 0; i < mCellESRef.size(); i++ ){
// delete mCellESRef[i];
//}
}
/**
* Use this to define a function to be called when a FRMR is read
* I dunno. May be usefull.
*/
void setFRMRLoadListener(ESCellListener* c){
mClass = c;
//mFRMRListener = fp;
//mClass = c;
}
std::string getRegn(){ return mRegn.get();}
long getNAM0(){return mColour.get();}
bool loadSection(float amount){
if ( !mIsSectionLoading )
loadSectionStart();
#ifdef _DEBUG
if ( amount < 0 ) //this should NEVER happen
return false;
#endif
if ( mDataStart == -1 ) //obviously no FRMRs found.
return loadSectionEnd(); //loaded as much as we can
if ( mDataReadTo == mDataEnd )//loaded everything
return loadSectionEnd();
long amountToLoad = (long) (( mDataEnd - mDataStart ) * (float)( amount / 100 ));
if ( amountToLoad < 1 )
amountToLoad = 1;
long readTo = mDataReadTo + amountToLoad;
if ( readTo > mDataEnd )
readTo = mDataEnd;
if ( amount >= 100 )
readTo = mDataEnd;
mAmountLoaded += amount;
//--------------------------------
//Loading Section
//--------------------------------
ESSubCellFRMRRef newCellESRef = NULL;
while ( mDataStream->tellg() < mDataEnd ){
char dataType[5];
mDataStream->read(dataType, 4);
//string must be null terminated.
dataType[4] = '\0';
mDataReadTo = mDataStream->tellg();
if ( strcmp(dataType, "FRMR") == 0){
if ( mDataStream->tellg() > readTo ){
mDataStream->seekg((long)mDataStream->tellg() - 4);
break;
}
if ( newCellESRef != NULL ){
if ( mClass )
//(*mFRMRListener)(newCellESRef);
//mFRMRListener->call(newCellESRef);
mClass->FRMRAdded(newCellESRef);
mCellESRef[newCellESRef->getFRMR()] = newCellESRef;
}
newCellESRef = new ESSubCellFRMR;
}
assert(newCellESRef);
if ( strcmp(dataType, "FRMR") == 0)
newCellESRef->mFRMR.read(*mDataStream);
else if ( strcmp(dataType, "NAME") == 0)
newCellESRef->mName.read(*mDataStream);
else if ( strcmp(dataType, "XSCL") == 0)
newCellESRef->mScale.read(*mDataStream);
else if ( strcmp(dataType, "DELE") == 0)
newCellESRef->mDel.read(*mDataStream);
else if ( strcmp(dataType, "DATA") == 0)
newCellESRef->mPos.read(*mDataStream);
else
handelUnknownRecord(*mDataStream);
}
//add the last cell record...
if ( newCellESRef != NULL ){
if ( mClass )
mClass->FRMRAdded(newCellESRef);
//mFRMRListener->call(newCellESRef);
//(*mFRMRListener)(newCellESRef);
mCellESRef[newCellESRef->getFRMR()] = newCellESRef;
}
mDataReadTo = mDataStream->tellg();
if ( mDataReadTo == mDataEnd )
return loadSectionEnd(); // aka reutrn true
return false;
}
void resetESRefItr(){
refIter = mCellESRef.begin();
}
bool refItrGood(){
if ( refIter == mCellESRef.end() )
return false;
if ( mCellESRef.begin() == mCellESRef.end() )
return false;
return true;
}
ESSubCellFRMRRef getNextESRef(){
if ( refIter == mCellESRef.end() )
return NULL;
ESSubCellFRMRRef ref = refIter->second;
refIter++;
return ref;
}
/**
* @return the number of refrances in the cell
*/
//unsigned getESRefBegin(){
// boost::mutex::scoped_lock scoped_lock(mMutexAllData);
// return (unsigned) mCellESRef.begin();
//}
//unsigned getESRefEnd(){
//}
/**
* @param index the FRMR of the record
* @return a ref with the FRMR of index
* \todo Make it return a readonly version of a cell ref? Not thread safe.
*/
/*
ESSubCellFRMR* getESRef(unsigned index){
boost::mutex::scoped_lock scoped_lock(mMutexAllData);
return mCellESRef.at(index);
}
*/
ESSubCellFRMR* getESRef(unsigned index){
// boost::mutex::scoped_lock scoped_lock(mMutexAllData);
return mCellESRef[index];
}
/**
* Adds a ref to the cell. Any ref with the same FRMR is overwriten
* @param ref the ref to add
*/
void addESRef(ESSubCellFRMR* ref){
if ( ref == NULL )
return;
//if ( (long)mCellESRef.size() < ref->getFRMR() + 1 ){
// mCellESRef.resize(ref->getFRMR() + 1, NULL);
//}
if ( mCellESRef.find(ref->getFRMR()) != mCellESRef.end() )
delete mCellESRef[ref->getFRMR()];
mCellESRef[ref->getFRMR()] = ref;
}
/**
* @return data relating to the cell. This includes grid data, interior, exterior etc
*/
ESSubCellData* getCellData(){
//boost::mutex::scoped_lock scoped_lock(mMutexAllData);
return &mCellData;
}
void setCellData(ESSubCellData &cellData){
//boost::mutex::scoped_lock scoped_lock(mMutexAllData);
mCellData = cellData ;
}
/**
* @return the water height of the cell
*/
float getWaterHeight(){ return mWaterHeight.get(); }
/**
* @param f the float to set the water heigth to
*/
void setWaterHeight(float f){ mWaterHeight.set(f); }
/**
* @return the lighting (ambinat) data for the current cell
*/
ESSubAmbi* getAmbiData(){ return &mAmbiData; }
/**
* @param &a the ambi data to set for the current cell
*/
void setAmbiData(ESSubAmbi &a){ mAmbiData = a; }
/**
* Returns the name of the cell. If the cell is an exterior, it doesn't have a name (0 length string is returned
*/
std::string getCellName(){
//boost::mutex::scoped_lock scoped_lock(mMutexAllData);
return mCellName.get();
}
/**
* Reads all the cell data excluding the FRMR records
*/
void read(std::ifstream &ifs, long recordSize);
};
}//namepsace
#endif
| 22.203271 | 113 | 0.625908 | [
"vector"
] |
77d3ade52bcd666a869088f35733cb8318e75f4d | 3,462 | h | C | app/android/jni/point_cloud_drawable.h | patrickelectric/rtabmap | 9fbd02b06d79ecc1564e3148201b50755795c290 | [
"BSD-3-Clause"
] | null | null | null | app/android/jni/point_cloud_drawable.h | patrickelectric/rtabmap | 9fbd02b06d79ecc1564e3148201b50755795c290 | [
"BSD-3-Clause"
] | null | null | null | app/android/jni/point_cloud_drawable.h | patrickelectric/rtabmap | 9fbd02b06d79ecc1564e3148201b50755795c290 | [
"BSD-3-Clause"
] | 2 | 2018-12-08T16:54:33.000Z | 2021-05-17T06:56:06.000Z | /*
Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
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 Universite de Sherbrooke nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TANGO_POINT_CLOUD_POINT_CLOUD_DRAWABLE_H_
#define TANGO_POINT_CLOUD_POINT_CLOUD_DRAWABLE_H_
#include <jni.h>
#include <tango-gl/util.h>
#include <vector>
#include <pcl/point_cloud.h>
#include <pcl/point_types.h>
#include <rtabmap/core/Transform.h>
#include <pcl/Vertices.h>
#include "util.h"
// PointCloudDrawable is responsible for the point cloud rendering.
class PointCloudDrawable {
public:
PointCloudDrawable(
GLuint cloudShaderProgram,
GLuint textureShaderProgram,
const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud);
PointCloudDrawable(
GLuint cloudShaderProgram,
GLuint textureShaderProgram,
const Mesh & mesh);
virtual ~PointCloudDrawable();
void updatePolygons(const std::vector<pcl::Vertices> & polygons);
void updateCloud(const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud);
void updateMesh(const Mesh & mesh);
void setPose(const rtabmap::Transform & pose);
void setVisible(bool visible) {visible_=visible;}
rtabmap::Transform getPose() const {return glmToTransform(pose_);}
bool isVisible() const {return visible_;}
// Update current point cloud data.
//
// @param projection_mat: projection matrix from current render camera.
// @param view_mat: view matrix from current render camera.
// @param model_mat: model matrix for this point cloud frame.
// @param vertices: all vertices in this point cloud frame.
void Render(const glm::mat4 & projectionMatrix, const glm::mat4 & viewMatrix, bool meshRendering = true, float pointSize = 3.0f, bool textureRendering = false);
private:
// Vertex buffer of the point cloud geometry.
GLuint vertex_buffers_;
GLuint textures_;
std::vector<GLushort> polygons_;
int nPoints_;
glm::mat4 pose_;
bool visible_;
GLuint cloud_shader_program_;
GLuint texture_shader_program_;
};
#endif // TANGO_POINT_CLOUD_POINT_CLOUD_DRAWABLE_H_
| 41.214286 | 162 | 0.771519 | [
"mesh",
"geometry",
"render",
"vector",
"model",
"transform"
] |
77d9ae3ab1512246a13b18a50e9b74b3cbc6a2df | 3,599 | h | C | XivAlexanderCommon/Utils_Win32.h | tkiapril/XivAlexander | 34e078f52b27c1fe76618ff849298ccb100181bc | [
"Apache-2.0"
] | null | null | null | XivAlexanderCommon/Utils_Win32.h | tkiapril/XivAlexander | 34e078f52b27c1fe76618ff849298ccb100181bc | [
"Apache-2.0"
] | null | null | null | XivAlexanderCommon/Utils_Win32.h | tkiapril/XivAlexander | 34e078f52b27c1fe76618ff849298ccb100181bc | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <span>
#include <vector>
#include <windef.h>
namespace Utils::Win32 {
void SetThreadDescription(HANDLE hThread, const std::wstring& description);
template <typename ... Args>
void SetThreadDescription(HANDLE hThread, const wchar_t* format, Args ... args) {
SetThreadDescription(hThread, std::format(format, std::forward<Args>(args)...));
}
template <typename ... Args>
void DebugPrint(const wchar_t* format, Args ... args) {
OutputDebugStringW(std::format(L"{}\n", std::format(format, std::forward<Args>(args)...)).c_str());
}
int MessageBoxF(HWND hWnd, UINT uType, const wchar_t* lpCaption, const std::wstring& text);
int MessageBoxF(HWND hWnd, UINT uType, const wchar_t* lpCaption, const std::string& text);
int MessageBoxF(HWND hWnd, UINT uType, const wchar_t* lpCaption, const wchar_t* text);
int MessageBoxF(HWND hWnd, UINT uType, const wchar_t* lpCaption, const char* text);
template <typename ... Args>
int MessageBoxF(HWND hWnd, UINT uType, const wchar_t* lpCaption, const wchar_t* format, Args ... args) {
return MessageBoxF(hWnd, uType, lpCaption, std::format(format, std::forward<Args>(args)...).c_str());
}
template <typename ... Args>
int MessageBoxF(HWND hWnd, UINT uType, const wchar_t* lpCaption, const char* format, Args ... args) {
return MessageBoxF(hWnd, uType, lpCaption, FromUtf8(std::format(format, std::forward<Args>(args)...)).c_str());
}
void SetMenuState(HMENU hMenu, DWORD nMenuId, bool bChecked, bool bEnabled);
std::string FormatWindowsErrorMessage(unsigned int errorCode);
std::pair<std::string, std::string> FormatModuleVersionString(void* pBlock);
std::pair<std::string, std::string> FormatModuleVersionString(const std::filesystem::path& path);
std::pair<std::string, std::string> FormatModuleVersionString(HMODULE hModule);
bool EnableTokenPrivilege(HANDLE hToken, LPCTSTR Privilege, bool bEnablePrivilege);
void AddDebugPrivilege();
bool IsUserAnAdmin();
std::filesystem::path GetMappedImageNativePath(HANDLE hProcess, void* lpMem);
std::filesystem::path ToNativePath(const std::filesystem::path& path);
struct RunProgramParams {
enum ElevateMode {
Normal,
Force,
NeverUnlessAlreadyElevated,
NeverUnlessShellIsElevated,
CancelIfRequired,
NoElevationIfDenied,
};
std::filesystem::path path;
std::filesystem::path dir;
std::wstring args;
bool wait = false;
ElevateMode elevateMode = Normal;
bool throwOnCancel = false;
};
bool RunProgram(RunProgramParams params);
std::wstring GetCommandLineWithoutProgramName();
std::wstring ReverseCommandLineToArgv(const std::wstring& argv);
std::wstring ReverseCommandLineToArgv(const std::span<const std::wstring>& argv);
std::wstring ReverseCommandLineToArgv(const std::initializer_list<const std::wstring>& argv);
std::string ReverseCommandLineToArgv(const std::string& argv);
std::string ReverseCommandLineToArgv(const std::span<const std::string>& argv);
std::string ReverseCommandLineToArgv(const std::initializer_list<const std::string>& argv);
std::vector<DWORD> GetProcessList();
class Error : public std::runtime_error {
const int m_nErrorCode;
public:
Error(int errorCode, const std::string& msg);
explicit Error(const std::string& msg);
template<typename ... Args>
Error(const char* format, Args...args)
: Error(std::format(format, std::forward<Args>(args)...)) {
}
template<typename ... Args>
Error(int errorCode, const char* format, Args...args)
: Error(errorCode, std::format(format, std::forward<Args>(args)...)) {
}
[[nodiscard]] int Code() const;
};
}
| 36.353535 | 113 | 0.734926 | [
"vector"
] |
77da10603e58754a2a73cdf73f25f27720d3eb86 | 2,544 | h | C | src/xray/editor/world/sources/particle_node_properties.h | ixray-team/ixray-2.0 | 85c3a544175842323fc82f42efd96c66f0fc5abb | [
"Linux-OpenIB"
] | 3 | 2021-10-30T09:36:14.000Z | 2022-03-26T17:00:06.000Z | src/xray/editor/world/sources/particle_node_properties.h | acidicMercury8/ixray-2.0 | 85c3a544175842323fc82f42efd96c66f0fc5abb | [
"Linux-OpenIB"
] | null | null | null | src/xray/editor/world/sources/particle_node_properties.h | acidicMercury8/ixray-2.0 | 85c3a544175842323fc82f42efd96c66f0fc5abb | [
"Linux-OpenIB"
] | 1 | 2022-03-26T17:00:08.000Z | 2022-03-26T17:00:08.000Z | ////////////////////////////////////////////////////////////////////////////
// Created : 30.01.2010
// Author : Evgeniy Obertyukh
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////
#ifndef PARTICLE_NODE_TYPE_H_INCLUDED
#define PARTICLE_NODE_TYPE_H_INCLUDED
#include "float_curve.h"
using namespace System::ComponentModel;
namespace xray {
namespace editor {
// public delegate void particle_property_changed(particle_graph_node^ node);
ref struct particle_node_properties
{
public:
particle_node_properties(particle_graph_node^ owner)
{
type = "";
name = "";
m_length_time = 600;
m_start_time = 0;
m_length_time_pos = m_start_time + m_length_time;
m_owner = owner;
fc = gcnew xray::editor::float_curve();
}
particle_node_properties(particle_graph_node^ owner ,String^ set_type, String^ set_name)
{
type = set_type;
name = set_name;
m_length_time = 600;
m_start_time = 0;
m_length_time_pos = m_start_time + m_length_time;
m_owner = owner;
}
private:
int m_start_time;
int m_length_time;
int m_length_time_pos;
particle_node_properties^ my_old_version;
bool m_transaction_active;
private:
void set_new_start_time(int value);
void set_start_time_impl(int value);
void set_length_time_impl(int value);
public:
void set_start_length_offsets(int offset);
void start_transaction();
void end_transaction();
public:
// event particle_property_changed^ on_property_changed;
[ReadOnlyAttribute(true)]
property String^ type;
[ReadOnlyAttribute(true)]
property String^ name;
[DisplayNameAttribute("fc"), DescriptionAttribute("object fc"), CategoryAttribute("general"),
ReadOnlyAttribute(false), MergablePropertyAttribute(false)]
property xray::editor::float_curve^ fc;
property int start_time{
int get(){return m_start_time;}
void set(int value){set_start_time_impl(value);}
};
property int length_time{
int get(){return m_length_time;}
void set(int value){set_length_time_impl(value);}
};
[Browsable(false)]
property particle_graph_node^ m_owner;
[Browsable(false)]
property int time_limit;
}; // class particle_node_type
}; //namespace editor
}; //namespace xray
#endif // #ifndef PARTICLE_NODE_TYPE_H_INCLUDED | 28.58427 | 98 | 0.631682 | [
"object"
] |
77dc85cfa973aea676e6dca97c3ece8571ed3429 | 473 | h | C | gpu_basics/Partition.h | jdinkla/parallel2015_gpucomputing | 15654399897d891637bb466bcca0e5aa73c22fce | [
"MIT"
] | 1 | 2020-03-13T18:40:07.000Z | 2020-03-13T18:40:07.000Z | gpu_basics/Partition.h | jdinkla/parallel2015_gpucomputing | 15654399897d891637bb466bcca0e5aa73c22fce | [
"MIT"
] | 1 | 2019-06-09T14:33:31.000Z | 2019-06-18T20:35:30.000Z | gpu_basics/Partition.h | jdinkla/parallel2015_gpucomputing | 15654399897d891637bb466bcca0e5aa73c22fce | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2015 by Joern Dinkla, www.dinkla.com, All rights reserved.
*
* See the LICENSE file in the root directory.
*/
#pragma once
template <class Framework, class Data>
struct Partition
{
int partition_id;
Framework framework;
Data data;
};
#ifdef COMPILING_FOR_CUDA
struct CudaPartition1D
{
int partition_id;
int device_id;
cudaStream_t stream; // not reusable for OpenCL, AMP
int start; // not reusable for 2D, 3D, etc.
int end;
};
#endif
| 17.518519 | 74 | 0.718816 | [
"3d"
] |
77df3d167f72f9e343e6b37c7fc2bd7887366956 | 937 | h | C | lib/djvMath/NumericValueModels.h | pafri/DJV | 9db15673b6b03ad3743f57119118261b1fbe8810 | [
"BSD-3-Clause"
] | null | null | null | lib/djvMath/NumericValueModels.h | pafri/DJV | 9db15673b6b03ad3743f57119118261b1fbe8810 | [
"BSD-3-Clause"
] | null | null | null | lib/djvMath/NumericValueModels.h | pafri/DJV | 9db15673b6b03ad3743f57119118261b1fbe8810 | [
"BSD-3-Clause"
] | null | null | null | // SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2004-2020 Darby Johnston
// All rights reserved.
#pragma once
#include <djvMath/INumericValueModel.h>
namespace djv
{
namespace Math
{
//! This class provides an integer number model.
class IntValueModel : public INumericValueModel<int>
{
DJV_NON_COPYABLE(IntValueModel);
protected:
void _init();
IntValueModel();
public:
static std::shared_ptr<IntValueModel> create();
};
//! This class provides a floating-point number model.
class FloatValueModel : public INumericValueModel<float>
{
DJV_NON_COPYABLE(FloatValueModel);
protected:
void _init();
FloatValueModel();
public:
static std::shared_ptr<FloatValueModel> create();
};
} // namespace Math
} // namespace djv
| 22.853659 | 64 | 0.596585 | [
"model"
] |
77e1f9c9b7f5e6f28de73eb3d23213f329536b59 | 12,812 | c | C | source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c | arubertoson/blender | 9d3550d7819807064dd39365322295ebd8ea0a09 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | 1 | 2020-09-23T21:30:18.000Z | 2020-09-23T21:30:18.000Z | source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c | arubertoson/blender | 9d3550d7819807064dd39365322295ebd8ea0a09 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | source/blender/gpencil_modifiers/intern/MOD_gpencilmultiply.c | arubertoson/blender | 9d3550d7819807064dd39365322295ebd8ea0a09 | [
"Naumen",
"Condor-1.1",
"MS-PL"
] | null | null | null | /*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2017, Blender Foundation
* This is a new part of Blender
*/
/** \file
* \ingroup modifiers
*/
#include <stdio.h>
#include "MEM_guardedalloc.h"
#include "DNA_gpencil_modifier_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "BLI_alloca.h"
#include "BLI_blenlib.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "BLI_rand.h"
#include "BLI_utildefines.h"
#include "BLT_translation.h"
#include "BKE_collection.h"
#include "BKE_context.h"
#include "BKE_global.h"
#include "BKE_gpencil.h"
#include "BKE_gpencil_geom.h"
#include "BKE_gpencil_modifier.h"
#include "BKE_layer.h"
#include "BKE_lib_query.h"
#include "BKE_main.h"
#include "BKE_mesh.h"
#include "BKE_mesh_mapping.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_scene.h"
#include "BKE_screen.h"
#include "bmesh.h"
#include "bmesh_tools.h"
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
#include "UI_interface.h"
#include "UI_resources.h"
#include "RNA_access.h"
#include "MOD_gpencil_modifiertypes.h"
#include "MOD_gpencil_ui_common.h"
#include "MOD_gpencil_util.h"
static void initData(GpencilModifierData *md)
{
MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)md;
mmd->duplications = 3;
mmd->distance = 0.1f;
mmd->split_angle = DEG2RADF(1.0f);
mmd->fading_center = 0.5f;
mmd->fading_thickness = 0.5f;
mmd->fading_opacity = 0.5f;
mmd->material = NULL;
}
static void copyData(const GpencilModifierData *md, GpencilModifierData *target)
{
BKE_gpencil_modifier_copydata_generic(md, target);
}
static void minter_v3_v3v3v3_ref(
float *result, float *prev, float *curr, float *next, float *stroke_normal)
{
float vec[3], inter1[3], inter2[3];
ARRAY_SET_ITEMS(inter1, 0.0f, 0.0f, 0.0f);
ARRAY_SET_ITEMS(inter2, 0.0f, 0.0f, 0.0f);
float minter[3];
if (prev) {
sub_v3_v3v3(vec, curr, prev);
cross_v3_v3v3(inter1, stroke_normal, vec);
}
if (next) {
sub_v3_v3v3(vec, next, curr);
cross_v3_v3v3(inter2, stroke_normal, vec);
}
if (!prev) {
normalize_v3(inter2);
copy_v3_v3(result, inter2);
return;
}
if (!next) {
normalize_v3(inter1);
copy_v3_v3(result, inter1);
return;
}
interp_v3_v3v3(minter, inter1, inter2, 0.5);
normalize_v3(minter);
copy_v3_v3(result, minter);
}
static void duplicateStroke(Object *ob,
bGPDstroke *gps,
int count,
float dist,
float offset,
ListBase *results,
int fading,
float fading_center,
float fading_thickness,
float fading_opacity)
{
int i;
bGPDstroke *new_gps = NULL;
float stroke_normal[3];
bGPDspoint *pt;
float thickness_factor;
float opacity_factor;
/* Apply object scale to offset distance. */
offset *= mat4_to_scale(ob->obmat);
BKE_gpencil_stroke_normal(gps, stroke_normal);
if (len_v3(stroke_normal) < FLT_EPSILON) {
add_v3_fl(stroke_normal, 1);
normalize_v3(stroke_normal);
}
float *t1_array = MEM_callocN(sizeof(float[3]) * gps->totpoints,
"duplicate_temp_result_array_1");
float *t2_array = MEM_callocN(sizeof(float[3]) * gps->totpoints,
"duplicate_temp_result_array_2");
pt = gps->points;
for (int j = 0; j < gps->totpoints; j++) {
float minter[3];
if (j == 0) {
minter_v3_v3v3v3_ref(minter, NULL, &pt[j].x, &pt[j + 1].x, stroke_normal);
}
else if (j == gps->totpoints - 1) {
minter_v3_v3v3v3_ref(minter, &pt[j - 1].x, &pt[j].x, NULL, stroke_normal);
}
else {
minter_v3_v3v3v3_ref(minter, &pt[j - 1].x, &pt[j].x, &pt[j + 1].x, stroke_normal);
}
mul_v3_fl(minter, dist);
add_v3_v3v3(&t1_array[j * 3], &pt[j].x, minter);
sub_v3_v3v3(&t2_array[j * 3], &pt[j].x, minter);
}
/* This ensures the original stroke is the last one
* to be processed, since we duplicate its data. */
for (i = count - 1; i >= 0; i--) {
if (i != 0) {
new_gps = BKE_gpencil_stroke_duplicate(gps, true);
BLI_addtail(results, new_gps);
}
else {
new_gps = gps;
}
pt = new_gps->points;
float offset_fac = (count == 1) ? 0.5f : (i / (float)(count - 1));
if (fading) {
thickness_factor = interpf(1.0f - fading_thickness, 1.0f, fabsf(offset_fac - fading_center));
opacity_factor = interpf(1.0f - fading_opacity, 1.0f, fabsf(offset_fac - fading_center));
}
for (int j = 0; j < new_gps->totpoints; j++) {
float fac = interpf(1 + offset, offset, offset_fac);
interp_v3_v3v3(&pt[j].x, &t1_array[j * 3], &t2_array[j * 3], fac);
if (fading) {
pt[j].pressure = gps->points[j].pressure * thickness_factor;
pt[j].strength = gps->points[j].strength * opacity_factor;
}
}
}
/* Calc geometry data. */
if (new_gps != NULL) {
BKE_gpencil_stroke_geometry_update(new_gps);
}
MEM_freeN(t1_array);
MEM_freeN(t2_array);
}
static void bakeModifier(Main *UNUSED(bmain),
Depsgraph *UNUSED(depsgraph),
GpencilModifierData *md,
Object *ob)
{
bGPdata *gpd = ob->data;
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
ListBase duplicates = {0};
MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)md;
bGPDstroke *gps;
for (gps = gpf->strokes.first; gps; gps = gps->next) {
if (!is_stroke_affected_by_modifier(ob,
mmd->layername,
mmd->material,
mmd->pass_index,
mmd->layer_pass,
1,
gpl,
gps,
mmd->flag & GP_MIRROR_INVERT_LAYER,
mmd->flag & GP_MIRROR_INVERT_PASS,
mmd->flag & GP_MIRROR_INVERT_LAYERPASS,
mmd->flag & GP_MIRROR_INVERT_MATERIAL)) {
continue;
}
if (mmd->duplications > 0) {
duplicateStroke(ob,
gps,
mmd->duplications,
mmd->distance,
mmd->offset,
&duplicates,
mmd->flags & GP_MULTIPLY_ENABLE_FADING,
mmd->fading_center,
mmd->fading_thickness,
mmd->fading_opacity);
}
}
if (!BLI_listbase_is_empty(&duplicates)) {
BLI_movelisttolist(&gpf->strokes, &duplicates);
}
}
}
}
/* -------------------------------- */
static void generate_geometry(GpencilModifierData *md, Object *ob, bGPDlayer *gpl, bGPDframe *gpf)
{
MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)md;
bGPDstroke *gps;
ListBase duplicates = {0};
for (gps = gpf->strokes.first; gps; gps = gps->next) {
if (!is_stroke_affected_by_modifier(ob,
mmd->layername,
mmd->material,
mmd->pass_index,
mmd->layer_pass,
1,
gpl,
gps,
mmd->flag & GP_MIRROR_INVERT_LAYER,
mmd->flag & GP_MIRROR_INVERT_PASS,
mmd->flag & GP_MIRROR_INVERT_LAYERPASS,
mmd->flag & GP_MIRROR_INVERT_MATERIAL)) {
continue;
}
if (mmd->duplications > 0) {
duplicateStroke(ob,
gps,
mmd->duplications,
mmd->distance,
mmd->offset,
&duplicates,
mmd->flags & GP_MULTIPLY_ENABLE_FADING,
mmd->fading_center,
mmd->fading_thickness,
mmd->fading_opacity);
}
}
if (!BLI_listbase_is_empty(&duplicates)) {
BLI_movelisttolist(&gpf->strokes, &duplicates);
}
}
/* Generic "generateStrokes" callback */
static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Object *ob)
{
Scene *scene = DEG_get_evaluated_scene(depsgraph);
bGPdata *gpd = (bGPdata *)ob->data;
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
bGPDframe *gpf = BKE_gpencil_frame_retime_get(depsgraph, scene, ob, gpl);
if (gpf == NULL) {
continue;
}
generate_geometry(md, ob, gpl, gpf);
}
}
static void foreachIDLink(GpencilModifierData *md, Object *ob, IDWalkFunc walk, void *userData)
{
MultiplyGpencilModifierData *mmd = (MultiplyGpencilModifierData *)md;
walk(userData, ob, (ID **)&mmd->material, IDWALK_CB_USER);
}
static void panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
uiLayoutSetPropSep(layout, true);
uiItemR(layout, ptr, "duplicates", 0, NULL, ICON_NONE);
col = uiLayoutColumn(layout, false);
uiLayoutSetActive(layout, RNA_int_get(ptr, "duplicates") > 0);
uiItemR(col, ptr, "distance", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "offset", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
gpencil_modifier_panel_end(layout, ptr);
}
static void fade_header_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
uiItemR(layout, ptr, "use_fade", 0, NULL, ICON_NONE);
}
static void fade_panel_draw(const bContext *UNUSED(C), Panel *panel)
{
uiLayout *col;
uiLayout *layout = panel->layout;
PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, NULL);
uiLayoutSetPropSep(layout, true);
uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_fade"));
col = uiLayoutColumn(layout, false);
uiItemR(col, ptr, "fading_center", 0, NULL, ICON_NONE);
uiItemR(col, ptr, "fading_thickness", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
uiItemR(col, ptr, "fading_opacity", UI_ITEM_R_SLIDER, NULL, ICON_NONE);
}
static void mask_panel_draw(const bContext *UNUSED(C), Panel *panel)
{
gpencil_modifier_masking_panel_draw(panel, true, false);
}
static void panelRegister(ARegionType *region_type)
{
PanelType *panel_type = gpencil_modifier_panel_register(
region_type, eGpencilModifierType_Multiply, panel_draw);
gpencil_modifier_subpanel_register(
region_type, "fade", "", fade_header_draw, fade_panel_draw, panel_type);
gpencil_modifier_subpanel_register(
region_type, "mask", "Influence", NULL, mask_panel_draw, panel_type);
}
GpencilModifierTypeInfo modifierType_Gpencil_Multiply = {
/* name */ "MultipleStrokes",
/* structName */ "MultiplyGpencilModifierData",
/* structSize */ sizeof(MultiplyGpencilModifierData),
/* type */ eGpencilModifierTypeType_Gpencil,
/* flags */ 0,
/* copyData */ copyData,
/* deformStroke */ NULL,
/* generateStrokes */ generateStrokes,
/* bakeModifier */ bakeModifier,
/* remapTime */ NULL,
/* initData */ initData,
/* freeData */ NULL,
/* isDisabled */ NULL,
/* updateDepsgraph */ NULL,
/* dependsOnTime */ NULL,
/* foreachObjectLink */ NULL,
/* foreachIDLink */ foreachIDLink,
/* foreachTexLink */ NULL,
/* panelRegister */ panelRegister,
};
| 31.870647 | 99 | 0.601233 | [
"geometry",
"object"
] |
77e3f3e5af85e052e484af1a38d01b1ec7867c8d | 595 | h | C | gifbuilder/src/main/cpp/me_khrystal_gifbuilder_encoder_GIFEncoder.h | kHRYSTAL/JZVideo | 5749a9fb7cc533a9eb36b528689af9431cb30497 | [
"MIT"
] | null | null | null | gifbuilder/src/main/cpp/me_khrystal_gifbuilder_encoder_GIFEncoder.h | kHRYSTAL/JZVideo | 5749a9fb7cc533a9eb36b528689af9431cb30497 | [
"MIT"
] | null | null | null | gifbuilder/src/main/cpp/me_khrystal_gifbuilder_encoder_GIFEncoder.h | kHRYSTAL/JZVideo | 5749a9fb7cc533a9eb36b528689af9431cb30497 | [
"MIT"
] | null | null | null | /* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class me_khrystal_gifbuilder_encoder_GIFEncoder */
#ifndef _Included_me_khrystal_gifbuilder_encoder_GIFEncoder
#define _Included_me_khrystal_gifbuilder_encoder_GIFEncoder
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: me_khrystal_gifbuilder_encoder_GIFEncoder
* Method: getImagePixelsNative
* Signature: (Ljava/lang/Object;)[B
*/
JNIEXPORT jbyteArray JNICALL Java_me_khrystal_gifbuilder_encoder_GIFEncoder_getImagePixelsNative
(JNIEnv *, jclass, jobject);
#ifdef __cplusplus
}
#endif
#endif
| 27.045455 | 96 | 0.806723 | [
"object"
] |
77e9c599739546e203f9187ef5b43213bde48e4b | 11,565 | h | C | production_apps/ESPRESO/src/mesh/structures/mesh.h | readex-eu/readex-apps | 38493b11806c306f4e8f1b7b2d97764b45fac8e2 | [
"BSD-3-Clause"
] | 2 | 2020-11-25T13:10:11.000Z | 2021-03-15T20:26:35.000Z | production_apps/ESPRESO/src/mesh/structures/mesh.h | readex-eu/readex-apps | 38493b11806c306f4e8f1b7b2d97764b45fac8e2 | [
"BSD-3-Clause"
] | null | null | null | production_apps/ESPRESO/src/mesh/structures/mesh.h | readex-eu/readex-apps | 38493b11806c306f4e8f1b7b2d97764b45fac8e2 | [
"BSD-3-Clause"
] | 1 | 2018-09-30T19:04:38.000Z | 2018-09-30T19:04:38.000Z | #ifndef MESH_H_
#define MESH_H_
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <functional>
namespace espreso {
struct Configuration;
struct G2L;
class Coordinates;
class Evaluator;
class Material;
class Region;
class Element;
enum class Property;
enum class ElementType;
namespace input {
class Loader;
}
class Mesh
{
public:
friend class input::Loader;
Mesh();
virtual ~Mesh();
virtual void partitiate(size_t parts);
virtual void partitiateNoncontinuously(size_t parts, size_t noncontinuousParts);
virtual void repartitiate(size_t parts, std::vector<size_t> &domainDOFCount, std::vector<std::vector<eslocal> > &previousDOFMap, std::vector<std::vector<eslocal> > &previousDomainMap);
void computeFixPoints(size_t number);
void computeVolumeCorners(size_t number, bool onVertices, bool onEdges, bool onFaces);
void computePlaneCorners(size_t number, bool onVertices, bool onEdges);
void computeElementsFromFaces();
void computeFacesOfAllElements();
void computeFacesOnDomainsSurface();
virtual void computeFacesSharedByDomains();
void clearFacesWithoutSettings();
void computeEdgesOfAllElements();
void computeEdgesSharedByDomains();
void computeEdgesOnBordersOfFacesSharedByDomains();
void clearEdgesWithoutSettings();
void computeCornersOnEdges(size_t number, bool onVertices, bool onEdges);
void computeCornersOnFaces(size_t number, bool onVertices, bool onEdges, bool onFaces);
void loadProperty(const std::map<std::string, std::string> ®ions, const std::vector<std::string> ¶meters, const std::vector<Property> &properties, size_t loadStep = 0);
void loadNodeProperty(const std::map<std::string, std::string> ®ions, const std::vector<std::string> ¶meters, const std::vector<Property> &properties, size_t loadStep = 0);
void loadFaceProperty(const std::map<std::string, std::string> ®ions, const std::vector<std::string> ¶meters, const std::vector<Property> &properties, size_t loadStep = 0);
void loadProperty(const std::map<size_t, std::map<std::string, std::string> > &property, const std::vector<std::string> ¶meters, const std::vector<Property> &properties);
void loadNodeProperty(const std::map<size_t, std::map<std::string, std::string> > &property, const std::vector<std::string> ¶meters, const std::vector<Property> &properties);
void loadFaceProperty(const std::map<size_t, std::map<std::string, std::string> > &property, const std::vector<std::string> ¶meters, const std::vector<Property> &properties);
void removeDuplicateRegions();
void fillDomainsSettings();
bool hasProperty(size_t domain, Property property, size_t loadStep) const;
bool hasProperty(Property property, size_t loadStep) const;
bool isPropertyTimeDependent(Property property, size_t loadStep) const;
bool isAnyPropertyTimeDependent(const std::vector<Property> &properties, size_t loadStep) const;
bool isPropertyTemperatureDependent(Property property, size_t loadStep) const;
bool isAnyPropertyTemperatureDependent(const std::vector<Property> &properties, size_t loadStep) const;
template<typename TMaterial>
void loadMaterials(const std::map<std::string, TMaterial*> &materials, const std::map<std::string, std::string> &sets)
{
size_t index = 0;
for (auto it = sets.begin(); it != sets.end(); ++it, index++) {
if (materials.find(it->second) == materials.end()) {
materialNotFound(it->second);
} else {
loadMaterial(this->region(it->first), index, it->second, *materials.find(it->second)->second);
}
}
checkMaterials();
}
void loadMaterial(Region* region, size_t index, const std::string &name, const Configuration &configuration);
void checkMaterials();
const Coordinates& coordinates() const { return *_coordinates; }
const std::vector<Element*>& elements() const { return _elements; };
const std::vector<Element*>& faces() const { return _faces; };
const std::vector<Element*>& edges() const { return _edges; };
const std::vector<Element*>& nodes() const { return _nodes; };
Element* getDOFsElement(size_t part, size_t DOF) const { return _DOFtoElement[part][DOF]; }
std::vector<std::vector<Region*> > getRegionsWithProperties(size_t loadStep, const std::vector<Property> &properties) const;
static std::vector<std::vector<Region*> > getRegionsWithProperties(const std::vector<Region*> ®ions, size_t loadStep, const std::vector<Property> &properties);
static bool commonRegion(const std::vector<Region*> &v1, const std::vector<Region*> &v2);
void addPropertyGroup(const std::vector<Property> &properties);
const std::vector<Property>& propertyGroup(Property property) const;
const std::map<Property, std::vector<Property> >& propertyGroups() const { return _propertyGroups; }
const std::vector<std::vector<Element*> >& fixPoints() const { return _fixPoints; }
const std::vector<Element*>& fixPoints(size_t part) const { return _fixPoints[part]; }
const std::vector<Element*>& corners() const { return _corners; }
size_t steps() const { return _steps; }
size_t parts() const { return _partPtrs.size() - 1; }
const std::vector<eslocal>& getPartition() const { return _partPtrs; }
size_t bodies() const { return _bodies.size() - 1; }
const std::vector<size_t>& getBodies() const { return _bodies; }
const std::vector<int>& neighbours() const { return _neighbours; }
const std::vector<Region*>& regions() const { return _regions; }
const std::vector<Region*>& monitoredRegions() const { return _monitoredRegions; }
const std::vector<Material*>& materials() const { return _materials; }
const std::vector<Evaluator*>& evaluators() const { return _evaluators; }
std::vector<size_t> assignVariousDOFsIndicesToNodes(const std::vector<size_t> &offsets, const std::vector<Property> &DOFs, std::vector<size_t> &DOFsOffsets);
std::vector<size_t> assignUniformDOFsIndicesToNodes(const std::vector<size_t> &offsets, const std::vector<Property> &DOFs, std::vector<size_t> &DOFsOffsets);
std::vector<size_t> assignUniformDOFsIndicesToEdges(const std::vector<size_t> &offsets, const std::vector<Property> &DOFs, std::vector<size_t> &DOFsOffsets);
std::vector<size_t> assignUniformDOFsIndicesToFaces(const std::vector<size_t> &offsets, const std::vector<Property> &DOFs, std::vector<size_t> &DOFsOffsets);
std::vector<size_t> assignUniformDOFsIndicesToElements(const std::vector<size_t> &offsets, const std::vector<Property> &DOFs, std::vector<size_t> &DOFsOffsets);
void clearNodesDOFsCounters();
void computeNodesDOFsCounters(const std::vector<Property> &DOFs);
void computeEdgesDOFsCounters(const std::vector<Property> &DOFs);
void computeFacesDOFsCounters(const std::vector<Property> &DOFs);
void getSurface(Mesh &surface) const;
void synchronizeGlobalIndices();
void synchronizeNeighbours();
void synchronizeRegionOrder();
Region* region(const std::string &name) const;
void addMonitoredRegion(Region* region) const;
bool isContinuous() const { return _continuous; }
const std::vector<eslocal>& getContinuityPartition() const { return _continuousPartId; }
void checkNeighbours();
void storeNodeData(const std::string &name, std::function<void (std::ofstream &os, const Element* e)> store);
void storeRegions();
void checkRegions(const std::vector<Element*> &elements);
protected:
void fillFacesFromElements(std::function<bool(const std::vector<Element*> &nodes, const Element* face)> filter);
void fillEdgesFromElements(std::function<bool(const std::vector<Element*> &nodes, const Element* edge)> filter);
void fillNodesFromCoordinates();
void fillEdgesFromFaces(std::function<bool(const std::vector<Element*> &nodes, const Element* edge)> filter);
void fillParentEdgesToNodes();
void fillParentFacesToNodes();
void fillParentElementsToNodes();
void fillEdgesParents();
void fillFacesParents();
void mapFacesToClusters();
void mapEdgesToClusters();
void mapCoordinatesToDomains();
void mapElementsToDomains();
void mapFacesToDomains();
void mapEdgesToDomains();
void mapNodesToDomains();
void materialNotFound(const std::string &name);
void loadProperty(
size_t loadStep,
const std::map<std::string, std::string> ®ions,
const std::vector<std::string> ¶meters,
const std::vector<Property> &properties,
ElementType type);
std::vector<eslocal> getPartition(size_t begin, size_t end, eslocal parts) const;
std::vector<eslocal> getPartition(const std::vector<Element*> &elements, size_t begin, size_t end, eslocal parts) const;
eslocal getCentralNode(eslocal begin, eslocal end, const std::vector<eslocal> &ePartition, eslocal part, eslocal subpart) const;
eslocal getCentralNode(const std::vector<Element*> &elements, size_t begin, size_t end, const std::vector<eslocal> &ePartition, eslocal subpart) const;
void makePartContinuous(size_t part);
/** @brief Reference to coordinates. */
Coordinates *_coordinates;
/** @brief Body in part 'i' is from _bodies[i] to _bodies[i + 1]. */
std::vector<size_t> _bodies;
/** @brief Elements in part 'i' are from _partPtrs[i] to _partPtrs[i + 1]. */
std::vector<eslocal> _partPtrs;
/** @brief Mesh is only one continuous object */
bool _continuous;
std::vector<eslocal> _continuousPartId;
/// Elements of the mesh.
std::vector<Element*> _elements;
/// Faces of the elements.
std::vector<Element*> _faces;
/// Edges of the elements.
std::vector<Element*> _edges;
/// Nodes of the elements.
std::vector<Element*> _nodes;
/// Back map from DOFs to Element
std::vector<std::vector<Element*> > _DOFtoElement;
/** @brief Fix points for all parts. */
std::vector<std::vector<Element*> > _fixPoints;
/// Corners for HFETI
std::vector<Element*> _corners;
/** @brief list of neighbours MPI ranks */
std::vector<int> _neighbours;
/** @brief list of materials in the mesh*/
std::vector<Material*> _materials;
/** @brief list of mesh regions*/
std::vector<Region*> _regions;
/** @brief list of regions that are monitored*/
mutable std::vector<Region*> _monitoredRegions;
/** @brief list of settings for each domain and load step*/
std::vector<std::vector<std::set<Property> > > _properties;
/** @brief groups defining which properties should be printed together */
std::map<Property, std::vector<Property> > _propertyGroups;
/** @brief number of load steps */
size_t _steps;
/** @brief list of DOFs offsets for nodes (useful for multiple physics)*/
std::vector<Property> _nodesDOFsOffsets;
/** @brief list of DOFs offsets for edges (useful for multiple physics)*/
std::vector<Property> _edgesDOFsOffsets;
/** @brief list of DOFs offsets for faces (useful for multiple physics)*/
std::vector<Property> _facesDOFsOffsets;
/** @brief list of DOFs offsets for elements (useful for multiple physics)*/
std::vector<Property> _elementsDOFsOffsets;
/** @brief list of evaluators */
std::vector<Evaluator*> _evaluators;
private:
Mesh(const Mesh &mesh) = delete;
Mesh& operator=(const Mesh &mesh) = delete;
};
namespace input { class API; }
class APIMesh: public Mesh
{
friend class input::API;
public:
APIMesh(eslocal *l2g, size_t size);
void partitiate(size_t parts);
void mapDOFsToDomains();
void fillParentElementsToDOFs(const std::vector<std::vector<eslocal> > &eDOFs);
void computeFacesSharedByDomains();
void computeDOFsDOFsCounters();
std::vector<size_t> distributeDOFsToDomains(const std::vector<size_t> &offsets);
const std::vector<Element*>& DOFs() const { return _DOFs; }
protected:
std::vector<Element*> _DOFs;
std::vector<esglobal> _l2g;
std::vector<G2L> *_g2l;
};
}
#endif /* MESH_H_ */
| 39.47099 | 185 | 0.748552 | [
"mesh",
"object",
"vector"
] |
77eb6299ef58f54f027c7e40093414ba6ccbf592 | 658 | h | C | Sources/World/Systems/ShadowVoxSystem.h | carloshgsilva/VoxelEngine | 5ba308d3573805437124f32d407306776c1d66d6 | [
"MIT"
] | 1 | 2022-01-20T15:53:31.000Z | 2022-01-20T15:53:31.000Z | Sources/World/Systems/ShadowVoxSystem.h | carloshgsilva/VoxelEngine | 5ba308d3573805437124f32d407306776c1d66d6 | [
"MIT"
] | null | null | null | Sources/World/Systems/ShadowVoxSystem.h | carloshgsilva/VoxelEngine | 5ba308d3573805437124f32d407306776c1d66d6 | [
"MIT"
] | null | null | null | #pragma once
#include "System.h"
#include "Graphics/Graphics.h"
class ShadowVoxSystem : public System {
Buffer _Buffer;
Image _Volume;
std::vector<ImageRegion> _UpdateRegions;
uint32 _SizeX;
uint32 _SizeY;
uint32 _SizeZ;
uint32 _SizeXtimes_SizeY;
std::vector<uint8> _Data;
void OnVoxDestroyed(entt::registry& r, entt::entity e);
public:
ShadowVoxSystem();
inline void SetVolumeAt(int x, int y, int z, int value);
inline bool GetVolumeAt(int x, int y, int z);
Image& GetVolumeImage() { return _Volume; }
virtual void OnCreate();
virtual void OnUpdate(DeltaTime dt);
virtual void OnEvent(Event& e) {}
virtual void OnDestroy() {}
}; | 18.8 | 57 | 0.727964 | [
"vector"
] |
77f16fa75d9cdc8fbf25a697fa89fa7cb62a6d1d | 4,121 | h | C | src/qw/progs.h | luaman/twilight | b4853f3e0c828a5aaff23e44c17d70410f7781c1 | [
"MIT"
] | 3 | 2018-01-14T10:43:27.000Z | 2020-03-02T08:38:23.000Z | src/qw/progs.h | luaman/twilight | b4853f3e0c828a5aaff23e44c17d70410f7781c1 | [
"MIT"
] | null | null | null | src/qw/progs.h | luaman/twilight | b4853f3e0c828a5aaff23e44c17d70410f7781c1 | [
"MIT"
] | null | null | null | /*
$RCSfile$
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifndef __PROGS_H
#define __PROGS_H
#include "pr_comp.h" // defs shared with qcc
#include "progdefs.h" // generated by program cdefs
#include "protocol.h"
typedef union eval_s
{
string_t string;
float _float;
float vector[3];
func_t function;
int ivector[3];
int _int;
int edict;
}
eval_t;
#define MAX_ENT_LEAFS 256
typedef struct edict_s
{
qboolean free;
link_t area; // linked to a division node or leaf
Uint num_leafs;
short leafnums[MAX_ENT_LEAFS];
entity_state_t baseline;
float freetime; // sv.time when the object was freed
double lastruntime; // sv.time when SV_RunEntity was last
// called for this edict
entvars_t v; // C exported fields from progs
// other fields from progs come immediately after
}
edict_t;
#define EDICT_FROM_AREA(l) ((edict_t *)((Uint8 *)l - (int)&(((edict_t *)0)->area)))
//============================================================================
extern dprograms_t *progs;
extern dfunction_t *pr_functions;
extern char *pr_strings;
extern dstatement_t *pr_statements;
extern globalvars_t *pr_global_struct;
extern float *pr_globals; // same as pr_global_struct
extern Uint pr_edict_size; // in bytes
//============================================================================
void PR_Init (void);
char *PR_GlobalString (int ofs);
char *PR_GlobalStringNoContents (int ofs);
void PR_ExecuteProgram (func_t fnum);
void PR_LoadProgs (void);
void PR_Profile_f (void);
edict_t *ED_Alloc (void);
void ED_Free (edict_t *ed);
// returns a copy of the string allocated from the server's string heap
void ED_Print (edict_t *ed);
void ED_ParseGlobals (const char *data);
void ED_LoadFromFile (const char *data);
edict_t *EDICT_NUM_ERROR (Uint n);
#define EDICT_NUM(n) (n < MAX_EDICTS ? (edict_t *)((Uint8 *)sv.edicts + (n) * pr_edict_size) : EDICT_NUM_ERROR(n))
Uint NUM_FOR_EDICT (edict_t *e);
#define NEXT_EDICT(e) ((edict_t *)( (Uint8 *)e + pr_edict_size))
#define EDICT_TO_PROG(e) ((Uint8 *)e - (Uint8 *)sv.edicts)
#define PROG_TO_EDICT(e) ((edict_t *)((Uint8 *)sv.edicts + e))
//============================================================================
#define G_FLOAT(o) (pr_globals[o])
#define G_INT(o) (*(int *)&pr_globals[o])
#define G_EDICT(o) ((edict_t *)((Uint8 *)sv.edicts+ *(int *)&pr_globals[o]))
#define G_EDICTNUM(o) NUM_FOR_EDICT(G_EDICT(o))
#define G_VECTOR(o) (&pr_globals[o])
#define G_STRING(o) (PR_GetString(*(string_t *)&pr_globals[o]))
#define G_FUNCTION(o) (*(func_t *)&pr_globals[o])
#define E_FLOAT(e,o) (((float*)&e->v)[o])
#define E_INT(e,o) (*(int *)&((float*)&e->v)[o])
#define E_VECTOR(e,o) (&((float*)&e->v)[o])
#define E_STRING(e,o) (PR_GetString(*(string_t *)&((float*)&e->v)[o]))
typedef void (*builtin_t) (void);
extern builtin_t *pr_builtins;
extern Uint pr_numbuiltins;
extern Uint pr_argc;
extern qboolean pr_trace;
extern dfunction_t *pr_xfunction;
extern func_t SpectatorConnect;
extern func_t SpectatorThink;
extern func_t SpectatorDisconnect;
void PR_RunError (char *error, ...);
void ED_PrintEdicts (void);
void ED_PrintNum (int ent);
eval_t *GetEdictFieldValue (edict_t *ed, char *field);
//
// PR Strings stuff
//
#define PR_GetString(num) (pr_strings + (num))
#define PR_SetString(s) ((int) ((s) - (pr_strings)))
#endif // __PROGS_H
| 26.082278 | 114 | 0.66877 | [
"object",
"vector"
] |
77f88a273d8135132e2efd5d3ab790adf56a0a33 | 734 | h | C | code/c/common/master/opdi_PortFactory.h | leomeyer/opdi_core | 29fcb1c1c8ecd7d3d3da251333ebefb731075813 | [
"BSD-2-Clause"
] | null | null | null | code/c/common/master/opdi_PortFactory.h | leomeyer/opdi_core | 29fcb1c1c8ecd7d3d3da251333ebefb731075813 | [
"BSD-2-Clause"
] | null | null | null | code/c/common/master/opdi_PortFactory.h | leomeyer/opdi_core | 29fcb1c1c8ecd7d3d3da251333ebefb731075813 | [
"BSD-2-Clause"
] | null | null | null | // This file is part of an OPDI reference implementation.
// see: Open Protocol for Device Interaction
//
// Copyright (C) 2011-2016 Leo Meyer (leo@leomeyer.de)
// All rights reserved.
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __PORTFACTORY_H
#define __PORTFACTORY_H
#include "opdi_protocol_constants.h"
#include "opdi_OPDIPort.h"
/** This class serves as a factory for basic port objects.
*
* @author Leo
*
*/
class PortFactory {
public:
static OPDIPort* createPort(IBasicProtocol& protocol, std::vector<std::string> parts);
};
#endif
| 23.677419 | 87 | 0.713896 | [
"vector"
] |
77f8e0338c6f75f56226a69624405acf4412bdc5 | 1,011 | h | C | src/phantom/shape.h | nio1814/3Dcones | 704b78a0d73b25ab59269e60babbd13876f8563e | [
"BSD-3-Clause"
] | 4 | 2019-09-10T13:46:41.000Z | 2022-03-21T20:19:23.000Z | src/phantom/shape.h | nio1814/3Dcones | 704b78a0d73b25ab59269e60babbd13876f8563e | [
"BSD-3-Clause"
] | 1 | 2017-05-17T07:05:00.000Z | 2017-05-17T07:05:38.000Z | src/phantom/shape.h | nio1814/3Dcones | 704b78a0d73b25ab59269e60babbd13876f8563e | [
"BSD-3-Clause"
] | 2 | 2020-04-12T09:39:29.000Z | 2022-03-21T20:19:25.000Z | #ifndef SHAPE_H
#define SHAPE_H
#include <vector>
class Shape
{
public:
enum Type{Ellipsoid, Ellipse};
Shape(Type type, float x, float y, float xAxisLength, float yAxisLength, float theta, float intensity);
Shape(Type type, float x, float y, float z, float xAxisLength, float yAxisLength, float zAxisLength, float phi, float theta, float psi, float intensity);
void relativePosition(const float *position, float* positionRelative);
void rotatedCoordinates(const float *coordinates, float* coordinatesRotated);
float principalAxis(int axis);
std::vector<float> principalAxes();
std::vector<float> displacement();
float intensity();
int dimensions();
private:
std::vector<float> m_rotationMatrix; //rotation matrices. T denotes matrix transpose.
std::vector<float> m_displacement; //displacement vectors.
std::vector<float> m_principalAxes; //the length of the principal axes.
float m_intensity; // signal intensity.
// Type m_type;
};
#endif // SHAPE_H
| 29.735294 | 155 | 0.732938 | [
"shape",
"vector"
] |
ae0025a4fed3af390c8b85afcb770da1b41b4f68 | 6,248 | h | C | src/prod/ktl/src/inc/kqueue.h | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 2,542 | 2018-03-14T21:56:12.000Z | 2019-05-06T01:18:20.000Z | src/prod/ktl/src/inc/kqueue.h | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 994 | 2019-05-07T02:39:30.000Z | 2022-03-31T13:23:04.000Z | src/prod/ktl/src/inc/kqueue.h | vishnuk007/service-fabric | d0afdea185ae932cc3c9eacf179692e6fddbc630 | [
"MIT"
] | 300 | 2018-03-14T21:57:17.000Z | 2019-05-06T20:07:00.000Z | /*++
(c) 2010 by Microsoft Corp. All Rights Reserved.
kqueue
Description:
Kernel Tempate Library (KTL): KQueue object.
Implements a simple, unguarded FIFO queue.
History:
raymcc 16-Aug-2010 Initial version.
raymcc 02-Sep-2010 Separation of implementation; simplifications
--*/
#pragma once
template <class T>
class KQueue : public KObject<KQueue<T>>
{
KAllocator_Required();
public:
//
// Constructor
//
// Constructs an empty queue. Can't fail.
//
NOFAIL KQueue(KAllocator& Allocator);
// Destructor
//
// Deallocates any items still in the queue during destruction.
//
~KQueue();
// Copy constructor
//
FAILABLE KQueue(
__in const KQueue& Src
);
// Assignment
//
FAILABLE KQueue& operator=(
__in const KQueue& Src
);
// IsEmpty
//
// Return value:
// TRUE if the queue is empty.
// FALSE if the queue is not empty.
//
BOOLEAN IsEmpty();
// Count
//
// Returns the number of items in the queue.
//
ULONG Count();
// Peek
//
// Returns a reference to the next item (head) in the queue. This is unchecked and will
// fault if the queue is empty.
//
// Return value:
// A reference to the next item in the queue.
//
T& Peek();
// PeekTail
//
// Returns a reference to the most recently enqueued item (tail). This is unchecked.
// Its primary use is to check the status of an enqueued object which might have
// run into out-of-memory during the copy construction necessary to enqueue it.
//
T& PeekTail();
// Deq
//
// Removes and deallocates the next item from the queue (a dequeue operation).
// This is typically done after executing a Peek() to read the item.
//
// Return values:
// TRUE if an item was dequeued.
// FALSE if the queue was tempty.
//
BOOLEAN Deq();
// Deq
//
// Removes and head of the queue and delivers it to the caller's object.
//
// Parameters:
// Receiver Receives the object at the front of the queue. The
// object must support assignment semantics.
//
// Return value:
// FALSE If the queue is empty
// TRUE If Receiver received the dequeued object
//
BOOLEAN Deq(
__inout T& Receiver
);
// Enq
//
// Enqueues the specified item. The object must support copy construction.
// Because of a FAILABLE copy constructor, the caller may wish to call PeekTail().Status()
// to verify that the object was successfully copied during the enqueue.
//
// Parameters:
// Object A reference to the object to be copied into the queue.
//
// Return value:
// TRUE If the object was successfully added to the queue.
// FALSE Insufficient memory was available to enqueue the item.
//
BOOLEAN Enq(
__in T Object
);
// Reset
//
// Used for a cheap iteration over the queue without dequeuing anything.
//
void
ResetCursor()
{
_Cursor = _Head;
}
// Next
//
// Used after a reset to get the next element in the queue in a simulated dequeue.
//
// Parameter:
// Receiver Receives the next object, if there is one.
//
// Return value:
// TRUE if an object was delivered, FALSE if end-of-queue.
//
BOOLEAN
Next(
__out T& Receiver
)
{
if (!_Cursor)
{
return FALSE;
}
Receiver = _Cursor->_Object;
_Cursor = _Cursor->_Next;
return TRUE;
}
private:
// Private functions
KQueue();
void Zero();
void Cleanup();
NTSTATUS CloneFrom(
__in KQueue& Src
);
// Data members
struct Entry
{
Entry* _Next;
T _Object;
Entry(T& src) : _Object(src), _Next(nullptr) { }
};
KAllocator& _Allocator;
Entry* _Tail;
Entry* _Head;
Entry* _Cursor;
ULONG _Count;
};
template <class T> inline
KQueue<T>::KQueue(KAllocator& Allocator)
: _Allocator(Allocator)
{
Zero();
}
template <class T> inline
KQueue<T>::~KQueue()
{
Cleanup();
}
template <class T> inline
KQueue<T>::KQueue(
__in const KQueue& Src
)
: _Allocator(Src._Allocator)
{
Zero();
CloneFrom(Src);
}
template <class T> inline
KQueue<typename T>& KQueue<T>::operator=(
__in const KQueue& Src
)
{
Cleanup();
CloneFrom(&Src);
return *this;
}
template <class T> inline
BOOLEAN KQueue<T>::IsEmpty()
{
return _Count == 0 ? TRUE : FALSE;
}
template <class T> inline
ULONG KQueue<T>::Count()
{
return _Count;
}
template <class T> inline
T& KQueue<T>::Peek()
{
return _Head->_Object;
}
template <class T> inline
T& KQueue<T>::PeekTail()
{
return _Tail->_Object;
}
template <class T> inline
BOOLEAN KQueue<T>::Deq()
{
if (!_Count)
{
return FALSE;
}
Entry* Tmp = _Head;
_Head = _Head->_Next;
_delete(Tmp);
_Count--;
if (_Head == nullptr)
{
_Tail = nullptr;
}
return TRUE;
}
template <class T> inline
BOOLEAN KQueue<T>::Deq(
__inout T& Receiver
)
{
if (!IsEmpty())
{
Receiver = Peek();
Deq();
return TRUE;
}
return FALSE;
}
template <class T> inline
BOOLEAN KQueue<T>::Enq(
__in T Object
)
{
if (!NT_SUCCESS(this->Status()))
{
return FALSE;
}
Entry* pNew = _new(KTL_TAG_QUEUE, _Allocator) Entry(Object);
if (!pNew)
{
this->SetStatus(STATUS_INSUFFICIENT_RESOURCES);
return FALSE;
}
if (_Tail)
{
_Tail->_Next = pNew;
}
_Tail = pNew;
if (!_Head)
{
_Head = _Tail;
}
_Count++;
return TRUE;
}
template <class T> inline
void KQueue<T>::Zero()
{
_Count = 0;
KObject<KQueue<T>>::SetStatus(STATUS_SUCCESS);
_Cursor = _Head = _Tail = nullptr;
}
template <class T> inline
void KQueue<T>::Cleanup()
{
while (_Count)
{
Deq();
}
}
| 19.343653 | 94 | 0.567222 | [
"object"
] |
cb703d6e5575e3100e6935a707e67078f68239c2 | 1,246 | h | C | src/hamlib/include/hamlib/particle.h | AndrewHamel111/raylib-5k-jam | 549d1a0441937ff1f07ddce48aa545b72ef4b39c | [
"Zlib"
] | null | null | null | src/hamlib/include/hamlib/particle.h | AndrewHamel111/raylib-5k-jam | 549d1a0441937ff1f07ddce48aa545b72ef4b39c | [
"Zlib"
] | null | null | null | src/hamlib/include/hamlib/particle.h | AndrewHamel111/raylib-5k-jam | 549d1a0441937ff1f07ddce48aa545b72ef4b39c | [
"Zlib"
] | null | null | null | #ifndef PARTICLE_H_
#define PARTICLE_H_
#include "raylib.h"
typedef enum particle_anim_info
{
STATIC = 1, TINT = 2, FADE = 4, SHRINK = 8, GROW = 16, ACCELERATE = 32, DECELERATE = 64, FADE_IMMEDIATE = 128, CUSTOM_ACC = 256, TINT_TO = 512
} particle_anim_info;
typedef struct Particle
{
Vector2 pos; // current position
float rotation; // current rotation in degrees. 0 degrees == RIGHT, 90 degrees == DOWN, etc.
float size; // diameter of particle
Vector2 vel; // displacement in pixels per second
Vector2 custom_acc;
float rotation_per_second; // rotation in degrees per second
float life; // seconds left of particle
float life_initial; // total lifespan of particle
particle_anim_info anim;
float anim_factor; // modifier on anim operation (i.e. faster fade, faster decel, slower grow, etc)
Color color;
Color color_initial;
Color color_final;
enum display_info {
PIXEL, SHAPE, SPRITE
} display_type;
union
{
struct display_info_shape // shape
{
enum shape_info
{
RECT, CIRCLE, TRIANGLE
} shape_type;
enum shape_display_info
{
SOLID, HOLLOW
} shape_display_type;
} shape;
struct display_info_sprite // sprite
{
Vector2 size;
Texture2D sprite;
} sprite;
};
} Particle;
#endif | 24.431373 | 143 | 0.719904 | [
"shape",
"solid"
] |
cb7059ea04a040fcb31a2999cc1506408f1a7fab | 1,882 | h | C | Pod/Classes/GravityRequest.h | ducnnguyen/GravityClientLib | 2c8abdbe77f5fee3d5cec0fdf74136c678e2fd52 | [
"MIT"
] | null | null | null | Pod/Classes/GravityRequest.h | ducnnguyen/GravityClientLib | 2c8abdbe77f5fee3d5cec0fdf74136c678e2fd52 | [
"MIT"
] | null | null | null | Pod/Classes/GravityRequest.h | ducnnguyen/GravityClientLib | 2c8abdbe77f5fee3d5cec0fdf74136c678e2fd52 | [
"MIT"
] | null | null | null | //
// GravityRequest.h
// GravityClient
//
// Created by Balazs Kiss on 7/11/13.
// Copyright (c) 2013 Balazs Kiss. All rights reserved.
//
#import <Foundation/Foundation.h>
@class GravityClient;
@class GravityRequest;
@class GravityItemRecommendation;
enum {
GravityRequestTypeHello = 0,
GravityRequestTypeRecommendation,
GravityRequestTypeBulkRecommendation,
GravityRequestTypeSearch,
GravityRequestTypeEvent,
GravityRequestTypeScenarioInfo,
GravityRequestTypeUser,
GravityRequestTypeItem
};
typedef NSUInteger GravityRequestType;
typedef void (^GravityRequestCompletionHandler)(GravityRequest *);
/*
A request to the Gravity service
*/
@interface GravityRequest : NSObject <NSURLConnectionDelegate, NSURLConnectionDataDelegate>
/*
Type of the request
*/
@property GravityRequestType type;
/*
The called method
*/
@property NSString *method;
/*
URL parameters of the request
*/
@property NSMutableArray *params;
/*
Body of the request
*/
@property NSData *body;
/*
The relevant connection object
*/
@property NSURLConnection *connection;
/*
Response of the server
*/
@property NSMutableData *response;
/*
The request is completed or not
*/
@property (readonly, getter = isCompleted) BOOL completed;
/*
The received recommendation
*/
@property (readonly) GravityItemRecommendation *itemRecommendation;
@property (readonly) NSMutableArray *itemRecommendations;
/*
Completion handler of the request
*/
@property (nonatomic, copy) GravityRequestCompletionHandler completionHandler;
/*
Initalizes a GravityRequest connection with an URL
@param client the GravityClient
@param type the GravityRequestType
@return an initialized GravityRequest object
*/
- (id) initWithClient:(GravityClient *)client andType:(GravityRequestType)type;
/*
Sends the GravityRequest of the GravityClient
*/
- (void) send;
@end
| 19.810526 | 91 | 0.765675 | [
"object"
] |
cb7e4cebfe658412879f8c0d546188af5240aeb2 | 2,206 | c | C | tools/rtl433/rtltest/devices/opus_xt300.c | tomwei7/LA104 | fdf04061f37693d37e2812ed6074348e65d7e5f9 | [
"MIT"
] | 336 | 2018-11-23T23:54:15.000Z | 2022-03-21T03:47:05.000Z | tools/rtl433/rtltest/devices/opus_xt300.c | 203Null/LA104 | b8ae9413d01ea24eafb9fdb420c97511287cbd99 | [
"MIT"
] | 56 | 2019-02-01T05:01:07.000Z | 2022-03-26T16:00:24.000Z | tools/rtl433/rtltest/devices/opus_xt300.c | 203Null/LA104 | b8ae9413d01ea24eafb9fdb420c97511287cbd99 | [
"MIT"
] | 52 | 2019-02-06T17:05:04.000Z | 2022-03-04T12:30:53.000Z | /* Opus/Imagintronix XT300 Soil Moisture Sensor
*
* Aslo called XH300 sometimes, this seems to be the associated display name
*
* https://www.plantcaretools.com/product/wireless-moisture-monitor/
*
* Data is transmitted with 6 bytes row:
*
+. 0. 1. 2. 3. 4. 5
* FF ID SM TT ?? CC
*
* FF: initial preamble
* ID: 0101 01ID
* SM: soil moisure (decimal 05 -> 99 %)
* TT: temperature °C + 40°C (decimal)
* ??: always FF... maybe spare bytes
* CC: check sum (simple sum) except 0xFF preamble
*
*/
#include "decoder.h"
static int opus_xt300_callback(r_device *decoder, bitbuffer_t *bitbuffer)
{
int ret = 0;
int row;
int chk;
uint8_t *b;
int channel, temp, moisture;
data_t *data;
for (row = 0; row < bitbuffer->num_rows; row++) {
if (bitbuffer->bits_per_row[row] != 48) {
continue;
}
b = bitbuffer->bb[row];
if (b[0] != 0xFF && ((b[1] | 0x1) & 0xFD) == 0x55) {
continue;
}
chk = add_bytes(b + 1, 4); // sum bytes 1-4
chk = chk & 0xFF;
if (chk != 0 && chk != b[5] ) {
continue;
}
channel = (b[1] & 0x03);
temp = b[3] - 40;
moisture = b[2];
data = data_make(
"model", "", DATA_STRING, "Opus-XT300",
"channel", "Channel", DATA_INT, channel,
"temperature_C", "Temperature", DATA_FORMAT, "%d C", DATA_INT, temp,
"moisture", "Moisture", DATA_FORMAT, "%d %%", DATA_INT, moisture,
"mic", "Integrity", DATA_STRING, "CHECKSUM",
NULL);
decoder_output_data(decoder, data);
ret++;
}
return ret;
}
static char *output_fields[] = {
"model",
"channel",
"temperature_C",
"moisture",
NULL
};
r_device opus_xt300 = {
.name = "Opus/Imagintronix XT300 Soil Moisture",
.modulation = OOK_PULSE_PWM,
.short_width = 544,
.long_width = 932,
.gap_limit = 10000,
.reset_limit = 31000,
.decode_fn = &opus_xt300_callback,
.disabled = 0,
.fields = output_fields
};
| 26.578313 | 89 | 0.524025 | [
"model"
] |
cb8561673b037f9ca4474e1ba361d8b1745e6192 | 16,003 | h | C | include/progressive_kd_tree_index.h | e-/ANN | dd485320d1eb55e821027ad09013eb10ae07db93 | [
"BSD-2-Clause"
] | 19 | 2017-08-01T05:19:55.000Z | 2022-02-02T15:13:41.000Z | include/progressive_kd_tree_index.h | e-/ANN | dd485320d1eb55e821027ad09013eb10ae07db93 | [
"BSD-2-Clause"
] | 4 | 2018-10-10T21:35:27.000Z | 2021-07-13T02:24:12.000Z | include/progressive_kd_tree_index.h | e-/ANN | dd485320d1eb55e821027ad09013eb10ae07db93 | [
"BSD-2-Clause"
] | 5 | 2018-09-24T17:21:05.000Z | 2021-03-02T09:59:35.000Z | #ifndef panene_progressive_kd_tree_index_h
#define panene_progressive_kd_tree_index_h
#include <vector>
#include <algorithm>
#include <random>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <queue>
#include <cassert>
#include <map>
#include <kd_tree_index.h>
#ifdef BENCHMARK
#include <util/timer.h>
#define BENCH(x) x
#else
#define BENCH(x) ((void)0)
#endif
namespace panene
{
enum UpdateStatus {
NoUpdate,
BuildingTree,
InsertingPoints
};
struct TreeWeight {
float addPointWeight;
float updateIndexWeight;
TreeWeight(float addPointWeight_, float updateIndexWeight_) : addPointWeight(addPointWeight_), updateIndexWeight(updateIndexWeight_) {
}
};
struct UpdateResult2 {
size_t numPointsInserted;
size_t addPointOps;
size_t updateIndexOps;
size_t addPointResult;
size_t updateIndexResult;
double addPointElapsed;
double updateIndexElapsed;
UpdateResult2() = default;
UpdateResult2(
size_t addPointOps_, size_t updateIndexOps_,
size_t addPointResult_, size_t updateIndexResult_,
size_t numPointsInserted_,
double addPointElapsed_, double updateIndexElapsed_) :
numPointsInserted(numPointsInserted_),
addPointOps(addPointOps_),
updateIndexOps(updateIndexOps_),
addPointResult(addPointResult_),
updateIndexResult(updateIndexResult_),
addPointElapsed(addPointElapsed_),
updateIndexElapsed(updateIndexElapsed_)
{
}
friend std::ostream& operator<<(std::ostream& os, const UpdateResult2& obj) {
os << "UpdateResult2(addPointOps: " << obj.addPointResult << " / " << obj.addPointOps << ", "
<< "updateIndexOps: " << obj.updateIndexResult << " / " << obj.updateIndexOps << ", numPointsInserted: " << obj.numPointsInserted << ")";
return os;
}
};
template <typename DataSource>
class ProgressiveKDTreeIndex : public KDTreeIndex<DataSource>
{
USE_KDTREE_INDEX_SYMBOLS
typedef DataSource DataSourceT;
public:
ProgressiveKDTreeIndex(DataSource *dataSource_, IndexParams indexParams_, TreeWeight weight_ = TreeWeight(0.3, 0.7), const float reconstructionWeight_ = .25f) : KDTreeIndex<DataSource>(dataSource_, indexParams_, Distance()), weight(weight_), reconstructionWeight(reconstructionWeight_) {
}
size_t addPoints(size_t ops) {
size_t oldSize = size;
size += ops;
if (size > dataSource->size())
size = dataSource->size();
if (oldSize == 0) { // for the first time, build the index as we did in the non-progressive version.
buildIndex();
return ops;
}
else {
for (size_t i = oldSize; i < size; ++i) {
for (size_t j = 0; j < numTrees; ++j) {
trees[j]->size++;
addPointToTree(trees[j], trees[j]->root, i, 0);
}
}
if (updateStatus == UpdateStatus::InsertingPoints) {
for (size_t i = oldSize; i < size && sizeAtUpdate < size; ++i) {
ongoingTree->size++;
addPointToTree(ongoingTree, ongoingTree->root, sizeAtUpdate++, 0);
}
}
return size - oldSize;
}
}
void beginUpdate() {
updateStatus = UpdateStatus::BuildingTree;
sizeAtUpdate = size;
ids.resize(sizeAtUpdate);
for (size_t i = 0; i < sizeAtUpdate; ++i) ids[i] = int(i);
std::random_shuffle(ids.begin(), ids.end());
ongoingTree = new KDTree<NodePtr>(dataSource->capacity());
ongoingTree->root = new(pool) Node(ongoingTree);
std::queue<NodeSplit> empty;
queue = empty;
queue.push(NodeSplit(ongoingTree->root, &ids[0], sizeAtUpdate, 1));
ongoingTree->size = sizeAtUpdate;
}
size_t update(int ops) {
int updatedCount = 0;
while ((ops == -1 || updatedCount < ops) && !queue.empty()) {
NodeSplit nodeSplit = queue.front();
queue.pop();
#if DEBUG
std::cerr << "updatedCount " << updatedCount << std::endl;
#endif
NodePtr node = nodeSplit.node;
IDType *begin = nodeSplit.begin;
int count = nodeSplit.count;
int depth = nodeSplit.depth;
#if DEBUG
std::cerr << begin << " " << count << std::endl;
#endif
// At this point, nodeSplit the two children of nodeSplit are nullptr
if (count == 1) {
node->child1 = node->child2 = NULL; /* Mark as leaf node. */
node->id = *begin; /* Store index of this vec. */ // TODO id of vec
ongoingTree->setInsertionLog(node->id, 1, depth);
}
else {
int idx;
int cutfeat;
DistanceType cutval;
meanSplit(begin, count, idx, cutfeat, cutval);
#if DEBUG
std::cerr << "cut index: " << idx << " cut count: " << count << std::endl;
#endif
node->divfeat = cutfeat;
node->divval = cutval;
node->child1 = new(pool) Node(ongoingTree);
node->child2 = new(pool) Node(ongoingTree);
queue.push(NodeSplit(node->child1, begin, idx, depth + 1));
queue.push(NodeSplit(node->child2, begin + idx, count - idx, depth + 1));
}
updatedCount += 1; // count; // std::min(1, count / 2);
}
if (updateStatus == UpdateStatus::BuildingTree && queue.empty()) {
updateStatus = UpdateStatus::InsertingPoints;
}
if (updateStatus == UpdateStatus::InsertingPoints) {
if (ongoingTree->size < size) {
// insert points from sizeAtUpdate to size
while (ongoingTree->size < size && (ops == -1 || updatedCount < ops)) {
ongoingTree->size++;
addPointToTree(ongoingTree, ongoingTree->root, sizeAtUpdate, 0);
sizeAtUpdate++;
updatedCount++;
}
}
if (ongoingTree->size >= size) {
// finished creating a new tree
ongoingTree->cost = ongoingTree->computeCost();
size_t victimId = 0;
float maxImbalance = trees[0]->computeImbalance();
// find the most unbalanced one
for (size_t i = 1; i < numTrees; ++i) {
float imbalance = trees[i]->computeImbalance();
if (maxImbalance < imbalance) {
maxImbalance = imbalance;
victimId = i;
}
}
// get the victim
auto victim = trees[victimId];
// replace the victim with the newly created tree
delete victim;
trees[victimId] = ongoingTree;
// reset the sizeAtUpdate
sizeAtUpdate = 0;
updateStatus = UpdateStatus::NoUpdate;
}
}
return updatedCount;
}
UpdateResult2 run(size_t ops) {
size_t addPointOps = 0, updateIndexOps = 0;
size_t addPointResult = 0, updateIndexResult = 0;
double addPointElapsed = 0, updateIndexElapsed = 0;
if (updateStatus != UpdateStatus::NoUpdate) {
addPointOps = (size_t)(ops * weight.addPointWeight);
updateIndexOps = (size_t)(ops * weight.updateIndexWeight);
}
else {
addPointOps = ops;
}
BENCH(Timer timer);
BENCH(timer.begin());
if (addPointOps > 0) {
addPointResult = addPoints(addPointOps);
}
if (addPointResult == 0) {
// if we added all points, put all operations to update index
weight.updateIndexWeight += weight.addPointWeight;
weight.addPointWeight = 0;
updateIndexOps = ops;
addPointOps = 0;
}
size_t numPointsInserted = size;
BENCH(addPointElapsed = timer.end());
if (updateStatus != NoUpdate) {
BENCH(timer.begin());
updateIndexResult = update(updateIndexOps);
BENCH(updateIndexElapsed = timer.end());
}
return UpdateResult2(
addPointOps, updateIndexOps,
addPointResult, updateIndexResult,
numPointsInserted,
addPointElapsed, updateIndexElapsed);
}
void checkBeginUpdate() {
if (updateStatus == UpdateStatus::NoUpdate) {
float updateCost = (float)std::log2(size) * size;
if (queryLoss > updateCost * reconstructionWeight) {
beginUpdate();
queryLoss = 0;
}
}
}
void knnSearch(
const IDType &qid,
ResultSet<IDType, DistanceType> &resultSet,
size_t knn,
const SearchParams& params)
{
std::vector<ElementType> vector(dim);
dataSource->get(qid, vector);
float costSum = findNeighbors(vector, resultSet, params);
size_t ideal = std::log2(size);
queryLoss += costSum - numTrees * ideal;
checkBeginUpdate();
}
// this needs to be improved
void knnSearch(
const std::vector<IDType> qids,
std::vector<ResultSet<IDType, DistanceType>> &resultSets,
size_t knn,
const SearchParams& params)
{
std::vector<std::vector<ElementType>> vectors(qids.size());
for (size_t i = 0; i < qids.size(); ++i) {
vectors[i].resize(dim);
dataSource->get(qids[i], vectors[i]);
}
knnSearch(vectors, resultSets, knn, params);
}
void knnSearch(
const std::vector<std::vector<ElementType>> &vectors,
std::vector<ResultSet<IDType, DistanceType>> &resultSets,
size_t knn,
const SearchParams& params)
{
resultSets.resize(vectors.size());
float costSum = 0;
#pragma omp parallel num_threads(params.cores)
{
#pragma omp for schedule(static) reduction(+:costSum)
for (int i = 0; i < (int)vectors.size(); i++) {
resultSets[i] = ResultSet<IDType, DistanceType>(knn);
costSum += findNeighbors(vectors[i], resultSets[i], params);
}
}
queryLoss += costSum;
checkBeginUpdate();
}
// alias for knnSearch(points) since Cython does not seem to support method overloading
void knnSearchVec(
const std::vector<std::vector<ElementType>> &vectors,
std::vector<ResultSet<IDType, DistanceType>> &resultSets,
size_t knn,
const SearchParams& params)
{
knnSearch(vectors, resultSets, knn, params);
}
protected:
void buildIndex() {
std::vector<IDType> ids(size);
for (size_t i = 0; i < size; ++i) {
ids[i] = IDType(i);
}
for (size_t i = 0; i < numTrees; ++i) {
std::random_shuffle(ids.begin(), ids.end());
trees[i]->root = divideTree(trees[i], &ids[0], size, 1);
trees[i]->size = size;
trees[i]->cost = trees[i]->computeCost();
}
}
void addPointToTree(KDTree<NodePtr>* tree, NodePtr node, IDType id, int depth) {
if ((node->child1 == NULL) && (node->child2 == NULL)) {
// if leaf
size_t nodeId = node->id;
size_t divfeat = dataSource->findDimWithMaxSpan(id, nodeId);
NodePtr left = new(pool) Node(tree);
left->child1 = left->child2 = NULL;
NodePtr right = new(pool) Node(tree);
right->child1 = right->child2 = NULL;
ElementType pointValue = dataSource->get(id, divfeat);
ElementType leafValue = dataSource->get(node->id, divfeat);
if (pointValue < leafValue) {
left->id = id;
right->id = node->id;
}
else {
left->id = node->id;
right->id = id;
}
left->divfeat = right->divfeat = -1;
node->divfeat = divfeat;
node->divval = (pointValue + leafValue) / 2;
node->child1 = left;
node->child2 = right;
// incrementally update imbalance
tree->setInsertionLog(id, 0, depth + 2);
tree->incrementFreqByOne(id);
tree->incrementFreqAndDepthByOne(nodeId);
}
else {
if (dataSource->get(id, node->divfeat) < node->divval) {
addPointToTree(tree, node->child1, id, depth + 1);
}
else {
addPointToTree(tree, node->child2, id, depth + 1);
}
}
}
void freeIndex() {
for (size_t i = 0; i < numTrees; ++i) {
if (trees[i] != nullptr) trees[i]->~KDTree();
}
pool.free();
}
public:
float getMaxCachedCost() {
float cost = 0;
for (size_t i = 0; i < numTrees; ++i) {
if (cost < trees[i]->getCachedCost()) {
cost = trees[i]->getCachedCost();
}
}
return cost;
}
std::vector<float> getCachedImbalances() {
std::vector<float> imbalances;
for (size_t i = 0; i < numTrees; ++i) {
imbalances.push_back(trees[i]->getCachedImbalance());
}
return imbalances;
}
std::vector<float> recomputeImbalances() {
std::vector<float> imbalances;
for (size_t i = 0; i < numTrees; ++i) {
imbalances.push_back(trees[i]->computeImbalance());
}
return imbalances;
}
size_t computeMaxDepth() {
size_t maxDepth = 0;
for (size_t j = 0; j < numTrees; ++j) {
size_t depth = trees[j]->computeMaxDepth();
if (maxDepth < depth)
maxDepth = depth;
}
return maxDepth;
}
void printBackstage() {
std::cout << "queue size: " << queue.size() << std::endl;
std::cout << "ongoingTree size: " << ongoingTree->size << std::endl;
}
public:
UpdateStatus updateStatus = UpdateStatus::NoUpdate;
KDTree<NodePtr>* ongoingTree;
float queryLoss = 0.0;
TreeWeight weight;
private:
float reconstructionWeight; // lower => more update
size_t sizeAtUpdate = 0;
std::queue<NodeSplit> queue;
std::vector<size_t> ids;
};
}
#endif
| 32.995876 | 295 | 0.501906 | [
"vector"
] |
cb8654fc8730efc36dd39ca3a493bcf36c31a75d | 1,489 | h | C | klic/include/OME/local/roquefort/include/klic/generic.h | GunterMueller/KLIC | 75e541269b4ad0bb6e23b73e7310f626b59830d2 | [
"Xnet",
"X11"
] | 5 | 2020-02-02T04:51:16.000Z | 2022-01-16T01:32:13.000Z | klic-3.01/include/OME/local/roquefort/include/klic/generic.h | GunterMueller/KLIC | 75e541269b4ad0bb6e23b73e7310f626b59830d2 | [
"Xnet",
"X11"
] | 1 | 2021-08-04T13:33:53.000Z | 2021-08-04T13:33:53.000Z | klic-3.011/include/OME/local/roquefort/include/klic/generic.h | GunterMueller/KLIC | 75e541269b4ad0bb6e23b73e7310f626b59830d2 | [
"Xnet",
"X11"
] | 3 | 2020-10-18T23:08:38.000Z | 2021-02-21T05:13:33.000Z | /* ----------------------------------------------------------
% (C)1993,1994,1995 Institute for New Generation Computer Technology
% (Read COPYRIGHT for detailed information.)
% (C)1996, 1997, 1998, 1999 Japan Information Processing Development Center
% (Read COPYRIGHT-JIPDEC for detailed information.)
----------------------------------------------------------- */
#include <klic/g_methtab.h>
extern q *gd_generic();
#define new_generic(name,argc,out,offset) \
{ out = name(argc,generic_arg,allocp+offset); allocp = heapp; }
#define call_generic(obj,funct,offset) \
allocp = (q *)gd_generic(allocp+(offset),(obj),(funct),generic_arg)
#define guard_generic(object,mf,inargc,label) \
{ \
q *obj = (q *)functorp(object); \
q retval = ((struct data_object_method_table *) \
(*obj))->g_generic( obj, (mf), generic_arg); \
\
if( retval != GENERIC_SUCCEEDED ){ \
if( retval == GENERIC_FAILED ) { goto label ; } \
else{ *reasonp++ = retval; goto label ; } \
} \
}
#define isgobj(x) (isref(functor_of(x)))
#ifdef __STDC__
#define data_object_method_table_of(class) class##_g_data_method_table
#else
#define data_object_method_table_of(class) class/**/_g_data_method_table
#endif
#define isclass(x, class) \
((struct data_object_method_table *)(functor_of(x)) == \
&data_object_method_table_of(class))
#define declare_method_table_of(class) \
extern struct data_object_method_table data_object_method_table_of(class)
| 34.627907 | 77 | 0.647414 | [
"object"
] |
cb8b385f6b9fc4717e08855adaa4f93b66f2badd | 37,998 | h | C | Source/GeneratedServices/SASPortal/GTLRSASPortalObjects.h | DonQsec/google-api-objectivec-client-for-rest | e1044ccfcfe3652c60c6429a18c37b6c7c5b3352 | [
"Apache-2.0"
] | 1 | 2020-08-14T23:36:18.000Z | 2020-08-14T23:36:18.000Z | Source/GeneratedServices/SASPortal/GTLRSASPortalObjects.h | DonQsec/google-api-objectivec-client-for-rest | e1044ccfcfe3652c60c6429a18c37b6c7c5b3352 | [
"Apache-2.0"
] | null | null | null | Source/GeneratedServices/SASPortal/GTLRSASPortalObjects.h | DonQsec/google-api-objectivec-client-for-rest | e1044ccfcfe3652c60c6429a18c37b6c7c5b3352 | [
"Apache-2.0"
] | null | null | null | // NOTE: This file was generated by the ServiceGenerator.
// ----------------------------------------------------------------------------
// API:
// SAS Portal API (sasportal/v1alpha1)
// Documentation:
// https://developers.google.com/spectrum-access-system/
#if SWIFT_PACKAGE || GTLR_USE_MODULAR_IMPORT
@import GoogleAPIClientForRESTCore;
#elif GTLR_BUILT_AS_FRAMEWORK
#import "GTLR/GTLRObject.h"
#else
#import "GTLRObject.h"
#endif
#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif
@class GTLRSASPortal_Assignment;
@class GTLRSASPortal_Customer;
@class GTLRSASPortal_Device;
@class GTLRSASPortal_DeviceAirInterface;
@class GTLRSASPortal_DeviceConfig;
@class GTLRSASPortal_DeviceGrant;
@class GTLRSASPortal_DeviceMetadata;
@class GTLRSASPortal_DeviceModel;
@class GTLRSASPortal_DpaMoveList;
@class GTLRSASPortal_FrequencyRange;
@class GTLRSASPortal_InstallationParams;
@class GTLRSASPortal_Node;
@class GTLRSASPortal_Operation_Metadata;
@class GTLRSASPortal_Operation_Response;
@class GTLRSASPortal_Policy;
@class GTLRSASPortal_Status;
@class GTLRSASPortal_Status_Details_Item;
// Generated comments include content from the discovery document; avoid them
// causing warnings since clang's checks are some what arbitrary.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
NS_ASSUME_NONNULL_BEGIN
// ----------------------------------------------------------------------------
// Constants - For some of the classes' properties below.
// ----------------------------------------------------------------------------
// GTLRSASPortal_Device.state
/**
* Device de-registered with SAS.
*
* Value: "DEREGISTERED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_Device_State_Deregistered;
/**
* Unspecified state.
*
* Value: "DEVICE_STATE_UNSPECIFIED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_Device_State_DeviceStateUnspecified;
/**
* Device registered with SAS.
*
* Value: "REGISTERED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_Device_State_Registered;
/**
* Device created in the SAS Portal, however, not yet registered
* with SAS.
*
* Value: "RESERVED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_Device_State_Reserved;
// ----------------------------------------------------------------------------
// GTLRSASPortal_DeviceAirInterface.radioTechnology
/** Value: "CAMBIUM_NETWORKS" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_CambiumNetworks;
/** Value: "CW" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_Cw;
/** Value: "DOODLE_CBRS" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_DoodleCbrs;
/** Value: "E_UTRA" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_EUtra;
/** Value: "FOUR_G_BBW_SAA_1" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_FourGBbwSaa1;
/** Value: "NR" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_Nr;
/** Value: "RADIO_TECHNOLOGY_UNSPECIFIED" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_RadioTechnologyUnspecified;
/** Value: "REDLINE" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_Redline;
/** Value: "TARANA_WIRELESS" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceAirInterface_RadioTechnology_TaranaWireless;
// ----------------------------------------------------------------------------
// GTLRSASPortal_DeviceConfig.category
/**
* Category A.
*
* Value: "DEVICE_CATEGORY_A"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_Category_DeviceCategoryA;
/**
* Category B.
*
* Value: "DEVICE_CATEGORY_B"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_Category_DeviceCategoryB;
/**
* Unspecified device category.
*
* Value: "DEVICE_CATEGORY_UNSPECIFIED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_Category_DeviceCategoryUnspecified;
// ----------------------------------------------------------------------------
// GTLRSASPortal_DeviceConfig.measurementCapabilities
/** Value: "MEASUREMENT_CAPABILITY_RECEIVED_POWER_WITH_GRANT" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_MeasurementCapabilities_MeasurementCapabilityReceivedPowerWithGrant;
/** Value: "MEASUREMENT_CAPABILITY_RECEIVED_POWER_WITHOUT_GRANT" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_MeasurementCapabilities_MeasurementCapabilityReceivedPowerWithoutGrant;
/** Value: "MEASUREMENT_CAPABILITY_UNSPECIFIED" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_MeasurementCapabilities_MeasurementCapabilityUnspecified;
// ----------------------------------------------------------------------------
// GTLRSASPortal_DeviceConfig.state
/** Value: "DEVICE_CONFIG_STATE_UNSPECIFIED" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_State_DeviceConfigStateUnspecified;
/** Value: "DRAFT" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_State_Draft;
/** Value: "FINAL" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceConfig_State_Final;
// ----------------------------------------------------------------------------
// GTLRSASPortal_DeviceGrant.channelType
/** Value: "CHANNEL_TYPE_GAA" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_ChannelType_ChannelTypeGaa;
/** Value: "CHANNEL_TYPE_PAL" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_ChannelType_ChannelTypePal;
/** Value: "CHANNEL_TYPE_UNSPECIFIED" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_ChannelType_ChannelTypeUnspecified;
// ----------------------------------------------------------------------------
// GTLRSASPortal_DeviceGrant.state
/**
* The device is currently transmitting.
*
* Value: "GRANT_STATE_AUTHORIZED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_State_GrantStateAuthorized;
/**
* The grant has expired.
*
* Value: "GRANT_STATE_EXPIRED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_State_GrantStateExpired;
/**
* The grant has been granted but the device is not heartbeating on it.
*
* Value: "GRANT_STATE_GRANTED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_State_GrantStateGranted;
/**
* The grant has been suspended by the SAS.
*
* Value: "GRANT_STATE_SUSPENDED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_State_GrantStateSuspended;
/**
* The grant has been terminated by the SAS.
*
* Value: "GRANT_STATE_TERMINATED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_State_GrantStateTerminated;
/** Value: "GRANT_STATE_UNSPECIFIED" */
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_DeviceGrant_State_GrantStateUnspecified;
// ----------------------------------------------------------------------------
// GTLRSASPortal_InstallationParams.heightType
/**
* AGL height is measured relative to the ground level.
*
* Value: "HEIGHT_TYPE_AGL"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_InstallationParams_HeightType_HeightTypeAgl;
/**
* AMSL height is measured relative to the mean sea level.
*
* Value: "HEIGHT_TYPE_AMSL"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_InstallationParams_HeightType_HeightTypeAmsl;
/**
* Unspecified height type.
*
* Value: "HEIGHT_TYPE_UNSPECIFIED"
*/
FOUNDATION_EXTERN NSString * const kGTLRSASPortal_InstallationParams_HeightType_HeightTypeUnspecified;
/**
* Associates `members` with a `role`.
*/
@interface GTLRSASPortal_Assignment : GTLRObject
/**
* The identities the role is assigned to. It can have the following
* values:
* * `{user_email}`: An email address that represents a specific
* Google account. For example: `alice\@gmail.com`.
* * `{group_email}`: An email address that represents a Google
* group. For example, `viewers\@gmail.com`.
*/
@property(nonatomic, strong, nullable) NSArray<NSString *> *members;
/** Required. Role that is assigned to `members`. */
@property(nonatomic, copy, nullable) NSString *role;
@end
/**
* Request for BulkCreateDevice method.
*/
@interface GTLRSASPortal_BulkCreateDeviceRequest : GTLRObject
/**
* Required. A csv with each row representing a [device]. Each row must
* conform to the regulations described on CreateDeviceRequest's device field.
*/
@property(nonatomic, copy, nullable) NSString *csv;
@end
/**
* Response for BulkCreateDevice method.
*/
@interface GTLRSASPortal_BulkCreateDeviceResponse : GTLRObject
/** Required. The devices that were imported. */
@property(nonatomic, strong, nullable) NSArray<GTLRSASPortal_Device *> *devices;
@end
/**
* Request for CreateSignedDevice method.
*/
@interface GTLRSASPortal_CreateSignedDeviceRequest : GTLRObject
/**
* Required. JSON Web Token signed using a CPI private key. Payload
* must be the JSON encoding of the [Device]. The user_id field must be set.
*
* Contains encoded binary data; GTLRBase64 can encode/decode (probably
* web-safe format).
*/
@property(nonatomic, copy, nullable) NSString *encodedDevice;
/**
* Required. Unique installer id (cpiId) from the Certified Professional
* Installers database.
*/
@property(nonatomic, copy, nullable) NSString *installerId;
@end
/**
* Entity representing a SAS customer.
*/
@interface GTLRSASPortal_Customer : GTLRObject
/** Required. Name of the organization that the customer entity represents. */
@property(nonatomic, copy, nullable) NSString *displayName;
/** Output only. Resource name of the customer. */
@property(nonatomic, copy, nullable) NSString *name;
/** User IDs used by the devices belonging to this customer. */
@property(nonatomic, strong, nullable) NSArray<NSString *> *sasUserIds;
@end
/**
* GTLRSASPortal_Device
*/
@interface GTLRSASPortal_Device : GTLRObject
/**
* Output only. Current configuration of the device as registered to the SAS.
*/
@property(nonatomic, strong, nullable) GTLRSASPortal_DeviceConfig *activeConfig;
/**
* Device parameters that can be overridden by both SAS Portal and SAS
* registration requests.
*/
@property(nonatomic, strong, nullable) GTLRSASPortal_DeviceMetadata *deviceMetadata;
/** Device display name. */
@property(nonatomic, copy, nullable) NSString *displayName;
/** The FCC identifier of the device. */
@property(nonatomic, copy, nullable) NSString *fccId;
/** Output only. Grants held by the device. */
@property(nonatomic, strong, nullable) NSArray<GTLRSASPortal_DeviceGrant *> *grants;
/** Output only. The resource path name. */
@property(nonatomic, copy, nullable) NSString *name;
/** Configuration of the device, as specified via SAS Portal API. */
@property(nonatomic, strong, nullable) GTLRSASPortal_DeviceConfig *preloadedConfig;
/**
* A serial number assigned to the device by the device
* manufacturer.
*/
@property(nonatomic, copy, nullable) NSString *serialNumber;
/**
* Output only. Device state.
*
* Likely values:
* @arg @c kGTLRSASPortal_Device_State_Deregistered Device de-registered with
* SAS. (Value: "DEREGISTERED")
* @arg @c kGTLRSASPortal_Device_State_DeviceStateUnspecified Unspecified
* state. (Value: "DEVICE_STATE_UNSPECIFIED")
* @arg @c kGTLRSASPortal_Device_State_Registered Device registered with SAS.
* (Value: "REGISTERED")
* @arg @c kGTLRSASPortal_Device_State_Reserved Device created in the SAS
* Portal, however, not yet registered
* with SAS. (Value: "RESERVED")
*/
@property(nonatomic, copy, nullable) NSString *state;
@end
/**
* Information about the device's air interface.
*/
@interface GTLRSASPortal_DeviceAirInterface : GTLRObject
/**
* This field specifies the radio access technology that is used for the CBSD.
* Conditional
*
* Likely values:
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_CambiumNetworks
* Value "CAMBIUM_NETWORKS"
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_Cw Value "CW"
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_DoodleCbrs Value
* "DOODLE_CBRS"
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_EUtra Value
* "E_UTRA"
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_FourGBbwSaa1
* Value "FOUR_G_BBW_SAA_1"
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_Nr Value "NR"
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_RadioTechnologyUnspecified
* Value "RADIO_TECHNOLOGY_UNSPECIFIED"
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_Redline Value
* "REDLINE"
* @arg @c kGTLRSASPortal_DeviceAirInterface_RadioTechnology_TaranaWireless
* Value "TARANA_WIRELESS"
*/
@property(nonatomic, copy, nullable) NSString *radioTechnology;
/**
* This field is related to the radioTechnology field and provides the air
* interface specification that the CBSD is compliant with at the time of
* registration.
* Optional
*/
@property(nonatomic, copy, nullable) NSString *supportedSpec;
@end
/**
* Information about the device configuration.
*/
@interface GTLRSASPortal_DeviceConfig : GTLRObject
/** Information about this device's air interface. */
@property(nonatomic, strong, nullable) GTLRSASPortal_DeviceAirInterface *airInterface;
/** The call sign of the device operator. */
@property(nonatomic, copy, nullable) NSString *callSign;
/**
* FCC category of the device.
*
* Likely values:
* @arg @c kGTLRSASPortal_DeviceConfig_Category_DeviceCategoryA Category A.
* (Value: "DEVICE_CATEGORY_A")
* @arg @c kGTLRSASPortal_DeviceConfig_Category_DeviceCategoryB Category B.
* (Value: "DEVICE_CATEGORY_B")
* @arg @c kGTLRSASPortal_DeviceConfig_Category_DeviceCategoryUnspecified
* Unspecified device category. (Value: "DEVICE_CATEGORY_UNSPECIFIED")
*/
@property(nonatomic, copy, nullable) NSString *category;
/** Installation parameters for the device. */
@property(nonatomic, strong, nullable) GTLRSASPortal_InstallationParams *installationParams;
/**
* Output-only. Whether the configuration has been signed by a CPI.
*
* Uses NSNumber of boolValue.
*/
@property(nonatomic, strong, nullable) NSNumber *isSigned;
/** Measurement reporting capabilities of the device. */
@property(nonatomic, strong, nullable) NSArray<NSString *> *measurementCapabilities;
/** Information about this device model. */
@property(nonatomic, strong, nullable) GTLRSASPortal_DeviceModel *model;
/**
* State of the configuration.
*
* Likely values:
* @arg @c kGTLRSASPortal_DeviceConfig_State_DeviceConfigStateUnspecified
* Value "DEVICE_CONFIG_STATE_UNSPECIFIED"
* @arg @c kGTLRSASPortal_DeviceConfig_State_Draft Value "DRAFT"
* @arg @c kGTLRSASPortal_DeviceConfig_State_Final Value "FINAL"
*/
@property(nonatomic, copy, nullable) NSString *state;
/** Output-only. The last time the device configuration was edited. */
@property(nonatomic, strong, nullable) GTLRDateTime *updateTime;
/** The identifier of a device user. */
@property(nonatomic, copy, nullable) NSString *userId;
@end
/**
* Device grant. It is an authorization provided by the Spectrum
* Access System to a device to transmit using specified operating
* parameters after a successful heartbeat by the device.
*/
@interface GTLRSASPortal_DeviceGrant : GTLRObject
/**
* Type of channel used.
*
* Likely values:
* @arg @c kGTLRSASPortal_DeviceGrant_ChannelType_ChannelTypeGaa Value
* "CHANNEL_TYPE_GAA"
* @arg @c kGTLRSASPortal_DeviceGrant_ChannelType_ChannelTypePal Value
* "CHANNEL_TYPE_PAL"
* @arg @c kGTLRSASPortal_DeviceGrant_ChannelType_ChannelTypeUnspecified
* Value "CHANNEL_TYPE_UNSPECIFIED"
*/
@property(nonatomic, copy, nullable) NSString *channelType;
/** The expiration time of the grant. */
@property(nonatomic, strong, nullable) GTLRDateTime *expireTime;
/** The transmission frequency range. */
@property(nonatomic, strong, nullable) GTLRSASPortal_FrequencyRange *frequencyRange;
/**
* Maximum Equivalent Isotropically Radiated Power (EIRP) permitted
* by the grant. The maximum EIRP is in units of dBm/MHz. The
* value of maxEirp represents the average (RMS) EIRP that would be
* measured by the procedure defined in FCC part 96.41(e)(3).
*
* Uses NSNumber of doubleValue.
*/
@property(nonatomic, strong, nullable) NSNumber *maxEirp;
/** The DPA move lists on which this grant appears. */
@property(nonatomic, strong, nullable) NSArray<GTLRSASPortal_DpaMoveList *> *moveList;
/**
* State of the grant.
*
* Likely values:
* @arg @c kGTLRSASPortal_DeviceGrant_State_GrantStateAuthorized The device
* is currently transmitting. (Value: "GRANT_STATE_AUTHORIZED")
* @arg @c kGTLRSASPortal_DeviceGrant_State_GrantStateExpired The grant has
* expired. (Value: "GRANT_STATE_EXPIRED")
* @arg @c kGTLRSASPortal_DeviceGrant_State_GrantStateGranted The grant has
* been granted but the device is not heartbeating on it. (Value:
* "GRANT_STATE_GRANTED")
* @arg @c kGTLRSASPortal_DeviceGrant_State_GrantStateSuspended The grant has
* been suspended by the SAS. (Value: "GRANT_STATE_SUSPENDED")
* @arg @c kGTLRSASPortal_DeviceGrant_State_GrantStateTerminated The grant
* has been terminated by the SAS. (Value: "GRANT_STATE_TERMINATED")
* @arg @c kGTLRSASPortal_DeviceGrant_State_GrantStateUnspecified Value
* "GRANT_STATE_UNSPECIFIED"
*/
@property(nonatomic, copy, nullable) NSString *state;
/** If the grant is suspended, the reason(s) for suspension. */
@property(nonatomic, strong, nullable) NSArray<NSString *> *suspensionReason;
@end
/**
* Device data overridable by both SAS Portal and registration requests.
*/
@interface GTLRSASPortal_DeviceMetadata : GTLRObject
@end
/**
* Information about the model of the device.
*/
@interface GTLRSASPortal_DeviceModel : GTLRObject
/** The firmware version of the device. */
@property(nonatomic, copy, nullable) NSString *firmwareVersion;
/** The hardware version of the device. */
@property(nonatomic, copy, nullable) NSString *hardwareVersion;
/** The name of the device model. */
@property(nonatomic, copy, nullable) NSString *name;
/** The software version of the device. */
@property(nonatomic, copy, nullable) NSString *softwareVersion;
/** The name of the device vendor. */
@property(nonatomic, copy, nullable) NSString *vendor;
@end
/**
* An entry in a DPA's move list.
*/
@interface GTLRSASPortal_DpaMoveList : GTLRObject
/** The ID of the DPA. */
@property(nonatomic, copy, nullable) NSString *dpaId;
/** The frequency range that the move list affects. */
@property(nonatomic, strong, nullable) GTLRSASPortal_FrequencyRange *frequencyRange;
@end
/**
* A generic empty message that you can re-use to avoid defining duplicated
* empty messages in your APIs. A typical example is to use it as the request
* or the response type of an API method. For instance:
* service Foo {
* rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
* }
* The JSON representation for `Empty` is empty JSON object `{}`.
*/
@interface GTLRSASPortal_Empty : GTLRObject
@end
/**
* Frequency range from `low_frequency` to `high_frequency`.
*/
@interface GTLRSASPortal_FrequencyRange : GTLRObject
/**
* The highest frequency of the frequency range in MHz.
*
* Uses NSNumber of doubleValue.
*/
@property(nonatomic, strong, nullable) NSNumber *highFrequencyMhz;
/**
* The lowest frequency of the frequency range in MHz.
*
* Uses NSNumber of doubleValue.
*/
@property(nonatomic, strong, nullable) NSNumber *lowFrequencyMhz;
@end
/**
* Request for GenerateSecret method]
* [spectrum.sas.portal.v1alpha1.DeviceManager.GenerateSecret].
*/
@interface GTLRSASPortal_GenerateSecretRequest : GTLRObject
@end
/**
* Response for GenerateSecret method.
*/
@interface GTLRSASPortal_GenerateSecretResponse : GTLRObject
/**
* The secret generated by the string and used by
* [ValidateInstaller] method.
*/
@property(nonatomic, copy, nullable) NSString *secret;
@end
/**
* Request message for `GetPolicy` method.
*/
@interface GTLRSASPortal_GetPolicyRequest : GTLRObject
/** Required. The resource for which the policy is being requested. */
@property(nonatomic, copy, nullable) NSString *resource;
@end
/**
* Information about the device installation parameters.
*/
@interface GTLRSASPortal_InstallationParams : GTLRObject
/**
* Boresight direction of the horizontal plane of the antenna in
* degrees with respect to true north. The value of this parameter
* is an integer with a value between 0 and 359 inclusive. A value
* of 0 degrees means true north; a value of 90 degrees means
* east. This parameter is optional for Category A devices and
* conditional for Category B devices.
*
* Uses NSNumber of intValue.
*/
@property(nonatomic, strong, nullable) NSNumber *antennaAzimuth;
/**
* 3-dB antenna beamwidth of the antenna in the horizontal-plane in
* degrees. This parameter is an unsigned integer having a value
* between 0 and 360 (degrees) inclusive; it is optional for
* Category A devices and conditional for Category B devices.
*
* Uses NSNumber of intValue.
*/
@property(nonatomic, strong, nullable) NSNumber *antennaBeamwidth;
/**
* Antenna downtilt in degrees and is an integer with a value
* between -90 and +90 inclusive; a negative value means the antenna
* is tilted up (above horizontal). This parameter is optional for
* Category A devices and conditional for Category B devices.
*
* Uses NSNumber of intValue.
*/
@property(nonatomic, strong, nullable) NSNumber *antennaDowntilt;
/**
* Peak antenna gain in dBi. This parameter is an integer with a
* value between -127 and +128 (dBi) inclusive.
*
* Uses NSNumber of intValue.
*/
@property(nonatomic, strong, nullable) NSNumber *antennaGain;
/**
* If an external antenna is used, the antenna model is optionally
* provided in this field. The string has a maximum length of 128
* octets.
*/
@property(nonatomic, copy, nullable) NSString *antennaModel;
/**
* If present, this parameter specifies whether the CBSD is a CPE-CBSD or not.
*
* Uses NSNumber of boolValue.
*/
@property(nonatomic, strong, nullable) NSNumber *cpeCbsdIndication;
/**
* This parameter is the maximum device EIRP in units of dBm/10MHz
* and is an integer with a value between -127 and +47 (dBm/10 MHz)
* inclusive. If not included, SAS interprets it as maximum
* allowable EIRP in units of dBm/10MHz for device category.
*
* Uses NSNumber of intValue.
*/
@property(nonatomic, strong, nullable) NSNumber *eirpCapability;
/**
* Device antenna height in meters. When the heightType parameter
* value is "AGL", the antenna height should be given relative to
* ground level. When the heightType parameter value is "AMSL", it
* is given with respect to WGS84 datum.
*
* Uses NSNumber of doubleValue.
*/
@property(nonatomic, strong, nullable) NSNumber *height;
/**
* Specifies how the height is measured.
*
* Likely values:
* @arg @c kGTLRSASPortal_InstallationParams_HeightType_HeightTypeAgl AGL
* height is measured relative to the ground level. (Value:
* "HEIGHT_TYPE_AGL")
* @arg @c kGTLRSASPortal_InstallationParams_HeightType_HeightTypeAmsl AMSL
* height is measured relative to the mean sea level. (Value:
* "HEIGHT_TYPE_AMSL")
* @arg @c kGTLRSASPortal_InstallationParams_HeightType_HeightTypeUnspecified
* Unspecified height type. (Value: "HEIGHT_TYPE_UNSPECIFIED")
*/
@property(nonatomic, copy, nullable) NSString *heightType;
/**
* A positive number in meters to indicate accuracy of the device
* antenna horizontal location. This optional parameter should only
* be present if its value is less than the FCC requirement of 50
* meters.
*
* Uses NSNumber of doubleValue.
*/
@property(nonatomic, strong, nullable) NSNumber *horizontalAccuracy;
/**
* Whether the device antenna is indoor or not. True: indoor. False:
* outdoor.
*
* Uses NSNumber of boolValue.
*/
@property(nonatomic, strong, nullable) NSNumber *indoorDeployment;
/**
* Latitude of the device antenna location in degrees relative to
* the WGS 84 datum. The allowed range is from -90.000000 to
* +90.000000. Positive values represent latitudes north of the
* equator; negative values south of the equator.
*
* Uses NSNumber of doubleValue.
*/
@property(nonatomic, strong, nullable) NSNumber *latitude;
/**
* Longitude of the device antenna location. in degrees relative to
* the WGS 84 datum. The allowed range is from -180.000000 to
* +180.000000. Positive values represent longitudes east of the
* prime meridian; negative values west of the prime
* meridian.
*
* Uses NSNumber of doubleValue.
*/
@property(nonatomic, strong, nullable) NSNumber *longitude;
/**
* A positive number in meters to indicate accuracy of the device
* antenna vertical location. This optional parameter should only be
* present if its value is less than the FCC requirement of 3
* meters.
*
* Uses NSNumber of doubleValue.
*/
@property(nonatomic, strong, nullable) NSNumber *verticalAccuracy;
@end
/**
* Response for `ListCustomers`.
*
* @note This class supports NSFastEnumeration and indexed subscripting over
* its "customers" property. If returned as the result of a query, it
* should support automatic pagination (when @c shouldFetchNextPages is
* enabled).
*/
@interface GTLRSASPortal_ListCustomersResponse : GTLRCollectionObject
/**
* The list of customers that
* match the request.
*
* @note This property is used to support NSFastEnumeration and indexed
* subscripting on this class.
*/
@property(nonatomic, strong, nullable) NSArray<GTLRSASPortal_Customer *> *customers;
/**
* A pagination token returned from a previous call to ListCustomers method
* that indicates from
* where listing should continue. If the field is missing or empty, it means
* there are no more customers.
*/
@property(nonatomic, copy, nullable) NSString *nextPageToken;
@end
/**
* Response for ListDevices method.
*
* @note This class supports NSFastEnumeration and indexed subscripting over
* its "devices" property. If returned as the result of a query, it
* should support automatic pagination (when @c shouldFetchNextPages is
* enabled).
*/
@interface GTLRSASPortal_ListDevicesResponse : GTLRCollectionObject
/**
* The devices that match the request.
*
* @note This property is used to support NSFastEnumeration and indexed
* subscripting on this class.
*/
@property(nonatomic, strong, nullable) NSArray<GTLRSASPortal_Device *> *devices;
/**
* A pagination token returned from a previous call to ListDevices method
* that indicates from where listing should continue. If the field
* is missing or empty, it means there is no more devices.
*/
@property(nonatomic, copy, nullable) NSString *nextPageToken;
@end
/**
* Response for ListNodes method.
*
* @note This class supports NSFastEnumeration and indexed subscripting over
* its "nodes" property. If returned as the result of a query, it should
* support automatic pagination (when @c shouldFetchNextPages is
* enabled).
*/
@interface GTLRSASPortal_ListNodesResponse : GTLRCollectionObject
/**
* A pagination token returned from a previous call to
* ListNodes method
* that indicates from where listing should continue. If the field is missing
* or empty, it means there is no more nodes.
*/
@property(nonatomic, copy, nullable) NSString *nextPageToken;
/**
* The nodes that match the request.
*
* @note This property is used to support NSFastEnumeration and indexed
* subscripting on this class.
*/
@property(nonatomic, strong, nullable) NSArray<GTLRSASPortal_Node *> *nodes;
@end
/**
* Request for MoveDevice method.
*/
@interface GTLRSASPortal_MoveDeviceRequest : GTLRObject
/**
* Required. The name of the new parent resource (Node or Customer) to
* reparent the device under.
*/
@property(nonatomic, copy, nullable) NSString *destination;
@end
/**
* Request for MoveNode method.
*/
@interface GTLRSASPortal_MoveNodeRequest : GTLRObject
/**
* Required. The name of the new parent resource node or Customer) to reparent
* the node under.
*/
@property(nonatomic, copy, nullable) NSString *destination;
@end
/**
* The Node.
*/
@interface GTLRSASPortal_Node : GTLRObject
/** The node's display name. */
@property(nonatomic, copy, nullable) NSString *displayName;
/** Output only. Resource name. */
@property(nonatomic, copy, nullable) NSString *name;
/** User ids used by the devices belonging to this node. */
@property(nonatomic, strong, nullable) NSArray<NSString *> *sasUserIds;
@end
/**
* This resource represents a long-running operation that is the result of a
* network API call.
*/
@interface GTLRSASPortal_Operation : GTLRObject
/**
* If the value is `false`, it means the operation is still in progress.
* If `true`, the operation is completed, and either `error` or `response` is
* available.
*
* Uses NSNumber of boolValue.
*/
@property(nonatomic, strong, nullable) NSNumber *done;
/** The error result of the operation in case of failure or cancellation. */
@property(nonatomic, strong, nullable) GTLRSASPortal_Status *error;
/**
* Service-specific metadata associated with the operation. It typically
* contains progress information and common metadata such as create time.
* Some services might not provide such metadata. Any method that returns a
* long-running operation should document the metadata type, if any.
*/
@property(nonatomic, strong, nullable) GTLRSASPortal_Operation_Metadata *metadata;
/**
* The server-assigned name, which is only unique within the same service that
* originally returns it. If you use the default HTTP mapping, the
* `name` should be a resource name ending with `operations/{unique_id}`.
*/
@property(nonatomic, copy, nullable) NSString *name;
/**
* The normal response of the operation in case of success. If the original
* method returns no data on success, such as `Delete`, the response is
* `google.protobuf.Empty`. If the original method is standard
* `Get`/`Create`/`Update`, the response should be the resource. For other
* methods, the response should have the type `XxxResponse`, where `Xxx`
* is the original method name. For example, if the original method name
* is `TakeSnapshot()`, the inferred response type is
* `TakeSnapshotResponse`.
*/
@property(nonatomic, strong, nullable) GTLRSASPortal_Operation_Response *response;
@end
/**
* Service-specific metadata associated with the operation. It typically
* contains progress information and common metadata such as create time.
* Some services might not provide such metadata. Any method that returns a
* long-running operation should document the metadata type, if any.
*
* @note This class is documented as having more properties of any valid JSON
* type. Use @c -additionalJSONKeys and @c -additionalPropertyForName: to
* get the list of properties and then fetch them; or @c
* -additionalProperties to fetch them all at once.
*/
@interface GTLRSASPortal_Operation_Metadata : GTLRObject
@end
/**
* The normal response of the operation in case of success. If the original
* method returns no data on success, such as `Delete`, the response is
* `google.protobuf.Empty`. If the original method is standard
* `Get`/`Create`/`Update`, the response should be the resource. For other
* methods, the response should have the type `XxxResponse`, where `Xxx`
* is the original method name. For example, if the original method name
* is `TakeSnapshot()`, the inferred response type is
* `TakeSnapshotResponse`.
*
* @note This class is documented as having more properties of any valid JSON
* type. Use @c -additionalJSONKeys and @c -additionalPropertyForName: to
* get the list of properties and then fetch them; or @c
* -additionalProperties to fetch them all at once.
*/
@interface GTLRSASPortal_Operation_Response : GTLRObject
@end
/**
* Defines an access control policy to the resources.
*/
@interface GTLRSASPortal_Policy : GTLRObject
@property(nonatomic, strong, nullable) NSArray<GTLRSASPortal_Assignment *> *assignments;
/**
* The [etag] is used for optimistic concurrency control as a way to
* help prevent simultaneous updates of a policy from overwriting
* each other. It is strongly suggested that systems make use of
* the [etag] in the read-modify-write cycle to perform policy
* updates in order to avoid race conditions: An [etag] is returned
* in the response to [GetPolicy], and systems are expected to put
* that etag in the request to [SetPolicy] to ensure that their
* change will be applied to the same version of the policy.
* If no [etag] is provided in the call to [SetPolicy], then the
* existing policy is overwritten blindly.
*
* Contains encoded binary data; GTLRBase64 can encode/decode (probably
* web-safe format).
*/
@property(nonatomic, copy, nullable) NSString *ETag;
@end
/**
* Request message for `SetPolicy` method.
*/
@interface GTLRSASPortal_SetPolicyRequest : GTLRObject
/** Required. The policy to be applied to the `resource`. */
@property(nonatomic, strong, nullable) GTLRSASPortal_Policy *policy;
/**
* Required. The resource for which the policy is being specified. This policy
* replaces any existing policy.
*/
@property(nonatomic, copy, nullable) NSString *resource;
@end
/**
* Request for SignDevice method.
*/
@interface GTLRSASPortal_SignDeviceRequest : GTLRObject
/**
* Required. The device to sign.
* The device fields name, fcc_id and serial_number must be set.
* The user_id field must be set.
*/
@property(nonatomic, strong, nullable) GTLRSASPortal_Device *device;
@end
/**
* The `Status` type defines a logical error model that is suitable for
* different programming environments, including REST APIs and RPC APIs. It is
* used by [gRPC](https://github.com/grpc). Each `Status` message contains
* three pieces of data: error code, error message, and error details.
* You can find out more about this error model and how to work with it in the
* [API Design Guide](https://cloud.google.com/apis/design/errors).
*/
@interface GTLRSASPortal_Status : GTLRObject
/**
* The status code, which should be an enum value of google.rpc.Code.
*
* Uses NSNumber of intValue.
*/
@property(nonatomic, strong, nullable) NSNumber *code;
/**
* A list of messages that carry the error details. There is a common set of
* message types for APIs to use.
*/
@property(nonatomic, strong, nullable) NSArray<GTLRSASPortal_Status_Details_Item *> *details;
/**
* A developer-facing error message, which should be in English. Any
* user-facing error message should be localized and sent in the
* google.rpc.Status.details field, or localized by the client.
*/
@property(nonatomic, copy, nullable) NSString *message;
@end
/**
* GTLRSASPortal_Status_Details_Item
*
* @note This class is documented as having more properties of any valid JSON
* type. Use @c -additionalJSONKeys and @c -additionalPropertyForName: to
* get the list of properties and then fetch them; or @c
* -additionalProperties to fetch them all at once.
*/
@interface GTLRSASPortal_Status_Details_Item : GTLRObject
@end
/**
* Request message for `TestPermissions` method.
*/
@interface GTLRSASPortal_TestPermissionsRequest : GTLRObject
/** The set of permissions to check for the `resource`. */
@property(nonatomic, strong, nullable) NSArray<NSString *> *permissions;
/** Required. The resource for which the permissions are being requested. */
@property(nonatomic, copy, nullable) NSString *resource;
@end
/**
* Response message for `TestPermissions` method.
*/
@interface GTLRSASPortal_TestPermissionsResponse : GTLRObject
/** A set of permissions that the caller is allowed. */
@property(nonatomic, strong, nullable) NSArray<NSString *> *permissions;
@end
/**
* Request for UpdateSignedDevice method.
*/
@interface GTLRSASPortal_UpdateSignedDeviceRequest : GTLRObject
/**
* Required. The JSON Web Token signed using a CPI private key. Payload
* must be the JSON encoding
* of the device. The user_id field must be set.
*
* Contains encoded binary data; GTLRBase64 can encode/decode (probably
* web-safe format).
*/
@property(nonatomic, copy, nullable) NSString *encodedDevice;
/**
* Required. Unique installer ID (CPI ID) from the Certified Professional
* Installers database.
*/
@property(nonatomic, copy, nullable) NSString *installerId;
@end
/**
* Request for ValidateInstaller method.
*/
@interface GTLRSASPortal_ValidateInstallerRequest : GTLRObject
/**
* Required. JSON Web Token signed using a CPI private key. Payload
* must include a "secret" claim whose value is the secret.
*/
@property(nonatomic, copy, nullable) NSString *encodedSecret;
/**
* Required. Unique installer id (cpiId) from the Certified
* Professional Installers database.
*/
@property(nonatomic, copy, nullable) NSString *installerId;
/** Required. Secret returned by the GenerateSecret method. */
@property(nonatomic, copy, nullable) NSString *secret;
@end
/**
* Response for ValidateInstaller method]
* [spectrum.sas.portal.v1alpha1.DeviceManager.ValidateInstaller].
*/
@interface GTLRSASPortal_ValidateInstallerResponse : GTLRObject
@end
NS_ASSUME_NONNULL_END
#pragma clang diagnostic pop
| 32.338723 | 134 | 0.737144 | [
"object",
"model"
] |
cb8c1738bba970e4cbbe0b39d355ef8c98a1ebad | 113,200 | h | C | Prj-Linux/opencv-release/3rdparty/ippicv/ippicv_lnx/icv/include/ippicv_l.h | iamike/HyperLPR | 8941161750feec2934459ec328d7e586cf28c741 | [
"Apache-2.0"
] | null | null | null | Prj-Linux/opencv-release/3rdparty/ippicv/ippicv_lnx/icv/include/ippicv_l.h | iamike/HyperLPR | 8941161750feec2934459ec328d7e586cf28c741 | [
"Apache-2.0"
] | 7 | 2021-05-24T22:57:32.000Z | 2021-08-23T05:32:30.000Z | 3rdparty/build_opencv-4.5.2/3rdparty/ippicv/ippicv_mac/icv/include/ippicv_l.h | LordOfTheUnicorn/trdrop | 6da4bf1528878e90cf14232dfb4adeec3458ee0f | [
"MIT"
] | null | null | null | /*
// Copyright 2014-2019 Intel Corporation All Rights Reserved.
//
// The source code, information and material ("Material") contained herein is
// owned by Intel Corporation or its suppliers or licensors, and title
// to such Material remains with Intel Corporation or its suppliers or
// licensors. The Material contains proprietary information of Intel
// or its suppliers and licensors. The Material is protected by worldwide
// copyright laws and treaty provisions. No part of the Material may be used,
// copied, reproduced, modified, published, uploaded, posted, transmitted,
// distributed or disclosed in any way without Intel's prior express written
// permission. No license under any patent, copyright or other intellectual
// property rights in the Material is granted to or conferred upon you,
// either expressly, by implication, inducement, estoppel or otherwise.
// Any license under such intellectual property rights must be express and
// approved by Intel in writing.
//
// Unless otherwise agreed by Intel in writing,
// you may not remove or alter this notice or any other notice embedded in
// Materials by Intel or Intel's suppliers or licensors in any way.
//
*/
#if !defined( __IPPICV_L_H__ )
#define __IPPICV_L_H__
#ifdef __cplusplus
extern "C" {
#endif
#include "ippicv_defs_l.h"
#include "ippicv_types_l.h"
#include "ippicv_redefs.h"
#include "ippversion.h"
/* =============================================================================
ippCore
============================================================================= */
/* /////////////////////////////////////////////////////////////////////////////
// Functions to allocate memory
///////////////////////////////////////////////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippMalloc_L
// Purpose: 64-byte aligned memory allocation
// Parameter:
// len number of bytes
// Returns: pointer to allocated memory
//
// Notes: the memory allocated by ippMalloc has to be free by ippFree
// function only.
*/
IPPAPI(void*, ippMalloc_L, (IppSizeL length))
/* =============================================================================
ippVM
============================================================================= */
/* =============================================================================
ippSP
============================================================================= */
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippsMalloc*_L
// Purpose: 64-byte aligned memory allocation
// Parameter:
// len number of elements (according to their type)
// Returns: pointer to allocated memory
//
// Notes: the memory allocated by ippsMalloc has to be free by ippsFree
// function only.
*/
IPPAPI(Ipp8u*, ippsMalloc_8u_L, (IppSizeL len))
/* =============================================================================
ippIP
============================================================================= */
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippiCopy..L
//
// Purpose: copy pixel values from the source image to the destination image
//
//
// Returns:
// ippStsNullPtrErr One of the pointers is NULL
// ippStsSizeErr roiSize has a field with zero or negative value
// ippStsNoErr OK
//
// Parameters:
// pSrc Pointer to the source image buffer
// srcStep Step in bytes through the source image buffer
// pDst Pointer to the destination image buffer
// dstStep Step in bytes through the destination image buffer
// roiSize Size of the ROI
// pMask Pointer to the mask image buffer
// maskStep Step in bytes through the mask image buffer
*/
IPPAPI(IppStatus, ippiCopy_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize))
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippiCopyReplicateBorder
//
// Purpose: Copies pixel values between two buffers and adds
// the replicated border pixels.
//
// Returns:
// ippStsNullPtrErr One of the pointers is NULL
// ippStsSizeErr 1). srcRoiSize or dstRoiSize has a field with negative or zero value
// 2). topBorderHeight or leftBorderWidth is less than zero
// 3). dstRoiSize.width < srcRoiSize.width + leftBorderWidth
// 4). dstRoiSize.height < srcRoiSize.height + topBorderHeight
// ippStsStepErr srcStep or dstStep is less than or equal to zero
// ippStsNoErr OK
//
// Parameters:
// pSrc Pointer to the source image buffer
// srcStep Step in bytes through the source image
// pDst Pointer to the destination image buffer
// dstStep Step in bytes through the destination image
// scrRoiSize Size of the source ROI in pixels
// dstRoiSize Size of the destination ROI in pixels
// topBorderHeight Height of the top border in pixels
// leftBorderWidth Width of the left border in pixels
*/
IPPAPI(IppStatus, ippiCopyReplicateBorder_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32s_C1R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32s_C3R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32s_C4R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32s_C1IR_L,(const Ipp32s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32s_C3IR_L, (const Ipp32s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32s_C4IR_L, (const Ipp32s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32f_C1IR_L, (const Ipp32f* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32f_C3IR_L, (const Ipp32f* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_32f_C4IR_L, (const Ipp32f* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_8u_C1IR_L, (const Ipp8u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_8u_C3IR_L, (const Ipp8u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_8u_C4IR_L, (const Ipp8u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16u_C1IR_L, (const Ipp16u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16u_C3IR_L, (const Ipp16u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16u_C4IR_L, (const Ipp16u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16s_C1IR_L, (const Ipp16s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16s_C3IR_L, (const Ipp16s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyReplicateBorder_16s_C4IR_L, (const Ipp16s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippiCopyWrapBorder
//
// Purpose: Copies pixel values between two buffers and adds the border pixels.
//
// Returns:
// ippStsNullPtrErr One of the pointers is NULL
// ippStsSizeErr 1). srcRoiSize or dstRoiSize has a field with negative or zero value
// 2). topBorderHeight or leftBorderWidth is less than zero
// 3). dstRoiSize.width < srcRoiSize.width + leftBorderWidth
// 4). dstRoiSize.height < srcRoiSize.height + topBorderHeight
// ippStsStepErr srcStep or dstStep is less than or equal to zero
// ippStsNoErr OK
//
// Parameters:
// pSrc Pointer to the source image buffer
// srcStep Step in bytes through the source image
// pDst Pointer to the destination image buffer
// dstStep Step in bytes through the destination image
// scrRoiSize Size of the source ROI in pixels
// dstRoiSize Size of the destination ROI in pixels
// topBorderHeight Height of the top border in pixels
// leftBorderWidth Width of the left border in pixels
*/
IPPAPI(IppStatus, ippiCopyWrapBorder_32s_C1R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyWrapBorder_32s_C1IR_L, (const Ipp32s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyWrapBorder_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyWrapBorder_32f_C1IR_L, (const Ipp32f* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippiCopyConstBorder
//
// Purpose: Copies pixel values between two buffers and adds
// the border pixels with constant value.
//
// Returns:
// ippStsNullPtrErr One of the pointers is NULL
// ippStsSizeErr 1). srcRoiSize or dstRoiSize has a field with negative or zero value
// 2). topBorderHeight or leftBorderWidth is less than zero
// 3). dstRoiSize.width < srcRoiSize.width + leftBorderWidth
// 4). dstRoiSize.height < srcRoiSize.height + topBorderHeight
// ippStsStepErr srcStep or dstStep is less than or equal to zero
// ippStsNoErr OK
//
// Parameters:
// pSrc Pointer to the source image buffer
// srcStep Step in bytes through the source image
// pDst Pointer to the destination image buffer
// dstStep Step in bytes through the destination image
// srcRoiSize Size of the source ROI in pixels
// dstRoiSize Size of the destination ROI in pixels
// topBorderHeight Height of the top border in pixels
// leftBorderWidth Width of the left border in pixels
// value Constant value to assign to the border pixels
*/
IPPAPI(IppStatus, ippiCopyConstBorder_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, Ipp8u value))
IPPAPI(IppStatus, ippiCopyConstBorder_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp8u value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp8u value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, Ipp16s value))
IPPAPI(IppStatus, ippiCopyConstBorder_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp16s value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp16s value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_32s_C1R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, Ipp32s value))
IPPAPI(IppStatus, ippiCopyConstBorder_32s_C3R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp32s value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_32s_C4R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp32s value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, Ipp16u value))
IPPAPI(IppStatus, ippiCopyConstBorder_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp16u value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp16u value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, Ipp32f value))
IPPAPI(IppStatus, ippiCopyConstBorder_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp32f value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth, const Ipp32f value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_8u_C1IR_L, (Ipp8u* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp8u value))
IPPAPI(IppStatus, ippiCopyConstBorder_8u_C3IR_L, (Ipp8u* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp8u value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_8u_C4IR_L, (Ipp8u* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp8u value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_16u_C1IR_L, (Ipp16u* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp16u value))
IPPAPI(IppStatus, ippiCopyConstBorder_16u_C3IR_L, (Ipp16u* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp16u value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_16u_C4IR_L, (Ipp16u* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp16u value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_16s_C1IR_L, (Ipp16s* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp16s value))
IPPAPI(IppStatus, ippiCopyConstBorder_16s_C3IR_L, (Ipp16s* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp16s value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_16s_C4IR_L, (Ipp16s* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp16s value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_32s_C1IR_L, (Ipp32s* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp32s value))
IPPAPI(IppStatus, ippiCopyConstBorder_32s_C3IR_L, (Ipp32s* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp32s value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_32s_C4IR_L, (Ipp32s* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp32s value[4]))
IPPAPI(IppStatus, ippiCopyConstBorder_32f_C1IR_L, (Ipp32f* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp32f value))
IPPAPI(IppStatus, ippiCopyConstBorder_32f_C3IR_L, (Ipp32f* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp32f value[3]))
IPPAPI(IppStatus, ippiCopyConstBorder_32f_C4IR_L, (Ipp32f* pSrcDst, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth, const Ipp32f value[4]))
/* ////////////////////////////////////////////////////////////////////////////
// Name: ippiCopyMirrorBorder
//
// Purpose: Copies pixel values between two buffers and adds
// the mirror border pixels.
//
// Returns:
// ippStsNullPtrErr One of the pointers is NULL
// ippStsSizeErr 1). srcRoiSize or dstRoiSize has a field with negative or zero value
// 2). topBorderHeight or leftBorderWidth is less than zero
// 3). dstRoiSize.width < srcRoiSize.width + leftBorderWidth
// 4). dstRoiSize.height < srcRoiSize.height + topBorderHeight
// ippStsStepErr srcStep or dstStep is less than or equal to zero
// ippStsNoErr OK
//
// Parameters:
// pSrc Pointer to the source image buffer
// srcStep Step in bytes through the source image
// pDst Pointer to the destination image buffer
// dstStep Step in bytes through the destination image
// scrRoiSize Size of the source ROI in pixels
// dstRoiSize Size of the destination ROI in pixels
// topBorderHeight Height of the top border in pixels
// leftBorderWidth Width of the left border in pixels
*/
IPPAPI(IppStatus, ippiCopyMirrorBorder_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp8u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32s_C1R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32s_C3R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32s_C4R_L, (const Ipp32s* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32s* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_8u_C1IR_L, (const Ipp8u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_8u_C3IR_L, (const Ipp8u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_8u_C4IR_L, (const Ipp8u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16s_C1IR_L, (const Ipp16s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16s_C3IR_L, (const Ipp16s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16s_C4IR_L, (const Ipp16s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32s_C1IR_L, (const Ipp32s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32s_C3IR_L, (const Ipp32s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32s_C4IR_L, (const Ipp32s* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16u_C1IR_L, (const Ipp16u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16u_C3IR_L, (const Ipp16u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16u_C4IR_L, (const Ipp16u* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp16u* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, IppiSizeL srcRoiSize, Ipp32f* pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftBorderWidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32f_C1IR_L, (const Ipp32f* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32f_C3IR_L, (const Ipp32f* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
IPPAPI(IppStatus, ippiCopyMirrorBorder_32f_C4IR_L, (const Ipp32f* pSrc, IppSizeL srcDstStep, IppiSizeL srcRoiSize, IppiSizeL dstRoiSize, IppSizeL topBorderHeight, IppSizeL leftborderwidth))
/* /////////////////////////////////////////////////////////////////////////////
// Bilateral filter functions with Border
/////////////////////////////////////////////////////////////////////////////
// Name: ippiFilterBilateralBorderGetBufferSize_L
// Purpose: to define buffer size for bilateral filter
// Parameters:
// filter Type of bilateral filter. Possible value is ippiFilterBilateralGauss.
// dstRoiSize Roi size (in pixels) of destination image what will be applied
// for processing.
// radius Radius of circular neighborhood what defines pixels for calculation.
// dataType Data type of the source and destination images. Possible values
// are Ipp8u and Ipp32f.
// numChannels Number of channels in the images. Possible values are 1 and 3.
// distMethod The type of method for definition of distance beetween pixel untensity.
// Possible value is ippDistNormL1.
// pSpecSize Pointer to the size (in bytes) of the spec.
// pBufferSize Pointer to the size (in bytes) of the external work buffer.
// Return:
// ippStsNoErr OK
// ippStsNullPtrErr any pointer is NULL
// ippStsSizeErr size of dstRoiSize is less or equal 0
// ippStsMaskSizeErr radius is less or equal 0
// ippStsNotSupportedModeErr filter or distMethod is not supported
// ippStsDataTypeErr Indicates an error when dataType has an illegal value.
// ippStsNumChannelsErr Indicates an error when numChannels has an illegal value.
*/
IPPAPI(IppStatus, ippiFilterBilateralBorderGetBufferSize_L , (IppiFilterBilateralType filter, IppiSizeL dstRoiSize, int radius, IppDataType dataType, int numChannels, IppiDistanceMethodType distMethodType, IppSizeL *pSpecSize, IppSizeL *pBufferSize))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiFilterBilateralBorderInit_L
// Purpose: initialization of Spec for bilateral filter with border
// Parameters:
// filter Type of bilateral filter. Possible value is ippiFilterBilateralGauss.
// dstRoiSize Roi size (in pixels) of destination image what will be applied
// for processing.
// radius Radius of circular neighborhood what defines pixels for calculation.
// dataType Data type of the source and destination images. Possible values
// are Ipp8u and Ipp32f.
// numChannels Number of channels in the images. Possible values are 1 and 3.
// distMethodType The type of method for definition of distance between pixel intensity.
// Possible value is ippDistNormL1.
// valSquareSigma square of Sigma for factor function for pixel intensity
// posSquareSigma square of Sigma for factor function for pixel position
// pSpec pointer to Spec
// Return:
// ippStsNoErr OK
// ippStsNullPtrErr pointer ro Spec is NULL
// ippStsSizeErr size of dstRoiSize is less or equal 0
// ippStsMaskSizeErr radius is less or equal 0
// ippStsNotSupportedModeErr filter or distMethod is not supported
// ippStsDataTypeErr Indicates an error when dataType has an illegal value.
// ippStsNumChannelsErr Indicates an error when numChannels has an illegal value.
// ippStsBadArgErr valSquareSigma or posSquareSigma is less or equal 0
*/
IPPAPI(IppStatus, ippiFilterBilateralBorderInit_L ,(IppiFilterBilateralType filter, IppiSizeL dstRoiSize, int radius, IppDataType dataType, int numChannels, IppiDistanceMethodType distMethod, Ipp32f valSquareSigma, Ipp32f posSquareSigma, IppiFilterBilateralSpec *pSpec))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiFilterBilateralBorder_8u_C1R
// ippiFilterBilateralBorder_8u_C3R
// Purpose: bilateral filter
// Parameters:
// pSrc Pointer to the source image
// srcStep Step through the source image
// pDst Pointer to the destination image
// dstStep Step through the destination image
// dstRoiSize Size of the destination ROI
// borderType Type of border.
// borderValue Pointer to constant value to assign to pixels of the constant border. This parameter is applicable
// only to the ippBorderConst border type. If this pointer is NULL than the constant value is equal 0.
// pSpec Pointer to filter spec
// pBuffer Pointer to work buffer
// Return:
// ippStsNoErr OK
// ippStsNullPtrErr pointer to Src, Dst, Spec or Buffer is NULL
// ippStsSizeErr size of dstRoiSize is less or equal 0
// ippStsContextMatchErr filter Spec is not match
// ippStsNotEvenStepErr Indicated an error when one of the step values is not divisible by 4
// for floating-point images.
// ippStsBorderErr Indicates an error when borderType has illegal value.
*/
IPPAPI(IppStatus, ippiFilterBilateralBorder_8u_C1R_L, (const Ipp8u *pSrc, IppSizeL srcStep, Ipp8u *pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppiBorderType borderType, Ipp8u *pBorderValue, const IppiFilterBilateralSpec *pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiFilterBilateralBorder_8u_C3R_L, (const Ipp8u *pSrc, IppSizeL srcStep, Ipp8u *pDst, IppSizeL dstStep, IppiSizeL dstRoiSize, IppiBorderType borderType, Ipp8u *pBorderValue, const IppiFilterBilateralSpec *pSpec, Ipp8u* pBuffer))
/* /////////////////////////////////////////////////////////////////////////////
// Resize Transform Functions
///////////////////////////////////////////////////////////////////////////// */
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeGetSize_L
// Purpose: Computes the size of Spec structure and temporal buffer for Resize transform
//
// Parameters:
// srcSize Size of the input image (in pixels)
// dstSize Size of the output image (in pixels)
// dataType Data type {ipp8u|ipp16u|ipp16s|ipp32f} and ipp64f only for Linear interpolation
// numChannels Number of channels, possible values are 1 or 3 or 4
// interpolation Interpolation method
// antialiasing Supported values:
// 0 - resizing without antialiasing
// 1 - resizing with antialiasing
// pSpecSize Pointer to the size (in bytes) of the Spec structure
// pInitBufSize Pointer to the size (in bytes) of the temporal buffer
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsNoOperation Indicates a warning if width or height of any image is zero
// ippStsSizeErr Indicates an error in the following cases:
// - if width or height of the source or destination image is negative,
// - if the source image size is less than a filter size of the chosen
// interpolation method (except ippSuper)
// - if one of the specified dimensions of the source image is less than
// the corresponding dimension of the destination image (for ippSuper method only)
// ippStsExceededSizeErr Indicates an error in the following cases:
// - if one of the calculated sizes exceeds maximum of IppSizeL type positive value
// (the size of the one of the processed images is too large)
// - if one of width or height of the destination image or the source image with borders
// exceeds 536870911 (0x1FFFFFFF)
// ippStsInterpolationErr Indicates an error if interpolation has an illegal value
// ippStsDataTypeErr Indicates an error when dataType has an illegal value
// ippStsNoAntialiasing Indicates a warning if specified interpolation does not support antialiasing
// ippStsNotSupportedModeErr Indicates an error if requested mode is currently not supported
//
// Notes:
// 1. Supported interpolation methods are ippNearest, ippLinear, ippCubic, ippLanczos and ippSuper.
// 2. If antialiasing value is equal to 1, use the ippResizeAntialiasing<Filter>Init functions, otherwise, use ippResize<Filter>Init
// 3. The implemented interpolation algorithms have the following filter sizes: Nearest Neighbor 1x1,
// Linear 2x2, Cubic 4x4, 2-lobed Lanczos 4x4.
*/
IPPAPI(IppStatus, ippiResizeGetSize_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, IppiInterpolationType interpolation, Ipp32u antialiasing, IppSizeL* pSpecSize, IppSizeL* pInitBufSize))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeGetBufferSize_L
// Purpose: Computes the size of external buffer for Resize transform
//
// Parameters:
// pSpec Pointer to the Spec structure for resize filter
// dstSize Size of the output image (in pixels)
// numChannels Number of channels, possible values are 1 or 3 or 4
// pBufSize Pointer to the size (in bytes) of the external buffer
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsContextMatchErr Indicates an error if pointer to an invalid pSpec structure is passed
// ippStsNumChannelsErr Indicates an error if numChannels has illegal value
// ippStsExceededSizeErr Indicates an error if one of the calculated sizes exceeds maximum of IppSizeL type
// positive value (the size of the one of the processed images is too large)
// ippStsSizeWrn Indicates a warning if the destination image size is more than
// the destination image origin size
*/
IPPAPI(IppStatus, ippiResizeGetBufferSize_L, (const IppiResizeSpec* pSpec, IppiSizeL dstSize, Ipp32u numChannels, IppSizeL* pBufSize))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeGetBorderSize_L
// Purpose: Computes the size of possible borders for Resize transform
//
// Parameters:
// pSpec Pointer to the Spec structure for resize filter
// borderSize Size of necessary borders (for memory allocation)
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsContextMatchErr Indicates an error if pointer to an invalid pSpec structure is passed
*/
IPPAPI(IppStatus, ippiResizeGetBorderSize_L, (const IppiResizeSpec* pSpec, IppiBorderSize* pBorderSize))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeGetSrcOffset
// Purpose: Computes the offset of input image for Resize transform by tile processing
//
// Parameters:
// pSpec Pointer to the Spec structure for resize filter
// dstOffset Offset of the tiled destination image respective
// to the destination image origin
// srcOffset Pointer to the computed offset of input image
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsContextMatchErr Indicates an error if pointer to an invalid pSpec structure is passed
// ippStsOutOfRangeErr Indicates an error if the destination image offset point is outside the
// destination image origin
*/
IPPAPI (IppStatus, ippiResizeGetSrcOffset_L, (const IppiResizeSpec* pSpec, IppiPointL dstOffset, IppiPointL* srcOffset))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeGetSrcRoi
// Purpose: Computes the ROI of input image
// for Resize transform by tile processing
//
// Parameters:
// pSpec Pointer to the Spec structure for resize filter
// dstRoiOffset Offset of the destination image ROI
// dstRoiSize Size of the ROI of destination image
// srcRoiOffset Pointer to the computed offset of source image ROI
// srcRoiSize Pointer to the computed ROI size of source image
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsContextMatchErr Indicates an error if pointer to an invalid pSpec structure is passed
// ippStsOutOfRangeErr Indicates an error if the destination image offset point is outside
// the destination image origin
// ippStsSizeErr Indicates an error in the following cases:
// - if width or height of the destination image ROI size
// is negative or equal to 0,
// IppStsSizeWrn Indicates a warning if the destination ROI exceeds with
// the destination image origin
*/
IPPAPI (IppStatus, ippiResizeGetSrcRoi_L, (const IppiResizeSpec* pSpec, IppiPointL dstRoiOffset, IppiSizeL dstRoiSize, IppiPointL* srcRoiOffset, IppiSizeL* srcRoiSize))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeNearestInit_L
// ippiResizeLinearInit_L
// ippiResizeCubicInit_L
// ippiResizeLanczosInit_L
// ippiResizeSuperInit_L
//
// Purpose: Initializes the Spec structure for the Resize transform
// by different interpolation methods
//
// Parameters:
// srcSize Size of the input image (in pixels)
// dstSize Size of the output image (in pixels)
// dataType Data type {ipp8u|ipp16u|ipp16s|ipp32f} and ipp64f only for Linear interpolation
// numChannels Number of channels, possible values are 1 or 3 or 4
// valueB The first parameter (B) for specifying Cubic filters
// valueC The second parameter (C) for specifying Cubic filters
// numLobes The parameter for specifying Lanczos (2 or 3) or Hahn (3 or 4) filters
// pInitBuf Pointer to the temporal buffer for several filter initialization
// pSpec Pointer to the Spec structure for resize filter
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsNoOperation Indicates a warning if width or height of any image is zero
// ippStsSizeErr Indicates an error in the following cases:
// - if width or height of the source or destination image is negative,
// - if the source image size is less than a filter size of the chosen
// interpolation method (except ippiResizeSuperInit).
// - if one of the specified dimensions of the source image is less than
// the corresponding dimension of the destination image
// (for ippiResizeSuperInit only).
// ippStsExceededSizeErr Indicates an error if one of width or height of the destination image or
// the source image with borders exceeds 536870911 (0x1FFFFFFF)
// ippStsDataTypeErr Indicates an error when dataType has an illegal value.
// ippStsNotSupportedModeErr Indicates an error if the requested mode is not supported.
//
// Notes/References:
// 1. The equation shows the family of cubic filters:
// ((12-9B-6C)*|x|^3 + (-18+12B+6C)*|x|^2 + (6-2B) ) / 6 for |x| < 1
// K(x) = (( -B-6C)*|x|^3 + ( 6B+30C)*|x|^2 + (-12B-48C)*|x| + (8B+24C)) / 6 for 1 <= |x| < 2
// 0 elsewhere
// Some values of (B,C) correspond to known cubic splines: Catmull-Rom (B=0,C=0.5), B-Spline (B=1,C=0) and other.
// Mitchell, Don P.; Netravali, Arun N. (Aug. 1988). "Reconstruction filters in computer graphics"
// http://www.mentallandscape.com/Papers_siggraph88.pdf
//
// 2. Hahn filter does not supported now.
// 3. The implemented interpolation algorithms have the following filter sizes: Nearest Neighbor 1x1,
// Linear 2x2, Cubic 4x4, 2-lobed Lanczos 4x4, 3-lobed Lanczos 6x6.
*/
IPPAPI(IppStatus, ippiResizeNearestInit_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, IppiResizeSpec* pSpec))
IPPAPI(IppStatus, ippiResizeLinearInit_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, IppiResizeSpec* pSpec))
IPPAPI(IppStatus, ippiResizeCubicInit_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, Ipp32f valueB, Ipp32f valueC, IppiResizeSpec* pSpec, Ipp8u* pInitBuf))
IPPAPI(IppStatus, ippiResizeLanczosInit_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, Ipp32u numLobes, IppiResizeSpec* pSpec, Ipp8u* pInitBuf))
IPPAPI(IppStatus, ippiResizeSuperInit_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, IppiResizeSpec* pSpec))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeNearest
// ippiResizeLinear
// ippiResizeCubic
// ippiResizeLanczos
// ippiResizeSuper
//
// Purpose: Changes an image size by different interpolation methods
//
// Parameters:
// pSrc Pointer to the source image
// srcStep Distance (in bytes) between of consecutive lines in the source image
// pDst Pointer to the destination image
// dstStep Distance (in bytes) between of consecutive lines in the destination image
// border Type of the border
// borderValue Pointer to the constant value(s) if border type equals ippBorderConstant
// pSpec Pointer to the Spec structure for resize filter
// pBuffer Pointer to the work buffer
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsNoOperation Indicates a warning if width or height of output image is zero
// ippStsBorderErr Indicates an error if border type has an illegal value
// ippStsContextMatchErr Indicates an error if pointer to an invalid pSpec structure is passed
// ippStsNotSupportedModeErr Indicates an error if requested mode is currently not supported
// ippStsSizeErr Indicates an error if width or height of the destination image
// is negative
// ippStsStepErr Indicates an error if the step value is not data type multiple
// ippStsSizeWrn Indicates a warning if the destination image size is more than
// the destination image origin size
//
// Notes:
// 1. Supported border types are ippBorderInMem and ippBorderRepl
// (except Nearest Neighbor and Super Sampling methods).
// 2. Hahn filter does not supported now.
*/
IPPAPI(IppStatus, ippiResizeNearest_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiResizeNearest_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_64f_C1R_L, (const Ipp64f* pSrc, IppSizeL srcStep, Ipp64f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp64f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_64f_C3R_L, (const Ipp64f* pSrc, IppSizeL srcStep, Ipp64f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp64f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLinear_64f_C4R_L, (const Ipp64f* pSrc, IppSizeL srcStep, Ipp64f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp64f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeCubic_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeLanczos_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, const Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeSuper_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeNearestAntialiasingInit_L
// ippiResizeLinearAntialiasingInit_L
// ippiResizeCubicAntialiasingInit_L
//
// Purpose: Initializes the Spec structure for the Resize transform
// with antialiasing by different interpolation methods
//
// Parameters:
// srcSize Size of the input image (in pixels)
// dstSize Size of the output image (in pixels)
// dataType Data type {ipp8u|ipp16u|ipp16s|ipp32f}
// valueB The first parameter (B) for specifying Cubic filters
// valueC The second parameter (C) for specifying Cubic filters
// numLobes The parameter for specifying Lanczos (2 or 3) or Hahn (3 or 4) filters
// pInitBuf Pointer to the temporal buffer for several filter initialization
// pSpec Pointer to the Spec structure for resize filter
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsNoOperation Indicates a warning if width or height of any image is zero
// ippStsSizeErr Indicates an error if width or height of the source image is negative
// ippStsExceededSizeErr Indicates an error if one of width or height of the destination image or
// the source image with borders exceeds 536870911 (0x1FFFFFFF)
// ippStsNotSupportedModeErr Indicates an error if the requested mode is not supported.
//
// Notes/References:
// 1. The equation shows the family of cubic filters:
// ((12-9B-6C)*|x|^3 + (-18+12B+6C)*|x|^2 + (6-2B) ) / 6 for |x| < 1
// K(x) = (( -B-6C)*|x|^3 + ( 6B+30C)*|x|^2 + (-12B-48C)*|x| + (8B+24C)) / 6 for 1 <= |x| < 2
// 0 elsewhere
// Some values of (B,C) correspond to known cubic splines: Catmull-Rom (B=0,C=0.5), B-Spline (B=1,C=0) and other.
// Mitchell, Don P.; Netravali, Arun N. (Aug. 1988). "Reconstruction filters in computer graphics"
// http://www.mentallandscape.com/Papers_siggraph88.pdf
//
// 2. Hahn filter does not supported now.
// 3. The implemented interpolation algorithms have the following filter sizes:
// Linear 2x2, Cubic 4x4, 2-lobed Lanczos 4x4, 3-lobed Lanczos 6x6.
*/
IPPAPI (IppStatus, ippiResizeAntialiasingLinearInit_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, IppiResizeSpec* pSpec, Ipp8u* pInitBuf))
IPPAPI (IppStatus, ippiResizeAntialiasingCubicInit_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, Ipp32f valueB, Ipp32f valueC, IppiResizeSpec* pSpec, Ipp8u* pInitBuf))
IPPAPI (IppStatus, ippiResizeAntialiasingLanczosInit_L, (IppiSizeL srcSize, IppiSizeL dstSize, IppDataType dataType, Ipp32u numLobes, IppiResizeSpec* pSpec, Ipp8u* pInitBuf))
/* /////////////////////////////////////////////////////////////////////////////
// Name: ippiResizeAntialiasing
//
// Purpose: Changes an image size by different interpolation methods with antialiasing technique
//
// Parameters:
// pSrc Pointer to the source image
// srcStep Distance (in bytes) between of consecutive lines in the source image
// pDst Pointer to the destination image
// dstStep Distance (in bytes) between of consecutive lines in the destination image
// dstOffset Offset of tiled image respectively destination image origin
// dstSize Size of the destination image (in pixels)
// border Type of the border
// borderValue Pointer to the constant value(s) if border type equals ippBorderConstant
// pSpec Pointer to the Spec structure for resize filter
// pBuffer Pointer to the work buffer
//
// Return Values:
// ippStsNoErr Indicates no error
// ippStsNullPtrErr Indicates an error if one of the specified pointers is NULL
// ippStsBorderErr Indicates an error if border type has an illegal value
// ippStsContextMatchErr Indicates an error if pointer to an invalid pSpec structure is passed
// ippStsNotSupportedModeErr Indicates an error if requested mode is currently not supported
// ippStsStepErr Indicates an error if the step value is not data type multiple
// ippStsOutOfRangeErr Indicates an error if the destination image offset point is outside the
// destination image origin
// ippStsSizeWrn Indicates a warning if the destination image size is more than
// the destination image origin size
//
// Notes:
// 1. Supported border types are ippBorderInMemory and ippBorderReplicate.
// 2. Hahn filter does not supported now.
*/
IPPAPI (IppStatus, ippiResizeAntialiasing_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp8u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_16u_C1R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_16u_C3R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_16u_C4R_L, (const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp16u* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_16s_C1R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_16s_C3R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_16s_C4R_L, (const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp16s* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
IPPAPI (IppStatus, ippiResizeAntialiasing_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep, IppiPointL dstOffset, IppiSizeL dstSize, IppiBorderType border, Ipp32f* pBorderValue, const IppiResizeSpec* pSpec, Ipp8u* pBuffer))
/* =============================================================================
ippCV
============================================================================= */
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiFilterGaussianGetBufferSize
//
// Purpose: Computes the size of the working buffer for the Gaussian filter
//
// Return:
// ippStsNoErr Ok. Any other value indicates an error or a warning.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr maxRoiSize has a field with zero or negative value.
// ippStsDataTypeErr Indicates an error when dataType has an illegal value.
// ippStsBadArgErr Indicates an error if kernelSize is even or is less than 3.
// ippStsChannelErr Indicates an error when numChannels has an illegal value.
//
// Arguments:
// maxRoiSize Maximal size of the image ROI in pixels.
// kernelSize Size of the Gaussian kernel (odd, greater or equal to 3).
// dataType Data type of the source and destination images.
// numChannels Number of channels in the images. Possible values are 1 and 3.
// pSpecSize Pointer to the computed size (in bytes) of the Gaussian
// specification structure.
// pBufferSize Pointer to the computed size (in bytes) of the external buffer.
*/
IPPAPI(IppStatus, ippiFilterGaussianGetBufferSize_L,(IppiSizeL maxRoiSize, int kernelSize,
IppDataType dataType, IppiBorderType borderType, int numChannels, IppSizeL* pBufferSize))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiFilterGaussianGetSpecSize_L
//
// Purpose: Computes the size of the working buffer for the Gaussian filter GaussianSpec
//
// Return:
// ippStsNoErr Ok. Any other value indicates an error or a warning.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr maxRoiSize has a field with zero or negative value.
// ippStsDataTypeErr Indicates an error when dataType has an illegal value.
// ippStsBadArgErr Indicates an error if kernelSize is even or is less than 3.
// ippStsChannelErr Indicates an error when numChannels has an illegal value.
//
// Arguments:
// kernelSize Size of the Gaussian kernel (odd, greater or equal to 3).
// dataType Data type of the source and destination images.
// numChannels Number of channels in the images. Possible values are 1 and 3.
// pSpecSize Pointer to the computed size (in bytes) of the Gaussian
// specification structure.
// pInitBufferSize Pointer to the computed size (in bytes) of the external buffer for the Gaussian filter GaussianSpec.
*/
IPPAPI(IppStatus, ippiFilterGaussianGetSpecSize_L,(int kernelSize, IppDataType dataType, int numChannels, IppSizeL *pSpecSize, IppSizeL* pInitBufferSize))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiFilterGaussianInit
//
// Purpose: initialization of Spec for Gaussian filter
//
// Return:
// ippStsNoErr Ok. Any other value indicates an error or a warning.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr roiSize has a field with zero or negative value.
// ippStsDataTypeErr Indicates an error when borderType has an illegal value.
// ippStsBadArgErr kernelSize is even or is less than 3.
// ippStsChannelErr Indicates an error when numChannels has an illegal value.
// ippStsBorderErr Indicates an error condition if borderType has a illegal
// value.
//
// Arguments:
// roiSize Size of the image ROI in pixels.
// kernelSize Size of the Gaussian kernel (odd, greater or equal to 3).
// sigma Standard deviation of the Gaussian kernel.
// borderType One of border supported types.
// dataType Data type of the source and destination images.
// numChannels Number of channels in the images. Possible values are 1 and 3.
// pSpec Pointer to the Spec.
// pBuffer Pointer to the buffer:
*/
IPPAPI(IppStatus, ippiFilterGaussianInit_L,(IppiSizeL roiSize, int kernelSize, Ipp32f sigma, IppiBorderType borderType, IppDataType dataType, int numChannels,
IppFilterGaussianSpec* pSpec, Ipp8u* pInitBuffer))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiFilterGaussian
//
// Purpose: Applies Gaussian filter with borders
//
// Return:
// ippStsNoErr Ok. Any other value indicates an error or a warning.
// ippStsNullPtrErr One of the specified pointers is NULL.
// ippStsSizeErr roiSize has a field with zero or negative value.
// ippStsStepErr Indicates an error condition if srcStep or dstStep is less
// than roiSize.width * <pixelSize>.
// ippStsNotEvenStepErr One of the step values is not divisible by 4 for floating-point images.
// ippStsBadArgErr kernelSize is less than 3 or sigma is less or equal than 0.
//
// Arguments:
// pSrc Pointer to the source image ROI.
// srcStep Distance in bytes between starts of consecutive lines in the source image.
// pDst Pointer to the destination image ROI.
// dstStep Distance in bytes between starts of consecutive lines in the destination image.
// roiSize Size of the source and destination image ROI.
// borderType One of border supported types.
// borderValue Constant value to assign to pixels of the constant border. if border type equals ippBorderConstant
// pSpec Pointer to the Gaussian specification structure.
// pBuffer Pointer to the working buffer.
*/
//////////////////////////////////////////////////////////////////////////////////////////
IPPAPI(IppStatus, ippiFilterGaussian_32f_C1R_L,(const Ipp32f* pSrc, IppSizeL srcStep,
Ipp32f* pDst, IppSizeL dstStep, IppiSizeL roiSize, IppiBorderType borderType, const Ipp32f borderValue[1],
IppFilterGaussianSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiFilterGaussian_16u_C1R_L,(const Ipp16u * pSrc, IppSizeL srcStep,
Ipp16u * pDst, IppSizeL dstStep, IppiSizeL roiSize, IppiBorderType borderType, const Ipp16u borderValue[1],
IppFilterGaussianSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiFilterGaussian_16s_C1R_L,(const Ipp16s* pSrc, IppSizeL srcStep,
Ipp16s* pDst, IppSizeL dstStep, IppiSizeL roiSize, IppiBorderType borderType, const Ipp16s borderValue[1],
IppFilterGaussianSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiFilterGaussian_8u_C1R_L,(const Ipp8u* pSrc, IppSizeL srcStep,
Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize, IppiBorderType borderType, const Ipp8u borderValue[1],
IppFilterGaussianSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiFilterGaussian_32f_C3R_L,(const Ipp32f* pSrc, IppSizeL srcStep,
Ipp32f* pDst, IppSizeL dstStep, IppiSizeL roiSize, IppiBorderType borderType, const Ipp32f borderValue[3],
IppFilterGaussianSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiFilterGaussian_16u_C3R_L,(const Ipp16u * pSrc, IppSizeL srcStep,
Ipp16u * pDst, IppSizeL dstStep, IppiSizeL roiSize, IppiBorderType borderType, const Ipp16u borderValue[3],
IppFilterGaussianSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiFilterGaussian_16s_C3R_L,(const Ipp16s* pSrc, IppSizeL srcStep,
Ipp16s* pDst, IppSizeL dstStep, IppiSizeL roiSize, IppiBorderType borderType, const Ipp16s borderValue[3],
IppFilterGaussianSpec* pSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiFilterGaussian_8u_C3R_L,(const Ipp8u* pSrc, IppSizeL srcStep,
Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize, IppiBorderType borderType, const Ipp8u borderValue[3],
IppFilterGaussianSpec* pSpec, Ipp8u* pBuffer))
/****************************************************************************************\
* Morphological Operations *
\****************************************************************************************/
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiDilateGetBufferSize_L, ippiErodeGetBufferSize_L
//
//
// Purpose: Gets the size of the internal state or specification structure for morphological operations.
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr Width of the image, or width or height of the structuring
// element is less than,or equal to zero.
//
// Parameters:
// roiSize Size of the source and destination image ROI in pixels.
// maskSize Size of the structuring element.
// dataType The type of data
// numChannels The number of channels
// pBufferSize Pointer to the buffer size value for the morphological initialization function.
*/
IPPAPI(IppStatus, ippiDilateGetBufferSize_L, (IppiSizeL roiSize, IppiSizeL maskSize, IppDataType datatype, int numChannels, IppSizeL* pBufferSize))
IPPAPI(IppStatus, ippiErodeGetBufferSize_L, (IppiSizeL roiSize, IppiSizeL maskSize, IppDataType datatype, int numChannels, IppSizeL* pBufferSize))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiDilateGetSpecSize_L, ippiErodeGetSpecSize_L
//
//
// Purpose: Gets the size of the internal state or specification structure for morphological operations.
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr Width of the image, or width or height of the structuring
// element is less than,or equal to zero.
//
// Parameters:
// roiSize Size of the source and destination image ROI in pixels.
// maskSize Size of the structuring element.
// pSpecSize Pointer to the specification structure size.
*/
IPPAPI(IppStatus, ippiDilateGetSpecSize_L,(IppiSizeL roiSize, IppiSizeL maskSize, IppSizeL* pSpecSize))
IPPAPI(IppStatus, ippiErodeGetSpecSize_L,(IppiSizeL roiSize, IppiSizeL maskSize, IppSizeL* pSpecSize))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiDilateInit_L, ippiErodeInit_L
//
// Purpose: Initialize the internal state or specification structure for morphological operation.
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr Width of the image or width or height of the structuring
// element is less than, or equal to zero.
// ippStsAnchorErr Anchor point is outside the structuring element.
//
// Parameters:
// roiSize Size of the source and destination image ROI in pixels.
// pMask Pointer to the structuring element (mask).
// maskSize Size of the structuring element.
// pMorphSpec Pointer to the morphology specification structure.
*/
IPPAPI(IppStatus, ippiDilateInit_L,(IppiSizeL roiSize, const Ipp8u* pMask, IppiSizeL maskSize, IppiMorphStateL* pMorphSpec))
IPPAPI(IppStatus, ippiErodeInit_L,(IppiSizeL roiSize, const Ipp8u* pMask, IppiSizeL maskSize, IppiMorphStateL* pMorphSpec))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiDilate_8u_C1R, ippiDilate_8u_C3R,
// ippiDilate_8u_C4R, ippiDilate_32f_C1R,
// ippiDilate_32f_C3R, ippiDilate_32f_C4R
//
// ippiErode_8u_C1R, ippiErode_8u_C3R,
// ippiErode_8u_C4R, ippiErode_32f_C1R,
// ippiErode_32f_C3R, ippiErode_32f_C4R,
//
// ippiDilate_16u_C1R, ippiDilate_16s_C1R,
// ippiDilate_1u_C1R
//
// Purpose: Perform erosion/dilation of the image arbitrary shape structuring element.
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr The ROI width or height is less than 1,
// or ROI width is bigger than ROI width in the state structure.
// ippStsStepErr Step is too small to fit the image.
// ippStsNotEvenStepErr Step is not multiple of the element.
// ippStsBadArgErr Incorrect border type.
//
// Parameters:
// pSrc Pointer to the source image.
// srcStep Step in the source image.
// pDst Pointer to the destination image.
// dstStep Step in the destination image.
// roiSize Size of the source and destination image ROI in pixels.
// borderType Type of border (ippBorderRepl now).
// borderValue Pointer to the vector of values for the constant border.
// pMorphSpec Pointer to the morphology specification structure.
// pBuffer Pointer to the external work buffer.
*/
IPPAPI(IppStatus, ippiDilate_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep,
Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp8u borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiDilate_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep,
Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp8u borderValue[3], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiDilate_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep,
Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp8u borderValue[4], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiDilate_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep,
Ipp32f* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp32f borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiDilate_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep,
Ipp32f* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp32f borderValue[3], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiDilate_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep,
Ipp32f* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp32f borderValue[4], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiDilate_1u_C1R_L,( const Ipp8u* pSrc, IppSizeL srcStep, int srcBitOffset, Ipp8u* pDst, IppSizeL dstStep, int dstBitOffset,
IppiSizeL roiSize, IppiBorderType borderType, const Ipp8u borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer ))
IPPAPI(IppStatus, ippiDilate_16u_C1R_L,(const Ipp16u* pSrc, IppSizeL srcStep,
Ipp16u* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp16u borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiDilate_16s_C1R_L,(const Ipp16s* pSrc, IppSizeL srcStep,
Ipp16s* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp16s borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_8u_C1R_L, (const Ipp8u* pSrc, IppSizeL srcStep,
Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType,const Ipp8u borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_8u_C3R_L, (const Ipp8u* pSrc, IppSizeL srcStep,
Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp8u borderValue[3], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_8u_C4R_L, (const Ipp8u* pSrc, IppSizeL srcStep,
Ipp8u* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp8u borderValue[4], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_32f_C1R_L, (const Ipp32f* pSrc, IppSizeL srcStep,
Ipp32f* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp32f borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_32f_C3R_L, (const Ipp32f* pSrc, IppSizeL srcStep,
Ipp32f* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp32f borderValue[3], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_32f_C4R_L, (const Ipp32f* pSrc, IppSizeL srcStep,
Ipp32f* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp32f borderValue[4], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_16u_C1R_L,(const Ipp16u* pSrc, IppSizeL srcStep,
Ipp16u* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp16u borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_16s_C1R_L,(const Ipp16s* pSrc, IppSizeL srcStep,
Ipp16s* pDst, IppSizeL dstStep, IppiSizeL roiSize,
IppiBorderType borderType, const Ipp16s borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer))
IPPAPI(IppStatus, ippiErode_1u_C1R_L,( const Ipp8u* pSrc, IppSizeL srcStep, int srcBitOffset, Ipp8u* pDst, IppSizeL dstStep, int dstBitOffset,
IppiSizeL roiSize, IppiBorderType borderType, const Ipp8u borderValue[1], const IppiMorphStateL* pMorphSpec, Ipp8u* pBuffer ))
/****************************************************************************************\
* Advanced Morphological Operations *
\****************************************************************************************/
/////////////////////////////////////////////////////////////
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiMorphGetSpecSize_L
//
// Purpose: Gets the size of the internal state or specification structure for advanced morphological operations.
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr Width of the image, or width or height of the structuring.
// element is less than, or equal to zero.
//
// Parameters:
// roiSize Maximum size of the image ROI, in pixels.
// maskSize Size of the structuring element.
// dataType The type of data
// numChannels The number of channels
// pSpecSize Pointer to the specification structure size.
*/
IPPAPI(IppStatus, ippiMorphGetSpecSize_L,(IppiSizeL roiSize, IppiSizeL maskSize, IppDataType depth, int numChannels, IppSizeL* pSpecSize))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiMorphGetBufferSize_L
//
// Purpose: Gets the size of the work buffer for the advanced morphological operations.
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr Width of the image, or width or height of the structuring.
// element is less than, or equal to zero.
//
// Parameters:
// roiSize Maximum size of the image ROI, in pixels.
// maskSize Size of the structuring element.
// dataType The type of data
// numChannels The number of channels
// pBufferSize Pointer to the buffer size value for the morphology initialization function.
*/
IPPAPI(IppStatus, ippiMorphGetBufferSize_L,(IppiSizeL roiSize, IppiSizeL maskSize, IppDataType depth, int numChannels, IppSizeL* bufferSize))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiMorphInit_L
//
// Purpose: Initialize the internal state or specification structure for advanced morphological operations.
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr Width of the image or width or height of the structuring
// element is less than, or equal to zero.
// ippStsAnchorErr Anchor point is outside the structuring element.
//
// Parameters:
// roiSize Maximum size of the image ROI, in pixels.
// pMask Pointer to the structuring element (mask).
// maskSize Size of the structuring element.
// dataType The type of data
// numChannels The number of channels
// pMorphSpec Pointer to the advanced morphology specification structure.
*/
IPPAPI( IppStatus, ippiMorphInit_L,( IppiSizeL roiSize, const Ipp8u* pMask, IppiSizeL maskSize, IppDataType depth, int numChannels,
IppiMorphAdvStateL* pMorphSpec))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiMorphClose_8u_C1R_L, ippiMorphClose_8u_C3R_L,
// ippiMorphClose_8u_C4R_L, ippiMorphClose_32f_C1R_L,
// ippiMorphClose_32f_C3R_L, ippiMorphClose_32f_C4R_L
//
// ippiMorphOpen_8u_C1R_L, ippiMorphOpen_8u_C3R_L,
// ippiMorphOpen_8u_C4R_L, ippiMorphOpen_32f_C1R_L,
// ippiMorphOpen_32f_C3R_L, ippiMorphOpen_32f_C4R_L,
//
// ippiMorphClose_16u_C1R_L, ippiMorphOpen_16u_C1R_L,
// ippiMorphClose_16s_C1R_L, ippiMorphOpen_16s_C1R_L,
// ippiMorphClose_1u_C1R_L, ippiMorphOpen_1u_C1R_L,
// ippiMorphTophat_8u_C1R_L, ippiMorphTophat_8u_C3R_L,
// ippiMorphTophat_8u_C4R_L, ippiMorphTophat_32f_C1R_L,
// ippiMorphTophat_32f_C3R_L, ippiMorphTophat_32f_C4R_L,
//
// ippiMorphBlackhat_8u_C1R_L, ippiMorphBlackhat_8u_C3R_L,
// ippiMorphBlackhat_8u_C4R_L, ippiMorphBlackhat_32f_C1R_L,
// ippiMorphBlackhat_32f_C3R_L, ippiMorphBlackhat_32f_C4R_L,
//
// ippiMorphGradient_8u_C1R_L, ippiMorphGradient_8u_C3R_L,
// ippiMorphGradient_8u_C4R_L, ippiMorphGradient_32f_C1R_L,
// ippiMorphGradient_32f_C3R_L, ippiMorphGradient_32f_C4R_L,
//
// Purpose: Perform advanced morphologcal operations on the image arbitrary shape structuring element.
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsSizeErr The ROI width or height is less than 1,
// or ROI width is bigger than ROI width in the state structure.
// ippStsStepErr Step is too small to fit the image.
// ippStsNotEvenStepErr Step is not multiple of the element.
// ippStsBadArgErr Incorrect border type.
//
// Parameters:
// pSrc Pointer to the source image.
// srcStep Step in the source image.
// pDst Pointer to the destination image.
// dstStep Step in the destination image.
// roiSize ROI size.
// borderType Type of border (ippBorderRepl now).
// borderValue Value for the constant border.
// pMorphSpec Pointer to the morphology specification structure.
// pBuffer Pointer to the external work buffer.
*/
/////////////////////////////////////////////////////////////////////////
IPPAPI( IppStatus, ippiMorphOpen_16u_C1R_L,(
const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphOpen_16s_C1R_L,(
const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16s borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphOpen_1u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, int srcBitOffset, Ipp8u* pDst, IppSizeL dstStep, int dstBitOffset,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphOpen_8u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphOpen_8u_C3R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphOpen_8u_C4R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_8u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_8u_C3R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_8u_C4R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_16u_C1R_L,(
const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_16s_C1R_L,(
const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16s borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_1u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, int srcBitOffset, Ipp8u* pDst, IppSizeL dstStep, int dstBitOffset,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphOpen_32f_C1R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphOpen_32f_C3R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphOpen_32f_C4R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_32f_C1R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_32f_C3R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphClose_32f_C4R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_16u_C1R_L,(
const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_16s_C1R_L,(
const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16s borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_1u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, int srcBitOffset, Ipp8u* pDst, IppSizeL dstStep, int dstBitOffset,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_8u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_8u_C3R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_8u_C4R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_32f_C1R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_32f_C3R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphTophat_32f_C4R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_16u_C1R_L,(
const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_16s_C1R_L,(
const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16s borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_1u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, int srcBitOffset, Ipp8u* pDst, IppSizeL dstStep, int dstBitOffset,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_8u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_8u_C3R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_8u_C4R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_32f_C1R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_32f_C3R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphBlackhat_32f_C4R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_16u_C1R_L,(
const Ipp16u* pSrc, IppSizeL srcStep, Ipp16u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_16s_C1R_L,(
const Ipp16s* pSrc, IppSizeL srcStep, Ipp16s* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp16s borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_1u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, int srcBitOffset, Ipp8u* pDst, IppSizeL dstStep, int dstBitOffset,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_8u_C1R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_8u_C3R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_8u_C4R_L,(
const Ipp8u* pSrc, IppSizeL srcStep, Ipp8u* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp8u borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_32f_C1R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[1], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_32f_C3R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[3], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
IPPAPI( IppStatus, ippiMorphGradient_32f_C4R_L,(
const Ipp32f* pSrc, IppSizeL srcStep, Ipp32f* pDst, IppSizeL dstStep,
IppiSizeL roiSize, IppiBorderType borderType, Ipp32f borderValue[4], const IppiMorphAdvStateL* pMorthSpec, Ipp8u* pBuffer ))
/* ///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiMorphSetMode_L
//
// Purpose: Set mode for symmetrical operation in advanced morphology
// IPP_MORPH_DEFAULT - default behavior
// IPP_MORPH_MASK_NO_FLIP - don't flip mask(the same mask for (erode(dilate)->dilate(erode)) operations)
//
//
// Return:
// ippStsNoErr Ok.
// ippStsNullPtrErr One of the pointers is NULL.
// ippStsNotSupportedModeErr Incorrect mode
//
// Parameters:
// mode Mode. One of IPP_MORPH_DEFAULT(flip), IPP_MORPH_MASK_NO_FLIP(no flip)
// pMorphSpec Pointer to the morphology specification structure.
*/
IPPAPI(IppStatus, ippiMorphSetMode_L, (int mode, IppiMorphAdvStateL* pMorphSpec))
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiCannyGetSize_L
//
// Purpose: Calculates size of temporary buffer, required to run Canny function.
//
// Return:
// ippStsNoErr Ok
// ippStsNullPtrErr Pointer bufferSize is NULL
// ippStsSizeErr roiSize has a field with zero or negative value
//
// Parameters:
// roi Size of image ROI in pixel
// bufferSize Pointer to the variable that returns the size of the temporary buffer
//F*/
IPPAPI(IppStatus, ippiCannyGetSize_L, ( IppiSizeL roi, IppSizeL* bufferSize ))
/*F///////////////////////////////////////////////////////////////////////////////////////
// Name: ippiCanny_16s8u_C1R_L
//
// Purpose: Creates binary image of source's image edges,
// using derivatives of the first order.
//
// Return:
// ippStsNoErr Ok
// ippStsNullPtrErr One of pointers is NULL
// ippStsSizeErr The width or height of images is less or equal zero
// ippStsStepErr The steps in images are too small
// ippStsNotEvenStepErr Step is not multiple of element.
// ippStsBadArgErr Bad thresholds
//
// Parameters:
// pDX Pointers to the source image ( first derivatives with respect to X )
// dxStep Step in bytes through the source image pSrcDx
// pDY Pointers to the source image ( first derivatives with respect to Y )
// dyStep Step in bytes through the source image pSrcDy
// pDst Pointers to the destination image
// dstStep Step in bytes through the destination image
//
// roiL Size of the source images ROI in pixels
// lowThreshold Low threshold for edges detection
// highThreshold Upper threshold for edges detection
// norm Norm type, {ippNormL1, ippNormL2}
// pBuffer Pointer to the pre-allocated temporary buffer, which size can be
// calculated using ippiCannyGetSize function
//F*/
IPPAPI(IppStatus, ippiCanny_16s8u_C1R_L, ( Ipp16s* pSrcDx, IppSizeL srcDxStep, Ipp16s* pSrcDy, IppSizeL srcDyStep, Ipp8u* pDstEdges, IppSizeL dstEdgeStep, IppiSizeL roiSize, Ipp32f lowThreshold, Ipp32f highThreshold, IppNormType norm, Ipp8u* pBuffer ))
IPPAPI(IppStatus, ippiCanny_32f8u_C1R_L, ( Ipp32f* pSrcDx, IppSizeL srcDxStep, Ipp32f* pSrcDy, IppSizeL srcDyStep, Ipp8u* pDstEdges, IppSizeL dstEdgeStep, IppiSizeL roiSize, Ipp32f lowThreshold, Ipp32f highThreshold, IppNormType norm, Ipp8u* pBuffer ))
#ifdef __cplusplus
}
#endif
#endif /* __IPPICV_H__ */
| 78.556558 | 270 | 0.695459 | [
"shape",
"vector",
"transform"
] |
cb985004394b2eb2bcf986968a16ccbef5f44a20 | 10,433 | h | C | src/presolve/HPresolve.h | WTFHCN/HiGHS | 6cec473fc821bca0d98517a11691da8b5e1b0e51 | [
"MIT"
] | 241 | 2018-03-27T15:04:14.000Z | 2022-03-31T14:44:18.000Z | src/presolve/HPresolve.h | WTFHCN/HiGHS | 6cec473fc821bca0d98517a11691da8b5e1b0e51 | [
"MIT"
] | 384 | 2018-03-28T10:34:36.000Z | 2022-03-31T20:19:37.000Z | src/presolve/HPresolve.h | WTFHCN/HiGHS | 6cec473fc821bca0d98517a11691da8b5e1b0e51 | [
"MIT"
] | 54 | 2018-04-28T22:43:19.000Z | 2022-03-31T14:44:22.000Z | /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* This file is part of the HiGHS linear optimization suite */
/* */
/* Written and engineered 2008-2021 at the University of Edinburgh */
/* */
/* Available as open-source under the MIT License */
/* */
/* Authors: Julian Hall, Ivet Galabova, Qi Huangfu, Leona Gottwald */
/* and Michael Feldmeier */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/**@file presolve/HAggregator.h
* @brief
*/
#ifndef PRESOLVE_HIGHS_PRESOLVE_H_
#define PRESOLVE_HIGHS_PRESOLVE_H_
#include <cassert>
#include <cmath>
#include <list>
#include <queue>
#include <set>
#include <unordered_map>
#include <vector>
#include "lp_data/HConst.h"
#include "lp_data/HStruct.h"
#include "lp_data/HighsLp.h"
#include "lp_data/HighsOptions.h"
#include "mip/HighsMipSolver.h"
#include "util/HighsCDouble.h"
#include "util/HighsHash.h"
#include "util/HighsLinearSumBounds.h"
#include "util/HighsMatrixSlice.h"
namespace presolve {
class HighsPostsolveStack;
class HPresolve {
// pointer to model and options that where presolved
HighsLp* model;
const HighsOptions* options;
HighsTimer* timer;
HighsMipSolver* mipsolver = nullptr;
// triplet storage
std::vector<double> Avalue;
std::vector<HighsInt> Arow;
std::vector<HighsInt> Acol;
// linked list links for column based links for each nonzero
std::vector<HighsInt> colhead;
std::vector<HighsInt> Anext;
std::vector<HighsInt> Aprev;
// splay tree links for row based iteration and nonzero lookup
std::vector<HighsInt> rowroot;
std::vector<HighsInt> ARleft;
std::vector<HighsInt> ARright;
// length of rows and columns
std::vector<HighsInt> rowsize;
std::vector<HighsInt> rowsizeInteger;
std::vector<HighsInt> rowsizeImplInt;
std::vector<HighsInt> colsize;
// vector to store the nonzero positions of a row
std::vector<HighsInt> rowpositions;
// stack to reuse free slots
std::vector<HighsInt> freeslots;
// vectors holding implied bounds on primal and dual variables as well as
// their origins
std::vector<double> implColLower;
std::vector<double> implColUpper;
std::vector<HighsInt> colLowerSource;
std::vector<HighsInt> colUpperSource;
std::vector<double> rowDualLower;
std::vector<double> rowDualUpper;
std::vector<double> implRowDualLower;
std::vector<double> implRowDualUpper;
std::vector<HighsInt> rowDualLowerSource;
std::vector<HighsInt> rowDualUpperSource;
// implied bounds on values of primal and dual rows computed from the bounds
// of primal and dual variables
HighsLinearSumBounds impliedRowBounds;
HighsLinearSumBounds impliedDualRowBounds;
std::vector<HighsInt> changedRowIndices;
std::vector<uint8_t> changedRowFlag;
std::vector<HighsInt> changedColIndices;
std::vector<uint8_t> changedColFlag;
std::vector<std::pair<HighsInt, HighsInt>> substitutionOpportunities;
// set with the sizes and indices of equation rows sorted by the size and a
// vector to access there iterator positions in the set by index for quick
// removal
std::set<std::pair<HighsInt, HighsInt>> equations;
std::vector<std::set<std::pair<HighsInt, HighsInt>>::iterator> eqiters;
bool shrinkProblemEnabled;
size_t reductionLimit;
// vectors storing singleton rows and columns
std::vector<HighsInt> singletonRows;
std::vector<HighsInt> singletonColumns;
// flags to mark rows/columns as deleted
std::vector<uint8_t> rowDeleted;
std::vector<uint8_t> colDeleted;
std::vector<uint16_t> numProbes;
int64_t probingContingent;
HighsInt probingNumDelCol;
HighsInt numProbed;
// counters for number of deleted rows and columns
HighsInt numDeletedRows;
HighsInt numDeletedCols;
// store old problem sizes to compute percentage redunctions in presolve loop
HighsInt oldNumCol;
HighsInt oldNumRow;
bool probingEarlyAbort;
enum class Result {
kOk,
kPrimalInfeasible,
kDualInfeasible,
kStopped,
};
// private functions for different shared functionality and matrix
// modification
void link(HighsInt pos);
void unlink(HighsInt pos);
void markChangedRow(HighsInt row);
void markChangedCol(HighsInt col);
double getMaxAbsColVal(HighsInt col) const;
double getMaxAbsRowVal(HighsInt row) const;
void updateColImpliedBounds(HighsInt row, HighsInt col, double val);
void updateRowDualImpliedBounds(HighsInt row, HighsInt col, double val);
bool rowCoefficientsIntegral(HighsInt row, double scale) const;
bool isImpliedFree(HighsInt col) const;
bool isDualImpliedFree(HighsInt row) const;
bool isImpliedIntegral(HighsInt col);
bool isImpliedInteger(HighsInt col);
bool isLowerImplied(HighsInt col) const;
bool isUpperImplied(HighsInt col) const;
HighsInt countFillin(HighsInt row);
bool checkFillin(HighsHashTable<HighsInt, HighsInt>& fillinCache,
HighsInt row, HighsInt col);
#ifndef NDEBUG
void debugPrintRow(HighsPostsolveStack& postSolveStack, HighsInt row);
#endif
HighsInt findNonzero(HighsInt row, HighsInt col);
void fromCSC(const std::vector<double>& Aval,
const std::vector<HighsInt>& Aindex,
const std::vector<HighsInt>& Astart);
void fromCSR(const std::vector<double>& ARval,
const std::vector<HighsInt>& ARindex,
const std::vector<HighsInt>& ARstart);
void toCSC(std::vector<double>& Aval, std::vector<HighsInt>& Aindex,
std::vector<HighsInt>& Astart);
void toCSR(std::vector<double>& ARval, std::vector<HighsInt>& ARindex,
std::vector<HighsInt>& ARstart);
void storeRow(HighsInt row);
HighsTripletPositionSlice getStoredRow() const;
HighsTripletListSlice getColumnVector(HighsInt col) const;
HighsTripletTreeSlicePreOrder getRowVector(HighsInt row) const;
HighsTripletTreeSliceInOrder getSortedRowVector(HighsInt row) const;
void markRowDeleted(HighsInt row);
void markColDeleted(HighsInt col);
void fixColToLower(HighsPostsolveStack& postsolveStack, HighsInt col);
void fixColToUpper(HighsPostsolveStack& postsolveStack, HighsInt col);
void fixColToZero(HighsPostsolveStack& postsolveStack, HighsInt col);
void transformColumn(HighsPostsolveStack& postSolveStack, HighsInt col,
double scale, double constant);
void scaleRow(HighsInt row, double scale, bool integral = false);
void scaleStoredRow(HighsInt row, double scale, bool integral = false);
void substitute(HighsInt row, HighsInt col, double rhs);
void changeColUpper(HighsInt col, double newUpper);
void changeColLower(HighsInt col, double newLower);
void changeRowDualUpper(HighsInt row, double newUpper);
void changeRowDualLower(HighsInt row, double newLower);
void changeImplColUpper(HighsInt col, double newUpper, HighsInt originRow);
void changeImplColLower(HighsInt col, double newLower, HighsInt originRow);
void changeImplRowDualUpper(HighsInt row, double newUpper,
HighsInt originCol);
void changeImplRowDualLower(HighsInt row, double newLower,
HighsInt originCol);
void scaleMIP(HighsPostsolveStack& postSolveStack);
Result applyConflictGraphSubstitutions(HighsPostsolveStack& postSolveStack);
Result fastPresolveLoop(HighsPostsolveStack& postsolveStack);
Result presolve(HighsPostsolveStack& postsolveStack);
Result checkLimits(HighsPostsolveStack& postsolveStack);
void storeCurrentProblemSize();
double problemSizeReduction();
public:
// for LP presolve
void setInput(HighsLp& model_, const HighsOptions& options_,
HighsTimer* timer = nullptr);
// for MIP presolve
void setInput(HighsMipSolver& mipsolver);
void setReductionLimit(size_t reductionLimit) {
this->reductionLimit = reductionLimit;
}
HighsInt numNonzeros() const { return int(Avalue.size() - freeslots.size()); }
void shrinkProblem(HighsPostsolveStack& postSolveStack);
void addToMatrix(HighsInt row, HighsInt col, double val);
Result runProbing(HighsPostsolveStack& postSolveStack);
Result dominatedColumns(HighsPostsolveStack& postSolveStack);
Result doubletonEq(HighsPostsolveStack& postSolveStack, HighsInt row);
Result singletonRow(HighsPostsolveStack& postSolveStack, HighsInt row);
Result emptyCol(HighsPostsolveStack& postSolveStack, HighsInt col);
Result singletonCol(HighsPostsolveStack& postSolveStack, HighsInt col);
Result rowPresolve(HighsPostsolveStack& postSolveStack, HighsInt row);
Result colPresolve(HighsPostsolveStack& postSolveStack, HighsInt col);
Result solveOneRowComponent(HighsPostsolveStack& postsolveStack,
HighsInt row);
Result initialRowAndColPresolve(HighsPostsolveStack& postSolveStack);
HighsModelStatus run(HighsPostsolveStack& postSolveStack);
void computeIntermediateMatrix(std::vector<HighsInt>& flagRow,
std::vector<HighsInt>& flagCol,
size_t& numreductions);
void substitute(HighsInt substcol, HighsInt staycol, double offset,
double scale);
void removeFixedCol(HighsInt col);
void removeRow(HighsInt row);
Result aggregator(HighsPostsolveStack& postSolveStack);
Result removeRowSingletons(HighsPostsolveStack& postSolveStack);
Result presolveColSingletons(HighsPostsolveStack& postSolveStack);
Result presolveChangedRows(HighsPostsolveStack& postSolveStack);
Result presolveChangedCols(HighsPostsolveStack& postSolveStack);
Result removeDoubletonEquations(HighsPostsolveStack& postSolveStack);
HighsInt strengthenInequalities();
HighsInt detectImpliedIntegers();
Result detectParallelRowsAndCols(HighsPostsolveStack& postsolveStack);
Result sparsify(HighsPostsolveStack& postsolveStack);
void setRelaxedImpliedBounds();
static void debug(const HighsLp& lp, const HighsOptions& options);
};
} // namespace presolve
#endif
| 31.050595 | 80 | 0.707275 | [
"vector",
"model"
] |
cba1bdaa784d39c4847ec921d870d2c5b259f2a2 | 18,989 | c | C | ili.c | AaronDewes/cili | efd77b70df8e382616a0d88f1ae1b0efa9db07d1 | [
"MIT"
] | null | null | null | ili.c | AaronDewes/cili | efd77b70df8e382616a0d88f1ae1b0efa9db07d1 | [
"MIT"
] | null | null | null | ili.c | AaronDewes/cili | efd77b70df8e382616a0d88f1ae1b0efa9db07d1 | [
"MIT"
] | null | null | null | #include <wiringPi.h>
#include <wiringPiSPI.h>
#include <stdint.h>
#include <stdio.h>
#include <math.h>
#include "ili.h"
#include "interface.h"
#define PNG_SKIP_SETJMP_CHECK
#include <png.h>
#include <jpeglib.h>
void setup_pins(ILIObject *self) {
wiringPiSetupGpio();
if (self->SPI == -1) {
pinMode (self->W, OUTPUT);
pinMode (self->DB8, OUTPUT);
pinMode (self->DB9, OUTPUT);
pinMode (self->DB10, OUTPUT);
pinMode (self->DB11, OUTPUT);
pinMode (self->DB12, OUTPUT);
pinMode (self->DB13, OUTPUT);
pinMode (self->DB14, OUTPUT);
pinMode (self->DB15, OUTPUT);
digitalWrite (self->W, LOW);
digitalWrite (self->DB8, LOW);
digitalWrite (self->DB9, LOW);
digitalWrite (self->DB10, LOW);
digitalWrite (self->DB11, LOW);
digitalWrite (self->DB12, LOW);
digitalWrite (self->DB13, LOW);
digitalWrite (self->DB14, LOW);
digitalWrite (self->DB15, LOW);
} else {
self->spi_fd = wiringPiSPISetup (self->SPI, self->SPEED);
}
pinMode (self->RS, OUTPUT);
pinMode (self->RST, OUTPUT);
pinMode (self->CS, OUTPUT);
digitalWrite (self->RS, LOW);
digitalWrite (self->RST, LOW);
digitalWrite (self->CS, HIGH);
}
void set_color(ILIObject *self, uint16_t r, uint16_t g, uint16_t b) {
self->color = (r,g,b);
}
void set_backgroundcolor(ILIObject *self, uint16_t r, uint16_t g, uint16_t b) {
self->background_color = get_color(r,g,b);
}
uint16_t get_color(uint16_t r, uint16_t g, uint16_t b) {
return (r, b, g);
}
void fill_rect(ILIObject *self, uint16_t pos_x1, uint16_t pos_y1, uint16_t pos_x2, uint16_t pos_y2) {
unsigned int size = (abs(pos_x2 - pos_x1) + 1) * (abs(pos_y2 - pos_y1) + 1);
set_area(self, min(pos_x1, pos_x2), min(pos_y1, pos_y2), max(pos_x1, pos_x2), max(pos_y1, pos_y2));
int i;
for(i=0; i<size; i++) {
data(self, self->background_color);
}
}
void draw_pixel(ILIObject *self, uint16_t pos_x1, uint16_t pos_y1, uint16_t color) {
set_area(self, pos_x1, pos_y1, pos_x1, pos_y1);
if (color>-1) {
data(self, color);
} else {
data(self, self->color);
}
}
void draw_vertical_line(ILIObject *self, uint16_t pos_x1, uint16_t pos_y1, uint16_t length) {
set_area(self, pos_x1, pos_y1, pos_x1, pos_y1 + length);
int i;
for(i=0; i<length; i++) {
data(self, self->color);
}
}
void draw_horizontal_line(ILIObject *self, uint16_t pos_x1, uint16_t pos_y1, uint16_t length) {
set_area(self, pos_x1, pos_y1, pos_x1 + length, pos_y1);
int i;
for(i=0; i<length; i++) {
data(self, self->color);
}
}
void swap(uint16_t *a, uint16_t *b) {
uint16_t t;
t = *b;
*b = *a;
*a = t;
}
int calculate_line_appendix(int appendix) {
if (appendix == 0) {
return -1;
}
if (appendix < 0) {
return appendix * -1;
}
return (appendix + 1) * -1;
}
void calculate_line_steps(int *steps, uint16_t length, uint16_t step, uint16_t required_length) {
int i;
for (i=0; i<step; i++) {
steps[i] = length;
}
if (step * length < required_length) {
int rest = required_length - step * length;
int offset = round(step / 2);
int steps_even = step % 2;
int rest_even = rest % 2;
int appendix = 0;
for (i=0; i<rest; i++) {
steps[offset + appendix] += 1;
if (steps_even == 0) {
appendix = calculate_line_appendix(appendix);
} else if (i > 0 && rest_even == 0) {
appendix = calculate_line_appendix(appendix);
} else if (rest_even > 0) {
appendix = calculate_line_appendix(appendix);
}
}
}
}
void draw_line(ILIObject *self, uint16_t pos_x1, uint16_t pos_y1, uint16_t pos_x2, uint16_t pos_y2) {
uint16_t width = abs(pos_x2 - pos_x1);
uint16_t height = abs(pos_y2 - pos_y1);
int horizontal;
int offset_x=0, offset_y=0;
int step = 0, required_length = 0, length = 0;
if (pos_x1 == pos_x2) {
draw_vertical_line(self, pos_x1, pos_y1, height+1);
return;
}
if (pos_y1 == pos_y2) {
draw_horizontal_line(self, pos_x1, pos_y1, width+1);
return;
}
if (width > height) {
horizontal = 1;
width += 1;
if (pos_x2 < pos_x1) {
swap(&pos_x2, &pos_x1);
swap(&pos_y2, &pos_y1);
}
if (pos_y2 > pos_y1) {
offset_y = 1;
} else {
offset_y = -1;
}
if (pos_x2 > pos_x1) {
offset_x = 1;
} else {
offset_x = -1;
}
length = round(width / (height + 1));
step = height + 1;
required_length = width;
} else {
horizontal = 0;
height += 1;
if (pos_y2 < pos_y1) {
swap(&pos_x2, &pos_x1);
swap(&pos_y2, &pos_y1);
}
if (pos_y2 > pos_y1) {
offset_y = 1;
} else {
offset_y = -1;
}
if (pos_x2 > pos_x1) {
offset_x = 1;
} else {
offset_x = -1;
}
length = round(height / (width + 1));
step = width + 1;
required_length = height;
}
int *steps = (int*)calloc(step, sizeof(int*));
calculate_line_steps(steps, length, step, required_length);
int delta_x=0, delta_y=0, i;
for (i=0; i<step; i++) {
//printf("i = %d \n", i);
if (horizontal == 1) {
draw_horizontal_line(
self,
pos_x1 + delta_x,
pos_y1 + i * offset_y,
steps[i]
);
delta_x += *(steps + i) * offset_x;
} else {
draw_vertical_line(
self,
pos_x1 + (i * offset_x),
pos_y1 + delta_y,
steps[i]
);
delta_y += *(steps + i) * offset_y;
}
}
free(steps);
}
void draw_circle(ILIObject *self, uint16_t pos_x, uint16_t pos_y, uint16_t radius) {
int err=0, offset_x = radius, offset_y=0;
while (offset_x >= offset_y) {
draw_pixel(self, pos_x + offset_x, pos_y + offset_y, -1);
draw_pixel(self, pos_x + offset_y, pos_y + offset_x, -1);
draw_pixel(self, pos_x - offset_y, pos_y + offset_x, -1);
draw_pixel(self, pos_x - offset_x, pos_y + offset_y, -1);
draw_pixel(self, pos_x - offset_x, pos_y - offset_y, -1);
draw_pixel(self, pos_x - offset_y, pos_y - offset_x, -1);
draw_pixel(self, pos_x + offset_y, pos_y - offset_x, -1);
draw_pixel(self, pos_x + offset_x, pos_y - offset_y, -1);
if (err <= 0) {
offset_y += 1;
err += 2*offset_y + 1;
} else {
offset_x -= 1;
err -= 2*offset_x + 1;
}
}
}
void draw_arc(ILIObject *self, uint16_t pos_x, uint16_t pos_y, uint16_t radius, uint16_t start, uint16_t end) {
int err=0, offset_x = radius, offset_y=0;
double start_r, end_r;
start_r = start * M_PI / 180;
end_r = end * M_PI / 180;
while (offset_x >= offset_y) {
if (start_r <= atan2(offset_y, offset_x) && atan2(offset_y, offset_x) <= end_r) {
draw_pixel(self, pos_x + offset_x, pos_y + offset_y, -1);
}
if (start_r <= atan2(offset_x, offset_y) && atan2(offset_x, offset_y) <= end_r) {
draw_pixel(self, pos_x + offset_y, pos_y + offset_x, -1);
}
if (start_r <= atan2(offset_x, -offset_y) && atan2(offset_x, -offset_y) <= end_r) {
draw_pixel(self, pos_x - offset_y, pos_y + offset_x, -1);
}
if (start_r <= atan2(offset_y, -offset_x) && atan2(offset_y, -offset_x) <= end_r) {
draw_pixel(self, pos_x - offset_x, pos_y + offset_y, -1);
}
if (start_r <= atan2(-offset_y, -offset_x) + 2*M_PI && atan2(-offset_y, -offset_x) + 2*M_PI <= end_r) {
draw_pixel(self, pos_x - offset_x, pos_y - offset_y, -1);
}
if (start_r <= atan2(-offset_x, -offset_y) + 2*M_PI && atan2(-offset_x, -offset_y) + 2*M_PI <= end_r) {
draw_pixel(self, pos_x - offset_y, pos_y - offset_x, -1);
}
if (start_r <= atan2(-offset_x, offset_y) + 2*M_PI && atan2(-offset_x, offset_y) + 2*M_PI <= end_r) {
draw_pixel(self, pos_x + offset_y, pos_y - offset_x, -1);
}
if (start_r <= atan2(-offset_y, offset_x) + 2*M_PI && atan2(-offset_y, offset_x) + 2*M_PI <= end_r) {
draw_pixel(self, pos_x + offset_x, pos_y - offset_y, -1);
}
if (err <= 0) {
offset_y += 1;
err += 2*offset_y + 1;
} else {
offset_x -= 1;
err -= 2*offset_x + 1;
}
}
}
void draw_rect(ILIObject *self, uint16_t pos_x1, uint16_t pos_y1, uint16_t pos_x2, uint16_t pos_y2) {
draw_line(self, pos_x1, pos_y1, pos_x2, pos_y1);
draw_line(self, pos_x1, pos_y2, pos_x2, pos_y2);
draw_line(self, pos_x1, pos_y1, pos_x1, pos_y2);
draw_line(self, pos_x2, pos_y1, pos_x2, pos_y2);
}
void draw_text(ILIObject *self, uint16_t pos_x, uint16_t pos_y, char *text, uint16_t with_background) {
PyObject *size;
PyObject *rows;
int width, height, i, j, z;
int offset=0;
int len = strlen(text);
int letter;
size = PyObject_GetAttrString(self->font, "size");
width = PyLong_AsLong(PyTuple_GetItem(size, 0));
height = PyLong_AsLong(PyTuple_GetItem(size, 1));
Py_DECREF(size);
for (i=0; i<len; i++) {
rows = PyObject_CallMethod(self->font, "get", "c", text[i]);
if (with_background) {
set_area(self, pos_x + offset, pos_y, pos_x + offset + width - 1, pos_y + height - 1);
}
for (j=0; j<height; j++) {
letter = PyLong_AsLong(PyList_GetItem(rows, j));
for(z=0; z<width; z++) {
if (letter & 0x01) {
if (with_background) {
data(self, self->color);
} else {
draw_pixel(self, pos_x + offset + z, pos_y+j, -1);
}
} else {
if (with_background) {
data(self, self->background_color);
}
}
letter >>= 1;
}
}
offset += width;
Py_DECREF(rows);
}
}
static int is_transparent(ILIObject *self, int r, int g, int b) {
if (self->is_transparency == 0) {
return 0;
}
int i;
for(i=0; i<self->is_transparency; i++) {
if (self->transparency[i].r == r &&
self->transparency[i].g == g &&
self->transparency[i].b == b)
{
return 1;
}
}
return 0;
}
void draw_object_image(ILIObject *self, uint16_t pos_x, uint16_t pos_y, PyObject *image) {
PyObject *size;
int width, height, i, j;
PyObject *pixel;
int r,g,b;
int temp_area[3] = {-1};
int area[3] = {-1};
size = PyObject_GetAttrString(image, "size");
width = PyLong_AsLong(PyTuple_GetItem(size, 0));
height = PyLong_AsLong(PyTuple_GetItem(size, 1));
Py_DECREF(size);
set_area(self, pos_x, pos_y, pos_x + width - 1, pos_y + height - 1);
for(j=0; j<height; j++) {
for (i=0; i<width; i++) {
pixel = PyObject_CallMethod(
image, "getpixel","((i,i))", i, j
);
r = PyLong_AsLong(PyTuple_GetItem(pixel, 0));
g = PyLong_AsLong(PyTuple_GetItem(pixel, 1));
b = PyLong_AsLong(PyTuple_GetItem(pixel, 2));
if (is_transparent(self, r, g, b)) {
area[0] = pos_x;
area[1] = pos_y + j + 1;
area[2] = pos_x + width - 1;
area[3] = pos_y + height - 1;
temp_area[0] = pos_x + i + 1;
temp_area[1] = pos_y + j;
temp_area[2] = pos_x + width -1;
temp_area[3] = pos_y + j;
} else {
if (temp_area[0] != -1) {
set_area(self, temp_area[0], temp_area[1], temp_area[2], temp_area[3]);
temp_area[0] = -1;
}
data(self, get_color(r, g, b));
}
Py_DECREF(pixel);
}
if (area[0] != -1) {
set_area(self, area[0], area[1], area[2], area[3]);
area[0] = -1;
temp_area[0] = -1;
}
}
}
void draw_jpeg_file_image(ILIObject *self, uint16_t pos_x, uint16_t pos_y, FILE *infile) {
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr err;
JSAMPARRAY buffer; /* Output row buffer */
int row_stride; /* physical row width in output buffer */
int red,green,blue;
int i;
int temp_area[3] = {-1};
int area[3] = {-1};
/* Step 1: allocate and initialize JPEG decompression object */
cinfo.err = jpeg_std_error(&err);
/* Now we can initialize the JPEG decompression object. */
jpeg_create_decompress(&cinfo);
/* Step 2: specify data source (eg, a file) */
jpeg_stdio_src(&cinfo, infile);
/* Step 3: read file parameters with jpeg_read_header() */
(void) jpeg_read_header(&cinfo, TRUE);
/* Step 5: Start decompressor */
(void) jpeg_start_decompress(&cinfo);
/* JSAMPLEs per row in output buffer */
row_stride = cinfo.output_width * cinfo.output_components;
/* Make a one-row-high sample array that will go away when done with image */
buffer = (*cinfo.mem->alloc_sarray)
((j_common_ptr) &cinfo, JPOOL_IMAGE, row_stride, 1);
set_area(self, pos_x, pos_y, pos_x + cinfo.output_width - 1, pos_y + cinfo.output_height - 1);
/* Here we use the library's state variable cinfo.output_scanline as the
* loop counter, so that we don't have to keep track ourselves.
*/
while (cinfo.output_scanline < cinfo.output_height) {
/* jpeg_read_scanlines expects an array of pointers to scanlines.
* Here the array is only one element long, but you could ask for
* more than one scanline at a time if that's more convenient.
*/
(void) jpeg_read_scanlines(&cinfo, buffer, 1);
unsigned char* pixel_row = (unsigned char*)(buffer[0]);
for(i = 0; i < cinfo.output_width; i++) {
red = (int)(*pixel_row++);
green = (int)(*pixel_row++);
blue = (int)(*pixel_row++);
if (is_transparent(self, red, green, blue)) {
area[0] = pos_x;
area[1] = pos_y + cinfo.output_scanline + 1;
area[2] = pos_x + cinfo.output_width - 1;
area[3] = pos_y + cinfo.output_height - 1;
temp_area[0] = pos_x + i + 1;
temp_area[1] = pos_y + cinfo.output_scanline;
temp_area[2] = pos_x + cinfo.output_width -1;
temp_area[3] = pos_y + cinfo.output_scanline;
} else {
if (temp_area[0] != -1) {
set_area(self, temp_area[0], temp_area[1], temp_area[2], temp_area[3]);
temp_area[0] = -1;
}
data(self, get_color(red, green, blue));
}
}
if (area[0] != -1) {
set_area(self, area[0], area[1], area[2], area[3]);
area[0] = -1;
temp_area[0] = -1;
}
}
/* Step 7: Finish decompression */
(void) jpeg_finish_decompress(&cinfo);
/* Step 8: Release JPEG decompression object */
/* This is an important step since it will release a good deal of memory. */
jpeg_destroy_decompress(&cinfo);
}
void draw_png_file_image(ILIObject *self, uint16_t pos_x, uint16_t pos_y, FILE *fp) {
int width, height;
png_byte color_type;
png_byte bit_depth;
png_bytep *row_pointers;
int x,y;
int temp_area[3] = {-1};
int area[3] = {-1};
int red,green,blue;
png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if(!png) abort();
png_infop info = png_create_info_struct(png);
if(!info) abort();
if(setjmp(png_jmpbuf(png))) abort();
png_init_io(png, fp);
png_read_info(png, info);
width = png_get_image_width(png, info);
height = png_get_image_height(png, info);
color_type = png_get_color_type(png, info);
bit_depth = png_get_bit_depth(png, info);
// Read any color_type into 8bit depth, RGBA format.
// See http://www.libpng.org/pub/png/libpng-manual.txt
if(bit_depth == 16)
png_set_strip_16(png);
if(color_type == PNG_COLOR_TYPE_PALETTE)
png_set_palette_to_rgb(png);
// PNG_COLOR_TYPE_GRAY_ALPHA is always 8 or 16bit depth.
if(color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_expand_gray_1_2_4_to_8(png);
if(png_get_valid(png, info, PNG_INFO_tRNS))
png_set_tRNS_to_alpha(png);
// These color_type don't have an alpha channel then fill it with 0xff.
if(color_type == PNG_COLOR_TYPE_RGB ||
color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_PALETTE)
png_set_filler(png, 0xFF, PNG_FILLER_AFTER);
if(color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png);
png_read_update_info(png, info);
row_pointers = (png_bytep*)malloc(sizeof(png_bytep) * height);
for(y = 0; y < height; y++) {
row_pointers[y] = (png_byte*)malloc(png_get_rowbytes(png,info));
}
png_read_image(png, row_pointers);
set_area(self, pos_x, pos_y, pos_x + width - 1, pos_y + height - 1);
for(y = 0; y < height; y++) {
png_bytep row = row_pointers[y];
for(x = 0; x < width; x++) {
png_bytep px = &(row[x * 4]);
red = px[0];
green = px[1];
blue = px[2];
if (is_transparent(self, red, green, blue)) {
area[0] = pos_x;
area[1] = pos_y + y + 1;
area[2] = pos_x + width - 1;
area[3] = pos_y + height - 1;
temp_area[0] = pos_x + x + 1;
temp_area[1] = pos_y + y;
temp_area[2] = pos_x + width -1;
temp_area[3] = pos_y + y;
} else {
if (temp_area[0] != -1) {
set_area(self, temp_area[0], temp_area[1], temp_area[2], temp_area[3]);
temp_area[0] = -1;
}
data(self, get_color(red, green, blue));
}
}
if (area[0] != -1) {
set_area(self, area[0], area[1], area[2], area[3]);
area[0] = -1;
temp_area[0] = -1;
}
png_free(png, row);
}
png_destroy_read_struct(&png, &info, NULL);
png=NULL;
info=NULL;
} | 33.431338 | 111 | 0.545579 | [
"object"
] |
cbab94c7172292b36527c6fb9e6288bcc0b1c0b9 | 5,366 | h | C | Direct2DNet/DXGINet/IDXGIDevice.h | SansyHuman/Direct2DNet | 345d981a07fd8cbdf7cf7e6ca9d7b493439dbd17 | [
"MIT"
] | null | null | null | Direct2DNet/DXGINet/IDXGIDevice.h | SansyHuman/Direct2DNet | 345d981a07fd8cbdf7cf7e6ca9d7b493439dbd17 | [
"MIT"
] | null | null | null | Direct2DNet/DXGINet/IDXGIDevice.h | SansyHuman/Direct2DNet | 345d981a07fd8cbdf7cf7e6ca9d7b493439dbd17 | [
"MIT"
] | null | null | null | #pragma once
#include "DXGINetHeaders.h"
#include "IDXGIObject.h"
#include "DXGISettings.h"
#include "../Direct2DNet/Exception/DXException.h"
using namespace System::Runtime;
using namespace System::Runtime::CompilerServices;
namespace D2DNet
{
namespace DXGINet
{
ref class IDXGIAdapter;
ref class IDXGISurface;
// Done.
/// <summary>
/// An IDXGIDevice interface implements a derived class for DXGI objects that produce image data.
/// </summary>
[System::Runtime::InteropServices::GuidAttribute("54ec77fa-1377-44e6-8c32-88fd5f44c84c")]
public ref class IDXGIDevice : DXGINet::IDXGIObject
{
internal:
IDXGIDevice() : DXGINet::IDXGIObject() {}
// Called By D3D11Device::QueryToIDXGIDevice
IDXGIDevice(::IDXGIDevice *pDevice);
public:
/// <summary>
/// Returns the adapter for the specified device.
/// </summary>
/// <param name="adapter">An IDXGIAdapter object to the adapter(out parameter).</param>
/// <returns>
/// Returns S_OK if successful; otherwise, returns one of the DXGI_ERROR that indicates failure.
/// </returns>
HRESULT GetAdapter(
[InteropServices::OutAttribute] DXGINet::IDXGIAdapter ^%adapter
);
/// <summary>
/// Returns a surface.
/// </summary>
/// <param name="desc">A DXGI_SURFACE_DESC structure that describes the surface.</param>
/// <param name="numSurfaces">The number of surfaces to create.</param>
/// <param name="usage">A DXGI_USAGE flag that specifies how the surface is expected to be used.
/// </param>
/// <param name="cpuAccess">A DXGI_CPU_ACCESS flag that specifies how the surface is expected to
/// be accessed by CPU.
/// </param>
/// <param name="sharedResource">An optional pointer to the shared resource information for
/// opening views of such resources.
/// </param>
/// <exception cref="DWriteNet::Exception::DWriteException">
/// Thrown when it failed to create the surface.
/// </exception>
[System::ObsoleteAttribute("This method is used internally and you should not call it directly in your application.")]
DXGINet::IDXGISurface ^CreateSurface(
[InteropServices::InAttribute][IsReadOnlyAttribute] DXGINet::DXGI_SURFACE_DESC %desc,
UINT numSurfaces,
DXGINet::DXGI_USAGE usage,
DXGINet::DXGI_CPU_ACCESS cpuAccess,
[InteropServices::OptionalAttribute] System::Nullable<System::IntPtr> sharedResource
);
/// <summary>
/// Gets the residency status of an array of resources.
/// </summary>
/// <param name="resources">An array of IDXGIResource interfaces.</param>
/// <param name="residencyStatus">An array of DXGI_RESIDENCY flags. Each element describes
/// the residency status for corresponding element in the resources argument array. The input
/// residencyStatus array should have the same length with resources array.</param>
/// <returns>
/// Returns S_OK if successful; otherwise, returns DXGI_ERROR_DEVICE_REMOVED, E_INVALIDARG,
/// or E_POINTER.
/// </returns>
HRESULT QueryResourceResidency(
array<D2DNet::IUnknown ^> ^resources,
array<DXGINet::DXGI_RESIDENCY> ^residencyStatus
);
/// <summary>
/// Sets the GPU thread priority.
/// </summary>
/// <param name="priority">A value that specifies the required GPU thread priority. This value
/// is between -7(NEG_7) and 7(POS_7), inclusive, where 0(NORMAL) represents normal priority.
/// </param>
/// <returns>
/// Return S_OK if successful; otherwise, returns E_INVALIDARG if the priority parameter
/// is invalid.
/// </returns>
HRESULT SetGPUThreadPriority(DXGINet::DXGI_GPU_THREAD_PRIORITY priority);
/// <summary>
/// Gets the GPU thread priority.
/// </summary>
/// <param name="priority">A value that specifies the required GPU thread priority. This value
/// is between -7(NEG_7) and 7(POS_7), inclusive, where 0(NORMAL) represents normal priority.
/// </param>
/// <returns>
/// Return S_OK if successful.
/// </returns>
HRESULT GetGPUThreadPriority(
[InteropServices::OutAttribute] DXGINet::DXGI_GPU_THREAD_PRIORITY %priority
);
/// <summary>
/// Gets the GPU thread priority.
/// </summary>
/// <returns>
/// (HRESULT, <see cref="DXGINet::DXGI_GPU_THREAD_PRIORITY"/>) tuple. HRESULT is S_OK
/// if successful. <see cref="DXGINet::DXGI_GPU_THREAD_PRIORITY"/> is the GPU thread priority.
/// </returns>
System::ValueTuple<HRESULT, DXGINet::DXGI_GPU_THREAD_PRIORITY> GetGPUThreadPriority();
};
}
} | 44.716667 | 130 | 0.587961 | [
"object"
] |
cbb095c1be79e679af76bb687f931541a583bce1 | 4,467 | h | C | 3rdparty/libwebp/utils/bit_writer.h | snosov1/opencv | ce05d6cb89450a5778f4c0169b5da5589798192a | [
"BSD-3-Clause"
] | 291 | 2015-06-11T06:07:15.000Z | 2022-02-11T00:33:07.000Z | 3rdparty/libwebp/utils/bit_writer.h | snosov1/opencv | ce05d6cb89450a5778f4c0169b5da5589798192a | [
"BSD-3-Clause"
] | 28 | 2016-10-16T19:42:37.000Z | 2018-09-14T21:29:48.000Z | 3rdparty/libwebp/utils/bit_writer.h | snosov1/opencv | ce05d6cb89450a5778f4c0169b5da5589798192a | [
"BSD-3-Clause"
] | 69 | 2015-08-02T02:39:45.000Z | 2021-12-21T06:54:39.000Z | // Copyright 2011 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
// -----------------------------------------------------------------------------
//
// Bit writing and boolean coder
//
// Author: Skal (pascal.massimino@gmail.com)
#ifndef WEBP_UTILS_BIT_WRITER_H_
#define WEBP_UTILS_BIT_WRITER_H_
#include "../webp/types.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
//------------------------------------------------------------------------------
// Bit-writing
typedef struct VP8BitWriter VP8BitWriter;
struct VP8BitWriter {
int32_t range_; // range-1
int32_t value_;
int run_; // number of outstanding bits
int nb_bits_; // number of pending bits
uint8_t* buf_; // internal buffer. Re-allocated regularly. Not owned.
size_t pos_;
size_t max_pos_;
int error_; // true in case of error
};
// Initialize the object. Allocates some initial memory based on expected_size.
int VP8BitWriterInit(VP8BitWriter* const bw, size_t expected_size);
// Finalize the bitstream coding. Returns a pointer to the internal buffer.
uint8_t* VP8BitWriterFinish(VP8BitWriter* const bw);
// Release any pending memory and zeroes the object. Not a mandatory call.
// Only useful in case of error, when the internal buffer hasn't been grabbed!
void VP8BitWriterWipeOut(VP8BitWriter* const bw);
int VP8PutBit(VP8BitWriter* const bw, int bit, int prob);
int VP8PutBitUniform(VP8BitWriter* const bw, int bit);
void VP8PutValue(VP8BitWriter* const bw, int value, int nb_bits);
void VP8PutSignedValue(VP8BitWriter* const bw, int value, int nb_bits);
// Appends some bytes to the internal buffer. Data is copied.
int VP8BitWriterAppend(VP8BitWriter* const bw,
const uint8_t* data, size_t size);
// return approximate write position (in bits)
static WEBP_INLINE uint64_t VP8BitWriterPos(const VP8BitWriter* const bw) {
return (uint64_t)(bw->pos_ + bw->run_) * 8 + 8 + bw->nb_bits_;
}
// Returns a pointer to the internal buffer.
static WEBP_INLINE uint8_t* VP8BitWriterBuf(const VP8BitWriter* const bw) {
return bw->buf_;
}
// Returns the size of the internal buffer.
static WEBP_INLINE size_t VP8BitWriterSize(const VP8BitWriter* const bw) {
return bw->pos_;
}
//------------------------------------------------------------------------------
// VP8LBitWriter
// TODO(vikasa): VP8LBitWriter is copied as-is from lossless code. There's scope
// of re-using VP8BitWriter. Will evaluate once basic lossless encoder is
// implemented.
typedef struct {
uint8_t* buf_;
size_t bit_pos_;
size_t max_bytes_;
// After all bits are written, the caller must observe the state of
// error_. A value of 1 indicates that a memory allocation failure
// has happened during bit writing. A value of 0 indicates successful
// writing of bits.
int error_;
} VP8LBitWriter;
static WEBP_INLINE size_t VP8LBitWriterNumBytes(VP8LBitWriter* const bw) {
return (bw->bit_pos_ + 7) >> 3;
}
static WEBP_INLINE uint8_t* VP8LBitWriterFinish(VP8LBitWriter* const bw) {
return bw->buf_;
}
// Returns 0 in case of memory allocation error.
int VP8LBitWriterInit(VP8LBitWriter* const bw, size_t expected_size);
void VP8LBitWriterDestroy(VP8LBitWriter* const bw);
// This function writes bits into bytes in increasing addresses, and within
// a byte least-significant-bit first.
//
// The function can write up to 16 bits in one go with WriteBits
// Example: let's assume that 3 bits (Rs below) have been written already:
//
// BYTE-0 BYTE+1 BYTE+2
//
// 0000 0RRR 0000 0000 0000 0000
//
// Now, we could write 5 or less bits in MSB by just sifting by 3
// and OR'ing to BYTE-0.
//
// For n bits, we take the last 5 bytes, OR that with high bits in BYTE-0,
// and locate the rest in BYTE+1 and BYTE+2.
//
// VP8LBitWriter's error_ flag is set in case of memory allocation error.
void VP8LWriteBits(VP8LBitWriter* const bw, int n_bits, uint32_t bits);
//------------------------------------------------------------------------------
#if defined(__cplusplus) || defined(c_plusplus)
} // extern "C"
#endif
#endif /* WEBP_UTILS_BIT_WRITER_H_ */
| 35.452381 | 80 | 0.681889 | [
"object"
] |
cbc738d7466daeba4baf4f41d290cb56b8dba55c | 1,814 | h | C | talk/owt/sdk/base/vcmcapturer.h | AoEiuV020/owt-client-native | 7fc498347b20149fd1a4fd7ff84fa891548c9a84 | [
"Apache-2.0"
] | 294 | 2019-02-20T01:44:34.000Z | 2022-03-30T15:52:55.000Z | talk/owt/sdk/base/vcmcapturer.h | AoEiuV020/owt-client-native | 7fc498347b20149fd1a4fd7ff84fa891548c9a84 | [
"Apache-2.0"
] | 335 | 2019-02-20T11:54:49.000Z | 2022-03-29T14:26:34.000Z | talk/owt/sdk/base/vcmcapturer.h | AoEiuV020/owt-client-native | 7fc498347b20149fd1a4fd7ff84fa891548c9a84 | [
"Apache-2.0"
] | 163 | 2019-02-18T06:56:26.000Z | 2022-03-30T13:37:24.000Z | /*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef OWT_BASE_VCMCAPTURER_H_
#define OWT_BASE_VCMCAPTURER_H_
#include <memory>
#include <vector>
#include "api/scoped_refptr.h"
#include "modules/video_capture/video_capture.h"
#include "webrtc/rtc_base/thread.h"
#include "talk/owt/sdk/base/cameravideocapturer.h"
// This file is borrowed from webrtc project.
namespace owt {
namespace base {
class VcmCapturer : public CameraVideoCapturer,
public rtc::VideoSinkInterface<webrtc::VideoFrame> {
public:
static VcmCapturer* Create(size_t width,
size_t height,
size_t target_fps,
size_t capture_device_index);
virtual ~VcmCapturer();
void OnFrame(const webrtc::VideoFrame& frame) override;
private:
VcmCapturer();
bool Init(size_t width,
size_t height,
size_t target_fps,
size_t capture_device_index);
void Destroy();
rtc::scoped_refptr<webrtc::VideoCaptureModule> CreateDeviceOnVCMThread(
const char* unique_device_utf8);
int32_t StartCaptureOnVCMThread(webrtc::VideoCaptureCapability);
int32_t StopCaptureOnVCMThread();
void ReleaseOnVCMThread();
rtc::scoped_refptr<webrtc::VideoCaptureModule> vcm_;
webrtc::VideoCaptureCapability capability_;
std::unique_ptr<rtc::Thread> vcm_thread_;
};
} // namespace base
} // namespace owt
#endif // OWT_BASE_VCMCAPTURER_H_
| 32.392857 | 73 | 0.712238 | [
"vector"
] |
cbce6c0173ed7ebb90308f6a94251fa04dfdd7aa | 5,738 | h | C | examples/bfd/elf/csky.h | kieker-monitoring/kieker-lang-pack-c | a8aa001f02781bda34a655e6b62b7ed369759142 | [
"Apache-2.0"
] | 3 | 2021-05-04T17:09:06.000Z | 2021-10-04T07:19:26.000Z | examples/bfd/elf/csky.h | kieker-monitoring/kieker-lang-pack-c | a8aa001f02781bda34a655e6b62b7ed369759142 | [
"Apache-2.0"
] | null | null | null | examples/bfd/elf/csky.h | kieker-monitoring/kieker-lang-pack-c | a8aa001f02781bda34a655e6b62b7ed369759142 | [
"Apache-2.0"
] | null | null | null | /* C-SKY ELF support for BFD.
Copyright (C) 1998-2020 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
This file is part of BFD, the Binary File Descriptor library.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
#ifndef _ELF_CSKY_H
#define _ELF_CSKY_H
#include "elf/reloc-macros.h"
/* Values of relocation types according to the ABI doc.
The order should be consistent with csky bfd reloc type
table in bfd-in2.h. */
START_RELOC_NUMBERS (elf_csky_reloc_type)
RELOC_NUMBER (R_CKCORE_NONE,0)
RELOC_NUMBER (R_CKCORE_ADDR32,1)
RELOC_NUMBER (R_CKCORE_PCREL_IMM8BY4,2)
RELOC_NUMBER (R_CKCORE_PCREL_IMM11BY2,3)
RELOC_NUMBER (R_CKCORE_PCREL_IMM4BY2,4)
RELOC_NUMBER (R_CKCORE_PCREL32,5)
RELOC_NUMBER (R_CKCORE_PCREL_JSR_IMM11BY2,6)
RELOC_NUMBER (R_CKCORE_GNU_VTINHERIT,7)
RELOC_NUMBER (R_CKCORE_GNU_VTENTRY,8)
RELOC_NUMBER (R_CKCORE_RELATIVE,9)
RELOC_NUMBER (R_CKCORE_COPY,10)
RELOC_NUMBER (R_CKCORE_GLOB_DAT,11)
RELOC_NUMBER (R_CKCORE_JUMP_SLOT,12)
RELOC_NUMBER (R_CKCORE_GOTOFF,13)
RELOC_NUMBER (R_CKCORE_GOTPC,14)
RELOC_NUMBER (R_CKCORE_GOT32,15)
RELOC_NUMBER (R_CKCORE_PLT32,16)
RELOC_NUMBER (R_CKCORE_ADDRGOT,17)
RELOC_NUMBER (R_CKCORE_ADDRPLT,18)
RELOC_NUMBER (R_CKCORE_PCREL_IMM26BY2,19)
RELOC_NUMBER (R_CKCORE_PCREL_IMM16BY2,20)
RELOC_NUMBER (R_CKCORE_PCREL_IMM16BY4,21)
RELOC_NUMBER (R_CKCORE_PCREL_IMM10BY2,22)
RELOC_NUMBER (R_CKCORE_PCREL_IMM10BY4,23)
RELOC_NUMBER (R_CKCORE_ADDR_HI16,24)
RELOC_NUMBER (R_CKCORE_ADDR_LO16,25)
RELOC_NUMBER (R_CKCORE_GOTPC_HI16,26)
RELOC_NUMBER (R_CKCORE_GOTPC_LO16,27)
RELOC_NUMBER (R_CKCORE_GOTOFF_HI16,28)
RELOC_NUMBER (R_CKCORE_GOTOFF_LO16,29)
RELOC_NUMBER (R_CKCORE_GOT12,30)
RELOC_NUMBER (R_CKCORE_GOT_HI16,31)
RELOC_NUMBER (R_CKCORE_GOT_LO16,32)
RELOC_NUMBER (R_CKCORE_PLT12,33)
RELOC_NUMBER (R_CKCORE_PLT_HI16,34)
RELOC_NUMBER (R_CKCORE_PLT_LO16,35)
RELOC_NUMBER (R_CKCORE_ADDRGOT_HI16,36)
RELOC_NUMBER (R_CKCORE_ADDRGOT_LO16,37)
RELOC_NUMBER (R_CKCORE_ADDRPLT_HI16,38)
RELOC_NUMBER (R_CKCORE_ADDRPLT_LO16,39)
RELOC_NUMBER (R_CKCORE_PCREL_JSR_IMM26BY2,40)
RELOC_NUMBER (R_CKCORE_TOFFSET_LO16, 41)
RELOC_NUMBER (R_CKCORE_DOFFSET_LO16, 42)
RELOC_NUMBER (R_CKCORE_PCREL_IMM18BY2, 43)
RELOC_NUMBER (R_CKCORE_DOFFSET_IMM18, 44)
RELOC_NUMBER (R_CKCORE_DOFFSET_IMM18BY2, 45)
RELOC_NUMBER (R_CKCORE_DOFFSET_IMM18BY4, 46)
RELOC_NUMBER (R_CKCORE_GOTOFF_IMM18, 47)
RELOC_NUMBER (R_CKCORE_GOT_IMM18BY4, 48)
RELOC_NUMBER (R_CKCORE_PLT_IMM18BY4, 49)
RELOC_NUMBER (R_CKCORE_PCREL_IMM7BY4, 50)
RELOC_NUMBER (R_CKCORE_TLS_LE32, 51)
RELOC_NUMBER (R_CKCORE_TLS_IE32, 52)
RELOC_NUMBER (R_CKCORE_TLS_GD32, 53)
RELOC_NUMBER (R_CKCORE_TLS_LDM32, 54)
RELOC_NUMBER (R_CKCORE_TLS_LDO32, 55)
RELOC_NUMBER (R_CKCORE_TLS_DTPMOD32, 56)
RELOC_NUMBER (R_CKCORE_TLS_DTPOFF32, 57)
RELOC_NUMBER (R_CKCORE_TLS_TPOFF32, 58)
RELOC_NUMBER (R_CKCORE_PCREL_FLRW_IMM8BY4, 59)
RELOC_NUMBER (R_CKCORE_NOJSRI, 60)
RELOC_NUMBER (R_CKCORE_CALLGRAPH, 61)
RELOC_NUMBER (R_CKCORE_IRELATIVE, 62)
RELOC_NUMBER (R_CKCORE_PCREL_BLOOP_IMM4BY4, 63)
RELOC_NUMBER (R_CKCORE_PCREL_BLOOP_IMM12BY4, 64)
END_RELOC_NUMBERS (R_CKCORE_MAX)
/* Additional section types. */
#define SHT_CSKY_ATTRIBUTES 0x70000001 /* Section holds attributes. */
/* Object attribute tags. */
enum
{
/* 0-3 are generic. */
/* Arch name for this object file. */
Tag_CSKY_ARCH_NAME = 4,
Tag_CSKY_CPU_NAME = 5,
/* ISA flags for this object file. */
Tag_CSKY_ISA_FLAGS,
Tag_CSKY_ISA_EXT_FLAGS,
/* CSKY DSP version used by this object file. */
Tag_CSKY_DSP_VERSION,
/* CSKY VDSP version used by this object file. */
Tag_CSKY_VDSP_VERSION,
/* CSKY FPU version used by this object file. */
Tag_CSKY_FPU_VERSION = 0x10,
/* FPU ABI. params: Soft GR/Hard GR/Hard FR. */
Tag_CSKY_FPU_ABI,
/* Rounding Support. */
Tag_CSKY_FPU_ROUNDING,
/* Denormal Support. */
Tag_CSKY_FPU_DENORMAL,
/* Exeception Support. */
Tag_CSKY_FPU_Exception,
/* Number Module Support("IEEE 754"). */
Tag_CSKY_FPU_NUMBER_MODULE,
/* Half/Single/Double. */
Tag_CSKY_FPU_HARDFP,
Tag_CSKY_MAX,
};
/* Object attribute values. */
enum
{
/* Values defined for Tag_CSKY_DSP_VERSION. */
VAL_CSKY_DSP_VERSION_EXTENSION = 1, /* hi-lo DSP extension. */
VAL_CSKY_DSP_VERSION_2 = 2, /* CK803s EDSP. */
};
enum
{
/* Values defined for Tag_CSKY_VDSP_VERSION. */
VAL_CSKY_VDSP_VERSION_1 = 1, /* VDSP version 1. */
VAL_CSKY_VDSP_VERSION_2 /* VDSP version 1. */
};
enum
{
/* Values defined for Tag_CSKY_FPU_VERSION. */
VAL_CSKY_FPU_VERSION_1 = 1, /* ABIV1 FPU. */
VAL_CSKY_FPU_VERSION_2, /* ABIV2 FPU. */
};
enum
{
VAL_CSKY_FPU_ABI_SOFT = 1,
VAL_CSKY_FPU_ABI_SOFTFP,
VAL_CSKY_FPU_ABI_HARD,
};
enum
{
VAL_CSKY_FPU_HARDFP_HALF = 1,
VAL_CSKY_FPU_HARDFP_SINGLE = 2,
VAL_CSKY_FPU_HARDFP_DOUBLE = 4,
};
#endif /* _ELF_CSKY_H */
| 33.16763 | 77 | 0.747822 | [
"object"
] |
cbcf3967b23e4105ac236cca01d6426e48262602 | 4,101 | h | C | Source/Swapchain.h | pac85/RayTracedGL1 | add5a73b5d359606d3bd350e696e64d97a9c6347 | [
"MIT"
] | 17 | 2021-09-05T01:34:40.000Z | 2022-03-12T03:25:38.000Z | Source/Swapchain.h | pac85/RayTracedGL1 | add5a73b5d359606d3bd350e696e64d97a9c6347 | [
"MIT"
] | null | null | null | Source/Swapchain.h | pac85/RayTracedGL1 | add5a73b5d359606d3bd350e696e64d97a9c6347 | [
"MIT"
] | 3 | 2021-11-14T01:02:25.000Z | 2022-02-14T08:56:22.000Z | // Copyright (c) 2020-2021 Sultim Tsyrendashiev
//
// 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 <list>
#include <vector>
#include "Common.h"
#include "PhysicalDevice.h"
#include "CommandBufferManager.h"
#include "ISwapchainDependency.h"
namespace RTGL1
{
class Swapchain
{
public:
Swapchain(
VkDevice device,
VkSurfaceKHR surface,
std::shared_ptr<PhysicalDevice> physDevice,
std::shared_ptr<CommandBufferManager> cmdManager);
~Swapchain();
Swapchain(const Swapchain &other) = delete;
Swapchain(Swapchain &&other) noexcept = delete;
Swapchain &operator=(const Swapchain &other) = delete;
Swapchain &operator=(Swapchain &&other) noexcept = delete;
// Request new surface size. Swapchain will be recreated when the inconsitency
// will be found. Returns true, if new extent is different from the previous one.
// Should be called every frame change.
bool RequestNewSize(uint32_t newWidth, uint32_t newHeight);
bool RequestVsync(bool enable);
void AcquireImage(VkSemaphore imageAvailableSemaphore);
void BlitForPresent(VkCommandBuffer cmd, VkImage srcImage, uint32_t srcImageWidth, uint32_t srcImageHeight, VkImageLayout srcImageLayout = VK_IMAGE_LAYOUT_GENERAL);
void Present(const std::shared_ptr<Queues> &queues, VkSemaphore renderFinishedSemaphore);
// Subscribe to swapchain size chagne event.
// shared_ptr will be transformed to weak_ptr
void Subscribe(std::shared_ptr<ISwapchainDependency> subscriber);
void Unsubscribe(const ISwapchainDependency *subscriber);
VkFormat GetSurfaceFormat() const;
uint32_t GetWidth() const;
uint32_t GetHeight() const;
uint32_t GetCurrentImageIndex() const;
uint32_t GetImageCount() const;
VkImageView GetImageView(uint32_t index) const;
const VkImageView *GetImageViews() const;
private:
// Safe to call even if swapchain wasn't created
bool Recreate(uint32_t newWidth, uint32_t newHeight, bool vsync);
void Create(uint32_t newWidth, uint32_t newHeight, bool vsync, VkSwapchainKHR oldSwapchain = VK_NULL_HANDLE);
void Destroy();
// Destroy dresources but not the swapchain itself. Old swapchain is returned.
VkSwapchainKHR DestroyWithoutSwapchain();
void CallCreateSubscribers();
void CallDestroySubscribers();
private:
VkDevice device;
VkSurfaceKHR surface;
std::shared_ptr<PhysicalDevice> physDevice;
std::shared_ptr<CommandBufferManager> cmdManager;
VkSurfaceFormatKHR surfaceFormat;
VkSurfaceCapabilitiesKHR surfCapabilities;
VkPresentModeKHR presentModeVsync;
VkPresentModeKHR presentModeImmediate;
// user requests this extent
VkExtent2D requestedExtent;
bool requestedVsync;
// current surface's size
VkExtent2D surfaceExtent;
bool isVsync;
VkSwapchainKHR swapchain;
std::vector<VkImage> swapchainImages;
std::vector<VkImageView> swapchainViews;
uint32_t currentSwapchainIndex;
std::list<std::weak_ptr<ISwapchainDependency>> subscribers;
};
} | 36.945946 | 168 | 0.754206 | [
"vector"
] |
cbd3f54891e255295057e3082f7fe3eb12be0ca7 | 1,963 | h | C | roller_eye/src/inc/alsa/pcm_external.h | lorenzo-bianchi/Scout-open-source | ca20d3112388f47a36a245de5de1a35673afd260 | [
"MIT"
] | 35 | 2022-03-12T01:36:17.000Z | 2022-03-28T14:56:13.000Z | roller_eye/src/inc/alsa/pcm_external.h | lorenzo-bianchi/Scout-open-source | ca20d3112388f47a36a245de5de1a35673afd260 | [
"MIT"
] | null | null | null | roller_eye/src/inc/alsa/pcm_external.h | lorenzo-bianchi/Scout-open-source | ca20d3112388f47a36a245de5de1a35673afd260 | [
"MIT"
] | 9 | 2022-03-12T01:39:43.000Z | 2022-03-31T20:54:19.000Z | /**
* \file include/pcm_external.h
* \brief External PCM plugin SDK
* \author Takashi Iwai <tiwai@suse.de>
* \date 2005
*
* Extern PCM plugin SDK.
*/
/*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __ALSA_PCM_EXTERNAL_H
#define __ALSA_PCM_EXTERNAL_H
#include "pcm.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* \defgroup Plugin_SDK External PCM plugin SDK
* \{
*/
/**
* Define the object entry for external PCM plugins
*/
#define SND_PCM_PLUGIN_ENTRY(name) _snd_pcm_##name##_open
/**
* Define the symbols of the given plugin with versions
*/
#define SND_PCM_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_PCM_PLUGIN_ENTRY(name), SND_PCM_DLSYM_VERSION);
/**
* Define the plugin
*/
#define SND_PCM_PLUGIN_DEFINE_FUNC(plugin) \
int SND_PCM_PLUGIN_ENTRY(plugin) (snd_pcm_t **pcmp, const char *name,\
snd_config_t *root, snd_config_t *conf, \
snd_pcm_stream_t stream, int mode)
#include "pcm_ioplug.h"
#include "pcm_extplug.h"
int snd_pcm_parse_control_id(snd_config_t *conf, snd_ctl_elem_id_t *ctl_id, int *cardp,
int *cchannelsp, int *hwctlp);
/** \} */
#ifdef __cplusplus
}
#endif
#endif /* __ALSA_PCM_EXTERNAL_H */
| 27.647887 | 112 | 0.69893 | [
"object"
] |
cbe1d18a38669cbd7eb5b8c4395e40eacb16e990 | 6,527 | h | C | source/stdafx.h | heatray/WUMPatch | 9e6c3dcbef5d12bdd1478251dc83e51b541a1371 | [
"MIT"
] | 1 | 2022-03-24T10:44:20.000Z | 2022-03-24T10:44:20.000Z | source/stdafx.h | heatray/WUMPatch | 9e6c3dcbef5d12bdd1478251dc83e51b541a1371 | [
"MIT"
] | null | null | null | source/stdafx.h | heatray/WUMPatch | 9e6c3dcbef5d12bdd1478251dc83e51b541a1371 | [
"MIT"
] | null | null | null | #pragma once
#define _WIN32_WINNT 0x0600 // Windows Vista
#include <SDKDDKVer.h>
#define WIN32_LEAN_AND_MEAN
#define _USE_MATH_DEFINES
#pragma warning(push)
#pragma warning(disable: 4178 4305 4309 4510 4996)
#include <windows.h>
#include <stdint.h>
#include <array>
#include <math.h>
#include <subauth.h>
#include <thread>
#include <mutex>
#include <set>
#include <map>
#include <iomanip>
#include "inireader\IniReader.h"
#include "injector\include\injector\injector.hpp"
#include "injector\include\injector\calling.hpp"
#include "injector\include\injector\hooking.hpp"
#ifdef _M_IX86
#include "injector\include\injector\assembly.hpp"
#endif
#include "injector\include\injector\utility.hpp"
// #include "hooking\Hooking.Patterns.h"
// #include "log.h"
// #include "ModuleList.hpp"
#include <filesystem>
#pragma warning(pop)
#ifndef CEXP
#define CEXP extern "C" __declspec(dllexport)
#endif
std::string format(const char* fmt, ...);
template<typename T>
std::array<uint8_t, sizeof(T)> to_bytes(const T& object)
{
std::array<uint8_t, sizeof(T)> bytes;
const uint8_t* begin = reinterpret_cast<const uint8_t*>(std::addressof(object));
const uint8_t* end = begin + sizeof(T);
std::copy(begin, end, std::begin(bytes));
return bytes;
}
template<typename T>
T& from_bytes(const std::array<uint8_t, sizeof(T)>& bytes, T& object)
{
static_assert(std::is_trivially_copyable<T>::value, "not a TriviallyCopyable type");
uint8_t* begin_object = reinterpret_cast<uint8_t*>(std::addressof(object));
std::copy(std::begin(bytes), std::end(bytes), begin_object);
return object;
}
template<class T, class T1>
T from_bytes(const T1& bytes)
{
static_assert(std::is_trivially_copyable<T>::value, "not a TriviallyCopyable type");
T object;
uint8_t* begin_object = reinterpret_cast<uint8_t*>(std::addressof(object));
std::copy(std::begin(bytes), std::end(bytes) - (sizeof(T1) - sizeof(T)), begin_object);
return object;
}
template <size_t n>
std::string pattern_str(const std::array<uint8_t, n> bytes)
{
std::string result;
for (size_t i = 0; i < n; i++)
{
result += format("%02X ", bytes[i]);
}
return result;
}
template <typename T>
std::string pattern_str(T t)
{
return std::string((std::is_same<T, char>::value ? format("%c ", t) : format("%02X ", t)));
}
template <typename T, typename... Rest>
std::string pattern_str(T t, Rest... rest)
{
return std::string((std::is_same<T, char>::value ? format("%c ", t) : format("%02X ", t)) + pattern_str(rest...));
}
template<size_t N>
constexpr size_t length(char const (&)[N])
{
return N - 1;
}
template <typename T, typename V>
bool iequals(const T& s1, const V& s2)
{
T str1(s1); T str2(s2);
std::transform(str1.begin(), str1.end(), str1.begin(), ::tolower);
std::transform(str2.begin(), str2.end(), str2.begin(), ::tolower);
return (str1 == str2);
}
template<class T>
T GetModulePath(HMODULE hModule)
{
static constexpr auto INITIAL_BUFFER_SIZE = MAX_PATH;
static constexpr auto MAX_ITERATIONS = 7;
T ret;
auto bufferSize = INITIAL_BUFFER_SIZE;
for (size_t iterations = 0; iterations < MAX_ITERATIONS; ++iterations)
{
ret.resize(bufferSize);
size_t charsReturned = 0;
if constexpr (std::is_same_v<T, std::string>)
charsReturned = GetModuleFileNameA(hModule, &ret[0], bufferSize);
else
charsReturned = GetModuleFileNameW(hModule, &ret[0], bufferSize);
if (charsReturned < ret.length())
{
ret.resize(charsReturned);
return ret;
}
else
{
bufferSize *= 2;
}
}
return T();
}
template<class T>
T GetThisModulePath()
{
HMODULE hm = NULL;
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)&GetResolutionsList, &hm);
T r = GetModulePath<T>(hm);
if constexpr (std::is_same_v<T, std::string>)
r = r.substr(0, r.find_last_of("/\\") + 1);
else
r = r.substr(0, r.find_last_of(L"/\\") + 1);
return r;
}
template<class T>
T GetThisModuleName()
{
HMODULE hm = NULL;
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, (LPCWSTR)&GetResolutionsList, &hm);
const T moduleFileName = GetModulePath<T>(hm);
if constexpr (std::is_same_v<T, std::string>)
return moduleFileName.substr(moduleFileName.find_last_of("/\\") + 1);
else
return moduleFileName.substr(moduleFileName.find_last_of(L"/\\") + 1);
}
template<class T>
T GetExeModulePath()
{
T r = GetModulePath<T>(NULL);
if constexpr (std::is_same_v<T, std::string>)
r = r.substr(0, r.find_last_of("/\\") + 1);
else
r = r.substr(0, r.find_last_of(L"/\\") + 1);
return r;
}
template<class T>
T GetExeModuleName()
{
const T moduleFileName = GetModulePath<T>(NULL);
if constexpr (std::is_same_v<T, std::string>)
return moduleFileName.substr(moduleFileName.find_last_of("/\\") + 1);
else
return moduleFileName.substr(moduleFileName.find_last_of(L"/\\") + 1);
}
template<class T>
T GetCurrentDirectoryW()
{
static constexpr auto INITIAL_BUFFER_SIZE = MAX_PATH;
static constexpr auto MAX_ITERATIONS = 7;
T ret;
auto bufferSize = INITIAL_BUFFER_SIZE;
for (size_t iterations = 0; iterations < MAX_ITERATIONS; ++iterations)
{
ret.resize(bufferSize);
size_t charsReturned = 0;
if constexpr (std::is_same_v<T, std::string>)
charsReturned = GetCurrentDirectoryA(bufferSize, &ret[0]);
else
charsReturned = GetCurrentDirectoryW(bufferSize, &ret[0]);
if (charsReturned < ret.length())
{
ret.resize(charsReturned);
return ret;
}
else
{
bufferSize *= 2;
}
}
return T();
}
template <typename T>
inline std::wstring int_to_hex(T val, size_t width = sizeof(T) * 2)
{
std::wstringstream ss;
ss << std::uppercase << std::setfill(L'0') << std::setw(width) << std::hex << (val | 0);
return ss.str();
}
template <typename T>
inline std::string int_to_hex_str(T val, size_t width = sizeof(T) * 2)
{
std::stringstream ss;
ss << std::uppercase << std::setfill('0') << std::setw(width) << std::hex << (val | 0);
return ss.str();
}
template <typename T>
bool fileExists(T fileName)
{
std::ifstream infile(fileName);
return infile.good();
}
| 28.255411 | 145 | 0.654206 | [
"object",
"transform"
] |
cbea72140a3f0a6e282b2ea92d2a3093a43c0541 | 37,409 | c | C | ophyra_tftdisp/ophyra_tftdisp.c | amrf7/modules | 15ac3faa716bf59499f05db1329731c7862913f0 | [
"MIT"
] | null | null | null | ophyra_tftdisp/ophyra_tftdisp.c | amrf7/modules | 15ac3faa716bf59499f05db1329731c7862913f0 | [
"MIT"
] | 1 | 2021-03-25T06:28:43.000Z | 2021-03-25T22:13:27.000Z | ophyra_tftdisp/ophyra_tftdisp.c | amrf7/modules | 15ac3faa716bf59499f05db1329731c7862913f0 | [
"MIT"
] | 2 | 2021-12-15T03:21:11.000Z | 2022-02-08T19:16:41.000Z | /*
ophyra_tftdisp.c
User module in C for the use of the TFT ST7735 display and the Ophyra board, manufactured by Intesc Electronica y Embebidos.
Intesc Electronica y Embebidos.
This file includes the definition of a class and 19 functions that the TFT screen needs to work correctly in the MicroPython language.
correctly in the MicroPython language.
To build the firmware including this module, run in Cygwin:
make BOARD=OPHYRA USER_C_MODULES=../.../.../modules CFLAGS_EXTRA=-DMODULE_OPHYRA_TFTDISP_ENABLED=1 all
In USER_C_MODULES you specify the path to the location of the modules folder, where the ophyra_tft file is located.
the ophyra_tftdisp.c and micropython.mk files are located.
Written by: Jonatan Salinas and Carlos D. Hernández.
Last modification date: 05/10/2021.
CHANGELOG
-> Update the function write_data() for work drawImg because send a uint32t len
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "py/runtime.h"
#include "py/obj.h"
#include "py/objstr.h"
#include "py/mphal.h"
#include "ports/stm32/spi.h"
//#include "lib/oofatfs/ff.h"
/*
Command Definitions
*/
#define CMD_NOP (0x00) // No Operacion
#define CMD_SWRESET (0x01) // Software Reset
#define CMD_RDDID (0x04) // Read Display ID
#define CMD_RDDST (0x09) // Read Display Status
#define CMD_SLPIN (0x10) // Sleep in & Booster Off
#define CMD_SLPOUT (0x11) // Sleep out & Booster On
#define CMD_PTLON (0x12) // Partial mode On
#define CMD_NORON (0x13) // Partial Off (Normal)
#define CMD_INVOFF (0x20) // Display inversion Off
#define CMD_INVON (0x21) // Display inversion On
#define CMD_DISPOFF (0x28) // Display Off
#define CMD_DISPON (0x29) // Display On
#define CMD_CASET (0x2A) // Column Address set
#define CMD_RASET (0x2B) // Row Address set
#define CMD_RAMWR (0x2C) // Memory Write
#define CMD_RAMRD (0x2E) // Memory Read
#define CMD_PTLAR (0x30) // Partial Start/End Address set
#define CMD_COLMOD (0x3A) // Interface Pixel Format
#define CMD_MADCTL (0x36) // Memory Data Acces Control
#define CMD_RDID1 (0xDA) // Read ID1
#define CMD_RDID2 (0xDB) // Read ID2
#define CMD_RDID3 (0xDC) // Read ID3
#define CMD_RDID4 (0xDD) // Read ID4
/*
Panel Function Commands
*/
#define CMD_FRMCTR1 (0xB1) // In normal mode (Full colors)
#define CMD_FRMCTR2 (0xB2) // In Idle mode (8-colors)
#define CMD_FRMCTR3 (0xB3) // In partial mode + Full colors
#define CMD_INVCTR (0xB4) // Display inversion control
#define CMD_PWCTR1 (0xC0) // Power Control Settings
#define CMD_PWCTR2 (0xC1) // Power Control Settings
#define CMD_PWCTR3 (0xC2) // Power Control Settings
#define CMD_PWCTR4 (0xC3) // Power Control Settings
#define CMD_PWCTR5 (0xC4) // Power Control Settings
#define CMD_VMCTR1 (0xC5) // VCOM Control
#define CMD_GMCTRP1 (0xE0)
#define CMD_GMCTRN1 (0xE1)
/*
Work pin identifiers
*/
const pin_obj_t *Pin_DC=pin_D6;
const pin_obj_t *Pin_CS=pin_A15;
const pin_obj_t *Pin_RST=pin_D7;
const pin_obj_t *Pin_BL=pin_A7;
/*
TFT color palette definition
*/
#define COLOR_BLACK (0x0000)
#define COLOR_BLUE (0x001F)
#define COLOR_RED (0xF800)
#define COLOR_GREEN (0x07E0)
#define COLOR_CYAN (0x07FF)
#define COLOR_MAGENTA (0xF81F)
#define COLOR_YELLOW (0xFFE0)
#define COLOR_WHITE (0xFFFF)
/*
SPI1 Conf
*/
#define TIMEOUT_SPI (5000)
/*
Font Lib implemented here.
*/
#define WIDTH (6)
#define HEIGHT (8)
#define START (32)
#define END (127)
const uint8_t Font[]=
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x06, 0x5F, 0x06, 0x00,
0x00, 0x07, 0x03, 0x00, 0x07, 0x03,
0x00, 0x24, 0x7E, 0x24, 0x7E, 0x24,
0x00, 0x24, 0x2B, 0x6A, 0x12, 0x00,
0x00, 0x63, 0x13, 0x08, 0x64, 0x63,
0x00, 0x36, 0x49, 0x56, 0x20, 0x50,
0x00, 0x00, 0x07, 0x03, 0x00, 0x00,
0x00, 0x00, 0x3E, 0x41, 0x00, 0x00,
0x00, 0x00, 0x41, 0x3E, 0x00, 0x00,
0x00, 0x08, 0x3E, 0x1C, 0x3E, 0x08,
0x00, 0x08, 0x08, 0x3E, 0x08, 0x08,
0x00, 0x00, 0xE0, 0x60, 0x00, 0x00,
0x00, 0x08, 0x08, 0x08, 0x08, 0x08,
0x00, 0x00, 0x60, 0x60, 0x00, 0x00,
0x00, 0x20, 0x10, 0x08, 0x04, 0x02,
0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E,
0x00, 0x00, 0x42, 0x7F, 0x40, 0x00,
0x00, 0x62, 0x51, 0x49, 0x49, 0x46,
0x00, 0x22, 0x49, 0x49, 0x49, 0x36,
0x00, 0x18, 0x14, 0x12, 0x7F, 0x10,
0x00, 0x2F, 0x49, 0x49, 0x49, 0x31,
0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30,
0x00, 0x01, 0x71, 0x09, 0x05, 0x03,
0x00, 0x36, 0x49, 0x49, 0x49, 0x36,
0x00, 0x06, 0x49, 0x49, 0x29, 0x1E,
0x00, 0x00, 0x6C, 0x6C, 0x00, 0x00,
0x00, 0x00, 0xEC, 0x6C, 0x00, 0x00,
0x00, 0x08, 0x14, 0x22, 0x41, 0x00,
0x00, 0x24, 0x24, 0x24, 0x24, 0x24,
0x00, 0x00, 0x41, 0x22, 0x14, 0x08,
0x00, 0x02, 0x01, 0x59, 0x09, 0x06,
0x00, 0x3E, 0x41, 0x5D, 0x55, 0x1E,
0x00, 0x7E, 0x11, 0x11, 0x11, 0x7E,
0x00, 0x7F, 0x49, 0x49, 0x49, 0x36,
0x00, 0x3E, 0x41, 0x41, 0x41, 0x22,
0x00, 0x7F, 0x41, 0x41, 0x41, 0x3E,
0x00, 0x7F, 0x49, 0x49, 0x49, 0x41,
0x00, 0x7F, 0x09, 0x09, 0x09, 0x01,
0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A,
0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F,
0x00, 0x00, 0x41, 0x7F, 0x41, 0x00,
0x00, 0x30, 0x40, 0x40, 0x40, 0x3F,
0x00, 0x7F, 0x08, 0x14, 0x22, 0x41,
0x00, 0x7F, 0x40, 0x40, 0x40, 0x40,
0x00, 0x7F, 0x02, 0x04, 0x02, 0x7F,
0x00, 0x7F, 0x02, 0x04, 0x08, 0x7F,
0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E,
0x00, 0x7F, 0x09, 0x09, 0x09, 0x06,
0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E,
0x00, 0x7F, 0x09, 0x09, 0x19, 0x66,
0x00, 0x26, 0x49, 0x49, 0x49, 0x32,
0x00, 0x01, 0x01, 0x7F, 0x01, 0x01,
0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F,
0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F,
0x00, 0x3F, 0x40, 0x3C, 0x40, 0x3F,
0x00, 0x63, 0x14, 0x08, 0x14, 0x63,
0x00, 0x07, 0x08, 0x70, 0x08, 0x07,
0x00, 0x71, 0x49, 0x45, 0x43, 0x00,
0x00, 0x00, 0x7F, 0x41, 0x41, 0x00,
0x00, 0x02, 0x04, 0x08, 0x10, 0x20,
0x00, 0x00, 0x41, 0x41, 0x7F, 0x00,
0x00, 0x04, 0x02, 0x01, 0x02, 0x04,
0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
0x00, 0x00, 0x03, 0x07, 0x00, 0x00,
0x00, 0x20, 0x54, 0x54, 0x54, 0x78,
0x00, 0x7F, 0x44, 0x44, 0x44, 0x38,
0x00, 0x38, 0x44, 0x44, 0x44, 0x28,
0x00, 0x38, 0x44, 0x44, 0x44, 0x7F,
0x00, 0x38, 0x54, 0x54, 0x54, 0x08,
0x00, 0x08, 0x7E, 0x09, 0x09, 0x00,
0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C,
0x00, 0x7F, 0x04, 0x04, 0x78, 0x00,
0x00, 0x00, 0x00, 0x7D, 0x40, 0x00,
0x00, 0x40, 0x80, 0x84, 0x7D, 0x00,
0x00, 0x7F, 0x10, 0x28, 0x44, 0x00,
0x00, 0x00, 0x00, 0x7F, 0x40, 0x00,
0x00, 0x7C, 0x04, 0x18, 0x04, 0x78,
0x00, 0x7C, 0x04, 0x04, 0x78, 0x00,
0x00, 0x38, 0x44, 0x44, 0x44, 0x38,
0x00, 0xFC, 0x44, 0x44, 0x44, 0x38,
0x00, 0x38, 0x44, 0x44, 0x44, 0xFC,
0x00, 0x44, 0x78, 0x44, 0x04, 0x08,
0x00, 0x08, 0x54, 0x54, 0x54, 0x20,
0x00, 0x04, 0x3E, 0x44, 0x24, 0x00,
0x00, 0x3C, 0x40, 0x20, 0x7C, 0x00,
0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C,
0x00, 0x3C, 0x60, 0x30, 0x60, 0x3C,
0x00, 0x6C, 0x10, 0x10, 0x6C, 0x00,
0x00, 0x9C, 0xA0, 0x60, 0x3C, 0x00,
0x00, 0x64, 0x54, 0x54, 0x4C, 0x00,
0x00, 0x08, 0x3E, 0x41, 0x41, 0x00,
0x00, 0x00, 0x00, 0x77, 0x00, 0x00,
0x00, 0x00, 0x41, 0x41, 0x3E, 0x08,
0x00, 0x02, 0x01, 0x02, 0x01, 0x00,
0x00, 0x3C, 0x26, 0x23, 0x26, 0x3C
};
/*
Created a struct for data image for BMP based on ST7735_Driver.h
*Don't necessary change the type of var a alternative name is better using name?
*/
// if use typedef uint8_t U8; may have a problem with the code optimization.
// typedef struct imgBMPdescription
// {
// uint8_t u8XSize; // Size in pixels to X axe
// uint8_t u8YSize; // Size in pixels to Y axe
// uint8_t u8XCursor;// Coordinate in X axe
// uint8_t u8YCursor;// Coordinate in Y axe
// uint8_t* pu8Img; // Pointer to Img Data
// }BMPData;
// BMPData pstImgdesc;
/*
Definition of the data structure arranged for TFT display
*/
typedef struct _tftdisp_class_obj_t{
mp_obj_base_t base;
const spi_t *spi;
bool power_on;
bool inverted;
bool backlight_on;
uint8_t margin_row;
uint8_t margin_col;
uint8_t width;
uint8_t height;
} tftdisp_class_obj_t;
const mp_obj_type_t tftdisp_class_type;
// Print Function
STATIC void tftdisp_class_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind){
(void)kind;
mp_print_str(print, "tftdisp_class()");
}
/*
make_new: Class constructor. This function is invoked when the Micropython user types:
ST7735()
*/
STATIC mp_obj_t tftdisp_class_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
tftdisp_class_obj_t *self = m_new_obj(tftdisp_class_obj_t);
self->base.type = &tftdisp_class_type;
//Definition of the use of the working pins for the TFT
mp_hal_pin_config(Pin_DC, MP_HAL_PIN_MODE_OUTPUT, MP_HAL_PIN_PULL_DOWN,0);
mp_hal_pin_config(Pin_CS, MP_HAL_PIN_MODE_OUTPUT, MP_HAL_PIN_PULL_DOWN,0);
mp_hal_pin_config(Pin_RST, MP_HAL_PIN_MODE_OUTPUT, MP_HAL_PIN_PULL_DOWN,0);
mp_hal_pin_config(Pin_BL, MP_HAL_PIN_MODE_OUTPUT, MP_HAL_PIN_PULL_DOWN,0);
// Definition of logical states
self->power_on=true;
self->inverted=false;
self->backlight_on=true;
//Initialization of the TFT display columns and rows
self->margin_row=0;
self->margin_col=0;
self->spi=&spi_obj[0];
// SPI communication settings
//spi_set_params(&spi_obj[0], PRESCALE, BAUDRATE, POLARITY, PHASE, BITS, FIRSTBIT);
SPI_InitTypeDef *init = &self->spi->spi->Init;
init->Mode = SPI_MODE_MASTER;
init->BaudRatePrescaler = SPI_BAUDRATEPRESCALER_4;
init->CLKPolarity = SPI_POLARITY_HIGH;
init->CLKPhase = SPI_PHASE_2EDGE;
init->Direction = SPI_DIRECTION_2LINES;
init->DataSize = SPI_DATASIZE_8BIT;
init->NSS = SPI_NSS_SOFT;
init->FirstBit = SPI_FIRSTBIT_MSB;
init->TIMode = SPI_TIMODE_DISABLED;
init->CRCCalculation = SPI_CRCCALCULATION_DISABLED;
init->CRCPolynomial = 0;
spi_init(self->spi,false);
return MP_OBJ_FROM_PTR(self);
}
// Here Intern Functions
/*
write_cmd() Internal function | It is used to communicate with the TFT screen through preset commands, which are used to configure the TFT prior to its operation.
which are used to configure the TFT prior to its operation.
Example of data transmission in Python:
self.write_cmd(CMD_RASET)
*/
STATIC void write_cmd(int cmd)
{
mp_hal_pin_low(Pin_DC);
mp_hal_pin_low(Pin_CS);
//We define a space of size 1 byte
uint8_t aux[1]={(uint8_t)cmd};
spi_transfer(&spi_obj[0],1, aux, NULL, TIMEOUT_SPI);
mp_hal_pin_high(Pin_CS);
}
/*
write_data() Internal function | Allows us to send defined memory arrays of type bytearray only internally for the control of data that make up certain functions such as show_image().
data that make up certain functions such as show_image().
Example of data transmission in Python:
self.write_data(bytearray([0x00, y0 + self.margin_row, 0x00, y1 + self.margin_row]))
*/
STATIC void write_data( uint8_t *data, size_t len)
{
mp_hal_pin_high(Pin_DC);
mp_hal_pin_low(Pin_CS);
//We measure the size of the array with sizeof() to know the size in bytes.
spi_transfer(&spi_obj[0],len, data, NULL, TIMEOUT_SPI);
mp_hal_pin_high(Pin_CS);
}
/*
set_window() intern function | Defines settings for the rows and columns in the screen display so that when a pixel or character is placed it is preset.
when a pixel or character? is placed it is preset.
Disclaimer.
You need to make a conversion to the objects you work with in the other functions you define within uPython.
inside uPython.
*/
STATIC void set_window(mp_obj_t self_in, uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
{
//Set window frame boundaries.
//Any pixels written to the display will start from this area.
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
// set row XSTART/XEND
write_cmd(CMD_RASET);
uint8_t bytes_send[]={0x00, y0 + self->margin_row, 0x00, y1 + self->margin_row};
write_data(bytes_send, sizeof(bytes_send));
// set column XSTART/XEND
write_cmd(CMD_CASET);
uint8_t bytes_send1[]={0x00, x0 + self->margin_col, 0x00, x1 + self->margin_col};
write_data(bytes_send1, sizeof(bytes_send1));
// write addresses to RAM
write_cmd(CMD_RAMWR);
}
/*
reset() Hard reset the display.
*/
STATIC void reset(void)
{
mp_hal_pin_low(Pin_DC);
mp_hal_pin_high(Pin_RST);
mp_hal_delay_ms(500);
mp_hal_pin_low(Pin_RST);
mp_hal_delay_ms(500);
mp_hal_pin_high(Pin_RST);
mp_hal_delay_ms(500);
}
/*
write_pixels() intern function | Used to draw a pixel on the display
so that all the functions need this function to draw the desired pixels on the screen
the desired pixels on the screen by returning the size of pixels to be drawn and the color.
and the color.
*/
STATIC void write_pixels(uint16_t count, uint16_t color)
{
//Write pixels to the display.
//count - total number of pixels
//color - 16-bit RGB value
uint8_t data_transfer[2]={(uint8_t)(color>>8), (uint8_t)(color&0xFF)};
mp_hal_pin_high(Pin_DC);
mp_hal_pin_low(Pin_CS);
for(uint16_t i=0; i<count;i++)
{
//We send the color of the size of 2 bytes if the color is 16 bits.
//Always 2 bytes are sent to this function
spi_transfer(&spi_obj[0],2,data_transfer, NULL, TIMEOUT_SPI);
}
mp_hal_pin_high(Pin_CS);
}
/*
hline() | Intern Function. This function is used internally to create horizontal lines on the TFT display.
horizontal lines on the TFT display.
It accepts primitive parameters as it is for internal use.
*/
STATIC mp_obj_t hline(mp_obj_t self_in, uint8_t x, uint8_t y, uint8_t w, uint16_t color)
{
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
if(x>=self->width || y>=self->height)
{
return mp_const_none;
}
set_window(self, x, y, x+w-1, y);
write_pixels(x+w-1, color);
return mp_const_none;
}
/*
vline() | Intern function. This function is for internal use for the
creation of vertical lines in the TFT display, in this way primitive parameters are
primitive parameters are sent as it is for internal use.
*/
STATIC mp_obj_t vline(mp_obj_t self_in, uint8_t x, uint8_t y, uint8_t h, uint16_t color)
{
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
if(x>=self->width || y>=self->height)
{
return mp_const_none;
}
if((y+h-1)>=self->height)
{
h=self->height-y;
}
set_window(self, x, y, x, y+h-1);
write_pixels(y+h-1, color);
return mp_const_none;
}
/*
pixel0(x, y, color) | Intern Function is used to draw a single individual pixel on the TFT screen
so that public use python functions can send primitive data,
to speed up the plotting process on the TFT display.
*/
STATIC void pixel0(mp_obj_t self_in, uint8_t x, uint8_t y, uint16_t color )
{
//Draw a single pixel0 on the display with given color.
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
set_window(self, x, y, x+1, y+1);
write_pixels(1,color);
}
/*
rect_int | Intern Function is the same with function rect() only receive primitive
params.
*/
STATIC mp_obj_t rect_int(mp_obj_t self_in, uint8_t x, uint8_t y, uint8_t w, uint8_t h, uint16_t color)
{
//Draw a rectangle with specified coordinates/size and fill with color.
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
if(x>=self->width || y>=self->height)
{
return mp_const_none;
}
if((x+w-1) >= self->width)
{
w=self->width-x;
}
if((y+h-1)>=self->height)
{
h=self->height-y;
}
set_window(self, x, y, x+w-1, y+h-1);
write_pixels((w*h), color);
return mp_const_none;
}
/*
drawImg() | Intern Function for put a Img in screen.
*/
// STATIC void drawImg(mp_obj_t self_in, BMPData* pstImgDesc)
// {
// tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
// set_window(self, pstImgDesc->u8XCursor, pstImgDesc->u8YCursor, pstImgDesc->u8XSize, pstImgDesc->u8YSize);
// write_data(pstImgDesc->pu8Img, pstImgDesc->u8XSize * pstImgDesc->u8YSize * 3);
// }
/*
ST7735() is the function that initializes the TFT screen is the equivalent of:
ST7735().init()
In this case there will be a change in which the function will be invoked as follows:
ST7735().init(True) or ST7735().init(1)
*/
STATIC mp_obj_t st7735_init(size_t n_args, const mp_obj_t *args)
{
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint8_t orient=0;
if(args[1])
{
orient=mp_obj_get_int(args[1]);
}
//mp_obj_is_bool(orient);
//First hard reset
reset(); //function here
write_cmd(CMD_SWRESET);
mp_hal_delay_ms(150);
write_cmd(CMD_SLPOUT);
mp_hal_delay_ms(255);
//Data transmission and delays optimization
write_cmd(CMD_FRMCTR1);
uint8_t data_set3[]={0x01, 0x2C, 0x2D};
write_data(data_set3, sizeof(data_set3));
write_cmd(CMD_FRMCTR2);
uint8_t data_set6[]={0x01, 0x2C, 0x2D, 0x01, 0x2C, 0x2D};
write_data(data_set6, sizeof(data_set6));
mp_hal_delay_ms(10);
write_cmd(CMD_INVCTR);
uint8_t data_set1[]={0x07};
write_data(data_set1, sizeof(data_set1));
write_cmd(CMD_PWCTR1);
uint8_t dataset[]={0xA2, 0x02, 0x84};
write_data(dataset, sizeof(dataset));
write_cmd(CMD_PWCTR2);
uint8_t dataset1[]={0xC5};
write_data(dataset1, sizeof(dataset1));
write_cmd(CMD_PWCTR3);
uint8_t dataset2[]={0x8A, 0x00};
write_data(dataset2, sizeof(dataset2));
write_cmd(CMD_PWCTR4);
uint8_t dataset3[]={0x8A, 0x2A};
write_data(dataset3, sizeof(dataset3));
write_cmd(CMD_PWCTR5);
uint8_t dataset4[]={0x8A, 0xEE};
write_data(dataset4, sizeof(dataset4));
write_cmd(CMD_VMCTR1);
uint8_t data_vmc[]={0x0E};
write_data(data_vmc, sizeof(data_vmc));
write_cmd(CMD_INVOFF);
write_cmd(CMD_MADCTL);
if(orient==0)
{
uint8_t data_orient[]={0xA0};
write_data(data_orient, sizeof(data_orient));
self->width=160;
self->height=128;
}
else
{
uint8_t datas[]={0x00};
write_data(datas, sizeof(datas));
self->width=128;
self->height=160;
}
write_cmd(CMD_COLMOD);
uint8_t dataset0[]={0x05};
write_data(dataset0, sizeof(dataset0));
write_cmd(CMD_CASET);
uint8_t dataset5[]={0x00, 0x01, 0x00, 127};
write_data(dataset5, sizeof(dataset5));
write_cmd(CMD_RASET);
uint8_t dataset6[]={0x00, 0x01, 0x00, 159};
write_data(dataset6, sizeof(dataset6));
write_cmd(CMD_GMCTRP1);
uint8_t dataset7[]={0x02, 0x1c, 0x07, 0x12, 0x37, 0x32, 0x29, 0x2d, 0x29, 0x25, 0x2b, 0x39, 0x00, 0x01, 0x03, 0x10};
write_data(dataset7, sizeof(dataset7));
write_cmd(CMD_GMCTRN1);
uint8_t dataset8[]={0x03, 0x1d, 0x07, 0x06, 0x2e, 0x2c, 0x29, 0x2d, 0x2e, 0x2e, 0x37, 0x3f, 0x00, 0x00, 0x02, 0x10};
write_data(dataset8, sizeof(dataset8));
write_cmd(CMD_NORON);
mp_hal_delay_ms(10);
write_cmd(CMD_DISPON);
mp_hal_delay_ms(100);
return mp_const_none;
}
/*
power() this function is used to turn on the screen or to obtain the screen status.
*/
STATIC mp_obj_t power(mp_obj_t self_in, mp_obj_t state)
{
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
if(state==mp_const_none)
{
return mp_obj_new_bool(self->power_on?1:0);
}
if(state==mp_const_true)
{
write_cmd(CMD_DISPON);
self->power_on=true;
}
if (state==mp_const_false)
{
write_cmd(CMD_DISPOFF);
self->power_on=false;
}
return mp_const_none;
}
/*
inverted() is used to obtain a color inversion on the TFT by means of commands
*/
STATIC mp_obj_t inverted(mp_obj_t self_in, mp_obj_t state)
{
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
if(state==0)
{
return mp_obj_new_bool(self->inverted?1:0);
}
if(state==mp_const_true || state==mp_obj_new_int(1))
{
write_cmd(CMD_INVON);
self->inverted=true;
}
else
{
write_cmd(CMD_INVOFF);
self->inverted=false;
}
return mp_const_none;
}
/*
backlight() This function allows you to turn on the light of the TFT screen.
*/
STATIC mp_obj_t backlight(mp_obj_t self_in, mp_obj_t state)
{
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
if(state==mp_const_none)
{
return mp_obj_new_bool(self->backlight_on?1:0);
}
if(state==mp_obj_new_int(1) || state==mp_const_true)
{
mp_hal_pin_high(Pin_BL);
self->backlight_on=true;
}
else
{
mp_hal_pin_low(Pin_BL);
self->backlight_on=false;
}
return mp_const_none;
}
/*
pixel(x, y, color) is used to draw a single individual pixel on the TFT screen.
Example in uPython:
tft.pixel(10,20,tft.rgbcolor(255,25,0))
*/
STATIC mp_obj_t pixel(size_t n_args, const mp_obj_t *args)
{
//Draw a single pixel on the display with given color.
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint8_t x_int8=(uint8_t)mp_obj_get_int(args[1]);
uint8_t y_int8=(uint8_t)mp_obj_get_int(args[2]);
uint16_t color_int16=mp_obj_get_int(args[3]);
pixel0(self, x_int8, y_int8, color_int16);
return mp_const_none;
}
/*
rgbcolor() function to set colors on the tft screen given the parameters Red, Green, Blue.
parameters Red, Green, Blue.
*/
STATIC mp_obj_t rgbcolor(size_t n_args, const mp_obj_t *args)
{
//Pack 24-bit RGB into 16-bit value.
uint8_t red, green, blue;
red=mp_obj_get_int(args[1]);
green=mp_obj_get_int(args[2]);
blue=mp_obj_get_int(args[3]);
return mp_obj_new_int(((red & 0xF8) << 8) | ((green & 0xFC) << 3 ) | (blue >> 3));
}
/*
rect() This function is used for the creation of a
quadrilatero in which through the coordinates x, y
coordinates, the height h, the width w and the color is implemented in this function.
this function.
Example of use in uPython:
tft.rect(10,20,50,60,tft.rgbcolor(23,0,254))
*/
STATIC mp_obj_t rect(size_t n_args, const mp_obj_t *args)
{
//Draw a rectangle with specified coordinates/size and fill with color.
tftdisp_class_obj_t *self = args[0];
uint8_t x=mp_obj_get_int(args[1]);
uint8_t y=mp_obj_get_int(args[2]);
uint8_t w=mp_obj_get_int(args[3]);
uint8_t h=mp_obj_get_int(args[4]);
uint16_t color=mp_obj_get_int(args[5]);
rect_int(self, x, y, w, h, color);
return mp_const_none;
}
/*
line() This function creates the line drawing on the display through Bresenham's algorithm
*/
STATIC mp_obj_t line(size_t n_args, const mp_obj_t *args)
{
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(args[0]);
//transformar los objetos
uint8_t x0=mp_obj_get_int(args[1]);
uint8_t y0=mp_obj_get_int(args[2]);
uint8_t x1=mp_obj_get_int(args[3]);
uint8_t y1=mp_obj_get_int(args[4]);
uint16_t color=mp_obj_get_int(args[5]);
uint8_t start, end;
//comienzo de la funcion
if(x0==x1)
{
if (y1<y0)
{
start=x1;
end=y1;
}
else
{
start=x0;
end=y0;
}
vline(self, start, end, abs(y1-y0)+1, color);
}
else if(y0==y1)
{
if (x1<x0)
{
start=x1;
end=y1;
}
else
{
start=x0;
end=y0;
}
hline(self, start, end, abs(x1-x0)+1, color);
}
else
{
//Start Bresenham's algorithm
int dx = abs(x1-x0), inx = x0<x1 ? 1 : -1;
int dy = abs(y1-y0), iny = y0<y1 ? 1 : -1;
int err = (dx>dy ? dx : -dy)/2, e2;
while(1){
pixel0(self, x0, y0, color);
if (x0==x1 && y0==y1) break;
e2 = err;
if(e2 >-dx)
{
err -= dy;
x0 += inx;
}
if(e2 < dy)
{
err += dx;
y0 += iny; }
}
}
return mp_const_none;
}
/*
char() | Intern Function. This function puts a single character on the screen.
tft, this function is a dependency of the text() function.
CHANGELOG
Add a flag and add an extra color for the text background if required.
bool flag and uint16_t color_bcknd
*/
STATIC mp_obj_t charfunc(mp_obj_t self_in, uint8_t x, uint8_t y, char ch, uint16_t color, uint8_t sizex, uint8_t sizey, bool flag, uint16_t color_bcknd)
{
//Draw a character at a given position using the user font.
//Font is a data dictionary, can be scaled with sizex and sizey.
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
//Font is define not necesary put parameter in this function
uint16_t ci=(uint16_t)ch;
if(!sizex && !sizey)
{
//this is by defect in the function uPython
sizex=1;
sizey=1;
}
if(START<=ci && ci<=END)
{
ci=(ci-START)*WIDTH;
// this the equivalent to ch = font['data'][ci:ci + width]
uint8_t ch[6];
for(uint8_t i=0;i<WIDTH;i++)
{
ch[i]=Font[ci];
ci++;
}
//end to equivalent
//no font scaling
uint8_t px=x;
if(sizex<=1 && sizey<=1)
{
for(uint8_t k=0; k<WIDTH;k++)
{
uint8_t py=y;
char temp = ch[k];
for(uint8_t i=0; i<HEIGHT;i++)
{
if(temp&0x01)
{
pixel0(self, px, py, color);
}
else if(flag)
{
pixel0(self, px, py, color_bcknd);
}
py+=1;
temp>>=1;
}
px+=1;
}
}
else //scale to given sizes
{
for(uint8_t c=0;c<WIDTH;c++)
{
uint8_t py=y;
for(uint8_t i=0; i<HEIGHT;i++)
{
if(ch[c]&0x01)
{
rect_int(self, px, py, sizex, sizey, color);
}
py+=sizey;
c>>=1;
}
px+=sizex;
}
}
}
// character not found in this font
return mp_const_none;
}
/*
text() | This function displays text on the TFT display with the following parameters:
-> x Position on the X-axis.
-> y Position on the Y-axis.
-> string Receiver variable of the text to print.
-> color Number that defines the color of the text.
Optional (Update)
-> flag token that receives a boolean value to activate the background.
-> color_bcknd desired background color.
*/
STATIC mp_obj_t text(size_t n_args, const mp_obj_t *args)
{
//Draw text at a given position using the user font.
//Font can be scaled with the size parameter.
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(args[0]);
uint8_t x = mp_obj_get_int(args[1]);
uint8_t y = mp_obj_get_int(args[2]);
mp_check_self(mp_obj_is_str_or_bytes(args[3]));
GET_STR_DATA_LEN(args[3], str, str_len);
char string[str_len];
strcpy(string, (char *)str);
uint16_t color = mp_obj_get_int(args[4]);
bool flag=false;
uint16_t color_bcknd=65535;
if(n_args>5)
{
flag=mp_obj_get_int(args[5])? true : false;
color_bcknd=mp_obj_get_int(args[6]);
}
uint8_t width=WIDTH+1;
uint8_t px=x;
for(uint8_t i=0;i<str_len;i++)
{
charfunc(self, px, y, string[i], color, 1, 1, flag, color_bcknd);
px+=width;
// wrap the text to the next line if it reaches the end
if(px+width>self->width)
{
y+=HEIGHT+1;
px=x;
}
}
return mp_const_none;
}
/*
clear() | This function clears the screen through the use of the rect_int() function in which it fills the screen with a color set by the user.
fills the screen with a color set by the user giving the effect of an empty screen.
*/
STATIC mp_obj_t clear(mp_obj_t self_in, mp_obj_t color)
{
tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(self_in);
uint16_t color16b=mp_obj_get_int(color);
rect_int(self, 0, 0, self->width, self->height, color16b);
return mp_const_none;
}
/*
show_image() | Function in progress
*/
// STATIC mp_obj_t show_image(size_t n_args, const mp_obj_t *args)
// {
// tftdisp_class_obj_t *self = MP_OBJ_TO_PTR(args[0]);
// uint8_t x=mp_obj_get_int(args[1]);
// uint8_t y=mp_obj_get_int(args[2]);
// mp_check_self(mp_obj_is_str_or_bytes(args[3]));
// GET_STR_DATA_LEN(args[3], str, str_len);
// char file[str_len];
// strcpy(file, (char *)str);
// printf("Hago uso de valores para leer el epacio de la micro SD \n");
// FATFS fatfs; ///Archivo del sistema para el driver (SD)
// FIL fil; //Estructura del objeto de archivo
// FRESULT fresult;///Retorno de ejecucion de funciones (Enum definidos)
// UINT testBytes; //Variable entera de 32 bits sin signo
// uint8_t BMInfo_Buffer[54];
// uint16_t PointerImage=0;
// uint16_t HeightImg, WideImg;
// //init the use of FS
// //This function registers/unregisters a filesystem object
// fresult=f_mount(&fatfs);
// printf("Monto la SD\n");
// if(fresult == FR_OK){
// //This function opens a file and sets the write/read pointer to zero
// printf("Todo OK, Voy a abrir el archivo %s \n",file);
// fresult = f_open(&fatfs ,&fil , file, FA_READ | FA_WRITE);
// if(fresult == FR_OK){ //checking if a file is open correctly
// fresult = f_lseek(&fil, 0); //Pointing to begin of file BMP.
// printf("Voy a posicionarme la posicion 0 del archivo\n");
// // Getting all the parameters of the file BMP.
// // Reads a firts 54 bytes of file and saves in BMInfo_Buffer.
// fresult = f_read(&fil, BMInfo_Buffer, sizeof(BMInfo_Buffer), &testBytes);
// printf("Voy a leer el archivo\n");
// //In this conditional it's verified the "BM" nature of the file
// if (BMInfo_Buffer[0] == 'B' && BMInfo_Buffer[1] == 'M'){
// //extracting size of image.
// HeightImg = (BMInfo_Buffer[19] << 8 | BMInfo_Buffer[18]);
// WideImg = (BMInfo_Buffer[23] << 8 | BMInfo_Buffer[22]);
// if(HeightImg<=160 && WideImg<=128){//checking size of image.
// if(BMInfo_Buffer[28]==8){ //checking the format codifying of the pixels
// /*Here two variables are created:
// *Line_Buffer: store the 160 numbers, those bytes point to ColorMAP_Buffer.
// *Image_Line_RGB: will store the 480 numbers, those are bytes information RGB to print in screen.*/
// uint8_t Line_Buffer[BMInfo_Buffer[18]];
// uint8_t Image_Line_RGB[BMInfo_Buffer[18]*3];
// uint8_t ColorMap_Buffer[1024];
// // Get the color map
// fresult = f_lseek(&fil, 54);
// fresult = f_read(&fil, ColorMap_Buffer, sizeof(ColorMap_Buffer), &testBytes);
// // This for cycle will run many times as the height of the image
// for (uint8_t j = 0; j<BMInfo_Buffer[22]; j++)
// {
// //This pointer it's use to get the information inside the Line buffer
// PointerImage = 0;
// //Get the line N
// fresult = f_lseek(&fil, 1078+(BMInfo_Buffer[18]*j));
// fresult = f_read(&fil, Line_Buffer, sizeof(Line_Buffer), &testBytes);
// //In this for cycle it's created the line tha will be printed in Ophyra's TFT---
// for(uint16_t i = 0; i < sizeof(Image_Line_RGB); i=i+3)
// {
// Image_Line_RGB[i+2] = ColorMap_Buffer[(Line_Buffer[PointerImage])*4];
// Image_Line_RGB[i+1] = ColorMap_Buffer[(Line_Buffer[PointerImage]*4)+1];
// Image_Line_RGB[i] = ColorMap_Buffer[(Line_Buffer[PointerImage]*4)+2];
// PointerImage++;
// }
// //-------------------------Prints the line N on Ophyra's TF-------------------
// pstImgdesc.pu8Img = Image_Line_RGB;
// pstImgdesc.u8XSize = BMInfo_Buffer[18];
// pstImgdesc.u8YSize = 1;
// pstImgdesc.u8XCursor = x;
// pstImgdesc.u8YCursor = y + (BMInfo_Buffer[22] - j - 1);
// drawImg(self ,&pstImgdesc);
// //----------------------------------------------------------------------------
// }
// }else if(BMInfo_Buffer[28]==24){
// /*Here two variables are created:
// *Line_Buffer: store the 160 numbers, those bytes point to ColorMAP_Buffer.*/
// uint8_t Image_Line_RGB[BMInfo_Buffer[18]*3];
// // This for cycle will run many times as the height of the image
// for (uint8_t j = 0; j<BMInfo_Buffer[22]; j++)
// {//Get the line N
// fresult = f_lseek(&fil, 54+(3*BMInfo_Buffer[18]*j));
// fresult = f_read(&fil, Image_Line_RGB, sizeof(Image_Line_RGB), &testBytes);
// //-------------------------Prints the line N on Ophyra's TF-------------------
// for(uint16_t i=0; i < sizeof(Image_Line_RGB); i=i+3)
// {
// uint8_t tempo = Image_Line_RGB[i];
// Image_Line_RGB[i] = Image_Line_RGB[i+2];
// Image_Line_RGB[i+2] = tempo;
// }
// pstImgdesc.pu8Img = Image_Line_RGB;
// pstImgdesc.u8XSize = BMInfo_Buffer[18];
// pstImgdesc.u8YSize = 1;
// pstImgdesc.u8XCursor = x;
// pstImgdesc.u8YCursor = y + (BMInfo_Buffer[22] - j - 1);
// drawImg(self, &pstImgdesc);
// //----------------------------------------------------------------------------
// }
// }else{
// printf("Error only 8 or 24 bit supported");
// }
// }else{
// printf("Error image too large");
// }
// }else{
// printf("Error Image is not a BMP");
// }
// }else{
// printf("Error Image not found!");
// }
// }
// else{
// printf("Error SD no mount");
// }
// if(fresult == FR_OK){
// fresult = f_close(&fil);//This function close an open file
// printf("Cerre el archivo\n");
// }
// return mp_const_none;
// }
//The above functions are associated with their corresponding Micropython function object.
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(st7735_init_obj, 1, 2, st7735_init);
MP_DEFINE_CONST_FUN_OBJ_2(inverted_obj, inverted);
MP_DEFINE_CONST_FUN_OBJ_2(power_obj, power);
MP_DEFINE_CONST_FUN_OBJ_2(backlight_obj, backlight);
MP_DEFINE_CONST_FUN_OBJ_VAR(rgbcolor_obj, 4, rgbcolor);
MP_DEFINE_CONST_FUN_OBJ_VAR(pixel_obj, 4, pixel);
MP_DEFINE_CONST_FUN_OBJ_VAR(rect_obj, 6, rect);
MP_DEFINE_CONST_FUN_OBJ_VAR(line_obj, 6, line);
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(text_obj, 5, 7, text);
MP_DEFINE_CONST_FUN_OBJ_2(clear_obj, clear);
// MP_DEFINE_CONST_FUN_OBJ_VAR(show_image_obj, 4, show_image);
/*
The Micropython function object is associated with a certain string, which will be used in Micropython programming.
Micropython programming. Ex: If you write:
ST7735().backlight(1)
Internally it calls the function object backlight_state_obj, which is associated with the function
backlight_state, which changes the state of the backlight of the TFT screen.
*/
STATIC const mp_rom_map_elem_t tftdisp_class_locals_dict_table[] = {
{ MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&st7735_init_obj) },
{ MP_ROM_QSTR(MP_QSTR_inverted), MP_ROM_PTR(&inverted_obj) },
{ MP_ROM_QSTR(MP_QSTR_power), MP_ROM_PTR(&power_obj) },
{ MP_ROM_QSTR(MP_QSTR_backlight), MP_ROM_PTR(&backlight_obj) },
{ MP_ROM_QSTR(MP_QSTR_rgbcolor), MP_ROM_PTR(&rgbcolor_obj) },
{ MP_ROM_QSTR(MP_QSTR_pixel), MP_ROM_PTR(&pixel_obj) },
{ MP_ROM_QSTR(MP_QSTR_rect), MP_ROM_PTR(&rect_obj) },
{ MP_ROM_QSTR(MP_QSTR_line), MP_ROM_PTR(&line_obj) },
{ MP_ROM_QSTR(MP_QSTR_text), MP_ROM_PTR(&text_obj) },
{ MP_ROM_QSTR(MP_QSTR_clear), MP_ROM_PTR(&clear_obj) },
// { MP_ROM_QSTR(MP_QSTR_show_image), MP_ROM_PTR(&show_image_obj) },
//Name of the func. to be invoked in Python Pointer to the object of the func. to be invoked.
};
STATIC MP_DEFINE_CONST_DICT(tftdisp_class_locals_dict, tftdisp_class_locals_dict_table);
const mp_obj_type_t tftdisp_class_type = {
{ &mp_type_type },
.name = MP_QSTR_ophyra_tftdisp,
.print = tftdisp_class_print,
.make_new = tftdisp_class_make_new,
.locals_dict = (mp_obj_dict_t*)&tftdisp_class_locals_dict,
};
STATIC const mp_rom_map_elem_t ophyra_tftdisp_globals_table[] = {
//File name (User C module)
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_ophyra_tftdisp) },
//Class name //Name of the associated "type".
{ MP_ROM_QSTR(MP_QSTR_ST7735), MP_ROM_PTR(&tftdisp_class_type) },
};
STATIC MP_DEFINE_CONST_DICT(mp_module_ophyra_tftdisp_globals, ophyra_tftdisp_globals_table);
// Define object module.
const mp_obj_module_t ophyra_tftdisp_user_cmodule = {
.base = { &mp_type_module },
.globals = (mp_obj_dict_t *)&mp_module_ophyra_tftdisp_globals,
};
// Register the module to make it available for Python.
// Filename, filename_user_cmodule, MODULE_IDENTIFIER_ENABLED
MP_REGISTER_MODULE(MP_QSTR_ophyra_tftdisp, ophyra_tftdisp_user_cmodule, MODULE_OPHYRA_TFTDISP_ENABLED);
| 32.529565 | 187 | 0.644177 | [
"object"
] |
cbfa60fe162fd4e480642dc930474899b83a1fe4 | 489 | c | C | tests/scheme/test_vec.c | FunnyLanguage/funny | 28ddbf2c4e4ef194a820cba2d77f0b09ef335a2a | [
"BSD-3-Clause"
] | null | null | null | tests/scheme/test_vec.c | FunnyLanguage/funny | 28ddbf2c4e4ef194a820cba2d77f0b09ef335a2a | [
"BSD-3-Clause"
] | null | null | null | tests/scheme/test_vec.c | FunnyLanguage/funny | 28ddbf2c4e4ef194a820cba2d77f0b09ef335a2a | [
"BSD-3-Clause"
] | null | null | null | /*
* Funny Language - a free style programming language.
* Copyright (C) 2015 by fanguangping (fanguangping@163.com)
* test_vec.c
*/
#include <assert.h>
#include <string.h>
#include "test_vec.h"
void test_vec(Scheme *sc) {
test_op(sc, "(vector 1 2 3)", "#(1 2 3)");
test_op(sc, "(make-vector 3 2)", "#(2 2 2)");
test_op(sc, "(vector-length (vector 1 2 3))", "3");
test_op(sc, "(vector-ref (vector 1 2 3) 2)", "3");
test_op(sc, "(vector-set! (vector 1 2 3) 2 4)", "#(1 2 4)");
}
| 27.166667 | 61 | 0.609407 | [
"vector"
] |
02019ec2d36f6c29956da4fa3036de6f096cd061 | 653 | h | C | src/pages/BusPage.h | bjorn-grape/my_tiny_led_panel_display | 8b0fceab9c83dba5dde9c95dbb74abded9da76ff | [
"MIT"
] | null | null | null | src/pages/BusPage.h | bjorn-grape/my_tiny_led_panel_display | 8b0fceab9c83dba5dde9c95dbb74abded9da76ff | [
"MIT"
] | null | null | null | src/pages/BusPage.h | bjorn-grape/my_tiny_led_panel_display | 8b0fceab9c83dba5dde9c95dbb74abded9da76ff | [
"MIT"
] | null | null | null | #pragma once
#include <string>
#include <vector>
#include <sstream>
#include "Page.h"
#include "graphics.h"
struct BusData {
std::string name;
unsigned hour;
unsigned min;
BusData(std::string name, unsigned hour, unsigned min)
: name(name), hour(hour), min(min){}
};
class BusPage : public Page {
public:
BusPage(canvas_ptr);
virtual bool init();
virtual void display(bool is_same_page);
virtual void update(const std::string& name, const std::string& val) ;
private:
bool need_refresh = false;
int index = 0;
unsigned entry_per_page = 2;
std::vector<BusData> data;
};
| 22.517241 | 75 | 0.640123 | [
"vector"
] |
c4b63a3dbc6109b17a6c06c28a93f60a5d8a70b9 | 156,598 | c | C | gridftp/control/source/globus_ftp_control_client.c | ezeeyahoo/gct | 817c3a69aba0bac7bd1e464e127cfc998451ca13 | [
"Apache-2.0"
] | 44 | 2015-02-04T22:01:05.000Z | 2021-01-27T21:18:47.000Z | gridftp/control/source/globus_ftp_control_client.c | ezeeyahoo/gct | 817c3a69aba0bac7bd1e464e127cfc998451ca13 | [
"Apache-2.0"
] | 108 | 2017-11-01T20:22:38.000Z | 2022-03-25T18:33:20.000Z | gridftp/control/source/globus_ftp_control_client.c | ezeeyahoo/gct | 817c3a69aba0bac7bd1e464e127cfc998451ca13 | [
"Apache-2.0"
] | 51 | 2015-04-07T14:29:47.000Z | 2021-09-23T08:44:18.000Z | /*
* Copyright 1999-2006 University of Chicago
*
* 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 GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* @file globus_ftp_control_client.c
* @brief Client-side FTP Control API
*/
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
#include "globus_ftp_control.h"
#include "globus_i_ftp_control.h"
#include "globus_error_gssapi.h"
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#ifndef TARGET_ARCH_WIN32
#include <netinet/in.h>
#endif
/* Global variable declarations */
FILE * globus_i_ftp_control_devnull;
/* Local variable declarations */
static globus_list_t * globus_l_ftp_cc_handle_list = GLOBUS_NULL;
static globus_mutex_t globus_l_ftp_cc_handle_list_mutex;
static globus_cond_t globus_l_ftp_cc_handle_list_cond;
static int globus_l_ftp_cc_handle_signal_count;
static int globus_l_ftp_cc_deactivated = GLOBUS_TRUE;
/* Local function declarations */
static void
globus_l_ftp_control_send_cmd_cb(
void * callback_arg,
globus_ftp_control_handle_t * handle,
globus_object_t * error,
globus_ftp_control_response_t * ftp_response);
static void
globus_l_ftp_control_data_close_cb(
void * arg,
struct globus_ftp_control_handle_s * handle,
globus_object_t * error);
static void
globus_l_ftp_control_close_cb(
void * arg,
globus_io_handle_t * handle,
globus_result_t result);
static void
globus_l_ftp_control_connect_cb(
void * arg,
globus_io_handle_t * handle,
globus_result_t result);
static void
globus_l_ftp_control_read_cb(
void * arg,
globus_io_handle_t * handle,
globus_result_t result,
globus_byte_t * buf,
globus_size_t nbytes);
static void
globus_l_ftp_control_write_cb(
void * arg,
globus_io_handle_t * handle,
globus_result_t result,
globus_byte_t * buf,
globus_size_t nbytes);
static globus_result_t
globus_l_ftp_control_response_init(
globus_ftp_control_response_t * response);
static int
globus_l_ftp_control_end_of_reply(
globus_ftp_cc_handle_t * cc_handle,
int hint,
globus_object_t ** err);
static void
globus_l_ftp_control_read_next(
globus_ftp_control_handle_t * handle);
static globus_result_t
globus_l_ftp_control_queue_element_init(
globus_ftp_control_rw_queue_element_t * element,
globus_ftp_control_response_callback_t callback,
void * arg,
globus_byte_t * write_buf,
int write_flags,
globus_io_write_callback_t write_callback,
globus_io_read_callback_t read_callback,
globus_bool_t expect_response,
globus_bool_t use_auth,
globus_ftp_control_handle_t * handle);
/**
* @brief Initialize a globus ftp handle
* @ingroup globus_ftp_control_client
* @details
* This function will set up (i.e. initialize all mutexes and
* variables) a globus ftp handle. It will also enter the handle in a
* list used by the module activation/deactivation functions.
*
* @param handle
* The handle to initialize.
* @return
* - GLOBUS_SUCCESS
* - error object
*/
globus_result_t
globus_ftp_control_handle_init(
globus_ftp_control_handle_t * handle)
{
globus_result_t rc;
if(handle == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_handle_init: Handle argument is NULL")
);
}
/* control_client.c specific init */
handle->cc_handle.cc_state = GLOBUS_FTP_CONTROL_UNCONNECTED;
globus_fifo_init(&handle->cc_handle.readers);
globus_fifo_init(&handle->cc_handle.writers);
globus_l_ftp_control_response_init(
&(handle->cc_handle.response));
handle->cc_handle.use_auth = GLOBUS_FALSE;
handle->cc_handle.cc_state = GLOBUS_FTP_CONTROL_UNCONNECTED;
handle->cc_handle.command_cb = GLOBUS_NULL;
handle->cc_handle.command_cb_arg = GLOBUS_NULL;
handle->cc_handle.auth_cb = GLOBUS_NULL;
handle->cc_handle.auth_cb_arg = GLOBUS_NULL;
handle->cc_handle.cb_count = 0;
handle->cc_handle.close_cb = GLOBUS_NULL;
handle->cc_handle.close_cb_arg = GLOBUS_NULL;
handle->cc_handle.close_result = GLOBUS_NULL;
handle->cc_handle.quit_response.response_buffer = GLOBUS_NULL;
handle->cc_handle.nl_handle_set = GLOBUS_FALSE;
handle->cc_handle.signal_deactivate = GLOBUS_FALSE;
*handle->cc_handle.serverhost = '\0';
globus_io_tcpattr_init(&handle->cc_handle.io_attr);
globus_ftp_control_auth_info_init(&(handle->cc_handle.auth_info),
GSS_C_NO_CREDENTIAL,
GLOBUS_FALSE,
GLOBUS_NULL,
GLOBUS_NULL,
GLOBUS_NULL,
GLOBUS_NULL);
globus_mutex_init(&(handle->cc_handle.mutex), GLOBUS_NULL);
handle->cc_handle.read_buffer = (globus_byte_t *) globus_libc_malloc(
GLOBUS_FTP_CONTROL_READ_BUFFER_SIZE);
if(handle->cc_handle.read_buffer == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_handle_init: malloc failed")
);
}
handle->cc_handle.read_buffer_size = GLOBUS_FTP_CONTROL_READ_BUFFER_SIZE;
handle->cc_handle.bytes_read = 0;
globus_mutex_lock(&globus_l_ftp_cc_handle_list_mutex);
{
globus_list_insert(&globus_l_ftp_cc_handle_list, handle);
handle->cc_handle.list_elem = globus_l_ftp_cc_handle_list;
}
globus_mutex_unlock(&globus_l_ftp_cc_handle_list_mutex);
/* control_data.c specific init */
rc = globus_i_ftp_control_data_cc_init(handle);
if(rc != GLOBUS_SUCCESS)
{
globus_libc_free(handle->cc_handle.read_buffer);
return rc;
}
return GLOBUS_SUCCESS;
}
/* globus_ftp_control_handle_init() */
/**
* @brief Destroy a globus ftp handle
* @ingroup globus_ftp_control_client
* @details
* This function will free up all dynamically allocated memory
* associated with a given globus ftp handle. It will also remove the
* handle from a list used by the module activation/deactivation
* functions. This function should only be called after a call to
* either globus_ftp_control_force_close or globus_ftp_control_quit.
*
* @param handle
* The handle to destroy.
* @return
* - success
* - invalid handle
* - handle is still in connected state
*/
globus_result_t
globus_ftp_control_handle_destroy(
globus_ftp_control_handle_t * handle)
{
void * result;
if(handle == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_handle_destroy: Null handle argument")
);
}
if(handle->cc_handle.cc_state !=
GLOBUS_FTP_CONTROL_UNCONNECTED)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_handle_destroy: Handle still connected")
);
}
/* control_client.c specific destroy */
globus_mutex_lock(&globus_l_ftp_cc_handle_list_mutex);
{
result = globus_list_remove(&globus_l_ftp_cc_handle_list,
handle->cc_handle.list_elem);
}
globus_mutex_unlock(&globus_l_ftp_cc_handle_list_mutex);
if(result != GLOBUS_NULL)
{
globus_ftp_control_response_destroy(
&handle->cc_handle.response);
globus_ftp_control_response_destroy(
&handle->cc_handle.quit_response);
globus_mutex_destroy(&(handle->cc_handle.mutex));
globus_libc_free(handle->cc_handle.read_buffer);
globus_io_tcpattr_destroy(&handle->cc_handle.io_attr);
if(handle->cc_handle.nl_handle_set)
{
globus_netlogger_handle_destroy(&handle->cc_handle.nl_handle);
}
if(handle->cc_handle.close_result != GLOBUS_SUCCESS)
{
globus_object_free(handle->cc_handle.close_result);
}
globus_fifo_destroy(&handle->cc_handle.readers);
globus_fifo_destroy(&handle->cc_handle.writers);
/* control_data.c specific destroy */
return globus_i_ftp_control_data_cc_destroy(handle);
}
return GLOBUS_SUCCESS;
}
/* globus_ftp_control_handle_destroy() */
globus_result_t
globus_ftp_control_use_tls(
globus_ftp_control_handle_t * handle,
globus_ftp_control_auth_info_t * auth_info)
{
globus_result_t rc = GLOBUS_SUCCESS;
globus_xio_attr_t attr = NULL;
if (auth_info->req_flags & GSS_C_ANON_FLAG)
{
rc = globus_io_attr_set_secure_authentication_mode(
&handle->cc_handle.io_attr,
GLOBUS_IO_SECURE_AUTHENTICATION_MODE_ANONYMOUS,
NULL);
}
else
{
rc = globus_io_attr_set_secure_authentication_mode(
&handle->cc_handle.io_attr,
GLOBUS_IO_SECURE_AUTHENTICATION_MODE_MUTUAL,
auth_info->credential_handle);
}
if (auth_info->auth_gssapi_subject != NULL)
{
globus_io_secure_authorization_data_t data = NULL;
rc = globus_io_secure_authorization_data_initialize(
&data);
if (rc == GLOBUS_SUCCESS)
{
rc = globus_io_secure_authorization_data_set_identity(
&data,
auth_info->auth_gssapi_subject);
}
if (rc == GLOBUS_SUCCESS)
{
rc = globus_io_attr_set_secure_authorization_mode(
&handle->cc_handle.io_attr,
GLOBUS_IO_SECURE_AUTHORIZATION_MODE_IDENTITY,
&data);
}
globus_io_secure_authorization_data_destroy(&data);
}
else
{
rc = globus_io_attr_set_secure_authorization_mode(
&handle->cc_handle.io_attr,
GLOBUS_IO_SECURE_AUTHORIZATION_MODE_HOST,
NULL);
}
if (auth_info->req_flags & GSS_C_DELEG_FLAG)
{
/* Client requests delegation */
rc = globus_io_attr_set_secure_delegation_mode(
&handle->cc_handle.io_attr,
((auth_info->req_flags
& GSS_C_GLOBUS_LIMITED_DELEG_PROXY_FLAG) != 0)
? GLOBUS_IO_SECURE_DELEGATION_MODE_LIMITED_PROXY
: GLOBUS_IO_SECURE_DELEGATION_MODE_FULL_PROXY);
}
else
{
rc = globus_io_attr_set_secure_delegation_mode(
&handle->cc_handle.io_attr,
GLOBUS_IO_SECURE_DELEGATION_MODE_NONE);
}
if (rc == GLOBUS_SUCCESS)
{
rc = globus_io_attr_set_secure_channel_mode(
&handle->cc_handle.io_attr,
GLOBUS_IO_SECURE_CHANNEL_MODE_SSL_WRAP);
}
if (rc == GLOBUS_SUCCESS)
{
rc = globus_io_attr_set_secure_protection_mode(
&handle->cc_handle.io_attr,
GLOBUS_IO_SECURE_PROTECTION_MODE_PRIVATE);
}
if (rc == GLOBUS_SUCCESS)
{
rc = globus_io_attr_get_xio_attr(
&handle->cc_handle.io_attr,
&attr);
}
if (rc == GLOBUS_SUCCESS)
{
rc = globus_xio_attr_cntl(
attr,
globus_io_compat_get_gsi_driver(),
GLOBUS_XIO_GSI_SET_APPLICATION_PROTOCOLS,
(char *[])
{
"ftp",
NULL,
});
}
if (rc == GLOBUS_SUCCESS &&
auth_info->req_flags & GSS_C_GLOBUS_ALLOW_MISSING_SIGNING_POLICY)
{
rc = globus_xio_attr_cntl(
attr,
globus_io_compat_get_gsi_driver(),
GLOBUS_XIO_GSI_SET_ALLOW_MISSING_SIGNING_POLICY,
GLOBUS_TRUE);
}
return rc;
}
/* globus_ftp_control_use_tls() */
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
globus_result_t
globus_i_ftp_control_client_set_netlogger(
globus_ftp_control_handle_t * handle,
globus_netlogger_handle_t * nl_handle)
{
if(handle == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_handle_destroy: Null handle argument")
);
}
if(nl_handle == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_handle_destroy: Null nl_handle argument")
);
}
globus_mutex_lock(&(handle->cc_handle.mutex));
{
globus_io_attr_netlogger_copy_handle(nl_handle,
&handle->cc_handle.nl_handle);
globus_netlogger_set_desc(
&handle->cc_handle.nl_handle,
"FTP_CONTROL");
globus_io_attr_netlogger_set_handle(
&handle->cc_handle.io_attr,
&handle->cc_handle.nl_handle);
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
return GLOBUS_SUCCESS;
}
globus_result_t
globus_i_ftp_control_client_set_stack(
globus_ftp_control_handle_t * handle,
globus_xio_stack_t stack)
{
globus_result_t result;
if(handle == NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_i_ftp_control_set_stack: Null handle argument")
);
}
if(stack == NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_i_ftp_control_set_stack: Null stack")
);
}
globus_mutex_lock(&(handle->cc_handle.mutex));
{
result = globus_io_attr_set_stack(
&handle->cc_handle.io_attr,
stack);
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
return result;
}
globus_result_t
globus_i_ftp_control_client_get_attr(
globus_ftp_control_handle_t * handle,
globus_xio_attr_t * attr)
{
globus_result_t result;
result = globus_io_attr_get_xio_attr(
&handle->cc_handle.io_attr, attr);
return result;
}
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
/**
* @brief Create a new control connection to an FTP server
* @ingroup globus_ftp_control_client
* @details
* This function is used to initiate an FTP control connection. It
* creates the socket to the FTP server. When the connection is made
* to the server, and the server's identification string is received,
* the callback function will be invoked.
*
* @param handle
* A pointer to a initialized FTP control handle. This handle
* will be used for all subsequent FTP control operations.
* @param host
* The hostname of the FTP server.
* @param port
* The TCP port number of the FTP server.
* @param callback
* A function to be called once the connection to the server is
* established, and a response has been read.
* @param callback_arg
* Parameter to the callback function.
* @return
* - success
* - Null handle
* - Null host
* - Illegal port number
* - Null callback
* - Cannot resolve hostname
* - Cannot create socket
*
* @par Callback errors:
* - success
* - connection refused
* - protocol error
* - eof
*
* @par Expected callback response values:
* - 120 Service ready in nnn minutes.
* - 220 Service ready for new user.
* - 421 Service not available, closing control connection.
* - 500 Syntax error, command unrecognized.
*
* @note The server may send other responses.
*/
globus_result_t
globus_ftp_control_connect(
globus_ftp_control_handle_t * handle,
char * host,
unsigned short port,
globus_ftp_control_response_callback_t callback,
void * callback_arg)
{
globus_result_t rc;
globus_ftp_control_rw_queue_element_t * element;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_connect() entering\n"));
if(handle == GLOBUS_NULL)
{
rc = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_connect: NULL handle argument")
);
goto error_exit;
}
if(host == GLOBUS_NULL)
{
rc = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_connect: NULL host argument")
);
goto error_exit;
}
#if USHRT_MAX > 65536
if (port > 65536)
{
rc = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_connect: Port argument greater than 64k")
);
goto error_exit;
}
#endif
if(callback == GLOBUS_NULL)
{
rc = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_connect: NULL callback argument")
);
goto error_exit;
}
globus_mutex_lock(&(handle->cc_handle.mutex));
{
if(!(globus_fifo_empty(&handle->cc_handle.readers) &&
globus_fifo_empty(&handle->cc_handle.writers) &&
handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_UNCONNECTED &&
globus_l_ftp_cc_deactivated == GLOBUS_FALSE))
{
rc = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_connect: Other operation already in progress")
);
goto unlock_exit;
}
element = (globus_ftp_control_rw_queue_element_t *)
globus_libc_malloc(sizeof(globus_ftp_control_rw_queue_element_t));
if(element == GLOBUS_NULL)
{
rc = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_connect: malloc failed")
);
goto unlock_exit;
}
element->callback = callback;
element->arg = callback_arg;
strncpy(handle->cc_handle.serverhost,
host, sizeof(handle->cc_handle.serverhost));
handle->cc_handle.serverhost[
sizeof(handle->cc_handle.serverhost) - 1] = 0;
globus_io_attr_set_socket_keepalive(
&handle->cc_handle.io_attr, GLOBUS_TRUE);
globus_io_attr_set_tcp_nodelay(
&handle->cc_handle.io_attr, GLOBUS_TRUE);
rc=globus_io_tcp_register_connect(
host,
port,
&handle->cc_handle.io_attr,
globus_l_ftp_control_connect_cb,
(void *) handle,
&handle->cc_handle.io_handle);
if(rc == GLOBUS_SUCCESS)
{
handle->cc_handle.cc_state = GLOBUS_FTP_CONTROL_CONNECTING;
globus_fifo_enqueue(&handle->cc_handle.readers,
element);
handle->cc_handle.cb_count++;
}
else
{
globus_libc_free(element);
goto unlock_exit;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_connect() exiting\n"));
return GLOBUS_SUCCESS;
unlock_exit:
globus_mutex_unlock(&(handle->cc_handle.mutex));
error_exit:
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_connect() exiting with error\n"));
return rc;
}
/* globus_ftp_control_connect() */
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* Internal callback for the globus_io_tcp_register_connect function.
*
* This is a internal callback used with the
* globus_io_tcp_register_connect function which in this library is
* called in the globus_ftp_control_connect function. It checks that
* the connect completed successfully and registers a read on the
* connection.
*
* @param arg
* The callback argument, in this case the control handle for
* the connection.
* @param handle
* The globus_io handle for the connection. In practice this
* represents the socket fd for the connection.
* @param result
* The result of the connect operation
*
* @return void
*
* @par If a error is detected in this function the user callback is
* called with an appropriate error object and the function
* returns.
*/
static void
globus_l_ftp_control_connect_cb(
void * arg,
globus_io_handle_t * handle,
globus_result_t result)
{
globus_ftp_cc_handle_t * cc_handle;
globus_ftp_control_handle_t * c_handle;
globus_object_t * error;
globus_result_t rc;
globus_ftp_control_rw_queue_element_t * element;
globus_bool_t call_close_cb = GLOBUS_FALSE;
globus_bool_t closing = GLOBUS_FALSE;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_connect_cb() entering\n"));
c_handle=(globus_ftp_control_handle_t *) arg;
cc_handle= &(c_handle->cc_handle);
globus_mutex_lock(&(cc_handle->mutex));
{
element= (globus_ftp_control_rw_queue_element_t *)
globus_fifo_peek(&cc_handle->readers);
if(result != GLOBUS_SUCCESS)
{
if(cc_handle->cc_state == GLOBUS_FTP_CONTROL_CONNECTING)
{
cc_handle->cc_state = GLOBUS_FTP_CONTROL_CLOSING;
}
error=globus_error_get(result);
globus_mutex_unlock(&(cc_handle->mutex));
goto return_error;
}
if(cc_handle->cc_state == GLOBUS_FTP_CONTROL_CONNECTING)
{
cc_handle->cc_state = GLOBUS_FTP_CONTROL_CONNECTED;
}
else if(cc_handle->cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
closing = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(cc_handle->mutex));
if(closing)
{
error = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_l_ftp_control_connect_cb: connection forced closed");
goto return_error;
}
rc=globus_io_register_read(handle,
cc_handle->read_buffer,
GLOBUS_FTP_CONTROL_READ_BUFFER_SIZE,
1,
globus_l_ftp_control_read_cb,
arg);
if(rc != GLOBUS_SUCCESS)
{
error=globus_error_get(rc);
goto return_error;
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_connect_cb() exiting\n"));
return;
return_error:
(element->callback)((element->arg),
c_handle,
error,
GLOBUS_NULL);
globus_mutex_lock(&(cc_handle->mutex));
{
globus_fifo_dequeue(&cc_handle->readers);
cc_handle->cb_count--;
if(!cc_handle->cb_count &&
cc_handle->cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(cc_handle->mutex));
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(c_handle);
}
globus_libc_free(element);
globus_object_free(error);
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_connect_cb() exiting with error\n"));
return;
}
#endif
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* Internal callback for the globus_io_tcp_register_read function.
*
* This is a internal callback used with the
* globus_io_tcp_register_read function which in this library is
* used for reading replies to any sent ftp commands. It checks that
* the read completed successfully, copies the bytes read to a
* response buffer, checks whether there is a complete response in the
* response buffer, decodes the reply if encryption/authentication is
* used. If the reply is not complete a new register_read is
* called. If the reply is complete, but preliminary the user callback
* is called with the intermediate reply and a new register read is
* called. If the reply is complete and is not preliminary the
* user/abort callback is called and no further action is taken.
*
* @param arg
* The callback argument, in this case the control handle for
* the connection.
* @param handle
* The globus_io handle for the connection. In practice this
* represents the socket fd for the connection.
* @param result
* The result of the read operation
* @param buf
* The buffer in which the result of the read is stored
* @param nbytes
* The number of bytes read
*
* @return void
*
* @par If a error is detected in this function the user callback is
* called with an appropriate error object and the function
* returns.
*/
static void
globus_l_ftp_control_read_cb(
void * arg,
globus_io_handle_t * handle,
globus_result_t result,
globus_byte_t * buf,
globus_size_t nbytes)
{
globus_ftp_control_rw_queue_element_t * element;
globus_ftp_cc_handle_t * cc_handle;
globus_ftp_control_handle_t * c_handle;
globus_object_t * error = NULL;
globus_byte_t * new_buf;
int end_of_reply;
globus_result_t rc;
globus_size_t response_length;
globus_bool_t queue_empty;
globus_bool_t call_close_cb = GLOBUS_FALSE;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_read_cb() entering\n"));
c_handle=(globus_ftp_control_handle_t *) arg;
cc_handle=&(c_handle->cc_handle);
queue_empty=GLOBUS_FALSE;
element= (globus_ftp_control_rw_queue_element_t *)
globus_fifo_peek(&cc_handle->readers);
/* check result */
if(result != GLOBUS_SUCCESS)
{
error=globus_error_get(result);
goto return_error;
}
/* copy the result to a response_buffer; allocate more memory if
* needed
*/
if(nbytes < (cc_handle->response.response_buffer_size -
cc_handle->response.response_length))
{
response_length = cc_handle->response.response_length;
memcpy(&cc_handle->response.response_buffer[response_length],
buf, nbytes);
cc_handle->response.response_length+=nbytes;
}
else
{
/* Optimize our buffer growing for large MLSC replies. */
int current = cc_handle->response.response_length;
/* Need at least this much to satisfy current read */
int new_size = current + nbytes + 1;
if(current < 1000000)
{
/* double each time */
int new_size_extra = current * 2;
new_size = GLOBUS_MAX(new_size, new_size_extra);
}
else
{
/* add 100K */
int new_size_extra = current + 100000;
new_size = GLOBUS_MAX(new_size, new_size_extra);
}
new_buf = (globus_byte_t *)
globus_libc_malloc(sizeof(globus_byte_t) * new_size);
if(new_buf == GLOBUS_NULL)
{
error=globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_l_ftp_control_read_cb: malloc failed");
goto return_error;
}
cc_handle->response.response_buffer_size = new_size;
memcpy(new_buf,
cc_handle->response.response_buffer,
cc_handle->response.response_length);
globus_libc_free(cc_handle->response.response_buffer);
cc_handle->response.response_buffer=new_buf;
memcpy(&(cc_handle->response.response_buffer[
cc_handle->response.response_length]),
buf,
nbytes);
cc_handle->response.response_length+=nbytes;
}
/* check whether there is a full reply in the
* response_buffer. Note that _end_of_reply() will also do any
* necessary decoding of protected replies.
*/
end_of_reply=globus_l_ftp_control_end_of_reply(
cc_handle, cc_handle->response.response_length - nbytes, &error);
if(end_of_reply == -1)
{
error=globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
error,
"globus_l_ftp_control_read_cb: Error while searching for end of reply");
goto return_error;
}
while (end_of_reply) /* got a full reply */
{
if(cc_handle->response.response_class ==
GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY)
{
/* if reply was preliminary, call the user cb with reply
* and continue to read
*/
(element->callback)(element->arg,
c_handle,
GLOBUS_NULL,
&(cc_handle->response));
response_length = cc_handle->response.response_length;
memcpy(cc_handle->response.response_buffer,
&cc_handle->read_buffer[
nbytes-(response_length-end_of_reply)],
response_length-end_of_reply);
cc_handle->response.response_length=response_length
-end_of_reply;
end_of_reply=globus_l_ftp_control_end_of_reply(cc_handle, 0, &error);
if(end_of_reply == -1)
{
error=globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
error,
"globus_l_ftp_control_read_cb: Error while searching for end of reply");
goto return_error;
}
}
else
{
/* reply was not preliminary so call user callback with
* reply and check if there are more entries in the read
* queue
*/
response_length=cc_handle->response.response_length;
cc_handle->response.response_length=end_of_reply;
(element->callback)(element->arg,
c_handle,
GLOBUS_NULL,
&(cc_handle->response));
memcpy(cc_handle->response.response_buffer,
&cc_handle->read_buffer[nbytes-(response_length-end_of_reply)],
response_length-end_of_reply);
cc_handle->response.response_length = response_length -
end_of_reply;
globus_mutex_lock(&cc_handle->mutex);
{
globus_fifo_dequeue(&cc_handle->readers);
cc_handle->cb_count--;
queue_empty=globus_fifo_empty(&cc_handle->readers);
if(!cc_handle->cb_count &&
cc_handle->cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&cc_handle->mutex);
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(c_handle);
}
globus_libc_free(element);
if(queue_empty == GLOBUS_TRUE)
{
goto do_return;
}
else
{
element= (globus_ftp_control_rw_queue_element_t *)
globus_fifo_peek(&cc_handle->readers);
end_of_reply=globus_l_ftp_control_end_of_reply(cc_handle, 0, &error);
if(end_of_reply == -1)
{
error=globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
error,
"globus_l_ftp_control_read_cb: Error while searching for end of reply");
goto return_error;
}
}
}
}
/* call another register_read by default
*/
rc=globus_io_register_read(handle,
cc_handle->read_buffer,
GLOBUS_FTP_CONTROL_READ_BUFFER_SIZE,
1,
globus_l_ftp_control_read_cb,
arg);
if(rc != GLOBUS_SUCCESS)
{
error=globus_error_get(rc);
goto return_error;
}
do_return:
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_read_cb() exiting\n"));
return;
return_error:
(element->callback)(element->arg,
c_handle,
error,
GLOBUS_NULL);
globus_mutex_lock(&cc_handle->mutex);
{
globus_fifo_dequeue(&cc_handle->readers);
cc_handle->cb_count--;
queue_empty=globus_fifo_empty(&cc_handle->readers);
if(!cc_handle->cb_count &&
cc_handle->cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&cc_handle->mutex);
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(c_handle);
}
globus_libc_free(element);
globus_object_free(error);
if(queue_empty == GLOBUS_FALSE)
{
globus_l_ftp_control_read_next(c_handle);
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_read_cb() exiting with error\n"));
return;
}
#endif
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/* search backward in @buff looking for "\r\n". If found, return
index of just past it. Otherwise, return 0.
*/
static
int
globus_l_ftp_control_get_current_line_start(
const char * buff,
int index)
{
while(index >= 2)
{
if(buff[index - 1] == '\n' && buff[index - 2] == '\r')
{
return index;
}
index--;
}
return 0;
}
/* @buff response buffer
@len length of response buffer
@hint length of response buffer in last call, to optimize scans
@return True if response buffer has a final ftp line (NNN<space>...\r\n)
*/
static
int
globus_l_ftp_control_check_final_line_fast(
const char * buff,
int len,
int hint)
{
int line_start;
int i;
line_start = globus_l_ftp_control_get_current_line_start(buff, hint);
for(i = line_start; i < (len - 1); /* empty */)
{
if(buff[i] == '\r' && buff[i + 1] == '\n')
{
/* newline found */
int line_len = i - line_start;
if(line_len >= 4 && buff[line_start + 3] == ' ' &&
isdigit(buff[line_start]) &&
isdigit(buff[line_start + 1]) &&
isdigit(buff[line_start + 2]))
{
/* final line found */
return 1;
}
else
{
/* see if next line is a final */
line_start = i + 2;
i = line_start;
}
}
else
{
i++;
}
}
/* no newline found */
return 0;
}
/**
* Internal helper function which checks a buffer for a complete ftp
* reply.
*
* This is a internal helper function checks whether a given response
* struct contains a complete ftp reply. If so, it decodes the reply
* if necessary and fills in the reply_code and reply_class fields in
* the response struct.
*
* @param cc_handle
* A control connection handle, which is assumed to contain
* a pointer to the response struct to be processed and, if
* authentication is used, information about the security
* context of the control connection.
*
* @return
* - -1 if an error occurred
* - 0 if no complete reply was found
* - a index into the response_buffer, indicating the end of
* the reply
*
*/
int
globus_l_ftp_control_end_of_reply(
globus_ftp_cc_handle_t * cc_handle,
int hint,
globus_object_t ** err)
{
int current;
int last;
int first;
int found;
int length;
int total_length;
unsigned char * out_buf;
gss_buffer_desc wrapped_token;
gss_buffer_desc unwrapped_token;
globus_ftp_control_response_t * response;
OM_uint32 maj_stat;
OM_uint32 min_stat;
int conf_state;
gss_qop_t qop_state;
globus_result_t rc;
/* To improve performance on large buffers, hint is used. We look at the
* first line beginning before hint and all lines thereafter.
*/
last=-1;
current=1;
found=0;
first=1;
response=&cc_handle->response;
if(hint && response->response_length > hint)
{
if(!globus_l_ftp_control_check_final_line_fast(
(const char *) response->response_buffer,
response->response_length,
hint))
{
return 0;
}
}
/* find the end of reply */
while(!found && current < response->response_length)
{
if(response->response_buffer[current - 1] == '\r' &&
response->response_buffer[current] == '\n')
{
/* check that we actually have a ftp reply */
if(first)
{
if((current < 5) ||
!(isdigit((response->response_buffer)[last+1]) &&
isdigit((response->response_buffer)[last+2]) &&
isdigit((response->response_buffer)[last+3]) &&
(((response->response_buffer)[last+4]==' ') ||
((response->response_buffer)[last+4]=='-'))))
{
return -1;
}
first=0;
}
if(((response->response_buffer)[last+4]==' ') &&
isdigit((response->response_buffer)[last+1]) &&
isdigit((response->response_buffer)[last+2]) &&
isdigit((response->response_buffer)[last+3]))
{
found=current+1;
}
else
{
last=current;
}
}
current++;
}
if(found)
{
/* need to unwrap reply if it is protected */
if((response->response_buffer)[last+1] == '6')
{
globus_size_t copy_len = response->response_length * 2;
last=-1;
current=0;
length=0;
total_length=0;
out_buf = globus_libc_malloc(copy_len);
if( out_buf == GLOBUS_NULL)
{
return -1;
}
while(current<found)
{
if(response->response_buffer[current] == '\n')
{
/* Decode token */
response->response_buffer[current-1] = '\0';
rc=globus_i_ftp_control_radix_decode(
&(response->response_buffer[last+5]),
&(out_buf[total_length]),&length);
if(rc != GLOBUS_SUCCESS)
{
*err = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_l_ftp_control_end_of_reply: base64 decode failure.");
return -1;
}
/* Unwrap token */
wrapped_token.value = &(out_buf[total_length]);
wrapped_token.length = length;
maj_stat = gss_unwrap(&min_stat,
cc_handle->auth_info.
auth_gssapi_context,
&wrapped_token,
&unwrapped_token,
&conf_state,
&qop_state);
if(maj_stat != GSS_S_COMPLETE)
{
globus_libc_free(out_buf);
return -1;
}
/* get rid of terminating NULL */
if(((char *) unwrapped_token.value)[unwrapped_token.length - 1] == '\0')
{
unwrapped_token.length--;
}
if(total_length+unwrapped_token.length >= copy_len)
{
copy_len = (total_length+unwrapped_token.length) * 4;
out_buf = globus_realloc(out_buf, copy_len);
}
memcpy(&(out_buf[total_length]),
unwrapped_token.value,
unwrapped_token.length);
length = unwrapped_token.length;
total_length += length;
gss_release_buffer(&min_stat, &unwrapped_token);
last=current;
}
current++;
}
total_length++;
memcpy(&(out_buf[total_length]),
&(response->response_buffer[found]),
response->response_length-found);
globus_libc_free(response->response_buffer);
response->response_buffer=out_buf;
response->response_buffer_size= response->response_length + 4;
response->response_length=
total_length+response->response_length-found;
found=total_length;
last=total_length-length-2;
}
else
{
response->response_length++;
found++;
if(response->response_buffer_size < response->response_length)
{
response->response_buffer_size = response->response_length;
out_buf = globus_libc_realloc(response->response_buffer,
response->response_length);
if( out_buf == GLOBUS_NULL)
{
return -1;
}
response->response_buffer = out_buf;
}
if(response->response_length-found)
{
memmove(&response->response_buffer[found],
&response->response_buffer[found - 1],
response->response_length-found);
}
}
/* get the ftp response code */
response->response_buffer[found - 1] = '\0';
if(sscanf((const char *) &(response->response_buffer[last+1]),
"%d", &response->code) < 1)
{
globus_assert(0);
}
/* determine the ftp response class */
switch(response->response_buffer[last+1])
{
case '1':
response->response_class=
GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY;
break;
case '2':
response->response_class=
GLOBUS_FTP_POSITIVE_COMPLETION_REPLY;
break;
case '3':
response->response_class=
GLOBUS_FTP_POSITIVE_INTERMEDIATE_REPLY;
break;
case '4':
response->response_class=
GLOBUS_FTP_TRANSIENT_NEGATIVE_COMPLETION_REPLY;
break;
case '5':
response->response_class=
GLOBUS_FTP_PERMANENT_NEGATIVE_COMPLETION_REPLY;
break;
default:
response->response_class=
GLOBUS_FTP_UNKNOWN_REPLY;
break;
}
}
return found;
}
/**
* Internal helper function which creates and initializes a response
* structure
*
* This is a internal helper function allocates memory for a response
* structure and a buffer contained within that structure. It also
* initializes other values in the structure to default values.
*
* @param response
* This parameter is used to return the new response struct.
*
* @return
* - Error object
* - GLOBUS_SUCCESS
*
*/
static
globus_result_t
globus_l_ftp_control_response_init(
globus_ftp_control_response_t * response)
{
response->code=0;
response->response_class=GLOBUS_FTP_UNKNOWN_REPLY;
response->response_length=0;
response->response_buffer_size=
GLOBUS_I_FTP_CONTROL_BUF_SIZE;
response->response_buffer=(globus_byte_t *)
globus_libc_malloc(sizeof(globus_byte_t)*
GLOBUS_I_FTP_CONTROL_BUF_SIZE);
if(response->response_buffer== GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_l_ftp_control_response_init: malloc failed")
);
}
return GLOBUS_SUCCESS;
}
/* globus_l_ftp_control_response_init() */
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
/**
* @brief Free the memory associated with a response
* @ingroup globus_ftp_control_client
* @details
* This is a helper function which frees the memory associated with a
* response structure.
*
* @param response
* This parameter indicates the response structure to destroy
*
* @return
* - Error object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_ftp_control_response_destroy(
globus_ftp_control_response_t * response)
{
if(response == GLOBUS_NULL)
{
return GLOBUS_SUCCESS;
}
if(response->response_buffer != GLOBUS_NULL)
{
globus_libc_free(response->response_buffer);
}
return GLOBUS_SUCCESS;
}
/**
* @brief Copy a response structure
* @ingroup globus_ftp_control_client
* @details
* This is a helper function which copies one response structure to
* another.
*
* @param src
* This parameter indicates the response structure to copy
* @param dest
* This parameter specifies the target response structure
*
* @return
* - Error object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_ftp_control_response_copy(
globus_ftp_control_response_t * src,
globus_ftp_control_response_t * dest)
{
if(src == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_l_ftp_control_response_copy: Source argument is NULL")
);
}
if(dest == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_l_ftp_control_response_copy: Destination argument is NULL")
);
}
dest->code=src->code;
dest->response_class=src->response_class;
dest->response_length=src->response_length;
dest->response_buffer_size=src->response_buffer_size;
dest->response_buffer=(globus_byte_t *)
globus_libc_malloc(dest->response_buffer_size);
if(dest->response_buffer== GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_l_ftp_control_response_copy: malloc failed")
);
}
memcpy(dest->response_buffer,
src->response_buffer,
dest->response_length+1);
return GLOBUS_SUCCESS;
}
/**
* @brief Authenticate the user to the FTP server
* @ingroup globus_ftp_control_client
* @details
* This will perform the authentication handshake with the FTP
* server. Depending on which parameters are non-NULL, the
* authentication may involve GSSAPI credentials, a username, a
* password, and an account name.
*
* @note Do we want to add attribute arguments for:
* - specifying type of delegation
* - gsswrap control messages for integrity or confidentiality
*
* @param handle
* A pointer to a unauthenticated GridFTP control handle. In the
* case of GSS authentication the GSS security context is stored in
* this structure.
* @param auth_info
* This structure is used to pass the following information:
* - user
* The user's name for login purposes. If this string is
* "anonymous", "ftp", GLOBUS_NULL or ":globus-mapping:" then
* the password argument is optional. If this string is
* GLOBUS_NULL or ":globus-mapping:" and gss_auth is true then
* the users login is looked by the FTP server host.
* - password
* The password for the above user argument. If the user
* argument is "anonymous" or "ftp" or if gss_auth is true this
* string may be GLOBUS_NULL.
* - account
* This parameter is optional. If not used it should be set to
* GLOBUS_NULL. It might be needed by firewalls.
* - auth_gssapi_subject
* The GSSAPI subject name of the server you are connecting
* to. If this is GLOBUS_NULL, and the gss_auth parameter is
* set to GLOBUS_TRUE, then the name will default to the host
* name.
* @param use_auth
* If set to GLOBUS_TRUE the above argument indicates that GSS
* authentication should be used, otherwise cleartext
* user/password authentication is used.
* @param callback
* The function to be called once the authentication process is
* complete or when an error occurs.
* @param callback_arg
* User supplied argument to the callback function
*
* @return
* - success
* - Null handle
* - Invalid handle
* - Handle already authenticated
*
* @par Callback errors:
* - success
* - authentication failed
* - protocol error
* - eof
*
* @par Expected callback response values:
* - 230 User logged in, proceed.
* - 232 User logged in, authorized by security data exchange.
* - 234 Security data exchange complete.
* - 331 User name okay, need password.
* - 332 Need account for login.
* - 336 Username okay, need password. Challenge is "...."
* - 431 Need some unavailable resource to process security.
* - 500 Syntax error, command unrecognized.
* - 530 Not logged in.
*
* @note The server may send other responses.
*
* @note The function globus_ftp_control_authenticate_ex() is identical except
* that the auth_info->req_flags is used. If delegation flags or any flags
* other than GSS_C_MUTUAL_FLAG and GSS_C_CONF_FLAG are desired, they must be
* set explicitly. It is the caller's responsibility to ensure that req_flags
* only contains valid flags.
*/
globus_result_t
globus_ftp_control_authenticate(
globus_ftp_control_handle_t * handle,
globus_ftp_control_auth_info_t * auth_info,
globus_bool_t use_auth,
globus_ftp_control_response_callback_t callback,
void * callback_arg)
{
globus_ftp_control_auth_info_t tmp_auth_info;
globus_result_t result;
if(auth_info == GLOBUS_NULL)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_authenticate: auth_info argument is NULL")
);
goto error;
}
result = globus_i_ftp_control_auth_info_init(&tmp_auth_info, auth_info);
if(result != GLOBUS_SUCCESS)
{
goto error;
}
/* Do limited delegation */
tmp_auth_info.req_flags |=
GSS_C_GLOBUS_LIMITED_DELEG_PROXY_FLAG|GSS_C_DELEG_FLAG;
result = globus_ftp_control_authenticate_ex(
handle,
&tmp_auth_info,
use_auth,
callback,
callback_arg);
globus_i_ftp_control_auth_info_destroy(&tmp_auth_info);
return result;
error:
return result;
}
/* globus_ftp_control_authenticate() */
/**
* @ingroup globus_ftp_control_client
* @copydoc globus_ftp_control_authenticate
*/
globus_result_t
globus_ftp_control_authenticate_ex(
globus_ftp_control_handle_t * handle,
globus_ftp_control_auth_info_t * auth_info,
globus_bool_t use_auth,
globus_ftp_control_response_callback_t callback,
void * callback_arg)
{
globus_result_t rc;
globus_result_t result;
globus_i_ftp_passthru_cb_arg_t * auth_cb_arg;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_authenticate() entering\n"));
if(handle == GLOBUS_NULL)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_authenticate: handle argument is NULL")
);
goto error;
}
if(auth_info == GLOBUS_NULL)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_authenticate: auth_info argument is NULL")
);
goto error;
}
if(handle->cc_handle.auth_info.auth_gssapi_context !=
GSS_C_NO_CONTEXT &&
use_auth == GLOBUS_TRUE)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_authenticate: Already authenticated")
);
goto error;
}
if(use_auth == GLOBUS_FALSE &&
auth_info->user == GLOBUS_NULL)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_authenticate: No user supplied")
);
goto error;
}
globus_mutex_lock(&(handle->cc_handle.mutex));
{
if(handle->cc_handle.cc_state != GLOBUS_FTP_CONTROL_CONNECTED)
{
globus_mutex_unlock(&(handle->cc_handle.mutex));
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_authenticate: Handle not connected")
);
goto error;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
/* copy information into the control connection handle */
rc = globus_i_ftp_control_auth_info_init(
&(handle->cc_handle.auth_info),auth_info);
if(rc != GLOBUS_SUCCESS)
{
result=rc;
goto error;
}
handle->cc_handle.auth_info.req_flags = auth_info->req_flags;
handle->cc_handle.use_auth=use_auth;
auth_cb_arg = (globus_i_ftp_passthru_cb_arg_t *)
globus_libc_malloc(sizeof(globus_i_ftp_passthru_cb_arg_t));
if(auth_cb_arg == GLOBUS_NULL)
{
result=globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_authenticate: malloc failed")
);
goto error;
}
auth_cb_arg->user_cb=callback;
auth_cb_arg->user_cb_arg=callback_arg;
if(use_auth == GLOBUS_FALSE)
{
globus_io_secure_authentication_mode_t
mode = GLOBUS_IO_SECURE_AUTHENTICATION_MODE_NONE;
rc = globus_io_attr_get_secure_authentication_mode(
&handle->cc_handle.io_attr,
&mode,
NULL);
if (rc == GLOBUS_SUCCESS
&& mode != GLOBUS_IO_SECURE_AUTHENTICATION_MODE_NONE)
{
handle->cc_handle.auth_info.authenticated = GLOBUS_TRUE + 1;
}
auth_cb_arg->cmd=GLOBUS_I_FTP_USER;
rc = globus_ftp_control_send_command(handle,"USER %s\r\n",
globus_l_ftp_control_send_cmd_cb,
(void *) auth_cb_arg,
auth_info->user);
}
else
{
auth_cb_arg->cmd=GLOBUS_I_FTP_AUTH;
rc = globus_ftp_control_send_command(handle,"AUTH GSSAPI\r\n",
globus_l_ftp_control_send_cmd_cb,
(void *) auth_cb_arg);
}
if(rc != GLOBUS_SUCCESS)
{
globus_libc_free(auth_cb_arg);
result=rc;
goto error;
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_authenticate() exiting\n"));
return GLOBUS_SUCCESS;
error:
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_authenticate() exiting with error\n"));
return result;
}
/* globus_ftp_control_authenticate_ex() */
/**
* @brief Send an FTP protocol command
* @ingroup globus_ftp_control_client
* @details
* This function is used to send an FTP command, and register a handler
* to receive the FTP reply (or replies, if an intermediate one is sent).
* When the control channel is gss authenticated, the message and the reply
* will be automatically gss wrapped/unwrapped.
*
* @param handle
* A pointer to a GridFTP control handle. The command described by
* the cmdspec is issued to the server over the control channel
* associated with this handle.
* @param cmdspec
* A printf-style format string containing the text of the command
* to send to the server. The optional parameters to the format string
* are passed after the callback_arg in the function invocation.
* @param callback
* The function to be called once the authentication process is
* complete or when an error occurs.
* @param callback_arg
* User supplied argument to the callback function
* @param ...
* Parameters which will be substituted into the % escapes in the
* cmdspec string.
*
* @return
* - Success
* - Null handle
* - Command already in progress
*
* @par Callback errors:
* - success
* - protocol error
* - eof
*
* @par Expected callback response values:
* Any defined in RFC 959, 2228, 2389, draft-ietf-ftpext-mlst-10,
* or the @ref extensions_intro "protocol extensions" document.
*/
globus_result_t
globus_ftp_control_send_command(
globus_ftp_control_handle_t * handle,
const char * cmdspec,
globus_ftp_control_response_callback_t callback,
void * callback_arg,
...)
{
globus_ftp_control_rw_queue_element_t * element;
globus_result_t rc;
globus_result_t result;
globus_bool_t queue_empty;
globus_bool_t authenticated;
globus_bool_t call_close_cb = GLOBUS_FALSE;
char * buf;
char * encode_buf;
va_list ap;
int arglength;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_send_command() entering\n"));
if(handle == GLOBUS_NULL)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_send command: handle argument is NULL")
);
goto error;
}
va_start(ap, callback_arg);
arglength=globus_libc_vfprintf(globus_i_ftp_control_devnull,
cmdspec,
ap);
va_end(ap);
if(arglength < 1)
{
result=globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_send_command: Unable to determine total length of command string")
);
goto error;
}
buf = globus_libc_malloc(arglength+1);
if(buf == GLOBUS_NULL)
{
result=globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_send_command: malloc failed")
);
goto error;
}
va_start(ap, callback_arg);
if(globus_libc_vsprintf(buf, cmdspec,ap) < arglength)
{
globus_libc_free(buf);
result= globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_send_command: Command string construction failed")
);
va_end(ap);
goto error;
}
va_end(ap);
globus_mutex_lock(&(handle->cc_handle.mutex));
{
authenticated = handle->cc_handle.auth_info.authenticated;
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
if(authenticated == GLOBUS_TRUE)
{
/* encode the command */
rc=globus_i_ftp_control_encode_command(&(handle->cc_handle),
buf,
&encode_buf);
globus_libc_free(buf);
if(rc != GLOBUS_SUCCESS)
{
result=rc;
goto error;
}
buf=encode_buf;
}
element = (globus_ftp_control_rw_queue_element_t *)
globus_libc_malloc(sizeof(globus_ftp_control_rw_queue_element_t));
if(element == GLOBUS_NULL)
{
result=globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_send_command: malloc failed")
);
globus_libc_free(buf);
goto error;
}
element->callback = callback;
element->arg = callback_arg;
element->write_flags = 0;
element->write_buf = (globus_byte_t *) buf;
element->write_callback = globus_l_ftp_control_write_cb;
element->read_callback = globus_l_ftp_control_read_cb;
element->expect_response = GLOBUS_TRUE;
globus_mutex_lock(&(handle->cc_handle.mutex));
{
if(handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_CONNECTED)
{
queue_empty=globus_fifo_empty(&handle->cc_handle.writers);
globus_fifo_enqueue(&handle->cc_handle.writers,
element);
handle->cc_handle.cb_count++;
}
else
{
globus_mutex_unlock(&(handle->cc_handle.mutex));
result=globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_send_command: Handle not connected")
);
globus_libc_free(buf);
globus_libc_free(element);
goto error;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
if(queue_empty == GLOBUS_TRUE)
{
/* queue was empty, we need to do the write/send */
rc = globus_io_register_write(&handle->cc_handle.io_handle,
element->write_buf,
(globus_size_t) strlen(buf),
element->write_callback,
(void *) handle);
if(rc != GLOBUS_SUCCESS)
{
globus_mutex_lock(&(handle->cc_handle.mutex));
{
globus_fifo_dequeue(&handle->cc_handle.writers);
handle->cc_handle.cb_count--;
queue_empty=globus_fifo_empty(&handle->cc_handle.writers);
if(!handle->cc_handle.cb_count &&
handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(handle);
}
globus_libc_free(buf);
globus_libc_free(element);
if(queue_empty == GLOBUS_FALSE)
{
globus_i_ftp_control_write_next(handle);
}
result=rc;
goto error;
}
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_send_command() exiting\n"));
return GLOBUS_SUCCESS;
error:
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_send_command() exiting with error\n"));
return result;
}
/* globus_ftp_control_send_command() */
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* Internal callback for the globus_io_tcp_register_write function.
*
* This is a internal callback used with the
* globus_io_tcp_register_write function which in this library is
* used for sending all ftp commands but ABOR. It checks that
* the write completed successfully and then calls
* globus_io_register_read to read the reply for the command that was
* sent.
*
* @param arg
* The callback argument.
* @param handle
* The globus_io handle for the connection. In practice this
* represents the socket fd for the connection.
* @param result
* The result of the write operation
* @param buf
* The buffer in which the command was stored
* @param nbytes
* The number of bytes written
*
* @return void
*
* @par If a error is detected in this function the user callback is
* called with an appropriate error object and the function
* returns.
*/
static
void
globus_l_ftp_control_write_cb(
void * arg,
globus_io_handle_t * handle,
globus_result_t result,
globus_byte_t * buf,
globus_size_t nbytes)
{
globus_ftp_cc_handle_t * cc_handle;
globus_ftp_control_handle_t * c_handle;
globus_object_t * error;
globus_result_t rc;
globus_ftp_control_rw_queue_element_t * element;
globus_bool_t write_queue_empty;
globus_bool_t read_queue_empty;
globus_bool_t call_close_cb = GLOBUS_FALSE;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_write_cb() entering\n"));
c_handle=(globus_ftp_control_handle_t *) arg;
cc_handle=&(c_handle->cc_handle);
globus_libc_free(buf);
globus_mutex_lock(&(cc_handle->mutex));
{
element = (globus_ftp_control_rw_queue_element_t *)
globus_fifo_dequeue(&cc_handle->writers);
cc_handle->cb_count--;
write_queue_empty=globus_fifo_empty(&cc_handle->writers);
if(element->expect_response == GLOBUS_TRUE &&
result == GLOBUS_SUCCESS)
{
read_queue_empty=globus_fifo_empty(&cc_handle->readers);
globus_fifo_enqueue(&cc_handle->readers,
element);
cc_handle->cb_count++;
}
if(!cc_handle->cb_count &&
cc_handle->cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(cc_handle->mutex));
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(c_handle);
}
if(write_queue_empty == GLOBUS_FALSE)
{
globus_i_ftp_control_write_next(c_handle);
}
if(result != GLOBUS_SUCCESS)
{
error=globus_error_get(result);
goto return_error;
}
if(element->expect_response == GLOBUS_TRUE)
{
if(read_queue_empty == GLOBUS_TRUE)
{
rc=globus_io_register_read(&cc_handle->io_handle,
cc_handle->read_buffer,
GLOBUS_FTP_CONTROL_READ_BUFFER_SIZE,
1,
element->read_callback,
arg);
if(rc != GLOBUS_SUCCESS)
{
globus_mutex_lock(&(cc_handle->mutex));
{
element = (globus_ftp_control_rw_queue_element_t *)
globus_fifo_dequeue(&cc_handle->readers);
cc_handle->cb_count--;
read_queue_empty=globus_fifo_empty(&cc_handle->readers);
if(!cc_handle->cb_count &&
cc_handle->cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(cc_handle->mutex));
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(c_handle);
}
if(read_queue_empty == GLOBUS_FALSE)
{
globus_l_ftp_control_read_next(c_handle);
}
error=globus_error_get(rc);
goto return_error;
}
}
}
else
{
globus_libc_free(element);
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_write_cb() exiting\n"));
return;
return_error:
if(element->expect_response == GLOBUS_TRUE)
{
(element->callback)((element->arg),
c_handle,
error,
GLOBUS_NULL);
}
globus_libc_free(element);
globus_object_free(error);
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_write_cb() exiting with error\n"));
return;
}
/* globus_l_ftp_control_write_cb() */
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
/**
* @brief Send a GridFTP ABORT
* @ingroup globus_ftp_control_client
* @details
* This function is used to send the ABORT message to the FTP server.
* The ABORT message is sent out-of-band, and terminates any current
* data transfer in progress.
*
* As a result of the ABORT, the data channels used by this control channel
* will be closed. The data command callback will be issued with either
* a completion reply, or a transfer aborted reply. The ABORT callback
* will also be invoked, with the server's response to the abort command.
*
* Any attempts to register buffers for read or write after an ABORT
* has been sent will fail with a "no transfer in progress" error.
*
* @param handle
* A pointer to a GridFTP control handle. The ABORT command
* is issued to the server over the control channel
* associated with this handle.
* @param callback
* The function to be called once the authentication process is
* complete or when an error occurs.
* @param callback_arg
* User supplied argument to the callback function
*
* @return
* - Success
* - Null handle
* - No transfer in progress
*
* @par Callback errors:
* - success
* - protocol error
* - eof
*
* @par Expected callback response values:
* - 226 Abort successful.
* - 500 Syntax error, command unrecognized.
*
* @note The server may send other responses.
*/
globus_result_t
globus_ftp_control_abort(
globus_ftp_control_handle_t * handle,
globus_ftp_control_response_callback_t callback,
void * callback_arg)
{
globus_result_t rc;
globus_result_t result;
globus_ftp_control_rw_queue_element_t * element;
globus_ftp_control_rw_queue_element_t * element_ip;
globus_ftp_control_rw_queue_element_t * element_synch;
globus_ftp_control_rw_queue_element_t * element_abor;
globus_bool_t queue_empty;
globus_fifo_t abort_queue;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_abort() entering\n"));
globus_fifo_init(&abort_queue);
element_ip = (globus_ftp_control_rw_queue_element_t *)
globus_libc_malloc(sizeof(globus_ftp_control_rw_queue_element_t));
if(element_ip == GLOBUS_NULL)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_abort: malloc failed")
);
goto return_error;
}
result = globus_l_ftp_control_queue_element_init(
element_ip,
callback,
callback_arg,
(globus_byte_t *) GLOBUS_I_TELNET_IP,
0,
globus_l_ftp_control_write_cb,
GLOBUS_NULL,
GLOBUS_FALSE,
GLOBUS_FALSE,
handle);
if(result != GLOBUS_SUCCESS)
{
globus_libc_free(element_ip);
goto return_error;
}
element_synch = (globus_ftp_control_rw_queue_element_t *)
globus_libc_malloc(sizeof(globus_ftp_control_rw_queue_element_t));
if(element_synch == GLOBUS_NULL)
{
globus_libc_free(element_ip->write_buf);
globus_libc_free(element_ip);
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_abort: malloc failed")
);
goto return_error;
}
result = globus_l_ftp_control_queue_element_init(
element_synch,
callback,
callback_arg,
(globus_byte_t *) GLOBUS_I_TELNET_SYNCH,
MSG_OOB,
globus_l_ftp_control_write_cb,
GLOBUS_NULL,
GLOBUS_FALSE,
GLOBUS_FALSE,
handle);
if(result != GLOBUS_SUCCESS)
{
globus_libc_free(element_ip->write_buf);
globus_libc_free(element_ip);
globus_libc_free(element_synch);
goto return_error;
}
element_abor = (globus_ftp_control_rw_queue_element_t *)
globus_libc_malloc(sizeof(globus_ftp_control_rw_queue_element_t));
if(element_abor == GLOBUS_NULL)
{
globus_libc_free(element_ip->write_buf);
globus_libc_free(element_ip);
globus_libc_free(element_synch->write_buf);
globus_libc_free(element_synch);
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_abort: malloc failed")
);
goto return_error;
}
result = globus_l_ftp_control_queue_element_init(
element_abor,
callback,
callback_arg,
(globus_byte_t *) "ABOR\r\n",
0,
globus_l_ftp_control_write_cb,
globus_l_ftp_control_read_cb,
GLOBUS_TRUE,
handle->cc_handle.use_auth,
handle);
if(result != GLOBUS_SUCCESS)
{
globus_libc_free(element_ip->write_buf);
globus_libc_free(element_ip);
globus_libc_free(element_synch->write_buf);
globus_libc_free(element_synch);
globus_libc_free(element_abor);
goto return_error;
}
globus_mutex_lock(&(handle->cc_handle.mutex));
{
if( handle->cc_handle.cc_state !=
GLOBUS_FTP_CONTROL_CONNECTED)
{
globus_mutex_unlock(&(handle->cc_handle.mutex));
globus_libc_free(element_ip->write_buf);
globus_libc_free(element_ip);
globus_libc_free(element_synch->write_buf);
globus_libc_free(element_synch);
globus_libc_free(element_abor->write_buf);
globus_libc_free(element_abor);
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_abort: Handle not connected")
);
goto return_error;
}
else
{
queue_empty=globus_fifo_empty(&handle->cc_handle.writers);
if(queue_empty == GLOBUS_FALSE)
{
globus_fifo_move(&abort_queue,
&handle->cc_handle.writers);
globus_fifo_enqueue(&handle->cc_handle.writers,
globus_fifo_dequeue(&abort_queue));
}
globus_fifo_enqueue(&handle->cc_handle.writers,
(void *) element_ip);
globus_fifo_enqueue(&handle->cc_handle.writers,
(void *) element_synch);
globus_fifo_enqueue(&handle->cc_handle.writers,
(void *) element_abor);
handle->cc_handle.cb_count -= globus_fifo_size(&abort_queue);
handle->cc_handle.cb_count += 3;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
while( (element=globus_fifo_dequeue(&abort_queue)) != GLOBUS_NULL)
{
(element->callback)((element->arg),
handle,
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"Command aborted"),
GLOBUS_NULL);
globus_libc_free(element);
}
if(queue_empty == GLOBUS_TRUE)
{
/* queue was empty, we need to do the write/send */
rc = globus_io_register_write(&handle->cc_handle.io_handle,
element_ip->write_buf,
(globus_size_t) strlen(
(char *) element_ip->write_buf),
element_ip->write_callback,
(void *) handle);
if(rc != GLOBUS_SUCCESS)
{
globus_mutex_lock(&(handle->cc_handle.mutex));
{
globus_fifo_dequeue(&handle->cc_handle.writers);
globus_fifo_dequeue(&handle->cc_handle.writers);
globus_fifo_dequeue(&handle->cc_handle.writers);
handle->cc_handle.cb_count -= 3;
queue_empty=globus_fifo_empty(&handle->cc_handle.writers);
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
globus_libc_free(element_ip->write_buf);
globus_libc_free(element_ip);
globus_libc_free(element_synch->write_buf);
globus_libc_free(element_synch);
globus_libc_free(element_abor->write_buf);
globus_libc_free(element_abor);
if(queue_empty == GLOBUS_FALSE)
{
globus_i_ftp_control_write_next(handle);
}
result=rc;
goto return_error;
}
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_abort() exiting\n"));
return GLOBUS_SUCCESS;
return_error:
globus_fifo_destroy(&abort_queue);
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_abort() exiting with error\n"));
return result;
}
/* globus_ftp_control_abort() */
/**
* @brief Send a GridFTP QUIT
* @ingroup globus_ftp_control_client
* @details
* This function is used to close the control channel to the FTP server.
* There should be no transfer commands in progress when this is called.
* Once the final response callback passed to this function is invoked,
* the control handle can no longer be used for any GridFTP control
* operations.
*
* @note Need to further define behavior for when a QUIT happens
* during a transfer or command is in progress.
*
* @note Since this function waits until all other callbacks are completed
* before calling it's own callback it may not be called in a blocking
* fashion from another callback.
*
* @param handle
* A pointer to a GridFTP control handle. The quit message is
* issued to the server over the control channel
* associated with this handle.
* @param callback
* The function to be called once the authentication process is
* complete or when an error occurs.
* @param callback_arg
* User supplied argument to the callback function
* @return
* - Success
* - Null handle
* - Command in progress
*
* @par Callback errors:
* - success
* - protocol error
* - eof
*
* @par Expected callback response values:
* - 221 Service closing control connection.
* - 500 Syntax error, command unrecognized.
*
* @note The server may send other responses.
*/
globus_result_t
globus_ftp_control_quit(
globus_ftp_control_handle_t * handle,
globus_ftp_control_response_callback_t callback,
void * callback_arg)
{
globus_result_t rc;
globus_result_t result;
globus_i_ftp_passthru_cb_arg_t * quit_cb_arg;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_quit() entering\n"));
globus_mutex_lock(&(handle->cc_handle.mutex));
{
if(handle->cc_handle.cc_state != GLOBUS_FTP_CONTROL_CONNECTED)
{
globus_mutex_unlock(&(handle->cc_handle.mutex));
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_quit: Handle not connected")
);
goto return_error;
}
else
{
handle->cc_handle.close_cb = callback;
handle->cc_handle.close_cb_arg = callback_arg;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
quit_cb_arg = (globus_i_ftp_passthru_cb_arg_t *)
globus_libc_malloc(sizeof(globus_i_ftp_passthru_cb_arg_t));
if(quit_cb_arg == GLOBUS_NULL)
{
result=globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_ftp_control_quit: malloc failed")
);
goto return_error;
}
quit_cb_arg->user_cb = callback;
quit_cb_arg->user_cb_arg = callback_arg;
quit_cb_arg->cmd = GLOBUS_I_FTP_QUIT;
quit_cb_arg->handle = handle;
rc = globus_ftp_control_send_command(handle,"QUIT\r\n",
globus_l_ftp_control_send_cmd_cb,
(void *) quit_cb_arg);
if(rc != GLOBUS_SUCCESS)
{
globus_libc_free(quit_cb_arg);
result=rc;
goto return_error;
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_quit() exiting\n"));
return GLOBUS_SUCCESS;
return_error:
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_quit() exiting with error\n"));
return result;
}
/* globus_ftp_control_quit() */
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* Internal callback for the globus_ftp_control_send_cmd function.
*
* This is a internal callback used with the
* globus_ftp_control_send_cmd function which in this library is
* used in the authentication process and for sending the QUIT
* command. It checks that the command was successfully sent and based
* upon the command that was executed and the ftp reply to that
* command calls other functions.
*
* @param arg
* The callback argument, which in this case is used to pass
* the original user callback and argument.
* @param handle
* The control handle associated with the session
* @param error
* A error object containing information about any errors that
* occurred.
* @param ftp_response
* A struct containing information about the ftp reply to the
* command that was sent.
*
* @return void
*
* @par If a error is detected in this function the user callback is
* called with an appropriate error object or ftp response and
* the function returns.
*/
static gss_OID_desc gss_nt_host_ip_oid =
{ 10, "\x2b\x06\x01\x04\x01\x9b\x50\x01\x01\x02" };
static gss_OID_desc * GLOBUS_GSS_C_NT_HOST_IP = &gss_nt_host_ip_oid;
static
void
globus_l_ftp_control_send_cmd_cb(
void * callback_arg,
globus_ftp_control_handle_t * handle,
globus_object_t * error,
globus_ftp_control_response_t * ftp_response)
{
globus_result_t rc;
globus_i_ftp_passthru_cb_arg_t * cb_arg;
globus_object_t * error_obj;
globus_bool_t call_close_cb = GLOBUS_FALSE;
int len;
OM_uint32 maj_stat;
OM_uint32 min_stat;
gss_buffer_desc send_tok;
gss_buffer_desc recv_tok;
gss_buffer_desc * token_ptr;
globus_byte_t * radix_buf;
OM_uint32 max_input_size[2];
OM_uint32 pbsz;
int tmp_host[16];
int tmp_hostlen;
unsigned short tmp_port;
char * serverhost = NULL;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_send_cmd_cb() entering\n"));
cb_arg = (globus_i_ftp_passthru_cb_arg_t *) callback_arg;
if(error != GLOBUS_NULL &&
cb_arg->cmd != GLOBUS_I_FTP_QUIT)
{
error_obj=globus_object_copy(error);
goto return_error;
}
switch(cb_arg->cmd)
{
case GLOBUS_I_FTP_AUTH:
switch(ftp_response->response_class)
{
case GLOBUS_FTP_POSITIVE_INTERMEDIATE_REPLY:
/* follow AUTH with ADAT and set authentication variables
* int the control connection handle
*/
cb_arg->cmd=GLOBUS_I_FTP_ADAT;
/* Do mutual authentication */
handle->cc_handle.auth_info.req_flags |= GSS_C_MUTUAL_FLAG;
if(handle->cc_handle.auth_info.encrypt)
{
handle->cc_handle.auth_info.req_flags |= GSS_C_CONF_FLAG;
}
/* use a target_name based on either a supplied subject
* string or the remote hostname
*/
/* get the actual host we connected to */
rc = globus_io_tcp_get_remote_address_ex(
&handle->cc_handle.io_handle,
tmp_host,
&tmp_hostlen,
&tmp_port);
if(rc == GLOBUS_SUCCESS)
{
serverhost = globus_libc_ints_to_contact_string(
tmp_host,
tmp_hostlen,
0);
}
if(handle->cc_handle.auth_info.auth_gssapi_subject == NULL)
{
if(serverhost == NULL)
{
error_obj = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"No possible GSI subject. If using a non TCP "
"protocol and GSI you must specify a subject.");
goto return_error;
}
send_tok.value = globus_common_create_string(
"%s/%s",
handle->cc_handle.serverhost,
serverhost);
send_tok.length = strlen(send_tok.value);
maj_stat = gss_import_name(
&min_stat,
&send_tok,
GLOBUS_GSS_C_NT_HOST_IP,
&(handle->cc_handle.auth_info.target_name));
if(maj_stat != GSS_S_COMPLETE)
{
error_obj = globus_error_wrap_gssapi_error(
GLOBUS_FTP_CONTROL_MODULE,
maj_stat,
min_stat,
0,
__FILE__,
"globus_l_ftp_control_send_cmd_cb",
__LINE__,
"gss_import_name failed");
gss_release_buffer(&min_stat, &send_tok);
goto return_error;
}
gss_release_buffer(&min_stat, &send_tok);
}
else
{
gss_OID name_type = GSS_C_NT_USER_NAME;
if(strstr(handle->cc_handle.auth_info.auth_gssapi_subject,
"host@") ||
strstr(handle->cc_handle.auth_info.auth_gssapi_subject,
"ftp@"))
{
name_type = GSS_C_NT_HOSTBASED_SERVICE;
}
send_tok.value=handle->cc_handle.auth_info.
auth_gssapi_subject;
send_tok.length=strlen(handle->cc_handle.auth_info.
auth_gssapi_subject) + 1;
maj_stat = gss_import_name(&min_stat,
&send_tok,
name_type,
&(handle->cc_handle.auth_info.
target_name));
if(maj_stat != GSS_S_COMPLETE)
{
error_obj = globus_error_wrap_gssapi_error(
GLOBUS_FTP_CONTROL_MODULE,
maj_stat,
min_stat,
0,
__FILE__,
"globus_l_ftp_control_send_cmd_cb",
__LINE__,
"gss_import_name failed");
goto return_error;
}
}
token_ptr=GSS_C_NO_BUFFER;
/* initialize security context
*/
maj_stat = gss_init_sec_context(
&min_stat,
handle->cc_handle.auth_info.credential_handle,
&(handle->cc_handle.auth_info.
auth_gssapi_context),
handle->cc_handle.auth_info.
target_name,
GSS_C_NULL_OID,
handle->cc_handle.auth_info.
req_flags,
0,
GSS_C_NO_CHANNEL_BINDINGS,
token_ptr,
NULL,
&send_tok,
NULL,
NULL);
if(maj_stat != GSS_S_COMPLETE &&
maj_stat != GSS_S_CONTINUE_NEEDED)
{
error_obj = globus_error_wrap_gssapi_error(
GLOBUS_FTP_CONTROL_MODULE,
maj_stat,
min_stat,
0,
__FILE__,
"globus_l_ftp_control_send_cmd_cb",
__LINE__,
"gss_init_sec_context failed");
goto return_error;
}
len = send_tok.length;
/* base64 encode the token that needs to be sent to the
* server
*/
radix_buf = malloc(send_tok.length * 8 / 6 + 4);
if(radix_buf == GLOBUS_NULL)
{
gss_release_buffer(&min_stat, &send_tok);
error_obj = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
"globus_l_ftp_control_send_cmd_cb: malloc failed");
goto return_error;
}
rc = globus_i_ftp_control_radix_encode(send_tok.value,
radix_buf,
&len);
if(rc != GLOBUS_SUCCESS)
{
gss_release_buffer(&min_stat, &send_tok);
free(radix_buf);
error_obj = globus_error_get(rc);
goto return_error;
}
/* send the initial security token to the server */
rc = globus_ftp_control_send_command(
handle,"ADAT %s\r\n",
globus_l_ftp_control_send_cmd_cb,
callback_arg,radix_buf);
globus_libc_free(radix_buf);
gss_release_buffer(&min_stat, &send_tok);
if(rc != GLOBUS_SUCCESS)
{
error_obj = globus_error_get(rc);
goto return_error;
}
break;
case GLOBUS_FTP_UNKNOWN_REPLY:
case GLOBUS_FTP_POSITIVE_COMPLETION_REPLY:
case GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY:
case GLOBUS_FTP_TRANSIENT_NEGATIVE_COMPLETION_REPLY:
case GLOBUS_FTP_PERMANENT_NEGATIVE_COMPLETION_REPLY:
(cb_arg->user_cb)((cb_arg->user_cb_arg),
handle,
GLOBUS_NULL,
ftp_response);
globus_libc_free(cb_arg);
break;
}
break;
case GLOBUS_I_FTP_ADAT:
switch(ftp_response->response_class)
{
case GLOBUS_FTP_POSITIVE_INTERMEDIATE_REPLY:
/* base64 decode the reply */
ftp_response->response_buffer
[ftp_response->response_length-3]='\0';
len = strlen((const char *) ftp_response->response_buffer);
radix_buf = globus_libc_malloc((len + 1) * 6 / 8 + 1);
if(radix_buf == GLOBUS_NULL)
{
error_obj = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_l_ftp_control_send_cmd_cb: malloc failed"));
goto return_error;
}
rc = globus_i_ftp_control_radix_decode(
ftp_response->response_buffer + strlen("335 ADAT="),
radix_buf,
&len);
if(rc != GLOBUS_SUCCESS)
{
globus_libc_free(radix_buf);
error_obj = globus_error_get(rc);
goto return_error;
}
recv_tok.value = radix_buf;
recv_tok.length = len;
token_ptr = &recv_tok;
maj_stat = gss_init_sec_context(
&min_stat,
handle->cc_handle.auth_info.credential_handle,
&(handle->cc_handle.auth_info.
auth_gssapi_context),
handle->cc_handle.auth_info.
target_name,
GSS_C_NULL_OID,
handle->cc_handle.auth_info.
req_flags,
0,
GSS_C_NO_CHANNEL_BINDINGS,
token_ptr,
NULL,
&send_tok,
NULL,
NULL);
if(maj_stat != GSS_S_COMPLETE &&
maj_stat != GSS_S_CONTINUE_NEEDED)
{
error_obj = globus_error_wrap_gssapi_error(
GLOBUS_FTP_CONTROL_MODULE,
maj_stat,
min_stat,
0,
__FILE__,
"globus_l_ftp_control_send_cmd_cb",
__LINE__,
"gss_init_sec_context failed");
gss_release_buffer(&min_stat, token_ptr);
goto return_error;
}
gss_release_buffer(&min_stat, token_ptr);
len = send_tok.length;
if(len != 0)
{
radix_buf = globus_libc_malloc(send_tok.length * 8 / 6 + 4);
if(radix_buf == GLOBUS_NULL)
{
gss_release_buffer(&min_stat, &send_tok);
error_obj = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_l_ftp_control_send_cmd_cb: malloc failed"));
goto return_error;
}
rc = globus_i_ftp_control_radix_encode(send_tok.value,
radix_buf,
&len);
if(rc != GLOBUS_SUCCESS)
{
globus_libc_free(radix_buf);
gss_release_buffer(&min_stat, &send_tok);
error_obj = globus_error_get(rc);
goto return_error;
}
rc = globus_ftp_control_send_command(
handle,"ADAT %s\r\n",
globus_l_ftp_control_send_cmd_cb,
callback_arg,radix_buf);
globus_libc_free(radix_buf);
gss_release_buffer(&min_stat, &send_tok);
if(rc != GLOBUS_SUCCESS)
{
error_obj = globus_error_get(rc);
goto return_error;
}
}
else
{
error_obj = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_l_ftp_control_send_cmd_cb: gss_init_sec_context failed to generate output token\n"));
goto return_error;
}
break;
case GLOBUS_FTP_POSITIVE_COMPLETION_REPLY:
cb_arg->cmd=GLOBUS_I_FTP_USER;
/* base64 decode the reply */
if(!strncmp((const char *) ftp_response->response_buffer,
"235 ADAT=", 8))
{
ftp_response->response_buffer
[ftp_response->response_length-3]='\0';
len = strlen((char *) ftp_response->response_buffer);
radix_buf = malloc((len + 1) * 6 / 8 + 1);
if(radix_buf == GLOBUS_NULL)
{
error_obj = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_l_ftp_control_send_cmd_cb: malloc failed"));
goto return_error;
}
rc = globus_i_ftp_control_radix_decode(
ftp_response->response_buffer + strlen("235 ADAT="),
radix_buf,
&len);
if(rc != GLOBUS_SUCCESS)
{
globus_libc_free(radix_buf);
error_obj = globus_error_get(rc);
goto return_error;
}
recv_tok.value = radix_buf;
recv_tok.length = len;
token_ptr = &recv_tok;
maj_stat = gss_init_sec_context(
&min_stat,
handle->cc_handle.auth_info.credential_handle,
&(handle->cc_handle.auth_info.
auth_gssapi_context),
handle->cc_handle.auth_info.
target_name,
GSS_C_NULL_OID,
handle->cc_handle.auth_info.
req_flags,
0,
GSS_C_NO_CHANNEL_BINDINGS,
token_ptr,
NULL,
&send_tok,
NULL,
NULL);
if(maj_stat != GSS_S_COMPLETE)
{
error_obj = globus_error_wrap_gssapi_error(
GLOBUS_FTP_CONTROL_MODULE,
maj_stat,
min_stat,
0,
__FILE__,
"globus_l_ftp_control_send_cmd_cb",
__LINE__,
_FCSL("gss_init_sec_context failed"));
gss_release_buffer(&min_stat, token_ptr);
goto return_error;
}
gss_release_buffer(&min_stat, token_ptr);
if(send_tok.length != 0)
{
error_obj = globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_l_ftp_control_send_cmd_cb: gss_init_sec_context generated unexpected output token\n"));
gss_release_buffer(&min_stat, &send_tok);
goto return_error;
}
}
globus_mutex_lock(&(handle->cc_handle.mutex));
{
handle->cc_handle.auth_info.authenticated = GLOBUS_TRUE;
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
gss_wrap_size_limit(
&min_stat,
handle->cc_handle.auth_info.auth_gssapi_context,
0,
GSS_C_QOP_DEFAULT,
1<<30,
&max_input_size[0]);
gss_wrap_size_limit(
&min_stat,
handle->cc_handle.auth_info.auth_gssapi_context,
1,
GSS_C_QOP_DEFAULT,
1<<30,
&max_input_size[1]);
/* establish a max of 1M. This is only necessary because some
* naive implementations will attempt to allocate this entire
* buffer all at once (read: wuftp)
*/
pbsz = 1024 *1024;
if(max_input_size[0] < pbsz)
{
pbsz = max_input_size[0];
}
if(max_input_size[1] && max_input_size[1] < pbsz)
{
pbsz = max_input_size[1];
}
globus_ftp_control_local_pbsz(handle, pbsz);
/* copy actual host into handle */
rc = globus_io_tcp_get_remote_address_ex(
&handle->cc_handle.io_handle,
tmp_host,
&tmp_hostlen,
&tmp_port);
if(rc == GLOBUS_SUCCESS)
{
serverhost = globus_libc_ints_to_contact_string(
tmp_host,
tmp_hostlen,
0);
if(serverhost)
{
strncpy(handle->cc_handle.serverhost,
serverhost, sizeof(handle->cc_handle.serverhost));
handle->cc_handle.serverhost[
sizeof(handle->cc_handle.serverhost) - 1] = 0;
}
}
if(handle->cc_handle.auth_info.user != GLOBUS_NULL)
{
rc = globus_ftp_control_send_command(
handle,
"USER %s\r\n",
globus_l_ftp_control_send_cmd_cb,
callback_arg,
handle->cc_handle.auth_info.user);
}
else
{
rc = globus_ftp_control_send_command(
handle,
"USER :globus-mapping:\r\n",
globus_l_ftp_control_send_cmd_cb,
callback_arg);
}
if(rc != GLOBUS_SUCCESS)
{
error_obj = globus_error_get(rc);
goto return_error;
}
break;
case GLOBUS_FTP_UNKNOWN_REPLY:
case GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY:
case GLOBUS_FTP_TRANSIENT_NEGATIVE_COMPLETION_REPLY:
case GLOBUS_FTP_PERMANENT_NEGATIVE_COMPLETION_REPLY:
(cb_arg->user_cb)((cb_arg->user_cb_arg),
handle,
GLOBUS_NULL,
ftp_response);
globus_libc_free(cb_arg);
break;
}
break;
case GLOBUS_I_FTP_USER:
switch(ftp_response->response_class)
{
case GLOBUS_FTP_POSITIVE_INTERMEDIATE_REPLY:
ugly_hack:
cb_arg->cmd=GLOBUS_I_FTP_PASS;
if(handle->cc_handle.auth_info.password != GLOBUS_NULL)
{
rc = globus_ftp_control_send_command(
handle,
"PASS %s\r\n",
globus_l_ftp_control_send_cmd_cb,
callback_arg,
handle->cc_handle.auth_info.password);
}
else
{
rc = globus_ftp_control_send_command(
handle,
"PASS dummy\r\n",
globus_l_ftp_control_send_cmd_cb,
callback_arg);
}
if(rc != GLOBUS_SUCCESS)
{
error_obj = globus_error_get(rc);
goto return_error;
}
break;
case GLOBUS_FTP_POSITIVE_COMPLETION_REPLY:
if(handle->cc_handle.auth_info.authenticated == GLOBUS_TRUE)
{
goto ugly_hack;
}
case GLOBUS_FTP_UNKNOWN_REPLY:
case GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY:
case GLOBUS_FTP_TRANSIENT_NEGATIVE_COMPLETION_REPLY:
case GLOBUS_FTP_PERMANENT_NEGATIVE_COMPLETION_REPLY:
(cb_arg->user_cb)((cb_arg->user_cb_arg),
handle,
GLOBUS_NULL,
ftp_response);
globus_libc_free(callback_arg);
break;
}
break;
case GLOBUS_I_FTP_PASS:
switch(ftp_response->response_class)
{
case GLOBUS_FTP_POSITIVE_INTERMEDIATE_REPLY:
cb_arg->cmd=GLOBUS_I_FTP_ACCT;
if(handle->cc_handle.auth_info.account != GLOBUS_NULL)
{
rc = globus_ftp_control_send_command(
handle,"ACCT %s\r\n",
globus_l_ftp_control_send_cmd_cb,
callback_arg,
handle->cc_handle.auth_info.account);
}
else
{
(cb_arg->user_cb)((cb_arg->user_cb_arg),
handle,
GLOBUS_NULL,
ftp_response);
globus_libc_free(callback_arg);
break;
}
if(rc != GLOBUS_SUCCESS)
{
error_obj = globus_error_get(rc);
goto return_error;
}
break;
case GLOBUS_FTP_UNKNOWN_REPLY:
case GLOBUS_FTP_POSITIVE_PRELIMINARY_REPLY:
case GLOBUS_FTP_POSITIVE_COMPLETION_REPLY:
case GLOBUS_FTP_TRANSIENT_NEGATIVE_COMPLETION_REPLY:
case GLOBUS_FTP_PERMANENT_NEGATIVE_COMPLETION_REPLY:
(cb_arg->user_cb)((cb_arg->user_cb_arg),
handle,
GLOBUS_NULL,
ftp_response);
globus_libc_free(callback_arg);
break;
}
break;
case GLOBUS_I_FTP_QUIT:
if(ftp_response != GLOBUS_NULL)
{
rc=globus_ftp_control_response_copy(
ftp_response,
&handle->cc_handle.quit_response);
if(rc != GLOBUS_SUCCESS){
error_obj = globus_error_get(rc);
goto return_error;
}
}
globus_mutex_lock(&(handle->cc_handle.mutex));
if(handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_CONNECTED)
{
handle->cc_handle.cc_state = GLOBUS_FTP_CONTROL_CLOSING;
handle->cc_handle.cb_count++;
globus_mutex_unlock(&(handle->cc_handle.mutex));
rc=globus_ftp_control_data_force_close(
handle,
globus_l_ftp_control_data_close_cb,
(void *) handle);
if(rc != GLOBUS_SUCCESS)
{
rc=globus_io_register_close(&handle->cc_handle.io_handle,
globus_l_ftp_control_close_cb,
(void *) handle);
if(rc != GLOBUS_SUCCESS)
{
globus_mutex_lock(&(handle->cc_handle.mutex));
{
handle->cc_handle.cb_count--;
handle->cc_handle.close_result =
globus_error_get(rc);
if(!handle->cc_handle.cb_count)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(handle);
}
}
}
}
else
{
globus_mutex_unlock(&(handle->cc_handle.mutex));
(cb_arg->user_cb)((cb_arg->user_cb_arg),
handle,
GLOBUS_NULL,
ftp_response);
}
globus_libc_free(cb_arg);
break;
default:
break;
}
if(serverhost)
{
globus_free(serverhost);
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_send_cmd_cb() exiting\n"));
return;
return_error:
(cb_arg->user_cb)((cb_arg->user_cb_arg),
handle,
error_obj,
GLOBUS_NULL);
globus_object_free(error_obj);
globus_libc_free(callback_arg);
if(serverhost)
{
globus_free(serverhost);
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_send_cmd_cb() exiting with error\n"));
return;
}
/**
* Internal callback for the globus_ftp_control_data[_force]_close
* function.
*
* This is an internal callback used as part of the
* globus_ftp_control[_force]_close function. It checks the result of
* the close and calls either globus_io_register_close on the control
* connection or the user callback if the connection is already closed.
*
* @param arg
* The callback argument, which in this case is used to pass
* the original user callback and argument.
* @param handle
* The handle for the ftp connection.
* @param error
* The result of the close operation
*
* @return void
*
* @par If a error is detected in this function the user callback is
* called with an appropriate error object or ftp response and
* the function returns.
*/
static
void
globus_l_ftp_control_data_close_cb(
void * arg,
globus_ftp_control_handle_t * handle,
globus_object_t * error)
{
globus_result_t rc;
globus_bool_t call_close_cb = GLOBUS_FALSE;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_data_close_cb() entering\n"));
rc=globus_io_register_close(&handle->cc_handle.io_handle,
globus_l_ftp_control_close_cb,
arg);
if(rc != GLOBUS_SUCCESS)
{
globus_mutex_lock(&(handle->cc_handle.mutex));
{
handle->cc_handle.cb_count--;
handle->cc_handle.close_result =
globus_error_get(rc);
if(!handle->cc_handle.cb_count)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(handle);
}
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_data_close_cb() exiting\n"));
return;
}
/* globus_l_ftp_control_data_close_cb() */
/**
* Internal callback for the globus_io_register_close function.
*
* This is an internal callback used as part of the
* globus_ftp_control_quit function. It checks the result of the close
* and calls the user callback with the response of to the quit.
*
* @param arg
* The callback argument, which in this case is used to pass
* the original user callback and argument.
* @param handle
* The globus_io handle for the connection. In practice this
* represents the socket fd for the connection.
* @param result
* The result of the close operation
*
* @return void
*
* @par If a error is detected in this function the user callback is
* called with an appropriate error object or ftp response and
* the function returns.
*/
static
void
globus_l_ftp_control_close_cb(
void * arg,
globus_io_handle_t * handle,
globus_result_t result)
{
globus_ftp_cc_handle_t * cc_handle;
globus_ftp_control_handle_t * c_handle;
globus_bool_t call_close_cb = GLOBUS_FALSE;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_close_cb() entering\n"));
c_handle=(globus_ftp_control_handle_t *) arg;
cc_handle=&(c_handle->cc_handle);
globus_mutex_lock(&cc_handle->mutex);
{
cc_handle->cb_count--;
if(!cc_handle->cb_count)
{
call_close_cb = GLOBUS_TRUE;
}
cc_handle->close_result = globus_error_get(result);
}
globus_mutex_unlock(&cc_handle->mutex);
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(c_handle);
}
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_l_ftp_control_close_cb() exiting\n"));
return;
}
/* globus_l_ftp_control_close_cb() */
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
/**
* @brief Force a control connection to close
* @ingroup globus_ftp_control_client
* @details
* Force a close of the control connection without waiting for
* outstanding commands to complete and without sending QUIT.
*
* This function is used to close the control channel to the FTP server.
* Once the final response callback passed to this function is invoked,
* the control handle can no longer be used for any GridFTP control
* operations.
*
* @note Since this function waits until all other callbacks are completed
* before calling it's own callback it may not be called in a blocking
* fashion from another callback.
*
* @param handle
* A pointer to a GridFTP control handle. The quit message is
* issued to the server over the control channel
* associated with this handle.
* @param callback
* The function to be called once the authentication process is
* complete or when an error occurs.
* @param callback_arg
* User supplied argument to the callback function
* @return
* - Success
* - Null handle
*
* @par Callback errors:
* - success
* - failure
*
* @par Expected callback response values:
* - GLOBUS_NULL
*
*/
globus_result_t
globus_ftp_control_force_close(
globus_ftp_control_handle_t * handle,
globus_ftp_control_response_callback_t callback,
void * callback_arg)
{
globus_result_t rc;
globus_bool_t connected;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_force_close() entering\n"));
globus_mutex_lock(&(handle->cc_handle.mutex));
{
if(handle->cc_handle.cc_state != GLOBUS_FTP_CONTROL_CONNECTED &&
handle->cc_handle.cc_state != GLOBUS_FTP_CONTROL_CONNECTING)
{
rc = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_ftp_control_force_close: Handle is not connected"))
);
goto return_error;
}
else
{
if(handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_CONNECTED)
{
connected = GLOBUS_TRUE;
}
else
{
connected = GLOBUS_FALSE;
}
handle->cc_handle.close_cb = callback;
handle->cc_handle.close_cb_arg = callback_arg;
handle->cc_handle.cc_state = GLOBUS_FTP_CONTROL_CLOSING;
handle->cc_handle.cb_count++;
}
if(connected)
{
rc=globus_ftp_control_data_force_close(
handle,
globus_l_ftp_control_data_close_cb,
(void *) handle);
}
if(!connected || rc != GLOBUS_SUCCESS)
{
rc=globus_io_register_close(&handle->cc_handle.io_handle,
globus_l_ftp_control_close_cb,
(void *) handle);
if(rc != GLOBUS_SUCCESS)
{
globus_i_ftp_control_auth_info_destroy(
&(handle->cc_handle.auth_info));
handle->cc_handle.cb_count--;
handle->cc_handle.cc_state = GLOBUS_FTP_CONTROL_UNCONNECTED;
goto return_error;
}
}
if(globus_l_ftp_cc_deactivated)
{
handle->cc_handle.signal_deactivate = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_force_close() exiting\n"));
return GLOBUS_SUCCESS;
return_error:
globus_mutex_unlock(&(handle->cc_handle.mutex));
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_ftp_control_force_close() exiting with error\n"));
return rc;
}
/* globus_ftp_control_force_close() */
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* Internal helper function which creates and initializes a
* authentication information structure
*
* This is internal helper function allocates memory for a
* auth_info_t structure and initializes it with the values contained
* in the second argument
*
* @param dest
* This parameter is used to return the new response struct.
* @param src
* A auth_info_t containing the values to initialize dest
* with.
* @return
* - Error object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_i_ftp_control_auth_info_init(
globus_ftp_control_auth_info_t * dest,
globus_ftp_control_auth_info_t * src)
{
if(dest == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_auth_info_init: Destination argument is NULL"))
);
}
if(src == GLOBUS_NULL)
{
memset((void *) dest, 0, sizeof(globus_ftp_control_auth_info_t));
}
else
{
dest->credential_handle = src->credential_handle;
dest->locally_acquired_credential = GLOBUS_FALSE;
if(src->auth_gssapi_subject != GLOBUS_NULL)
{
dest->auth_gssapi_subject =
globus_libc_strdup(src->auth_gssapi_subject);
}
else
{
dest->auth_gssapi_subject = GLOBUS_NULL;
}
if(src->user != GLOBUS_NULL)
{
dest->user = globus_libc_strdup(src->user);
}
else
{
dest->user = GLOBUS_NULL;
}
if(src->password != GLOBUS_NULL)
{
dest->password = globus_libc_strdup(src->password);
}
else
{
dest->password = GLOBUS_NULL;
}
if(src->account != GLOBUS_NULL)
{
dest->account = globus_libc_strdup(src->account);
}
else
{
dest->account = GLOBUS_NULL;
}
dest->delegated_credential_handle = GSS_C_NO_CREDENTIAL;
dest->encrypt = src->encrypt;
}
dest->prev_cmd=GLOBUS_FTP_CONTROL_COMMAND_UNKNOWN;
dest->auth_gssapi_context = GSS_C_NO_CONTEXT;
dest->req_flags = 0;
dest->target_name = GSS_C_NO_NAME;
dest->authenticated = GLOBUS_FALSE;
return GLOBUS_SUCCESS;
}
/* globus_i_ftp_control_auth_info_init() */
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
/**
* @brief Initialize authentication information
* @ingroup globus_ftp_control_client
* @details
* This is helper function initializes a authentication information
* structure with the values contained in the second to fifth arguments,
* which may be GLOBUS_NULL. No memory is allocated in this function.
*
* @param auth_info
* The authentication structure to initialize.
* @param credential_handle
* The credential to use for authentication. This may be
* GSS_C_NO_CREDENTIAL to use the user's default credential.
* @param encrypt
* Boolean whether or not to encrypt the control channel for this
* handle.
* @param user
* The user name
* @param password
* The password for the user name
* @param account
* The account for the user name/password
* @param subject
* The GSSAPI subject name
* @return
* - Error object
* - GLOBUS_SUCCESS
*/
globus_result_t
globus_ftp_control_auth_info_init(
globus_ftp_control_auth_info_t * auth_info,
gss_cred_id_t credential_handle,
globus_bool_t encrypt,
char * user,
char * password,
char * account,
char * subject)
{
if(auth_info == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_ftp_control_auth_info_init: auth_info argument is NULL"))
);
}
if(credential_handle != GLOBUS_NULL)
{
auth_info->credential_handle = credential_handle;
}
else
{
auth_info->credential_handle = GSS_C_NO_CREDENTIAL;
}
auth_info->auth_gssapi_subject = subject;
auth_info->user = user;
auth_info->password = password;
auth_info->account = account;
auth_info->prev_cmd=GLOBUS_FTP_CONTROL_COMMAND_UNKNOWN;
auth_info->auth_gssapi_context = GSS_C_NO_CONTEXT;
auth_info->req_flags = 0;
auth_info->target_name = GSS_C_NO_NAME;
auth_info->authenticated = GLOBUS_FALSE;
auth_info->locally_acquired_credential = GLOBUS_FALSE;
auth_info->delegated_credential_handle = GSS_C_NO_CREDENTIAL;
auth_info->encrypt = encrypt;
return GLOBUS_SUCCESS;
}
/* globus_ftp_control_auth_info_init() */
/**
* @brief Compare authentication information
* @ingroup globus_ftp_control_client
* @details
* This is helper function compares two authentication information
* structures and return zero if the two structures are deemed equal
* and a non-zero value otherwise.
*
* @param auth_info_1
* The first authentication structure
* @param auth_info_2
* The second authentication structure
* @return
* - 0 if the structures are equal
* - !0 if the structures differ or an error occurred
*
*/
int
globus_ftp_control_auth_info_compare(
globus_ftp_control_auth_info_t * auth_info_1,
globus_ftp_control_auth_info_t * auth_info_2)
{
if(auth_info_1 == GLOBUS_NULL)
{
return -1;
}
if(auth_info_2 == GLOBUS_NULL)
{
return -1;
}
if(auth_info_1->auth_gssapi_subject != GLOBUS_NULL &&
auth_info_2->auth_gssapi_subject != GLOBUS_NULL )
{
if(strcmp(auth_info_1->auth_gssapi_subject,
auth_info_2->auth_gssapi_subject))
{
return -1;
}
}
else if(auth_info_1->auth_gssapi_subject != GLOBUS_NULL ||
auth_info_2->auth_gssapi_subject != GLOBUS_NULL)
{
return -1;
}
if(auth_info_1->credential_handle != GSS_C_NO_CREDENTIAL &&
auth_info_2->credential_handle != GSS_C_NO_CREDENTIAL)
{
if(auth_info_1->credential_handle !=
auth_info_2->credential_handle)
{
return -1;
}
}
else if((auth_info_1->locally_acquired_credential != GLOBUS_TRUE &&
auth_info_1->credential_handle != GSS_C_NO_CREDENTIAL &&
auth_info_2->credential_handle == GSS_C_NO_CREDENTIAL) ||
(auth_info_1->credential_handle == GSS_C_NO_CREDENTIAL &&
auth_info_2->locally_acquired_credential != GLOBUS_TRUE &&
auth_info_2->credential_handle != GSS_C_NO_CREDENTIAL))
{
return -1;
}
if(auth_info_1->user != GLOBUS_NULL &&
auth_info_2->user != GLOBUS_NULL )
{
if(strcmp(auth_info_1->user,
auth_info_2->user))
{
return -1;
}
}
else if(auth_info_1->user != GLOBUS_NULL ||
auth_info_2->user != GLOBUS_NULL)
{
return -1;
}
if(auth_info_1->password != GLOBUS_NULL &&
auth_info_2->password != GLOBUS_NULL )
{
if(strcmp(auth_info_1->password,
auth_info_2->password))
{
return -1;
}
}
else if(auth_info_1->password != GLOBUS_NULL ||
auth_info_2->password != GLOBUS_NULL)
{
return -1;
}
if(auth_info_1->account != GLOBUS_NULL &&
auth_info_2->account != GLOBUS_NULL )
{
if(strcmp(auth_info_1->account,
auth_info_2->account))
{
return -1;
}
}
else if(auth_info_1->account != GLOBUS_NULL ||
auth_info_2->account != GLOBUS_NULL)
{
return -1;
}
return 0;
}
/* globus_ftp_control_auth_info_compare() */
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
/**
* Internal helper function which frees the memory associated with a
* auth_info_t structure.
*
* This is a internal helper function frees the memory associated with
* a auth_info_t structure.
*
* @param auth_info
* This parameter indicates the auth_info structure to destroy
* and is used to set the pointer to the auth_info structure to
* GLOBUS_NULL
*
* @return
* - Error object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_i_ftp_control_auth_info_destroy(
globus_ftp_control_auth_info_t * auth_info)
{
OM_uint32 major_status;
OM_uint32 minor_status;
if( auth_info != GLOBUS_NULL)
{
if(auth_info->auth_gssapi_subject != GLOBUS_NULL)
{
globus_libc_free(auth_info->auth_gssapi_subject);
auth_info->auth_gssapi_subject=GLOBUS_NULL;
}
if(auth_info->user != GLOBUS_NULL)
{
globus_libc_free(auth_info->user);
auth_info->user=GLOBUS_NULL;
}
if(auth_info->password != GLOBUS_NULL)
{
globus_libc_free(auth_info->password);
auth_info->password=GLOBUS_NULL;
}
if(auth_info->account != GLOBUS_NULL)
{
globus_libc_free(auth_info->account);
auth_info->account=GLOBUS_NULL;
}
if(auth_info->target_name != GSS_C_NO_NAME)
{
major_status=gss_release_name(&minor_status,
&(auth_info->target_name));
auth_info->target_name = GSS_C_NO_NAME;
if(major_status == GSS_S_FAILURE)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_auth_info_destroy: gss_release_name failed"))
);
}
}
if(auth_info->authenticated == GLOBUS_TRUE
&& auth_info->auth_gssapi_context != GSS_C_NO_CONTEXT)
{
major_status=gss_delete_sec_context(&minor_status,
&(auth_info->
auth_gssapi_context),
GLOBUS_NULL);
auth_info->auth_gssapi_context = GSS_C_NO_CONTEXT;
if(major_status == GSS_S_FAILURE)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_auth_info_destroy: Failed to delete security context"))
);
}
}
if(auth_info->credential_handle != GSS_C_NO_CREDENTIAL &&
auth_info->locally_acquired_credential)
{
major_status=gss_release_cred(&minor_status,
&(auth_info->credential_handle));
auth_info->credential_handle = GSS_C_NO_CREDENTIAL;
auth_info->locally_acquired_credential = GLOBUS_FALSE;
if(major_status == GSS_S_FAILURE)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_auth_info_destroy: gss_release_cred failed"))
);
}
}
if(auth_info->delegated_credential_handle != GSS_C_NO_CREDENTIAL)
{
major_status=gss_release_cred(&minor_status,
&(auth_info->delegated_credential_handle));
auth_info->delegated_credential_handle = GSS_C_NO_CREDENTIAL;
}
auth_info->authenticated = GLOBUS_FALSE;
}
return GLOBUS_SUCCESS;
}
/* globus_i_ftp_control_auth_info_destroy() */
static char *radixN =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static char pad = '=';
/**
* Internal helper function which base64 encodes a given input
*
* This is a internal helper function base64 encodes the first
* "length" bytes of the given in-buffer and writes the result to the
* out-buffer . This function assumes that the out-buffer is large
* enough to contain the encoded in-buffer. The length of the encoded
* inbuf is returned through the length parameter.
*
* @param inbuf
* The input buffer to encode
* @param outbuf
* The buffer in which the encoded input buffer is stored
* @param length
* Initially the length of the input. Used to return the length
* of the output.
*
* @return
* - Error object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_i_ftp_control_radix_encode(
unsigned char * inbuf,
unsigned char * outbuf,
int * length)
{
int i;
int j;
unsigned char c;
for (i=0,j=0; i < *length; i++)
{
switch (i%3)
{
case 0:
outbuf[j++] = radixN[inbuf[i]>>2];
c = (inbuf[i]&3)<<4;
break;
case 1:
outbuf[j++] = radixN[c|inbuf[i]>>4];
c = (inbuf[i]&15)<<2;
break;
case 2:
outbuf[j++] = radixN[c|inbuf[i]>>6];
outbuf[j++] = radixN[inbuf[i]&63];
c = 0;
}
}
if (i%3)
{
outbuf[j++] = radixN[c];
}
switch (i%3)
{
case 1:
outbuf[j++] = pad;
case 2:
outbuf[j++] = pad;
}
outbuf[*length = j] = '\0';
return GLOBUS_SUCCESS;
}
/* globus_i_ftp_control_radix_encode() */
/**
* Internal helper function which base64 decodes a given input
*
* This is a internal helper function base64 decodes the given
* in-buffer and writes the result to the out-buffer . This function
* assumes that the out-buffer is large enough to contain the decoded
* in-buffer. The length of the decoded inbuf is returned through
* the length parameter.
*
* @param inbuf
* The input buffer to decode
* @param outbuf
* The buffer in which the decoded input buffer is stored
* @param length
* Used to return the length of the output.
*
* @return
* - Error Object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_i_ftp_control_radix_decode(
unsigned char * inbuf,
unsigned char * outbuf,
int * length)
{
int i;
int j;
int D;
char * p;
for (i=0,j=0; inbuf[i] && inbuf[i] != pad; i++)
{
if ((p = strchr(radixN, inbuf[i])) == NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_radix_decode: Character not in charset"))
);
}
D = p - radixN;
switch (i&3)
{
case 0:
outbuf[j] = D<<2;
break;
case 1:
outbuf[j++] |= D>>4;
outbuf[j] = (D&15)<<4;
break;
case 2:
outbuf[j++] |= D>>2;
outbuf[j] = (D&3)<<6;
break;
case 3:
outbuf[j++] |= D;
}
}
switch (i&3)
{
case 1:
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_radix_decode: Padding error"))
);
case 2:
if (D&15)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_radix_decode: Padding error"))
);
}
if (strcmp((char *)&inbuf[i], "=="))
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_radix_decode: Padding error"))
);
}
break;
case 3:
if (D&3)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_radix_decode: Padding error"))
);
}
if (strcmp((char *)&inbuf[i], "="))
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_radix_decode: Padding error"))
);
}
}
*length = j;
return GLOBUS_SUCCESS;
}
/* globus_i_ftp_control_radix_decode() */
/**
* Internal helper function which gss wraps, base 64 encodes and puts
* a MIC in front of the encoded string
*
* @param cc_handle
* A control connection handle.
* @param cmd
* A string representing the command to encode.
* @param encoded_cmd
* Used to return the encoded command. Memory for the encoded
* command is allocated in this function.
*
* @return
* - Error object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_i_ftp_control_encode_command(
globus_ftp_cc_handle_t * cc_handle,
char * cmd,
char ** encoded_cmd)
{
gss_buffer_desc in_buf;
gss_buffer_desc out_buf;
OM_uint32 maj_stat;
OM_uint32 min_stat;
int conf_state;
int length;
if(cc_handle == GLOBUS_NULL ||
cmd == GLOBUS_NULL ||
encoded_cmd == GLOBUS_NULL)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_encode_command: NULL argument detected"))
);
}
in_buf.value = cmd;
in_buf.length = strlen(cmd);
maj_stat = gss_wrap(&min_stat,
cc_handle->auth_info.auth_gssapi_context,
0,
GSS_C_QOP_DEFAULT,
&in_buf,
&conf_state,
&out_buf);
if(maj_stat != GSS_S_COMPLETE)
{
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_encode_command: gss_wrap failed"))
);
}
*encoded_cmd = (char *) globus_libc_malloc((out_buf.length + 3) * 8 / 6 + 9);
if(*encoded_cmd == GLOBUS_NULL)
{
gss_release_buffer(&min_stat, &out_buf);
return globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_encode_command: malloc failed"))
);
}
if(conf_state == 0)
{
(*encoded_cmd)[0]='M';
(*encoded_cmd)[1]='I';
(*encoded_cmd)[2]='C';
(*encoded_cmd)[3]=' ';
}
else
{
(*encoded_cmd)[0]='E';
(*encoded_cmd)[1]='N';
(*encoded_cmd)[2]='C';
(*encoded_cmd)[3]=' ';
}
length = out_buf.length;
globus_i_ftp_control_radix_encode(out_buf.value,
(unsigned char *) &((*encoded_cmd)[4]),
&length);
(*encoded_cmd)[length+4]='\r';
(*encoded_cmd)[length+5]='\n';
(*encoded_cmd)[length+6]='\0';
gss_release_buffer(&min_stat, &out_buf);
return GLOBUS_SUCCESS;
}
/* globus_i_ftp_control_encode_command() */
/**
* Internal helper function which sets up a list for keeping track of
* control connection handles and which opens /dev/null which is used
* for checking the length of commands and responses.
*
* Internal helper function which sets up a list for keeping track of
* control connection handles and which opens /dev/null which is used
* for checking the length of commands and responses.
*
*
* @return
* - Error object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_i_ftp_control_client_activate(void)
{
globus_result_t result;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_i_ftp_control_client_activate() entering\n"));
globus_module_activate(GLOBUS_GSI_GSS_ASSIST_MODULE);
globus_mutex_init(
&(globus_l_ftp_cc_handle_list_mutex), GLOBUS_NULL);
globus_cond_init(
&(globus_l_ftp_cc_handle_list_cond), GLOBUS_NULL);
globus_l_ftp_cc_handle_signal_count = 0;
#ifndef TARGET_ARCH_WIN32
globus_i_ftp_control_devnull=fopen("/dev/null","w");
#else
globus_i_ftp_control_devnull=fopen("NUL","w");
#endif
if (globus_i_ftp_control_devnull == NULL)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_i_ftp_control_client_activate: Failed to open /dev/null"))
);
goto return_error;
}
globus_l_ftp_cc_deactivated = GLOBUS_FALSE;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_i_ftp_control_client_activate() exiting\n"));
return GLOBUS_SUCCESS;
return_error:
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_i_ftp_control_client_activate() exiting with error\n"));
return result;
}
/**
*
* Internal helper function which deactivates any control connections
*
* Internal helper function which goes through a list of control
* connection handles, closes any open connections associated with the
* handles and deallocates any memory allocated to these handles. It
* also closes /dev/null
*
* @return
* - Error Object
* - GLOBUS_SUCCESS
*
*/
globus_result_t
globus_i_ftp_control_client_deactivate(void)
{
globus_ftp_control_handle_t * handle;
globus_list_t * tmp;
globus_result_t result;
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_i_ftp_control_client_deactivate() entering\n"));
globus_l_ftp_cc_deactivated = GLOBUS_TRUE;
globus_mutex_lock(&globus_l_ftp_cc_handle_list_mutex);
{
tmp = globus_l_ftp_cc_handle_list;
while(!globus_list_empty(tmp))
{
handle = (globus_ftp_control_handle_t *) globus_list_first(tmp);
tmp = globus_list_rest(tmp);
result = globus_ftp_control_force_close(
handle, GLOBUS_NULL, GLOBUS_NULL);
if(result != GLOBUS_SUCCESS)
{
globus_mutex_lock(&handle->cc_handle.mutex);
{
switch(handle->cc_handle.cc_state)
{
case GLOBUS_FTP_CONTROL_UNCONNECTED:
/* handle ready to be destroyed */
break;
case GLOBUS_FTP_CONTROL_CLOSING:
/* close already in progress */
globus_l_ftp_cc_handle_signal_count++;
handle->cc_handle.signal_deactivate = GLOBUS_TRUE;
break;
case GLOBUS_FTP_CONTROL_CONNECTED:
case GLOBUS_FTP_CONTROL_CONNECTING:
handle->cc_handle.cc_state =
GLOBUS_FTP_CONTROL_CLOSING;
if(handle->cc_handle.cb_count)
{
globus_l_ftp_cc_handle_signal_count++;
handle->cc_handle.signal_deactivate = GLOBUS_TRUE;
}
break;
default:
break;
}
}
globus_mutex_unlock(&handle->cc_handle.mutex);
}
else
{
globus_l_ftp_cc_handle_signal_count++;
}
}
while(globus_l_ftp_cc_handle_signal_count > 0)
{
globus_cond_wait(
&globus_l_ftp_cc_handle_list_cond,
&globus_l_ftp_cc_handle_list_mutex);
}
while(!globus_list_empty(globus_l_ftp_cc_handle_list))
{
handle = (globus_ftp_control_handle_t *) globus_list_remove(
&globus_l_ftp_cc_handle_list, globus_l_ftp_cc_handle_list);
if(handle->cc_handle.cc_state != GLOBUS_FTP_CONTROL_UNCONNECTED)
{
globus_io_close(&handle->cc_handle.io_handle);
globus_i_ftp_control_auth_info_destroy(
&handle->cc_handle.auth_info);
}
if(handle->cc_handle.response.response_buffer)
{
globus_libc_free(handle->cc_handle.response.response_buffer);
}
globus_mutex_destroy(&handle->cc_handle.mutex);
globus_libc_free(handle->cc_handle.read_buffer);
globus_ftp_control_response_destroy(&handle->cc_handle.quit_response);
if(handle->cc_handle.close_result)
{
globus_object_free(handle->cc_handle.close_result);
}
}
}
globus_mutex_unlock(&globus_l_ftp_cc_handle_list_mutex);
globus_mutex_destroy(&globus_l_ftp_cc_handle_list_mutex);
globus_cond_destroy(&globus_l_ftp_cc_handle_list_cond);
fclose(globus_i_ftp_control_devnull);
globus_module_deactivate(GLOBUS_GSI_GSS_ASSIST_MODULE);
globus_i_ftp_control_debug_printf(1,
(stderr, "globus_i_ftp_control_client_deactivate() exiting\n"));
return GLOBUS_SUCCESS;
}
/* globus_i_ftp_control_client_deactivate() */
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
globus_result_t
globus_ftp_control_client_get_connection_info(
globus_ftp_control_handle_t * handle,
int localhost[4],
unsigned short * localport,
int remotehost[4],
unsigned short * remoteport)
{
globus_result_t result =
globus_error_put(GLOBUS_ERROR_NO_INFO);
globus_mutex_lock(&(handle->cc_handle.mutex));
{
if(handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_CONNECTED)
{
if(localhost != GLOBUS_NULL &&
localport != GLOBUS_NULL)
{
result = globus_io_tcp_get_local_address(
&handle->cc_handle.io_handle,
localhost,
localport);
}
if(remotehost != GLOBUS_NULL &&
remoteport != GLOBUS_NULL)
{
result = globus_io_tcp_get_remote_address(
&handle->cc_handle.io_handle,
remotehost,
remoteport);
}
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
return result;
}
/**
* @brief Not documented yet
* @ingroup globus_ftp_control_client
*/
globus_result_t
globus_ftp_control_client_get_connection_info_ex(
globus_ftp_control_handle_t * handle,
globus_ftp_control_host_port_t * local_info,
globus_ftp_control_host_port_t * remote_info)
{
globus_result_t result =
globus_error_put(GLOBUS_ERROR_NO_INFO);
globus_mutex_lock(&(handle->cc_handle.mutex));
{
if(handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_CONNECTED)
{
if(local_info)
{
result = globus_io_tcp_get_local_address_ex(
&handle->cc_handle.io_handle,
local_info->host,
&local_info->hostlen,
&local_info->port);
}
if(remote_info)
{
result = globus_io_tcp_get_remote_address_ex(
&handle->cc_handle.io_handle,
remote_info->host,
&remote_info->hostlen,
&remote_info->port);
}
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
return result;
}
#ifndef GLOBUS_DONT_DOCUMENT_INTERNAL
void
globus_i_ftp_control_write_next(
globus_ftp_control_handle_t * handle)
{
globus_object_t * error;
globus_result_t rc;
globus_ftp_control_rw_queue_element_t * element;
globus_bool_t queue_empty = GLOBUS_FALSE;
globus_bool_t call_close_cb = GLOBUS_FALSE;
rc = (globus_result_t) 1;
while(queue_empty == GLOBUS_FALSE &&
rc != GLOBUS_SUCCESS)
{
/* queue was not empty, we need to do the next write/send */
element = globus_fifo_peek(&handle->cc_handle.writers);
rc = globus_io_register_send(&handle->cc_handle.io_handle,
element->write_buf,
(globus_size_t) strlen(
(char *) element->write_buf),
element->write_flags,
element->write_callback,
(void *) handle);
if(rc != GLOBUS_SUCCESS)
{
error=globus_error_get(rc);;
if(element->expect_response == GLOBUS_TRUE)
{
if(element->callback)
{
(element->callback)((element->arg),
handle,
error,
GLOBUS_NULL);
}
else
{
(element->send_response_cb)((element->arg),
handle,
error);
}
}
globus_mutex_lock(&(handle->cc_handle.mutex));
{
globus_fifo_dequeue(&handle->cc_handle.writers);
handle->cc_handle.cb_count--;
queue_empty=globus_fifo_empty(&handle->cc_handle.writers);
if(!handle->cc_handle.cb_count &&
handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(handle);
}
globus_libc_free(element->write_buf);
globus_object_free(error);
globus_libc_free(element);
}
}
return;
}
static
void
globus_l_ftp_control_read_next(
globus_ftp_control_handle_t * handle)
{
globus_object_t * error;
globus_result_t rc;
globus_ftp_control_rw_queue_element_t * element;
globus_bool_t queue_empty = GLOBUS_FALSE;
globus_bool_t call_close_cb = GLOBUS_FALSE;
do
{
/* queue was not empty, we need to do the next read */
element = globus_fifo_peek(&handle->cc_handle.readers);
rc=globus_io_register_read(&handle->cc_handle.io_handle,
handle->cc_handle.read_buffer,
GLOBUS_FTP_CONTROL_READ_BUFFER_SIZE,
1, /* 0 or 1 here ? */
element->read_callback,
(void *) handle);
if(rc != GLOBUS_SUCCESS)
{
error=globus_error_get(rc);
(element->callback)((element->arg),
handle,
error,
GLOBUS_NULL);
globus_mutex_lock(&(handle->cc_handle.mutex));
{
globus_fifo_dequeue(&handle->cc_handle.readers);
handle->cc_handle.cb_count--;
queue_empty=globus_fifo_empty(&handle->cc_handle.readers);
if(!handle->cc_handle.cb_count &&
handle->cc_handle.cc_state == GLOBUS_FTP_CONTROL_CLOSING)
{
call_close_cb = GLOBUS_TRUE;
}
}
globus_mutex_unlock(&(handle->cc_handle.mutex));
if(call_close_cb == GLOBUS_TRUE)
{
globus_i_ftp_control_call_close_cb(handle);
}
globus_libc_free(element);
globus_object_free(error);
}
}
while(queue_empty == GLOBUS_FALSE &&
rc != GLOBUS_SUCCESS);
return;
}
static
globus_result_t
globus_l_ftp_control_queue_element_init(
globus_ftp_control_rw_queue_element_t * element,
globus_ftp_control_response_callback_t callback,
void * arg,
globus_byte_t * write_buf,
int write_flags,
globus_io_write_callback_t write_callback,
globus_io_read_callback_t read_callback,
globus_bool_t expect_response,
globus_bool_t use_auth,
globus_ftp_control_handle_t * handle)
{
globus_result_t result = GLOBUS_SUCCESS;
element->callback=callback;
element->arg=arg;
element->write_flags = write_flags;
if(use_auth == GLOBUS_TRUE)
{
result=globus_i_ftp_control_encode_command(
&handle->cc_handle,
(char *) write_buf,
(char **) (void *) &element->write_buf);
}
else
{
element->write_buf = (globus_byte_t *)
globus_libc_strdup((const char *) write_buf);
if(element->write_buf == GLOBUS_NULL)
{
result = globus_error_put(
globus_error_construct_string(
GLOBUS_FTP_CONTROL_MODULE,
GLOBUS_NULL,
_FCSL("globus_l_ftp_control_queue_element_init: strdup failed"))
);
}
}
element->write_callback = write_callback;
element->read_callback = read_callback;
element->expect_response = expect_response;
return result;
}
void
globus_i_ftp_control_call_close_cb(
globus_ftp_control_handle_t * handle)
{
globus_ftp_control_response_callback_t close_cb;
void * close_cb_arg;
globus_ftp_control_response_t response;
globus_object_t * result;
globus_bool_t signal_deactivate;
globus_mutex_lock(&handle->cc_handle.mutex);
{
globus_i_ftp_control_auth_info_destroy(
&(handle->cc_handle.auth_info));
handle->cc_handle.cc_state = GLOBUS_FTP_CONTROL_UNCONNECTED;
signal_deactivate = handle->cc_handle.signal_deactivate;
close_cb = handle->cc_handle.close_cb;
close_cb_arg = handle->cc_handle.close_cb_arg;
result = handle->cc_handle.close_result;
handle->cc_handle.close_result = GLOBUS_NULL;
response = handle->cc_handle.quit_response;
memset(
&handle->cc_handle.quit_response,
0,
sizeof(handle->cc_handle.quit_response));
}
globus_mutex_unlock(&handle->cc_handle.mutex);
if(close_cb)
{
close_cb(close_cb_arg, handle, result, &response);
}
if(result)
{
globus_object_free(result);
}
if(response.response_buffer)
{
globus_free(response.response_buffer);
}
if(signal_deactivate)
{
globus_mutex_lock(&globus_l_ftp_cc_handle_list_mutex);
{
if(globus_l_ftp_cc_handle_signal_count > 0)
{
if(--globus_l_ftp_cc_handle_signal_count == 0)
{
globus_cond_signal(&globus_l_ftp_cc_handle_list_cond);
}
}
}
globus_mutex_unlock(&globus_l_ftp_cc_handle_list_mutex);
}
}
#endif /* GLOBUS_DONT_DOCUMENT_INTERNAL */
/**
* @brief Not documented yet
* @ingroup globus_ftp_control_client
*/
globus_result_t
globus_ftp_control_ipv6_allow(
globus_ftp_control_handle_t * handle,
globus_bool_t allow)
{
globus_result_t result;
result = globus_io_attr_set_tcp_allow_ipv6(
&handle->cc_handle.io_attr, allow);
if(result == GLOBUS_SUCCESS)
{
result = globus_io_attr_set_tcp_allow_ipv6(
&handle->dc_handle.io_attr, allow);
}
return result;
}
| 30.826378 | 125 | 0.574267 | [
"object"
] |
c4bb9cffa98587f9346b0e7babdfd4b6c6c6f088 | 6,655 | h | C | mysqlshdk/libs/db/row_copy.h | mueller/mysql-shell | 29bafc5692bd536a12c4e41c54cb587375fe52cf | [
"Apache-2.0"
] | 119 | 2016-04-14T14:16:22.000Z | 2022-03-08T20:24:38.000Z | mysqlshdk/libs/db/row_copy.h | mueller/mysql-shell | 29bafc5692bd536a12c4e41c54cb587375fe52cf | [
"Apache-2.0"
] | 9 | 2017-04-26T20:48:42.000Z | 2021-09-07T01:52:44.000Z | mysqlshdk/libs/db/row_copy.h | mueller/mysql-shell | 29bafc5692bd536a12c4e41c54cb587375fe52cf | [
"Apache-2.0"
] | 51 | 2016-07-20T05:06:48.000Z | 2022-03-09T01:20:53.000Z | /*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is also distributed with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms, as
* designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have included with MySQL.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Persistent copy of a Row object
#ifndef MYSQLSHDK_LIBS_DB_ROW_COPY_H_
#define MYSQLSHDK_LIBS_DB_ROW_COPY_H_
#include <memory>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include "mysqlshdk/include/mysqlshdk_export.h"
#include "mysqlshdk/libs/db/column.h"
#include "mysqlshdk/libs/db/row.h"
namespace mysqlshdk {
namespace db {
class SHCORE_PUBLIC Mem_row : public IRow {
public:
Mem_row();
Mem_row(const Mem_row &row);
Mem_row &operator=(const Mem_row &row);
virtual ~Mem_row() {}
uint32_t num_fields() const override;
Type get_type(uint32_t index) const override;
bool is_null(uint32_t index) const override;
std::string get_as_string(uint32_t index) const override;
std::string get_string(uint32_t index) const override;
int64_t get_int(uint32_t index) const override;
uint64_t get_uint(uint32_t index) const override;
float get_float(uint32_t index) const override;
double get_double(uint32_t index) const override;
std::pair<const char *, size_t> get_string_data(
uint32_t index) const override;
void get_raw_data(uint32_t index, const char **out_data,
size_t *out_size) const override;
uint64_t get_bit(uint32_t index) const override;
/** Inserts new field at specified offset. Field value is set to null.
*
* @param type field type.
* @param offset offset at which to insert (default - last column).
*/
void add_field(Type type);
void add_field(Type type, uint32_t offset);
protected:
class Field_data_ {
public:
virtual ~Field_data_() {}
};
template <typename T>
class Field_data : public Field_data_ {
public:
explicit Field_data(const T &v) : value(v) {}
explicit Field_data(T &&v) : value(std::move(v)) {}
T value;
};
template <typename T>
const T &get(int field) const {
return static_cast<Field_data<T> *>(_data->fields[field].get())->value;
}
struct Data {
std::vector<Type> types;
std::vector<std::unique_ptr<Field_data_>> fields;
Data() {}
explicit Data(const std::vector<Type> &types_)
: types(types_), fields(types_.size()) {}
};
std::shared_ptr<Data> _data;
mutable std::string m_raw_data_cache;
};
/**
* A self-contained Row object that owns its own storage, as opposed to
* mysql::Row or mysqlx::Row which are references to data owned by the
* underlying client library.
*
* Can be created from the copy-constructor, from any instance of IRow.
*/
class SHCORE_PUBLIC Row_copy : public Mem_row {
public:
explicit Row_copy(const IRow &row);
Row_copy() {}
virtual ~Row_copy() {}
};
/**
* A self-contained Row object like Row_copy, but can be created or modified
* programmatically.
*/
class SHCORE_PUBLIC Mutable_row : public Mem_row {
public:
template <class T>
typename std::enable_if<std::is_integral<T>::value>::type set_field(
uint32_t index, T &&arg) {
if (_data->types[index] == Type::Integer)
_data->fields[index] = std::unique_ptr<Field_data_>(
new Field_data<int64_t>(std::forward<T>(arg)));
else if (_data->types[index] == Type::UInteger)
_data->fields[index] = std::unique_ptr<Field_data_>(
new Field_data<uint64_t>(std::forward<T>(arg)));
else
throw std::invalid_argument(
"Attempt to write integer value to non integer field");
}
template <class T>
typename std::enable_if<std::is_floating_point<T>::value>::type set_field(
uint32_t index, T &&arg) {
if (_data->types[index] != Type::Float &&
_data->types[index] != Type::Double)
throw std::invalid_argument(
"Attempt to write floating point number to not neither float or "
"double field.");
_data->fields[index] =
std::make_unique<Field_data<T>>(std::forward<T>(arg));
}
template <class T>
typename std::enable_if<std::is_same<T, std::nullptr_t>::value>::type
set_field(uint32_t index, T && /*arg*/) {
_data->fields[index] = nullptr;
}
template <class T>
typename std::enable_if<!std::is_arithmetic<T>::value &&
!std::is_same<T, std::nullptr_t>::value>::type
set_field(uint32_t index, T &&arg) {
if (_data->types[index] >= Type::Integer &&
_data->types[index] <= Type::Double)
throw std::invalid_argument(
"Attempt to write arithmetic type to non arithmetic field");
_data->fields[index] = std::unique_ptr<Field_data_>(
new Field_data<std::string>(std::string(std::forward<T>(arg))));
}
private:
template <class T, class... Args>
void set_field(uint32_t start, T &&value, Args... args) {
set_field(start, std::forward<T>(value));
if (start < _data->fields.size())
set_field(start + 1, std::forward<Args>(args)...);
}
public:
template <class... Args>
void set_row_values(Args... args) {
constexpr int n = sizeof...(args);
if (n != _data->fields.size())
throw std::invalid_argument(
"The number of arguments does not match the row size");
set_field(0, std::forward<Args>(args)...);
}
explicit Mutable_row(const std::vector<Type> &types) {
_data = std::make_shared<Data>(types);
}
template <class... Args>
Mutable_row(const std::vector<Type> &types, Args... args) {
_data = std::make_shared<Data>(types);
set_row_values(std::forward<Args>(args)...);
}
virtual ~Mutable_row();
};
} // namespace db
} // namespace mysqlshdk
#endif // MYSQLSHDK_LIBS_DB_ROW_COPY_H_
| 32.463415 | 80 | 0.686702 | [
"object",
"vector"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.