blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 905
values | visit_date timestamp[us]date 2015-08-09 11:21:18 2023-09-06 10:45:07 | revision_date timestamp[us]date 1997-09-14 05:04:47 2023-09-17 19:19:19 | committer_date timestamp[us]date 1997-09-14 05:04:47 2023-09-06 06:22:19 | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22
values | gha_event_created_at timestamp[us]date 2012-06-07 00:51:45 2023-09-14 21:58:39 ⌀ | gha_created_at timestamp[us]date 2008-03-27 23:40:48 2023-08-21 23:17:38 ⌀ | gha_language stringclasses 141
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 115
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
b07e8f129186869ae7934c0e1fa459e6ee03d5f6 | 0b79a22cc166cac39cf3008a9f8d6cf79d2cccfd | /Irrigation/test/Common/Mocks/MockSchedulerContainer.h | e87c03155ca86b8a5da46a4dd62f77454726868a | [] | no_license | gyengep/irrigation | 01f9fdb56cd67bb1fbfc7726cabeceae64b5f798 | e6643032010c69a80d70be4dc7b9ee1c2033c707 | refs/heads/master | 2023-08-10T19:46:04.360659 | 2023-07-26T20:12:44 | 2023-07-26T20:12:44 | 61,204,876 | 0 | 0 | null | 2020-08-31T21:15:29 | 2016-06-15T12:04:11 | C++ | UTF-8 | C++ | false | false | 1,481 | h | #pragma once
#include <gmock/gmock.h>
#include "Logic/SchedulerContainer.h"
class MockSchedulerContainer : public SchedulerContainer {
public:
MOCK_CONST_METHOD0(begin, const_iterator());
MOCK_CONST_METHOD0(end, const_iterator());
MOCK_CONST_METHOD0(size, size_t());
MOCK_CONST_METHOD1(at, const_mapped_type(const key_type& key));
MOCK_METHOD1(at, mapped_type(const key_type& key));
MOCK_CONST_METHOD0(getEveryDayScheduler, const EveryDayScheduler&());
MOCK_CONST_METHOD0(getHotWeatherScheduler, const HotWeatherScheduler&());
MOCK_CONST_METHOD0(getTemperatureDependentScheduler, const TemperatureDependentScheduler&());
MOCK_CONST_METHOD0(getWeeklyScheduler, const WeeklyScheduler&());
MOCK_METHOD0(getEveryDayScheduler, EveryDayScheduler&());
MOCK_METHOD0(getHotWeatherScheduler, HotWeatherScheduler&());
MOCK_METHOD0(getTemperatureDependentScheduler, TemperatureDependentScheduler&());
MOCK_METHOD0(getWeeklyScheduler, WeeklyScheduler&());
MOCK_CONST_METHOD0(toSchedulersDto, SchedulersDTO());
MOCK_METHOD1(updateFromSchedulersDto, void(const SchedulersDTO& schedulerdDto));
MOCK_CONST_METHOD0(toString, std::string());
};
///////////////////////////////////////////////////////////////////////////////
class MockSchedulerContainerFactory : public SchedulerContainerFactory {
public:
virtual ~MockSchedulerContainerFactory() = default;
virtual SchedulerContainerPtr create() const override {
return std::make_shared<MockSchedulerContainer>();
}
};
| [
"peter.gyenge@tcandc.com"
] | peter.gyenge@tcandc.com |
27ca2f195b7524f32234f2fc6f9448bf02a3a308 | dd656493066344e70123776c2cc31dd13f31c1d8 | /MITK/Utilities/Poco/Foundation/include/Poco/DynamicAnyHolder.h | ad38a59ad355a8effa0487eb9c25e58ac0417fca | [
"BSL-1.0"
] | permissive | david-guerrero/MITK | e9832b830cbcdd94030d2969aaed45da841ffc8c | e5fbc9993f7a7032fc936f29bc59ca296b4945ce | refs/heads/master | 2020-04-24T19:08:37.405353 | 2011-11-13T22:25:21 | 2011-11-13T22:25:21 | 2,372,730 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 51,037 | h | //
// DynamicAnyHolder.h
//
// $Id$
//
// Library: Foundation
// Package: Core
// Module: DynamicAnyHolder
//
// Definition of the DynamicAnyHolder class.
//
// Copyright (c) 2007, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef Foundation_DynamicAnyHolder_INCLUDED
#define Foundation_DynamicAnyHolder_INCLUDED
#include "Poco/Foundation.h"
#include "Poco/NumberFormatter.h"
#include "Poco/NumberParser.h"
#include "Poco/DateTime.h"
#include "Poco/Timestamp.h"
#include "Poco/LocalDateTime.h"
#include "Poco/DateTimeFormat.h"
#include "Poco/DateTimeFormatter.h"
#include "Poco/DateTimeParser.h"
#include "Poco/String.h"
#include "Poco/Exception.h"
#include <vector>
#include <typeinfo>
#undef min
#undef max
#include <limits>
namespace Poco {
class DynamicAny;
class Foundation_API DynamicAnyHolder
/// Interface for a data holder used by the DynamicAny class.
/// Provides methods to convert between data types.
/// Only data types for which a convert method exists are supported, which are
/// all C++ built-in types with addition of std::string, DateTime, LocalDateTime, Timestamp,
/// and std::vector<DynamicAny>.
{
public:
DynamicAnyHolder();
/// Creates the DynamicAnyHolder.
virtual ~DynamicAnyHolder();
/// Destroys the DynamicAnyHolder.
virtual DynamicAnyHolder* clone() const = 0;
/// Deep-copies the DynamicAnyHolder.
virtual const std::type_info& type() const = 0;
/// Returns the type information of the stored content.
virtual void convert(Int8& val) const = 0;
virtual void convert(Int16& val) const = 0;
virtual void convert(Int32& val) const = 0;
virtual void convert(Int64& val) const = 0;
virtual void convert(UInt8& val) const = 0;
virtual void convert(UInt16& val) const = 0;
virtual void convert(UInt32& val) const = 0;
virtual void convert(UInt64& val) const = 0;
virtual void convert(DateTime& val) const = 0;
virtual void convert(LocalDateTime& val) const = 0;
virtual void convert(Timestamp& val) const = 0;
virtual bool isArray() const = 0;
virtual bool isInteger() const = 0;
virtual bool isSigned() const = 0;
virtual bool isNumeric() const = 0;
virtual bool isString() const = 0;
#ifndef POCO_LONG_IS_64_BIT
void convert(long& val) const;
void convert(unsigned long& val) const;
#endif
virtual void convert(bool& val) const = 0;
virtual void convert(float& val) const = 0;
virtual void convert(double& val) const = 0;
virtual void convert(char& val) const = 0;
virtual void convert(std::string& val) const = 0;
protected:
template <typename F, typename T>
void convertToSmaller(const F& from, T& to) const
/// This function is meant to convert signed numeric values from
/// larger to smaller type. It checks the upper and lower bound and
/// if from value is within limits of type T (i.e. check calls do not throw),
/// it is converted.
{
poco_static_assert (std::numeric_limits<F>::is_specialized);
poco_static_assert (std::numeric_limits<T>::is_specialized);
poco_static_assert (std::numeric_limits<F>::is_signed);
poco_static_assert (std::numeric_limits<T>::is_signed);
if (std::numeric_limits<F>::is_integer)
checkUpperLimit(from, to);
else
checkUpperLimitFloat(from, to);
checkLowerLimit(from, to);
to = static_cast<T>(from);
}
template <typename F, typename T>
void convertToSmallerUnsigned(const F& from, T& to) const
/// This function is meant for converting unsigned integral data types,
/// from larger to smaller type. Since lower limit is always 0 for unigned types,
/// only the upper limit is checked, thus saving some cycles compared to the signed
/// version of the function. If the value to be converted is smaller than
/// the maximum value for the target type, the conversion is performed.
{
poco_static_assert (std::numeric_limits<F>::is_specialized);
poco_static_assert (std::numeric_limits<T>::is_specialized);
poco_static_assert (!std::numeric_limits<F>::is_signed);
poco_static_assert (!std::numeric_limits<T>::is_signed);
checkUpperLimit(from, to);
to = static_cast<T>(from);
}
template <typename F, typename T>
void convertSignedToUnsigned(const F& from, T& to) const
/// This function is meant for converting signed integral data types to
/// unsigned data types. Negative values can not be converted and if one is
/// encountered, RangeException is thrown.
/// If upper limit is within the target data type limits, the conversion is performed.
{
poco_static_assert (std::numeric_limits<F>::is_specialized);
poco_static_assert (std::numeric_limits<T>::is_specialized);
poco_static_assert (std::numeric_limits<F>::is_signed);
poco_static_assert (!std::numeric_limits<T>::is_signed);
if (from < 0)
throw RangeException("Value too small.");
checkUpperLimit(from, to);
to = static_cast<T>(from);
}
template <typename F, typename T>
void convertSignedFloatToUnsigned(const F& from, T& to) const
/// This function is meant for converting floating point data types to
/// unsigned integral data types. Negative values can not be converted and if one is
/// encountered, RangeException is thrown.
/// If uper limit is within the target data type limits, the conversion is performed.
{
poco_static_assert (std::numeric_limits<F>::is_specialized);
poco_static_assert (std::numeric_limits<T>::is_specialized);
poco_static_assert (!std::numeric_limits<F>::is_integer);
poco_static_assert (std::numeric_limits<T>::is_integer);
poco_static_assert (!std::numeric_limits<T>::is_signed);
if (from < 0)
throw RangeException("Value too small.");
checkUpperLimitFloat(from, to);
to = static_cast<T>(from);
}
template <typename F, typename T>
void convertUnsignedToSigned(const F& from, T& to) const
/// This function is meant for converting unsigned integral data types to
/// unsigned data types. Negative values can not be converted and if one is
/// encountered, RangeException is thrown.
/// If upper limit is within the target data type limits, the converiosn is performed.
{
poco_static_assert (std::numeric_limits<F>::is_specialized);
poco_static_assert (std::numeric_limits<T>::is_specialized);
poco_static_assert (!std::numeric_limits<F>::is_signed);
poco_static_assert (std::numeric_limits<T>::is_signed);
checkUpperLimit(from, to);
to = static_cast<T>(from);
}
private:
template <typename F, typename T>
void checkUpperLimit(const F& from, T&) const
{
if ((sizeof(T) < sizeof(F)) &&
(from > static_cast<F>(std::numeric_limits<T>::max())))
{
throw RangeException("Value too large.");
}
else
if (static_cast<T>(from) > std::numeric_limits<T>::max())
{
throw RangeException("Value too large.");
}
}
template <typename F, typename T>
void checkUpperLimitFloat(const F& from, T&) const
{
if (from > std::numeric_limits<T>::max())
throw RangeException("Value too large.");
}
template <typename F, typename T>
void checkLowerLimit(const F& from, T&) const
{
if (from < std::numeric_limits<T>::min())
throw RangeException("Value too small.");
}
};
//
// inlines
//
#ifndef POCO_LONG_IS_64_BIT
inline void DynamicAnyHolder::convert(long& val) const
{
Int32 tmp;
convert(tmp);
val = tmp;
}
inline void DynamicAnyHolder::convert(unsigned long& val) const
{
UInt32 tmp;
convert(tmp);
val = tmp;
}
#endif
template <typename T>
class DynamicAnyHolderImpl: public DynamicAnyHolder
/// Template based implementation of a DynamicAnyHolder.
/// Conversion work happens in the template specializations of this class.
///
/// DynamicAny can be used for any type for which a specialization for
/// DynamicAnyHolderImpl is available.
///
/// DynamicAnyHolderImpl throws following exceptions:
/// NotImplementedException (if the specialization for a type does not exist)
/// RangeException (if an attempt is made to assign a numeric value outside of the target min/max limits
/// SyntaxException (if an attempt is made to convert a string containing non-numeric characters to number)
///
/// All specializations must additionally implement a public member function:
/// const T& value() const
/// returning a const reference to the actual stored value.
{
public:
DynamicAnyHolderImpl()
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(T);
}
bool isInteger() const
{
return std::numeric_limits<T>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<T>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<T>::is_specialized;
}
bool isString() const
{
return type() == typeid(std::string);
}
void convert(Int8&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(Int16&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(Int32&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(Int64&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(UInt8&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(UInt16&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(UInt32&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(UInt64&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(bool&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(float&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(double&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(char&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(std::string&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(DateTime&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(LocalDateTime&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
void convert(Timestamp&) const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
DynamicAnyHolder* clone() const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
bool isArray() const
{
throw NotImplementedException("No DynamicAnyHolder specialization for type", typeid(T).name());
}
};
template <>
class DynamicAnyHolderImpl<Int8>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(Int8 val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Int8);
}
void convert(Int8& val) const
{
val = _val;
}
void convert(Int16& val) const
{
val = _val;
}
void convert(Int32& val) const
{
val = _val;
}
void convert(Int64& val) const
{
val = _val;
}
void convert(UInt8& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt64& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
val = static_cast<char>(_val);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("Int8 -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("Int8 -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("Int8 -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const Int8& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<Int8>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<Int8>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<Int8>::is_specialized;
}
bool isString() const
{
return false;
}
private:
Int8 _val;
};
template <>
class DynamicAnyHolderImpl<Int16>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(Int16 val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Int16);
}
void convert(Int8& val) const
{
convertToSmaller(_val, val);
}
void convert(Int16& val) const
{
val = _val;
}
void convert(Int32& val) const
{
val = _val;
}
void convert(Int64& val) const
{
val = _val;
}
void convert(UInt8& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt64& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("Int16 -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("Int16 -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("Int16 -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const Int16& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<Int16>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<Int16>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<Int16>::is_specialized;
}
bool isString() const
{
return false;
}
private:
Int16 _val;
};
template <>
class DynamicAnyHolderImpl<Int32>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(Int32 val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Int32);
}
void convert(Int8& val) const
{
convertToSmaller(_val, val);
}
void convert(Int16& val) const
{
convertToSmaller(_val, val);
}
void convert(Int32& val) const
{
val = _val;
}
void convert(Int64& val) const
{
val = _val;
}
void convert(UInt8& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt64& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("Int32 -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("Int32 -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("Int32 -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const Int32& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<Int32>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<Int32>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<Int32>::is_specialized;
}
bool isString() const
{
return false;
}
private:
Int32 _val;
};
template <>
class DynamicAnyHolderImpl<Int64>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(Int64 val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Int64);
}
void convert(Int8& val) const
{
convertToSmaller(_val, val);
}
void convert(Int16& val) const
{
convertToSmaller(_val, val);
}
void convert(Int32& val) const
{
convertToSmaller(_val, val);
}
void convert(Int64& val) const
{
val = _val;
}
void convert(UInt8& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt64& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime& dt) const
{
dt = Timestamp(_val);
}
void convert(LocalDateTime& ldt) const
{
ldt = Timestamp(_val);
}
void convert(Timestamp& val) const
{
val = Timestamp(_val);
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const Int64& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<Int64>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<Int64>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<Int64>::is_specialized;
}
bool isString() const
{
return false;
}
private:
Int64 _val;
};
template <>
class DynamicAnyHolderImpl<UInt8>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(UInt8 val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(UInt8);
}
void convert(Int8& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int16& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int32& val) const
{
val = static_cast<Int32>(_val);
}
void convert(Int64& val) const
{
val = static_cast<Int64>(_val);
}
void convert(UInt8& val) const
{
val = _val;
}
void convert(UInt16& val) const
{
val = _val;
}
void convert(UInt32& val) const
{
val = _val;
}
void convert(UInt64& val) const
{
val = _val;
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("UInt8 -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("Unt8 -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("UInt8 -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const UInt8& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<UInt8>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<UInt8>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<UInt8>::is_specialized;
}
bool isString() const
{
return false;
}
private:
UInt8 _val;
};
template <>
class DynamicAnyHolderImpl<UInt16>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(UInt16 val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(UInt16);
}
void convert(Int8& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int16& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int32& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int64& val) const
{
val = static_cast<Int64>(_val);
}
void convert(UInt8& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt16& val) const
{
val = _val;
}
void convert(UInt32& val) const
{
val = _val;
}
void convert(UInt64& val) const
{
val = _val;
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("UInt16 -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("UInt16 -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("UInt16 -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const UInt16& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<UInt16>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<UInt16>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<UInt16>::is_specialized;
}
bool isString() const
{
return false;
}
private:
UInt16 _val;
};
template <>
class DynamicAnyHolderImpl<UInt32>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(UInt32 val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(UInt32);
}
void convert(Int8& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int16& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int32& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int64& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(UInt8& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt32& val) const
{
val = _val;
}
void convert(UInt64& val) const
{
val = _val;
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("UInt32 -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("UInt32 -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("UInt32 -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const UInt32& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<UInt32>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<UInt32>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<UInt32>::is_specialized;
}
bool isString() const
{
return false;
}
private:
UInt32 _val;
};
template <>
class DynamicAnyHolderImpl<UInt64>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(UInt64 val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(UInt64);
}
void convert(Int8& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int16& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int32& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int64& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(UInt8& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt64& val) const
{
val = _val;
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime& dt) const
{
Int64 val;
convertUnsignedToSigned(_val, val);
dt = Timestamp(val);
}
void convert(LocalDateTime& ldt) const
{
Int64 val;
convertUnsignedToSigned(_val, val);
ldt = Timestamp(val);
}
void convert(Timestamp& val) const
{
Int64 tmp;
convertUnsignedToSigned(_val, tmp);
val = Timestamp(tmp);
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const UInt64& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<UInt64>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<UInt64>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<UInt64>::is_specialized;
}
bool isString() const
{
return false;
}
private:
UInt64 _val;
};
template <>
class DynamicAnyHolderImpl<bool>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(bool val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(bool);
}
void convert(Int8& val) const
{
val = static_cast<Int8>(_val ? 1 : 0);
}
void convert(Int16& val) const
{
val = static_cast<Int16>(_val ? 1 : 0);
}
void convert(Int32& val) const
{
val = static_cast<Int32>(_val ? 1 : 0);
}
void convert(Int64& val) const
{
val = static_cast<Int64>(_val ? 1 : 0);
}
void convert(UInt8& val) const
{
val = static_cast<UInt8>(_val ? 1 : 0);
}
void convert(UInt16& val) const
{
val = static_cast<UInt16>(_val ? 1 : 0);
}
void convert(UInt32& val) const
{
val = static_cast<UInt32>(_val ? 1 : 0);
}
void convert(UInt64& val) const
{
val = static_cast<UInt64>(_val ? 1 : 0);
}
void convert(bool& val) const
{
val = _val;
}
void convert(float& val) const
{
val = (_val ? 1.0f : 0.0f);
}
void convert(double& val) const
{
val = (_val ? 1.0 : 0.0);
}
void convert(char& val) const
{
val = static_cast<char>(_val ? 1 : 0);
}
void convert(std::string& val) const
{
val = (_val ? "true" : "false");
}
void convert(DateTime&) const
{
throw BadCastException("bool -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("bool -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("bool -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const bool& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<bool>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<bool>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<bool>::is_specialized;
}
bool isString() const
{
return false;
}
private:
bool _val;
};
template <>
class DynamicAnyHolderImpl<float>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(float val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(float);
}
void convert(Int8& val) const
{
convertToSmaller(_val, val);
}
void convert(Int16& val) const
{
convertToSmaller(_val, val);
}
void convert(Int32& val) const
{
convertToSmaller(_val, val);
}
void convert(Int64& val) const
{
convertToSmaller(_val, val);
}
void convert(UInt8& val) const
{
convertSignedFloatToUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertSignedFloatToUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertSignedFloatToUnsigned(_val, val);
}
void convert(UInt64& val) const
{
convertSignedFloatToUnsigned(_val, val);
}
void convert(bool& val) const
{
val = !(_val <= std::numeric_limits<float>::min() &&
_val >= -1 * std::numeric_limits<float>::min());
}
void convert(float& val) const
{
val = _val;
}
void convert(double& val) const
{
val = _val;
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("float -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("float -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("float -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const float& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<float>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<float>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<float>::is_specialized;
}
bool isString() const
{
return false;
}
private:
float _val;
};
template <>
class DynamicAnyHolderImpl<double>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(double val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(double);
}
void convert(Int8& val) const
{
convertToSmaller(_val, val);
}
void convert(Int16& val) const
{
convertToSmaller(_val, val);
}
void convert(Int32& val) const
{
convertToSmaller(_val, val);
}
void convert(Int64& val) const
{
convertToSmaller(_val, val);
}
void convert(UInt8& val) const
{
convertSignedFloatToUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertSignedFloatToUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertSignedFloatToUnsigned(_val, val);
}
void convert(UInt64& val) const
{
convertSignedFloatToUnsigned(_val, val);
}
void convert(bool& val) const
{
val = !(_val <= std::numeric_limits<double>::min() &&
_val >= -1 * std::numeric_limits<double>::min());
}
void convert(float& val) const
{
double fMin = -1 * std::numeric_limits<float>::max();
double fMax = std::numeric_limits<float>::max();
if (_val < fMin) throw RangeException("Value too small.");
if (_val > fMax) throw RangeException("Value too large.");
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = _val;
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("double -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("double -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("double -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const double& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<double>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<double>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<double>::is_specialized;
}
bool isString() const
{
return false;
}
private:
double _val;
};
template <>
class DynamicAnyHolderImpl<char>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(char val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(char);
}
void convert(Int8& val) const
{
val = static_cast<Int8>(_val);
}
void convert(Int16& val) const
{
val = static_cast<UInt8>(_val);
}
void convert(Int32& val) const
{
val = static_cast<UInt8>(_val);
}
void convert(Int64& val) const
{
val = static_cast<UInt8>(_val);
}
void convert(UInt8& val) const
{
val = static_cast<UInt8>(_val);
}
void convert(UInt16& val) const
{
val = static_cast<UInt8>(_val);
}
void convert(UInt32& val) const
{
val = static_cast<UInt8>(_val);
}
void convert(UInt64& val) const
{
val = static_cast<UInt8>(_val);
}
void convert(bool& val) const
{
val = (_val != '\0');
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
val = _val;
}
void convert(std::string& val) const
{
val = std::string(1, _val);
}
void convert(DateTime&) const
{
throw BadCastException("char -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("char -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("char -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const char& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<char>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<char>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<char>::is_specialized;
}
bool isString() const
{
return false;
}
private:
char _val;
};
template <>
class DynamicAnyHolderImpl<std::string>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(const char* pVal): _val(pVal)
{
}
DynamicAnyHolderImpl(const std::string& val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(std::string);
}
void convert(Int8& val) const
{
int v = NumberParser::parse(_val);
convertToSmaller(v, val);
}
void convert(Int16& val) const
{
int v = NumberParser::parse(_val);
convertToSmaller(v, val);
}
void convert(Int32& val) const
{
val = NumberParser::parse(_val);
}
void convert(Int64& val) const
{
val = NumberParser::parse64(_val);
}
void convert(UInt8& val) const
{
unsigned int v = NumberParser::parseUnsigned(_val);
convertToSmallerUnsigned(v, val);
}
void convert(UInt16& val) const
{
unsigned int v = NumberParser::parseUnsigned(_val);
convertToSmallerUnsigned(v, val);
}
void convert(UInt32& val) const
{
val = NumberParser::parseUnsigned(_val);
}
void convert(UInt64& val) const
{
val = NumberParser::parseUnsigned64(_val);
}
void convert(bool& val) const
{
static const std::string VAL_FALSE("false");
static const std::string VAL_INTFALSE("0");
if (_val == VAL_INTFALSE || (icompare(_val, VAL_FALSE) == 0))
val = false;
else
val = true;
}
void convert(float& val) const
{
double v = NumberParser::parseFloat(_val);
convertToSmaller(v, val);
}
void convert(double& val) const
{
val = NumberParser::parseFloat(_val);
}
void convert(char& val) const
{
if (_val.empty())
val = '\0';
else
val = _val[0];
}
void convert(std::string& val) const
{
val = _val;
}
void convert(DateTime& val) const
{
int tzd = 0;
if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, _val, val, tzd))
throw BadCastException("string -> DateTime");
}
void convert(LocalDateTime& ldt) const
{
int tzd = 0;
DateTime tmp;
if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, _val, tmp, tzd))
throw BadCastException("string -> LocalDateTime");
ldt = LocalDateTime(tzd, tmp, false);
}
void convert(Timestamp& ts) const
{
int tzd = 0;
DateTime tmp;
if (!DateTimeParser::tryParse(DateTimeFormat::ISO8601_FORMAT, _val, tmp, tzd))
throw BadCastException("string -> Timestamp");
ts = tmp.timestamp();
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const std::string& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return false;
}
bool isSigned() const
{
return false;
}
bool isNumeric() const
{
return false;
}
bool isString() const
{
return true;
}
private:
std::string _val;
};
#ifndef POCO_LONG_IS_64_BIT
template <>
class DynamicAnyHolderImpl<long>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(long val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(long);
}
void convert(Int8& val) const
{
convertToSmaller(_val, val);
}
void convert(Int16& val) const
{
convertToSmaller(_val, val);
}
void convert(Int32& val) const
{
val = static_cast<Int32>(_val);
}
void convert(Int64& val) const
{
val = static_cast<Int64>(_val);
}
void convert(UInt8& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(UInt64& val) const
{
convertSignedToUnsigned(_val, val);
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("long -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("long -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("long -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const long& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<long>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<long>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<long>::is_specialized;
}
bool isString() const
{
return false;
}
private:
long _val;
};
template <>
class DynamicAnyHolderImpl<unsigned long>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(unsigned long val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(unsigned long);
}
void convert(Int8& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int16& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int32& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(Int64& val) const
{
convertUnsignedToSigned(_val, val);
}
void convert(UInt8& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt16& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt32& val) const
{
convertToSmallerUnsigned(_val, val);
}
void convert(UInt64& val) const
{
val = static_cast<UInt64>(_val);
}
void convert(bool& val) const
{
val = (_val != 0);
}
void convert(float& val) const
{
val = static_cast<float>(_val);
}
void convert(double& val) const
{
val = static_cast<double>(_val);
}
void convert(char& val) const
{
UInt8 tmp;
convert(tmp);
val = static_cast<char>(tmp);
}
void convert(std::string& val) const
{
val = NumberFormatter::format(_val);
}
void convert(DateTime&) const
{
throw BadCastException("unsigned long -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("unsigned long -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("unsigned long -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const unsigned long& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return std::numeric_limits<unsigned long>::is_integer;
}
bool isSigned() const
{
return std::numeric_limits<unsigned long>::is_signed;
}
bool isNumeric() const
{
return std::numeric_limits<unsigned long>::is_specialized;
}
bool isString() const
{
return false;
}
private:
unsigned long _val;
};
#endif // 64bit
template <typename T>
class DynamicAnyHolderImpl<std::vector<T> >: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(const std::vector<T>& val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(std::vector<T>);
}
void convert(Int8& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(Int16& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(Int32& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(Int64& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(UInt8& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(UInt16& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(UInt32& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(UInt64& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(bool& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(float& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(double& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(char& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(std::string& val) const
{
throw BadCastException("Cannot cast collection type to non-collection type");
}
void convert(DateTime&) const
{
throw BadCastException("vector -> DateTime");
}
void convert(LocalDateTime&) const
{
throw BadCastException("vector -> LocalDateTime");
}
void convert(Timestamp&) const
{
throw BadCastException("vector -> Timestamp");
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const std::vector<T>& value() const
{
return _val;
}
bool isArray() const
{
return true;
}
bool isInteger() const
{
return false;
}
bool isSigned() const
{
return false;
}
bool isNumeric() const
{
return false;
}
bool isString() const
{
return false;
}
T& operator[](typename std::vector<T>::size_type n)
{
return _val.operator[](n);
}
const T& operator[](typename std::vector<T>::size_type n) const
{
return _val.operator[](n);
}
private:
std::vector<T> _val;
};
template <>
class DynamicAnyHolderImpl<DateTime>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(const DateTime& val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(DateTime);
}
void convert(Int8&) const
{
throw BadCastException();
}
void convert(Int16&) const
{
throw BadCastException();
}
void convert(Int32&) const
{
throw BadCastException();
}
void convert(Int64& val) const
{
val = _val.timestamp().epochMicroseconds();
}
void convert(UInt8&) const
{
throw BadCastException();
}
void convert(UInt16&) const
{
throw BadCastException();
}
void convert(UInt32&) const
{
throw BadCastException();
}
void convert(UInt64& val) const
{
val = _val.timestamp().epochMicroseconds();
}
void convert(bool&) const
{
throw BadCastException();
}
void convert(float&) const
{
throw BadCastException();
}
void convert(double&) const
{
throw BadCastException();
}
void convert(char&) const
{
throw BadCastException();
}
void convert(std::string& val) const
{
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
}
void convert(DateTime& val) const
{
val = _val;
}
void convert(LocalDateTime& ldt) const
{
ldt = _val.timestamp();
}
void convert(Timestamp& ts) const
{
ts = _val.timestamp();
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const DateTime& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return false;
}
bool isSigned() const
{
return false;
}
bool isNumeric() const
{
return false;
}
bool isString() const
{
return false;
}
private:
DateTime _val;
};
template <>
class DynamicAnyHolderImpl<LocalDateTime>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(const LocalDateTime& val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(LocalDateTime);
}
void convert(Int8&) const
{
throw BadCastException();
}
void convert(Int16&) const
{
throw BadCastException();
}
void convert(Int32&) const
{
throw BadCastException();
}
void convert(Int64& val) const
{
val = _val.timestamp().epochMicroseconds();
}
void convert(UInt8&) const
{
throw BadCastException();
}
void convert(UInt16&) const
{
throw BadCastException();
}
void convert(UInt32&) const
{
throw BadCastException();
}
void convert(UInt64& val) const
{
val = _val.timestamp().epochMicroseconds();
}
void convert(bool&) const
{
throw BadCastException();
}
void convert(float&) const
{
throw BadCastException();
}
void convert(double&) const
{
throw BadCastException();
}
void convert(char&) const
{
throw BadCastException();
}
void convert(std::string& val) const
{
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
}
void convert(DateTime& val) const
{
val = _val.timestamp();
}
void convert(LocalDateTime& ldt) const
{
ldt = _val;
}
void convert(Timestamp& ts) const
{
ts = _val.timestamp();
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const LocalDateTime& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return false;
}
bool isSigned() const
{
return false;
}
bool isNumeric() const
{
return false;
}
bool isString() const
{
return false;
}
private:
LocalDateTime _val;
};
template <>
class DynamicAnyHolderImpl<Timestamp>: public DynamicAnyHolder
{
public:
DynamicAnyHolderImpl(const Timestamp& val): _val(val)
{
}
~DynamicAnyHolderImpl()
{
}
const std::type_info& type() const
{
return typeid(Timestamp);
}
void convert(Int8&) const
{
throw BadCastException();
}
void convert(Int16&) const
{
throw BadCastException();
}
void convert(Int32&) const
{
throw BadCastException();
}
void convert(Int64& val) const
{
val = _val.epochMicroseconds();
}
void convert(UInt8&) const
{
throw BadCastException();
}
void convert(UInt16&) const
{
throw BadCastException();
}
void convert(UInt32&) const
{
throw BadCastException();
}
void convert(UInt64& val) const
{
val = _val.epochMicroseconds();
}
void convert(bool&) const
{
throw BadCastException();
}
void convert(float&) const
{
throw BadCastException();
}
void convert(double&) const
{
throw BadCastException();
}
void convert(char&) const
{
throw BadCastException();
}
void convert(std::string& val) const
{
val = DateTimeFormatter::format(_val, Poco::DateTimeFormat::ISO8601_FORMAT);
}
void convert(DateTime& val) const
{
val = _val;
}
void convert(LocalDateTime& ldt) const
{
ldt = _val;
}
void convert(Timestamp& ts) const
{
ts = _val;
}
DynamicAnyHolder* clone() const
{
return new DynamicAnyHolderImpl(_val);
}
const Timestamp& value() const
{
return _val;
}
bool isArray() const
{
return false;
}
bool isInteger() const
{
return false;
}
bool isSigned() const
{
return false;
}
bool isNumeric() const
{
return false;
}
bool isString() const
{
return false;
}
private:
Timestamp _val;
};
} // namespace Poco
#endif // Foundation_DynamicAnyHolder_INCLUDED
| [
"dav@live.ca"
] | dav@live.ca |
7e6081d4ef6740fcdca88c81c306dd66ee38d81b | 34b22618cc53750a239ee7d3c98314d8e9b19093 | /framework/samples/cmadtvmapmaker/src/Application/main.cpp | e7bd75d817d41ea4c796c96d919b5bfe87bd86fe | [] | no_license | ivan-kits/cframework | 7beef16da89fb4f9559c0611863d05ac3de25abd | 30015ddf1e5adccd138a2988455fe8010d1d9f50 | refs/heads/master | 2023-06-12T05:09:30.355989 | 2021-07-04T09:00:00 | 2021-07-04T09:00:00 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 204 | cpp | #include "cmadtvmapmaker/Application/Application.h"
int main()
{
CMadTV::Application::GetInstance().Start( "data/database/map.png" );
CMadTV::Application::DestroyInstance();
return 0;
}
| [
"dev@oeing.eu"
] | dev@oeing.eu |
eb0f33c59ae48c89aecf094eda2db1c87c7daaf0 | fb227e3635b5c06e49bad48928f7b6d3254c4dca | /atCoder/abc141/d.cpp | b345108fd5aab07bfaea6c34306bb5bba9f69e47 | [] | no_license | BryanValeriano/marathon | 5be2ab354e49187c865f0296f7dfb5ab3c3d6c9b | 8dadfad7d1a6822f61ba5ed4a06e998541515634 | refs/heads/master | 2022-09-11T00:06:14.982588 | 2022-09-03T17:01:30 | 2022-09-03T17:01:30 | 141,581,750 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 712 | cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mk make_pair
#define fi first
#define se second
#define eb emplace_back
typedef long long ll;
typedef pair<int,int> ii;
typedef vector< pair<int,int> > vii;
const int INF = 0x3f3f3f3f;
int n,m;
priority_queue<int, vector<int> > pq;
int main() {
ios_base::sync_with_stdio(false);
cin >> n >> m;
for(int i = 0; i < n; i++) {
int x; cin >> x;
pq.push(x);
}
while(m--) {
int at = pq.top();
pq.pop();
if(at) at /= 2;
pq.push(at);
}
ll ans = 0;
while(!pq.empty()) ans += pq.top(), pq.pop();
cout << ans << endl;
return 0;
}
| [
"bryan.b.valeriano@gmail.com"
] | bryan.b.valeriano@gmail.com |
5fd1c2f3c658a41432c539ed9f4b97ff94627a44 | 3481ae27511db59c6605739ac561a4b8d363bc57 | /CARPROJECTSOEN422/robotGUI/client.h | 8c2fb640b9840188200ee59440284abeb5c449fe | [] | no_license | danseremet/Soen422TeamLabs | b4b50e58d6e481f4a11c24ea4a86ee43000c30ee | 5f712bed58fbe759b616b5e9d2f4545efc4a95df | refs/heads/master | 2022-03-20T03:34:23.671807 | 2019-11-24T20:43:45 | 2019-11-24T20:43:45 | 217,197,117 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 216 | h | #ifndef CLIENT_H
#define CLIENT_H
class Client {
public:
Client(std::string server_ip);
~Client();
void sendMessages(std::vector<std::string> messages);
private:
int sockid;
};
#endif // CLIENT_H
| [
"dan_seremet@yahoo.com"
] | dan_seremet@yahoo.com |
abe663b615b33d7bf85de29b31181778457a988b | 10632f52200b275400bd62d5dbdc2a8c69754a3a | /tertut4 - try digger/Engine/Engine/horizontalblurshaderclass.cpp | 2c0af5aa81d3e8f75e9031c9593b5066094e776a | [] | no_license | rex390/ProceduralCW | 98b48a27fb4ce98eb0fa4a99c9caaa8b0adfdb58 | 7ae414ef96860b9a90e56ecb0d75678dcf3c49bf | refs/heads/master | 2020-03-14T16:13:52.336090 | 2018-05-01T09:14:33 | 2018-05-01T09:14:33 | 131,693,796 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,461 | cpp | #include "horizontalblurshaderclass.h"
HorizontalBlurShaderClass::HorizontalBlurShaderClass()
{
m_vertexShader = 0;
m_pixelShader = 0;
m_layout = 0;
m_sampleState = 0;
m_matrixBuffer = 0;
m_screenSizeBuffer = 0;
}
HorizontalBlurShaderClass::HorizontalBlurShaderClass(const HorizontalBlurShaderClass& other)
{
}
HorizontalBlurShaderClass::~HorizontalBlurShaderClass()
{
}
bool HorizontalBlurShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
{
bool result;
// Initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, L"horizontalblur.vs", L"horizontalblur.ps");
if(!result)
{
return false;
}
return true;
}
void HorizontalBlurShaderClass::Shutdown()
{
// Shutdown the vertex and pixel shaders as well as the related objects.
ShutdownShader();
return;
}
bool HorizontalBlurShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix,
D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, float screenWidth)
{
bool result;
// Set the shader parameters that it will use for rendering.
result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, screenWidth);
if(!result)
{
return false;
}
// Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount);
return true;
}
bool HorizontalBlurShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{
HRESULT result;
ID3D10Blob* errorMessage;
ID3D10Blob* vertexShaderBuffer;
ID3D10Blob* pixelShaderBuffer;
D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
unsigned int numElements;
D3D11_SAMPLER_DESC samplerDesc;
D3D11_BUFFER_DESC matrixBufferDesc;
D3D11_BUFFER_DESC screenSizeBufferDesc;
// Initialize the pointers this function will use to null.
errorMessage = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
// Compile the vertex shader code.
result = D3DX11CompileFromFile(vsFilename, NULL, NULL, "HorizontalBlurVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL,
&vertexShaderBuffer, &errorMessage, NULL);
if(FAILED(result))
{
// If the shader failed to compile it should have writen something to the error message.
if(errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
}
// If there was nothing in the error message then it simply could not find the shader file itself.
else
{
MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
}
return false;
}
// Compile the pixel shader code.
result = D3DX11CompileFromFile(psFilename, NULL, NULL, "HorizontalBlurPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, NULL,
&pixelShaderBuffer, &errorMessage, NULL);
if(FAILED(result))
{
// If the shader failed to compile it should have writen something to the error message.
if(errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
}
// If there was nothing in the error message then it simply could not find the file itself.
else
{
MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
}
return false;
}
// Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
if(FAILED(result))
{
return false;
}
// Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
if(FAILED(result))
{
return false;
}
// Create the vertex input layout description.
// This setup needs to match the VertexType stucture in the ModelClass and in the shader.
polygonLayout[0].SemanticName = "POSITION";
polygonLayout[0].SemanticIndex = 0;
polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
polygonLayout[0].InputSlot = 0;
polygonLayout[0].AlignedByteOffset = 0;
polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[0].InstanceDataStepRate = 0;
polygonLayout[1].SemanticName = "TEXCOORD";
polygonLayout[1].SemanticIndex = 0;
polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
polygonLayout[1].InputSlot = 0;
polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[1].InstanceDataStepRate = 0;
// Get a count of the elements in the layout.
numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
// Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(),
&m_layout);
if(FAILED(result))
{
return false;
}
// Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
vertexShaderBuffer->Release();
vertexShaderBuffer = 0;
pixelShaderBuffer->Release();
pixelShaderBuffer = 0;
// Create a texture sampler state description.
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
samplerDesc.BorderColor[0] = 0;
samplerDesc.BorderColor[1] = 0;
samplerDesc.BorderColor[2] = 0;
samplerDesc.BorderColor[3] = 0;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
if(FAILED(result))
{
return false;
}
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
if(FAILED(result))
{
return false;
}
// Setup the description of the dynamic screen size constant buffer that is in the vertex shader.
screenSizeBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
screenSizeBufferDesc.ByteWidth = sizeof(ScreenSizeBufferType);
screenSizeBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
screenSizeBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
screenSizeBufferDesc.MiscFlags = 0;
screenSizeBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&screenSizeBufferDesc, NULL, &m_screenSizeBuffer);
if(FAILED(result))
{
return false;
}
return true;
}
void HorizontalBlurShaderClass::ShutdownShader()
{
// Release the screen size constant buffer.
if(m_screenSizeBuffer)
{
m_screenSizeBuffer->Release();
m_screenSizeBuffer = 0;
}
// Release the matrix constant buffer.
if(m_matrixBuffer)
{
m_matrixBuffer->Release();
m_matrixBuffer = 0;
}
// Release the sampler state.
if(m_sampleState)
{
m_sampleState->Release();
m_sampleState = 0;
}
// Release the layout.
if(m_layout)
{
m_layout->Release();
m_layout = 0;
}
// Release the pixel shader.
if(m_pixelShader)
{
m_pixelShader->Release();
m_pixelShader = 0;
}
// Release the vertex shader.
if(m_vertexShader)
{
m_vertexShader->Release();
m_vertexShader = 0;
}
return;
}
void HorizontalBlurShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{
char* compileErrors;
unsigned long bufferSize, i;
ofstream fout;
// Get a pointer to the error message text buffer.
compileErrors = (char*)(errorMessage->GetBufferPointer());
// Get the length of the message.
bufferSize = errorMessage->GetBufferSize();
// Open a file to write the error message to.
fout.open("shader-error.txt");
// Write out the error message.
for(i=0; i<bufferSize; i++)
{
fout << compileErrors[i];
}
// Close the file.
fout.close();
// Release the error message.
errorMessage->Release();
errorMessage = 0;
// Pop a message up on the screen to notify the user to check the text file for compile errors.
MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
return;
}
bool HorizontalBlurShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, D3DXMATRIX worldMatrix, D3DXMATRIX viewMatrix,
D3DXMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, float screenWidth)
{
HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource;
MatrixBufferType* dataPtr;
unsigned int bufferNumber;
ScreenSizeBufferType* dataPtr2;
// Transpose the matrices to prepare them for the shader.
D3DXMatrixTranspose(&worldMatrix, &worldMatrix);
D3DXMatrixTranspose(&viewMatrix, &viewMatrix);
D3DXMatrixTranspose(&projectionMatrix, &projectionMatrix);
// Lock the matrix constant buffer so it can be written to.
result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if(FAILED(result))
{
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix;
dataPtr->view = viewMatrix;
dataPtr->projection = projectionMatrix;
// Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader.
bufferNumber = 0;
// Now set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
// Lock the screen size constant buffer so it can be written to.
result = deviceContext->Map(m_screenSizeBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if(FAILED(result))
{
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr2 = (ScreenSizeBufferType*)mappedResource.pData;
// Copy the data into the constant buffer.
dataPtr2->screenWidth = screenWidth;
dataPtr2->padding = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
// Unlock the constant buffer.
deviceContext->Unmap(m_screenSizeBuffer, 0);
// Set the position of the constant buffer in the vertex shader.
bufferNumber = 1;
// Now set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_screenSizeBuffer);
// Set shader texture resource in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture);
return true;
}
void HorizontalBlurShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{
// Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(m_vertexShader, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0);
// Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState);
// Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0);
return;
}
| [
"rex390@users.noreply.github.com"
] | rex390@users.noreply.github.com |
0f3f6195d22a481b946981ccd36698c1164e5b73 | 88ae8695987ada722184307301e221e1ba3cc2fa | /third_party/grpc/src/src/core/lib/transport/metadata_batch.h | 5b4f6d972f7f60b1d839da0926b4e07c6a437cfd | [
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later",
"BSD-3-Clause",
"MPL-2.0"
] | permissive | iridium-browser/iridium-browser | 71d9c5ff76e014e6900b825f67389ab0ccd01329 | 5ee297f53dc7f8e70183031cff62f37b0f19d25f | refs/heads/master | 2023-08-03T16:44:16.844552 | 2023-07-20T15:17:00 | 2023-07-23T16:09:30 | 220,016,632 | 341 | 40 | BSD-3-Clause | 2021-08-13T13:54:45 | 2019-11-06T14:32:31 | null | UTF-8 | C++ | false | false | 49,658 | h | //
//
// Copyright 2015 gRPC 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.
//
//
#ifndef GRPC_SRC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
#define GRPC_SRC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
#include <grpc/support/port_platform.h>
#include <stdlib.h>
#include <cstdint>
#include <string>
#include <type_traits>
#include <utility>
#include "absl/container/inlined_vector.h"
#include "absl/functional/function_ref.h"
#include "absl/meta/type_traits.h"
#include "absl/strings/numbers.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include <grpc/impl/compression_types.h>
#include <grpc/status.h>
#include <grpc/support/log.h>
#include "src/core/lib/compression/compression_internal.h"
#include "src/core/lib/gprpp/chunked_vector.h"
#include "src/core/lib/gprpp/packed_table.h"
#include "src/core/lib/gprpp/time.h"
#include "src/core/lib/resource_quota/arena.h"
#include "src/core/lib/slice/slice.h"
#include "src/core/lib/transport/parsed_metadata.h"
namespace grpc_core {
// Given a metadata key and a value, return the encoded size.
// Defaults to calling the key's Encode() method and then calculating the size
// of that, but can be overridden for specific keys if there's a better way of
// doing this.
// May return 0 if the size is unknown/unknowable.
template <typename Key>
size_t EncodedSizeOfKey(Key, const typename Key::ValueType& value) {
return Key::Encode(value).size();
}
// grpc-timeout metadata trait.
// ValueType is defined as Timestamp - an absolute timestamp (i.e. a
// deadline!), that is converted to a duration by transports before being
// sent.
// TODO(ctiller): Move this elsewhere. During the transition we need to be able
// to name this in MetadataMap, but ultimately once the transition is done we
// should not need to.
struct GrpcTimeoutMetadata {
static constexpr bool kRepeatable = false;
using ValueType = Timestamp;
using MementoType = Duration;
static absl::string_view key() { return "grpc-timeout"; }
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
static ValueType MementoToValue(MementoType timeout);
static Slice Encode(ValueType x);
static std::string DisplayValue(ValueType x) { return x.ToString(); }
static std::string DisplayMemento(MementoType x) { return x.ToString(); }
};
// TE metadata trait.
struct TeMetadata {
static constexpr bool kRepeatable = false;
// HTTP2 says that TE can either be empty or "trailers".
// Empty means this trait is not included, "trailers" means kTrailers, and
// kInvalid is used to remember an invalid value.
enum ValueType : uint8_t {
kTrailers,
kInvalid,
};
using MementoType = ValueType;
static absl::string_view key() { return "te"; }
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
static ValueType MementoToValue(MementoType te) { return te; }
static StaticSlice Encode(ValueType x) {
GPR_ASSERT(x == kTrailers);
return StaticSlice::FromStaticString("trailers");
}
static const char* DisplayValue(ValueType te);
static const char* DisplayMemento(MementoType te) { return DisplayValue(te); }
};
inline size_t EncodedSizeOfKey(TeMetadata, TeMetadata::ValueType x) {
return x == TeMetadata::kTrailers ? 8 : 0;
}
// content-type metadata trait.
struct ContentTypeMetadata {
static constexpr bool kRepeatable = false;
// gRPC says that content-type can be application/grpc[;something]
// Core has only ever verified the prefix.
// IF we want to start verifying more, we can expand this type.
enum ValueType : uint8_t {
kApplicationGrpc,
kEmpty,
kInvalid,
};
using MementoType = ValueType;
static absl::string_view key() { return "content-type"; }
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
static ValueType MementoToValue(MementoType content_type) {
return content_type;
}
static StaticSlice Encode(ValueType x);
static const char* DisplayValue(ValueType content_type);
static const char* DisplayMemento(ValueType content_type) {
return DisplayValue(content_type);
}
};
// scheme metadata trait.
struct HttpSchemeMetadata {
static constexpr bool kRepeatable = false;
enum ValueType : uint8_t {
kHttp,
kHttps,
kInvalid,
};
using MementoType = ValueType;
static absl::string_view key() { return ":scheme"; }
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error) {
return Parse(value.as_string_view(), on_error);
}
static ValueType Parse(absl::string_view value,
MetadataParseErrorFn on_error);
static ValueType MementoToValue(MementoType content_type) {
return content_type;
}
static StaticSlice Encode(ValueType x);
static const char* DisplayValue(ValueType content_type);
static const char* DisplayMemento(MementoType content_type) {
return DisplayValue(content_type);
}
};
size_t EncodedSizeOfKey(HttpSchemeMetadata, HttpSchemeMetadata::ValueType x);
// method metadata trait.
struct HttpMethodMetadata {
static constexpr bool kRepeatable = false;
enum ValueType : uint8_t {
kPost,
kGet,
kPut,
kInvalid,
};
using MementoType = ValueType;
static absl::string_view key() { return ":method"; }
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
static ValueType MementoToValue(MementoType content_type) {
return content_type;
}
static StaticSlice Encode(ValueType x);
static const char* DisplayValue(ValueType content_type);
static const char* DisplayMemento(MementoType content_type) {
return DisplayValue(content_type);
}
};
// Base type for metadata pertaining to a single compression algorithm
// (e.g., "grpc-encoding").
struct CompressionAlgorithmBasedMetadata {
using ValueType = grpc_compression_algorithm;
using MementoType = ValueType;
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
static ValueType MementoToValue(MementoType x) { return x; }
static Slice Encode(ValueType x) {
GPR_ASSERT(x != GRPC_COMPRESS_ALGORITHMS_COUNT);
return Slice::FromStaticString(CompressionAlgorithmAsString(x));
}
static const char* DisplayValue(ValueType x) {
if (const char* p = CompressionAlgorithmAsString(x)) {
return p;
} else {
return "<discarded-invalid-value>";
}
}
static const char* DisplayMemento(MementoType x) { return DisplayValue(x); }
};
// grpc-encoding metadata trait.
struct GrpcEncodingMetadata : public CompressionAlgorithmBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-encoding"; }
};
// grpc-internal-encoding-request metadata trait.
struct GrpcInternalEncodingRequest : public CompressionAlgorithmBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-internal-encoding-request"; }
};
// grpc-accept-encoding metadata trait.
struct GrpcAcceptEncodingMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-accept-encoding"; }
using ValueType = CompressionAlgorithmSet;
using MementoType = ValueType;
static MementoType ParseMemento(Slice value, MetadataParseErrorFn) {
return CompressionAlgorithmSet::FromString(value.as_string_view());
}
static ValueType MementoToValue(MementoType x) { return x; }
static Slice Encode(ValueType x) { return x.ToSlice(); }
static absl::string_view DisplayValue(ValueType x) { return x.ToString(); }
static absl::string_view DisplayMemento(MementoType x) {
return DisplayValue(x);
}
};
struct SimpleSliceBasedMetadata {
using ValueType = Slice;
using MementoType = Slice;
static MementoType ParseMemento(Slice value, MetadataParseErrorFn) {
return value.TakeOwned();
}
static ValueType MementoToValue(MementoType value) { return value; }
static Slice Encode(const ValueType& x) { return x.Ref(); }
static absl::string_view DisplayValue(const ValueType& value) {
return value.as_string_view();
}
static absl::string_view DisplayMemento(const MementoType& value) {
return value.as_string_view();
}
};
// user-agent metadata trait.
struct UserAgentMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "user-agent"; }
};
// grpc-message metadata trait.
struct GrpcMessageMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-message"; }
};
// host metadata trait.
struct HostMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "host"; }
};
// endpoint-load-metrics-bin metadata trait.
struct EndpointLoadMetricsBinMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "endpoint-load-metrics-bin"; }
};
// grpc-server-stats-bin metadata trait.
struct GrpcServerStatsBinMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-server-stats-bin"; }
};
// grpc-trace-bin metadata trait.
struct GrpcTraceBinMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-trace-bin"; }
};
// grpc-tags-bin metadata trait.
struct GrpcTagsBinMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-tags-bin"; }
};
// :authority metadata trait.
struct HttpAuthorityMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return ":authority"; }
};
// :path metadata trait.
struct HttpPathMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return ":path"; }
};
// We separate SimpleIntBasedMetadata into two pieces: one that does not
// depend on the invalid value, and one that does. This allows the compiler to
// easily see the functions that are shared, and helps reduce code bloat here.
template <typename Int>
struct SimpleIntBasedMetadataBase {
using ValueType = Int;
using MementoType = Int;
static ValueType MementoToValue(MementoType value) { return value; }
static Slice Encode(ValueType x) { return Slice::FromInt64(x); }
static Int DisplayValue(ValueType x) { return x; }
static Int DisplayMemento(MementoType x) { return x; }
};
template <typename Int, Int kInvalidValue>
struct SimpleIntBasedMetadata : public SimpleIntBasedMetadataBase<Int> {
static constexpr Int invalid_value() { return kInvalidValue; }
static Int ParseMemento(Slice value, MetadataParseErrorFn on_error) {
Int out;
if (!absl::SimpleAtoi(value.as_string_view(), &out)) {
on_error("not an integer", value);
out = kInvalidValue;
}
return out;
}
};
// grpc-status metadata trait.
struct GrpcStatusMetadata
: public SimpleIntBasedMetadata<grpc_status_code, GRPC_STATUS_UNKNOWN> {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-status"; }
};
// grpc-previous-rpc-attempts metadata trait.
struct GrpcPreviousRpcAttemptsMetadata
: public SimpleIntBasedMetadata<uint32_t, 0> {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-previous-rpc-attempts"; }
};
// grpc-retry-pushback-ms metadata trait.
struct GrpcRetryPushbackMsMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpc-retry-pushback-ms"; }
using ValueType = Duration;
using MementoType = Duration;
static ValueType MementoToValue(MementoType x) { return x; }
static Slice Encode(Duration x) { return Slice::FromInt64(x.millis()); }
static int64_t DisplayValue(Duration x) { return x.millis(); }
static int64_t DisplayMemento(Duration x) { return DisplayValue(x); }
static Duration ParseMemento(Slice value, MetadataParseErrorFn on_error);
};
// :status metadata trait.
// TODO(ctiller): consider moving to uint16_t
struct HttpStatusMetadata : public SimpleIntBasedMetadata<uint32_t, 0> {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return ":status"; }
};
// "secret" metadata trait used to pass load balancing token between filters.
// This should not be exposed outside of gRPC core.
class GrpcLbClientStats;
struct GrpcLbClientStatsMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "grpclb_client_stats"; }
using ValueType = GrpcLbClientStats*;
using MementoType = ValueType;
static ValueType MementoToValue(MementoType value) { return value; }
static Slice Encode(ValueType) { abort(); }
static const char* DisplayValue(ValueType) { return "<internal-lb-stats>"; }
static const char* DisplayMemento(MementoType) {
return "<internal-lb-stats>";
}
static MementoType ParseMemento(Slice, MetadataParseErrorFn) {
return nullptr;
}
};
inline size_t EncodedSizeOfKey(GrpcLbClientStatsMetadata,
GrpcLbClientStatsMetadata::ValueType) {
return 0;
}
// lb-token metadata
struct LbTokenMetadata : public SimpleSliceBasedMetadata {
static constexpr bool kRepeatable = false;
static absl::string_view key() { return "lb-token"; }
};
// lb-cost-bin metadata
struct LbCostBinMetadata {
static constexpr bool kRepeatable = true;
static absl::string_view key() { return "lb-cost-bin"; }
struct ValueType {
double cost;
std::string name;
};
using MementoType = ValueType;
static ValueType MementoToValue(MementoType value) { return value; }
static Slice Encode(const ValueType& x);
static std::string DisplayValue(ValueType x);
static std::string DisplayMemento(MementoType x) { return DisplayValue(x); }
static MementoType ParseMemento(Slice value, MetadataParseErrorFn on_error);
};
// Annotation added by a transport to note whether a failed request was never
// placed on the wire, or never seen by a server.
struct GrpcStreamNetworkState {
static absl::string_view DebugKey() { return "GrpcStreamNetworkState"; }
static constexpr bool kRepeatable = false;
enum ValueType : uint8_t {
kNotSentOnWire,
kNotSeenByServer,
};
static std::string DisplayValue(ValueType x);
};
// Annotation added by a server transport to note the peer making a request.
struct PeerString {
static absl::string_view DebugKey() { return "PeerString"; }
static constexpr bool kRepeatable = false;
using ValueType = Slice;
static std::string DisplayValue(const ValueType& x);
};
// Annotation added by various systems to describe the reason for a failure.
struct GrpcStatusContext {
static absl::string_view DebugKey() { return "GrpcStatusContext"; }
static constexpr bool kRepeatable = true;
using ValueType = std::string;
static const std::string& DisplayValue(const std::string& x);
};
// Annotation added by a transport to note that the status came from the wire.
struct GrpcStatusFromWire {
static absl::string_view DebugKey() { return "GrpcStatusFromWire"; }
static constexpr bool kRepeatable = false;
using ValueType = bool;
static absl::string_view DisplayValue(bool x) { return x ? "true" : "false"; }
};
// Annotation added by client surface code to denote wait-for-ready state
struct WaitForReady {
struct ValueType {
bool value = false;
bool explicitly_set = false;
};
static absl::string_view DebugKey() { return "WaitForReady"; }
static constexpr bool kRepeatable = false;
static std::string DisplayValue(ValueType x);
};
// Annotation added by a transport to note that server trailing metadata
// is a Trailers-Only response.
struct GrpcTrailersOnly {
static absl::string_view DebugKey() { return "GrpcTrailersOnly"; }
static constexpr bool kRepeatable = false;
using ValueType = bool;
static absl::string_view DisplayValue(bool x) { return x ? "true" : "false"; }
};
namespace metadata_detail {
// Build a key/value formatted debug string.
// Output looks like 'key1: value1, key2: value2'
// The string is expected to be readable, but not necessarily parsable.
class DebugStringBuilder {
public:
// Add one key/value pair to the output.
void Add(absl::string_view key, absl::string_view value);
// Finalize the output and return the string.
// Subsequent Add calls are UB.
std::string TakeOutput() { return std::move(out_); }
private:
std::string out_;
};
// IsEncodable: Given a trait, determine if that trait is encodable, or is
// just a value attached to a MetadataMap. We use the presence of the key()
// static method to determine if a trait is encodable or not - encodable
// traits have string names, and non-encodable traits do not.
template <typename Trait, typename Ignored = void>
struct IsEncodableTrait {
static const bool value = false;
};
template <typename Trait>
struct IsEncodableTrait<Trait, absl::void_t<decltype(Trait::key())>> {
static const bool value = true;
};
// Helper type - maps a string name to a trait.
template <typename MustBeVoid, typename... Traits>
struct NameLookup;
template <typename Trait, typename... Traits>
struct NameLookup<absl::enable_if_t<IsEncodableTrait<Trait>::value, void>,
Trait, Traits...> {
// Call op->Found(Trait()) if op->name == Trait::key() for some Trait in
// Traits. If not found, call op->NotFound().
template <typename Op>
static auto Lookup(absl::string_view key, Op* op)
-> decltype(op->Found(Trait())) {
if (key == Trait::key()) {
return op->Found(Trait());
}
return NameLookup<void, Traits...>::Lookup(key, op);
}
};
template <typename Trait, typename... Traits>
struct NameLookup<absl::enable_if_t<!IsEncodableTrait<Trait>::value, void>,
Trait, Traits...> {
template <typename Op>
static auto Lookup(absl::string_view key, Op* op)
-> decltype(NameLookup<void, Traits...>::Lookup(key, op)) {
return NameLookup<void, Traits...>::Lookup(key, op);
}
};
template <>
struct NameLookup<void> {
template <typename Op>
static auto Lookup(absl::string_view key, Op* op)
-> decltype(op->NotFound(key)) {
return op->NotFound(key);
}
};
// Helper to take a slice to a memento to a value.
// By splitting this part out we can scale code size as the number of
// (memento, value) types, rather than as the number of traits.
template <typename ParseMementoFn, typename MementoToValueFn>
struct ParseValue {
template <ParseMementoFn parse_memento, MementoToValueFn memento_to_value>
static GPR_ATTRIBUTE_NOINLINE auto Parse(Slice* value,
MetadataParseErrorFn on_error)
-> decltype(memento_to_value(parse_memento(std::move(*value),
on_error))) {
return memento_to_value(parse_memento(std::move(*value), on_error));
}
};
// This is an "Op" type for NameLookup.
// Used for MetadataMap::Parse, its Found/NotFound methods turn a slice into a
// ParsedMetadata object.
template <typename Container>
class ParseHelper {
public:
ParseHelper(Slice value, MetadataParseErrorFn on_error, size_t transport_size)
: value_(std::move(value)),
on_error_(on_error),
transport_size_(transport_size) {}
template <typename Trait>
GPR_ATTRIBUTE_NOINLINE ParsedMetadata<Container> Found(Trait trait) {
return ParsedMetadata<Container>(
trait,
ParseValueToMemento<typename Trait::MementoType, Trait::ParseMemento>(),
static_cast<uint32_t>(transport_size_));
}
GPR_ATTRIBUTE_NOINLINE ParsedMetadata<Container> NotFound(
absl::string_view key) {
return ParsedMetadata<Container>(Slice::FromCopiedString(key),
std::move(value_));
}
private:
template <typename T, T (*parse_memento)(Slice, MetadataParseErrorFn)>
GPR_ATTRIBUTE_NOINLINE T ParseValueToMemento() {
return parse_memento(std::move(value_), on_error_);
}
Slice value_;
MetadataParseErrorFn on_error_;
const size_t transport_size_;
};
// This is an "Op" type for NameLookup.
// Used for MetadataMap::Append, its Found/NotFound methods turn a slice into
// a value and add it to a container.
template <typename Container>
class AppendHelper {
public:
AppendHelper(Container* container, Slice value, MetadataParseErrorFn on_error)
: container_(container), value_(std::move(value)), on_error_(on_error) {}
template <typename Trait>
GPR_ATTRIBUTE_NOINLINE void Found(Trait trait) {
container_->Set(
trait, ParseValue<decltype(Trait::ParseMemento),
decltype(Trait::MementoToValue)>::
template Parse<Trait::ParseMemento, Trait::MementoToValue>(
&value_, on_error_));
}
GPR_ATTRIBUTE_NOINLINE void NotFound(absl::string_view key) {
container_->unknown_.Append(key, std::move(value_));
}
private:
Container* const container_;
Slice value_;
MetadataParseErrorFn on_error_;
};
// This is an "Op" type for NameLookup.
// Used for MetadataMap::Remove, its Found/NotFound methods remove a key from
// the container.
template <typename Container>
class RemoveHelper {
public:
explicit RemoveHelper(Container* container) : container_(container) {}
template <typename Trait>
GPR_ATTRIBUTE_NOINLINE void Found(Trait trait) {
container_->Remove(trait);
}
GPR_ATTRIBUTE_NOINLINE void NotFound(absl::string_view key) {
container_->unknown_.Remove(key);
}
private:
Container* const container_;
};
// This is an "Op" type for NameLookup.
// Used for MetadataMap::GetStringValue, its Found/NotFound methods generated
// a string value from the container.
template <typename Container>
class GetStringValueHelper {
public:
explicit GetStringValueHelper(const Container* container,
std::string* backing)
: container_(container), backing_(backing) {}
template <typename Trait>
GPR_ATTRIBUTE_NOINLINE absl::enable_if_t<
Trait::kRepeatable == false &&
std::is_same<Slice, typename Trait::ValueType>::value,
absl::optional<absl::string_view>>
Found(Trait) {
const auto* value = container_->get_pointer(Trait());
if (value == nullptr) return absl::nullopt;
return value->as_string_view();
}
template <typename Trait>
GPR_ATTRIBUTE_NOINLINE absl::enable_if_t<
Trait::kRepeatable == true &&
!std::is_same<Slice, typename Trait::ValueType>::value,
absl::optional<absl::string_view>>
Found(Trait) {
const auto* value = container_->get_pointer(Trait());
if (value == nullptr) return absl::nullopt;
backing_->clear();
for (const auto& v : *value) {
if (!backing_->empty()) backing_->push_back(',');
auto new_segment = Trait::Encode(v);
backing_->append(new_segment.begin(), new_segment.end());
}
return *backing_;
}
template <typename Trait>
GPR_ATTRIBUTE_NOINLINE absl::enable_if_t<
Trait::kRepeatable == false &&
!std::is_same<Slice, typename Trait::ValueType>::value,
absl::optional<absl::string_view>>
Found(Trait) {
const auto* value = container_->get_pointer(Trait());
if (value == nullptr) return absl::nullopt;
*backing_ = std::string(Trait::Encode(*value).as_string_view());
return *backing_;
}
GPR_ATTRIBUTE_NOINLINE absl::optional<absl::string_view> NotFound(
absl::string_view key) {
return container_->unknown_.GetStringValue(key, backing_);
}
private:
const Container* const container_;
std::string* backing_;
};
// Sink for key value logs
using LogFn = absl::FunctionRef<void(absl::string_view, absl::string_view)>;
template <typename T>
struct AdaptDisplayValueToLog {
static std::string ToString(const T& value) { return std::to_string(value); }
};
template <>
struct AdaptDisplayValueToLog<std::string> {
static std::string ToString(const std::string& value) { return value; }
};
template <>
struct AdaptDisplayValueToLog<const std::string&> {
static std::string ToString(const std::string& value) { return value; }
};
template <>
struct AdaptDisplayValueToLog<absl::string_view> {
static std::string ToString(absl::string_view value) {
return std::string(value);
}
};
template <>
struct AdaptDisplayValueToLog<Slice> {
static std::string ToString(Slice value) {
return std::string(value.as_string_view());
}
};
template <>
struct AdaptDisplayValueToLog<const char*> {
static std::string ToString(const char* value) { return std::string(value); }
};
template <>
struct AdaptDisplayValueToLog<StaticSlice> {
static absl::string_view ToString(StaticSlice value) {
return value.as_string_view();
}
};
template <typename T, typename U, typename V>
GPR_ATTRIBUTE_NOINLINE void LogKeyValueTo(absl::string_view key, const T& value,
V (*display_value)(U), LogFn log_fn) {
log_fn(key, AdaptDisplayValueToLog<V>::ToString(display_value(value)));
}
// Generate a strong type for metadata values per trait.
template <typename Which, typename Ignored = void>
struct Value;
template <typename Which>
struct Value<Which, absl::enable_if_t<Which::kRepeatable == false &&
IsEncodableTrait<Which>::value,
void>> {
Value() = default;
explicit Value(const typename Which::ValueType& value) : value(value) {}
explicit Value(typename Which::ValueType&& value)
: value(std::forward<typename Which::ValueType>(value)) {}
Value(const Value&) = delete;
Value& operator=(const Value&) = delete;
Value(Value&&) noexcept = default;
Value& operator=(Value&& other) noexcept {
value = std::move(other.value);
return *this;
}
template <typename Encoder>
void EncodeTo(Encoder* encoder) const {
encoder->Encode(Which(), value);
}
template <typename Encoder>
void VisitWith(Encoder* encoder) const {
return EncodeTo(encoder);
}
void LogTo(LogFn log_fn) const {
LogKeyValueTo(Which::key(), value, Which::DisplayValue, log_fn);
}
using StorageType = typename Which::ValueType;
GPR_NO_UNIQUE_ADDRESS StorageType value;
};
template <typename Which>
struct Value<Which, absl::enable_if_t<Which::kRepeatable == false &&
!IsEncodableTrait<Which>::value,
void>> {
Value() = default;
explicit Value(const typename Which::ValueType& value) : value(value) {}
explicit Value(typename Which::ValueType&& value)
: value(std::forward<typename Which::ValueType>(value)) {}
Value(const Value&) = delete;
Value& operator=(const Value&) = delete;
Value(Value&&) noexcept = default;
Value& operator=(Value&& other) noexcept {
value = std::move(other.value);
return *this;
}
template <typename Encoder>
void EncodeTo(Encoder*) const {}
template <typename Encoder>
void VisitWith(Encoder* encoder) const {
encoder->Encode(Which(), value);
}
void LogTo(LogFn log_fn) const {
LogKeyValueTo(Which::DebugKey(), value, Which::DisplayValue, log_fn);
}
using StorageType = typename Which::ValueType;
GPR_NO_UNIQUE_ADDRESS StorageType value;
};
template <typename Which>
struct Value<Which, absl::enable_if_t<Which::kRepeatable == true &&
IsEncodableTrait<Which>::value,
void>> {
Value() = default;
explicit Value(const typename Which::ValueType& value) {
this->value.push_back(value);
}
explicit Value(typename Which::ValueType&& value) {
this->value.emplace_back(std::forward<typename Which::ValueType>(value));
}
Value(const Value&) = delete;
Value& operator=(const Value&) = delete;
Value(Value&& other) noexcept : value(std::move(other.value)) {}
Value& operator=(Value&& other) noexcept {
value = std::move(other.value);
return *this;
}
template <typename Encoder>
void EncodeTo(Encoder* encoder) const {
for (const auto& v : value) {
encoder->Encode(Which(), v);
}
}
template <typename Encoder>
void VisitWith(Encoder* encoder) const {
return EncodeTo(encoder);
}
void LogTo(LogFn log_fn) const {
for (const auto& v : value) {
LogKeyValueTo(Which::key(), v, Which::Encode, log_fn);
}
}
using StorageType = absl::InlinedVector<typename Which::ValueType, 1>;
StorageType value;
};
template <typename Which>
struct Value<Which, absl::enable_if_t<Which::kRepeatable == true &&
!IsEncodableTrait<Which>::value,
void>> {
Value() = default;
explicit Value(const typename Which::ValueType& value) {
this->value.push_back(value);
}
explicit Value(typename Which::ValueType&& value) {
this->value.emplace_back(std::forward<typename Which::ValueType>(value));
}
Value(const Value&) = delete;
Value& operator=(const Value&) = delete;
Value(Value&& other) noexcept : value(std::move(other.value)) {}
Value& operator=(Value&& other) noexcept {
value = std::move(other.value);
return *this;
}
template <typename Encoder>
void EncodeTo(Encoder*) const {}
template <typename Encoder>
void VisitWith(Encoder* encoder) const {
for (const auto& v : value) {
encoder->Encode(Which(), v);
}
}
void LogTo(LogFn log_fn) const {
for (const auto& v : value) {
LogKeyValueTo(Which::DebugKey(), v, Which::DisplayValue, log_fn);
}
}
using StorageType = absl::InlinedVector<typename Which::ValueType, 1>;
StorageType value;
};
// Encoder to copy some metadata
template <typename Output>
class CopySink {
public:
explicit CopySink(Output* dst) : dst_(dst) {}
template <class T, class V>
void Encode(T trait, V value) {
dst_->Set(trait, value);
}
template <class T>
void Encode(T trait, const Slice& value) {
dst_->Set(trait, std::move(value.AsOwned()));
}
void Encode(const Slice& key, const Slice& value) {
dst_->unknown_.Append(key.as_string_view(), value.Ref());
}
private:
Output* dst_;
};
// Callable for the ForEach in Encode() -- for each value, call the
// appropriate encoder method.
template <typename Encoder>
struct EncodeWrapper {
Encoder* encoder;
template <typename Which>
void operator()(const Value<Which>& which) {
which.EncodeTo(encoder);
}
};
// Callable for the table ForEach in ForEach() -- for each value, call the
// appropriate visitor method.
template <typename Encoder>
struct ForEachWrapper {
Encoder* encoder;
template <typename Which>
void operator()(const Value<Which>& which) {
which.VisitWith(encoder);
}
};
// Callable for the ForEach in Log()
struct LogWrapper {
LogFn log_fn;
template <typename Which>
void operator()(const Value<Which>& which) {
which.LogTo(log_fn);
}
};
// Encoder to compute TransportSize
class TransportSizeEncoder {
public:
void Encode(const Slice& key, const Slice& value) {
size_ += key.length() + value.length() + 32;
}
template <typename Which>
void Encode(Which, const typename Which::ValueType& value) {
Add(Which(), value);
}
void Encode(ContentTypeMetadata,
const typename ContentTypeMetadata::ValueType& value) {
if (value == ContentTypeMetadata::kInvalid) return;
Add(ContentTypeMetadata(), value);
}
size_t size() const { return size_; }
private:
template <typename Which>
void Add(Which, const typename Which::ValueType& value) {
size_ += Which::key().length() + Which::Encode(value).length() + 32;
}
uint32_t size_ = 0;
};
// Handle unknown (non-trait-based) fields in the metadata map.
class UnknownMap {
public:
explicit UnknownMap(Arena* arena) : unknown_(arena) {}
using BackingType = ChunkedVector<std::pair<Slice, Slice>, 10>;
void Append(absl::string_view key, Slice value);
void Remove(absl::string_view key);
absl::optional<absl::string_view> GetStringValue(absl::string_view key,
std::string* backing) const;
BackingType::ConstForwardIterator begin() const { return unknown_.cbegin(); }
BackingType::ConstForwardIterator end() const { return unknown_.cend(); }
bool empty() const { return unknown_.empty(); }
size_t size() const { return unknown_.size(); }
void Clear() { unknown_.Clear(); }
Arena* arena() const { return unknown_.arena(); }
private:
// Backing store for added metadata.
ChunkedVector<std::pair<Slice, Slice>, 10> unknown_;
};
} // namespace metadata_detail
// Helper function for encoders
// Given a metadata trait, convert the value to a slice.
template <typename Which>
absl::enable_if_t<std::is_same<typename Which::ValueType, Slice>::value,
const Slice&>
MetadataValueAsSlice(const Slice& slice) {
return slice;
}
template <typename Which>
absl::enable_if_t<!std::is_same<typename Which::ValueType, Slice>::value, Slice>
MetadataValueAsSlice(typename Which::ValueType value) {
return Slice(Which::Encode(value));
}
// MetadataMap encodes the mapping of metadata keys to metadata values.
//
// MetadataMap takes a derived class and list of traits. Each of these trait
// objects defines one metadata field that is used by core, and so should have
// more specialized handling than just using the generic APIs.
//
// MetadataMap is the backing type for some derived type via the curiously
// recursive template pattern. This is because many types consumed by
// MetadataMap require the container type to operate on, and many of those
// types are instantiated one per trait. A naive implementation without the
// Derived type would, for traits A,B,C, then instantiate for some
// T<Container, Trait>:
// - T<MetadataMap<A,B,C>, A>,
// - T<MetadataMap<A,B,C>, B>,
// - T<MetadataMap<A,B,C>, C>.
// Since these types ultimately need to be recorded in the .dynstr segment
// for dynamic linkers (if gRPC is linked as a static library) this would
// create O(N^2) bytes of symbols even in stripped libraries. To avoid this
// we use the derived type (e.g. grpc_metadata_batch right now) to capture
// the container type, and we would write T<grpc_metadata_batch, A>, etc...
// Note that now the container type uses a number of bytes that is independent
// of the number of traits, and so we return to a linear symbol table growth
// function.
//
// Each trait object has one of two possible signatures, depending on whether
// that traits field is encodable or not.
// Non-encodable traits are carried in a MetadataMap, but are never passed to
// the application nor serialized to wire.
//
// Encodable traits have the following signature:
// // Traits for the "grpc-xyz" metadata field:
// struct GrpcXyzMetadata {
// // Can this metadata field be repeated?
// static constexpr bool kRepeatable = ...;
// // The type that's stored on MetadataBatch
// using ValueType = ...;
// // The type that's stored in compression/decompression tables
// using MementoType = ...;
// // The string key for this metadata type (for transports that require it)
// static absl::string_view key() { return "grpc-xyz"; }
// // Parse a memento from a slice
// // Takes ownership of value
// // Calls fn in the case of an error that should be reported to the user
// static MementoType ParseMemento(Slice value, MementoParseErrorFn fn) {
// ...
// }
// // Convert a memento to a value
// static ValueType MementoToValue(MementoType memento) { ... }
// // Convert a value to its canonical text wire format (the format that
// // ParseMemento will accept!)
// static Slice Encode(const ValueType& value);
// // Convert a value to something that can be passed to StrCat and
// displayed
// // for debugging
// static SomeStrCatableType DisplayValue(ValueType value) { ... }
// static SomeStrCatableType DisplayMemento(MementoType value) { ... }
// };
//
// Non-encodable traits are determined by missing the key() method, and have
// the following signature (and by convention omit the Metadata part of the
// type name):
// // Traits for the GrpcXyz field:
// struct GrpcXyz {
// // The string key that should be used for debug dumps - should not be a
// // valid http2 key (ie all lower case)
// static absl::string_view DebugKey() { return "GRPC_XYZ"; }
// // Can this metadata field be repeated?
// static constexpr bool kRepeatable = ...;
// // The type that's stored on MetadataBatch
// using ValueType = ...;
// // Convert a value to something that can be passed to StrCat and
// displayed
// // for debugging
// static SomeStrCatableType DisplayValue(ValueType value) { ... }
// };
//
// About parsing and mementos:
//
// Many gRPC transports exchange metadata as key/value strings, but also allow
// for a more efficient representation as a single integer. We can use this
// integer representation to avoid reparsing too, by storing the parsed value
// in the compression table. This is what mementos are used for.
//
// A trait offers the capability to turn a slice into a memento via
// ParseMemento. This is exposed to users of MetadataMap via the Parse()
// method, that returns a ParsedMetadata object. That ParsedMetadata object
// can in turn be used to set the same value on many different MetadataMaps
// without having to reparse.
//
// Implementation wise, ParsedMetadata is a type erased wrapper around
// MementoType. When we set a value on MetadataMap, we first turn that memento
// into a value. For most types, this is going to be a no-op, but for example
// for grpc-timeout we make the memento the timeout expressed on the wire, but
// we make the value the timestamp of when the timeout will expire (i.e. the
// deadline).
template <class Derived, typename... Traits>
class MetadataMap {
public:
explicit MetadataMap(Arena* arena);
~MetadataMap();
MetadataMap(const MetadataMap&) = delete;
MetadataMap& operator=(const MetadataMap&) = delete;
MetadataMap(MetadataMap&&) noexcept;
// We never create MetadataMap directly, instead we create Derived, but we
// want to be able to move it without redeclaring this.
// NOLINTNEXTLINE(misc-unconventional-assign-operator)
Derived& operator=(MetadataMap&&) noexcept;
// Encode this metadata map into some encoder.
// For each field that is set in the MetadataMap, call
// encoder->Encode.
//
// For fields for which we have traits, this will be a method with
// the signature:
// void Encode(TraitsType, typename TraitsType::ValueType value);
// For fields for which we do not have traits, this will be a method
// with the signature:
// void Encode(string_view key, Slice value);
template <typename Encoder>
void Encode(Encoder* encoder) const {
table_.template ForEachIn<metadata_detail::EncodeWrapper<Encoder>,
Value<Traits>...>(
metadata_detail::EncodeWrapper<Encoder>{encoder});
for (const auto& unk : unknown_) {
encoder->Encode(unk.first, unk.second);
}
}
// Like Encode, but also visit the non-encodable fields.
template <typename Encoder>
void ForEach(Encoder* encoder) const {
table_.ForEach(metadata_detail::ForEachWrapper<Encoder>{encoder});
for (const auto& unk : unknown_) {
encoder->Encode(unk.first, unk.second);
}
}
// Similar to Encode, but targeted at logging: for each metadatum,
// call f(key, value) as absl::string_views.
void Log(metadata_detail::LogFn log_fn) const {
table_.ForEach(metadata_detail::LogWrapper{log_fn});
for (const auto& unk : unknown_) {
log_fn(unk.first.as_string_view(), unk.second.as_string_view());
}
}
std::string DebugString() const {
metadata_detail::DebugStringBuilder builder;
Log([&builder](absl::string_view key, absl::string_view value) {
builder.Add(key, value);
});
return builder.TakeOutput();
}
// Get the pointer to the value of some known metadata.
// Returns nullptr if the metadata is not present.
// Causes a compilation error if Which is not an element of Traits.
template <typename Which>
const typename metadata_detail::Value<Which>::StorageType* get_pointer(
Which) const {
if (auto* p = table_.template get<Value<Which>>()) return &p->value;
return nullptr;
}
// Get the pointer to the value of some known metadata.
// Returns nullptr if the metadata is not present.
// Causes a compilation error if Which is not an element of Traits.
template <typename Which>
typename metadata_detail::Value<Which>::StorageType* get_pointer(Which) {
if (auto* p = table_.template get<Value<Which>>()) return &p->value;
return nullptr;
}
// Get the pointer to the value of some known metadata.
// Adds the default value for the metadata is not present.
// Causes a compilation error if Which is not an element of Traits.
template <typename Which>
typename metadata_detail::Value<Which>::StorageType* GetOrCreatePointer(
Which) {
return &table_.template get_or_create<Value<Which>>()->value;
}
// Get the value of some known metadata.
// Returns nullopt if the metadata is not present.
// Causes a compilation error if Which is not an element of Traits.
template <typename Which>
absl::optional<typename Which::ValueType> get(Which) const {
if (auto* p = table_.template get<Value<Which>>()) return p->value;
return absl::nullopt;
}
// Set the value of some known metadata.
// Returns a pointer to the new value.
template <typename Which, typename... Args>
absl::enable_if_t<Which::kRepeatable == false, void> Set(Which,
Args&&... args) {
table_.template set<Value<Which>>(std::forward<Args>(args)...);
}
template <typename Which, typename... Args>
absl::enable_if_t<Which::kRepeatable == true, void> Set(Which,
Args&&... args) {
GetOrCreatePointer(Which())->emplace_back(std::forward<Args>(args)...);
}
// Remove a specific piece of known metadata.
template <typename Which>
void Remove(Which) {
table_.template clear<Value<Which>>();
}
// Remove some metadata by name
void Remove(absl::string_view key) {
metadata_detail::RemoveHelper<Derived> helper(static_cast<Derived*>(this));
metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
}
void Remove(const char* key) { Remove(absl::string_view(key)); }
// Retrieve some metadata by name
absl::optional<absl::string_view> GetStringValue(absl::string_view name,
std::string* buffer) const {
metadata_detail::GetStringValueHelper<Derived> helper(
static_cast<const Derived*>(this), buffer);
return metadata_detail::NameLookup<void, Traits...>::Lookup(name, &helper);
}
// Extract a piece of known metadata.
// Returns nullopt if the metadata was not present, or the value if it was.
// The same as:
// auto value = m.get(T());
// m.Remove(T());
template <typename Which>
absl::enable_if_t<Which::kRepeatable == false,
absl::optional<typename Which::ValueType>>
Take(Which which) {
if (auto* p = get_pointer(which)) {
absl::optional<typename Which::ValueType> value(std::move(*p));
Remove(which);
return value;
}
return {};
}
// Extract repeated known metadata.
// Returns an empty vector if the metadata was not present.
template <typename Which>
absl::enable_if_t<Which::kRepeatable == true,
typename metadata_detail::Value<Which>::StorageType>
Take(Which which) {
if (auto* p = get_pointer(which)) {
typename Value<Which>::StorageType value = std::move(*p);
Remove(which);
return value;
}
return {};
}
// Parse metadata from a key/value pair, and return an object representing
// that result.
// TODO(ctiller): key should probably be an absl::string_view.
// Once we don't care about interning anymore, make that change!
static ParsedMetadata<Derived> Parse(absl::string_view key, Slice value,
uint32_t transport_size,
MetadataParseErrorFn on_error) {
metadata_detail::ParseHelper<Derived> helper(value.TakeOwned(), on_error,
transport_size);
return metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
}
// Set a value from a parsed metadata object.
void Set(const ParsedMetadata<Derived>& m) {
m.SetOnContainer(static_cast<Derived*>(this));
}
// Append a key/value pair - takes ownership of value
void Append(absl::string_view key, Slice value,
MetadataParseErrorFn on_error) {
metadata_detail::AppendHelper<Derived> helper(static_cast<Derived*>(this),
value.TakeOwned(), on_error);
metadata_detail::NameLookup<void, Traits...>::Lookup(key, &helper);
}
void Clear();
size_t TransportSize() const;
Derived Copy() const;
bool empty() const { return table_.empty() && unknown_.empty(); }
size_t count() const { return table_.count() + unknown_.size(); }
private:
friend class metadata_detail::AppendHelper<Derived>;
friend class metadata_detail::GetStringValueHelper<Derived>;
friend class metadata_detail::RemoveHelper<Derived>;
friend class metadata_detail::CopySink<Derived>;
friend class ParsedMetadata<Derived>;
template <typename Which>
using Value = metadata_detail::Value<Which>;
// Table of known metadata types.
PackedTable<Value<Traits>...> table_;
metadata_detail::UnknownMap unknown_;
};
// Ok/not-ok check for metadata maps that contain GrpcStatusMetadata, so that
// they can be used as result types for TrySeq.
template <typename Derived, typename... Args>
inline bool IsStatusOk(const MetadataMap<Derived, Args...>& m) {
return m.get(GrpcStatusMetadata()).value_or(GRPC_STATUS_UNKNOWN) ==
GRPC_STATUS_OK;
}
template <typename Derived, typename... Traits>
MetadataMap<Derived, Traits...>::MetadataMap(Arena* arena) : unknown_(arena) {}
template <typename Derived, typename... Traits>
MetadataMap<Derived, Traits...>::MetadataMap(MetadataMap&& other) noexcept
: table_(std::move(other.table_)), unknown_(std::move(other.unknown_)) {}
// We never create MetadataMap directly, instead we create Derived, but we
// want to be able to move it without redeclaring this.
// NOLINTNEXTLINE(misc-unconventional-assign-operator)
template <typename Derived, typename... Traits>
Derived& MetadataMap<Derived, Traits...>::operator=(
MetadataMap&& other) noexcept {
table_ = std::move(other.table_);
unknown_ = std::move(other.unknown_);
return static_cast<Derived&>(*this);
}
template <typename Derived, typename... Traits>
MetadataMap<Derived, Traits...>::~MetadataMap() = default;
template <typename Derived, typename... Traits>
void MetadataMap<Derived, Traits...>::Clear() {
table_.ClearAll();
unknown_.Clear();
}
template <typename Derived, typename... Traits>
size_t MetadataMap<Derived, Traits...>::TransportSize() const {
metadata_detail::TransportSizeEncoder enc;
Encode(&enc);
return enc.size();
}
template <typename Derived, typename... Traits>
Derived MetadataMap<Derived, Traits...>::Copy() const {
Derived out(unknown_.arena());
metadata_detail::CopySink<Derived> sink(&out);
ForEach(&sink);
return out;
}
} // namespace grpc_core
struct grpc_metadata_batch;
using grpc_metadata_batch_base = grpc_core::MetadataMap<
grpc_metadata_batch,
// Colon prefixed headers first
grpc_core::HttpPathMetadata, grpc_core::HttpAuthorityMetadata,
grpc_core::HttpMethodMetadata, grpc_core::HttpStatusMetadata,
grpc_core::HttpSchemeMetadata,
// Non-colon prefixed headers begin here
grpc_core::ContentTypeMetadata, grpc_core::TeMetadata,
grpc_core::GrpcEncodingMetadata, grpc_core::GrpcInternalEncodingRequest,
grpc_core::GrpcAcceptEncodingMetadata, grpc_core::GrpcStatusMetadata,
grpc_core::GrpcTimeoutMetadata, grpc_core::GrpcPreviousRpcAttemptsMetadata,
grpc_core::GrpcRetryPushbackMsMetadata, grpc_core::UserAgentMetadata,
grpc_core::GrpcMessageMetadata, grpc_core::HostMetadata,
grpc_core::EndpointLoadMetricsBinMetadata,
grpc_core::GrpcServerStatsBinMetadata, grpc_core::GrpcTraceBinMetadata,
grpc_core::GrpcTagsBinMetadata, grpc_core::GrpcLbClientStatsMetadata,
grpc_core::LbCostBinMetadata, grpc_core::LbTokenMetadata,
// Non-encodable things
grpc_core::GrpcStreamNetworkState, grpc_core::PeerString,
grpc_core::GrpcStatusContext, grpc_core::GrpcStatusFromWire,
grpc_core::WaitForReady, grpc_core::GrpcTrailersOnly>;
struct grpc_metadata_batch : public grpc_metadata_batch_base {
using grpc_metadata_batch_base::grpc_metadata_batch_base;
};
#endif // GRPC_SRC_CORE_LIB_TRANSPORT_METADATA_BATCH_H
| [
"jengelh@inai.de"
] | jengelh@inai.de |
66eaa3234081325fc74e6f3e0e4fb3ac5946b141 | 2204e2916dc9e01da168ae54a5de84d0fd746d5f | /pipes/pipes.cpp | eaa33dde431ffb6c29ce70efedb45630e9963530 | [] | no_license | Sukhdev841/Computer-Networks | 5c34b1313612c18e0381e1f1a7f1ac38616ca1e5 | 03a03ef33d230aa14ecde17989fadfe921d91414 | refs/heads/master | 2021-09-11T23:44:40.011319 | 2018-04-13T07:30:25 | 2018-04-13T07:30:25 | 116,450,012 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 839 | cpp | #include <iostream>
#include <unistd.h>
using namespace std;
void parent(int rfd,int wfd)
{
while(true)
{
const char *s = "parent";
char *k = new char[100];
write(wfd,s,strlen(s));
read(rfd,k,100);
cout<<k<<endl;
sleep(1);
}
}
void child(int rfd,int wfd)
{
while(true)
{
const char *s = "child";
char *k = new char[100];
write(wfd,s,strlen(s));
read(rfd,k,100);
cout<<k<<endl;
sleep(1);
}
}
int main()
{
int pfd1[2],pfd2[2];
if(pipe(pfd1))
{
cout<<"\nPipe creation failed (1)\n";
exit(0);
}
if(pipe(pfd2))
{
cout<<"\nPipe creation failed (2)\n";
exit(0);
}
int c = fork();
if(c>0)
{
// parent process
close(pfd1[0]);
close(pfd2[1]);
parent(pfd2[0],pfd1[1]);
}
else
{
//child process
close(pfd1[1]);
close(pfd2[0]);
child(pfd1[0],pfd2[1]);
}
return 0;
}
| [
"singhsukhdev1415@gmail.com"
] | singhsukhdev1415@gmail.com |
7445e2f33eb754fabdd5b76dfb450cd9720ee373 | 995bcab0f4b26402475fee2564ed51723414a2a6 | /sem_04/oop/lab_03/src/managers/config_manager.cpp | fdb1add57debd70ad578ca8e47b4b73dbbabbbad | [] | no_license | maxerMU/bmstu | e1400abdc5ca7c4b58f51ec5e46e072cd50297de | d91cb82ce8f43e1caea7c5d91c878b2329ec8427 | refs/heads/main | 2023-06-10T23:54:29.144731 | 2021-07-01T08:25:41 | 2021-07-01T08:25:41 | 308,846,327 | 4 | 0 | null | 2021-07-01T08:25:42 | 2020-10-31T09:23:57 | C++ | UTF-8 | C++ | false | false | 624 | cpp | #include "config_manager.h"
std::shared_ptr<config_manager> config_manager_creator::get_manager()
{
if (_manager == nullptr)
create_manager();
return _manager;
}
void config_manager_creator::create_manager()
{
static std::shared_ptr<config_manager> _manager(new config_manager());
this->_manager = _manager;
}
config_manager::config_manager()
:reg_maker(std::shared_ptr<base_registration_maker>(new registration_maker()))
{
reg_maker->make_registration(_solution);
}
std::shared_ptr<loader_creator> config_manager::get_creator(size_t index)
{
return _solution.get_creator(index);
}
| [
"max_mitsevich@mail.ru"
] | max_mitsevich@mail.ru |
80608ef4d5f9ebb6d2d358ad882b06db4a83a2db | d40419b6ae56d34b51b5652afa1afcf82e009dbb | /src/flapGame/flapGame/Shaders.h | 8c4aa12c5ea4acd3cee273c8111fd67a8db14de3 | [
"BSD-3-Clause",
"MIT",
"CC0-1.0",
"Zlib",
"LicenseRef-scancode-public-domain"
] | permissive | narveer-rathore/FlapHero | 0521639d49d3c15f876f4eef680439bfa7009b09 | cc216dc0c6360f2d941af53f58725b830029758e | refs/heads/main | 2023-03-02T23:03:53.956348 | 2021-02-16T00:00:26 | 2021-02-16T00:00:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,753 | h | #pragma once
#include <flapGame/Core.h>
#include <flapGame/GLHelpers.h>
#include <flapGame/VertexFormats.h>
namespace flap {
struct MaterialShader {
struct Props {
Float3 diffuse = {1, 1, 1};
Float3 specular = {0.2f, 0.2f, 0.2f};
float specPower = 5.f;
Float4 fog = {0, 0, 0, 1};
};
static Props defaultProps;
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint vertNormalAttrib = 0;
GLint modelToCameraUniform = 0;
GLint cameraToViewportUniform = 0;
GLint colorUniform = 0;
GLint specularUniform = 0;
GLint specPowerUniform = 0;
GLint fogUniform = 0;
static Owned<MaterialShader> create();
void draw(const Float4x4& cameraToViewport, const Float4x4& modelToCamera,
const DrawMesh* drawMesh, const Props* props = nullptr);
};
struct TexturedMaterialShader {
struct Props {
Float3 diffuse = {1, 1, 1};
Float3 specular = {0.2f, 0.2f, 0.2f};
float specPower = 5.f;
Float4 fog = {0, 0, 0, 1};
};
static Props defaultProps;
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint vertTexCoordAttrib = 0;
GLint vertNormalAttrib = 0;
GLint modelToCameraUniform = 0;
GLint cameraToViewportUniform = 0;
GLint textureUniform = 0;
GLint specularUniform = 0;
GLint specPowerUniform = 0;
GLint fogUniform = 0;
static Owned<TexturedMaterialShader> create();
void draw(const Float4x4& cameraToViewport, const Float4x4& modelToCamera,
const DrawMesh* drawMesh, GLuint texID, const MaterialShader::Props* props = nullptr);
};
struct PipeShader {
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint vertNormalAttrib = 0;
GLint modelToCameraUniform = 0;
GLint cameraToViewportUniform = 0;
GLint normalSkewUniform = 0;
GLint textureUniform = 0;
static Owned<PipeShader> create();
void draw(const Float4x4& cameraToViewport, const Float4x4& modelToCamera,
const Float2& normalSkew, const DrawMesh* drawMesh, GLuint texID);
};
struct UberShader {
struct Props {
Float3 diffuse = {1, 1, 1};
Float3 diffuse2 = {1, 1, 1};
GLuint texID = 0;
Float3 diffuseClamp = {-0.5f, 1.5f, 0.1f};
Float3 specular = {1, 1, 1};
float specPower = 5.f;
Float4 rim = {1, 1, 1, 1};
Float2 rimFactor = {1.f, 2.5f};
Float3 lightDir = {0, 0, 0};
Float3 specLightDir = {0, 0, 0};
PLY_INLINE Props() {
this->lightDir = Float3{1.f, -1.f, -0.5f}.normalized();
this->specLightDir = Float3{0.8f, -1.f, -0.2f}.normalized();
}
};
static Props defaultProps;
struct Flags {
static constexpr u32 Skinned = 1;
static constexpr u32 Duotone = 2;
};
u32 flags = 0;
ShaderProgram shader;
GLint vertPositionAttrib = -1;
GLint vertNormalAttrib = -1;
GLint vertTexCoordAttrib = -1;
GLint vertBlendIndicesAttrib = -1;
GLint vertBlendWeightsAttrib = -1;
GLint modelToCameraUniform = -1;
GLint cameraToViewportUniform = -1;
GLint diffuseUniform = -1;
GLint diffuse2Uniform = -1;
GLint diffuseClampUniform = -1;
GLint specularUniform = -1;
GLint specPowerUniform = -1;
GLint rimUniform = -1;
GLint rimFactorUniform = -1;
GLint lightDirUniform = -1;
GLint specLightDirUniform = -1;
GLint boneXformsUniform = -1;
GLint boneXformsCUniform = -1;
GLint texImageUniform = -1;
static Owned<UberShader> create(u32 flags);
void draw(const Float4x4& cameraToViewport, const Float4x4& modelToCamera,
const DrawMesh* drawMesh, ArrayView<const Float4x4> boneToModel,
const Props* props = nullptr);
};
struct GradientShader {
ShaderProgram shader;
GLint vertPositionAttrib = -1;
GLint vertTexCoordAttrib = -1;
GLint modelToViewportUniform = -1;
GLint color0Uniform = -1;
GLint color1Uniform = -1;
static Owned<GradientShader> create();
void draw(const Float4x4& modelToViewport, const DrawMesh* drawMesh, const Float4& color0,
const Float4& color1);
};
struct FlatShader {
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint modelToViewportUniform = 0;
GLint colorUniform = 0;
GLBuffer quadVBO;
GLBuffer quadIndices;
u32 quadNumIndices = 0;
static Owned<FlatShader> create();
void draw(const Float4x4& modelToViewport, const DrawMesh* drawMesh, bool writeDepth, bool useDepth = true);
void drawQuad(const Float4x4& modelToViewport, const Float4& linearColor, bool useDepth = true);
};
struct StarShader {
struct InstanceData {
Float4x4 modelToViewport;
Float4 color;
};
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint vertTexCoordAttrib = 0;
GLint instModelToViewportAttrib = 0;
GLint instColorAttrib = 0;
GLint textureUniform = 0;
static Owned<StarShader> create();
void draw(const DrawMesh* drawMesh, GLuint textureID,
ArrayView<const InstanceData> instanceData);
};
struct RayShader {
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint modelToViewportUniform = 0;
static Owned<RayShader> create();
void draw(const Float4x4& modelToViewport, const DrawMesh* drawMesh);
};
struct FlashShader {
ShaderProgram shader;
GLint positionAttrib = 0;
GLint modelToViewportUniform = 0;
GLint vertToTexCoordUniform = 0;
GLint textureUniform = 0;
GLint colorUniform = 0;
GLBuffer vbo;
GLBuffer indices;
u32 numIndices = 0;
static PLY_NO_INLINE Owned<FlashShader> create();
void drawQuad(const Float4x4& modelToViewport, const Float4& vertToTexCoord, GLuint textureID,
const Float4& color) const;
};
struct TexturedShader {
ShaderProgram shader;
GLint positionAttrib = 0;
GLint texCoordAttrib = 0;
GLint modelToViewportUniform = 0;
GLint textureUniform = 0;
GLint colorUniform = 0;
static PLY_NO_INLINE Owned<TexturedShader> create();
void draw(const Float4x4& modelToViewport, GLuint textureID, const Float4& color,
const DrawMesh* drawMesh, bool depthTest = false);
void draw(const Float4x4& modelToViewport, GLuint textureID, const Float4& color,
ArrayView<VertexPT> vertices, ArrayView<u16> indices, bool useDstAlpha = false) const;
};
struct HypnoShader {
ShaderProgram shader;
GLint positionAttrib = 0;
GLint instPlacementAttrib = 0;
GLint instScaleAttrib = 0;
GLint modelToViewportUniform = 0;
GLint textureUniform = 0;
GLint paletteUniform = 0;
GLint paletteSizeUniform = 0;
GLBuffer vbo;
GLBuffer indices;
u32 numIndices = 0;
static PLY_NO_INLINE Owned<HypnoShader> create();
void draw(const Float4x4& modelToViewport, GLuint textureID, const Texture& palette,
float atScale, float timeParam) const;
};
struct CopyShader {
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint vertTexCoordAttrib = 0;
GLint modelToViewportUniform = 0;
GLint textureUniform = 0;
GLint opacityUniform = 0;
GLint premulColorUniform = 0;
GLBuffer quadVBO;
GLBuffer quadIndices;
u32 quadNumIndices = 0;
static PLY_NO_INLINE Owned<CopyShader> create();
void drawQuad(const Float4x4& modelToViewport, GLuint textureID, float opacity,
float premul) const;
};
struct ColorCorrectShader {
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint textureUniform = 0;
static PLY_NO_INLINE Owned<ColorCorrectShader> create();
void draw(const DrawMesh* drawMesh, GLuint textureID) const;
};
struct PuffShader {
struct InstanceData {
Float4x4 modelToWorld;
Float2 colorAlpha;
};
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint instModelToWorldAttrib = 0;
GLint instColorAlphaAttrib = 0;
GLint worldToViewportUniform = 0;
GLint textureUniform = 0;
GLBuffer quadVBO;
GLBuffer quadIndices;
u32 quadNumIndices = 0;
static Owned<PuffShader> create();
void draw(const Float4x4& worldToViewport, GLuint textureID,
ArrayView<const InstanceData> instanceData);
};
struct ShapeShader {
ShaderProgram shader;
GLint vertPositionAttrib = 0;
GLint vertTexCoordAttrib = 0;
GLint modelToViewportUniform = 0;
GLint textureUniform = 0;
GLint colorUniform = 0;
GLint slopeUniform = 0;
static Owned<ShapeShader> create();
void draw(const Float4x4& modelToViewport, GLuint textureID, const Float4& colorAndRamp,
float slope, const DrawMesh* drawMesh);
};
} // namespace flap
| [
"filter-github@preshing.com"
] | filter-github@preshing.com |
3d7b0f829af6a4e7915978c5838349feab118baf | d03bc4381c9c2e70b299579e746ef5673f98b382 | /Source/Game/ModulePlayScene.cpp | 64580112d113f528d6a523894dac69b327192696 | [
"MIT"
] | permissive | marcorod94/FlappyDemoCpp | 7886c0baa558c6f0432b5b21c0f38dedd6bbf6c3 | 87594e2f0fc9dd1ed11e0b588147d3bf8bbe123a | refs/heads/master | 2023-02-23T08:49:38.911523 | 2021-02-01T22:54:27 | 2021-02-01T22:54:27 | 330,761,561 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,897 | cpp | #include "Main/Application.h"
#include "Module/ModuleAudio.h"
#include "Module/ModuleInput.h"
#include "Module/ModuleRender.h"
#include "Module/ModuleTexture.h"
#include "ModuleGameOverScene.h"
#include "ModuleBird.h"
#include "ModulePlayScene.h"
#include "ModuleScore.h"
#include "ModuleTube.h"
#include "SDL.h"
ModulePlayScene::ModulePlayScene(bool active) : Module(active)
{
backgroundRect =
{
0, 0, SCREEN_WIDTH, SCREEN_HEIGHT
};
groundRect = {
0, 0, SCREEN_WIDTH, static_cast<int>(SCREEN_HEIGHT * 0.15F)
};
groundRect.x = static_cast<int>(SCREEN_WIDTH * 0.5F - groundRect.w * 0.5F);
groundRect.y = static_cast<int>(SCREEN_HEIGHT - groundRect.h);
}
bool ModulePlayScene::Init()
{
backgroundText = App->texture->Load("Assets/Textures/bg.png");
groundText = App->texture->Load("Assets/Textures/ground.png");
dieSFX = App->audio->LoadFx("Assets/Audio/die.wav");
hitSFX = App->audio->LoadFx("Assets/Audio/hit.wav");
pointSFX = App->audio->LoadFx("Assets/Audio/point.wav");
App->audio->PlayMusic("Assets/Audio/music.mp3");
App->bird->Init();
App->tubes->Init();
App->score->Init();
return true;
}
UpdateStatus ModulePlayScene::PreUpdate()
{
if (enableNextFrame)
{
Disable();
App->gameOverScene->Enable();
enableNextFrame = false;
}
return UpdateStatus::CONTINUE;
}
UpdateStatus ModulePlayScene::Update()
{
App->renderer->Blit(backgroundText, &backgroundRect);
App->bird->Update();
App->tubes->Update();
App->score->Update();
App->renderer->Blit(groundText, &groundRect);
return UpdateStatus::CONTINUE;
}
UpdateStatus ModulePlayScene::PostUpdate()
{
/*if (enableNextFrame)
{
Disable();
App->gameOverScene->Enable();
enableNextFrame = false;
}*/
return UpdateStatus::CONTINUE;
}
bool ModulePlayScene::CleanUp()
{
App->texture->Unload(backgroundText);
App->tubes->CleanUp();
App->bird->CleanUp();
App->score->CleanUp();
return true;
}
| [
"marco.rod.94@live.com"
] | marco.rod.94@live.com |
9bb90855cb393c0eed617a7bd5915f25e2959334 | 729d0b395bf761ec80bbd9cfba0b5ec9fcfcb1f5 | /UBSanitizer/examples/04_invalid_enum.cpp | a455c85e4a638bbc07f7d5220cce90045bfe84df | [
"MIT"
] | permissive | dermojo/presentations | 0e3be6f4260eac79e8960dcc4e80424a2482de7b | 4f4da0e60c144e735c98bb4c77ce7ccb055bd20b | refs/heads/master | 2021-01-11T23:23:13.295197 | 2020-01-07T20:11:44 | 2020-01-07T20:11:44 | 78,574,142 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 645 | cpp | // UBSAN example: invalid enum
#include <cstdlib>
#include <iostream>
// note: only works with Clang, but not with enum classes...
enum Color
{
red = 0,
green = 1,
blue = 2,
};
inline std::ostream& operator<<(std::ostream& os, Color c)
{
switch (c)
{
case Color::red:
return os << "red";
case Color::green:
return os << "green";
case Color::blue:
return os << "blue";
default:
return os << "???";
}
}
int main(int argc, const char** argv)
{
if (argc < 2)
return 1;
Color c = static_cast<Color>(atoi(argv[1]));
std::cout << c << "\n";
return 0;
}
| [
"dermojo@gmail.com"
] | dermojo@gmail.com |
84bf0eb384f3ae7805e5fdc5d76798cbb5a30f6e | a05326130b3a1fd40240293d5a1f32ae74508e11 | /Global/Util.h | 274da4e86d00ede017db52661ecc31772212719f | [] | no_license | hnefatl/BattleshipsMP | e8a60b95eea7f62cd6dd2f347b2f575b65e8374b | 331ae42cd72cbc1c7952e84c77ab651f18f350ea | refs/heads/master | 2021-01-01T06:10:49.518083 | 2013-07-28T21:33:08 | 2013-07-28T21:33:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 203 | h | #ifndef _UTIL_H
#define _UTIL_H
#include <vector>
#include <string>
std::string ToString(int Input);
std::vector<std::string> Split(std::string Input, char Delimiter);
int Round(float Input);
#endif | [
"hnefatl@gmail.com"
] | hnefatl@gmail.com |
a90d95599b2365c2471d1386b76b8918940691cc | 750395d2f5d37b1f30b8b1920e11e040cbe401c4 | /FHEOffline/FullSetup.cpp | 041dcf963e2d4ac81c8d6ed8c37bb941bfa1a1b3 | [
"MIT",
"BSD-2-Clause"
] | permissive | AlexanderViand/MP-SPDZ | b4c920e45143f710c9371cab4c37b63da5420ed7 | d26a62efe496946d721b0ab49710494cea5c9652 | refs/heads/master | 2020-05-19T08:10:28.857168 | 2019-05-03T08:03:13 | 2019-05-03T08:03:50 | 184,914,569 | 1 | 0 | NOASSERTION | 2019-05-04T15:48:59 | 2019-05-04T15:48:59 | null | UTF-8 | C++ | false | false | 1,544 | cpp |
#include "FHEOffline/FullSetup.h"
#include "Math/gfp.h"
#include "FHE/FHE_Params.h"
#include "FHE/NTL-Subs.h"
#include <sys/stat.h>
#include <fstream>
#include <sstream>
using namespace std;
// Read data for SHE offline
void get_setup(FHE_Params& params_p,FFT_Data& FTD,
FHE_Params& params_2,P2Data& P2D,string dir,
bool skip_2)
{
int lg2;
Ring R2,Rp;
bigint p02,p12,p0p,p1p,p;
// legacy
if (dir == "")
dir = PREP_DIR;
string filename=dir+"/Params-Data";
ifstream inpf(filename.c_str());
if (inpf.fail()) { throw file_error(filename); }
inpf >> p;
inpf >> lg2;
inpf >> Rp;
inpf >> FTD;
inpf >> p0p >> p1p;
if (p != FTD.get_prime())
throw runtime_error("inconsistent p in Params-Data");
if (!skip_2)
{
// initialize before reading P2D for consistency check
gf2n::init_field(lg2);
inpf >> R2;
inpf >> P2D;
if (R2.phi_m() != P2D.phi_m())
throw runtime_error("phi(m) mismatch between ring and plaintext representation");
inpf >> p02 >> p12;
}
if (inpf.fail())
throw file_error("incomplete parameters");
inpf.close();
gfp::init_field(FTD.get_prime());
params_p.set(Rp,{p0p,p1p});
cout << "log(p) = " << numBits(FTD.get_prime()) << ", log(p0) = "
<< numBits(p0p) << ", " << "log(p1) = " << numBits(p1p) << endl;
if (!skip_2)
{
params_2.set(R2,{p02,p12});
cout << "GF(2^" << lg2 << "): log(p0) = " << numBits(p02)
<< ", log(p1) = " << numBits(p12) << endl;
}
}
| [
"m.keller@bristol.ac.uk"
] | m.keller@bristol.ac.uk |
af1aaa10a185003208dafcf33a7203b7e88d9eaa | 6b4e2a7f51647524db22208eb98e925d1537fb6b | /Greedy/1708. Largest Subarray Length K.cpp | 2a3853eb04ce3c7e98322c356cac0725cc1371d4 | [] | no_license | denis-gubar/Leetcode | a099e0fd07600ae63456059753332f90ddd96542 | ad54bee10fdf59644cc762218277a2f9de9b3509 | refs/heads/master | 2023-07-21T04:25:57.949932 | 2023-07-09T12:46:24 | 2023-07-09T12:46:24 | 218,048,440 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 234 | cpp | class Solution {
public:
vector<int> largestSubarray(vector<int>& nums, int k) {
int N = nums.size();
auto it = max_element(nums.begin(), nums.begin() + N - k + 1);
return vector<int>(it, it + k);
}
};
| [
"Denis.Gubar@gmail.com"
] | Denis.Gubar@gmail.com |
b9c588273b0f7180e3ac244cdb8da666e4617c64 | be3989c18030bb6d6fd51c20419d68d04358d5be | /OOVisualization/src/expressions/VConditionalExpression.h | 0dc647095799f5da254fff899df318ef7e235c1d | [
"BSD-3-Clause"
] | permissive | Andresbu/Envision | e6226ab826a15827ad7187823625646e3f1c5c12 | 864396334ed521c2ff6dee8a24f624b2c70e2a86 | refs/heads/master | 2021-01-18T08:43:15.416892 | 2012-03-29T15:36:27 | 2012-03-29T15:36:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,075 | h | /***********************************************************************************************************************
**
** Copyright (c) 2011, 2012 ETH Zurich
** 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 ETH Zurich 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.
**
**********************************************************************************************************************/
/*
* VConditionalExpression.h
*
* Created on: Mar 27, 2012
* Author: Dimitar Asenov
*/
#ifndef OOVisualization_VCONDITIONALEXPRESSION_H_
#define OOVisualization_VCONDITIONALEXPRESSION_H_
#include "../oovisualization_api.h"
#include "OperatorStyle.h"
#include "OOModel/src/expressions/ConditionalExpression.h"
#include "VisualizationBase/src/items/ItemWithNode.h"
#include "VisualizationBase/src/items/LayoutProvider.h"
namespace Visualization {
class Static;
}
namespace OOVisualization {
class OOVISUALIZATION_API VConditionalExpression : public Visualization::ItemWithNode<Visualization::LayoutProvider<>,
OOModel::ConditionalExpression>
{
ITEM_COMMON_CUSTOM_STYLENAME(VConditionalExpression, OperatorStyle)
public:
VConditionalExpression(Item* parent, NodeType* node, const StyleType* style = itemStyles().get());
virtual ~VConditionalExpression();
protected:
void determineChildren();
private:
Visualization::Static* pre_;
Visualization::Static* in_;
Visualization::Static* in2_;
Visualization::Static* post_;
Visualization::Item* condition_;
Visualization::Item* true_;
Visualization::Item* false_;
};
} /* namespace OOVisualization */
#endif /* OOVisualization_VCONDITIONALEXPRESSION_H_ */
| [
"dimitar.asenov@inf.ethz.ch"
] | dimitar.asenov@inf.ethz.ch |
36be4036f1ee9b168dd23da87200f06a516a0a44 | 429a21d413b9d06e5d07d712e4fcd140291f97ca | /include/console/command_container.hpp | 92c9b8c4bbe6365352432efbdc92a4014966d071 | [] | no_license | fondesa/cmd-notes | 5201ae82bf7ed26dcc737c00f9e597b786b4c60a | 4a1cfed9767ad29e688559d6efeee26acbd9ec81 | refs/heads/master | 2021-09-18T11:59:34.490321 | 2018-07-13T22:08:59 | 2018-07-13T22:08:59 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 400 | hpp | //
// Created by Giorgio Antonioli on 06/07/18.
//
#ifndef NOTES_COMMAND_PROVIDER_HPP
#define NOTES_COMMAND_PROVIDER_HPP
#include "command.hpp"
class CommandContainer {
public:
virtual void insertCommand(const Command &command)=0;
virtual std::vector<Command> provideCommandList()=0;
virtual Command *provideCommandByName(std::string name)=0;
};
#endif //NOTES_COMMAND_PROVIDER_HPP
| [
"giorgio.antonioli.dev@gmail.com"
] | giorgio.antonioli.dev@gmail.com |
466b33b418dbc9ee3d0b6d361a02ab0d0d03b1aa | 43c1e63e01d2dedcb2935521ecb9bbe8ba5001a9 | /TaskModel/Inc/TaskObserver.h | 8eb4a63698e112972a10fa8d98def6ab321fed99 | [] | no_license | maoxingda/taskconcurrent | f2b526e391376b097621751f11a274bcc9e50fd7 | f2663f25d6f831b04b7ba9c55927dc7c656c735c | refs/heads/master | 2020-03-17T17:22:51.294670 | 2018-05-17T08:53:28 | 2018-05-17T08:53:28 | 133,785,904 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,038 | h | /********************************************************************
created: 2018/01/13
created: 13:1:2018 17:56
filename: c:\Users\maoxd\documents\visual studio 2017\Projects\ThreadPool2\ThreadPool2\TaskObserver.h
file path: c:\Users\maoxd\documents\visual studio 2017\Projects\ThreadPool2\ThreadPool2
file base: TaskObserver
file ext: h
author: maoxd
purpose: Abstract base observer for all observer class, delay the observer of the task to a derived class
usage: Derived observer class from this and Implement the interfece of Response to get the task processing results
*********************************************************************/
#pragma once
#include <memory> // for std::shared_ptr
// predeclaration
class Task;
class TaskObserver
{
public:
TaskObserver();
~TaskObserver();
// implement this method to get the task processing results
virtual void Response(const Task* context) = 0;
};
| [
"39357378+maoxingda@users.noreply.github.com"
] | 39357378+maoxingda@users.noreply.github.com |
957f5df0c250881d4a243d543a4312750e5a8fa8 | dd6147bf9433298a64bbceb7fdccaa4cc477fba6 | /8383/averina/labs/Interface/Commands/UnitCommands/CreateUnitRequest.h | 79ceacf32f5d9a6c93f362bc551b8e0008d26dd7 | [] | no_license | moevm/oop | 64a89677879341a3e8e91ba6d719ab598dcabb49 | faffa7e14003b13c658ccf8853d6189b51ee30e6 | refs/heads/master | 2023-03-16T15:48:35.226647 | 2020-06-08T16:16:31 | 2020-06-08T16:16:31 | 85,785,460 | 42 | 304 | null | 2023-03-06T23:46:08 | 2017-03-22T04:37:01 | C++ | UTF-8 | C++ | false | false | 421 | h |
#ifndef OOP_CREATEUNITREQUEST_H
#define OOP_CREATEUNITREQUEST_H
#include "../IRequest.h"
/*
* CreateUnitRequest -- класс-команда создания юнита.
*/
class CreateUnitRequest : public IRequest
{
public:
CreateUnitRequest(Field* field, std::string player) : IRequest(field) { this->player = player;}
void Command() override ;
private:
char id;
};
#endif //OOP_CREATEUNITREQUEST_H
| [
"42898899+olyaave@users.noreply.github.com"
] | 42898899+olyaave@users.noreply.github.com |
f28e250405ec59d85257df3be7af51d9e51d4dfe | 6c319006c241cee68e2527a51f357115e874daac | /audio-detecter/src/Pulse.h | 2ce172579bbdf228431cb809be68569c5d10d4d6 | [] | no_license | seongdeok/IOT | 7176c439d3b5d672e6bc1f00bdf7d45bf4cac4a1 | 7d58e331a909d5bb1170486688ddae3f35d678a6 | refs/heads/master | 2023-06-27T17:02:55.172883 | 2023-06-10T02:20:03 | 2023-06-10T02:20:03 | 127,240,583 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 336 | h | #ifndef PULSE_H
#define PULSE_H
#include<pulse/pulseaudio.h>
class Pulse{
public :
Pulse();
~Pulse();
static void my_subscription_callback(pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata);
static void context_state_callback(pa_context* c, void* userdata);
void monitor();
};
#endif
| [
"duk0669@gmail.com"
] | duk0669@gmail.com |
6c2ba05324547cef9060e8842ba427e9c96427c6 | 76f9af263fc1b3ea1410fec39def3221f9cbe8a1 | /cpp/1021.cpp | e9a8c7e27396448625d9fb217a0d4d0b8fa446d9 | [] | no_license | gustavorizzon/URIOnlineJudge | 86f2b847ab8f5ac262f8eccdc26069fe579afab4 | 7c0618235b4b96835381ab95edf5594c74ce15ba | refs/heads/master | 2020-07-28T14:03:14.984110 | 2019-09-20T01:08:26 | 2019-09-20T01:08:26 | 209,433,575 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,023 | cpp | #include <iostream>
using namespace std;
void mostrarMsg(int quantidade, string tipo, string valor)
{
cout << quantidade << " " << tipo << "(s) de R$ " << valor << "\n";
}
int main()
{
double n;
cin >> n;
int v = n * 100;
cout << "NOTAS:\n";
mostrarMsg((int) (v / 10000), "nota", "100.00");
v = v % 10000;
mostrarMsg((int) (v / 5000), "nota", "50.00");
v = v % 5000;
mostrarMsg((int) (v / 2000), "nota", "20.00");
v = v % 2000;
mostrarMsg((int) (v / 1000), "nota", "10.00");
v = v % 1000;
mostrarMsg((int) (v / 500), "nota", "5.00");
v = v % 500;
mostrarMsg((int) (v / 200), "nota", "2.00");
v = v % 200;
cout << "MOEDAS:\n";
mostrarMsg((int) (v / 100), "moeda", "1.00");
v = v % 100;
mostrarMsg((int) (v / 50), "moeda", "0.50");
v = v % 50;
mostrarMsg((int) (v / 25), "moeda", "0.25");
v = v % 25;
mostrarMsg((int) (v / 10), "moeda", "0.10");
v = v % 10;
mostrarMsg((int) (v / 5), "moeda", "0.05");
v = v % 5;
mostrarMsg((int) (v / 1), "moeda", "0.01");
return 0;
} | [
"gustavop.rizzon@gmail.com"
] | gustavop.rizzon@gmail.com |
74da75f5aad900b937489734ad2d514176fc38b3 | 77aec9addf0972d6c342f450adcaf1ef458d332a | /src/ncnn/layer/x86/convolution_x86.cpp | c95bc84780fe10054daf82592f2a7e33dd36bd48 | [
"Zlib",
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | Raneee/MTCNN | d650934a9ee1d45ef2fcaa912ab2128e311f5a12 | 5a956ec505051a98a46e4db0645567ab2bd884db | refs/heads/master | 2020-04-13T17:27:57.668086 | 2018-12-28T03:02:12 | 2018-12-28T03:02:12 | 163,349,074 | 0 | 0 | NOASSERTION | 2018-12-28T00:53:18 | 2018-12-28T00:53:18 | null | UTF-8 | C++ | false | false | 2,877 | cpp | // Tencent is pleased to support the open source community by making ncnn available.
//
// Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
// in compliance with the License. You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
#include "convolution_x86.h"
#if !defined(__ARM_NEON)
namespace ncnn {
#include "convolution_3x3.h"
#include "convolution_5x5.h"
DEFINE_LAYER_CREATOR(Convolution_x86)
int Convolution_x86::forward(const Mat &bottom_blob, Mat &top_blob) const {
// convolv with NxN kernel
// value = value + bias
if (kernel_size > 5 || stride > 5 || dilation != 1) {
return Convolution::forward(bottom_blob, top_blob);
}
typedef void(*conv_func)(const Mat &, Mat &, const Mat &, const Mat &);
// kernel_size x stride
conv_func conv_func_table[5][5] =
{
{
0,
0,
0,
0,
0
}, // kernel_size = 1
{
0,
0,
0,
0,
0
}, // kernel_size = 2
{
conv3x3s1_sse,
0,
0,
0,
0
}, // kernel_size = 3
{
0,
0,
0,
0,
0
}, // kernel_size = 4
{
conv5x5s1_sse,
0,
0,
0,
0
} // kernel_size = 5
};
conv_func conv = conv_func_table[kernel_size - 1][stride - 1];
if (!conv) {
return Convolution::forward(bottom_blob, top_blob);
}
int w = bottom_blob.w;
int h = bottom_blob.h;
Mat bottom_blob_bordered = bottom_blob;
if (pad > 0) {
copy_make_border(bottom_blob, bottom_blob_bordered, pad, pad, pad, pad, BORDER_CONSTANT, 0.f);
if (bottom_blob_bordered.empty())
return -100;
w = bottom_blob_bordered.w;
h = bottom_blob_bordered.h;
}
else if (pad == -233) {
int wpad = kernel_size + (w - 1) / stride * stride - w;
int hpad = kernel_size + (h - 1) / stride * stride - h;
if (wpad > 0 || hpad > 0) {
copy_make_border(bottom_blob, bottom_blob_bordered, hpad / 2, hpad - hpad / 2, wpad / 2,
wpad - wpad / 2, BORDER_CONSTANT, 0.f);
if (bottom_blob_bordered.empty())
return -100;
}
w = bottom_blob_bordered.w;
h = bottom_blob_bordered.h;
}
int outw = (w - kernel_size) / stride + 1;
int outh = (h - kernel_size) / stride + 1;
top_blob.create(outw, outh, num_output);
if (top_blob.empty())
return -100;
conv(bottom_blob_bordered, top_blob, weight_data, bias_data);
return 0;
}
} // namespace ncnn
#endif | [
"gaozhihan@vip.qq.com"
] | gaozhihan@vip.qq.com |
76d4633e9c95f00bb6b96b1f2acd851116aa3d94 | 2c01969db3e4de0131618057125aee655cba0cb8 | /quisp/backends/GraphState/Qubit_test.cc | 55163549dbeae033812da86b2dcc75e4261586f8 | [
"BSD-3-Clause",
"MPL-2.0",
"LicenseRef-scancode-free-unknown"
] | permissive | sfc-aqua/quisp | c86ee50e08047c6a5469e01ae8740710e9287636 | eddfe7ee80535a624987941653c59da2ce138929 | refs/heads/master | 2023-08-31T10:23:57.939878 | 2023-08-07T03:00:56 | 2023-08-07T03:00:56 | 246,997,413 | 77 | 36 | BSD-3-Clause | 2023-09-05T10:07:25 | 2020-03-13T05:48:04 | C++ | UTF-8 | C++ | false | false | 3,443 | cc | #include <backends/Backends.h>
#include <gtest/gtest.h>
#include <test_utils/TestUtils.h>
#include <Eigen/Eigen>
#include <memory>
#include <unsupported/Eigen/MatrixFunctions>
#include "backends/GraphState/types.h"
#include "backends/interfaces/IQubit.h"
#include "test.h"
namespace {
using namespace quisp_test::backends::graph_state;
using Eigen::Matrix2cd;
using Eigen::Matrix4cd;
using Eigen::Vector4cd;
class TestGsQubit : public GraphStateQubit {
public:
using GraphStateQubit::gate_err_cnot;
using GraphStateQubit::gate_err_h;
using GraphStateQubit::gate_err_x;
using GraphStateQubit::gate_err_z;
using GraphStateQubit::measurement_err;
using GraphStateQubit::memory_err;
};
class GsQubit : public GraphStateBackend {
public:
using GraphStateBackend::qubits;
GsQubit(std::unique_ptr<IRandomNumberGenerator> rng, std::unique_ptr<StationaryQubitConfiguration> config) : GraphStateBackend(std::move(rng), std::move(config)) {}
};
class QubitTest : public ::testing::Test {
protected:
void SetUp() {
SimTime::setScaleExp(-9);
rng = new TestRNG();
backend = std::make_unique<Backend>(std::unique_ptr<IRandomNumberGenerator>(rng), std::make_unique<StationaryQubitConfiguration>());
qubit = dynamic_cast<Qubit*>(backend->createQubit(1));
qubit->fillParams();
}
Qubit* qubit;
std::unique_ptr<Backend> backend;
TestRNG* rng;
};
TEST_F(QubitTest, applySingleQubitGateErrorTest) {
auto conf = new StationaryQubitConfiguration;
EigenvalueResult meas;
conf->x_gate_err_rate = 0.9;
conf->x_gate_x_err_ratio = 0.3;
conf->x_gate_y_err_ratio = 0.3;
conf->x_gate_z_err_ratio = 0.3;
auto conf2 = std::make_unique<StationaryQubitConfiguration>(*conf);
auto* id = new QubitId(123);
auto* qubit = backend->GsQubit::createQubit(id, std::move(conf2));
auto Gs_qubit = reinterpret_cast<TestGsQubit*>(qubit);
rng->double_value = 0.;
Gs_qubit->gateX();
meas = Gs_qubit->measureZ();
EXPECT_EQ(meas, EigenvalueResult::MINUS_ONE);
Gs_qubit->setFree();
Gs_qubit->gateX();
meas = qubit->measureX();
EXPECT_EQ(meas, EigenvalueResult::PLUS_ONE);
Gs_qubit->setFree();
Gs_qubit->gateX();
meas = qubit->measureY();
EXPECT_EQ(meas, EigenvalueResult::PLUS_ONE);
Gs_qubit->setFree();
rng->double_value = 0.4;
Gs_qubit->gateX();
meas = Gs_qubit->measureZ();
EXPECT_EQ(meas, EigenvalueResult::PLUS_ONE);
Gs_qubit->setFree();
Gs_qubit->gateX();
meas = qubit->measureX();
EXPECT_EQ(meas, EigenvalueResult::PLUS_ONE);
Gs_qubit->setFree();
Gs_qubit->gateX();
meas = qubit->measureY();
EXPECT_EQ(meas, EigenvalueResult::PLUS_ONE);
Gs_qubit->setFree();
rng->double_value = 0.7;
Gs_qubit->gateX();
meas = Gs_qubit->measureZ();
EXPECT_EQ(meas, EigenvalueResult::MINUS_ONE);
Gs_qubit->setFree();
Gs_qubit->gateX();
meas = qubit->measureX();
EXPECT_EQ(meas, EigenvalueResult::MINUS_ONE);
Gs_qubit->setFree();
Gs_qubit->gateX();
meas = qubit->measureY();
EXPECT_EQ(meas, EigenvalueResult::MINUS_ONE);
Gs_qubit->setFree();
rng->double_value = 1.0;
Gs_qubit->gateX();
meas = Gs_qubit->measureZ();
EXPECT_EQ(meas, EigenvalueResult::PLUS_ONE);
Gs_qubit->setFree();
Gs_qubit->gateX();
meas = qubit->measureX();
EXPECT_EQ(meas, EigenvalueResult::MINUS_ONE);
Gs_qubit->setFree();
Gs_qubit->gateX();
meas = qubit->measureY();
EXPECT_EQ(meas, EigenvalueResult::MINUS_ONE);
Gs_qubit->setFree();
}
} // namespace
| [
"n.tanetani@gmail.com"
] | n.tanetani@gmail.com |
b20d26f2f33c63d017d0b229585306e62ac383a2 | 3c4f5bd6d7ac3878c181fb05ab41c1d755ddf343 | /ModuleEx.h | e6f10742bb86a4e7b802826c08d2b9663b9c0bca | [] | no_license | imcooder/public | 1078df18c1459e67afd1200346dd971ea3b71933 | be947923c6e2fbd9c993a41115ace3e32dad74bf | refs/heads/master | 2021-05-28T08:43:00.027020 | 2010-07-24T07:39:51 | 2010-07-24T07:39:51 | 32,301,120 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 413 | h |
#ifndef HWX_MODULEEX_H
#define HWX_MODULEEX_H
#if _MSC_VER > 1000
#pragma once
#endif
#include "Ext_Type.h"
class HWModule
{
public:
HWModule();
virtual ~HWModule();
virtual BOOL LoadLibrary(LPCTSTR);
virtual void FreeLibrary();
virtual BOOL Succeed();
protected:
HMODULE m_hModule;
TCHAR m_szModuleFilePath[MAX_PATH];
BOOL m_blSucceed;
};
#endif //HWX_MODULEEX_H | [
"jtxuee@gmail.com@716a2f10-c84c-11dd-bf7c-81814f527a11"
] | jtxuee@gmail.com@716a2f10-c84c-11dd-bf7c-81814f527a11 |
76a4d78f9dce76e730db17f9a9323d1b88eb9c38 | 389a0a88e0b7d03a976fd9860bd7e0a47ffef31b | /home/lab3/Osoba.cpp | a7ff62988b97518abaf8234c36c1812c20ccee19 | [] | no_license | piaskowyk/cpp-laby | 98c3d8dec3b5b8aa5ae7511c385a54b48fa83353 | 9496df307b1553e50152f60f9ae87081a71ea1bc | refs/heads/master | 2020-05-02T00:30:24.045031 | 2019-05-28T13:41:39 | 2019-05-28T13:41:39 | 177,673,957 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 150 | cpp | #include "Osoba.h"
Osoba::Osoba(string name, int year){
imie = name;
if(year < 1){
year = 0;
} else {
rok = year;
}
} | [
"krzychu2956@gmail.com"
] | krzychu2956@gmail.com |
e4196990a52174f8bca0b650bbe1fc427e8f0508 | 185b2a3d3cc1353f325dddeb62a05b06eeb3ac09 | /kolay_impl/medianfilter.cpp | b238f9544062e81e97857373f562b37f62cc8de2 | [] | no_license | nicknick1945/melonoma | f3b180e3d2ac833af334b1656d5e105aca4a0f25 | 92cb0a02b1045c6cf2ef416dd031ee758ece9528 | refs/heads/develop | 2021-04-06T20:44:22.697660 | 2018-04-25T22:17:29 | 2018-04-25T22:17:29 | 125,406,142 | 0 | 0 | null | 2018-04-25T22:07:48 | 2018-03-15T17:53:28 | C++ | UTF-8 | C++ | false | false | 1,700 | cpp | #include "medianfilter.h"
#include "vector"
#include "kolya_headers/utils.h"
using namespace std;
class MediadMatrx{
public:
vector<int> filds;
void goSort(){
sort(filds.begin(),filds.end());
}
};
MedianFilter::MedianFilter()
{
}
void MedianFilter::doFilter(QImage &image)
{
vector<vector<int>> newImageMatrix = Utils::getEmptyDoubleVector(image.width(),image.height());
for (int h = 0 ; h < image.height(); h ++){
for (int w = 0 ; w < image.width(); w++){
MediadMatrx matrix;
matrix.filds.resize(25);
for (int i = 0 ; i < 5 ; i ++){
for (int j = 0 ; j < 5 ; j ++){
int currencyCoordsX = Utils::calculeNormalCoords(w+3-j,image.width());
int currencyCoordsY = Utils::calculeNormalCoords(h+3-i,image.height());
logger->info(QString::number(j + ( (i+1)*5 ) ) );
matrix.filds.at(j+((i)*5)) = image.pixelColor(currencyCoordsX,currencyCoordsY).blue();
}
}
matrix.goSort();
newImageMatrix.at(h).at(w) = matrix.filds.at(12);
}
}
for (int h = 0 ; h < image.height(); h ++){
for (int w = 0 ; w < image.width(); w++){
int color = newImageMatrix.at(h).at(w);
image.setPixelColor(w,h,QColor(color,color,color,255));
}
}
logger->info("медианный фильтр успешно применен");
}
QString *MedianFilter::getDescription()
{
QString *description = new QString("медианный фильтр");
return description;
}
| [
"n.matukhin@simplex-software.ru"
] | n.matukhin@simplex-software.ru |
734ecde79b15e5cbdac777a1d1d250c416d08093 | 898d977587c06809002cdc86cc66121fba32cc8e | /owGame/Renderer/RenderPass_WMO.cpp | 044fd9d8f7c875cb2b62204bf1c640b3e0ccf9cb | [
"Apache-2.0"
] | permissive | websolution10030/OpenWow | e301248ec460059d3389cd8fd3e9da4db7e3af28 | 84a5539c1f1993484ca60f56974d7c8217061922 | refs/heads/master | 2023-06-06T01:24:05.615319 | 2021-06-25T00:29:19 | 2021-06-25T00:29:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,130 | cpp | #include "stdafx.h"
#ifdef USE_WMO_MODELS
// General
#include "RenderPass_WMO.h"
// Additional
#include "WMO/WMO_Base_Instance.h"
#include "WMO/WMO_Group_Instance.h"
#include "WMO/WMO_Part_Material.h"
CRenderPass_WMO::CRenderPass_WMO(IScene& Scene)
: Base3DPass(Scene)
{
SetPassName("WMO");
m_WoWSettings = GetBaseManager().GetManager<ISettings>()->GetGroup("WoWSettings");
}
CRenderPass_WMO::~CRenderPass_WMO()
{}
//
// IRenderPassPipelined
//
std::shared_ptr<IRenderPassPipelined> CRenderPass_WMO::ConfigurePipeline(std::shared_ptr<IRenderTarget> RenderTarget)
{
__super::ConfigurePipeline(RenderTarget);
std::shared_ptr<IShader> g_pVertexShader;
std::shared_ptr<IShader> g_pPixelShader;
if (GetRenderDevice().GetDeviceType() == RenderDeviceType::RenderDeviceType_DirectX11)
{
g_pVertexShader = GetRenderDevice().GetObjectsFactory().LoadShader(EShaderType::VertexShader, "shaders_D3D/WMO.hlsl", "VS_main");
g_pPixelShader = GetRenderDevice().GetObjectsFactory().LoadShader(EShaderType::PixelShader, "shaders_D3D/WMO.hlsl", "PS_main");
}
else if (GetRenderDevice().GetDeviceType() == RenderDeviceType::RenderDeviceType_OpenGL)
{
g_pVertexShader = GetRenderDevice().GetObjectsFactory().LoadShader(EShaderType::VertexShader, "shaders_OGL/WMO.vs", "");
g_pPixelShader = GetRenderDevice().GetObjectsFactory().LoadShader(EShaderType::PixelShader, "shaders_OGL/WMO.ps", "");
}
g_pVertexShader->LoadInputLayoutFromReflector();
// PIPELINES
GetPipeline().GetDepthStencilState()->SetDepthMode(enableDepthWrites);
GetPipeline().SetRenderTarget(RenderTarget);
GetPipeline().SetShader(g_pVertexShader);
GetPipeline().SetShader(g_pPixelShader);
return shared_from_this();
}
//
// IVisitor
//
EVisitResult CRenderPass_WMO::Visit(const std::shared_ptr<ISceneNode>& SceneNode)
{
if (std::dynamic_pointer_cast<CWMO_Base_Instance>(SceneNode))
{
if (auto colliderComponent = SceneNode->GetComponentT<IColliderComponent>())
if (colliderComponent->IsCulled(GetRenderEventArgs().Camera))
return EVisitResult::Block;
return __super::Visit(SceneNode);
}
else if (std::dynamic_pointer_cast<CWMO_Group_Instance>(SceneNode))
{
if (auto colliderComponent = SceneNode->GetComponentT<IColliderComponent>())
if (colliderComponent->IsCulled(GetRenderEventArgs().Camera))
return EVisitResult::Block;
return __super::Visit(SceneNode);
}
return EVisitResult::AllowVisitChilds;
}
EVisitResult CRenderPass_WMO::Visit(const std::shared_ptr<IGeometry>& Geometry, const std::shared_ptr<IMaterial>& Material, SGeometryDrawArgs GeometryDrawArgs)
{
auto wmoMaterial = std::dynamic_pointer_cast<WMO_Part_Material>(Material);
wmoMaterial->GetBlendState()->Bind();
wmoMaterial->GetRasterizerState()->Bind();
return __super::Visit(Geometry, Material, GeometryDrawArgs);
}
#if 0
CRenderPass_WMO2::CRenderPass_WMO2(IRenderDevice & RenderDevice, const std::shared_ptr<BuildRenderListPassTemplated<CWMO_Group_Instance>>& List, std::shared_ptr<IScene> scene)
: Base3DPass(RenderDevice, scene)
, m_List(List)
{
}
CRenderPass_WMO2::~CRenderPass_WMO2()
{
}
struct Struct
{
Struct(const ISceneNode* Node, const IGeometry* Geom, const SGeometryDrawArgs& GeometryDrawArgs)
: Node(Node)
, Geom(Geom)
,GeometryDrawArgs(GeometryDrawArgs)
{}
const ISceneNode* Node;
const IGeometry* Geom;
SGeometryDrawArgs GeometryDrawArgs;
};
void CRenderPass_WMO2::Render(RenderEventArgs & e)
{
std::unordered_map<const IMaterial*, std::vector<Struct>> m_Filled;
//strBuffer = RenderDevice.GetObjectsFactory().CreateStructuredBuffer();
for (const auto& it : m_List->GetGeometryList())
{
auto& result = m_Filled.find(it.Material);
if (result == m_Filled.end())
{
m_Filled.insert
(
std::make_pair
(
it.Material,
std::vector<Struct>
(
{ Struct(it.Node, it.Geometry, it.GeometryDrawArgs) }
)
)
);
}
else
{
result->second.push_back(Struct(it.Node, it.Geometry, it.GeometryDrawArgs));
}
}
const IShader* vs = GetRenderEventArgs().PipelineState->GetShaders().at(EShaderType::VertexShader).get();
for (const auto& it : m_Filled)
{
it.first->Bind(GetRenderEventArgs().PipelineState->GetShaders());
for (const auto& it2 : it.second)
{
Visit(it.second.begin()->Node);
it2.Geom->Render(GetRenderEventArgs(), vs, it2.GeometryDrawArgs);
}
it.first->Unbind(GetRenderEventArgs().PipelineState->GetShaders());
}
//Log::Info("Size = '%d'", m_Filled.size());
}
std::shared_ptr<IRenderPassPipelined> CRenderPass_WMO2::CreatePipeline(std::shared_ptr<IRenderTarget> RenderTarget, const Viewport * Viewport)
{
std::shared_ptr<IShader> g_pVertexShader;
std::shared_ptr<IShader> g_pPixelShader;
if (GetRenderDevice().GetDeviceType() == RenderDeviceType::RenderDeviceType_DirectX)
{
g_pVertexShader = GetRenderDevice().GetObjectsFactory().LoadShader(EShaderType::VertexShader, "shaders_D3D/WMO.hlsl", "VS_main");
g_pPixelShader = GetRenderDevice().GetObjectsFactory().LoadShader(EShaderType::PixelShader, "shaders_D3D/WMO.hlsl", "PS_main");
}
else if (GetRenderDevice().GetDeviceType() == RenderDeviceType::RenderDeviceType_OpenGL)
{
g_pVertexShader = GetRenderDevice().GetObjectsFactory().LoadShader(EShaderType::VertexShader, "shaders_OGL/WMO.vs", "");
g_pPixelShader = GetRenderDevice().GetObjectsFactory().LoadShader(EShaderType::PixelShader, "shaders_OGL/WMO.ps", "");
}
g_pVertexShader->LoadInputLayoutFromReflector();
// PIPELINES
std::shared_ptr<IPipelineState> pipeline = GetRenderDevice().GetObjectsFactory().CreatePipelineState();
pipeline->GetBlendState()->SetBlendMode(disableBlending);
pipeline->GetDepthStencilState()->SetDepthMode(enableDepthWrites);
pipeline->GetRasterizerState()->SetCullMode(IRasterizerState::CullMode::Back);
pipeline->GetRasterizerState()->SetFillMode(IRasterizerState::FillMode::Solid);
pipeline->SetRenderTarget(RenderTarget);
pipeline->GetRasterizerState()->SetViewport(Viewport);
pipeline->SetShader(EShaderType::VertexShader, g_pVertexShader);
pipeline->SetShader(EShaderType::PixelShader, g_pPixelShader);
return SetPipeline(pipeline);
}
#endif
#endif | [
"alexstenfard@gmail.com"
] | alexstenfard@gmail.com |
2ab7b315d49c608b8843674f051aa7530fab884a | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/069/322/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_loop_43.cpp | 31f8dd9c4f36d5b71fe1c9ba1cb08fe2fd229eda | [] | no_license | CU-0xff/juliet-cpp | d62b8485104d8a9160f29213368324c946f38274 | d8586a217bc94cbcfeeec5d39b12d02e9c6045a2 | refs/heads/master | 2021-03-07T15:44:19.446957 | 2020-03-10T12:45:40 | 2020-03-10T12:45:40 | 246,275,244 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,142 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_loop_43.cpp
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806.label.xml
Template File: sources-sink-43.tmpl.cpp
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Initialize data as a large string
* GoodSource: Initialize data as a small string
* Sinks: loop
* BadSink : Copy data to string using a loop
* Flow Variant: 43 Data flow: data flows using a C++ reference from one function to another in the same source file
*
* */
#include "std_testcase.h"
#include <wchar.h>
namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_loop_43
{
#ifndef OMITBAD
void badSource(char * &data)
{
/* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */
memset(data, 'A', 100-1); /* fill with 'A's */
data[100-1] = '\0'; /* null terminate */
}
void bad()
{
char * data;
data = new char[100];
badSource(data);
{
char dest[50] = "";
size_t i, dataLen;
dataLen = strlen(data);
/* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */
for (i = 0; i < dataLen; i++)
{
dest[i] = data[i];
}
dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */
printLine(data);
delete [] data;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B() uses the GoodSource with the BadSink */
static void goodG2BSource(char * &data)
{
/* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */
memset(data, 'A', 50-1); /* fill with 'A's */
data[50-1] = '\0'; /* null terminate */
}
static void goodG2B()
{
char * data;
data = new char[100];
goodG2BSource(data);
{
char dest[50] = "";
size_t i, dataLen;
dataLen = strlen(data);
/* POTENTIAL FLAW: Possible buffer overflow if data is larger than dest */
for (i = 0; i < dataLen; i++)
{
dest[i] = data[i];
}
dest[50-1] = '\0'; /* Ensure the destination buffer is null terminated */
printLine(data);
delete [] data;
}
}
void good()
{
goodG2B();
}
#endif /* OMITGOOD */
} /* close namespace */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
using namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_loop_43; /* so that we can use good and bad easily */
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
fb06341c89a36897c81e10c19ebdc67c51b0ff9b | d8033ee59a652736710748261771012f356b3431 | /projects/ProjectExample/ProjectExampleLayer1.hpp | 270ebcb0fb8d80039b8347e0fe26fe71f56edfe5 | [] | no_license | Shwastya/MyTFMDescent | 4f696a38d9e68bbaad2e5c40715465abdf536e84 | 1b872dd7682623de8a54cce1bfa8134a57694260 | refs/heads/master | 2023-06-23T12:24:23.310130 | 2021-07-17T20:54:22 | 2021-07-17T20:54:22 | 347,040,611 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 913 | hpp | #include <MHelmet.h>
#define MH MHelmet // CLIENT CALL NAMESPACE ENGINE SIDE
class MyTFMDescent : public MHelmet::NodeLayer
{
public:
using Render = MH::Renderer;
using RenderDrawCall = MH::RenderDrawCall;
using GeometryRender = MH::RendererGeometry;
MyTFMDescent();
void Join() override;
void Free() override;
void Update(MH::DeltaTime dt) override;
void ImGuiRender();
void OnEvent(MH::Event& event) override;
private:
// Shader Library
MH::ShaderLib m_S;
MH::RefCount<MH::Shader> Shader;
MH::RefCount<MH::VAO> m_VAO;
MH::CameraMan m_CameraMan;
MH::RefCount<MH::Texture2D> m_Texture, m_AlphaTree;
MH::RefCount<MH::Texture2D> m_BoardTexture;
MH::RefCount<MH::FrameBuffer> m_FrameBuffer;
/* ATRIBUTOS LUZ */
glm::vec3 m_LightPos{ 5.0f, 5.0f, 14.5f };
/* ATRIBUTOS MODELO */
ModelTransform m_Model;
glm::vec3 m_ModelColor{ 1.0f, 0.0f, 0.5f }; // para shader color solo
}; | [
"jose.l.rosa.m@gmail.com"
] | jose.l.rosa.m@gmail.com |
4973d40409480278010a3d3c06af8ec5c4eff8f1 | 7624109d0d61903e3f619b294ca053a5deff794d | /DPfloatover/third_party/Profinet/src/examples/configuration_control_of_io_systems/src/configuration_control_of_io_systems.cpp | f95941e4f06be5a67040007e98e4a04d08120bcc | [] | no_license | wp6726454/USV-robotics | e315c77b2dce6ef2d6b7177cd26bbc7842ee2a35 | 00a4d70f3120ea222da25ee91ae1a21a7a3f0abe | refs/heads/master | 2020-04-02T22:06:27.989364 | 2018-10-26T11:03:30 | 2018-10-26T11:03:30 | 154,821,670 | 1 | 0 | null | 2018-10-26T11:05:27 | 2018-10-26T11:05:26 | null | UTF-8 | C++ | false | false | 11,119 | cpp | /*****************************************************************************/
/* Copyright (C) 2015 Siemens Aktiengesellschaft. All rights reserved. */
/*****************************************************************************/
/* This program is protected by German copyright law and international */
/* treaties. The use of this software including but not limited to its */
/* Source Code is subject to restrictions as agreed in the license */
/* agreement between you and Siemens. */
/* Copying or distribution is not allowed unless expressly permitted */
/* according to your license agreement with Siemens. */
/*****************************************************************************/
/* */
/* P r o j e c t &P: PROFINET IO Runtime Software :P& */
/* */
/* P a c k a g e &W: PROFINET IO Runtime Software :W& */
/* */
/* C o m p o n e n t &C: PnDriver :C& */
/* */
/* F i l e &F: configuration_control_of_io_systems.cpp :F& */
/* */
/* V e r s i o n &V: V1.1.0 :V& */
/* */
/* D a t e (YYYY-MM-DD) &D: 2015-11-05 :D& */
/* */
/*****************************************************************************/
/* */
/* D e s c r i p t i o n : */
/* */
/* This example shows how to use the feature configuration control of IO */
/* systems. At the startup one of the two possible configurations can be */
/* choosen. Each configuration uses a master project and a generated */
/* hardware configuration. */
/* */
/* - Configuration 1: optional IODevices. */
/* - Configuration 2: optional IODevices and programmale peers. */
/* */
/* In order to set the preferred configuration without receiving */
/* diagnosis alarms first deactivate all devices and then execute the */
/* tailoring process. */
/* */
/*****************************************************************************/
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <stdio.h>
#include <psi_cfg.h>
#define LTRC_ACT_MODUL_ID 0000
#define PND_MODULE_ID 0000
#if (EPS_PLF == EPS_PLF_WINDOWS_X86)
#include <crtdbg.h>
#endif
#include "pnd_int.h"
#include "pniobase.h"
#include "servusrx.h"
#include "helper_functions.h"
#include "user_application_common.h"
extern "C"
{
extern PNIO_UINT32 g_ApplHandle;
}
extern FILE* pTraceFile;
void callback_for_ifc_record_read_conf(PNIO_CBE_PRM*) {}
void callback_for_ds_read_conf(PNIO_CBE_PRM*) {}
void callback_for_ds_write_conf(PNIO_CBE_PRM*) {}
void callback_for_alarm_ind(PNIO_CBE_PRM* pCbfPrm)
{
#if (EPS_PLF == EPS_PLF_WINDOWS_X86)
waitForConsole();
#endif
/* Check if correct callback type */
if(pCbfPrm->CbeType == PNIO_CBE_ALARM_IND || pCbfPrm->CbeType == PNIO_CBE_IFC_ALARM_IND)
{
if(pCbfPrm->AlarmInd.pAlarmData->AlarmType == PNIO_ALARM_DEV_RETURN)
{
printf("PNIO_ALARM_DEV_RETURN has been received for device %d\n", pCbfPrm->AlarmInd.pAlarmData->DeviceNum);
}
}
}
void callback_for_iosystem_reconfig( PNIO_CBE_PRM * pCbfPrm )
{
#if (EPS_PLF == EPS_PLF_WINDOWS_X86)
waitForConsole();
#endif
if( pCbfPrm->IoSystemReconf.Status != PNIO_OK )
{
printf("Device activation/deactivation failed: %s\n", getPnioError((int)pCbfPrm->IoSystemReconf.Status));
}
else
{
switch (pCbfPrm->IoSystemReconf.Mode)
{
case PNIO_DA_TRUE:
printf("All configured devices have been activated \n");
break;
case PNIO_DA_FALSE:
printf("All devices have been deactivated \n");
break;
default:
break;
};
}
}
void prepareConfiguration(int configuration, PNIO_UINT32& deviceCnt, PNIO_ADDR* deviceList,
PNIO_UINT32& portInterconCnt, PNIO_ADDR* pPortInterConList)
{
switch(configuration)
{
case 1:
deviceCnt = 1;
portInterconCnt = 0;
deviceList[0].AddrType = PNIO_ADDR_LOG;
deviceList[0].u.Addr = 268;
break;
case 2:
deviceCnt = 0;
portInterconCnt = 5;
pPortInterConList[0].u.Addr = 65;
pPortInterConList[1].u.Addr = 260;
pPortInterConList[2].u.Addr = 261;
pPortInterConList[3].u.Addr = 273;
pPortInterConList[4].u.Addr = 274;
pPortInterConList[5].u.Addr = 283;
pPortInterConList[6].u.Addr = 284;
pPortInterConList[7].u.Addr = 293;
pPortInterConList[8].u.Addr = 294;
pPortInterConList[9].u.Addr = 303;
break;
default:
printf("Wrong configuration number\n");
break;
}
}
int main()
{
int cmd = 777;
PNIO_UINT32 result;
int configuration = 0;
PNIO_ADDR deviceList[3];
PNIO_ADDR portInterconList[10];
PNIO_UINT32 deviceCnt = 0;
PNIO_UINT32 portInterconCnt = 0;
initPnd();
#if (EPS_PLF == EPS_PLF_WINDOWS_X86)
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
initConsoleLock();
#endif
while (cmd != 0)
{
#if (EPS_PLF == EPS_PLF_WINDOWS_X86)
lockConsole();
#endif
printf("\n");
printf("PROFINET Driver | Configuration control of IO systems\n");
printf("===========================================\n");
printf("1...Startup \n");
printf("2...Deactivate all IO devices \n");
printf("3...Execute tailoring process \n");
printf("0...Exit \n");
#if (EPS_PLF == EPS_PLF_WINDOWS_X86)
unlockConsole();
scanf_s("%d", &cmd);
#else
scanf("%d", &cmd);
#endif
while(getchar()!='\n');
switch(cmd)
{
case 1:
printf("Please enter configuration number (1 or 2)\n");
#if (EPS_PLF == EPS_PLF_WINDOWS_X86)
unlockConsole();
scanf_s("%d", &configuration);
#else
scanf("%d", &configuration);
#endif
switch(configuration)
{
case 1:
startUpPnd("PNDriverBase_OptIODevices/Station_1.PN Driver_1.PNDriverConfiguration.xml", NULL);
break;
case 2:
startUpPnd("PNDriverBase_FlexibleTopology/Station_1.PN Driver_1.PNDriverConfiguration.xml", NULL);
break;
default:
configuration = 0;
printf("Configuration number has to be 1 or 2\n");
break;
}
if(configuration != 0)
{
if( (result = PNIO_interface_open(1, callback_for_ifc_record_read_conf, callback_for_alarm_ind, &g_ApplHandle)) != PNIO_OK)
{
printf("PNIO_interface_open() returned error: %s\n", getPnioError(result));
}
else if((result = PNIO_controller_open(1, PNIO_CEP_MODE_CTRL, callback_for_ds_read_conf, callback_for_ds_write_conf, callback_for_alarm_ind, &g_ApplHandle)) != PNIO_OK)
{
printf("PNIO_controller_open() returned error: %s\n", getPnioError(result));
}
else if((result = PNIO_register_cbf( g_ApplHandle, PNIO_CBE_IOSYSTEM_RECONFIG, callback_for_iosystem_reconfig)) != PNIO_OK)
{
printf("PNIO_register_cbf() returned error: %s\n", getPnioError(result));
}
else if( (result = PNIO_set_mode(g_ApplHandle,PNIO_MODE_OPERATE)) != PNIO_OK)
{
printf("PNIO_set_mode() returned error: %s\n", getPnioError(result));
}
else
{
printf("Mode has been set to operate\n");
}
}
break;
case 2:
result = PNIO_iosystem_reconfig(g_ApplHandle, PNIO_IOS_RECONFIG_MODE_DEACT, 0, PNIO_NULL, 0, PNIO_NULL);
printf("PNIO_iosystem_reconfig returned result: %s at mode PNIO_IOS_RECONFIG_MODE_DEACT\n", getPnioError(result));
break;
case 3:
prepareConfiguration(configuration, deviceCnt, deviceList, portInterconCnt, portInterconList);
result = PNIO_iosystem_reconfig(g_ApplHandle,
PNIO_IOS_RECONFIG_MODE_TAILOR,
deviceCnt,
deviceList,
portInterconCnt,
portInterconList);
printf("PNIO_iosystem_reconfig() returned result: %s at mode PNIO_IOS_RECONFIG_MODE_TAILOR\n", getPnioError(result));
break;
case 0:
if ((result = PNIO_interface_close(g_ApplHandle)) != PNIO_OK)
{
printf("PNIO_interface_close() returned error: %s\n", getPnioError(result));
}
else if ((result = PNIO_controller_close(g_ApplHandle)) != PNIO_OK)
{
printf("PNIO_controller_close() returned error: %s\n", getPnioError(result));
}
else if((result = SERV_CP_shutdown()) != PNIO_OK)
{
printf("SERV_CP_shutdown() returned error: %s\n", getPnioError(result));
}
else
{
SERV_CP_undo_init();
}
break;
default:
break;
}
}
if (pTraceFile)
{
fclose(pTraceFile);
}
pTraceFile = NULL;
} | [
"huzhihuan1991@gmail.com"
] | huzhihuan1991@gmail.com |
440e98db0c912ac1746a71853a3932d77896b070 | 8e459f944409caa56c4d2031ef37fbc8c0bcd60c | /purelib/utils/crypto_wrapper.cpp | 3d0de377fbf6d6ded12cb8b3bb10e702f1589217 | [
"MIT"
] | permissive | isoundy000/libxstudio365 | 66a6964aab4a84e5b18d7bfe399dc9975f38c90a | 99a11fe8ac1644fcc2d4d5331779c4b13afa158e | refs/heads/master | 2021-04-02T16:48:18.381123 | 2015-07-28T02:19:23 | 2015-07-28T02:19:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,691 | cpp | #define _ZLIB_SUPPORT
#ifdef _ZLIB_SUPPORT
#if defined(_WIN32) && !defined(_WP8)
#include <zlib.h>/* from cocos2dx */
#pragma comment(lib, "libzlib.lib")
#else
#include <zlib.h>
#endif
#endif
#include <assert.h>
#include "crypto_wrapper.h"
#include "md6.h"
#include <algorithm>
#include <fstream>
#define HASH_FILE_BUFF_SIZE 1024
//#ifdef _WIN32
//#pragma comment(lib, "ws2_32.lib")
//#endif
using namespace purelib;
#ifdef _ZLIB_SUPPORT
std::string crypto::zlib::compress(const unmanaged_string& in, int level)
{
// calc destLen
uLongf destLen = compressBound(in.size());
std::string out(destLen, '\0');
// do compress
int ret = ::compress2((Bytef*)(&out.front()), &destLen, (const Bytef*)in.c_str(), in.size(), level);
if (ret == Z_OK)
{
out.resize(destLen);
}
return std::move(out);
}
std::string crypto::zlib::uncompress(const unmanaged_string& in)
{
return crypto::zlib::inflate(in);
}
std::string crypto::zlib::deflate(const purelib::unmanaged_string& in, int level)
{
int err;
Bytef buffer[128];
z_stream d_stream; /* decompression stream */
// strcpy((char*)buffer, "garbage");
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
d_stream.opaque = (voidpf)0;
d_stream.next_in = (Bytef*)in.c_str();
d_stream.avail_in = in.size();
d_stream.next_out = buffer;
d_stream.avail_out = sizeof(buffer);
err = deflateInit(&d_stream, level);
if (err != Z_OK) // TODO: log somthing
return "";
std::string output;
for (;;)
{
err = deflate(&d_stream, Z_FINISH);
if (err == Z_STREAM_END)
{
output.insert(output.end(), buffer, buffer + sizeof(buffer) - d_stream.avail_out);
break;
}
switch (err)
{
case Z_NEED_DICT:
err = Z_DATA_ERROR;
case Z_DATA_ERROR:
case Z_MEM_ERROR:
deflateEnd(&d_stream);
return "";
}
// not enough buffer ?
if (err != Z_STREAM_END)
{
output.insert(output.end(), buffer, buffer + sizeof(buffer));
d_stream.next_out = buffer;
d_stream.avail_out = sizeof(buffer);
}
}
err = deflateEnd(&d_stream);
if (err != Z_OK)
return "";
return std::move(output);
}
// gzip
std::string crypto::zlib::gzcompr(const purelib::unmanaged_string& in, int level)
{
int err;
Bytef buffer[128];
z_stream d_stream; /* decompression stream */
// strcpy((char*)buffer, "garbage");
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
d_stream.opaque = (voidpf)0;
d_stream.next_in = (Bytef*)in.c_str();
d_stream.avail_in = in.size();
d_stream.next_out = buffer;
d_stream.avail_out = sizeof(buffer);
err = deflateInit2(&d_stream, level, Z_DEFLATED, MAX_WBITS + 16, MAX_MEM_LEVEL - 1, Z_DEFAULT_STRATEGY);
if (err != Z_OK) // TODO: log somthing
return "";
std::string output;
for (;;)
{
err = deflate(&d_stream, Z_FINISH);
if (err == Z_STREAM_END)
{
output.insert(output.end(), buffer, buffer + sizeof(buffer) - d_stream.avail_out);
break;
}
switch (err)
{
case Z_NEED_DICT:
err = Z_DATA_ERROR;
case Z_DATA_ERROR:
case Z_MEM_ERROR:
deflateEnd(&d_stream);
return "";
}
// not enough buffer ?
if (err != Z_STREAM_END)
{
output.insert(output.end(), buffer, buffer + sizeof(buffer));
d_stream.next_out = buffer;
d_stream.avail_out = sizeof(buffer);
}
}
err = deflateEnd(&d_stream);
if (err != Z_OK)
return "";
return std::move(output);
}
std::string crypto::zlib::inflate(const unmanaged_string& compr)
{ // inflate
int err;
Bytef buffer[128];
z_stream d_stream; /* decompression stream */
// strcpy((char*)buffer, "garbage");
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
d_stream.opaque = (voidpf)0;
d_stream.next_in = (Bytef*)compr.c_str();
d_stream.avail_in = compr.size();
d_stream.next_out = buffer;
d_stream.avail_out = sizeof(buffer);
err = inflateInit(&d_stream);
if (err != Z_OK) // TODO: log somthing
return "";
// CHECK_ERR(err, "inflateInit");
std::string output;
for (;;)
{
err = inflate(&d_stream, Z_NO_FLUSH);
if (err == Z_STREAM_END)
{
output.insert(output.end(), buffer, buffer + sizeof(buffer) - d_stream.avail_out);
break;
}
switch (err)
{
case Z_NEED_DICT:
err = Z_DATA_ERROR;
case Z_DATA_ERROR:
case Z_MEM_ERROR:
inflateEnd(&d_stream);
return "";
}
// not enough memory ?
if (err != Z_STREAM_END)
{
// *out = (unsigned char*)realloc(*out, bufferSize * BUFFER_INC_FACTOR);
output.insert(output.end(), buffer, buffer + sizeof(buffer));
d_stream.next_out = buffer;
d_stream.avail_out = sizeof(buffer);
}
}
err = inflateEnd(&d_stream);
if (err != Z_OK)
return "";
return std::move(output);
}
std::string crypto::zlib::gzuncompr(const unmanaged_string& compr)
{ // inflate
int err;
Bytef buffer[128];
z_stream d_stream; /* decompression stream */
// strcpy((char*)buffer, "garbage");
d_stream.zalloc = nullptr;
d_stream.zfree = nullptr;
d_stream.opaque = (voidpf)0;
d_stream.next_in = (Bytef*)compr.c_str();
d_stream.avail_in = compr.size();
d_stream.next_out = buffer;
d_stream.avail_out = sizeof(buffer);
err = inflateInit2(&d_stream, MAX_WBITS + 16);
if (err != Z_OK) // TODO: log somthing
return "";
// CHECK_ERR(err, "inflateInit");
std::string output;
for (;;)
{
err = inflate(&d_stream, Z_NO_FLUSH);
if (err == Z_STREAM_END)
{
output.insert(output.end(), buffer, buffer + sizeof(buffer) - d_stream.avail_out);
break;
}
switch (err)
{
case Z_NEED_DICT:
err = Z_DATA_ERROR;
case Z_DATA_ERROR:
case Z_MEM_ERROR:
inflateEnd(&d_stream);
return "";
}
// not enough memory ?
if (err != Z_STREAM_END)
{
// *out = (unsigned char*)realloc(*out, bufferSize * BUFFER_INC_FACTOR);
output.insert(output.end(), buffer, buffer + sizeof(buffer));
d_stream.next_out = buffer;
d_stream.avail_out = sizeof(buffer);
}
}
err = inflateEnd(&d_stream);
if (err != Z_OK)
return "";
return std::move(output);
}
#endif
std::string crypto::hash::md5(const unmanaged_string& plaintext)
{
char ciphertext[32];
md5chars(plaintext.c_str(), plaintext.length(), ciphertext);
return std::string(ciphertext, sizeof(ciphertext));
}
std::string crypto::hash::md5raw(const unmanaged_string& plaintext)
{
char ciphertext[16];
::md5(plaintext.c_str(), plaintext.length(), ciphertext);
return std::string(ciphertext, sizeof(ciphertext));
}
std::string crypto::hash::md6(const std::string& plaintext)
{
// char ciphertext[128];
std::string result(128, '\0');
::md6chars(plaintext.c_str(), plaintext.length(), &result.front(), 64);
return std::move(result); // std::string(ciphertext, sizeof(ciphertext));
}
std::string crypto::hash::md6raw(const std::string& plaintext)
{
std::string result(64, '\0');
::md6(plaintext.c_str(), plaintext.length(), &result.front(), 64);
return std::move(result);
}
std::string crypto::hash::fmd5(const char* filename)
{
std::ifstream fin;
fin.open(filename, std::ios_base::binary);
if (!fin.is_open())
{
// std::cout << "Transmission Client: open failed!\n";
return "";
}
fin.seekg(0, std::ios_base::end);
std::streamsize bytes_left = fin.tellg(); // filesize initialized
fin.seekg(0, std::ios_base::beg);
char buffer[HASH_FILE_BUFF_SIZE];
md5_state_t state;
char hash[16] = { 0 };
std::string result(32, '\0');
md5_init(&state);
while (bytes_left > 0) {
int bytes_read = (std::min)((std::streamsize)sizeof(buffer), bytes_left);
fin.read(buffer, bytes_read);
md5_append(&state, (unsigned char*)buffer, bytes_read);
bytes_left -= bytes_read;
}
fin.close();
md5_finish(&state, (unsigned char*)hash);
hexs2chars(hash, sizeof(hash), &result.front(), result.size());
return std::move(result);
}
std::string crypto::hash::fmd6(const char* filename, int hashByteLen)
{
std::ifstream fin;
fin.open(filename, std::ios_base::binary);
if (!fin.is_open())
{
// std::cout << "Transmission Client: open failed!\n";
return "";
}
fin.seekg(0, std::ios_base::end);
std::streamsize bytes_left = fin.tellg(); // filesize initialized
fin.seekg(0, std::ios_base::beg);
char buffer[HASH_FILE_BUFF_SIZE];
md6_state state;
if (hashByteLen > 64)
hashByteLen = 64;
// int hashByteLen = 64;
// assert(hashByteLen <= 64);
char hash[64] = { 0 };
std::string result(hashByteLen << 1, '\0');
md6_init(&state, hashByteLen << 3);
while (bytes_left > 0) {
int bytes_read = (std::min)((std::streamsize)sizeof(buffer), bytes_left);
fin.read(buffer, bytes_read);
md6_update(&state, (unsigned char*)buffer, bytes_read << 3);
bytes_left -= bytes_read;
}
fin.close();
md6_final(&state, (unsigned char*)hash);
hexs2chars(hash, hashByteLen, &result.front(), result.size());
return std::move(result);
}
std::string crypto::http::b64dec(const unmanaged_string& ciphertext)
{
std::string plaintext;
plaintext.reserve( ciphertext.length() );
base64_decodestate state;
base64_init_decodestate(&state);
int r1 = base64_decode_block(ciphertext.c_str(), ciphertext.length(), (char*)plaintext.c_str(), &state);
plaintext.assign(plaintext.c_str(), r1);
return std::move(plaintext);
}
std::string crypto::http::b64enc(const unmanaged_string& plaintext)
{
std::string ciphertext;
ciphertext.reserve( (plaintext.length() * 2) );
char* wrptr = (char*)ciphertext.c_str();
base64_encodestate state;
base64_init_encodestate(&state);
int r1 = base64_encode_block(plaintext.c_str(), plaintext.length(), wrptr, &state);
int r2 = base64_encode_blockend((char*)ciphertext.c_str() + r1, &state);
wrptr[r1 + r2] = '\0';
ciphertext.assign(wrptr, r1 + r2);
return std::move(ciphertext);
}
std::string crypto::http::urlencode(const unmanaged_string& input)
{
std::string output;
for( size_t ix = 0; ix < input.size(); ix++ )
{
uint8_t buf[4];
memset( buf, 0, 4 );
if( isalnum( (uint8_t)input[ix] ) )
{
buf[0] = input[ix];
}
//else if ( isspace( (BYTE)sIn[ix] ) )
//{
// buf[0] = '+';
//}
else
{
buf[0] = '%';
buf[1] = ::hex2uchr( (uint8_t)input[ix] >> 4 );
buf[2] = ::hex2uchr( (uint8_t)input[ix] % 16);
}
output += (char *)buf;
}
return std::move(output);
};
std::string crypto::http::urldecode(const unmanaged_string& ciphertext)
{
std::string result = "";
for( size_t ix = 0; ix < ciphertext.size(); ix++ )
{
uint8_t ch = 0;
if(ciphertext[ix]=='%')
{
ch = (::uchr2hex(ciphertext[ix+1])<<4);
ch |= ::uchr2hex(ciphertext[ix+2]);
ix += 2;
}
else if(ciphertext[ix] == '+')
{
ch = ' ';
}
else
{
ch = ciphertext[ix];
}
result += (char)ch;
}
return std::move(result);
}
/*
** UC_AUTHCODE implementation, legacy
**
*/
/*#define ord int
#define chr char
std::string crypto::http::uc_authcode(const std::string& input_string, AuthType operation, const char* public_key, unsigned int expiry)
{
int ckey_length = 4;
std::string key0 = crypto::http::md5(public_key);
std::string key1 = crypto::http::md5(key0.substr(0, 16));
std::string key2 = crypto::http::md5(key0.substr(16, 16));
std::string key3 = ckey_length ? (operation == kAuthTypeDecode ? input_string.substr(0, ckey_length): nsc::rsubstr(md5(microtime()), ckey_length)) : "";
std::string cryptkey = key1 + md5(key1 + key3);
int key_length = cryptkey.length();
char times[16];
sprintf(times, "%010d", expiry ? expiry + time(NULL) : 0);
std::string judge_text = operation == kAuthTypeDecode ? b64dec(input_string.substr(ckey_length)) : times + md5(input_string + key2).substr(0, 16) + input_string;
int string_length = judge_text.length();
int i, j, k;
uint8_t tmp;
std::string result = "";
uint8_t box[256];
for(i = 0; i < 256; ++i)
{
box[i] = i;
}
uint8_t rndkey[256];
for(i = 0; i < 256; i++) {
rndkey[i] = ord(cryptkey[i % key_length]);
}
for(j = i = 0; i < 256; i++) {
j = (j + box[i] + rndkey[i]) % 256;
tmp = box[i];
box[i] = box[j];
box[j] = tmp;
}
for(k = j = i = 0; i < string_length; i++) {
k = (k + 1) % 256;
j = (j + box[k]) % 256;
tmp = box[k];
box[k] = box[j];
box[j] = tmp;
result += chr(ord(judge_text[i]) ^ (box[(box[k] + box[j]) % 256]));
}
if(operation == kAuthTypeDecode) {
if((nsc::to_numeric<time_t>(result.substr(0, 10)) == 0 || nsc::to_numeric<time_t>(result.substr(0, 10)) - time(NULL) > 0) && result.substr(10, 16) == md5(result.substr(26) + key2).substr(0, 16)) {
return result.substr(26);
} else {
return "";
}
} else {
return key3 + nsc::replace(b64enc(result), "=", "");
}
}*/
| [
"xseekerj@live.com"
] | xseekerj@live.com |
f85937fb337336e1afbf4bd26196288e6da4d43d | 38e95a2bbf710735067ff60639fa50bb98630150 | /Source/Vr_Room/Vr_RoomGameModeBase.cpp | 89b7c5cf3a7561e7cbfb83dd87401aac6e663bbe | [] | no_license | zoown13/Vr_Room | f21bd4bd4853025f1acb07b970a2d7189228a836 | 04492a772f7b6e929a6796633684567105c04283 | refs/heads/master | 2022-11-08T02:45:17.268247 | 2020-06-13T08:49:45 | 2020-06-13T08:49:45 | 266,469,697 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 97 | cpp | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "Vr_RoomGameModeBase.h"
| [
"zoown13@gmail.com"
] | zoown13@gmail.com |
170d954089f1329568ebfdabfc1bf63b9c3bdeec | 527762d7e41bfd5421d9a7f37cf7c3a81357f78c | /src/terraineditor/editor.cpp | 1a35a4dbbbe2f7025d4245963d070e9b80cd53ba | [
"MIT"
] | permissive | sgynn/worldeditor | c14b84a6207f4b45812820a185edcf2a873b29ae | df15449aeb83c4dc48dab5d6bdcf6975045c0135 | refs/heads/master | 2023-06-23T08:36:01.281953 | 2023-06-18T11:45:44 | 2023-06-18T11:45:44 | 49,837,234 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,759 | cpp | #include <base/opengl.h>
#include <base/xml.h>
#include "editor.h"
#include <cstring>
#include <cstdio>
#include <base/game.h>
#include <base/input.h>
#include <base/hardwarebuffer.h>
#include <base/debuggeometry.h>
#include <base/drawablemesh.h>
#include <base/scene.h>
#include <base/mesh.h>
void BrushData::reset(const Brush& brush, float resolution, int channels) {
m_resolution = resolution;
vec2 min = ceil ((brush.position - brush.radius) / resolution);
vec2 max = floor((brush.position + brush.radius) / resolution);
m_intOffset.set(min.x, min.y);
m_offset = min * resolution;
m_size.x = max.x - min.x + 1;
m_size.y = max.y - min.y + 1;
m_channels = channels;
int count = m_size.x * m_size.y * m_channels;
int lock = m_size.x * m_size.y / 64 + 1;
if(m_dataSize < count) {
delete [] m_data;
m_data = new float[count];
m_dataSize = count;
delete [] m_lock;
m_lock = new uint64[lock];
}
m_mx = m_channels;
m_my = m_channels * m_size.x;
memset(m_data, 0, count * sizeof(float));
memset(m_lock, 0, lock * sizeof(uint64));
}
// --------------------------------------------- //
inline float clamp(float f, float min=0, float max=1) {
if(f<min) return min;
if(f>max) return max;
return f;
}
TerrainEditor::TerrainEditor(TerrainEditorDataInterface* t) : m_target(t), m_tool(0), m_locked(false), m_stroke(false) {
m_brushNode = new base::SceneNode("Brush");
m_brush.radius = 10;
m_brush.falloff = 0.5;
m_brush.strength = 1;
}
TerrainEditor::~TerrainEditor() {
base::DrawableMesh* drawable = static_cast<base::DrawableMesh*>(m_brushNode->getAttachment(0));
if(drawable) {
delete drawable->getMesh();
delete drawable;
}
delete m_brushNode;
}
void TerrainEditor::close() {
setTool(0);
}
void TerrainEditor::setTool(ToolInstance* t) {
m_brushNode->setVisible(false);
m_tool = t;
}
const Brush& TerrainEditor::getBrush() const {
return m_brush;
}
void TerrainEditor::setBrush(const Brush& b) {
m_brush.radius = b.radius;
m_brush.strength = b.strength;
m_brush.falloff = b.falloff;
}
void TerrainEditor::update(const Mouse& mouse, const Ray& ray, base::Camera*, InputState& state) {
if(!m_tool || !m_target) return;
// update current brush
float hitDistance = 0;
int hit = m_target->trace(ray, hitDistance);
vec3 position = ray.point(hitDistance);
if(hit) m_brush.position = position.xz();
else {
// y=0 plane outside map bounds
float t = -ray.start.y / ray.direction.y;
position = ray.point(t);
hit = t > 0;
}
if(!m_stroke && state.overGUI) hit = false;
// Change brush size
if(mouse.wheel && !state.consumedMouseWheel) {
if(state.keyMask==0) m_brush.radius = clamp( m_brush.radius * (1.0 + mouse.wheel * 0.1), 1, 100);
else if(state.keyMask==SHIFT_MASK) m_brush.strength = clamp( m_brush.strength + mouse.wheel * 0.01 );
else if(state.keyMask==CTRL_MASK) m_brush.falloff = clamp( m_brush.falloff + mouse.wheel * 0.01 );
printf("radius: %g strength: %g falloff: %g\n", m_brush.radius, m_brush.strength, m_brush.falloff);
state.consumedMouseWheel = true;
}
// Update rings
m_brushNode->setVisible(hit);
if(hit) {
updateBrushRings(position, m_brush.radius, m_brush.getRadius(0.5));
m_locked = true;
m_brush.position = position.xz();
EditableMap* maps[9]; vec3 offsets[9]; int flags[9];
int mapCount = m_target->getMaps(0, m_brush, maps, offsets, flags);
for(int i=0; i<mapCount; ++i) if(flags[i]==0) { m_locked = false; break; }
}
// Start/Stop brush stroke
if(!m_stroke && (mouse.pressed&1) && !state.consumedMouseDown) {
state.consumedMouseDown = true;
m_tool->tool->begin(m_brush);
m_last = position.xz();
m_stroke = true;
}
else if(m_stroke && (mouse.released&1)) {
m_tool->tool->end();
m_stroke = false;
}
// Paint
if(m_stroke) {
float distance = m_brush.position.distance(m_last);
m_last = position.xz();
if(distance > 40) {
printf("Warning: long brush stroke : (%g, %g) - (%g, %g)\n", m_last.x, m_last.y, m_brush.position.x, m_brush.position.y);
return;
}
int toolFlags = state.keyMask&SHIFT_MASK? m_tool->shift: m_tool->flags;
Tool* tool = m_tool->tool;
float spacing = fmin(m_brush.getRadius(0.8), m_brush.radius * 0.4) * 0.5;
int samples = (int) floor(distance / spacing) + 1;
vec2 step = (m_last - m_brush.position) / distance * spacing;
float resolution = 1; //m_tool->getResolution(); // should be from maps?
vec3 offsets[9];
EditableMap* maps[9];
Rect local[9];
Point base[9];
int flags[9];
int mapCount;
//uint64 ticks = base::Game::getTicks();
if(samples==1) step.set(0,0);
for(int j=0; j<samples; ++j) {
m_brush.position = position.xz() + step * j;
mapCount = m_target->getMaps(tool->getTarget(), m_brush, maps, offsets, flags);
if(mapCount==0) continue;
// Fill buffer
resolution = m_target->getResolution(tool->getTarget());
m_buffer.reset(m_brush, resolution, maps[0]->getChannels());
for(int k=0; k<mapCount; ++k) {
vec2 basef = floor((m_brush.position - offsets[k].xz() - m_brush.radius) / resolution);
base[k].set(basef.x, basef.y);
local[k].set(base[k], m_buffer.getSize());
local[k].intersect(maps[k]->getRect());
maps[k]->prepare(local[k]);
const Point& end = local[k].bottomRight();
for(int x=local[k].x; x<end.x; ++x) for(int y=local[k].y; y<end.y; ++y) {
if(m_buffer.locked(x-base[k].x, y-base[k].y)) continue;
float* data = m_buffer.getValue(x-base[k].x, y-base[k].y);
maps[k]->getValue(x, y, data);
}
if(flags[k]&1) for(int x=local[k].x; x<end.x; ++x) for(int y=local[k].y; y<end.y; ++y) {
m_buffer.lock(x-base[k].x, y-base[k].y);
}
}
// Run tool
tool->paint(m_buffer, m_brush, toolFlags);
// Write from buffer
for(int k=0; k<mapCount; ++k) {
if(flags[k]&1) continue; // Read only flag
const Point& end = local[k].bottomRight();
for(int x=local[k].x; x<end.x; ++x) for(int y=local[k].y; y<end.y; ++y) {
float* data = m_buffer.getValue(x-base[k].x, y-base[k].y);
maps[k]->setValue(x, y, data);
}
}
// Apply changes
for(int k=0; k<mapCount; ++k) {
maps[k]->apply(local[k]);
}
}
}
}
void TerrainEditor::updateBrushRings(const vec3& centre, float r1, float r2) {
base::DrawableMesh* drawable = static_cast<base::DrawableMesh*>(m_brushNode->getAttachment(0));
if(!drawable) {
drawable = new base::DrawableMesh();
base::HardwareVertexBuffer* buffer = new base::HardwareVertexBuffer();
base::Mesh* mesh = new base::Mesh();
buffer->attributes.add(base::VA_VERTEX, base::VA_FLOAT3);
buffer->attributes.add(base::VA_COLOUR, base::VA_ARGB);
buffer->createBuffer();
mesh->setVertexBuffer(buffer);
mesh->setPolygonMode(base::PolygonMode::LINE_STRIP);
drawable->setMesh(mesh);
drawable->setMaterial(base::DebugGeometryManager::getInstance()->getDefaultMaterial());
m_brushNode->attach(drawable);
}
struct Vertex { vec3 pos; uint colour; };
static std::vector<Vertex> data(70, Vertex{centre, 0xffffff00});
int k = 0;
auto addRing = [this](const vec3& centre, float r, std::vector<Vertex>& data, int& k) {
int sides = TWOPI * r * 2;
if(sides > 32) sides = 32;
float step = TWOPI / sides;
for(int i=0; i<=sides; ++i) {
Vertex& vx = data[k++];
vx.pos.x = centre.x + r * sin(i*step);
vx.pos.z = centre.z + r * cos(i*step);
vx.pos.y = m_target->getHeight(vx.pos) + 0.1;
data.push_back(vx);
}
};
addRing(centre, r1, data, k);
data[k++].pos.y = INFINITY;
addRing(centre, r2, data, k);
drawable->getMesh()->getVertexBuffer()->copyData(&data[0], k, sizeof(Vertex));
}
base::XMLElement TerrainEditor::save(const TerrainMap* context) const {
return base::XMLElement();
}
void TerrainEditor::load(const base::XMLElement&, const TerrainMap* context) {
}
| [
"dragoninspire@gmail.com"
] | dragoninspire@gmail.com |
e6d251ff1a57f5f2514b472afbcf84c24cfde4f4 | d02f13d1ac1c259ec73fd9b430ef72869c59bec7 | /q26.cpp | 0c8a181983164d26ab018dce8dc6b8de2c2880b9 | [] | no_license | imsudip/c- | bc689b5f72c32973bc4c51d64a21f37803010f91 | c3612610a44078cd6f8ba2791b9366f4c21cd33d | refs/heads/master | 2021-03-28T18:28:19.025866 | 2021-01-03T05:04:09 | 2021-01-03T05:04:09 | 247,884,636 | 1 | 0 | null | 2020-05-28T07:15:16 | 2020-03-17T05:12:05 | C++ | UTF-8 | C++ | false | false | 1,522 | cpp | #include<iostream>
#include<fstream>
using namespace std;
int main()
{
struct student
{
char name [50];
int roll,year,cls;
float sub1,sub2,sub3,total_marks;
};
struct student s[10];
int n,i;
cout<<"Enter No.of students: ";
cin>>n;
fstream fout;
fout.open("g:\\student.xls",ios::app);
fout<<"NAME\tROLL\tCLASS\tYEAR\tSUBJECT1\tSUBJECT2\tSUBJECT3\tTOTAL";
for(i=0;i<n;++i)
{
cout<<"\n\nFor Student"<<i+1;
cout<<"\n\nEnter name:";
cin>>s[i].name;
cout<<"\nEnter Roll Number:";
cin>>s[i].roll;
cout<<"\nEnter Class:";
cin>>s[i].cls;
cout<<"\nEnter Year:";
cin>>s[i].year;
cout<<"\nEnter marks of Subject 1:";
cin>>s[i].sub1;
cout<<"\nEnter marks of Subject 2:";
cin>>s[i].sub2;
cout<<"\nEnter marks of subject 3:";
cin>>s[i].sub3;
s[i].total_marks=s[i].sub1+s[i].sub2+s[i].sub3;
cout<<"\tStudent details\n--------------------------------------";
cout<<"\nName: "<<s[i].name<<"\n\nRoll = "<<s[i].roll<<"\n\nClass = "<<s[i].cls<<"\n\nYear = "<<s[i].year<<"\n\nSubject 1 = "<<s[i].sub1<<"\n\nSubject 2 = "<<s[i].sub2<<"\n\nSubject 3 = "<<s[i].sub3<<"\n\nTotal Marks = "<<s[i].total_marks;
fout<<"\n"<<s[i].name<<"\t"<<s[i].roll<<"\t"<<s[i].cls<<"\t"<<s[i].year<<"\t"<<s[i].sub1<<"\t"<<s[i].sub2<<"\t"<<s[i].sub2<<"\t"<<s[i].sub3<<"\t"<<s[i].total_marks;
}
fout.close();
return 0;
} | [
"49285187+imsudip@users.noreply.github.com"
] | 49285187+imsudip@users.noreply.github.com |
bc87a2dd09375bd10b9a2eac7c4e933ed61b14a0 | ed8f215222d537d718a525247991ca678a19a676 | /include/http_pattern_matcher/path_matcher_node.h | a23cc91e7b32ac0516e752fde5879e470d73503f | [
"Apache-2.0"
] | permissive | nareddyt/http_pattern_matcher | ad9c53c8e212e7ec8e7c17a2f4d9a96e64ff138f | 579163bb435706d8f582e3da3017af89c0f4bbae | refs/heads/main | 2023-03-15T01:57:45.739745 | 2021-03-17T17:20:25 | 2021-03-17T17:20:25 | 348,393,495 | 0 | 0 | Apache-2.0 | 2021-03-16T15:12:30 | 2021-03-16T15:12:29 | null | UTF-8 | C++ | false | false | 7,439 | h | /* Copyright 2021 Google Inc.
*
* 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 <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
namespace google {
namespace http {
namespace pattern_matcher {
typedef std::string HttpMethod;
struct PathMatcherLookupResult {
PathMatcherLookupResult() : data(nullptr), is_multiple(false) {}
PathMatcherLookupResult(void* data, bool is_multiple)
: data(data), is_multiple(is_multiple) {}
// The WrapperGraph that is registered to a method (or HTTP path).
void* data;
// Whether the method (or path) has been registered for more than once.
bool is_multiple;
};
// PathMatcherNodes represents a path part in a PathMatcher trie. Children nodes
// represent adjacent path parts. A node can have many literal children, one
// single-parameter child, and one repeated-parameter child.
//
// Thread Compatible.
class PathMatcherNode {
public:
// Provides information for inserting templates into the trie. Clients can
// instantiate PathInfo with the provided Builder.
class PathInfo {
public:
class Builder {
public:
friend class PathInfo;
Builder() : path_() {}
~Builder() {}
PathMatcherNode::PathInfo Build() const;
// Appends a node that must match the string value of a request part. The
// strings "/." and "/.." are disallowed.
//
// Example:
//
// builder.AppendLiteralNode("a")
// .AppendLiteralNode("b")
// .AppendLiteralNode("c");
//
// Matches the request path: a/b/c
Builder& AppendLiteralNode(std::string name);
// Appends a node that ignores the string value and matches any single
// request part.
//
// Example:
//
// builder.AppendLiteralNode("a")
// .AppendSingleParameterNode()
// .AppendLiteralNode("c");
//
// Matching request paths: a/foo/c, a/bar/c, a/1/c
Builder& AppendSingleParameterNode();
// TODO: Appends a node that ignores string values and matches any
// number of consecutive request parts.
//
// Example:
//
// builder.AppendLiteralNode("a")
// .AppendLiteralNode("b")
// .AppendRepeatedParameterNode();
//
// Matching request paths: a/b/1/2/3/4/5, a/b/c
// Builder& AppendRepeatedParameterNode();
private:
std::vector<std::string> path_;
}; // class Builder
~PathInfo() {}
// Returns path information used to insert a new path into a PathMatcherNode
// trie.
const std::vector<std::string>& path_info() const { return path_; }
private:
explicit PathInfo(const Builder& builder) : path_(builder.path_) {}
std::vector<std::string> path_;
}; // class PathInfo
typedef std::vector<std::string> RequestPathParts;
// Creates a Root node with an empty WrapperGraph map.
PathMatcherNode() : result_map_(), children_(), wildcard_(false) {}
~PathMatcherNode();
// Creates a clone of this node and its subtrie
std::unique_ptr<PathMatcherNode> Clone() const;
// Searches subtrie by finding a matching child for the current path part. If
// a matching child exists, this function recurses on current + 1 with that
// child as the receiver. If a matching descendant is found for the last part
// in then this method copies the matching descendant's WrapperGraph,
// VariableBindingInfoMap to the result pointers.
void LookupPath(const RequestPathParts::const_iterator current,
const RequestPathParts::const_iterator end,
HttpMethod http_method,
PathMatcherLookupResult* result) const;
// This method inserts a path of nodes into this subtrie. The WrapperGraph,
// VariableBindingInfoMap are inserted at the terminal descendant node.
// Returns true if the template didn't previously exist. Returns false
// otherwise and depends on if mark_duplicates is true, the template will be
// marked as having been registered for more than once and the lookup of the
// template will yield a special error reporting WrapperGraph.
bool InsertPath(const PathInfo& node_path_info, std::string http_method,
void* method_data, bool mark_duplicates);
void set_wildcard(bool wildcard) { wildcard_ = wildcard; }
private:
// This method inserts a path of nodes into this subtrie (described by the
// vector<Info>, starting from the |current| position in the iterator of path
// parts, and if necessary, creating intermediate nodes along the way. The
// WrapperGraph, VariableBindingInfoMap are inserted at the terminal
// descendant node (which corresponds to the string part in the iterator).
// Returns true if the template didn't previously exist. Returns false
// otherwise and depends on if mark_duplicates is true, the template will be
// marked as having been registered for more than once and the lookup of the
// template will yield a special error reporting WrapperGraph.
bool InsertTemplate(const std::vector<std::string>::const_iterator current,
const std::vector<std::string>::const_iterator end,
HttpMethod http_method, void* method_data,
bool mark_duplicates);
// Helper method for LookupPath. If the given child key exists, search
// continues on the child node pointed by the child key with the next part
// in the path. Returns true if found a match for the path eventually.
bool LookupPathFromChild(const std::string child_key,
const RequestPathParts::const_iterator current,
const RequestPathParts::const_iterator end,
HttpMethod http_method,
PathMatcherLookupResult* result) const;
// If a WrapperGraph is found for the provided key, then this method returns
// true and copies the WrapperGraph to the provided result pointer. If no
// match is found, this method returns false and leaves the result unmodified.
//
// NB: If result == nullptr, method will return bool value without modifying
// result.
bool GetResultForHttpMethod(HttpMethod key,
PathMatcherLookupResult* result) const;
std::map<HttpMethod, PathMatcherLookupResult> result_map_;
// Lookup must be FAST
//
// n: the number of paths registered per client varies, but we can expect the
// size of |children_| to range from ~5 to ~100 entries.
//
// To ensure fast lookups when n grows large, it is prudent to consider an
// alternative to binary search on a sorted vector.
std::unordered_map<std::string, std::unique_ptr<PathMatcherNode>> children_;
// True if this node represents a wildcard path '**'.
bool wildcard_;
};
} // namespace pattern_matcher
} // namespace http
} // namespace google
| [
"qiwzhang@google.com"
] | qiwzhang@google.com |
05b389a28e6949a8db91409e9b2e38807c61e4a6 | 13d7a0a52aace8524bb2d841c1736f5b74d61799 | /src/Light.cpp | 56d428a3080b3bf788f2a79311dd457fbf09f7c1 | [] | no_license | kotea/MyFrameWorks | a806abc38e1adc600f52224952fc4a205c18fc0a | 77c384e7fbb5ba5ce5ff844ff47905ee1188eeb3 | refs/heads/master | 2021-09-10T20:09:13.935299 | 2018-04-01T11:13:53 | 2018-04-01T11:13:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 508 | cpp | #include"Light.h"
DirectionalLight::DirectionalLight() {
}
DirectionalLight::~DirectionalLight() {
}
void DirectionalLight::SetDirection(float x, float y, float z) {
this->direction = Vector3f(x, y, z);
}
void DirectionalLight::SetColor(float r, float g, float b, float a) {
this->color = Vector4f(r, g, b, a);
}
void DirectionalLight::SetShader(ShaderClass* shader) {
shader->SetAmbientLight(1.0f, Vector4f(0.5f, 0.5f, 0.5f, 1.0f));
shader->SetDirectionalLight(0.3f, this->color, this->direction);
} | [
"kouzi85@gmail.com"
] | kouzi85@gmail.com |
b857701c41e38f7bcd4528dcede0c3ac28cf92a4 | 09ddd2df75bce4df9e413d3c8fdfddb7c69032b4 | /include/LFC/FileByteStream.h | 85e937753993906dd8da3584a6fe199b0c616b10 | [] | no_license | sigurdle/FirstProject2 | be22e4824da8cd2cb5047762478050a04a4ac63b | dee78c62a1b95e55fcdf3bf2a9bc79c69705bf94 | refs/heads/master | 2021-01-16T18:45:41.042140 | 2020-08-18T16:57:13 | 2020-08-18T16:57:13 | 3,554,336 | 6 | 5 | null | null | null | null | UTF-8 | C++ | false | false | 1,717 | h | #ifndef __FileByteStream_h_
#define __FileByteStream_h_
#if AMIGA
typedef long BPTR;
#endif
namespace System
{
namespace IO
{
enum FileStatus
{
FileStatus_Ok = 0,
FileStatus_Error = -100,
FileStatus_FileNotFound = FileStatus_Error - 1,//ERROR_FILE_NOT_FOUND
FileStatus_PathNotFound = FileStatus_Error - 2,
FileStatus_SharingViolation = FileStatus_Error - 32,//ERROR_SHARING_VIOLATION
};
/*
enum FileMode
{
FileMode_Read = 1,
FileMode_Write,
FileMode_ReadWrite,
};
*/
//LFCEXT Stream& operator << (Stream& stream, FileMode mode);
#if 0
class LFCEXT FileByteStream : public Object, public ISequentialByteStream
{
public:
CTOR FileByteStream();
#if WIN32
//FileByteStream(HANDLE hFile, bool bOwnHandle);
#elif AMIGA
CTOR FileByteStream(BPTR hFile, bool bOwnHandle);
#endif
CTOR FileByteStream(StringIn filename, FileMode mode = FileMode_Read);
~FileByteStream();
// ULONG m_refcount;
// ULONG AddRef();
// ULONG Release();
void Open(StringIn filename, FileMode mode);
//void Open(const char* filename);
virtual ULONG Read(void* pv, ULONG cb);
virtual LONGLONG Seek(LONGLONG offset, SeekOrigin origin);
virtual LONGLONG GetSize();
// virtual LONGLONG GetSize() const;
virtual ISequentialByteStream* Clone() const;
virtual ULONG Write(const void* pv, ULONG cb);
long GetLastStatus() const;
void Close();
#ifdef WIN32
static FileByteStream* FromHandle(HANDLE hFile, bool bOwnHandle);
#endif
protected:
String m_filename;
#if WIN32
HANDLE m_hFile;
#elif AMIGA
BPTR m_hFile;
// struct DosLibrary* m_DOSBase;
ULONG reserved;
#elif __APPLE__
short m_forkRefNum;
#endif
long m_lastStatus;
bool m_bOwnHandle;
};
#endif
} // IO
} // System
#endif // __FileByteStream_h_
| [
"sigurd.lerstad@gmail.com"
] | sigurd.lerstad@gmail.com |
4348be45546e2daa9a64c2ca34db8f5dd8a63216 | 184c3036a3624a65ce2fa0939cf8ba0ba2ef3294 | /Semester3/ComputerNetworks/Practicals/dijkstraAlgorithm/unweightedGraph/main.cpp | 2fe9dbd19ac3ded858285d1b298a5bf5e9551fd2 | [] | no_license | itsanshulverma/du-cs-undergrad-course | 9b6fd81d95fe6d89f74d792a45abd3537030d2ae | 98bf2af2c2698e2b10508160945e41cc51e18c77 | refs/heads/master | 2022-07-09T03:14:35.032690 | 2022-06-18T04:55:30 | 2022-06-18T04:55:30 | 238,611,894 | 20 | 14 | null | 2020-11-16T09:32:08 | 2020-02-06T05:03:47 | C++ | UTF-8 | C++ | false | false | 3,072 | cpp | /*
Implementation of Dijkstra algorithm in routing using Adjacency Matrix
Author: Anshul Verma, 19/78065
*/
#include <iostream>
#include <string>
using namespace std;
int extractMinVertex(int *dist, bool *visited, int n)
{
int minIndex = -1;
for (int i = 0; i < n; i++)
if(!visited[i] && (minIndex == -1 || dist[minIndex] > dist[i]))
minIndex = i;
return minIndex;
}
// Dijkstra Algorithm
void dijkstra(int **adj, int n, int source, int dest)
{
int *dist = new int[n];
bool *visited = new bool[n];
string *path = new string[n];
// Inintialising each element of distance(with INF)
// visited(with false)
// path with ""
for (int i = 0; i < n; i++)
{
dist[i] = INT16_MAX;
visited[i] = false;
path[i] = "";
}
// Source -> Source: 0
dist[source] = 0;
// Main Algorithm
for (int i = 0; i < n-1; i++)
{
int minVertex = extractMinVertex(dist, visited, n);
visited[minVertex] = true;
for (int j = 0; j < n; j++)
{
if(!visited[j] && adj[minVertex][j])
{
int dist_1 = dist[minVertex] + adj[minVertex][j];
string temp = path[minVertex] + " -> " + to_string(minVertex + 1);
if(dist_1 < dist[j])
{
dist[j] = dist_1;
path[j] = temp;
}
}
}
}
// Printing result
cout << "\nShortest path: " << path[dest] << " -> " << dest + 1;
cout << "\nMinimum no. of hops: " << dist[dest];
}
// to print adjacency matrix
void printAdjMatrix(int **adj, int n)
{
cout << "\n ";
for (int i = 0; i < n; i++)
{
cout << i+1 << " ";
}
cout << "\n ------------------";
for(int i = 0; i < n; ++i)
{
cout << "\n" << i+1 << " | ";
for (int j = 0; j < n; ++j)
{
cout << adj[i][j] << " ";
}
}
cout << endl;
}
int main(){
// Input as a Graph
int **adj, n;
cout << "\nEnter the total no of routers in the network: ";
cin >> n;
adj = new int* [n];
for (int i = 0; i < n; i++)
{
adj[i] = new int[n];
for (int j = 0; j < n; ++j)
{
adj[i][j] = 0;
}
}
for (int i = 0; i < n; ++i)
{
int v;
cout << "\nEnter the no of routers adjacent to Router " << i+1 << ": ";
cin >> v;
cout << "Enter the routers adjacent to Router " << i+1 << ": ";
for (int j = 0; j < v; ++j)
{
int e;
cin >> e;
adj[i][e-1] = 1;
adj[e-1][i] = 1;
}
}
// Printing adjacenecy matrix for the graph
printAdjMatrix(adj, n);
// Input source and destination
int source, dest;
cout << "\nEnter source router: ";
cin >> source;
cout << "Enter destination router: ";
cin >> dest;
// Applying Dijkstra Algorithm
dijkstra(adj, n, source-1, dest-1);
cout << "\n\n";
return 0;
} | [
"itsanshulverma@gmail.com"
] | itsanshulverma@gmail.com |
f8cb8e8c5b70c38609eff68a5aaa4c1d80d77bf1 | c1a0af283291fde85f2399dda5eb62b0dc62baa3 | /modules/canbus/vehicle/tayron/protocol/brake_pressure_6AB.h | d6e57461230a17174e24b6fc5d0b313e548686aa | [
"Apache-2.0"
] | permissive | mengxingshifen1218/simulation | 30420e761235f92dc4a3236ba17a526283e607b8 | 1d6a87b7595db1d32c656ae783aa365de551c5bc | refs/heads/master | 2023-08-18T03:50:55.803871 | 2020-05-08T08:45:47 | 2020-05-08T08:45:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,639 | h | /******************************************************************************
* Copyright 2018 The Apollo Authors. 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.
*****************************************************************************/
#pragma once
#include "modules/drivers/canbus/can_comm/protocol_data.h"
#include "modules/canbus/proto/chassis_detail.pb.h"
namespace apollo {
namespace canbus {
namespace tayron {
class Brakepressure6AB : public ::apollo::drivers::canbus::ProtocolData<
::apollo::canbus::ChassisDetail> {
public:
static const int32_t ID;
Brakepressure6AB();
void Parse(const std::uint8_t* bytes, int32_t length,
ChassisDetail* chassis) const override;
private:
// config detail: {'name': 'PU_Pressure', 'offset': 0.0, 'precision': 0.1, 'len': 12, 'is_signed_var': True, 'physical_range': '[0|409.5]', 'bit': 40, 'type': 'double', 'order': 'intel', 'physical_unit': 'bar'}
double pu_pressure(const std::uint8_t* bytes, const int32_t length) const;
};
} // namespace tayron
} // namespace canbus
} // namespace apollo
| [
"qwetqwe@qq.com"
] | qwetqwe@qq.com |
34a71c450c03985ae6335db27599a06882bfdf60 | 95ae7dfa9ee578f1b24a65986ff78bf77ceca0c5 | /Engine/modules/Verve/GUI/VEditorButton.h | 15b3e0dfa3b2c8d0b1bcecaab35b3e284d979694 | [
"MIT",
"LicenseRef-scancode-unknown"
] | permissive | TorqueGameEngines/Torque3D | 4e1f6a05cc0928980c8c7c20bcdd680eaa6dcee8 | a445a4364664e299196bd551d213844486080145 | refs/heads/development | 2023-09-03T12:40:40.658487 | 2023-08-24T14:44:43 | 2023-08-24T14:44:43 | 267,440,108 | 1,192 | 178 | MIT | 2023-09-13T14:28:16 | 2020-05-27T22:35:54 | C++ | UTF-8 | C++ | false | false | 2,312 | h | //-----------------------------------------------------------------------------
// Verve
// Copyright (C) 2014 - Violent Tulip
//
// 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 _VT_VEDITORBUTTON_H_
#define _VT_VEDITORBUTTON_H_
#ifndef _GUIBITMAPBUTTON_H_
#include "gui/buttons/guiBitmapButtonCtrl.h"
#endif
class VEditorButton : public GuiBitmapButtonTextCtrl
{
typedef GuiBitmapButtonTextCtrl Parent;
public:
bool mIsDraggable;
public:
VEditorButton();
static void initPersistFields( void );
void onMouseDown( const GuiEvent &pEvent );
void onMouseUp( const GuiEvent &pEvent );
void onMouseDragged( const GuiEvent &pEvent );
void onRightMouseDown( const GuiEvent &pEvent );
void onRightMouseUp( const GuiEvent &pEvent );
void onMouseEnter( const GuiEvent &pEvent );
void onMouseLeave( const GuiEvent &pEvent );
void onMouseEvent( const char *pEventName, const GuiEvent &pEvent );
void onRender( Point2I offset, const RectI &updateRect );
public:
DECLARE_CONOBJECT( VEditorButton );
};
#endif //_VT_VEDITORBUTTON_H_ | [
"Areloch@gmail.com"
] | Areloch@gmail.com |
41feab5430223de5b60e4a9542a8eb7dd664bf0c | 200d8dd8740e20727e7a466f3afe5097b0f9a0c0 | /quantitative_finance/L2/demos/Quadrature/src/host/quad_hcf_test.cpp | d378f6483b98b525cd0c0ad3bf585c5576af34b6 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | FinancialEngineerLab/hull-white-g2-tree-fdm-cpp | acd28e103a3a7b40afbddeaedc335191de5252ee | 64fd6145d2d8b7ab62d4d7669a4593e0537e7ff4 | refs/heads/main | 2023-03-16T16:43:20.642831 | 2020-10-22T21:16:30 | 2020-10-22T21:16:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,966 | cpp | #include <vector>
#include <chrono>
#include <math.h> /* fabs */
#include "xcl2.hpp"
#include "test_data.hpp"
#include "quad_hcf_engine_def.hpp"
#define TEST_TOLERANCE 0.001
extern TEST_DT model_hcfEngine(struct hcfEngineInputDataType* input_data);
static int check(TEST_DT act, TEST_DT exp) {
if (fabs(act - exp) > TEST_TOLERANCE) {
return 0;
}
return 1;
}
int main(int argc, char* argv[]) {
std::string xclbin_file(argv[1]);
TEST_DT integration_tolerance = 0.0001;
if (argc == 3) {
integration_tolerance = atof(argv[2]);
}
int num = sizeof(test_data) / sizeof(test_data_type);
if (num > MAX_NUMBER_TESTS) {
std::cout << "ERROR: too many tests. " << num << " specified, ";
std::cout << MAX_NUMBER_TESTS << " allowed." << std::endl;
return 1;
}
// IO data
std::vector<struct hcfEngineInputDataType, aligned_allocator<struct hcfEngineInputDataType> > input_data(num);
std::vector<TEST_DT, aligned_allocator<TEST_DT> > output_data(num);
size_t bytes_in = sizeof(struct hcfEngineInputDataType) * num;
size_t bytes_out = sizeof(TEST_DT) * num;
// fill the input data
std::cout << "Processing input data" << std::endl;
for (int i = 0; i < num; i++) {
input_data[i].s = test_data[i].s;
input_data[i].k = test_data[i].k;
input_data[i].t = test_data[i].t;
input_data[i].v = test_data[i].v;
input_data[i].r = test_data[i].r;
input_data[i].rho = test_data[i].rho;
input_data[i].vvol = test_data[i].vvol;
input_data[i].vbar = test_data[i].vbar;
input_data[i].kappa = test_data[i].kappa;
input_data[i].tol = integration_tolerance;
}
// get device
std::vector<cl::Device> devices = xcl::get_xil_devices();
cl::Device device = devices[0];
// get context
std::cout << "Creating context" << std::endl;
cl_int err;
cl::Context ctx(device, NULL, NULL, NULL, &err);
if (err != CL_SUCCESS) {
std::cout << "ERROR: failed to create context" << std::endl;
return 1;
}
// create command queue
std::cout << "Creating command queue" << std::endl;
cl::CommandQueue cq(ctx, device, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE, &err);
if (err != CL_SUCCESS) {
std::cout << "ERROR: failed to create command queue" << std::endl;
return 1;
}
// import and program the xclbin
std::cout << "Programming device" << std::endl;
auto start = std::chrono::high_resolution_clock::now();
std::string device_name = device.getInfo<CL_DEVICE_NAME>();
cl::Program::Binaries bins = xcl::import_binary_file(xclbin_file);
devices.resize(1);
cl::Program program(ctx, devices, bins, NULL, &err);
auto elapsed = std::chrono::high_resolution_clock::now() - start;
long long t_program = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
if (err != CL_SUCCESS) {
std::cout << "ERROR: failed to create program" << std::endl;
return 1;
}
cl::Kernel krnl(program, "quad_hcf_kernel", &err);
if (err != CL_SUCCESS) {
std::cout << "ERROR: failed to create kernel" << std::endl;
return 1;
}
// memory objects
std::cout << "Allocating memory objects" << std::endl;
cl_int overall_err = 0;
cl::Buffer dev_in(ctx, CL_MEM_USE_HOST_PTR | CL_MEM_READ_ONLY, bytes_in, input_data.data(), &err);
overall_err |= err;
cl::Buffer dev_out(ctx, CL_MEM_USE_HOST_PTR | CL_MEM_WRITE_ONLY, bytes_out, output_data.data(), &err);
overall_err |= err;
if (overall_err != CL_SUCCESS) {
std::cout << "ERROR: failed to create buffer" << std::endl;
return 1;
}
// set the arguments
std::cout << "Set device arguments" << std::endl;
err = krnl.setArg(0, dev_in);
err |= krnl.setArg(1, dev_out);
err |= krnl.setArg(2, num);
if (err != CL_SUCCESS) {
std::cout << "ERROR: failed to set args" << std::endl;
return 1;
}
// copy input data to device
std::cout << "Migrate memory to device" << std::endl;
start = std::chrono::high_resolution_clock::now();
err = cq.enqueueMigrateMemObjects({dev_in}, 0);
cq.finish();
elapsed = std::chrono::high_resolution_clock::now() - start;
long long t_mem_to_device = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
if (err != CL_SUCCESS) {
std::cout << "ERROR: failed to migrate memory to device" << std::endl;
return 1;
}
// launch kernel
std::cout << "Launching kernel" << std::endl;
start = std::chrono::high_resolution_clock::now();
cl::Event kernel_event;
err = cq.enqueueTask(krnl, NULL, &kernel_event);
cq.finish();
elapsed = std::chrono::high_resolution_clock::now() - start;
long long t_run = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
if (err != CL_SUCCESS) {
std::cout << "ERROR: failed to launch kernel" << std::endl;
return 1;
}
// copy results back to local memory
start = std::chrono::high_resolution_clock::now();
err = cq.enqueueMigrateMemObjects({dev_out}, CL_MIGRATE_MEM_OBJECT_HOST);
cq.finish();
elapsed = std::chrono::high_resolution_clock::now() - start;
long long t_mem_from_device = std::chrono::duration_cast<std::chrono::microseconds>(elapsed).count();
if (err != CL_SUCCESS) {
std::cout << "ERROR: failed to copy results to local memory" << std::endl;
return 1;
}
// check results
int fails = 0;
double error_max = 0;
for (int i = 0; i < num; i++) {
if (!check(output_data[i], test_data[i].exp)) {
std::cout << " FPGA[" << i << "]: Expected " << test_data[i].exp;
std::cout << ", got " << output_data[i];
std::cout << ", diff " << fabs(output_data[i] - test_data[i].exp) << std::endl;
fails++;
}
if (fabs(output_data[i] - test_data[i].exp) > error_max) {
error_max = fabs(output_data[i] - test_data[i].exp);
}
}
std::cout << "Results:" << std::endl;
std::cout << "Integration tolerance: " << integration_tolerance << std::endl;
std::cout << "Result tolerance: " << TEST_TOLERANCE << std::endl;
std::cout << "Number of tests: " << num << std::endl;
std::cout << "Out of tolerance: " << fails << std::endl;
std::cout << "Max error: " << error_max << std::endl;
std::cout << "Timings:" << std::endl;
std::cout << " program device = " << t_program << " us" << std::endl;
std::cout << " mem to device = " << t_mem_to_device << " us" << std::endl;
std::cout << " run kernel = " << t_run << " us" << std::endl;
std::cout << " mem from device = " << t_mem_from_device << " us" << std::endl;
std::cout << "TEST PASS" << std::endl;
return 0;
}
| [
"fengx@xilinx.com"
] | fengx@xilinx.com |
0345eca332fbca1985779ccabd0e7c1e427f2dec | 302f4bda84739593ab952f01c9e38d512b0a7d73 | /ext/Vc-1.3.2/common/simdarray.h | 61c3c5aeda93ec57b9d5cbdbae9573bbdd249709 | [
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"Apache-2.0",
"ICU",
"BSL-1.0",
"X11",
"Beerware"
] | permissive | thomaskrause/graphANNIS | 649ae23dd74b57bcd8a699c1e309e74096be9db2 | 66d12bcfb0e0b9bfcdc2df8ffaa5ae8c84cc569c | refs/heads/develop | 2020-04-11T01:28:47.589724 | 2018-03-15T18:16:50 | 2018-03-15T18:16:50 | 40,169,698 | 9 | 3 | Apache-2.0 | 2018-07-28T20:18:41 | 2015-08-04T07:24:49 | C++ | UTF-8 | C++ | false | false | 121,457 | h | /* This file is part of the Vc library. {{{
Copyright © 2013-2015 Matthias Kretz <kretz@kde.org>
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 names of contributing organizations 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 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 VC_COMMON_SIMDARRAY_H_
#define VC_COMMON_SIMDARRAY_H_
//#define Vc_DEBUG_SIMD_CAST 1
//#define Vc_DEBUG_SORTED 1
#if defined Vc_DEBUG_SIMD_CAST || defined Vc_DEBUG_SORTED
#include <Vc/IO>
#endif
#include <array>
#include "writemaskedvector.h"
#include "simdarrayhelper.h"
#include "simdmaskarray.h"
#include "utility.h"
#include "interleave.h"
#include "indexsequence.h"
#include "transpose.h"
#include "macros.h"
namespace Vc_VERSIONED_NAMESPACE
{
// internal namespace (product & sum helper) {{{1
namespace internal
{
template <typename T> T Vc_INTRINSIC Vc_PURE product_helper_(const T &l, const T &r) { return l * r; }
template <typename T> T Vc_INTRINSIC Vc_PURE sum_helper_(const T &l, const T &r) { return l + r; }
} // namespace internal
// min & max declarations {{{1
template <typename T, std::size_t N, typename V, std::size_t M>
inline SimdArray<T, N, V, M> min(const SimdArray<T, N, V, M> &x,
const SimdArray<T, N, V, M> &y);
template <typename T, std::size_t N, typename V, std::size_t M>
inline SimdArray<T, N, V, M> max(const SimdArray<T, N, V, M> &x,
const SimdArray<T, N, V, M> &y);
// SimdArray class {{{1
/// \addtogroup SimdArray
/// @{
// atomic SimdArray {{{1
#define Vc_CURRENT_CLASS_NAME SimdArray
/**\internal
* Specialization of `SimdArray<T, N, VectorType, VectorSize>` for the case where `N ==
* VectorSize`.
*
* This is specialized for implementation purposes: Since the general implementation uses
* two SimdArray data members it recurses over different SimdArray instantiations. The
* recursion is ended by this specialization, which has a single \p VectorType_ data
* member to which all functions are forwarded more or less directly.
*/
template <typename T, std::size_t N, typename VectorType_>
class SimdArray<T, N, VectorType_, N>
{
static_assert(std::is_same<T, double>::value || std::is_same<T, float>::value ||
std::is_same<T, int32_t>::value ||
std::is_same<T, uint32_t>::value ||
std::is_same<T, int16_t>::value ||
std::is_same<T, uint16_t>::value,
"SimdArray<T, N> may only be used with T = { double, float, int32_t, uint32_t, "
"int16_t, uint16_t }");
public:
using VectorType = VectorType_;
using vector_type = VectorType;
using storage_type = vector_type;
using vectorentry_type = typename vector_type::VectorEntryType;
using value_type = T;
using mask_type = SimdMaskArray<T, N, vector_type>;
using index_type = SimdArray<int, N>;
static constexpr std::size_t size() { return N; }
using Mask = mask_type;
using MaskType = Mask;
using MaskArgument = const MaskType &;
using VectorEntryType = vectorentry_type;
using EntryType = value_type;
using IndexType = index_type;
using AsArg = const SimdArray &;
using reference = Detail::ElementReference<SimdArray>;
static constexpr std::size_t Size = size();
static constexpr std::size_t MemoryAlignment = storage_type::MemoryAlignment;
// zero init
#ifndef Vc_MSVC // bogus error C2580
Vc_INTRINSIC SimdArray() = default;
#endif
// default copy ctor/operator
Vc_INTRINSIC SimdArray(const SimdArray &) = default;
Vc_INTRINSIC SimdArray(SimdArray &&) = default;
Vc_INTRINSIC SimdArray &operator=(const SimdArray &) = default;
// broadcast
Vc_INTRINSIC SimdArray(const value_type &a) : data(a) {}
Vc_INTRINSIC SimdArray(value_type &a) : data(a) {}
Vc_INTRINSIC SimdArray(value_type &&a) : data(a) {}
template <
typename U,
typename = enable_if<std::is_same<U, int>::value && !std::is_same<int, value_type>::value>>
Vc_INTRINSIC SimdArray(U a)
: SimdArray(static_cast<value_type>(a))
{
}
// implicit casts
template <typename U, typename V>
Vc_INTRINSIC SimdArray(const SimdArray<U, N, V> &x, enable_if<N == V::Size> = nullarg)
: data(simd_cast<vector_type>(internal_data(x)))
{
}
template <typename U, typename V>
Vc_INTRINSIC SimdArray(const SimdArray<U, N, V> &x,
enable_if<(N > V::Size && N <= 2 * V::Size)> = nullarg)
: data(simd_cast<vector_type>(internal_data(internal_data0(x)), internal_data(internal_data1(x))))
{
}
template <typename U, typename V>
Vc_INTRINSIC SimdArray(const SimdArray<U, N, V> &x,
enable_if<(N > 2 * V::Size && N <= 4 * V::Size)> = nullarg)
: data(simd_cast<vector_type>(internal_data(internal_data0(internal_data0(x))),
internal_data(internal_data1(internal_data0(x))),
internal_data(internal_data0(internal_data1(x))),
internal_data(internal_data1(internal_data1(x)))))
{
}
template <typename V, std::size_t Pieces, std::size_t Index>
Vc_INTRINSIC SimdArray(Common::Segment<V, Pieces, Index> &&x)
: data(simd_cast<vector_type, Index>(x.data))
{
}
Vc_INTRINSIC SimdArray(const std::initializer_list<value_type> &init)
: data(init.begin(), Vc::Unaligned)
{
#if defined Vc_CXX14 && 0 // doesn't compile yet
static_assert(init.size() == size(), "The initializer_list argument to "
"SimdArray<T, N> must contain exactly N "
"values.");
#else
Vc_ASSERT(init.size() == size());
#endif
}
// implicit conversion from underlying vector_type
template <
typename V,
typename = enable_if<Traits::is_simd_vector<V>::value && !Traits::isSimdArray<V>::value>>
explicit Vc_INTRINSIC SimdArray(const V &x)
: data(simd_cast<vector_type>(x))
{
}
// implicit conversion to Vector<U, AnyAbi> for if Vector<U, AnyAbi>::size() == N and
// T implicitly convertible to U
template <
typename U, typename A,
typename = enable_if<std::is_convertible<T, U>::value && Vector<U, A>::Size == N>>
Vc_INTRINSIC operator Vector<U, A>() const
{
return simd_cast<Vector<U, A>>(data);
}
#include "gatherinterface.h"
#include "scatterinterface.h"
// forward all remaining ctors
template <typename... Args,
typename = enable_if<!Traits::is_cast_arguments<Args...>::value &&
!Traits::is_gather_signature<Args...>::value &&
!Traits::is_initializer_list<Args...>::value>>
explicit Vc_INTRINSIC SimdArray(Args &&... args)
: data(std::forward<Args>(args)...)
{
}
template <std::size_t Offset>
explicit Vc_INTRINSIC SimdArray(
Common::AddOffset<VectorSpecialInitializerIndexesFromZero, Offset>)
: data(Vc::IndexesFromZero)
{
data += value_type(Offset);
}
Vc_INTRINSIC void setZero() { data.setZero(); }
Vc_INTRINSIC void setZero(mask_type k) { data.setZero(internal_data(k)); }
Vc_INTRINSIC void setZeroInverted() { data.setZeroInverted(); }
Vc_INTRINSIC void setZeroInverted(mask_type k) { data.setZeroInverted(internal_data(k)); }
Vc_INTRINSIC void setQnan() { data.setQnan(); }
Vc_INTRINSIC void setQnan(mask_type m) { data.setQnan(internal_data(m)); }
// internal: execute specified Operation
template <typename Op, typename... Args>
static Vc_INTRINSIC SimdArray fromOperation(Op op, Args &&... args)
{
SimdArray r;
Common::unpackArgumentsAuto(op, r.data, std::forward<Args>(args)...);
return r;
}
template <typename Op, typename... Args>
static Vc_INTRINSIC void callOperation(Op op, Args &&... args)
{
Common::unpackArgumentsAuto(op, nullptr, std::forward<Args>(args)...);
}
static Vc_INTRINSIC SimdArray Zero()
{
return SimdArray(Vc::Zero);
}
static Vc_INTRINSIC SimdArray One()
{
return SimdArray(Vc::One);
}
static Vc_INTRINSIC SimdArray IndexesFromZero()
{
return SimdArray(Vc::IndexesFromZero);
}
static Vc_INTRINSIC SimdArray Random()
{
return fromOperation(Common::Operations::random());
}
template <typename... Args> Vc_INTRINSIC void load(Args &&... args)
{
data.load(std::forward<Args>(args)...);
}
template <typename... Args> Vc_INTRINSIC void store(Args &&... args) const
{
data.store(std::forward<Args>(args)...);
}
Vc_INTRINSIC mask_type operator!() const
{
return {!data};
}
Vc_INTRINSIC SimdArray operator-() const
{
return {-data};
}
/// Returns a copy of itself
Vc_INTRINSIC SimdArray operator+() const { return *this; }
Vc_INTRINSIC SimdArray operator~() const
{
return {~data};
}
template <typename U,
typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>
Vc_INTRINSIC Vc_CONST SimdArray operator<<(U x) const
{
return {data << x};
}
template <typename U,
typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>
Vc_INTRINSIC SimdArray &operator<<=(U x)
{
data <<= x;
return *this;
}
template <typename U,
typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>
Vc_INTRINSIC Vc_CONST SimdArray operator>>(U x) const
{
return {data >> x};
}
template <typename U,
typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>
Vc_INTRINSIC SimdArray &operator>>=(U x)
{
data >>= x;
return *this;
}
#define Vc_BINARY_OPERATOR_(op) \
Vc_INTRINSIC Vc_CONST SimdArray operator op(const SimdArray &rhs) const \
{ \
return {data op rhs.data}; \
} \
Vc_INTRINSIC SimdArray &operator op##=(const SimdArray &rhs) \
{ \
data op## = rhs.data; \
return *this; \
}
Vc_ALL_ARITHMETICS(Vc_BINARY_OPERATOR_);
Vc_ALL_BINARY(Vc_BINARY_OPERATOR_);
Vc_ALL_SHIFTS(Vc_BINARY_OPERATOR_);
#undef Vc_BINARY_OPERATOR_
#define Vc_COMPARES(op) \
Vc_INTRINSIC mask_type operator op(const SimdArray &rhs) const \
{ \
return {data op rhs.data}; \
}
Vc_ALL_COMPARES(Vc_COMPARES);
#undef Vc_COMPARES
/// \copydoc Vector::isNegative
Vc_DEPRECATED("use isnegative(x) instead") Vc_INTRINSIC MaskType isNegative() const
{
return {isnegative(data)};
}
private:
friend reference;
Vc_INTRINSIC static value_type get(const SimdArray &o, int i) noexcept
{
return o.data[i];
}
template <typename U>
Vc_INTRINSIC static void set(SimdArray &o, int i, U &&v) noexcept(
noexcept(std::declval<value_type &>() = v))
{
o.data[i] = v;
}
public:
Vc_INTRINSIC reference operator[](size_t i) noexcept
{
static_assert(noexcept(reference{std::declval<SimdArray &>(), int()}), "");
return {*this, int(i)};
}
Vc_INTRINSIC value_type operator[](size_t i) const noexcept
{
return get(*this, int(i));
}
Vc_INTRINSIC Common::WriteMaskedVector<SimdArray, mask_type> operator()(const mask_type &k)
{
return {*this, k};
}
Vc_INTRINSIC void assign(const SimdArray &v, const mask_type &k)
{
data.assign(v.data, internal_data(k));
}
// reductions ////////////////////////////////////////////////////////
#define Vc_REDUCTION_FUNCTION_(name_) \
Vc_INTRINSIC Vc_PURE value_type name_() const { return data.name_(); } \
Vc_INTRINSIC Vc_PURE value_type name_(mask_type mask) const \
{ \
return data.name_(internal_data(mask)); \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
Vc_REDUCTION_FUNCTION_(min);
Vc_REDUCTION_FUNCTION_(max);
Vc_REDUCTION_FUNCTION_(product);
Vc_REDUCTION_FUNCTION_(sum);
#undef Vc_REDUCTION_FUNCTION_
Vc_INTRINSIC Vc_PURE SimdArray partialSum() const { return data.partialSum(); }
template <typename F> Vc_INTRINSIC SimdArray apply(F &&f) const
{
return {data.apply(std::forward<F>(f))};
}
template <typename F> Vc_INTRINSIC SimdArray apply(F &&f, const mask_type &k) const
{
return {data.apply(std::forward<F>(f), k)};
}
Vc_INTRINSIC SimdArray shifted(int amount) const
{
return {data.shifted(amount)};
}
template <std::size_t NN>
Vc_INTRINSIC SimdArray shifted(int amount, const SimdArray<value_type, NN> &shiftIn)
const
{
return {data.shifted(amount, simd_cast<VectorType>(shiftIn))};
}
Vc_INTRINSIC SimdArray rotated(int amount) const
{
return {data.rotated(amount)};
}
/// \copydoc Vector::exponent
Vc_DEPRECATED("use exponent(x) instead") Vc_INTRINSIC SimdArray exponent() const
{
return {exponent(data)};
}
Vc_INTRINSIC SimdArray interleaveLow(SimdArray x) const
{
return {data.interleaveLow(x.data)};
}
Vc_INTRINSIC SimdArray interleaveHigh(SimdArray x) const
{
return {data.interleaveHigh(x.data)};
}
Vc_INTRINSIC SimdArray reversed() const
{
return {data.reversed()};
}
Vc_INTRINSIC SimdArray sorted() const
{
return {data.sorted()};
}
template <typename G> static Vc_INTRINSIC SimdArray generate(const G &gen)
{
return {VectorType::generate(gen)};
}
Vc_DEPRECATED("use copysign(x, y) instead") Vc_INTRINSIC SimdArray
copySign(const SimdArray &reference) const
{
return {Vc::copysign(data, reference.data)};
}
friend VectorType &internal_data<>(SimdArray &x);
friend const VectorType &internal_data<>(const SimdArray &x);
/// \internal
Vc_INTRINSIC SimdArray(VectorType &&x) : data(std::move(x)) {}
Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(storage_type));
private:
// The alignas attribute attached to the class declaration above is ignored by ICC
// 17.0.0 (at least). So just move the alignas attribute down here where it works for
// all compilers.
alignas(static_cast<std::size_t>(
Common::BoundedAlignment<Common::NextPowerOfTwo<N>::value * sizeof(VectorType_) /
VectorType_::size()>::value)) storage_type data;
};
template <typename T, std::size_t N, typename VectorType> constexpr std::size_t SimdArray<T, N, VectorType, N>::Size;
template <typename T, std::size_t N, typename VectorType>
constexpr std::size_t SimdArray<T, N, VectorType, N>::MemoryAlignment;
template <typename T, std::size_t N, typename VectorType>
#ifndef Vc_MSVC
Vc_INTRINSIC
#endif
VectorType &internal_data(SimdArray<T, N, VectorType, N> &x)
{
return x.data;
}
template <typename T, std::size_t N, typename VectorType>
#ifndef Vc_MSVC
Vc_INTRINSIC
#endif
const VectorType &internal_data(const SimdArray<T, N, VectorType, N> &x)
{
return x.data;
}
// unpackIfSegment {{{2
template <typename T> T unpackIfSegment(T &&x) { return std::forward<T>(x); }
template <typename T, size_t Pieces, size_t Index>
auto unpackIfSegment(Common::Segment<T, Pieces, Index> &&x) -> decltype(x.asSimdArray())
{
return x.asSimdArray();
}
// gatherImplementation {{{2
template <typename T, std::size_t N, typename VectorType>
template <typename MT, typename IT>
inline void SimdArray<T, N, VectorType, N>::gatherImplementation(const MT *mem,
IT &&indexes)
{
data.gather(mem, unpackIfSegment(std::forward<IT>(indexes)));
}
template <typename T, std::size_t N, typename VectorType>
template <typename MT, typename IT>
inline void SimdArray<T, N, VectorType, N>::gatherImplementation(const MT *mem,
IT &&indexes,
MaskArgument mask)
{
data.gather(mem, unpackIfSegment(std::forward<IT>(indexes)), mask);
}
// scatterImplementation {{{2
template <typename T, std::size_t N, typename VectorType>
template <typename MT, typename IT>
inline void SimdArray<T, N, VectorType, N>::scatterImplementation(MT *mem,
IT &&indexes) const
{
data.scatter(mem, unpackIfSegment(std::forward<IT>(indexes)));
}
template <typename T, std::size_t N, typename VectorType>
template <typename MT, typename IT>
inline void SimdArray<T, N, VectorType, N>::scatterImplementation(MT *mem,
IT &&indexes,
MaskArgument mask) const
{
data.scatter(mem, unpackIfSegment(std::forward<IT>(indexes)), mask);
}
// generic SimdArray {{{1
/**
* Data-parallel arithmetic type with user-defined number of elements.
*
* \tparam T The type of the vector's elements. The supported types currently are limited
* to the types supported by Vc::Vector<T>.
*
* \tparam N The number of elements to store and process concurrently. You can choose an
* arbitrary number, though not every number is a good idea.
* Generally, a power of two value or the sum of two power of two values might
* work efficiently, though this depends a lot on the target system.
*
* \tparam V Don't change the default value unless you really know what you are doing.
* This type is set to the underlying native Vc::Vector type used in the
* implementation of the type.
* Having it as part of the type name guards against some cases of ODR
* violations (i.e. linking incompatible translation units / libraries).
*
* \tparam Wt Don't ever change the default value.
* This parameter is an unfortunate implementation detail shining through.
*
* \warning Choosing \p N too large (what “too large” means depends on the target) will
* result in excessive compilation times and high (or too high) register
* pressure, thus potentially negating the improvement from concurrent execution.
* As a rule of thumb, keep \p N less or equal to `2 * float_v::size()`.
*
* \warning A special portability concern arises from a current limitation in the MIC
* implementation (Intel Knights Corner), where SimdArray types with \p T = \p
* (u)short require an \p N either less than short_v::size() or a multiple of
* short_v::size().
*
* \headerfile simdarray.h <Vc/SimdArray>
*/
template <typename T, size_t N, typename V, size_t Wt> class SimdArray
{
static_assert(std::is_same<T, double>::value ||
std::is_same<T, float>::value ||
std::is_same<T, int32_t>::value ||
std::is_same<T, uint32_t>::value ||
std::is_same<T, int16_t>::value ||
std::is_same<T, uint16_t>::value, "SimdArray<T, N> may only be used with T = { double, float, int32_t, uint32_t, int16_t, uint16_t }");
static_assert(
// either the EntryType and VectorEntryType of the main V are equal
std::is_same<typename V::EntryType, typename V::VectorEntryType>::value ||
// or N is a multiple of V::size()
(N % V::size() == 0),
"SimdArray<(un)signed short, N> on MIC only works correctly for N = k * "
"MIC::(u)short_v::size(), i.e. k * 16.");
using my_traits = SimdArrayTraits<T, N>;
static constexpr std::size_t N0 = my_traits::N0;
static constexpr std::size_t N1 = my_traits::N1;
using Split = Common::Split<N0>;
template <typename U, std::size_t K> using CArray = U[K];
public:
using storage_type0 = typename my_traits::storage_type0;
using storage_type1 = typename my_traits::storage_type1;
static_assert(storage_type0::size() == N0, "");
/**\internal
* This type reveals the implementation-specific type used for the data member.
*/
using vector_type = V;
using vectorentry_type = typename storage_type0::vectorentry_type;
typedef vectorentry_type alias_type Vc_MAY_ALIAS;
/// The type of the elements (i.e.\ \p T)
using value_type = T;
/// The type of the mask used for masked operations and returned from comparisons.
using mask_type = SimdMaskArray<T, N, vector_type>;
/// The type of the vector used for indexes in gather and scatter operations.
using index_type = SimdArray<int, N>;
/**
* Returns \p N, the number of scalar components in an object of this type.
*
* The size of the SimdArray, i.e. the number of scalar elements in the vector. In
* contrast to Vector::size() you have control over this value via the \p N template
* parameter of the SimdArray class template.
*
* \returns The number of scalar values stored and manipulated concurrently by objects
* of this type.
*/
static constexpr std::size_t size() { return N; }
/// \copydoc mask_type
using Mask = mask_type;
/// \copydoc mask_type
using MaskType = Mask;
using MaskArgument = const MaskType &;
using VectorEntryType = vectorentry_type;
/// \copydoc value_type
using EntryType = value_type;
/// \copydoc index_type
using IndexType = index_type;
using AsArg = const SimdArray &;
using reference = Detail::ElementReference<SimdArray>;
///\copydoc Vector::MemoryAlignment
static constexpr std::size_t MemoryAlignment =
storage_type0::MemoryAlignment > storage_type1::MemoryAlignment
? storage_type0::MemoryAlignment
: storage_type1::MemoryAlignment;
/// \name Generators
///@{
///\copybrief Vector::Zero
static Vc_INTRINSIC SimdArray Zero()
{
return SimdArray(Vc::Zero);
}
///\copybrief Vector::One
static Vc_INTRINSIC SimdArray One()
{
return SimdArray(Vc::One);
}
///\copybrief Vector::IndexesFromZero
static Vc_INTRINSIC SimdArray IndexesFromZero()
{
return SimdArray(Vc::IndexesFromZero);
}
///\copydoc Vector::Random
static Vc_INTRINSIC SimdArray Random()
{
return fromOperation(Common::Operations::random());
}
///\copybrief Vector::generate
template <typename G> static Vc_INTRINSIC SimdArray generate(const G &gen) // {{{2
{
auto tmp = storage_type0::generate(gen); // GCC bug: the order of evaluation in
// an initializer list is well-defined
// (front to back), but GCC 4.8 doesn't
// implement this correctly. Therefore
// we enforce correct order.
return {std::move(tmp),
storage_type1::generate([&](std::size_t i) { return gen(i + N0); })};
}
///@}
/// \name Compile-Time Constant Initialization
///@{
///\copydoc Vector::Vector()
#ifndef Vc_MSVC // bogus error C2580
SimdArray() = default;
#endif
///@}
/// \name Conversion/Broadcast Constructors
///@{
///\copydoc Vector::Vector(EntryType)
Vc_INTRINSIC SimdArray(value_type a) : data0(a), data1(a) {}
template <
typename U,
typename = enable_if<std::is_same<U, int>::value && !std::is_same<int, value_type>::value>>
SimdArray(U a)
: SimdArray(static_cast<value_type>(a))
{
}
///@}
// default copy ctor/operator
SimdArray(const SimdArray &) = default;
SimdArray(SimdArray &&) = default;
SimdArray &operator=(const SimdArray &) = default;
// load ctor
template <typename U,
typename Flags = DefaultLoadTag,
typename = enable_if<Traits::is_load_store_flag<Flags>::value>>
explicit Vc_INTRINSIC SimdArray(const U *mem, Flags f = Flags())
: data0(mem, f), data1(mem + storage_type0::size(), f)
{
}
// MSVC does overload resolution differently and takes the const U *mem overload (I hope)
#ifndef Vc_MSVC
/**\internal
* Load from a C-array. This is basically the same function as the load constructor
* above, except that the forwarding reference overload would steal the deal and the
* constructor above doesn't get called. This overload is required to enable loads
* from C-arrays.
*/
template <typename U, std::size_t Extent, typename Flags = DefaultLoadTag,
typename = enable_if<Traits::is_load_store_flag<Flags>::value>>
explicit Vc_INTRINSIC SimdArray(CArray<U, Extent> &mem, Flags f = Flags())
: data0(&mem[0], f), data1(&mem[storage_type0::size()], f)
{
}
/**\internal
* Const overload of the above.
*/
template <typename U, std::size_t Extent, typename Flags = DefaultLoadTag,
typename = enable_if<Traits::is_load_store_flag<Flags>::value>>
explicit Vc_INTRINSIC SimdArray(const CArray<U, Extent> &mem, Flags f = Flags())
: data0(&mem[0], f), data1(&mem[storage_type0::size()], f)
{
}
#endif
// initializer list
Vc_INTRINSIC SimdArray(const std::initializer_list<value_type> &init)
: data0(init.begin(), Vc::Unaligned)
, data1(init.begin() + storage_type0::size(), Vc::Unaligned)
{
#if defined Vc_CXX14 && 0 // doesn't compile yet
static_assert(init.size() == size(), "The initializer_list argument to "
"SimdArray<T, N> must contain exactly N "
"values.");
#else
Vc_ASSERT(init.size() == size());
#endif
}
#include "gatherinterface.h"
#include "scatterinterface.h"
// forward all remaining ctors
template <typename... Args,
typename = enable_if<!Traits::is_cast_arguments<Args...>::value &&
!Traits::is_initializer_list<Args...>::value &&
!Traits::is_gather_signature<Args...>::value &&
!Traits::is_load_arguments<Args...>::value>>
explicit Vc_INTRINSIC SimdArray(Args &&... args)
: data0(Split::lo(args)...) // no forward here - it could move and thus
// break the next line
, data1(Split::hi(std::forward<Args>(args))...)
{
}
// explicit casts
template <typename W>
Vc_INTRINSIC explicit SimdArray(
W &&x,
enable_if<(Traits::is_simd_vector<W>::value && Traits::simd_vector_size<W>::value == N &&
!(std::is_convertible<Traits::entry_type_of<W>, T>::value &&
Traits::isSimdArray<W>::value))> = nullarg)
: data0(Split::lo(x)), data1(Split::hi(x))
{
}
// implicit casts
template <typename W>
Vc_INTRINSIC SimdArray(
W &&x,
enable_if<(Traits::isSimdArray<W>::value && Traits::simd_vector_size<W>::value == N &&
std::is_convertible<Traits::entry_type_of<W>, T>::value)> = nullarg)
: data0(Split::lo(x)), data1(Split::hi(x))
{
}
// implicit conversion to Vector<U, AnyAbi> for if Vector<U, AnyAbi>::size() == N and
// T implicitly convertible to U
template <
typename U, typename A,
typename = enable_if<std::is_convertible<T, U>::value && Vector<U, A>::Size == N>>
operator Vector<U, A>() const
{
return simd_cast<Vector<U, A>>(data0, data1);
}
//////////////////// other functions ///////////////
Vc_INTRINSIC void setZero()
{
data0.setZero();
data1.setZero();
}
Vc_INTRINSIC void setZero(const mask_type &k)
{
data0.setZero(Split::lo(k));
data1.setZero(Split::hi(k));
}
Vc_INTRINSIC void setZeroInverted()
{
data0.setZeroInverted();
data1.setZeroInverted();
}
Vc_INTRINSIC void setZeroInverted(const mask_type &k)
{
data0.setZeroInverted(Split::lo(k));
data1.setZeroInverted(Split::hi(k));
}
Vc_INTRINSIC void setQnan() {
data0.setQnan();
data1.setQnan();
}
Vc_INTRINSIC void setQnan(const mask_type &m) {
data0.setQnan(Split::lo(m));
data1.setQnan(Split::hi(m));
}
///\internal execute specified Operation
template <typename Op, typename... Args>
static Vc_INTRINSIC SimdArray fromOperation(Op op, Args &&... args)
{
SimdArray r = {
storage_type0::fromOperation(op, Split::lo(args)...), // no forward here - it
// could move and thus
// break the next line
storage_type1::fromOperation(op, Split::hi(std::forward<Args>(args))...)};
return r;
}
///\internal
template <typename Op, typename... Args>
static Vc_INTRINSIC void callOperation(Op op, Args &&... args)
{
storage_type0::callOperation(op, Split::lo(args)...);
storage_type1::callOperation(op, Split::hi(std::forward<Args>(args))...);
}
template <typename U, typename... Args> Vc_INTRINSIC void load(const U *mem, Args &&... args)
{
data0.load(mem, Split::lo(args)...); // no forward here - it could move and thus
// break the next line
data1.load(mem + storage_type0::size(), Split::hi(std::forward<Args>(args))...);
}
template <typename U, typename... Args> Vc_INTRINSIC void store(U *mem, Args &&... args) const
{
data0.store(mem, Split::lo(args)...); // no forward here - it could move and thus
// break the next line
data1.store(mem + storage_type0::size(), Split::hi(std::forward<Args>(args))...);
}
Vc_INTRINSIC mask_type operator!() const
{
return {!data0, !data1};
}
Vc_INTRINSIC SimdArray operator-() const
{
return {-data0, -data1};
}
/// Returns a copy of itself
Vc_INTRINSIC SimdArray operator+() const { return *this; }
Vc_INTRINSIC SimdArray operator~() const
{
return {~data0, ~data1};
}
// left/right shift operators {{{2
template <typename U,
typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>
Vc_INTRINSIC Vc_CONST SimdArray operator<<(U x) const
{
return {data0 << x, data1 << x};
}
template <typename U,
typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>
Vc_INTRINSIC SimdArray &operator<<=(U x)
{
data0 <<= x;
data1 <<= x;
return *this;
}
template <typename U,
typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>
Vc_INTRINSIC Vc_CONST SimdArray operator>>(U x) const
{
return {data0 >> x, data1 >> x};
}
template <typename U,
typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>
Vc_INTRINSIC SimdArray &operator>>=(U x)
{
data0 >>= x;
data1 >>= x;
return *this;
}
// binary operators {{{2
#define Vc_BINARY_OPERATOR_(op) \
Vc_INTRINSIC Vc_CONST SimdArray operator op(const SimdArray &rhs) const \
{ \
return {data0 op rhs.data0, data1 op rhs.data1}; \
} \
Vc_INTRINSIC SimdArray &operator op##=(const SimdArray &rhs) \
{ \
data0 op## = rhs.data0; \
data1 op## = rhs.data1; \
return *this; \
}
Vc_ALL_ARITHMETICS(Vc_BINARY_OPERATOR_);
Vc_ALL_BINARY(Vc_BINARY_OPERATOR_);
Vc_ALL_SHIFTS(Vc_BINARY_OPERATOR_);
#undef Vc_BINARY_OPERATOR_
#define Vc_COMPARES(op) \
Vc_INTRINSIC mask_type operator op(const SimdArray &rhs) const \
{ \
return {data0 op rhs.data0, data1 op rhs.data1}; \
}
Vc_ALL_COMPARES(Vc_COMPARES);
#undef Vc_COMPARES
// operator[] {{{2
/// \name Scalar Subscript Operators
///@{
private:
friend reference;
Vc_INTRINSIC static value_type get(const SimdArray &o, int i) noexcept
{
return reinterpret_cast<const alias_type *>(&o)[i];
}
template <typename U>
Vc_INTRINSIC static void set(SimdArray &o, int i, U &&v) noexcept(
noexcept(std::declval<value_type &>() = v))
{
reinterpret_cast<alias_type *>(&o)[i] = v;
}
public:
///\copydoc Vector::operator[](size_t)
Vc_INTRINSIC reference operator[](size_t i) noexcept
{
static_assert(noexcept(reference{std::declval<SimdArray &>(), int()}), "");
return {*this, int(i)};
}
///\copydoc Vector::operator[](size_t) const
Vc_INTRINSIC value_type operator[](size_t index) const noexcept
{
return get(*this, int(index));
}
///@}
// operator(){{{2
///\copydoc Vector::operator()(MaskType)
Vc_INTRINSIC Common::WriteMaskedVector<SimdArray, mask_type> operator()(
const mask_type &mask)
{
return {*this, mask};
}
///\internal
Vc_INTRINSIC void assign(const SimdArray &v, const mask_type &k) //{{{2
{
data0.assign(v.data0, internal_data0(k));
data1.assign(v.data1, internal_data1(k));
}
// reductions {{{2
#define Vc_REDUCTION_FUNCTION_(name_, binary_fun_, scalar_fun_) \
private: \
template <typename ForSfinae = void> \
Vc_INTRINSIC enable_if<std::is_same<ForSfinae, void>::value && \
storage_type0::Size == storage_type1::Size, \
value_type> name_##_impl() const \
{ \
return binary_fun_(data0, data1).name_(); \
} \
\
template <typename ForSfinae = void> \
Vc_INTRINSIC enable_if<std::is_same<ForSfinae, void>::value && \
storage_type0::Size != storage_type1::Size, \
value_type> name_##_impl() const \
{ \
return scalar_fun_(data0.name_(), data1.name_()); \
} \
\
public: \
/**\copybrief Vector::##name_ */ \
Vc_INTRINSIC value_type name_() const { return name_##_impl(); } \
/**\copybrief Vector::##name_ */ \
Vc_INTRINSIC value_type name_(const mask_type &mask) const \
{ \
if (Vc_IS_UNLIKELY(Split::lo(mask).isEmpty())) { \
return data1.name_(Split::hi(mask)); \
} else if (Vc_IS_UNLIKELY(Split::hi(mask).isEmpty())) { \
return data0.name_(Split::lo(mask)); \
} else { \
return scalar_fun_(data0.name_(Split::lo(mask)), \
data1.name_(Split::hi(mask))); \
} \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
Vc_REDUCTION_FUNCTION_(min, Vc::min, std::min);
Vc_REDUCTION_FUNCTION_(max, Vc::max, std::max);
Vc_REDUCTION_FUNCTION_(product, internal::product_helper_, internal::product_helper_);
Vc_REDUCTION_FUNCTION_(sum, internal::sum_helper_, internal::sum_helper_);
#undef Vc_REDUCTION_FUNCTION_
///\copybrief Vector::partialSum
Vc_INTRINSIC Vc_PURE SimdArray partialSum() const //{{{2
{
auto ps0 = data0.partialSum();
auto tmp = data1;
tmp[0] += ps0[data0.size() - 1];
return {std::move(ps0), tmp.partialSum()};
}
// apply {{{2
///\copybrief Vector::apply(F &&) const
template <typename F> inline SimdArray apply(F &&f) const
{
return {data0.apply(f), data1.apply(f)};
}
///\copybrief Vector::apply(F &&, MaskType) const
template <typename F> inline SimdArray apply(F &&f, const mask_type &k) const
{
return {data0.apply(f, Split::lo(k)), data1.apply(f, Split::hi(k))};
}
// shifted {{{2
///\copybrief Vector::shifted(int) const
inline SimdArray shifted(int amount) const
{
constexpr int SSize = Size;
constexpr int SSize0 = storage_type0::Size;
constexpr int SSize1 = storage_type1::Size;
if (amount == 0) {
return *this;
}
if (amount < 0) {
if (amount > -SSize0) {
return {data0.shifted(amount), data1.shifted(amount, data0)};
}
if (amount == -SSize0) {
return {storage_type0::Zero(), simd_cast<storage_type1>(data0)};
}
if (amount < -SSize0) {
return {storage_type0::Zero(), simd_cast<storage_type1>(data0.shifted(
amount + SSize0))};
}
return Zero();
} else {
if (amount >= SSize) {
return Zero();
} else if (amount >= SSize0) {
return {
simd_cast<storage_type0>(data1).shifted(amount - SSize0),
storage_type1::Zero()};
} else if (amount >= SSize1) {
return {data0.shifted(amount, data1), storage_type1::Zero()};
} else {
return {data0.shifted(amount, data1), data1.shifted(amount)};
}
}
}
template <std::size_t NN>
inline enable_if<
!(std::is_same<storage_type0, storage_type1>::value && // not bisectable
N == NN),
SimdArray>
shifted(int amount, const SimdArray<value_type, NN> &shiftIn) const
{
constexpr int SSize = Size;
if (amount < 0) {
return SimdArray::generate([&](int i) -> value_type {
i += amount;
if (i >= 0) {
return operator[](i);
} else if (i >= -SSize) {
return shiftIn[i + SSize];
}
return 0;
});
}
return SimdArray::generate([&](int i) -> value_type {
i += amount;
if (i < SSize) {
return operator[](i);
} else if (i < 2 * SSize) {
return shiftIn[i - SSize];
}
return 0;
});
}
private:
// workaround for MSVC not understanding the simpler and shorter expression of the boolean
// expression directly in the enable_if below
template <std::size_t NN> struct bisectable_shift
: public std::integral_constant<bool,
std::is_same<storage_type0, storage_type1>::value && // bisectable
N == NN>
{
};
public:
template <std::size_t NN>
inline SimdArray shifted(enable_if<bisectable_shift<NN>::value, int> amount,
const SimdArray<value_type, NN> &shiftIn) const
{
constexpr int SSize = Size;
if (amount < 0) {
if (amount > -static_cast<int>(storage_type0::Size)) {
return {data0.shifted(amount, internal_data1(shiftIn)),
data1.shifted(amount, data0)};
}
if (amount == -static_cast<int>(storage_type0::Size)) {
return {storage_type0(internal_data1(shiftIn)), storage_type1(data0)};
}
if (amount > -SSize) {
return {
internal_data1(shiftIn)
.shifted(amount + static_cast<int>(storage_type0::Size), internal_data0(shiftIn)),
data0.shifted(amount + static_cast<int>(storage_type0::Size), internal_data1(shiftIn))};
}
if (amount == -SSize) {
return shiftIn;
}
if (amount > -2 * SSize) {
return shiftIn.shifted(amount + SSize);
}
}
if (amount == 0) {
return *this;
}
if (amount < static_cast<int>(storage_type0::Size)) {
return {data0.shifted(amount, data1),
data1.shifted(amount, internal_data0(shiftIn))};
}
if (amount == static_cast<int>(storage_type0::Size)) {
return {storage_type0(data1), storage_type1(internal_data0(shiftIn))};
}
if (amount < SSize) {
return {data1.shifted(amount - static_cast<int>(storage_type0::Size), internal_data0(shiftIn)),
internal_data0(shiftIn)
.shifted(amount - static_cast<int>(storage_type0::Size), internal_data1(shiftIn))};
}
if (amount == SSize) {
return shiftIn;
}
if (amount < 2 * SSize) {
return shiftIn.shifted(amount - SSize);
}
return Zero();
}
// rotated {{{2
///\copybrief Vector::rotated
Vc_INTRINSIC SimdArray rotated(int amount) const
{
amount %= int(size());
if (amount == 0) {
return *this;
} else if (amount < 0) {
amount += size();
}
#ifdef Vc_MSVC
// MSVC fails to find a SimdArray::shifted function with 2 arguments. So use store
// ->
// load to implement the function instead.
alignas(MemoryAlignment) T tmp[N + data0.size()];
data0.store(&tmp[0], Vc::Aligned);
data1.store(&tmp[data0.size()], Vc::Aligned);
data0.store(&tmp[N], Vc::Unaligned);
SimdArray r;
r.data0.load(&tmp[amount], Vc::Unaligned);
r.data1.load(&tmp[(amount + data0.size()) % size()], Vc::Unaligned);
return r;
#else
auto &&d0cvtd = simd_cast<storage_type1>(data0);
auto &&d1cvtd = simd_cast<storage_type0>(data1);
constexpr int size0 = storage_type0::size();
constexpr int size1 = storage_type1::size();
if (amount == size0 && std::is_same<storage_type0, storage_type1>::value) {
return {std::move(d1cvtd), std::move(d0cvtd)};
} else if (amount < size1) {
return {data0.shifted(amount, d1cvtd), data1.shifted(amount, d0cvtd)};
} else if (amount == size1) {
return {data0.shifted(amount, d1cvtd), std::move(d0cvtd)};
} else if (int(size()) - amount < size1) {
return {data0.shifted(amount - int(size()), d1cvtd.shifted(size1 - size0)),
data1.shifted(amount - int(size()), data0.shifted(size0 - size1))};
} else if (int(size()) - amount == size1) {
return {data0.shifted(-size1, d1cvtd.shifted(size1 - size0)),
simd_cast<storage_type1>(data0.shifted(size0 - size1))};
} else if (amount <= size0) {
return {data0.shifted(size1, d1cvtd).shifted(amount - size1, data0),
simd_cast<storage_type1>(data0.shifted(amount - size1))};
} else {
return {data0.shifted(size1, d1cvtd).shifted(amount - size1, data0),
simd_cast<storage_type1>(data0.shifted(amount - size1, d1cvtd))};
}
return *this;
#endif
}
// interleaveLow/-High {{{2
///\internal \copydoc Vector::interleaveLow
Vc_INTRINSIC SimdArray interleaveLow(const SimdArray &x) const
{
// return data0[0], x.data0[0], data0[1], x.data0[1], ...
return {data0.interleaveLow(x.data0),
simd_cast<storage_type1>(data0.interleaveHigh(x.data0))};
}
///\internal \copydoc Vector::interleaveHigh
Vc_INTRINSIC SimdArray interleaveHigh(const SimdArray &x) const
{
return interleaveHighImpl(
x,
std::integral_constant<bool, storage_type0::Size == storage_type1::Size>());
}
private:
///\internal
Vc_INTRINSIC SimdArray interleaveHighImpl(const SimdArray &x, std::true_type) const
{
return {data1.interleaveLow(x.data1), data1.interleaveHigh(x.data1)};
}
///\internal
inline SimdArray interleaveHighImpl(const SimdArray &x, std::false_type) const
{
return {data0.interleaveHigh(x.data0)
.shifted(storage_type1::Size,
simd_cast<storage_type0>(data1.interleaveLow(x.data1))),
data1.interleaveHigh(x.data1)};
}
public:
///\copybrief Vector::reversed
inline SimdArray reversed() const //{{{2
{
if (std::is_same<storage_type0, storage_type1>::value) {
return {simd_cast<storage_type0>(data1).reversed(),
simd_cast<storage_type1>(data0).reversed()};
} else {
#ifdef Vc_MSVC
// MSVC fails to find a SimdArray::shifted function with 2 arguments. So use
// store
// -> load to implement the function instead.
alignas(MemoryAlignment) T tmp[N];
data1.reversed().store(&tmp[0], Vc::Aligned);
data0.reversed().store(&tmp[data1.size()], Vc::Unaligned);
return SimdArray{&tmp[0], Vc::Aligned};
#else
return {data0.shifted(storage_type1::Size, data1).reversed(),
simd_cast<storage_type1>(data0.reversed().shifted(
storage_type0::Size - storage_type1::Size))};
#endif
}
}
///\copydoc Vector::sorted
inline SimdArray sorted() const //{{{2
{
return sortedImpl(
std::integral_constant<bool, storage_type0::Size == storage_type1::Size>());
}
///\internal
Vc_INTRINSIC SimdArray sortedImpl(std::true_type) const
{
#ifdef Vc_DEBUG_SORTED
std::cerr << "-- " << data0 << data1 << '\n';
#endif
const auto a = data0.sorted();
const auto b = data1.sorted().reversed();
const auto lo = Vc::min(a, b);
const auto hi = Vc::max(a, b);
return {lo.sorted(), hi.sorted()};
}
///\internal
Vc_INTRINSIC SimdArray sortedImpl(std::false_type) const
{
using SortableArray =
SimdArray<value_type, Common::NextPowerOfTwo<size()>::value>;
auto sortable = simd_cast<SortableArray>(*this);
for (std::size_t i = Size; i < SortableArray::Size; ++i) {
using limits = std::numeric_limits<value_type>;
if (limits::has_infinity) {
sortable[i] = limits::infinity();
} else {
sortable[i] = std::numeric_limits<value_type>::max();
}
}
return simd_cast<SimdArray>(sortable.sorted());
/* The following implementation appears to be less efficient. But this may need further
* work.
const auto a = data0.sorted();
const auto b = data1.sorted();
#ifdef Vc_DEBUG_SORTED
std::cerr << "== " << a << b << '\n';
#endif
auto aIt = Vc::begin(a);
auto bIt = Vc::begin(b);
const auto aEnd = Vc::end(a);
const auto bEnd = Vc::end(b);
return SimdArray::generate([&](std::size_t) {
if (aIt == aEnd) {
return *(bIt++);
}
if (bIt == bEnd) {
return *(aIt++);
}
if (*aIt < *bIt) {
return *(aIt++);
} else {
return *(bIt++);
}
});
*/
}
/// \name Deprecated Members
///@{
///\copydoc size
///\deprecated Use size() instead.
static constexpr std::size_t Size = size();
/// \copydoc Vector::exponent
Vc_DEPRECATED("use exponent(x) instead") Vc_INTRINSIC SimdArray exponent() const
{
return {exponent(data0), exponent(data1)};
}
/// \copydoc Vector::isNegative
Vc_DEPRECATED("use isnegative(x) instead") Vc_INTRINSIC MaskType isNegative() const
{
return {isnegative(data0), isnegative(data1)};
}
///\copydoc Vector::copySign
Vc_DEPRECATED("use copysign(x, y) instead") Vc_INTRINSIC SimdArray
copySign(const SimdArray &reference) const
{
return {Vc::copysign(data0, reference.data0),
Vc::copysign(data1, reference.data1)};
}
///@}
// internal_data0/1 {{{2
friend storage_type0 &internal_data0<>(SimdArray &x);
friend storage_type1 &internal_data1<>(SimdArray &x);
friend const storage_type0 &internal_data0<>(const SimdArray &x);
friend const storage_type1 &internal_data1<>(const SimdArray &x);
/// \internal
Vc_INTRINSIC SimdArray(storage_type0 &&x, storage_type1 &&y) //{{{2
: data0(std::move(x)), data1(std::move(y))
{
}
Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(storage_type0));
private: //{{{2
// The alignas attribute attached to the class declaration above is ignored by ICC
// 17.0.0 (at least). So just move the alignas attribute down here where it works for
// all compilers.
alignas(static_cast<std::size_t>(
Common::BoundedAlignment<Common::NextPowerOfTwo<N>::value * sizeof(V) /
V::size()>::value)) storage_type0 data0;
storage_type1 data1;
};
#undef Vc_CURRENT_CLASS_NAME
template <typename T, std::size_t N, typename V, std::size_t M>
constexpr std::size_t SimdArray<T, N, V, M>::Size;
template <typename T, std::size_t N, typename V, std::size_t M>
constexpr std::size_t SimdArray<T, N, V, M>::MemoryAlignment;
// gatherImplementation {{{2
template <typename T, std::size_t N, typename VectorType, std::size_t M>
template <typename MT, typename IT>
inline void SimdArray<T, N, VectorType, M>::gatherImplementation(const MT *mem,
IT &&indexes)
{
data0.gather(mem, Split::lo(Common::Operations::gather(),
indexes)); // don't forward indexes - it could move and
// thus break the next line
data1.gather(mem, Split::hi(Common::Operations::gather(), std::forward<IT>(indexes)));
}
template <typename T, std::size_t N, typename VectorType, std::size_t M>
template <typename MT, typename IT>
inline void SimdArray<T, N, VectorType, M>::gatherImplementation(const MT *mem,
IT &&indexes, MaskArgument mask)
{
data0.gather(mem, Split::lo(Common::Operations::gather(), indexes),
Split::lo(mask)); // don't forward indexes - it could move and
// thus break the next line
data1.gather(mem, Split::hi(Common::Operations::gather(), std::forward<IT>(indexes)),
Split::hi(mask));
}
// scatterImplementation {{{2
template <typename T, std::size_t N, typename VectorType, std::size_t M>
template <typename MT, typename IT>
inline void SimdArray<T, N, VectorType, M>::scatterImplementation(MT *mem,
IT &&indexes) const
{
data0.scatter(mem, Split::lo(Common::Operations::gather(),
indexes)); // don't forward indexes - it could move and
// thus break the next line
data1.scatter(mem, Split::hi(Common::Operations::gather(), std::forward<IT>(indexes)));
}
template <typename T, std::size_t N, typename VectorType, std::size_t M>
template <typename MT, typename IT>
inline void SimdArray<T, N, VectorType, M>::scatterImplementation(MT *mem,
IT &&indexes, MaskArgument mask) const
{
data0.scatter(mem, Split::lo(Common::Operations::gather(), indexes),
Split::lo(mask)); // don't forward indexes - it could move and
// thus break the next line
data1.scatter(mem, Split::hi(Common::Operations::gather(), std::forward<IT>(indexes)),
Split::hi(mask));
}
// internal_data0/1 (SimdArray) {{{1
///\internal Returns the first data member of a generic SimdArray
template <typename T, std::size_t N, typename V, std::size_t M>
#ifndef Vc_MSVC
Vc_INTRINSIC
#endif
typename SimdArrayTraits<T, N>::storage_type0 &internal_data0(
SimdArray<T, N, V, M> &x)
{
return x.data0;
}
///\internal Returns the second data member of a generic SimdArray
template <typename T, std::size_t N, typename V, std::size_t M>
#ifndef Vc_MSVC
Vc_INTRINSIC
#endif
typename SimdArrayTraits<T, N>::storage_type1 &internal_data1(
SimdArray<T, N, V, M> &x)
{
return x.data1;
}
///\internal Returns the first data member of a generic SimdArray (const overload)
template <typename T, std::size_t N, typename V, std::size_t M>
#ifndef Vc_MSVC
Vc_INTRINSIC
#endif
const typename SimdArrayTraits<T, N>::storage_type0 &internal_data0(
const SimdArray<T, N, V, M> &x)
{
return x.data0;
}
///\internal Returns the second data member of a generic SimdArray (const overload)
template <typename T, std::size_t N, typename V, std::size_t M>
#ifndef Vc_MSVC
Vc_INTRINSIC
#endif
const typename SimdArrayTraits<T, N>::storage_type1 &internal_data1(
const SimdArray<T, N, V, M> &x)
{
return x.data1;
}
// MSVC workaround for SimdArray(storage_type0, storage_type1) ctor{{{1
// MSVC sometimes stores x to data1. By first broadcasting 0 and then assigning y
// in the body the bug is supressed.
#if defined Vc_MSVC && defined Vc_IMPL_SSE
template <>
Vc_INTRINSIC SimdArray<double, 8, SSE::Vector<double>, 2>::SimdArray(
SimdArray<double, 4> &&x, SimdArray<double, 4> &&y)
: data0(x), data1(0)
{
data1 = y;
}
#endif
// binary operators {{{1
namespace result_vector_type_internal
{
template <typename T>
using type = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
template <typename T>
using is_integer_larger_than_int = std::integral_constant<
bool, std::is_integral<T>::value &&(sizeof(T) > sizeof(int) ||
std::is_same<T, long>::value ||
std::is_same<T, unsigned long>::value)>;
template <
typename L, typename R,
std::size_t N = Traits::isSimdArray<L>::value ? Traits::simd_vector_size<L>::value
: Traits::simd_vector_size<R>::value,
bool =
(Traits::isSimdArray<L>::value ||
Traits::isSimdArray<R>::value) // one of the operands must be a SimdArray
&& !std::is_same<type<L>, type<R>>::value // if the operands are of the same type
// use the member function
&&
((std::is_arithmetic<type<L>>::value &&
!is_integer_larger_than_int<type<L>>::value) ||
(std::is_arithmetic<type<R>>::value &&
!is_integer_larger_than_int<type<R>>::value) // one of the operands is a scalar
// type
||
( // or one of the operands is Vector<T> with Vector<T>::size() ==
// SimdArray::size()
Traits::simd_vector_size<L>::value == Traits::simd_vector_size<R>::value &&
((Traits::is_simd_vector<L>::value && !Traits::isSimdArray<L>::value) ||
(Traits::is_simd_vector<R>::value && !Traits::isSimdArray<R>::value))))>
struct evaluate;
template <typename L, typename R, std::size_t N> struct evaluate<L, R, N, true>
{
private:
using LScalar = Traits::entry_type_of<L>;
using RScalar = Traits::entry_type_of<R>;
template <bool B, typename True, typename False>
using conditional = typename std::conditional<B, True, False>::type;
public:
// In principle we want the exact same rules for SimdArray<T> ⨉ SimdArray<U> as the standard
// defines for T ⨉ U. BUT: short ⨉ short returns int (because all integral types smaller than
// int are promoted to int before any operation). This would imply that SIMD types with integral
// types smaller than int are more or less useless - and you could use SimdArray<int> from the
// start. Therefore we special-case those operations where the scalar type of both operands is
// integral and smaller than int.
// In addition to that there is no generic support for 64-bit int SIMD types. Therefore
// promotion to a 64-bit integral type (including `long` because it can potentially have 64
// bits) also is not done. But if one of the operands is a scalar type that is larger than int
// then the operator is disabled altogether. We do not want an implicit demotion.
using type = SimdArray<
conditional<(std::is_integral<LScalar>::value &&std::is_integral<RScalar>::value &&
sizeof(LScalar) < sizeof(int) &&
sizeof(RScalar) < sizeof(int)),
conditional<(sizeof(LScalar) == sizeof(RScalar)),
conditional<std::is_unsigned<LScalar>::value, LScalar, RScalar>,
conditional<(sizeof(LScalar) > sizeof(RScalar)), LScalar, RScalar>>,
decltype(std::declval<LScalar>() + std::declval<RScalar>())>,
N>;
};
} // namespace result_vector_type_internal
template <typename L, typename R>
using result_vector_type = typename result_vector_type_internal::evaluate<L, R>::type;
static_assert(
std::is_same<result_vector_type<short int, Vc::SimdArray<short unsigned int, 32ul>>,
Vc::SimdArray<short unsigned int, 32ul>>::value,
"result_vector_type does not work");
#define Vc_BINARY_OPERATORS_(op_) \
/*!\brief Applies op_ component-wise and concurrently. */ \
template <typename L, typename R> \
Vc_INTRINSIC result_vector_type<L, R> operator op_(L &&lhs, R &&rhs) \
{ \
using Return = result_vector_type<L, R>; \
return Return(std::forward<L>(lhs)) op_ Return(std::forward<R>(rhs)); \
}
/**
* \name Arithmetic and Bitwise Operators
*
* Applies the operator component-wise and concurrently on \p lhs and \p rhs and returns
* a new SimdArray object containing the result values.
*
* This operator only participates in overload resolution if:
* \li At least one of the template parameters \p L or \p R is a SimdArray type.
* \li Either \p L or \p R is a fundamental arithmetic type but not an integral type
* larger than \c int \n
* or \n
* \p L or \p R is a Vc::Vector type with equal number of elements (Vector::size() ==
* SimdArray::size()).
*
* The return type of the operator is a SimdArray type using the more precise EntryType of
* \p L or \p R and the same number of elements as the SimdArray argument(s).
*/
///@{
Vc_ALL_ARITHMETICS(Vc_BINARY_OPERATORS_);
Vc_ALL_BINARY(Vc_BINARY_OPERATORS_);
///@}
#undef Vc_BINARY_OPERATORS_
#define Vc_BINARY_OPERATORS_(op_) \
/*!\brief Applies op_ component-wise and concurrently. */ \
template <typename L, typename R> \
Vc_INTRINSIC typename result_vector_type<L, R>::mask_type operator op_(L &&lhs, \
R &&rhs) \
{ \
using Promote = result_vector_type<L, R>; \
return Promote(std::forward<L>(lhs)) op_ Promote(std::forward<R>(rhs)); \
}
/**
* \name Compare Operators
*
* Applies the operator component-wise and concurrently on \p lhs and \p rhs and returns
* a new SimdMaskArray object containing the result values.
*
* This operator only participates in overload resolution if (same rules as above):
* \li At least one of the template parameters \p L or \p R is a SimdArray type.
* \li Either \p L or \p R is a fundamental arithmetic type but not an integral type
* larger than \c int \n
* or \n
* \p L or \p R is a Vc::Vector type with equal number of elements (Vector::size() ==
* SimdArray::size()).
*
* The return type of the operator is a SimdMaskArray type using the more precise EntryType of
* \p L or \p R and the same number of elements as the SimdArray argument(s).
*/
///@{
Vc_ALL_COMPARES(Vc_BINARY_OPERATORS_);
///@}
#undef Vc_BINARY_OPERATORS_
// math functions {{{1
#define Vc_FORWARD_UNARY_OPERATOR(name_) \
/*!\brief Applies the std::name_ function component-wise and concurrently. */ \
template <typename T, std::size_t N, typename V, std::size_t M> \
inline SimdArray<T, N, V, M> name_(const SimdArray<T, N, V, M> &x) \
{ \
return SimdArray<T, N, V, M>::fromOperation( \
Common::Operations::Forward_##name_(), x); \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
#define Vc_FORWARD_UNARY_BOOL_OPERATOR(name_) \
/*!\brief Applies the std::name_ function component-wise and concurrently. */ \
template <typename T, std::size_t N, typename V, std::size_t M> \
inline SimdMaskArray<T, N, V, M> name_(const SimdArray<T, N, V, M> &x) \
{ \
return SimdMaskArray<T, N, V, M>::fromOperation( \
Common::Operations::Forward_##name_(), x); \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
#define Vc_FORWARD_BINARY_OPERATOR(name_) \
/*!\brief Applies the std::name_ function component-wise and concurrently. */ \
template <typename T, std::size_t N, typename V, std::size_t M> \
inline SimdArray<T, N, V, M> name_(const SimdArray<T, N, V, M> &x, \
const SimdArray<T, N, V, M> &y) \
{ \
return SimdArray<T, N, V, M>::fromOperation( \
Common::Operations::Forward_##name_(), x, y); \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
/**
* \name Math functions
* These functions evaluate the
*/
///@{
Vc_FORWARD_UNARY_OPERATOR(abs);
Vc_FORWARD_UNARY_OPERATOR(asin);
Vc_FORWARD_UNARY_OPERATOR(atan);
Vc_FORWARD_BINARY_OPERATOR(atan2);
Vc_FORWARD_UNARY_OPERATOR(ceil);
Vc_FORWARD_BINARY_OPERATOR(copysign);
Vc_FORWARD_UNARY_OPERATOR(cos);
Vc_FORWARD_UNARY_OPERATOR(exp);
Vc_FORWARD_UNARY_OPERATOR(exponent);
Vc_FORWARD_UNARY_OPERATOR(floor);
/// Applies the std::fma function component-wise and concurrently.
template <typename T, std::size_t N>
inline SimdArray<T, N> fma(const SimdArray<T, N> &a, const SimdArray<T, N> &b,
const SimdArray<T, N> &c)
{
return SimdArray<T, N>::fromOperation(Common::Operations::Forward_fma(), a, b, c);
}
Vc_FORWARD_UNARY_BOOL_OPERATOR(isfinite);
Vc_FORWARD_UNARY_BOOL_OPERATOR(isinf);
Vc_FORWARD_UNARY_BOOL_OPERATOR(isnan);
#if defined Vc_MSVC && defined Vc_IMPL_SSE
inline SimdMaskArray<double, 8, SSE::Vector<double>, 2> isnan(
const SimdArray<double, 8, SSE::Vector<double>, 2> &x)
{
using V = SSE::Vector<double>;
const SimdArray<double, 4, V, 2> &x0 = internal_data0(x);
const SimdArray<double, 4, V, 2> &x1 = internal_data1(x);
SimdMaskArray<double, 4, V, 2> r0;
SimdMaskArray<double, 4, V, 2> r1;
internal_data(internal_data0(r0)) = isnan(internal_data(internal_data0(x0)));
internal_data(internal_data1(r0)) = isnan(internal_data(internal_data1(x0)));
internal_data(internal_data0(r1)) = isnan(internal_data(internal_data0(x1)));
internal_data(internal_data1(r1)) = isnan(internal_data(internal_data1(x1)));
return {std::move(r0), std::move(r1)};
}
#endif
Vc_FORWARD_UNARY_BOOL_OPERATOR(isnegative);
/// Applies the std::frexp function component-wise and concurrently.
template <typename T, std::size_t N>
inline SimdArray<T, N> frexp(const SimdArray<T, N> &x, SimdArray<int, N> *e)
{
return SimdArray<T, N>::fromOperation(Common::Operations::Forward_frexp(), x, e);
}
/// Applies the std::ldexp function component-wise and concurrently.
template <typename T, std::size_t N>
inline SimdArray<T, N> ldexp(const SimdArray<T, N> &x, const SimdArray<int, N> &e)
{
return SimdArray<T, N>::fromOperation(Common::Operations::Forward_ldexp(), x, e);
}
Vc_FORWARD_UNARY_OPERATOR(log);
Vc_FORWARD_UNARY_OPERATOR(log10);
Vc_FORWARD_UNARY_OPERATOR(log2);
Vc_FORWARD_UNARY_OPERATOR(reciprocal);
Vc_FORWARD_UNARY_OPERATOR(round);
Vc_FORWARD_UNARY_OPERATOR(rsqrt);
Vc_FORWARD_UNARY_OPERATOR(sin);
/// Determines sine and cosine concurrently and component-wise on \p x.
template <typename T, std::size_t N>
void sincos(const SimdArray<T, N> &x, SimdArray<T, N> *sin, SimdArray<T, N> *cos)
{
SimdArray<T, N>::callOperation(Common::Operations::Forward_sincos(), x, sin, cos);
}
Vc_FORWARD_UNARY_OPERATOR(sqrt);
Vc_FORWARD_UNARY_OPERATOR(trunc);
Vc_FORWARD_BINARY_OPERATOR(min);
Vc_FORWARD_BINARY_OPERATOR(max);
///@}
#undef Vc_FORWARD_UNARY_OPERATOR
#undef Vc_FORWARD_UNARY_BOOL_OPERATOR
#undef Vc_FORWARD_BINARY_OPERATOR
// simd_cast {{{1
#ifdef Vc_MSVC
#define Vc_DUMMY_ARG0 , int = 0
#define Vc_DUMMY_ARG1 , long = 0
#define Vc_DUMMY_ARG2 , short = 0
#define Vc_DUMMY_ARG3 , char = '0'
#define Vc_DUMMY_ARG4 , unsigned = 0u
#define Vc_DUMMY_ARG5 , unsigned short = 0u
#else
#define Vc_DUMMY_ARG0
#define Vc_DUMMY_ARG1
#define Vc_DUMMY_ARG2
#define Vc_DUMMY_ARG3
#define Vc_DUMMY_ARG4
#define Vc_DUMMY_ARG5
#endif // Vc_MSVC
// simd_cast_impl_smaller_input {{{2
// The following function can be implemented without the sizeof...(From) overload.
// However, ICC has a bug (Premier Issue #6000116338) which leads to an ICE. Splitting the
// function in two works around the issue.
template <typename Return, std::size_t N, typename T, typename... From>
Vc_INTRINSIC Vc_CONST enable_if<sizeof...(From) != 0, Return>
simd_cast_impl_smaller_input(const From &... xs, const T &last)
{
Return r = simd_cast<Return>(xs...);
for (size_t i = 0; i < N; ++i) {
r[i + N * sizeof...(From)] = static_cast<typename Return::EntryType>(last[i]);
}
return r;
}
template <typename Return, std::size_t N, typename T>
Vc_INTRINSIC Vc_CONST Return simd_cast_impl_smaller_input(const T &last)
{
Return r = Return();
for (size_t i = 0; i < N; ++i) {
r[i] = static_cast<typename Return::EntryType>(last[i]);
}
return r;
}
template <typename Return, std::size_t N, typename T, typename... From>
Vc_INTRINSIC Vc_CONST enable_if<sizeof...(From) != 0, Return> simd_cast_impl_larger_input(
const From &... xs, const T &last)
{
Return r = simd_cast<Return>(xs...);
for (size_t i = N * sizeof...(From); i < Return::Size; ++i) {
r[i] = static_cast<typename Return::EntryType>(last[i - N * sizeof...(From)]);
}
return r;
}
template <typename Return, std::size_t N, typename T>
Vc_INTRINSIC Vc_CONST Return simd_cast_impl_larger_input(const T &last)
{
Return r = Return();
for (size_t i = 0; i < Return::size(); ++i) {
r[i] = static_cast<typename Return::EntryType>(last[i]);
}
return r;
}
// simd_cast_without_last (declaration) {{{2
template <typename Return, typename T, typename... From>
Vc_INTRINSIC_L Vc_CONST_L Return
simd_cast_without_last(const From &... xs, const T &) Vc_INTRINSIC_R Vc_CONST_R;
// are_all_types_equal {{{2
template <typename... Ts> struct are_all_types_equal;
template <typename T>
struct are_all_types_equal<T> : public std::integral_constant<bool, true>
{
};
template <typename T0, typename T1, typename... Ts>
struct are_all_types_equal<T0, T1, Ts...>
: public std::integral_constant<
bool, std::is_same<T0, T1>::value && are_all_types_equal<T1, Ts...>::value>
{
};
// simd_cast_interleaved_argument_order (declarations) {{{2
/*! \internal
The need for simd_cast_interleaved_argument_order stems from a shortcoming in pack
expansion of variadic templates in C++. For a simd_cast with SimdArray arguments that
are bisectable (i.e. \c storage_type0 and \c storage_type1 are equal) the generic
implementation needs to forward to a simd_cast of the \c internal_data0 and \c
internal_data1 of the arguments. But the required order of arguments is
`internal_data0(arg0), internal_data1(arg0), internal_data0(arg1), ...`. This is
impossible to achieve with pack expansion. It is only possible to write
`internal_data0(args)..., internal_data1(args)...` and thus have the argument order
mixed up. The simd_cast_interleaved_argument_order “simply” calls simd_cast with the
arguments correctly reordered (i.e. interleaved).
The implementation of simd_cast_interleaved_argument_order is done generically, so that
it supports any number of arguments. The central idea of the implementation is an
`extract` function which returns one value of an argument pack determined via an index
passed as template argument. This index is generated via an index_sequence. The
`extract` function uses two argument packs (of equal size) to easily return values from
the front and middle of the argument pack (for doing the deinterleave).
*/
template <typename Return, typename... Ts>
Vc_INTRINSIC Vc_CONST Return
simd_cast_interleaved_argument_order(const Ts &... a, const Ts &... b);
// simd_cast_with_offset (declarations and one impl) {{{2
// offset == 0 {{{3
template <typename Return, std::size_t offset, typename From, typename... Froms>
Vc_INTRINSIC Vc_CONST
enable_if<(are_all_types_equal<From, Froms...>::value && offset == 0), Return>
simd_cast_with_offset(const From &x, const Froms &... xs);
// offset > 0 && offset divisible by Return::Size {{{3
template <typename Return, std::size_t offset, typename From>
Vc_INTRINSIC Vc_CONST
enable_if<(From::Size > offset && offset > 0 && offset % Return::Size == 0), Return>
simd_cast_with_offset(const From &x);
// offset > 0 && offset NOT divisible && Return is non-atomic simd(mask)array {{{3
template <typename Return, std::size_t offset, typename From>
Vc_INTRINSIC Vc_CONST
enable_if<(From::Size > offset && offset > 0 && offset % Return::Size != 0 &&
((Traits::isSimdArray<Return>::value &&
!Traits::isAtomicSimdArray<Return>::value) ||
(Traits::isSimdMaskArray<Return>::value &&
!Traits::isAtomicSimdMaskArray<Return>::value))),
Return>
simd_cast_with_offset(const From &x);
// offset > 0 && offset NOT divisible && Return is atomic simd(mask)array {{{3
template <typename Return, std::size_t offset, typename From>
Vc_INTRINSIC Vc_CONST
enable_if<(From::Size > offset && offset > 0 && offset % Return::Size != 0 &&
((Traits::isSimdArray<Return>::value &&
Traits::isAtomicSimdArray<Return>::value) ||
(Traits::isSimdMaskArray<Return>::value &&
Traits::isAtomicSimdMaskArray<Return>::value))),
Return>
simd_cast_with_offset(const From &x);
// offset > first argument (drops first arg) {{{3
template <typename Return, std::size_t offset, typename From, typename... Froms>
Vc_INTRINSIC Vc_CONST enable_if<
(are_all_types_equal<From, Froms...>::value && From::Size <= offset), Return>
simd_cast_with_offset(const From &, const Froms &... xs)
{
return simd_cast_with_offset<Return, offset - From::Size>(xs...);
}
// offset > first and only argument (returns Zero) {{{3
template <typename Return, std::size_t offset, typename From>
Vc_INTRINSIC Vc_CONST enable_if<(From::Size <= offset), Return> simd_cast_with_offset(
const From &)
{
return Return::Zero();
}
// first_type_of {{{2
template <typename T, typename... Ts> struct first_type_of_impl
{
using type = T;
};
template <typename... Ts> using first_type_of = typename first_type_of_impl<Ts...>::type;
// simd_cast_drop_arguments (declarations) {{{2
template <typename Return, typename From>
Vc_INTRINSIC Vc_CONST Return simd_cast_drop_arguments(From x);
template <typename Return, typename... Froms>
Vc_INTRINSIC Vc_CONST
enable_if<(are_all_types_equal<Froms...>::value &&
sizeof...(Froms) * first_type_of<Froms...>::Size < Return::Size),
Return>
simd_cast_drop_arguments(Froms... xs, first_type_of<Froms...> x);
// The following function can be implemented without the sizeof...(From) overload.
// However, ICC has a bug (Premier Issue #6000116338) which leads to an ICE. Splitting the
// function in two works around the issue.
template <typename Return, typename From, typename... Froms>
Vc_INTRINSIC Vc_CONST enable_if<
(are_all_types_equal<From, Froms...>::value &&
(1 + sizeof...(Froms)) * From::Size >= Return::Size && sizeof...(Froms) != 0),
Return>
simd_cast_drop_arguments(Froms... xs, From x, From);
template <typename Return, typename From>
Vc_INTRINSIC Vc_CONST
enable_if<(are_all_types_equal<From>::value && From::Size >= Return::Size), Return>
simd_cast_drop_arguments(From x, From);
namespace
{
#ifdef Vc_DEBUG_SIMD_CAST
void debugDoNothing(const std::initializer_list<void *> &) {}
template <typename T0, typename... Ts>
inline void vc_debug_(const char *prefix, const char *suffix, const T0 &arg0,
const Ts &... args)
{
std::cerr << prefix << arg0;
debugDoNothing({&(std::cerr << ", " << args)...});
std::cerr << suffix;
}
#else
template <typename T0, typename... Ts>
Vc_INTRINSIC void vc_debug_(const char *, const char *, const T0 &, const Ts &...)
{
}
#endif
} // unnamed namespace
// is_less trait{{{2
template <size_t A, size_t B>
struct is_less : public std::integral_constant<bool, (A < B)> {
};
// is_power_of_2 trait{{{2
template <size_t N>
struct is_power_of_2 : public std::integral_constant<bool, ((N - 1) & N) == 0> {
};
// simd_cast<T>(xs...) to SimdArray/-mask {{{2
#define Vc_SIMDARRAY_CASTS(SimdArrayType_, NativeType_) \
template <typename Return, typename T, typename A, typename... Froms> \
Vc_INTRINSIC Vc_CONST enable_if< \
(Traits::isAtomic##SimdArrayType_<Return>::value && \
is_less<NativeType_<T, A>::Size * sizeof...(Froms), Return::Size>::value && \
are_all_types_equal<NativeType_<T, A>, Froms...>::value), \
Return> \
simd_cast(NativeType_<T, A> x, Froms... xs) \
{ \
vc_debug_("simd_cast{1}(", ")\n", x, xs...); \
return {simd_cast<typename Return::storage_type>(x, xs...)}; \
} \
template <typename Return, typename T, typename A, typename... Froms> \
Vc_INTRINSIC Vc_CONST enable_if< \
(Traits::isAtomic##SimdArrayType_<Return>::value && \
!is_less<NativeType_<T, A>::Size * sizeof...(Froms), Return::Size>::value && \
are_all_types_equal<NativeType_<T, A>, Froms...>::value), \
Return> \
simd_cast(NativeType_<T, A> x, Froms... xs) \
{ \
vc_debug_("simd_cast{2}(", ")\n", x, xs...); \
return {simd_cast_without_last<Return, NativeType_<T, A>, Froms...>(x, xs...)}; \
} \
template <typename Return, typename T, typename A, typename... Froms> \
Vc_INTRINSIC Vc_CONST \
enable_if<(Traits::is##SimdArrayType_<Return>::value && \
!Traits::isAtomic##SimdArrayType_<Return>::value && \
is_less<Common::left_size<Return::Size>(), \
NativeType_<T, A>::Size *(1 + sizeof...(Froms))>::value && \
are_all_types_equal<NativeType_<T, A>, Froms...>::value), \
Return> \
simd_cast(NativeType_<T, A> x, Froms... xs) \
{ \
vc_debug_("simd_cast{3}(", ")\n", x, xs...); \
using R0 = typename Return::storage_type0; \
using R1 = typename Return::storage_type1; \
return {simd_cast_drop_arguments<R0, Froms...>(x, xs...), \
simd_cast_with_offset<R1, R0::Size>(x, xs...)}; \
} \
template <typename Return, typename T, typename A, typename... Froms> \
Vc_INTRINSIC Vc_CONST \
enable_if<(Traits::is##SimdArrayType_<Return>::value && \
!Traits::isAtomic##SimdArrayType_<Return>::value && \
!is_less<Common::left_size<Return::Size>(), \
NativeType_<T, A>::Size *(1 + sizeof...(Froms))>::value && \
are_all_types_equal<NativeType_<T, A>, Froms...>::value), \
Return> \
simd_cast(NativeType_<T, A> x, Froms... xs) \
{ \
vc_debug_("simd_cast{4}(", ")\n", x, xs...); \
using R0 = typename Return::storage_type0; \
using R1 = typename Return::storage_type1; \
return {simd_cast<R0>(x, xs...), R1::Zero()}; \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
Vc_SIMDARRAY_CASTS(SimdArray, Vc::Vector);
Vc_SIMDARRAY_CASTS(SimdMaskArray, Vc::Mask);
#undef Vc_SIMDARRAY_CASTS
// simd_cast<SimdArray/-mask, offset>(V) {{{2
#define Vc_SIMDARRAY_CASTS(SimdArrayType_, NativeType_) \
/* SIMD Vector/Mask to atomic SimdArray/simdmaskarray */ \
template <typename Return, int offset, typename T, typename A> \
Vc_INTRINSIC Vc_CONST \
enable_if<Traits::isAtomic##SimdArrayType_<Return>::value, Return> \
simd_cast(NativeType_<T, A> x Vc_DUMMY_ARG0) \
{ \
vc_debug_("simd_cast{offset, atomic}(", ")\n", offset, x); \
return {simd_cast<typename Return::storage_type, offset>(x)}; \
} \
/* both halves of Return array are extracted from argument */ \
template <typename Return, int offset, typename T, typename A> \
Vc_INTRINSIC Vc_CONST \
enable_if<(Traits::is##SimdArrayType_<Return>::value && \
!Traits::isAtomic##SimdArrayType_<Return>::value && \
Return::Size * offset + Common::left_size<Return::Size>() < \
NativeType_<T, A>::Size), \
Return> \
simd_cast(NativeType_<T, A> x Vc_DUMMY_ARG1) \
{ \
vc_debug_("simd_cast{offset, split Return}(", ")\n", offset, x); \
using R0 = typename Return::storage_type0; \
constexpr int entries_offset = offset * Return::Size; \
constexpr int entries_offset_right = entries_offset + R0::Size; \
return { \
simd_cast_with_offset<typename Return::storage_type0, entries_offset>(x), \
simd_cast_with_offset<typename Return::storage_type1, entries_offset_right>( \
x)}; \
} \
/* SIMD Vector/Mask to non-atomic SimdArray/simdmaskarray */ \
/* right half of Return array is zero */ \
template <typename Return, int offset, typename T, typename A> \
Vc_INTRINSIC Vc_CONST \
enable_if<(Traits::is##SimdArrayType_<Return>::value && \
!Traits::isAtomic##SimdArrayType_<Return>::value && \
Return::Size * offset + Common::left_size<Return::Size>() >= \
NativeType_<T, A>::Size), \
Return> \
simd_cast(NativeType_<T, A> x Vc_DUMMY_ARG2) \
{ \
vc_debug_("simd_cast{offset, R1::Zero}(", ")\n", offset, x); \
using R0 = typename Return::storage_type0; \
using R1 = typename Return::storage_type1; \
constexpr int entries_offset = offset * Return::Size; \
return {simd_cast_with_offset<R0, entries_offset>(x), R1::Zero()}; \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
Vc_SIMDARRAY_CASTS(SimdArray, Vc::Vector);
Vc_SIMDARRAY_CASTS(SimdMaskArray, Vc::Mask);
#undef Vc_SIMDARRAY_CASTS
// simd_cast<T>(xs...) from SimdArray/-mask {{{2
#define Vc_SIMDARRAY_CASTS(SimdArrayType_) \
/* indivisible SimdArrayType_ */ \
template <typename Return, typename T, std::size_t N, typename V, typename... From> \
Vc_INTRINSIC Vc_CONST \
enable_if<(are_all_types_equal<SimdArrayType_<T, N, V, N>, From...>::value && \
(sizeof...(From) == 0 || N * sizeof...(From) < Return::Size) && \
!std::is_same<Return, SimdArrayType_<T, N, V, N>>::value), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, N> &x0, const From &... xs) \
{ \
vc_debug_("simd_cast{indivisible}(", ")\n", x0, xs...); \
return simd_cast<Return>(internal_data(x0), internal_data(xs)...); \
} \
/* indivisible SimdArrayType_ && can drop arguments from the end */ \
template <typename Return, typename T, std::size_t N, typename V, typename... From> \
Vc_INTRINSIC Vc_CONST \
enable_if<(are_all_types_equal<SimdArrayType_<T, N, V, N>, From...>::value && \
(sizeof...(From) > 0 && (N * sizeof...(From) >= Return::Size)) && \
!std::is_same<Return, SimdArrayType_<T, N, V, N>>::value), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, N> &x0, const From &... xs) \
{ \
vc_debug_("simd_cast{indivisible2}(", ")\n", x0, xs...); \
return simd_cast_without_last<Return, \
typename SimdArrayType_<T, N, V, N>::storage_type, \
typename From::storage_type...>( \
internal_data(x0), internal_data(xs)...); \
} \
/* bisectable SimdArrayType_ (N = 2^n) && never too large */ \
template <typename Return, typename T, std::size_t N, typename V, std::size_t M, \
typename... From> \
Vc_INTRINSIC Vc_CONST enable_if< \
(N != M && are_all_types_equal<SimdArrayType_<T, N, V, M>, From...>::value && \
!std::is_same<Return, SimdArrayType_<T, N, V, M>>::value && \
is_less<N * sizeof...(From), Return::Size>::value && is_power_of_2<N>::value), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x0, const From &... xs) \
{ \
vc_debug_("simd_cast{bisectable}(", ")\n", x0, xs...); \
return simd_cast_interleaved_argument_order< \
Return, typename SimdArrayType_<T, N, V, M>::storage_type0, \
typename From::storage_type0...>(internal_data0(x0), internal_data0(xs)..., \
internal_data1(x0), internal_data1(xs)...); \
} \
/* bisectable SimdArrayType_ (N = 2^n) && input so large that at least the last \
* input can be dropped */ \
template <typename Return, typename T, std::size_t N, typename V, std::size_t M, \
typename... From> \
Vc_INTRINSIC Vc_CONST enable_if< \
(N != M && are_all_types_equal<SimdArrayType_<T, N, V, M>, From...>::value && \
!is_less<N * sizeof...(From), Return::Size>::value && is_power_of_2<N>::value), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x0, const From &... xs) \
{ \
vc_debug_("simd_cast{bisectable2}(", ")\n", x0, xs...); \
return simd_cast_without_last<Return, SimdArrayType_<T, N, V, M>, From...>( \
x0, xs...); \
} \
/* remaining SimdArrayType_ input never larger (N != 2^n) */ \
template <typename Return, typename T, std::size_t N, typename V, std::size_t M, \
typename... From> \
Vc_INTRINSIC Vc_CONST enable_if< \
(N != M && are_all_types_equal<SimdArrayType_<T, N, V, M>, From...>::value && \
N * (1 + sizeof...(From)) <= Return::Size && !is_power_of_2<N>::value), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x0, const From &... xs) \
{ \
vc_debug_("simd_cast{remaining}(", ")\n", x0, xs...); \
return simd_cast_impl_smaller_input<Return, N, SimdArrayType_<T, N, V, M>, \
From...>(x0, xs...); \
} \
/* remaining SimdArrayType_ input larger (N != 2^n) */ \
template <typename Return, typename T, std::size_t N, typename V, std::size_t M, \
typename... From> \
Vc_INTRINSIC Vc_CONST enable_if< \
(N != M && are_all_types_equal<SimdArrayType_<T, N, V, M>, From...>::value && \
N * (1 + sizeof...(From)) > Return::Size && !is_power_of_2<N>::value), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x0, const From &... xs) \
{ \
vc_debug_("simd_cast{remaining2}(", ")\n", x0, xs...); \
return simd_cast_impl_larger_input<Return, N, SimdArrayType_<T, N, V, M>, \
From...>(x0, xs...); \
} \
/* a single bisectable SimdArrayType_ (N = 2^n) too large */ \
template <typename Return, typename T, std::size_t N, typename V, std::size_t M> \
Vc_INTRINSIC Vc_CONST \
enable_if<(N != M && N >= 2 * Return::Size && is_power_of_2<N>::value), Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x) \
{ \
vc_debug_("simd_cast{single bisectable}(", ")\n", x); \
return simd_cast<Return>(internal_data0(x)); \
} \
template <typename Return, typename T, std::size_t N, typename V, std::size_t M> \
Vc_INTRINSIC Vc_CONST enable_if<(N != M && N > Return::Size && \
N < 2 * Return::Size && is_power_of_2<N>::value), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x) \
{ \
vc_debug_("simd_cast{single bisectable2}(", ")\n", x); \
return simd_cast<Return>(internal_data0(x), internal_data1(x)); \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
Vc_SIMDARRAY_CASTS(SimdArray);
Vc_SIMDARRAY_CASTS(SimdMaskArray);
#undef Vc_SIMDARRAY_CASTS
// simd_cast<T, offset>(SimdArray/-mask) {{{2
#define Vc_SIMDARRAY_CASTS(SimdArrayType_) \
/* offset == 0 is like without offset */ \
template <typename Return, int offset, typename T, std::size_t N, typename V, \
std::size_t M> \
Vc_INTRINSIC Vc_CONST enable_if<(offset == 0), Return> simd_cast( \
const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG0) \
{ \
vc_debug_("simd_cast{offset == 0}(", ")\n", offset, x); \
return simd_cast<Return>(x); \
} \
/* forward to V */ \
template <typename Return, int offset, typename T, std::size_t N, typename V> \
Vc_INTRINSIC Vc_CONST enable_if<(offset != 0), Return> simd_cast( \
const SimdArrayType_<T, N, V, N> &x Vc_DUMMY_ARG1) \
{ \
vc_debug_("simd_cast{offset, forward}(", ")\n", offset, x); \
return simd_cast<Return, offset>(internal_data(x)); \
} \
/* convert from right member of SimdArray */ \
template <typename Return, int offset, typename T, std::size_t N, typename V, \
std::size_t M> \
Vc_INTRINSIC Vc_CONST \
enable_if<(N != M && offset * Return::Size >= Common::left_size<N>() && \
offset != 0 && Common::left_size<N>() % Return::Size == 0), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG2) \
{ \
vc_debug_("simd_cast{offset, right}(", ")\n", offset, x); \
return simd_cast<Return, offset - Common::left_size<N>() / Return::Size>( \
internal_data1(x)); \
} \
/* same as above except for odd cases where offset * Return::Size doesn't fit the \
* left side of the SimdArray */ \
template <typename Return, int offset, typename T, std::size_t N, typename V, \
std::size_t M> \
Vc_INTRINSIC Vc_CONST \
enable_if<(N != M && offset * Return::Size >= Common::left_size<N>() && \
offset != 0 && Common::left_size<N>() % Return::Size != 0), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG3) \
{ \
vc_debug_("simd_cast{offset, right, nofit}(", ")\n", offset, x); \
return simd_cast_with_offset<Return, \
offset * Return::Size - Common::left_size<N>()>( \
internal_data1(x)); \
} \
/* convert from left member of SimdArray */ \
template <typename Return, int offset, typename T, std::size_t N, typename V, \
std::size_t M> \
Vc_INTRINSIC Vc_CONST enable_if< \
(N != M && /*offset * Return::Size < Common::left_size<N>() &&*/ \
offset != 0 && (offset + 1) * Return::Size <= Common::left_size<N>()), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG4) \
{ \
vc_debug_("simd_cast{offset, left}(", ")\n", offset, x); \
return simd_cast<Return, offset>(internal_data0(x)); \
} \
/* fallback to copying scalars */ \
template <typename Return, int offset, typename T, std::size_t N, typename V, \
std::size_t M> \
Vc_INTRINSIC Vc_CONST \
enable_if<(N != M && (offset * Return::Size < Common::left_size<N>()) && \
offset != 0 && (offset + 1) * Return::Size > Common::left_size<N>()), \
Return> \
simd_cast(const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG5) \
{ \
vc_debug_("simd_cast{offset, copy scalars}(", ")\n", offset, x); \
using R = typename Return::EntryType; \
Return r = Return::Zero(); \
for (std::size_t i = offset * Return::Size; \
i < std::min(N, (offset + 1) * Return::Size); ++i) { \
r[i - offset * Return::Size] = static_cast<R>(x[i]); \
} \
return r; \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
Vc_SIMDARRAY_CASTS(SimdArray);
Vc_SIMDARRAY_CASTS(SimdMaskArray);
#undef Vc_SIMDARRAY_CASTS
// simd_cast_drop_arguments (definitions) {{{2
template <typename Return, typename From>
Vc_INTRINSIC Vc_CONST Return simd_cast_drop_arguments(From x)
{
return simd_cast<Return>(x);
}
template <typename Return, typename... Froms>
Vc_INTRINSIC Vc_CONST
enable_if<(are_all_types_equal<Froms...>::value &&
sizeof...(Froms) * first_type_of<Froms...>::Size < Return::Size),
Return>
simd_cast_drop_arguments(Froms... xs, first_type_of<Froms...> x)
{
return simd_cast<Return>(xs..., x);
}
// The following function can be implemented without the sizeof...(From) overload.
// However, ICC has a bug (Premier Issue #6000116338) which leads to an ICE. Splitting the
// function in two works around the issue.
template <typename Return, typename From, typename... Froms>
Vc_INTRINSIC Vc_CONST enable_if<
(are_all_types_equal<From, Froms...>::value &&
(1 + sizeof...(Froms)) * From::Size >= Return::Size && sizeof...(Froms) != 0),
Return>
simd_cast_drop_arguments(Froms... xs, From x, From)
{
return simd_cast_drop_arguments<Return, Froms...>(xs..., x);
}
template <typename Return, typename From>
Vc_INTRINSIC Vc_CONST
enable_if<(are_all_types_equal<From>::value && From::Size >= Return::Size), Return>
simd_cast_drop_arguments(From x, From)
{
return simd_cast_drop_arguments<Return>(x);
}
// simd_cast_with_offset (definitions) {{{2
template <typename Return, std::size_t offset, typename From>
Vc_INTRINSIC Vc_CONST
enable_if<(From::Size > offset && offset > 0 && offset % Return::Size == 0),
Return> simd_cast_with_offset(const From &x)
{
return simd_cast<Return, offset / Return::Size>(x);
}
template <typename Return, std::size_t offset, typename From>
Vc_INTRINSIC Vc_CONST
enable_if<(From::Size > offset && offset > 0 && offset % Return::Size != 0 &&
((Traits::isSimdArray<Return>::value &&
!Traits::isAtomicSimdArray<Return>::value) ||
(Traits::isSimdMaskArray<Return>::value &&
!Traits::isAtomicSimdMaskArray<Return>::value))),
Return>
simd_cast_with_offset(const From &x)
{
using R0 = typename Return::storage_type0;
using R1 = typename Return::storage_type1;
return {simd_cast_with_offset<R0, offset>(x),
simd_cast_with_offset<R1, offset + R0::Size>(x)};
}
template <typename Return, std::size_t offset, typename From>
Vc_INTRINSIC Vc_CONST
enable_if<(From::Size > offset && offset > 0 && offset % Return::Size != 0 &&
((Traits::isSimdArray<Return>::value &&
Traits::isAtomicSimdArray<Return>::value) ||
(Traits::isSimdMaskArray<Return>::value &&
Traits::isAtomicSimdMaskArray<Return>::value))),
Return>
simd_cast_with_offset(const From &x)
{
return simd_cast<Return, offset / Return::Size>(x.shifted(offset % Return::Size));
}
template <typename Return, std::size_t offset, typename From, typename... Froms>
Vc_INTRINSIC Vc_CONST
enable_if<(are_all_types_equal<From, Froms...>::value && offset == 0), Return>
simd_cast_with_offset(const From &x, const Froms &... xs)
{
return simd_cast<Return>(x, xs...);
}
// simd_cast_without_last (definition) {{{2
template <typename Return, typename T, typename... From>
Vc_INTRINSIC Vc_CONST Return simd_cast_without_last(const From &... xs, const T &)
{
return simd_cast<Return>(xs...);
}
// simd_cast_interleaved_argument_order (definitions) {{{2
#ifdef Vc_MSVC
// MSVC doesn't see that the Ts pack below can be empty and thus complains when extract_interleaved
// is called with only 2 arguments. These overloads here are *INCORRECT standard C++*, but they make
// MSVC do the right thing.
template <std::size_t I, typename T0>
Vc_INTRINSIC Vc_CONST enable_if<(I == 0), T0> extract_interleaved(const T0 &a0, const T0 &)
{
return a0;
}
template <std::size_t I, typename T0>
Vc_INTRINSIC Vc_CONST enable_if<(I == 1), T0> extract_interleaved(const T0 &, const T0 &b0)
{
return b0;
}
#endif // Vc_MSVC
/// \internal returns the first argument
template <std::size_t I, typename T0, typename... Ts>
Vc_INTRINSIC Vc_CONST enable_if<(I == 0), T0> extract_interleaved(const T0 &a0,
const Ts &...,
const T0 &,
const Ts &...)
{
return a0;
}
/// \internal returns the center argument
template <std::size_t I, typename T0, typename... Ts>
Vc_INTRINSIC Vc_CONST enable_if<(I == 1), T0> extract_interleaved(const T0 &,
const Ts &...,
const T0 &b0,
const Ts &...)
{
return b0;
}
/// \internal drops the first and center arguments and recurses
template <std::size_t I, typename T0, typename... Ts>
Vc_INTRINSIC Vc_CONST enable_if<(I > 1), T0> extract_interleaved(const T0 &,
const Ts &... a,
const T0 &,
const Ts &... b)
{
return extract_interleaved<I - 2, Ts...>(a..., b...);
}
/// \internal calls simd_cast with correct argument order thanks to extract_interleaved
template <typename Return, typename... Ts, std::size_t... Indexes>
Vc_INTRINSIC Vc_CONST Return
simd_cast_interleaved_argument_order_1(index_sequence<Indexes...>, const Ts &... a,
const Ts &... b)
{
return simd_cast<Return>(extract_interleaved<Indexes, Ts...>(a..., b...)...);
}
/// \internal constructs the necessary index_sequence to pass it to
/// simd_cast_interleaved_argument_order_1
template <typename Return, typename... Ts>
Vc_INTRINSIC Vc_CONST Return
simd_cast_interleaved_argument_order(const Ts &... a, const Ts &... b)
{
using seq = make_index_sequence<sizeof...(Ts)*2>;
return simd_cast_interleaved_argument_order_1<Return, Ts...>(seq(), a..., b...);
}
// conditional_assign {{{1
#define Vc_CONDITIONAL_ASSIGN(name_, op_) \
template <Operator O, typename T, std::size_t N, typename V, size_t VN, typename M, \
typename U> \
Vc_INTRINSIC enable_if<O == Operator::name_, void> conditional_assign( \
SimdArray<T, N, V, VN> &lhs, M &&mask, U &&rhs) \
{ \
lhs(mask) op_ rhs; \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
Vc_CONDITIONAL_ASSIGN( Assign, =);
Vc_CONDITIONAL_ASSIGN( PlusAssign, +=);
Vc_CONDITIONAL_ASSIGN( MinusAssign, -=);
Vc_CONDITIONAL_ASSIGN( MultiplyAssign, *=);
Vc_CONDITIONAL_ASSIGN( DivideAssign, /=);
Vc_CONDITIONAL_ASSIGN( RemainderAssign, %=);
Vc_CONDITIONAL_ASSIGN( XorAssign, ^=);
Vc_CONDITIONAL_ASSIGN( AndAssign, &=);
Vc_CONDITIONAL_ASSIGN( OrAssign, |=);
Vc_CONDITIONAL_ASSIGN( LeftShiftAssign,<<=);
Vc_CONDITIONAL_ASSIGN(RightShiftAssign,>>=);
#undef Vc_CONDITIONAL_ASSIGN
#define Vc_CONDITIONAL_ASSIGN(name_, expr_) \
template <Operator O, typename T, std::size_t N, typename V, size_t VN, typename M> \
Vc_INTRINSIC enable_if<O == Operator::name_, SimdArray<T, N, V, VN>> \
conditional_assign(SimdArray<T, N, V, VN> &lhs, M &&mask) \
{ \
return expr_; \
} \
Vc_NOTHING_EXPECTING_SEMICOLON
Vc_CONDITIONAL_ASSIGN(PostIncrement, lhs(mask)++);
Vc_CONDITIONAL_ASSIGN( PreIncrement, ++lhs(mask));
Vc_CONDITIONAL_ASSIGN(PostDecrement, lhs(mask)--);
Vc_CONDITIONAL_ASSIGN( PreDecrement, --lhs(mask));
#undef Vc_CONDITIONAL_ASSIGN
// transpose_impl {{{1
namespace Common
{
template <typename T, size_t N, typename V>
inline void transpose_impl(
TransposeTag<4, 4>, SimdArray<T, N, V, N> *Vc_RESTRICT r[],
const TransposeProxy<SimdArray<T, N, V, N>, SimdArray<T, N, V, N>,
SimdArray<T, N, V, N>, SimdArray<T, N, V, N>> &proxy)
{
V *Vc_RESTRICT r2[4] = {&internal_data(*r[0]), &internal_data(*r[1]),
&internal_data(*r[2]), &internal_data(*r[3])};
transpose_impl(TransposeTag<4, 4>(), &r2[0],
TransposeProxy<V, V, V, V>{internal_data(std::get<0>(proxy.in)),
internal_data(std::get<1>(proxy.in)),
internal_data(std::get<2>(proxy.in)),
internal_data(std::get<3>(proxy.in))});
}
template <typename T, typename V>
inline void transpose_impl(
TransposeTag<2, 4>, SimdArray<T, 4, V, 1> *Vc_RESTRICT r[],
const TransposeProxy<SimdArray<T, 2, V, 1>, SimdArray<T, 2, V, 1>,
SimdArray<T, 2, V, 1>, SimdArray<T, 2, V, 1>> &proxy)
{
auto &lo = *r[0];
auto &hi = *r[1];
internal_data0(internal_data0(lo)) = internal_data0(std::get<0>(proxy.in));
internal_data1(internal_data0(lo)) = internal_data0(std::get<1>(proxy.in));
internal_data0(internal_data1(lo)) = internal_data0(std::get<2>(proxy.in));
internal_data1(internal_data1(lo)) = internal_data0(std::get<3>(proxy.in));
internal_data0(internal_data0(hi)) = internal_data1(std::get<0>(proxy.in));
internal_data1(internal_data0(hi)) = internal_data1(std::get<1>(proxy.in));
internal_data0(internal_data1(hi)) = internal_data1(std::get<2>(proxy.in));
internal_data1(internal_data1(hi)) = internal_data1(std::get<3>(proxy.in));
}
template <typename T, typename V>
inline void transpose_impl(
TransposeTag<4, 4>, SimdArray<T, 1, V, 1> *Vc_RESTRICT r[],
const TransposeProxy<SimdArray<T, 1, V, 1>, SimdArray<T, 1, V, 1>,
SimdArray<T, 1, V, 1>, SimdArray<T, 1, V, 1>> &proxy)
{
V *Vc_RESTRICT r2[4] = {&internal_data(*r[0]), &internal_data(*r[1]),
&internal_data(*r[2]), &internal_data(*r[3])};
transpose_impl(TransposeTag<4, 4>(), &r2[0],
TransposeProxy<V, V, V, V>{internal_data(std::get<0>(proxy.in)),
internal_data(std::get<1>(proxy.in)),
internal_data(std::get<2>(proxy.in)),
internal_data(std::get<3>(proxy.in))});
}
template <typename T, size_t N, typename V>
inline void transpose_impl(
TransposeTag<4, 4>, SimdArray<T, N, V, 1> *Vc_RESTRICT r[],
const TransposeProxy<SimdArray<T, N, V, 1>, SimdArray<T, N, V, 1>,
SimdArray<T, N, V, 1>, SimdArray<T, N, V, 1>> &proxy)
{
SimdArray<T, N, V, 1> *Vc_RESTRICT r0[4 / 2] = {r[0], r[1]};
SimdArray<T, N, V, 1> *Vc_RESTRICT r1[4 / 2] = {r[2], r[3]};
using H = SimdArray<T, 2>;
transpose_impl(TransposeTag<2, 4>(), &r0[0],
TransposeProxy<H, H, H, H>{internal_data0(std::get<0>(proxy.in)),
internal_data0(std::get<1>(proxy.in)),
internal_data0(std::get<2>(proxy.in)),
internal_data0(std::get<3>(proxy.in))});
transpose_impl(TransposeTag<2, 4>(), &r1[0],
TransposeProxy<H, H, H, H>{internal_data1(std::get<0>(proxy.in)),
internal_data1(std::get<1>(proxy.in)),
internal_data1(std::get<2>(proxy.in)),
internal_data1(std::get<3>(proxy.in))});
}
/* TODO:
template <typename T, std::size_t N, typename V, std::size_t VSize>
inline enable_if<(N > VSize), void> transpose_impl(
std::array<SimdArray<T, N, V, VSize> * Vc_RESTRICT, 4> & r,
const TransposeProxy<SimdArray<T, N, V, VSize>, SimdArray<T, N, V, VSize>,
SimdArray<T, N, V, VSize>, SimdArray<T, N, V, VSize>> &proxy)
{
typedef SimdArray<T, N, V, VSize> SA;
std::array<typename SA::storage_type0 * Vc_RESTRICT, 4> r0 = {
{&internal_data0(*r[0]), &internal_data0(*r[1]), &internal_data0(*r[2]),
&internal_data0(*r[3])}};
transpose_impl(
r0, TransposeProxy<typename SA::storage_type0, typename SA::storage_type0,
typename SA::storage_type0, typename SA::storage_type0>{
internal_data0(std::get<0>(proxy.in)),
internal_data0(std::get<1>(proxy.in)),
internal_data0(std::get<2>(proxy.in)),
internal_data0(std::get<3>(proxy.in))});
std::array<typename SA::storage_type1 * Vc_RESTRICT, 4> r1 = {
{&internal_data1(*r[0]), &internal_data1(*r[1]), &internal_data1(*r[2]),
&internal_data1(*r[3])}};
transpose_impl(
r1, TransposeProxy<typename SA::storage_type1, typename SA::storage_type1,
typename SA::storage_type1, typename SA::storage_type1>{
internal_data1(std::get<0>(proxy.in)),
internal_data1(std::get<1>(proxy.in)),
internal_data1(std::get<2>(proxy.in)),
internal_data1(std::get<3>(proxy.in))});
}
*/
} // namespace Common
// Traits static assertions {{{1
static_assert(Traits::has_no_allocated_data<const volatile Vc::SimdArray<int, 4> &>::value, "");
static_assert(Traits::has_no_allocated_data<const volatile Vc::SimdArray<int, 4>>::value, "");
static_assert(Traits::has_no_allocated_data<volatile Vc::SimdArray<int, 4> &>::value, "");
static_assert(Traits::has_no_allocated_data<volatile Vc::SimdArray<int, 4>>::value, "");
static_assert(Traits::has_no_allocated_data<const Vc::SimdArray<int, 4> &>::value, "");
static_assert(Traits::has_no_allocated_data<const Vc::SimdArray<int, 4>>::value, "");
static_assert(Traits::has_no_allocated_data<Vc::SimdArray<int, 4>>::value, "");
static_assert(Traits::has_no_allocated_data<Vc::SimdArray<int, 4> &&>::value, "");
// }}}1
/// @}
} // namespace Vc_VERSIONED_NAMESPACE
// numeric_limits {{{1
namespace std
{
template <typename T, size_t N, typename V, size_t VN>
struct numeric_limits<Vc::SimdArray<T, N, V, VN>> : public numeric_limits<T> {
private:
using R = Vc::SimdArray<T, N, V, VN>;
public:
static Vc_ALWAYS_INLINE Vc_CONST R max() noexcept { return numeric_limits<T>::max(); }
static Vc_ALWAYS_INLINE Vc_CONST R min() noexcept { return numeric_limits<T>::min(); }
static Vc_ALWAYS_INLINE Vc_CONST R lowest() noexcept
{
return numeric_limits<T>::lowest();
}
static Vc_ALWAYS_INLINE Vc_CONST R epsilon() noexcept
{
return numeric_limits<T>::epsilon();
}
static Vc_ALWAYS_INLINE Vc_CONST R round_error() noexcept
{
return numeric_limits<T>::round_error();
}
static Vc_ALWAYS_INLINE Vc_CONST R infinity() noexcept
{
return numeric_limits<T>::infinity();
}
static Vc_ALWAYS_INLINE Vc_CONST R quiet_NaN() noexcept
{
return numeric_limits<T>::quiet_NaN();
}
static Vc_ALWAYS_INLINE Vc_CONST R signaling_NaN() noexcept
{
return numeric_limits<T>::signaling_NaN();
}
static Vc_ALWAYS_INLINE Vc_CONST R denorm_min() noexcept
{
return numeric_limits<T>::denorm_min();
}
};
} // namespace std
//}}}1
#endif // VC_COMMON_SIMDARRAY_H_
// vim: foldmethod=marker
| [
"thomaskrause@posteo.de"
] | thomaskrause@posteo.de |
5293ee5752f8590a7980f8783c8fb5cd618e2c70 | 306185841be99d22c5b778776c77d4cb0b36d708 | /Castlevania/CastleVania/Ghost.h | 0633619c6ca7d054769536aff766fdb36e2223a7 | [] | no_license | trungnguyen1618033/Castlevania-SE102 | 02f72d4d318cfc4dded7f45181e0ceada7a062b2 | d0f47b1469522ebaa8cc0586a50da3f15f8507d3 | refs/heads/master | 2021-05-18T11:18:36.388145 | 2020-11-24T08:45:53 | 2020-11-24T08:45:53 | 251,223,496 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 497 | h | #pragma once
#include "Enemy.h"
class Ghost : public Enemy
{
float velocityVariation;
public:
Ghost();
virtual void Update(DWORD dt, vector<LPGAMEOBJECT>* coObjects = NULL, bool stopMoving = false);
virtual void Render();
virtual void SetState(int state);
virtual void GetBoundingBox(float& left, float& top, float& right, float& bottom);
virtual void GetActiveBoundingBox(float& left, float& top, float& right, float& bottom);
virtual void LoseHP(int x);
void GetOrientation();
};
| [
"trungnguyen1618033@gmail.com"
] | trungnguyen1618033@gmail.com |
80fb6d88fead38e92bfe9efcddbd34a9a89683d9 | 3a3b58b0161ae6ea298f9886716b03fb3e7cfc35 | /src_203308508/src/list/list_destructor.h | 9726aab47ba12ee572f08d9aebe1f5437a30f3a8 | [] | no_license | tantantzp/datastructure | cc052c6434e9be051a273848342e6fcd11e129af | 8d4ade4b6c91a8738d78e1442ff2fb534a814067 | refs/heads/master | 2021-01-01T17:16:41.662236 | 2015-07-04T08:25:29 | 2015-07-04T08:25:29 | 38,527,341 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 556 | h | /******************************************************************************************
* Data Structures in C++
* ISBN: 7-302-26883-3 & 7-302-29652-2
* Junhui DENG, deng@tsinghua.edu.cn
* Computer Science & Technology, Tsinghua University
* Copyright (c) 2011. All rights reserved.
******************************************************************************************/
#pragma once
template <typename T> List<T>::~List() //列表析构器
{ clear(); delete header; delete trailer; } //清空列表,释放头、尾哨兵节点 | [
"610082896@qq.com"
] | 610082896@qq.com |
077fd37305801d62c1f91ffdf3df0101cf23bd06 | 12f3796320dc22072df6c6ae43445fd44a9057b4 | /GeometryLib/PointSet.cpp | f566a33e1c08133ef724f4333d62a133421238f7 | [] | no_license | Aloalo/GeometryLib | fc782a1d2398eccf37407aa430c40420d9a69326 | 4e1fcb229fe81d93539eaa76d51fb32805f1bf07 | refs/heads/master | 2020-12-25T06:12:57.170362 | 2013-03-12T09:42:20 | 2013-03-12T09:42:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 113 | cpp | #include "StdAfx.h"
#include "PointSet.h"
PointSet::PointSet(void)
{
}
PointSet::~PointSet(void)
{
}
| [
"tomislavtunkovic@gmail.com"
] | tomislavtunkovic@gmail.com |
63e783d095d6aeadd2f762b7b6e2a5fc1fcf71cd | 4b998f10386144b7e6059d101c3c8c9e33ec7628 | /parallel programming lab/ucs545Ass1Q4parallel.cpp | f62d71bbdf72384e5fb5d5b9b5785c0c8d264cda | [] | no_license | Kulpreet-Singh/Advanced_algos_c-plus-plus | bba1c9ef2d9d029c11c4a2d2ad82063167a9e2c5 | 501e0a3b7835540c9ceeb8fc37ba9199a4afb147 | refs/heads/main | 2023-06-26T14:00:47.058191 | 2021-07-30T17:22:10 | 2021-07-30T17:22:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,727 | cpp | #include <iostream>
#include <fstream>
#include <cmath>
#include<omp.h>
using namespace std;
int main()
{
ifstream temp;
temp.open("Database.txt");
const int m = 100;
int** matrixA = new int* [m];
int** matrixB = new int* [m];
int** Answer = new int* [m];
for (int i = 0; i < m; ++i)
{
matrixA[i] = new int[100];
matrixB[i] = new int[100];
Answer[i] = new int[100];
}
#pragma omp parallel for
for (int i = 0; i < m; ++i)
{
for (int j = 0; j < m; ++j)
{
matrixA[i][j] = 0;
matrixB[i][j] = 0;
Answer[i][j] = 0;
}
}
int a, r1 = 0, c1 = 0, r2 = 0, c2 = 0;
cout << "What operation would you like to perform?\n1.Addition of Matrices\n2.Multipication of Matices\n3.Multiplication of a Vector and Matrix" << endl;
cin >> a;
switch (a)
{
case 1: cout << "Enter no. of rows followed by columns(upto 100):" << endl;
cin >> r1 >> c1;
r2 = r1;
c2 = c1;
#pragma omp parallel for
for (int i = 0; i < r1; ++i)
{
for (int j = 0; j < c1; ++j)
{
temp >> matrixA[i][j];
cout << matrixA[i][j] << " ";
}
cout << "\n";
}
cout << "\n";
#pragma omp parallel for
for (int i = 0; i < r2; ++i)
{
for (int j = 0; j < c2; ++j)
{
temp >> matrixB[i][j];
cout << matrixB[i][j] << " ";
}
cout << "\n";
}
cout << "\n";
#pragma omp parallel for
for (int i = 0; i < r1; ++i)
{
for (int j = 0; j < c1; ++j)
{
Answer[i][j] = matrixA[i][j]+matrixB[i][j];
cout << Answer[i][j] << " ";
}
cout << "\n";
}
break;
case 2: cout << "Enter no. of rows(Matrix A)(upto 100) followed by columns(Matrix A)(upto 100) followed by columns(Matrix B)(upto 100):" << endl;
cin >> r1 >> c1 >> c2;
r2 = c1;
#pragma omp parallel for
for (int i = 0; i < r1; ++i)
{
for (int j = 0; j < c1; ++j)
{
temp >> matrixA[i][j];
cout << matrixA[i][j] << " ";
}
cout << "\n";
}
cout << "\n";
#pragma omp parallel for
for (int i = 0; i < r2; ++i)
{
for (int j = 0; j < c2; ++j)
{
temp >> matrixB[i][j];
cout << matrixB[i][j] << " ";
}
cout << "\n";
}
cout << "\n";
#pragma omp parallel for
for (int i = 0; i < r1; ++i)
{
for (int j = 0; j < c2; ++j)
{
for (int k = 0; k < r2; ++k)
{
Answer[i][j] += matrixA[i][k] * matrixB[k][j];
}
cout << Answer[i][j] << " ";
}
cout << "\n";
}
break;
case 3: cout << "Vector into Matrix(enter 1) or Matrix into Vector(enter 2)?" << endl;
int b;
cin >> b;
if (b == 1)
{
cout << "Enter dimensions of the matrix(rows followed by columns):" << endl;
cin >> r2 >> c2;
r1 = 1;
c1 = r2;
}
else if (b == 2)
{
cout << "Enter dimensions of the matrix(rows followed by columns):" << endl;
cin >> r1 >> c1;
r2 = c1;
c2 = 1;
}
else {
cout << "Invalid input!" << endl;
break;
}
#pragma omp parallel for
for (int i = 0; i < r1; ++i)
{
for (int j = 0; j < c1; ++j)
{
temp >> matrixA[i][j];
cout << matrixA[i][j] << " ";
}
cout << "\n";
}
cout << "\n";
#pragma omp parallel for
for (int i = 0; i < r2; ++i)
{
for (int j = 0; j < c2; ++j)
{
temp >> matrixB[i][j];
cout << matrixB[i][j] << " ";
}
cout << "\n";
}
cout << "\n";
#pragma omp parallel for
for (int i = 0; i < r1; ++i)
{
for (int j = 0; j < c2; ++j)
{
for (int k = 0; k < r2; ++k)
{
Answer[i][j] += matrixA[i][k] * matrixB[k][j];
}
cout << Answer[i][j] << " ";
}
cout << "\n";
}
break;
default: cout << "Invalid Input!" << endl;
break;
}
temp.close();
return 0;
}
| [
"43897531+Kulpreet-Singh@users.noreply.github.com"
] | 43897531+Kulpreet-Singh@users.noreply.github.com |
701b4425daa5ac0750d499f13c7121e5b515e7d9 | 27946ae56de6ce7c61e2e891a0b4427cec746406 | /libs/intrusive/example/doc_unordered_set.cpp | fc3403fd98ac88f367fab15ed70f8c532297c653 | [
"BSL-1.0"
] | permissive | alexanderkjeldaas/boost-mirror | 15994a75295926cb975b6cb27b9f472237fc52ae | 1b626831ef9060f49b3197583e7f80445b19a862 | refs/heads/master | 2021-01-10T20:05:39.378833 | 2013-05-11T22:38:36 | 2013-05-11T22:38:36 | 8,898,120 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,992 | cpp | /////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2006-2012
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/intrusive for documentation.
//
/////////////////////////////////////////////////////////////////////////////
//[doc_unordered_set_code
#include <boost/intrusive/unordered_set.hpp>
#include <vector>
#include <algorithm>
#include <boost/functional/hash.hpp>
using namespace boost::intrusive;
class MyClass : public unordered_set_base_hook<>
{ //This is a derivation hook
int int_;
public:
unordered_set_member_hook<> member_hook_; //This is a member hook
MyClass(int i)
: int_(i)
{}
friend bool operator== (const MyClass &a, const MyClass &b)
{ return a.int_ == b.int_; }
friend std::size_t hash_value(const MyClass &value)
{ return std::size_t(value.int_); }
};
//Define an unordered_set that will store MyClass objects using the base hook
typedef unordered_set<MyClass> BaseSet;
//Define an unordered_multiset that will store MyClass using the member hook
typedef member_hook<MyClass, unordered_set_member_hook<>, &MyClass::member_hook_>
MemberOption;
typedef unordered_multiset< MyClass, MemberOption> MemberMultiSet;
int main()
{
typedef std::vector<MyClass>::iterator VectIt;
typedef std::vector<MyClass>::reverse_iterator VectRit;
//Create a vector with 100 different MyClass objects
std::vector<MyClass> values;
for(int i = 0; i < 100; ++i) values.push_back(MyClass(i));
//Create a copy of the vector
std::vector<MyClass> values2(values);
//Create a bucket array for base_set
BaseSet::bucket_type base_buckets[100];
//Create a bucket array for member_multi_set
MemberMultiSet::bucket_type member_buckets[200];
//Create unordered containers taking buckets as arguments
BaseSet base_set(BaseSet::bucket_traits(base_buckets, 100));
MemberMultiSet member_multi_set
(MemberMultiSet::bucket_traits(member_buckets, 200));
//Now insert values's elements in the unordered_set
for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it)
base_set.insert(*it);
//Now insert values's and values2's elements in the unordered_multiset
for(VectIt it(values.begin()), itend(values.end()), it2(values2.begin())
; it != itend; ++it, ++it2){
member_multi_set.insert(*it);
member_multi_set.insert(*it2);
}
//Now find every element
{
VectIt it(values.begin()), itend(values.end());
for(; it != itend; ++it){
//base_set should contain one element for each key
if(base_set.count(*it) != 1) return 1;
//member_multi_set should contain two elements for each key
if(member_multi_set.count(*it) != 2) return 1;
}
}
return 0;
}
//]
| [
"igaztanaga@b8fc166d-592f-0410-95f2-cb63ce0dd405"
] | igaztanaga@b8fc166d-592f-0410-95f2-cb63ce0dd405 |
80de98f96fb680a1ccba049147217bc084bb74da | 0df64eb6236326ae39ec8027da22a87aa4e9b36d | /Week_03/atan2_experiment/src/ofApp.cpp | 8c890d9178b459b617e3f284fde1395f756a39de | [] | no_license | bachadam/ARTTECH-3039 | d9f6d6e879b34fa8a1b69ff80e540502d058c2d5 | 5facc80f156d1fbf13032ac59cd355ea559be1b5 | refs/heads/master | 2021-01-23T08:20:51.080184 | 2017-03-28T20:04:00 | 2017-03-28T20:04:00 | 86,501,270 | 0 | 0 | null | 2017-03-28T19:53:37 | 2017-03-28T19:53:37 | null | UTF-8 | C++ | false | false | 581 | cpp | #include "ofApp.h"
void ofApp::draw()
{
ofBackground(0);
glm::vec2 mousePosition(ofGetMouseX(), ofGetMouseY());
glm::vec2 screenCenter(ofGetWidth() / 2, ofGetHeight() / 2);
glm::vec2 diff = mousePosition - screenCenter;
float angle = std::atan2(diff.y, diff.x);
float distance = glm::distance(mousePosition, screenCenter);
float h = 10;
glm::vec2 t0(0, h);
glm::vec2 t1(0, -h);
glm::vec2 t2(distance, 0);
ofPushMatrix();
ofTranslate(screenCenter);
ofRotateRad(angle);
ofDrawTriangle(t0, t1, t2);
ofPopMatrix();
}
| [
"me@christopherbaker.net"
] | me@christopherbaker.net |
fcef9295c8b226bd62b2194dc32c8afec957eaa3 | 1844d045437e540d0e7521b32d0b4265996d1fec | /tests/test.cpp | e81731df34572105e43a927dd4802dac380f21a9 | [] | no_license | sikomo/cpp | f4780552bd39634e9f0f7e6a02dd21b8b8096a47 | 43f129b2ac2471985bdef0a884d33946737a77be | refs/heads/master | 2020-04-04T14:43:25.830007 | 2019-02-09T17:31:16 | 2019-02-09T17:31:16 | 156,009,837 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 743 | cpp | #include <iostream>
using namespace std;
class B {
public:
B(int v) : varB(v){
};
int varB;
};
class A {
public:
A(int v, B *bb) : var(v), b(bb){
};
int var;
B *b;
};
int main(int argc, char const *argv[]) {
B objetB(200);
A objetA(10, &objetB);
A autreObjetA = objetA;
cout << objetA.b->varB << endl;
cout << autreObjetA.b->varB << endl;
objetB.varB = 50;
cout << objetA.b->varB << endl;
cout << autreObjetA.b->varB << endl;
cout << &objetA<<endl;
A *p = &objetA ;
cout << (*p).b->varB << endl;
B *q = &objetB;
cout << (*q).varB << endl;
(*q).varB = 80;
cout << (*p).b->varB << endl;
return 0;
}
| [
"komodu59@gmail.com"
] | komodu59@gmail.com |
cd931481edae32a870681b85f199e6acbc18732b | d2190cbb5ea5463410eb84ec8b4c6a660e4b3d0e | /old_hydra/hydra/trunk/pairs/ntuple/pairs.h | e3bfbf968412859643f70143f323ba26bc51a7cf | [] | no_license | wesmail/hydra | 6c681572ff6db2c60c9e36ec864a3c0e83e6aa6a | ab934d4c7eff335cc2d25f212034121f050aadf1 | refs/heads/master | 2021-07-05T17:04:53.402387 | 2020-08-12T08:54:11 | 2020-08-12T08:54:11 | 149,625,232 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,835 | h | // $Id: pairs.h,v 1.13 2008-09-18 13:06:49 halo Exp $
// Author: Thomas.Eberl@ph.tum.de, last modified : 2006-12-11 18:23:39
//
#ifndef pairs_h
#define pairs_h
#ifdef SIMULATION
#define pairs pairsS
#else // ! SIMULATION
#define pairs pairsE
#endif // ! SIMULATION
#include "TROOT.h"
#include "TChain.h"
#include "TFile.h"
#include "TObjArray.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TH3F.h"
#include "TArrayI.h"
///////////////////////////////////////////////////////////////////////////////
// CUT FLAG DEFINITIONS - PAIR FRAMEWORK - 25052005
///////////////////////////////////////////////////////////////////////////////
// isCutNb==0 : isGoodOpang==1 && isNotDoubleHit==1 && all tracks removed
// isCutNb!=0 : all removed pairs, by direct cuts and track removing
// isCutNb==1 : isGoodOpang!=1 || isNotDoubleHit!=1, direct cut pairs
// isCutNb!=1 : isGoodOpang==1 && isNotDoubleHit==1
// isCutNb==2 : pairs removed by track removing due to opening angle cut
// isCutNb!=2 : all pairs except for isCutNb==2
// isCutNb==3 : pairs removed by track removing due to nodoublehit cut
// isCutNb!=3 : all pairs except for isCutNb==3
// isCutNb==10: pairs removed by track removing due to opang and nodouble cut
// isCutNb!=10: all pairs except for isCutNb==10
///////////////////////////////////////////////////////////////////////////////
#define EFF_OFFSET 13 // beginning of efficiency corrected histograms
#define MAXCUT EFF_OFFSET*2 // 2nd half is with efficiency correction
#define MAXPOL 3 // pair polarity [0] = -2, [1] = 0, [2] = 2
#define MAXMINVBINS 3 // m_inv < 150.; 150. < m_inv < 600. ; 600 < m_inv
#ifdef SIMULATION
#define MAXPAIR 12 // [0]=all pairs, rest mode dependent
// OLD:
// [1]=pi0, [2]=conv,
// [3]=eta,[4]=delta,[5]=rho,[6]=omega dal.,[7]=omega dir
#endif // SIMULATION
class pairs {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
Int_t fCurrent; //!current Tree number in a TChain
// Declaration of leave types
Float_t invmass;
Float_t opang;
Float_t rap;
Float_t pt;
Float_t charge;
Float_t isCutNb;
Float_t idxPart1;
Float_t idxPart2;
Float_t prob1;
Float_t prob2;
Float_t pid1;
Float_t pid2;
Float_t idxpidcand1;
Float_t sys1;
Float_t r1;
Float_t z1;
Float_t massexp1;
Float_t betaexp1;
Float_t momalgidx1;
Float_t chrg1;
Float_t mostprobpid1;
Float_t weightmostprobpid1;
Float_t theta1;
Float_t phi1;
Float_t sec1;
Float_t idxpidcand2;
Float_t sys2;
Float_t r2;
Float_t z2;
Float_t massexp2;
Float_t betaexp2;
Float_t momalgidx2;
Float_t chrg2;
Float_t mostprobpid2;
Float_t weightmostprobpid2;
Float_t theta2;
Float_t phi2;
Float_t sec2;
Float_t drmt1;
Float_t drmp1;
Float_t drmt2;
Float_t drmp2;
Float_t tof1;
Float_t tof2;
Float_t rpadnr1;
Float_t rcentroid1;
Float_t rt1;
Float_t rp1;
Float_t rpatmat1;
Float_t rhoutra1;
Float_t rampl1;
Float_t rlocmax41;
Float_t rpadnr2;
Float_t rcentroid2;
Float_t rt2;
Float_t rp2;
Float_t rpatmat2;
Float_t rhoutra2;
Float_t rampl2;
Float_t rlocmax42;
Float_t mom1;
Float_t mom2;
Float_t doubleHit;
Float_t qspline1;
Float_t qspline2;
Float_t innerchisquare1;
Float_t innerchisquare2;
Float_t outerchisquare1;
Float_t outerchisquare2;
Float_t distancetovertex1;
Float_t distancetovertex2;
Float_t DSflag;
Float_t trigDec;
Float_t evtNr;
#ifdef FORMATBEFORE_AUG06
Float_t iscpcandidate1;
Float_t iscpcandidate2;
Float_t opangcpcandidate1;
Float_t opangcpcandidate2;
#else
#ifdef FORMAT_HYDRA800
Float_t closestlepisfitted1;
Float_t closestlepisfitted2;
Float_t closesthadisfitted1;
Float_t closesthadisfitted2;
Float_t opangclosestlep1;
Float_t opangclosestlep2;
Float_t opangclosesthad1;
Float_t opangclosesthad2;
#else
// most recent format version goes here
Float_t metaeloss1;
Float_t metaeloss2;
Float_t innermdcdedx1;
Float_t innermdcdedx2;
Float_t innermdcdedxsigma1;
Float_t innermdcdedxsigma2;
Float_t outermdcdedx1;
Float_t outermdcdedx2;
Float_t outermdcdedxsigma1;
Float_t outermdcdedxsigma2;
Float_t combinedmdcdedx1;
Float_t combinedmdcdedx2;
Float_t combinedmdcdedxsigma1;
Float_t combinedmdcdedxsigma2;
Float_t dxRkMeta1;
Float_t dxRkMeta2;
Float_t dyRkMeta1;
Float_t dyRkMeta2;
Float_t dzRkMeta1;
Float_t dzRkMeta2;
Float_t dxMdcMeta1;
Float_t dxMdcMeta2;
Float_t dyMdcMeta1;
Float_t dyMdcMeta2;
Float_t metamatchqa1;
Float_t metamatchqa2;
Float_t shower_sum0_1;
Float_t shower_sum0_2;
Float_t angletoclosestfittedlep1;
Float_t angletoclosestnonfittedlep1;
Float_t angletoclosestfittedhad1;
Float_t angletoclosestnonfittedhad1;
Float_t angletoclosestfittedlep2;
Float_t angletoclosestnonfittedlep2;
Float_t angletoclosestfittedhad2;
Float_t angletoclosestnonfittedhad2;
Float_t trigTBit;
Float_t flags1;
Float_t flags2;
#ifdef STORE_FW_INFO // APR07
Float_t fwMult;
Float_t fwTime1;
Float_t fwTime2;
Float_t fwTime3;
Float_t fwCharge1;
Float_t fwCharge2;
Float_t fwCharge3;
Float_t fwCell1;
Float_t fwCell2;
Float_t fwCell3;
Float_t fwTheta1;
Float_t fwTheta2;
Float_t fwTheta3;
Float_t fwPhi1;
Float_t fwPhi2;
Float_t fwPhi3;
Float_t fwDist1;
Float_t fwDist2;
Float_t fwDist3;
Float_t tofrecflag;
#endif // FW
#endif // !FORMAT_HYDRA800
Float_t IOm_chi2_1;
Float_t IOm_chi2_2;
Float_t pairvertx;
Float_t pairverty;
Float_t pairvertz;
Float_t pairdistx;
Float_t pairdisty;
Float_t pairdistz;
Float_t pairdist;
Float_t evtVertX;
Float_t evtVertY;
Float_t evtVertZ;
Float_t run;
#endif // !FORMATBEFORE_AUG06
#ifdef SIMULATION
Float_t Gpid1;
Float_t GparentId1;
Float_t GprocessId1;
Float_t Gmom1;
Float_t Gpid2;
Float_t GparentId2;
Float_t GprocessId2;
Float_t Gmom2;
Float_t Ginvmass;
Float_t Gopang;
Float_t Grap;
Float_t Gpt;
Float_t Gcharge;
Float_t GparentTrackNb1;
Float_t GparentTrackNb2;
Float_t GdecayId;
Float_t GCommonDet1;
Float_t GCommonDet2;
Float_t Gvx1;
Float_t Gvy1;
Float_t Gvz1;
Float_t Gvx2;
Float_t Gvy2;
Float_t Gvz2;
Float_t Gmed1;
Float_t Gmed2;
Float_t Ggeninfo1;
Float_t Ggenweight1;
Float_t Ggeninfo2;
Float_t Ggenweight2;
Float_t GgrandparentTrackNb1;
Float_t GgrandparentTrackNb2;
Float_t GgrandparentId1;
Float_t GgrandparentId2;
#endif // SIMULATION
Float_t isGoodOpang;
Float_t isNotDoubleHit;
#ifdef SIMULATION
Float_t Ggeninfo1_1;
Float_t Ggeninfo1_2;
Float_t Ggeninfo2_1;
Float_t Ggeninfo2_2;
#endif // SIMULATION
// List of branches
TBranch *b_invmass; //!
TBranch *b_opang; //!
TBranch *b_rap; //!
TBranch *b_pt; //!
TBranch *b_charge; //!
TBranch *b_isCutNb; //!
TBranch *b_idxPart1; //!
TBranch *b_idxPart2; //!
TBranch *b_prob1; //!
TBranch *b_prob2; //!
TBranch *b_pid1; //!
TBranch *b_pid2; //!
TBranch *b_idxpidcand1; //!
TBranch *b_sys1; //!
TBranch *b_r1; //!
TBranch *b_z1; //!
TBranch *b_massexp1; //!
TBranch *b_betaexp1; //!
TBranch *b_momalgidx1; //!
TBranch *b_chrg1; //!
TBranch *b_mostprobpid1; //!
TBranch *b_weightmostprobpid1; //!
TBranch *b_theta1; //!
TBranch *b_phi1; //!
TBranch *b_sec1; //!
TBranch *b_idxpidcand2; //!
TBranch *b_sys2; //!
TBranch *b_r2; //!
TBranch *b_z2; //!
TBranch *b_massexp2; //!
TBranch *b_betaexp2; //!
TBranch *b_momalgidx2; //!
TBranch *b_chrg2; //!
TBranch *b_mostprobpid2; //!
TBranch *b_weightmostprobpid2; //!
TBranch *b_theta2; //!
TBranch *b_phi2; //!
TBranch *b_sec2; //!
TBranch *b_drmt1; //!
TBranch *b_drmp1; //!
TBranch *b_drmt2; //!
TBranch *b_drmp2; //!
TBranch *b_tof1; //!
TBranch *b_tof2; //!
TBranch *b_rpadnr1; //!
TBranch *b_rcentroid1; //!
TBranch *b_rt1; //!
TBranch *b_rp1; //!
TBranch *b_rpatmat1; //!
TBranch *b_rhoutra1; //!
TBranch *b_rampl1; //!
TBranch *b_rlocmax41; //!
TBranch *b_rpadnr2; //!
TBranch *b_rcentroid2; //!
TBranch *b_rt2; //!
TBranch *b_rp2; //!
TBranch *b_rpatmat2; //!
TBranch *b_rhoutra2; //!
TBranch *b_rampl2; //!
TBranch *b_rlocmax42; //!
TBranch *b_mom1; //!
TBranch *b_mom2; //!
TBranch *b_doubleHit; //!
TBranch *b_qspline1; //!
TBranch *b_qspline2; //!
TBranch *b_innerchisquare1; //!
TBranch *b_innerchisquare2; //!
TBranch *b_outerchisquare1; //!
TBranch *b_outerchisquare2; //!
TBranch *b_distancetovertex1; //!
TBranch *b_distancetovertex2; //!
TBranch *b_DSflag; //!
TBranch *b_trigDec; //!
TBranch *b_evtNr; //!
#ifdef FORMATBEFORE_AUG06
TBranch *b_iscpcandidate1; //!
TBranch *b_iscpcandidate2; //!
TBranch *b_opangcpcandidate1; //!
TBranch *b_opangcpcandidate2; //!
#else
#ifdef FORMAT_HYDRA800
TBranch *b_closestlepisfitted1; //!
TBranch *b_closestlepisfitted2; //!
TBranch *b_closesthadisfitted1; //!
TBranch *b_closesthadisfitted2; //!
TBranch *b_opangclosestlep1; //!
TBranch *b_opangclosestlep2; //!
TBranch *b_opangclosesthad1; //!
TBranch *b_opangclosesthad2; //!
#else
// most recent format version goes here
TBranch *b_metaeloss1; //!
TBranch *b_metaeloss2; //!
TBranch *b_innermdcdedx1; //!
TBranch *b_innermdcdedx2; //!
TBranch *b_innermdcdedxsigma1; //!
TBranch *b_innermdcdedxsigma2; //!
TBranch *b_outermdcdedx1; //!
TBranch *b_outermdcdedx2; //!
TBranch *b_outermdcdedxsigma1; //!
TBranch *b_outermdcdedxsigma2; //!
TBranch *b_combinedmdcdedx1; //!
TBranch *b_combinedmdcdedx2; //!
TBranch *b_combinedmdcdedxsigma1; //!
TBranch *b_combinedmdcdedxsigma2; //!
TBranch *b_dxRkMeta1;
TBranch *b_dxRkMeta2;
TBranch *b_dyRkMeta1;
TBranch *b_dyRkMeta2;
TBranch *b_dzRkMeta1;
TBranch *b_dzRkMeta2;
TBranch *b_dxMdcMeta1;
TBranch *b_dxMdcMeta2;
TBranch *b_dyMdcMeta1;
TBranch *b_dyMdcMeta2;
TBranch *b_metamatchqa1; //!
TBranch *b_metamatchqa2; //!
TBranch *b_shower_sum0_1; //!
TBranch *b_shower_sum0_2; //!
TBranch *b_angletoclosestfittedlep1; //!
TBranch *b_angletoclosestnonfittedlep1; //!
TBranch *b_angletoclosestfittedhad1; //!
TBranch *b_angletoclosestnonfittedhad1; //!
TBranch *b_angletoclosestfittedlep2; //!
TBranch *b_angletoclosestnonfittedlep2; //!
TBranch *b_angletoclosestfittedhad2; //!
TBranch *b_angletoclosestnonfittedhad2; //!
TBranch *b_trigTBit; //!
TBranch *b_flags1; //!
TBranch *b_flags2; //!
#ifdef STORE_FW_INFO // APR07
TBranch *b_fwMult;
TBranch *b_fwTime1;
TBranch *b_fwTime2;
TBranch *b_fwTime3;
TBranch *b_fwCharge1;
TBranch *b_fwCharge2;
TBranch *b_fwCharge3;
TBranch *b_fwCell1;
TBranch *b_fwCell2;
TBranch *b_fwCell3;
TBranch *b_fwTheta1;
TBranch *b_fwTheta2;
TBranch *b_fwTheta3;
TBranch *b_fwPhi1;
TBranch *b_fwPhi2;
TBranch *b_fwPhi3;
TBranch *b_fwDist1;
TBranch *b_fwDist2;
TBranch *b_fwDist3;
TBranch *b_tofrecflag;
#endif
#endif // !FORMAT_HYDRA800
TBranch *b_IOm_chi2_1; //!
TBranch *b_IOm_chi2_2; //!
TBranch *b_pairvertx; //!
TBranch *b_pairverty; //!
TBranch *b_pairvertz; //!
TBranch *b_pairdistx; //!
TBranch *b_pairdisty; //!
TBranch *b_pairdistz; //!
TBranch *b_pairdist; //!
// TBranch *b_evtNr; //!
// TBranch *b_DSflag; //!
// TBranch *b_trigDec; //!
TBranch *b_evtVertX; //!
TBranch *b_evtVertY; //!
TBranch *b_evtVertZ; //!
TBranch *b_run; //!
#endif // !FORMATBEFORE_AUG06
#ifdef SIMULATION
TBranch *b_Gpid1; //!
TBranch *b_GparentId1; //!
TBranch *b_GprocessId1; //!
TBranch *b_Gmom1; //!
TBranch *b_Gpid2; //!
TBranch *b_GparentId2; //!
TBranch *b_GprocessId2; //!
TBranch *b_Gmom2; //!
TBranch *b_Ginvmass; //!
TBranch *b_Gopang; //!
TBranch *b_Grap; //!
TBranch *b_Gpt; //!
TBranch *b_Gcharge; //!
TBranch *b_GparentTrackNb1; //!
TBranch *b_GparentTrackNb2; //!
TBranch *b_GdecayId; //!
TBranch *b_GCommonDet1; //!
TBranch *b_GCommonDet2; //!
TBranch *b_Gvx1; //!
TBranch *b_Gvy1; //!
TBranch *b_Gvz1; //!
TBranch *b_Gvx2; //!
TBranch *b_Gvy2; //!
TBranch *b_Gvz2; //!
TBranch *b_Gmed1; //!
TBranch *b_Gmed2; //!
TBranch *b_Ggeninfo1; //!
TBranch *b_Ggenweight1; //!
TBranch *b_Ggeninfo2; //!
TBranch *b_Ggenweight2; //!
TBranch *b_GgrandparentTrackNb1; //!
TBranch *b_GgrandparentTrackNb2; //!
TBranch *b_GgrandparentId1; //!
TBranch *b_GgrandparentId2; //!
#endif // SIMULATION
TBranch *b_isGoodOpang; //!
TBranch *b_isNotDoubleHit; //!
#ifdef SIMULATION
TBranch *b_Ggeninfo1_1; //!
TBranch *b_Ggeninfo1_2; //!
TBranch *b_Ggeninfo2_1; //!
TBranch *b_Ggeninfo2_2; //!
#endif // SIMULATION
pairs(TTree *tree, TString opt);
~pairs();
TObjArray* harr;//!
TObjArray* getHistograms(void){return harr;};
TH1F* rebinVar(TH1F*,Float_t*, Int_t,
Bool_t kNorm=kTRUE, Bool_t kErr=kTRUE);
TH1F* getSignal(TH1F*, TH1F*);
TH1F* getBackg(TH1F*, TH1F*, Int_t);
TH1F *getNorm(TH1F*, Float_t);
void setPosiEffFileName(const TString &f) {posiEffFileName=f;};
void setEleEffFileName(const TString &f) {eleEffFileName=f;};
#ifdef SIMULATION
Float_t calcWeight();
void convertElementaryInfo(ULong64_t*, Float_t);
static Bool_t isGoodParentId(ULong64_t myParentId);
#endif // SIMULATION
Float_t getRecPhi(Float_t, Float_t);
Bool_t checkIndex(Int_t pid, Int_t ct, Int_t index);
void countMultPerEvent(Int_t jentry,Int_t localEvtNr, Int_t cut);
void countDiMultPerEvent(Int_t jentry,Int_t localEvtNr, Int_t cut);
void fillHistograms(Int_t cut, Float_t weight);
Int_t Cut(Int_t entry);
Int_t GetEntry(Int_t entry);
Int_t LoadTree(Int_t entry);
void Init(TTree *tree);
void Loop(Int_t n=0);
void SetEvents(Double_t e) { evt = e; };
void SetWarnings(Bool_t k){ kWarnings = k; };
Bool_t Notify();
void Show(Long64_t evt = -1, Long64_t entry = -1, Long64_t run = -1);
#ifdef SIMULATION
typedef enum EvtGen {
bPluto,
bElementary,
bUrQMD,
bUnknown
} EvtGen;
EvtGen evtGen;
Bool_t bEventMixing;
Bool_t bDividePi0Channels;
Bool_t bIncoherent;
#endif // SIMULATION
Bool_t bCos;
Float_t getEfficiencyFactor(Int_t);
Float_t getOAInefficiencyFactor();
// EFFICIENCY MATRICES
TString posiEffFileName;
TString eleEffFileName;
TFile* pEleEffFile;
TFile* pPosiEffFile;
TH3F* p3DEffEle;
TH3F* p3DEffPosi;
Bool_t kEffCorrInit;
//list of histograms
TH1F* hmass_cut_pol[MAXCUT][MAXPOL]; //!
#ifdef SIMULATION
TH1F* hmass_cut_true[MAXCUT][MAXPAIR]; //unlike sign true pairs
TH1F* hmass_cut_truecb[MAXCUT]; //unlike sign true cb pairs
#endif // SIMULATION
TH1F* hmass_cut_pol_norm[MAXCUT][MAXPOL];
#ifdef SIMULATION
TH1F* hmass_cut_true_norm[MAXCUT][MAXPAIR]; //unlike sign true pairs
TH1F* hmass_cut_truecb_norm[MAXCUT]; //unlike sign true cb pairs
#endif // SIMULATION
TH1F* hmass_back0_cut[MAXCUT];
TH1F* hmass_sig0_cut[MAXCUT];
TH1F* hmass_back1_cut[MAXCUT];
TH1F* hmass_sig1_cut[MAXCUT];
TH1F* hmass_back0_cut_norm[MAXCUT];
TH1F* hmass_sig0_cut_norm[MAXCUT];
TH1F* hmass_back1_cut_norm[MAXCUT];
TH1F* hmass_sig1_cut_norm[MAXCUT];
TH1F* hoangle_cut_pol[MAXCUT][MAXPOL];
#ifdef SIMULATION
TH1F* hoangle_cut_true[MAXCUT][MAXPAIR];
TH1F* hoangle_cut_truecb[MAXCUT];
#endif // SIMULATION
TH1F* hoangle_cut_pol_norm[MAXCUT][MAXPOL];
#ifdef SIMULATION
TH1F* hoangle_cut_true_norm[MAXCUT][MAXPAIR];
TH1F* hoangle_cut_truecb_norm[MAXCUT];
#endif // SIMULATION
TH1F* hoangle_back0_cut[MAXCUT];
TH1F* hoangle_sig0_cut[MAXCUT];
TH1F* hoangle_back1_cut[MAXCUT];
TH1F* hoangle_sig1_cut[MAXCUT];
TH1F* hoangle_back0_cut_norm[MAXCUT];
TH1F* hoangle_sig0_cut_norm[MAXCUT];
TH1F* hoangle_back1_cut_norm[MAXCUT];
TH1F* hoangle_sig1_cut_norm[MAXCUT];
TH1F* hrap_cut_pol[MAXCUT][MAXPOL];
#ifdef SIMULATION
TH1F* hrap_cut_true[MAXCUT][MAXPAIR];
TH1F* hrap_cut_truecb[MAXCUT];
#endif // SIMULATION
TH1F* hrap_cut_pol_norm[MAXCUT][MAXPOL];
#ifdef SIMULATION
TH1F* hrap_cut_true_norm[MAXCUT][MAXPAIR];
TH1F* hrap_cut_truecb_norm[MAXCUT];
#endif // SIMULATION
TH1F* hrap_back0_cut[MAXCUT];
TH1F* hrap_sig0_cut[MAXCUT];
TH1F* hrap_back1_cut[MAXCUT];
TH1F* hrap_sig1_cut[MAXCUT];
TH1F* hrap_back0_cut_norm[MAXCUT];
TH1F* hrap_sig0_cut_norm[MAXCUT];
TH1F* hrap_back1_cut_norm[MAXCUT];
TH1F* hrap_sig1_cut_norm[MAXCUT];
TH1F* hpt_cut_pol[MAXCUT][MAXPOL];
#ifdef SIMULATION
TH1F* hpt_cut_true[MAXCUT][MAXPAIR];
TH1F* hpt_cut_truecb[MAXCUT];
#endif // SIMULATION
TH1F* hpt_cut_pol_norm[MAXCUT][MAXPOL];
#ifdef SIMULATION
TH1F* hpt_cut_true_norm[MAXCUT][MAXPAIR];
TH1F* hpt_cut_truecb_norm[MAXCUT];
#endif // SIMULATION
TH1F* hpt_back0_cut[MAXCUT];
TH1F* hpt_sig0_cut[MAXCUT];
TH1F* hpt_back1_cut[MAXCUT];
TH1F* hpt_sig1_cut[MAXCUT];
TH1F* hpt_back0_cut_norm[MAXCUT];
TH1F* hpt_sig0_cut_norm[MAXCUT];
TH1F* hpt_back1_cut_norm[MAXCUT];
TH1F* hpt_sig1_cut_norm[MAXCUT];
TH1F* hpolar_cut_pol[MAXCUT][MAXMINVBINS][MAXPOL];
#ifdef SIMULATION
TH1F* hpolar_cut_true[MAXCUT][MAXMINVBINS][MAXPAIR];
TH1F* hpolar_cut_truecb[MAXCUT][MAXMINVBINS];
#endif // SIMULATION
TH1F* hpolar_cut_pol_norm[MAXCUT][MAXMINVBINS][MAXPOL];
#ifdef SIMULATION
TH1F* hpolar_cut_true_norm[MAXCUT][MAXMINVBINS][MAXPAIR];
TH1F* hpolar_cut_truecb_norm[MAXCUT][MAXMINVBINS];
#endif // SIMULATION
TH1F* hpolar_back0_cut[MAXCUT][MAXMINVBINS];
TH1F* hpolar_sig0_cut[MAXCUT][MAXMINVBINS];
TH1F* hpolar_back1_cut[MAXCUT][MAXMINVBINS];
TH1F* hpolar_sig1_cut[MAXCUT][MAXMINVBINS];
TH1F* hpolar_back0_cut_norm[MAXCUT][MAXMINVBINS];
TH1F* hpolar_sig0_cut_norm[MAXCUT][MAXMINVBINS];
TH1F* hpolar_back1_cut_norm[MAXCUT][MAXMINVBINS];
TH1F* hpolar_sig1_cut_norm[MAXCUT][MAXMINVBINS];
TH2F* hlepmult_cut[MAXCUT];
TH1F* hdilepmult_cut_pol[MAXCUT][MAXPOL];
Int_t nPos[MAXCUT];
Int_t nNeg[MAXCUT];
Int_t nPP[MAXCUT];
Int_t nPN[MAXCUT];
Int_t nNN[MAXCUT];
Int_t indextable[2][MAXCUT][100];
Int_t indextableD[3][MAXCUT][100];
Float_t polar;
Float_t polarweight; // polarization
Int_t minvbin; // polarization
Double_t evt;
Bool_t kWarnings; // loop warnings switch
};
#endif // #ifdef pairs_h
| [
"waleed.physics@gmail.com"
] | waleed.physics@gmail.com |
ccea64125142f297b5777053ba2611b1e965f841 | a65ade13b64bd3b969aef229c2f5ae6162b2933f | /CoreSystem/EffectSystem/ParticleHelper.h | 1e03390dc6d87b61e5417a09713ed4e01a3c766d | [] | no_license | jiowchern/fdo | a29eb161ff2672801c9dc51a06d15687790c0f76 | 84cf1386bb8d238954013734b081f9ac8afc423f | refs/heads/master | 2022-07-20T17:41:10.802133 | 2019-09-24T19:20:40 | 2019-09-24T19:20:40 | 210,220,229 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 272 | h | /**
* @file ParticleHelper.h
* @author Yuming Ho
*/
#ifndef ParticleHelperH
#define ParticleHelperH
#include "ParticlePreRequest.h"
namespace FDO
{
bool RenderParticle(ParticleInstPtr particleInst , unsigned int &outflushedPartCount);
}
#endif // ParticleHelperH | [
"jiowchern@gmail.com"
] | jiowchern@gmail.com |
013313d3e64aca73fb3f63ac1ef31bc646721c15 | af65041099c761e92eb9d27a7699c99b67286bec | /3rdParty/ChaiScript-5.8.1/samples/memory_leak_test.cpp | 13afbb45dae4af55ab7435dfd820bfc734e4117d | [
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | bauer-sw/Deploy-Helper | cafae4b97e3da69ba161a9b9432dbe572787a40f | e8e88a5ba585b9d8e8bcea55367d3ddeb70d5c02 | refs/heads/master | 2021-06-17T13:09:12.562596 | 2017-06-04T16:05:24 | 2017-06-04T16:05:24 | 93,181,534 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,810 | cpp | #include <iostream>
#include <chaiscript/chaiscript.hpp>
#include <chaiscript/chaiscript_stdlib.hpp>
#ifdef READLINE_AVAILABLE
#include <readline/readline.h>
#include <readline/history.h>
#endif
std::string get_next_command() {
#ifdef READLINE_AVAILABLE
char *input_raw;
input_raw = readline("eval> ");
add_history(input_raw);
return std::string(input_raw);
#else
std::string retval;
std::cout << "eval> ";
std::getline(std::cin, retval);
return retval;
#endif
}
void function(void)
{
// do nothing
}
class test
{
chaiscript::ChaiScript chai;
chaiscript::ChaiScript::State backupState;
public:
test()
: chai(chaiscript::Std_Lib::library())
{
backupState = chai.get_state();
}
~test(){}
void ResetState()
{
chai.set_state(backupState);
chai.add(chaiscript::fun(&function),"Whatever()");
}
void RunFile(std::string sFile)
{
try {
chaiscript::Boxed_Value val = chai.eval_file(sFile);
}
catch (std::exception &e) {
std::cout << e.what() << '\n';
}
}
};
int main(int /*argc*/, char * /*argv*/[]) {
test myChai;
std::string command = "";
//
// this loop increases memory usage, if RunFile is not called (just hitting enter)
// as soon RunFile gets called, memory will be freed.
//
// scenario1 - RunFile gets called every Loop: memory usage does not change
// scenario2 - RunFile gets never called (just hitting enter): memory usage increases every loop
// scenario3 - RunFile gets in changing intervals: memory usage goes up and down, but never as
// low as in case 1 scenario3 :
while(command != "quit")
{
for(int i = 1; i < 200; i++)
myChai.ResetState();
if(command == "runfile")
myChai.RunFile("Test.chai");
command = get_next_command();
}
}
| [
"info@bauer-sw.de"
] | info@bauer-sw.de |
2cdaeb2ef1619ba8f07fd46ba6fc46f2d13f86c0 | 652a8a3f660dba3193385d65e00d5aaaa2b489a7 | /Graph/Building_Roads.cpp | 4d2c0f8abaa6c2542359385999b63d5adb03aec2 | [] | no_license | strang3-r/Data-Structure | 90a4bf025efa5de9ffc1c6cfd94f0f8cc3507ee2 | ab1e0ff9ccf3b3ef1a0cdc7f8fb914d69172d019 | refs/heads/master | 2023-06-22T09:17:53.348459 | 2021-07-23T22:43:17 | 2021-07-23T22:43:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,463 | cpp | // Building_Roads.cpp
/*<!-- Created By Black Devil -->*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ff first
#define ss second
#define endl "\n"
#define ll long long
#define ld long double
#define loop(a, b, c) for(ll (a) = (b); (a)<=(c); (a)++)
#define looprev(a, b, c) for(ll (a) = (b); (a)>=(c); (a)--)
#define pb push_back
#define mp make_pair
#define pii pair<ll, ll>
#define vi vector<ll>
#define mii map<ll, ll>
#define pqb priority_queue<ll>
#define pqs priority_queue<int, vi, greater<ll> >
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#define inf 1e18
#define ps(x, y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr = new type[n];
#define w(t) int x; cin>>x; while(x--)
// mt19937 rng(chrono::steady_clock::now,time_since_epoch(),count());
typedef tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> pbds;
void file_i_o(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
/* <!-- #ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif --> */
}
int n, m;
int ans = 0;
vector<vector<int>> g;
vector<bool> vis;
vector<int> lead;
void dfs(int u){
vis[u] = true;
for(auto v: g[u]){
if(not vis[v])
dfs(v);
}
}
void process_c(){
for(auto i= 1; i<=n; ++i){
if(not vis[i]){
ans++;
lead.pb(i);
dfs(i);
}
}
}
int main(int argc, char const *argv[])
{
file_i_o();
clock_t start, end;
start = clock();
cin>>n>>m;
g.resize(n+1);
vis.resize(n+1);
for(auto i = 0; i<m; ++i){
int u, v;
cin>> u >> v;
g[u].pb(v);
g[v].pb(u);
}
process_c();
cout<< ans-1 <<endl;
if(ans > 1){
int u = lead[0]; int v;
for(auto i = 1; i<ans; i++){
v = lead[i];
cout<< u <<" "<< v <<endl;
u = v;
}
}
end = clock();
double time_taken=double(end-start)/double(CLOCKS_PER_SEC);
cerr<<"\nTime : "<<fixed<<time_taken<<setprecision(5)<<" s \n";
cerr<<"Coded By Black Devil"<<endl;
return 0;
} | [
"55326048+Atmagyan@users.noreply.github.com"
] | 55326048+Atmagyan@users.noreply.github.com |
60a48fc38f5d1376105ac6554b8ae26bf81d938a | 2c97fc62eab1f78c4a5d1a83826a75209ebb6d39 | /1比赛题目/18.10.31模拟赛/players/H10/city/city.cpp | c9978e3c78d8e0104036e818e708c4743a6a72f8 | [] | no_license | GaisaiYuno/My-OI-Code-1 | f32932f1004e593ffee0b0e97cffd25d9e2851bf | c57ec4e2aaa1d770ee9490a42710d1cf71a153f2 | refs/heads/master | 2020-12-31T23:13:46.913582 | 2020-02-08T01:09:46 | 2020-02-08T01:09:46 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 990 | cpp | #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
struct node{
int l,r;
}s[1001];
bool cmp(node a,node b){
return a.l<b.l;
}
int a[10001],n,m,d,val=0,cnt=1;
int ans[2000002];
int main(){
freopen("city.in","r",stdin);
freopen("city.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
for(int i=1;i<=m;i++)scanf("%d%d",&s[i].l,&s[i].r);
sort(s+1,s+m+1,cmp);
for(int i=2;i<=m;i++){//hebing
if(s[i].l<=s[cnt].r){
s[cnt].r=max(s[cnt].r,s[i].r);
}
else{
++cnt;
s[cnt].l=s[i].l;s[cnt].r=s[i].r;
}
}
sort(s+1,s+cnt+1,cmp);
for(int i=1;i<=n;i++){
for(int j=1;j<=cnt;j++){
ans[s[j].l-a[i]+1000001]++;
ans[s[j].r-a[i]+1+1000001]--;
//cout<<s[j].l-a[i]+1000001<<" "<<s[j].r-a[i]+1+1000001<<endl;
}
}
for(int i=0;i<=2000001;i++){
ans[i]+=ans[i-1];//cout<<ans[i]<<endl;
if(ans[i]>val)val=ans[i],d=abs(1000001-i);
else if(ans[i]==val)d=min(d,abs(1000001-i));
}
cout<<d<<" "<<val;
}
| [
"1980878786@qq.com"
] | 1980878786@qq.com |
a79fd988535dc61438ced13d6a1d3090b686aeb3 | 2962f164cecb440ecd905ab9f3cc569c03a01ad5 | /RtspPlayer/assemblies/sunell/include/RS485DeviceInfo.h | b2c6703d4d50162fdd7faa460096ef9dabdda65b | [] | no_license | paxan222/hello-world | 5ef9bd04a5c4337c1403a04973e2c0c11665bb26 | c55c60e0f72a04e1e2560dc19c2a6bbd7e8b430f | refs/heads/master | 2020-12-11T21:09:30.200433 | 2017-05-04T08:39:53 | 2017-05-04T08:39:53 | 55,044,669 | 0 | 1 | null | null | null | null | GB18030 | C++ | false | false | 3,154 | h | #ifndef _RS485DEVICEINFO_H_
#define _RS485DEVICEINFO_H_
#include "DomainConst.h"
#include <string.h>
#include "SNPlatOS.h"
/**********************************************************************/
//此处用于控制文件编译字节对齐,拷贝时两行注释间内容需一起拷贝,
//结束处的“#ifdef PRAGMA_PACK”部分也要一起拷贝,否则pragma pack入栈出栈不匹配
#if(PRAGMA_PACK_DEFINE != 10000)
# error Not included "SNPlatOS.h".
#endif
#ifdef PRAGMA_PACK
#ifdef WIN32
#pragma pack(push, PRAGMA_PACK_CHAR)
#endif
#ifndef WIN32
#ifndef _PACKED_1_
#define _PACKED_1_ __attribute__((packed, aligned(PRAGMA_PACK_CHAR))) // for gcc
#endif
#else
#ifndef _PACKED_1_
#define _PACKED_1_
#endif
#endif
#else
#ifndef _PACKED_1_
#define _PACKED_1_
#endif
#endif
/**********************************************************************/
class SN_DLL_API RS485DeviceInfo
{
public:
RS485DeviceInfo();
~RS485DeviceInfo();
RS485DeviceInfo(const RS485DeviceInfo& p_objRS485DeviceInfo);
public:
bool setName(const char* p_pszName);
const char* getName() const ;
/************************************************************************
**概述:
* 设置串口ID
**输入:
* p_nComId:串口ID
**输出:
* 无
**返回值:
* 无
**功能:
*
*************************************************************************/
void setComId(const int p_nComId);
/************************************************************************
**概述:
* 获取串口ID
**输入:
* 无
**输出 :
* 无
*返回值 :
* 串口ID
**功能:
*
*************************************************************************/
const int getComId() const;
/************************************************************************
**概述:
* 赋值函数
**输入:
* p_objRS485DeviceInfo:设备主机网络信息
**输出:
* 无
**返回值:
* 设备主机网络信息
**功能:
************************************************************************/
RS485DeviceInfo& operator =(const RS485DeviceInfo& p_objRS485DeviceInfo);
/****************************************************************************
**概述:
* 定义“等于”操作符
**输入:
* p_objRS485DeviceInfo:RS485DeviceInfo类的一个对象的引用。
**输出:
* 无
**返回值:
* true:相等
* false:不相等
**功能:
* 两个RS485DeviceInfo类的对象,所有属性均相等,则说明这两个对象相等,返回true
* 如果有一个属性不等,则返回false。
*****************************************************************************/
bool operator == (const RS485DeviceInfo& p_objRS485DeviceInfo);
private:
char m_szName[CONST_LENGTH_RS485_NAME + 1]; //串口自定义名称
int m_nComId; //串口ID
}_PACKED_1_;
/**********************************************************************/
#ifdef PRAGMA_PACK
#ifdef WIN32
#pragma pack(pop)
#endif
#endif
/**********************************************************************/
#endif //_RS485DEVICEINFO_H_
| [
"paxan222@yandex.ru"
] | paxan222@yandex.ru |
d9778f3b7ccd83228b81611d8bdfecd6cc6e0c8e | 73a94174af592e3e6107282c7b04a11b256fa0ac | /ARWithWord/Library/Il2cppBuildCache/Android/armeabi-v7a/il2cppOutput/Il2CppCCFieldValuesTable.cpp | 3d1610f438f89c698c94e75253bc1c1e15d5b78d | [
"MIT"
] | permissive | CPT-BJ/ARWithWord | 55b1f561441947b6dff8ce9142956122e879bc80 | 8c591d791f07b591c69c57042d934f21ff3c2baa | refs/heads/main | 2023-04-20T10:58:45.670593 | 2021-05-08T07:46:42 | 2021-05-08T07:46:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 146,087 | cpp | #include "pch-cpp.hpp"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable4[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable5[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable6[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable7[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable8[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable9[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable11[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable13[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable14[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable15[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable16[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable18[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable19[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable20[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable21[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable22[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable25[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable26[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable27[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable28[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable29[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable30[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable31[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable32[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable33[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable34[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable35[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable36[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable37[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable38[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable39[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable40[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable41[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable42[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable43[22];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable46[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable47[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable48[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable49[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable50[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable51[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable53[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable55[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable56[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable65[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable66[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable67[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable68[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable69[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable70[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable71[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable75[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable76[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable77[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable78[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable79[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable80[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable81[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable82[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable83[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable84[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable85[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable86[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable102[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable104[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable109[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable110[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable111[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable112[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable113[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable115[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable117[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable118[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable119[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable121[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable122[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable123[145];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable124[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable125[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable126[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable129[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable130[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable131[45];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable132[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable133[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable134[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable135[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable136[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable137[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable141[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable142[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable144[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable145[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable146[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable147[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable148[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable151[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable152[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable157[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable158[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable160[22];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable161[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable162[40];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable163[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable164[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable165[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable166[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable167[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable168[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable169[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable170[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable171[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable172[33];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable173[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable174[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable175[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable176[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable177[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable189[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable190[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable191[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable196[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable200[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable201[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable207[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable209[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable210[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable211[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable215[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable217[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable219[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable220[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable221[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable222[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable223[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable225[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable227[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable229[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable230[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable231[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable232[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable233[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable237[29];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable238[47];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable240[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable241[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable242[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable243[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable244[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable245[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable246[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable247[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable248[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable250[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable251[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable252[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable253[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable254[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable255[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable256[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable258[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable260[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable261[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable262[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable263[23];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable265[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable266[48];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable267[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable268[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable270[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable272[23];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable273[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable274[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable277[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable279[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable280[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable281[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable282[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable283[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable284[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable285[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable286[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable287[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable288[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable289[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable290[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable291[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable292[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable293[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable295[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable297[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable298[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable299[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable300[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable301[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable303[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable304[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable306[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable307[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable308[26];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable310[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable311[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable312[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable314[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable315[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable316[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable317[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable318[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable319[44];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable320[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable321[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable322[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable323[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable324[35];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable325[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable326[396];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable327[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable328[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable329[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable330[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable335[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable338[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable339[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable340[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable341[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable342[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable344[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable345[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable347[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable348[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable349[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable350[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable351[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable352[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable353[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable355[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable356[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable358[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable359[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable360[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable363[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable364[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable365[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable366[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable367[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable368[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable369[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable370[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable371[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable374[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable375[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable376[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable377[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable378[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable379[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable380[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable381[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable382[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable383[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable384[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable386[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable387[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable388[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable389[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable390[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable391[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable392[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable393[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable394[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable395[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable397[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable398[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable399[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable400[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable401[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable402[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable403[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable404[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable405[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable406[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable407[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable410[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable411[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable413[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable414[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable415[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable416[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable417[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable418[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable419[22];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable420[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable421[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable422[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable425[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable426[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable427[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable428[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable429[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable430[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable431[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable432[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable433[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable434[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable435[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable436[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable437[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable439[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable440[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable441[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable442[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable443[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable444[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable447[23];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable450[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable451[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable452[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable454[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable455[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable457[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable458[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable459[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable460[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable461[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable462[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable466[33];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable470[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable471[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable472[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable473[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable474[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable476[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable477[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable479[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable480[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable482[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable483[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable484[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable487[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable489[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable492[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable493[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable495[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable497[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable502[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable503[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable508[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable509[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable511[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable520[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable526[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable529[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable530[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable531[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable536[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable537[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable539[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable540[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable542[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable543[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable545[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable546[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable547[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable549[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable550[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable552[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable553[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable554[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable555[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable557[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable558[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable559[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable561[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable562[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable563[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable565[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable566[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable567[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable568[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable570[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable572[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable573[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable574[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable575[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable576[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable579[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable580[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable581[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable582[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable583[27];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable584[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable585[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable586[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable587[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable588[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable590[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable591[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable593[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable594[42];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable595[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable596[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable597[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable598[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable599[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable600[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable601[84];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable602[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable603[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable604[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable605[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable606[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable607[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable608[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable609[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable610[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable611[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable612[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable613[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable614[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable615[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable616[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable617[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable618[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable619[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable620[36];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable621[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable622[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable623[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable624[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable625[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable626[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable627[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable628[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable629[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable630[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable631[31];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable632[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable633[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable634[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable635[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable636[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable637[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable638[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable639[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable640[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable641[38];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable642[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable643[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable645[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable646[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable647[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable648[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable649[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable650[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable651[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable652[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable653[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable654[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable656[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable657[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable658[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable659[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable661[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable662[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable663[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable665[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable668[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable671[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable672[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable673[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable674[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable675[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable685[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable686[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable687[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable689[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable690[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable691[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable697[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable698[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable699[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable700[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable701[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable702[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable704[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable707[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable709[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable710[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable715[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable716[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable717[39];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable719[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable720[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable723[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable724[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable725[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable726[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable728[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable729[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable731[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable732[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable733[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable734[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable735[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable736[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable737[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable738[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable739[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable740[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable741[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable742[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable743[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable744[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable745[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable746[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable747[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable748[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable749[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable751[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable752[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable753[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable754[22];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable755[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable757[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable758[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable759[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable760[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable761[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable762[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable765[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable766[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable768[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable769[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable770[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable771[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable772[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable773[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable774[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable775[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable776[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable777[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable779[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable780[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable782[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable784[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable785[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable786[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable789[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable790[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable793[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable794[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable798[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable802[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable803[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable804[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable805[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable809[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable810[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable811[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable818[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable819[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable820[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable821[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable822[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable823[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable824[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable825[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable826[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable827[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable828[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable830[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable831[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable837[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable838[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable839[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable840[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable841[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable842[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable843[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable844[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable845[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable846[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable847[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable848[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable849[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable850[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable853[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable854[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable855[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable856[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable857[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable858[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable859[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable860[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable861[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable862[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable863[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable864[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable865[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable866[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable867[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable868[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable869[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable871[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable872[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable873[47];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable874[24];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable875[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable876[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable877[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable878[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable879[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable880[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable881[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable882[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable883[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable884[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable885[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable886[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable887[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable888[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable889[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable890[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable891[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable892[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable893[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable894[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable895[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable896[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable897[24];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable898[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable899[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable900[41];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable901[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable902[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable903[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable904[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable905[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable906[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable907[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable908[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable909[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable910[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable911[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable912[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable916[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable917[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable918[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable919[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable920[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable921[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable922[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable923[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable926[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable927[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable928[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable929[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable932[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable933[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable934[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable935[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable936[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable937[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable938[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable939[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable941[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable943[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable944[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable945[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable949[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable950[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable951[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable952[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable953[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable954[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable955[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable956[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable958[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable970[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable971[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable972[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable973[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable974[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable976[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable984[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable985[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable986[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable988[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable992[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable994[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable995[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable996[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable998[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1000[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1001[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1002[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1003[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1004[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1005[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1006[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1007[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1008[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1009[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1010[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1011[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1012[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1013[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1014[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1015[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1016[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1017[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1019[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1020[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1030[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1031[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1032[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1033[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1034[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1035[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1036[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1037[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1041[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1042[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1044[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1045[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1046[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1049[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1051[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1052[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1053[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1054[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1055[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1056[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1057[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1058[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1059[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1060[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1061[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1066[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1067[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1068[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1069[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1070[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1071[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1072[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1073[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1074[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1075[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1076[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1077[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1080[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1081[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1083[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1084[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1087[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1091[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1093[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1095[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1096[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1097[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1098[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1099[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1100[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1101[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1102[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1103[45];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1104[39];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1106[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1111[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1112[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1113[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1114[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1115[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1116[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1117[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1119[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1123[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1124[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1125[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1126[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1127[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1128[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1144[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1145[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1146[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1148[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1149[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1150[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1151[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1152[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1155[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1156[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1157[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1158[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1160[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1161[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1173[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1174[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1175[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1176[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1178[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1179[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1181[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1182[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1184[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1185[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1186[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1187[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1188[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1189[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1190[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1191[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1195[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1198[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1199[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1200[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1201[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1202[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1203[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1204[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1205[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1206[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1211[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1212[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1217[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1238[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1239[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1243[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1244[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1245[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1246[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1247[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1248[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1249[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1250[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1251[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1252[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1254[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1297[103];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1307[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1314[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1319[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1324[56];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1325[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1326[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1327[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1328[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1329[29];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1331[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1332[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1333[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1334[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1335[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1336[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1337[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1338[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1340[26];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1345[30];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1346[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1348[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1349[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1351[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1352[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1353[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1354[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1355[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1356[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1357[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1358[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1359[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1361[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1362[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1363[57];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1364[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1365[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1366[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1367[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1368[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1369[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1370[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1371[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1372[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1373[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1374[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1375[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1376[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1377[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1379[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1380[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1381[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1383[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1386[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1388[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1389[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1390[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1398[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1399[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1400[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1402[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1403[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1404[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1405[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1407[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1408[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1409[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1410[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1412[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1413[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1414[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1415[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1416[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1417[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1422[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1423[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1424[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1425[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1426[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1428[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1429[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1430[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1431[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1432[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1433[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1434[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1437[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1438[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1439[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1440[32];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1441[48];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1444[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1468[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1469[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1470[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1471[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1472[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1473[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1474[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1475[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1476[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1477[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1478[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1479[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1480[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1481[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1482[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1483[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1485[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1489[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1490[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1491[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1492[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1493[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1494[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1495[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1496[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1497[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1498[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1500[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1501[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1502[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1503[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1504[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1507[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1511[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1514[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1515[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1516[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1517[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1518[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1519[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1520[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1521[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1523[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1524[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1527[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1528[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1529[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1530[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1532[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1533[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1538[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1539[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1540[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1543[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1547[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1549[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1550[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1551[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1552[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1553[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1556[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1557[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1558[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1559[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1560[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1561[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1562[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1569[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1570[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1571[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1572[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1573[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1575[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1576[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1592[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1594[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1596[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1597[41];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1598[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1599[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1600[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1601[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1604[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1605[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1606[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1607[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1608[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1609[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1610[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1612[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1613[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1615[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1616[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1617[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1619[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1621[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1622[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1623[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1624[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1625[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1627[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1628[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1629[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1630[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1632[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1634[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1635[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1636[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1639[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1640[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1647[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1648[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1650[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1651[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1652[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1653[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1654[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1655[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1656[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1657[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1658[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1659[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1660[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1661[71];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1662[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1663[29];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1664[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1665[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1666[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1667[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1668[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1671[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1673[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1681[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1684[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1686[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1687[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1688[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1689[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1690[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1691[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1692[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1693[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1694[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1695[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1699[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1700[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1701[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1703[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1705[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1707[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1708[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1710[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1711[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1712[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1717[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1718[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1722[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1725[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1735[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1736[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1738[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1740[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1742[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1744[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1746[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1747[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1748[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1749[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1752[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1758[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1764[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1766[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1767[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1771[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1772[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1774[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1775[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1776[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1777[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1779[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1781[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1782[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1783[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1784[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1785[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1786[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1787[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1788[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1789[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1790[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1791[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1793[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1795[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1797[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1799[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1801[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1802[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1805[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1806[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1807[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1808[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1809[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1810[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1811[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1813[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1946[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1947[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1948[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1949[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1950[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1953[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1954[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1955[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1956[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1957[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1958[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1960[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1961[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1963[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1964[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1965[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1966[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1967[26];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1969[24];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1970[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1971[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1972[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1973[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1974[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1975[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1976[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1978[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1979[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1980[27];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1981[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1982[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1984[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1985[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1986[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1987[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1988[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1989[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1990[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1991[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1992[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1994[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1995[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable1996[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2000[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2004[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2005[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2006[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2007[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2008[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2009[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2010[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2012[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2013[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2014[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2015[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2016[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2017[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2018[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2019[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2020[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2021[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2022[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2023[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2026[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2027[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2028[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2029[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2030[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2031[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2034[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2035[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2036[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2037[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2038[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2039[142];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2042[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2043[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2044[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2045[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2053[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2054[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2059[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2062[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2066[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2068[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2069[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2070[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2072[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2074[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2075[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2077[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2078[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2083[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2084[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2085[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2086[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2087[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2088[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2089[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2090[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2091[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2092[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2093[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2094[59];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2095[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2096[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2097[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2098[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2099[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2100[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2101[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2102[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2104[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2106[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2107[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2109[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2110[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2111[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2112[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2123[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2126[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2127[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2128[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2132[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2133[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2134[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2135[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2136[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2137[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2138[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2141[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2142[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2143[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2145[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2147[31];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2149[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2152[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2153[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2154[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2155[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2156[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2157[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2158[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2161[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2162[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2163[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2164[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2165[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2166[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2169[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2170[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2171[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2172[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2173[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2174[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2176[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2177[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2178[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2181[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2182[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2183[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2187[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2188[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2191[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2195[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2196[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2197[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2198[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2199[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2200[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2202[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2204[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2206[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2208[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2209[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2210[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2212[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2214[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2216[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2219[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2220[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2221[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2225[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2226[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2227[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2228[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2231[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2232[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2234[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2235[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2236[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2237[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2240[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2241[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2243[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2244[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2246[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2248[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2249[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2250[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2251[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2252[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2253[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2255[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2257[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2259[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2260[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2262[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2263[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2264[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2265[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2266[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2272[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2273[17];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2274[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2275[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2276[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2278[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2279[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2282[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2283[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2284[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2285[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2286[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2287[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2288[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2289[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2290[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2299[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2301[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2302[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2303[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2304[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2305[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2306[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2307[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2308[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2309[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2310[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2311[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2312[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2313[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2314[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2315[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2316[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2317[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2318[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2319[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2320[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2321[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2322[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2323[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2324[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2325[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2326[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2327[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2328[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2329[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2330[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2331[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2332[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2333[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2334[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2335[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2336[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2337[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2338[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2339[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2340[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2341[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2342[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2343[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2344[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2345[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2346[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2347[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2348[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2349[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2350[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2351[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2352[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2353[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2354[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2355[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2356[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2357[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2358[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2359[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2360[20];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2362[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2363[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2366[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2367[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2368[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2369[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2370[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2371[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2372[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2373[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2374[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2375[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2376[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2377[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2378[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2380[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2381[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2382[16];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2383[15];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2384[24];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2385[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2386[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2387[75];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2388[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2389[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2391[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2392[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2393[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2394[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2395[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2396[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2397[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2398[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2401[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2403[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2405[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2407[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2408[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2409[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2410[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2411[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2413[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2414[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2415[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2416[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2417[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2418[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2419[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2420[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2421[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2425[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2432[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2433[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2434[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2435[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2437[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2440[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2442[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2443[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2444[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2445[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2446[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2447[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2448[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2449[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2450[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2451[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2453[74];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2454[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2455[39];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2456[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2457[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2458[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2459[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2460[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2461[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2462[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2463[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2464[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2465[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2467[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2472[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2473[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2474[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2475[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2476[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2479[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2484[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2485[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2487[21];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2488[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2489[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2490[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2491[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2492[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2493[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2494[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2495[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2496[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2497[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2498[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2499[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2500[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2501[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2502[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2503[10];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2504[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2506[19];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2507[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2508[12];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2510[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2511[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2512[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2513[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2514[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2515[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2516[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2517[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2518[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2519[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2520[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2521[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2522[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2523[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2524[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2525[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2527[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2528[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2529[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2530[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2531[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2532[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2534[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2535[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2536[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2537[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2538[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2539[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2540[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2541[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2542[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2543[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2545[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2546[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2547[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2548[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2549[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2550[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2551[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2552[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2553[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2554[25];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2559[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2562[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2564[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2568[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2569[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2573[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2574[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2575[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2576[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2580[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2585[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2586[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2587[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2588[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2589[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2591[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2593[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2596[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2597[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2600[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2602[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2603[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2604[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2606[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2608[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2609[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2610[14];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2613[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2614[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2617[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2618[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2619[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2623[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2625[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2626[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2627[9];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2628[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2629[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2630[30];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2631[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2632[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2633[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2634[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2635[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2636[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2637[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2640[13];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2644[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2646[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2647[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2648[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2649[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2650[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2653[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2654[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2655[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2656[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2657[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2659[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2660[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2662[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2666[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2667[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2668[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2669[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2670[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2671[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2672[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2673[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2674[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2677[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2678[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2680[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2681[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2682[11];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2683[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2685[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2688[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2690[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2691[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2694[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2697[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2698[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2699[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2700[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2701[8];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2702[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2706[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2708[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2709[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2710[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2711[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2712[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2713[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2716[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2717[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2718[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2719[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2720[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2722[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2723[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2726[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2729[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2732[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2733[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2734[1];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2735[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2736[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2737[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2738[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2739[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2740[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2741[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2742[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2743[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2744[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2745[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2746[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2747[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2748[18];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2750[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2751[7];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2752[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2754[4];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2755[3];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2756[6];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2757[2];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2758[5];
IL2CPP_EXTERN_C_CONST int32_t g_FieldOffsetTable2759[17];
IL2CPP_EXTERN_C_CONST int32_t* g_FieldOffsetTable[2760] =
{
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable4,
g_FieldOffsetTable5,
g_FieldOffsetTable6,
g_FieldOffsetTable7,
g_FieldOffsetTable8,
g_FieldOffsetTable9,
NULL,
g_FieldOffsetTable11,
NULL,
g_FieldOffsetTable13,
g_FieldOffsetTable14,
g_FieldOffsetTable15,
g_FieldOffsetTable16,
NULL,
g_FieldOffsetTable18,
g_FieldOffsetTable19,
g_FieldOffsetTable20,
g_FieldOffsetTable21,
g_FieldOffsetTable22,
NULL,
NULL,
g_FieldOffsetTable25,
g_FieldOffsetTable26,
g_FieldOffsetTable27,
g_FieldOffsetTable28,
g_FieldOffsetTable29,
g_FieldOffsetTable30,
g_FieldOffsetTable31,
g_FieldOffsetTable32,
g_FieldOffsetTable33,
g_FieldOffsetTable34,
g_FieldOffsetTable35,
g_FieldOffsetTable36,
g_FieldOffsetTable37,
g_FieldOffsetTable38,
g_FieldOffsetTable39,
g_FieldOffsetTable40,
g_FieldOffsetTable41,
g_FieldOffsetTable42,
g_FieldOffsetTable43,
NULL,
NULL,
g_FieldOffsetTable46,
g_FieldOffsetTable47,
g_FieldOffsetTable48,
g_FieldOffsetTable49,
g_FieldOffsetTable50,
g_FieldOffsetTable51,
NULL,
g_FieldOffsetTable53,
NULL,
g_FieldOffsetTable55,
g_FieldOffsetTable56,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable65,
g_FieldOffsetTable66,
g_FieldOffsetTable67,
g_FieldOffsetTable68,
g_FieldOffsetTable69,
g_FieldOffsetTable70,
g_FieldOffsetTable71,
NULL,
NULL,
NULL,
g_FieldOffsetTable75,
g_FieldOffsetTable76,
g_FieldOffsetTable77,
g_FieldOffsetTable78,
g_FieldOffsetTable79,
g_FieldOffsetTable80,
g_FieldOffsetTable81,
g_FieldOffsetTable82,
g_FieldOffsetTable83,
g_FieldOffsetTable84,
g_FieldOffsetTable85,
g_FieldOffsetTable86,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable102,
NULL,
g_FieldOffsetTable104,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable109,
g_FieldOffsetTable110,
g_FieldOffsetTable111,
g_FieldOffsetTable112,
g_FieldOffsetTable113,
NULL,
g_FieldOffsetTable115,
NULL,
g_FieldOffsetTable117,
g_FieldOffsetTable118,
g_FieldOffsetTable119,
NULL,
g_FieldOffsetTable121,
g_FieldOffsetTable122,
g_FieldOffsetTable123,
g_FieldOffsetTable124,
g_FieldOffsetTable125,
g_FieldOffsetTable126,
NULL,
NULL,
g_FieldOffsetTable129,
g_FieldOffsetTable130,
g_FieldOffsetTable131,
g_FieldOffsetTable132,
g_FieldOffsetTable133,
g_FieldOffsetTable134,
g_FieldOffsetTable135,
g_FieldOffsetTable136,
g_FieldOffsetTable137,
NULL,
NULL,
NULL,
g_FieldOffsetTable141,
g_FieldOffsetTable142,
NULL,
g_FieldOffsetTable144,
g_FieldOffsetTable145,
g_FieldOffsetTable146,
g_FieldOffsetTable147,
g_FieldOffsetTable148,
NULL,
NULL,
g_FieldOffsetTable151,
g_FieldOffsetTable152,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable157,
g_FieldOffsetTable158,
NULL,
g_FieldOffsetTable160,
g_FieldOffsetTable161,
g_FieldOffsetTable162,
g_FieldOffsetTable163,
g_FieldOffsetTable164,
g_FieldOffsetTable165,
g_FieldOffsetTable166,
g_FieldOffsetTable167,
g_FieldOffsetTable168,
g_FieldOffsetTable169,
g_FieldOffsetTable170,
g_FieldOffsetTable171,
g_FieldOffsetTable172,
g_FieldOffsetTable173,
g_FieldOffsetTable174,
g_FieldOffsetTable175,
g_FieldOffsetTable176,
g_FieldOffsetTable177,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable189,
g_FieldOffsetTable190,
g_FieldOffsetTable191,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable196,
NULL,
NULL,
NULL,
g_FieldOffsetTable200,
g_FieldOffsetTable201,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable207,
NULL,
g_FieldOffsetTable209,
g_FieldOffsetTable210,
g_FieldOffsetTable211,
NULL,
NULL,
NULL,
g_FieldOffsetTable215,
NULL,
g_FieldOffsetTable217,
NULL,
g_FieldOffsetTable219,
g_FieldOffsetTable220,
g_FieldOffsetTable221,
g_FieldOffsetTable222,
g_FieldOffsetTable223,
NULL,
g_FieldOffsetTable225,
NULL,
g_FieldOffsetTable227,
NULL,
g_FieldOffsetTable229,
g_FieldOffsetTable230,
g_FieldOffsetTable231,
g_FieldOffsetTable232,
g_FieldOffsetTable233,
NULL,
NULL,
NULL,
g_FieldOffsetTable237,
g_FieldOffsetTable238,
NULL,
g_FieldOffsetTable240,
g_FieldOffsetTable241,
g_FieldOffsetTable242,
g_FieldOffsetTable243,
g_FieldOffsetTable244,
g_FieldOffsetTable245,
g_FieldOffsetTable246,
g_FieldOffsetTable247,
g_FieldOffsetTable248,
NULL,
g_FieldOffsetTable250,
g_FieldOffsetTable251,
g_FieldOffsetTable252,
g_FieldOffsetTable253,
g_FieldOffsetTable254,
g_FieldOffsetTable255,
g_FieldOffsetTable256,
NULL,
g_FieldOffsetTable258,
NULL,
g_FieldOffsetTable260,
g_FieldOffsetTable261,
g_FieldOffsetTable262,
g_FieldOffsetTable263,
NULL,
g_FieldOffsetTable265,
g_FieldOffsetTable266,
g_FieldOffsetTable267,
g_FieldOffsetTable268,
NULL,
g_FieldOffsetTable270,
NULL,
g_FieldOffsetTable272,
g_FieldOffsetTable273,
g_FieldOffsetTable274,
NULL,
NULL,
g_FieldOffsetTable277,
NULL,
g_FieldOffsetTable279,
g_FieldOffsetTable280,
g_FieldOffsetTable281,
g_FieldOffsetTable282,
g_FieldOffsetTable283,
g_FieldOffsetTable284,
g_FieldOffsetTable285,
g_FieldOffsetTable286,
g_FieldOffsetTable287,
g_FieldOffsetTable288,
g_FieldOffsetTable289,
g_FieldOffsetTable290,
g_FieldOffsetTable291,
g_FieldOffsetTable292,
g_FieldOffsetTable293,
NULL,
g_FieldOffsetTable295,
NULL,
g_FieldOffsetTable297,
g_FieldOffsetTable298,
g_FieldOffsetTable299,
g_FieldOffsetTable300,
g_FieldOffsetTable301,
NULL,
g_FieldOffsetTable303,
g_FieldOffsetTable304,
NULL,
g_FieldOffsetTable306,
g_FieldOffsetTable307,
g_FieldOffsetTable308,
NULL,
g_FieldOffsetTable310,
g_FieldOffsetTable311,
g_FieldOffsetTable312,
NULL,
g_FieldOffsetTable314,
g_FieldOffsetTable315,
g_FieldOffsetTable316,
g_FieldOffsetTable317,
g_FieldOffsetTable318,
g_FieldOffsetTable319,
g_FieldOffsetTable320,
g_FieldOffsetTable321,
g_FieldOffsetTable322,
g_FieldOffsetTable323,
g_FieldOffsetTable324,
g_FieldOffsetTable325,
g_FieldOffsetTable326,
g_FieldOffsetTable327,
g_FieldOffsetTable328,
g_FieldOffsetTable329,
g_FieldOffsetTable330,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable335,
NULL,
NULL,
g_FieldOffsetTable338,
g_FieldOffsetTable339,
g_FieldOffsetTable340,
g_FieldOffsetTable341,
g_FieldOffsetTable342,
NULL,
g_FieldOffsetTable344,
g_FieldOffsetTable345,
NULL,
g_FieldOffsetTable347,
g_FieldOffsetTable348,
g_FieldOffsetTable349,
g_FieldOffsetTable350,
g_FieldOffsetTable351,
g_FieldOffsetTable352,
g_FieldOffsetTable353,
NULL,
g_FieldOffsetTable355,
g_FieldOffsetTable356,
NULL,
g_FieldOffsetTable358,
g_FieldOffsetTable359,
g_FieldOffsetTable360,
NULL,
NULL,
g_FieldOffsetTable363,
g_FieldOffsetTable364,
g_FieldOffsetTable365,
g_FieldOffsetTable366,
g_FieldOffsetTable367,
g_FieldOffsetTable368,
g_FieldOffsetTable369,
g_FieldOffsetTable370,
g_FieldOffsetTable371,
NULL,
NULL,
g_FieldOffsetTable374,
g_FieldOffsetTable375,
g_FieldOffsetTable376,
g_FieldOffsetTable377,
g_FieldOffsetTable378,
g_FieldOffsetTable379,
g_FieldOffsetTable380,
g_FieldOffsetTable381,
g_FieldOffsetTable382,
g_FieldOffsetTable383,
g_FieldOffsetTable384,
NULL,
g_FieldOffsetTable386,
g_FieldOffsetTable387,
g_FieldOffsetTable388,
g_FieldOffsetTable389,
g_FieldOffsetTable390,
g_FieldOffsetTable391,
g_FieldOffsetTable392,
g_FieldOffsetTable393,
g_FieldOffsetTable394,
g_FieldOffsetTable395,
NULL,
g_FieldOffsetTable397,
g_FieldOffsetTable398,
g_FieldOffsetTable399,
g_FieldOffsetTable400,
g_FieldOffsetTable401,
g_FieldOffsetTable402,
g_FieldOffsetTable403,
g_FieldOffsetTable404,
g_FieldOffsetTable405,
g_FieldOffsetTable406,
g_FieldOffsetTable407,
NULL,
NULL,
g_FieldOffsetTable410,
g_FieldOffsetTable411,
NULL,
g_FieldOffsetTable413,
g_FieldOffsetTable414,
g_FieldOffsetTable415,
g_FieldOffsetTable416,
g_FieldOffsetTable417,
g_FieldOffsetTable418,
g_FieldOffsetTable419,
g_FieldOffsetTable420,
g_FieldOffsetTable421,
g_FieldOffsetTable422,
NULL,
NULL,
g_FieldOffsetTable425,
g_FieldOffsetTable426,
g_FieldOffsetTable427,
g_FieldOffsetTable428,
g_FieldOffsetTable429,
g_FieldOffsetTable430,
g_FieldOffsetTable431,
g_FieldOffsetTable432,
g_FieldOffsetTable433,
g_FieldOffsetTable434,
g_FieldOffsetTable435,
g_FieldOffsetTable436,
g_FieldOffsetTable437,
NULL,
g_FieldOffsetTable439,
g_FieldOffsetTable440,
g_FieldOffsetTable441,
g_FieldOffsetTable442,
g_FieldOffsetTable443,
g_FieldOffsetTable444,
NULL,
NULL,
g_FieldOffsetTable447,
NULL,
NULL,
g_FieldOffsetTable450,
g_FieldOffsetTable451,
g_FieldOffsetTable452,
NULL,
g_FieldOffsetTable454,
g_FieldOffsetTable455,
NULL,
g_FieldOffsetTable457,
g_FieldOffsetTable458,
g_FieldOffsetTable459,
g_FieldOffsetTable460,
g_FieldOffsetTable461,
g_FieldOffsetTable462,
NULL,
NULL,
NULL,
g_FieldOffsetTable466,
NULL,
NULL,
NULL,
g_FieldOffsetTable470,
g_FieldOffsetTable471,
g_FieldOffsetTable472,
g_FieldOffsetTable473,
g_FieldOffsetTable474,
NULL,
g_FieldOffsetTable476,
g_FieldOffsetTable477,
NULL,
g_FieldOffsetTable479,
g_FieldOffsetTable480,
NULL,
g_FieldOffsetTable482,
g_FieldOffsetTable483,
g_FieldOffsetTable484,
NULL,
NULL,
g_FieldOffsetTable487,
NULL,
g_FieldOffsetTable489,
NULL,
NULL,
g_FieldOffsetTable492,
g_FieldOffsetTable493,
NULL,
g_FieldOffsetTable495,
NULL,
g_FieldOffsetTable497,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable502,
g_FieldOffsetTable503,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable508,
g_FieldOffsetTable509,
NULL,
g_FieldOffsetTable511,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable520,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable526,
NULL,
NULL,
g_FieldOffsetTable529,
g_FieldOffsetTable530,
g_FieldOffsetTable531,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable536,
g_FieldOffsetTable537,
NULL,
g_FieldOffsetTable539,
g_FieldOffsetTable540,
NULL,
g_FieldOffsetTable542,
g_FieldOffsetTable543,
NULL,
g_FieldOffsetTable545,
g_FieldOffsetTable546,
g_FieldOffsetTable547,
NULL,
g_FieldOffsetTable549,
g_FieldOffsetTable550,
NULL,
g_FieldOffsetTable552,
g_FieldOffsetTable553,
g_FieldOffsetTable554,
g_FieldOffsetTable555,
NULL,
g_FieldOffsetTable557,
g_FieldOffsetTable558,
g_FieldOffsetTable559,
NULL,
g_FieldOffsetTable561,
g_FieldOffsetTable562,
g_FieldOffsetTable563,
NULL,
g_FieldOffsetTable565,
g_FieldOffsetTable566,
g_FieldOffsetTable567,
g_FieldOffsetTable568,
NULL,
g_FieldOffsetTable570,
NULL,
g_FieldOffsetTable572,
g_FieldOffsetTable573,
g_FieldOffsetTable574,
g_FieldOffsetTable575,
g_FieldOffsetTable576,
NULL,
NULL,
g_FieldOffsetTable579,
g_FieldOffsetTable580,
g_FieldOffsetTable581,
g_FieldOffsetTable582,
g_FieldOffsetTable583,
g_FieldOffsetTable584,
g_FieldOffsetTable585,
g_FieldOffsetTable586,
g_FieldOffsetTable587,
g_FieldOffsetTable588,
NULL,
g_FieldOffsetTable590,
g_FieldOffsetTable591,
NULL,
g_FieldOffsetTable593,
g_FieldOffsetTable594,
g_FieldOffsetTable595,
g_FieldOffsetTable596,
g_FieldOffsetTable597,
g_FieldOffsetTable598,
g_FieldOffsetTable599,
g_FieldOffsetTable600,
g_FieldOffsetTable601,
g_FieldOffsetTable602,
g_FieldOffsetTable603,
g_FieldOffsetTable604,
g_FieldOffsetTable605,
g_FieldOffsetTable606,
g_FieldOffsetTable607,
g_FieldOffsetTable608,
g_FieldOffsetTable609,
g_FieldOffsetTable610,
g_FieldOffsetTable611,
g_FieldOffsetTable612,
g_FieldOffsetTable613,
g_FieldOffsetTable614,
g_FieldOffsetTable615,
g_FieldOffsetTable616,
g_FieldOffsetTable617,
g_FieldOffsetTable618,
g_FieldOffsetTable619,
g_FieldOffsetTable620,
g_FieldOffsetTable621,
g_FieldOffsetTable622,
g_FieldOffsetTable623,
g_FieldOffsetTable624,
g_FieldOffsetTable625,
g_FieldOffsetTable626,
g_FieldOffsetTable627,
g_FieldOffsetTable628,
g_FieldOffsetTable629,
g_FieldOffsetTable630,
g_FieldOffsetTable631,
g_FieldOffsetTable632,
g_FieldOffsetTable633,
g_FieldOffsetTable634,
g_FieldOffsetTable635,
g_FieldOffsetTable636,
g_FieldOffsetTable637,
g_FieldOffsetTable638,
g_FieldOffsetTable639,
g_FieldOffsetTable640,
g_FieldOffsetTable641,
g_FieldOffsetTable642,
g_FieldOffsetTable643,
NULL,
g_FieldOffsetTable645,
g_FieldOffsetTable646,
g_FieldOffsetTable647,
g_FieldOffsetTable648,
g_FieldOffsetTable649,
g_FieldOffsetTable650,
g_FieldOffsetTable651,
g_FieldOffsetTable652,
g_FieldOffsetTable653,
g_FieldOffsetTable654,
NULL,
g_FieldOffsetTable656,
g_FieldOffsetTable657,
g_FieldOffsetTable658,
g_FieldOffsetTable659,
NULL,
g_FieldOffsetTable661,
g_FieldOffsetTable662,
g_FieldOffsetTable663,
NULL,
g_FieldOffsetTable665,
NULL,
NULL,
g_FieldOffsetTable668,
NULL,
NULL,
g_FieldOffsetTable671,
g_FieldOffsetTable672,
g_FieldOffsetTable673,
g_FieldOffsetTable674,
g_FieldOffsetTable675,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable685,
g_FieldOffsetTable686,
g_FieldOffsetTable687,
NULL,
g_FieldOffsetTable689,
g_FieldOffsetTable690,
g_FieldOffsetTable691,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable697,
g_FieldOffsetTable698,
g_FieldOffsetTable699,
g_FieldOffsetTable700,
g_FieldOffsetTable701,
g_FieldOffsetTable702,
NULL,
g_FieldOffsetTable704,
NULL,
NULL,
g_FieldOffsetTable707,
NULL,
g_FieldOffsetTable709,
g_FieldOffsetTable710,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable715,
g_FieldOffsetTable716,
g_FieldOffsetTable717,
NULL,
g_FieldOffsetTable719,
g_FieldOffsetTable720,
NULL,
NULL,
g_FieldOffsetTable723,
g_FieldOffsetTable724,
g_FieldOffsetTable725,
g_FieldOffsetTable726,
NULL,
g_FieldOffsetTable728,
g_FieldOffsetTable729,
NULL,
g_FieldOffsetTable731,
g_FieldOffsetTable732,
g_FieldOffsetTable733,
g_FieldOffsetTable734,
g_FieldOffsetTable735,
g_FieldOffsetTable736,
g_FieldOffsetTable737,
g_FieldOffsetTable738,
g_FieldOffsetTable739,
g_FieldOffsetTable740,
g_FieldOffsetTable741,
g_FieldOffsetTable742,
g_FieldOffsetTable743,
g_FieldOffsetTable744,
g_FieldOffsetTable745,
g_FieldOffsetTable746,
g_FieldOffsetTable747,
g_FieldOffsetTable748,
g_FieldOffsetTable749,
NULL,
g_FieldOffsetTable751,
g_FieldOffsetTable752,
g_FieldOffsetTable753,
g_FieldOffsetTable754,
g_FieldOffsetTable755,
NULL,
g_FieldOffsetTable757,
g_FieldOffsetTable758,
g_FieldOffsetTable759,
g_FieldOffsetTable760,
g_FieldOffsetTable761,
g_FieldOffsetTable762,
NULL,
NULL,
g_FieldOffsetTable765,
g_FieldOffsetTable766,
NULL,
g_FieldOffsetTable768,
g_FieldOffsetTable769,
g_FieldOffsetTable770,
g_FieldOffsetTable771,
g_FieldOffsetTable772,
g_FieldOffsetTable773,
g_FieldOffsetTable774,
g_FieldOffsetTable775,
g_FieldOffsetTable776,
g_FieldOffsetTable777,
NULL,
g_FieldOffsetTable779,
g_FieldOffsetTable780,
NULL,
g_FieldOffsetTable782,
NULL,
g_FieldOffsetTable784,
g_FieldOffsetTable785,
g_FieldOffsetTable786,
NULL,
NULL,
g_FieldOffsetTable789,
g_FieldOffsetTable790,
NULL,
NULL,
g_FieldOffsetTable793,
g_FieldOffsetTable794,
NULL,
NULL,
NULL,
g_FieldOffsetTable798,
NULL,
NULL,
NULL,
g_FieldOffsetTable802,
g_FieldOffsetTable803,
g_FieldOffsetTable804,
g_FieldOffsetTable805,
NULL,
NULL,
NULL,
g_FieldOffsetTable809,
g_FieldOffsetTable810,
g_FieldOffsetTable811,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable818,
g_FieldOffsetTable819,
g_FieldOffsetTable820,
g_FieldOffsetTable821,
g_FieldOffsetTable822,
g_FieldOffsetTable823,
g_FieldOffsetTable824,
g_FieldOffsetTable825,
g_FieldOffsetTable826,
g_FieldOffsetTable827,
g_FieldOffsetTable828,
NULL,
g_FieldOffsetTable830,
g_FieldOffsetTable831,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable837,
g_FieldOffsetTable838,
g_FieldOffsetTable839,
g_FieldOffsetTable840,
g_FieldOffsetTable841,
g_FieldOffsetTable842,
g_FieldOffsetTable843,
g_FieldOffsetTable844,
g_FieldOffsetTable845,
g_FieldOffsetTable846,
g_FieldOffsetTable847,
g_FieldOffsetTable848,
g_FieldOffsetTable849,
g_FieldOffsetTable850,
NULL,
NULL,
g_FieldOffsetTable853,
g_FieldOffsetTable854,
g_FieldOffsetTable855,
g_FieldOffsetTable856,
g_FieldOffsetTable857,
g_FieldOffsetTable858,
g_FieldOffsetTable859,
g_FieldOffsetTable860,
g_FieldOffsetTable861,
g_FieldOffsetTable862,
g_FieldOffsetTable863,
g_FieldOffsetTable864,
g_FieldOffsetTable865,
g_FieldOffsetTable866,
g_FieldOffsetTable867,
g_FieldOffsetTable868,
g_FieldOffsetTable869,
NULL,
g_FieldOffsetTable871,
g_FieldOffsetTable872,
g_FieldOffsetTable873,
g_FieldOffsetTable874,
g_FieldOffsetTable875,
g_FieldOffsetTable876,
g_FieldOffsetTable877,
g_FieldOffsetTable878,
g_FieldOffsetTable879,
g_FieldOffsetTable880,
g_FieldOffsetTable881,
g_FieldOffsetTable882,
g_FieldOffsetTable883,
g_FieldOffsetTable884,
g_FieldOffsetTable885,
g_FieldOffsetTable886,
g_FieldOffsetTable887,
g_FieldOffsetTable888,
g_FieldOffsetTable889,
g_FieldOffsetTable890,
g_FieldOffsetTable891,
g_FieldOffsetTable892,
g_FieldOffsetTable893,
g_FieldOffsetTable894,
g_FieldOffsetTable895,
g_FieldOffsetTable896,
g_FieldOffsetTable897,
g_FieldOffsetTable898,
g_FieldOffsetTable899,
g_FieldOffsetTable900,
g_FieldOffsetTable901,
g_FieldOffsetTable902,
g_FieldOffsetTable903,
g_FieldOffsetTable904,
g_FieldOffsetTable905,
g_FieldOffsetTable906,
g_FieldOffsetTable907,
g_FieldOffsetTable908,
g_FieldOffsetTable909,
g_FieldOffsetTable910,
g_FieldOffsetTable911,
g_FieldOffsetTable912,
NULL,
NULL,
NULL,
g_FieldOffsetTable916,
g_FieldOffsetTable917,
g_FieldOffsetTable918,
g_FieldOffsetTable919,
g_FieldOffsetTable920,
g_FieldOffsetTable921,
g_FieldOffsetTable922,
g_FieldOffsetTable923,
NULL,
NULL,
g_FieldOffsetTable926,
g_FieldOffsetTable927,
g_FieldOffsetTable928,
g_FieldOffsetTable929,
NULL,
NULL,
g_FieldOffsetTable932,
g_FieldOffsetTable933,
g_FieldOffsetTable934,
g_FieldOffsetTable935,
g_FieldOffsetTable936,
g_FieldOffsetTable937,
g_FieldOffsetTable938,
g_FieldOffsetTable939,
NULL,
g_FieldOffsetTable941,
NULL,
g_FieldOffsetTable943,
g_FieldOffsetTable944,
g_FieldOffsetTable945,
NULL,
NULL,
NULL,
g_FieldOffsetTable949,
g_FieldOffsetTable950,
g_FieldOffsetTable951,
g_FieldOffsetTable952,
g_FieldOffsetTable953,
g_FieldOffsetTable954,
g_FieldOffsetTable955,
g_FieldOffsetTable956,
NULL,
g_FieldOffsetTable958,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable970,
g_FieldOffsetTable971,
g_FieldOffsetTable972,
g_FieldOffsetTable973,
g_FieldOffsetTable974,
NULL,
g_FieldOffsetTable976,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable984,
g_FieldOffsetTable985,
g_FieldOffsetTable986,
NULL,
g_FieldOffsetTable988,
NULL,
NULL,
NULL,
g_FieldOffsetTable992,
NULL,
g_FieldOffsetTable994,
g_FieldOffsetTable995,
g_FieldOffsetTable996,
NULL,
g_FieldOffsetTable998,
NULL,
g_FieldOffsetTable1000,
g_FieldOffsetTable1001,
g_FieldOffsetTable1002,
g_FieldOffsetTable1003,
g_FieldOffsetTable1004,
g_FieldOffsetTable1005,
g_FieldOffsetTable1006,
g_FieldOffsetTable1007,
g_FieldOffsetTable1008,
g_FieldOffsetTable1009,
g_FieldOffsetTable1010,
g_FieldOffsetTable1011,
g_FieldOffsetTable1012,
g_FieldOffsetTable1013,
g_FieldOffsetTable1014,
g_FieldOffsetTable1015,
g_FieldOffsetTable1016,
g_FieldOffsetTable1017,
NULL,
g_FieldOffsetTable1019,
g_FieldOffsetTable1020,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1030,
g_FieldOffsetTable1031,
g_FieldOffsetTable1032,
g_FieldOffsetTable1033,
g_FieldOffsetTable1034,
g_FieldOffsetTable1035,
g_FieldOffsetTable1036,
g_FieldOffsetTable1037,
NULL,
NULL,
NULL,
g_FieldOffsetTable1041,
g_FieldOffsetTable1042,
NULL,
g_FieldOffsetTable1044,
g_FieldOffsetTable1045,
g_FieldOffsetTable1046,
NULL,
NULL,
g_FieldOffsetTable1049,
NULL,
g_FieldOffsetTable1051,
g_FieldOffsetTable1052,
g_FieldOffsetTable1053,
g_FieldOffsetTable1054,
g_FieldOffsetTable1055,
g_FieldOffsetTable1056,
g_FieldOffsetTable1057,
g_FieldOffsetTable1058,
g_FieldOffsetTable1059,
g_FieldOffsetTable1060,
g_FieldOffsetTable1061,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1066,
g_FieldOffsetTable1067,
g_FieldOffsetTable1068,
g_FieldOffsetTable1069,
g_FieldOffsetTable1070,
g_FieldOffsetTable1071,
g_FieldOffsetTable1072,
g_FieldOffsetTable1073,
g_FieldOffsetTable1074,
g_FieldOffsetTable1075,
g_FieldOffsetTable1076,
g_FieldOffsetTable1077,
NULL,
NULL,
g_FieldOffsetTable1080,
g_FieldOffsetTable1081,
NULL,
g_FieldOffsetTable1083,
g_FieldOffsetTable1084,
NULL,
NULL,
g_FieldOffsetTable1087,
NULL,
NULL,
NULL,
g_FieldOffsetTable1091,
NULL,
g_FieldOffsetTable1093,
NULL,
g_FieldOffsetTable1095,
g_FieldOffsetTable1096,
g_FieldOffsetTable1097,
g_FieldOffsetTable1098,
g_FieldOffsetTable1099,
g_FieldOffsetTable1100,
g_FieldOffsetTable1101,
g_FieldOffsetTable1102,
g_FieldOffsetTable1103,
g_FieldOffsetTable1104,
NULL,
g_FieldOffsetTable1106,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1111,
g_FieldOffsetTable1112,
g_FieldOffsetTable1113,
g_FieldOffsetTable1114,
g_FieldOffsetTable1115,
g_FieldOffsetTable1116,
g_FieldOffsetTable1117,
NULL,
g_FieldOffsetTable1119,
NULL,
NULL,
NULL,
g_FieldOffsetTable1123,
g_FieldOffsetTable1124,
g_FieldOffsetTable1125,
g_FieldOffsetTable1126,
g_FieldOffsetTable1127,
g_FieldOffsetTable1128,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1144,
g_FieldOffsetTable1145,
g_FieldOffsetTable1146,
NULL,
g_FieldOffsetTable1148,
g_FieldOffsetTable1149,
g_FieldOffsetTable1150,
g_FieldOffsetTable1151,
g_FieldOffsetTable1152,
NULL,
NULL,
g_FieldOffsetTable1155,
g_FieldOffsetTable1156,
g_FieldOffsetTable1157,
g_FieldOffsetTable1158,
NULL,
g_FieldOffsetTable1160,
g_FieldOffsetTable1161,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1173,
g_FieldOffsetTable1174,
g_FieldOffsetTable1175,
g_FieldOffsetTable1176,
NULL,
g_FieldOffsetTable1178,
g_FieldOffsetTable1179,
NULL,
g_FieldOffsetTable1181,
g_FieldOffsetTable1182,
NULL,
g_FieldOffsetTable1184,
g_FieldOffsetTable1185,
g_FieldOffsetTable1186,
g_FieldOffsetTable1187,
g_FieldOffsetTable1188,
g_FieldOffsetTable1189,
g_FieldOffsetTable1190,
g_FieldOffsetTable1191,
NULL,
NULL,
NULL,
g_FieldOffsetTable1195,
NULL,
NULL,
g_FieldOffsetTable1198,
g_FieldOffsetTable1199,
g_FieldOffsetTable1200,
g_FieldOffsetTable1201,
g_FieldOffsetTable1202,
g_FieldOffsetTable1203,
g_FieldOffsetTable1204,
g_FieldOffsetTable1205,
g_FieldOffsetTable1206,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1211,
g_FieldOffsetTable1212,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1217,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1238,
g_FieldOffsetTable1239,
NULL,
NULL,
NULL,
g_FieldOffsetTable1243,
g_FieldOffsetTable1244,
g_FieldOffsetTable1245,
g_FieldOffsetTable1246,
g_FieldOffsetTable1247,
g_FieldOffsetTable1248,
g_FieldOffsetTable1249,
g_FieldOffsetTable1250,
g_FieldOffsetTable1251,
g_FieldOffsetTable1252,
NULL,
g_FieldOffsetTable1254,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1297,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1307,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1314,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1319,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1324,
g_FieldOffsetTable1325,
g_FieldOffsetTable1326,
g_FieldOffsetTable1327,
g_FieldOffsetTable1328,
g_FieldOffsetTable1329,
NULL,
g_FieldOffsetTable1331,
g_FieldOffsetTable1332,
g_FieldOffsetTable1333,
g_FieldOffsetTable1334,
g_FieldOffsetTable1335,
g_FieldOffsetTable1336,
g_FieldOffsetTable1337,
g_FieldOffsetTable1338,
NULL,
g_FieldOffsetTable1340,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1345,
g_FieldOffsetTable1346,
NULL,
g_FieldOffsetTable1348,
g_FieldOffsetTable1349,
NULL,
g_FieldOffsetTable1351,
g_FieldOffsetTable1352,
g_FieldOffsetTable1353,
g_FieldOffsetTable1354,
g_FieldOffsetTable1355,
g_FieldOffsetTable1356,
g_FieldOffsetTable1357,
g_FieldOffsetTable1358,
g_FieldOffsetTable1359,
NULL,
g_FieldOffsetTable1361,
g_FieldOffsetTable1362,
g_FieldOffsetTable1363,
g_FieldOffsetTable1364,
g_FieldOffsetTable1365,
g_FieldOffsetTable1366,
g_FieldOffsetTable1367,
g_FieldOffsetTable1368,
g_FieldOffsetTable1369,
g_FieldOffsetTable1370,
g_FieldOffsetTable1371,
g_FieldOffsetTable1372,
g_FieldOffsetTable1373,
g_FieldOffsetTable1374,
g_FieldOffsetTable1375,
g_FieldOffsetTable1376,
g_FieldOffsetTable1377,
NULL,
g_FieldOffsetTable1379,
g_FieldOffsetTable1380,
g_FieldOffsetTable1381,
NULL,
g_FieldOffsetTable1383,
NULL,
NULL,
g_FieldOffsetTable1386,
NULL,
g_FieldOffsetTable1388,
g_FieldOffsetTable1389,
g_FieldOffsetTable1390,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1398,
g_FieldOffsetTable1399,
g_FieldOffsetTable1400,
NULL,
g_FieldOffsetTable1402,
g_FieldOffsetTable1403,
g_FieldOffsetTable1404,
g_FieldOffsetTable1405,
NULL,
g_FieldOffsetTable1407,
g_FieldOffsetTable1408,
g_FieldOffsetTable1409,
g_FieldOffsetTable1410,
NULL,
g_FieldOffsetTable1412,
g_FieldOffsetTable1413,
g_FieldOffsetTable1414,
g_FieldOffsetTable1415,
g_FieldOffsetTable1416,
g_FieldOffsetTable1417,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1422,
g_FieldOffsetTable1423,
g_FieldOffsetTable1424,
g_FieldOffsetTable1425,
g_FieldOffsetTable1426,
NULL,
g_FieldOffsetTable1428,
g_FieldOffsetTable1429,
g_FieldOffsetTable1430,
g_FieldOffsetTable1431,
g_FieldOffsetTable1432,
g_FieldOffsetTable1433,
g_FieldOffsetTable1434,
NULL,
NULL,
g_FieldOffsetTable1437,
g_FieldOffsetTable1438,
g_FieldOffsetTable1439,
g_FieldOffsetTable1440,
g_FieldOffsetTable1441,
NULL,
NULL,
g_FieldOffsetTable1444,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1468,
g_FieldOffsetTable1469,
g_FieldOffsetTable1470,
g_FieldOffsetTable1471,
g_FieldOffsetTable1472,
g_FieldOffsetTable1473,
g_FieldOffsetTable1474,
g_FieldOffsetTable1475,
g_FieldOffsetTable1476,
g_FieldOffsetTable1477,
g_FieldOffsetTable1478,
g_FieldOffsetTable1479,
g_FieldOffsetTable1480,
g_FieldOffsetTable1481,
g_FieldOffsetTable1482,
g_FieldOffsetTable1483,
NULL,
g_FieldOffsetTable1485,
NULL,
NULL,
NULL,
g_FieldOffsetTable1489,
g_FieldOffsetTable1490,
g_FieldOffsetTable1491,
g_FieldOffsetTable1492,
g_FieldOffsetTable1493,
g_FieldOffsetTable1494,
g_FieldOffsetTable1495,
g_FieldOffsetTable1496,
g_FieldOffsetTable1497,
g_FieldOffsetTable1498,
NULL,
g_FieldOffsetTable1500,
g_FieldOffsetTable1501,
g_FieldOffsetTable1502,
g_FieldOffsetTable1503,
g_FieldOffsetTable1504,
NULL,
NULL,
g_FieldOffsetTable1507,
NULL,
NULL,
NULL,
g_FieldOffsetTable1511,
NULL,
NULL,
g_FieldOffsetTable1514,
g_FieldOffsetTable1515,
g_FieldOffsetTable1516,
g_FieldOffsetTable1517,
g_FieldOffsetTable1518,
g_FieldOffsetTable1519,
g_FieldOffsetTable1520,
g_FieldOffsetTable1521,
NULL,
g_FieldOffsetTable1523,
g_FieldOffsetTable1524,
NULL,
NULL,
g_FieldOffsetTable1527,
g_FieldOffsetTable1528,
g_FieldOffsetTable1529,
g_FieldOffsetTable1530,
NULL,
g_FieldOffsetTable1532,
g_FieldOffsetTable1533,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1538,
g_FieldOffsetTable1539,
g_FieldOffsetTable1540,
NULL,
NULL,
g_FieldOffsetTable1543,
NULL,
NULL,
NULL,
g_FieldOffsetTable1547,
NULL,
g_FieldOffsetTable1549,
g_FieldOffsetTable1550,
g_FieldOffsetTable1551,
g_FieldOffsetTable1552,
g_FieldOffsetTable1553,
NULL,
NULL,
g_FieldOffsetTable1556,
g_FieldOffsetTable1557,
g_FieldOffsetTable1558,
g_FieldOffsetTable1559,
g_FieldOffsetTable1560,
g_FieldOffsetTable1561,
g_FieldOffsetTable1562,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1569,
g_FieldOffsetTable1570,
g_FieldOffsetTable1571,
g_FieldOffsetTable1572,
g_FieldOffsetTable1573,
NULL,
g_FieldOffsetTable1575,
g_FieldOffsetTable1576,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1592,
NULL,
g_FieldOffsetTable1594,
NULL,
g_FieldOffsetTable1596,
g_FieldOffsetTable1597,
g_FieldOffsetTable1598,
g_FieldOffsetTable1599,
g_FieldOffsetTable1600,
g_FieldOffsetTable1601,
NULL,
NULL,
g_FieldOffsetTable1604,
g_FieldOffsetTable1605,
g_FieldOffsetTable1606,
g_FieldOffsetTable1607,
g_FieldOffsetTable1608,
g_FieldOffsetTable1609,
g_FieldOffsetTable1610,
NULL,
g_FieldOffsetTable1612,
g_FieldOffsetTable1613,
NULL,
g_FieldOffsetTable1615,
g_FieldOffsetTable1616,
g_FieldOffsetTable1617,
NULL,
g_FieldOffsetTable1619,
NULL,
g_FieldOffsetTable1621,
g_FieldOffsetTable1622,
g_FieldOffsetTable1623,
g_FieldOffsetTable1624,
g_FieldOffsetTable1625,
NULL,
g_FieldOffsetTable1627,
g_FieldOffsetTable1628,
g_FieldOffsetTable1629,
g_FieldOffsetTable1630,
NULL,
g_FieldOffsetTable1632,
NULL,
g_FieldOffsetTable1634,
g_FieldOffsetTable1635,
g_FieldOffsetTable1636,
NULL,
NULL,
g_FieldOffsetTable1639,
g_FieldOffsetTable1640,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1647,
g_FieldOffsetTable1648,
NULL,
g_FieldOffsetTable1650,
g_FieldOffsetTable1651,
g_FieldOffsetTable1652,
g_FieldOffsetTable1653,
g_FieldOffsetTable1654,
g_FieldOffsetTable1655,
g_FieldOffsetTable1656,
g_FieldOffsetTable1657,
g_FieldOffsetTable1658,
g_FieldOffsetTable1659,
g_FieldOffsetTable1660,
g_FieldOffsetTable1661,
g_FieldOffsetTable1662,
g_FieldOffsetTable1663,
g_FieldOffsetTable1664,
g_FieldOffsetTable1665,
g_FieldOffsetTable1666,
g_FieldOffsetTable1667,
g_FieldOffsetTable1668,
NULL,
NULL,
g_FieldOffsetTable1671,
NULL,
g_FieldOffsetTable1673,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1681,
NULL,
NULL,
g_FieldOffsetTable1684,
NULL,
g_FieldOffsetTable1686,
g_FieldOffsetTable1687,
g_FieldOffsetTable1688,
g_FieldOffsetTable1689,
g_FieldOffsetTable1690,
g_FieldOffsetTable1691,
g_FieldOffsetTable1692,
g_FieldOffsetTable1693,
g_FieldOffsetTable1694,
g_FieldOffsetTable1695,
NULL,
NULL,
NULL,
g_FieldOffsetTable1699,
g_FieldOffsetTable1700,
g_FieldOffsetTable1701,
NULL,
g_FieldOffsetTable1703,
NULL,
g_FieldOffsetTable1705,
NULL,
g_FieldOffsetTable1707,
g_FieldOffsetTable1708,
NULL,
g_FieldOffsetTable1710,
g_FieldOffsetTable1711,
g_FieldOffsetTable1712,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1717,
g_FieldOffsetTable1718,
NULL,
NULL,
NULL,
g_FieldOffsetTable1722,
NULL,
NULL,
g_FieldOffsetTable1725,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1735,
g_FieldOffsetTable1736,
NULL,
g_FieldOffsetTable1738,
NULL,
g_FieldOffsetTable1740,
NULL,
g_FieldOffsetTable1742,
NULL,
g_FieldOffsetTable1744,
NULL,
g_FieldOffsetTable1746,
g_FieldOffsetTable1747,
g_FieldOffsetTable1748,
g_FieldOffsetTable1749,
NULL,
NULL,
g_FieldOffsetTable1752,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1758,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1764,
NULL,
g_FieldOffsetTable1766,
g_FieldOffsetTable1767,
NULL,
NULL,
NULL,
g_FieldOffsetTable1771,
g_FieldOffsetTable1772,
NULL,
g_FieldOffsetTable1774,
g_FieldOffsetTable1775,
g_FieldOffsetTable1776,
g_FieldOffsetTable1777,
NULL,
g_FieldOffsetTable1779,
NULL,
g_FieldOffsetTable1781,
g_FieldOffsetTable1782,
g_FieldOffsetTable1783,
g_FieldOffsetTable1784,
g_FieldOffsetTable1785,
g_FieldOffsetTable1786,
g_FieldOffsetTable1787,
g_FieldOffsetTable1788,
g_FieldOffsetTable1789,
g_FieldOffsetTable1790,
g_FieldOffsetTable1791,
NULL,
g_FieldOffsetTable1793,
NULL,
g_FieldOffsetTable1795,
NULL,
g_FieldOffsetTable1797,
NULL,
g_FieldOffsetTable1799,
NULL,
g_FieldOffsetTable1801,
g_FieldOffsetTable1802,
NULL,
NULL,
g_FieldOffsetTable1805,
g_FieldOffsetTable1806,
g_FieldOffsetTable1807,
g_FieldOffsetTable1808,
g_FieldOffsetTable1809,
g_FieldOffsetTable1810,
g_FieldOffsetTable1811,
NULL,
g_FieldOffsetTable1813,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable1946,
g_FieldOffsetTable1947,
g_FieldOffsetTable1948,
g_FieldOffsetTable1949,
g_FieldOffsetTable1950,
NULL,
NULL,
g_FieldOffsetTable1953,
g_FieldOffsetTable1954,
g_FieldOffsetTable1955,
g_FieldOffsetTable1956,
g_FieldOffsetTable1957,
g_FieldOffsetTable1958,
NULL,
g_FieldOffsetTable1960,
g_FieldOffsetTable1961,
NULL,
g_FieldOffsetTable1963,
g_FieldOffsetTable1964,
g_FieldOffsetTable1965,
g_FieldOffsetTable1966,
g_FieldOffsetTable1967,
NULL,
g_FieldOffsetTable1969,
g_FieldOffsetTable1970,
g_FieldOffsetTable1971,
g_FieldOffsetTable1972,
g_FieldOffsetTable1973,
g_FieldOffsetTable1974,
g_FieldOffsetTable1975,
g_FieldOffsetTable1976,
NULL,
g_FieldOffsetTable1978,
g_FieldOffsetTable1979,
g_FieldOffsetTable1980,
g_FieldOffsetTable1981,
g_FieldOffsetTable1982,
NULL,
g_FieldOffsetTable1984,
g_FieldOffsetTable1985,
g_FieldOffsetTable1986,
g_FieldOffsetTable1987,
g_FieldOffsetTable1988,
g_FieldOffsetTable1989,
g_FieldOffsetTable1990,
g_FieldOffsetTable1991,
g_FieldOffsetTable1992,
NULL,
g_FieldOffsetTable1994,
g_FieldOffsetTable1995,
g_FieldOffsetTable1996,
NULL,
NULL,
NULL,
g_FieldOffsetTable2000,
NULL,
NULL,
NULL,
g_FieldOffsetTable2004,
g_FieldOffsetTable2005,
g_FieldOffsetTable2006,
g_FieldOffsetTable2007,
g_FieldOffsetTable2008,
g_FieldOffsetTable2009,
g_FieldOffsetTable2010,
NULL,
g_FieldOffsetTable2012,
g_FieldOffsetTable2013,
g_FieldOffsetTable2014,
g_FieldOffsetTable2015,
g_FieldOffsetTable2016,
g_FieldOffsetTable2017,
g_FieldOffsetTable2018,
g_FieldOffsetTable2019,
g_FieldOffsetTable2020,
g_FieldOffsetTable2021,
g_FieldOffsetTable2022,
g_FieldOffsetTable2023,
NULL,
NULL,
g_FieldOffsetTable2026,
g_FieldOffsetTable2027,
g_FieldOffsetTable2028,
g_FieldOffsetTable2029,
g_FieldOffsetTable2030,
g_FieldOffsetTable2031,
NULL,
NULL,
g_FieldOffsetTable2034,
g_FieldOffsetTable2035,
g_FieldOffsetTable2036,
g_FieldOffsetTable2037,
g_FieldOffsetTable2038,
g_FieldOffsetTable2039,
NULL,
NULL,
g_FieldOffsetTable2042,
g_FieldOffsetTable2043,
g_FieldOffsetTable2044,
g_FieldOffsetTable2045,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2053,
g_FieldOffsetTable2054,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2059,
NULL,
NULL,
g_FieldOffsetTable2062,
NULL,
NULL,
NULL,
g_FieldOffsetTable2066,
NULL,
g_FieldOffsetTable2068,
g_FieldOffsetTable2069,
g_FieldOffsetTable2070,
NULL,
g_FieldOffsetTable2072,
NULL,
g_FieldOffsetTable2074,
g_FieldOffsetTable2075,
NULL,
g_FieldOffsetTable2077,
g_FieldOffsetTable2078,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2083,
g_FieldOffsetTable2084,
g_FieldOffsetTable2085,
g_FieldOffsetTable2086,
g_FieldOffsetTable2087,
g_FieldOffsetTable2088,
g_FieldOffsetTable2089,
g_FieldOffsetTable2090,
g_FieldOffsetTable2091,
g_FieldOffsetTable2092,
g_FieldOffsetTable2093,
g_FieldOffsetTable2094,
g_FieldOffsetTable2095,
g_FieldOffsetTable2096,
g_FieldOffsetTable2097,
g_FieldOffsetTable2098,
g_FieldOffsetTable2099,
g_FieldOffsetTable2100,
g_FieldOffsetTable2101,
g_FieldOffsetTable2102,
NULL,
g_FieldOffsetTable2104,
NULL,
g_FieldOffsetTable2106,
g_FieldOffsetTable2107,
NULL,
g_FieldOffsetTable2109,
g_FieldOffsetTable2110,
g_FieldOffsetTable2111,
g_FieldOffsetTable2112,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2123,
NULL,
NULL,
g_FieldOffsetTable2126,
g_FieldOffsetTable2127,
g_FieldOffsetTable2128,
NULL,
NULL,
NULL,
g_FieldOffsetTable2132,
g_FieldOffsetTable2133,
g_FieldOffsetTable2134,
g_FieldOffsetTable2135,
g_FieldOffsetTable2136,
g_FieldOffsetTable2137,
g_FieldOffsetTable2138,
NULL,
NULL,
g_FieldOffsetTable2141,
g_FieldOffsetTable2142,
g_FieldOffsetTable2143,
NULL,
g_FieldOffsetTable2145,
NULL,
g_FieldOffsetTable2147,
NULL,
g_FieldOffsetTable2149,
NULL,
NULL,
g_FieldOffsetTable2152,
g_FieldOffsetTable2153,
g_FieldOffsetTable2154,
g_FieldOffsetTable2155,
g_FieldOffsetTable2156,
g_FieldOffsetTable2157,
g_FieldOffsetTable2158,
NULL,
NULL,
g_FieldOffsetTable2161,
g_FieldOffsetTable2162,
g_FieldOffsetTable2163,
g_FieldOffsetTable2164,
g_FieldOffsetTable2165,
g_FieldOffsetTable2166,
NULL,
NULL,
g_FieldOffsetTable2169,
g_FieldOffsetTable2170,
g_FieldOffsetTable2171,
g_FieldOffsetTable2172,
g_FieldOffsetTable2173,
g_FieldOffsetTable2174,
NULL,
g_FieldOffsetTable2176,
g_FieldOffsetTable2177,
g_FieldOffsetTable2178,
NULL,
NULL,
g_FieldOffsetTable2181,
g_FieldOffsetTable2182,
g_FieldOffsetTable2183,
NULL,
NULL,
NULL,
g_FieldOffsetTable2187,
g_FieldOffsetTable2188,
NULL,
NULL,
g_FieldOffsetTable2191,
NULL,
NULL,
NULL,
g_FieldOffsetTable2195,
g_FieldOffsetTable2196,
g_FieldOffsetTable2197,
g_FieldOffsetTable2198,
g_FieldOffsetTable2199,
g_FieldOffsetTable2200,
NULL,
g_FieldOffsetTable2202,
NULL,
g_FieldOffsetTable2204,
NULL,
g_FieldOffsetTable2206,
NULL,
g_FieldOffsetTable2208,
g_FieldOffsetTable2209,
g_FieldOffsetTable2210,
NULL,
g_FieldOffsetTable2212,
NULL,
g_FieldOffsetTable2214,
NULL,
g_FieldOffsetTable2216,
NULL,
NULL,
g_FieldOffsetTable2219,
g_FieldOffsetTable2220,
g_FieldOffsetTable2221,
NULL,
NULL,
NULL,
g_FieldOffsetTable2225,
g_FieldOffsetTable2226,
g_FieldOffsetTable2227,
g_FieldOffsetTable2228,
NULL,
NULL,
g_FieldOffsetTable2231,
g_FieldOffsetTable2232,
NULL,
g_FieldOffsetTable2234,
g_FieldOffsetTable2235,
g_FieldOffsetTable2236,
g_FieldOffsetTable2237,
NULL,
NULL,
g_FieldOffsetTable2240,
g_FieldOffsetTable2241,
NULL,
g_FieldOffsetTable2243,
g_FieldOffsetTable2244,
NULL,
g_FieldOffsetTable2246,
NULL,
g_FieldOffsetTable2248,
g_FieldOffsetTable2249,
g_FieldOffsetTable2250,
g_FieldOffsetTable2251,
g_FieldOffsetTable2252,
g_FieldOffsetTable2253,
NULL,
g_FieldOffsetTable2255,
NULL,
g_FieldOffsetTable2257,
NULL,
g_FieldOffsetTable2259,
g_FieldOffsetTable2260,
NULL,
g_FieldOffsetTable2262,
g_FieldOffsetTable2263,
g_FieldOffsetTable2264,
g_FieldOffsetTable2265,
g_FieldOffsetTable2266,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2272,
g_FieldOffsetTable2273,
g_FieldOffsetTable2274,
g_FieldOffsetTable2275,
g_FieldOffsetTable2276,
NULL,
g_FieldOffsetTable2278,
g_FieldOffsetTable2279,
NULL,
NULL,
g_FieldOffsetTable2282,
g_FieldOffsetTable2283,
g_FieldOffsetTable2284,
g_FieldOffsetTable2285,
g_FieldOffsetTable2286,
g_FieldOffsetTable2287,
g_FieldOffsetTable2288,
g_FieldOffsetTable2289,
g_FieldOffsetTable2290,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2299,
NULL,
g_FieldOffsetTable2301,
g_FieldOffsetTable2302,
g_FieldOffsetTable2303,
g_FieldOffsetTable2304,
g_FieldOffsetTable2305,
g_FieldOffsetTable2306,
g_FieldOffsetTable2307,
g_FieldOffsetTable2308,
g_FieldOffsetTable2309,
g_FieldOffsetTable2310,
g_FieldOffsetTable2311,
g_FieldOffsetTable2312,
g_FieldOffsetTable2313,
g_FieldOffsetTable2314,
g_FieldOffsetTable2315,
g_FieldOffsetTable2316,
g_FieldOffsetTable2317,
g_FieldOffsetTable2318,
g_FieldOffsetTable2319,
g_FieldOffsetTable2320,
g_FieldOffsetTable2321,
g_FieldOffsetTable2322,
g_FieldOffsetTable2323,
g_FieldOffsetTable2324,
g_FieldOffsetTable2325,
g_FieldOffsetTable2326,
g_FieldOffsetTable2327,
g_FieldOffsetTable2328,
g_FieldOffsetTable2329,
g_FieldOffsetTable2330,
g_FieldOffsetTable2331,
g_FieldOffsetTable2332,
g_FieldOffsetTable2333,
g_FieldOffsetTable2334,
g_FieldOffsetTable2335,
g_FieldOffsetTable2336,
g_FieldOffsetTable2337,
g_FieldOffsetTable2338,
g_FieldOffsetTable2339,
g_FieldOffsetTable2340,
g_FieldOffsetTable2341,
g_FieldOffsetTable2342,
g_FieldOffsetTable2343,
g_FieldOffsetTable2344,
g_FieldOffsetTable2345,
g_FieldOffsetTable2346,
g_FieldOffsetTable2347,
g_FieldOffsetTable2348,
g_FieldOffsetTable2349,
g_FieldOffsetTable2350,
g_FieldOffsetTable2351,
g_FieldOffsetTable2352,
g_FieldOffsetTable2353,
g_FieldOffsetTable2354,
g_FieldOffsetTable2355,
g_FieldOffsetTable2356,
g_FieldOffsetTable2357,
g_FieldOffsetTable2358,
g_FieldOffsetTable2359,
g_FieldOffsetTable2360,
NULL,
g_FieldOffsetTable2362,
g_FieldOffsetTable2363,
NULL,
NULL,
g_FieldOffsetTable2366,
g_FieldOffsetTable2367,
g_FieldOffsetTable2368,
g_FieldOffsetTable2369,
g_FieldOffsetTable2370,
g_FieldOffsetTable2371,
g_FieldOffsetTable2372,
g_FieldOffsetTable2373,
g_FieldOffsetTable2374,
g_FieldOffsetTable2375,
g_FieldOffsetTable2376,
g_FieldOffsetTable2377,
g_FieldOffsetTable2378,
NULL,
g_FieldOffsetTable2380,
g_FieldOffsetTable2381,
g_FieldOffsetTable2382,
g_FieldOffsetTable2383,
g_FieldOffsetTable2384,
g_FieldOffsetTable2385,
g_FieldOffsetTable2386,
g_FieldOffsetTable2387,
g_FieldOffsetTable2388,
g_FieldOffsetTable2389,
NULL,
g_FieldOffsetTable2391,
g_FieldOffsetTable2392,
g_FieldOffsetTable2393,
g_FieldOffsetTable2394,
g_FieldOffsetTable2395,
g_FieldOffsetTable2396,
g_FieldOffsetTable2397,
g_FieldOffsetTable2398,
NULL,
NULL,
g_FieldOffsetTable2401,
NULL,
g_FieldOffsetTable2403,
NULL,
g_FieldOffsetTable2405,
NULL,
g_FieldOffsetTable2407,
g_FieldOffsetTable2408,
g_FieldOffsetTable2409,
g_FieldOffsetTable2410,
g_FieldOffsetTable2411,
NULL,
g_FieldOffsetTable2413,
g_FieldOffsetTable2414,
g_FieldOffsetTable2415,
g_FieldOffsetTable2416,
g_FieldOffsetTable2417,
g_FieldOffsetTable2418,
g_FieldOffsetTable2419,
g_FieldOffsetTable2420,
g_FieldOffsetTable2421,
NULL,
NULL,
NULL,
g_FieldOffsetTable2425,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2432,
g_FieldOffsetTable2433,
g_FieldOffsetTable2434,
g_FieldOffsetTable2435,
NULL,
g_FieldOffsetTable2437,
NULL,
NULL,
g_FieldOffsetTable2440,
NULL,
g_FieldOffsetTable2442,
g_FieldOffsetTable2443,
g_FieldOffsetTable2444,
g_FieldOffsetTable2445,
g_FieldOffsetTable2446,
g_FieldOffsetTable2447,
g_FieldOffsetTable2448,
g_FieldOffsetTable2449,
g_FieldOffsetTable2450,
g_FieldOffsetTable2451,
NULL,
g_FieldOffsetTable2453,
g_FieldOffsetTable2454,
g_FieldOffsetTable2455,
g_FieldOffsetTable2456,
g_FieldOffsetTable2457,
g_FieldOffsetTable2458,
g_FieldOffsetTable2459,
g_FieldOffsetTable2460,
g_FieldOffsetTable2461,
g_FieldOffsetTable2462,
g_FieldOffsetTable2463,
g_FieldOffsetTable2464,
g_FieldOffsetTable2465,
NULL,
g_FieldOffsetTable2467,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2472,
g_FieldOffsetTable2473,
g_FieldOffsetTable2474,
g_FieldOffsetTable2475,
g_FieldOffsetTable2476,
NULL,
NULL,
g_FieldOffsetTable2479,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2484,
g_FieldOffsetTable2485,
NULL,
g_FieldOffsetTable2487,
g_FieldOffsetTable2488,
g_FieldOffsetTable2489,
g_FieldOffsetTable2490,
g_FieldOffsetTable2491,
g_FieldOffsetTable2492,
g_FieldOffsetTable2493,
g_FieldOffsetTable2494,
g_FieldOffsetTable2495,
g_FieldOffsetTable2496,
g_FieldOffsetTable2497,
g_FieldOffsetTable2498,
g_FieldOffsetTable2499,
g_FieldOffsetTable2500,
g_FieldOffsetTable2501,
g_FieldOffsetTable2502,
g_FieldOffsetTable2503,
g_FieldOffsetTable2504,
NULL,
g_FieldOffsetTable2506,
g_FieldOffsetTable2507,
g_FieldOffsetTable2508,
NULL,
g_FieldOffsetTable2510,
g_FieldOffsetTable2511,
g_FieldOffsetTable2512,
g_FieldOffsetTable2513,
g_FieldOffsetTable2514,
g_FieldOffsetTable2515,
g_FieldOffsetTable2516,
g_FieldOffsetTable2517,
g_FieldOffsetTable2518,
g_FieldOffsetTable2519,
g_FieldOffsetTable2520,
g_FieldOffsetTable2521,
g_FieldOffsetTable2522,
g_FieldOffsetTable2523,
g_FieldOffsetTable2524,
g_FieldOffsetTable2525,
NULL,
g_FieldOffsetTable2527,
g_FieldOffsetTable2528,
g_FieldOffsetTable2529,
g_FieldOffsetTable2530,
g_FieldOffsetTable2531,
g_FieldOffsetTable2532,
NULL,
g_FieldOffsetTable2534,
g_FieldOffsetTable2535,
g_FieldOffsetTable2536,
g_FieldOffsetTable2537,
g_FieldOffsetTable2538,
g_FieldOffsetTable2539,
g_FieldOffsetTable2540,
g_FieldOffsetTable2541,
g_FieldOffsetTable2542,
g_FieldOffsetTable2543,
NULL,
g_FieldOffsetTable2545,
g_FieldOffsetTable2546,
g_FieldOffsetTable2547,
g_FieldOffsetTable2548,
g_FieldOffsetTable2549,
g_FieldOffsetTable2550,
g_FieldOffsetTable2551,
g_FieldOffsetTable2552,
g_FieldOffsetTable2553,
g_FieldOffsetTable2554,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2559,
NULL,
NULL,
g_FieldOffsetTable2562,
NULL,
g_FieldOffsetTable2564,
NULL,
NULL,
NULL,
g_FieldOffsetTable2568,
g_FieldOffsetTable2569,
NULL,
NULL,
NULL,
g_FieldOffsetTable2573,
g_FieldOffsetTable2574,
g_FieldOffsetTable2575,
g_FieldOffsetTable2576,
NULL,
NULL,
NULL,
g_FieldOffsetTable2580,
NULL,
NULL,
NULL,
NULL,
g_FieldOffsetTable2585,
g_FieldOffsetTable2586,
g_FieldOffsetTable2587,
g_FieldOffsetTable2588,
g_FieldOffsetTable2589,
NULL,
g_FieldOffsetTable2591,
NULL,
g_FieldOffsetTable2593,
NULL,
NULL,
g_FieldOffsetTable2596,
g_FieldOffsetTable2597,
NULL,
NULL,
g_FieldOffsetTable2600,
NULL,
g_FieldOffsetTable2602,
g_FieldOffsetTable2603,
g_FieldOffsetTable2604,
NULL,
g_FieldOffsetTable2606,
NULL,
g_FieldOffsetTable2608,
g_FieldOffsetTable2609,
g_FieldOffsetTable2610,
NULL,
NULL,
g_FieldOffsetTable2613,
g_FieldOffsetTable2614,
NULL,
NULL,
g_FieldOffsetTable2617,
g_FieldOffsetTable2618,
g_FieldOffsetTable2619,
NULL,
NULL,
NULL,
g_FieldOffsetTable2623,
NULL,
g_FieldOffsetTable2625,
g_FieldOffsetTable2626,
g_FieldOffsetTable2627,
g_FieldOffsetTable2628,
g_FieldOffsetTable2629,
g_FieldOffsetTable2630,
g_FieldOffsetTable2631,
g_FieldOffsetTable2632,
g_FieldOffsetTable2633,
g_FieldOffsetTable2634,
g_FieldOffsetTable2635,
g_FieldOffsetTable2636,
g_FieldOffsetTable2637,
NULL,
NULL,
g_FieldOffsetTable2640,
NULL,
NULL,
NULL,
g_FieldOffsetTable2644,
NULL,
g_FieldOffsetTable2646,
g_FieldOffsetTable2647,
g_FieldOffsetTable2648,
g_FieldOffsetTable2649,
g_FieldOffsetTable2650,
NULL,
NULL,
g_FieldOffsetTable2653,
g_FieldOffsetTable2654,
g_FieldOffsetTable2655,
g_FieldOffsetTable2656,
g_FieldOffsetTable2657,
NULL,
g_FieldOffsetTable2659,
g_FieldOffsetTable2660,
NULL,
g_FieldOffsetTable2662,
NULL,
NULL,
NULL,
g_FieldOffsetTable2666,
g_FieldOffsetTable2667,
g_FieldOffsetTable2668,
g_FieldOffsetTable2669,
g_FieldOffsetTable2670,
g_FieldOffsetTable2671,
g_FieldOffsetTable2672,
g_FieldOffsetTable2673,
g_FieldOffsetTable2674,
NULL,
NULL,
g_FieldOffsetTable2677,
g_FieldOffsetTable2678,
NULL,
g_FieldOffsetTable2680,
g_FieldOffsetTable2681,
g_FieldOffsetTable2682,
g_FieldOffsetTable2683,
NULL,
g_FieldOffsetTable2685,
NULL,
NULL,
g_FieldOffsetTable2688,
NULL,
g_FieldOffsetTable2690,
g_FieldOffsetTable2691,
NULL,
NULL,
g_FieldOffsetTable2694,
NULL,
NULL,
g_FieldOffsetTable2697,
g_FieldOffsetTable2698,
g_FieldOffsetTable2699,
g_FieldOffsetTable2700,
g_FieldOffsetTable2701,
g_FieldOffsetTable2702,
NULL,
NULL,
NULL,
g_FieldOffsetTable2706,
NULL,
g_FieldOffsetTable2708,
g_FieldOffsetTable2709,
g_FieldOffsetTable2710,
g_FieldOffsetTable2711,
g_FieldOffsetTable2712,
g_FieldOffsetTable2713,
NULL,
NULL,
g_FieldOffsetTable2716,
g_FieldOffsetTable2717,
g_FieldOffsetTable2718,
g_FieldOffsetTable2719,
g_FieldOffsetTable2720,
NULL,
g_FieldOffsetTable2722,
g_FieldOffsetTable2723,
NULL,
NULL,
g_FieldOffsetTable2726,
NULL,
NULL,
g_FieldOffsetTable2729,
NULL,
NULL,
g_FieldOffsetTable2732,
g_FieldOffsetTable2733,
g_FieldOffsetTable2734,
g_FieldOffsetTable2735,
g_FieldOffsetTable2736,
g_FieldOffsetTable2737,
g_FieldOffsetTable2738,
g_FieldOffsetTable2739,
g_FieldOffsetTable2740,
g_FieldOffsetTable2741,
g_FieldOffsetTable2742,
g_FieldOffsetTable2743,
g_FieldOffsetTable2744,
g_FieldOffsetTable2745,
g_FieldOffsetTable2746,
g_FieldOffsetTable2747,
g_FieldOffsetTable2748,
NULL,
g_FieldOffsetTable2750,
g_FieldOffsetTable2751,
g_FieldOffsetTable2752,
NULL,
g_FieldOffsetTable2754,
g_FieldOffsetTable2755,
g_FieldOffsetTable2756,
g_FieldOffsetTable2757,
g_FieldOffsetTable2758,
g_FieldOffsetTable2759,
};
| [
"shibuiyusuke@gmail.com"
] | shibuiyusuke@gmail.com |
f20e0e6beca54b0cbdc65dfd49a71598e46e1d73 | 5f93a57aa92e38f072981f64d7ee4e41823b545e | /food/anp.cpp | f5e7d8817744aeb8d31ce1e95082a3cf36ae6ab0 | [] | no_license | RealtimeX/frash | 68d00d60ecbcef30db2581641e5ee18a99a2582f | 2b348361f0a1c5de49bfd577b5c4fe6f6d718f24 | refs/heads/master | 2021-01-18T07:39:26.802347 | 2010-07-08T03:46:56 | 2010-07-08T03:46:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 55,261 | cpp | #define ANDROID 1
#include <stdlib.h>
#define IOSFC_BUILDING_IOSFC
#include <IOSurface/IOSurfaceAPI.h>
#include <CoreGraphics/CoreGraphics.h>
#include <CoreFoundation/CoreFoundation.h>
#include <jni.h>
#include "npapi.h"
#include "android_npapi.h"
#include "ANPSystem_npapi.h"
#include "ANPSurface_npapi.h"
#include <math.h>
#include <mach/mach_port.h>
#define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER
#include <CoreText/CoreText.h>
#include <CoreText/CTStringAttributes.h>
#include "ANPSurface_npapi.h"
#include "common.h"
#include <AudioToolbox/AudioQueue.h>
#include <pthread.h>
static CGContextRef randomctx;
__attribute__((constructor))
void init_randomctx() {
randomctx = CGBitmapContextCreate(malloc(50*50*4), 50, 50, 8, 50*4, CGColorSpaceCreateDeviceRGB(), kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast);
_assert(randomctx);
}
CGRect rectFromRectF(const ANPRectF rectf) {
return CGRectMake(rectf.left, movie_h - rectf.bottom, rectf.right - rectf.left, rectf.bottom - rectf.top);
}
CGRect rectFromRectI(const ANPRectI recti) {
return CGRectMake(recti.left, movie_h - recti.bottom, recti.right - recti.left, recti.bottom - recti.top);
}
ANPRectF rectFFromRect(const CGRect rect) {
ANPRectF result;
result.left = rect.origin.x;
result.right = rect.origin.x + rect.size.width;
result.bottom = movie_w - rect.origin.y;
result.top = result.top - rect.size.height;
return result;
}
struct ANPBitmap bitmapFromIOSurface(IOSurfaceRef surface) {
struct ANPBitmap result;
result.baseAddr = IOSurfaceGetBaseAddress(surface);
result.width = IOSurfaceGetWidth(surface);
result.height = IOSurfaceGetHeight(surface);
result.rowBytes = IOSurfaceGetBytesPerRow(surface);
result.format = kRGBA_8888_ANPBitmapFormat; // XXX
return result;
}
struct ANPTypeface {
CFStringRef name;
ANPTypefaceStyle style;
int refcount;
};
// ANPBitmapInterfaceV0
bool bitmap_impl_getPixelPacking(ANPBitmapFormat, ANPPixelPacking* packing) {
// XXX
notice("bitmap_impl_getPixelPacking");
_abort();
//return true;
}
// ANPLogInterfaceV0
void log_impl_log(ANPLogType type, const char format[], ...) {
switch(type) {
case kDebug_ANPLogType:
fprintf(stderr, "[DBG] "); break;
case kWarning_ANPLogType:
fprintf(stderr, "[WRN] "); break;
case kError_ANPLogType:
fprintf(stderr, "[ERR] "); break;
default:
fprintf(stderr, "[???] "); break;
}
va_list ap;
va_start(ap, format);
vfprintf(stderr, format, ap);
va_end(ap);
}
// ANPAudioTrackInterfaceV0
struct ANPAudioTrack {
ANPAudioCallbackProc callbackProc;
AudioQueueRef aq;
AudioQueueBufferRef buf1, buf2, buf3;
int32_t channelCount;
ANPSampleFormat sampleFormat;
void *user;
bool stopped;
pthread_mutex_t mu;
};
void aqtry_(OSStatus ret, const char *name) {
if(!ret) return;
err("Audio error in %s:", name);
err("%d", (int) ret);
_abort();
}
#define aqtry(x) aqtry_(x, #x)
void trackCallbackProc (
void *inUserData,
AudioQueueRef inAQ,
AudioQueueBufferRef inBuffer
) {
notice("trackCallbackProc");
ANPAudioTrack *result = (ANPAudioTrack *) inUserData;
pthread_mutex_lock(&result->mu);
ANPAudioBuffer buffer;
buffer.channelCount = result->channelCount;
buffer.format = result->sampleFormat;
buffer.bufferData = inBuffer->mAudioData;
buffer.size = inBuffer->mAudioDataBytesCapacity;
/* call proc */
result->callbackProc(kMoreData_ANPAudioEvent, result->user, &buffer);
inBuffer->mAudioDataByteSize = buffer.size;
notice("%p potential: %d actual: %d", inBuffer, inBuffer->mAudioDataBytesCapacity, inBuffer->mAudioDataByteSize);
aqtry(AudioQueueEnqueueBuffer(result->aq, inBuffer, 0, NULL));
pthread_mutex_unlock(&result->mu);
}
/** Create a new audio track, or NULL on failure. The track is initially in
the stopped state and therefore ANPAudioCallbackProc will not be called
until the track is started.
*/
ANPAudioTrack* audiotrack_impl_newTrack(uint32_t sampleRate, // sampling rate in Hz
ANPSampleFormat sampleFormat,
int channelCount, // MONO=1, STEREO=2
ANPAudioCallbackProc callbackProc,
void* user) {
notice("channelCount: %d", channelCount);
notice("sampleFormat: %d", sampleFormat);
ANPAudioTrack *result = new ANPAudioTrack;
result->callbackProc = callbackProc;
result->channelCount = channelCount;
result->sampleFormat = sampleFormat;
result->user = user;
struct AudioStreamBasicDescription fmt;
int bits;
switch(sampleFormat) {
case kPCM16Bit_ANPSampleFormat: bits = 16; break;
case kPCM8Bit_ANPSampleFormat: bits = 8; break;
default: _abort();
}
FillOutASBDForLPCM(fmt, sampleRate, channelCount, bits, bits, false, false, false);
aqtry(AudioQueueNewOutput(&fmt, trackCallbackProc, result, NULL, NULL, 0, &result->aq));
aqtry(AudioQueueAllocateBuffer(result->aq, 65536, &result->buf1));
aqtry(AudioQueueAllocateBuffer(result->aq, 65536, &result->buf2));
aqtry(AudioQueueAllocateBuffer(result->aq, 65536, &result->buf3));
result->stopped = true;
pthread_mutex_init(&result->mu, NULL);
return result;
}
/** Deletes a track that was created using newTrack. The track can be
deleted in any state and it waits for the ANPAudioCallbackProc thread
to exit before returning.
*/
void audiotrack_impl_deleteTrack(ANPAudioTrack *track) {
notice("audiotrack_impl_deleteTrack");
aqtry(AudioQueueDispose(track->aq, false));
delete track;
}
void *audiotrack_starter(void *track_) {
ANPAudioTrack *track = (ANPAudioTrack *) track_;
trackCallbackProc(track, track->aq, track->buf1);
notice("OK TRACK CALLBACK IS DONE");
trackCallbackProc(track, track->aq, track->buf2);
//trackCallbackProc(track, track->aq, track->buf3);
return NULL;
}
void audiotrack_impl_start(ANPAudioTrack *track) {
notice("audiotrack_impl_start %p", track->aq);
//return;
track->stopped = false;
pthread_t thread;
pthread_create(&thread, NULL, audiotrack_starter, track);
aqtry(AudioQueueStart(track->aq, NULL));
}
void audiotrack_impl_pause(ANPAudioTrack *track) {
notice("audiotrack_impl_pause %p", track);
track->stopped = true;
aqtry(AudioQueuePause(track->aq));
}
void audiotrack_impl_stop(ANPAudioTrack *track) {
notice("audiotrack_impl_stop %p", track);
track->stopped = true;
aqtry(AudioQueueStop(track->aq, false));
}
/** Returns true if the track is not playing (e.g. pause or stop was called,
or start was never called.
*/
bool audiotrack_impl_isStopped(ANPAudioTrack *track) {
return track->stopped;
}
// ANPPaintInterfaceV0
struct ANPPaint {
ANPPaintJoin join;
ANPPaintFlags flags;
ANPPaintStyle style;
ANPPaintCap cap;
// XXX
ANPPaintAlign align;
ANPTextEncoding encoding;
ANPTypeface *typeface;
ANPTypefaceStyle typefaceStyle;
float textSkewX, textScaleX, textSize;
//
ANPColor color;
float strokeWidth, strokeMiter;
};
void typeface_impl_ref(ANPTypeface *typeface);
void typeface_impl_unref(ANPTypeface *typeface);
/** Return a new paint object, which holds all of the color and style
attributes that affect how things (geometry, text, bitmaps) are drawn
in a ANPCanvas.
The paint that is returned is not tied to any particular plugin
instance, but it must only be accessed from one thread at a time.
*/
ANPPaint* paint_impl_newPaint() {
ANPPaint *result = new ANPPaint;
memset(result, 0, sizeof(ANPPaint));
result->textScaleX = 1;
result->textSize = 12;
return result;
}
void paint_impl_deletePaint(ANPPaint *paint) {
if(paint->typeface) typeface_impl_unref(paint->typeface);
delete paint;
}
ANPPaintFlags paint_impl_getFlags(const ANPPaint *paint) {
notice("%s: flags = %d", __func__, paint->flags);
return paint->flags;
}
void paint_impl_setFlags(ANPPaint *paint, ANPPaintFlags flags) {
notice("%s: flags => %d", __func__, flags);
paint->flags = flags;
}
ANPColor paint_impl_getColor(const ANPPaint *paint) {
return paint->color;
}
void paint_impl_setColor(ANPPaint *paint, ANPColor color) {
paint->color = color;
}
ANPPaintStyle paint_impl_getStyle(const ANPPaint *paint) {
return paint->style;
}
void paint_impl_setStyle(ANPPaint *paint, ANPPaintStyle style) {
paint->style = style;
}
float paint_impl_getStrokeWidth(const ANPPaint *paint) {
return paint->strokeWidth;
}
float paint_impl_getStrokeMiter(const ANPPaint *paint) {
return paint->strokeMiter;
}
ANPPaintCap paint_impl_getStrokeCap(const ANPPaint *paint) {
return paint->cap;
}
ANPPaintJoin paint_impl_getStrokeJoin(const ANPPaint *paint) {
return paint->join;
}
void paint_impl_setStrokeWidth(ANPPaint *paint, float width) {
paint->strokeWidth = width;
}
void paint_impl_setStrokeMiter(ANPPaint *paint, float miter) {
paint->strokeMiter = miter;
}
void paint_impl_setStrokeCap(ANPPaint *paint, ANPPaintCap cap) {
paint->cap = cap;
}
void paint_impl_setStrokeJoin(ANPPaint *paint, ANPPaintJoin join) {
paint->join = join;
}
ANPTextEncoding paint_impl_getTextEncoding(const ANPPaint *paint) {
return paint->encoding;
}
ANPPaintAlign paint_impl_getTextAlign(const ANPPaint *paint) {
return paint->align;
}
float paint_impl_getTextSize(const ANPPaint *paint) {
return paint->textSize;
}
float paint_impl_getTextScaleX(const ANPPaint *paint) {
return paint->textScaleX;
}
float paint_impl_getTextSkewX(const ANPPaint *paint) {
return paint->textSkewX;
}
void paint_impl_setTextEncoding(ANPPaint *paint, ANPTextEncoding encoding) {
paint->encoding = encoding;
}
void paint_impl_setTextAlign(ANPPaint *paint, ANPPaintAlign align) {
paint->align = align;
}
void paint_impl_setTextSize(ANPPaint *paint, float size) {
paint->textSize = size;
}
void paint_impl_setTextScaleX(ANPPaint *paint, float scaleX) {
paint->textScaleX = scaleX;
}
void paint_impl_setTextSkewX(ANPPaint *paint, float skewX) {
paint->textSkewX = skewX;
}
/** Return the typeface ine paint, or null if there is none. This does not
modify the owner count of the returned typeface.
*/
ANPTypeface* paint_impl_getTypeface(const ANPPaint *paint) {
return paint->typeface;
}
/** Set the paint's typeface. If the paint already had a non-null typeface,
its owner count is decremented. If the new typeface is non-null, its
owner count is incremented.
*/
void paint_impl_setTypeface(ANPPaint *paint, ANPTypeface *typeface) {
if(paint->typeface) typeface_impl_unref(paint->typeface);
if(typeface) typeface_impl_ref(typeface);
paint->typeface = typeface;
}
CTFontRef paint_mkfont(const ANPPaint *paint) {
notice("(paint_mkfont)");
CGAffineTransform transform = CGAffineTransformMake(1, 0, paint->textSkewX, 1, 0, 0);
transform = CGAffineTransformScale(transform, paint->textScaleX, 1);
CTFontRef base = CTFontCreateWithName(paint->typeface->name, paint->textSize, &transform);
_assert(base);
CTFontSymbolicTraits traits = 0;
if(paint->style & kBold_ANPTypefaceStyle)
traits |= kCTFontBoldTrait;
if(paint->style & kItalic_ANPTypefaceStyle)
traits |= kCTFontItalicTrait;
return base;
// XXX this returns null?
CTFontRef result = CTFontCreateCopyWithSymbolicTraits(base, 0.0, NULL, traits, traits);
CFRelease(base);
return result;
}
CGColorRef color_getref(ANPColor color);
CFAttributedStringRef paint_mkats(const ANPPaint *paint, const void *text, uint32_t byteLength) {
CFStringRef string = CFStringCreateWithBytes(NULL, (const UInt8 *) text, byteLength, paint->encoding == kUTF16_ANPTextEncoding ? kCFStringEncodingUTF16 : kCFStringEncodingUTF8, false);
CFMutableDictionaryRef dict = CFDictionaryCreateMutable(NULL, 0, &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
CFNumberRef num;
float f;
f = paint->strokeWidth;
num = CFNumberCreate(NULL, kCFNumberCGFloatType, &f);
CFDictionarySetValue(dict, kCTStrokeWidthAttributeName, num);
CFRelease(num);
CGColorRef color = color_getref(paint->color);
CFDictionarySetValue(dict, kCTStrokeColorAttributeName, color);
CFDictionarySetValue(dict, kCTForegroundColorAttributeName, color);
CGColorRelease(color);
CTFontRef font = paint_mkfont(paint);
_assert(font);
CFDictionarySetValue(dict, kCTFontAttributeName, font);
CFRelease(font);
CFAttributedStringRef result = CFAttributedStringCreate(NULL, string, dict);
CFRelease(dict);
CFRelease(string);
return result;
}
/** Return the width of the text. If bounds is not null, return the bounds
of the text in that rectangle.
*/
float paint_impl_measureText(ANPPaint *paint, const void* text, uint32_t byteLength,
ANPRectF* bounds) {
CTFontRef font = paint_mkfont(paint);
CFAttributedStringRef ats = paint_mkats(paint, text, byteLength);
CTLineRef line = CTLineCreateWithAttributedString(ats);
if(bounds) {
*bounds = rectFFromRect(CTLineGetImageBounds(line, randomctx));
}
float ret = CTLineGetTypographicBounds(line, NULL, NULL, NULL);
CFRelease(line);
CFRelease(font);
return ret;
/*
CTFramesetterRef fs = CTFramesetterCreateWithAttributedString(ats);
CFRange fitRange;
CGSize size = CTFramesetterSuggestFrameSizeWithConstraints(fs, CFRangeMake(0, 0), NULL, CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX), &fitRange);
CFRelease(font);
CFRelease(ats);
CFRelease(fs);
if(bounds) {
bounds->left = 0;
bounds->top = 0;
bounds->right = size.width;
bounds->bottom = size.height;
}
return size.width;
*/
}
/** Return the number of unichars specifed by the text.
If widths is not null, returns the array of advance widths for each
unichar.
If bounds is not null, returns the array of bounds for each unichar.
*/
int paint_impl_getTextWidths(ANPPaint *paint, const void* text, uint32_t byteLength,
float widths[], ANPRectF bounds[]) {
// This is not quite correct, because unichar != glyph.
// Don't kill me.
CTFontRef font = paint_mkfont(paint);
CFAttributedStringRef ats = paint_mkats(paint, text, byteLength);
CTLineRef line = CTLineCreateWithAttributedString(ats);
CFArrayRef runs = CTLineGetGlyphRuns(line);
_assert(CFArrayGetCount(runs) == 1);
CTRunRef run = (CTRunRef) CFArrayGetValueAtIndex(runs, 0);
int glyphs = CTRunGetGlyphCount(run);
if(widths) {
CGSize *buf = (CGSize *) malloc(sizeof(CGSize) * glyphs);
CTRunGetAdvances(run, CFRangeMake(0, 0), buf);
for(int i = 0; i < glyphs; i++) {
widths[i] = buf[i].width;
}
free(buf);
}
if(bounds) {
for(int i = 0; i < glyphs; i++) {
CGRect rect = CTRunGetImageBounds(run, randomctx, CFRangeMake(i, 1));
bounds[i] = rectFFromRect(rect);
}
}
CFRelease(run);
CFRelease(line);
CFRelease(font);
return glyphs;
}
/** Return in metrics the spacing values for text, respecting the paint's
typeface and pointsize, and return the spacing between lines
(descent - ascent + leading). If metrics is NULL, it will be ignored.
*/
float paint_impl_getFontMetrics(ANPPaint *paint, ANPFontMetrics* metrics) {
CTFontRef font = paint_mkfont(paint);
CFAttributedStringRef ats = paint_mkats(paint, "AAA", 3);
CTLineRef line = CTLineCreateWithAttributedString(ats);
CGFloat ascent, descent, leading;
CTLineGetTypographicBounds(line, &ascent, &descent, &leading);
if(metrics) {
metrics->fAscent = ascent;
metrics->fDescent = descent;
metrics->fLeading = leading;
}
CGRect imageBounds = CTLineGetImageBounds(line, randomctx);
metrics->fTop = imageBounds.origin.y;
metrics->fBottom = imageBounds.size.height;
CFRelease(line);
CFRelease(font);
return descent - ascent + leading;
}
// ANPTypefaceInterfaceV0
ANPTypeface* typeface_impl_createFromName(const char name[], ANPTypefaceStyle style) {
notice("createFromName: %s", name);
ANPTypeface *result = new ANPTypeface;
CFStringRef str = CFStringCreateWithCString(NULL, name, kCFStringEncodingASCII);
result->name = str;
result->refcount = 1;
result->style = style;
return result;
}
ANPTypeface* typeface_impl_createFromTypeface(const ANPTypeface* family,
ANPTypefaceStyle style) {
ANPTypeface *result = new ANPTypeface;
result->name = family->name;
result->refcount = 1;
result->style = style;
CFRetain(result->name);
return result;
}
/** Return the owner count of the typeface. A newly created typeface has an
owner count of 1. When the owner count is reaches 0, the typeface is
deleted.
*/
int32_t typeface_impl_getRefCount(const ANPTypeface *typeface) {
return typeface->refcount;
}
/** Increment the owner count on the typeface
*/
void typeface_impl_ref(ANPTypeface *typeface) {
typeface->refcount++;
}
/** Decrement the owner count on the typeface. When the count goes to 0,
the typeface is deleted.
*/
void typeface_impl_unref(ANPTypeface *typeface) {
if(--typeface->refcount == 0) {
CFRelease(typeface->name);
delete typeface;
}
}
/** Return the style bits for the specified typeface
*/
ANPTypefaceStyle typeface_impl_getStyle(const ANPTypeface *typeface) {
return typeface->style;
}
/** Some fonts are stored in files. If that is true for the fontID, then
this returns the byte length of the full file path. If path is not null,
then the full path is copied into path (allocated by the caller), up to
length bytes. If index is not null, then it is set to the truetype
collection index for this font, or 0 if the font is not in a collection.
Note: getFontPath does not assume that path is a null-terminated string,
so when it succeeds, it only copies the bytes of the file name and
nothing else (i.e. it copies exactly the number of bytes returned by the
function. If the caller wants to treat path[] as a C string, it must be
sure that it is allocated at least 1 byte larger than the returned size,
and it must copy in the terminating 0.
If the fontID does not correspond to a file, then the function returns
0, and the path and index parameters are ignored.
@param fontID The font whose file name is being queried
@param path Either NULL, or storage for receiving up to length bytes
of the font's file name. Allocated by the caller.
@param length The maximum space allocated in path (by the caller).
Ignored if path is NULL.
@param index Either NULL, or receives the TTC index for this font.
If the font is not a TTC, then will be set to 0.
@return The byte length of th font's file name, or 0 if the font is not
baked by a file.
*/
int32_t typeface_impl_getFontPath(const ANPTypeface*, char path[], int32_t length,
int32_t* index) {
return 0;
}
/** Return a UTF8 encoded path name for the font directory, or NULL if not
supported. If returned, this string address will be valid for the life
of the plugin instance. It will always end with a '/' character.
*/
const char* typeface_impl_getFontDirectoryPath() {
return NULL;
}
// ANPWindowInterfaceV0
//
// inval may be null
// todo: send the rect along over ipc
void window_impl_setVisibleRects(NPP instance, const ANPRectI rects[], int32_t count) {
notice("%s", __func__);
// Just ignore it.
//_abort();
}
/** Clears any rectangles that are being tracked as a result of a call to
setVisibleRects. This call is equivalent to setVisibleRect(inst, NULL, 0).
*/
void window_impl_clearVisibleRects(NPP instance) {
notice("%s", __func__);
_abort();
}
/** Given a boolean value of true the device will be requested to provide
a keyboard. A value of false will result in a request to hide the
keyboard. Further, the on-screen keyboard will not be displayed if a
physical keyboard is active.
*/
void window_impl_showKeyboard(NPP instance, bool value) {
notice("%s", __func__);
_abort();
}
/** Called when a plugin wishes to enter into full screen mode. The plugin's
Java class (set using kSetPluginStubJavaClassName_ANPSetValue) will be
called asynchronously to provide a View object to be displayed full screen.
*/
void window_impl_requestFullScreen(NPP instance) {
notice("%s", __func__);
}
void window_impl_exitFullScreen(NPP instance) {
notice("%s", __func__);
_abort();
}
void window_impl_requestCenterFitZoom(NPP instance) {
notice("%s", __func__);
_abort();
}
// ANPSystemInterfaceV0
const char* system_impl_getApplicationDataDirectory() {
return "/tmp/";
}
extern "C" jclass system_impl_loadJavaClass(NPP instance, const char* className);
// ANPPathInterfaceV0
struct ANPPath {
CGMutablePathRef path;
};
/** Return a new path */
ANPPath* path_impl_newPath() {
ANPPath *result = new ANPPath;
result->path = CGPathCreateMutable();
return result;
}
/** Delete a path previously allocated by ANPPath() */
void path_impl_deletePath(ANPPath *path) {
CGPathRelease(path->path);
}
/** Make a deep copy of the src path, into the dst path (already allocated
by the caller).
*/
void path_impl_copy(ANPPath* dst, const ANPPath* src) {
dst->path = CGPathCreateMutableCopy(src->path);
}
/** Returns true if the two paths are the same (i.e. have the same points)
*/
bool path_impl_equal(const ANPPath* path0, const ANPPath* path1) {
return CGPathEqualToPath(path0->path, path1->path);
}
/** Remove any previous points, initializing the path back to empty. */
void path_impl_reset(ANPPath *path) {
CGPathRelease(path->path);
path->path = CGPathCreateMutable();
}
/** Return true if the path is empty (has no lines, quads or cubics). */
bool path_impl_isEmpty(const ANPPath *path) {
return CGPathIsEmpty(path->path);
}
/** Return the path's bounds in bounds. */
void path_impl_getBounds(const ANPPath *path, ANPRectF* bounds) {
*bounds = rectFFromRect(CGPathGetBoundingBox(path->path));
}
void path_impl_moveTo(ANPPath *path, float x, float y) {
CGPathMoveToPoint(path->path, NULL, x, y);
}
void path_impl_lineTo(ANPPath *path, float x, float y) {
CGPathAddLineToPoint(path->path, NULL, x, y);
}
void path_impl_quadTo(ANPPath *path, float x0, float y0, float x1, float y1) {
CGPathAddQuadCurveToPoint(path->path, NULL, x0, y0, x1, y1);
}
void path_impl_cubicTo(ANPPath *path, float x0, float y0, float x1, float y1,
float x2, float y2) {
CGPathAddCurveToPoint(path->path, NULL, x0, y0, x1, y1, x2, y2);
}
void path_impl_close(ANPPath *path) {
CGPathCloseSubpath(path->path);
}
/** Offset the src path by [dx, dy]. If dst is null, apply the
change directly to the src path. If dst is not null, write the
changed path into dst, and leave the src path unchanged. In that case
dst must have been previously allocated by the caller.
*/
void path_impl_offset(ANPPath* src, float dx, float dy, ANPPath* dst) {
/*CGPathRef newPath = CGPathCreateMutable();
CGPathApply(path, (void *) newPath, offset_applier_func*/
notice("%s", __func__);
_abort();
}
/** Transform the path by the matrix. If dst is null, apply the
change directly to the src path. If dst is not null, write the
changed path into dst, and leave the src path unchanged. In that case
dst must have been previously allocated by the caller.
*/
void path_impl_transform(ANPPath* src, const ANPMatrix*, ANPPath* dst) {
notice("%s", __func__);
_abort();
}
// ANPMatrixInterfaceV0
struct ANPMatrix {
CGAffineTransform transform;
};
ANPMatrix* matrix_impl_newMatrix() {
ANPMatrix *result = new ANPMatrix;
result->transform = CGAffineTransformIdentity;
return result;
}
void matrix_impl_deleteMatrix(ANPMatrix *matrix) {
delete matrix;
}
ANPMatrixFlag matrix_impl_getFlags(const ANPMatrix*) {
return 7;
}
void matrix_impl_copy(ANPMatrix* dst, const ANPMatrix* src) {
*dst = *src;
}
/** Return the matrix values in a float array (allcoated by the caller),
where the values are treated as follows:
w = x * [6] + y * [7] + [8];
x' = (x * [0] + y * [1] + [2]) / w;
y' = (x * [3] + y * [4] + [5]) / w;
*/
void matrix_impl_get3x3(const ANPMatrix*, float[9]) {
notice("get3x3");
_abort();
}
/** Initialize the matrix from values in a float array,
where the values are treated as follows:
w = x * [6] + y * [7] + [8];
x' = (x * [0] + y * [1] + [2]) / w;
y' = (x * [3] + y * [4] + [5]) / w;
*/
void matrix_impl_set3x3(ANPMatrix*, const float[9]) {
notice("set3x3");
_abort();
}
void matrix_impl_setIdentity(ANPMatrix *matrix) {
matrix->transform = CGAffineTransformIdentity;
}
void matrix_impl_preTranslate(ANPMatrix *matrix, float tx, float ty) {
matrix->transform = CGAffineTransformConcat(CGAffineTransformMakeTranslation(tx, ty), matrix->transform);
}
void matrix_impl_postTranslate(ANPMatrix *matrix, float tx, float ty){
matrix->transform = CGAffineTransformConcat(matrix->transform, CGAffineTransformMakeTranslation(tx, ty));
}
void matrix_impl_preScale(ANPMatrix *matrix, float sx, float sy) {
matrix->transform = CGAffineTransformConcat(CGAffineTransformMakeScale(sx, sy), matrix->transform);
}
void matrix_impl_postScale(ANPMatrix *matrix, float sx, float sy) {
matrix->transform = CGAffineTransformConcat(matrix->transform, CGAffineTransformMakeScale(sx, sy));
}
void matrix_impl_preSkew(ANPMatrix *matrix, float kx, float ky) {
notice("skew");
_abort();
}
void matrix_impl_postSkew(ANPMatrix *matrix, float kx, float ky) {
notice("skew");
_abort();
}
void matrix_impl_preRotate(ANPMatrix *matrix, float degrees) {
matrix->transform = CGAffineTransformConcat(CGAffineTransformMakeRotation((degrees / 180.0) * M_PI), matrix->transform);
}
void matrix_impl_postRotate(ANPMatrix *matrix, float degrees) {
matrix->transform = CGAffineTransformConcat(matrix->transform, CGAffineTransformMakeRotation((degrees / 180.0) * M_PI));
}
void matrix_impl_preConcat(ANPMatrix *matrix, const ANPMatrix *matrix2) {
matrix->transform = CGAffineTransformConcat(matrix2->transform, matrix->transform);
}
void matrix_impl_postConcat(ANPMatrix *matrix, const ANPMatrix *matrix2) {
matrix->transform = CGAffineTransformConcat(matrix->transform, matrix2->transform);
}
/** Return true if src is invertible, and if so, return its inverse in dst.
If src is not invertible, return false and ignore dst.
*/
bool matrix_impl_invert(ANPMatrix* dst, const ANPMatrix* src) {
dst->transform = CGAffineTransformInvert(src->transform);
return true;
}
/** Transform the x,y pairs in src[] by this matrix, and store the results
in dst[]. The count parameter is treated as the number of pairs in the
array. It is legal for src and dst to point to the same memory, but
illegal for the two arrays to partially overlap.
*/
void matrix_impl_mapPoints(ANPMatrix *matrix, float dst[], const float src[],
int32_t count) {
for(int i = 0; i < count; i++) {
CGPoint ret = CGPointApplyAffineTransform(CGPointMake(src[2*i], src[2*i+1]), matrix->transform);
dst[2*i] = ret.x;
dst[2*i+1] = ret.y;
}
}
// ANPCanvasInterfaceV0
struct ANPCanvas {
CGContextRef ctx;
bool clipped;
ANPPaintStyle style;
};
ANPCanvas* canvas_impl_newCanvas(ANPBitmap *bitmap) {
ANPCanvas *result = new ANPCanvas;
notice("bitmap: %p width:%d height:%d baseAddr:%p rowBytes:%d format:%d", bitmap, bitmap->width, bitmap->height, bitmap->baseAddr, bitmap->rowBytes, bitmap->format);
//_assert(bitmap->format == kRGBA_8888_ANPBitmapFormat);
if(bitmap->format != kRGBA_8888_ANPBitmapFormat) {
bitmap->width = 1;
bitmap->height = 1;
bitmap->baseAddr = malloc(4);
bitmap->rowBytes = 4;
bitmap->format = kRGBA_8888_ANPBitmapFormat;
notice("CRAP");
}
result->ctx = CGBitmapContextCreate(bitmap->baseAddr, bitmap->width, bitmap->height, 8, bitmap->rowBytes, CGColorSpaceCreateDeviceRGB(), kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast);
result->clipped = false;
result->style = kFillAndStroke_ANPPaintStyle;
return result;
}
void canvas_impl_deleteCanvas(ANPCanvas *canvas) {
notice("deleting canvas %p", canvas);
notice("its ctx:%p clipped:%d", canvas->ctx, canvas->clipped);
CGContextRelease(canvas->ctx);
delete canvas;
}
void canvas_impl_save(ANPCanvas *canvas) {
CGContextSaveGState(canvas->ctx);
}
void canvas_impl_restore(ANPCanvas *canvas) {
CGContextRestoreGState(canvas->ctx);
}
void canvas_impl_translate(ANPCanvas *canvas, float tx, float ty) {
CGContextTranslateCTM(canvas->ctx, tx, ty);
}
void canvas_impl_scale(ANPCanvas *canvas, float sx, float sy) {
CGContextScaleCTM(canvas->ctx, sx, sy);
}
void canvas_impl_rotate(ANPCanvas *canvas, float degrees) {
CGContextRotateCTM(canvas->ctx, (degrees / 180.0) * M_PI);
}
void canvas_impl_skew(ANPCanvas *canvas, float kx, float ky) {
notice("canvas_impl_skew: stub");
_abort();
}
void canvas_impl_concat(ANPCanvas *canvas, const ANPMatrix *matrix) {
CGContextConcatCTM(canvas->ctx, matrix->transform);
}
void canvas_impl_clipRect(ANPCanvas *canvas, const ANPRectF *rectf) {
notice("clipRect{%f, %f, %f, %f}", rectf->left, rectf->top, rectf->right, rectf->bottom);
CGContextClipToRect(canvas->ctx, rectFromRectF(*rectf));
canvas->clipped = true;
}
void canvas_impl_clipPath(ANPCanvas *canvas, const ANPPath *path) {
notice("%s", __func__); _abort();
CGContextAddPath(canvas->ctx, path->path);
CGContextClip(canvas->ctx);
canvas->clipped = true;
}
void canvas_impl_getTotalMatrix(ANPCanvas *canvas, ANPMatrix *matrix) {
matrix->transform = CGContextGetCTM(canvas->ctx);
}
bool canvas_impl_getLocalClipBounds(ANPCanvas *canvas, ANPRectF *bounds, bool aa) {
// ignore aa
notice("%s", __func__); _abort();
if(!canvas->clipped) return false;
*bounds = rectFFromRect(CGContextGetClipBoundingBox(canvas->ctx));
return true;
}
/** Return the current clip bounds in device coordinates in bounds. If the
current clip is empty, return false and ignore the bounds argument.
*/
bool canvas_impl_getDeviceClipBounds(ANPCanvas*, ANPRectI* bounds) {
notice("%s", __func__);
_abort();
}
void canvas_impl_drawColor(ANPCanvas *canvas, ANPColor color) {
CGFloat components[4];
components[0] = (1.0/256) * (color & 0x00ff0000);
components[1] = (1.0/256) * (color & 0x0000ff00);
components[2] = (1.0/256) * (color & 0x000000ff);
components[3] = (1.0/256) * (color & 0xff000000);
CGContextSetFillColor(canvas->ctx, components);
int w = CGBitmapContextGetWidth(canvas->ctx);
int h = CGBitmapContextGetHeight(canvas->ctx);
log("canvas_impl_drawColor: w=%d h=%d", w, h);
if(w > 0 && h > 0) {
CGContextFillRect(canvas->ctx, CGRectMake(0, 0, w, h));
}
}
CGColorRef color_getref(ANPColor color) {
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGFloat components[4];
components[0] = (1.0/256) * (color & 0x00ff0000);
components[1] = (1.0/256) * (color & 0x0000ff00);
components[2] = (1.0/256) * (color & 0x000000ff);
components[3] = (1.0/256) * (color & 0xff000000);
CGColorRef result = CGColorCreate(colorSpace, components);
CGColorSpaceRelease(colorSpace);
return result;
}
// note unpremultiplied crap
void do_paint(ANPCanvas *canvas, const ANPPaint *paint) {
CGContextSetShouldAntialias(canvas->ctx, paint->flags & kAntiAlias_ANPPaintFlag);
CGContextSetAllowsAntialiasing(canvas->ctx, paint->flags & kAntiAlias_ANPPaintFlag);
CGLineJoin join;
switch(paint->join) {
case kMiter_ANPPaintJoin:
join = kCGLineJoinMiter;
case kRound_ANPPaintJoin:
join = kCGLineJoinRound;
case kBevel_ANPPaintJoin:
default:
join = kCGLineJoinBevel;
}
CGContextSetLineJoin(canvas->ctx, join);
CGLineCap cap;
switch(paint->cap) {
case kButt_ANPPaintCap:
cap = kCGLineCapButt;
case kRound_ANPPaintCap:
cap = kCGLineCapRound;
case kSquare_ANPPaintCap:
default:
cap = kCGLineCapSquare;
}
CGContextSetLineCap(canvas->ctx, cap);
CGContextSetLineWidth(canvas->ctx, paint->strokeWidth);
canvas_impl_drawColor(canvas, paint->color);
canvas->style = paint->style;
}
CGPathDrawingMode get_dm(ANPCanvas *canvas) {
switch(canvas->style) {
case kFill_ANPPaintStyle:
return kCGPathFill;
case kStroke_ANPPaintStyle:
return kCGPathStroke;
case kFillAndStroke_ANPPaintStyle:
default:
return kCGPathFillStroke;
}
}
void canvas_impl_drawPaint(ANPCanvas *canvas, const ANPPaint *paint) {
do_paint(canvas, paint);
}
void canvas_impl_drawLine(ANPCanvas *canvas, float x0, float y0, float x1, float y1,
const ANPPaint *paint) {
do_paint(canvas, paint);
CGContextMoveToPoint(canvas->ctx, x0, y0);
CGContextAddLineToPoint(canvas->ctx, x1, y1);
CGContextDrawPath(canvas->ctx, get_dm(canvas));
}
void canvas_impl_drawRect(ANPCanvas *canvas, const ANPRectF *rect, const ANPPaint *paint) {
do_paint(canvas, paint);
CGContextAddRect(canvas->ctx, rectFromRectF(*rect));
CGContextDrawPath(canvas->ctx, get_dm(canvas));
}
void canvas_impl_drawOval(ANPCanvas *canvas, const ANPRectF*, const ANPPaint *paint) {
notice("%s", __func__);
_abort();
}
void canvas_impl_drawPath(ANPCanvas *canvas, const ANPPath *path, const ANPPaint *paint) {
do_paint(canvas, paint);
CGContextAddPath(canvas->ctx, path->path);
CGContextDrawPath(canvas->ctx, get_dm(canvas));
}
void canvas_impl_drawText(ANPCanvas *canvas, const void* text, uint32_t byteLength,
float x, float y, const ANPPaint *paint) {
notice("%s", __func__);
CGContextSaveGState(canvas->ctx);
CFAttributedStringRef ats = paint_mkats(paint, text, byteLength);
CTLineRef line = CTLineCreateWithAttributedString(ats);
CGContextSetTextMatrix(canvas->ctx, CGAffineTransformIdentity);
y = movie_h - y;
CGContextSetTextPosition(canvas->ctx, x, y);
CTLineDraw(line, canvas->ctx);
CFRelease(line);
CGContextRestoreGState(canvas->ctx);
}
void canvas_impl_drawPosText(ANPCanvas *canvas, const void* text, uint32_t byteLength,
const float xy[], const ANPPaint *paint) {
notice("%s", __func__);
_abort();
}
void canvas_impl_drawBitmapRect(ANPCanvas *canvas, const ANPBitmap *bitmap,
const ANPRectI* src, const ANPRectF* dst,
const ANPPaint *paint) {
notice("%s: src={%d, %d, %d, %d}, dst={%f, %f, %f, %f}", __func__, src->left, src->top, src->right, src->bottom,
dst->left, dst->top, dst->right, dst->bottom);
_abort();
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap->baseAddr, bitmap->rowBytes * bitmap->height, NULL);
CGImageRef image = CGImageCreate(bitmap->width, bitmap->height, 8, 32, bitmap->rowBytes, CGColorSpaceCreateDeviceRGB(), kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast, provider, NULL, false, kCGRenderingIntentDefault);
CGImageRef image2 = CGImageCreateWithImageInRect(image, rectFromRectI(*src));
do_paint(canvas, paint);
CGContextDrawImage(canvas->ctx, rectFromRectF(*dst), image);
CGImageRelease(image2);
CGImageRelease(image);
CGDataProviderRelease(provider);
}
void canvas_impl_drawBitmap(ANPCanvas *canvas, const ANPBitmap *bitmap, float x, float y,
const ANPPaint *paint) {
_abort();
CGDataProviderRef provider = CGDataProviderCreateWithData(NULL, bitmap->baseAddr, bitmap->rowBytes * bitmap->height, NULL);
CGImageRef image = CGImageCreate(bitmap->width, bitmap->height, 8, 32, bitmap->rowBytes, CGColorSpaceCreateDeviceRGB(), kCGBitmapByteOrder32Big | kCGImageAlphaPremultipliedLast, provider, NULL, false, kCGRenderingIntentDefault);
do_paint(canvas, paint);
CGContextDrawImage(canvas->ctx, CGRectMake(x, y, bitmap->width, bitmap->height), image);
CGImageRelease(image);
CGDataProviderRelease(provider);
}
// ANPEventInterfacev0
//
extern "C" void handle_event(void *event);
static void postEventCB(CFRunLoopTimerRef timer, void *info) {
ANPEvent *event = (ANPEvent *) info;
notice("postEventCB... type = %d", event->eventType);
handle_event(info);
free(info);
CFRunLoopTimerInvalidate(timer);
CFRelease(timer);
}
void event_postEvent(NPP inst, const ANPEvent *event) {
_assert(event->inSize >= sizeof(ANPEvent));
ANPEvent *ev2 = (ANPEvent *) malloc(event->inSize);
memcpy(ev2, event, event->inSize);
CFRunLoopTimerContext ctx;
memset(&ctx, 0, sizeof(ctx));
ctx.info = (void *) ev2;
CFRunLoopTimerRef ref = CFRunLoopTimerCreate(NULL, CFAbsoluteTimeGetCurrent(), 0, 0, 0, postEventCB, &ctx);
CFRunLoopAddTimer(CFRunLoopGetMain(), ref, kCFRunLoopCommonModes);
}
void event_impl_postEvent(NPP inst, const ANPEvent* event) {
// I'll need to deal with the multithreading stuff
notice("%s [%d]", __func__, event->eventType);
if(event->eventType == kCustom_ANPEventType) {
notice(" subtype: %d", event->data.other[0]);
}
event_postEvent(inst, event);
}
static void *temp;
static size_t temp_sz;
static ANPRectI cur_dirty;
static bool cur_dirty_valid;
// ANPSurfaceInterfaceV0
extern "C" void refresh_size();
bool surface_impl_lock(JNIEnv* env, jobject surface, ANPBitmap* bitmap, ANPRectI* dirtyRect) {
notice("%s surface=%p", __func__, surface);
if(pending_movie_w != movie_w || pending_movie_h != movie_h) {
refresh_size();
}
if(temp_sz != IOSurfaceGetAllocSize(sfc)) {
log("alloc %d", temp_sz);
if(temp) free(temp);
temp = calloc(1, IOSurfaceGetAllocSize(sfc));
//memset(temp, 0xff, IOSurfaceGetAllocSize(sfc));
temp_sz = IOSurfaceGetAllocSize(sfc);
}
//log("dirtyRect=%p", dirtyRect);
// sanity, not security check, fwiw
if(dirtyRect && (dirtyRect->left >= (int)IOSurfaceGetWidth(sfc) || dirtyRect->top >= (int)IOSurfaceGetHeight(sfc) || dirtyRect->right >= (int)IOSurfaceGetWidth(sfc) || dirtyRect->bottom >= (int)IOSurfaceGetHeight(sfc))) {
dirtyRect = false;
}
if(dirtyRect) {
//log("%d,%d,%d,%d", dirtyRect->left, dirtyRect->top, dirtyRect->right, dirtyRect->bottom);
cur_dirty_valid = true;
cur_dirty = *dirtyRect;
} else {
cur_dirty_valid = false;
}
bitmap->baseAddr = temp;
bitmap->format = kRGBA_8888_ANPBitmapFormat;
bitmap->width = sfc ? IOSurfaceGetWidth(sfc) : 0;
bitmap->height = sfc ? IOSurfaceGetHeight(sfc) : 0;
bitmap->rowBytes = bitmap->width * 4;
return true;
}
//#include <fcntl.h>
extern "C" void rgba_bgra_copy(void *dest, void *src, void *end);
void surface_impl_unlock(JNIEnv* env, jobject surface) {
notice("%s surface=%p", __func__, surface);
if(!sfc || !IOSurfaceGetWidth(sfc) || !IOSurfaceGetHeight(sfc)) return;
if(cur_dirty_valid) {
int rowsize = (cur_dirty.right - cur_dirty.left) * 4;
int fullrowsize = IOSurfaceGetBytesPerRow(sfc);
int rowoffset = cur_dirty.top * fullrowsize + cur_dirty.left * 4;
char *start = ((char *) IOSurfaceGetBaseAddress(sfc)) + rowoffset;
char *tempstart = ((char *) temp) + rowoffset;
char *end = tempstart + rowsize;
for(int y = cur_dirty.top; y < cur_dirty.bottom; y++) {
rgba_bgra_copy((void *) start, (void *) tempstart, (void *) end);
start += fullrowsize;
tempstart += fullrowsize;
end += fullrowsize;
}
_assertZero(display_sync(food, cur_dirty.left, cur_dirty.top, cur_dirty.right, cur_dirty.bottom));
} else {
void *end = (void *) ((char *)temp + IOSurfaceGetAllocSize(sfc));
rgba_bgra_copy(IOSurfaceGetBaseAddress(sfc), temp, end);
_assertZero(display_sync(food, 0, 0, 0, 0));
}
//memcpy(IOSurfaceGetBaseAddress(sfc), temp, IOSurfaceGetAllocSize(sfc));
/*int fd = open("foo.txt", O_WRONLY | O_CREAT, 0755);
write(fd, IOSurfaceGetBaseAddress(sfc), IOSurfaceGetAllocSize(sfc));
close(fd);*/
}
//
extern "C"
void iface_getvalue(NPNVariable typ, ANPInterface *ptr) {
switch(typ) {
case kLogInterfaceV0_ANPGetValue: {
ANPLogInterfaceV0 *iface = (ANPLogInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->log)) = stub(log_impl_log);
break; }
case kBitmapInterfaceV0_ANPGetValue: {
ANPBitmapInterfaceV0 *iface = (ANPBitmapInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->getPixelPacking)) = stub(bitmap_impl_getPixelPacking);
break; }
case kMatrixInterfaceV0_ANPGetValue: {
ANPMatrixInterfaceV0 *iface = (ANPMatrixInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->newMatrix)) = stub(matrix_impl_newMatrix);
*((void **) (&iface->deleteMatrix)) = stub(matrix_impl_deleteMatrix);
*((void **) (&iface->getFlags)) = stub(matrix_impl_getFlags);
*((void **) (&iface->copy)) = stub(matrix_impl_copy);
*((void **) (&iface->get3x3)) = stub(matrix_impl_get3x3);
*((void **) (&iface->set3x3)) = stub(matrix_impl_set3x3);
*((void **) (&iface->setIdentity)) = stub(matrix_impl_setIdentity);
*((void **) (&iface->preTranslate)) = stub(matrix_impl_preTranslate);
*((void **) (&iface->postTranslate)) = stub(matrix_impl_postTranslate);
*((void **) (&iface->preScale)) = stub(matrix_impl_preScale);
*((void **) (&iface->postScale)) = stub(matrix_impl_postScale);
*((void **) (&iface->preSkew)) = stub(matrix_impl_preSkew);
*((void **) (&iface->postSkew)) = stub(matrix_impl_postSkew);
*((void **) (&iface->preRotate)) = stub(matrix_impl_preRotate);
*((void **) (&iface->postRotate)) = stub(matrix_impl_postRotate);
*((void **) (&iface->preConcat)) = stub(matrix_impl_preConcat);
*((void **) (&iface->postConcat)) = stub(matrix_impl_postConcat);
*((void **) (&iface->invert)) = stub(matrix_impl_invert);
*((void **) (&iface->mapPoints)) = stub(matrix_impl_mapPoints);
break; }
case kPathInterfaceV0_ANPGetValue: {
ANPPathInterfaceV0 *iface = (ANPPathInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->newPath)) = stub(path_impl_newPath);
*((void **) (&iface->deletePath)) = stub(path_impl_deletePath);
*((void **) (&iface->copy)) = stub(path_impl_copy);
*((void **) (&iface->equal)) = stub(path_impl_equal);
*((void **) (&iface->reset)) = stub(path_impl_reset);
*((void **) (&iface->isEmpty)) = stub(path_impl_isEmpty);
*((void **) (&iface->getBounds)) = stub(path_impl_getBounds);
*((void **) (&iface->moveTo)) = stub(path_impl_moveTo);
*((void **) (&iface->lineTo)) = stub(path_impl_lineTo);
*((void **) (&iface->quadTo)) = stub(path_impl_quadTo);
*((void **) (&iface->cubicTo)) = stub(path_impl_cubicTo);
*((void **) (&iface->close)) = stub(path_impl_close);
*((void **) (&iface->offset)) = stub(path_impl_offset);
*((void **) (&iface->transform)) = stub(path_impl_transform);
break; }
case kTypefaceInterfaceV0_ANPGetValue: {
ANPTypefaceInterfaceV0 *iface = (ANPTypefaceInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->createFromName)) = stub(typeface_impl_createFromName);
*((void **) (&iface->createFromTypeface)) = stub(typeface_impl_createFromTypeface);
*((void **) (&iface->getRefCount)) = stub(typeface_impl_getRefCount);
*((void **) (&iface->ref)) = stub(typeface_impl_ref);
*((void **) (&iface->unref)) = stub(typeface_impl_unref);
*((void **) (&iface->getStyle)) = stub(typeface_impl_getStyle);
*((void **) (&iface->getFontPath)) = stub(typeface_impl_getFontPath);
*((void **) (&iface->getFontDirectoryPath)) = stub(typeface_impl_getFontDirectoryPath);
break; }
case kPaintInterfaceV0_ANPGetValue: {
ANPPaintInterfaceV0 *iface = (ANPPaintInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->newPaint)) = stub(paint_impl_newPaint);
*((void **) (&iface->deletePaint)) = stub(paint_impl_deletePaint);
*((void **) (&iface->getFlags)) = stub(paint_impl_getFlags);
*((void **) (&iface->setFlags)) = stub(paint_impl_setFlags);
*((void **) (&iface->getColor)) = stub(paint_impl_getColor);
*((void **) (&iface->setColor)) = stub(paint_impl_setColor);
*((void **) (&iface->getStyle)) = stub(paint_impl_getStyle);
*((void **) (&iface->setStyle)) = stub(paint_impl_setStyle);
*((void **) (&iface->getStrokeWidth)) = stub(paint_impl_getStrokeWidth);
*((void **) (&iface->getStrokeMiter)) = stub(paint_impl_getStrokeMiter);
*((void **) (&iface->getStrokeCap)) = stub(paint_impl_getStrokeCap);
*((void **) (&iface->getStrokeJoin)) = stub(paint_impl_getStrokeJoin);
*((void **) (&iface->setStrokeWidth)) = stub(paint_impl_setStrokeWidth);
*((void **) (&iface->setStrokeMiter)) = stub(paint_impl_setStrokeMiter);
*((void **) (&iface->setStrokeCap)) = stub(paint_impl_setStrokeCap);
*((void **) (&iface->setStrokeJoin)) = stub(paint_impl_setStrokeJoin);
*((void **) (&iface->getTextEncoding)) = stub(paint_impl_getTextEncoding);
*((void **) (&iface->getTextAlign)) = stub(paint_impl_getTextAlign);
*((void **) (&iface->getTextSize)) = stub(paint_impl_getTextSize);
*((void **) (&iface->getTextScaleX)) = stub(paint_impl_getTextScaleX);
*((void **) (&iface->getTextSkewX)) = stub(paint_impl_getTextSkewX);
*((void **) (&iface->setTextEncoding)) = stub(paint_impl_setTextEncoding);
*((void **) (&iface->setTextAlign)) = stub(paint_impl_setTextAlign);
*((void **) (&iface->setTextSize)) = stub(paint_impl_setTextSize);
*((void **) (&iface->setTextScaleX)) = stub(paint_impl_setTextScaleX);
*((void **) (&iface->setTextSkewX)) = stub(paint_impl_setTextSkewX);
*((void **) (&iface->getTypeface)) = stub(paint_impl_getTypeface);
*((void **) (&iface->setTypeface)) = stub(paint_impl_setTypeface);
*((void **) (&iface->measureText)) = stub(paint_impl_measureText);
*((void **) (&iface->getTextWidths)) = stub(paint_impl_getTextWidths);
*((void **) (&iface->getFontMetrics)) = stub(paint_impl_getFontMetrics);
break; }
case kCanvasInterfaceV0_ANPGetValue: {
ANPCanvasInterfaceV0 *iface = (ANPCanvasInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->newCanvas)) = stub(canvas_impl_newCanvas);
*((void **) (&iface->deleteCanvas)) = stub(canvas_impl_deleteCanvas);
*((void **) (&iface->save)) = stub(canvas_impl_save);
*((void **) (&iface->restore)) = stub(canvas_impl_restore);
*((void **) (&iface->translate)) = stub(canvas_impl_translate);
*((void **) (&iface->scale)) = stub(canvas_impl_scale);
*((void **) (&iface->rotate)) = stub(canvas_impl_rotate);
*((void **) (&iface->skew)) = stub(canvas_impl_skew);
*((void **) (&iface->concat)) = stub(canvas_impl_concat);
*((void **) (&iface->clipRect)) = stub(canvas_impl_clipRect);
*((void **) (&iface->clipPath)) = stub(canvas_impl_clipPath);
*((void **) (&iface->getTotalMatrix)) = stub(canvas_impl_getTotalMatrix);
*((void **) (&iface->getLocalClipBounds)) = stub(canvas_impl_getLocalClipBounds);
*((void **) (&iface->getDeviceClipBounds)) = stub(canvas_impl_getDeviceClipBounds);
*((void **) (&iface->drawColor)) = stub(canvas_impl_drawColor);
*((void **) (&iface->drawPaint)) = stub(canvas_impl_drawPaint);
*((void **) (&iface->drawLine)) = stub(canvas_impl_drawLine);
*((void **) (&iface->drawRect)) = stub(canvas_impl_drawRect);
*((void **) (&iface->drawOval)) = stub(canvas_impl_drawOval);
*((void **) (&iface->drawPath)) = stub(canvas_impl_drawPath);
*((void **) (&iface->drawText)) = stub(canvas_impl_drawText);
*((void **) (&iface->drawPosText)) = stub(canvas_impl_drawPosText);
*((void **) (&iface->drawBitmap)) = stub(canvas_impl_drawBitmap);
*((void **) (&iface->drawBitmapRect)) = stub(canvas_impl_drawBitmapRect);
break; }
case kWindowInterfaceV0_ANPGetValue: {
ANPWindowInterfaceV0 *iface = (ANPWindowInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->setVisibleRects)) = stub(window_impl_setVisibleRects);
*((void **) (&iface->clearVisibleRects)) = stub(window_impl_clearVisibleRects);
*((void **) (&iface->showKeyboard)) = stub(window_impl_showKeyboard);
*((void **) (&iface->requestFullScreen)) = stub(window_impl_requestFullScreen);
*((void **) (&iface->exitFullScreen)) = stub(window_impl_exitFullScreen);
*((void **) (&iface->requestCenterFitZoom)) = stub(window_impl_requestCenterFitZoom);
break; }
case kAudioTrackInterfaceV0_ANPGetValue: {
ANPAudioTrackInterfaceV0 *iface = (ANPAudioTrackInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->newTrack)) = stub(audiotrack_impl_newTrack);
*((void **) (&iface->deleteTrack)) = stub(audiotrack_impl_deleteTrack);
*((void **) (&iface->start)) = stub(audiotrack_impl_start);
*((void **) (&iface->pause)) = stub(audiotrack_impl_pause);
*((void **) (&iface->stop)) = stub(audiotrack_impl_stop);
*((void **) (&iface->isStopped)) = stub(audiotrack_impl_isStopped);
break; }
case kEventInterfaceV0_ANPGetValue: {
ANPEventInterfaceV0 *iface = (ANPEventInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->postEvent)) = stub(event_impl_postEvent);
break; }
case kSystemInterfaceV0_ANPGetValue: {
ANPSystemInterfaceV0 *iface = (ANPSystemInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->getApplicationDataDirectory)) = stub(system_impl_getApplicationDataDirectory);
*((void **) (&iface->loadJavaClass)) = stub(system_impl_loadJavaClass);
break; }
case kSurfaceInterfaceV0_ANPGetValue: {
ANPSurfaceInterfaceV0 *iface = (ANPSurfaceInterfaceV0 *) ptr;
_assert(iface->inSize == sizeof(*iface));
*((void **) (&iface->lock)) = stub(surface_impl_lock);
*((void **) (&iface->unlock)) = stub(surface_impl_unlock);
break; }
default:
warn("Unknown interface type %d", typ);
}
}
extern "C" void post_draw_event() {
ANPEvent *event = new ANPEvent;
event->inSize = sizeof(*event);
event->eventType = kDraw_ANPEventType;
event->data.draw.model = kSurface_ANPDrawingModel;
event->data.draw.clip = (struct ANPRectI) {0, 0, movie_w, movie_h};
memset(&event->data.draw.data.bitmap, 0xfe, sizeof(event->data.draw.data.bitmap));
event_postEvent(NULL, event);
delete event;
}
extern "C" void post_lifecycle_event(ANPLifecycleAction action) {
ANPEvent *event = new ANPEvent;
event->inSize = sizeof(*event);
event->eventType = kLifecycle_ANPEventType;
event->data.lifecycle.action = action;
event_postEvent(NULL, event);
delete event;
}
extern "C" void post_key_event(bool isUp, int32_t nativeCode, int32_t virtualCode, uint32_t modifiers, int32_t repeatCount, int32_t unichar) {
ANPEvent *event = new ANPEvent;
event->inSize = sizeof(*event);
event->eventType = kKey_ANPEventType;
event->data.key.action = isUp ? kUp_ANPKeyAction : kDown_ANPKeyAction;
event->data.key.nativeCode = (int32_t) nativeCode;
event->data.key.virtualCode = virtualCode;
event->data.key.modifiers = (ANPKeyModifier) modifiers;
event->data.key.unichar = unichar;
event_postEvent(NULL, event);
delete event;
}
extern "C" void post_touch_event(ANPTouchAction action, ANPKeyModifier modifiers, int32_t x, int32_t y) {
ANPEvent *event = new ANPEvent;
event->inSize = sizeof(*event);
event->eventType = kTouch_ANPEventType;
event->data.touch.action = action;
event->data.touch.modifiers = modifiers;
event->data.touch.x = x;
event->data.touch.y = y;
event_postEvent(NULL, event);
delete event;
}
extern "C" void post_custom_event(int32_t a, int32_t b, int32_t c, int32_t d, int32_t e, int32_t f, int32_t g, int32_t h) {
ANPEvent *event = new ANPEvent;
event->inSize = sizeof(*event);
event->eventType = kCustom_ANPEventType;
event->data.other[0] = a;
event->data.other[1] = b;
event->data.other[2] = c;
event->data.other[3] = d;
event->data.other[4] = e;
event->data.other[5] = f;
event->data.other[6] = g;
event->data.other[7] = h;
event_postEvent(NULL, event);
delete event;
}
extern "C" void post_mouse_event(ANPMouseAction action, int32_t x, int32_t y) {
ANPEvent *event = new ANPEvent;
event->inSize = sizeof(*event);
event->eventType = kMouse_ANPEventType;
event->data.mouse.action = action;
event->data.mouse.x = x;
event->data.mouse.y = y;
event_postEvent(NULL, event);
delete event;
}
extern "C" int touch(int rpcfd, int action, int x, int y) {
log("touch! (%d, %d)", x, y);
ANPEvent *event = new ANPEvent;
event->inSize = sizeof(*event);
event->eventType = kTouch_ANPEventType;
event->data.touch.action = action;
event->data.touch.modifiers = 0;
event->data.touch.x = x;
event->data.touch.y = y;
handle_event(event);
delete event;
notice("now doing the other thing");
notice("ok");
return 0;
}
| [
"comexk@gmail.com"
] | comexk@gmail.com |
151ed8a1649aa4f2692b8e5d280039ecd2c84f0d | 43963deaade533bc28ed8ca3a00e99bec171046e | /src/kernel/RtlUpcaseUnicodeChar.cpp | 86dfd728881cddd8669ab19dd10c1ec0d67cac46 | [] | no_license | mborgerson/OpenXBOX | 3bc8dac3b719859b1284b2426b195945bb878b98 | 126fbd13a51dd09ae3f7cac747dffe1ce1a0e912 | refs/heads/master | 2023-02-25T16:11:31.497371 | 2017-12-27T21:08:57 | 2017-12-27T21:08:57 | 113,101,895 | 18 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 352 | cpp | #include "common.h"
/*
* RtlUpcaseUnicodeChar
*
* Import Number: 313
* Calling Convention: stdcall
* Parameter 0: WCHAR SourceCharacter
* Return Type: WCHAR
*/
int Xbox::RtlUpcaseUnicodeChar()
{
K_ENTER_STDCALL();
K_INIT_ARG(WCHAR, SourceCharacter);
WCHAR rval;
K_EXIT_WITH_VALUE(rval);
return ERROR_NOT_IMPLEMENTED;
}
| [
"contact@mborgerson.com"
] | contact@mborgerson.com |
aaae836d2f53886bc9c1cd8bafc447c67f61b191 | 06c1e117bcb1027d68f9acb8661ed4164df9b7bf | /test.cpp | 89e97430678e10567b6bf822e551349c1a050ded | [] | no_license | Deepayan-Ghosh/Garbage-Collector | 0bb40129e05c4440ae911bdd421684e1fe59b4bb | 97cbbde8c87b82b3d442db390513eab91915bb08 | refs/heads/master | 2021-01-21T17:46:45.431450 | 2017-05-21T21:17:30 | 2017-05-21T21:17:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,000 | cpp | /*
A test program that uses Garbage Collection. The program creates a circular linked list.
Simple pointers are replaced with GCPtr and the type is passed as template parameter.
To use Garbage Collection, include the header GC.h
To see the GC log, use #define GC_LOG
The Log is shown at every step when a GCPtr goes out of scope
The user can explicitly call the printList() function anywhere in the program to see the current status
e,g: GCPtr <int>::printList() OR GCPtr <float>::printList()
For user defined types, when using GC_LOG, the user-defined type definition must overload the << operator to enable
cout in printList() to print the contents of the user-defined type
compile using: g++ -o main GCNode.cpp GCPtr.cpp <your_program.cpp>
./main
*/
#include <iostream>
#define GC_LOG
#include "GC.h"
using namespace std;
struct Node{
int data;
GCPtr <Node> next;
Node(int data)
{
this->data=data;
next=NULL;
}
friend ostream &operator<<( ostream &output,
const Node &D ) {
output << "data : " << D.data;
return output;
}
static GCPtr<Node> addNode(int data,GCPtr <Node> &start)
{
if(start==NULL)
{
start=new Node(data);
start->next=start;
}
else
{
GCPtr <Node> temp=start;
cout<<"inside function\n";
GCPtr<Node>::printList();
while(temp->next!=start)
temp=temp->next;
temp->next=new Node(data);
temp->next->next=start;
}
return start;
}
};
int main()
{
int * a=new int[10];
//cout<<sizeof(a)<<endl;
/*GCPtr <int,10> p;
GCPtr <int,10> q=p;
p=a;*/
GCPtr<Node> start=NULL;
start=Node::addNode(1,start);
start=Node::addNode(2,start);
start=Node::addNode(3,start);
return 0;
} | [
"deepayanghosh89@gmail.com"
] | deepayanghosh89@gmail.com |
d798af0a93794c4502b766301237ba7610a91b61 | 98a19e75864c2711284e6ea805c4d7c4a2ee0ed4 | /sensor/st/MmaSensor.cpp | fde6020b3fcf97ba10c05514d2c3c6e4e2949c77 | [
"Apache-2.0"
] | permissive | kasimling/Firefly_hardware_rockchip | 3c853ca35caf6d79188aab87a612be88792c9874 | ce9b8c274a65b9f7e52e3bdce96a16e7afb761a9 | refs/heads/master | 2021-05-02T15:29:33.484080 | 2018-02-08T02:02:33 | 2018-02-08T02:02:33 | 120,697,679 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 16,098 | cpp | /*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <fcntl.h>
#include <errno.h>
#include <math.h>
#include <poll.h>
#include <unistd.h>
#include <dirent.h>
#include <sys/select.h>
#include <stdio.h>
#include <math.h>
#include <cutils/log.h>
#include "MmaSensor.h"
#include "mma8452_kernel.h"
#if defined(ANGLE_SUPPORT)
static int sAngleFd = -1;
static int sAccFd = -1;
static int sCtrlFd = -1;
static int sCountAngle[2] = {0,0};
static int sKeyCtrl = -1;
#define DISABLE_KEY 0
#define ENABLE_KEY 1
#define GSENSOR_IOCTL_KEYBOARD _IOW(GSENSOR_IOCTL_MAGIC, 0x11, int[2] )
#define ANGLE_VALID_COUNT 5
static int angle_open_device(void)
{
if (sAngleFd < 0)
{
sAngleFd = open("/dev/angle", O_RDWR);
if(sAngleFd < 0)
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
}
if (sAccFd < 0)
{
sAccFd = open(MMA_DEVICE_NAME, O_RDWR);
if(sAccFd < 0)
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
}
#if 0
if (sCtrlFd < 0)
{
sCtrlFd = open("/dev/ec", O_RDWR);
if(sCtrlFd < 0)
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
}
#endif
ALOGD("%s\n",__FUNCTION__);
return 0;
}
static int angle_close_device(void)
{
if(sAngleFd >= 0)
{
close(sAngleFd);
sAngleFd = -1;
}
if(sAccFd >= 0)
{
close(sAccFd);
sAccFd = -1;
}
#if 0
if(sCtrlFd >= 0)
{
close(sCtrlFd);
sCtrlFd = -1;
}
#endif
ALOGD("%s\n",__FUNCTION__);
return 0;
}
static int angle_enable(int32_t handle, int en)
{
int sample_rate = MMA8452_RATE_12P5;
if (sAngleFd < 0)
{
ALOGE("%s:line=%d,error: sAngleFd=%d\n",__FUNCTION__, __LINE__, sAngleFd);
return -1;
}
if(en)
{
if ( 0 > ioctl(sAngleFd, GSENSOR_IOCTL_START) )
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
if ( 0 > ioctl(sAngleFd, GSENSOR_IOCTL_APP_SET_RATE, &sample_rate) )
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
}
else
{
if ( 0 > ioctl(sAngleFd, GSENSOR_IOCTL_CLOSE) )
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
}
ALOGD("%s: handle=%d, en=%d\n",__FUNCTION__, handle, en);
return 0;
}
static int angle_get_acc_data(float angleData[3], float accData[3])
{
struct sensor_axis angle = {0, 0, 0};
struct sensor_axis acc = {0, 0, 0};
if (sAngleFd < 0)
{
ALOGE("%s:line=%d,error: sAngleFd=%d\n",__FUNCTION__, __LINE__, sAngleFd);
return -1;
}
if (sAccFd < 0)
{
ALOGE("%s:line=%d,error: sAngleFd=%d\n",__FUNCTION__, __LINE__, sAngleFd);
return -1;
}
if ( 0 > ioctl(sAngleFd, GSENSOR_IOCTL_GETDATA, &angle) )
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
if ( 0 > ioctl(sAccFd, GSENSOR_IOCTL_GETDATA, &acc) )
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
angleData[0] = ( (angle.y) * ACCELERATION_RATIO_ANDROID_TO_HW);
angleData[1] = ( -(angle.x) * ACCELERATION_RATIO_ANDROID_TO_HW);
angleData[2] = ( (angle.z) * ACCELERATION_RATIO_ANDROID_TO_HW);
accData[0] = ( (acc.y) * ACCELERATION_RATIO_ANDROID_TO_HW);
accData[1] = ( -(acc.x) * ACCELERATION_RATIO_ANDROID_TO_HW);
accData[2] = ( (acc.z) * ACCELERATION_RATIO_ANDROID_TO_HW);
return 0;
}
static float angle_pitch_to_angle(float pitch, float accData)
{
float angle = 0.0f;
if((pitch >= 0) && (accData > 0))
{
pitch = pitch;
}
else if((pitch >= 0) && (accData < 0))
{
pitch = 3.14159f - pitch;
}
else if((pitch < 0) && (accData > 0))
{
pitch = 6.28318f + pitch;
}
else if((pitch < 0) && (accData < 0))
{
pitch = 3.14159f - pitch;
}
angle = pitch * 180 / 3.14159f;
return angle;
}
static int angle_calc_angle(void)
{
int ret = 0;
float angleData[3],accData[3];
float anglePitch, angleRoll;
float accPitch, accRoll;
int angle[2];
int keyCtrl[2] = {0,0};
//get angle and accel data
ret = angle_get_acc_data(angleData,accData);
if(ret)
{
ALOGE("%s:line=%d,error:ret=%d\n",__FUNCTION__, __LINE__, ret);
return -1;
}
//calculate angle
anglePitch = atan2(angleData[0], sqrt((int)(angleData[1] * angleData[1]) + (int)(angleData[2] * angleData[2])));
angleRoll = atan2(angleData[1], sqrt((int)(angleData[0] * angleData[0]) + (int)(angleData[2] * angleData[2])));
accPitch = atan2(accData[0], sqrt((int)(accData[1] * accData[1]) + (int)(accData[2] * accData[2])));
accRoll = atan2(accData[1], sqrt((int)(accData[0] * accData[0]) + (int)(accData[2] * accData[2])));
anglePitch = angle_pitch_to_angle(anglePitch, angleData[2]);
angleRoll = angle_pitch_to_angle(angleRoll, angleData[2]);
accPitch = angle_pitch_to_angle(accPitch, accData[2]);
accRoll = angle_pitch_to_angle(accRoll, accData[2]);
if(anglePitch > accPitch)
angle[0] = (int)(anglePitch - accPitch);
else
angle[0] = (int)((anglePitch - accPitch) + 360) % 360;
if(angleRoll > accRoll)
angle[1] = (int)(angleRoll - accRoll);
else
angle[1] = (int)((angleRoll - accRoll) + 360) % 360;
//it is gsensor inaccuracy
if(angle[0] >= 355)
angle[0] = fabs((360 - angle[0]));
if(angle[1] >= 355)
angle[1] = fabs((360 - angle[1]));
//control key board
if(fabs(angle[0]) > 185)
{
keyCtrl[0] = 0; //close keyboard
sCountAngle[DISABLE_KEY]++;
sCountAngle[ENABLE_KEY] = 0;
}
else if(fabs(angle[0]) < 180)
{
keyCtrl[0] = 1; //open keyboard
sCountAngle[ENABLE_KEY]++;
sCountAngle[DISABLE_KEY] = 0;
}
//else
//ALOGE("%s:do nothing\n",__func__);
keyCtrl[1] = angle[0];
if((sCountAngle[DISABLE_KEY] > ANGLE_VALID_COUNT) || (sCountAngle[ENABLE_KEY] > ANGLE_VALID_COUNT))
{
if(sKeyCtrl != keyCtrl[0])
{
#if 0
if (sCtrlFd < 0)
{
ALOGE("%s:line=%d,error: sAngleFd=%d\n",__FUNCTION__, __LINE__, sCtrlFd);
return -1;
}
if ( 0 > ioctl(sCtrlFd, GSENSOR_IOCTL_KEYBOARD, keyCtrl) )
{
ALOGE("%s:line=%d,error=%s\n",__FUNCTION__, __LINE__, strerror(errno));
return -1;
}
#endif
ALOGD("%s:angleData x=%f, y=%f, z=%f, accData x=%f, y=%f, z=%f\n", __FUNCTION__, angleData[0], angleData[1], angleData[2], accData[0],accData[1],accData[2]);
ALOGD("%s:anglePitch=%f, accPitch=%f, angleRoll=%f, accRoll=%f\n", __FUNCTION__, anglePitch, accPitch, angleRoll, accRoll);
ALOGD("%s:angle[0]=%d, angle[1]=%d\n", __FUNCTION__, angle[0], angle[1]);
sKeyCtrl = keyCtrl[0];
}
if(sCountAngle[DISABLE_KEY] > ANGLE_VALID_COUNT)
sCountAngle[DISABLE_KEY] = 0;
if(sCountAngle[ENABLE_KEY] > ANGLE_VALID_COUNT)
sCountAngle[ENABLE_KEY] = 0;
}
return 0;
}
#endif
/*****************************************************************************/
MmaSensor::MmaSensor()
: SensorBase(MMA_DEVICE_NAME, "gsensor"),
mEnabled(0),
mPendingMask(0),
mInputReader(32)
{
memset(mPendingEvents, 0, sizeof(mPendingEvents));
memset(mAccelInsertingEvents, 0, sizeof(mAccelInsertingEvents));
mPretimestamp = 0;
mPendingEvents[Accelerometer].version = sizeof(sensors_event_t);
mPendingEvents[Accelerometer].sensor = ID_A;
mPendingEvents[Accelerometer].type = SENSOR_TYPE_ACCELEROMETER;
mPendingEvents[Accelerometer].acceleration.status = SENSOR_STATUS_ACCURACY_HIGH;
for (int i=0 ; i<numSensors ; i++)
mDelays[i] = 200000000; // 200 ms by default
// read the actual value of all sensors if they're enabled already
struct input_absinfo absinfo;
short flags = 0;
open_device();
#if defined(ANGLE_SUPPORT)
angle_open_device();
#endif
if (!mEnabled) {
close_device();
#if defined(ANGLE_SUPPORT)
angle_close_device();
#endif
}
}
MmaSensor::~MmaSensor() {
}
int MmaSensor::enable(int32_t handle, int en)
{
D("Entered : handle = 0x%x, en = 0x%x.", handle, en);
int what = -1;
switch (handle) {
case ID_A :
what = Accelerometer;
break;
default :
E("invalie 'handle'.");
return -EINVAL;
}
if (uint32_t(what) >= numSensors)
return -EINVAL;
int newState = en ? 1 : 0;
int err = 0;
I("newState = 0x%x, what = 0x%x, mEnabled = 0x%x.", newState, what, mEnabled);
if ((uint32_t(newState)<<what) != (mEnabled & (1<<what))) {
if (!mEnabled) {
open_device();
#if defined(ANGLE_SUPPORT)
angle_open_device();
#endif
}
if ( 1 == newState ) {
I("to call 'GSENSOR_IOCTL_START'.");
if ( 0 > (err = ioctl(dev_fd, GSENSOR_IOCTL_START) ) ) {
E("fail to perform GSENSOR_IOCTL_START, err = %d, error is '%s'", err, strerror(errno));
goto EXIT;
}
mEnabled |= (1 << what);
}
else {
I("to call 'GSENSOR_IOCTL_CLOSE'.");
if ( 0 > (err = ioctl(dev_fd, GSENSOR_IOCTL_CLOSE) ) ) {
E("fail to perform GSENSOR_IOCTL_CLOSE, err = %d, error is '%s'", err, strerror(errno));
goto EXIT;
}
mEnabled &= ~(1 << what);
}
#if defined(ANGLE_SUPPORT)
err = angle_enable(handle, en);
if(err < 0)
{
ALOGE("%s:line=%d,error=%d\n",__FUNCTION__, __LINE__, err);
}
#endif
}
EXIT:
if ( !mEnabled ) {
close_device();
#if defined(ANGLE_SUPPORT)
angle_close_device();
#endif
}
D("to exit : mEnabled = 0x%x.", mEnabled);
return err;
}
int MmaSensor::setDelay(int32_t handle, int64_t ns)
{
D("Entered : handle = 0x%x, ns = %lld.", handle, ns);
#ifdef GSENSOR_IOCTL_APP_SET_RATE
int what = -1;
switch (handle) {
case ID_A: what = Accelerometer; break;
}
if (uint32_t(what) >= numSensors)
return -EINVAL;
if (ns < 0)
return -EINVAL;
mDelays[what] = ns;
return update_delay();
#else
return -1;
#endif
}
int MmaSensor::update_delay()
{
D("Entered.");
int result = 0;
if (mEnabled) {
uint64_t wanted = -1LLU;
for (int i=0 ; i<numSensors ; i++) {
if (mEnabled & (1<<i)) {
uint64_t ns = mDelays[i];
wanted = wanted < ns ? wanted : ns;
}
}
short delay = int64_t(wanted) / 1000000;
int sample_rate = (0 >= delay) ? 1000 : (1000 / delay);
int acceptable_sample_rate = 0;
if ( sample_rate <= 2 ) {
acceptable_sample_rate = MMA8452_RATE_1P56;
}
else if ( sample_rate <= 7 ) {
acceptable_sample_rate = MMA8452_RATE_6P25;
}
else if ( sample_rate <= 13 ) {
acceptable_sample_rate = MMA8452_RATE_12P5;
}
else {
acceptable_sample_rate = MMA8452_RATE_50;
}
D("acceptable_sample_rate = %d", acceptable_sample_rate);
if ( 0 > (result = ioctl(dev_fd, GSENSOR_IOCTL_APP_SET_RATE, &acceptable_sample_rate) ) ) {
E("fail to perform GSENSOR_IOCTL_APP_SET_RATE, result = %d, error is '%s'", result, strerror(errno) );
}
}
return result;
}
int MmaSensor::readEvents(sensors_event_t* data, int count)
{
#if defined(ANGLE_SUPPORT)
int err = 0;
#endif
D("Entered : count = %d.", count);
if (count < 1)
return -EINVAL;
ssize_t n = mInputReader.fill(data_fd);
if (n < 0)
return n;
int numEventReceived = 0; /* 已经接受的 event 的数量, 待返回. */
input_event const* event;
while (count && mInputReader.readEvent(&event)) {
int type = event->type;
D("count = 0x%x, type = 0x%x.", count, type);
if (type == EV_ABS) { // #define EV_ABS 0x03
processEvent(event->code, event->value);
mInputReader.next();
} else if (type == EV_SYN) { // #define EV_SYN 0x00
for (int j=0 ; count && mPendingMask && j<numSensors ; j++) {
D("mPendingMask = 0x%x, j = %d; (mPendingMask & (1<<j)) = 0x%x", mPendingMask, j, (mPendingMask & (1<<j)) );
if (mPendingMask & (1<<j)) {
mPendingMask &= ~(1<<j);
D( "mEnabled = 0x%x, j = %d; mEnabled & (1<<j) = 0x%x.", mEnabled, j, (mEnabled & (1 << j) ) );
if (mEnabled & (1<<j)) {
mPendingEvents[j].timestamp = getTimestamp();
D("hxw mPendingEvents[j].timestamp:%ld\n",mPendingEvents[j].timestamp);
D("hxw mPretimestamp:%ld\n",mPretimestamp);
#ifdef INSERT_FAKE_DATA
if(mPretimestamp == 0)mPretimestamp = mPendingEvents[j].timestamp;
int tmstamp_ms = nanoseconds_to_milliseconds(mPendingEvents[j].timestamp - mPretimestamp);
int num = tmstamp_ms/INSERT_DUR_MAX;
num -= tmstamp_ms%INSERT_DUR_MAX<INSERT_DUR_MIN? 1: 0;
num = num>=INSERT_FAKE_MAX ? 0 : num;
instertFakeData(num);
for(int k = 0;k<num;k++){
*data++ = mAccelInsertingEvents[k];
count--;
numEventReceived++;
}
#endif
*data++ = mPendingEvents[j];
count--;
numEventReceived++;
mPretimestamp = mPendingEvents[j].timestamp;
}
}
}
if (!mPendingMask) {
mInputReader.next();
}
#if defined(ANGLE_SUPPORT)
err = angle_calc_angle();
if(err < 0)
{
ALOGE("%s:line=%d,error=%d\n",__FUNCTION__, __LINE__, err);
}
#endif
} else {
LOGE("MmaSensor: unknown event (type=%d, code=%d)",
type, event->code);
mInputReader.next();
}
}
return numEventReceived;
}
void MmaSensor::instertFakeData(int num){
for (int i=num-1 ; i>=0; i--){
mAccelInsertingEvents[i].version = mPendingEvents[Accelerometer].version;
mAccelInsertingEvents[i].sensor = mPendingEvents[Accelerometer].sensor;
mAccelInsertingEvents[i].type = mPendingEvents[Accelerometer].type;
mAccelInsertingEvents[i].acceleration.status = mPendingEvents[Accelerometer].acceleration.status;
mAccelInsertingEvents[i].acceleration.x = mPendingEvents[Accelerometer].acceleration.x;
mAccelInsertingEvents[i].acceleration.y= mPendingEvents[Accelerometer].acceleration.y;
mAccelInsertingEvents[i].acceleration.z= mPendingEvents[Accelerometer].acceleration.z;
//usleep(10);
//mAccelInsertingEvents[i].timestamp = getTimestamp();
mAccelInsertingEvents[i].timestamp = mPendingEvents[Accelerometer].timestamp - INSERT_DUR_MAX*1000000*(num-i);
D("hxw mAccelInsertingEvents[%d].timestamp:%ld\n",i,mAccelInsertingEvents[i].timestamp);
}
}
void MmaSensor::processEvent(int code, int value)
{
D("Entered : code = 0x%x, value = 0x%x.", code, value);
switch (code) {
case EVENT_TYPE_ACCEL_X:
mPendingMask |= 1<<Accelerometer;
mPendingEvents[Accelerometer].acceleration.x = value * ACCELERATION_RATIO_ANDROID_TO_HW;
break;
case EVENT_TYPE_ACCEL_Y:
mPendingMask |= 1<<Accelerometer;
mPendingEvents[Accelerometer].acceleration.y = value * ACCELERATION_RATIO_ANDROID_TO_HW;
break;
case EVENT_TYPE_ACCEL_Z:
mPendingMask |= 1<<Accelerometer;
mPendingEvents[Accelerometer].acceleration.z = value * ACCELERATION_RATIO_ANDROID_TO_HW;
break;
}
}
| [
"alex.ling@harman.com"
] | alex.ling@harman.com |
3681fd1513527b380be01922ea5fe014dce1ef58 | 892cb4c39cf5dbd21ea06fe85228181d340706bd | /MatrixTask.cpp | a10cd4822724c01654e178460f62ea757fa54db9 | [
"MIT"
] | permissive | vsmontes/Dispatcher | e74b630bb41b8d52cecf6872655ca26240110110 | 5f18fb7acfb89dbfa41207aeb1904793c73f4900 | refs/heads/master | 2022-04-14T05:54:12.513441 | 2020-04-15T16:18:51 | 2020-04-15T16:18:51 | 255,970,489 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,010 | cpp | #include "MatrixTask.h"
#include <iostream>
using namespace std;
extern int MATRIX_DIM;
CMatrixTask::CMatrixTask(int start_line, int line_count)
{
MatrixGlobalData * Data = (MatrixGlobalData*)CMatrixTask::GlobalData;
LocalData = (MatrixLocalData*)malloc(sizeof(MatrixLocalData));
if (Data)
{
((MatrixLocalData*)LocalData)->line_count = line_count;
((MatrixLocalData*)LocalData)->start_line = start_line;
}
else
{
cout << "erro" << endl;
}
}
CMatrixTask::~CMatrixTask(void)
{
}
void CMatrixTask::Exec()
{
MatrixGlobalData * Data = (MatrixGlobalData*)CMatrixTask::GlobalData;
MatrixLocalData * mydata = (MatrixLocalData*)LocalData;
int end_line = mydata->start_line + mydata->line_count;
for (unsigned int i=mydata->start_line; i< end_line; i++)
{
for (unsigned int j=0; j< MATRIX_DIM; j++)
{
for (unsigned int lc=0; lc< MATRIX_DIM; lc++)
{
Data->r[i][j] += Data->m1[i][lc] * Data->m2[lc][j];
}
//cout << Data->r[i][j] << "\t";
}
//cout << endl;
}
}
| [
"vmontes@gmail.com"
] | vmontes@gmail.com |
dc70615673a78ee164dfd16804b15b5e01bc1d77 | e0f42167a28d5edb9cd238f69bd8af7ccfee282e | /data-server/src/raft/src/impl/transport/fast_server.h | 33fb2c2724bdeff5487e6120b6dd20e2c2ffb268 | [
"Apache-2.0"
] | permissive | apaqi/sharkstore | d516af141dff3e71274be2847c25c4501bcbd189 | 88e0e0f29c8c170b6021dd0743560a94b9fc8b6a | refs/heads/master | 2020-04-18T06:26:08.514125 | 2019-01-24T07:10:03 | 2019-01-24T07:10:03 | 167,320,629 | 0 | 0 | Apache-2.0 | 2019-01-24T07:09:19 | 2019-01-24T07:09:03 | JavaScript | UTF-8 | C++ | false | false | 940 | h | _Pragma("once");
#include "common/socket_base.h"
#include "transport.h"
namespace fbase {
namespace raft {
namespace impl {
namespace transport {
class FastServer : public dataserver::common::SocketBase {
public:
FastServer(const sf_socket_thread_config_t& config,
const MessageHandler& handler);
~FastServer();
FastServer(const FastServer&) = delete;
FastServer& operator=(const FastServer&) = delete;
Status Initialize();
void Shutdown();
private:
friend void fastserver_recv_task_cb(request_buff_t*, void*);
friend void fastserver_send_done_cb(response_buff_t*, void*, int);
void handleTask(request_buff_t* task);
void sendDoneCallback(response_buff_t* task, int err);
private:
sf_socket_thread_config_t config_;
sf_socket_status_t status_;
MessageHandler handler_;
};
} /* namespace transport */
} // namespace impl
} // namespace raft
} // namespace fbase
| [
"dingjun@jd.com"
] | dingjun@jd.com |
3722fa51ea6268676ffd6ee6d61c6c405810dab7 | 5044e97d9d89a8c66ae343b7f8dd3bbefba77549 | /Correspondence_Oct7/Pablo2_Oct7/lib/match/src/.svn/text-base/ImageDistanceMap.cpp.svn-base | 961b1f9c48157eb86680a209de2ad235e32247e4 | [] | no_license | ZhiyLiu/optim | 994bbc17553c75fbc1b5a2d6c91be58d3736775b | ddd8c89f62717126b3cd0f695ccc9f0795134bb3 | refs/heads/master | 2021-05-07T09:10:05.830207 | 2018-12-02T03:08:15 | 2018-12-02T03:08:15 | 109,456,051 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 28,368 | //#include <sys/timeb.h>
//#include <unistd.h>
#include <iostream>
#include <math.h>
#include "Danielsson.h"
#include "DistanceMap3D.h"
#include "ImageDistanceMap.h"
#include "ImageResample3D.h"
#include "snapshot.h"
#include "Tuning.h"
//#define DEBUG
extern int globalVerbosity;
using namespace std;
ImageDistanceMap::ImageDistanceMap()
{
distIm = NULL;
//xiaojie
gradDistIm = NULL;
}
ImageDistanceMap::ImageDistanceMap(Image3D * im)
{
image = im;
distIm = NULL;
//xiaojie
gradDistIm = NULL;
initialize();
}
ImageDistanceMap::~ImageDistanceMap()
{
if (distIm != NULL)
delete [] distIm;
if (image != NULL)
delete image;
}
const char * msg_1 = "Error: ImageDistanceMap object not initialized";
void ImageDistanceMap::initialize(Image3D * im)
{
if (im == NULL) {
cout << msg_1 << endl;
return;
}
if (distIm != NULL) {
delete [] distIm;
distIm = NULL;
}
image = im;
initialize();
}
void ImageDistanceMap::initialize()
{
#ifdef BINARY
if (image->getAbsXSpacing() != image->getAbsYSpacing()
|| image->getAbsXSpacing() != image->getAbsZSpacing())
{
// Deal with anisotropy by just resampling image to isotropic.
// Easy, but expensive in time.
if (globalVerbosity > -1) {
cout << "Resampling image to cubic voxels" << endl;
}
ImageResample3D resampler;
resampler.isotropicSample(*image, tuningWt(BpVoxelSpacing),
tuningWt(AttractionMask), tuningWt(RepulsionMask));
}
#endif
mapSize[0] = image->getXDim();
mapSize[1] = image->getYDim();
mapSize[2] = image->getZDim();
size = mapSize[0] * mapSize[1] * mapSize[2];
// Or deal with anisotropy by just scaling everything properly
double shortest_spacing = min(image->getAbsXSpacing(), min(image->getAbsYSpacing(),
image->getAbsZSpacing()));
scale = 1.0/shortest_spacing;
// This puts all distances into units of 'shortest-side-voxels'
mapSpacing[0] = image->getAbsXSpacing() * scale;
mapSpacing[1] = image->getAbsYSpacing() * scale;
mapSpacing[2] = image->getAbsZSpacing() * scale;
const double extent[] = {
mapSize[0]*mapSpacing[0]/scale,
mapSize[1]*mapSpacing[1]/scale,
mapSize[2]*mapSpacing[2]/scale
};
// The scaling from model to world coordinates is the maximum extent
double modelToWorldScale = extent[0];
if (modelToWorldScale < extent[1])
modelToWorldScale = extent[1];
if (modelToWorldScale < extent[2])
modelToWorldScale = extent[2];
// Scaling from model to image coordinates
modelToImageScale[0] = modelToWorldScale / mapSpacing[0] * scale;
modelToImageScale[1] = modelToWorldScale / mapSpacing[1] * scale;
modelToImageScale[2] = modelToWorldScale / mapSpacing[2] * scale;
if (globalVerbosity > 0) {
cout << "Mapsize: " << mapSize[0] << ", " << mapSize[1] << ", "
<< mapSize[2] << endl;
cout << "Mapspacing: " << mapSpacing[0] << ", " << mapSpacing[1] << ", "
<< mapSpacing[2] << endl;
}
}
// return count of 6-connected voxel neighbors that are off (non-positive).
// The (x,y,z) coordinate is in a *raster* order that ignores image coordinate
// flipping and is not an array index only to avoud wrapping around the image edge.
inline int ImageDistanceMap::zeroNeighbors(int x, int y, int z)
{
int count = 0;
int xdim = mapSize[0];
int ydim = mapSize[1];
int zdim = mapSize[2];
int xydim = xdim*ydim;
int pixIndex = x + xdim*y + xydim*z;
GreyValue *vox = image->getVoxels();
// ignore neighbors that wrap around the image's edge
if (x && vox[pixIndex- 1] <= 0) count++;
if (y && vox[pixIndex- xdim] <= 0) count++;
if (z && vox[pixIndex-xydim] <= 0) count++;
if (x < xdim-1 && vox[pixIndex+ 1] <= 0) count++;
if (y < ydim-1 && vox[pixIndex+ xdim] <= 0) count++;
if (z < zdim-1 && vox[pixIndex+xydim] <= 0) count++;
return count;
}
// Compute the distance map for the binary image.
bool ImageDistanceMap::createMap()
{
int x, y, z;
int i;
int boundary_count = 0;
if (image == NULL || size == 0) {
cout << msg_1 << endl;
return false;
}
unsigned char * bdryIm = new unsigned char[size];
// use bitset instead?
distIm = new short[size];
// should use memset() here
for (i = 0; i < size; i++) {
bdryIm[i] = 0;
distIm[i] = 0;
}
// Convert the binary/blurred solid object image into a
// boundary (shell) object image. The image is blurred if
// resampling was done by initialize(), else it's derived from
// a plane of a bitStack image or just a binary image (which has
// only one plane).
// Image flip is ignored throughout distance map calc's:
// avoid Image3D voxel accessors by accessing the voxels directly.
// This is ~6x faster and bdryIm is 2x smaller.
// --GST 20080111
#ifdef UNFLIPPED
cout
<< "Warning: distance map code is untested if UNFLIPPED is defined at compile time."
<< endl;
#endif
GreyValue *binImVox = image->getVoxels();
int pixIndex = 0;
for (z = 0; z < mapSize[2]; z++) {
for (y = 0; y < mapSize[1]; y++) {
for (x = 0; x < mapSize[0]; x++, pixIndex++) {
// If this voxel is on and has no neighbors, it's a boundary.
// Threshold at 0.5: works for blurred OR binary image.
// NOTE: zeroNeighbors assumes array (x,y,z) -- no flipping
if (binImVox[pixIndex] > 0.5 && zeroNeighbors(x, y, z)) {
bdryIm[pixIndex] = (unsigned char) 255;
boundary_count++;
}
}
}
}
#ifdef BINARY
if ((int) tuningWt(BpDebug1) == 1) {
cout << "Snapshot bdryIm.raw3" << endl;
snapshot("bdryIm.raw3", bdryIm, mapSize[0], mapSize[1], mapSize[2],
0, 255, mapSpacing[0], mapSpacing[1], mapSpacing[2]);
}
#endif
if (globalVerbosity > 0)
cout << "Boundary points found: " << boundary_count << endl;
bool ret = createRawSignedImageDistanceMaps((char *) bdryIm);
delete [] bdryIm;
return ret;
}
//#define ROHIT_DEBUG
#ifdef ROHIT_DEBUG
#include <fstream>
#endif
bool ImageDistanceMap::createRawSignedImageDistanceMaps(char * bdryIm)
{
short * odx;
short * ody;
short * odz;
int i;
float dist;
#ifdef DEBUG
float dmin = 1e5;
float dmax = -1e5;
#endif
if (globalVerbosity > -1) {
cout << "Calculating Danielsson Distance Map (DDM)" << endl;
}
#ifdef ROHIT_DEBUG
ofstream fbdry("bdry.dat", ios::trunc|ios::out);
for (i = 0; i < size; i++)
{
fbdry << (unsigned short)bdryIm[i] << endl;
}
#endif
int retCode; // failure code for edt3ddan; 0=OK, else=outOfMemory
retCode = edt3ddan(bdryIm, mapSize[0], mapSize[1], mapSize[2],
#ifdef BINARY
mapSpacing[0], mapSpacing[1], mapSpacing[2],
#endif
0, &odx, &ody, &odz);
if (retCode)
{
cout << "Error: Insufficient memory for distance map"
<< ", err code=" << retCode
<< ", mapsize=" << mapSize[0]*mapSize[1]*mapSize[2]*2 << " *3*shorts"
<< endl;
return false;
}
#ifdef DEBUG
cout << "createRawSignedDistanceBpointMaps(): size = " << size << endl;
#endif
// Deal with anisotropy in units of 'shortest-side-voxels'
double x_spacing_sqare = mapSpacing[0]*mapSpacing[0];
double y_spacing_sqare = mapSpacing[1]*mapSpacing[1];
double z_spacing_sqare = mapSpacing[2]*mapSpacing[2];
#ifdef ROHIT_DEBUG
cout << mapSize[0] << ' ' << mapSize[1] << ' ' << mapSize[2] << endl;
ofstream fmap("dmap.dat", ios::trunc|ios::out);
ofstream fimg("img.dat", ios::trunc|ios::out);
#endif
GreyValue *binaryImage = image->getVoxels();
//#define DEBUG_DDM
#ifdef DEBUG_DDM
short testx[] = {0, 1, 1, 1, 2, 0, 1, 1, 1, 2};
short testy[] = {0, 0, 1, 1, 0, 0, 0, 1, 1, 0};
short testz[] = {0, 0, 0, 1, 0, 0, 0, 0, 1, 0};
short binIm[] = {0, 0, 0, 0, 0, 1, 1, 1, 1, 1};
#endif
GreyValue stackMask = (image->getIsImageStacked() ? image->getStackedMask() : 0xFFFF);
for (i = 0; i < size; i++)
{
#ifdef DEBUG
if( i % 10000 == 0 ) {
printf("\b\b\b\b\b\b %3d%% ", int(double(i)*100./double(size)) );
fflush(stdout);
}
#endif
// Okay for isotropic, ie, if we resample
//dist = (float) (sqrt(((double) odx[i]*odx[i] + ody[i]*ody[i] + odz[i]*odz[i])));
// Req'd for anisotropic spacing, can't hurt - with isotropic voxels, the scale is just 1:1
//dist = (float) (sqrt(((double) odx[i]*odx[i]*x_spacing_sqare +
// ody[i]*ody[i]*y_spacing_sqare +
// odz[i]*odz[i]*z_spacing_sqare )));
// GST: test moving the boundary from the voxel centers to the voxel edges:
// expand each internal distance by a half-voxel and contract the external distances.
// - round distance to nearest fixed-point integer, then add
// .5 voxel if inside the image
// -.5 voxel if outside.
// - the goal is a +1/2 voxel distance for the voxel bordering the "voxel
// crack" and -1/2 voxel distance just inside the crack, with a zero halfway
// between the centers (at the crack).
// - routines that use the distance map may need to take fabs(mapValue) now.
// - we really want to store dist^2, but there are not enough bits in a short int.
// 800 is the max dist we expect, so 800*800 = 640000 -- bigger than 16 bits
// - distances inside the object are negative; outide are positive.
#ifdef DEBUG_DDM
if (i >= sizeof(testx)/sizeof(*testx)) exit(0);
float dist2 = // distance squared
testx[i]*testx[i] +
testy[i]*testy[i] +
testz[i]*testz[i];
#else
float dist2 = // distance squared
odx[i]*odx[i]*x_spacing_sqare +
ody[i]*ody[i]*y_spacing_sqare +
odz[i]*odz[i]*z_spacing_sqare;
#endif
dist = sqrt(dist2);
#ifdef DEBUG
if (dist > dmax)
dmax = dist;
if (dist < dmin)
dmin = dist;
#endif
#ifdef BINARY
// Store distance (voxels)
if ((int) tuningWt(BpDDMCenter) == 1)
{
// Round to nearest integer voxel distance.
// Side effect: forces most corners of 4-connected neighbors and 8-connected
// neighbors to a distance of 1, eg, sqrt(1+1+0) -> 1.4 -> 1
distIm[i] = (short) (dist + 0.5);
}
else {
// We believe that this has the effect of a zero crossing halfway between the
// inside and outside voxels.
//distIm[i] = (short) (8.0*dist + 0.5) + (binaryImage[i] ? 4 : -4);
//distIm[i] = (short) (8.0*dist + 0.5); // round to nearest signed 12.3 integer voxel distance
#ifdef DEBUG_DDM
distIm[i] = floor(8.0*dist + 0.5); // round to nearest signed 12.3 integer voxel distance
if (binIm[i]) distIm[i] = -distIm[i];
distIm[i] = distIm[i] - 4.0;
cout << "DEBUG_DDM: (x,y,z,binIm)=" << testx[i] << " " << testy[i] << " " << testz[i]
<< " " << binIm[i] << ") " << "distIm=" << distIm[i] << endl;
#else
distIm[i] = (short) floor(8.0*dist + 0.5); // round to nearest signed 12.3 integer voxel distance
if (binaryImage[i] & stackMask) {
distIm[i] = -distIm[i];
}
distIm[i] = distIm[i] - 4;
#endif
}
#endif /* BINARY */
#ifdef ROHIT_DEBUG
fmap << (short) distIm[i] << endl;
fimg << (short) binaryImage[i] << endl;
#endif
}
cout << '\n';
free(odx);
free(ody);
free(odz);
#ifdef BINARY
if ((int) tuningWt(BpDebug2) == 1)
{
cout << "Snapshot ddm.raw3" << endl;
float dmin = (float) (distIm[0]), dmax = (float)(distIm[0]);
float * fltMap = new float[size];
dmin = distIm[0];
dmax = dmin;
for (int k = 0; k < size; k++) {
fltMap[k] = (float) (distIm[k]);
if (fltMap[k] < dmin)
dmin = fltMap[k];
else if (fltMap[k] > dmax)
dmax = fltMap[k];
}
snapshot("ddm.raw3", fltMap, mapSize[0], mapSize[1], mapSize[2],
(float)dmin, (float)dmax, mapSpacing[0], mapSpacing[1], mapSpacing[2]);
delete fltMap;
cout << "Distance map intensity range = " << dmin << " - " << dmax << endl;
}
#else
#ifdef DEBUG
cout << "Distance map intensity range = " << dmin << " - " << dmax << endl;
#endif
#endif
return true;
}
/* Assuming that all distances outside are positive, this function
extrapolates the distance map using city block distances. This
is inaccurate, but monotonically increasing, so it is appropriate
for optimization.
*/
float ImageDistanceMap::getDistance(int i, int j, int k)
{
int inc = 0;
if (i < 0) {
inc -= i;
i = 0;
}
else if (i >= mapSize[0]) {
inc += (i - mapSize[0] + 1);
i = mapSize[0] - 1;
}
if (j < 0) {
inc -= j;
j = 0;
}
else if (j >= mapSize[1]) {
inc += (j - mapSize[1] + 1);
j = mapSize[1] - 1;
}
if (k < 0) {
inc -= k;
k = 0;
}
else if (k >= mapSize[2]) {
inc += (k - mapSize[2] + 1);
k = mapSize[2] - 1;
}
double ret = (int) distIm[i + mapSize[0]*(j + k*mapSize[1])];
// xiaojie: earlier it was ret/8, now it is ret/100
//return ret/8 + inc;
return ret/100 + inc; // this division is done because distances are stored as unsigned shorts
// which are 100 times the actual distances
}
float ImageDistanceMap::bilerp_in_z(float x, float y, int z)
{
int ix, iy;
float dx, dy;
ix = (int) x;
iy = (int) y;
float a = getDistance(ix, iy, z);
float b = getDistance((ix + 1), iy, z);
float c = getDistance(ix, (iy + 1), z);
float d = getDistance((ix + 1), (iy + 1), z);
dx = x - (float) ix;
dy = y - (float) iy;
float i1 = (1.0 - dx)*a + dx*b;
float i2 = (1.0 - dx)*c + dx*d;
return (1.0 - dy)*i1 + dy*i2;
}
float ImageDistanceMap::trilerp(float x, float y, float z)
{
int ix, iy, iz;
float a, b;
float dz;
ix = (int) x;
iy = (int) y;
iz = (int) z;
a = bilerp_in_z(x, y, iz);
b = bilerp_in_z(x, y, iz + 1);
dz = z - (float) iz;
return (1.0 - dz)*a + dz*b;
}
const char * msg_2 =
"Error: ImageDistanceMap object not initialized: returning infinite distance";
// This function doesn't test to verify that (x, y, z) is in the unit cube
float ImageDistanceMap::get_distance(double x, double y, double z)
{
if (distIm == NULL) {
if (globalVerbosity > 1)
cout << msg_2 << endl;
return INFINITE_DISTANCE;
}
Vector3D v(x, y, z);
image->modelToImageCoordinates(v);
// Points outside the unit cube will return monotonically
// increasing values, by use of the city-block distance
return trilerp(v.getX(), v.getY(), v.getZ());
}
//xiaojie
//doesn't use this function in current program-11/22/2011
Vector3D ImageDistanceMap::getGradDistance(int i, int j, int k)
{
//TOCHECK
//return gradDistIm[i + mapSize[0]*(j + k*mapSize[1])];
return( Vector3D() ) ;
}
Vector3D ImageDistanceMap::bilerp_in_z_grad(float x, float y, int z)
{
int ix, iy;
float dx, dy;
ix = (int) x;
iy = (int) y;
Vector3D a = getGradDistance(ix, iy, z);
Vector3D b = getGradDistance((ix + 1), iy, z);
Vector3D c = getGradDistance(ix, (iy + 1), z);
Vector3D d = getGradDistance((ix + 1), (iy + 1), z);
dx = x - (float) ix;
dy = y - (float) iy;
Vector3D i1 = a*(1.0 - dx) + b*dx;
Vector3D i2 = c*(1.0 - dx) + d*dx;
return i1*(1.0 - dy) + i2*y;
}
Vector3D ImageDistanceMap::trilerp_grad(float x, float y, float z)
{
int ix, iy, iz;
Vector3D a, b;
float dz;
ix = (int) x;
iy = (int) y;
iz = (int) z;
a = bilerp_in_z_grad(x, y, iz);
b = bilerp_in_z_grad(x, y, iz + 1);
dz = z - (float) iz;
return a*(1.0 - dz) + b*dz;
}
//const char * msg_2 =
//"Error: ImageDistanceMap object not initialized: returning infinite distance";
// This function doesn't test to verify that (x, y, z) is in the unit cube
Vector3D ImageDistanceMap::get_graddistance(double x, double y, double z)
{
// ----------------------------------------------------------
const Vector3D imageToModelScale(
1.0/getModelToImageScale()[0],
1.0/getModelToImageScale()[1],
1.0/getModelToImageScale()[2] );
// dp is delta voxel in unit co-ordinates.
Vector3D dp = imageToModelScale;
dp = dp / 2.; // halve the step size as an initial guess
double dpx = dp.getX(); // faster forms of dp
double dpy = dp.getY();
double dpz = dp.getZ();
// The gradient is derived from the distance map, a piecewise-linear map which is tri-lerp'd by
// getDistance() at positions slightly around (x,y,z). The second term (weighted by .0532) helps
// decide cases in which getDistance(+dp) == getDistance(-dp).
// FIXME: Check for bounds
// (No need to adjust for dilation here, as we are only interested in differences)
Vector3D grad = 0.9679 * Vector3D(
getDistance(x+dpx,y,z) - getDistance(x-dpx,y,z),
getDistance(x,y+dpy,z) - getDistance(x,y-dpy,z),
getDistance(x,y,z+dpz) - getDistance(x,y,z-dpz) )
+ 0.0532 * Vector3D(
getDistance(x+2*dpx,y,z) - getDistance(x-2*dpx,y,z),
getDistance(x,y+2*dpy,z) - getDistance(x,y-2*dpy,z),
getDistance(x,y,z+2*dpz) - getDistance(x,y,z-2*dpz) );
if(grad == Vector3D(0,0,0)){
grad = 0.9679 * Vector3D(
getDistance(x+5*dpx,y,z) - getDistance(x-5*dpx,y,z),
getDistance(x,y+5*dpy,z) - getDistance(x,y-5*dpy,z),
getDistance(x,y,z+5*dpz) - getDistance(x,y,z-5*dpz) )
+ 0.0532 * Vector3D(
getDistance(x+10*dpx,y,z) - getDistance(x-10*dpx,y,z),
getDistance(x,y+10*dpy,z) - getDistance(x,y-10*dpy,z),
getDistance(x,y,z+10*dpz) - getDistance(x,y,z-10*dpz) );
//grad.normalize();
}
grad.normalize();
return( grad ) ;
// ----------------------------------------------------------
}
float ImageDistanceMap::getWorldDistance(double x, double y, double z)
{
// Gets something in unit cube distances
if (x < 0.0 || y < 0.0 || z < 0.0)
return (float) INFINITE_DISTANCE;
if (x >= 1.0 || y >= 1.0 || z >= 1.0)
return (float) INFINITE_DISTANCE;
if (distIm == NULL) {
if (globalVerbosity > 1)
cout << msg_2 << endl;
return INFINITE_DISTANCE;
}
// Converts them to world distances
Vector3D v(x, y, z);
image->modelToImageCoordinates(v);
int i = (int) v.getX(); // AGG: Why not rounding here?
int j = (int) v.getY();
int k = (int) v.getZ();
return (float) image->modelToWorldDistance(getDistance(i, j, k));
}
ImageDistanceMap::operator Image3D *()
{
// the output voxels
GreyValue * img = new GreyValue[size];
int y,z;
int xdim = mapSize[0];
int ydim = mapSize[1];
int zdim = mapSize[2];
int xydim = xdim * ydim;
if (image->getXSpacing() < 0)
{
cout << "Error: x flip is not implemented";
}
else if (image->getYSpacing() < 0)
{
for (z=0; z < zdim; z++)
{
for (y=0; y < ydim; y++)
{
memcpy((void *) (img + z*xydim + y*xdim),
(void *) (distIm + z*xydim +(ydim-y-1)*xdim),
xdim * sizeof(GreyValue));
}
}
}
else if (image->getZSpacing() < 0)
{
cout << "Error: z flip is not implemented";
}
else
{
// no flip - copy without changing voxel order
memcpy((void *) img, (void *) distIm, size * sizeof(GreyValue));
}
Image3D * im = new Image3D;
im->setVoxels(img, mapSize[0], mapSize[1], mapSize[2]);
// The image will have all spacings positive
im->setSpacingAndOrigin(mapSpacing[0]/scale, mapSpacing[1]/scale, mapSpacing[2]/scale);
return im;
}
void ImageDistanceMap::printMinMaxDistance()
{
float min = distIm[0];
float max = distIm[0];
for (int i = 0; i < size; i++) {
if (max < distIm[i])
max = distIm[i];
else if (min > distIm[i])
min = distIm[i];
}
cout << " distances in map: " << min << " .. " << max << endl;
}
void ImageDistanceMap::fromImage3D(Image3D * distMapImage)
{
initialize(distMapImage); // This deletes distIm
distIm = new short[size];
GreyValue * im = distMapImage->getVoxels();
for (int i = 0; i < size; i++) {
distIm[i] = im[i];
//if (i%1000==0) cout << im[i] << " : " << distIm[i] << endl;
}
if (globalVerbosity > 0)
printMinMaxDistance();
return;
}
//xiaojie
void ImageDistanceMap::createGradDistMapFromGradXYZ( Image3D* gradX, Image3D* gradY, Image3D* gradZ )
{
// delete the gradDistIm if it already exists
if( gradDistIm != NULL ) {
delete [] gradDistIm ;
gradDistIm = NULL ;
}
gradDistIm = new Vector3D[size];
GreyValue * imX = gradX->getVoxels();
GreyValue * imY = gradY->getVoxels();
GreyValue * imZ = gradZ->getVoxels();
for (int i = 0; i < size; i++) {
gradDistIm[i].setX(imX[i]);
gradDistIm[i].setY(imY[i]);
gradDistIm[i].setZ(imZ[i]);
}
return;
}
void ImageDistanceMap::setgradXDistImfromImage3D(Image3D * gradXdistImage)
{
// delete the gradDistIm pointer if it already exists
gradDistIm = new Vector3D[size];
GreyValue * im = gradXdistImage->getVoxels();
for (int i = 0; i < size; i++) {
gradDistIm[i].setX(im[i]);
//if (i%1000==0) cout << im[i] << " : " << distIm[i] << endl;
}
return;
}
void ImageDistanceMap::setgradYDistImfromImage3D(Image3D * gradYdistImage)
{
gradDistIm = new Vector3D[size];
GreyValue * im = gradYdistImage->getVoxels();
for (int i = 0; i < size; i++) {
gradDistIm[i].setY(im[i]);
//if (i%1000==0) cout << im[i] << " : " << distIm[i] << endl;
}
return;
}
void ImageDistanceMap::setgradZDistImfromImage3D(Image3D * gradZdistImage)
{
gradDistIm = new Vector3D[size];
GreyValue * im = gradZdistImage->getVoxels();
for (int i = 0; i < size; i++) {
gradDistIm[i].setZ(im[i]);
//if (i%1000==0) cout << im[i] << " : " << distIm[i] << endl;
}
return;
}
// Xiaojie
Curvature ImageDistanceMap::getCurvature(double x, double y, double z) {
// get the gradient of the distance
Vector3D n = getGradDistance(x,y,z);
//cout<<"n"<<n<<endl;
// let(nX, nY, nZ) be the three components of the n vector
// get an u,v basis for the tangent plane
//TOFIX
//n=(0,0,1)
Vector3D u,v;
if((fabs(n.getY())<1e-10)&&(fabs(n.getX())<1e-10)){
u = Vector3D(1,0,0);
v = Vector3D(0,1,0);
}
else{
//xiaojie0426
u = Vector3D(n.getY(), -n.getX(), 0);
u.normalize();
v = n.cross(u);
v.normalize();
}
//DEBUG
//cout<<"n"<<n<<endl;
//cout<<"u"<<u<<endl;
//cout<<"v"<<v<<endl;
// For calculating the unit distance
const Vector3D imageToModelScale(
1.0/getModelToImageScale()[0],
1.0/getModelToImageScale()[1],
1.0/getModelToImageScale()[2] );
// dp is delta voxel in unit co-ordinates.
Vector3D dp = imageToModelScale;
dp = dp / 2.; // halve the step size as an initial guess
double dpx = dp.getX(); // faster forms of dp
double dpy = dp.getY();
double dpz = dp.getZ();
// calculating the gradient of gradient of distance
Vector3D gradGrad_X = 0.9679 * ( getGradDistance(x+dpx,y,z) - getGradDistance(x-dpx,y,z) )
+ 0.0532 * ( getGradDistance(x+2*dpx,y,z) - getGradDistance(x-2*dpx,y,z) ) ;
if(gradGrad_X==Vector3D(0,0,0)){
gradGrad_X = 0.9679 * ( getGradDistance(x+5*dpx,y,z) - getGradDistance(x-5*dpx,y,z) )
+ 0.0532 * ( getGradDistance(x+10*dpx,y,z) - getGradDistance(x-10*dpx,y,z) ) ;
}
Vector3D gradGrad_Y = 0.9679 * ( getGradDistance(x,y+dpy,z) - getGradDistance(x,y-dpy,z) )
+ 0.0532 * ( getGradDistance(x,y+2*dpy,z) - getGradDistance(x,y-2*dpy,z) ) ;
if(gradGrad_Y==Vector3D(0,0,0)){
gradGrad_Y = 0.9679 * ( getGradDistance(x,y+5*dpy,z) - getGradDistance(x,y-5*dpy,z) )
+ 0.0532 * ( getGradDistance(x,y+10*dpy,z) - getGradDistance(x,y-10*dpy,z) ) ;
}
Vector3D gradGrad_Z = 0.9679 * ( getGradDistance(x,y,z+dpz) - getGradDistance(x,y,z-dpz) )
+ 0.0532 * ( getGradDistance(x,y,z+2*dpz) - getGradDistance(x,y,z-2*dpz) ) ;
if(gradGrad_Z==Vector3D(0,0,0)){
gradGrad_Z = 0.9679 * ( getGradDistance(x,y,z+5*dpz) - getGradDistance(x,y,z-5*dpz) )
+ 0.0532 * ( getGradDistance(x,y,z+10*dpz) - getGradDistance(x,y,z-10*dpz) ) ;
}
// calculating the gradients of the gradient n = (nX, nY, nZ)
Vector3D grad_nX = Vector3D( gradGrad_X.getX(), gradGrad_Y.getX(), gradGrad_Z.getX() ) ;
Vector3D grad_nY = Vector3D( gradGrad_X.getY(), gradGrad_Y.getY(), gradGrad_Z.getY() ) ;
Vector3D grad_nZ = Vector3D( gradGrad_X.getZ(), gradGrad_Y.getZ(), gradGrad_Z.getZ() ) ;
// Curvature Tensor: the 2X2 matrix (M-II shape operator) in u,v basis
double a11 = u * Vector3D(grad_nX*u, grad_nY*u, grad_nZ*u);
double a12 = u * Vector3D(grad_nX*v, grad_nY*v, grad_nZ*v);
double a22 = v * Vector3D(grad_nX*v, grad_nY*v, grad_nZ*v);
// Construct the curvature from the tensor values
// calculating principal curvatures
//TOCHECK
//kappa1>=kapap2?
double squaredTerm = a11*a11+4*a12*a12-2*a11*a22+a22*a22 ;
if( squaredTerm < 0 )
squaredTerm = 0 ;
double kappa1 = double(0.5)*(a11+a22+sqrt(squaredTerm));
double kappa2 = double(0.5)*(a11+a22-sqrt(squaredTerm));
// calculating principal directions in combinations of the u, v basis
//umbilic case: kappa1 = kappa2 is taken care of by the a12 = 0
Vector2D prinCoor1, prinCoor2 ;
if( a12 == 0 ) {
if( a11 < a22 ) {
//DEBUG
//cout<<"a11 < a22"<<endl;
//TOCHECK
prinCoor1 = Vector2D( 0, 1 ) ;
prinCoor2 = Vector2D( 1, 0 ) ;
}
else if( a11 > a22 ) {
//DEBUG
//cout<<" a11 > a22"<<endl;
//TOCHECK
prinCoor1 = Vector2D( 1, 0 ) ;
prinCoor2 = Vector2D( 0, 1 ) ;
}
else {
//TOCHECK: seems kappa1 == 0 for this case
prinCoor1 = Vector2D( 0, 0 ) ;
prinCoor2 = Vector2D( 0, 0 ) ;
//DEBUG
//cout<<"getGradDistance(x+dpx,y,z)"<<getGradDistance(x+dpx,y,z)-getGradDistance(x-dpx,y,z)<<endl;
}
}
else {
prinCoor1 = Vector2D((a11-a22+sqrt(squaredTerm))/(2*a12),1);
prinCoor2 = Vector2D(-(-a11+a22+sqrt(squaredTerm))/(2*a12),1);
}
// calculating the principal directions
Vector3D p1 = prinCoor1.getX() * u + prinCoor1.getY() * v;
Vector3D p2 = prinCoor2.getX() * u + prinCoor2.getY() * v;
p1.normalize() ;
p2.normalize() ;
//DEBUG
//cout<<"kappa1"<<kappa1<<endl;
//cout<<"kappa2"<<kappa2<<endl;
return( Curvature( p1, p2, kappa1, kappa2 ) ) ;
}
bool ImageDistanceMap::getGradCurvature(double x, double y, double z, Vector3D& gradKappa1, Vector3D& gradKappa2) {
// For calculating the unit distance
const Vector3D imageToModelScale(
1.0/getModelToImageScale()[0],
1.0/getModelToImageScale()[1],
1.0/getModelToImageScale()[2] );
// dp is delta voxel in unit co-ordinates.
Vector3D dp = imageToModelScale;
dp = dp / 2.; // halve the step size as an initial guess
double dpx = dp.getX(); // faster forms of dp
double dpy = dp.getY();
double dpz = dp.getZ();
// calculating the gradient of gradient of kappa1
double gradKappa1X = 0.9679 * ( getCurvature(x+dpx, y, z).kappa1 - getCurvature(x-dpx, y, z).kappa1 )
+ 0.0532 * ( getCurvature(x+2*dpx, y, z).kappa1 - getCurvature(x-2*dpx, y, z).kappa1 ) ;
if(gradKappa1X==0){
gradKappa1X = 0.9679 * ( getCurvature(x+5*dpx, y, z).kappa1 - getCurvature(x-5*dpx, y, z).kappa1 )
+ 0.0532 * ( getCurvature(x+10*dpx, y, z).kappa1 - getCurvature(x-10*dpx, y, z).kappa1 ) ;
}
double gradKappa1Y = 0.9679 * ( getCurvature(x, y+dpy, z).kappa1 - getCurvature(x, y-dpy, z).kappa1 )
+ 0.0532 * ( getCurvature(x, y+2*dpy, z).kappa1 - getCurvature(x, y-2*dpy, z).kappa1 ) ;
if(gradKappa1Y==0){
gradKappa1Y = 0.9679 * ( getCurvature(x, y+5*dpy, z).kappa1 - getCurvature(x, y-5*dpy, z).kappa1 )
+ 0.0532 * ( getCurvature(x, y+10*dpy, z).kappa1 - getCurvature(x, y-10*dpy, z).kappa1 ) ;
}
double gradKappa1Z = 0.9679 * ( getCurvature(x, y, z+dpz).kappa1 - getCurvature(x, y, z-dpz).kappa1 )
+ 0.0532 * ( getCurvature(x, y, z+2*dpz).kappa1 - getCurvature(x, y, z-2*dpz).kappa1 ) ;
if(gradKappa1Z==0){
gradKappa1Z = 0.9679 * ( getCurvature(x, y, z+5*dpz).kappa1 - getCurvature(x, y, z-5*dpz).kappa1 )
+ 0.0532 * ( getCurvature(x, y, z+10*dpz).kappa1 - getCurvature(x, y, z-10*dpz).kappa1 ) ;
}
gradKappa1 = Vector3D( gradKappa1X, gradKappa1Y, gradKappa1Z ) ;
// calculating the gradient of gradient of kappa2
double gradKappa2X = 0.9679 * ( getCurvature(x+dpx, y, z).kappa2 - getCurvature(x-dpx, y, z).kappa2 )
+ 0.0532 * ( getCurvature(x+2*dpx, y, z).kappa2 - getCurvature(x-2*dpx, y, z).kappa2 ) ;
if(gradKappa2X==0){
gradKappa2X = 0.9679 * ( getCurvature(x+5*dpx, y, z).kappa2 - getCurvature(x-5*dpx, y, z).kappa2 )
+ 0.0532 * ( getCurvature(x+10*dpx, y, z).kappa2 - getCurvature(x-10*dpx, y, z).kappa2 ) ;
}
double gradKappa2Y = 0.9679 * ( getCurvature(x, y+dpy, z).kappa2 - getCurvature(x, y-dpy, z).kappa2 )
+ 0.0532 * ( getCurvature(x, y+2*dpy, z).kappa2 - getCurvature(x, y-2*dpy, z).kappa2 ) ;
if(gradKappa2Y==0){
gradKappa2Y = 0.9679 * ( getCurvature(x, y+5*dpy, z).kappa2 - getCurvature(x, y-5*dpy, z).kappa2 )
+ 0.0532 * ( getCurvature(x, y+10*dpy, z).kappa2 - getCurvature(x, y-10*dpy, z).kappa2 ) ;
}
double gradKappa2Z = 0.9679 * ( getCurvature(x, y, z+dpz).kappa2 - getCurvature(x, y, z-dpz).kappa2 )
+ 0.0532 * ( getCurvature(x, y, z+2*dpz).kappa2 - getCurvature(x, y, z-2*dpz).kappa2 ) ;
if(gradKappa2Z==0){
gradKappa2Z = 0.9679 * ( getCurvature(x, y, z+5*dpz).kappa2 - getCurvature(x, y, z-5*dpz).kappa2 )
+ 0.0532 * ( getCurvature(x, y, z+10*dpz).kappa2 - getCurvature(x, y, z-10*dpz).kappa2 ) ;
}
gradKappa2 = Vector3D( gradKappa2X, gradKappa2Y, gradKappa2Z ) ;
//DEBUG
//cout<<"gradKappa1"<<gradKappa1<<endl;
//cout<<"gradKappa2"<<gradKappa2<<endl;
return( 1 ) ;
}
| [
"zhiy@midag322017.cs.unc.edu"
] | zhiy@midag322017.cs.unc.edu | |
b10145ae6cc81101d7e2d9636a227c9e856d237b | 9ab72b27ea0e679e3a576070e303ba122ae354fe | /test/Common/utest-core.cpp | e31c25045736bc5bec5b763805596b26fb3000d8 | [] | no_license | antoniomosca/coolfluid3 | 6b18d225d3dc4bfd4a660a06eed4d4c7fd25abe5 | 13c941dd4c4d67f2f46977d76707a4e1caf1369d | refs/heads/master | 2021-01-18T10:33:56.215184 | 2011-08-26T09:45:46 | 2011-08-26T09:45:46 | 2,178,424 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,549 | cpp | // Copyright (C) 2010-2011 von Karman Institute for Fluid Dynamics, Belgium
//
// This software is distributed under the terms of the
// GNU Lesser General Public License version 3 (LGPLv3).
// See doc/lgpl.txt and doc/gpl.txt for the license text.
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE "Test module for component factory"
#include <boost/test/unit_test.hpp>
#include "Common/Log.hpp"
#include "Common/Core.hpp"
#include "Common/MPI/PE.hpp"
using namespace std;
using namespace boost;
using namespace CF;
using namespace CF::Common;
//////////////////////////////////////////////////////////////////////////////
struct Core_fixture
{
/// common setup for each test case
Core_fixture() {}
/// common tear-down for each test case
~Core_fixture() {}
};
//////////////////////////////////////////////////////////////////////////////
BOOST_FIXTURE_TEST_SUITE( CFactoryTest, Core_fixture )
//////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE( initiate )
{
Core::instance().initiate(boost::unit_test::framework::master_test_suite().argc,
boost::unit_test::framework::master_test_suite().argv);
}
////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_CASE( terminate )
{
Core::instance().terminate();
}
////////////////////////////////////////////////////////////////////////////////
BOOST_AUTO_TEST_SUITE_END()
////////////////////////////////////////////////////////////////////////////////
| [
"tlmquintino@gmail.com"
] | tlmquintino@gmail.com |
2491af6c791a4449e87f4fbae25dc09710f36ee4 | da598835bebf4e05ae04dbb521f862a8374fea00 | /cs2400/cs2401/Project5/main.cc | dd423a109beb75bad23183d71fe542523eb35641 | [] | no_license | EYE657318/github-upload | 49a307b5f2fd9d999458acf77b245caf12eaf58c | 34f52d98f493d9d9737a402b6c88ab213caa0567 | refs/heads/master | 2023-02-26T06:52:39.129235 | 2021-01-27T19:28:04 | 2021-01-27T19:28:04 | 333,533,232 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,191 | cc | #include <iostream>
#include <fstream>
#include "animals.h"
#include "dlist.h"
using namespace std;
int menu();
int main(){
char trash;
int choice;
ifstream fins;
ofstream fouts;
string animaltype;
Animal* temp;
dlist<Animal*> animals;
Animal* test;
bool breaker = false;
bool breaker2 = false;
fins.open("record.txt");
if(fins.fail()){cout << "There was a problem opening the file" << endl;
return 1;}
while(!fins.eof()){
fins >> animaltype;
if(animaltype == "ant"){
temp = new Ant;}
if(animaltype == "monkfish"){
temp = new Monkfish;}
if(animaltype == "materialrabbit"){
temp = new GemRabbit;}
if(animaltype == "scarab"){
temp = new Scarab;}
if(animaltype == "blink"){
temp = new BlinkDog;}
if(animaltype == "auroch"){
temp = new Auroch;}
temp -> input(fins);
animals.rear_insert(temp);
if(fins.peek() == '\n'){fins.ignore();}
}
cout << endl << endl << "LOADING HAPPENED" << endl << endl;
choice = menu();
cout << "CHOICE: " << choice << endl;
while(choice != 8){
switch(choice){
case 1:
temp = new Ant;
cout << "e" << endl;
break;
case 2:
temp = new Monkfish;
break;
case 3:
temp = new GemRabbit;
break;
case 4:
temp = new Scarab;
break;
case 5:
temp = new BlinkDog;
break;
case 6:
temp = new Auroch;
break;
case 7:
for(dlist<Animal*>::iterator i = animals.begin(); i!= animals.end(); ++i){
test = *i;
test -> output(cout);
cout << endl << endl;
}
//temp = NULL;
breaker2 = true;
//cout << "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" << endl;
break;
default:
breaker = true;
break;
}
if(breaker == true){
break;
}
if(breaker2 == false ){
temp -> input(cin);
animals.rear_insert(temp);
}else{
breaker2 = false;
}
choice = menu();
}
//dlist<Animal*>::iterator i = animals.begin();
//test -> output(cout);
/*Ant A;
Monkfish M;
GemRabbit G;
Scarab S;
BlinkDog B;
Auroch U;
A.input(cin);
A.output(cout);
M.input(cin);
M.output(cout);
G.input(cin);
G.output(cout);
S.input(cin);
S.output(cout);
B.input(cin);
B.output(cout);
U.input(cin);
U.output(cout);
fouts.open("record.txt");
A.output(fouts);
M.output(fouts);
G.output(fouts);
S.output(fouts);
B.output(fouts);
U.output(fouts);
fouts.close();*/
fouts.open("record.txt");
for(dlist<Animal*>::iterator i = animals.begin(); i!= animals.end(); ++i){
test = *i;
test -> output(fouts);
}
fouts.close();
cout << endl << endl << endl;
cout << "Ignore all of that, it means it's working." << endl;
cout << endl << endl;
cout << "Enter any character to exit." << endl;
cin >> trash;
return 0;
}
int menu(){
int thischoice;
cout << "Please enter your choice." << endl;
cout << "1) Create the habitat for an ant colony." << endl;
cout << "2) Create the habitat for a monkfish." << endl;
cout << "3) Create the habitat for an artificial rabbit." << endl;
cout << "4) Create the habitat for a scarab." << endl;
cout << "5) Create the habitat for a blink dog." << endl;
cout << "6) Create the habitat for a herd of aurochs." << endl;
cout << "7) Print all entries." << endl;
cout << "8) Exit the program and save to file." << endl;
cin >> thischoice;
return thischoice;
} | [
"ip657318@ohio.edu"
] | ip657318@ohio.edu |
1dceeb13384fd6e9263dc6300eb17d5ef76f4d03 | 59ed87abbfa81589d00e638746d7c05d56f27a61 | /dense_linear_alg/outer_prod.cpp | 045976b05b21a2440be5da15bea0aeac471a7dfc | [] | no_license | StephanusJustinHuang/UpdateHW5 | 6006133ccd4ec8157cdeda82198f3b19631b84f6 | 92ae95241165138b26c8a8b693127f7c3880385b | refs/heads/main | 2023-09-02T09:42:14.755882 | 2021-11-22T23:04:43 | 2021-11-22T23:04:43 | 430,891,762 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,399 | cpp | #include "mpi.h"
#include <vector>
#include <numeric>
int* outer_product0(int n, int N, std::vector<int>& x, std::vector<int>& y)
{
std::vector<int> y_global(N);
MPI_Allgather(y.data(), n, MPI_INT, y_global.data(), n, MPI_INT, MPI_COMM_WORLD);
int* z = new int[n*N];
for (int i = 0; i < n; i++)
for (int j = 0; j < N; j++)
z[i*N + j] = x[i]*y_global[j];
return z;
}
int* outer_product1(int n, int N, std::vector<int>& x, std::vector<int>& y)
{
int my_id, num_procs;
MPI_Comm_rank(MPI_COMM_WORLD, &my_id);
MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
int* z = new int[n*N];
int proc = my_id;
int first_col;
int send_proc = my_id - 1;
if (send_proc < 0) send_proc += num_procs;
int recv_proc = my_id + 1;
if (recv_proc == num_procs) recv_proc -= num_procs;
std::vector<int> tmp(n);
MPI_Request send_req, recv_req;
for (int i = 0; i < num_procs; i++)
{
first_col = n*proc;
for (int i = 0; i < n; i++)
for (int j = 0; j < n; j++)
z[i*N+j+first_col] = x[i]*y[j];
proc++;
if (proc == num_procs)
proc = 0;
MPI_Isend(y.data(), n, MPI_INT, send_proc, 0, MPI_COMM_WORLD, &send_req);
MPI_Irecv(tmp.data(), n, MPI_INT, recv_proc, 0, MPI_COMM_WORLD, &recv_req);
MPI_Wait(&send_req, MPI_STATUS_IGNORE);
MPI_Wait(&recv_req, MPI_STATUS_IGNORE);
std::copy(tmp.begin(), tmp.end(), y.begin());
}
return z;
}
int main(int argc, char* argv[])
{
MPI_Init(&argc, &argv);
int my_id, num_procs;
MPI_Comm_rank(MPI_COMM_WORLD, &my_id);
MPI_Comm_size(MPI_COMM_WORLD, &num_procs);
if (argc == 1)
{
printf("Requires command line argument for n\n");
MPI_Finalize();
return 0;
}
int N = (int) atoi(argv[1]);
int n = N / num_procs;
std::vector<int> x(n);
std::vector<int> y(n);
std::iota(x.begin(), x.end(), my_id*n);
std::iota(y.begin(), y.end(), my_id*n);
int* z_global = new int[N*N];
int* z = outer_product1(n, N, x, y);
MPI_Allgather(z, n*N, MPI_INT, z_global, n*N, MPI_INT, MPI_COMM_WORLD);
if (my_id == 0)
for (int i = 0; i < N; i++)
for (int j = 0; j < N; j++)
printf("z[%d][%d] = %d\n", i, j, z_global[i*N+j]);
delete[] z;
MPI_Finalize();
return 0;
}
| [
"66668715+StephanusJustinHuang@users.noreply.github.com"
] | 66668715+StephanusJustinHuang@users.noreply.github.com |
7e22ef17e4f17dc1d02d862620c50d659a946b93 | f2c3250674d484b91dd9385d7fac50017b034e4b | /luogu/4723-2.cpp | d6cc169102f5b4564f2ce0ab65e44f03c31e6460 | [] | no_license | DQSSSSS/Algorithm-Competition-Code | a01d4e8b3a9b9da02a400eb5bb4e063eaade33c9 | 574a0806fadf1433fcb4fac4489a237c58daab3c | refs/heads/master | 2023-01-06T06:17:12.295671 | 2020-11-11T22:44:41 | 2020-11-11T22:44:41 | 309,434,336 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,527 | cpp | #include<bits/stdc++.h>
#define For(i,a,b) for(i=(a);i<=(b);++i)
#define Forward(i,a,b) for(i=(a);i>=(b);--i)
#define Rep(i,a,b) for(register int i=(a),i##end=(b);i<=i##end;++i)
#define Repe(i,a,b) for(register int i=(a),i##end=(b);i>=i##end;--i)
#define Chkmin(a,b) a=a<b?a:b
using namespace std;
template<typename T>inline void read(T &x){
T s=0,f=1;char k=getchar();
while(!isdigit(k)&&k^'-')k=getchar();
if(!isdigit(k)){f=-1;k=getchar();}
while(isdigit(k)){s=s*10+(k^48);k=getchar();}
x=s*f;
}
void file(void){
freopen("polynomial.in","r",stdin);
freopen("polynomial.out","w",stdout);
}
const int MAXN=1<<20;
typedef long long ll;
namespace polynomial
{
static int mod=998244353,gen=3,g[21],rev[MAXN],Len;
inline int ad(int a,int b){return (a+=b)>=mod?a-mod:a;}
inline int power(int a,int b)
{
static int sum;
for(sum=1;b;b>>=1,a=(ll)a*a%mod)if(b&1)
sum=(ll)sum*a%mod;
return sum;
}
inline void predone()
{
static int i,j;
for(i=1,j=2;i<=19;++i,j<<=1)g[i]=power(gen,(mod-1)/j);
}
inline void calrev(int Len)
{
static int Logl;Logl=(int)floor(log(Len)/log(2)+0.3)-1;
Rep(i,1,Len-1)rev[i]=(rev[i>>1]>>1)|((i&1)<<Logl);
}
inline void NTT(int X[],int typ)
{
Rep(i,1,Len-1)if(i<rev[i])swap(X[i],X[rev[i]]);
static int i,j,k,kk,w,t,wn,r;
for(k=2,kk=1,r=1;k<=Len;k<<=1,kk<<=1,++r)
{
wn=g[r];
for(i=0;i<Len;i+=k)for(j=0,w=1;j<kk;++j,w=(ll)w*wn%mod)
{
t=(ll)w*X[i+j+kk]%mod;
X[i+j+kk]=ad(X[i+j],mod-t);
X[i+j]=ad(X[i+j],t);
}
}
if(typ==-1)
{
reverse(X+1,X+Len);
static int invn;invn=power(Len,mod-2);
Rep(i,0,Len-1)X[i]=(ll)X[i]*invn%mod;
}
}
static int x[MAXN],y[MAXN];
inline void mul(int a[],int b[])
{
memset(x,0,sizeof x);memset(y,0,sizeof y);
Rep(i,0,(Len>>1)-1)x[i]=a[i],y[i]=b[i];
NTT(x,1);NTT(y,1);
Rep(i,0,Len-1)x[i]=(ll)x[i]*y[i]%mod;
NTT(x,-1);
Rep(i,0,Len-1)a[i]=x[i];
}
static int A[MAXN],B[MAXN];
void Inv(int *a,int *b,int n)
{
if(n==1){b[0]=power(a[0],mod-2);return;}
Inv(a,b,n>>1);
Len=n<<1;
calrev(Len);
Rep(i,0,(Len>>1)-1)A[i]=a[i],B[i]=b[i];
NTT(A,1);NTT(B,1);
Rep(i,0,Len-1)B[i]=(ll)B[i]*B[i]%mod*A[i]%mod;
NTT(B,-1);
Rep(i,0,(Len>>1)-1)b[i]=ad(b[i],ad(b[i],mod-B[i]));
Rep(i,0,Len)A[i]=B[i]=0;
}
static int X[MAXN],Y[MAXN],TT[MAXN];
inline void Div(int *a,int n,int *b,int m)
{
if(n<m){Rep(i,0,m-1)b[i]=a[i];return;}
memcpy(X,a,sizeof X);memcpy(Y,b,sizeof Y);
reverse(b,b+m+1);reverse(X,X+n+1);
Rep(i,n-m+1,n)X[i]=0;
memset(TT,0,sizeof TT);
for(Len=2;Len<=(n-m+1);Len<<=1);
Inv(b,TT,Len);
memcpy(b,TT,sizeof TT);
while(Len<=(n<<2))Len<<=1;
calrev(Len);
mul(X,b);reverse(X,X+n-m+1);
Rep(i,n-m+1,n)X[i]=0;
mul(Y,X);
Rep(i,0,m-1)b[i]=ad(a[i],mod-Y[i]);
memcpy(a,X,sizeof X);
}
}
using namespace polynomial;
static int n,F[MAXN],G[MAXN],m,AA[MAXN],KK[MAXN];
static int R[MAXN];
inline void MMM(int *A,int *B,int *Mo,int lp)
{
Chkmin(lp,m<<1);
calrev(Len);mul(A,B);
cout << Len << endl;
memcpy(R,Mo,sizeof R);
Div(A,lp,R,m);
Rep(i,m,m<<1)A[i]=0;
Rep(i,0,m-1)A[i]=R[i];
}
inline void KSM(int *A,int x,int *B,int *Mo)
{
for(int i=1;x;x>>=1,++i)
{
if(x&1) {
printf("------------------%d----------------\n",x);
for(int k = 0;k < m*2;k ++) printf("%d ",B[k]); puts("");
for(int k = 0;k < m*2;k ++) printf("%d ",A[k]); puts("");
for(int k = 0;k < m*2;k ++) printf("%d ",Mo[k]); puts("");
MMM(B,A,Mo,m<<1);
for(int k = 0;k < m*2;k ++) printf("%d ",B[k]); puts("");
}
printf("------------------%d----------------\n",x);
for(int k = 0;k < m*2;k ++) printf("%d ",A[k]); puts("");
for(int k = 0;k < m*2;k ++) printf("%d ",A[k]); puts("");
for(int k = 0;k < m*2;k ++) printf("%d ",Mo[k]); puts("");
MMM(A,A,Mo,m<<1);
for(int k = 0;k < m*2;k ++) printf("%d ",A[k]); puts("");
}
}
/**
6 4
3 -1 0 4
-2 3 1 5
------------------6----------------
0 1 0 0 0 0 0 0
0 1 0 0 0 0 0 0
998244349 0 1 998244350 1 0 0 0
0 0 1 0 0 0 0 0
------------------3----------------
1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
998244349 0 1 998244350 1 0 0 0
0 0 1 0 0 0 0 0
------------------3----------------
0 0 1 0 0 0 0 0
0 0 1 0 0 0 0 0
998244349 0 1 998244350 1 0 0 0
4 0 998244352 3 0 0 0 0
------------------1----------------
0 0 1 0 0 0 0 0
4 0 998244352 3 0 0 0 0
998244349 0 1 998244350 1 0 0 0
32 12 998244349 21 0 0 0 0
------------------1----------------
4 0 998244352 3 0 0 0 0
4 0 998244352 3 0 0 0 0
998244349 0 1 998244350 1 0 0 0
236 84 998244326 168 0 0 0 0
*/
int main(void){
// file();
freopen("testdata (4).in","r",stdin);
predone();
read(n);read(m);
for(Len=2;Len<=(m<<1);Len<<=1);
Rep(i,1,m)read(F[m-i]),F[m-i]=ad(0,mod-F[m-i]);
F[m]=1;
Rep(i,0,m-1)read(AA[i]),AA[i]=ad(AA[i],mod);
G[1]=1;KK[0]=1;
KSM(G,n,KK,F);
static int ans=0;
Rep(i,0,m-1)ans=ad(ans,(ll)AA[i]*KK[i]%mod);
cout<<ans<<endl;
// cerr<<1.0*clock()/CLOCKS_PER_SEC<<endl;
return 0;
}
| [
"1053181679@qq.com"
] | 1053181679@qq.com |
56ecea0a4cbdab525a1dc324aa3a993fa2f1b10d | c80423e2261489d726703c033718bc54adaf3357 | /Project2/Source.cpp | fdec021529f7343b10d78845d8ec50746daa45f0 | [] | no_license | GerasimenkoOksana/diagramm | cd29f992e023cc05421a5ab2862782e5d3bb8504 | f34fb294560e0e3d3a1701c5b77a4ddfc7cfb2dd | refs/heads/master | 2022-12-16T16:11:08.109208 | 2020-09-06T18:12:05 | 2020-09-06T18:12:05 | 291,769,771 | 0 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,289 | cpp | #include<iostream>
#include<string>
#include<fstream>
using namespace std;
class Write
{
string file;
public:
Write(string file) : file(file) {}
void write(string data)
{
ofstream out(file);
out <<data;
out.close();
}
};
class Read
{
string file;
public:
Read(string file):file(file){}
int read()
{
ifstream in(file);
string data;
//in >> data;
getline(in, data);
hash<string>_hash;
in.close();
return _hash(data);
}
};
class DVD
{
string file;
void check_disk() //проверка читается ли диск
{
if (false)
{
throw "disk_corrupted";
}
}
bool check_space() //проверка своб места
{
return true;
}
public:
DVD(string file):file(file)
{
check_disk();
}
void read()
{
Read read(file);
read.read();
}
void write(string data)
{
if (!check_space()) throw "no_space";
hash<string> _hash;
int sum= _hash(data);
Write write(file);
write.write(data);
Read read(file);
if (sum == read.read())
cout << "Диск записан" << endl;
else throw "ошибка записи";
}
};
int main()
{
setlocale(0, "");
try
{
DVD dvd("file.txt");
dvd.write("1 2 345");
}
catch (const char* error)
{
cout << error << endl;
}
system("pause");
} | [
"gerrus155@gmail.com"
] | gerrus155@gmail.com |
d3c638db492486bbcc32df4d9bffe9dd09c401c9 | cb56d37259f37f7bd6b8c73d4a1fa0121c541759 | /BezierPacthCreator/hw1/Transform.h | bf42280f01635e3ad576f7ecf4624bf5acd21509 | [] | no_license | RicardoZeballos/BezierPatch | 37a933f33e90a65e14abb779de36dcea0095eaa9 | 19ef3ea0803a64b998ca0033683437235c41113c | refs/heads/master | 2020-04-05T23:39:52.230239 | 2013-11-14T07:47:53 | 2013-11-14T07:47:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 881 | h | // Transform header file to define the interface.
// The class is all static for simplicity
// You need to implement left, up and lookAt
// Rotate is a helper function
// Include the helper glm library, including matrix transform extensions
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
// glm provides vector, matrix classes like glsl
// Typedefs to make code more readable
typedef glm::mat3 mat3 ;
typedef glm::mat4 mat4 ;
typedef glm::vec3 vec3 ;
typedef glm::vec4 vec4 ;
const float pi = 3.14159265 ; // For portability across platforms
class Transform
{
public:
Transform();
virtual ~Transform();
static void left(float degrees, vec3& eye, vec3& up);
static void up(float degrees, vec3& eye, vec3& up);
static mat4 lookAt(vec3 eye, vec3 up);
static mat3 rotate(const float degrees, const vec3& axis) ;
};
| [
"z.rick3@berkeley.edu"
] | z.rick3@berkeley.edu |
9f68ab8746371ed98255b918d5199aa5da928493 | a7764174fb0351ea666faa9f3b5dfe304390a011 | /src/Prs3d/Prs3d_ShadingAspect.cxx | de9e605928954e3c9490323955b62ec1b0db5f24 | [] | no_license | uel-dataexchange/Opencascade_uel | f7123943e9d8124f4fa67579e3cd3f85cfe52d91 | 06ec93d238d3e3ea2881ff44ba8c21cf870435cd | refs/heads/master | 2022-11-16T07:40:30.837854 | 2020-07-08T01:56:37 | 2020-07-08T01:56:37 | 276,290,778 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,907 | cxx |
#define BUC60488 //GG_23/09/99 Updates correctly the Material after
// any change.
#define GER61351 //GG_171199 Enable to set an object RGB color
// instead a restricted object NameOfColor.
// Enable to change separatly the front and back color.
#define OCC1174 //SAV_080103 Added back face interior color management
#include <Prs3d_ShadingAspect.ixx>
//=======================================================================
//function : Prs3d_ShadingAspect
//purpose :
//=======================================================================
Prs3d_ShadingAspect::Prs3d_ShadingAspect () {
Graphic3d_MaterialAspect aMat (Graphic3d_NOM_BRASS);
Quantity_Color Col;
// Ceci permet de recuperer la couleur associee
// au materiau defini par defaut.
//POP K4L
Col = aMat.AmbientColor ();
// Col = aMat.Color ();
myAspect = new Graphic3d_AspectFillArea3d (Aspect_IS_SOLID,
Col,
Col,
Aspect_TOL_SOLID,
1.0,
aMat,
aMat);
}
//=======================================================================
//function : SetColor
//purpose :
//=======================================================================
#ifdef GER61351
void Prs3d_ShadingAspect::SetColor(const Quantity_NameOfColor aColor,
const Aspect_TypeOfFacingModel aModel) {
SetColor(Quantity_Color(aColor),aModel);
}
void Prs3d_ShadingAspect::SetColor(const Quantity_Color &aColor,
const Aspect_TypeOfFacingModel aModel) {
#ifndef OCC1174
myAspect->SetInteriorColor(aColor);
#endif
if( aModel != Aspect_TOFM_BOTH_SIDE ) {
myAspect->SetDistinguishOn();
}
if( aModel == Aspect_TOFM_FRONT_SIDE || aModel == Aspect_TOFM_BOTH_SIDE ) {
Graphic3d_MaterialAspect front = myAspect->FrontMaterial();
front.SetColor(aColor);
myAspect->SetFrontMaterial(front);
#ifdef OCC1174
myAspect->SetInteriorColor( aColor );
#endif
}
if( aModel == Aspect_TOFM_BACK_SIDE || aModel == Aspect_TOFM_BOTH_SIDE ) {
Graphic3d_MaterialAspect back = myAspect->BackMaterial();
back.SetColor(aColor);
myAspect->SetBackMaterial(back);
#ifdef OCC1174
myAspect->SetBackInteriorColor( aColor );
#endif
}
}
Quantity_Color Prs3d_ShadingAspect::Color( const Aspect_TypeOfFacingModel aModel ) const {
Quantity_Color myReturn ;
switch (aModel) {
default:
case Aspect_TOFM_BOTH_SIDE:
case Aspect_TOFM_FRONT_SIDE:
myReturn = myAspect->FrontMaterial().Color();
break;
case Aspect_TOFM_BACK_SIDE:
myReturn = myAspect->BackMaterial().Color();
break;
}
return myReturn ;
}
#else
void Prs3d_ShadingAspect::SetColor(const Quantity_NameOfColor aColor) {
myAspect->SetInteriorColor(aColor);
#ifdef OCC1174
myAspect->SetBackInteriorColor( aColor );
#endif
myAspect->FrontMaterial().SetAmbientColor(Quantity_Color(aColor));
myAspect->BackMaterial().SetAmbientColor(Quantity_Color(aColor));
// myAspect->FrontMaterial().SetColor(Quantity_Color(aColor));
// myAspect->BackMaterial().SetColor(Quantity_Color(aColor));
}
#endif
//=======================================================================
//function : SetMaterial
//purpose :
//=======================================================================
#ifdef GER61351
void Prs3d_ShadingAspect::SetMaterial(
const Graphic3d_NameOfMaterial aMaterial,
const Aspect_TypeOfFacingModel aModel ) {
SetMaterial(Graphic3d_MaterialAspect(aMaterial),aModel);
}
#else
void Prs3d_ShadingAspect::SetMaterial(
// const Graphic3d_NameOfPhysicalMaterial aMaterial) {
const Graphic3d_NameOfMaterial aMaterial) {
Graphic3d_MaterialAspect TheMaterial(aMaterial);
myAspect->SetFrontMaterial (TheMaterial);
myAspect->SetBackMaterial (TheMaterial);
}
#endif
//=======================================================================
//function : SetMaterial
//purpose :
//=======================================================================
#ifdef GER61351
void Prs3d_ShadingAspect::SetMaterial(
const Graphic3d_MaterialAspect& aMaterial,
const Aspect_TypeOfFacingModel aModel ) {
if( aModel != Aspect_TOFM_BOTH_SIDE ) {
myAspect->SetDistinguishOn();
}
if( aModel == Aspect_TOFM_FRONT_SIDE || aModel == Aspect_TOFM_BOTH_SIDE ) {
myAspect->SetFrontMaterial(aMaterial);
}
if( aModel == Aspect_TOFM_BACK_SIDE || aModel == Aspect_TOFM_BOTH_SIDE ) {
myAspect->SetBackMaterial(aMaterial);
}
}
Graphic3d_MaterialAspect Prs3d_ShadingAspect::Material(
const Aspect_TypeOfFacingModel aModel ) const {
Graphic3d_MaterialAspect myReturn ;
switch (aModel) {
default:
case Aspect_TOFM_BOTH_SIDE:
case Aspect_TOFM_FRONT_SIDE:
myReturn = myAspect->FrontMaterial();
break;
case Aspect_TOFM_BACK_SIDE:
myReturn = myAspect->BackMaterial();
break;
}
return myReturn ;
}
#else
void Prs3d_ShadingAspect::SetMaterial(
const Graphic3d_MaterialAspect& aMaterial)
{
myAspect->SetFrontMaterial (aMaterial);
myAspect->SetBackMaterial (aMaterial);
}
#endif
//=======================================================================
//function : SetTransparency
//purpose :
//=======================================================================
#ifdef GER61351
void Prs3d_ShadingAspect::SetTransparency(const Standard_Real aValue,
const Aspect_TypeOfFacingModel aModel ) {
if( aModel != Aspect_TOFM_BOTH_SIDE ) {
myAspect->SetDistinguishOn();
}
if( aModel == Aspect_TOFM_FRONT_SIDE || aModel == Aspect_TOFM_BOTH_SIDE ) {
Graphic3d_MaterialAspect front = myAspect->FrontMaterial();
front.SetTransparency(aValue);
myAspect->SetFrontMaterial(front);
}
if( aModel == Aspect_TOFM_BACK_SIDE || aModel == Aspect_TOFM_BOTH_SIDE ) {
Graphic3d_MaterialAspect back = myAspect->BackMaterial();
back.SetTransparency(aValue);
myAspect->SetBackMaterial(back);
}
}
Standard_Real Prs3d_ShadingAspect::Transparency(const Aspect_TypeOfFacingModel aModel ) const {
Standard_Real aValue(0.);
switch (aModel) {
case Aspect_TOFM_BOTH_SIDE:
case Aspect_TOFM_FRONT_SIDE:
aValue = myAspect->FrontMaterial().Transparency();
case Aspect_TOFM_BACK_SIDE:
aValue = myAspect->BackMaterial().Transparency();
}
return aValue;
}
#endif
//=======================================================================
//function : SetAspect
//purpose :
//=======================================================================
void Prs3d_ShadingAspect::SetAspect(const Handle(Graphic3d_AspectFillArea3d)& Asp)
{
myAspect=Asp;
}
Handle (Graphic3d_AspectFillArea3d) Prs3d_ShadingAspect::Aspect () const {
return myAspect;
}
| [
"shoka.sho2@excel.co.jp"
] | shoka.sho2@excel.co.jp |
a0dddf548c42e54bce250229d09099b616127b6e | 6bba5e0ed8aea730de624ce4afc56e8647675278 | /src/xercesc/util/XMLBigInteger.cpp | e35f09f3f2b611d897ebb47ada78d0f088e55ae0 | [
"Apache-2.0"
] | permissive | ksmyth/xerces-c | 0b3d2b330389db2018f7d820c898be7f0a2f33f0 | 245d0f626041add542ab7deabd6ba9c3e4641f6d | refs/heads/master | 2021-01-17T17:28:41.671391 | 2017-10-12T15:29:24 | 2017-10-12T15:39:21 | 61,400,297 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,647 | cpp | /*
* 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.
*/
/*
* $Id: XMLBigInteger.cpp 568078 2007-08-21 11:43:25Z amassari $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#include <xercesc/util/XMLBigInteger.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/NumberFormatException.hpp>
#include <xercesc/util/PlatformUtils.hpp>
#include <xercesc/util/TransService.hpp>
#include <xercesc/util/XMLUniDefs.hpp>
#include <xercesc/util/Janitor.hpp>
#include <xercesc/util/XMLChar.hpp>
XERCES_CPP_NAMESPACE_BEGIN
XMLCh* XMLBigInteger::getCanonicalRepresentation(const XMLCh* const rawData
, MemoryManager* const memMgr
, bool /* isNonPositiveInteger */)
{
try
{
XMLCh* retBuf = (XMLCh*) memMgr->allocate( (XMLString::stringLen(rawData) + 2) * sizeof(XMLCh));
ArrayJanitor<XMLCh> jan(retBuf, memMgr);
int sign = 0;
XMLBigInteger::parseBigInteger(rawData, retBuf, sign);
if (sign == 0)
{
retBuf[0] = chDigit_0;
retBuf[1] = chNull;
}
else if (sign == -1)
{
XMLCh* retBuffer = (XMLCh*) memMgr->allocate( (XMLString::stringLen(retBuf) + 2) * sizeof(XMLCh));
retBuffer[0] = chDash;
XMLString::copyString(&(retBuffer[1]), retBuf);
return retBuffer;
}
jan.release();
return retBuf;
}
catch (const NumberFormatException&)
{
return 0;
}
}
/***
*
* Leading and trailing whitespaces are allowed, and trimmed
*
* Only one and either of (+,-) after the leading whitespace, before
* any other characters are allowed, and trimmed
*
* Leading zero, after leading whitespace, (+|-), before any other
* characters are allowed, and trimmed
*
* '.' NOT allowed
* return status: void
* ret_buf: w/o leading and/or trailing whitespace
* w/o '+' and '-'
* w/o leading zero
*
* see XMLString::parseInt();
* XMLString::textToBin();
*
* " +000203456" "203456"
* " -000203456" "203456"
*
***/
void XMLBigInteger::parseBigInteger(const XMLCh* const toConvert
, XMLCh* const retBuffer
, int& signValue
, MemoryManager* const manager)
{
// If no string, then its a failure
if ((!toConvert) || (!*toConvert))
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_emptyString, manager);
//
// Note: in Java's BigInteger, it seems any leading and/or trailing
// whitespaces are not allowed. If this is the case, we may
// need to skip the trimming below.
//
// Scan past any whitespace. If we hit the end, then return failure
const XMLCh* startPtr = toConvert;
while (XMLChar1_0::isWhitespace(*startPtr))
startPtr++;
if (!*startPtr)
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_WSString, manager);
// Start at the end and work back through any whitespace
const XMLCh* endPtr = toConvert + XMLString::stringLen(toConvert);
while (XMLChar1_0::isWhitespace(*(endPtr - 1)))
endPtr--;
//
// Work through what remains and convert each char to a digit.
// anything other than '
//
XMLCh* retPtr = retBuffer;
signValue = 1;
//
// '+' or '-' is allowed only at the first position
//
if (*startPtr == chDash)
{
signValue = -1;
startPtr++;
if (startPtr == endPtr)
{
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager);
}
}
else if (*startPtr == chPlus)
{
// skip the '+'
startPtr++;
if (startPtr == endPtr)
{
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager);
}
}
// Scan past any leading zero.
while (*startPtr == chDigit_0)
startPtr++;
if (startPtr >= endPtr)
{
signValue = 0;
// containning zero, only zero, nothing but zero
// it is a zero, indeed
return;
}
while (startPtr < endPtr)
{
// If not valid decimal digit, then an error
if ((*startPtr < chDigit_0) || (*startPtr > chDigit_9))
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_Inv_chars, manager);
// copy over
*retPtr = *startPtr;
retPtr++;
startPtr++;
}
*retPtr = 0; //terminated
return;
}
/**
* Translates a string containing an optional minus sign followed by a
* sequence of one or more digits into a BigInteger.
* Any extraneous characters (including whitespace),
* inclusive, will result in a NumberFormatException.
*/
XMLBigInteger::XMLBigInteger(const XMLCh* const strValue,
MemoryManager* const manager)
: fSign(0)
, fMagnitude(0)
, fRawData(0)
, fMemoryManager(manager)
{
if (!strValue)
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_emptyString, fMemoryManager);
XMLCh* ret_value = (XMLCh*) fMemoryManager->allocate
(
(XMLString::stringLen(strValue) + 1) * sizeof(XMLCh)
);//new XMLCh[XMLString::stringLen(strValue)+1];
ArrayJanitor<XMLCh> janName(ret_value, fMemoryManager);
parseBigInteger(strValue, ret_value, fSign, fMemoryManager);
if (fSign == 0)
fMagnitude = XMLString::replicate(XMLUni::fgZeroLenString, fMemoryManager);
else
fMagnitude = XMLString::replicate(ret_value, fMemoryManager);
fRawData = XMLString::replicate(strValue, fMemoryManager);
}
XMLBigInteger::~XMLBigInteger()
{
fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude;
if (fRawData)
fMemoryManager->deallocate(fRawData);//delete[] fRawData;
}
XMLBigInteger::XMLBigInteger(const XMLBigInteger& toCopy)
: XMemory(toCopy)
, fSign(toCopy.fSign)
, fMagnitude(0)
, fRawData(0)
, fMemoryManager(toCopy.fMemoryManager)
{
fMagnitude = XMLString::replicate(toCopy.fMagnitude, fMemoryManager);
fRawData = XMLString::replicate(toCopy.fRawData, fMemoryManager);
}
/**
* Returns -1, 0 or 1 as lValue is less than, equal to, or greater
* than rValue.
*/
int XMLBigInteger::compareValues(const XMLBigInteger* const lValue
, const XMLBigInteger* const rValue
, MemoryManager* const manager)
{
if ((!lValue) || (!rValue) )
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_null_ptr, manager);
int lSign = lValue->getSign();
int rSign = rValue->getSign();
//
// different sign
//
if (lSign != rSign)
return(lSign > rSign ? 1 : -1);
//
// same sign
//
if (lSign == 0) // optimization
return 0;
int lStrLen = XMLString::stringLen(lValue->fMagnitude);
int rStrLen = XMLString::stringLen(rValue->fMagnitude);
//
// different length
//
if (lStrLen > rStrLen)
return ( lSign > 0 ? 1 : -1 );
else if (lStrLen < rStrLen)
return ( lSign > 0 ? -1 : 1 );
//
// same length
// XMLString::compareString() return > 0, 0 and <0
// we need to convert it to 1, 0, and -1
//
int retVal = XMLString::compareString(lValue->fMagnitude, rValue->fMagnitude);
if ( retVal > 0 )
{
return ( lSign > 0 ? 1 : -1 );
}
else if ( retVal < 0 )
{
return ( lSign > 0 ? -1 : 1 );
}
else
return 0;
}
int XMLBigInteger::compareValues(const XMLCh* const lString
, const int& lSign
, const XMLCh* const rString
, const int& rSign
, MemoryManager* const manager)
{
if ((!lString) || (!rString) )
ThrowXMLwithMemMgr(NumberFormatException, XMLExcepts::XMLNUM_null_ptr, manager);
//
// different sign
//
if (lSign != rSign)
return(lSign > rSign ? 1 : -1);
//
// same sign
//
if (lSign == 0) // optimization
return 0;
int lStrLen = XMLString::stringLen(lString);
int rStrLen = XMLString::stringLen(rString);
//
// different length
//
if (lStrLen > rStrLen)
return ( lSign > 0 ? 1 : -1 );
else if (lStrLen < rStrLen)
return ( lSign > 0 ? -1 : 1 );
//
// same length
// XMLString::compareString() return > 0, 0 and <0
// we need to convert it to 1, 0, and -1
//
int retVal = XMLString::compareString(lString, rString);
if ( retVal > 0 )
{
return ( lSign > 0 ? 1 : -1 );
}
else if ( retVal < 0 )
{
return ( lSign > 0 ? -1 : 1 );
}
else
return 0;
}
/**
* Shift the fMagnitude to the left
*/
void XMLBigInteger::multiply(const unsigned int byteToShift)
{
if (byteToShift <= 0)
return;
int strLen = XMLString::stringLen(fMagnitude);
XMLCh* tmp = (XMLCh*) fMemoryManager->allocate
(
(strLen + byteToShift + 1) * sizeof(XMLCh)
);//new XMLCh[strLen+byteToShift+1];
XMLString::moveChars(tmp, fMagnitude, strLen);
unsigned int i = 0;
for ( ; i < byteToShift; i++)
tmp[strLen+i] = chDigit_0;
tmp[strLen+i] = chNull;
fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude;
fMagnitude = tmp;
}
/**
* Shift the fMagnitude to the right
* by doing this, we lose precision.
*/
void XMLBigInteger::divide(const unsigned int byteToShift)
{
if (byteToShift <= 0)
return;
int strLen = XMLString::stringLen(fMagnitude);
XMLCh* tmp = (XMLCh*) fMemoryManager->allocate
(
(strLen - byteToShift + 1) * sizeof(XMLCh)
);//new XMLCh[strLen-byteToShift+1];
XMLString::moveChars(tmp, fMagnitude, strLen-byteToShift);
tmp[strLen-byteToShift] = chNull;
fMemoryManager->deallocate(fMagnitude);//delete[] fMagnitude;
fMagnitude = tmp;
}
//
//
//
int XMLBigInteger::intValue() const
{
unsigned int retVal;
XMLString::textToBin(fMagnitude, retVal, fMemoryManager);
return retVal * getSign();
}
XERCES_CPP_NAMESPACE_END
| [
"kevin.m.smyth@gmail.com"
] | kevin.m.smyth@gmail.com |
0bd0be634bb1b29b86f5e747e7bd235ff82281d3 | fde837c3dc53a0908bdc844bca59012e562cb69d | /loginwindow.cpp | 17b181ddfa61fae577b137e1b81abc9a6d54c351 | [] | no_license | simurayousuke/ShopSystem | 06dcc0b7ccffb95628eaeb71d533371b60b20529 | dcee4885d672af7e7be5190b2619a8ce0700edc4 | refs/heads/master | 2021-01-11T04:08:07.467187 | 2016-10-18T06:50:16 | 2016-10-18T06:50:16 | 71,217,890 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 948 | cpp | #include "loginwindow.h"
#include "ui_loginwindow.h"
#include "QMessageBox"
#include "cstdlib"
LoginWindow::LoginWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::LoginWindow)
{
ui->setupUi(this);
}
LoginWindow::~LoginWindow()
{
delete ui;
}
void LoginWindow::on_buttonLogin_clicked()
{
if(ui->inputUsername->text()=="admin")
{
if(ui->inputPassword->text()=="admin")
{
QMessageBox mb(this);
mb.setText("登录成功,欢迎回来"+ui->inputUsername->text());
mb.setWindowTitle("登录");
mb.addButton("确定", QMessageBox::AcceptRole);
mb.exec();
return;
}
}
QMessageBox mb(this);
mb.setText("登录失败,用户名或密码错误");
mb.setWindowTitle("登录");
mb.addButton("确定", QMessageBox::RejectRole);
mb.exec();
}
void LoginWindow::on_buttonExit_clicked()
{
std::exit(0);
}
| [
"yzz0427@outlook.com"
] | yzz0427@outlook.com |
c876dc1404af394dcb86fb6c053ab9009d7a31f1 | e0915750c0683ae62b56a9cd2c28a62e0136aa3d | /include/chromium/src/chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc | e628b9fd41c30d068709e1740d5de05ae89a0133 | [] | no_license | sealeks/nsdavinci | e2700b7329f8b23a0ab951a28e7c8da5cf6f69c6 | a2bb626b96550aee95374e14b3c34f5f93faa4bf | refs/heads/master | 2020-04-12T08:05:49.143881 | 2016-10-14T15:31:26 | 2016-10-14T15:31:26 | 41,061,947 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,173 | cc | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h"
#include <vector>
#include "base/time.h"
#include "chrome/browser/ui/views/sad_tab_view.h"
#include "chrome/browser/ui/views/tab_contents/native_tab_contents_view.h"
#include "chrome/browser/ui/views/tab_contents/render_view_context_menu_views.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/renderer_host/render_view_host_factory.h"
#include "content/browser/renderer_host/render_widget_host_view.h"
#include "content/browser/tab_contents/interstitial_page.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/tab_contents/tab_contents_delegate.h"
#include "views/focus/focus_manager.h"
#include "views/focus/view_storage.h"
#include "views/screen.h"
#include "views/widget/native_widget.h"
#include "views/widget/widget.h"
#if defined(OS_WIN)
#include <windows.h>
#endif
using WebKit::WebDragOperation;
using WebKit::WebDragOperationNone;
using WebKit::WebDragOperationsMask;
using WebKit::WebInputEvent;
// static
TabContentsView* TabContentsView::Create(TabContents* tab_contents) {
return new TabContentsViewViews(tab_contents);
}
TabContentsViewViews::TabContentsViewViews(TabContents* tab_contents)
: tab_contents_(tab_contents),
native_tab_contents_view_(NULL),
sad_tab_(NULL),
close_tab_after_drag_ends_(false),
focus_manager_(NULL) {
last_focused_view_storage_id_ =
views::ViewStorage::GetInstance()->CreateStorageID();
}
TabContentsViewViews::~TabContentsViewViews() {
// Makes sure to remove any stored view we may still have in the ViewStorage.
//
// It is possible the view went away before us, so we only do this if the
// view is registered.
views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
if (view_storage->RetrieveView(last_focused_view_storage_id_) != NULL)
view_storage->RemoveView(last_focused_view_storage_id_);
}
void TabContentsViewViews::Unparent() {
// Remember who our FocusManager is, we won't be able to access it once
// un-parented.
focus_manager_ = GetFocusManager();
CHECK(native_tab_contents_view_);
native_tab_contents_view_->Unparent();
}
void TabContentsViewViews::CreateView(const gfx::Size& initial_size) {
native_tab_contents_view_ =
NativeTabContentsView::CreateNativeTabContentsView(this);
native_tab_contents_view_->InitNativeTabContentsView();
}
RenderWidgetHostView* TabContentsViewViews::CreateViewForWidget(
RenderWidgetHost* render_widget_host) {
if (render_widget_host->view()) {
// During testing, the view will already be set up in most cases to the
// test view, so we don't want to clobber it with a real one. To verify that
// this actually is happening (and somebody isn't accidentally creating the
// view twice), we check for the RVH Factory, which will be set when we're
// making special ones (which go along with the special views).
DCHECK(RenderViewHostFactory::has_factory());
return render_widget_host->view();
}
// If we were showing sad tab, remove it now.
if (sad_tab_) {
SetContentsView(new views::View());
sad_tab_ = NULL;
}
return native_tab_contents_view_->CreateRenderWidgetHostView(
render_widget_host);
}
gfx::NativeView TabContentsViewViews::GetNativeView() const {
return Widget::GetNativeView();
}
gfx::NativeView TabContentsViewViews::GetContentNativeView() const {
RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
return rwhv ? rwhv->GetNativeView() : NULL;
}
gfx::NativeWindow TabContentsViewViews::GetTopLevelNativeWindow() const {
return GetTopLevelWidget()->GetNativeWindow();
}
void TabContentsViewViews::GetContainerBounds(gfx::Rect* out) const {
*out = GetClientAreaScreenBounds();
}
void TabContentsViewViews::StartDragging(const WebDropData& drop_data,
WebDragOperationsMask ops,
const SkBitmap& image,
const gfx::Point& image_offset) {
native_tab_contents_view_->StartDragging(drop_data, ops, image, image_offset);
}
void TabContentsViewViews::SetPageTitle(const std::wstring& title) {
native_tab_contents_view_->SetPageTitle(title);
}
void TabContentsViewViews::OnTabCrashed(base::TerminationStatus status,
int /* error_code */) {
// Force an invalidation to render sad tab.
// Note that it's possible to get this message after the window was destroyed.
if (GetNativeView()) {
SadTabView::Kind kind =
status == base::TERMINATION_STATUS_PROCESS_WAS_KILLED ?
SadTabView::KILLED : SadTabView::CRASHED;
sad_tab_ = new SadTabView(tab_contents_, kind);
SetContentsView(sad_tab_);
sad_tab_->SchedulePaint();
}
}
void TabContentsViewViews::SizeContents(const gfx::Size& size) {
gfx::Rect bounds;
GetContainerBounds(&bounds);
if (bounds.size() != size) {
SetSize(size);
} else {
// Our size matches what we want but the renderers size may not match.
// Pretend we were resized so that the renderers size is updated too.
OnNativeTabContentsViewSized(size);
}
}
void TabContentsViewViews::RenderViewCreated(RenderViewHost* host) {
}
void TabContentsViewViews::Focus() {
if (tab_contents_->interstitial_page()) {
tab_contents_->interstitial_page()->Focus();
return;
}
if (tab_contents_->is_crashed() && sad_tab_ != NULL) {
sad_tab_->RequestFocus();
return;
}
if (tab_contents_->constrained_window_count() > 0) {
ConstrainedWindow* window = *tab_contents_->constrained_window_begin();
DCHECK(window);
window->FocusConstrainedWindow();
return;
}
RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
GetFocusManager()->FocusNativeView(rwhv ? rwhv->GetNativeView()
: GetNativeView());
}
void TabContentsViewViews::SetInitialFocus() {
if (tab_contents_->FocusLocationBarByDefault())
tab_contents_->SetFocusToLocationBar(false);
else
Focus();
}
void TabContentsViewViews::StoreFocus() {
views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
if (view_storage->RetrieveView(last_focused_view_storage_id_) != NULL)
view_storage->RemoveView(last_focused_view_storage_id_);
views::FocusManager* focus_manager =
views::FocusManager::GetFocusManagerForNativeView(GetNativeView());
if (focus_manager) {
// |focus_manager| can be NULL if the tab has been detached but still
// exists.
views::View* focused_view = focus_manager->GetFocusedView();
if (focused_view)
view_storage->StoreView(last_focused_view_storage_id_, focused_view);
}
}
void TabContentsViewViews::RestoreFocus() {
views::ViewStorage* view_storage = views::ViewStorage::GetInstance();
views::View* last_focused_view =
view_storage->RetrieveView(last_focused_view_storage_id_);
if (!last_focused_view) {
SetInitialFocus();
} else {
views::FocusManager* focus_manager =
views::FocusManager::GetFocusManagerForNativeView(GetNativeView());
// If you hit this DCHECK, please report it to Jay (jcampan).
DCHECK(focus_manager != NULL) << "No focus manager when restoring focus.";
if (last_focused_view->IsFocusableInRootView() && focus_manager &&
focus_manager->ContainsView(last_focused_view)) {
last_focused_view->RequestFocus();
} else {
// The focused view may not belong to the same window hierarchy (e.g.
// if the location bar was focused and the tab is dragged out), or it may
// no longer be focusable (e.g. if the location bar was focused and then
// we switched to fullscreen mode). In that case we default to the
// default focus.
SetInitialFocus();
}
view_storage->RemoveView(last_focused_view_storage_id_);
}
}
void TabContentsViewViews::UpdatePreferredSize(const gfx::Size& pref_size) {
}
bool TabContentsViewViews::IsDoingDrag() const {
return native_tab_contents_view_->IsDoingDrag();
}
void TabContentsViewViews::CancelDragAndCloseTab() {
DCHECK(IsDoingDrag());
// We can't close the tab while we're in the drag and
// |drag_handler_->CancelDrag()| is async. Instead, set a flag to cancel
// the drag and when the drag nested message loop ends, close the tab.
native_tab_contents_view_->CancelDrag();
close_tab_after_drag_ends_ = true;
}
bool TabContentsViewViews::IsEventTracking() const {
return false;
}
void TabContentsViewViews::CloseTabAfterEventTracking() {
}
void TabContentsViewViews::GetViewBounds(gfx::Rect* out) const {
*out = GetWindowScreenBounds();
}
void TabContentsViewViews::UpdateDragCursor(WebDragOperation operation) {
native_tab_contents_view_->SetDragCursor(operation);
}
void TabContentsViewViews::GotFocus() {
if (tab_contents_->delegate())
tab_contents_->delegate()->TabContentsFocused(tab_contents_);
}
void TabContentsViewViews::TakeFocus(bool reverse) {
if (!tab_contents_->delegate()->TakeFocus(reverse)) {
views::FocusManager* focus_manager =
views::FocusManager::GetFocusManagerForNativeView(GetNativeView());
// We may not have a focus manager if the tab has been switched before this
// message arrived.
if (focus_manager)
focus_manager->AdvanceFocus(reverse);
}
}
void TabContentsViewViews::CloseTab() {
tab_contents_->Close(tab_contents_->render_view_host());
}
void TabContentsViewViews::CreateNewWindow(
int route_id,
const ViewHostMsg_CreateWindow_Params& params) {
delegate_view_helper_.CreateNewWindowFromTabContents(
tab_contents_, route_id, params);
}
void TabContentsViewViews::CreateNewWidget(
int route_id, WebKit::WebPopupType popup_type) {
delegate_view_helper_.CreateNewWidget(route_id, popup_type,
tab_contents_->render_view_host()->process());
}
void TabContentsViewViews::CreateNewFullscreenWidget(int route_id) {
delegate_view_helper_.CreateNewFullscreenWidget(
route_id, tab_contents_->render_view_host()->process());
}
void TabContentsViewViews::ShowCreatedWindow(int route_id,
WindowOpenDisposition disposition,
const gfx::Rect& initial_pos,
bool user_gesture,
std::wstring param) {
delegate_view_helper_.ShowCreatedWindow(
tab_contents_, route_id, disposition, initial_pos, user_gesture, param);
}
void TabContentsViewViews::ShowCreatedWidget(
int route_id, const gfx::Rect& initial_pos) {
delegate_view_helper_.ShowCreatedWidget(
tab_contents_, route_id, initial_pos);
}
void TabContentsViewViews::ShowCreatedFullscreenWidget(int route_id) {
delegate_view_helper_.ShowCreatedFullscreenWidget(tab_contents_, route_id);
}
void TabContentsViewViews::ShowContextMenu(const ContextMenuParams& params) {
// Allow delegates to handle the context menu operation first.
if (tab_contents_->delegate()->HandleContextMenu(params))
return;
context_menu_.reset(new RenderViewContextMenuViews(tab_contents_, params));
context_menu_->Init();
gfx::Point screen_point(params.x, params.y);
views::View::ConvertPointToScreen(GetRootView(), &screen_point);
// Enable recursive tasks on the message loop so we can get updates while
// the context menu is being displayed.
bool old_state = MessageLoop::current()->NestableTasksAllowed();
MessageLoop::current()->SetNestableTasksAllowed(true);
context_menu_->RunMenuAt(screen_point.x(), screen_point.y());
MessageLoop::current()->SetNestableTasksAllowed(old_state);
}
void TabContentsViewViews::ShowPopupMenu(const gfx::Rect& bounds,
int item_height,
double item_font_size,
int selected_item,
const std::vector<WebMenuItem>& items,
bool right_aligned) {
// External popup menus are only used on Mac.
NOTREACHED();
}
////////////////////////////////////////////////////////////////////////////////
// TabContentsViewViews, internal::NativeTabContentsViewDelegate implementation:
TabContents* TabContentsViewViews::GetTabContents() {
return tab_contents_;
}
bool TabContentsViewViews::IsShowingSadTab() const {
return tab_contents_->is_crashed() && sad_tab_;
}
void TabContentsViewViews::OnNativeTabContentsViewShown() {
tab_contents_->ShowContents();
}
void TabContentsViewViews::OnNativeTabContentsViewHidden() {
tab_contents_->HideContents();
}
void TabContentsViewViews::OnNativeTabContentsViewSized(const gfx::Size& size) {
if (tab_contents_->interstitial_page())
tab_contents_->interstitial_page()->SetSize(size);
RenderWidgetHostView* rwhv = tab_contents_->GetRenderWidgetHostView();
if (rwhv)
rwhv->SetSize(size);
}
void TabContentsViewViews::OnNativeTabContentsViewWheelZoom(bool zoom_in) {
if (tab_contents_->delegate())
tab_contents_->delegate()->ContentsZoomChange(zoom_in);
}
void TabContentsViewViews::OnNativeTabContentsViewMouseDown() {
// Make sure this TabContents is activated when it is clicked on.
if (tab_contents_->delegate())
tab_contents_->delegate()->ActivateContents(tab_contents_);
}
void TabContentsViewViews::OnNativeTabContentsViewMouseMove(bool motion) {
// Let our delegate know that the mouse moved (useful for resetting status
// bubble state).
if (tab_contents_->delegate()) {
tab_contents_->delegate()->ContentsMouseEvent(
tab_contents_, views::Screen::GetCursorScreenPoint(), motion);
}
}
void TabContentsViewViews::OnNativeTabContentsViewDraggingEnded() {
if (close_tab_after_drag_ends_) {
close_tab_timer_.Start(base::TimeDelta::FromMilliseconds(0), this,
&TabContentsViewViews::CloseTab);
}
tab_contents_->SystemDragEnded();
}
views::internal::NativeWidgetDelegate*
TabContentsViewViews::AsNativeWidgetDelegate() {
return this;
}
////////////////////////////////////////////////////////////////////////////////
// TabContentsViewViews, views::Widget overrides:
views::FocusManager* TabContentsViewViews::GetFocusManager() {
views::FocusManager* focus_manager = Widget::GetFocusManager();
if (focus_manager) {
// If focus_manager_ is non NULL, it means we have been reparented, in which
// case its value may not be valid anymore.
focus_manager_ = NULL;
return focus_manager;
}
// TODO(jcampan): we should DCHECK on focus_manager_, as it should not be
// NULL. We are not doing it as it breaks some unit-tests. We should
// probably have an empty TabContentView implementation for the unit-tests,
// that would prevent that code being executed in the unit-test case.
// DCHECK(focus_manager_);
return focus_manager_;
}
| [
"sealeks@mail.ru"
] | sealeks@mail.ru |
e5511026f78c7329212e72450f21d23b553db073 | 82033329b69d487f0f5442e6728a5c167f6097e7 | /MachineLearningEngine/TestMLE/VectorEngineGetMatrixGetBasicVectorsTest.h | 73ad670e1d41770cb4d05c0d7593928d83e67ac3 | [
"MIT"
] | permissive | Gronne/CPP-Matrix-Engine | 68859f9539fe92683feb3c319cb292c009c227fa | 97aaec75ebf949dc84aaddafa80bcc4d82552c50 | refs/heads/master | 2022-12-09T18:38:08.663338 | 2020-09-14T10:39:21 | 2020-09-14T10:39:21 | 170,529,569 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,249 | h | #pragma once
#include "VectorEngineDatastructureHeader.h"
TEST(VectorEngineGetMatrixGetBasicVectors, GBV0P2x2M)
{
Matrix *matrix = new Matrix(2, 2);
*matrix = { 0, 0,
0, 0 };
EXPECT_THROW(GetMatrix::getBasicVectors(*matrix), std::exception);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBV1P2x2M)
{
Matrix *matrix = new Matrix(2, 2);
*matrix = { 1, 1,
2, 2 };
Matrix *matrixResult = new Matrix(1, 2);
matrixResult->setEntry(0, 0, 1);
matrixResult->setEntry(0, 1, 1);
EXPECT_NO_THROW(*matrix = GetMatrix::getBasicVectors(*matrix));
EXPECT_TRUE(*matrixResult == *matrix);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBV2P2x2M)
{
Matrix *matrix = new Matrix(2, 2);
*matrix = { 1, 2,
5, 4 };
Matrix *matrixResult = new Matrix(2, 2);
*matrixResult = { 1, 2,
5, 4 };
EXPECT_NO_THROW(*matrix = GetMatrix::getBasicVectors(*matrix));
EXPECT_TRUE(*matrixResult == *matrix);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBV0P3x3M)
{
Matrix *matrix = new Matrix(3, 3);
*matrix = { 0, 0, 0,
0, 0, 0,
0, 0, 0 };
EXPECT_THROW(GetMatrix::getBasicVectors(*matrix), std::exception);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBV1P3x3M)
{
Matrix *matrix = new Matrix(3, 3);
*matrix = { 1, 0, 0,
0, 0, 0,
0, 0, 0 };
Matrix *matrixResult = new Matrix(1, 3);
*matrixResult = { 1, 0, 0 };
EXPECT_NO_THROW(*matrix = GetMatrix::getBasicVectors(*matrix));
EXPECT_TRUE(*matrixResult == *matrix);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBV2P3x3M)
{
Matrix *matrix = new Matrix(3, 3);
*matrix = { 1, 0, 0,
0, 1, 0,
0, 0, 0 };
Matrix *matrixResult = new Matrix(2, 3);
*matrixResult = { 1, 0, 0,
0, 1, 0 };
EXPECT_NO_THROW(*matrix = GetMatrix::getBasicVectors(*matrix));
EXPECT_TRUE(*matrixResult == *matrix);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBV3P3x3M)
{
Matrix *matrix = new Matrix(3, 3);
*matrix = { 1, 0, 0,
0, 1, 0,
0, 0, 1 };
Matrix *matrixResult = new Matrix(3, 3);
*matrixResult = { 1, 0, 0,
0, 1, 0,
0, 0, 1 };
EXPECT_NO_THROW(*matrix = GetMatrix::getBasicVectors(*matrix));
EXPECT_TRUE(*matrixResult == *matrix);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBVZeroSpecial)
{
Matrix *matrix = new Matrix(4, 5);
*matrix = { 0, 0, 0, 0, 0,
0, 1, 0, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1 };
Matrix *matrixResult = new Matrix(3, 5);
*matrixResult = { 0, 1, 0, 0, 0,
0, 0, 0, 1, 0,
0, 0, 0, 0, 1 };
EXPECT_NO_THROW(*matrix = GetMatrix::getBasicVectors(*matrix));
EXPECT_TRUE(*matrixResult == *matrix);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBVSpecialCase)
{
Matrix *matrix = new Matrix(3, 3);
*matrix = { 1, 2, 3,
0, 0, 6,
0, 0, 6 };
Matrix *matrixResult = new Matrix(2, 3);
*matrixResult = { 1, 2, 3,
0, 0, 6 };
EXPECT_NO_THROW(*matrix = GetMatrix::getBasicVectors(*matrix));
EXPECT_TRUE(*matrixResult == *matrix);
}
TEST(VectorEngineGetMatrixGetBasicVectors, GBVSpecialCase2)
{
Matrix *matrix = new Matrix(3, 4);
*matrix = { 0, 0, 0, 1,
0, 0, 0, 0,
0, 0, 0, 0 };
Matrix *matrixResult = new Matrix(1, 4);
*matrixResult = { 0, 0, 0, 1 };
EXPECT_NO_THROW(*matrix = GetMatrix::getBasicVectors(*matrix));
EXPECT_TRUE(*matrixResult == *matrix);
}
| [
"mathias0909@gmail.com"
] | mathias0909@gmail.com |
5165b494af2ae06698c7ecc95d0268d96faf1936 | 724ab4b95af7786587d442f206f0c3a895b2e2c1 | /chinko_bot/messages/game/actions/fight/GameActionFightPointsVariationMessage.h | ff28db4b02af60de1495b876e2b8d1c71c61eefb | [] | no_license | LaCulotte/chinko_bot | 82ade0e6071de4114cc56b1eb6085270d064ccb1 | 29aeba90638d0f2fe54d1394c1c9a2f63524e50e | refs/heads/master | 2023-02-04T21:15:20.344124 | 2020-12-26T08:55:00 | 2020-12-26T08:55:00 | 270,402,722 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,044 | h | #ifndef GAMEACTIONFIGHTPOINTSVARIATIONMESSAGE_MESSAGE_H
#define GAMEACTIONFIGHTPOINTSVARIATIONMESSAGE_MESSAGE_H
#include "AbstractGameActionMessage.h"
class GameActionFightPointsVariationMessage : public AbstractGameActionMessage {
public:
// Constructor
GameActionFightPointsVariationMessage() {};
// Copy constructor
GameActionFightPointsVariationMessage(const GameActionFightPointsVariationMessage& other) = default;
// Copy operator
GameActionFightPointsVariationMessage& operator=(const GameActionFightPointsVariationMessage& other) = default;
// Destructor
~GameActionFightPointsVariationMessage() = default;
virtual unsigned int getId() override { return protocolId; };
static const unsigned int protocolId = 8093;
// Turns raw data into the usable data (message's attributes)
virtual bool deserialize(shared_ptr<MessageDataBuffer> input) override;
// Turns the message's attributes into raw data
virtual bool serialize(shared_ptr<MessageDataBuffer> output) override;
double targetId = 0;
int delta = 0;
};
#endif | [
"negeko-inscriptions@hotmail.com"
] | negeko-inscriptions@hotmail.com |
5e06e29dec8a3e562d53518d4968ca7f713b2641 | 283b934b73be7019a864a24f83508071bfccd040 | /4course/modern_programming_tecs/other_labs/main.cpp | 9dc6508c59eec3aa804206db1e1a7b3342ca6953 | [
"WTFPL"
] | permissive | AlexseiT/sibsutis | 0e3aa4ca315cdf7f6654b2714c5c918f639fb74a | 5d7d88ffabbe445052927eb6c6097697df672997 | refs/heads/master | 2023-08-20T18:15:50.993319 | 2021-08-28T08:10:48 | 2021-08-28T08:10:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,409 | cpp | #include "lab5/TFracEditor.h"
#include "lab4/TPNumEditor.h"
#include <iostream>
using namespace std;
int main() {
cout << "\nTFracEditor:" << endl;
TFracEditor fracEditor;
cout << "init: " << fracEditor.getFraction() << endl;
fracEditor.editFraction(Operations::ADD_DIGIT);
cout << "Add Number: " << fracEditor.getFraction() << endl;
fracEditor.editFraction(Operations::ADD_DIVIDER);
cout << "Add divider: " << fracEditor.getFraction() << endl;
fracEditor.editFraction(Operations::ADD_SIGN);
cout << "Add sign: " << fracEditor.getFraction() << endl;
fracEditor.editFraction(Operations::ADD_DIGIT);
cout << "Add Number: " << fracEditor.getFraction() << endl;
fracEditor.editFraction(Operations::REMOVE_LAST_DIGIT);
cout << "Remove digit: " << fracEditor.getFraction() << endl;
cout << "\nTPNumEditor:" << endl;
TPNumEditor pNumEditor;
cout << "init: " << pNumEditor.getNumberString() << endl;
pNumEditor.menu(_addDigit);
cout << "add digit: " << pNumEditor.getNumberString() << endl; // int 0-15
pNumEditor.menu(_addDigit);
cout << "add digit: " << pNumEditor.getNumberString() << endl; // int 0-15
pNumEditor.menu(_backspace);
cout << "backspace: " << pNumEditor.getNumberString() << endl;
pNumEditor.menu(_editNumber);
cout << "editNumber: " << pNumEditor.getNumberString() << endl; // 10 or greater than 10
} | [
"dmitriy.samsonov28@gmail.com"
] | dmitriy.samsonov28@gmail.com |
314a64b5b7d98f8bbed0458beabfad92d5d591b6 | 90c8e33d17c6cafe9bebd439974585182b01466b | /19s_09/C/20553606_shieldforever_C.cpp | cef00e82757992eb0508542f35f619366193c520 | [] | no_license | neverac/codes | fa89f6bb2aeef868b07e3bacefa1b7051e5c9af6 | 816d5039b48a44d5e940fba85dab0649d5427983 | refs/heads/master | 2020-06-20T10:57:31.191587 | 2019-07-28T08:46:20 | 2019-07-28T08:46:20 | 197,100,521 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 452 | cpp | #include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstdlib>
#include<cstring>
#include<string>
#include<iomanip>
#include<queue>
using namespace std;
int main(){
int T;
cin>>T;
while(T--){
int ang;
cin>>ang;
int a = ang, b = 180;
for(int i = 2; i <= a; i++){
while(a % i == 0 && b % i == 0){
a /= i;
b /= i;
}
}
if(b - a == 1){
b *= 2;
a *= 2;
}
printf("%d\n", b);
}
return 0;
}
| [
"no-email"
] | no-email |
fcd1d2c318fd20e22df89cff4b1e2b876947bd8c | 8b461323d1dfc94e3d5ef3449cc8fcce7ee9de77 | /congcongclient/Classes/Game/ZJH/TLJRoomDetail.cpp | b696e2a0d1a53e859ecaaf685cf25ad33681cc90 | [
"MIT"
] | permissive | Crasader/18_TTL | 5c324623207fff1c187f8d26a9cdc5097e105850 | 4489bd5cfcf10eb9ebf4232cde822c40f5be6960 | refs/heads/master | 2020-12-12T03:19:21.529121 | 2019-01-25T05:00:11 | 2019-01-25T05:00:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 773 | cpp | #include "TLJRoomDetail.h"
#include "WIDGET.h"
FV_SINGLETON_STORAGE(TLJRoomDetail);
TLJRoomDetail::TLJRoomDetail()
{
init();
}
TLJRoomDetail::~TLJRoomDetail()
{
}
bool TLJRoomDetail::init()
{
if(!cocos2d::Node::init()) {
return false;
}
initLayout();
initButton();
return true;
}
void TLJRoomDetail::initLayout()
{
WidgetScenceXMLparse TLJroomDetail("Game/TLJ/Script/TLJRoomDetail.xml", this);
}
void TLJRoomDetail::initButton()
{
WidgetManager::addButtonCB("NNOperator_ButtonClose", this, button_selector(TLJRoomDetail::Button_Close));
}
void TLJRoomDetail::show()
{
setVisible(true);
}
void TLJRoomDetail::hide()
{
setVisible(false);
}
void TLJRoomDetail::Button_Close(cocos2d::Ref*, WidgetUserInfo*)
{
hide();
}
| [
"taotingfu819@163.com"
] | taotingfu819@163.com |
f2cbdeb5ccff6122460bd88a00b92d8567e9d4b3 | 3db023edb0af1dcf8a1da83434d219c3a96362ba | /windows_nt_3_5_source_code/NT-782/PRIVATE/SDKTOOLS/CACLS/ACCOUNT.CXX | 17eeb61a80d0a3c3cc657feed75e9b0d1e4f446b | [] | no_license | xiaoqgao/windows_nt_3_5_source_code | de30e9b95856bc09469d4008d76191f94379c884 | d2894c9125ff1c14028435ed1b21164f6b2b871a | refs/heads/master | 2022-12-23T17:58:33.768209 | 2020-09-28T20:20:18 | 2020-09-28T20:20:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,313 | cxx | //+------------------------------------------------------------------
//
// Copyright (C) 1993, Microsoft Corporation.
//
// File: account.cxx
//
// Contents: Class wrapping account sid and name
//
// Classes: CAccount
//
// History: Nov-93 DaveMont Created.
//
//-------------------------------------------------------------------
#include <account.hxx>
//+---------------------------------------------------------------------------
//
// Member: CAccount::CAccount, public
//
// Synopsis: initializes data members
//
// Arguments: IN [Name] - principal
// IN [System] - server/domain
//
//----------------------------------------------------------------------------
CAccount::CAccount(WCHAR *Name, WCHAR *System)
: _name(Name),
_system(System),
_domain(NULL),
_psid(NULL),
_fsid(TRUE)
{
}
//+---------------------------------------------------------------------------
//
// Member: CAccount::CAccount, public
//
// Synopsis: Initializes data members
//
// Arguments: IN [pSid] - SID of principal
// IN [System] - server/domain
//
//----------------------------------------------------------------------------
CAccount::CAccount(SID *pSid, WCHAR *System)
: _name(NULL),
_system(System),
_domain(NULL),
_psid(pSid),
_fsid(FALSE)
{
}
//+---------------------------------------------------------------------------
//
// Member: Dtor, public
//
// Synopsis: frees sid or name and domain
//
// Arguments: none
//
//----------------------------------------------------------------------------
CAccount::~CAccount()
{
if (_fsid)
{
if (_psid)
{
LocalFree(_psid);
}
} else if (_name)
{
LocalFree(_name);
}
if (_domain)
LocalFree(_domain);
}
//+---------------------------------------------------------------------------
//
// Member: CAccount::GetAccountName, public
//
// Synopsis: returns the Name associated with the instance of the class
//
// Arguments: OUT [name] address of the principal name
//
//----------------------------------------------------------------------------
ULONG CAccount::GetAccountName(WCHAR **name)
{
ULONG ret = STATUS_SUCCESS;
if (_name == NULL)
{
DWORD can = 0, crd = 0;
SID_NAME_USE esnu;
if (!LookupAccountSid( NULL,
_psid,
NULL,
&can,
NULL,
&crd,
&esnu))
{
if (ERROR_INSUFFICIENT_BUFFER == (ret = GetLastError()))
{
ret = STATUS_SUCCESS;
if (NULL == (_name = (WCHAR *)LocalAlloc(LMEM_FIXED, can * sizeof(WCHAR))))
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
if (NULL == (_domain = (WCHAR *)LocalAlloc(LMEM_FIXED, crd * sizeof(WCHAR))))
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
if ( !LookupAccountSid( NULL,
_psid,
_name,
&can,
_domain,
&crd,
&esnu) )
{
ret = GetLastError();
}
}
}
}
*name = _name;
return(ret);
}
//+---------------------------------------------------------------------------
//
// Member: CAccount::GetAccountSid, public
//
// Synopsis: returns the Sid
//
// Arguments: OUT [psid] - sid associated with instance of the class
//
//----------------------------------------------------------------------------
ULONG CAccount::GetAccountSid(SID **psid)
{
ULONG ret = STATUS_SUCCESS;
if (_psid == NULL && _name != NULL)
{
DWORD cusid = 0, crd = 0;
SID_NAME_USE esnu;
if (!LookupAccountName( _system,
_name,
NULL,
&cusid,
NULL,
&crd,
&esnu))
{
if (ERROR_INSUFFICIENT_BUFFER == (ret = GetLastError()))
{
ret = STATUS_SUCCESS;
if (NULL == (_psid = (SID *)LocalAlloc(LMEM_FIXED, cusid)))
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
if (NULL == (_domain = (WCHAR *)LocalAlloc(LMEM_FIXED, crd * sizeof(WCHAR))))
{
return(ERROR_NOT_ENOUGH_MEMORY);
}
if ( !LookupAccountName( _system,
_name,
_psid,
&cusid,
_domain,
&crd,
&esnu) )
{
ret = GetLastError();
}
}
}
}
*psid = _psid;
return(ret);
}
//+---------------------------------------------------------------------------
//
// Member: CAccount::GetAccountDomain, public
//
// Synopsis: returns the domain for the class
//
// Arguments: [domain] - returns the domain associated with the instance of
// the class
//
//----------------------------------------------------------------------------
ULONG CAccount::GetAccountDomain(WCHAR **domain)
{
ULONG ret = STATUS_SUCCESS;
if (_domain == NULL)
{
if (_fsid)
{
SID *psid;
ret = GetAccountSid(&psid);
} else
{
WCHAR *name;
ret = GetAccountName(&name);
}
}
*domain = _domain;
return(ret);
}
| [
"benjamin.barratt@icloud.com"
] | benjamin.barratt@icloud.com |
8305b3064a001925c00e977bc9e73a335fa6a781 | fe18c0717d9a4e4000021b05c3b342d2eaf692c1 | /src/search_local/index_read/utils/get_aois_action.h | c605ec4687f3cf44c2dac549d6d23fb7b27a0f58 | [
"OML",
"MIT",
"Apache-2.0",
"LicenseRef-scancode-public-domain"
] | permissive | jdisearch/isearch | 0c29c972650c36774d58cc10d5dc906deb5bbf18 | 272bd4ab0dc82d9e33c8543474b1294569947bb3 | refs/heads/master | 2023-08-12T10:10:13.850970 | 2021-09-18T08:43:05 | 2021-09-18T08:43:05 | 397,084,210 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,940 | h | /*
* =====================================================================================
*
* Filename: get_aois_action.h
*
* Description: aoi related definition.
*
* Version: 1.0
* Created: 09/08/2020
* Revision: none
* Compiler: gcc
*
* Author: zhulin, shzhulin3@jd.com
* Company: JD.com, Inc.
*
* =====================================================================================
*/
#ifndef _LBS_WEBSERVICE_GET_AOIS_ACTION_H_
#define _LBS_WEBSERVICE_GET_AOIS_ACTION_H_
#include <vector>
#include <limits.h>
#include <float.h>
#include <iostream>
using namespace std;
typedef std::vector<std::vector<double> > Polygon;
typedef std::vector<double> GeometryLocation;
// 点到多边形最短距离
double GetShortestDistance(double lng, double lat, const Polygon &polygon);
double GetDistance(double lon1, double lat1, double lon2, double lat2);
bool PointInPolygon(double longitude, double latitude, const Polygon &polygon);
class DistanceOp{
public:
DistanceOp(Polygon g0, Polygon g1, double terminateDistance){
geom[0].assign(g0.begin(), g0.end());
geom[1].assign(g1.begin(), g1.end());
this->terminateDistance = terminateDistance;
minDistance = DBL_MAX;
}
double distance(){
if(geom[0].size() > 0 && geom[1].size() > 0){
computeMinDistance();
return minDistance;
} else {
return 0;
}
}
void computeMinDistance(){
computeContainmentDistance(0);
if (minDistance > terminateDistance) {
computeContainmentDistance(1);
}
if (minDistance > terminateDistance) {
computeFacetDistance();
}
}
void computeContainmentDistance(int polyGeomIndex) {
int locationsIndex = 1 - polyGeomIndex;
computeContainmentDistance(geom[locationsIndex], geom[polyGeomIndex]);
if (minDistance <= terminateDistance) {
return;
}
}
void computeContainmentDistance(const Polygon &locs, const Polygon &polys) {
for(size_t i = 0; i < locs.size(); ++i) {
GeometryLocation loc = locs[i];
computeContainmentDistance(loc, polys);
if (minDistance <= terminateDistance) {
return;
}
}
}
void computeContainmentDistance(GeometryLocation ptLoc, Polygon poly) {
if (2 != locate(ptLoc, poly)) {
minDistance = 0.0;
minDistanceLocation[0].assign(ptLoc.begin(), ptLoc.end());
minDistanceLocation[1].assign(ptLoc.begin(), ptLoc.end());
}
}
int locate(GeometryLocation ptLoc, Polygon poly){
if(poly.size() == 0){
return 2;
}
// 判断点是否在多边形里面,刚好在边上或者在多边形内部返回1,在多边形外面返回2,不考虑环的情况
if(PointInPolygon(ptLoc[0], ptLoc[1], poly)){
return 1;
}
return 2;
}
void computeFacetDistance(){
for(size_t i = 0; i < geom[0].size(); ++i){
GeometryLocation p = geom[0][i];
double distance = GetShortestDistance(p[0], p[1], geom[1]);
if(distance < minDistance){
minDistance = distance;
}
if(minDistance <= terminateDistance){
return;
}
}
for(size_t i = 0; i < geom[1].size(); ++i){
GeometryLocation p = geom[1][i];
double distance = GetShortestDistance(p[0], p[1], geom[0]);
if(distance < minDistance){
minDistance = distance;
}
if(minDistance <= terminateDistance){
return;
}
}
}
private:
Polygon geom[2];
std::vector<double> minDistanceLocation[2];
double terminateDistance;
double minDistance;
};
#endif | [
"shzhulin3@jd.com"
] | shzhulin3@jd.com |
80700f27688fb8f47866fa2f4954f9f4b204633d | 5de2c8ccebe2c71bbb71fdf7e0dcdd6b7c49ac12 | /src/no_service/include/cppcon20/async_event.hpp | a1c49872b4fe69e12388a36dd0147e013b018841 | [] | no_license | RobertLeahy/CppCon2020Talk | cb43b7261ec3c466cee889f9c6f5742415f5a14e | 1ab6bd9ef429bf5446016252f75f83de4baa6c54 | refs/heads/master | 2022-12-23T22:38:30.540174 | 2020-09-15T22:49:10 | 2020-09-15T22:49:10 | 295,865,748 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,886 | hpp | #pragma once
#include <cassert>
#include <cstddef>
#include <utility>
#include <vector>
#include <asio/associated_executor.hpp>
#include <asio/async_result.hpp>
#include <asio/execution/allocator.hpp>
#include <asio/execution/context.hpp>
#include <asio/execution/execute.hpp>
#include <asio/execution/executor.hpp>
#include <asio/execution/outstanding_work.hpp>
#include <asio/execution_context.hpp>
#include <asio/io_context.hpp>
#include <asio/prefer.hpp>
#include <asio/query.hpp>
#include "pending.hpp"
namespace cppcon20 {
template<asio::execution::executor Executor>
struct basic_async_event {
using executor_type = Executor;
basic_async_event(basic_async_event&& other) = delete;
basic_async_event& operator=(basic_async_event&&) = delete;
explicit basic_async_event(executor_type ex) : ex_(std::move(ex)) {}
auto get_executor() const noexcept {
return ex_;
}
private:
Executor ex_;
std::vector<pending<void()>> pendings_;
public:
std::size_t notify_one() {
if (pendings_.empty()) return 0;
auto pending = std::move(pendings_.front());
pendings_.erase(pendings_.begin());
pending();
return 1;
}
std::size_t notify_all() {
std::size_t invoked(0);
while (notify_one()) ++invoked;
return invoked;
}
template<typename CompletionToken>
decltype(auto) async_wait(CompletionToken&& token) {
return asio::async_initiate<CompletionToken, void()>([&](auto h) {
auto ex = asio::get_associated_executor(h, ex_);
pendings_.emplace_back([h = std::move(h), ex = std::move(ex)]() mutable {
auto alloc = asio::get_associated_allocator(h);
auto alloc_ex = asio::prefer(std::move(ex), asio::execution::allocator(
alloc));
asio::execution::execute(alloc_ex, std::move(h));
});
}, token);
}
};
using async_event = basic_async_event<asio::io_context::executor_type>;
}
| [
"rleahy@rleahy.ca"
] | rleahy@rleahy.ca |
15f7362207a476c9b5584b5cffe4db9337370f59 | 2f0c1ca45348214dad8855d6414b0fbdc7467f77 | /Tools/TestWebKitAPI/Tests/WebKit2/WKImageCreateCGImageCrash.cpp | 778f088c03679d68bb831bf605fea0b06646712a | [] | no_license | changbai1980/webkit | da5bba8b6d0c9c59753fb6db6980875efe8025f0 | a3b93818797274d618f2804762ba301496aff90c | refs/heads/master | 2023-01-09T11:08:58.526560 | 2014-09-24T01:45:40 | 2014-09-24T01:45:40 | 24,399,383 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,559 | cpp | /*
* Copyright (C) 2014 Apple 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:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include <WebKit/WKImageCG.h>
namespace TestWebKitAPI {
TEST(WebKit2, WKImageCreateCGImageCrash)
{
EXPECT_FALSE(WKImageCreateCGImage(nullptr));
}
} // namespace TestWebKitAPI
| [
"aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc"
] | aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc |
9d8f3056dac308902c76ff4a5aa053a36756664c | 896b5a6aab6cb6c1e3ee2e59aad0128226471871 | /chromeos/constants/chromeos_features.h | 9483a5c9f079fba2a883ca87a0a00724fbdd4e39 | [
"BSD-3-Clause"
] | permissive | bkueppers/chromium | 86f09d32b7cb418f431b3b01a00ffe018e24de32 | d160b8b58d58120a9b2331671d0bda228d469482 | refs/heads/master | 2023-03-14T10:41:52.563439 | 2019-11-08T13:33:40 | 2019-11-08T13:33:40 | 219,389,734 | 0 | 0 | BSD-3-Clause | 2019-11-04T01:05:37 | 2019-11-04T01:05:37 | null | UTF-8 | C++ | false | false | 6,645 | h | // Copyright 2018 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 CHROMEOS_CONSTANTS_CHROMEOS_FEATURES_H_
#define CHROMEOS_CONSTANTS_CHROMEOS_FEATURES_H_
#include "base/component_export.h"
#include "base/feature_list.h"
namespace chromeos {
namespace features {
// All features in alphabetical order. The features should be documented
// alongside the definition of their values in the .cc file. If a feature is
// being rolled out via Finch, add a comment in the .cc file.
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kAmbientModeFeature;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kArcAdbSideloadingFeature;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kAutoScreenBrightness;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kBluetoothAggressiveAppearanceFilter;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kBluetoothPhoneFilter;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kBlueZLongTermKeyBlocklist;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const char kBlueZLongTermKeyBlocklistParamName[];
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kCameraSystemWebApp;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kCrostiniBackup;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kCrostiniUseBusterImage;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kCrostiniGpuSupport;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kCrostiniUsbAllowUnsupported;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kCrostiniWebUIInstaller;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kCryptAuthV2DeviceActivityStatus;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kCryptAuthV2DeviceSync;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kCryptAuthV2Enrollment;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kDisableOfficeEditingComponentApp;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kDiscoverApp;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kDriveFs;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kDriveFsMirroring;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kEolWarningNotifications;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kEduCoexistence;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kEnableFileManagerFeedbackPanel;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kEnableFileManagerPiexWasm;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kExoPointerLock;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kFilesNG;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kMojoDBusRelay;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kEnableSupervisionTransitionScreens;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kFsNosymfollow;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kGaiaActionButtons;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kGesturePropertiesDBusService;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kHelpAppV2;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kImeInputLogicHmm;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kImeInputLogicFst;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kImeInputLogicFstNonEnglish;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kImeInputLogicMozc;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kImeDecoderWithSandbox;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kVirtualKeyboardFloatingDefault;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kInstantTethering;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) extern const base::Feature kMediaApp;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kParentalControlsSettings;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kReleaseNotes;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kReleaseNotesNotification;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kSessionManagerLongKillTimeout;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kShelfScrollable;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kShelfHotseat;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kShowBluetoothDebugLogToggle;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kShowBluetoothDeviceBattery;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kShowPlayInDemoMode;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kSmartDimModelV3;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kSplitSettings;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kSplitSettingsSync;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kUpdatedCellularActivationUi;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kUseMessagesGoogleComDomain;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kUseMessagesStagingUrl;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kUserActivityPrediction;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kUseSearchClickForRightClick;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kVideoPlayerNativeControls;
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
extern const base::Feature kVirtualKeyboardBorderedKey;
// Keep alphabetized.
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAmbientModeEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsAssistantEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsEduCoexistenceEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsImeDecoderWithSandboxEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS)
bool IsInstantTetheringBackgroundAdvertisingSupported();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsParentalControlsSettingsEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsSplitSettingsEnabled();
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool IsSplitSettingsSyncEnabled();
// TODO(michaelpg): Remove after M71 branch to re-enable Play Store by default.
COMPONENT_EXPORT(CHROMEOS_CONSTANTS) bool ShouldShowPlayStoreInDemoMode();
// Keep alphabetized.
} // namespace features
} // namespace chromeos
#endif // CHROMEOS_CONSTANTS_CHROMEOS_FEATURES_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
f75a1aed3359ff521657b70d6fbdaeca225f291c | 11a3b05817a56620f1c149037951bfec63c00356 | /solver.cpp | b43d0f8394360b32b0ed3322c1f2b841dfd24f45 | [] | no_license | eroberts20/puzzle_solver | 46ad0dfc93e8138054b659910f62df5f82021b48 | 0be4d5049bbe2921945ef2c644350ab99aeeac0e | refs/heads/master | 2020-12-24T20:42:52.433262 | 2016-05-08T16:21:22 | 2016-05-08T16:21:22 | 58,320,649 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 506 | cpp | #include <iostream>
using namespace std;
#include "game_bored.h"
void init();
Game_bored bored;
int main()
{
init();
return 0;
}
void init()
{
bored.init(1, 0, 2, true);
bored.init(1, 1, 2, true);
bored.init(1, 1, 3, true);
bored.init(1, 1, 4, true);
bored.init(2, 0, 0, true);
bored.init(2, 0, 3, true);
bored.init(2, 2, 3, true);
bored.init(2, 3, 3, true);
bored.init(2, 2, 2, false);
bored.init(4, 1, 0, true);
bored.init(0, 3, 0, true);
bored.init(0, 3, 1, true);
} | [
"eroberts20@mail.csuchico.edu"
] | eroberts20@mail.csuchico.edu |
09aad02e6d9f29799ffa4a3311eee8e1c697962e | 2962f164cecb440ecd905ab9f3cc569c03a01ad5 | /RtspPlayer/assemblies/sunell/include/RecordQueryCondition.h | 4bba58e1c96232856631efc131d24db6c84575d4 | [] | no_license | paxan222/hello-world | 5ef9bd04a5c4337c1403a04973e2c0c11665bb26 | c55c60e0f72a04e1e2560dc19c2a6bbd7e8b430f | refs/heads/master | 2020-12-11T21:09:30.200433 | 2017-05-04T08:39:53 | 2017-05-04T08:39:53 | 55,044,669 | 0 | 1 | null | null | null | null | GB18030 | C++ | false | false | 9,884 | h | #ifndef _RECORD_QUERY_CONTION_
#define _RECORD_QUERY_CONTION_
#include "SNPlatOS.h"
#include "DomainConst.h"
#include "TimeStruct.h"
#include "AlarmExType.h"
#include <vector>
/**********************************************************************/
//此处用于控制文件编译字节对齐,拷贝时两行注释间内容需一起拷贝,
//结束处的“#ifdef PRAGMA_PACK”部分也要一起拷贝,否则pragma pack入栈出栈不匹配
#if(PRAGMA_PACK_DEFINE != 10000)
# error Not included "SNPlatOS.h".
#endif
#ifdef PRAGMA_PACK
#ifdef WIN32
#pragma pack(push, PRAGMA_PACK_CHAR)
#endif
#ifndef WIN32
#ifndef _PACKED_1_
#define _PACKED_1_ __attribute__((packed, aligned(PRAGMA_PACK_CHAR))) // for gcc
#endif
#else
#ifndef _PACKED_1_
#define _PACKED_1_
#endif
#endif
#else
#ifndef _PACKED_1_
#define _PACKED_1_
#endif
#endif
/**********************************************************************/
class SN_DLL_API RecordQueryCondition
{
public:
RecordQueryCondition(void);
~RecordQueryCondition(void);
RecordQueryCondition(const RecordQueryCondition &p_RecordQueryCondition);
public:
/***********************************************************************
**概述:
* 设置设备Id。
**输入:
* p_pszDeviceId:设备Id
**输出:
* 无
**返回值:
* true :设置成功
* false :设置失败
**功能:
************************************************************************/
bool setDeviceId(const char* p_pszDeviceId);
/************************************************************************
**概述:
* 获取设备Id
**输入:
* 无
**输出:
* 无
**返回值:
* 设备ID
**功能:
*
***************************************************************************/
const char* getDeviceId() const;
/***********************************************************************
**概述:
* 设置设备IP地址
**输入:
* p_strDeviceIP:设备IP地址
**输出:
* 无
**返回值:
* true :设置成功
* false :设置失败
**功能:
************************************************************************/
bool setDeviceIP(const char* p_pszDeviceIP);
/***********************************************************************
**概述:
* 获取设备IP地址
**输入:
* 无
**输出:
* 无
**返回值:
* 设备IP地址
**功能:
************************************************************************/
const char* getDeviceIP() const;
/************************************************************************
**概述:
* 设置设备通道号
**输入:
* p_nCameraId 设备通道号
**输出:
* 无
**返回值:
* 无
************************************************************************/
void setCameraId(int p_nCameraId);
/************************************************************************
**概述:
* 获取设备通道号
**输入:
* 无
**输出:
* 无
**返回值:
* 设备通道号
************************************************************************/
const int getCameraId() const;
/************************************************************************
**概述:
* 获取录像段的开始时间
**输入:
* 无
**输出:
* 无
**返回值:
* 录像段开始时间
************************************************************************/
const unsigned long getRecordBeginTime() const;
const TimeStruct& getStructRecordBeginTime() const;
/************************************************************************
**概述:
* 设置录像段的开始时间
**输入:
* p_nRecordBeginTime :录像段开始时间
**输出:
* 无
**返回值:
* 无
************************************************************************/
void setRecordBeginTime(unsigned long p_nRecordBeginTime);
void setStructRecordBeginTime(const TimeStruct& p_objTime);
/************************************************************************
**概述:
* 获取录像段的结束时间
**输入:
* 无
**输出:
* 无
**返回值:
* 录像段结束时间
************************************************************************/
const unsigned long getRecordEndTime() const;
const TimeStruct& getStructRecordEndTime() const;
/************************************************************************
**概述:
* 设置录像段的结束时间
**输入:
* p_nRecordEndTime :录像段结束时间
**输出:
* 无
**返回值:
* 无
************************************************************************/
void setRecordEndTime(unsigned long p_nRecordEndTime);
void setStructRecordEndTime(const TimeStruct& p_objTime);
/************************************************************************
**概述:
* 设置录像文件锁标志
**输入:
* p_bLockFile: true:锁定文件,false解除锁定
**输出:
* 无
**返回值:
* 无
************************************************************************/
void setLockFlag(bool p_bLockFile);
/************************************************************************
**概述:
* 获取文件锁标志
**输入:
* 无
**输出:
* 无
**返回值:
* true:文件锁定
* false:文件没有被锁定
************************************************************************/
const bool getLockFlag() const;
/************************************************************************
**概述:
* 设置录像文件报警标志
**输入:
* p_bAlarmFile: true:只查询报警文件,false所有文件
**输出:
* 无
**返回值:
* 无
************************************************************************/
void setAlarmFlag(bool p_bAlarmFile);
/************************************************************************
**概述:
* 获取是否报警标志
**输入:
* 无
**输出:
* 无
**返回值:
* true:查询报警录像
* false:查询所有录像
************************************************************************/
const bool getAlarmFlag() const;
/************************************************************************
**概述:
* 获取录像查询分段间隔
**输入:
* 无
**输出:
* 无
**返回值:
* 录像查询分段间隔时间
************************************************************************/
const unsigned long getRecordSegmentInterval() const;
/************************************************************************
**概述:
* 设置录像查询结果分段间隔
**输入:
* p_nRecordSegmentInterval :录像结果分段时间间隔,单位:s
**输出:
* 无
**返回值:
* 无
************************************************************************/
void setRecordSegmentInterval(unsigned long p_nRecordSegmentInterval);
/************************************************************************
**概述:
* 获取录像查询时间精度
**输入:
* 无
**输出:
* 无
**返回值:
* 录像查询时间精度
************************************************************************/
const int getRecordQueryTimePrecision() const;
/************************************************************************
**概述:
* 设置录像查询时间精度
**输入:
* p_nRecordQueryTimePrecision :录像查询时间精度,单位:s
* 最小精度是3s,最大1小时
**输出:
* 无
**返回值:
* 无
************************************************************************/
void setRecordQueryTimePrecision(int p_nRecordQueryTimePrecision);
/************************************************************************
**概述:
* 设置录像查询报警类型列表
**输入:
* p_objAlarmExTypeList :录像查询报警类型列表
**输出:
* 无
**返回值:
* 无
************************************************************************/
void setAlarmExTypeList(const std::vector<AlarmExType>& p_objAlarmExTypeList);
/************************************************************************
**概述:
* 获取录像查询报警类型列表
**输入:
* 无
**输出:
* 无
**返回值:
* 录像查询报警类型列表
************************************************************************/
const std::vector<AlarmExType>& getAlarmExTypeList() const;
/************************************************************************
**概述:
* 赋值函数
**输入:
* p_objRecordQueryCondition :录像查询参数信息
**输出:
* 无
**返回值:
* 无
**功能:
*
************************************************************************/
RecordQueryCondition& operator = (const RecordQueryCondition &p_objRecordQueryCondition);
private:
char m_szDeviceId[CONST_MAXLENGTH_DEVICEID + 1]; //设备id
char m_szDeviceIp[CONST_MAXLENGTH_IP + 1]; //设备IP地址
int m_nCameraId; //设备通道号
unsigned long m_nRecordBeginTime; //录像段开始时间
TimeStruct m_objRecordBeginTime; //
unsigned long m_nRecordEndTime; //录像段结束时间
TimeStruct m_objRecordEndTime; //
unsigned long m_nQuerySegmentInterval; //查询分段间隔,按多久时间分一段,单位s,0:表示不分段
int m_nQueryTimePrecision; //录像查询时间精度
bool m_bIsLockFile;
bool m_bIsAlarm; //是否报警
std::vector<AlarmExType> m_objAlarmExTypeList; //报警类型
}_PACKED_1_;
/**********************************************************************/
#ifdef PRAGMA_PACK
#ifdef WIN32
#pragma pack(pop)
#endif
#endif
/**********************************************************************/
#endif //_RECORD_QUERY_CONTION_
| [
"paxan222@yandex.ru"
] | paxan222@yandex.ru |
8260e21438b17bef8ee88ba81233bd205e9ab73f | 7c779a4e844a48c8325cb0dd10ec210ff29d3e0a | /catboost/libs/data_new/loader.h | 828fb1bf3b85b2354f6411af59e16fc576e7d0d7 | [
"Apache-2.0"
] | permissive | canorbal/catboost | 4dda61bbabe4dd4b969b72cde75aa95c6ff5eb19 | 4cd634ded290651da0c48e48e56a2a6425adf0aa | refs/heads/master | 2020-04-07T23:28:01.051412 | 2019-03-22T16:30:26 | 2019-03-22T16:30:26 | 149,100,990 | 0 | 0 | Apache-2.0 | 2018-09-17T09:26:59 | 2018-09-17T09:26:58 | null | UTF-8 | C++ | false | false | 8,074 | h | #pragma once
#include "async_row_processor.h"
#include "meta_info.h"
#include "objects.h"
#include "visitor.h"
#include <catboost/libs/data_util/line_data_reader.h>
#include <catboost/libs/data_util/path_with_scheme.h>
#include <catboost/libs/data_types/pair.h>
#include <catboost/libs/options/load_options.h>
#include <catboost/libs/column_description/cd_parser.h>
#include <library/object_factory/object_factory.h>
#include <library/threading/local_executor/local_executor.h>
#include <util/generic/strbuf.h>
#include <util/generic/string.h>
#include <util/generic/vector.h>
namespace NCB {
struct TDatasetLoaderCommonArgs {
TPathWithScheme PairsFilePath;
TPathWithScheme GroupWeightsFilePath;
TDsvFormatOptions PoolFormat;
THolder<ICdProvider> CdProvider;
TVector<ui32> IgnoredFeatures;
EObjectsOrder ObjectsOrder;
ui32 BlockSize;
NPar::TLocalExecutor* LocalExecutor;
};
// pass this struct to to IDatasetLoader ctor
struct TDatasetLoaderPullArgs {
TPathWithScheme PoolPath;
TDatasetLoaderCommonArgs CommonArgs;
};
// pass this struct to to IDatasetLoader ctor
struct TLineDataLoaderPushArgs {
THolder<ILineDataReader> Reader;
TDatasetLoaderCommonArgs CommonArgs;
};
struct IDatasetLoader {
virtual ~IDatasetLoader() = default;
virtual EDatasetVisitorType GetVisitorType() const = 0;
/* Process all data
*
* checks dynamically that IDatasetVisitor is of compatible derived type
* otherwise fails
*/
virtual void DoIfCompatible(IDatasetVisitor* visitor) = 0;
};
struct IRawObjectsOrderDatasetLoader : public IDatasetLoader {
virtual EDatasetVisitorType GetVisitorType() const override {
return EDatasetVisitorType::RawObjectsOrder;
}
void DoIfCompatible(IDatasetVisitor* visitor) override {
auto compatibleVisitor = dynamic_cast<IRawObjectsOrderDataVisitor*>(visitor);
CB_ENSURE_INTERNAL(compatibleVisitor, "visitor is incompatible with dataset loader");
Do(compatibleVisitor);
}
// Process all data
virtual void Do(IRawObjectsOrderDataVisitor* visitor) = 0;
// Process next block of objects and build sub-pool from it
// returns true if any rows were processed
virtual bool DoBlock(IRawObjectsOrderDataVisitor* visitor) = 0;
};
struct IRawFeaturesOrderDatasetLoader : public IDatasetLoader {
virtual EDatasetVisitorType GetVisitorType() const override {
return EDatasetVisitorType::RawObjectsOrder;
}
// Process all data
virtual void Do(IRawFeaturesOrderDataVisitor* visitor) = 0;
};
struct IQuantizedFeaturesDatasetLoader : public IDatasetLoader {
virtual EDatasetVisitorType GetVisitorType() const override {
return EDatasetVisitorType::QuantizedFeatures;
}
void DoIfCompatible(IDatasetVisitor* visitor) override {
auto compatibleVisitor = dynamic_cast<IQuantizedFeaturesDataVisitor*>(visitor);
CB_ENSURE_INTERNAL(compatibleVisitor, "visitor is incompatible with dataset loader");
Do(compatibleVisitor);
}
// Process all data
virtual void Do(IQuantizedFeaturesDataVisitor* visitor) = 0;
// TODO(akhropov): support blocks by features, by docs?
};
using TDatasetLoaderFactory =
NObjectFactory::TParametrizedObjectFactory<IDatasetLoader,
TString,
TDatasetLoaderPullArgs>;
///////////////////////////////////////////////////////////////////////////
// Common functionality used in IDatasetLoader implementations
/*
* init ignored features information in dataMetaInfo and ignoredFeaturesMask
* from ignoredFeaturesFlatIndices
*
* note that ignoredFeaturesFlatIndices can contain indices beyond featuresCount in dataMetaInfo
*/
void ProcessIgnoredFeaturesList(
TConstArrayRef<ui32> ignoredFeatures, // [flatFeatureIdx]
TDataMetaInfo* dataMetaInfo, // inout, must be inited, only ignored flags are updated
TVector<bool>* ignoredFeaturesMask // [flatFeatureIdx]
);
void SetPairs(const TPathWithScheme& pairsPath, ui32 objectCount, IDatasetVisitor* visitor);
void SetGroupWeights(
const TPathWithScheme& groupWeightsPath,
ui32 objectCount,
IDatasetVisitor* visitor
);
/*
* Some common functionality for IRawObjectsOrderDatasetLoader classes than utilize async row processing.
* Args, FeatureIds and DataMetaInfo are provided as commonly needed
* (but not related to async processing)
*
* Derived classes must implement GetObjectDount, StartBuilder and ProcessBlock
* (and might redefine FinalizeBuilder, but common implementation is provided)
* and then implement IRawObjectsOrderDatasetLoader like this:
*
* > void Do(IRawObjectsOrderDataVisitor* visitor) override {
* > TBase::Do(GetReadFunc(), visitor);
* > }
* >
* > bool DoBlock(IRawObjectsOrderDataVisitor* visitor) override {
* > return TBase::DoBlock(GetReadFunc(), visitor);
* > }
*/
template <class TData>
class TAsyncProcDataLoaderBase {
public:
explicit TAsyncProcDataLoaderBase(TDatasetLoaderCommonArgs&& args)
: Args(std::move(args))
, AsyncRowProcessor(Args.LocalExecutor, Args.BlockSize)
{}
protected:
template <class TReadDataFunc>
void Do(TReadDataFunc readFunc, IRawObjectsOrderDataVisitor* visitor) {
StartBuilder(false, GetObjectCount(), 0, visitor);
while (AsyncRowProcessor.ReadBlock(readFunc)) {
ProcessBlock(visitor);
}
FinalizeBuilder(false, visitor);
}
template <class TReadDataFunc>
bool DoBlock(TReadDataFunc readFunc, IRawObjectsOrderDataVisitor* visitor) {
CB_ENSURE(!Args.PairsFilePath.Inited(),
"TAsyncProcDataLoaderBase::DoBlock does not support pairs data");
CB_ENSURE(!Args.GroupWeightsFilePath.Inited(),
"TAsyncProcDataLoaderBase::DoBlock does not support group weights data");
if (!AsyncRowProcessor.ReadBlock(readFunc))
return false;
StartBuilder(true,
AsyncRowProcessor.GetParseBufferSize(),
AsyncRowProcessor.GetLinesProcessed(),
visitor);
ProcessBlock(visitor);
FinalizeBuilder(true, visitor);
return true;
}
virtual ui32 GetObjectCount() = 0;
virtual void StartBuilder(bool inBlock,
ui32 objectCount, ui32 offset,
IRawObjectsOrderDataVisitor* visitor) = 0;
virtual void ProcessBlock(IRawObjectsOrderDataVisitor* visitor) = 0;
virtual void FinalizeBuilder(bool inBlock, IRawObjectsOrderDataVisitor* visitor) {
if (!inBlock) {
SetGroupWeights(Args.GroupWeightsFilePath, GetObjectCount(), visitor);
SetPairs(Args.PairsFilePath, GetObjectCount(), visitor);
}
visitor->Finish();
}
virtual ~TAsyncProcDataLoaderBase() = default;
protected:
TDatasetLoaderCommonArgs Args;
NCB::TAsyncRowProcessor<TData> AsyncRowProcessor;
TVector<TString> FeatureIds;
TDataMetaInfo DataMetaInfo;
};
/* missing values mostly as in pandas
* (https://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html)
* + some additions like 'NAN', 'Na', 'na', 'Null', 'none', 'None', '-'
*/
bool IsMissingValue(const TStringBuf& s);
bool TryParseFloatFeatureValue(TStringBuf stringValue, float* value);
}
| [
"akhropov@yandex-team.ru"
] | akhropov@yandex-team.ru |
b3ea331cdadb31c7dbba1f937012e818e6fd1d73 | 477061b1377b7c1230b122c6148c24732065e72d | /gittutorial/stdafx.cpp | b89c1cb9a0e54d998b79614387ab21107078e559 | [] | no_license | ChenLiCh/gitTest | 3c57a21ad496d1cda4066fb585f9dd9e351b4bfb | 0a08fa05eccde821b348ce835cb2f27e264f0118 | refs/heads/master | 2021-03-30T21:22:08.392456 | 2018-03-16T03:14:27 | 2018-03-16T03:14:27 | 124,482,297 | 0 | 0 | null | null | null | null | BIG5 | C++ | false | false | 183 | cpp | // stdafx.cpp : 僅包含標準 Include 檔的原始程式檔
// gittutorial.pch 會成為先行編譯標頭檔
// stdafx.obj 會包含先行編譯類型資訊
#include "stdafx.h"
| [
"ahm12345@gmail.com"
] | ahm12345@gmail.com |
e5887f23d76f080fae83162a3ed479bbeff383f6 | 48187768666c03e8eda5e138f23f247ffb9e9af7 | /Prime/Prime.cpp | e8834565c76fa8e85127e9fc731c6d9dfbed4542 | [] | no_license | huangx99/mySonOOP | dcc6a593f19f56a5df358d1f2988d63d43f48151 | 9de3ab591981f4d837fad02eb080090dec560a31 | refs/heads/master | 2020-09-01T12:29:54.670433 | 2017-07-22T04:10:09 | 2017-07-22T04:10:09 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,001 | cpp | #include "Prime.h"
using namespace std;
Prime::Prime(int low, int up):lower(low),upper(up) {
count=0;
dArray=new int[upper-lower];
generatePrime();
}
Prime::~Prime() {
delete [] dArray;
}
bool Prime::isPrime(int n){
int i;
if(n<=1)return false;
for(i=2;i<n;i++){//2,3,4,,,n-1
if(n%i==0)
return false;
}
if(i==n)//i=n
return true;
}
void Prime::printPrime(){
cout<<lower<<"---"<<upper<<" "<<count<<" 素数:"<<endl;
if(count<=MAXCOUNT){
cout<<"静态数组保存素数"<<endl;
for(int i=0; i<count;i++)
cout<<setw(3)<<sArray[i]<<" ";
cout<<endl;
}else{
cout<<"动态数组保存素数"<<endl;
for(int i=0; i<count;i++)
cout<<setw(4)<<dArray[i]<<" ";
cout<<endl;
}
}
void Prime::generatePrime(){
for(int i=lower;i<=upper;i++){
if(isPrime(i))
sArray[count++]=i;
if(count==MAXCOUNT){
cout<<"超过256"<<endl;
goto DARRAY;//goto语句,DARRAY
}
}
DARRAY:
count=0;
for(int i=lower;i<=upper;i++){
if(isPrime(i))
dArray[count++]=i;
}
}
| [
"czldl@tom.com"
] | czldl@tom.com |
16847ae104bb6f2e7492f3c78ac803e4e533b794 | 1879a2f5a4a14b81051e3858147c31082eb7dfc7 | /src/JlsNameSpace.hpp | a5bd140ed56bf544c426b8476d895fdd57245ba5 | [] | no_license | asdlei99/join_logo_scp | 1ad70a0e3084f8971cbfc3d95ec357cc41aea9a7 | 0ee68f2054e2d3477a4b7d2d259b4140222e354b | refs/heads/master | 2020-09-26T12:42:03.807453 | 2018-11-11T13:54:11 | 2018-11-11T13:54:11 | null | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 17,769 | hpp | //
// join_logo_scp データ用定義
//
#pragma once
//---------------------------------------------------------------------
// データ格納用
//---------------------------------------------------------------------
namespace jlsd
{
using Msec = int;
using Sec = int;
using Nsc = int;
using Nrf = int;
using Nlg = int;
//--- Auto構成区切り(scp.chap) ---
enum ScpChapType {
SCP_CHAP_DUPE = -1, // 重複箇所
SCP_CHAP_NONE, // 初期状態
SCP_CHAP_CPOSIT, // 5秒単位可能性保持
SCP_CHAP_CPOSQ, // 15秒単位可能性保持
SCP_CHAP_CDET, // 15秒単位保持
SCP_CHAP_DINT, // 構成内部整数秒単位区切り
SCP_CHAP_DBORDER, // 無音シーンチェンジなし区切り
SCP_CHAP_DFIX, // 構成区切り
SCP_CHAP_DFORCE, // 強制区切り設定箇所
SCP_CHAP_DUNIT // Trimも強制区切り
};
static const ScpChapType SCP_CHAP_DECIDE = SCP_CHAP_DINT; // 確定箇所閾値
inline bool isScpChapTypeDecide(ScpChapType type){
return (type >= SCP_CHAP_DECIDE)? true : false;
}
//--- Auto構成推測基本内容(scp.arstat) ---
enum ScpArType {
SCP_AR_UNKNOWN, // 不明
SCP_AR_L_UNIT, // ロゴ有 15秒単位
SCP_AR_L_OTHER, // ロゴ有 その他
SCP_AR_L_MIXED, // ロゴ有 ロゴ無も混合
SCP_AR_N_UNIT, // ロゴ無 15秒単位
SCP_AR_N_OTHER, // ロゴ無 その他
SCP_AR_N_AUNIT, // ロゴ無 合併で15秒の中間地点
SCP_AR_N_BUNIT, // ロゴ無 合併で15秒の端
SCP_AR_B_UNIT, // ロゴ境界 15秒単位
SCP_AR_B_OTHER // ロゴ境界 その他
};
static const int SCP_ARR_L_LOW = SCP_AR_L_UNIT; // ロゴ有の下限値
static const int SCP_ARR_L_HIGH = SCP_AR_L_MIXED; // ロゴ有の上限値
inline bool isScpArTypeLogo(ScpArType type){
return (type >= SCP_ARR_L_LOW && type <= SCP_ARR_L_HIGH)? true : false;
}
inline bool isScpArTypeBorder(ScpArType type){
return (type >= SCP_AR_B_UNIT && type <= SCP_AR_B_OTHER)? true : false;
}
inline bool isScpArTypeLogoBorder(ScpArType type){
return ((type >= SCP_ARR_L_LOW && type <= SCP_ARR_L_HIGH) ||
(type >= SCP_AR_B_UNIT && type <= SCP_AR_B_OTHER))? true : false;
}
//--- Auto構成推測拡張内容(scp.arext) ---
enum ScpArExtType {
SCP_AREXT_NONE, // 追加構成なし
SCP_AREXT_L_TRKEEP, // ロゴ有 残す予告
SCP_AREXT_L_TRCUT, // ロゴ有 カット番宣
SCP_AREXT_L_TRRAW, // ロゴ有 エンドカード判断前
SCP_AREXT_L_ECCUT, // ロゴ有 カット番宣
SCP_AREXT_L_EC, // ロゴ有 エンドカード
SCP_AREXT_L_SP, // ロゴ有 番組提供
SCP_AREXT_L_LGCUT, // ロゴ有 ロゴ端部分カット
SCP_AREXT_L_LGADD, // ロゴ有 ロゴ端部分残す
SCP_AREXT_N_TRCUT, // ロゴ無 カット番宣
SCP_AREXT_N_LGCUT, // ロゴ無 ロゴ端部分カット
SCP_AREXT_N_LGADD // ロゴ無 ロゴ端部分残す
};
//--- 設定値保持 ---
enum ConfigVarType {
CONFIG_VAR_msecWLogoTRMax, // AutoCutコマンドでカット対象とするロゴ期間最大フレーム期間
CONFIG_VAR_msecWCompTRMax, // AutoCutコマンドTRで予告と認識する構成最大フレーム期間
CONFIG_VAR_msecWLogoSftMrg, // Autoコマンド前調整でロゴ切り替わりのずれを許すフレーム期間
CONFIG_VAR_msecWCompFirst, // 先頭構成カット扱いにする構成最大フレーム期間
CONFIG_VAR_msecWCompLast, // 最後構成カット扱いにする構成最大フレーム期間
CONFIG_VAR_msecWLogoSumMin, // ロゴ合計期間が指定フレーム未満の時はロゴなしとして扱う
CONFIG_VAR_msecWLogoLgMin, // CM推測時にロゴ有情報確定と認識する最小ロゴ期間
CONFIG_VAR_msecWLogoCmMin, // CM推測時にロゴ無情報確定と認識する最小ロゴ期間
CONFIG_VAR_msecWLogoRevMin, // ロゴ情報補正する時に本編と認識する最小期間
CONFIG_VAR_msecMgnCmDetect, // CM構成で15秒単位ではない可能性と認識する誤差フレーム期間
CONFIG_VAR_msecMgnCmDivide, // CM構成内分割を許す1秒単位からの誤差フレーム期間
CONFIG_VAR_secWCompSPMin, // Autoコマンド番組提供で標準最小秒数
CONFIG_VAR_secWCompSPMax, // Autoコマンド番組提供で標準最大秒数
CONFIG_VAR_flagCutTR, // 15秒以上番宣をカットする場合は1をセット
CONFIG_VAR_flagCutSP, // 番組提供をカットする場合は1をセット
CONFIG_VAR_flagAddLogo, // ロゴあり通常構成を残す場合は1をセット(現在は未使用)
CONFIG_VAR_flagAddUC, // ロゴなし不明構成を残す場合は1をセット
CONFIG_VAR_typeNoSc, // シーンチェンジなし無音位置のCM判断(0:自動 1:なし 2:あり)
CONFIG_VAR_cancelCntSc, // 無音が多い構成を分離しない処理を1の時は使用しない
CONFIG_VAR_LogoLevel, // ロゴ使用レベル
CONFIG_VAR_LogoRevise, // ロゴからの補正
CONFIG_VAR_AutoCmSub, // ロゴなし時の補助設定
CONFIG_VAR_msecPosFirst, // ロゴ開始位置検出設定期間
CONFIG_VAR_msecLgCutFirst, // ロゴが最初からある時にカット扱いにする構成最大フレーム期間
CONFIG_VAR_msecZoneFirst, // ロゴ無効とする開始位置検出設定期間
CONFIG_VAR_msecZoneLast, // ロゴ無効とする終了位置検出設定期間
CONFIG_VAR_priorityPosFirst, // 最初の位置設定優先度(0:制御なし 1:ロゴあり 2:位置優先 3:Select優先)
SIZE_CONFIG_VAR
};
enum ConfigActType { // 設定値を動作別に取得用
CONFIG_ACT_LogoDelEdge, // ロゴ端のCM判断
CONFIG_ACT_LogoDelMid, // ロゴ内の15秒単位CM化
CONFIG_ACT_LogoDelWide, // 広域ロゴなし削除
CONFIG_ACT_LogoUCRemain, // ロゴなし不明部分を残す
CONFIG_ACT_LogoUCGapCm, // CM単位から誤差が大きい構成を残す
CONFIG_ACT_MuteNoSc // シーンチェンジなし無音位置のCM判断(1:使用しない 2:使用する)
};
//--- 構成候補優先順位(scp.stat) ---
enum ScpPriorType {
SCP_PRIOR_DUPE = -1, // 間引き
SCP_PRIOR_NONE, // 初期状態
SCP_PRIOR_LV1, // 候補
SCP_PRIOR_DECIDE // 決定
};
//--- 構成候補優先順位(logo.stat_*) ---
enum LogoPriorType {
LOGO_PRIOR_DUPE = -1, // 間引き
LOGO_PRIOR_NONE, // 初期状態
LOGO_PRIOR_LV1, // 候補
LOGO_PRIOR_DECIDE // 決定
};
//--- ロゴ分離構成状態(logo.unit_*) ---
enum LogoUnitType {
LOGO_UNIT_NORMAL, // 通常
LOGO_UNIT_DIVIDE // ロゴ分離
};
//--- ロゴ結果確定状態(logo.flag_*) ---
enum LogoResultType {
LOGO_RESULT_NONE, // 初期状態
LOGO_RESULT_DECIDE, // 確定
LOGO_RESULT_ABORT // abort破棄確定
};
//--- 選択方向 ---
enum SearchDirType {
SEARCH_DIR_PREV,
SEARCH_DIR_NEXT
};
//--- ロゴの選択エッジ ---
enum LogoEdgeType {
LOGO_EDGE_RISE, // ロゴの立ち上がりエッジ
LOGO_EDGE_FALL, // ロゴの立ち下がりエッジ
LOGO_EDGE_BOTH // ロゴの両エッジ
};
//--- ロゴの選択 ---
enum LogoSelectType {
LOGO_SELECT_ALL, // 全選択
LOGO_SELECT_VALID // 有効のみ選択
};
//--- シーンチェンジで全体の先頭最後を除く選択 ---
enum ScpEndType {
SCP_END_EDGEIN, // シーンチェンジ番号の先頭最後含む
SCP_END_NOEDGE // シーンチェンジ番号の先頭最後除く
};
//--- ロゴのエッジ方向認識 ---
inline bool isLogoEdgeRise(LogoEdgeType type){
return (type == LOGO_EDGE_RISE || type == LOGO_EDGE_BOTH)? true : false;
}
inline bool isLogoEdgeFall(LogoEdgeType type){
return (type == LOGO_EDGE_FALL || type == LOGO_EDGE_BOTH)? true : false;
}
inline LogoEdgeType edgeInvert(LogoEdgeType type){
return (type == LOGO_EDGE_FALL)? LOGO_EDGE_RISE : LOGO_EDGE_FALL;
}
inline bool isLogoEdgeRiseFromNrf(int nrf){
return (nrf % 2 == 0)? true : false;
}
//--- ロゴ番号変換(nrf - nlg) ---
inline LogoEdgeType edgeFromNrf(int nrf){
return (nrf % 2 == 0)? LOGO_EDGE_RISE : LOGO_EDGE_FALL;
}
inline LogoEdgeType edgeInvertFromNrf(int nrf){
return (nrf % 2 == 0)? LOGO_EDGE_FALL : LOGO_EDGE_RISE;
}
inline int nlgFromNrf(int nrf){
return nrf / 2;
}
inline int nrfFromNlg(int nlg, LogoEdgeType edge){
return (edge == LOGO_EDGE_FALL)? nlg*2+1 : nlg*2;
}
inline int nrfFromNlgRise(int nlg){
return nlg*2;
}
inline int nrfFromNlgFall(int nlg){
return nlg*2+1;
}
//--- 優先順位の変換 ---
inline LogoPriorType priorLogoFromScp(ScpPriorType n){
return (LogoPriorType) n;
}
//--- 保持設定値のフラグ値定義 ---
enum ConfigBitType {
CONFIG_LOGO_LEVEL_DEFAULT = 0,
CONFIG_LOGO_LEVEL_UNUSE_ALL = 1,
CONFIG_LOGO_LEVEL_UNUSE_EX1 = 2,
CONFIG_LOGO_LEVEL_UNUSE_EX2 = 3,
CONFIG_LOGO_LEVEL_USE_LOW = 4,
CONFIG_LOGO_LEVEL_USE_MIDL = 5,
CONFIG_LOGO_LEVEL_USE_MIDH = 6,
CONFIG_LOGO_LEVEL_USE_HIGH = 7,
CONFIG_LOGO_LEVEL_USE_MAX = 8
};
//--- 構造体 ---
struct RangeNsc {
Nsc st;
Nsc ed;
};
struct RangeNrf {
Nrf st;
Nrf ed;
};
struct RangeMsec {
Msec st;
Msec ed;
};
struct WideMsec {
Msec just;
Msec early;
Msec late;
};
struct RangeFixMsec {
Msec st;
Msec ed;
bool fixSt; // true=確定開始地点
bool fixEd; // true=確定終了地点
};
struct RangeWideMsec {
WideMsec st;
WideMsec ed;
bool fixSt; // true=確定開始地点
bool fixEd; // true=確定終了地点
bool logomode; // false=CM期間 true=ロゴ期間
};
struct RangeNscMsec {
RangeNsc nsc;
RangeMsec msec;
};
struct Term {
bool valid;
bool endfix;
ScpEndType endtype;
Nsc ini;
RangeNsc nsc;
RangeMsec msec;
};
struct NrfCurrent {
bool valid; // 0=データ格納なし 1=データ格納あり
Nrf nrfRise;
Nrf nrfFall;
Nrf nrfLastRise;
Nrf nrfLastFall;
Msec msecRise;
Msec msecFall;
Msec msecLastRise;
Msec msecLastFall;
};
struct ElgCurrent {
bool valid; // 0=データ格納なし 1=データ格納あり
bool border; // 0=border含めない 1=border含む
bool outflag; // 0=内部動作 1=最終出力動作
Nsc nscRise;
Nsc nscFall;
Nsc nscLastRise;
Nsc nscLastFall;
Msec msecRise;
Msec msecFall;
Msec msecLastRise;
Msec msecLastFall;
};
struct CalcDifInfo {
int sgn;
Sec sec;
Msec gap;
};
struct CalcModInfo {
Msec mod15;
Msec mod05;
};
}
//---------------------------------------------------------------------
// JLスクリプトの引数関連保持
//---------------------------------------------------------------------
namespace jlscmd
{
//--- JLスクリプト命令 ---
enum JlcmdSelType {
JLCMD_SEL_Nop,
JLCMD_SEL_If,
JLCMD_SEL_EndIf,
JLCMD_SEL_Else,
JLCMD_SEL_ElsIf,
JLCMD_SEL_Call,
JLCMD_SEL_Repeat,
JLCMD_SEL_EndRepeat,
JLCMD_SEL_Echo,
JLCMD_SEL_LogoOff,
JLCMD_SEL_OldAdjust,
JLCMD_SEL_Set,
JLCMD_SEL_Default,
JLCMD_SEL_EvalFrame,
JLCMD_SEL_EvalTime,
JLCMD_SEL_EvalNum,
JLCMD_SEL_SetParam,
JLCMD_SEL_OptSet,
JLCMD_SEL_OptDefault,
JLCMD_SEL_UnitSec,
JLCMD_SEL_AutoCut,
JLCMD_SEL_AutoAdd,
JLCMD_SEL_AutoEdge,
JLCMD_SEL_AutoCM,
JLCMD_SEL_AutoUp,
JLCMD_SEL_AutoBorder,
JLCMD_SEL_AutoIns,
JLCMD_SEL_AutoDel,
JLCMD_SEL_Find,
JLCMD_SEL_MkLogo,
JLCMD_SEL_DivLogo,
JLCMD_SEL_Select,
JLCMD_SEL_Force,
JLCMD_SEL_Abort,
JLCMD_SEL_GetPos,
JLCMD_SEL_GetList,
JLCMD_SEL_NextTail,
JLCMD_SEL_DivFile,
SIZE_JLCMD_SEL
};
//--- JLスクリプト命令種類 ---
enum JlcmdCategoryType {
JLCMD_CAT_NONE,
JLCMD_CAT_COND,
JLCMD_CAT_CALL,
JLCMD_CAT_REP,
JLCMD_CAT_SYS,
JLCMD_CAT_REG,
JLCMD_CAT_NEXT,
JLCMD_CAT_LOGO,
JLCMD_CAT_AUTOLOGO,
JLCMD_CAT_AUTOEACH,
JLCMD_CAT_AUTO
};
//--- JLスクリプトオプション種類 ---
enum JlOptionCategoryType{
JLOPT_CAT_NONE,
JLOPT_CAT_NUMLOGO,
JLOPT_CAT_FRAME,
JLOPT_CAT_SC,
JLOPT_CAT_MSECM1,
JLOPT_CAT_SEC,
JLOPT_CAT_NUM,
JLOPT_CAT_FLAG
};
//--- JLスクリプトオプション格納変数 ---
enum JlOptionDataType {
JLOPT_DATA_DUMMY,
JLOPT_DATA_TypeNLogo,
JLOPT_DATA_TypeFrame,
JLOPT_DATA_MsecFrameLeft,
JLOPT_DATA_MsecFrameRight,
JLOPT_DATA_MsecEndlenC,
JLOPT_DATA_MsecEndlenL,
JLOPT_DATA_MsecEndlenR,
JLOPT_DATA_MsecSftC,
JLOPT_DATA_MsecSftL,
JLOPT_DATA_MsecSftR,
JLOPT_DATA_MsecTLHoldL,
JLOPT_DATA_MsecTLHoldR,
JLOPT_DATA_MsecLenPMin,
JLOPT_DATA_MsecLenPMax,
JLOPT_DATA_MsecLenNMin,
JLOPT_DATA_MsecLenNMax,
JLOPT_DATA_MsecFromAbs,
JLOPT_DATA_MsecFromHead,
JLOPT_DATA_MsecFromTail,
JLOPT_DATA_MsecLogoExtL,
JLOPT_DATA_MsecLogoExtR,
JLOPT_DATA_MsecEndAbs,
JLOPT_DATA_AutopCode,
JLOPT_DATA_AutopLimit,
JLOPT_DATA_AutopScope,
JLOPT_DATA_AutopScopeN,
JLOPT_DATA_AutopScopeX,
JLOPT_DATA_AutopPeriod,
JLOPT_DATA_AutopMaxPrd,
JLOPT_DATA_AutopSecNext,
JLOPT_DATA_AutopSecPrev,
JLOPT_DATA_AutopTrScope,
JLOPT_DATA_AutopTrSumPrd,
JLOPT_DATA_AutopTr1stPrd,
JLOPT_DATA_FlagWide,
JLOPT_DATA_FlagFromLast,
JLOPT_DATA_FlagWithP,
JLOPT_DATA_FlagWithN,
JLOPT_DATA_FlagNoEdge,
JLOPT_DATA_FlagOverlap,
JLOPT_DATA_FlagConfirm,
JLOPT_DATA_FlagUnit,
JLOPT_DATA_FlagElse,
JLOPT_DATA_FlagCont,
JLOPT_DATA_FlagReset,
JLOPT_DATA_FlagFlat,
JLOPT_DATA_FlagForce,
JLOPT_DATA_FlagNoForce,
JLOPT_DATA_FlagAutoChg,
JLOPT_DATA_FlagAutoEach,
JLOPT_DATA_FlagEndHead,
JLOPT_DATA_FlagEndTail,
JLOPT_DATA_FlagEndHold,
JLOPT_DATA_FlagRelative,
SIZE_JLOPT_DATA
};
enum JlOptionArgScType {
CMDARG_SC_NONE,
CMDARG_SC_SC,
CMDARG_SC_NOSC,
CMDARG_SC_SM,
CMDARG_SC_NOSM,
CMDARG_SC_SMA,
CMDARG_SC_NOSMA,
CMDARG_SC_AC,
CMDARG_SC_NOAC
};
enum JlOptionArgLgType {
CMDARG_LG_NONE,
CMDARG_LG_N,
CMDARG_LG_NR,
CMDARG_LG_NLOGO,
CMDARG_LG_NAUTO
};
enum JlOptionArgFrType {
CMDARG_FR_F,
CMDARG_FR_FR,
CMDARG_FR_FHEAD,
CMDARG_FR_FTAIL,
CMDARG_FR_FMID,
CMDARG_FR_FHEADX,
CMDARG_FR_FTAILX,
CMDARG_FR_FMIDX
};
//--- JLスクリプト命令サブ選択 ---
enum JlcmdSubType {
JLCMD_SUB_TR,
JLCMD_SUB_SP,
JLCMD_SUB_EC
};
//--- JLスクリプトデコード結果エラー ---
enum JlcmdErrType {
JLCMD_ERR_None,
JLCMD_ERR_ErrOpt, // コマンド異常(オプション)
JLCMD_ERR_ErrRange, // コマンド異常(範囲)
JLCMD_ERR_ErrSEB, // コマンド異常(S/E/B選択)
JLCMD_ERR_ErrVar, // コマンド異常(変数関連)
JLCMD_ERR_ErrTR, // コマンド異常(TR/SP/ED選択)
JLCMD_ERR_ErrCmd // コマンド異常(コマンド)
};
//--- JLスクリプトAuto系コマンド ---
enum JlcmdAutoType {
JLCMD_AUTO_None,
JLCMD_AUTO_CUTTR,
JLCMD_AUTO_CUTEC,
JLCMD_AUTO_ADDTR,
JLCMD_AUTO_ADDSP,
JLCMD_AUTO_ADDEC,
JLCMD_AUTO_EDGE,
JLCMD_AUTO_ATCM,
JLCMD_AUTO_ATUP,
JLCMD_AUTO_ATBORDER,
JLCMD_AUTO_ATCHG,
JLCMD_AUTO_INS,
JLCMD_AUTO_DEL
};
//--- Autoコマンドパラメータ ---
enum JlParamAuto {
// codeパラメータ
PARAM_AUTO_c_exe, // 0:コマンド実行なし 1:コマンド実行
PARAM_AUTO_c_search, // 検索する範囲を選択
PARAM_AUTO_c_wmin, // 構成期間の最小値秒数
PARAM_AUTO_c_wmax, // 構成期間の最大値秒数
PARAM_AUTO_c_w15, // 1:番組構成で15秒を検索
PARAM_AUTO_c_lgprev, // 0:ロゴ・予告の前側を対象外
PARAM_AUTO_c_lgpost, // 0:ロゴ・予告の後側を対象外
PARAM_AUTO_c_lgintr, // 1:予告と番組提供の間のみ対象とする
PARAM_AUTO_c_lgsp, // 1:番組提供が直後にある場合のみ対象
PARAM_AUTO_c_cutskip, // 1:予告カット以降も対象とする
PARAM_AUTO_c_in1, // 1:予告位置に番組提供を入れる
PARAM_AUTO_c_chklast, // 1:本体構成が後にあれば対象外とする
PARAM_AUTO_c_lgy, // 1:ロゴ内を対象とする
PARAM_AUTO_c_lgn, // 1:ロゴ外を対象とする
PARAM_AUTO_c_lgbn, // 1:両隣を含めロゴ外の場合を対象とする
PARAM_AUTO_c_limloc, // 1:標準期間の候補位置のみに限定
PARAM_AUTO_c_limtrsum, // 1:予告期間により無効化する
PARAM_AUTO_c_unitcmoff, // 1:CM分割した構成の検出を強制無効
PARAM_AUTO_c_unitcmon, // 1:CM分割した構成の検出を強制設定
PARAM_AUTO_c_wdefmin, // 標準の構成期間の最小値秒数
PARAM_AUTO_c_wdefmax, // 標準の構成期間の最大値秒数
// autocut用
PARAM_AUTO_c_from, // cuttr
PARAM_AUTO_c_cutst, // cuttr
PARAM_AUTO_c_lgpre, // cuttr
PARAM_AUTO_c_sel, // cutec
PARAM_AUTO_c_cutla, // cutec
PARAM_AUTO_c_cutlp, // cutec
PARAM_AUTO_c_cut30, // cutec
PARAM_AUTO_c_cutsp, // cutec
// edge用
PARAM_AUTO_c_cmpart,
PARAM_AUTO_c_add,
PARAM_AUTO_c_allcom,
PARAM_AUTO_c_noedge,
// autoins,autodel用
PARAM_AUTO_c_restruct,
// 数値パラメータ
PARAM_AUTO_v_limit,
PARAM_AUTO_v_scope,
PARAM_AUTO_v_scopen,
PARAM_AUTO_v_period,
PARAM_AUTO_v_maxprd,
PARAM_AUTO_v_trsumprd,
PARAM_AUTO_v_secprev,
PARAM_AUTO_v_secnext,
// autocut用
PARAM_AUTO_v_trscope,
PARAM_AUTO_v_tr1stprd,
// 合計数
SIZE_PARAM_AUTO
};
}
| [
"pianoyayaninth@yahoo.co.jp"
] | pianoyayaninth@yahoo.co.jp |
5e3792b41006478f325fae0110b0b163e715d3f1 | 7b5a4de17a163938bb067db18982282a6c76a774 | /code/file_io.cpp | b1aa311b76e6f69ff5c44cb295a5e213c0dbb10c | [
"MIT"
] | permissive | elvismd/tanksgame | aa4769b309a6c742b801ea65a7b2252e8122a2e4 | 8c2c9daa9963b9d5a5e16a8515bd4c3e7d231799 | refs/heads/master | 2021-10-23T13:22:43.694309 | 2019-03-17T21:27:09 | 2019-03-17T21:27:09 | 176,162,656 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,037 | cpp | #include "file_io.h"
#include "logger.h"
File_Result load_file(const char* file_name, Memory_Arena* arena)
{
File_Result result = {};
FILE* file;
file = fopen(file_name, "rb");
if(file == NULL)
{
log_warning("Unable to open file: %s", file_name);
return result;
}
fseek(file, 0, SEEK_END);
result.size = ftell(file);
fseek(file, 0, SEEK_SET);
if(arena != NULL)
result.contents = (char*)push_memory(arena, sizeof(char) * result.size + 1);
else
result.contents = (char*)malloc(sizeof(char) * result.size + 1);
memset(result.contents, 0, result.size + 1);
if(fread(result.contents, 1, result.size, file) != result.size)
log_warning("Unable to read file: %s", file_name);
fclose(file);
log_info("Loaded file: %s", file_name);
return result;
}
File_Result load_temp_file(const char* file_name)
{
return load_file(file_name, NULL);
}
Text_File_Handler get_text_file_handler(File_Result* file_result)
{
Text_File_Handler text_handler = {};
text_handler.at = file_result->contents;
text_handler.length = file_result->size;
// always consume the first word
consume_word(&text_handler);
return text_handler;
}
bool is_end_of_line(char c)
{
bool result =
((c == '\n') ||
(c == '\r'));
return result;
}
bool is_white_space(char c)
{
bool result =
((c == ' ') ||
(c == '\t') ||
(c == '\v') ||
(c == '\f') ||
is_end_of_line(c));
return result;
}
bool is_alpha(char c)
{
bool result = (((c >= 'a') && (c <= 'z')) ||
((c >= 'A') && (c <= 'Z')));
return result;
}
bool is_number(char c)
{
bool result = ((c >= '0') && (c <= '9'));
return result;
}
bool is_ascii(char c)
{
bool result = c < 127;
return result;
}
void eat_all_white_space(Text_File_Handler* text_file_handler)
{
for (;;)
{
if (is_white_space(text_file_handler->at[0]))
{
++text_file_handler->at;
}
else if ((text_file_handler->at[0] == '/') && (text_file_handler->at[1] == '/'))
{
text_file_handler->at += 2;
while (text_file_handler->at[0] && !is_end_of_line(text_file_handler->at[0]))
{
++text_file_handler->at;
}
}
else if ((text_file_handler->at[0] == '/') && (text_file_handler->at[1] == '*'))
{
text_file_handler->at += 2;
while (text_file_handler->at[0] &&
!((text_file_handler->at[0] == '*') &&
(text_file_handler->at[1] == '/')))
{
++text_file_handler->at;
}
if (text_file_handler->at[0] == '*')
{
text_file_handler->at += 2;
}
}
else
{
break;
}
}
}
b32 can_consume_lines(Text_File_Handler* text_file_handler)
{
return (*text_file_handler->at != NULL &&
(is_white_space(text_file_handler->at[0]) || is_alpha(text_file_handler->at[0]) || is_number(text_file_handler->at[0]))
);
}
void consume_line(Text_File_Handler* text_file_handler)
{
eat_all_white_space(text_file_handler);
if(*text_file_handler->at == NULL)
{
text_file_handler->line_length = 0;
return;
}
char* text = text_file_handler->at;
while(!is_end_of_line(text_file_handler->at[0]))
++text_file_handler->at;
text_file_handler->line_length = text_file_handler->at - text;
text_file_handler->line = text;
}
void consume_word(Text_File_Handler* text_file_handler)
{
eat_all_white_space(text_file_handler);
if(*text_file_handler->at == NULL)
{
text_file_handler->word_length = 0;
return;
}
char* text = text_file_handler->at;
while(!is_white_space(text_file_handler->at[0]))
++text_file_handler->at;
text_file_handler->word_length = text_file_handler->at - text;
text_file_handler->word = text;
}
bool word_is(Text_File_Handler* text_file_handler, const char* match)
{
char *at = (char*)match;
for (int i = 0; i < text_file_handler->word_length; ++i, ++at)
{
if ((*at == 0) || (text_file_handler->word[i] != *at))
{
return false;
}
}
bool result = (*at == 0);
return result;
}
| [
"elvis.leite.9@gmail.com"
] | elvis.leite.9@gmail.com |
bbf84a90a09f8b008857e168f74bf4647a7bed8b | f645c62e2fd01ce164964d0b8d7a7c44fec70260 | /src/ServerConfiguration.cpp | 9bc3594c23b9b55a0af6eb6b4c041df873beb6b0 | [
"BSD-3-Clause"
] | permissive | bercik/gear | 37d2df83e9cda1b6d1ccdabc10b0c9a1e77a07d1 | aa33d1e9abed727f822177599d43337bcc778b07 | refs/heads/master | 2020-05-30T01:30:28.980342 | 2010-02-22T16:03:22 | 2010-02-22T16:03:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,569 | cpp | /*
* Copyright (c) 2009, Piotr Korzuszek
* 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 <organization> 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.
*/
#include "ServerConfiguration.h"
#include "common.h"
/* Configuration file location */
const CL_String CONFIG_FILE = "config.xml";
class ServerConfigurationImpl
{
public:
/** Server port */
int m_port;
/** Level name */
CL_String m_level;
ServerConfigurationImpl() :
m_port(DEFAULT_PORT)
{
// try to load server configuration
load(CONFIG_FILE);
}
void load(const CL_String &p_configFile);
};
ServerConfiguration::ServerConfiguration() :
m_impl(new ServerConfigurationImpl())
{
// empty
}
ServerConfiguration::~ServerConfiguration()
{
// empty
}
void ServerConfigurationImpl::load(const CL_String &p_configFile)
{
try {
cl_log_event(LOG_DEBUG, "loading configuration from %1", p_configFile);
CL_File file(
p_configFile,
CL_File::open_existing,
CL_File::access_read
);
CL_DomDocument document(file);
CL_DomElement root = document.get_document_element();
if (root.named_item("server").is_null()) {
// no configuration at all
return;
}
CL_DomElement server = root.named_item("server").to_element();
m_level = server.select_string("level");
m_port = server.select_int("port");
if (m_level.length() == 0) {
cl_log_event(LOG_ERROR, "%1: level not set", CONFIG_FILE);
exit(1);
}
if (m_port <= 0 || m_port > 0xFFFF) {
cl_log_event(LOG_ERROR, "%1: invalid port value", CONFIG_FILE);
exit(1);
}
// // read all elements
// CL_DomNode cur = server.get_first_child();
// while (cur.is_element()) {
//
// if (cur.get_node_name() == "port") {
// m_port = CL_StringHelp::local8_to_int
// (cur.to_element().get_text()
// );
// cl_log_event(LOG_DEBUG, "Port set to %1", m_port);
// }
//
// cur = cur.get_next_sibling();
// }
} catch (CL_Exception e) {
cl_log_event(LOG_ERROR, e.message);
}
}
const CL_String &ServerConfiguration::getLevel() const
{
return m_impl->m_level;
}
int ServerConfiguration::getPort() const
{
return m_impl->m_port;
}
| [
"piotr.korzuszek@gmail.com"
] | piotr.korzuszek@gmail.com |
494195a6c0161a1ac8eb0bbebbbce989839cd65c | 9e60f1a170549690ea791b8d94636915880ef413 | /Input.cpp | 3dd002c524965d938bc01705834d911557598de1 | [] | no_license | EstevanBR/SFML-Engine-2019 | 383a4f498d3076e64b1c92efdc11323db73a6573 | 113df26dc3daf96035ac0571d169913bde32f340 | refs/heads/master | 2020-08-22T00:15:27.935786 | 2019-11-13T06:49:35 | 2019-11-13T06:49:35 | 216,278,691 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,879 | cpp | #include <iostream>
#include "Input.hpp"
#include "InputComponent.hpp"
Input::Input(sf::RenderWindow &window): _window(window) {
}
void Input::handlePress(bool &userInputState) {
if (userInputState == false) {
userInputState = true;
}
}
void Input::handleRelease(bool &userInputState) {
userInputState = false;
}
void Input::process(float delta) {
sf::Event event;
while(_window.pollEvent(event)) {
if (event.type == sf::Event::Closed or (event.type == sf::Event::KeyPressed and event.key.code == sf::Keyboard::Escape)) {
std::cout << "Goodbye!" << std::endl;
_window.close();
}
if (event.type == sf::Event::EventType::KeyPressed) {
auto code = event.key.code;
if (code == inputMap.up) handlePress(_userInput.up);
if (code == inputMap.left) handlePress(_userInput.left);
if (code == inputMap.down) handlePress(_userInput.down);
if (code == inputMap.right) handlePress(_userInput.right);
if (code == inputMap.a) handlePress(_userInput.a);
if (code == inputMap.b) handlePress(_userInput.b);
if (code == inputMap.start) handlePress(_userInput.start);
} else if (event.type == sf::Event::EventType::KeyReleased) {
auto code = event.key.code;
if (code == inputMap.up) handleRelease(_userInput.up);
if (code == inputMap.left) handleRelease(_userInput.left);
if (code == inputMap.down) handleRelease(_userInput.down);
if (code == inputMap.right) handleRelease(_userInput.right);
if (code == inputMap.a) handleRelease(_userInput.a);
if (code == inputMap.b) handleRelease(_userInput.b);
if (code == inputMap.start) handleRelease(_userInput.start);
}
}
}
| [
"estevan@bluerocket.us"
] | estevan@bluerocket.us |
c3b75f6cec7ae8f0172dc9855017946d7d64c9fd | 58b5ad99d0bca0af77ea01c37cf8d23602bf9a8c | /main_old.cpp | 2b46f64eda07065a3983e628ad7acbc2df6a9388 | [] | no_license | wgleiuni/STT2 | cb3a78200ee94b5034b04a4f8877df3ae6a8935e | 56da5c8b86c805b1a4f9bf0fa3e39f9d3f76ca50 | refs/heads/master | 2021-01-13T15:27:39.937406 | 2017-02-24T18:24:04 | 2017-02-24T18:24:04 | 80,164,773 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,911 | cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <limits.h>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
using namespace std;
class Mag {
public:
Mag();
void Read();
void go();
private:
void RK4_onestep();
void RK4_df(double,vector<double>&);
vector<double> _y,_ty,_k1,_k2,_k3,_k4,_b;
double _alpha,_mu,_kappa,_nu,_v,_f,_gammaB,_omega,_h,_t,_totT;
fstream ofile;
int _cnt=0,_numdt;
};
Mag::Mag() {
_y.resize(3);
_ty.resize(3);
_k1.resize(3);
_k2.resize(3);
_k3.resize(3);
_k4.resize(3);
_b.resize(3);
Read();
_omega=2*M_PI*_f/_gammaB;
cout << "omega = " << _omega << endl;
ofile.open("result.txt",fstream::out);
return;
}
void Mag::Read() {
ifstream infile("data.txt");
string line;
if (getline(infile,line)) {
istringstream iss(line);
iss>>_alpha;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_kappa;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_mu;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_nu;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_f;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_gammaB;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_v;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_h;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_totT;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_numdt;
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_b[0]>>_b[1]>>_b[2];
}
if (getline(infile,line)) {
istringstream iss(line);
iss>>_y[0]>>_y[1]>>_y[2];
}
cout << "alpha = " << _alpha << endl;
cout << "kappa = " << _kappa << endl;
cout << "mu = " << _mu << endl;
cout << "nu = " << _nu << endl;
cout << "f = " << _f << endl;
cout << "gammaB = " << _gammaB << endl;
cout << "v = " << _v << endl;
cout << "dt = " << _h << endl;
cout << "m0 = " << _y[0] << " " << _y[1] << " " << _y[2] << endl;
return;
}
void Mag::RK4_onestep() {
for (int i=0;i<3;i++) _ty[i]=_y[i];
RK4_df(_t,_k1);
for (int i=0;i<3;i++) _ty[i]=_y[i]+_h*_k1[i]/2.;
RK4_df(_t+_h/2.,_k2);
for (int i=0;i<3;i++) _ty[i]=_y[i]+_h*_k2[i]/2.;
RK4_df(_t+_h/2.,_k3);
for (int i=0;i<3;i++) _ty[i]=_y[i]+_h*_k3[i];
RK4_df(_t+_h,_k4);
for (int i=0;i<3;i++) _y[i]+=_h/6.*(_k1[i]+2.*_k2[i]+2.*_k3[i]+_k4[i]);
_t+=_h;
if (_cnt++%_numdt==0) ofile << _t << "\t" << _y[0] << "\t" << _y[1] << "\t" << _y[2] << endl;
return;
}
void Mag::RK4_df(double t,vector<double>& k) {
vector<double> b (3);
double v=_v*sin(_omega*t);
b[0]=(1.0-_mu*(_ty[0]*_b[0]+_ty[1]*_b[1]+_ty[2]*_b[2])-_nu*v)*_b[0];
b[1]=(1.0-_mu*(_ty[0]*_b[0]+_ty[1]*_b[1]+_ty[2]*_b[2])-_nu*v)*_b[1]+_kappa*_ty[1];
b[2]=(1.0-_mu*(_ty[0]*_b[0]+_ty[1]*_b[1]+_ty[2]*_b[2])-_nu*v)*_b[2];
double denom=1.+_alpha*_alpha;
k[0]=-(b[2]*_ty[1]+_alpha*b[1]*_ty[0]*_ty[1]-_alpha*b[0]*_ty[1]*_ty[1]-b[1]*_ty[2]+_alpha*b[2]*_ty[0]*_ty[2]-_alpha*b[0]*_ty[2]*_ty[2])/denom;
k[1]=-(-b[2]*_ty[0]+_alpha*b[0]*_ty[0]*_ty[1]-_alpha*b[1]*_ty[0]*_ty[0]+b[0]*_ty[2]+_alpha*b[2]*_ty[1]*_ty[2]-_alpha*b[1]*_ty[2]*_ty[2])/denom;
k[2]=-(b[1]*_ty[0]+_alpha*b[1]*_ty[1]*_ty[2]-_alpha*b[2]*_ty[0]*_ty[0]-b[0]*_ty[1]+_alpha*b[0]*_ty[0]*_ty[2]-_alpha*b[2]*_ty[1]*_ty[1])/denom;
return;
}
void Mag::go() {
double t=0.;
while (t<_totT) {
RK4_onestep();
t+=_h;
}
return;
}
int main(int argc, char *argv[])
{
Mag obj;
obj.go();
return 0;
}
| [
"quantum@chaos37.eas.asu.edu"
] | quantum@chaos37.eas.asu.edu |
90776814f6baa7924d09c36c4f45676a2a9b38c9 | 29c00da21fa59d3749549e8bc194c4d85aa99d89 | /base/callback_helpers.h | 32fb2384a5219135cee77417171fee4d55a54eda | [] | no_license | sgraham/gn | 579fc9ddcc321c5f21197578ada58d87d87615f5 | 07efe06a8facf30e3d8dd92dc6095ccd1e9158e8 | refs/heads/master | 2020-03-18T10:22:21.512014 | 2018-05-27T05:20:43 | 2018-05-27T05:20:43 | 134,608,660 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,280 | h | // Copyright (c) 2012 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.
// This defines helpful methods for dealing with Callbacks. Because Callbacks
// are implemented using templates, with a class per callback signature, adding
// methods to Callback<> itself is unattractive (lots of extra code gets
// generated). Instead, consider adding methods here.
#ifndef BASE_CALLBACK_HELPERS_H_
#define BASE_CALLBACK_HELPERS_H_
#include <utility>
#include "base/atomicops.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ptr_util.h"
namespace base {
// Prefer std::move() over ResetAndReturn().
template <typename CallbackType>
CallbackType ResetAndReturn(CallbackType* cb) {
CallbackType ret(std::move(*cb));
DCHECK(!*cb);
return ret;
}
namespace internal {
template <typename... Args>
class AdaptCallbackForRepeatingHelper final {
public:
explicit AdaptCallbackForRepeatingHelper(OnceCallback<void(Args...)> callback)
: callback_(std::move(callback)) {
DCHECK(callback_);
}
void Run(Args... args) {
if (subtle::NoBarrier_AtomicExchange(&has_run_, 1))
return;
DCHECK(callback_);
std::move(callback_).Run(std::forward<Args>(args)...);
}
private:
volatile subtle::Atomic32 has_run_ = 0;
base::OnceCallback<void(Args...)> callback_;
DISALLOW_COPY_AND_ASSIGN(AdaptCallbackForRepeatingHelper);
};
} // namespace internal
// Wraps the given OnceCallback into a RepeatingCallback that relays its
// invocation to the original OnceCallback on the first invocation. The
// following invocations are just ignored.
//
// Note that this deliberately subverts the Once/Repeating paradigm of Callbacks
// but helps ease the migration from old-style Callbacks. Avoid if possible; use
// if necessary for migration. TODO(tzik): Remove it. https://crbug.com/730593
template <typename... Args>
RepeatingCallback<void(Args...)> AdaptCallbackForRepeating(
OnceCallback<void(Args...)> callback) {
using Helper = internal::AdaptCallbackForRepeatingHelper<Args...>;
return base::BindRepeating(&Helper::Run,
std::make_unique<Helper>(std::move(callback)));
}
// ScopedClosureRunner is akin to std::unique_ptr<> for Closures. It ensures
// that the Closure is executed no matter how the current scope exits.
class ScopedClosureRunner {
public:
ScopedClosureRunner();
explicit ScopedClosureRunner(OnceClosure closure);
~ScopedClosureRunner();
ScopedClosureRunner(ScopedClosureRunner&& other);
// Releases the current closure if it's set and replaces it with the closure
// from |other|.
ScopedClosureRunner& operator=(ScopedClosureRunner&& other);
// Calls the current closure and resets it, so it wont be called again.
void RunAndReset();
// Replaces closure with the new one releasing the old one without calling it.
void ReplaceClosure(OnceClosure closure);
// Releases the Closure without calling.
OnceClosure Release() WARN_UNUSED_RESULT;
private:
OnceClosure closure_;
DISALLOW_COPY_AND_ASSIGN(ScopedClosureRunner);
};
} // namespace base
#endif // BASE_CALLBACK_HELPERS_H_
| [
"scottmg@chromium.org"
] | scottmg@chromium.org |
85e389cc3e775c461a19c1892f6bf34e57d88ec4 | b7d57e803e9990d3a782c730d3d3bdfa6f0c83c2 | /include/TGUI/Rect.hpp | ebb33dc177e397f2dcb4aab78e7ef91fabd075d1 | [
"Zlib"
] | permissive | texus/TGUI | f114ae502418599ddc8f26cd6ef0b29e12a314d3 | 3103f6e1279ae40b5a2fac2ef9125d56a97b41bd | refs/heads/1.x | 2023-09-05T21:26:16.767847 | 2023-09-03T18:10:03 | 2023-09-03T18:11:01 | 4,234,723 | 739 | 140 | Zlib | 2023-09-03T16:40:26 | 2012-05-05T15:38:22 | C++ | UTF-8 | C++ | false | false | 11,321 | hpp | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
// TGUI - Texus' Graphical User Interface
// Copyright (C) 2012-2023 Bruno Van de Velde (vdv_b@tgui.eu)
//
// This software is provided 'as-is', without any express or implied warranty.
// In no event will the authors be held liable for any damages arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it freely,
// subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented;
// you must not claim that you wrote the original software.
// If you use this software in a product, an acknowledgment
// in the product documentation would be appreciated but is not required.
//
// 2. Altered source versions must be plainly marked as such,
// and must not be misrepresented as being the original software.
//
// 3. This notice may not be removed or altered from any source distribution.
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef TGUI_RECT_HPP
#define TGUI_RECT_HPP
#include <TGUI/Vector2.hpp>
#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
#include <SFML/Graphics/Rect.hpp>
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TGUI_MODULE_EXPORT namespace tgui
{
template <typename T>
class Rect
{
public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Default constructor
///
/// Creates an empty rectangle (it is equivalent to calling Rect{0, 0, 0, 0}).
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constexpr Rect() = default;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Constructs the rectangle from an another Rect with a different type
///
/// @param rect Rectangle to copy
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename U>
explicit constexpr Rect(const Rect<U>& rect) :
left {static_cast<T>(rect.left)},
top {static_cast<T>(rect.top)},
width {static_cast<T>(rect.width)},
height{static_cast<T>(rect.height)}
{
}
#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Constructs the rectangle from an sf::Rect
///
/// @param rect Rectangle to initialize
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
explicit constexpr Rect(sf::Rect<T> rect) :
left {rect.left},
top {rect.top},
width {rect.width},
height{rect.height}
{
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Constructs the rectangle from its position and size
///
/// @param rectLeft Left coordinate of the rectangle
/// @param rectTop Top coordinate of the rectangle
/// @param rectWidth Width of the rectangle
/// @param rectHeight Height of the rectangle
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constexpr Rect(T rectLeft, T rectTop, T rectWidth, T rectHeight) :
left {rectLeft},
top {rectTop},
width {rectWidth},
height{rectHeight}
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Constructs the rectangle from its position and size
///
/// @param position Position of the top-left corner of the rectangle
/// @param size Size of the rectangle
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constexpr Rect(Vector2<T> position, Vector2<T> size) :
left {position.x},
top {position.y},
width {size.x},
height{size.y}
{
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Sets the position of the rectangle
///
/// @param position New position for the rectangle
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constexpr void setPosition(Vector2<T> position)
{
left = position.x;
top = position.y;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Returns the position of the rectangle
///
/// @return Rectangle position
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TGUI_NODISCARD constexpr Vector2<T> getPosition() const
{
return {left, top};
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Sets the size of the rectangle
///
/// @param size New size for the rectangle
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constexpr void setSize(Vector2<T> size)
{
width = size.x;
height = size.y;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Returns the size of the rectangle
///
/// @return Rectangle size
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TGUI_NODISCARD constexpr Vector2<T> getSize() const
{
return {width, height};
}
#if TGUI_HAS_RENDERER_BACKEND_SFML_GRAPHICS && !TGUI_DISABLE_SFML_CONVERSIONS
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Converts the Rect to an sf::Rect
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
explicit operator sf::Rect<T>() const
{
return sf::Rect<T>{left, top, width, height};
}
#endif
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Check if a point is inside the rectangle's area
///
/// This check is non-inclusive. If the point lies on the edge of the rectangle, this function will return false.
///
/// @param pos Coordinate to test
///
/// @return True if the point is inside, false otherwise
///
/// @warning This code assumes the width and height are positive.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TGUI_NODISCARD constexpr bool contains(const Vector2<T>& pos) const
{
return (pos.x >= left) && (pos.x < left + width) && (pos.y >= top) && (pos.y < top + height);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Check the intersection between two rectangles
///
/// @param rect Rectangle to test
///
/// @return True if rectangles overlap, false otherwise
///
/// @warning This code assumes the width and height of both rectangles are positive.
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TGUI_NODISCARD constexpr bool intersects(const Rect<T>& rect) const
{
// Compute the intersection boundaries
const T interLeft = std::max(left, rect.left);
const T interTop = std::max(top, rect.top);
const T interRight = std::min(left + width, rect.left + rect.width);
const T interBottom = std::min(top + height, rect.top + rect.height);
// If the intersection is valid (positive non zero area), then there is an intersection
return (interLeft < interRight) && (interTop < interBottom);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public:
T left = 0; //!< Left coordinate of the rectangle
T top = 0; //!< Top coordinate of the rectangle
T width = 0; //!< Width of the rectangle
T height = 0; //!< Height of the rectangle
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Checks if two Rect objects are equal
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
TGUI_NODISCARD constexpr bool operator==(const Rect<T>& left, const Rect<T>& right)
{
return (left.left == right.left) && (left.width == right.width)
&& (left.top == right.top) && (left.height == right.height);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// @brief Checks if two Rect objects are different
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template <typename T>
TGUI_NODISCARD constexpr bool operator!=(const Rect<T>& left, const Rect<T>& right)
{
return !(left == right);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using FloatRect = Rect<float>;
using IntRect = Rect<int>;
using UIntRect = Rect<unsigned int>;
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#endif // TGUI_RECT_HPP
| [
"vdv_b@tgui.eu"
] | vdv_b@tgui.eu |
c4cca3cb56a687634f90075867bb5708ed99fd3b | 24bc4990e9d0bef6a42a6f86dc783785b10dbd42 | /gpu/command_buffer/service/scheduler_dfs.cc | 0bc58f13e8aafea6883cb3433b0383c8cb8ec1fc | [
"BSD-3-Clause"
] | permissive | nwjs/chromium.src | 7736ce86a9a0b810449a3b80a4af15de9ef9115d | 454f26d09b2f6204c096b47f778705eab1e3ba46 | refs/heads/nw75 | 2023-08-31T08:01:39.796085 | 2023-04-19T17:25:53 | 2023-04-19T17:25:53 | 50,512,158 | 161 | 201 | BSD-3-Clause | 2023-05-08T03:19:09 | 2016-01-27T14:17:03 | null | UTF-8 | C++ | false | false | 29,270 | cc | // Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gpu/command_buffer/service/scheduler_dfs.h"
#include <algorithm>
#include <cstddef>
#include <vector>
#include "base/cpu_reduction_experiment.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/hash/md5_constexpr.h"
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/synchronization/lock.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/common/scheduling_priority.h"
#include "gpu/command_buffer/service/scheduler.h"
#include "gpu/command_buffer/service/sync_point_manager.h"
#include "gpu/config/gpu_preferences.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
namespace gpu {
namespace {
using Task = ::gpu::Scheduler::Task;
uint64_t GetTaskFlowId(uint32_t sequence_id, uint32_t order_num) {
// Xor with a mask to ensure that the flow id does not collide with non-gpu
// tasks.
static constexpr uint64_t kMask =
base::MD5Hash64Constexpr("gpu::SchedulerDfs");
return kMask ^ (sequence_id) ^ (static_cast<uint64_t>(order_num) << 32);
}
} // namespace
SchedulerDfs::SchedulingState::SchedulingState() = default;
SchedulerDfs::SchedulingState::SchedulingState(const SchedulingState& other) =
default;
SchedulerDfs::SchedulingState::~SchedulingState() = default;
void SchedulerDfs::SchedulingState::WriteIntoTrace(
perfetto::TracedValue context) const {
auto dict = std::move(context).WriteDictionary();
dict.Add("sequence_id", sequence_id.GetUnsafeValue());
dict.Add("priority", SchedulingPriorityToString(priority));
dict.Add("order_num", order_num);
}
bool SchedulerDfs::SchedulingState::operator==(
const SchedulerDfs::SchedulingState& rhs) const {
return std::tie(sequence_id, priority, order_num) ==
std::tie(rhs.sequence_id, rhs.priority, rhs.order_num);
}
SchedulerDfs::Sequence::Task::Task(base::OnceClosure closure,
uint32_t order_num,
ReportingCallback report_callback)
: closure(std::move(closure)),
order_num(order_num),
report_callback(std::move(report_callback)) {}
SchedulerDfs::Sequence::Task::Task(Task&& other) = default;
SchedulerDfs::Sequence::Task::~Task() {
DCHECK(report_callback.is_null());
}
SchedulerDfs::Sequence::Task& SchedulerDfs::Sequence::Task::operator=(
Task&& other) = default;
SchedulerDfs::Sequence::WaitFence::WaitFence(const SyncToken& sync_token,
uint32_t order_num,
SequenceId release_sequence_id)
: sync_token(sync_token),
order_num(order_num),
release_sequence_id(release_sequence_id) {}
SchedulerDfs::Sequence::WaitFence::WaitFence(WaitFence&& other) = default;
SchedulerDfs::Sequence::WaitFence::~WaitFence() = default;
SchedulerDfs::Sequence::WaitFence& SchedulerDfs::Sequence::WaitFence::operator=(
WaitFence&& other) = default;
SchedulerDfs::PerThreadState::PerThreadState() = default;
SchedulerDfs::PerThreadState::PerThreadState(PerThreadState&& other) = default;
SchedulerDfs::PerThreadState::~PerThreadState() = default;
SchedulerDfs::PerThreadState& SchedulerDfs::PerThreadState::operator=(
PerThreadState&& other) = default;
SchedulerDfs::Sequence::Sequence(
SchedulerDfs* scheduler,
SequenceId sequence_id,
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
SchedulingPriority priority,
scoped_refptr<SyncPointOrderData> order_data)
: scheduler_(scheduler),
sequence_id_(sequence_id),
task_runner_(std::move(task_runner)),
default_priority_(priority),
current_priority_(priority),
order_data_(std::move(order_data)) {}
SchedulerDfs::Sequence::~Sequence() {
for (auto& kv : wait_fences_) {
Sequence* release_sequence =
scheduler_->GetSequence(kv.first.release_sequence_id);
if (release_sequence) {
scheduler_->TryScheduleSequence(release_sequence);
}
}
order_data_->Destroy();
}
bool SchedulerDfs::Sequence::IsNextTaskUnblocked() const {
return !tasks_.empty() &&
(wait_fences_.empty() ||
wait_fences_.begin()->first.order_num > tasks_.front().order_num);
}
bool SchedulerDfs::Sequence::HasTasks() const {
return enabled_ && !tasks_.empty();
}
bool SchedulerDfs::Sequence::ShouldYieldTo(const Sequence* other) const {
if (task_runner() != other->task_runner())
return false;
if (!running())
return false;
return SchedulingState::RunsBefore(other->scheduling_state_,
scheduling_state_);
}
void SchedulerDfs::Sequence::SetEnabled(bool enabled) {
if (enabled_ == enabled)
return;
enabled_ = enabled;
if (enabled) {
TRACE_EVENT_NESTABLE_ASYNC_BEGIN1("gpu", "SequenceEnabled",
TRACE_ID_LOCAL(this), "sequence_id",
sequence_id_.GetUnsafeValue());
} else {
TRACE_EVENT_NESTABLE_ASYNC_END1("gpu", "SequenceEnabled",
TRACE_ID_LOCAL(this), "sequence_id",
sequence_id_.GetUnsafeValue());
}
scheduler_->TryScheduleSequence(this);
}
SchedulerDfs::SchedulingState SchedulerDfs::Sequence::SetScheduled() {
DCHECK(HasTasks());
DCHECK_NE(running_state_, RUNNING);
running_state_ = SCHEDULED;
scheduling_state_.sequence_id = sequence_id_;
scheduling_state_.priority = current_priority();
scheduling_state_.order_num = tasks_.front().order_num;
return scheduling_state_;
}
void SchedulerDfs::Sequence::UpdateRunningPriority() {
DCHECK_EQ(running_state_, RUNNING);
scheduling_state_.priority = current_priority();
}
void SchedulerDfs::Sequence::ContinueTask(base::OnceClosure closure) {
DCHECK_EQ(running_state_, RUNNING);
uint32_t order_num = order_data_->current_order_num();
tasks_.push_front({std::move(closure), order_num, ReportingCallback()});
order_data_->PauseProcessingOrderNumber(order_num);
}
uint32_t SchedulerDfs::Sequence::ScheduleTask(
base::OnceClosure closure,
ReportingCallback report_callback) {
uint32_t order_num = order_data_->GenerateUnprocessedOrderNumber();
TRACE_EVENT_WITH_FLOW0("gpu,toplevel.flow", "SchedulerDfs::ScheduleTask",
GetTaskFlowId(sequence_id_.value(), order_num),
TRACE_EVENT_FLAG_FLOW_OUT);
tasks_.push_back({std::move(closure), order_num, std::move(report_callback)});
return order_num;
}
base::TimeDelta SchedulerDfs::Sequence::FrontTaskWaitingDependencyDelta() {
DCHECK(!tasks_.empty());
if (tasks_.front().first_dependency_added.is_null()) {
// didn't wait for dependencies.
return base::TimeDelta();
}
return tasks_.front().running_ready - tasks_.front().first_dependency_added;
}
base::TimeDelta SchedulerDfs::Sequence::FrontTaskSchedulingDelay() {
DCHECK(!tasks_.empty());
return base::TimeTicks::Now() - tasks_.front().running_ready;
}
uint32_t SchedulerDfs::Sequence::BeginTask(base::OnceClosure* closure) {
DCHECK(closure);
DCHECK(!tasks_.empty());
DCHECK_EQ(running_state_, SCHEDULED);
DVLOG(10) << "Sequence " << sequence_id() << " is now running.";
running_state_ = RUNNING;
*closure = std::move(tasks_.front().closure);
uint32_t order_num = tasks_.front().order_num;
if (!tasks_.front().report_callback.is_null()) {
std::move(tasks_.front().report_callback).Run(tasks_.front().running_ready);
}
tasks_.pop_front();
return order_num;
}
void SchedulerDfs::Sequence::FinishTask() {
DCHECK_EQ(running_state_, RUNNING);
running_state_ = SCHEDULED;
DVLOG(10) << "Sequence " << sequence_id() << " is now ending.";
}
void SchedulerDfs::Sequence::SetLastTaskFirstDependencyTimeIfNeeded() {
DCHECK(!tasks_.empty());
if (tasks_.back().first_dependency_added.is_null()) {
// Fence are always added for the last task (which should always exists).
tasks_.back().first_dependency_added = base::TimeTicks::Now();
}
}
void SchedulerDfs::Sequence::AddWaitFence(const SyncToken& sync_token,
uint32_t order_num,
SequenceId release_sequence_id) {
auto it =
wait_fences_.find(WaitFence{sync_token, order_num, release_sequence_id});
if (it != wait_fences_.end())
return;
wait_fences_.emplace(
std::make_pair(WaitFence(sync_token, order_num, release_sequence_id),
default_priority_));
}
void SchedulerDfs::Sequence::RemoveWaitFence(const SyncToken& sync_token,
uint32_t order_num,
SequenceId release_sequence_id) {
DVLOG(10) << "Sequence " << sequence_id_.value()
<< " removing wait fence that was released by sequence "
<< release_sequence_id.value() << ".";
auto it =
wait_fences_.find(WaitFence{sync_token, order_num, release_sequence_id});
if (it != wait_fences_.end()) {
wait_fences_.erase(it);
for (auto& task : tasks_) {
if (order_num == task.order_num) {
// The fence applies to this task, bump the readiness timestamp
task.running_ready = base::TimeTicks::Now();
break;
} else if (order_num < task.order_num) {
// Updated all task related to this fence.
break;
}
}
Sequence* release_sequence = scheduler_->GetSequence(release_sequence_id);
if (release_sequence) {
// The release sequence's task runner could potentially need to be waken
// up now.
// TODO(elgarawany): Really? This doesn't make sense. The release sequence
// must have just been running because it released the fence!
scheduler_->TryScheduleSequence(release_sequence);
}
scheduler_->TryScheduleSequence(this);
}
}
SchedulerDfs::SchedulerDfs(SyncPointManager* sync_point_manager,
const GpuPreferences& gpu_preferences)
: sync_point_manager_(sync_point_manager),
blocked_time_collection_enabled_(
gpu_preferences.enable_gpu_blocked_time_metric) {
if (blocked_time_collection_enabled_ && !base::ThreadTicks::IsSupported())
DLOG(ERROR) << "GPU Blocked time collection is enabled but not supported.";
}
SchedulerDfs::~SchedulerDfs() {
base::AutoLock auto_lock(lock_);
// Sequences as well as tasks posted to the threads have "this" pointer of the
// SchedulerDfs. Hence adding DCHECKS to make sure sequences are
// finished/destroyed and none of the threads are running by the time
// scheduler is destroyed.
DCHECK(sequence_map_.empty());
for (const auto& per_thread_state : per_thread_state_map_)
DCHECK(!per_thread_state.second.running);
}
SequenceId SchedulerDfs::CreateSequence(
SchedulingPriority priority,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
base::AutoLock auto_lock(lock_);
scoped_refptr<SyncPointOrderData> order_data =
sync_point_manager_->CreateSyncPointOrderData();
SequenceId sequence_id = order_data->sequence_id();
auto sequence =
std::make_unique<Sequence>(this, sequence_id, std::move(task_runner),
priority, std::move(order_data));
sequence_map_.emplace(sequence_id, std::move(sequence));
return sequence_id;
}
SequenceId SchedulerDfs::CreateSequenceForTesting(SchedulingPriority priority) {
// This will create the sequence on the thread on which this method is called.
return CreateSequence(priority,
base::SingleThreadTaskRunner::GetCurrentDefault());
}
void SchedulerDfs::DestroySequence(SequenceId sequence_id) {
base::circular_deque<Sequence::Task> tasks_to_be_destroyed;
{
base::AutoLock auto_lock(lock_);
Sequence* sequence = GetSequence(sequence_id);
DCHECK(sequence);
tasks_to_be_destroyed = std::move(sequence->tasks_);
sequence_map_.erase(sequence_id);
}
}
SchedulerDfs::Sequence* SchedulerDfs::GetSequence(SequenceId sequence_id) {
lock_.AssertAcquired();
auto it = sequence_map_.find(sequence_id);
if (it != sequence_map_.end())
return it->second.get();
return nullptr;
}
void SchedulerDfs::EnableSequence(SequenceId sequence_id) {
base::AutoLock auto_lock(lock_);
Sequence* sequence = GetSequence(sequence_id);
DCHECK(sequence);
sequence->SetEnabled(true);
}
void SchedulerDfs::DisableSequence(SequenceId sequence_id) {
base::AutoLock auto_lock(lock_);
Sequence* sequence = GetSequence(sequence_id);
DCHECK(sequence);
sequence->SetEnabled(false);
}
SchedulingPriority SchedulerDfs::GetSequenceDefaultPriority(
SequenceId sequence_id) {
base::AutoLock auto_lock(lock_);
Sequence* sequence = GetSequence(sequence_id);
DCHECK(sequence);
return sequence->default_priority_;
}
void SchedulerDfs::SetSequencePriority(SequenceId sequence_id,
SchedulingPriority priority) {
base::AutoLock auto_lock(lock_);
Sequence* sequence = GetSequence(sequence_id);
DCHECK(sequence);
sequence->current_priority_ = priority;
}
void SchedulerDfs::ScheduleTask(Task task) {
base::AutoLock auto_lock(lock_);
ScheduleTaskHelper(std::move(task));
}
void SchedulerDfs::ScheduleTasks(std::vector<Task> tasks) {
base::AutoLock auto_lock(lock_);
for (auto& task : tasks)
ScheduleTaskHelper(std::move(task));
}
void SchedulerDfs::ScheduleTaskHelper(Task task) {
SequenceId sequence_id = task.sequence_id;
Sequence* sequence = GetSequence(sequence_id);
DCHECK(sequence);
auto* task_runner = sequence->task_runner();
uint32_t order_num = sequence->ScheduleTask(std::move(task.closure),
std::move(task.report_callback));
for (const SyncToken& sync_token : ReduceSyncTokens(task.sync_token_fences)) {
SequenceId release_sequence_id =
sync_point_manager_->GetSyncTokenReleaseSequenceId(sync_token);
// base::Unretained is safe here since all sequences and corresponding sync
// point callbacks will be released before the scheduler is destroyed (even
// though sync point manager itself outlives the scheduler briefly).
if (sync_point_manager_->WaitNonThreadSafe(
sync_token, sequence_id, order_num, task_runner,
base::BindOnce(&SchedulerDfs::SyncTokenFenceReleased,
base::Unretained(this), sync_token, order_num,
release_sequence_id, sequence_id))) {
sequence->AddWaitFence(sync_token, order_num, release_sequence_id);
sequence->SetLastTaskFirstDependencyTimeIfNeeded();
}
}
TryScheduleSequence(sequence);
}
void SchedulerDfs::ContinueTask(SequenceId sequence_id,
base::OnceClosure closure) {
base::AutoLock auto_lock(lock_);
Sequence* sequence = GetSequence(sequence_id);
DCHECK(sequence);
DCHECK(sequence->task_runner()->BelongsToCurrentThread());
sequence->ContinueTask(std::move(closure));
}
bool SchedulerDfs::ShouldYield(SequenceId sequence_id) {
base::AutoLock auto_lock(lock_);
Sequence* running_sequence = GetSequence(sequence_id);
DCHECK(running_sequence);
DCHECK(running_sequence->running());
DCHECK(running_sequence->task_runner()->BelongsToCurrentThread());
// Call FindNextTask to find the sequence that will run next. This can
// potentially return nullptr if the only dependency on this thread is a
// sequence tied to another thread.
// TODO(elgarawany): Remove ShouldYield entirely and make CommandBufferStub,
// the only user of ShouldYield, always pause, and leave the scheduling
// decision to the scheduler.
Sequence* next_sequence = FindNextTask();
if (next_sequence == nullptr)
return false;
return running_sequence->ShouldYieldTo(next_sequence);
}
base::TimeDelta SchedulerDfs::TakeTotalBlockingTime() {
if (!blocked_time_collection_enabled_ || !base::ThreadTicks::IsSupported())
return base::TimeDelta::Min();
base::AutoLock auto_lock(lock_);
base::TimeDelta result;
std::swap(result, total_blocked_time_);
return result;
}
base::SingleThreadTaskRunner* SchedulerDfs::GetTaskRunnerForTesting(
SequenceId sequence_id) {
base::AutoLock auto_lock(lock_);
return GetSequence(sequence_id)->task_runner();
}
void SchedulerDfs::SyncTokenFenceReleased(const SyncToken& sync_token,
uint32_t order_num,
SequenceId release_sequence_id,
SequenceId waiting_sequence_id) {
base::AutoLock auto_lock(lock_);
Sequence* sequence = GetSequence(waiting_sequence_id);
if (sequence)
sequence->RemoveWaitFence(sync_token, order_num, release_sequence_id);
}
void SchedulerDfs::TryScheduleSequence(Sequence* sequence) {
lock_.AssertAcquired();
auto* task_runner = sequence->task_runner();
auto& thread_state = per_thread_state_map_[task_runner];
DVLOG(10) << "Trying to schedule or wake up sequence "
<< sequence->sequence_id().value()
<< ". running: " << sequence->running() << ".";
if (sequence->running()) {
// Update priority of running sequence because of sync token releases.
DCHECK(thread_state.running);
sequence->UpdateRunningPriority();
} else {
// Insert into scheduling queue if sequence isn't already scheduled.
if (!sequence->scheduled() && sequence->HasTasks()) {
sequence->SetScheduled();
}
// Wake up RunNextTask if the sequence has work to do. (If the thread is not
// running, that means that all other sequences were either empty, or
// waiting for work to be done on another thread).
if (!thread_state.running && HasAnyUnblockedTasksOnRunner(task_runner)) {
TRACE_EVENT_NESTABLE_ASYNC_BEGIN0("gpu", "SchedulerDfs::Running",
TRACE_ID_LOCAL(this));
DVLOG(10) << "Waking up thread because there is work to do.";
thread_state.running = true;
thread_state.run_next_task_scheduled = base::TimeTicks::Now();
task_runner->PostTask(
FROM_HERE,
base::BindOnce(&SchedulerDfs::RunNextTask, base::Unretained(this)));
}
}
}
const std::vector<SchedulerDfs::SchedulingState>&
SchedulerDfs::GetSortedRunnableSequences(
base::SingleThreadTaskRunner* task_runner) {
auto& thread_state = per_thread_state_map_[task_runner];
std::vector<SchedulingState>& sorted_sequences =
thread_state.sorted_sequences;
sorted_sequences.clear();
for (const auto& kv : sequence_map_) {
Sequence* sequence = kv.second.get();
// Add any sequence that is enabled, not already running, and has any tasks.
if (sequence->IsRunnable()) {
SchedulingState scheduling_state = sequence->SetScheduled();
sorted_sequences.push_back(scheduling_state);
}
}
// Sort the sequence. We never have more than a few handful of sequences - so
// this is pretty cheap to do.
std::stable_sort(sorted_sequences.begin(), sorted_sequences.end(),
&SchedulingState::RunsBefore);
return sorted_sequences;
}
bool SchedulerDfs::HasAnyUnblockedTasksOnRunner(
const base::SingleThreadTaskRunner* task_runner) const {
// Loop over all sequences and check if any of them are unblocked and belong
// to |task_runner|.
for (const auto& [_, sequence] : sequence_map_) {
if (sequence->task_runner() == task_runner && sequence->enabled() &&
sequence->IsNextTaskUnblocked()) {
return true;
}
}
// Either we don't have any enabled sequences, or they are all blocked (this
// can happen if DrDC is enabled).
return false;
}
SchedulerDfs::Sequence* SchedulerDfs::FindNextTaskFromRoot(
Sequence* root_sequence) {
if (!root_sequence)
return nullptr;
VLOG_IF(10, !root_sequence->enabled())
<< "Sequence " << root_sequence->sequence_id() << " is not enabled!";
DVLOG_IF(10, !root_sequence->HasTasks())
<< "Sequence " << root_sequence->sequence_id()
<< " does not have any tasks!";
// Don't bother looking at disabled sequence, sequences that don't have tasks,
// and (leaf) sequences that are already running. We don't look at running
// sequences because their order number is updated *before* they finish, which
// can make dependencies appear circular.
if (!root_sequence->IsRunnable()) {
return nullptr;
}
// First, recurse into any dependency that needs to run before the first
// task in |root_sequence|. The dependencies are sorted by their order num
// (because of WaitFence ordering).
const uint32_t first_task_order_num = root_sequence->tasks_.front().order_num;
DVLOG(10) << "Sequence " << root_sequence->sequence_id()
<< " (order_num: " << first_task_order_num << ") has "
<< root_sequence->wait_fences_.size() << " waits.";
for (auto fence_iter = root_sequence->wait_fences_.begin();
fence_iter != root_sequence->wait_fences_.end() &&
fence_iter->first.order_num <= first_task_order_num;
++fence_iter) {
// Recurse into the dependent sequence. If a subtask was found, then
// we're done.
DVLOG(10) << "Recursing into dependency in sequence "
<< fence_iter->first.release_sequence_id
<< " (order_num: " << fence_iter->first.order_num << ").";
Sequence* release_sequence =
GetSequence(fence_iter->first.release_sequence_id);
// ShouldYield might be calling this function, and a dependency might depend
// on the calling sequence, which might have not released its fences yet.
if (release_sequence && release_sequence->HasTasks() &&
release_sequence->tasks_.front().order_num >=
fence_iter->first.order_num) {
continue;
}
if (Sequence* result = FindNextTaskFromRoot(release_sequence);
result != nullptr) {
return result;
}
}
// It's possible that none of root_sequence's dependencies can be run
// because they are tied to another thread.
const bool are_dependencies_done =
root_sequence->wait_fences_.empty() ||
root_sequence->wait_fences_.begin()->first.order_num >
first_task_order_num;
// Return |root_sequence| only if its dependencies are done, and if it can
// run on the current thread.
DVLOG_IF(10, root_sequence->task_runner() !=
base::SingleThreadTaskRunner::GetCurrentDefault().get())
<< "Will not run sequence because it does not belong to this thread.";
if (are_dependencies_done &&
root_sequence->task_runner() ==
base::SingleThreadTaskRunner::GetCurrentDefault().get()) {
return root_sequence;
} else {
DVLOG_IF(10, !are_dependencies_done)
<< "Sequence " << root_sequence->sequence_id()
<< "'s dependencies are not yet done.";
return nullptr;
}
}
SchedulerDfs::Sequence* SchedulerDfs::FindNextTask() {
auto* task_runner = base::SingleThreadTaskRunner::GetCurrentDefault().get();
auto& sorted_sequences = GetSortedRunnableSequences(task_runner);
// Walk the scheduling queue starting with the highest priority sequence and
// find the first sequence that can be run. The loop will iterate more than
// once only if DrDC is enabled and the first sequence contains a single
// dependency tied to another thread.
for (const SchedulingState& state : sorted_sequences) {
Sequence* root_sequence = GetSequence(state.sequence_id);
DVLOG(10) << "FindNextTask: Calling FindNextTaskFromRoot on sequence "
<< root_sequence->sequence_id().value();
if (Sequence* sequence = FindNextTaskFromRoot(root_sequence);
sequence != nullptr) {
return sequence;
}
}
return nullptr;
}
// See comments in scheduler.h for a high-level overview of the algorithm.
void SchedulerDfs::RunNextTask() {
SequenceId sequence_id;
DCHECK(sequence_id.is_null());
{
base::AutoLock auto_lock(lock_);
auto* task_runner = base::SingleThreadTaskRunner::GetCurrentDefault().get();
auto* thread_state = &per_thread_state_map_[task_runner];
DVLOG(10) << "RunNextTask: Task runner is " << (uint64_t)task_runner;
// Walk the job graph starting from the highest priority roots to find a
// task to run.
Sequence* sequence = FindNextTask();
if (sequence == nullptr) {
// If there is no sequence to run, it should mean that there are no
// runnable sequences.
// TODO(elgarawany): We shouldn't have run RunNextTask if there were no
// runnable sequences. Change logic to check for that too (that changes
// old behavior - so leaving for now).
DCHECK(GetSortedRunnableSequences(task_runner).empty())
<< "RunNextTask should not have been called "
"if it did not have any unblocked tasks.";
TRACE_EVENT_NESTABLE_ASYNC_END0("gpu", "SchedulerDfs::Running",
TRACE_ID_LOCAL(this));
DVLOG(10) << "Empty scheduling queue. Sleeping.";
thread_state->running = false;
return;
}
DCHECK(sequence->task_runner() == task_runner)
<< "FindNextTaskFromRoot returned sequence that does not belong to "
"this thread.";
sequence_id = sequence->sequence_id();
}
// Now, execute the sequence's task.
ExecuteSequence(sequence_id);
// Finally, reschedule RunNextTask if there is any potential remaining work.
{
base::AutoLock auto_lock(lock_);
auto* task_runner = base::SingleThreadTaskRunner::GetCurrentDefault().get();
auto* thread_state = &per_thread_state_map_[task_runner];
if (!HasAnyUnblockedTasksOnRunner(task_runner)) {
TRACE_EVENT_NESTABLE_ASYNC_END0("gpu", "SchedulerDfs::Running",
TRACE_ID_LOCAL(this));
DVLOG(10) << "Thread has no runnable sequences. Sleeping.";
thread_state->running = false;
return;
}
thread_state->run_next_task_scheduled = base::TimeTicks::Now();
task_runner->PostTask(FROM_HERE, base::BindOnce(&SchedulerDfs::RunNextTask,
base::Unretained(this)));
}
}
void SchedulerDfs::ExecuteSequence(const SequenceId sequence_id) {
base::AutoLock auto_lock(lock_);
auto* task_runner = base::SingleThreadTaskRunner::GetCurrentDefault().get();
auto* thread_state = &per_thread_state_map_[task_runner];
const bool log_histograms =
base::ShouldLogHistogramForCpuReductionExperiment();
if (log_histograms) {
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"GPU.SchedulerDfs.ThreadSuspendedTime",
base::TimeTicks::Now() - thread_state->run_next_task_scheduled,
base::Microseconds(10), base::Seconds(30), 100);
}
Sequence* sequence = GetSequence(sequence_id);
DCHECK(sequence);
DCHECK(sequence->HasTasks());
DCHECK_EQ(sequence->task_runner(), task_runner);
DVLOG(10) << "Executing sequence " << sequence_id.value() << ".";
if (log_histograms) {
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"GPU.SchedulerDfs.TaskDependencyTime",
sequence->FrontTaskWaitingDependencyDelta(), base::Microseconds(10),
base::Seconds(30), 100);
UMA_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(
"GPU.SchedulerDfs.TaskSchedulingDelayTime",
sequence->FrontTaskSchedulingDelay(), base::Microseconds(10),
base::Seconds(30), 100);
}
base::OnceClosure closure;
uint32_t order_num = sequence->BeginTask(&closure);
TRACE_EVENT_WITH_FLOW0("gpu,toplevel.flow", "SchedulerDfs::RunNextTask",
GetTaskFlowId(sequence_id.value(), order_num),
TRACE_EVENT_FLAG_FLOW_IN);
// Begin/FinishProcessingOrderNumber must be called with the lock released
// because they can renter the scheduler in Enable/DisableSequence.
scoped_refptr<SyncPointOrderData> order_data = sequence->order_data();
// Unset pointers before releasing the lock to prevent accidental data race.
thread_state = nullptr;
sequence = nullptr;
base::TimeDelta blocked_time;
{
base::AutoUnlock auto_unlock(lock_);
order_data->BeginProcessingOrderNumber(order_num);
if (blocked_time_collection_enabled_ && base::ThreadTicks::IsSupported()) {
// We can't call base::ThreadTicks::Now() if it's not supported
base::ThreadTicks thread_time_start = base::ThreadTicks::Now();
base::TimeTicks wall_time_start = base::TimeTicks::Now();
std::move(closure).Run();
base::TimeDelta thread_time_elapsed =
base::ThreadTicks::Now() - thread_time_start;
base::TimeDelta wall_time_elapsed =
base::TimeTicks::Now() - wall_time_start;
blocked_time += (wall_time_elapsed - thread_time_elapsed);
} else {
std::move(closure).Run();
}
if (order_data->IsProcessingOrderNumber())
order_data->FinishProcessingOrderNumber(order_num);
}
total_blocked_time_ += blocked_time;
// Reset pointers after reaquiring the lock.
sequence = GetSequence(sequence_id);
if (sequence) {
sequence->FinishTask();
}
}
} // namespace gpu
| [
"roger@nwjs.io"
] | roger@nwjs.io |
aef4eb04eb8388bafbf64b6b8e4eb5b9c3d19a65 | 702229825d97d28b79c2719e4edc5270a2b54631 | /android/diploid_android/Diploid_Android/Diploid_Android/Diploid_Android.NativeActivity/Engine/header/ver2.0/Main/Collision.h | 127f00bc56895c9a7581693d73d83b6005f9f1ea | [] | no_license | Keioh/DXLib | fb10edf15468e6b9094e849a872f6f58d7903eb8 | b469010bc02b58cfcdcb334fecc28a892ba9579f | refs/heads/master | 2023-02-08T01:57:27.842954 | 2023-01-26T10:59:58 | 2023-01-26T10:59:58 | 91,177,788 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,731 | h | #pragma once
#include <list>
#include "DxLib.h"
#include "ver2.0/Graphics/DiploidCircleV2.h"
#include "ver2.0/Graphics/DiploidBoxV2.h"
using namespace std;
class DiploidCollision
{
private:
int upadata_count;//���X�V���邩�̃J�E���g(��ʊO�ȂǁA�p�ɂɔ����������Ȃ��ꏊ�Ōv�Z����炷���߂̕ϐ�)
int window_size_x = 1080, window_size_y = 1920;
protected:
public:
bool CircleAndCircleCollisionUpdate(DiploidCircleV2* circle_one, DiploidCircleV2* circle_two, int updata_rate = 0);//�~�Ɖ~�̓����蔻�����s���܂��B(�߂�l�͓�̉~���q�b�g���Ă�����true��Ԃ��܂��B)
VECTOR CircleAndCircleCollisionPointsUpdate(DiploidCircleV2* circle_one, DiploidCircleV2* circle_two, int updata_rate = 0);//�~�Ɖ~�����������u�Ԃ̈ʒu�܂��B(�߂�l�͓��������ꏊ�̈ʒu��Ԃ��܂��Bz�ɂ͔��a�������Ă��܂��B)
bool BoxAndMouseCollisionUpdate(DiploidBoxV2* box, int mouse_x, int mouse_y, int updata_rate = 0);//�l�p�ƃ}�E�X�̓����蔻�����s���܂��B(�߂�l�̓}�E�X�Ǝl�p���q�b�g���Ă�����true��Ԃ��܂��B)
bool BoxAndTouchCollisionUpdate(DiploidBoxV2* box, int touch_x, int touch_y, int updata_rate = 0);//�l�p�ƃ^�b�`�̓����蔻�����s���܂��B(�߂�l�̓^�b�`�Ǝl�p���q�b�g���Ă�����true��Ԃ��܂��B)
int GetUpdateCounter();//�X�V�p�x�𐔂���J�E���^�[��擾���܂��B
}; | [
"kou2013kou.kou@gmail.com"
] | kou2013kou.kou@gmail.com |
f7cdb2f6be3fc17818759e69cf7695dcc9ab1bbf | 03c2feadd7504b465c6672813ee28e9fee5f6a99 | /ScopeOfFunction.cpp | 14c1d2f71369167975d159ca3c6446a9b1c2a242 | [] | no_license | BSE2021/ScopeOfFunction | 32ccc1e6779c1a8f3a833e6b72361a3d72e5852f | b16ee482f306438946e88663f77d348d465806c3 | refs/heads/main | 2023-04-23T01:18:17.403866 | 2021-05-06T05:16:03 | 2021-05-06T05:16:03 | 364,792,657 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 294 | cpp | #include <iostream>
#include <cstring>
using namespace std;
void greet_someone(string greeting) {
//string greeting = "from someone function";
cout << greeting; //local scope
}
int main() {
string greeting = "from main function";
greet_someone(greeting);
cout << "\n" <<greeting;
}
| [
"beula.samuel@yoobeecolleges.com"
] | beula.samuel@yoobeecolleges.com |
8fad6de81127d9b2019bf40b67821c869c914e93 | 711e5c8b643dd2a93fbcbada982d7ad489fb0169 | /XPSP1/NT/inetsrv/iis/svcs/smtp/aqueue/cat/ldapstor/icatitemattr.cpp | 31590fc3e04885359354d4f6804e6ef1b51562ea | [] | no_license | aurantst/windows-XP-SP1 | 629a7763c082fd04d3b881e0d32a1cfbd523b5ce | d521b6360fcff4294ae6c5651c539f1b9a6cbb49 | refs/heads/master | 2023-03-21T01:08:39.870106 | 2020-09-28T08:10:11 | 2020-09-28T08:10:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 27,343 | cpp | //+------------------------------------------------------------
//
// Copyright (C) 1998, Microsoft Corporation
//
// File: icatitemattr.cpp
//
// Contents: Implementation of CICategorizerItemAttributesIMP
//
// Classes:
// CLdapResultWrap
// CICategorizerItemAttributesIMP
//
// Functions:
//
// History:
// jstamerj 1998/07/01 13:48:15: Created.
//
//-------------------------------------------------------------
#include "precomp.h"
#include "icatitemattr.h"
//+------------------------------------------------------------
//
// Function: CLdapResultWrap::CLdapResultWrap
//
// Synopsis: Refcount an LDAP Message, call ldap_msg_free when all
// references have been released
//
// Arguments:
// pCPLDAPWrap: PLDAP to refcount
// pMessage: the LDAPMessage to refcount
//
// Returns: NOTHING
//
// History:
// jstamerj 1998/10/05 13:12:15: Created.
//
//-------------------------------------------------------------
CLdapResultWrap::CLdapResultWrap(
CPLDAPWrap *pCPLDAPWrap,
PLDAPMessage pMessage)
{
_ASSERT(pCPLDAPWrap);
_ASSERT(pMessage);
m_pCPLDAPWrap = pCPLDAPWrap;
m_pCPLDAPWrap->AddRef();
m_pLDAPMessage = pMessage;
m_lRefCount = 0;
}
//+------------------------------------------------------------
//
// Function: CLdapResultWrap::AddRef
//
// Synopsis: Increment the ref count of this object
//
// Arguments: NONE
//
// Returns: new refcount
//
// History:
// jstamerj 1998/10/05 13:14:59: Created.
//
//-------------------------------------------------------------
LONG CLdapResultWrap::AddRef()
{
return InterlockedIncrement(&m_lRefCount);
}
//+------------------------------------------------------------
//
// Function: CLdapResultWrap::Release
//
// Synopsis: Decrement the ref count. Free the object when the
// refcount hits zero
//
// Arguments: NONE
//
// Returns: New refcount
//
// History:
// jstamerj 1998/10/05 13:26:47: Created.
//
//-------------------------------------------------------------
LONG CLdapResultWrap::Release()
{
LONG lNewRefCount;
lNewRefCount = InterlockedDecrement(&m_lRefCount);
if(lNewRefCount == 0) {
//
// Release this ldapmessage
//
delete this;
return 0;
} else {
return lNewRefCount;
}
}
//+------------------------------------------------------------
//
// Function: CLdapResultWrap::~CLdapResultWrap
//
// Synopsis: Release the ldap message result
//
// Arguments: NONE
//
// Returns: NOTHING
//
// History:
// jstamerj 1998/10/05 13:31:39: Created.
//
//-------------------------------------------------------------
CLdapResultWrap::~CLdapResultWrap()
{
m_pCPLDAPWrap->Release();
ldap_msgfree(m_pLDAPMessage);
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::CICategorizerItemAttributesIMP
//
// Synopsis: Initializes member data
//
// Arguments:
// pldap: PLDAP to use
// pldapmessage: PLDAPMessage to serve out
//
// Returns: NOTHING
//
// History:
// jstamerj 1998/07/02 12:35:15: Created.
//
//-------------------------------------------------------------
CICategorizerItemAttributesIMP::CICategorizerItemAttributesIMP(
PLDAP pldap,
PLDAPMessage pldapmessage,
CLdapResultWrap *pResultWrap)
{
m_dwSignature = CICATEGORIZERITEMATTRIBUTESIMP_SIGNATURE;
_ASSERT(pldap);
_ASSERT(pldapmessage);
_ASSERT(pResultWrap);
m_pldap = pldap;
m_pldapmessage = pldapmessage;
m_cRef = 0;
m_pResultWrap = pResultWrap;
m_pResultWrap->AddRef();
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::~CICategorizerItemAttributesIMP
//
// Synopsis: Checks to make sure signature is valid and then resets signature
//
// Arguments: NONE
//
// Returns: NOTHING
//
// History:
// jstamerj 1998/07/02 12:39:45: Created.
//
//-------------------------------------------------------------
CICategorizerItemAttributesIMP::~CICategorizerItemAttributesIMP()
{
m_pResultWrap->Release();
_ASSERT(m_dwSignature == CICATEGORIZERITEMATTRIBUTESIMP_SIGNATURE);
m_dwSignature = CICATEGORIZERITEMATTRIBUTESIMP_SIGNATURE_INVALID;
}
//+------------------------------------------------------------
//
// Function: QueryInterface
//
// Synopsis: Returns pointer to this object for IUnknown and ICategorizerItemAttributes
//
// Arguments:
// iid -- interface ID
// ppv -- pvoid* to fill in with pointer to interface
//
// Returns:
// S_OK: Success
// E_NOINTERFACE: Don't support that interface
//
// History:
// jstamerj 980612 14:07:57: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::QueryInterface(
REFIID iid,
LPVOID *ppv)
{
*ppv = NULL;
if(iid == IID_IUnknown) {
*ppv = (LPVOID) this;
} else if (iid == IID_ICategorizerItemAttributes) {
*ppv = (LPVOID) ((ICategorizerItemAttributes *) this);
} else if (iid == IID_ICategorizerItemRawAttributes) {
*ppv = (LPVOID) ((ICategorizerItemRawAttributes *) this);
} else if (iid == IID_ICategorizerUTF8Attributes) {
*ppv = (LPVOID) ((ICategorizerUTF8Attributes *) this);
} else {
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
//+------------------------------------------------------------
//
// Function: AddRef
//
// Synopsis: adds a reference to this object
//
// Arguments: NONE
//
// Returns: New reference count
//
// History:
// jstamerj 980611 20:07:14: Created.
//
//-------------------------------------------------------------
ULONG CICategorizerItemAttributesIMP::AddRef()
{
return InterlockedIncrement((PLONG)&m_cRef);
}
//+------------------------------------------------------------
//
// Function: Release
//
// Synopsis: releases a reference, deletes this object when the
// refcount hits zero.
//
// Arguments: NONE
//
// Returns: New reference count
//
// History:
// jstamerj 980611 20:07:33: Created.
//
//-------------------------------------------------------------
ULONG CICategorizerItemAttributesIMP::Release()
{
LONG lNewRefCount;
lNewRefCount = InterlockedDecrement((PLONG)&m_cRef);
if(lNewRefCount == 0) {
delete this;
return 0;
} else {
return lNewRefCount;
}
}
//+------------------------------------------------------------
//
// Function: BeginAttributeEnumeration
//
// Synopsis: Prepare to enumerate through attribute values for a specific attribute
//
// Arguments:
// pszAttributeName: Name of attribute to enumerate through
// penumerator: Uninitialized Enumerator structure to use
//
// Returns:
// S_OK: Success
// CAT_E_PROPNOTFOUND: No attributes values exist
//
// History:
// jstamerj 1998/07/02 10:54:00: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::BeginAttributeEnumeration(
IN LPCSTR pszAttributeName,
IN PATTRIBUTE_ENUMERATOR penumerator)
{
TraceFunctEnterEx((LPARAM)this, "CICategorizerItemAttributesIMP::BeginAttributeEnumeration");
_ASSERT(pszAttributeName);
_ASSERT(penumerator);
penumerator->pvBase =
penumerator->pvCurrent = ldap_get_values(
m_pldap,
m_pldapmessage,
(LPSTR)pszAttributeName);
if(penumerator->pvBase == NULL) {
ErrorTrace((LPARAM)this, "Requested attribute %s not found", pszAttributeName);
TraceFunctLeaveEx((LPARAM)this);
return CAT_E_PROPNOTFOUND;
}
TraceFunctLeaveEx((LPARAM)this);
return S_OK;
}
//+------------------------------------------------------------
//
// Function: GetNextAttributeValue
//
// Synopsis: Get the next attribute in an enumeration
//
// Arguments:
// penumerator: enumerator sturcture initialized in BeginAttributeEnumeration
// ppszAttributeValue: Ptr to Ptr to recieve Ptr to string of attribute value
//
// Returns:
// S_OK: Success
// HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)
//
// History:
// jstamerj 1998/07/02 11:14:54: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::GetNextAttributeValue(
IN PATTRIBUTE_ENUMERATOR penumerator,
OUT LPSTR *ppszAttributeValue)
{
_ASSERT(penumerator);
_ASSERT(ppszAttributeValue);
*ppszAttributeValue = *((LPSTR *)penumerator->pvCurrent);
if(*ppszAttributeValue) {
//
// Advance enumerator to next value
//
penumerator->pvCurrent = (PVOID) (((LPSTR *)penumerator->pvCurrent)+1);
return S_OK;
} else {
//
// This is the last value
//
return HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS);
}
}
//+------------------------------------------------------------
//
// Function: RewindAttributeEnumeration
//
// Synopsis: Rewind enumerator to beginning of attribute value list
//
// Arguments:
// penumerator: attribute enumerator initialized by BeginAttributeEnumeration
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/07/06 11:22:23: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::RewindAttributeEnumeration(
IN PATTRIBUTE_ENUMERATOR penumerator)
{
penumerator->pvCurrent = penumerator->pvBase;
return S_OK;
}
//+------------------------------------------------------------
//
// Function: EndAttributeEnumeration
//
// Synopsis: Free memory associated with an attribute enumeration
//
// Arguments:
// penumerator: attribute enumerator initialized by BeginAttributeEnumeration
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/07/02 12:24:44: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::EndAttributeEnumeration(
IN PATTRIBUTE_ENUMERATOR penumerator)
{
_ASSERT(penumerator);
ldap_value_free((LPSTR *)penumerator->pvBase);
return S_OK;
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::BeginAttributeNameEnumeration
//
// Synopsis: Enumerate through the attributes returned from LDAP
//
// Arguments:
// penumerator: Caller allocated enumerator structure to be
// initialized by this call
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/09/18 10:49:56: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::BeginAttributeNameEnumeration(
IN PATTRIBUTE_ENUMERATOR penumerator)
{
_ASSERT(penumerator);
penumerator->pvBase =
penumerator->pvCurrent = NULL;
return S_OK;
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::GetNextAttributeName
//
// Synopsis: enumerate through the attribute names returned
//
// Arguments:
// penumerator: enumerator strucutre initialized in BeginAttributeNameEnumeration
// ppszAttributeValue: out parameter for an attribute name
//
// Returns:
// S_OK: Success
// HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)
//
// History:
// jstamerj 1998/09/18 10:53:15: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::GetNextAttributeName(
IN PATTRIBUTE_ENUMERATOR penumerator,
OUT LPSTR *ppszAttributeName)
{
_ASSERT(penumerator);
_ASSERT(ppszAttributeName);
if(penumerator->pvCurrent == NULL) {
*ppszAttributeName = ldap_first_attribute(
m_pldap,
m_pldapmessage,
(BerElement **) &(penumerator->pvCurrent));
} else {
*ppszAttributeName = ldap_next_attribute(
m_pldap,
m_pldapmessage,
(BerElement *) (penumerator->pvCurrent));
}
if(*ppszAttributeName == NULL) {
//
// Assume we've reached the end of the attribute name
// enumeration
//
return HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS);
} else {
return S_OK;
}
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributeIMP::EndAttributeNameEnumeration
//
// Synopsis: Free all data held for this enumeration
//
// Arguments:
// penumerator: enumerator strucutre initialized in BeginAttributeNameEnumeration
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/09/18 11:04:37: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::EndAttributeNameEnumeration(
IN PATTRIBUTE_ENUMERATOR penumerator)
{
//
// Ldap uses only buffers in the connection block for this, so we
// don't need to explicitly free anything
//
return S_OK;
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::AggregateAttributes
//
// Synopsis: Normally, accept and ICategorizerItemAttributes for aggregation
//
// Arguments:
// pICatItemAttributes: attributes to aggregate
//
// Returns:
// E_NOTIMPL
//
// History:
// jstamerj 1998/07/16 14:42:16: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::AggregateAttributes(
IN ICategorizerItemAttributes *pICatItemAttributes)
{
return E_NOTIMPL;
}
//+------------------------------------------------------------
//
// Function: BeginRawAttributeEnumeration
//
// Synopsis: Prepare to enumerate through attribute values for a specific attribute
//
// Arguments:
// pszAttributeName: Name of attribute to enumerate through
// penumerator: Uninitialized Enumerator structure to use
//
// Returns:
// S_OK: Success
// CAT_E_PROPNOTFOUND: No attributes values exist
//
// History:
// jstamerj 1998/12/09 12:44:15: Created
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::BeginRawAttributeEnumeration(
IN LPCSTR pszAttributeName,
IN PATTRIBUTE_ENUMERATOR penumerator)
{
TraceFunctEnterEx((LPARAM)this, "CICategorizerItemAttributesIMP::BeginRawAttributeEnumeration");
_ASSERT(pszAttributeName);
_ASSERT(penumerator);
penumerator->pvBase =
penumerator->pvCurrent = ldap_get_values_len(
m_pldap,
m_pldapmessage,
(LPSTR)pszAttributeName);
if(penumerator->pvBase == NULL) {
ErrorTrace((LPARAM)this, "Requested attribute %s not found", pszAttributeName);
TraceFunctLeaveEx((LPARAM)this);
return CAT_E_PROPNOTFOUND;
}
TraceFunctLeaveEx((LPARAM)this);
return S_OK;
}
//+------------------------------------------------------------
//
// Function: GetNextRawAttributeValue
//
// Synopsis: Get the next attribute in an enumeration
//
// Arguments:
// penumerator: enumerator sturcture initialized in BeginAttributeEnumeration
// pdwcb: dword to set to the # of bytes in the pvValue buffer
// pvValue: Ptr to recieve Ptr to raw attribute value
//
// Returns:
// S_OK: Success
// HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)
//
// History:
// jstamerj 1998/12/09 12:49:27: Created
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::GetNextRawAttributeValue(
IN PATTRIBUTE_ENUMERATOR penumerator,
OUT PDWORD pdwcb,
OUT LPVOID *pvValue)
{
_ASSERT(penumerator);
_ASSERT(pdwcb);
_ASSERT(pvValue);
if( (*((PLDAP_BERVAL *)penumerator->pvCurrent)) != NULL) {
*pdwcb = (* ((PLDAP_BERVAL *)penumerator->pvCurrent))->bv_len;
*pvValue = (* ((PLDAP_BERVAL *)penumerator->pvCurrent))->bv_val;
//
// Advance enumerator to next value
//
penumerator->pvCurrent = (PVOID)
(((PLDAP_BERVAL *)penumerator->pvCurrent)+1);
return S_OK;
} else {
//
// This is the last value
//
*pdwcb = 0;
*pvValue = NULL;
return HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS);
}
}
//+------------------------------------------------------------
//
// Function: RewindRawAttributeEnumeration
//
// Synopsis: Rewind enumerator to beginning of attribute value list
//
// Arguments:
// penumerator: attribute enumerator initialized by BeginAttributeEnumeration
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/12/09 12:49:23: Created
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::RewindRawAttributeEnumeration(
IN PATTRIBUTE_ENUMERATOR penumerator)
{
return RewindAttributeEnumeration(penumerator);
}
//+------------------------------------------------------------
//
// Function: EndRawAttributeEnumeration
//
// Synopsis: Free memory associated with an attribute enumeration
//
// Arguments:
// penumerator: attribute enumerator initialized by BeginAttributeEnumeration
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/12/09 12:50:02: Created
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::EndRawAttributeEnumeration(
IN PATTRIBUTE_ENUMERATOR penumerator)
{
_ASSERT(penumerator);
ldap_value_free_len((struct berval **)penumerator->pvBase);
return S_OK;
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::GetAllAttributeValues
//
// Synopsis: Retrieve all values for a particular attribute at once.
// This may not be optimal for attributes with a large number of
// values (enumerating through the values may be better performace wise).
//
// Arguments:
// pszAttributeName: The name of the attribute you want
// penumerator: A user allocated ATTRIBUTE_ENUMERATOR structure for
// use by the ICategorizerItemAttributes implementor
// prgpszAttributeValues: Where to return the pointer to the
// attribute string array. This will be a NULL terminated array of
// pointers to strings.
//
// Returns:
// S_OK: Success
// CAT_E_PROPNOTFOUND: None of those attributes exist
//
// History:
// jstamerj 1998/12/10 18:55:38: Created.
//
//-------------------------------------------------------------
HRESULT CICategorizerItemAttributesIMP::GetAllAttributeValues(
LPCSTR pszAttributeName,
PATTRIBUTE_ENUMERATOR penumerator,
LPSTR **prgpszAttributeValues)
{
HRESULT hr;
TraceFunctEnter("CICategorizerItemAttributesIMP::GetAllAttributeValues");
//
// piggy back on BeginAttributeEnumeration
//
hr = BeginAttributeEnumeration(
pszAttributeName,
penumerator);
if(SUCCEEDED(hr)) {
//
// return the array
//
*prgpszAttributeValues = (LPSTR *) penumerator->pvBase;
}
DebugTrace(NULL, "returning hr %08lx", hr);
TraceFunctLeave();
return hr;
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::ReleaseAllAttributes
//
// Synopsis: Release the attributes allocated from GetAllAttributeValues
//
// Arguments:
// penumerator: the enumerator passed into GetAllAttributeValues
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/12/10 19:38:57: Created.
//
//-------------------------------------------------------------
HRESULT CICategorizerItemAttributesIMP::ReleaseAllAttributeValues(
PATTRIBUTE_ENUMERATOR penumerator)
{
HRESULT hr;
TraceFunctEnter("CICategorizerItemAttributesIMP::ReleaseAllAttributes");
//
// piggy back off of endattributeenumeration
//
hr = EndAttributeEnumeration(
penumerator);
DebugTrace(NULL, "returning hr %08lx", hr);
TraceFunctLeave();
return hr;
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::CountAttributeValues
//
// Synopsis: Return a count of the number of attribute values associated
// with this enumerator
//
// Arguments:
// penumerator: describes the attribute in question
// pdwCount: Out parameter for the count
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1999/03/25 14:36:58: Created.
//
//-------------------------------------------------------------
HRESULT CICategorizerItemAttributesIMP::CountAttributeValues(
IN PATTRIBUTE_ENUMERATOR penumerator,
OUT DWORD *pdwCount)
{
TraceFunctEnterEx((LPARAM)this, "CICategorizerItemAttributesIMP::CountAttributeValues");
_ASSERT(pdwCount);
*pdwCount = ldap_count_values((PCHAR *) penumerator->pvBase);
TraceFunctLeaveEx((LPARAM)this);
return S_OK;
} // CICategorizerItemAttributesIMP::CountAttributeValues
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::CountRawAttributeValues
//
// Synopsis: Return a count of the number of attribute values associated
// with this enumerator
//
// Arguments:
// penumerator: describes the attribute in question
// pdwCount: Out parameter for the count
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1999/03/25 14:39:54: Created
//
//-------------------------------------------------------------
HRESULT CICategorizerItemAttributesIMP::CountRawAttributeValues(
IN PATTRIBUTE_ENUMERATOR penumerator,
OUT DWORD *pdwCount)
{
TraceFunctEnterEx((LPARAM)this, "CICategorizerItemAttributesIMP::CountRawAttributeValues");
_ASSERT(pdwCount);
*pdwCount = ldap_count_values_len((struct berval **) penumerator->pvBase);
TraceFunctLeaveEx((LPARAM)this);
return S_OK;
} // CICategorizerItemAttributesIMP::CountRawAttributeValues
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::BeginUTF8AttributeEnumeration
//
// Synopsis: Begin UTF8 attribute enumeration
//
// Arguments:
// pszAttributeName: Name of attribute to enumerate through
// penumerator: Uninitialized Enumerator structure to use
//
// Returns:
// S_OK: Success
// CAT_E_PROPNOTFOUND: No attributes values exist
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1999/12/10 11:14:35: Created.
//
//-------------------------------------------------------------
HRESULT CICategorizerItemAttributesIMP::BeginUTF8AttributeEnumeration(
IN LPCSTR pszAttributeName,
IN PATTRIBUTE_ENUMERATOR penumerator)
{
HRESULT hr;
TraceFunctEnterEx((LPARAM)this, "CICategorizerItemAttributesIMP::BeginUTF8AttributeEnumeration");
//
// Piggy back raw attribute enumeration and use the pvContext
// member of penumerator.
//
hr = BeginRawAttributeEnumeration(
pszAttributeName,
penumerator);
penumerator->pvContext = NULL;
DebugTrace((LPARAM)this, "returning hr %08lx", hr);
TraceFunctLeaveEx((LPARAM)this);
return hr;
}
//+------------------------------------------------------------
//
// Function: GetNextAttributeValue
//
// Synopsis: Get the next attribute in an enumeration
//
// Arguments:
// penumerator: enumerator sturcture initialized in BeginAttributeEnumeration
// ppszAttributeValue: Ptr to Ptr to recieve Ptr to string of attribute value
//
// Returns:
// S_OK: Success
// HRESULT_FROM_WIN32(ERROR_NO_MORE_ITEMS)
//
// History:
// jstamerj 1998/07/02 11:14:54: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::GetNextUTF8AttributeValue(
IN PATTRIBUTE_ENUMERATOR penumerator,
OUT LPSTR *ppszAttributeValue)
{
HRESULT hr = S_OK;
DWORD dwcb = 0;
LPVOID pvAttributeValue = NULL;
LPSTR psz = NULL;
if(penumerator->pvContext) {
delete [] (LPSTR) penumerator->pvContext;
penumerator->pvContext = NULL;
}
hr = GetNextRawAttributeValue(
penumerator,
&dwcb,
&pvAttributeValue);
if(FAILED(hr))
return hr;
//
// Convert to termianted UTF8 string
//
psz = new CHAR[dwcb + 1];
if(psz == NULL)
return E_OUTOFMEMORY;
CopyMemory(psz, pvAttributeValue, dwcb);
psz[dwcb] = '\0';
*ppszAttributeValue = psz;
penumerator->pvContext = psz;
return hr;
}
//+------------------------------------------------------------
//
// Function: RewindAttributeEnumeration
//
// Synopsis: Rewind enumerator to beginning of attribute value list
//
// Arguments:
// penumerator: attribute enumerator initialized by BeginAttributeEnumeration
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/07/06 11:22:23: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::RewindUTF8AttributeEnumeration(
IN PATTRIBUTE_ENUMERATOR penumerator)
{
return RewindRawAttributeEnumeration(
penumerator);
}
//+------------------------------------------------------------
//
// Function: EndAttributeEnumeration
//
// Synopsis: Free memory associated with an attribute enumeration
//
// Arguments:
// penumerator: attribute enumerator initialized by BeginAttributeEnumeration
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1998/07/02 12:24:44: Created.
//
//-------------------------------------------------------------
STDMETHODIMP CICategorizerItemAttributesIMP::EndUTF8AttributeEnumeration(
IN PATTRIBUTE_ENUMERATOR penumerator)
{
if(penumerator->pvContext) {
delete [] (LPSTR) penumerator->pvContext;
penumerator->pvContext = NULL;
}
return EndRawAttributeEnumeration(penumerator);
}
//+------------------------------------------------------------
//
// Function: CICategorizerItemAttributesIMP::CountUTF8AttributeValues
//
// Synopsis: Return a count of the number of attribute values associated
// with this enumerator
//
// Arguments:
// penumerator: describes the attribute in question
// pdwCount: Out parameter for the count
//
// Returns:
// S_OK: Success
//
// History:
// jstamerj 1999/03/25 14:39:54: Created
//
//-------------------------------------------------------------
HRESULT CICategorizerItemAttributesIMP::CountUTF8AttributeValues(
IN PATTRIBUTE_ENUMERATOR penumerator,
OUT DWORD *pdwCount)
{
return CountRawAttributeValues(
penumerator,
pdwCount);
} // CICategorizerItemAttributesIMP::CountRawAttributeValues
| [
"112426112@qq.com"
] | 112426112@qq.com |
0c534c15042ac95c11ebbbbdb8fa69749a86b48c | f778b6e09764715707bedc40b43e5447c754179c | /templates/cc_template.cpp | 3ca0f3852445e5c2b4be6a1a0c7c355d23fcb95e | [] | no_license | rohitagarwal0910/cpsetup | 53ef0d8cab38d641578267bb5c73809a40ae873b | e93d6a23e9e85d3c76c4d3b18f99336fd2f2e533 | refs/heads/master | 2022-09-22T11:22:11.712611 | 2020-06-04T19:25:30 | 2020-06-04T19:25:30 | 259,939,221 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 984 | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef vector<lli> vll;
typedef vector<vector<lli>> vvl;
typedef vector<pair<lli, lli>> vpll;
typedef pair<lli, lli> pll;
typedef pair<long double, long double> pdd;
typedef pair<lli, vll> plv;
typedef pair<long double, vll> pdv;
typedef map<lli, lli> mll;
typedef map<lli, vll> mlv;
#define pb push_back
#define google cout << "Case #" << TT << ": ";
#define fin for (lli i = 0; i < n; i++)
#define fi(n) for (lli i = 0; i < n; i++)
#define fj(n) for (lli j = 0; j < n; j++)
#define fiv for (lli i = 0; i < v.size(); i++)
#define fis for (lli i = 0; i < s.size(); i++)
#define rep(i,s,e) for (lli i = s; i < e; i++)
#define repr(i,s,e) for (lli i = s; i >= e; i--)
#define vs v.size()
#define ss s.size()
#define all(v) v.begin(), v.end()
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli TC = 1;
cin >> TC;
for (lli TT = 1; TT<=TC; TT++) {
}
return 0;
} | [
"agarwal.rohit0910@gmail.com"
] | agarwal.rohit0910@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.