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 986 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145 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 122 values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
93f58ee7acac5bc8b8935fea838e235b7f9215b1 | 4c002cbf46477ac23c5a662309fe3b60f4df68f3 | /src/netbase.h | 5af03533b2e281a7275aafefd09b4b82a44341a5 | [
"MIT"
] | permissive | park-com/Coin | da8a382d170d26c2f4be1224ce9080a6f5b21d8d | 845a503fb0cf67b1d6b33b8ef90fe36ba60ef58e | refs/heads/master | 2021-05-31T23:01:15.414860 | 2016-05-29T18:23:31 | 2016-05-29T18:23:31 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,089 | h | // Copyright (c) 2009-2012 The COIN developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_NETBASE_H
#define BITCOIN_NETBASE_H
#include <string>
#include <vector>
#include "serialize.h"
#include "compat.h"
extern int nConnectTimeout;
#ifdef WIN32
// In MSVC, this is defined as a macro, undefine it to prevent a compile and link error
#undef SetPort
#endif
enum Network
{
NET_UNROUTABLE,
NET_IPV4,
NET_IPV6,
NET_TOR,
NET_MAX,
};
extern int nConnectTimeout;
extern bool fNameLookup;
/** IP address (IPv6, or IPv4 using mapped IPv6 range (::FFFF:0:0/96)) */
class CNetAddr
{
protected:
unsigned char ip[16]; // in network byte order
public:
CNetAddr();
CNetAddr(const struct in_addr& ipv4Addr);
explicit CNetAddr(const char *pszIp, bool fAllowLookup = false);
explicit CNetAddr(const std::string &strIp, bool fAllowLookup = false);
void Init();
void SetIP(const CNetAddr& ip);
bool SetSpecial(const std::string &strName); // for Tor addresses
bool IsIPv4() const; // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0)
bool IsIPv6() const; // IPv6 address (not mapped IPv4, not Tor)
bool IsRFC1918() const; // IPv4 private networks (10.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12)
bool IsRFC3849() const; // IPv6 documentation address (2001:0DB8::/32)
bool IsRFC3927() const; // IPv4 autoconfig (169.254.0.0/16)
bool IsRFC3964() const; // IPv6 6to4 tunnelling (2002::/16)
bool IsRFC4193() const; // IPv6 unique local (FC00::/15)
bool IsRFC4380() const; // IPv6 Teredo tunnelling (2001::/32)
bool IsRFC4843() const; // IPv6 ORCHID (2001:10::/28)
bool IsRFC4862() const; // IPv6 autoconfig (FE80::/64)
bool IsRFC6052() const; // IPv6 well-known prefix (64:FF9B::/96)
bool IsRFC6145() const; // IPv6 IPv4-translated address (::FFFF:0:0:0/96)
bool IsTor() const;
bool IsLocal() const;
bool IsRoutable() const;
bool IsValid() const;
bool IsMulticast() const;
enum Network GetNetwork() const;
std::string ToString() const;
std::string ToStringIP() const;
unsigned int GetByte(int n) const;
uint64 GetHash() const;
bool GetInAddr(struct in_addr* pipv4Addr) const;
std::vector<unsigned char> GetGroup() const;
int GetReachabilityFrom(const CNetAddr *paddrPartner = NULL) const;
void print() const;
#ifdef USE_IPV6
CNetAddr(const struct in6_addr& pipv6Addr);
bool GetIn6Addr(struct in6_addr* pipv6Addr) const;
#endif
friend bool operator==(const CNetAddr& a, const CNetAddr& b);
friend bool operator!=(const CNetAddr& a, const CNetAddr& b);
friend bool operator<(const CNetAddr& a, const CNetAddr& b);
IMPLEMENT_SERIALIZE
(
READWRITE(FLATDATA(ip));
)
};
/** A combination of a network address (CNetAddr) and a (TCP) port */
class CService : public CNetAddr
{
protected:
unsigned short port; // host order
public:
CService();
CService(const CNetAddr& ip, unsigned short port);
CService(const struct in_addr& ipv4Addr, unsigned short port);
CService(const struct sockaddr_in& addr);
explicit CService(const char *pszIpPort, int portDefault, bool fAllowLookup = false);
explicit CService(const char *pszIpPort, bool fAllowLookup = false);
explicit CService(const std::string& strIpPort, int portDefault, bool fAllowLookup = false);
explicit CService(const std::string& strIpPort, bool fAllowLookup = false);
void Init();
void SetPort(unsigned short portIn);
unsigned short GetPort() const;
bool GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const;
bool SetSockAddr(const struct sockaddr* paddr);
friend bool operator==(const CService& a, const CService& b);
friend bool operator!=(const CService& a, const CService& b);
friend bool operator<(const CService& a, const CService& b);
std::vector<unsigned char> GetKey() const;
std::string ToString() const;
std::string ToStringPort() const;
std::string ToStringIPPort() const;
void print() const;
#ifdef USE_IPV6
CService(const struct in6_addr& ipv6Addr, unsigned short port);
CService(const struct sockaddr_in6& addr);
#endif
IMPLEMENT_SERIALIZE
(
CService* pthis = const_cast<CService*>(this);
READWRITE(FLATDATA(ip));
unsigned short portN = htons(port);
READWRITE(portN);
if (fRead)
pthis->port = ntohs(portN);
)
};
typedef std::pair<CService, int> proxyType;
enum Network ParseNetwork(std::string net);
void SplitHostPort(std::string in, int &portOut, std::string &hostOut);
bool SetProxy(enum Network net, CService addrProxy, int nSocksVersion = 5);
bool GetProxy(enum Network net, proxyType &proxyInfoOut);
bool IsProxy(const CNetAddr &addr);
bool SetNameProxy(CService addrProxy, int nSocksVersion = 5);
bool HaveNameProxy();
bool LookupHost(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions = 0, bool fAllowLookup = true);
bool LookupHostNumeric(const char *pszName, std::vector<CNetAddr>& vIP, unsigned int nMaxSolutions = 0);
bool Lookup(const char *pszName, CService& addr, int portDefault = 0, bool fAllowLookup = true);
bool Lookup(const char *pszName, std::vector<CService>& vAddr, int portDefault = 0, bool fAllowLookup = true, unsigned int nMaxSolutions = 0);
bool LookupNumeric(const char *pszName, CService& addr, int portDefault = 0);
bool ConnectSocket(const CService &addr, SOCKET& hSocketRet, int nTimeout = nConnectTimeout);
bool ConnectSocketByName(CService &addr, SOCKET& hSocketRet, const char *pszDest, int portDefault = 0, int nTimeout = nConnectTimeout);
#endif
| [
"clintoncointeam@gmail.com"
] | clintoncointeam@gmail.com |
ffb122cf9cadf27c2db1e9e0e249a828b0d2dd32 | b1fed0cf607483a8c51df377d6278d186be95007 | /tags/Rel_1_3_FINAL/shib-target/RPCListener.cpp | 6e3340f73b27237db1ab060635871a134f2b38e1 | [] | no_license | svn2github/cpp-sp | eab0e52ce521ae696ba02d815d7da02481c4e24d | 9c0bfdae80f3c60860b36f15698f241f1e3d933f | refs/heads/master | 2020-06-06T03:24:19.620256 | 2015-01-20T00:27:14 | 2015-01-20T00:27:14 | 19,316,247 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,295 | cpp | /*
* Copyright 2001-2005 Internet2
*
* 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.
*/
/*
* RPCListener.cpp -- Handles marshalling and connection mgmt for ONC-remoted IListeners
*
* Scott Cantor
* 5/1/05
*
*/
#include <saml/saml.h> // need this to "prime" the xmlsec-constrained windows.h declaration
#include <shib-target/shibrpc.h>
#include "internal.h"
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
using namespace std;
using namespace log4cpp;
using namespace saml;
using namespace shibboleth;
using namespace shibtarget;
namespace shibtarget {
// Wraps the actual RPC connection
class RPCHandle
{
public:
RPCHandle(Category& log);
~RPCHandle();
CLIENT* connect(const RPCListener* listener); // connects and returns the CLIENT handle
void disconnect(const RPCListener* listener=NULL); // disconnects, should not return disconnected handles to pool!
private:
Category& m_log;
CLIENT* m_clnt;
IListener::ShibSocket m_sock;
};
// Manages the pool of connections
class RPCHandlePool
{
public:
RPCHandlePool(Category& log, const RPCListener* listener)
: m_log(log), m_listener(listener), m_lock(shibboleth::Mutex::create()) {}
~RPCHandlePool();
RPCHandle* get();
void put(RPCHandle*);
private:
const RPCListener* m_listener;
Category& m_log;
auto_ptr<Mutex> m_lock;
stack<RPCHandle*> m_pool;
};
// Cleans up after use
class RPC
{
public:
RPC(RPCHandlePool& pool);
~RPC() {delete m_handle;}
RPCHandle* operator->() {return m_handle;}
void pool() {if (m_handle) m_pool.put(m_handle); m_handle=NULL;}
private:
RPCHandle* m_handle;
RPCHandlePool& m_pool;
};
// Local-wrapper for an ISessionCacheEntry
class EntryWrapper : public virtual ISessionCacheEntry
{
public:
EntryWrapper(shibrpc_get_session_ret_2& ret, Category& log);
~EntryWrapper() { delete statement; delete pre_response; delete post_response; }
void lock() {}
void unlock() { delete this; }
virtual bool isValid(time_t lifetime, time_t timeout) const { return true; }
virtual const char* getClientAddress() const { return NULL; }
virtual ShibProfile getProfile() const { return profile; }
virtual const char* getProviderId() const { return provider_id.c_str(); }
virtual const saml::SAMLAuthenticationStatement* getAuthnStatement() const { return statement; }
virtual CachedResponse getResponse() { return CachedResponse(pre_response,post_response); }
private:
string provider_id;
ShibProfile profile;
SAMLAuthenticationStatement* statement;
SAMLResponse* pre_response;
SAMLResponse* post_response;
};
}
RPCListener::RPCListener(const DOMElement* e) : log(&Category::getInstance(SHIBT_LOGCAT".Listener"))
{
m_rpcpool=new RPCHandlePool(*log,this);
}
RPCListener::~RPCListener()
{
delete m_rpcpool;
}
void RPCListener::sessionNew(
const IApplication* application,
int supported_profiles,
const char* recipient,
const char* packet,
const char* ip,
string& target,
string& cookie,
string& provider_id
) const
{
#ifdef _DEBUG
saml::NDC ndc("sessionNew");
#endif
if (!packet || !*packet) {
log->error("missing profile response");
throw FatalProfileException("Profile response missing.");
}
if (!ip || !*ip) {
log->error("missing client address");
throw FatalProfileException("Invalid client address.");
}
if (supported_profiles <= 0) {
log->error("no profile support indicated");
throw FatalProfileException("No profile support indicated.");
}
shibrpc_new_session_args_2 arg;
arg.recipient = (char*)recipient;
arg.application_id = (char*)application->getId();
arg.packet = (char*)packet;
arg.client_addr = (char*)ip;
arg.supported_profiles = supported_profiles;
log->info("create session for user at (%s) for application (%s)", ip, arg.application_id);
shibrpc_new_session_ret_2 ret;
memset(&ret, 0, sizeof(ret));
// Loop on the RPC in case we lost contact the first time through
int retry = 1;
CLIENT* clnt;
RPC rpc(*m_rpcpool);
do {
clnt = rpc->connect(this);
clnt_stat status = shibrpc_new_session_2(&arg, &ret, clnt);
if (status != RPC_SUCCESS) {
// FAILED. Release, disconnect, and retry
log->error("RPC Failure: (CLIENT: %p) (%d): %s", clnt, status, clnt_spcreateerror("shibrpc_new_session_2"));
rpc->disconnect(this);
if (retry)
retry--;
else
throw ListenerException("Failure passing session setup information to listener.");
}
else {
// SUCCESS. Pool and continue
retry = -1;
}
} while (retry>=0);
if (ret.status && *ret.status)
log->debug("RPC completed with exception: %s", ret.status);
else
log->debug("RPC completed successfully");
SAMLException* except=NULL;
if (ret.status && *ret.status) {
// Reconstitute exception object.
try {
istringstream estr(ret.status);
except=SAMLException::getInstance(estr);
}
catch (SAMLException& e) {
log->error("caught SAML Exception while building the SAMLException: %s", e.what());
log->error("XML was: %s", ret.status);
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_new_session_ret_2, (caddr_t)&ret);
rpc.pool();
throw FatalProfileException("An unrecoverable error occurred while creating your session.");
}
#ifndef _DEBUG
catch (...) {
log->error("caught unknown exception building SAMLException");
log->error("XML was: %s", ret.status);
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_new_session_ret_2, (caddr_t)&ret);
rpc.pool();
throw;
}
#endif
}
else {
log->debug("new session from IdP (%s) with key (%s)", ret.provider_id, ret.cookie);
cookie = ret.cookie;
provider_id = ret.provider_id;
if (ret.target)
target = ret.target;
}
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_new_session_ret_2, (caddr_t)&ret);
rpc.pool();
if (except) {
auto_ptr<SAMLException> wrapper(except);
wrapper->raise();
}
}
EntryWrapper::EntryWrapper(shibrpc_get_session_ret_2& ret, Category& log)
{
profile = static_cast<ShibProfile>(ret.profile);
int minor = (profile==SAML10_POST || profile==SAML10_ARTIFACT) ? 0 : 1;
provider_id = ret.provider_id;
istringstream authstream(ret.auth_statement);
log.debugStream() << "trying to decode authentication statement: "
<< ((ret.auth_statement && *ret.auth_statement) ? ret.auth_statement : "(none)") << CategoryStream::ENDLINE;
auto_ptr<SAMLAuthenticationStatement> s(
(ret.auth_statement && *ret.auth_statement) ? new SAMLAuthenticationStatement(authstream) : NULL
);
istringstream prestream(ret.attr_response_pre);
log.debugStream() << "trying to decode unfiltered attribute response: "
<< ((ret.attr_response_pre && *ret.attr_response_pre) ? ret.attr_response_pre : "(none)") << CategoryStream::ENDLINE;
auto_ptr<SAMLResponse> pre(
(ret.attr_response_pre && *ret.attr_response_pre) ? new SAMLResponse(prestream,minor) : NULL
);
istringstream poststream(ret.attr_response_post);
log.debugStream() << "trying to decode filtered attribute response: "
<< ((ret.attr_response_post && *ret.attr_response_post) ? ret.attr_response_post : "(none)") << CategoryStream::ENDLINE;
auto_ptr<SAMLResponse> post(
(ret.attr_response_post && *ret.attr_response_post) ? new SAMLResponse(poststream,minor) : NULL
);
statement=s.release();
pre_response = pre.release();
post_response = post.release();
}
void RPCListener::sessionGet(
const IApplication* application,
const char* cookie,
const char* ip,
ISessionCacheEntry** pentry
) const
{
#ifdef _DEBUG
saml::NDC ndc("sessionGet");
#endif
if (!cookie || !*cookie) {
log->error("no session key provided");
throw InvalidSessionException("No session key was provided.");
}
else if (strchr(cookie,'=')) {
log->error("cookie value not extracted successfully, probably overlapping cookies across domains");
throw InvalidSessionException("The session key wasn't extracted successfully from the browser cookie.");
}
if (!ip || !*ip) {
log->error("invalid client Address");
throw FatalProfileException("Invalid client address.");
}
log->debug("getting session for client at (%s)", ip);
log->debug("session cookie (%s)", cookie);
shibrpc_get_session_args_2 arg;
arg.cookie = (char*)cookie;
arg.client_addr = (char*)ip;
arg.application_id = (char*)application->getId();
shibrpc_get_session_ret_2 ret;
memset (&ret, 0, sizeof(ret));
// Loop on the RPC in case we lost contact the first time through
int retry = 1;
CLIENT *clnt;
RPC rpc(*m_rpcpool);
do {
clnt = rpc->connect(this);
clnt_stat status = shibrpc_get_session_2(&arg, &ret, clnt);
if (status != RPC_SUCCESS) {
// FAILED. Release, disconnect, and try again...
log->error("RPC Failure: (CLIENT: %p) (%d) %s", clnt, status, clnt_spcreateerror("shibrpc_get_session_2"));
rpc->disconnect(this);
if (retry)
retry--;
else
throw ListenerException("Failure requesting session information from listener.");
}
else {
// SUCCESS
retry = -1;
}
} while (retry>=0);
if (ret.status && *ret.status)
log->debug("RPC completed with exception: %s", ret.status);
else
log->debug("RPC completed successfully");
SAMLException* except=NULL;
if (ret.status && *ret.status) {
// Reconstitute exception object.
try {
istringstream estr(ret.status);
except=SAMLException::getInstance(estr);
}
catch (SAMLException& e) {
log->error("caught SAML Exception while building the SAMLException: %s", e.what());
log->error("XML was: %s", ret.status);
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_get_session_ret_2, (caddr_t)&ret);
rpc.pool();
throw FatalProfileException("An unrecoverable error occurred while accessing your session.");
}
catch (...) {
log->error("caught unknown exception building SAMLException");
log->error("XML was: %s", ret.status);
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_get_session_ret_2, (caddr_t)&ret);
rpc.pool();
throw;
}
}
else {
try {
*pentry=new EntryWrapper(ret,*log);
}
catch (SAMLException& e) {
log->error("caught SAML exception while reconstituting session objects: %s", e.what());
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_get_session_ret_2, (caddr_t)&ret);
rpc.pool();
throw;
}
#ifndef _DEBUG
catch (...) {
log->error("caught unknown exception while reconstituting session objects");
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_get_session_ret_2, (caddr_t)&ret);
rpc.pool();
throw;
}
#endif
}
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_get_session_ret_2, (caddr_t)&ret);
rpc.pool();
if (except) {
auto_ptr<SAMLException> wrapper(except);
wrapper->raise();
}
}
void RPCListener::sessionEnd(
const IApplication* application,
const char* cookie
) const
{
#ifdef _DEBUG
saml::NDC ndc("sessionEnd");
#endif
if (!cookie || !*cookie) {
log->error("no session key provided");
throw InvalidSessionException("No session key was provided.");
}
else if (strchr(cookie,'=')) {
log->error("cookie value not extracted successfully, probably overlapping cookies across domains");
throw InvalidSessionException("The session key wasn't extracted successfully from the browser cookie.");
}
log->debug("ending session with cookie (%s)", cookie);
shibrpc_end_session_args_2 arg;
arg.cookie = (char*)cookie;
shibrpc_end_session_ret_2 ret;
memset (&ret, 0, sizeof(ret));
// Loop on the RPC in case we lost contact the first time through
int retry = 1;
CLIENT *clnt;
RPC rpc(*m_rpcpool);
do {
clnt = rpc->connect(this);
clnt_stat status = shibrpc_end_session_2(&arg, &ret, clnt);
if (status != RPC_SUCCESS) {
// FAILED. Release, disconnect, and try again...
log->error("RPC Failure: (CLIENT: %p) (%d) %s", clnt, status, clnt_spcreateerror("shibrpc_end_session_2"));
rpc->disconnect(this);
if (retry)
retry--;
else
throw ListenerException("Failure ending session through listener.");
}
else {
// SUCCESS
retry = -1;
}
} while (retry>=0);
if (ret.status && *ret.status)
log->debug("RPC completed with exception: %s", ret.status);
else
log->debug("RPC completed successfully");
SAMLException* except=NULL;
if (ret.status && *ret.status) {
// Reconstitute exception object.
try {
istringstream estr(ret.status);
except=SAMLException::getInstance(estr);
}
catch (SAMLException& e) {
log->error("caught SAML Exception while building the SAMLException: %s", e.what());
log->error("XML was: %s", ret.status);
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_end_session_ret_2, (caddr_t)&ret);
rpc.pool();
throw FatalProfileException("An unrecoverable error occurred while accessing your session.");
}
catch (...) {
log->error("caught unknown exception building SAMLException");
log->error("XML was: %s", ret.status);
clnt_freeres(clnt, (xdrproc_t)xdr_shibrpc_end_session_ret_2, (caddr_t)&ret);
rpc.pool();
throw;
}
}
clnt_freeres (clnt, (xdrproc_t)xdr_shibrpc_end_session_ret_2, (caddr_t)&ret);
rpc.pool();
if (except) {
auto_ptr<SAMLException> wrapper(except);
wrapper->raise();
}
}
void RPCListener::ping(int& i) const
{
#ifdef _DEBUG
saml::NDC ndc("ping");
#endif
int result=-1;
log->debug("pinging with (%d)", i);
// Loop on the RPC in case we lost contact the first time through
int retry = 1;
CLIENT *clnt;
RPC rpc(*m_rpcpool);
do {
clnt = rpc->connect(this);
clnt_stat status = shibrpc_ping_2(&i, &result, clnt);
if (status != RPC_SUCCESS) {
// FAILED. Release, disconnect, and try again...
log->error("RPC Failure: (CLIENT: %p) (%d) %s", clnt, status, clnt_spcreateerror("shibrpc_end_session_2"));
rpc->disconnect(this);
if (retry)
retry--;
else
throw ListenerException("Failure pinging listener.");
}
else {
// SUCCESS
retry = -1;
}
} while (retry>=0);
log->debug("RPC completed successfully");
i=result;
rpc.pool();
}
RPCHandle::RPCHandle(Category& log) : m_clnt(NULL), m_sock((IListener::ShibSocket)0), m_log(log)
{
m_log.debug("New RPCHandle created: %p", this);
}
RPCHandle::~RPCHandle()
{
m_log.debug("Destroying RPC Handle: %p", this);
disconnect();
}
void RPCHandle::disconnect(const RPCListener* listener)
{
if (m_clnt) {
clnt_destroy(m_clnt);
m_clnt=NULL;
if (listener) {
listener->close(m_sock);
m_sock=(IListener::ShibSocket)0;
}
else {
#ifdef WIN32
::closesocket(m_sock);
#else
::close(m_sock);
#endif
m_sock=(IListener::ShibSocket)0;
}
}
}
CLIENT* RPCHandle::connect(const RPCListener* listener)
{
#ifdef _DEBUG
saml::NDC ndc("connect");
#endif
if (m_clnt) {
m_log.debug("returning existing connection: %p -> %p", this, m_clnt);
return m_clnt;
}
m_log.debug("trying to connect to socket");
IListener::ShibSocket sock;
if (!listener->create(sock)) {
m_log.error("cannot create socket");
throw ListenerException("Cannot create socket");
}
bool connected = false;
int num_tries = 3;
for (int i = num_tries-1; i >= 0; i--) {
if (listener->connect(sock)) {
connected = true;
break;
}
m_log.warn("cannot connect %p to socket...%s", this, (i > 0 ? "retrying" : ""));
if (i) {
#ifdef WIN32
Sleep(2000*(num_tries-i));
#else
sleep(2*(num_tries-i));
#endif
}
}
if (!connected) {
m_log.crit("socket server unavailable, failing");
listener->close(sock);
throw ListenerException("Cannot connect to listener process, a site adminstrator should be notified.");
}
CLIENT* clnt = (CLIENT*)listener->getClientHandle(sock, SHIBRPC_PROG, SHIBRPC_VERS_2);
if (!clnt) {
const char* rpcerror = clnt_spcreateerror("RPCHandle::connect");
m_log.crit("RPC failed for %p: %s", this, rpcerror);
listener->close(sock);
throw ListenerException(rpcerror);
}
// Set the RPC timeout to a fairly high value...
struct timeval tv;
tv.tv_sec = 300; /* change timeout to 5 minutes */
tv.tv_usec = 0; /* this should always be set */
clnt_control(clnt, CLSET_TIMEOUT, (char*)&tv);
m_clnt = clnt;
m_sock = sock;
m_log.debug("success: %p -> %p", this, m_clnt);
return m_clnt;
}
RPCHandlePool::~RPCHandlePool()
{
while (!m_pool.empty()) {
delete m_pool.top();
m_pool.pop();
}
}
RPCHandle* RPCHandlePool::get()
{
m_lock->lock();
if (m_pool.empty()) {
m_lock->unlock();
return new RPCHandle(m_log);
}
RPCHandle* ret=m_pool.top();
m_pool.pop();
m_lock->unlock();
return ret;
}
void RPCHandlePool::put(RPCHandle* handle)
{
m_lock->lock();
m_pool.push(handle);
m_lock->unlock();
}
RPC::RPC(RPCHandlePool& pool) : m_pool(pool)
{
m_handle=m_pool.get();
}
| [
"(no author)@cb58f699-b61c-0410-a6fe-9272a202ed29"
] | (no author)@cb58f699-b61c-0410-a6fe-9272a202ed29 |
b581c076161c588b32ff3dd497dec6d6923764ec | 469ab6e7dde3862e177e7dce1d21f182a0844a10 | /draft/quantico6/LTC68042.cpp | ad23b7806cb3cadedc68eedf03501db41ac61d4a | [] | no_license | jcaf/bs | c7d321a263bccf4215ff9447a82448fba55daa79 | 549881d795581b2cf8bf81d523381ea603e4269f | refs/heads/master | 2023-03-25T05:48:50.450169 | 2021-03-22T23:09:44 | 2021-03-22T23:09:44 | 350,516,204 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,175 | cpp | #include <Arduino.h>
#include "LTC68042.h"
#include <avr/pgmspace.h>
#include "system.h"
//#define _LTC68042_DEBUG_
#ifdef _LTC68042_DEBUG_
void ltc6804e_debug_errordump(int8_t error)
{
if (error == -1)
{Serial.println(F("ERROR PEC"));}
}
#endif // _LTC68042_DEBUG_
uint8_t ADCV[2];
uint8_t ADAX[2];
uint8_t ADSTAT[2];
uint8_t ADOW[2];
static void wakeup_idle();
static void wakeup_sleep();
static uint16_t pec15_calc(uint8_t len, uint8_t *data);
static void spi_write_array( uint8_t length, uint8_t *data);
static void spi_write_read(uint8_t *TxData, uint8_t TXlen, uint8_t *rx_data, uint8_t RXlen);
static void spi_write(uint8_t data);
static uint8_t spi_read(uint8_t data);
static int8_t LTC6804_rdcvGroup_address(uint8_t address, uint8_t rdcv_group, uint16_t *data_ext);
static void LTC6804_rdauxGroup_address(uint8_t address, uint8_t aux_group, uint8_t *data);
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void set_adcv(uint8_t MD, uint8_t DCP, uint8_t CH)
{
ADCV[0] = 0x02 | ((MD & 0x02)>>1);
ADCV[1] = ((MD&0x01)<<7) | 0x60 | (DCP<<4) | (CH&0x07);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//CMD0 CMD1 PEC0 PEC1
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void LTC6804_ADCV_address(uint8_t address)
{
uint8_t cmd[4];
uint16_t temp_pec;
cmd[0] = (0x80 | (address<<3)) + ADCV[0];
cmd[1] = ADCV[1];
temp_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(temp_pec >> 8);//PEC0 (HIGH)
cmd[3] = (uint8_t)(temp_pec);//PEC1 (LOW)
wakeup_idle ();
output_low(LTC6804_CS);
spi_write_array(4,cmd);
output_high(LTC6804_CS);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void set_adax(uint8_t MD, uint8_t CHG )//broadcast
{
ADAX[0] = 0x04 | ((MD&0x02)>>1);
ADAX[1] = ((MD&0x01)<<7) | 0x60 | (CHG) ;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void LTC6804_ADAX_broadcast()
{
uint8_t cmd[4];
uint16_t temp_pec;
cmd[0] = ADAX[0];
cmd[1] = ADAX[1];
temp_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(temp_pec >> 8);
cmd[3] = (uint8_t)(temp_pec);
wakeup_idle ();
output_low(LTC6804_CS);
spi_write_array(4,cmd);
output_high(LTC6804_CS);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int8_t LTC6804_RDCV_BYGROUP_address(uint8_t address, uint8_t rdcv_group, uint16_t *data_ext)
{
uint8_t cv;
int8_t pec_error;
uint16_t data[NUM_CELL_2V_MAX];
pec_error=0;
cv=0;
if (rdcv_group == READ_CELL_GROUP_ABCD )
{
for (uint8_t group=1; group<= 4; group++)
{
if (LTC6804_rdcvGroup_address(address, group, data) == -1)
{
pec_error = -1;
}
for (uint8_t i=0; i<3; i++)
{
data_ext[cv] = data[i];
cv++;
}
}
}
else
{
pec_error = LTC6804_rdcvGroup_address(address, rdcv_group, data_ext);
}
return pec_error;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int8_t LTC6804_rdcvGroup_address(uint8_t address, uint8_t rdcv_group, uint16_t *data_ext)
{
uint8_t cmd[4];
uint8_t data[NUM_BYTES_IN_REGGROUP + ADD_PEC];
uint16_t temp_pec;
uint16_t received_pec, data_pec;
int8_t pec_error;
uint16_t CXV;
uint8_t c;
cmd[0] = 0x80 | (address<<3); //Setting address
if (rdcv_group == 1)
cmd[1] = 0x04;
else if(rdcv_group == 2)
cmd[1] = 0x06;
else if(rdcv_group == 3)
cmd[1] = 0x08;
else if(rdcv_group == 4)
cmd[1] = 0x0A;
temp_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(temp_pec >> 8);
cmd[3] = (uint8_t)(temp_pec);
wakeup_idle();
output_low(LTC6804_CS);
spi_write_read(cmd,4, data, NUM_BYTES_IN_REGGROUP + ADD_PEC);
output_high(LTC6804_CS);
c=0;
for (uint8_t i=0; i<3; i++)
{
CXV = (data[c+1]<<8) | data[c];
data_ext[i] = CXV ;
c+=2;
}
//b.iii
received_pec = ( ((uint16_t)data[6])<<8 ) | data[7];//PEC0(HIGH) | PEC1(LOW)
data_pec = pec15_calc(NUM_BYTES_IN_REGGROUP, &data[0]);
pec_error = 0;
if (received_pec != data_pec)
{
pec_error = -1;
#ifdef _LTC68042_DEBUG_
ltc6804e_debug_errordump(pec_error);
#endif // _LTC68042_DEBUG_
}
return pec_error;
}
int8_t ltc_rdaux_groupAB_allIC(uint16_t (*aux_codes)[NUM_TOTAL_REGAUX])
{
int8_t pec_error = 0;
for (uint8_t num_ic=0; num_ic<NUM_IC; num_ic++)
{
if ( LTC6804_RDAUX_BYGROUP_address( num_ic, READ_AUX_GROUP_AB, &aux_codes[num_ic][0] ) == -1)
pec_error = -1;
}
return pec_error;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//0: Read back all auxiliary registers
//1: Read back auxiliary group A
//2: Read back auxiliary group B
// IC1 GPIO1- IC1 GPIO2 -IC1 GPIO3 -IC1 GPIO4 -IC1 GPIO5 -IC1 Vref2 -> IC2 GPIO1 - IC2 GPIO2 .....
///////////////////////////////////////////////////////////////////////////////////////////////////////////
#define GPIO_IN_REG 3
int8_t LTC6804_RDAUX_BYGROUP_address(uint8_t address, uint8_t aux_group, uint16_t *data_ext)
{
uint8_t data[NUM_BYTES_IN_REGGROUP+ADD_PEC];//6 + 2(PEC)
uint16_t data_pec, received_pec;
uint8_t gpio,i;
int8_t pec_error = 0;
if (aux_group == READ_AUX_GROUP_AB )
{
gpio=0;
for (uint8_t group=READ_AUX_GROUP_A; group<=READ_AUX_GROUP_B; group++)
{
LTC6804_rdauxGroup_address(address, group, data);//data recoge 8 bytes
i=0;
for (uint8_t gp=0; gp<GPIO_IN_REG; gp++)
{
data_ext[gpio++] = ( data[i+1]<<8) | data[i];
i+=2;
}
received_pec = ( ((uint16_t)data[6])<<8) | data[7];
data_pec = pec15_calc(6, &data[0]);
if (data_pec != received_pec)
pec_error = -1;
}
}
else
{
LTC6804_rdauxGroup_address(address, aux_group, data);
i=0;
for (uint8_t gpio=0; gpio<GPIO_IN_REG; gpio++)
{
data_ext[gpio] = (data[i+1]<<8) | data[i];
i=i+2;
}
received_pec = ( ((uint16_t)data[i])<<8) | data[i+1];
data_pec = pec15_calc(6, &data[0]);
if (data_pec != received_pec)
{
pec_error = -1;
#ifdef _LTC68042_DEBUG_
ltc6804e_debug_errordump(pec_error);
#endif // _LTC68042_DEBUG_
}
}
return (pec_error);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//1: Read back auxiliary group A
//2: Read back auxiliary group B
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void LTC6804_rdauxGroup_address(uint8_t address, uint8_t aux_group, uint8_t *data)
{
uint8_t cmd[4];
uint16_t cmd_pec;
cmd[0] = 0x80 | (address<<3);
if (aux_group == 1)
cmd[1] = 0x0C;
else if(aux_group == 2)
cmd[1] = 0x0E;
cmd_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(cmd_pec >> 8);
cmd[3] = (uint8_t)(cmd_pec);
wakeup_idle();
output_low(LTC6804_CS);
spi_write_read(cmd,4,data,8);
output_high(LTC6804_CS);
}
/////////////////////////////////////////////////////////////////////////////////////
//configurable
//no uso set_config() -> todo en 1
/////////////////////////////////////////////////////////////////////////////////////
#define WRCFG_GPIO5_1 0x1F //GPIO5-GPIO4-GPIO3-GPIO2-GPIO1 PULL DOWN (1=DISABLE)
#define WRCFG_REFON 0//0
#define WRCFG_ADCOPT 0//0
//#define WRCFG_DCC12_1 0//x0FFF //12 discharge-cells actived
#define WRCFG_DCTO 0 //disabled by hardware
void ltc_write_cfg_address(uint8_t address, float VUV, float VOV, uint16_t DCC12_1 )
{
uint8_t cfg[NUM_BYTES_IN_REGGROUP + ADD_PEC];
uint16_t temp_pec;
uint16_t vuv= (uint16_t) ( ( (VUV/100E-6)/16) -1);
uint16_t vov= (uint16_t) ( (VOV/100E-6)/16);
cfg[0]= ((WRCFG_GPIO5_1 & 0x1F)<<3) | (WRCFG_REFON<<2) | (WRCFG_ADCOPT);
cfg[1]=(uint8_t)vuv;
cfg[2]=(((uint8_t)vov)<<4) | (((uint8_t) (vuv>>8)) & 0x0F);
cfg[3]=(uint8_t)(vov>>4);
cfg[4]= (uint8_t)DCC12_1;
cfg[5]= ((WRCFG_DCTO<<4)&0xF0) | ( (DCC12_1>>8) & 0x0F);
//ADD PEC
temp_pec = (uint16_t)pec15_calc(NUM_BYTES_IN_REGGROUP, cfg);
cfg[6] = (uint8_t)(temp_pec >> 8);
cfg[7] = (uint8_t)temp_pec;
LTC6804_WRCFG_address(address, cfg);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// The function will calculate the needed PEC codes for the write data
// and then transmit data to the ICs on a stack.
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void LTC6804_WRCFG_address(uint8_t address, uint8_t * config_reg_group) //+2 PEC
{
uint8_t cmd[4];
uint16_t temp_pec;
cmd[0] = 0x80 + (address<<3); //Setting address
cmd[1] = 0x01;
temp_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(temp_pec >> 8);
cmd[3] = (uint8_t)(temp_pec);
wakeup_idle ();
output_low(LTC6804_CS);
spi_write_array(4,cmd);
spi_write_array(NUM_BYTES_IN_REGGROUP + ADD_PEC, config_reg_group);//spi_write_array(8, config_reg_group);
output_high(LTC6804_CS);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void set_stat(uint8_t MD, uint8_t CHST)
{
ADSTAT[0]= 0x04 | ((MD & 0x02)>>1);
ADSTAT[1]= ((MD&0x01)<<7) | 0x68 | (CHST & 0x07);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void LTC6804_ADSTAT_broadcast(void)
{
uint8_t cmd[4];
uint16_t temp_pec;
cmd[0] = ADSTAT[0];
cmd[1] = ADSTAT[1];
temp_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(temp_pec >> 8);
cmd[3] = (uint8_t)(temp_pec);
wakeup_idle ();
output_low(LTC6804_CS);
spi_write_array(4,cmd);
output_high(LTC6804_CS);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
int8_t LTC6804_RDSTAT_address(uint8_t address, char group, uint8_t *data_ext)
{
uint8_t cmd[4];
uint8_t data[NUM_BYTES_IN_REGGROUP+ ADD_PEC];
int8_t pec_error = 0;
uint16_t data_pec;
uint16_t received_pec;
cmd[0] = 0x80 + (address<<3);
if (group=='A')
cmd[1] = 0x10;//RDSTATA
else if (group=='B')
cmd[1] = 0x12;//RDSTATB
data_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(data_pec >> 8);
cmd[3] = (uint8_t)(data_pec);
wakeup_idle ();
output_low(LTC6804_CS);
spi_write_read(cmd, 4, data, NUM_BYTES_IN_REGGROUP+ ADD_PEC);
output_high(LTC6804_CS);
for (uint8_t current_byte=0; current_byte < NUM_BYTES_IN_REGGROUP; current_byte++)
{
data_ext[current_byte] = data[current_byte];
}
//4.b
received_pec = (data[6]<<8) + data[7];
data_pec = pec15_calc(NUM_BYTES_IN_REGGROUP, data_ext);
if(received_pec != data_pec)
{
pec_error = -1;
}
return(pec_error);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void set_adow(uint8_t MD, uint8_t PUP, uint8_t DCP, uint8_t CH)
{
ADOW[0]= 0x02 | ((MD & 0x02)>>1);
ADOW[1]= ((MD&0x01)<<7) | ((PUP&0x01)<<6) | (1<<5) | ( (DCP&0x1)<<4) | (1<<3) | (CH & 0x07);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
void LTC6804_ADOW_address(uint8_t address)
{
uint8_t cmd[4];
uint16_t temp_pec;
//1
cmd[0] = (0x80 + (address<<3)) | ADOW[0];
cmd[1] = ADOW[1];
//2
temp_pec = pec15_calc(2, cmd);
cmd[2] = (uint8_t)(temp_pec >> 8);
cmd[3] = (uint8_t)(temp_pec);
//3
wakeup_idle ();
//4
output_low(LTC6804_CS);
spi_write_array(4,cmd);
output_high(LTC6804_CS);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Generic wakeup commannd to wake isoSPI up out of idle
// IMPORTANT: wake must be before to command to send because the tWAKE-> Core in Stanby
///////////////////////////////////////////////////////////////////////////////////////////////////////////
static void wakeup_idle()
{
output_low(LTC6804_CS);
delayMicroseconds(1); //Guarantees the isoSPI will be in ready mode
output_high(LTC6804_CS);
delayMicroseconds(300);//tWAKE = 300 us Max if core is sleep state
//tREADY = 10 uS
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
// Generic wakeup commannd to wake the LTC6804 from sleep
///////////////////////////////////////////////////////////////////////////////////////////////////////////
static void wakeup_sleep()
{
output_low(LTC6804_CS);
delay(1); // Guarantees the LTC6804 will be in standby
output_high(LTC6804_CS);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//calculates and returns the CRC15
//uint8_t len: the length of the data array being passed to the function
//uint8_t data* : the array of data that the PEC will be generated from
//return The calculated pec15 as an unsigned int16_t
///////////////////////////////////////////////////////////////////////////////////////////////////////////
const uint16_t crc15Table[256] PROGMEM = {0x0,0xc599, 0xceab, 0xb32, 0xd8cf, 0x1d56, 0x1664, 0xd3fd, 0xf407, 0x319e, 0x3aac,
0xff35, 0x2cc8, 0xe951, 0xe263, 0x27fa, 0xad97, 0x680e, 0x633c, 0xa6a5, 0x7558, 0xb0c1,
0xbbf3, 0x7e6a, 0x5990, 0x9c09, 0x973b, 0x52a2, 0x815f, 0x44c6, 0x4ff4, 0x8a6d, 0x5b2e,
0x9eb7, 0x9585, 0x501c, 0x83e1, 0x4678, 0x4d4a, 0x88d3, 0xaf29, 0x6ab0, 0x6182, 0xa41b,
0x77e6, 0xb27f, 0xb94d, 0x7cd4, 0xf6b9, 0x3320, 0x3812, 0xfd8b, 0x2e76, 0xebef, 0xe0dd,
0x2544, 0x2be, 0xc727, 0xcc15, 0x98c, 0xda71, 0x1fe8, 0x14da, 0xd143, 0xf3c5, 0x365c,
0x3d6e, 0xf8f7,0x2b0a, 0xee93, 0xe5a1, 0x2038, 0x7c2, 0xc25b, 0xc969, 0xcf0, 0xdf0d,
0x1a94, 0x11a6, 0xd43f, 0x5e52, 0x9bcb, 0x90f9, 0x5560, 0x869d, 0x4304, 0x4836, 0x8daf,
0xaa55, 0x6fcc, 0x64fe, 0xa167, 0x729a, 0xb703, 0xbc31, 0x79a8, 0xa8eb, 0x6d72, 0x6640,
0xa3d9, 0x7024, 0xb5bd, 0xbe8f, 0x7b16, 0x5cec, 0x9975, 0x9247, 0x57de, 0x8423, 0x41ba,
0x4a88, 0x8f11, 0x57c, 0xc0e5, 0xcbd7, 0xe4e, 0xddb3, 0x182a, 0x1318, 0xd681, 0xf17b,
0x34e2, 0x3fd0, 0xfa49, 0x29b4, 0xec2d, 0xe71f, 0x2286, 0xa213, 0x678a, 0x6cb8, 0xa921,
0x7adc, 0xbf45, 0xb477, 0x71ee, 0x5614, 0x938d, 0x98bf, 0x5d26, 0x8edb, 0x4b42, 0x4070,
0x85e9, 0xf84, 0xca1d, 0xc12f, 0x4b6, 0xd74b, 0x12d2, 0x19e0, 0xdc79, 0xfb83, 0x3e1a, 0x3528,
0xf0b1, 0x234c, 0xe6d5, 0xede7, 0x287e, 0xf93d, 0x3ca4, 0x3796, 0xf20f, 0x21f2, 0xe46b, 0xef59,
0x2ac0, 0xd3a, 0xc8a3, 0xc391, 0x608, 0xd5f5, 0x106c, 0x1b5e, 0xdec7, 0x54aa, 0x9133, 0x9a01,
0x5f98, 0x8c65, 0x49fc, 0x42ce, 0x8757, 0xa0ad, 0x6534, 0x6e06, 0xab9f, 0x7862, 0xbdfb, 0xb6c9,
0x7350, 0x51d6, 0x944f, 0x9f7d, 0x5ae4, 0x8919, 0x4c80, 0x47b2, 0x822b, 0xa5d1, 0x6048, 0x6b7a,
0xaee3, 0x7d1e, 0xb887, 0xb3b5, 0x762c, 0xfc41, 0x39d8, 0x32ea, 0xf773, 0x248e, 0xe117, 0xea25,
0x2fbc, 0x846, 0xcddf, 0xc6ed, 0x374, 0xd089, 0x1510, 0x1e22, 0xdbbb, 0xaf8, 0xcf61, 0xc453,
0x1ca, 0xd237, 0x17ae, 0x1c9c, 0xd905, 0xfeff, 0x3b66, 0x3054, 0xf5cd, 0x2630, 0xe3a9, 0xe89b,
0x2d02, 0xa76f, 0x62f6, 0x69c4, 0xac5d, 0x7fa0, 0xba39, 0xb10b, 0x7492, 0x5368, 0x96f1, 0x9dc3,
0x585a, 0x8ba7, 0x4e3e, 0x450c, 0x8095
};
static uint16_t pec15_calc(uint8_t len, uint8_t *data)
{
uint16_t remainder,addr;
remainder = 16;//initialize the PEC
for(uint8_t i = 0; i<len; i++) // loops for each byte in data array
{
addr = ((remainder>>7)^data[i])&0xff;//calculate PEC table address
remainder = (remainder<<8)^ pgm_read_word_near(&crc15Table[addr]);
}
return(remainder<<1);//return(remainder*2);//The CRC15 has a 0 in the LSB so the remainder must be multiplied by 2
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
static void spi_write_array(uint8_t len, uint8_t *data)
{
for(uint8_t i = 0; i < len; i++)
spi_write(data[i]);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
//uint8_t *tx_Data,//array of data to be written on SPI port
//uint8_t tx_len, //length of the tx data array
//uint8_t *rx_data,//Input: array that will store the data read by the SPI port
//uint8_t rx_len //Option: number of bytes to be read from the SPI port
///////////////////////////////////////////////////////////////////////////////////////////////////////////
static void spi_write_read(uint8_t *tx_Data, uint8_t tx_len, uint8_t *rx_data, uint8_t rx_len )
{
for(uint8_t i = 0; i < tx_len; i++)
spi_write(tx_Data[i]);
for(uint8_t i = 0; i < rx_len; i++)
rx_data[i] = (uint8_t)spi_read(0xFF);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
static void spi_write(uint8_t data)
{
SPDR = data;
while(!(SPSR & (1<<SPIF))) ;
uint8_t dummy = SPDR;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////
static uint8_t spi_read(uint8_t data)
{
SPDR = data;
while(!(SPSR & (1<<SPIF))) ;
return SPDR;
}
| [
"firwar21@gmail.com"
] | firwar21@gmail.com |
f808045910abb4ed2c94ad08dd77dd312b1ba07e | 841b2836af718bd36d7c1c5e1c31b2bd9f616bb4 | /Source/sober/log/Logger.hpp | 57cf61ca3d6e56e800afe6a2a64f9752a18e1a4f | [
"BSD-2-Clause"
] | permissive | abhishek-aurea/OhioLdapPlugin | 9422df42659713f02131a5fe96421933230d5a83 | 7fc6c0d9632a7b9eef719d544ebc00a50afbb21a | refs/heads/master | 2021-10-09T02:03:32.228609 | 2018-12-20T04:03:40 | 2018-12-20T04:03:40 | 104,431,063 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 732 | hpp | #ifndef SOBER_LOG_LOGGER_HPP_
#define SOBER_LOG_LOGGER_HPP_
// Copyright (c) 2014, Ruslan Baratov
// All rights reserved.
#include <leathers/push>
#include <leathers/all>
# include <boost/log/sources/logger.hpp>
# include <sober/log/Severity.fpp>
#include <leathers/pop>
namespace sober {
namespace log {
class Logger {
public:
using Instance = boost::log::sources::logger;
Logger(const char* name, const void* parent);
static void init_logs_for_testing(bool log_to_cout, bool log_cout_verbose);
Instance debug;
Instance info;
Instance error;
private:
void init(Instance&, const char* name, Severity severity, const void* parent);
};
} // namespace log
} // namespace sober
#endif // SOBER_LOG_LOGGER_HPP_
| [
"abhishek.tiwari@aurea.com"
] | abhishek.tiwari@aurea.com |
be4e224dd6bd11af8fd061bbdc07f7d6e9087749 | 6e0b5857bd83ea845f2450a8708ee96ef4e91d9d | /Baikal/SceneGraph/IO/scene_gltf_io.cpp | 409f9af8e47aa8aef7eb6ebd034fca4525f062aa | [
"MIT"
] | permissive | mistajuliax/RadeonProRender-Baikal | 52d2108521b396846c46dcdfef92990e1526dc64 | 7956d798055ac79fcb1d046053b0e9d9a4f80e8f | refs/heads/master | 2022-07-06T04:23:00.089097 | 2018-03-19T15:51:41 | 2018-03-19T15:51:41 | 126,146,044 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,421 | cpp |
#include "Baikal/SceneGraph/IO/scene_io.h"
#ifdef ENABLE_GLTF
#include <cassert>
#include <iostream>
#include "FreeImage.h"
#include "Baikal/SceneGraph/IO/image_io.h"
#include "Baikal/SceneGraph/scene1.h"
#include "Baikal/SceneGraph/light.h"
#include "RadeonProRender.h"
#include "RprSupport.h"
#include "ProRenderGLTF.h"
#include "Rpr/Export.h"
using namespace Baikal;
namespace Baikal
{
// glTF scene loader
class SceneGltfIo : public SceneIo
{
public:
// Load scene from file
virtual Scene1::Ptr LoadScene(std::string const& filename, std::string const& basepath) const override;
private:
};
Scene1::Ptr SceneGltfIo::LoadScene(std::string const& filename, std::string const& basepath) const
{
rpr_context context = nullptr;
rprx_context uber_context = nullptr;
rpr_material_system sys = nullptr;
rpr_scene scene = nullptr;
auto res = rprCreateContext(RPR_API_VERSION, nullptr, 0, RPR_CREATION_FLAGS_ENABLE_GPU0, nullptr, nullptr, &context);
res = rprContextCreateMaterialSystem(context, NULL, &sys);
res = rprxCreateContext(sys, 0, &uber_context);
if (!rprImportFromGLTF(filename.c_str(), context, sys, uber_context, &scene))
{
throw std::runtime_error("Failed to load GLTF scene:" + filename + "\n");
}
Baikal::Scene1::Ptr baikal_scene = ExportFromRpr(scene);
if (baikal_scene->GetNumLights() == 0)
{
auto image_io(ImageIo::CreateImageIo());
// TODO: temporary code, add IBL
auto ibl_texture = image_io->LoadImage("../Resources/Textures/studio015.hdr");
auto ibl = ImageBasedLight::Create();
ibl->SetTexture(ibl_texture);
ibl->SetMultiplier(1.f);
// TODO: temporary code to add directional light
auto light = SpotLight::Create();
light->SetPosition({ 0.f, 5.f, 3.f });
light->SetDirection(RadeonRays::normalize(RadeonRays::float3(0.f, -1.f, 0.f)));
light->SetEmittedRadiance(300.f * RadeonRays::float3(1.f, 0.95f, 0.92f));
auto light1 = DirectionalLight::Create();
light1->SetDirection(RadeonRays::float3(0.3f, -1.f, -0.5f));
light1->SetEmittedRadiance(RadeonRays::float3(1.f, 0.8f, 0.65f));
auto point_light = PointLight::Create();
point_light->SetPosition({ 0.f, 2.f, 3.f });
point_light->SetDirection(RadeonRays::float3(0.3f, -1.f, -0.5f));
point_light->SetEmittedRadiance(RadeonRays::float3(10.f, 10.8f, 10.65f));
baikal_scene->AttachLight(ibl);
//baikal_scene->AttachLight(light);
//baikal_scene->AttachLight(light1);
//baikal_scene->AttachLight(point_light);
}
rprxDeleteContext(uber_context);
rprObjectDelete(scene);
rprObjectDelete(sys);
rprObjectDelete(context);
return baikal_scene;
}
std::unique_ptr<Baikal::SceneIo> SceneIo::CreateSceneIoGltf()
{
return std::unique_ptr<Baikal::SceneIo>(new SceneGltfIo());
}
} //Baikal
#else
namespace Baikal
{
std::unique_ptr<SceneIo> SceneIo::CreateSceneIoGltf()
{
throw std::runtime_error("GLTF support is disabled. Please build with --gltf premake option.\n");
return nullptr;
}
}
#endif //ENABLE_GLTF
| [
"konstantin.zverev@developex.org"
] | konstantin.zverev@developex.org |
e062033c18a6a1092d1e6e124a5b0e27b9123749 | e99b7caf1386ca79203e45af8726c60c3190d633 | /source/entities/enemy.h | bef2e394bb3e55ce39bb718bf962aff66bf31581 | [] | no_license | MarcosX/sdl_app | 184ec8aa3d54a8211a1390cc2083c7e11445655d | 7a106ea819cea6d11f229c2007afdb9cc5b7327a | refs/heads/master | 2021-01-02T22:17:57.674676 | 2013-03-02T18:13:26 | 2013-03-02T18:13:26 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 233 | h | #ifndef _ENEMY_H_
#define _ENEMY_H_
#include "game_entity.h"
#include "../states/enemy_walking.h"
class Enemy: public GameEntity {
public:
Enemy();
void loop();
void render(SDL_Surface* display);
void cleanUp();
};
#endif
| [
"marcos.uece.comp@gmail.com"
] | marcos.uece.comp@gmail.com |
58fe03fc01e597fe6c46235471d7fc645e27dc5d | 8063aa86d9a80321e7e8c0e76ab9675338bdf8aa | /Source/Hexagon/Mobs/ShootingEnemy.h | 41c64bdf768009daac6fc09ec3247c6770b355be | [] | no_license | Michael-Christie/Project-Hexagon | f0a4224ad339ba24f8ad084035b3bf55892429a6 | 26741d71233da1a4865a0c4f8bc408655ed64606 | refs/heads/master | 2022-12-11T03:26:54.754904 | 2020-09-08T15:27:17 | 2020-09-08T15:27:17 | 288,165,729 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,331 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "../Interfaces/Damageable.h"
#include "ShootingEnemy.generated.h"
UCLASS()
class HEXAGON_API AShootingEnemy : public ACharacter, public IDamageable
{
GENERATED_BODY()
public:
// Sets default values for this character's properties
AShootingEnemy();
float EnemyHealth = 50;
bool canShoot = true;
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
void HitDamage(float amount) override;
UFUNCTION()
void OnOverlapBegin(UPrimitiveComponent * overlappingComponent, AActor * otherActor, UPrimitiveComponent * otherComp, int32 otherBodyIndex, bool bFromSweep, const FHitResult & sweepResult);
UFUNCTION()
void OnPawnSeen(APawn* seenPawn);
FTimerHandle TimerHandle_ResetShooting;
void ResetShooting();
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
UPROPERTY(EditAnywhere, Category = AI)
class UPawnSensingComponent* PawnSense;
UPROPERTY(EditDefaultsOnly, Category = Projectile)
TSubclassOf<class AProjectile> ProjectileClass;
};
| [
"michaelchristie26@gmail.com"
] | michaelchristie26@gmail.com |
f3043385615a6ae9504007f10babdfd8853306bc | 2d5270c2d390f0a245aabc02eb1c32265bc9ac5d | /apollo-src/modules/control/common/pid_controller.cc | 926e1271a5d88d8e41cb397d9f716d09d23af8bf | [
"Apache-2.0"
] | permissive | qwetqwe/apollo_note | a1035a2137f9224dccf31a9dcc5fbfe7d6850580 | 248a25bb22e33f3396f155591d1af4edc13c1fa7 | refs/heads/master | 2022-06-03T20:06:47.171191 | 2022-05-18T06:17:31 | 2022-05-18T06:17:31 | 176,864,392 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 2,737 | cc | /******************************************************************************
* Copyright 2017 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.
*****************************************************************************/
#include "modules/control/common/pid_controller.h"
#include <cmath>
#include "modules/common/log.h"
namespace apollo {
namespace control {
double PIDController::Control(const double error, const double dt) {
if (dt <= 0) {
AWARN << "dt <= 0, will use the last output";
return previous_output_;
}
double diff = 0;
double output = 0;
if (first_hit_) {
first_hit_ = false;
} else {
diff = (error - previous_error_) / dt;
}
// integral handling
if (!integrator_enabled_) {
integral_ = 0;
} else if (!integrator_hold_) {
integral_ += error * dt * ki_;
// apply Ki before integrating to avoid steps when change Ki at steady state
if (integral_ > saturation_high_) {
integral_ = saturation_high_;
saturation_status_ = 1;
} else if (integral_ < saturation_low_) {
integral_ = saturation_low_;
saturation_status_ = -1;
} else {
saturation_status_ = 0;
}
}
previous_error_ = error;
output = error * kp_ + integral_ + diff * kd_; // Ki already applied
previous_output_ = output;
return output;
}
void PIDController::Reset() {
previous_error_ = 0.0;
previous_output_ = 0.0;
integral_ = 0.0;
first_hit_ = true;
}
void PIDController::Init(const PidConf &pid_conf) {
previous_error_ = 0.0;
previous_output_ = 0.0;
integral_ = 0.0;
first_hit_ = true;
integrator_enabled_ = pid_conf.integrator_enable();
saturation_high_ = std::fabs(pid_conf.integrator_saturation_level());
saturation_low_ = -std::fabs(pid_conf.integrator_saturation_level());
saturation_status_ = 0;
integrator_hold_ = false;
SetPID(pid_conf);
}
void PIDController::SetPID(const PidConf &pid_conf) {
kp_ = pid_conf.kp();
ki_ = pid_conf.ki();
kd_ = pid_conf.kd();
}
int PIDController::saturation_status() const { return saturation_status_; }
bool PIDController::integrator_hold() const { return integrator_hold_; }
} // namespace control
} // namespace apollo
| [
"slamcode@foxmail.com"
] | slamcode@foxmail.com |
c95f6f95d6c2809005eb69d678cded9d64e51837 | 0f209e19caa4d0c475e1e0802b2b075a3491fa36 | /gui/QT/settings_window.hpp | 834524c2e5023686de919305ec38b4806ba61433 | [
"OpenSSL",
"BSD-3-Clause"
] | permissive | anhlt309/UltraGrid | ab136fa3f4e4f408287984a8d4b0692530341124 | 9d75e70c0470c0d8771bdd299d0b648426736481 | refs/heads/master | 2020-04-23T02:00:55.229413 | 2019-02-13T08:50:09 | 2019-02-14T12:19:57 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 374 | hpp | #ifndef SETTINGS_WINDOW
#define SETTINGS_WINDOW
#include <QString>
#include "ui_settings.h"
class SettingsWindow : public QDialog{
Q_OBJECT
public:
SettingsWindow(QWidget *parent = 0);
QString getVideoPort() const;
QString getAudioPort() const;
bool isDefault() const;
QString getPortArgs() const;
signals:
void changed();
private:
Ui::Settings ui;
};
#endif
| [
"445597@mail.muni.cz"
] | 445597@mail.muni.cz |
934c51571084e455b2e0541206fbbb8af12b15d1 | 96681d233d1c91d677c0364bcf30491f87fec929 | /Codeforces/Little Artem.cpp | 811d53eb38df592be1cf05329d08d1c8e7071131 | [] | no_license | CarlosSalazar84/Solutions-Competitive-Programming- | 533669028b0838f977b46e252463948ee16e4082 | 5ef1f736a60eb481a5392a0245970fa112677ba4 | refs/heads/main | 2022-12-31T19:50:45.688585 | 2020-10-16T01:56:43 | 2020-10-16T01:56:43 | 304,451,401 | 0 | 0 | null | 2020-10-16T01:56:44 | 2020-10-15T21:24:38 | C++ | UTF-8 | C++ | false | false | 1,148 | cpp | #include <bits/stdc++.h>
using namespace std;
#define fastIO ios::sync_with_stdio(0), cin.tie(0)
#define endl '\n'
int main() {
int t;
cin >> t;
for(int i=0;i<t;i++){
int n,m;
cin >> n >> m;
char matriz[n][m];
for(int j=0;j<n;j++){
for(int k=0;k<m;k++){
matriz[j][k]='B';
}
}
if(n==2){
for(int j=0;j<n;j++){
for(int k=0;k<m-1;k++){
if(j%2==0 && k%2==0) matriz[k][j]='W';
if(j%2==1 && k%2==1) matriz[k][j]='W';
}
}
}else if(m==2){
for(int j=0;j<m;j++){
for(int k=0;k<n-1;k++){
if(j%2==0 && k%2==1) matriz[k][j]='W';
if(j%2==1 && k%2==0) matriz[k][j]='W';
}
}
}else{
matriz[0][0]='W';
matriz[1][0]='W';
matriz[1][1]='W';
}
for(int j=0;j<n;j++){
for(int k=0;k<m;k++){
cout << matriz[j][k];
}
cout << endl;
}
}
return 0;
}
| [
"carlos.al.sa.me2002@gmail.com"
] | carlos.al.sa.me2002@gmail.com |
b4941ab4591602fe047d9d5d0a4bccd738a4befd | dd80a584130ef1a0333429ba76c1cee0eb40df73 | /external/chromium_org/ppapi/proxy/ppb_image_data_proxy.cc | c9d61f9feae039505b9121dab1244f5f567e2925 | [
"BSD-3-Clause",
"MIT",
"LicenseRef-scancode-khronos"
] | permissive | karunmatharu/Android-4.4-Pay-by-Data | 466f4e169ede13c5835424c78e8c30ce58f885c1 | fcb778e92d4aad525ef7a995660580f948d40bc9 | refs/heads/master | 2021-03-24T13:33:01.721868 | 2017-02-18T17:48:49 | 2017-02-18T17:48:49 | 81,847,777 | 0 | 2 | MIT | 2020-03-09T00:02:12 | 2017-02-13T16:47:00 | null | UTF-8 | C++ | false | false | 23,345 | cc | // 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.
#include "ppapi/proxy/ppb_image_data_proxy.h"
#include <string.h> // For memcpy
#include <map>
#include <vector>
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "ppapi/c/pp_completion_callback.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/pp_resource.h"
#include "ppapi/proxy/enter_proxy.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "ppapi/proxy/plugin_dispatcher.h"
#include "ppapi/proxy/plugin_globals.h"
#include "ppapi/proxy/plugin_resource_tracker.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/shared_impl/host_resource.h"
#include "ppapi/shared_impl/proxy_lock.h"
#include "ppapi/shared_impl/resource.h"
#include "ppapi/shared_impl/scoped_pp_resource.h"
#include "ppapi/thunk/enter.h"
#include "ppapi/thunk/thunk.h"
#if !defined(OS_NACL)
#include "skia/ext/platform_canvas.h"
#include "ui/surface/transport_dib.h"
#endif
using ppapi::thunk::PPB_ImageData_API;
namespace ppapi {
namespace proxy {
namespace {
// How ImageData re-use works
// --------------------------
//
// When animating plugins (like video), re-creating image datas for each frame
// and mapping the memory has a high overhead. So we try to re-use these when
// possible.
//
// 1. Plugin makes an asynchronous call that transfers an ImageData to the
// implementation of some API.
// 2. Plugin frees its ImageData reference. If it doesn't do this we can't
// re-use it.
// 3. When the last plugin ref of an ImageData is released, we don't actually
// delete it. Instead we put it on a queue where we hold onto it in the
// plugin process for a short period of time.
// 4. The API implementation that received the ImageData finishes using it.
// Without our caching system it would get deleted at this point.
// 5. The proxy in the renderer will send NotifyUnusedImageData back to the
// plugin process. We check if the given resource is in the queue and mark
// it as usable.
// 6. When the plugin requests a new image data, we check our queue and if there
// is a usable ImageData of the right size and format, we'll return it
// instead of making a new one. It's important that caching is only requested
// when the size is unlikely to change, so cache hits are high.
//
// Some notes:
//
// - We only re-use image data when the plugin and host are rapidly exchanging
// them and the size is likely to remain constant. It should be clear that
// the plugin is promising that it's done with the image.
//
// - Theoretically we could re-use them in other cases but the lifetime
// becomes more difficult to manage. The plugin could have used an ImageData
// in an arbitrary number of queued up PaintImageData calls which we would
// have to check.
//
// - If a flush takes a long time or there are many released image datas
// accumulating in our queue such that some are deleted, we will have
// released our reference by the time the renderer notifies us of an unused
// image data. In this case we just give up.
//
// - We maintain a per-instance cache. Some pages have many instances of
// Flash, for example, each of a different size. If they're all animating we
// want each to get its own image data re-use.
//
// - We generate new resource IDs when re-use happens to try to avoid weird
// problems if the plugin messes up its refcounting.
// Keep a cache entry for this many seconds before expiring it. We get an entry
// back from the renderer after an ImageData is swapped out, so it means the
// plugin has to be painting at least two frames for this time interval to
// get caching.
static const int kMaxAgeSeconds = 2;
// ImageDataCacheEntry ---------------------------------------------------------
struct ImageDataCacheEntry {
ImageDataCacheEntry() : added_time(), usable(false), image() {}
ImageDataCacheEntry(ImageData* i)
: added_time(base::TimeTicks::Now()),
usable(false),
image(i) {
}
base::TimeTicks added_time;
// Set to true when the renderer tells us that it's OK to re-use this iamge.
bool usable;
scoped_refptr<ImageData> image;
};
// ImageDataInstanceCache ------------------------------------------------------
// Per-instance cache of image datas.
class ImageDataInstanceCache {
public:
ImageDataInstanceCache() : next_insertion_point_(0) {}
// These functions have the same spec as the ones in ImageDataCache.
scoped_refptr<ImageData> Get(PPB_ImageData_Shared::ImageDataType type,
int width, int height,
PP_ImageDataFormat format);
void Add(ImageData* image_data);
void ImageDataUsable(ImageData* image_data);
// Expires old entries. Returns true if there are still entries in the list,
// false if this instance cache is now empty.
bool ExpireEntries();
private:
void IncrementInsertionPoint();
// We'll store this many ImageDatas per instance.
const static int kCacheSize = 2;
ImageDataCacheEntry images_[kCacheSize];
// Index into cache where the next item will go.
int next_insertion_point_;
};
scoped_refptr<ImageData> ImageDataInstanceCache::Get(
PPB_ImageData_Shared::ImageDataType type,
int width, int height,
PP_ImageDataFormat format) {
// Just do a brute-force search since the cache is so small.
for (int i = 0; i < kCacheSize; i++) {
if (!images_[i].usable)
continue;
if (images_[i].image->type() != type)
continue;
const PP_ImageDataDesc& desc = images_[i].image->desc();
if (desc.format == format &&
desc.size.width == width && desc.size.height == height) {
scoped_refptr<ImageData> ret(images_[i].image);
images_[i] = ImageDataCacheEntry();
// Since we just removed an item, this entry is the best place to insert
// a subsequent one.
next_insertion_point_ = i;
return ret;
}
}
return scoped_refptr<ImageData>();
}
void ImageDataInstanceCache::Add(ImageData* image_data) {
images_[next_insertion_point_] = ImageDataCacheEntry(image_data);
IncrementInsertionPoint();
}
void ImageDataInstanceCache::ImageDataUsable(ImageData* image_data) {
for (int i = 0; i < kCacheSize; i++) {
if (images_[i].image.get() == image_data) {
images_[i].usable = true;
// This test is important. The renderer doesn't guarantee how many image
// datas it has or when it notifies us when one is usable. Its possible
// to get into situations where it's always telling us the old one is
// usable, and then the older one immediately gets expired. Therefore,
// if the next insertion would overwrite this now-usable entry, make the
// next insertion overwrite some other entry to avoid the replacement.
if (next_insertion_point_ == i)
IncrementInsertionPoint();
return;
}
}
}
bool ImageDataInstanceCache::ExpireEntries() {
base::TimeTicks threshold_time =
base::TimeTicks::Now() - base::TimeDelta::FromSeconds(kMaxAgeSeconds);
bool has_entry = false;
for (int i = 0; i < kCacheSize; i++) {
if (images_[i].image.get()) {
// Entry present.
if (images_[i].added_time <= threshold_time) {
// Found an entry to expire.
images_[i] = ImageDataCacheEntry();
next_insertion_point_ = i;
} else {
// Found an entry that we're keeping.
has_entry = true;
}
}
}
return has_entry;
}
void ImageDataInstanceCache::IncrementInsertionPoint() {
// Go to the next location, wrapping around to get LRU.
next_insertion_point_++;
if (next_insertion_point_ >= kCacheSize)
next_insertion_point_ = 0;
}
// ImageDataCache --------------------------------------------------------------
class ImageDataCache {
public:
ImageDataCache() : weak_factory_(this) {}
~ImageDataCache() {}
static ImageDataCache* GetInstance();
// Retrieves an image data from the cache of the specified type, size and
// format if one exists. If one doesn't exist, this will return a null refptr.
scoped_refptr<ImageData> Get(PP_Instance instance,
PPB_ImageData_Shared::ImageDataType type,
int width, int height,
PP_ImageDataFormat format);
// Adds the given image data to the cache. There should be no plugin
// references to it. This may delete an older item from the cache.
void Add(ImageData* image_data);
// Notification from the renderer that the given image data is usable.
void ImageDataUsable(ImageData* image_data);
void DidDeleteInstance(PP_Instance instance);
private:
friend struct LeakySingletonTraits<ImageDataCache>;
// Timer callback to expire entries for the given instance.
void OnTimer(PP_Instance instance);
typedef std::map<PP_Instance, ImageDataInstanceCache> CacheMap;
CacheMap cache_;
// This class does timer calls and we don't want to run these outside of the
// scope of the object. Technically, since this class is a leaked static,
// this will never happen and this factory is unnecessary. However, it's
// probably better not to make assumptions about the lifetime of this class.
base::WeakPtrFactory<ImageDataCache> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ImageDataCache);
};
// static
ImageDataCache* ImageDataCache::GetInstance() {
return Singleton<ImageDataCache,
LeakySingletonTraits<ImageDataCache> >::get();
}
scoped_refptr<ImageData> ImageDataCache::Get(
PP_Instance instance,
PPB_ImageData_Shared::ImageDataType type,
int width, int height,
PP_ImageDataFormat format) {
CacheMap::iterator found = cache_.find(instance);
if (found == cache_.end())
return scoped_refptr<ImageData>();
return found->second.Get(type, width, height, format);
}
void ImageDataCache::Add(ImageData* image_data) {
cache_[image_data->pp_instance()].Add(image_data);
// Schedule a timer to invalidate this entry.
base::MessageLoop::current()->PostDelayedTask(
FROM_HERE,
RunWhileLocked(base::Bind(&ImageDataCache::OnTimer,
weak_factory_.GetWeakPtr(),
image_data->pp_instance())),
base::TimeDelta::FromSeconds(kMaxAgeSeconds));
}
void ImageDataCache::ImageDataUsable(ImageData* image_data) {
CacheMap::iterator found = cache_.find(image_data->pp_instance());
if (found != cache_.end())
found->second.ImageDataUsable(image_data);
}
void ImageDataCache::DidDeleteInstance(PP_Instance instance) {
cache_.erase(instance);
}
void ImageDataCache::OnTimer(PP_Instance instance) {
CacheMap::iterator found = cache_.find(instance);
if (found == cache_.end())
return;
if (!found->second.ExpireEntries()) {
// There are no more entries for this instance, remove it from the cache.
cache_.erase(found);
}
}
} // namespace
// ImageData -------------------------------------------------------------------
ImageData::ImageData(const HostResource& resource,
PPB_ImageData_Shared::ImageDataType type,
const PP_ImageDataDesc& desc)
: Resource(OBJECT_IS_PROXY, resource),
type_(type),
desc_(desc),
is_candidate_for_reuse_(false) {
}
ImageData::~ImageData() {
}
PPB_ImageData_API* ImageData::AsPPB_ImageData_API() {
return this;
}
void ImageData::LastPluginRefWasDeleted() {
// The plugin no longer needs this ImageData, add it to our cache if it's
// been used in a ReplaceContents. These are the ImageDatas that the renderer
// will send back ImageDataUsable messages for.
if (is_candidate_for_reuse_)
ImageDataCache::GetInstance()->Add(this);
}
void ImageData::InstanceWasDeleted() {
ImageDataCache::GetInstance()->DidDeleteInstance(pp_instance());
}
PP_Bool ImageData::Describe(PP_ImageDataDesc* desc) {
memcpy(desc, &desc_, sizeof(PP_ImageDataDesc));
return PP_TRUE;
}
int32_t ImageData::GetSharedMemory(int* /* handle */,
uint32_t* /* byte_count */) {
// Not supported in the proxy (this method is for actually implementing the
// proxy in the host).
return PP_ERROR_NOACCESS;
}
void ImageData::SetIsCandidateForReuse() {
is_candidate_for_reuse_ = true;
}
void ImageData::RecycleToPlugin(bool zero_contents) {
is_candidate_for_reuse_ = false;
if (zero_contents) {
void* data = Map();
memset(data, 0, desc_.stride * desc_.size.height);
Unmap();
}
}
// PlatformImageData -----------------------------------------------------------
#if !defined(OS_NACL)
PlatformImageData::PlatformImageData(const HostResource& resource,
const PP_ImageDataDesc& desc,
ImageHandle handle)
: ImageData(resource, PPB_ImageData_Shared::PLATFORM, desc) {
#if defined(OS_WIN)
transport_dib_.reset(TransportDIB::CreateWithHandle(handle));
#else
transport_dib_.reset(TransportDIB::Map(handle));
#endif // defined(OS_WIN)
}
PlatformImageData::~PlatformImageData() {
}
void* PlatformImageData::Map() {
if (!mapped_canvas_.get()) {
mapped_canvas_.reset(transport_dib_->GetPlatformCanvas(desc_.size.width,
desc_.size.height));
if (!mapped_canvas_.get())
return NULL;
}
const SkBitmap& bitmap =
skia::GetTopDevice(*mapped_canvas_)->accessBitmap(true);
bitmap.lockPixels();
return bitmap.getAddr(0, 0);
}
void PlatformImageData::Unmap() {
// TODO(brettw) have a way to unmap a TransportDIB. Currently this isn't
// possible since deleting the TransportDIB also frees all the handles.
// We need to add a method to TransportDIB to release the handles.
}
SkCanvas* PlatformImageData::GetPlatformCanvas() {
return mapped_canvas_.get();
}
SkCanvas* PlatformImageData::GetCanvas() {
return mapped_canvas_.get();
}
// static
ImageHandle PlatformImageData::NullHandle() {
#if defined(OS_WIN)
return NULL;
#elif defined(TOOLKIT_GTK)
return 0;
#else
return ImageHandle();
#endif
}
ImageHandle PlatformImageData::HandleFromInt(int32_t i) {
#if defined(OS_WIN)
return reinterpret_cast<ImageHandle>(i);
#elif defined(TOOLKIT_GTK)
return static_cast<ImageHandle>(i);
#else
return ImageHandle(i, false);
#endif
}
#endif // !defined(OS_NACL)
// SimpleImageData -------------------------------------------------------------
SimpleImageData::SimpleImageData(const HostResource& resource,
const PP_ImageDataDesc& desc,
const base::SharedMemoryHandle& handle)
: ImageData(resource, PPB_ImageData_Shared::SIMPLE, desc),
shm_(handle, false /* read_only */),
size_(desc.size.width * desc.size.height * 4),
map_count_(0) {
}
SimpleImageData::~SimpleImageData() {
}
void* SimpleImageData::Map() {
if (map_count_++ == 0)
shm_.Map(size_);
return shm_.memory();
}
void SimpleImageData::Unmap() {
if (--map_count_ == 0)
shm_.Unmap();
}
SkCanvas* SimpleImageData::GetPlatformCanvas() {
return NULL; // No canvas available.
}
SkCanvas* SimpleImageData::GetCanvas() {
return NULL; // No canvas available.
}
// PPB_ImageData_Proxy ---------------------------------------------------------
PPB_ImageData_Proxy::PPB_ImageData_Proxy(Dispatcher* dispatcher)
: InterfaceProxy(dispatcher) {
}
PPB_ImageData_Proxy::~PPB_ImageData_Proxy() {
}
// static
PP_Resource PPB_ImageData_Proxy::CreateProxyResource(
PP_Instance instance,
PPB_ImageData_Shared::ImageDataType type,
PP_ImageDataFormat format,
const PP_Size& size,
PP_Bool init_to_zero) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance);
if (!dispatcher)
return 0;
// Check the cache.
scoped_refptr<ImageData> cached_image_data =
ImageDataCache::GetInstance()->Get(instance, type,
size.width, size.height, format);
if (cached_image_data.get()) {
// We have one we can re-use rather than allocating a new one.
cached_image_data->RecycleToPlugin(PP_ToBool(init_to_zero));
return cached_image_data->GetReference();
}
HostResource result;
PP_ImageDataDesc desc;
switch (type) {
case PPB_ImageData_Shared::SIMPLE: {
ppapi::proxy::SerializedHandle image_handle_wrapper;
dispatcher->Send(new PpapiHostMsg_PPBImageData_CreateSimple(
kApiID, instance, format, size, init_to_zero,
&result, &desc, &image_handle_wrapper));
if (image_handle_wrapper.is_shmem()) {
base::SharedMemoryHandle image_handle = image_handle_wrapper.shmem();
if (!result.is_null())
return
(new SimpleImageData(result, desc, image_handle))->GetReference();
}
break;
}
case PPB_ImageData_Shared::PLATFORM: {
#if !defined(OS_NACL)
ImageHandle image_handle = PlatformImageData::NullHandle();
dispatcher->Send(new PpapiHostMsg_PPBImageData_CreatePlatform(
kApiID, instance, format, size, init_to_zero,
&result, &desc, &image_handle));
if (!result.is_null())
return
(new PlatformImageData(result, desc, image_handle))->GetReference();
#else
// PlatformImageData shouldn't be created in untrusted code.
NOTREACHED();
#endif
break;
}
}
return 0;
}
bool PPB_ImageData_Proxy::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PPB_ImageData_Proxy, msg)
#if !defined(OS_NACL)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_CreatePlatform,
OnHostMsgCreatePlatform)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBImageData_CreateSimple,
OnHostMsgCreateSimple)
#endif
IPC_MESSAGE_HANDLER(PpapiMsg_PPBImageData_NotifyUnusedImageData,
OnPluginMsgNotifyUnusedImageData)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
#if !defined(OS_NACL)
// static
PP_Resource PPB_ImageData_Proxy::CreateImageData(
PP_Instance instance,
PPB_ImageData_Shared::ImageDataType type,
PP_ImageDataFormat format,
const PP_Size& size,
bool init_to_zero,
PP_ImageDataDesc* desc,
IPC::PlatformFileForTransit* image_handle,
uint32_t* byte_count) {
HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
if (!dispatcher)
return 0;
thunk::EnterResourceCreation enter(instance);
if (enter.failed())
return 0;
PP_Bool pp_init_to_zero = init_to_zero ? PP_TRUE : PP_FALSE;
PP_Resource pp_resource = 0;
switch (type) {
case PPB_ImageData_Shared::SIMPLE: {
pp_resource = enter.functions()->CreateImageDataSimple(
instance, format, &size, pp_init_to_zero);
break;
}
case PPB_ImageData_Shared::PLATFORM: {
pp_resource = enter.functions()->CreateImageData(
instance, format, &size, pp_init_to_zero);
break;
}
}
if (!pp_resource)
return 0;
ppapi::ScopedPPResource resource(ppapi::ScopedPPResource::PassRef(),
pp_resource);
thunk::EnterResourceNoLock<PPB_ImageData_API> enter_resource(resource.get(),
false);
if (enter_resource.object()->Describe(desc) != PP_TRUE) {
DVLOG(1) << "CreateImageData failed: could not Describe";
return 0;
}
int local_fd = 0;
if (enter_resource.object()->GetSharedMemory(&local_fd,
byte_count) != PP_OK) {
DVLOG(1) << "CreateImageData failed: could not GetSharedMemory";
return 0;
}
#if defined(OS_WIN)
*image_handle = dispatcher->ShareHandleWithRemote(
reinterpret_cast<HANDLE>(static_cast<intptr_t>(local_fd)), false);
#elif defined(TOOLKIT_GTK)
// On X Windows, a PlatformImageData is backed by a SysV shared memory key,
// so embed that in a fake PlatformFileForTransit and don't share it across
// processes.
if (type == PPB_ImageData_Shared::PLATFORM)
*image_handle = IPC::PlatformFileForTransit(local_fd, false);
else
*image_handle = dispatcher->ShareHandleWithRemote(local_fd, false);
#elif defined(OS_POSIX)
*image_handle = dispatcher->ShareHandleWithRemote(local_fd, false);
#else
#error Not implemented.
#endif
return resource.Release();
}
void PPB_ImageData_Proxy::OnHostMsgCreatePlatform(
PP_Instance instance,
int32_t format,
const PP_Size& size,
PP_Bool init_to_zero,
HostResource* result,
PP_ImageDataDesc* desc,
ImageHandle* result_image_handle) {
IPC::PlatformFileForTransit image_handle;
uint32_t byte_count;
PP_Resource resource =
CreateImageData(instance,
PPB_ImageData_Shared::PLATFORM,
static_cast<PP_ImageDataFormat>(format),
size,
true /* init_to_zero */,
desc, &image_handle, &byte_count);
result->SetHostResource(instance, resource);
if (resource) {
#if defined(TOOLKIT_GTK)
// On X Windows ImageHandle is a SysV shared memory key.
*result_image_handle = image_handle.fd;
#else
*result_image_handle = image_handle;
#endif
} else {
*result_image_handle = PlatformImageData::NullHandle();
}
}
void PPB_ImageData_Proxy::OnHostMsgCreateSimple(
PP_Instance instance,
int32_t format,
const PP_Size& size,
PP_Bool init_to_zero,
HostResource* result,
PP_ImageDataDesc* desc,
ppapi::proxy::SerializedHandle* result_image_handle) {
IPC::PlatformFileForTransit image_handle;
uint32_t byte_count;
PP_Resource resource =
CreateImageData(instance,
PPB_ImageData_Shared::SIMPLE,
static_cast<PP_ImageDataFormat>(format),
size,
true /* init_to_zero */,
desc, &image_handle, &byte_count);
result->SetHostResource(instance, resource);
if (resource) {
result_image_handle->set_shmem(image_handle, byte_count);
} else {
result_image_handle->set_null_shmem();
}
}
#endif // !defined(OS_NACL)
void PPB_ImageData_Proxy::OnPluginMsgNotifyUnusedImageData(
const HostResource& old_image_data) {
PluginGlobals* plugin_globals = PluginGlobals::Get();
if (!plugin_globals)
return; // This may happen if the plugin is maliciously sending this
// message to the renderer.
EnterPluginFromHostResource<PPB_ImageData_API> enter(old_image_data);
if (enter.succeeded()) {
ImageData* image_data = static_cast<ImageData*>(enter.object());
ImageDataCache::GetInstance()->ImageDataUsable(image_data);
}
// The renderer sent us a reference with the message. If the image data was
// still cached in our process, the proxy still holds a reference so we can
// remove the one the renderer just sent is. If the proxy no longer holds a
// reference, we released everything and we should also release the one the
// renderer just sent us.
dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
API_ID_PPB_CORE, old_image_data));
}
} // namespace proxy
} // namespace ppapi
| [
"karun.matharu@gmail.com"
] | karun.matharu@gmail.com |
ac11e6e535681bbbc717db0145d85308dadd5e67 | bc17b47315bf09081b0aefcf46d5113c31f24a33 | /12468.cpp | deaf1886f3f3c6475afad914055b6ab21bf9db56 | [] | no_license | IshanX111/UVA_Problem_Solution | ece9b4d45c56c613bd8b786424060d183946b7bf | 9f4e15e1210400d62192915e476c8741ecbce1da | refs/heads/master | 2023-05-12T08:27:34.384826 | 2023-05-01T18:28:25 | 2023-05-01T18:28:25 | 231,390,534 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 495 | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int i,f,res,d;
for(;;){
cin>>i>>f;
if(i==-1 &&f==-1){
break;
}
if(i<f){
d=f-i;
if(d>=50){
d=100-d;
}
printf("%d\n",d);
}
if(f<i){
d=i-f;
if(d>=50){
d=100-d;
}
printf("%d\n",d);
}
}
}
| [
"noreply@github.com"
] | IshanX111.noreply@github.com |
88ecda2a0f6366ba618967ac10c952b0b07d601f | c3903103e3d78b835fe5ddf64eb9618a06b458f3 | /13.Dynamic-programming/MaximumValueContiguousSubsequence.cpp | b60b5e09968c6a369d5a8c41fc55baf2dd120479 | [] | no_license | Cquential/Data-Structures-and-Algorithms | 3e1f6202eb30b1d4966ea20de7f1cbdd36093e0d | a43254d1704de140bf77cad62d7768197e458639 | refs/heads/master | 2020-05-22T14:08:55.333805 | 2019-10-15T10:56:44 | 2019-10-15T10:56:44 | 186,378,378 | 0 | 2 | null | 2019-10-23T07:45:31 | 2019-05-13T08:32:35 | C | UTF-8 | C++ | false | false | 360 | cpp | /* Amit Bansal - @amitbansal7 */
#include <bits/stdc++.h>
using namespace std;
int main()
{
int A[] = { -2, -3, 4, -1, -2, 1, 5, -3};
int n = sizeof(A) / sizeof(A[0]);
int msf = A[0];
int cmax = A[0];
for (int i = 1; i < n; i++)
{
cmax = max(cmax + A[i], A[i]);
msf = max(cmax, msf);
}
printf("Maximum contiguous sequence sum is %d\n",msf);
}
| [
"007amitbansal@gmail.com"
] | 007amitbansal@gmail.com |
18919647e32027ed7cebcc9934c0e805a0179322 | 22729f0eb84230e5becbca11fb86707f61f81516 | /examples/ar-basic/rs-ar-basic.cpp | b81e371205c8a3beaeb14b507ad73f31a06c08a1 | [
"GPL-1.0-or-later",
"OFL-1.1",
"GPL-2.0-only",
"GPL-3.0-only",
"BSL-1.0",
"MIT",
"Apache-2.0",
"LGPL-2.1-only",
"LicenseRef-scancode-public-domain",
"Zlib",
"BSD-2-Clause",
"BSD-3-Clause",
"BSD-1-Clause",
"Unlicense"
] | permissive | lips-hci/ae400-realsense-sdk | 742cc375d421ee41c04d1934b5bec23d607f39ed | 2554f30bdcbf71b5b7279fef494176f3fbd6c6c7 | refs/heads/master | 2023-04-27T01:57:34.504808 | 2023-03-21T09:21:34 | 2023-04-13T06:11:17 | 227,797,796 | 9 | 4 | Apache-2.0 | 2023-08-25T07:42:36 | 2019-12-13T08:59:00 | C++ | UTF-8 | C++ | false | false | 12,998 | cpp | // License: Apache 2.0. See LICENSE file in root directory.
// Copyright(c) 2019 Intel Corporation. All Rights Reserved.
#include <librealsense2/rs.hpp>
#include <librealsense2/rsutil.h>
#include <array>
#include <cmath>
#include <iostream>
#include <vector>
#include "example.hpp"
struct point3d {
float f[3];
point3d() {}
point3d(float x, float y, float z) : f{x, y, z} {}
float x() const { return f[0]; }
float y() const { return f[1]; }
float z() const { return f[2]; }
};
struct pixel {
float f[2];
pixel() {}
pixel(float x, float y) : f{x, y} {}
float x() const { return f[0]; }
float y() const { return f[1]; }
};
// We define a virtual object as a collection of vertices that will be connected by lines
typedef std::array<point3d, 4> object;
static rs2_pose identity_pose();
static rs2_pose reset_object_pose(const rs2_pose& device_pose_in_world = identity_pose());
static rs2_pose pose_inverse(const rs2_pose& p);
static rs2_pose pose_multiply(const rs2_pose& ref2_in_ref1, const rs2_pose& ref3_in_ref2);
static rs2_quaternion quaternion_conjugate(const rs2_quaternion& q);
static rs2_quaternion quaternion_multiply(const rs2_quaternion& a, const rs2_quaternion& b);
static rs2_vector quaternion_rotate_vector(const rs2_quaternion& q, const rs2_vector& v);
static rs2_vector pose_transform_point(const rs2_pose& pose, const rs2_vector& p);
static rs2_vector vector_addition(const rs2_vector& a, const rs2_vector& b);
static rs2_vector vector_negate(const rs2_vector& v);
static object convert_object_coordinates(const object& obj, const rs2_pose& object_pose);
static std::vector<point3d> raster_line(const point3d& a, const point3d& b, float step);
static void render_line(const std::vector<pixel>& line, int color_code);
static void render_text(int win_height, const std::string& text);
int main(int argc, char * argv[]) try
{
std::cout << "Waiting for device..." << std::endl;
// Declare RealSense pipeline, encapsulating the actual device and sensors
rs2::pipeline pipe;
// Create a configuration for configuring the pipeline with a non default profile
rs2::config cfg;
// Enable fisheye and pose streams
cfg.enable_stream(RS2_STREAM_POSE, RS2_FORMAT_6DOF);
cfg.enable_stream(RS2_STREAM_FISHEYE, 1);
cfg.enable_stream(RS2_STREAM_FISHEYE, 2);
// Start pipeline with chosen configuration
rs2::pipeline_profile pipe_profile = pipe.start(cfg);
// T265 has two fisheye sensors, we can choose any of them (index 1 or 2)
const int fisheye_sensor_idx = 1;
// Get fisheye sensor intrinsics parameters
rs2::stream_profile fisheye_stream = pipe_profile.get_stream(RS2_STREAM_FISHEYE, fisheye_sensor_idx);
rs2_intrinsics intrinsics = fisheye_stream.as<rs2::video_stream_profile>().get_intrinsics();
rs2_extrinsics pose_to_fisheye_extrinsics = pipe_profile.get_stream(RS2_STREAM_POSE).get_extrinsics_to(fisheye_stream);
std::cout << "Device got. Streaming data" << std::endl;
// Create an OpenGL display window and a texture to draw the fisheye image
window app(intrinsics.width, intrinsics.height, "Intel RealSense T265 Augmented Reality Example");
window_key_listener key_watcher(app);
texture fisheye_image;
// Create the vertices of a simple virtual object.
// This virtual object is 4 points in 3D space that describe 3 XYZ 20cm long axes.
// These vertices are relative to the object's own coordinate system.
const float length = 0.20f;
const object virtual_object = {{
{ 0, 0, 0 }, // origin
{ length, 0, 0 }, // X
{ 0, length, 0 }, // Y
{ 0, 0, length } // Z
}};
// This variable will hold the pose of the virtual object in world coordinates.
// We we initialize it once we get the first pose frame.
rs2_pose object_pose_in_world;
bool object_pose_in_world_initialized = false;
// Main loop
while (app)
{
rs2_pose device_pose_in_world; // This will contain the current device pose
{
// Wait for the next set of frames from the camera
auto frames = pipe.wait_for_frames();
// Get a frame from the fisheye stream
rs2::video_frame fisheye_frame = frames.get_fisheye_frame(fisheye_sensor_idx);
// Get a frame from the pose stream
rs2::pose_frame pose_frame = frames.get_pose_frame();
// Copy current camera pose
device_pose_in_world = pose_frame.get_pose_data();
// Render the fisheye image
fisheye_image.render(fisheye_frame, { 0, 0, app.width(), app.height() });
// By closing the current scope we let frames be deallocated, so we do not fill up librealsense queues while we do other computation.
}
// If we have not set the virtual object in the world yet, set it in front of the camera now.
if (!object_pose_in_world_initialized)
{
object_pose_in_world = reset_object_pose(device_pose_in_world);
object_pose_in_world_initialized = true;
}
// Compute the pose of the object relative to the current pose of the device
rs2_pose world_pose_in_device = pose_inverse(device_pose_in_world);
rs2_pose object_pose_in_device = pose_multiply(world_pose_in_device, object_pose_in_world);
// Get the object vertices in device coordinates
object object_in_device = convert_object_coordinates(virtual_object, object_pose_in_device);
// Convert object vertices from device coordinates into fisheye sensor coordinates using extrinsics
object object_in_sensor;
for (size_t i = 0; i < object_in_device.size(); ++i)
{
rs2_transform_point_to_point(object_in_sensor[i].f, &pose_to_fisheye_extrinsics, object_in_device[i].f);
}
for (size_t i = 1; i < object_in_sensor.size(); ++i)
{
// Discretize the virtual object line into smaller 1cm long segments
std::vector<point3d> points_in_sensor = raster_line(object_in_sensor[0], object_in_sensor[i], 0.01f);
std::vector<pixel> projected_line;
projected_line.reserve(points_in_sensor.size());
for (auto& point : points_in_sensor)
{
// A 3D point is visible in the image if its Z coordinate relative to the fisheye sensor is positive.
if (point.z() > 0)
{
// Project 3D sensor coordinates to 2D fisheye image coordinates using intrinsics
projected_line.emplace_back();
rs2_project_point_to_pixel(projected_line.back().f, &intrinsics, point.f);
}
}
// Display the line in the image
render_line(projected_line, static_cast<int>(i));
}
// Display text in the image
render_text(static_cast<int>(app.height()), "Press spacebar to reset the pose of the virtual object. Press ESC to exit");
// Check if some key is pressed
switch (key_watcher.get_key())
{
case GLFW_KEY_SPACE:
// Reset virtual object pose if user presses spacebar
object_pose_in_world = reset_object_pose(device_pose_in_world);
std::cout << "Setting new pose for virtual object: " << object_pose_in_world.translation << std::endl;
break;
case GLFW_KEY_ESCAPE:
// Exit if user presses escape
app.close();
break;
}
}
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
{
std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
}
rs2_pose identity_pose()
{
// Return an identity pose (no translation, no rotation)
rs2_pose pose;
pose.translation.x = 0;
pose.translation.y = 0;
pose.translation.z = 0;
pose.rotation.x = 0;
pose.rotation.y = 0;
pose.rotation.z = 0;
pose.rotation.w = 1;
return pose;
}
rs2_pose reset_object_pose(const rs2_pose& device_pose_in_world)
{
// Set the object 50 centimeter away in front of the camera.
// T265 coordinate system is defined here: https://github.com/IntelRealSense/librealsense/blob/master/doc/t265.md#sensor-origin-and-coordinate-system
rs2_pose object_pose_in_device;
object_pose_in_device.translation.x = 0;
object_pose_in_device.translation.y = 0;
object_pose_in_device.translation.z = -0.50;
object_pose_in_device.rotation.x = 0;
object_pose_in_device.rotation.y = 0;
object_pose_in_device.rotation.z = 0;
object_pose_in_device.rotation.w = 1;
// Convert the pose of the virtual object from camera coordinates into world coordinates
rs2_pose object_pose_in_world = pose_multiply(device_pose_in_world, object_pose_in_device);
return object_pose_in_world;
}
rs2_pose pose_inverse(const rs2_pose& p)
{
rs2_pose i;
i.rotation = quaternion_conjugate(p.rotation);
i.translation = vector_negate(quaternion_rotate_vector(i.rotation, p.translation));
return i;
}
rs2_pose pose_multiply(const rs2_pose& ref2_in_ref1, const rs2_pose& ref3_in_ref2)
{
rs2_pose ref3_in_ref1;
ref3_in_ref1.rotation = quaternion_multiply(ref2_in_ref1.rotation, ref3_in_ref2.rotation);
ref3_in_ref1.translation = vector_addition(quaternion_rotate_vector(ref2_in_ref1.rotation, ref3_in_ref2.translation), ref2_in_ref1.translation);
return ref3_in_ref1;
}
rs2_vector pose_transform_point(const rs2_pose& pose, const rs2_vector& p)
{
return vector_addition(quaternion_rotate_vector(pose.rotation, p), pose.translation);
}
rs2_quaternion quaternion_multiply(const rs2_quaternion& a, const rs2_quaternion& b)
{
return rs2_quaternion {
a.x * b.w + a.w * b.x - a.z * b.y + a.y * b.z,
a.y * b.w + a.z * b.x + a.w * b.y - a.x * b.z,
a.z * b.w - a.y * b.x + a.x * b.y + a.w * b.z,
a.w * b.w - a.x * b.x - a.y * b.y - a.z * b.z,
};
}
rs2_vector quaternion_rotate_vector(const rs2_quaternion& q, const rs2_vector& v)
{
rs2_quaternion v_as_quaternion = { v.x, v.y, v.z, 0 };
rs2_quaternion rotated_v = quaternion_multiply(quaternion_multiply(q, v_as_quaternion), quaternion_conjugate(q));
return rs2_vector { rotated_v.x, rotated_v.y, rotated_v.z };
}
rs2_quaternion quaternion_conjugate(const rs2_quaternion& q)
{
return rs2_quaternion { -q.x, -q.y, -q.z, q.w };
}
rs2_vector vector_addition(const rs2_vector& a, const rs2_vector& b)
{
return rs2_vector { a.x + b.x, a.y + b.y, a.z + b.z };
}
rs2_vector vector_negate(const rs2_vector& v)
{
return rs2_vector { -v.x, -v.y, -v.z };
}
object convert_object_coordinates(const object& obj, const rs2_pose& object_pose)
{
object transformed_obj;
for (size_t i = 0; i < obj.size(); ++i) {
rs2_vector v { obj[i].x(), obj[i].y(), obj[i].z() };
v = pose_transform_point(object_pose, v);
transformed_obj[i].f[0] = v.x;
transformed_obj[i].f[1] = v.y;
transformed_obj[i].f[2] = v.z;
}
return transformed_obj;
}
std::vector<point3d> raster_line(const point3d& a, const point3d& b, float step)
{
rs2_vector direction = { b.x() - a.x(), b.y() - a.y(), b.z() - a.z() };
float distance = std::sqrt(direction.x*direction.x + direction.y*direction.y + direction.z*direction.z);
int npoints = static_cast<int>(distance / step + 1);
std::vector<point3d> points;
if (npoints > 0)
{
direction.x = direction.x * step / distance;
direction.y = direction.y * step / distance;
direction.z = direction.z * step / distance;
points.reserve(npoints);
points.emplace_back(a);
for (int i = 1; i < npoints; ++i)
{
points.emplace_back(a.x() + direction.x * i,
a.y() + direction.y * i,
a.z() + direction.z * i);
}
}
return points;
}
void render_line(const std::vector<pixel>& line, int color_code)
{
if (!line.empty())
{
GLfloat current_color[4];
glGetFloatv(GL_CURRENT_COLOR, current_color);
glLineWidth(5);
glColor3f(color_code == 1 ? 1.f : 0.f,
color_code == 2 ? 1.f : 0.f,
color_code == 3 ? 1.f : 0.f);
glBegin(GL_LINE_STRIP);
for (auto& pixel : line)
{
glVertex3f(pixel.x(), pixel.y(), 0.f);
}
glEnd();
glColor4fv(current_color);
}
}
void render_text(int win_height, const std::string& text)
{
GLfloat current_color[4];
glGetFloatv(GL_CURRENT_COLOR, current_color);
glColor3f(0, 0.5, 1);
glScalef(2, 2, 2);
draw_text(15, (win_height - 10) / 2, text.c_str());
glScalef(1, 1, 1);
glColor4fv(current_color);
}
| [
"timcheng@lips-hci.com"
] | timcheng@lips-hci.com |
6875aa155d0c4fad79d36f5b09700aad3a32a57e | 5bd2afeded6a39311403641533f9a8798582b5c6 | /codeforces/841/B.cpp | a3784dce7985fbcce5cd3439e5901328c974513b | [] | no_license | ShahjalalShohag/ProblemSolving | 19109c35fc1a38b7a895dbc4d95cbb89385b895b | 3df122f13808681506839f81b06d507ae7fc17e0 | refs/heads/master | 2023-02-06T09:28:43.118420 | 2019-01-06T11:09:00 | 2020-12-27T14:35:25 | 323,168,270 | 31 | 16 | null | null | null | null | UTF-8 | C++ | false | false | 3,664 | cpp | #pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#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 ll long long
#define ull unsigned long long
#define ld long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector< pair<int,int> >
#define vpll vector< pair<ll,ll> >
#define ppll pair< ll,pll >
#define pllp pair< pll,ll >
#define stll stack<ll>
#define qll queue<ll>
#define pqll priority_queue<ll>
#define umap unordered_map
#define uset unordered_set
#define PQ priority_queue
#define rep(i,n) for(i=0;i<n;i++)
#define itfor(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define printa(a,L,R) for(int i=L;i<R;i++) cout<<a[i]<<(i==R-1?'\n':' ')
#define printv(a) printa(a,0,a.size())
#define print2d(a,r,c) for(int i=0;i<r;i++) for(int j=0;j<c;j++) cout<<a[i][j]<<(j==c-1?'\n':' ')
#define pb push_back
#define MP make_pair
#define UB upper_bound
#define LB lower_bound
#define SQ(x) ((x)*(x))
#define issq(x) (((ll)(sqrt((x))))*((ll)(sqrt((x))))==(x))
#define F first
#define S second
#define mem(a,x) memset(a,x,sizeof(a))
#define inf 0x3f3f3f3f
#define PI 3.14159265358979323846
#define E 2.71828182845904523536
#define gamma 0.5772156649
#define nl "\n"
#define lg(r,n) (int)(log2(n)/log2(r))
#define sf(a) scanf("%d",&a)
#define sfl(a) scanf("%I64d",&a)
#define sfc(a) scanf("%c",&a)
#define sff(a,b) scanf("%d %d",&a,&b)
#define sffl(a,b) scanf("%I64d %I64d",&a,&b)
#define sfff(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define sfffl(a,b,c) scanf("%I64d %I64d %I64d",&a,&b,&c)
#define pf printf
#define pfi(a) pf("%d\n",&a)
#define pfl(a) pf("%I64d\n",&a)
#define _ccase printf("Case %d: ",++cs)
#define _case cout<<"Case "<<++cs<<": "
#define debug(x) cout<<#x"="<<(x)<<nl
#define rev(v) reverse(v.begin(),v.end())
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<int>())
#define all(v) v.begin(),v.end()
#define mnv(v) *min_element(v.begin(),v.end())
#define mxv(v) *max_element(v.begin(),v.end())
#define countv(v,a) count(v.begin(),v.end(),a)
#define toint(a) atoi(a.c_str())
#define midlr mid=b+((e-b)>>1),l=n<<1,r=n<<11
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL)
string tostr(int n) {stringstream rr;rr<<n;return rr.str();}
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
const int mod=1e9+7;
//ll qpow(ll n,ll k) {ll ans=1;n%=mod;while(k){if(k&1) ans=(ans*n)%mod;n=(n*n)%mod;k>>=1;}return ans%mod;}
const int mxn=1e5+9;
const ld eps=1e-9;
int main()
{
fast;
ll i,j,k,n,m,sum=0,flag=0;
cin>>n;
for(i=0;i<n;i++){
cin>>k,sum+=k;
if(k&1) flag=1;
}
if(sum&1) cout<<"First";
else{
if(flag) cout<<"First";
else cout<<"Second";
}
return 0;
}
| [
"shahjalalshohag2014@gmail.com"
] | shahjalalshohag2014@gmail.com |
54bc244ec2b2062c3ed69497bff5b676bc83b30e | 869b147ac9fd92fe44e2944da22b7b4826eff57d | /class-projects/ryanweng/LinkIt_ONE/LinkIt_ONE.ino | 9b1362fab3f78d31afb8e413cb07dacb24fa8d50 | [] | no_license | ryan4559/ntnu-2016-iot | 6c814e505c84147efddb37fbfaea4413ee940684 | 642c0a796eb5ff127594cbbf2269254efcbfbb51 | refs/heads/master | 2020-12-26T03:23:08.632357 | 2016-07-10T00:05:15 | 2016-07-10T00:05:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,150 | ino | #include <Arduino.h>
//0:A4 1:G3
#define PM_sensor 1
//========================================
void get_PM(int *PM1 = 0,int *PM25 = 0,int *PM10 = 0)
{
#if PM_sensor == 0
unsigned long timeout = millis();
int count = 0;
byte incomeByte[32];
boolean startcount = false;
byte data;
Serial1.begin(9600);
while (1) {
if ((millis() - timeout) > 1500) {
Serial.println("[A4-ERROR-TIMEOUT]");
//#TODO:make device fail alarm message here
break;
}
if (Serial1.available()) {
data = Serial1.read();
if (data == 0x32 && !startcount) {
startcount = true;
count++;
incomeByte[0] = data;
} else if (startcount) {
count++;
incomeByte[count - 1] = data;
if (count >= 32) {
break;
}
}
}
}
Serial1.end();
Serial1.flush();
unsigned int calcsum = 0; // BM
unsigned int exptsum;
for (int i = 0; i < 29; i++) {
calcsum += (unsigned int)incomeByte[i];
}
exptsum = ((unsigned int)incomeByte[30] << 8) + (unsigned int)incomeByte[31];
if (calcsum == exptsum) {
*PM1 = ((unsigned int)incomeByte[4] << 8) + (unsigned int)incomeByte[5];
*PM25 = ((unsigned int)incomeByte[6] << 8) + (unsigned int)incomeByte[7];
*PM10 = ((unsigned int)incomeByte[8] << 8) + (unsigned int)incomeByte[9];
} else {
Serial.println("#[exception] PM2.5 Sensor CHECKSUM ERROR!");
*PM1 = -1;
*PM25 = -1;
*PM10 = -1;
}
#elif PM_sensor == 1
unsigned long timeout = millis();
int count=0;
byte incomeByte[24];
boolean startcount=false;
byte data;
Serial1.begin(9600);
while (1){
if((millis() - timeout) > 3000) {
Serial.println("[G3-ERROR-TIMEOUT]");
break;
}
if(Serial1.available()){
data=Serial1.read();
if(data==0x42 && !startcount){
startcount = true;
count++;
incomeByte[0]=data;
} else if (startcount){
count++;
incomeByte[count-1]=data;
if(count>=24) {break;}
}
}
}
Serial1.end();
Serial1.flush();
unsigned int calcsum = 0; // BM
unsigned int exptsum;
for(int i = 0; i < 22; i++) {
calcsum += (unsigned int)incomeByte[i];
}
exptsum = ((unsigned int)incomeByte[22] << 8) + (unsigned int)incomeByte[23];
if(calcsum == exptsum) {
*PM1 = ((unsigned int)incomeByte[10] << 8) + (unsigned int)incomeByte[11];
*PM25 = ((unsigned int)incomeByte[12] << 8) + (unsigned int)incomeByte[13];
*PM10 = ((unsigned int)incomeByte[14] << 8) + (unsigned int)incomeByte[15];
} else {
Serial.println("#[exception] PM2.5 Sensor CHECKSUM ERROR!");
*PM1 = -1;
*PM25 = -1;
*PM10 = -1;
}
#endif
}
void setup() {
Serial.begin(9600);
}
void loop() {
int PM1=0, PM25=0, PM10=0;
get_PM(&PM1,&PM25,&PM10);
Serial.print("PM1 = ");
Serial.println(PM1,DEC);
Serial.print("PM2.5 = ");
Serial.println(PM25,DEC);
Serial.print("PM10 = ");
Serial.println(PM10,DEC);
}
| [
"ryan4559@gmail.com"
] | ryan4559@gmail.com |
d36172fede8007bb56072a7b914977c62735df65 | ad90fd7724d8bf72f3e8b3d967799e317769430a | /HelloWorld/win32/Character_data.cpp | 3fc33fc8519c722b5b652fca1df98b018c4fd804 | [] | no_license | geniikw/myFirst2DGame | f71865ec8eabdff35c33b2a013b3afd1711b7776 | d9050e71913000e9147fa3f889d4b6c7c35fda94 | refs/heads/master | 2021-07-09T21:09:57.886694 | 2016-12-15T16:50:51 | 2016-12-15T16:50:51 | 19,765,521 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 608 | cpp | #include"Character_data.h"
#include"Battle_Unit.h"
#include"Manager_Resource.h"
Character_data::Character_data
(int index, string name, int atk, int def, int spd,const CG3Point &size)
{
m_iIndex = index;
m_szName = name;
m_iAA = atk;
m_iDA = def;
m_iSR = spd;
//캐릭터의 크기
m_size = size;
}
Battle_Unit* Character_data::makeBU(int kind) const
{
Battle_Unit* temp = new Battle_Unit();
temp->setStatus(m_iAA, m_iDA, m_iSR,0,0,0);
temp->reMakeCubeData(m_size);
temp->setTag(kind);
temp->autorelease();
//아직까진 적과 구분을 하는 데이터가 없다...
return temp;
} | [
"geniikw@gmail.com"
] | geniikw@gmail.com |
21e5e6ff8f4888f22b608024c34d76d685bfba2c | 04b1803adb6653ecb7cb827c4f4aa616afacf629 | /ui/views/controls/button/image_button_factory_unittest.cc | 6d022452da064168bbcb1efec78ba7595c24c52a | [
"BSD-3-Clause"
] | permissive | Samsung/Castanets | 240d9338e097b75b3f669604315b06f7cf129d64 | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | refs/heads/castanets_76_dev | 2023-08-31T09:01:04.744346 | 2021-07-30T04:56:25 | 2021-08-11T05:45:21 | 125,484,161 | 58 | 49 | BSD-3-Clause | 2022-10-16T19:31:26 | 2018-03-16T08:07:37 | null | UTF-8 | C++ | false | false | 1,720 | cc | // Copyright 2017 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 "ui/views/controls/button/image_button_factory.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/color_utils.h"
#include "ui/native_theme/native_theme.h"
#include "ui/views/animation/test/ink_drop_host_view_test_api.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/test/views_test_base.h"
namespace views {
using ImageButtonFactoryTest = ViewsTestBase;
TEST_F(ImageButtonFactoryTest, CreateVectorImageButton) {
auto button = CreateVectorImageButton(nullptr);
EXPECT_EQ(ImageButton::ALIGN_CENTER, button->h_alignment_);
EXPECT_EQ(ImageButton::ALIGN_MIDDLE, button->v_alignment_);
}
TEST_F(ImageButtonFactoryTest, SetImageFromVectorIcon) {
auto button = CreateVectorImageButton(nullptr);
SetImageFromVectorIcon(button.get(), vector_icons::kCloseRoundedIcon,
SK_ColorRED);
EXPECT_FALSE(button->GetImage(Button::STATE_NORMAL).isNull());
EXPECT_FALSE(button->GetImage(Button::STATE_DISABLED).isNull());
EXPECT_EQ(color_utils::DeriveDefaultIconColor(SK_ColorRED),
button->GetInkDropBaseColor());
}
TEST_F(ImageButtonFactoryTest, SetImageFromVectorIcon_Default) {
auto button = CreateVectorImageButton(nullptr);
SetImageFromVectorIcon(button.get(), vector_icons::kCloseRoundedIcon);
EXPECT_EQ(button->GetNativeTheme()->GetSystemColor(
ui::NativeTheme::kColorId_DefaultIconColor),
button->GetInkDropBaseColor());
}
} // namespace views
| [
"sunny.nam@samsung.com"
] | sunny.nam@samsung.com |
9e5c1637fb9c7d32c171b744bddf88b6bb6c48d4 | 8191afce54f369c18f98c602b1ee99fcb5a75004 | /Decorator/Borderdecorator.h | abec90e42ad4b61100936c7db67c3f80d5a432d3 | [] | no_license | KoiKomei/INGSW | 07f9a49a9c735ec0bba10537840b9e3ae4d0811f | 456b6f366177772c3340bf2c469f01dd218171d9 | refs/heads/master | 2020-04-01T17:24:29.858283 | 2018-11-14T18:04:52 | 2018-11-14T18:04:52 | 153,427,765 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 298 | h | #pragma once
#ifndef BORDERDECORATOR_H
#define BORDERDECORATOR_H
#include "Decorator.h"
class Borderdecorator : public Decorator {
public:
Borderdecorator(Widget *w) :Decorator(w) {}
void draw() {
Decorator::draw();
cout << " Borderdecorator" << endl;
}
};
#endif // !BORDERDECORATOR_H
| [
"alex.parisella@gmail.com"
] | alex.parisella@gmail.com |
c36521932cfd38ab2e791047511c95ca4b3b95d8 | f94f4db7c0dfe547267bfc64198a7563697ff511 | /com/win32com/src/PyRecord.cpp | 0937c2185a9feafa0e230524760422062c6b6cda | [
"Apache-2.0"
] | permissive | huanyin88/Mod-Pywin32-For-Python3.x-DDE | 8e4e766327efbc13b5e7aa0a3cba63a3b93637fc | 992931aa534357d54aaac34077f0128d3a740e5e | refs/heads/master | 2022-11-08T20:09:01.667351 | 2020-06-18T17:09:22 | 2020-06-18T17:09:22 | 273,058,757 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 21,636 | cpp | #include "stdafx.h"
#include "PythonCOM.h"
#include "PyRecord.h"
// @doc
// The owner of the record buffer - many records may point here!
class PyRecordBuffer {
public:
PyRecordBuffer(int size)
{
data = PyMem_Malloc(size);
if (data == NULL)
PyErr_NoMemory();
ref = 0;
}
~PyRecordBuffer()
{
if (data)
PyMem_Free(data);
}
void AddRef() { ref++; }
void Release()
{
if (--ref == 0) {
delete this;
return;
}
}
void *data;
long ref;
};
BOOL PyRecord_Check(PyObject *ob) { return ((ob)->ob_type == &PyRecord::Type); }
BOOL PyObject_AsVARIANTRecordInfo(PyObject *ob, VARIANT *pv)
{
if (!PyRecord_Check(ob)) {
PyErr_SetString(PyExc_TypeError, "Only com_record objects can be used as records");
return NULL;
}
PyRecord *pyrec = (PyRecord *)ob;
HRESULT hr = pyrec->pri->RecordCreateCopy(pyrec->pdata, &V_RECORD(pv));
if (FAILED(hr)) {
PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo);
return FALSE;
}
V_RECORDINFO(pv) = pyrec->pri;
pyrec->pri->AddRef();
return TRUE;
}
PyObject *PyObject_FromSAFEARRAYRecordInfo(SAFEARRAY *psa)
{
PyObject *ret = NULL, *ret_tuple = NULL;
IRecordInfo *info = NULL;
BYTE *source_data = NULL, *this_dest_data = NULL;
long lbound, ubound, nelems, i;
ULONG cb_elem;
PyRecordBuffer *owner = NULL;
HRESULT hr = SafeArrayGetRecordInfo(psa, &info);
if (FAILED(hr))
goto exit;
hr = SafeArrayAccessData(psa, (void **)&source_data);
if (FAILED(hr))
goto exit;
// Allocate a new chunk of memory
hr = SafeArrayGetUBound(psa, 1, &ubound);
if (FAILED(hr))
goto exit;
hr = SafeArrayGetLBound(psa, 1, &lbound);
if (FAILED(hr))
goto exit;
nelems = ubound - lbound;
hr = info->GetSize(&cb_elem);
if (FAILED(hr))
goto exit;
owner = new PyRecordBuffer(nelems * cb_elem);
if (PyErr_Occurred())
goto exit;
owner->AddRef(); // unref'd at end - for successful failure cleanup
ret_tuple = PyTuple_New(nelems);
if (ret_tuple == NULL)
goto exit;
this_dest_data = (BYTE *)owner->data;
for (i = 0; i < nelems; i++) {
hr = info->RecordInit(this_dest_data);
if (FAILED(hr))
goto exit;
hr = info->RecordCopy(source_data, this_dest_data);
if (FAILED(hr))
goto exit;
PyTuple_SET_ITEM(ret_tuple, i, new PyRecord(info, this_dest_data, owner));
this_dest_data += cb_elem;
source_data += cb_elem;
}
ret = ret_tuple;
Py_INCREF(ret); // for decref on cleanup.
exit:
if (FAILED(hr)) {
if (info)
PyCom_BuildPyException(hr, info, IID_IRecordInfo);
else
PyCom_BuildPyException(hr);
Py_XDECREF(ret);
ret = NULL;
}
if (owner != NULL)
owner->Release();
Py_XDECREF(ret_tuple);
if (info)
info->Release();
if (source_data != NULL)
SafeArrayUnaccessData(psa);
return ret;
}
// Creates a new Record by TAKING A COPY of the passed record.
PyObject *PyObject_FromRecordInfo(IRecordInfo *ri, void *data, ULONG cbData)
{
if ((data != NULL && cbData == 0) || (data == NULL && cbData != 0))
return PyErr_Format(PyExc_RuntimeError, "Both or neither data and size must be given");
ULONG cb;
HRESULT hr = ri->GetSize(&cb);
if (FAILED(hr))
return PyCom_BuildPyException(hr, ri, IID_IRecordInfo);
if (cbData != 0 && cbData != cb)
return PyErr_Format(PyExc_ValueError, "Expecting a string of %d bytes (got %d)", cb, cbData);
PyRecordBuffer *owner = new PyRecordBuffer(cb);
if (PyErr_Occurred()) { // must be mem error!
delete owner;
return NULL;
}
hr = ri->RecordInit(owner->data);
if (FAILED(hr)) {
delete owner;
return PyCom_BuildPyException(hr, ri, IID_IRecordInfo);
}
hr = data == NULL ? 0 : ri->RecordCopy(data, owner->data);
if (FAILED(hr)) {
delete owner;
return PyCom_BuildPyException(hr, ri, IID_IRecordInfo);
}
return new PyRecord(ri, owner->data, owner);
}
// @pymethod <o PyRecord>|pythoncom|GetRecordFromGuids|Creates a new record object from the given GUIDs
PyObject *pythoncom_GetRecordFromGuids(PyObject *self, PyObject *args)
{
void *data = NULL;
PyObject *obGuid, *obInfoGuid, *obdata = Py_None;
int major, minor, lcid;
int cb = 0;
if (!PyArg_ParseTuple(args, "OiiiO|O:GetRecordFromGuids",
&obGuid, // @pyparm <o PyIID>|iid||The GUID of the type library
&major, // @pyparm int|verMajor||The major version number of the type lib.
&minor, // @pyparm int|verMinor||The minor version number of the type lib.
&lcid, // @pyparm int|lcid||The LCID of the type lib.
&obInfoGuid, // @pyparm <o PyIID>|infoIID||The GUID of the record info in the library
&obdata)) // @pyparm string or buffer|data|None|The raw data to initialize the record with.
return NULL;
if (!PyWinObject_AsReadBuffer(obdata, &data, &cb, TRUE))
return NULL;
GUID guid, infoGuid;
if (!PyWinObject_AsIID(obGuid, &guid))
return NULL;
if (!PyWinObject_AsIID(obInfoGuid, &infoGuid))
return NULL;
IRecordInfo *i = NULL;
HRESULT hr = GetRecordInfoFromGuids(guid, major, minor, lcid, infoGuid, &i);
if (FAILED(hr))
return PyCom_BuildPyException(hr);
PyObject *ret = PyObject_FromRecordInfo(i, data, cb);
i->Release();
return ret;
}
// @pymethod <o PyRecord>|pythoncom|GetRecordFromTypeInfo|Creates a new record object from a <o PyITypeInfo> interface
// @comm This function will fail if the specified type info does not have a guid defined
PyObject *pythoncom_GetRecordFromTypeInfo(PyObject *self, PyObject *args)
{
PyObject *obtypeinfo, *ret;
ITypeInfo *pITI = NULL;
IRecordInfo *pIRI = NULL;
HRESULT hr;
if (!PyArg_ParseTuple(args, "O:GetRecordFromTypeInfo",
&obtypeinfo)) // @pyparm <o PyITypeInfo>|TypeInfo||The type information to be converted into
// a PyRecord object
return NULL;
if (!PyCom_InterfaceFromPyInstanceOrObject(obtypeinfo, IID_ITypeInfo, (void **)&pITI, FALSE))
return NULL;
hr = GetRecordInfoFromTypeInfo(pITI, &pIRI);
if (FAILED(hr))
ret = PyCom_BuildPyException(hr);
else
ret = PyObject_FromRecordInfo(pIRI, NULL, 0);
pITI->Release();
if (pIRI != NULL)
pIRI->Release();
return ret;
}
PyRecord::PyRecord(IRecordInfo *ri, PVOID data, PyRecordBuffer *owner)
{
ob_type = &PyRecord::Type;
_Py_NewReference(this);
ri->AddRef();
pri = ri;
pdata = data;
this->owner = owner;
owner->AddRef();
};
PyRecord::~PyRecord()
{
owner->Release();
pri->Release();
}
PyTypeObject PyRecord::Type = {
PYWIN_OBJECT_HEAD "com_record",
sizeof(PyRecord),
0,
PyRecord::tp_dealloc, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
0, /* tp_compare */
&PyRecord::tp_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
0, /* tp_call */
0, /* tp_str */
PyRecord::getattro, /* tp_getattro */
PyRecord::setattro, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
0, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
PyRecord::tp_richcompare, /* tp_richcompare */
0, /* tp_weaklistoffset */
0, /* tp_iter */
0, /* tp_iternext */
PyRecord::methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
};
static PyObject *PyRecord_reduce(PyObject *self, PyObject *args)
{
PyObject *ret = NULL;
PyRecord *pyrec = (PyRecord *)self;
PyObject *obModule = NULL, *obModDict = NULL, *obFunc = NULL;
ITypeInfo *pti = NULL;
TYPEATTR *pta = NULL;
ULONG cb;
HRESULT hr;
GUID structguid;
if (!PyArg_ParseTuple(args, ":reduce"))
return NULL;
hr = pyrec->pri->GetTypeInfo(&pti);
if (FAILED(hr) || pti == NULL) {
PyCom_BuildPyException(hr);
goto done;
}
hr = pti->GetTypeAttr(&pta);
if (FAILED(hr) || pta == NULL) {
PyCom_BuildPyException(hr);
goto done;
}
hr = pyrec->pri->GetGuid(&structguid);
if (FAILED(hr)) {
PyCom_BuildPyException(hr);
goto done;
}
hr = pyrec->pri->GetSize(&cb);
if (FAILED(hr)) {
PyCom_BuildPyException(hr);
goto done;
}
obModule = PyImport_ImportModule("pythoncom");
if (obModule)
obModDict = PyModule_GetDict(obModule); // no ref added!
if (obModDict)
obFunc = PyDict_GetItemString(obModDict, "GetRecordFromGuids"); // no ref added!
if (!obFunc) {
PyErr_Clear();
PyErr_SetString(PyExc_RuntimeError, "pythoncom.GetRecordFromGuids() can't be located!");
goto done;
}
ret =
Py_BuildValue("O(NHHiNN)", obFunc, PyWinObject_FromIID(pta->guid), pta->wMajorVerNum, pta->wMinorVerNum,
pta->lcid, PyWinObject_FromIID(structguid), PyString_FromStringAndSize((char *)pyrec->pdata, cb));
done:
if (pta && pti)
pti->ReleaseTypeAttr(pta);
if (pti)
pti->Release();
Py_XDECREF(obModule);
// obModDict and obFunc have no new reference.
return ret;
}
// The object itself.
// Any method names should be "__blah__", as they override
// structure names!
struct PyMethodDef PyRecord::methods[] = {{"__reduce__", PyRecord_reduce, 1}, // This allows the copy module to work!
{NULL}};
static BSTR *_GetFieldNames(IRecordInfo *pri, ULONG *pnum)
{
ULONG num_names;
HRESULT hr = pri->GetFieldNames(&num_names, NULL);
if (FAILED(hr)) {
PyCom_BuildPyException(hr, pri, IID_IRecordInfo);
return NULL;
}
BSTR *strings = new BSTR[num_names];
if (strings == NULL) {
PyErr_NoMemory();
return NULL;
}
for (ULONG i = 0; i < num_names; i++) strings[i] = NULL;
hr = pri->GetFieldNames(&num_names, strings);
if (FAILED(hr)) {
PyCom_BuildPyException(hr, pri, IID_IRecordInfo);
return NULL;
}
*pnum = num_names;
return strings;
}
static void _FreeFieldNames(BSTR *strings, ULONG num_names)
{
for (ULONG i = 0; i < num_names; i++) SysFreeString(strings[i]);
delete[] strings;
}
#if (PY_VERSION_HEX < 0x03000000)
#define PyWinCoreString_ConcatAndDel PyString_ConcatAndDel
#define PyWinCoreString_Concat PyString_Concat
#else
// Unicode versions of '_Concat' etc have different sigs. Make them the
// same here...
void PyWinCoreString_Concat(register PyObject **pv, register PyObject *w)
{
if (!w) { // hrm - string version doesn't do this, but I saw PyObject_Repr() return NULL...
Py_XDECREF(*pv);
*pv = NULL;
return;
}
PyObject *tmp = PyUnicode_Concat(*pv, w);
Py_DECREF(*pv);
*pv = tmp;
}
void PyWinCoreString_ConcatAndDel(register PyObject **pv, register PyObject *w)
{
PyWinCoreString_Concat(pv, w);
Py_XDECREF(w);
}
#endif
PyObject *PyRecord::tp_repr(PyObject *self)
{
ULONG i;
PyRecord *pyrec = (PyRecord *)self;
ULONG num_names;
BSTR *strings = _GetFieldNames(pyrec->pri, &num_names);
if (strings == NULL)
return NULL;
PyObject *obrepr = NULL, *obattrname;
BOOL bsuccess = FALSE;
PyObject *comma = PyWinCoreString_FromString(_T(", "));
PyObject *equals = PyWinCoreString_FromString(_T("="));
PyObject *closing_paren = PyWinCoreString_FromString(_T(")"));
obrepr = PyWinCoreString_FromString(_T("com_struct("));
if (obrepr == NULL || comma == NULL || equals == NULL || closing_paren == NULL)
goto done;
for (i = 0; i < num_names && obrepr != NULL; i++) {
obattrname = PyWinCoreString_FromString(strings[i]);
if (obattrname == NULL)
goto done;
// must exit on error via loop_error from here...
PyObject *sub_object = NULL;
if (i > 0) {
PyWinCoreString_Concat(&obrepr, comma);
if (!obrepr)
goto loop_error;
}
PyWinCoreString_Concat(&obrepr, obattrname);
if (!obrepr)
goto loop_error;
PyWinCoreString_Concat(&obrepr, equals);
if (!obrepr)
goto loop_error;
sub_object = PyRecord::getattro(self, obattrname);
if (!sub_object)
goto loop_error;
PyWinCoreString_ConcatAndDel(&obrepr, PyObject_Repr(sub_object));
Py_DECREF(sub_object);
Py_DECREF(obattrname);
continue;
// loop error handler.
loop_error:
Py_DECREF(obattrname);
goto done;
}
PyWinCoreString_Concat(&obrepr, closing_paren);
bsuccess = TRUE;
done:
Py_XDECREF(comma);
Py_XDECREF(equals);
Py_XDECREF(closing_paren);
if (strings)
_FreeFieldNames(strings, num_names);
if (!bsuccess) {
Py_XDECREF(obrepr);
obrepr = NULL;
}
return obrepr;
}
PyObject *PyRecord::getattro(PyObject *self, PyObject *obname)
{
PyObject *res;
PyRecord *pyrec = (PyRecord *)self;
char *name = PYWIN_ATTR_CONVERT(obname);
if (name == NULL)
return NULL;
if (strcmp(name, "__members__") == 0) {
ULONG cnames = 0;
HRESULT hr = pyrec->pri->GetFieldNames(&cnames, NULL);
if (FAILED(hr))
return PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo);
BSTR *strs = (BSTR *)malloc(sizeof(BSTR) * cnames);
if (strs == NULL)
return PyErr_NoMemory();
hr = pyrec->pri->GetFieldNames(&cnames, strs);
if (FAILED(hr)) {
free(strs);
return PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo);
}
res = PyList_New(cnames);
for (ULONG i = 0; i < cnames && res != NULL; i++) {
PyObject *item = PyWinCoreString_FromString(strs[i]);
SysFreeString(strs[i]);
if (item == NULL) {
Py_DECREF(res);
res = NULL;
}
else
PyList_SET_ITEM(res, i, item); // ref count swallowed.
}
free(strs);
return res;
}
res = PyObject_GenericGetAttr(self, obname);
if (res != NULL)
return res;
PyErr_Clear();
WCHAR *wname;
if (!PyWinObject_AsWCHAR(obname, &wname))
return NULL;
VARIANT vret;
VariantInit(&vret);
void *sub_data = NULL;
PY_INTERFACE_PRECALL;
HRESULT hr = pyrec->pri->GetFieldNoCopy(pyrec->pdata, wname, &vret, &sub_data);
PyWinObject_FreeWCHAR(wname);
PY_INTERFACE_POSTCALL;
if (FAILED(hr)) {
if (hr == TYPE_E_FIELDNOTFOUND) {
// This is slightly suspect - throwing a unicode
// object for an AttributeError in py2k - but this
// is the value we asked COM for, so it makes sense...
// (and PyErr_Format doesn't handle unicode in py2x)
PyErr_SetObject(PyExc_AttributeError, obname);
return NULL;
}
return PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo);
}
// Short-circuit sub-structs and arrays here, so we dont allocate a new chunk
// of memory and copy it - we need sub-structs to persist.
if (V_VT(&vret) == (VT_BYREF | VT_RECORD))
return new PyRecord(V_RECORDINFO(&vret), V_RECORD(&vret), pyrec->owner);
else if (V_VT(&vret) == (VT_BYREF | VT_ARRAY | VT_RECORD)) {
SAFEARRAY *psa = *V_ARRAYREF(&vret);
int d = SafeArrayGetDim(psa);
if (sub_data == NULL)
return PyErr_Format(PyExc_RuntimeError, "Did not get a buffer for the array!");
if (SafeArrayGetDim(psa) != 1)
return PyErr_Format(PyExc_TypeError, "Only support single dimensional arrays of records");
IRecordInfo *sub = NULL;
long ubound, lbound, nelems;
int i;
BYTE *this_data;
PyObject *ret_tuple = NULL;
ULONG element_size = 0;
hr = SafeArrayGetUBound(psa, 1, &ubound);
if (FAILED(hr))
goto array_end;
hr = SafeArrayGetLBound(psa, 1, &lbound);
if (FAILED(hr))
goto array_end;
hr = SafeArrayGetRecordInfo(psa, &sub);
if (FAILED(hr))
goto array_end;
hr = sub->GetSize(&element_size);
if (FAILED(hr))
goto array_end;
nelems = ubound - lbound;
ret_tuple = PyTuple_New(nelems);
if (ret_tuple == NULL)
goto array_end;
this_data = (BYTE *)sub_data;
for (i = 0; i < nelems; i++) {
PyTuple_SET_ITEM(ret_tuple, i, new PyRecord(sub, this_data, pyrec->owner));
this_data += element_size;
}
array_end:
if (sub)
sub->Release();
if (FAILED(hr))
return PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo);
return ret_tuple;
}
// This default conversion we use is a little slow (but it will do!)
// For arrays, the pparray->pvData member is *not* set, since the actual data
// pointer from the record is returned in sub_data, so set it here.
if (V_ISARRAY(&vret) && V_ISBYREF(&vret))
(*V_ARRAYREF(&vret))->pvData = sub_data;
PyObject *ret = PyCom_PyObjectFromVariant(&vret);
// VariantClear(&vret);
return ret;
}
int PyRecord::setattro(PyObject *self, PyObject *obname, PyObject *v)
{
VARIANT val;
VariantInit(&val);
PyRecord *pyrec = (PyRecord *)self;
if (!PyCom_VariantFromPyObject(v, &val))
return -1;
WCHAR *wname;
if (!PyWinObject_AsWCHAR(obname, &wname, FALSE))
return -1;
PY_INTERFACE_PRECALL;
HRESULT hr = pyrec->pri->PutField(INVOKE_PROPERTYPUT, pyrec->pdata, wname, &val);
PY_INTERFACE_POSTCALL;
PyWinObject_FreeWCHAR(wname);
VariantClear(&val);
if (FAILED(hr)) {
PyCom_BuildPyException(hr, pyrec->pri, IID_IRecordInfo);
return -1;
}
return 0;
}
PyObject *PyRecord::tp_richcompare(PyObject *self, PyObject *other, int op)
{
PyObject *ret = NULL;
if (op != Py_EQ && op != Py_NE) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
int success = op == Py_EQ ? TRUE : FALSE;
if (self->ob_type != other->ob_type) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
PyRecord *pyself = (PyRecord *)self;
PyRecord *pyother = (PyRecord *)other;
if (!pyself->pri->IsMatchingType(pyother->pri)) {
// Not matching types, so can't compare.
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
// Need to do a recursive compare, as some elements may be pointers
// (eg, strings, objects)
ULONG num_names;
BSTR *strings = _GetFieldNames(pyself->pri, &num_names);
if (strings == NULL)
return NULL;
for (ULONG i = 0; i < num_names; i++) {
ret = 0;
PyObject *obattrname;
obattrname = PyWinCoreString_FromString(strings[i]);
if (obattrname == NULL)
goto done;
// There appear to be several problems here. This will leave an exception hanging
// if an attribute is not found, and should probably return False if other does not
// have an attr that self does ???
// MarkH: but is that possible in practice? For structures,
// an attribute must be found, and the set must be identical
// (we have already checked the 'type' is the same above)
// (defense against COM errors etc would be nice though :)
PyObject *self_sub = PyRecord::getattro(self, obattrname);
if (!self_sub) {
Py_DECREF(obattrname);
goto done;
}
PyObject *other_sub = PyRecord::getattro(other, obattrname);
if (!other_sub) {
Py_DECREF(obattrname);
Py_DECREF(self_sub);
goto done;
}
int c = PyObject_RichCompareBool(self_sub, other_sub, op);
Py_DECREF(self_sub);
Py_DECREF(other_sub);
Py_DECREF(obattrname);
if (c == -1)
goto done;
if (c != success) {
ret = PyBool_FromLong(c);
goto done;
}
}
ret = PyBool_FromLong(success);
done:
_FreeFieldNames(strings, num_names);
return ret;
}
void PyRecord::tp_dealloc(PyObject *ob) { delete (PyRecord *)ob; }
| [
"ldy104220@163.com"
] | ldy104220@163.com |
be0a098ef9ad854db99cfc4173dd6169a4ffaef5 | db557a30a28f77774cf4662c119a9197fb3ae0a0 | /HelperFunctions/getVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV.cpp | 03f746be01a4453f95fb11e286f6b95c3493f468 | [
"Apache-2.0"
] | permissive | dkaip/jvulkan-natives-Linux-x86_64 | b076587525a5ee297849e08368f32d72098ae87e | ea7932f74e828953c712feea11e0b01751f9dc9b | refs/heads/master | 2021-07-14T16:57:14.386271 | 2020-09-13T23:04:39 | 2020-09-13T23:04:39 | 183,515,517 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,344 | cpp | /*
* Copyright 2020 Douglas Kaip
*
* 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.
*/
/*
* getVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV.cpp
*
* Created on: Sep 9, 2020
* Author: Douglas Kaip
*/
#include "JVulkanHelperFunctions.hh"
#include "slf4j.hh"
namespace jvulkan
{
void getVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV(
JNIEnv *env,
jobject jVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNVObject,
VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV *vkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV,
std::vector<void *> *memoryToFree)
{
jclass theClass = env->GetObjectClass(jVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNVObject);
if (env->ExceptionOccurred())
{
LOGERROR(env, "%s", "Could not get class for jVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNVObject");
return;
}
////////////////////////////////////////////////////////////////////////
VkStructureType sTypeValue = getSType(env, jVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNVObject);
if (env->ExceptionOccurred())
{
LOGERROR(env, "%s", "Call to getSType failed.");
return;
}
////////////////////////////////////////////////////////////////////////
jobject jpNextObject = getpNextObject(env, jVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNVObject);
if (env->ExceptionOccurred())
{
LOGERROR(env, "%s", "Call to getpNext failed.");
return;
}
void *pNext = nullptr;
if (jpNextObject != nullptr)
{
getpNextChain(
env,
jpNextObject,
&pNext,
memoryToFree);
if (env->ExceptionOccurred())
{
LOGERROR(env, "%s", "Call to getpNextChain failed.");
return;
}
}
////////////////////////////////////////////////////////////////////////
jmethodID methodId = env->GetMethodID(theClass, "isDeviceGeneratedCommands", "()Z");
if (env->ExceptionOccurred())
{
LOGERROR(env, "%s", "Could not find method id for isDeviceGeneratedCommands.");
return;
}
VkBool32 deviceGeneratedCommands = (VkBool32)env->CallBooleanMethod(jVkPhysicalDeviceDeviceGeneratedCommandsFeaturesNVObject, methodId);
if (env->ExceptionOccurred())
{
LOGERROR(env, "%s", "Error calling CallBooleanMethod.");
return;
}
vkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV->sType = sTypeValue;
vkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV->pNext = (void *)pNext;
vkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV->deviceGeneratedCommands = deviceGeneratedCommands;
}
}
| [
"dkaip@earthlink.net"
] | dkaip@earthlink.net |
71d68f1e2182fd766e49af1e74a2a56752c199a9 | 0d2ce66551a3c41c254aed1315565058ec72b996 | /src/blockchain_utilities/bootstrap_file.h | 7b7c8dac726f606832a7c7acfc2a145f37a0c18c | [
"BSD-3-Clause"
] | permissive | fireice-uk/ryo-currency | 03c536274c4d551e901d8e778c5786f1d19393de | 917dbb993178bb8a2ea571f214b15adcbb7c708f | refs/heads/genesis | 2022-10-24T22:44:05.249321 | 2018-06-24T21:21:39 | 2018-06-24T21:21:47 | 138,629,694 | 5 | 0 | NOASSERTION | 2020-08-23T23:27:04 | 2018-06-25T17:43:31 | C++ | UTF-8 | C++ | false | false | 3,906 | h | // Copyright (c) 2018, Ryo Currency Project
// Portions copyright (c) 2014-2018, The Monero Project
//
// Portions of this file are available under BSD-3 license. Please see ORIGINAL-LICENSE for details
// All rights reserved.
//
// Authors and copyright holders give permission for following:
//
// 1. Redistribution and use in source and binary forms WITHOUT modification.
//
// 2. Modification of the source form for your own personal use.
//
// As long as the following conditions are met:
//
// 3. You must not distribute modified copies of the to third parties. This includes
// posting the work online, or hosting copies of the modified work for download.
//
// 4. Any derivative version of this work is also covered by this license, including point 8.
//
// 5. Neither the name of the copyright holders nor the names of the authors may be
// used to endorse or promote products derived from this software without specific
// prior written permission.
//
// 6. You agree that this licence is governed by and shall be construed in accordance
// with the laws of England and Wales.
//
// 7. You agree to submit all disputes arising out of or in connection with this licence
// to the exclusive jurisdiction of the Courts of England and Wales.
//
// Authors and copyright holders agree that:
//
// 8. This licence expires and the work covered by it is released into the
// public domain on 1st of February 2019
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/iostreams/device/back_inserter.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/iostreams/stream_buffer.hpp>
#include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_core/blockchain.h"
#include <algorithm>
#include <atomic>
#include <boost/iostreams/copy.hpp>
#include <cstdio>
#include <fstream>
#include "common/command_line.h"
#include "version.h"
#include "blockchain_utilities.h"
using namespace cryptonote;
class BootstrapFile
{
public:
uint64_t count_bytes(std::ifstream &import_file, uint64_t blocks, uint64_t &h, bool &quit);
uint64_t count_blocks(const std::string &dir_path, std::streampos &start_pos, uint64_t &seek_height);
uint64_t count_blocks(const std::string &dir_path);
uint64_t seek_to_first_chunk(std::ifstream &import_file);
bool store_blockchain_raw(cryptonote::Blockchain *cs, cryptonote::tx_memory_pool *txp,
boost::filesystem::path &output_file, uint64_t use_block_height = 0);
protected:
Blockchain *m_blockchain_storage;
tx_memory_pool *m_tx_pool;
typedef std::vector<char> buffer_type;
std::ofstream *m_raw_data_file;
buffer_type m_buffer;
boost::iostreams::stream<boost::iostreams::back_insert_device<buffer_type>> *m_output_stream;
// open export file for write
bool open_writer(const boost::filesystem::path &file_path);
bool initialize_file();
bool close();
void write_block(block &block);
void flush_chunk();
private:
uint64_t m_height;
uint64_t m_cur_height; // tracks current height during export
uint32_t m_max_chunk;
};
| [
"psychocryptHPC@gmail.com"
] | psychocryptHPC@gmail.com |
422a90460e3eaa820383df8511c275550c224014 | 7bc6c0cef3185a32dafefb0c47e43f104e6f5830 | /www/chromium-legacy/files/patch-components_metrics_metrics__log.cc | 4c3918ed3c933ba7f147f41886faf285043dfb7d | [
"BSD-2-Clause"
] | permissive | dkgroot/DPorts | e4580d23d34c2a783650c71442d2419972b14193 | 4d1993fd80d7f69ea0e80c07c79b57642343d2bc | refs/heads/master | 2022-03-26T00:05:26.019205 | 2019-11-19T11:05:05 | 2019-11-19T11:05:05 | 195,806,777 | 0 | 0 | NOASSERTION | 2019-07-08T12:23:49 | 2019-07-08T12:23:49 | null | UTF-8 | C++ | false | false | 565 | cc | --- components/metrics/metrics_log.cc.orig 2019-06-04 18:55:21 UTC
+++ components/metrics/metrics_log.cc
@@ -197,7 +197,7 @@ void MetricsLog::RecordCoreSystemProfile(MetricsServic
// OperatingSystemVersion refers to the ChromeOS release version.
#if defined(OS_CHROMEOS)
os->set_kernel_version(base::SysInfo::KernelVersion());
-#elif defined(OS_LINUX)
+#elif defined(OS_LINUX) || defined(OS_BSD)
// Linux operating system version is copied over into kernel version to be
// consistent.
os->set_kernel_version(base::SysInfo::OperatingSystemVersion());
| [
"nobody@home.ok"
] | nobody@home.ok |
08e90ef517864d00c729b93171898a66c4c5c7bf | 13c9224b601a0736f5e6d4dd74e5b715ca84f433 | /src/test/test_bitcoin.cpp | f6429df97d1acdaea21ac7002e96b7a9fcb56536 | [
"MIT"
] | permissive | DTL-UWM/SOISCOIN | 394881aacb711289d11a099d661d8f6cfede9ebf | dd9553a5f79fab4a044eaae1423426346d9c4a53 | refs/heads/master | 2020-05-30T10:18:42.461215 | 2019-06-03T13:39:07 | 2019-06-03T13:39:07 | 189,669,263 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,738 | cpp | // Copyright (c) 2011-2016 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "test_bitcoin.h"
#include "chainparams.h"
#include "consensus/consensus.h"
#include "consensus/validation.h"
#include "crypto/sha256.h"
#include "fs.h"
#include "key.h"
#include "validation.h"
#include "miner.h"
#include "net_processing.h"
#include "pubkey.h"
#include "random.h"
#include "txdb.h"
#include "txmempool.h"
#include "ui_interface.h"
#include "rpc/server.h"
#include "rpc/register.h"
#include "script/sigcache.h"
#include <memory>
void CConnmanTest::AddNode(CNode& node)
{
LOCK(g_connman->cs_vNodes);
g_connman->vNodes.push_back(&node);
}
void CConnmanTest::ClearNodes()
{
LOCK(g_connman->cs_vNodes);
g_connman->vNodes.clear();
}
uint256 insecure_rand_seed = GetRandHash();
FastRandomContext insecure_rand_ctx(insecure_rand_seed);
extern bool fPrintToConsole;
extern void noui_connect();
BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
{
SHA256AutoDetect();
RandomInit();
ECC_Start();
SetupEnvironment();
SetupNetworking();
InitSignatureCache();
InitScriptExecutionCache();
fPrintToDebugLog = false; // don't want to write to debug.log file
fCheckBlockIndex = true;
SelectParams(chainName);
noui_connect();
}
BasicTestingSetup::~BasicTestingSetup()
{
ECC_Stop();
}
TestingSetup::TestingSetup(const std::string& chainName) : BasicTestingSetup(chainName)
{
const CChainParams& chainparams = Params();
// Ideally we'd move all the RPC tests to the functional testing framework
// instead of unit tests, but for now we need these here.
RegisterAllCoreRPCCommands(tableRPC);
ClearDatadirCache();
pathTemp = fs::temp_directory_path() / strprintf("test_soiscoin_%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(100000)));
fs::create_directories(pathTemp);
gArgs.ForceSetArg("-datadir", pathTemp.string());
// Note that because we don't bother running a scheduler thread here,
// callbacks via CValidationInterface are unreliable, but that's OK,
// our unit tests aren't testing multiple parts of the code at once.
GetMainSignals().RegisterBackgroundSignalScheduler(scheduler);
mempool.setSanityCheck(1.0);
pblocktree = new CBlockTreeDB(1 << 20, true);
pcoinsdbview = new CCoinsViewDB(1 << 23, true);
pcoinsTip = new CCoinsViewCache(pcoinsdbview);
if (!LoadGenesisBlock(chainparams)) {
throw std::runtime_error("LoadGenesisBlock failed.");
}
{
CValidationState state;
if (!ActivateBestChain(state, chainparams)) {
throw std::runtime_error("ActivateBestChain failed.");
}
}
nScriptCheckThreads = 3;
for (int i=0; i < nScriptCheckThreads-1; i++)
threadGroup.create_thread(&ThreadScriptCheck);
g_connman = std::unique_ptr<CConnman>(new CConnman(0x1337, 0x1337)); // Deterministic randomness for tests.
connman = g_connman.get();
peerLogic.reset(new PeerLogicValidation(connman, scheduler));
}
TestingSetup::~TestingSetup()
{
threadGroup.interrupt_all();
threadGroup.join_all();
GetMainSignals().FlushBackgroundCallbacks();
GetMainSignals().UnregisterBackgroundSignalScheduler();
g_connman.reset();
peerLogic.reset();
UnloadBlockIndex();
delete pcoinsTip;
delete pcoinsdbview;
delete pblocktree;
fs::remove_all(pathTemp);
}
TestChain100Setup::TestChain100Setup() : TestingSetup(CBaseChainParams::REGTEST)
{
// Generate a 100-block chain:
coinbaseKey.MakeNewKey(true);
CScript scriptPubKey = CScript() << ToByteVector(coinbaseKey.GetPubKey()) << OP_CHECKSIG;
for (int i = 0; i < COINBASE_MATURITY; i++)
{
std::vector<CMutableTransaction> noTxns;
CBlock b = CreateAndProcessBlock(noTxns, scriptPubKey);
coinbaseTxns.push_back(*b.vtx[0]);
}
}
//
// Create a new block with just given transactions, coinbase paying to
// scriptPubKey, and try to add it to the current chain.
//
CBlock
TestChain100Setup::CreateAndProcessBlock(const std::vector<CMutableTransaction>& txns, const CScript& scriptPubKey)
{
const CChainParams& chainparams = Params();
std::unique_ptr<CBlockTemplate> pblocktemplate = BlockAssembler(chainparams).CreateNewBlock(scriptPubKey);
CBlock& block = pblocktemplate->block;
// Replace mempool-selected txns with just coinbase plus passed-in txns:
block.vtx.resize(1);
for (const CMutableTransaction& tx : txns)
block.vtx.push_back(MakeTransactionRef(tx));
// IncrementExtraNonce creates a valid coinbase and merkleRoot
unsigned int extraNonce = 0;
IncrementExtraNonce(&block, chainActive.Tip(), extraNonce);
while (!CheckProofOfWork(block.GetPoWHash(), block.nBits, chainparams.GetConsensus())) ++block.nNonce;
std::shared_ptr<const CBlock> shared_pblock = std::make_shared<const CBlock>(block);
ProcessNewBlock(chainparams, shared_pblock, true, nullptr);
CBlock result = block;
return result;
}
TestChain100Setup::~TestChain100Setup()
{
}
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CMutableTransaction &tx) {
CTransaction txn(tx);
return FromTx(txn);
}
CTxMemPoolEntry TestMemPoolEntryHelper::FromTx(const CTransaction &txn) {
return CTxMemPoolEntry(MakeTransactionRef(txn), nFee, nTime, nHeight,
spendsCoinbase, sigOpCost, lp);
}
| [
"kris.zernikel@protonmail.com"
] | kris.zernikel@protonmail.com |
8d836bc57b4c2dbe201e45b3864ad251d9d3c301 | 09e3dd86f55a3c0dfa76c13e61c60a8d43444949 | /MainWin.h | e27af82d156ee8a5e64dcd512517336eef726147 | [] | no_license | vito/MusicPlayer | 548b58f0c901acdfa23bc0813c6030831a2489d4 | 5803c7c8386714761188c008c0418838defaf617 | refs/heads/master | 2020-05-03T02:28:53.171832 | 2009-11-11T03:38:40 | 2009-11-11T03:39:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,126 | h | #ifndef __MAIN_WIN_H
#define __MAIN_WIN_H
#include <Button.h>
#include <CheckBox.h>
#include <MediaFile.h>
#include <MediaTrack.h>
#include <SoundPlayer.h>
#include <StatusBar.h>
#include <Window.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
class MainWin : public BWindow {
// GUI elements
BButton *play;
BButton *pause;
BButton *next;
BButton *stop;
BCheckBox *shuffleTick;
BStatusBar *progress;
// Playback state
int32 position;
bool shuffle;
void MainView();
void Play();
void Pause();
void Stop();
void Next();
public:
static bigtime_t time;
static BMediaTrack *playTrack;
static BMediaFile *mediaFile;
static BSoundPlayer *sp;
static media_format playFormat;
static void PlayBuffer(void *cookie, void *buffer, size_t size, const media_raw_audio_format &format);
static void Notifier(void *cookie, BSoundPlayer::sound_player_notification what, ...);
static void Timestamp(char *target, bigtime_t length);
MainWin();
bool QuitRequested();
void MessageReceived(BMessage *message);
};
#endif
| [
"i.am@toogeneric.com"
] | i.am@toogeneric.com |
08b48d4d8935772d55ac9a63bd87f76bb54b6115 | aba1677649d60295b823c0eb65509cfbb7a1c44a | /base_files/lexemes.hpp | be467b45e141b82936d37247781e488eef84681f | [] | no_license | BangodKA/SubPython | 9183258256a515cce5e0809e27cc6650ef0a0139 | a6ebd3f3495307885bff845a3b344be42a627403 | refs/heads/master | 2022-07-20T21:27:39.665422 | 2020-05-09T17:58:15 | 2020-05-09T17:58:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 794 | hpp | #pragma once
#include <iostream>
#include <sstream>
#include <string>
struct Lexeme {
enum LexemeType {
// Constants
// String consists of ASCII only;
StringConst,
BoolConst,
IntegerConst,
FloatConst,
// Keywords
Bool,
Int,
Str,
Float,
While,
For,
Break,
Continue,
If,
Else,
ElIf,
In,
Range,
And,
Or,
Not,
Print,
// Punctuators/Operators
EOL,
IndentSpace,
Comma,
Colon,
LeftParenthesis,
RightParenthesis,
Assign,
Equal,
NotEqual,
Less,
LessEq,
Greater,
GreaterEq,
Add,
Sub,
Mul,
Div,
Mod,
UnaryMinus, // Special operation, not lexeme
Identifier,
};
Lexeme() = default;
LexemeType type;
std::string value;
int indent_amount = 0;
static std::string TypeToString(Lexeme::LexemeType type);
};
| [
"krapivin_2000@mail.ru"
] | krapivin_2000@mail.ru |
43d807c43d8cc20e6f767cb4f5e8e3dd3d90230b | dd0ac9ffeefa100e3c68395c7615c884f4598f62 | /c2019/commands/test_auto.cpp | 80668c2ac735ea31848591c39290338bea9a3d94 | [
"MIT"
] | permissive | jishnusen/robot-code-public | 9dda261d1ee89b5a4588dcc81c6ed5606d095e6c | eb8eea0400bf57135e9e2e9d8a882a3491c88ab2 | refs/heads/master | 2022-12-28T03:14:32.150553 | 2019-04-03T01:52:09 | 2019-04-03T01:52:09 | 115,956,512 | 0 | 0 | null | 2018-01-01T23:49:31 | 2018-01-01T23:49:31 | null | UTF-8 | C++ | false | false | 959 | cpp | #include "c2019/commands/test_auto.h"
namespace c2019 {
namespace commands {
using muan::wpilib::DriverStationProto;
bool TestAuto::IsAutonomous() {
DriverStationProto driver_station;
AutoGoalProto auto_goal;
if (!driver_station_reader_.ReadLastMessage(&driver_station)) {
LOG(WARNING, "No driver station status found.");
return false;
}
if (!driver_station->is_sys_active()) {
LOG(WARNING, "Tried to run command while disabled.");
return false;
}
if (!auto_goal_reader_.ReadLastMessage(&auto_goal)) {
LOG(WARNING, "No auto goal found.");
return false;
}
if (auto_goal->run_command() && auto_goal->command() == TEST_AUTO) {
return true;
}
return false;
}
void TestAuto::operator()() {
EnterAutonomous();
SetFieldPosition(0.0, -0.3, 0.0);
LOG(INFO, "Running TEST auto");
StartDrivePath(2.55, 1.2, 0, 1, false);
Wait(50);
ExitAutonomous();
}
} // namespace commands
} // namespace c2019
| [
"noreply@github.com"
] | jishnusen.noreply@github.com |
d2f7a6d18c79235ad5413b81b28c4563f9664adf | 8f9ac0b6269772bbcd809301e8ca8d1c9e24a348 | /src/test/base58_tests.cpp | 762a4d1f5c4191519c3e431f453709c05fb67602 | [
"MIT"
] | permissive | ezehy/starcashx | 3f6e8359cff15ec5568d97bcbad5cd20dbdb58e0 | 68aa67b863a4ed75d833875a55f5161e37e17f14 | refs/heads/master | 2020-03-26T23:07:04.092633 | 2018-10-11T10:05:41 | 2018-10-11T10:05:41 | 145,511,954 | 0 | 2 | null | 2018-11-04T09:32:19 | 2018-08-21T05:38:54 | C++ | UTF-8 | C++ | false | false | 9,546 | cpp | #include <boost/test/unit_test.hpp>
#include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h"
#include "json/json_spirit_utils.h"
#include "base58.h"
#include "util.h"
using namespace json_spirit;
extern Array read_json(const std::string& filename);
BOOST_AUTO_TEST_SUITE(base58_tests)
// Goal: test low-level base58 encoding functionality
BOOST_AUTO_TEST_CASE(base58_EncodeBase58)
{
Array tests = read_json("base58_encode_decode.json");
BOOST_FOREACH(Value& tv, tests)
{
Array test = tv.get_array();
std::string strTest = write_string(tv, false);
if (test.size() < 2) // Allow for extra stuff (useful for comments)
{
BOOST_ERROR("Bad test: " << strTest);
continue;
}
std::vector<unsigned char> sourcedata = ParseHex(test[0].get_str());
std::string base58string = test[1].get_str();
BOOST_CHECK_MESSAGE(
EncodeBase58(&sourcedata[0], &sourcedata[sourcedata.size()]) == base58string,
strTest);
}
}
// Goal: test low-level base58 decoding functionality
BOOST_AUTO_TEST_CASE(base58_DecodeBase58)
{
Array tests = read_json("base58_encode_decode.json");
std::vector<unsigned char> result;
BOOST_FOREACH(Value& tv, tests)
{
Array test = tv.get_array();
std::string strTest = write_string(tv, false);
if (test.size() < 2) // Allow for extra stuff (useful for comments)
{
BOOST_ERROR("Bad test: " << strTest);
continue;
}
std::vector<unsigned char> expected = ParseHex(test[0].get_str());
std::string base58string = test[1].get_str();
BOOST_CHECK_MESSAGE(DecodeBase58(base58string, result), strTest);
BOOST_CHECK_MESSAGE(result.size() == expected.size() && std::equal(result.begin(), result.end(), expected.begin()), strTest);
}
BOOST_CHECK(!DecodeBase58("invalid", result));
}
// Visitor to check address type
class TestAddrTypeVisitor : public boost::static_visitor<bool>
{
private:
std::string exp_addrType;
public:
TestAddrTypeVisitor(const std::string &exp_addrType) : exp_addrType(exp_addrType) { }
bool operator()(const CKeyID &id) const
{
return (exp_addrType == "pubkey");
}
bool operator()(const CScriptID &id) const
{
return (exp_addrType == "script");
}
bool operator()(const CNoDestination &no) const
{
return (exp_addrType == "none");
}
};
// Visitor to check address payload
class TestPayloadVisitor : public boost::static_visitor<bool>
{
private:
std::vector<unsigned char> exp_payload;
public:
TestPayloadVisitor(std::vector<unsigned char> &exp_payload) : exp_payload(exp_payload) { }
bool operator()(const CKeyID &id) const
{
uint160 exp_key(exp_payload);
return exp_key == id;
}
bool operator()(const CScriptID &id) const
{
uint160 exp_key(exp_payload);
return exp_key == id;
}
bool operator()(const CNoDestination &no) const
{
return exp_payload.size() == 0;
}
};
// Goal: check that parsed keys match test payload
BOOST_AUTO_TEST_CASE(base58_keys_valid_parse)
{
Array tests = read_json("base58_keys_valid.json");
std::vector<unsigned char> result;
CStarCashXcoinSecret secret;
CStarCashXcoinAddress addr;
BOOST_FOREACH(Value& tv, tests)
{
Array test = tv.get_array();
std::string strTest = write_string(tv, false);
if (test.size() < 3) // Allow for extra stuff (useful for comments)
{
BOOST_ERROR("Bad test: " << strTest);
continue;
}
std::string exp_base58string = test[0].get_str();
std::vector<unsigned char> exp_payload = ParseHex(test[1].get_str());
const Object &metadata = test[2].get_obj();
bool isPrivkey = find_value(metadata, "isPrivkey").get_bool();
bool isTestnet = find_value(metadata, "isTestnet").get_bool();
if (isTestnet)
SelectParams(CChainParams::TESTNET);
else
SelectParams(CChainParams::MAIN);
if(isPrivkey)
{
bool isCompressed = find_value(metadata, "isCompressed").get_bool();
// Must be valid private key
// Note: CStarCashXcoinSecret::SetString tests isValid, whereas CStarCashXcoinAddress does not!
BOOST_CHECK_MESSAGE(secret.SetString(exp_base58string), "!SetString:"+ strTest);
BOOST_CHECK_MESSAGE(secret.IsValid(), "!IsValid:" + strTest);
CKey privkey = secret.GetKey();
BOOST_CHECK_MESSAGE(privkey.IsCompressed() == isCompressed, "compressed mismatch:" + strTest);
BOOST_CHECK_MESSAGE(privkey.size() == exp_payload.size() && std::equal(privkey.begin(), privkey.end(), exp_payload.begin()), "key mismatch:" + strTest);
// Private key must be invalid public key
addr.SetString(exp_base58string);
BOOST_CHECK_MESSAGE(!addr.IsValid(), "IsValid privkey as pubkey:" + strTest);
}
else
{
std::string exp_addrType = find_value(metadata, "addrType").get_str(); // "script" or "pubkey"
// Must be valid public key
BOOST_CHECK_MESSAGE(addr.SetString(exp_base58string), "SetString:" + strTest);
BOOST_CHECK_MESSAGE(addr.IsValid(), "!IsValid:" + strTest);
BOOST_CHECK_MESSAGE(addr.IsScript() == (exp_addrType == "script"), "isScript mismatch" + strTest);
CTxDestination dest = addr.Get();
BOOST_CHECK_MESSAGE(boost::apply_visitor(TestAddrTypeVisitor(exp_addrType), dest), "addrType mismatch" + strTest);
// Public key must be invalid private key
secret.SetString(exp_base58string);
BOOST_CHECK_MESSAGE(!secret.IsValid(), "IsValid pubkey as privkey:" + strTest);
}
}
SelectParams(CChainParams::MAIN);
}
// Goal: check that generated keys match test vectors
BOOST_AUTO_TEST_CASE(base58_keys_valid_gen)
{
Array tests = read_json("base58_keys_valid.json");
std::vector<unsigned char> result;
BOOST_FOREACH(Value& tv, tests)
{
Array test = tv.get_array();
std::string strTest = write_string(tv, false);
if (test.size() < 3) // Allow for extra stuff (useful for comments)
{
BOOST_ERROR("Bad test: " << strTest);
continue;
}
std::string exp_base58string = test[0].get_str();
std::vector<unsigned char> exp_payload = ParseHex(test[1].get_str());
const Object &metadata = test[2].get_obj();
bool isPrivkey = find_value(metadata, "isPrivkey").get_bool();
bool isTestnet = find_value(metadata, "isTestnet").get_bool();
if (isTestnet)
SelectParams(CChainParams::TESTNET);
else
SelectParams(CChainParams::MAIN);
if(isPrivkey)
{
bool isCompressed = find_value(metadata, "isCompressed").get_bool();
CKey key;
key.Set(exp_payload.begin(), exp_payload.end(), isCompressed);
assert(key.IsValid());
CStarCashXcoinSecret secret;
secret.SetKey(key);
BOOST_CHECK_MESSAGE(secret.ToString() == exp_base58string, "result mismatch: " + strTest);
}
else
{
std::string exp_addrType = find_value(metadata, "addrType").get_str();
CTxDestination dest;
if(exp_addrType == "pubkey")
{
dest = CKeyID(uint160(exp_payload));
}
else if(exp_addrType == "script")
{
dest = CScriptID(uint160(exp_payload));
}
else if(exp_addrType == "none")
{
dest = CNoDestination();
}
else
{
BOOST_ERROR("Bad addrtype: " << strTest);
continue;
}
CStarCashXcoinAddress addrOut;
BOOST_CHECK_MESSAGE(boost::apply_visitor(CStarCashXcoinAddressVisitor(&addrOut), dest), "encode dest: " + strTest);
BOOST_CHECK_MESSAGE(addrOut.ToString() == exp_base58string, "mismatch: " + strTest);
}
}
// Visiting a CNoDestination must fail
CStarCashXcoinAddress dummyAddr;
CTxDestination nodest = CNoDestination();
BOOST_CHECK(!boost::apply_visitor(CStarCashXcoinAddressVisitor(&dummyAddr), nodest));
SelectParams(CChainParams::MAIN);
}
// Goal: check that base58 parsing code is robust against a variety of corrupted data
BOOST_AUTO_TEST_CASE(base58_keys_invalid)
{
Array tests = read_json("base58_keys_invalid.json"); // Negative testcases
std::vector<unsigned char> result;
CStarCashXcoinSecret secret;
CStarCashXcoinAddress addr;
BOOST_FOREACH(Value& tv, tests)
{
Array test = tv.get_array();
std::string strTest = write_string(tv, false);
if (test.size() < 1) // Allow for extra stuff (useful for comments)
{
BOOST_ERROR("Bad test: " << strTest);
continue;
}
std::string exp_base58string = test[0].get_str();
// must be invalid as public and as private key
addr.SetString(exp_base58string);
BOOST_CHECK_MESSAGE(!addr.IsValid(), "IsValid pubkey:" + strTest);
secret.SetString(exp_base58string);
BOOST_CHECK_MESSAGE(!secret.IsValid(), "IsValid privkey:" + strTest);
}
}
BOOST_AUTO_TEST_SUITE_END()
| [
"noreply@github.com"
] | ezehy.noreply@github.com |
a071624e0338d3932cd2db5d1c3367b450129f2e | 6d95b4e3e1d1dbbaeffe2c7e7b7c0e3f436c7ff8 | /Sqrt.cpp | d412d24f6eae330aecd669d291bb26f0dab87c77 | [] | no_license | bapijun/leetcode-1 | 7597dfee7e8dbb5f133bc3e90b182073f435614b | d2630c40bb938db27725fd4df3981183b0ada383 | refs/heads/master | 2021-01-21T03:33:55.109924 | 2015-12-22T14:08:44 | 2015-12-22T14:08:44 | 48,434,710 | 1 | 0 | null | 2015-12-22T13:54:26 | 2015-12-22T13:54:26 | null | UTF-8 | C++ | false | false | 364 | cpp | class Solution {
public:
int sqrt(int x) {
unsigned long long int l = 1;
unsigned long long int h = x;
while (l < h) {
unsigned long long m = l+ (h - l) / 2;
unsigned long long multiply = m * m;
if (multiply > x) {
h = m - 1;
} else if (multiply < x) {
l = m + 1;
} else {
return m;
}
}
return h * h > x ? h - 1 : h;
}
}; | [
"coderchen@yeah.net"
] | coderchen@yeah.net |
a59da7b75e89b015c59addefec840e4871e8c895 | 39c3d663992aec80c76c022393ee55d3ae83ad1d | /01_white/week04/02.cpp | e967a1a3d89c46afc6c45f2f03067990f7c65ae3 | [] | no_license | vlad-khramov/c-plus-plus-modern-development | 40f0dd670335e43cadecc73d0b104def5559027f | 44794e1f87a442ffc5fe6797f756b0cca2b7e5d4 | refs/heads/master | 2023-02-20T05:25:25.147169 | 2018-10-28T06:52:10 | 2018-10-28T06:52:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,077 | cpp | #include <iostream>
#include <string>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
using namespace std;
//
//struct Image {
// double quality;
// double freshness;
// double rating;
//};
//
//struct Params {
// double a;
// double b;
// double c;
//};
class FunctionPart {
public:
FunctionPart(char op, double value) {
_op = op;
_value = value;
}
void Invert() {
_op = _op == '-' ? '+' : '-';
}
double Apply(double val) const {
return val + _value * (_op == '-' ? -1 : 1);
}
private:
char _op;
double _value;
};
class Function {
public:
void AddPart(char op, double val) {
_parts.push_back({op, val});
}
double Apply(double val) const {
for (auto& part : _parts) {
val = part.Apply(val);
}
return val;
}
void Invert() {
for (auto& part : _parts) {
part.Invert();
}
reverse(begin(_parts), end(_parts));
}
private:
vector<FunctionPart> _parts;
};
//Function MakeWeightFunction(const Params& params,
// const Image& image) {
// Function function;
// function.AddPart('-', image.freshness * params.a + params.b);
// function.AddPart('+', image.rating * params.c);
// return function;
//}
//
//double ComputeImageWeight(const Params& params, const Image& image) {
// Function function = MakeWeightFunction(params, image);
// return function.Apply(image.quality);
//}
//
//double ComputeQualityByWeight(const Params& params,
// const Image& image,
// double weight) {
// Function function = MakeWeightFunction(params, image);
// function.Invert();
// return function.Apply(weight);
//}
//
//int main() {
// Image image = {10, 2, 6};
// Params params = {4, 2, 6};
// cout << ComputeImageWeight(params, image) << endl;
// cout << ComputeQualityByWeight(params, image, 46) << endl;
// return 0;
//} | [
"quant13@gmail.com"
] | quant13@gmail.com |
431c59fb5c496f5ce7dc72d089658dd5c7e7a78c | f4526bb89a30d3df27a76e2167f6376a062f691f | /samples/rabbit/rabbit_profile.cpp | 1b015b6b1e4c47c99d0668f19596f70429915ad7 | [
"MIT"
] | permissive | Litutu/octoon | b5f5cc726b75cad7ccedca3bf5696c27c4e75695 | 613b3eb5b9c1576c083b2cc28eb5ca31ce03b506 | refs/heads/master | 2022-12-05T09:56:52.748413 | 2020-08-17T15:15:21 | 2020-08-17T15:15:32 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 3,139 | cpp | #include "rabbit_profile.h"
#include <fstream>
#include <filesystem>
#include <octoon/runtime/json.h>
namespace rabbit
{
RabbitProfile::RabbitProfile() noexcept
: denoiseModule(std::make_shared<DenoiseModule>())
, physicsModule(std::make_shared<PhysicsModule>())
, h264Module(std::make_shared<H264Module>())
, timeModule(std::make_shared<TimeModule>())
, fileModule(std::make_shared<FileModule>())
, entitiesModule(std::make_shared<EntitiesModule>())
, offlineModule(std::make_shared<OfflineModule>())
, canvasModule(std::make_shared<CanvasModule>())
, markModule(std::make_shared<MarkModule>())
, sunModule(std::make_shared<SunModule>())
, environmentModule(std::make_shared<EnvironmentModule>())
, clientModule(std::make_shared<ClientModule>())
, materialModule(std::make_shared<MaterialModule>())
, dragModule(std::make_shared<DragModule>())
, gridModule(std::make_shared<GridModule>())
{
}
RabbitProfile::RabbitProfile(std::string_view path) noexcept(false)
: RabbitProfile()
{
std::ifstream stream(path);
if (stream)
{
auto json = octoon::runtime::json::parse(stream);
this->denoiseModule->load(json["denoise"]);
this->physicsModule->load(json["physics"]);
this->h264Module->load(json["h264"]);
this->timeModule->load(json["time"]);
this->fileModule->load(json["file"]);
this->entitiesModule->load(json["entities"]);
this->offlineModule->load(json["offline"]);
this->canvasModule->load(json["canvas"]);
this->markModule->load(json["mark"]);
this->sunModule->load(json["sun"]);
this->environmentModule->load(json["environment"]);
this->clientModule->load(json["client"]);
this->materialModule->load(json["material"]);
this->dragModule->load(json["drag"]);
this->gridModule->load(json["grid"]);
}
else
{
throw std::runtime_error(u8"无法打开文件: " + std::string(path));
}
}
RabbitProfile::~RabbitProfile() noexcept
{
}
std::unique_ptr<RabbitProfile>
RabbitProfile::load(std::string_view path) noexcept(false)
{
return std::make_unique<RabbitProfile>(path);
}
void
RabbitProfile::save(std::string_view path, const RabbitProfile& profile) noexcept(false)
{
std::ofstream stream(path);
if (stream)
{
octoon::runtime::json json;
profile.denoiseModule->save(json["denoise"]);
profile.physicsModule->save(json["physics"]);
profile.h264Module->save(json["h264"]);
profile.timeModule->save(json["time"]);
profile.fileModule->save(json["file"]);
profile.entitiesModule->save(json["entities"]);
profile.offlineModule->save(json["offline"]);
profile.canvasModule->save(json["canvas"]);
profile.markModule->save(json["mark"]);
profile.sunModule->save(json["sun"]);
profile.environmentModule->save(json["environment"]);
profile.clientModule->save(json["client"]);
profile.materialModule->save(json["material"]);
profile.dragModule->save(json["drag"]);
profile.gridModule->save(json["grid"]);
auto string = json.dump();
stream.write(string.c_str(), string.size());
}
else
{
throw std::runtime_error(u8"无法创建文件: " + std::string(path));
}
}
} | [
"2221870259@qq.com"
] | 2221870259@qq.com |
b0faaaed8a02c042ecd1a82b63c15b896bd464d3 | e7f74d5683701e9552f3d476dc8f57775128f90f | /hackerrank.com/connecting-towns.cpp | 997b74870d48a3926b0ece6c01b5c7042995ca5c | [
"MIT"
] | permissive | bolatov/contests | 89463675ea3114115bd921973b54eb64620c19a2 | 39654ec36e1b7ff62052e324428141a9564fd576 | refs/heads/master | 2021-01-24T11:19:53.864281 | 2018-07-12T05:37:09 | 2018-07-12T05:37:09 | 21,923,806 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 434 | cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
const int MOD = 1234567;
int main() {
int t, n, ni;
cin >> t;
while (t-- > 0) {
cin >> n;
int ans = 1;
for (int i = 0; i < n - 1; ++i) {
cin >> ni;
ans = (ni * ans) % MOD;
ans %= MOD;
}
cout << ans << endl;
}
return 0;
}
| [
"almer.bolatov@gmail.com"
] | almer.bolatov@gmail.com |
28b9493533c2d0668c2b79c25c53c14dc46d6a4b | f6cb916c7e9db39728e786f89df8d59fe3dfec3d | /bugs/13152/bindings/bcd/fltk/Fl_Tiled_Image.cc | ffd457db0e96aab522c1b080592cb426145674ca | [] | no_license | CyberShadow/DBugTests | 8e2b9935ab1e65e7c14638b4a63bc5fec8aee1a2 | 24a227d9b835c1bc72b6c469ab293e0c3bf9039f | refs/heads/master | 2023-08-22T14:37:08.841829 | 2023-07-20T16:51:45 | 2023-07-20T16:51:45 | 23,382,869 | 4 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,341 | cc | /* THIS FILE GENERATED BY bcd.gen */
#include <stdlib.h>
#include <string.h>
#include "../bind.h"
#include "FL/Fl_Tiled_Image.H"
extern "C" {
void _BCD_delete_14Fl_Tiled_Image(Fl_Tiled_Image *This) {
delete This;
}
Fl_Tiled_Image *_BCD_new__ZN14Fl_Tiled_ImageC1EP8Fl_Imageii(Fl_Image * i, int W, int H) {
return new Fl_Tiled_Image(i, W, H);
}
Fl_Image * _BCD__ZN14Fl_Tiled_Image4copyEii(Fl_Tiled_Image *This, int W, int H) {
return (This->copy(W, H));
}
Fl_Image * _BCD__ZN14Fl_Tiled_Image4copyEv(Fl_Tiled_Image *This) {
return (This->copy());
}
void _BCD__ZN14Fl_Tiled_Image13color_averageE8Fl_Colorf(Fl_Tiled_Image *This, enum Fl_Color c, float i) {
(This->color_average(c, i));
}
void _BCD__ZN14Fl_Tiled_Image10desaturateEv(Fl_Tiled_Image *This) {
(This->desaturate());
}
void _BCD__ZN14Fl_Tiled_Image4drawEiiiiii(Fl_Tiled_Image *This, int X, int Y, int W, int H, int cx, int cy) {
(This->draw(X, Y, W, H, cx, cy));
}
void _BCD__ZN14Fl_Tiled_Image4drawEii(Fl_Tiled_Image *This, int X, int Y) {
(This->draw(X, Y));
}
Fl_Image * _BCD__ZN14Fl_Tiled_Image5imageEv(Fl_Tiled_Image *This) {
return (This->image());
}
int _BCD_R__ZN14Fl_Tiled_Image4copyEii__Fl_Tiled_Image_R_CHECK(void *);
Fl_Image * _BCD_R__ZN14Fl_Tiled_Image4copyEii__Fl_Tiled_Image_R(void *, int W, int H);
int _BCD_R__ZN14Fl_Tiled_Image13color_averageE8Fl_Colorf__Fl_Tiled_Image_R_CHECK(void *);
void _BCD_R__ZN14Fl_Tiled_Image13color_averageE8Fl_Colorf__Fl_Tiled_Image_R(void *, enum Fl_Color c, float i);
int _BCD_R__ZN14Fl_Tiled_Image10desaturateEv__Fl_Tiled_Image_R_CHECK(void *);
void _BCD_R__ZN14Fl_Tiled_Image10desaturateEv__Fl_Tiled_Image_R(void *);
int _BCD_R__ZN14Fl_Tiled_Image4drawEiiiiii__Fl_Tiled_Image_R_CHECK(void *);
void _BCD_R__ZN14Fl_Tiled_Image4drawEiiiiii__Fl_Tiled_Image_R(void *, int X, int Y, int W, int H, int cx, int cy);
}
class Fl_Tiled_Image_R : Fl_Tiled_Image {
public:
void *__D_data;
Fl_Tiled_Image_R(Fl_Image * i, int W, int H) : Fl_Tiled_Image(i, W, H) {}
Fl_Image * copy(int W, int H) {
if (_BCD_R__ZN14Fl_Tiled_Image4copyEii__Fl_Tiled_Image_R_CHECK(__D_data))
return _BCD_R__ZN14Fl_Tiled_Image4copyEii__Fl_Tiled_Image_R(__D_data, W, H);
else
return Fl_Tiled_Image::copy(W, H);
}
void color_average(enum Fl_Color c, float i) {
if (_BCD_R__ZN14Fl_Tiled_Image13color_averageE8Fl_Colorf__Fl_Tiled_Image_R_CHECK(__D_data))
_BCD_R__ZN14Fl_Tiled_Image13color_averageE8Fl_Colorf__Fl_Tiled_Image_R(__D_data, c, i);
else
Fl_Tiled_Image::color_average(c, i);
}
void desaturate() {
if (_BCD_R__ZN14Fl_Tiled_Image10desaturateEv__Fl_Tiled_Image_R_CHECK(__D_data))
_BCD_R__ZN14Fl_Tiled_Image10desaturateEv__Fl_Tiled_Image_R(__D_data);
else
Fl_Tiled_Image::desaturate();
}
void draw(int X, int Y, int W, int H, int cx, int cy) {
if (_BCD_R__ZN14Fl_Tiled_Image4drawEiiiiii__Fl_Tiled_Image_R_CHECK(__D_data))
_BCD_R__ZN14Fl_Tiled_Image4drawEiiiiii__Fl_Tiled_Image_R(__D_data, X, Y, W, H, cx, cy);
else
Fl_Tiled_Image::draw(X, Y, W, H, cx, cy);
}
};
extern "C" {
Fl_Tiled_Image_R *_BCD_new__ZN14Fl_Tiled_ImageC1EP8Fl_Imageii_R(Fl_Image * i, int W, int H) {
return new Fl_Tiled_Image_R(i, W, H);
}
void _BCD_delete_14Fl_Tiled_Image__Fl_Tiled_Image_R(Fl_Tiled_Image_R *This) {
delete This;
}
void _BCD_RI_14Fl_Tiled_Image(Fl_Tiled_Image_R *cd, void *dd) {
cd->__D_data = dd;
}
typedef long unsigned int _BCD__47_ulong;
typedef unsigned char _BCD__49_uchar;
}
| [
"vladimir@thecybershadow.net"
] | vladimir@thecybershadow.net |
189407752b4244f96f90e1d8220b4947cf411d49 | 4c28e923fa8af7a7afc4ece61afef842193dcf82 | /cpp/methods/boosting.cpp | 1fd26b7a7a0cba7be257e6507a69910c85c56b63 | [
"Apache-2.0"
] | permissive | towelenee/ml_lib | 3cb381959ddf697ee3200414bb0ef428368559d7 | 9fb218f98b7e4ae710e124e2f021125fb71e65a7 | refs/heads/master | 2020-06-16T07:01:09.788377 | 2019-06-27T12:19:42 | 2019-06-27T12:25:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,089 | cpp | #include "boosting.h"
#include <models/ensemble.h>
#include <chrono>
ModelPtr Boosting::fit(const DataSet& dataSet, const Target& target) {
assert(&dataSet == &target.owner());
Mx cursor(dataSet.samplesCount(), 1);
std::vector<ModelPtr> models;
auto start = std::chrono::system_clock::now();
for (int32_t iter = 0; iter < config_.iterations_; ++iter) {
auto weakTarget = weak_target_->create(dataSet, target, cursor);
models.push_back(weak_learner_->fit(dataSet, *weakTarget)->scale(config_.step_));
invoke(*models.back());
models.back()->append(dataSet, cursor);
}
std::cout << "fit time " << std::chrono::duration<double>(std::chrono::system_clock::now() - start).count() << std::endl;
return std::make_shared<Ensemble>(std::move(models));
}
Boosting::Boosting(
const BoostingConfig& config,
std::unique_ptr<EmpiricalTargetFactory>&& weak_target,
std::unique_ptr<Optimizer>&& weak_learner)
: config_(config)
, weak_target_(std::move(weak_target))
, weak_learner_(std::move(weak_learner)) {}
| [
"vasilij.ershov@gmail.com"
] | vasilij.ershov@gmail.com |
e5cd3fe250c14d31b6ba7cf03c29f7d93ad8712f | 6b32a6ba99c200c3bcfa57a2e4597c57688f4ff7 | /erizo/src/erizo/rtp/SequenceNumberTranslator.cpp | ba4b16372ba42aba176a340bd9fcd6609ac169f7 | [
"MIT"
] | permissive | wlfsihua/licode | 380f76c33c02bbb926f714f8a1e5ca4a40c25859 | dd4fe81e1fbcb8204b0bc366382c87f6384a9eba | refs/heads/master | 2021-01-11T19:59:14.973686 | 2017-02-23T13:02:34 | 2017-02-23T13:02:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,463 | cpp | #include "rtp/SequenceNumberTranslator.h"
#include <vector>
#include "rtp/RtpUtils.h"
namespace erizo {
constexpr uint16_t kMaxSequenceNumberInBuffer = 511; // = 65536 / 128 and more than 10s of audio @50fps
constexpr uint16_t kMaxDistance = 200;
DEFINE_LOGGER(SequenceNumberTranslator, "rtp.SequenceNumberTranslator");
SequenceNumberTranslator::SequenceNumberTranslator()
: in_out_buffer_{kMaxSequenceNumberInBuffer},
out_in_buffer_{kMaxSequenceNumberInBuffer},
first_input_sequence_number_{0},
last_input_sequence_number_{0},
initial_output_sequence_number_{0},
initialized_{false}, reset_{false} {
}
void SequenceNumberTranslator::add(SequenceNumber sequence_number) {
in_out_buffer_[sequence_number.input % kMaxSequenceNumberInBuffer] = sequence_number;
out_in_buffer_[sequence_number.output % kMaxSequenceNumberInBuffer] = sequence_number;
}
uint16_t SequenceNumberTranslator::fill(const uint16_t &first,
const uint16_t &last) {
const SequenceNumber& first_sequence_number = get(first);
uint16_t output_sequence_number = first_sequence_number.output;
if (first_sequence_number.type != SequenceNumberType::Skip) {
output_sequence_number++;
}
for (uint16_t sequence_number = first_sequence_number.input + 1;
RtpUtils::sequenceNumberLessThan(sequence_number, last);
sequence_number++) {
add(SequenceNumber{sequence_number, output_sequence_number++, SequenceNumberType::Valid});
}
return output_sequence_number;
}
SequenceNumber& SequenceNumberTranslator::internalGet(uint16_t input_sequence_number) {
return in_out_buffer_[input_sequence_number % kMaxSequenceNumberInBuffer];
}
SequenceNumber SequenceNumberTranslator::get(uint16_t input_sequence_number) const {
return in_out_buffer_[input_sequence_number % kMaxSequenceNumberInBuffer];
}
SequenceNumber SequenceNumberTranslator::get(uint16_t input_sequence_number, bool skip) {
if (!initialized_) {
SequenceNumberType type = skip ? SequenceNumberType::Skip : SequenceNumberType::Valid;
uint16_t output_sequence_number = reset_ ? initial_output_sequence_number_ : input_sequence_number;
add(SequenceNumber{input_sequence_number, output_sequence_number, type});
last_input_sequence_number_ = input_sequence_number;
first_input_sequence_number_ = input_sequence_number;
initialized_ = true;
reset_ = false;
return get(input_sequence_number);
}
if (RtpUtils::sequenceNumberLessThan(input_sequence_number, first_input_sequence_number_)) {
return SequenceNumber{input_sequence_number, 0, SequenceNumberType::Skip};
}
if (RtpUtils::sequenceNumberLessThan(last_input_sequence_number_, input_sequence_number)) {
uint16_t output_sequence_number = fill(last_input_sequence_number_, input_sequence_number);
SequenceNumberType type = skip ? SequenceNumberType::Skip : SequenceNumberType::Valid;
add(SequenceNumber{input_sequence_number, output_sequence_number, type});
last_input_sequence_number_ = input_sequence_number;
if (last_input_sequence_number_ - first_input_sequence_number_ > kMaxDistance) {
first_input_sequence_number_ = last_input_sequence_number_ - kMaxDistance;
}
return get(input_sequence_number);
} else {
SequenceNumber& result = internalGet(input_sequence_number);
if (result.type == SequenceNumberType::Valid) {
SequenceNumberType type = skip ? SequenceNumberType::Discard : SequenceNumberType::Valid;
result.type = type;
}
return result;
}
}
SequenceNumber SequenceNumberTranslator::reverse(uint16_t output_sequence_number) const {
SequenceNumber result = out_in_buffer_[output_sequence_number % kMaxSequenceNumberInBuffer];
if (RtpUtils::sequenceNumberLessThan(result.input, first_input_sequence_number_) ||
RtpUtils::sequenceNumberLessThan(last_input_sequence_number_, result.input)) {
return SequenceNumber{0, output_sequence_number, SequenceNumberType::Discard};
}
return result;
}
void SequenceNumberTranslator::reset() {
initialized_ = false;
SequenceNumber &last = internalGet(last_input_sequence_number_);
initial_output_sequence_number_ = last.output;
first_input_sequence_number_ = 0;
last_input_sequence_number_ = 0;
reset_ = true;
in_out_buffer_ = std::vector<SequenceNumber>(kMaxSequenceNumberInBuffer);
out_in_buffer_ = std::vector<SequenceNumber>(kMaxSequenceNumberInBuffer);
}
} // namespace erizo
| [
"noreply@github.com"
] | wlfsihua.noreply@github.com |
b4ccff19b6e3e515dee8fa505e3f6a6b7321df26 | 30c9c002e443b3fea15ffcf87e861b009bc93419 | /CommunicationPlugin/navigationBar/wnavigationtar.cpp | 59921de3f47cf747eaf51214ce5c83209e6637e2 | [] | no_license | fanzcsoft/Commication | 56dc6821b4f5ec7d6c42f191f8753419c0218a37 | 6fa0e1b6cf409431ce72d20d487c608ec910d686 | refs/heads/master | 2021-10-26T00:57:52.142285 | 2017-11-06T01:38:39 | 2017-11-06T01:38:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,878 | cpp | #include "wnavigationtar.h"
#include <QObject>
#include <QPointer>
#include <QMouseEvent>
#include <QDrag>
#include <QMimeData>
#include "core/core.h"
class WNavigationTarPrivate
{
public:
WNavigationTarPrivate(WNavigationTar *qq);
QColor currentItemColor;
QSize iconSize;
int itemSpacing;
QToolButton *pressToolButton;
QHash<QToolButton *, QWidget *> mapIconToWidget;
QVBoxLayout *vboxLayout;
WNavigationTar *q_ptr;
Q_DECLARE_PUBLIC(WNavigationTar)
};
WNavigationTarPrivate::WNavigationTarPrivate(WNavigationTar *qq)
:currentItemColor(QColor(Qt::white)), iconSize(QSize(25, 25)), itemSpacing(14),pressToolButton(nullptr) , vboxLayout(nullptr) ,q_ptr(qq)
{
}
WNavigationTar::WNavigationTar(QWidget *parent)
: QWidget(parent) ,d_ptr(new WNavigationTarPrivate(this))
{
setAttribute(Qt::WA_StyledBackground);
d_ptr->vboxLayout=new QVBoxLayout(this);
d_ptr->vboxLayout->setContentsMargins(0, 14, 0, 0);
d_ptr->vboxLayout->setSpacing(d_ptr->itemSpacing);
d_ptr->vboxLayout->addSpacerItem(new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding));
setAcceptDrops(true);
setStyleSheet(Core::getStylesheet(":/qss/navigation.qss"));
}
WNavigationTar::~WNavigationTar()
{
delete d_ptr;
}
void WNavigationTar::setCurrentItemColor(QColor &color)
{
d_ptr->currentItemColor=color;
}
QColor& WNavigationTar::currentItemColor() const
{
return d_ptr->currentItemColor;
}
void WNavigationTar::setIconSize(QSize size)
{
foreach(QToolButton *button, d_ptr->mapIconToWidget.keys()){
button->setIconSize(size);
}
d_ptr->iconSize=size;
}
QSize &WNavigationTar::iconSize()
{
return d_ptr->iconSize;
}
void WNavigationTar::setItemSpacing(int spacing)
{
d_ptr->itemSpacing=spacing;
d_ptr->vboxLayout->setSpacing(spacing);
}
int& WNavigationTar::itemSpacing()
{
return d_ptr->itemSpacing;
}
const QToolButton *WNavigationTar::addItem(QToolButton *toolButton, QWidget *widget, QString objectname)
{
if(!toolButton)
return nullptr;
toolButton->setObjectName(objectname);
toolButton->setCheckable(true);
toolButton->setIconSize(d_ptr->iconSize);
toolButton->setAutoRaise(true);
toolButton->setMinimumSize(36, 36);
toolButton->setMaximumSize(36, 36);
toolButton->installEventFilter(this);
connect(toolButton, SIGNAL(clicked()), this, SLOT(recvClickButton()));
d_ptr->mapIconToWidget.insert(toolButton, widget);
d_ptr->vboxLayout->insertWidget(d_ptr->mapIconToWidget.size()-1, toolButton);
return toolButton;
}
void WNavigationTar::mouseMoveEvent(QMouseEvent *ev)
{
if(ev->buttons()&Qt::LeftButton){
if(d_ptr->pressToolButton){
QToolButton *button=d_ptr->pressToolButton;
QPixmap pixmap(button->size());
button->render(&pixmap);
QMimeData *mimeDta=new QMimeData;
QByteArray itemData;
QDataStream dataStream(&itemData, QIODevice::WriteOnly);
dataStream<<(qint32)(d_ptr->mapIconToWidget.keys().indexOf(button));
mimeDta->setData(QStringLiteral("itemIndex"), itemData);
QDrag drag(this);
drag.setMimeData(mimeDta);
drag.setPixmap(pixmap);
drag.setHotSpot(QPoint(button->size().width()/3, button->size().height()/3));
drag.exec(Qt::MoveAction);
ev->accept();
}
}
else {
QWidget::mouseMoveEvent(ev);
}
}
void WNavigationTar::mouseReleaseEvent(QMouseEvent *ev)
{
d_ptr->pressToolButton=nullptr;
QWidget::mouseReleaseEvent(ev);
}
void WNavigationTar::dragEnterEvent(QDragEnterEvent *ev)
{
if(ev->mimeData()->hasFormat(QStringLiteral("itemIndex"))){
ev->acceptProposedAction();
}
else{
ev->ignore();
}
}
bool WNavigationTar::eventFilter(QObject *obj, QEvent *ev)
{
QToolButton *button=qobject_cast<QToolButton *>(obj);
if(button) {
if(ev->type()==QEvent::MouseButtonPress) {
QMouseEvent *mouseEvent=static_cast<QMouseEvent *>(ev);
if(mouseEvent->button()==Qt::LeftButton){
d_ptr->pressToolButton=button;
ev->ignore();
}
}
if(ev->type()==QEvent::MouseButtonRelease) {
QMouseEvent *mouseEvent=static_cast<QMouseEvent *>(ev);
if(mouseEvent->button()==Qt::LeftButton){
emit clickShowWidget(d_ptr->mapIconToWidget.value(button));
}
}
}
return QWidget::eventFilter(obj, ev);
}
void WNavigationTar::dropEvent(QDropEvent *ev)
{
if(ev->mimeData()->hasFormat(QStringLiteral("itemIndex"))){
QPoint globalPoint=ev->pos();
QByteArray itemData=ev->mimeData()->data(QStringLiteral("itemIndex"));
QDataStream dataStream(&itemData, QIODevice::ReadOnly);
qint32 indexDrag;
dataStream>>indexDrag;
foreach(QToolButton *button, d_ptr->mapIconToWidget.keys())
{
if((globalPoint.y()-button->pos().y())<=(button->size().height()+d_ptr->itemSpacing)){
QToolButton *childButton=d_ptr->mapIconToWidget.keys().at(indexDrag);
d_ptr->vboxLayout->removeWidget(childButton);
int index=d_ptr->vboxLayout->indexOf(button);
d_ptr->vboxLayout->insertWidget(index+1, childButton);
break;
}
}
ev->setDropAction(Qt::MoveAction);
ev->accept();
} else {
ev->ignore();
}
}
void WNavigationTar::recvClickButton()
{
QToolButton *button=qobject_cast<QToolButton *>(sender());
if(!button)
return;
foreach(QToolButton *pushButton, d_ptr->mapIconToWidget.keys()) {
if(button==pushButton) {
pushButton->setChecked(true);
} else {
pushButton->setChecked(false);
}
}
}
| [
"157948938@qq.com"
] | 157948938@qq.com |
0c5e8dbd8f2238214b9e45d0a16a83f1540d0c5e | 8e820a44fd75fb265841f52b3d4fa6a016dcbdf2 | /Source/Tools/ParticleEditor2D/EmitterAttributeEditor.cpp | 880df011fa1ef5ca38ad98c45860520e73069b70 | [
"Zlib",
"LicenseRef-scancode-khronos",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | xujingsy/Urho3D_xujing | e68d1259e0cf16b4c65345dd83b62fe242daa18c | 4ae4cb174ca7f2f9a08e83e8bf3b3ab0085bcec0 | refs/heads/master | 2020-04-14T19:07:33.678470 | 2014-08-29T07:26:03 | 2014-08-29T07:26:03 | 21,970,592 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 12,114 | cpp | //
// Copyright (c) 2014 the ParticleEditor2D project.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#include "Context.h"
#include "CoreEvents.h"
#include "EmitterAttributeEditor.h"
#include "Widgets/FloatEditor.h"
#include "Widgets/IntEditor.h"
#include "Widgets/ValueVarianceEditor.h"
#include "Widgets/Vector2Editor.h"
#include "ParticleEffect2D.h"
#include "ParticleEmitter2D.h"
#include "ResourceCache.h"
#include "Texture2D.h"
#include <QApplication>
#include <QComboBox>
#include <QFileDialog.h>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
namespace Urho3D
{
EmitterAttributeEditor::EmitterAttributeEditor(Context* context) :
ParticleEffectEditor(context),
maxParticlesChanged_(false)
{
CreateMaxParticlesEditor();
CreateDurationEditor();
vBoxLayout_->addSpacing(8);
CreateTextureEditor();
CreateBlendModeEditor();
vBoxLayout_->addSpacing(8);
CreateEmitterTypeEditor();
vBoxLayout_->addSpacing(8);
angleEditor_ = CreateValueVarianceEditor(tr("Angle"), 0.0f, 360.0f);
CreateGravityTypeEditor();
CreateRadialTypeEditor();
vBoxLayout_->addStretch(1);
SubscribeToEvent(E_POSTUPDATE, HANDLER(EmitterAttributeEditor, HandlePostUpdate));
}
EmitterAttributeEditor::~EmitterAttributeEditor()
{
}
void EmitterAttributeEditor::HandleMaxParticlesEditorValueChanged(int value)
{
if (updatingWidget_)
return;
maxParticlesChanged_ = true;
}
void EmitterAttributeEditor::HandleDurationEditorValueChanged(float value)
{
if (updatingWidget_)
return;
GetEffect()->SetDuration(value);
}
void EmitterAttributeEditor::HandleTexturePushButtonClicked()
{
QString fileName = QFileDialog::getOpenFileName(0, tr("Texture"), "./Data/Urho2D/", "*.dds;*.png;*.jpg;*.bmp;*.tga;*.ktx;*.pvr");
if (fileName.isEmpty())
return;
static QString dataPath = qApp->applicationDirPath() + "/Data/";
if (fileName.left(dataPath.length()) != dataPath)
return;
fileName = fileName.right(fileName.length() - dataPath.length());
ResourceCache* cache = GetSubsystem<ResourceCache>();
Sprite2D* sprite = cache->GetResource<Sprite2D>(fileName.toLatin1().data());
if (!sprite)
return;
textureEditor_->setText(fileName);
GetEffect()->SetSprite(sprite);
GetEmitter()->SetSprite(sprite);
}
void EmitterAttributeEditor::HandleBlendModeEditorChanged(int index)
{
if (updatingWidget_)
return;
GetEffect()->SetBlendMode((BlendMode)index);
GetEmitter()->SetBlendMode((BlendMode)index);
}
void EmitterAttributeEditor::HandleEmitterTypeEditorChanged(int index)
{
EmitterType2D emitterType = (EmitterType2D)index;
ShowGravityTypeEditor(emitterType == EMITTER_TYPE_GRAVITY);
ShowRadialTypeEditor(emitterType != EMITTER_TYPE_GRAVITY);
if (updatingWidget_)
return;
GetEffect()->SetEmitterType(emitterType);
}
void EmitterAttributeEditor::HandleSourcePositionVarianceEditorValueChanged(const Vector2& value)
{
if (updatingWidget_)
return;
GetEffect()->SetSourcePositionVariance(value);
}
void EmitterAttributeEditor::HandleGravityEditorValueChanged(const Vector2& value)
{
if (updatingWidget_)
return;
GetEffect()->SetGravity(value);
}
void EmitterAttributeEditor::HandleValueVarianceEditorValueChanged(float average, float variance)
{
if (updatingWidget_)
return;
QObject* s = sender();
ParticleEffect2D* effect = GetEffect();
if (s == speedEditor_)
{
effect->SetSpeed(speedEditor_->value());
effect->SetSpeedVariance(speedEditor_->variance());
}
else if (s == angleEditor_)
{
effect->SetAngle(angleEditor_->value());
effect->SetAngleVariance(angleEditor_->variance());
}
else if (s == radialAccelerationEditor_)
{
effect->SetRadialAcceleration(radialAccelerationEditor_->value());
effect->SetRadialAccelVariance(radialAccelerationEditor_->variance());
}
else if (s == tangentialAccelerationEditor_)
{
effect->SetTangentialAcceleration(tangentialAccelerationEditor_->value());
effect->SetTangentialAccelVariance(tangentialAccelerationEditor_->variance());
}
else if (s == maxRadiusEditor_)
{
effect->SetMaxRadius(maxRadiusEditor_->value());
effect->SetMaxRadiusVariance(maxRadiusEditor_->variance());
}
else if (s == minRadiusEditor_)
{
effect->SetMinRadius(minRadiusEditor_->value());
effect->SetMinRadiusVariance(minRadiusEditor_->variance());
}
else if (s == rotatePerSecondEditor_)
{
effect->SetRotatePerSecond(rotatePerSecondEditor_->value());
effect->SetRotatePerSecondVariance(rotatePerSecondEditor_->variance());
}
}
void EmitterAttributeEditor::HandleUpdateWidget()
{
ParticleEffect2D* effect_ = GetEffect();
maxParticlesEditor_->setValue(effect_->GetMaxParticles());
durationEditor_->setValue(effect_->GetDuration());
Sprite2D* sprite = effect_->GetSprite();
textureEditor_->setText(sprite ? sprite->GetName().CString() : "");
blendModeEditor_->setCurrentIndex((int)effect_->GetBlendMode());
emitterTypeEditor_->setCurrentIndex((int)effect_->GetEmitterType());
sourcePositionVarianceEditor_->setValue(effect_->GetSourcePositionVariance());
speedEditor_->setValue(effect_->GetSpeed(), effect_->GetSpeedVariance());
angleEditor_->setValue(effect_->GetAngle(), effect_->GetAngleVariance());
gravityEditor_->setValue(effect_->GetGravity());
radialAccelerationEditor_->setValue(effect_->GetRadialAcceleration(), effect_->GetRadialAccelVariance());
tangentialAccelerationEditor_->setValue(effect_->GetTangentialAcceleration(), effect_->GetTangentialAccelVariance());
maxRadiusEditor_->setValue(effect_->GetMaxRadius(), effect_->GetMaxRadiusVariance());
minRadiusEditor_->setValue(effect_->GetMinRadius(), effect_->GetMinRadiusVariance());
rotatePerSecondEditor_->setValue(effect_->GetRotatePerSecond(), effect_->GetRotatePerSecondVariance());
}
void EmitterAttributeEditor::CreateMaxParticlesEditor()
{
maxParticlesEditor_ = new IntEditor(tr("MaxParticles"));
vBoxLayout_->addLayout(maxParticlesEditor_);
maxParticlesEditor_->setRange(1, 2048);
connect(maxParticlesEditor_, SIGNAL(valueChanged(int)), this, SLOT(HandleMaxParticlesEditorValueChanged(int)));
}
void EmitterAttributeEditor::CreateDurationEditor()
{
durationEditor_ = new FloatEditor(tr("Duration"));
vBoxLayout_->addLayout(durationEditor_);
durationEditor_->setRange(-1.0f, 100.0f);
connect(durationEditor_, SIGNAL(valueChanged(float)), this, SLOT(HandleDurationEditorValueChanged(float)));
}
void EmitterAttributeEditor::CreateTextureEditor()
{
QHBoxLayout* hBoxLayout = AddHBoxLayout();
hBoxLayout->addWidget(new QLabel(tr("Texture")));
textureEditor_ = new QLineEdit();
hBoxLayout->addWidget(textureEditor_, 1);
textureEditor_->setReadOnly(true);
QPushButton* texturePushButton = new QPushButton("...");
hBoxLayout->addWidget(texturePushButton);
texturePushButton->setFixedWidth(32);
connect(texturePushButton, SIGNAL(clicked(bool)), this, SLOT(HandleTexturePushButtonClicked()));
}
void EmitterAttributeEditor::CreateBlendModeEditor()
{
QHBoxLayout* hBoxLayout = AddHBoxLayout();
hBoxLayout->addWidget(new QLabel(tr("Blend Mode")));
blendModeEditor_ = new QComboBox();
hBoxLayout->addWidget(blendModeEditor_, 1);
const char* blendModeNames[] =
{
"replace",
"add",
"multiply",
"alpha",
"addalpha",
"premulalpha",
"invdestalpha",
"subtract",
"subtractalpha",
0
};
for (unsigned i = 0; i < MAX_BLENDMODES; ++i)
blendModeEditor_->addItem(blendModeNames[i], i);
connect(blendModeEditor_,SIGNAL(currentIndexChanged(int)),this,SLOT(HandleBlendModeEditorChanged(int)));
}
void EmitterAttributeEditor::CreateEmitterTypeEditor()
{
emitterTypeEditor_ = new QComboBox();
vBoxLayout_->addWidget(emitterTypeEditor_, 1);
emitterTypeEditor_->addItem(tr("Gravity Emitter Type"));
emitterTypeEditor_->addItem(tr("Radial Emitter Type"));
emitterTypeEditor_->setCurrentIndex(-1);
connect(emitterTypeEditor_, SIGNAL(currentIndexChanged(int)), this, SLOT(HandleEmitterTypeEditorChanged(int)));
}
void EmitterAttributeEditor::CreateGravityTypeEditor()
{
sourcePositionVarianceEditor_ = new Vector2Editor(tr("SourcePositionVariance"));
vBoxLayout_->addWidget(sourcePositionVarianceEditor_);
sourcePositionVarianceEditor_->setRange(Vector2::ZERO, Vector2::ONE * 1000.0f);
connect(sourcePositionVarianceEditor_, SIGNAL(valueChanged(const Vector2&)), this, SLOT(HandleSourcePositionVarianceEditorValueChanged(const Vector2&)));
speedEditor_ = CreateValueVarianceEditor(tr("Speed"), 0.0f, 2000.0f);
gravityEditor_ = new Vector2Editor(tr("Gravity"));
vBoxLayout_->addWidget(gravityEditor_);
gravityEditor_->setRange(Vector2::ONE * -3000.0f, Vector2::ONE * 3000.0f);
connect(gravityEditor_, SIGNAL(valueChanged(const Vector2&)), this, SLOT(HandleGravityEditorValueChanged(const Vector2&)));
radialAccelerationEditor_ = CreateValueVarianceEditor(tr("Radial Acceleration"), -10000.0f, 10000.0f);
tangentialAccelerationEditor_ = CreateValueVarianceEditor(tr("Tangential AccelVariance"), -50000.0f, 50000.0f);
}
void EmitterAttributeEditor::CreateRadialTypeEditor()
{
maxRadiusEditor_ = CreateValueVarianceEditor(tr("MaxRadius"), 0.0f, 1000.0f);
minRadiusEditor_ = CreateValueVarianceEditor(tr("MinRadius"), 0.0f, 1000.0f);
const float s = 2.0f;
rotatePerSecondEditor_ = CreateValueVarianceEditor(tr("RotatePerSecond"), -360.0f * s, 360.0f * s);
}
void EmitterAttributeEditor::ShowGravityTypeEditor(bool visible)
{
sourcePositionVarianceEditor_->setVisible(visible);
speedEditor_->setVisible(visible);
gravityEditor_->setVisible(visible);
radialAccelerationEditor_->setVisible(visible);
tangentialAccelerationEditor_->setVisible(visible);
}
void EmitterAttributeEditor::ShowRadialTypeEditor(bool visible)
{
maxRadiusEditor_->setVisible(visible);
minRadiusEditor_->setVisible(visible);
rotatePerSecondEditor_->setVisible(visible);
}
ValueVarianceEditor* EmitterAttributeEditor::CreateValueVarianceEditor(const QString& name, float min, float max)
{
ValueVarianceEditor* editor = new ValueVarianceEditor(name);
vBoxLayout_->addWidget(editor);
editor->setRange(min, max);
connect(editor, SIGNAL(valueChanged(float, float)), this, SLOT(HandleValueVarianceEditorValueChanged(float, float)));
return editor;
}
void EmitterAttributeEditor::HandlePostUpdate(StringHash eventType, VariantMap& eventData)
{
if (!maxParticlesChanged_)
return;
maxParticlesChanged_ = false;
GetEffect()->SetMaxParticles(maxParticlesEditor_->value());
GetEmitter()->SetMaxParticles(maxParticlesEditor_->value());
}
} | [
"xujingsy@163.com"
] | xujingsy@163.com |
e3bf45599de74d87b50135c360bcfe2c6eacf348 | 3a76d65d40ca591e622cabb1cc433d5aa3024b80 | /tasfia2.ino | 4e3860dc3419135ec3fc56d386d51c8d7be5d41a | [] | no_license | hasibaust13/Android-Device-Controlled-Robot-Car | fb0618d306634c6d01e7c0cb14139f6e4fbecefe | a9576c156ce47450e803e87128d80f7f7b1aab18 | refs/heads/master | 2020-05-05T05:17:24.527107 | 2019-04-05T19:52:37 | 2019-04-05T19:52:37 | 179,745,369 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,114 | ino | int echo = 6;
int trig = 7;
long duration, distance;
int leftMotor1ForwardPin = 12;
int leftMotor1ReversePin = 11;
int rightMotor1ForwardPin = 9;
int rightMotor1ReversePin = 8;
int leftMotor2ForwardPin = 5;
int leftMotor2ReversePin = 4;
int rightMotor2ForwardPin = 3;
int rightMotor2ReversePin = 2;
void setup() {
pinMode(trig, OUTPUT);
pinMode(echo, INPUT);
pinMode(leftMotor1ForwardPin, OUTPUT);
pinMode(leftMotor1ReversePin, OUTPUT);
pinMode(leftMotor2ForwardPin, OUTPUT);
pinMode(leftMotor2ReversePin, OUTPUT);
pinMode(rightMotor1ForwardPin, OUTPUT);
pinMode(rightMotor1ReversePin, OUTPUT);
pinMode(rightMotor2ForwardPin, OUTPUT);
pinMode(rightMotor2ReversePin, OUTPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(trig, LOW);
delayMicroseconds(2);
digitalWrite(trig, HIGH);
delayMicroseconds(10);
digitalWrite(trig, LOW);
duration = pulseIn(echo, HIGH);
distance = duration / 58;
if(distance > 10){
goForward();
delay(2000);
goReverse();
delay(2000);
goLeft();
delay(2000);
goRight();
delay(2000);
}
else{
halt();
}
// delay(5000);
//goReverse();
//delay(5000);
//goLeft();
//delay(5000);
//goRight();
//delay(5000);
}
void halt(){
digitalWrite(leftMotor1ForwardPin, LOW);
digitalWrite(leftMotor1ReversePin, LOW);
digitalWrite(rightMotor1ForwardPin, LOW);
digitalWrite(rightMotor1ReversePin, LOW);
digitalWrite(leftMotor2ForwardPin, LOW);
digitalWrite(leftMotor2ReversePin, LOW);
digitalWrite(rightMotor2ForwardPin, LOW);
digitalWrite(rightMotor2ReversePin, LOW);
}
void goForward(){
digitalWrite(leftMotor1ForwardPin, HIGH);
digitalWrite(leftMotor1ReversePin, LOW);
digitalWrite(rightMotor1ForwardPin, HIGH);
digitalWrite(rightMotor1ReversePin, LOW);
digitalWrite(leftMotor2ForwardPin, HIGH);
digitalWrite(leftMotor2ReversePin, LOW);
digitalWrite(rightMotor2ForwardPin, HIGH);
digitalWrite(rightMotor2ReversePin, LOW);
}
void goReverse(){
digitalWrite(leftMotor1ForwardPin, LOW);
digitalWrite(leftMotor1ReversePin, HIGH);
digitalWrite(rightMotor1ForwardPin, LOW);
digitalWrite(rightMotor1ReversePin, HIGH);
digitalWrite(leftMotor2ForwardPin, LOW);
digitalWrite(leftMotor2ReversePin, HIGH);
digitalWrite(rightMotor2ForwardPin, LOW);
digitalWrite(rightMotor2ReversePin, HIGH);
}
void goLeft(){
digitalWrite(leftMotor1ForwardPin, LOW);
digitalWrite(leftMotor1ReversePin, LOW);
digitalWrite(rightMotor1ForwardPin, HIGH);
digitalWrite(rightMotor1ReversePin, LOW);
digitalWrite(leftMotor2ForwardPin, LOW);
digitalWrite(leftMotor2ReversePin, LOW);
digitalWrite(rightMotor2ForwardPin, HIGH);
digitalWrite(rightMotor2ReversePin, LOW);
}
void goRight(){
digitalWrite(leftMotor1ForwardPin, HIGH);
digitalWrite(leftMotor1ReversePin, LOW);
digitalWrite(rightMotor1ForwardPin, LOW);
digitalWrite(rightMotor1ReversePin, LOW);
digitalWrite(leftMotor2ForwardPin, HIGH);
digitalWrite(leftMotor2ReversePin, LOW);
digitalWrite(rightMotor2ForwardPin, LOW);
digitalWrite(rightMotor2ReversePin, LOW);
}
| [
"unitedhasib@gmail.com"
] | unitedhasib@gmail.com |
917c76b4716f4ef6694d8ebbb6b6999c618e9134 | ab7f2337d2907af4541bec5d148df03dac0844d2 | /src/hash_util.h | 256bfb5d6464c5505aac197f5db8af672db0b541 | [
"BSD-3-Clause",
"MIT"
] | permissive | vipinj/lockbox | 5a37943a8adacfbd654495ca43de60e5a694a3ed | 538a5706f39208c20420bd8d6c2b8c2ec84984cb | refs/heads/master | 2021-01-18T05:52:58.296990 | 2013-05-25T19:49:16 | 2013-05-25T19:49:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 135 | h | #pragma once
#include <string>
using std::string;
namespace lockbox {
string SHA1Hex(const string& input);
} // namespace lockbox
| [
"tierney@cs.nyu.edu"
] | tierney@cs.nyu.edu |
232fc8eb60a924317e203c5a505b09c5e3fa7b23 | 1ac667dcb0e08a94f150bf1cbbb724f743820a89 | /sc2d/src/core/rendering/renderable.cpp | 95d6c2dc021108cc207b93ee8c4d374c16c0b91b | [
"MIT"
] | permissive | NovaSurfer/scarecrow2d | 2dde91c2e7167c935521c809a5bab1228464424e | 3f877c082a8e0206edb3d899e18616c7d16b0e6f | refs/heads/master | 2023-01-10T15:47:43.498299 | 2022-10-09T20:34:04 | 2022-10-09T20:34:04 | 131,281,610 | 2 | 0 | MIT | 2020-03-14T22:05:57 | 2018-04-27T10:22:05 | C++ | UTF-8 | C++ | false | false | 2,145 | cpp | //
// Created by novasurfer on 5/6/20.
//
#include "renderable.h"
#include "math/transform.h"
namespace sc2d
{
void renderable_2d::set_texture(GLuint texid)
{
this->texid = texid;
shader.run();
shader.set_int(shader_const::IMG, texid);
}
void renderable_2d::set_texture_array(const GLuint texid)
{
this->texid = texid;
shader.run();
shader.set_int(shader_const::IMG_ARRAY, texid);
}
void renderable_2d::set_color(const colorRGB& color)
{
shader.run();
shader.set_vec3(shader_const::IMG_COLOR, color);
}
void transformable_2d::set_pos(const math::vec2& pos)
{
this->pos = pos;
update_transform();
}
void transformable_2d::set_size(const math::vec2& size)
{
this->size = size;
update_transform();
}
void transformable_2d::set_rot(const float rot)
{
this->rot = rot;
update_transform();
}
void transformable_2d::set_transfdata(const math::vec2& pos, const math::vec2& size,
const float rot, const math::mat4& projection)
{
this->pos = pos;
this->size = size;
this->rot = rot;
this->projection = projection;
update_transform();
}
void transformable_2d::set_transform(const math::mat4& transform)
{
this->transform = transform;
this->shader.run();
this->shader.set_mat4(shader_const::MVP, transform * projection);
}
void transformable_2d::set_projection(const math::mat4& projection)
{
this->projection = projection;
this->shader.run();
this->shader.set_mat4(shader_const::MVP, transform * projection);
}
void transformable_2d::update_transform()
{
transform =
math::transform(math::vec3(size.x, size.y, 1.0f), math::vec3(0.0f, 0.0f, 1.0f), rot,
math::vec3(0.5f * size.x + pos.x, 0.5f * size.y + pos.y, 0.0f));
this->shader.run();
this->shader.set_mat4(shader_const::MVP, transform * projection);
}
}
| [
"tribar.ge@gmail.com"
] | tribar.ge@gmail.com |
83b079ddacc0d93476a03a1c31f31123dbc1079c | 3c9d8787d9dd84b5402097c1331add04bc7a7f94 | /8.05 Greedy - Activity Selection.cpp | 9597e6b6fc9eb3aa0cba77aaeda3f659e018364d | [] | no_license | AbhishekPratik1810/my_cpp_dsa_practice | bfc6df01dc2412b39056b5d49791a0ccf105d19a | 37e465cf15d162dfaf535fdcf780d5d5225a8575 | refs/heads/master | 2022-12-09T03:24:24.220974 | 2020-09-15T17:50:33 | 2020-09-15T17:50:33 | 295,805,408 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,177 | cpp | //https://practice.geeksforgeeks.org/problems/n-meetings-in-one-room/0
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
bool compare(pair<int,int> a, pair<int,int> b){
return a.second<b.second;
}
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
vector<int> start(n);
vector<int> finish(n);
for(int i=0;i<n;i++)
cin>>start[i];
for(int i=0;i<n;i++)
cin>>finish[i];
vector<pair<int,int>> activities(n);
for(int i=0;i<n;i++)
activities[i]=make_pair(start[i],finish[i]);
sort(activities.begin(),activities.end(),compare);
vector<pair<int,int>> res;
int currSecond=INT_MIN;
for(int i=0;i<n;i++){
if(activities[i].first>=currSecond){
currSecond=activities[i].second;
res.push_back(make_pair(activities[i].first,activities[i].second));
}
}
for(auto p: res)
for(int i=0;i<n;i++)
if(p.first==start[i] && p.second ==finish[i])
cout<<i+1<<" ";
cout<<endl;
}
}
| [
"developerpratik18@gmail.com"
] | developerpratik18@gmail.com |
845c9d8c117a1f3e45726129a579e3736edce7f7 | c776476e9d06b3779d744641e758ac3a2c15cddc | /examples/litmus/c/run-scripts/tmp_1/3.LB+dmb.st+po+ctrlisb.c.cbmc_out.cpp | 308c4ceaa285ce388800e64c83a9a457aa7b3152 | [] | no_license | ashutosh0gupta/llvm_bmc | aaac7961c723ba6f7ffd77a39559e0e52432eade | 0287c4fb180244e6b3c599a9902507f05c8a7234 | refs/heads/master | 2023-08-02T17:14:06.178723 | 2023-07-31T10:46:53 | 2023-07-31T10:46:53 | 143,100,825 | 3 | 4 | null | 2023-05-25T05:50:55 | 2018-08-01T03:47:00 | C++ | UTF-8 | C++ | false | false | 43,463 | cpp | // 7:thr1:1
// 8:thr2:1
// 0:vars:3
// 3:atom_0_X0_1:1
// 4:atom_1_X0_1:1
// 5:atom_2_X0_1:1
// 6:thr0:1
#define ADDRSIZE 9
#define NPROC 4
#define NCONTEXT 1
#define ASSUME(stmt) __CPROVER_assume(stmt)
#define ASSERT(stmt) __CPROVER_assert(stmt, "error")
#define max(a,b) (a>b?a:b)
char __get_rng();
char get_rng( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
char get_rng_th( char from, char to ) {
char ret = __get_rng();
ASSUME(ret >= from && ret <= to);
return ret;
}
int main(int argc, char **argv) {
// declare arrays for intial value version in contexts
int meminit_[ADDRSIZE*NCONTEXT];
#define meminit(x,k) meminit_[(x)*NCONTEXT+k]
int coinit_[ADDRSIZE*NCONTEXT];
#define coinit(x,k) coinit_[(x)*NCONTEXT+k]
int deltainit_[ADDRSIZE*NCONTEXT];
#define deltainit(x,k) deltainit_[(x)*NCONTEXT+k]
// declare arrays for running value version in contexts
int mem_[ADDRSIZE*NCONTEXT];
#define mem(x,k) mem_[(x)*NCONTEXT+k]
int co_[ADDRSIZE*NCONTEXT];
#define co(x,k) co_[(x)*NCONTEXT+k]
int delta_[ADDRSIZE*NCONTEXT];
#define delta(x,k) delta_[(x)*NCONTEXT+k]
// declare arrays for local buffer and observed writes
int buff_[NPROC*ADDRSIZE];
#define buff(x,k) buff_[(x)*ADDRSIZE+k]
int pw_[NPROC*ADDRSIZE];
#define pw(x,k) pw_[(x)*ADDRSIZE+k]
// declare arrays for context stamps
char cr_[NPROC*ADDRSIZE];
#define cr(x,k) cr_[(x)*ADDRSIZE+k]
char iw_[NPROC*ADDRSIZE];
#define iw(x,k) iw_[(x)*ADDRSIZE+k]
char cw_[NPROC*ADDRSIZE];
#define cw(x,k) cw_[(x)*ADDRSIZE+k]
char cx_[NPROC*ADDRSIZE];
#define cx(x,k) cx_[(x)*ADDRSIZE+k]
char is_[NPROC*ADDRSIZE];
#define is(x,k) is_[(x)*ADDRSIZE+k]
char cs_[NPROC*ADDRSIZE];
#define cs(x,k) cs_[(x)*ADDRSIZE+k]
char crmax_[NPROC*ADDRSIZE];
#define crmax(x,k) crmax_[(x)*ADDRSIZE+k]
char sforbid_[ADDRSIZE*NCONTEXT];
#define sforbid(x,k) sforbid_[(x)*NCONTEXT+k]
// declare arrays for synchronizations
int cl[NPROC];
int cdy[NPROC];
int cds[NPROC];
int cdl[NPROC];
int cisb[NPROC];
int caddr[NPROC];
int cctrl[NPROC];
int cstart[NPROC];
int creturn[NPROC];
// declare arrays for contexts activity
int active[NCONTEXT];
int ctx_used[NCONTEXT];
int r0= 0;
char creg_r0;
int r1= 0;
char creg_r1;
int r2= 0;
char creg_r2;
int r3= 0;
char creg_r3;
int r4= 0;
char creg_r4;
int r5= 0;
char creg_r5;
int r6= 0;
char creg_r6;
int r7= 0;
char creg_r7;
int r8= 0;
char creg_r8;
int r9= 0;
char creg_r9;
int r10= 0;
char creg_r10;
int r11= 0;
char creg_r11;
int r12= 0;
char creg_r12;
char old_cctrl= 0;
char old_cr= 0;
char old_cdy= 0;
char old_cw= 0;
char new_creg= 0;
buff(0,0) = 0;
pw(0,0) = 0;
cr(0,0) = 0;
iw(0,0) = 0;
cw(0,0) = 0;
cx(0,0) = 0;
is(0,0) = 0;
cs(0,0) = 0;
crmax(0,0) = 0;
buff(0,1) = 0;
pw(0,1) = 0;
cr(0,1) = 0;
iw(0,1) = 0;
cw(0,1) = 0;
cx(0,1) = 0;
is(0,1) = 0;
cs(0,1) = 0;
crmax(0,1) = 0;
buff(0,2) = 0;
pw(0,2) = 0;
cr(0,2) = 0;
iw(0,2) = 0;
cw(0,2) = 0;
cx(0,2) = 0;
is(0,2) = 0;
cs(0,2) = 0;
crmax(0,2) = 0;
buff(0,3) = 0;
pw(0,3) = 0;
cr(0,3) = 0;
iw(0,3) = 0;
cw(0,3) = 0;
cx(0,3) = 0;
is(0,3) = 0;
cs(0,3) = 0;
crmax(0,3) = 0;
buff(0,4) = 0;
pw(0,4) = 0;
cr(0,4) = 0;
iw(0,4) = 0;
cw(0,4) = 0;
cx(0,4) = 0;
is(0,4) = 0;
cs(0,4) = 0;
crmax(0,4) = 0;
buff(0,5) = 0;
pw(0,5) = 0;
cr(0,5) = 0;
iw(0,5) = 0;
cw(0,5) = 0;
cx(0,5) = 0;
is(0,5) = 0;
cs(0,5) = 0;
crmax(0,5) = 0;
buff(0,6) = 0;
pw(0,6) = 0;
cr(0,6) = 0;
iw(0,6) = 0;
cw(0,6) = 0;
cx(0,6) = 0;
is(0,6) = 0;
cs(0,6) = 0;
crmax(0,6) = 0;
buff(0,7) = 0;
pw(0,7) = 0;
cr(0,7) = 0;
iw(0,7) = 0;
cw(0,7) = 0;
cx(0,7) = 0;
is(0,7) = 0;
cs(0,7) = 0;
crmax(0,7) = 0;
buff(0,8) = 0;
pw(0,8) = 0;
cr(0,8) = 0;
iw(0,8) = 0;
cw(0,8) = 0;
cx(0,8) = 0;
is(0,8) = 0;
cs(0,8) = 0;
crmax(0,8) = 0;
cl[0] = 0;
cdy[0] = 0;
cds[0] = 0;
cdl[0] = 0;
cisb[0] = 0;
caddr[0] = 0;
cctrl[0] = 0;
cstart[0] = get_rng(0,NCONTEXT-1);
creturn[0] = get_rng(0,NCONTEXT-1);
buff(1,0) = 0;
pw(1,0) = 0;
cr(1,0) = 0;
iw(1,0) = 0;
cw(1,0) = 0;
cx(1,0) = 0;
is(1,0) = 0;
cs(1,0) = 0;
crmax(1,0) = 0;
buff(1,1) = 0;
pw(1,1) = 0;
cr(1,1) = 0;
iw(1,1) = 0;
cw(1,1) = 0;
cx(1,1) = 0;
is(1,1) = 0;
cs(1,1) = 0;
crmax(1,1) = 0;
buff(1,2) = 0;
pw(1,2) = 0;
cr(1,2) = 0;
iw(1,2) = 0;
cw(1,2) = 0;
cx(1,2) = 0;
is(1,2) = 0;
cs(1,2) = 0;
crmax(1,2) = 0;
buff(1,3) = 0;
pw(1,3) = 0;
cr(1,3) = 0;
iw(1,3) = 0;
cw(1,3) = 0;
cx(1,3) = 0;
is(1,3) = 0;
cs(1,3) = 0;
crmax(1,3) = 0;
buff(1,4) = 0;
pw(1,4) = 0;
cr(1,4) = 0;
iw(1,4) = 0;
cw(1,4) = 0;
cx(1,4) = 0;
is(1,4) = 0;
cs(1,4) = 0;
crmax(1,4) = 0;
buff(1,5) = 0;
pw(1,5) = 0;
cr(1,5) = 0;
iw(1,5) = 0;
cw(1,5) = 0;
cx(1,5) = 0;
is(1,5) = 0;
cs(1,5) = 0;
crmax(1,5) = 0;
buff(1,6) = 0;
pw(1,6) = 0;
cr(1,6) = 0;
iw(1,6) = 0;
cw(1,6) = 0;
cx(1,6) = 0;
is(1,6) = 0;
cs(1,6) = 0;
crmax(1,6) = 0;
buff(1,7) = 0;
pw(1,7) = 0;
cr(1,7) = 0;
iw(1,7) = 0;
cw(1,7) = 0;
cx(1,7) = 0;
is(1,7) = 0;
cs(1,7) = 0;
crmax(1,7) = 0;
buff(1,8) = 0;
pw(1,8) = 0;
cr(1,8) = 0;
iw(1,8) = 0;
cw(1,8) = 0;
cx(1,8) = 0;
is(1,8) = 0;
cs(1,8) = 0;
crmax(1,8) = 0;
cl[1] = 0;
cdy[1] = 0;
cds[1] = 0;
cdl[1] = 0;
cisb[1] = 0;
caddr[1] = 0;
cctrl[1] = 0;
cstart[1] = get_rng(0,NCONTEXT-1);
creturn[1] = get_rng(0,NCONTEXT-1);
buff(2,0) = 0;
pw(2,0) = 0;
cr(2,0) = 0;
iw(2,0) = 0;
cw(2,0) = 0;
cx(2,0) = 0;
is(2,0) = 0;
cs(2,0) = 0;
crmax(2,0) = 0;
buff(2,1) = 0;
pw(2,1) = 0;
cr(2,1) = 0;
iw(2,1) = 0;
cw(2,1) = 0;
cx(2,1) = 0;
is(2,1) = 0;
cs(2,1) = 0;
crmax(2,1) = 0;
buff(2,2) = 0;
pw(2,2) = 0;
cr(2,2) = 0;
iw(2,2) = 0;
cw(2,2) = 0;
cx(2,2) = 0;
is(2,2) = 0;
cs(2,2) = 0;
crmax(2,2) = 0;
buff(2,3) = 0;
pw(2,3) = 0;
cr(2,3) = 0;
iw(2,3) = 0;
cw(2,3) = 0;
cx(2,3) = 0;
is(2,3) = 0;
cs(2,3) = 0;
crmax(2,3) = 0;
buff(2,4) = 0;
pw(2,4) = 0;
cr(2,4) = 0;
iw(2,4) = 0;
cw(2,4) = 0;
cx(2,4) = 0;
is(2,4) = 0;
cs(2,4) = 0;
crmax(2,4) = 0;
buff(2,5) = 0;
pw(2,5) = 0;
cr(2,5) = 0;
iw(2,5) = 0;
cw(2,5) = 0;
cx(2,5) = 0;
is(2,5) = 0;
cs(2,5) = 0;
crmax(2,5) = 0;
buff(2,6) = 0;
pw(2,6) = 0;
cr(2,6) = 0;
iw(2,6) = 0;
cw(2,6) = 0;
cx(2,6) = 0;
is(2,6) = 0;
cs(2,6) = 0;
crmax(2,6) = 0;
buff(2,7) = 0;
pw(2,7) = 0;
cr(2,7) = 0;
iw(2,7) = 0;
cw(2,7) = 0;
cx(2,7) = 0;
is(2,7) = 0;
cs(2,7) = 0;
crmax(2,7) = 0;
buff(2,8) = 0;
pw(2,8) = 0;
cr(2,8) = 0;
iw(2,8) = 0;
cw(2,8) = 0;
cx(2,8) = 0;
is(2,8) = 0;
cs(2,8) = 0;
crmax(2,8) = 0;
cl[2] = 0;
cdy[2] = 0;
cds[2] = 0;
cdl[2] = 0;
cisb[2] = 0;
caddr[2] = 0;
cctrl[2] = 0;
cstart[2] = get_rng(0,NCONTEXT-1);
creturn[2] = get_rng(0,NCONTEXT-1);
buff(3,0) = 0;
pw(3,0) = 0;
cr(3,0) = 0;
iw(3,0) = 0;
cw(3,0) = 0;
cx(3,0) = 0;
is(3,0) = 0;
cs(3,0) = 0;
crmax(3,0) = 0;
buff(3,1) = 0;
pw(3,1) = 0;
cr(3,1) = 0;
iw(3,1) = 0;
cw(3,1) = 0;
cx(3,1) = 0;
is(3,1) = 0;
cs(3,1) = 0;
crmax(3,1) = 0;
buff(3,2) = 0;
pw(3,2) = 0;
cr(3,2) = 0;
iw(3,2) = 0;
cw(3,2) = 0;
cx(3,2) = 0;
is(3,2) = 0;
cs(3,2) = 0;
crmax(3,2) = 0;
buff(3,3) = 0;
pw(3,3) = 0;
cr(3,3) = 0;
iw(3,3) = 0;
cw(3,3) = 0;
cx(3,3) = 0;
is(3,3) = 0;
cs(3,3) = 0;
crmax(3,3) = 0;
buff(3,4) = 0;
pw(3,4) = 0;
cr(3,4) = 0;
iw(3,4) = 0;
cw(3,4) = 0;
cx(3,4) = 0;
is(3,4) = 0;
cs(3,4) = 0;
crmax(3,4) = 0;
buff(3,5) = 0;
pw(3,5) = 0;
cr(3,5) = 0;
iw(3,5) = 0;
cw(3,5) = 0;
cx(3,5) = 0;
is(3,5) = 0;
cs(3,5) = 0;
crmax(3,5) = 0;
buff(3,6) = 0;
pw(3,6) = 0;
cr(3,6) = 0;
iw(3,6) = 0;
cw(3,6) = 0;
cx(3,6) = 0;
is(3,6) = 0;
cs(3,6) = 0;
crmax(3,6) = 0;
buff(3,7) = 0;
pw(3,7) = 0;
cr(3,7) = 0;
iw(3,7) = 0;
cw(3,7) = 0;
cx(3,7) = 0;
is(3,7) = 0;
cs(3,7) = 0;
crmax(3,7) = 0;
buff(3,8) = 0;
pw(3,8) = 0;
cr(3,8) = 0;
iw(3,8) = 0;
cw(3,8) = 0;
cx(3,8) = 0;
is(3,8) = 0;
cs(3,8) = 0;
crmax(3,8) = 0;
cl[3] = 0;
cdy[3] = 0;
cds[3] = 0;
cdl[3] = 0;
cisb[3] = 0;
caddr[3] = 0;
cctrl[3] = 0;
cstart[3] = get_rng(0,NCONTEXT-1);
creturn[3] = get_rng(0,NCONTEXT-1);
// Dumping initializations
mem(7+0,0) = 0;
mem(8+0,0) = 0;
mem(0+0,0) = 0;
mem(0+1,0) = 0;
mem(0+2,0) = 0;
mem(3+0,0) = 0;
mem(4+0,0) = 0;
mem(5+0,0) = 0;
mem(6+0,0) = 0;
// Dumping context matching equalities
co(0,0) = 0;
delta(0,0) = -1;
co(1,0) = 0;
delta(1,0) = -1;
co(2,0) = 0;
delta(2,0) = -1;
co(3,0) = 0;
delta(3,0) = -1;
co(4,0) = 0;
delta(4,0) = -1;
co(5,0) = 0;
delta(5,0) = -1;
co(6,0) = 0;
delta(6,0) = -1;
co(7,0) = 0;
delta(7,0) = -1;
co(8,0) = 0;
delta(8,0) = -1;
// Dumping thread 1
int ret_thread_1 = 0;
cdy[1] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[1] >= cstart[1]);
T1BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !37, metadata !DIExpression()), !dbg !52
// br label %label_1, !dbg !53
goto T1BLOCK1;
T1BLOCK1:
// call void @llvm.dbg.label(metadata !51), !dbg !54
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !40, metadata !DIExpression()), !dbg !55
// %0 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !56
// LD: Guess
old_cr = cr(1,0);
cr(1,0) = get_rng(0,NCONTEXT-1);// 1 ASSIGN LDCOM
// Check
ASSUME(active[cr(1,0)] == 1);
ASSUME(cr(1,0) >= iw(1,0));
ASSUME(cr(1,0) >= 0);
ASSUME(cr(1,0) >= cdy[1]);
ASSUME(cr(1,0) >= cisb[1]);
ASSUME(cr(1,0) >= cdl[1]);
ASSUME(cr(1,0) >= cl[1]);
// Update
creg_r0 = cr(1,0);
crmax(1,0) = max(crmax(1,0),cr(1,0));
caddr[1] = max(caddr[1],0);
if(cr(1,0) < cw(1,0)) {
r0 = buff(1,0);
} else {
if(pw(1,0) != co(0,cr(1,0))) {
ASSUME(cr(1,0) >= old_cr);
}
pw(1,0) = co(0,cr(1,0));
r0 = mem(0,cr(1,0));
}
ASSUME(creturn[1] >= cr(1,0));
// call void @llvm.dbg.value(metadata i64 %0, metadata !43, metadata !DIExpression()), !dbg !55
// %conv = trunc i64 %0 to i32, !dbg !57
// call void @llvm.dbg.value(metadata i32 %conv, metadata !38, metadata !DIExpression()), !dbg !52
// call void (...) @dmbst(), !dbg !58
// dumbst: Guess
cds[1] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cds[1] >= cdy[1]);
ASSUME(cds[1] >= cw(1,7+0));
ASSUME(cds[1] >= cw(1,8+0));
ASSUME(cds[1] >= cw(1,0+0));
ASSUME(cds[1] >= cw(1,0+1));
ASSUME(cds[1] >= cw(1,0+2));
ASSUME(cds[1] >= cw(1,3+0));
ASSUME(cds[1] >= cw(1,4+0));
ASSUME(cds[1] >= cw(1,5+0));
ASSUME(cds[1] >= cw(1,6+0));
ASSUME(creturn[1] >= cds[1]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !44, metadata !DIExpression()), !dbg !59
// call void @llvm.dbg.value(metadata i64 1, metadata !46, metadata !DIExpression()), !dbg !59
// store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !60
// ST: Guess
iw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW
old_cw = cw(1,0+1*1);
cw(1,0+1*1) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM
// Check
ASSUME(active[iw(1,0+1*1)] == 1);
ASSUME(active[cw(1,0+1*1)] == 1);
ASSUME(sforbid(0+1*1,cw(1,0+1*1))== 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(iw(1,0+1*1) >= 0);
ASSUME(cw(1,0+1*1) >= iw(1,0+1*1));
ASSUME(cw(1,0+1*1) >= old_cw);
ASSUME(cw(1,0+1*1) >= cr(1,0+1*1));
ASSUME(cw(1,0+1*1) >= cl[1]);
ASSUME(cw(1,0+1*1) >= cisb[1]);
ASSUME(cw(1,0+1*1) >= cdy[1]);
ASSUME(cw(1,0+1*1) >= cdl[1]);
ASSUME(cw(1,0+1*1) >= cds[1]);
ASSUME(cw(1,0+1*1) >= cctrl[1]);
ASSUME(cw(1,0+1*1) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,0+1*1) = 1;
mem(0+1*1,cw(1,0+1*1)) = 1;
co(0+1*1,cw(1,0+1*1))+=1;
delta(0+1*1,cw(1,0+1*1)) = -1;
ASSUME(creturn[1] >= cw(1,0+1*1));
// %cmp = icmp eq i32 %conv, 1, !dbg !61
// %conv1 = zext i1 %cmp to i32, !dbg !61
// call void @llvm.dbg.value(metadata i32 %conv1, metadata !47, metadata !DIExpression()), !dbg !52
// call void @llvm.dbg.value(metadata i64* @atom_0_X0_1, metadata !48, metadata !DIExpression()), !dbg !62
// %1 = zext i32 %conv1 to i64
// call void @llvm.dbg.value(metadata i64 %1, metadata !50, metadata !DIExpression()), !dbg !62
// store atomic i64 %1, i64* @atom_0_X0_1 seq_cst, align 8, !dbg !63
// ST: Guess
iw(1,3) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STIW
old_cw = cw(1,3);
cw(1,3) = get_rng(0,NCONTEXT-1);// 1 ASSIGN STCOM
// Check
ASSUME(active[iw(1,3)] == 1);
ASSUME(active[cw(1,3)] == 1);
ASSUME(sforbid(3,cw(1,3))== 0);
ASSUME(iw(1,3) >= max(creg_r0,0));
ASSUME(iw(1,3) >= 0);
ASSUME(cw(1,3) >= iw(1,3));
ASSUME(cw(1,3) >= old_cw);
ASSUME(cw(1,3) >= cr(1,3));
ASSUME(cw(1,3) >= cl[1]);
ASSUME(cw(1,3) >= cisb[1]);
ASSUME(cw(1,3) >= cdy[1]);
ASSUME(cw(1,3) >= cdl[1]);
ASSUME(cw(1,3) >= cds[1]);
ASSUME(cw(1,3) >= cctrl[1]);
ASSUME(cw(1,3) >= caddr[1]);
// Update
caddr[1] = max(caddr[1],0);
buff(1,3) = (r0==1);
mem(3,cw(1,3)) = (r0==1);
co(3,cw(1,3))+=1;
delta(3,cw(1,3)) = -1;
ASSUME(creturn[1] >= cw(1,3));
// ret i8* null, !dbg !64
ret_thread_1 = (- 1);
// Dumping thread 2
int ret_thread_2 = 0;
cdy[2] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[2] >= cstart[2]);
T2BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !67, metadata !DIExpression()), !dbg !80
// br label %label_2, !dbg !53
goto T2BLOCK1;
T2BLOCK1:
// call void @llvm.dbg.label(metadata !79), !dbg !82
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !69, metadata !DIExpression()), !dbg !83
// %0 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !56
// LD: Guess
old_cr = cr(2,0+1*1);
cr(2,0+1*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN LDCOM
// Check
ASSUME(active[cr(2,0+1*1)] == 2);
ASSUME(cr(2,0+1*1) >= iw(2,0+1*1));
ASSUME(cr(2,0+1*1) >= 0);
ASSUME(cr(2,0+1*1) >= cdy[2]);
ASSUME(cr(2,0+1*1) >= cisb[2]);
ASSUME(cr(2,0+1*1) >= cdl[2]);
ASSUME(cr(2,0+1*1) >= cl[2]);
// Update
creg_r1 = cr(2,0+1*1);
crmax(2,0+1*1) = max(crmax(2,0+1*1),cr(2,0+1*1));
caddr[2] = max(caddr[2],0);
if(cr(2,0+1*1) < cw(2,0+1*1)) {
r1 = buff(2,0+1*1);
} else {
if(pw(2,0+1*1) != co(0+1*1,cr(2,0+1*1))) {
ASSUME(cr(2,0+1*1) >= old_cr);
}
pw(2,0+1*1) = co(0+1*1,cr(2,0+1*1));
r1 = mem(0+1*1,cr(2,0+1*1));
}
ASSUME(creturn[2] >= cr(2,0+1*1));
// call void @llvm.dbg.value(metadata i64 %0, metadata !71, metadata !DIExpression()), !dbg !83
// %conv = trunc i64 %0 to i32, !dbg !57
// call void @llvm.dbg.value(metadata i32 %conv, metadata !68, metadata !DIExpression()), !dbg !80
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !72, metadata !DIExpression()), !dbg !86
// call void @llvm.dbg.value(metadata i64 1, metadata !74, metadata !DIExpression()), !dbg !86
// store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !59
// ST: Guess
iw(2,0+2*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW
old_cw = cw(2,0+2*1);
cw(2,0+2*1) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM
// Check
ASSUME(active[iw(2,0+2*1)] == 2);
ASSUME(active[cw(2,0+2*1)] == 2);
ASSUME(sforbid(0+2*1,cw(2,0+2*1))== 0);
ASSUME(iw(2,0+2*1) >= 0);
ASSUME(iw(2,0+2*1) >= 0);
ASSUME(cw(2,0+2*1) >= iw(2,0+2*1));
ASSUME(cw(2,0+2*1) >= old_cw);
ASSUME(cw(2,0+2*1) >= cr(2,0+2*1));
ASSUME(cw(2,0+2*1) >= cl[2]);
ASSUME(cw(2,0+2*1) >= cisb[2]);
ASSUME(cw(2,0+2*1) >= cdy[2]);
ASSUME(cw(2,0+2*1) >= cdl[2]);
ASSUME(cw(2,0+2*1) >= cds[2]);
ASSUME(cw(2,0+2*1) >= cctrl[2]);
ASSUME(cw(2,0+2*1) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,0+2*1) = 1;
mem(0+2*1,cw(2,0+2*1)) = 1;
co(0+2*1,cw(2,0+2*1))+=1;
delta(0+2*1,cw(2,0+2*1)) = -1;
ASSUME(creturn[2] >= cw(2,0+2*1));
// %cmp = icmp eq i32 %conv, 1, !dbg !60
// %conv1 = zext i1 %cmp to i32, !dbg !60
// call void @llvm.dbg.value(metadata i32 %conv1, metadata !75, metadata !DIExpression()), !dbg !80
// call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !76, metadata !DIExpression()), !dbg !89
// %1 = zext i32 %conv1 to i64
// call void @llvm.dbg.value(metadata i64 %1, metadata !78, metadata !DIExpression()), !dbg !89
// store atomic i64 %1, i64* @atom_1_X0_1 seq_cst, align 8, !dbg !62
// ST: Guess
iw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STIW
old_cw = cw(2,4);
cw(2,4) = get_rng(0,NCONTEXT-1);// 2 ASSIGN STCOM
// Check
ASSUME(active[iw(2,4)] == 2);
ASSUME(active[cw(2,4)] == 2);
ASSUME(sforbid(4,cw(2,4))== 0);
ASSUME(iw(2,4) >= max(creg_r1,0));
ASSUME(iw(2,4) >= 0);
ASSUME(cw(2,4) >= iw(2,4));
ASSUME(cw(2,4) >= old_cw);
ASSUME(cw(2,4) >= cr(2,4));
ASSUME(cw(2,4) >= cl[2]);
ASSUME(cw(2,4) >= cisb[2]);
ASSUME(cw(2,4) >= cdy[2]);
ASSUME(cw(2,4) >= cdl[2]);
ASSUME(cw(2,4) >= cds[2]);
ASSUME(cw(2,4) >= cctrl[2]);
ASSUME(cw(2,4) >= caddr[2]);
// Update
caddr[2] = max(caddr[2],0);
buff(2,4) = (r1==1);
mem(4,cw(2,4)) = (r1==1);
co(4,cw(2,4))+=1;
delta(4,cw(2,4)) = -1;
ASSUME(creturn[2] >= cw(2,4));
// ret i8* null, !dbg !63
ret_thread_2 = (- 1);
// Dumping thread 3
int ret_thread_3 = 0;
cdy[3] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[3] >= cstart[3]);
T3BLOCK0:
// call void @llvm.dbg.value(metadata i8* %arg, metadata !94, metadata !DIExpression()), !dbg !108
// br label %label_3, !dbg !54
goto T3BLOCK1;
T3BLOCK1:
// call void @llvm.dbg.label(metadata !106), !dbg !110
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !96, metadata !DIExpression()), !dbg !111
// %0 = load atomic i64, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !57
// LD: Guess
old_cr = cr(3,0+2*1);
cr(3,0+2*1) = get_rng(0,NCONTEXT-1);// 3 ASSIGN LDCOM
// Check
ASSUME(active[cr(3,0+2*1)] == 3);
ASSUME(cr(3,0+2*1) >= iw(3,0+2*1));
ASSUME(cr(3,0+2*1) >= 0);
ASSUME(cr(3,0+2*1) >= cdy[3]);
ASSUME(cr(3,0+2*1) >= cisb[3]);
ASSUME(cr(3,0+2*1) >= cdl[3]);
ASSUME(cr(3,0+2*1) >= cl[3]);
// Update
creg_r2 = cr(3,0+2*1);
crmax(3,0+2*1) = max(crmax(3,0+2*1),cr(3,0+2*1));
caddr[3] = max(caddr[3],0);
if(cr(3,0+2*1) < cw(3,0+2*1)) {
r2 = buff(3,0+2*1);
} else {
if(pw(3,0+2*1) != co(0+2*1,cr(3,0+2*1))) {
ASSUME(cr(3,0+2*1) >= old_cr);
}
pw(3,0+2*1) = co(0+2*1,cr(3,0+2*1));
r2 = mem(0+2*1,cr(3,0+2*1));
}
ASSUME(creturn[3] >= cr(3,0+2*1));
// call void @llvm.dbg.value(metadata i64 %0, metadata !98, metadata !DIExpression()), !dbg !111
// %conv = trunc i64 %0 to i32, !dbg !58
// call void @llvm.dbg.value(metadata i32 %conv, metadata !95, metadata !DIExpression()), !dbg !108
// %tobool = icmp ne i32 %conv, 0, !dbg !59
// br i1 %tobool, label %if.then, label %if.else, !dbg !61
old_cctrl = cctrl[3];
cctrl[3] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[3] >= old_cctrl);
ASSUME(cctrl[3] >= creg_r2);
ASSUME(cctrl[3] >= 0);
if((r2!=0)) {
goto T3BLOCK2;
} else {
goto T3BLOCK3;
}
T3BLOCK2:
// br label %lbl_LC00, !dbg !62
goto T3BLOCK4;
T3BLOCK3:
// br label %lbl_LC00, !dbg !63
goto T3BLOCK4;
T3BLOCK4:
// call void @llvm.dbg.label(metadata !107), !dbg !119
// call void (...) @isb(), !dbg !65
// isb: Guess
cisb[3] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cisb[3] >= cdy[3]);
ASSUME(cisb[3] >= cctrl[3]);
ASSUME(cisb[3] >= caddr[3]);
ASSUME(creturn[3] >= cisb[3]);
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !99, metadata !DIExpression()), !dbg !121
// call void @llvm.dbg.value(metadata i64 1, metadata !101, metadata !DIExpression()), !dbg !121
// store atomic i64 1, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !67
// ST: Guess
iw(3,0) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW
old_cw = cw(3,0);
cw(3,0) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM
// Check
ASSUME(active[iw(3,0)] == 3);
ASSUME(active[cw(3,0)] == 3);
ASSUME(sforbid(0,cw(3,0))== 0);
ASSUME(iw(3,0) >= 0);
ASSUME(iw(3,0) >= 0);
ASSUME(cw(3,0) >= iw(3,0));
ASSUME(cw(3,0) >= old_cw);
ASSUME(cw(3,0) >= cr(3,0));
ASSUME(cw(3,0) >= cl[3]);
ASSUME(cw(3,0) >= cisb[3]);
ASSUME(cw(3,0) >= cdy[3]);
ASSUME(cw(3,0) >= cdl[3]);
ASSUME(cw(3,0) >= cds[3]);
ASSUME(cw(3,0) >= cctrl[3]);
ASSUME(cw(3,0) >= caddr[3]);
// Update
caddr[3] = max(caddr[3],0);
buff(3,0) = 1;
mem(0,cw(3,0)) = 1;
co(0,cw(3,0))+=1;
delta(0,cw(3,0)) = -1;
ASSUME(creturn[3] >= cw(3,0));
// %cmp = icmp eq i32 %conv, 1, !dbg !68
// %conv1 = zext i1 %cmp to i32, !dbg !68
// call void @llvm.dbg.value(metadata i32 %conv1, metadata !102, metadata !DIExpression()), !dbg !108
// call void @llvm.dbg.value(metadata i64* @atom_2_X0_1, metadata !103, metadata !DIExpression()), !dbg !124
// %1 = zext i32 %conv1 to i64
// call void @llvm.dbg.value(metadata i64 %1, metadata !105, metadata !DIExpression()), !dbg !124
// store atomic i64 %1, i64* @atom_2_X0_1 seq_cst, align 8, !dbg !70
// ST: Guess
iw(3,5) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STIW
old_cw = cw(3,5);
cw(3,5) = get_rng(0,NCONTEXT-1);// 3 ASSIGN STCOM
// Check
ASSUME(active[iw(3,5)] == 3);
ASSUME(active[cw(3,5)] == 3);
ASSUME(sforbid(5,cw(3,5))== 0);
ASSUME(iw(3,5) >= max(creg_r2,0));
ASSUME(iw(3,5) >= 0);
ASSUME(cw(3,5) >= iw(3,5));
ASSUME(cw(3,5) >= old_cw);
ASSUME(cw(3,5) >= cr(3,5));
ASSUME(cw(3,5) >= cl[3]);
ASSUME(cw(3,5) >= cisb[3]);
ASSUME(cw(3,5) >= cdy[3]);
ASSUME(cw(3,5) >= cdl[3]);
ASSUME(cw(3,5) >= cds[3]);
ASSUME(cw(3,5) >= cctrl[3]);
ASSUME(cw(3,5) >= caddr[3]);
// Update
caddr[3] = max(caddr[3],0);
buff(3,5) = (r2==1);
mem(5,cw(3,5)) = (r2==1);
co(5,cw(3,5))+=1;
delta(5,cw(3,5)) = -1;
ASSUME(creturn[3] >= cw(3,5));
// ret i8* null, !dbg !71
ret_thread_3 = (- 1);
// Dumping thread 0
int ret_thread_0 = 0;
cdy[0] = get_rng(0,NCONTEXT-1);
ASSUME(cdy[0] >= cstart[0]);
T0BLOCK0:
// %thr0 = alloca i64, align 8
// %thr1 = alloca i64, align 8
// %thr2 = alloca i64, align 8
// call void @llvm.dbg.value(metadata i32 %argc, metadata !134, metadata !DIExpression()), !dbg !174
// call void @llvm.dbg.value(metadata i8** %argv, metadata !135, metadata !DIExpression()), !dbg !174
// %0 = bitcast i64* %thr0 to i8*, !dbg !83
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %0) #7, !dbg !83
// call void @llvm.dbg.declare(metadata i64* %thr0, metadata !136, metadata !DIExpression()), !dbg !176
// %1 = bitcast i64* %thr1 to i8*, !dbg !85
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %1) #7, !dbg !85
// call void @llvm.dbg.declare(metadata i64* %thr1, metadata !140, metadata !DIExpression()), !dbg !178
// %2 = bitcast i64* %thr2 to i8*, !dbg !87
// call void @llvm.lifetime.start.p0i8(i64 8, i8* %2) #7, !dbg !87
// call void @llvm.dbg.declare(metadata i64* %thr2, metadata !141, metadata !DIExpression()), !dbg !180
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2), metadata !142, metadata !DIExpression()), !dbg !181
// call void @llvm.dbg.value(metadata i64 0, metadata !144, metadata !DIExpression()), !dbg !181
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 2) monotonic, align 8, !dbg !90
// ST: Guess
iw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,0+2*1);
cw(0,0+2*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,0+2*1)] == 0);
ASSUME(active[cw(0,0+2*1)] == 0);
ASSUME(sforbid(0+2*1,cw(0,0+2*1))== 0);
ASSUME(iw(0,0+2*1) >= 0);
ASSUME(iw(0,0+2*1) >= 0);
ASSUME(cw(0,0+2*1) >= iw(0,0+2*1));
ASSUME(cw(0,0+2*1) >= old_cw);
ASSUME(cw(0,0+2*1) >= cr(0,0+2*1));
ASSUME(cw(0,0+2*1) >= cl[0]);
ASSUME(cw(0,0+2*1) >= cisb[0]);
ASSUME(cw(0,0+2*1) >= cdy[0]);
ASSUME(cw(0,0+2*1) >= cdl[0]);
ASSUME(cw(0,0+2*1) >= cds[0]);
ASSUME(cw(0,0+2*1) >= cctrl[0]);
ASSUME(cw(0,0+2*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+2*1) = 0;
mem(0+2*1,cw(0,0+2*1)) = 0;
co(0+2*1,cw(0,0+2*1))+=1;
delta(0+2*1,cw(0,0+2*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+2*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1), metadata !145, metadata !DIExpression()), !dbg !183
// call void @llvm.dbg.value(metadata i64 0, metadata !147, metadata !DIExpression()), !dbg !183
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 1) monotonic, align 8, !dbg !92
// ST: Guess
iw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,0+1*1);
cw(0,0+1*1) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,0+1*1)] == 0);
ASSUME(active[cw(0,0+1*1)] == 0);
ASSUME(sforbid(0+1*1,cw(0,0+1*1))== 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(iw(0,0+1*1) >= 0);
ASSUME(cw(0,0+1*1) >= iw(0,0+1*1));
ASSUME(cw(0,0+1*1) >= old_cw);
ASSUME(cw(0,0+1*1) >= cr(0,0+1*1));
ASSUME(cw(0,0+1*1) >= cl[0]);
ASSUME(cw(0,0+1*1) >= cisb[0]);
ASSUME(cw(0,0+1*1) >= cdy[0]);
ASSUME(cw(0,0+1*1) >= cdl[0]);
ASSUME(cw(0,0+1*1) >= cds[0]);
ASSUME(cw(0,0+1*1) >= cctrl[0]);
ASSUME(cw(0,0+1*1) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0+1*1) = 0;
mem(0+1*1,cw(0,0+1*1)) = 0;
co(0+1*1,cw(0,0+1*1))+=1;
delta(0+1*1,cw(0,0+1*1)) = -1;
ASSUME(creturn[0] >= cw(0,0+1*1));
// call void @llvm.dbg.value(metadata i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0), metadata !148, metadata !DIExpression()), !dbg !185
// call void @llvm.dbg.value(metadata i64 0, metadata !150, metadata !DIExpression()), !dbg !185
// store atomic i64 0, i64* getelementptr inbounds ([3 x i64], [3 x i64]* @vars, i64 0, i64 0) monotonic, align 8, !dbg !94
// ST: Guess
iw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,0);
cw(0,0) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,0)] == 0);
ASSUME(active[cw(0,0)] == 0);
ASSUME(sforbid(0,cw(0,0))== 0);
ASSUME(iw(0,0) >= 0);
ASSUME(iw(0,0) >= 0);
ASSUME(cw(0,0) >= iw(0,0));
ASSUME(cw(0,0) >= old_cw);
ASSUME(cw(0,0) >= cr(0,0));
ASSUME(cw(0,0) >= cl[0]);
ASSUME(cw(0,0) >= cisb[0]);
ASSUME(cw(0,0) >= cdy[0]);
ASSUME(cw(0,0) >= cdl[0]);
ASSUME(cw(0,0) >= cds[0]);
ASSUME(cw(0,0) >= cctrl[0]);
ASSUME(cw(0,0) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,0) = 0;
mem(0,cw(0,0)) = 0;
co(0,cw(0,0))+=1;
delta(0,cw(0,0)) = -1;
ASSUME(creturn[0] >= cw(0,0));
// call void @llvm.dbg.value(metadata i64* @atom_0_X0_1, metadata !151, metadata !DIExpression()), !dbg !187
// call void @llvm.dbg.value(metadata i64 0, metadata !153, metadata !DIExpression()), !dbg !187
// store atomic i64 0, i64* @atom_0_X0_1 monotonic, align 8, !dbg !96
// ST: Guess
iw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,3);
cw(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,3)] == 0);
ASSUME(active[cw(0,3)] == 0);
ASSUME(sforbid(3,cw(0,3))== 0);
ASSUME(iw(0,3) >= 0);
ASSUME(iw(0,3) >= 0);
ASSUME(cw(0,3) >= iw(0,3));
ASSUME(cw(0,3) >= old_cw);
ASSUME(cw(0,3) >= cr(0,3));
ASSUME(cw(0,3) >= cl[0]);
ASSUME(cw(0,3) >= cisb[0]);
ASSUME(cw(0,3) >= cdy[0]);
ASSUME(cw(0,3) >= cdl[0]);
ASSUME(cw(0,3) >= cds[0]);
ASSUME(cw(0,3) >= cctrl[0]);
ASSUME(cw(0,3) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,3) = 0;
mem(3,cw(0,3)) = 0;
co(3,cw(0,3))+=1;
delta(3,cw(0,3)) = -1;
ASSUME(creturn[0] >= cw(0,3));
// call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !154, metadata !DIExpression()), !dbg !189
// call void @llvm.dbg.value(metadata i64 0, metadata !156, metadata !DIExpression()), !dbg !189
// store atomic i64 0, i64* @atom_1_X0_1 monotonic, align 8, !dbg !98
// ST: Guess
iw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,4);
cw(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,4)] == 0);
ASSUME(active[cw(0,4)] == 0);
ASSUME(sforbid(4,cw(0,4))== 0);
ASSUME(iw(0,4) >= 0);
ASSUME(iw(0,4) >= 0);
ASSUME(cw(0,4) >= iw(0,4));
ASSUME(cw(0,4) >= old_cw);
ASSUME(cw(0,4) >= cr(0,4));
ASSUME(cw(0,4) >= cl[0]);
ASSUME(cw(0,4) >= cisb[0]);
ASSUME(cw(0,4) >= cdy[0]);
ASSUME(cw(0,4) >= cdl[0]);
ASSUME(cw(0,4) >= cds[0]);
ASSUME(cw(0,4) >= cctrl[0]);
ASSUME(cw(0,4) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,4) = 0;
mem(4,cw(0,4)) = 0;
co(4,cw(0,4))+=1;
delta(4,cw(0,4)) = -1;
ASSUME(creturn[0] >= cw(0,4));
// call void @llvm.dbg.value(metadata i64* @atom_2_X0_1, metadata !157, metadata !DIExpression()), !dbg !191
// call void @llvm.dbg.value(metadata i64 0, metadata !159, metadata !DIExpression()), !dbg !191
// store atomic i64 0, i64* @atom_2_X0_1 monotonic, align 8, !dbg !100
// ST: Guess
iw(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STIW
old_cw = cw(0,5);
cw(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN STCOM
// Check
ASSUME(active[iw(0,5)] == 0);
ASSUME(active[cw(0,5)] == 0);
ASSUME(sforbid(5,cw(0,5))== 0);
ASSUME(iw(0,5) >= 0);
ASSUME(iw(0,5) >= 0);
ASSUME(cw(0,5) >= iw(0,5));
ASSUME(cw(0,5) >= old_cw);
ASSUME(cw(0,5) >= cr(0,5));
ASSUME(cw(0,5) >= cl[0]);
ASSUME(cw(0,5) >= cisb[0]);
ASSUME(cw(0,5) >= cdy[0]);
ASSUME(cw(0,5) >= cdl[0]);
ASSUME(cw(0,5) >= cds[0]);
ASSUME(cw(0,5) >= cctrl[0]);
ASSUME(cw(0,5) >= caddr[0]);
// Update
caddr[0] = max(caddr[0],0);
buff(0,5) = 0;
mem(5,cw(0,5)) = 0;
co(5,cw(0,5))+=1;
delta(5,cw(0,5)) = -1;
ASSUME(creturn[0] >= cw(0,5));
// %call = call i32 @pthread_create(i64* noundef %thr0, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t0, i8* noundef null) #7, !dbg !101
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,7+0));
ASSUME(cdy[0] >= cw(0,8+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,7+0));
ASSUME(cdy[0] >= cr(0,8+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[1] >= cdy[0]);
// %call11 = call i32 @pthread_create(i64* noundef %thr1, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t1, i8* noundef null) #7, !dbg !102
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,7+0));
ASSUME(cdy[0] >= cw(0,8+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,7+0));
ASSUME(cdy[0] >= cr(0,8+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[2] >= cdy[0]);
// %call12 = call i32 @pthread_create(i64* noundef %thr2, %union.pthread_attr_t* noundef null, i8* (i8*)* noundef @t2, i8* noundef null) #7, !dbg !103
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,7+0));
ASSUME(cdy[0] >= cw(0,8+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,7+0));
ASSUME(cdy[0] >= cr(0,8+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cstart[3] >= cdy[0]);
// %3 = load i64, i64* %thr0, align 8, !dbg !104, !tbaa !105
// LD: Guess
old_cr = cr(0,6);
cr(0,6) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,6)] == 0);
ASSUME(cr(0,6) >= iw(0,6));
ASSUME(cr(0,6) >= 0);
ASSUME(cr(0,6) >= cdy[0]);
ASSUME(cr(0,6) >= cisb[0]);
ASSUME(cr(0,6) >= cdl[0]);
ASSUME(cr(0,6) >= cl[0]);
// Update
creg_r4 = cr(0,6);
crmax(0,6) = max(crmax(0,6),cr(0,6));
caddr[0] = max(caddr[0],0);
if(cr(0,6) < cw(0,6)) {
r4 = buff(0,6);
} else {
if(pw(0,6) != co(6,cr(0,6))) {
ASSUME(cr(0,6) >= old_cr);
}
pw(0,6) = co(6,cr(0,6));
r4 = mem(6,cr(0,6));
}
ASSUME(creturn[0] >= cr(0,6));
// %call13 = call i32 @pthread_join(i64 noundef %3, i8** noundef null), !dbg !109
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,7+0));
ASSUME(cdy[0] >= cw(0,8+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,7+0));
ASSUME(cdy[0] >= cr(0,8+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[1]);
// %4 = load i64, i64* %thr1, align 8, !dbg !110, !tbaa !105
// LD: Guess
old_cr = cr(0,7);
cr(0,7) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,7)] == 0);
ASSUME(cr(0,7) >= iw(0,7));
ASSUME(cr(0,7) >= 0);
ASSUME(cr(0,7) >= cdy[0]);
ASSUME(cr(0,7) >= cisb[0]);
ASSUME(cr(0,7) >= cdl[0]);
ASSUME(cr(0,7) >= cl[0]);
// Update
creg_r5 = cr(0,7);
crmax(0,7) = max(crmax(0,7),cr(0,7));
caddr[0] = max(caddr[0],0);
if(cr(0,7) < cw(0,7)) {
r5 = buff(0,7);
} else {
if(pw(0,7) != co(7,cr(0,7))) {
ASSUME(cr(0,7) >= old_cr);
}
pw(0,7) = co(7,cr(0,7));
r5 = mem(7,cr(0,7));
}
ASSUME(creturn[0] >= cr(0,7));
// %call14 = call i32 @pthread_join(i64 noundef %4, i8** noundef null), !dbg !111
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,7+0));
ASSUME(cdy[0] >= cw(0,8+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,7+0));
ASSUME(cdy[0] >= cr(0,8+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[2]);
// %5 = load i64, i64* %thr2, align 8, !dbg !112, !tbaa !105
// LD: Guess
old_cr = cr(0,8);
cr(0,8) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,8)] == 0);
ASSUME(cr(0,8) >= iw(0,8));
ASSUME(cr(0,8) >= 0);
ASSUME(cr(0,8) >= cdy[0]);
ASSUME(cr(0,8) >= cisb[0]);
ASSUME(cr(0,8) >= cdl[0]);
ASSUME(cr(0,8) >= cl[0]);
// Update
creg_r6 = cr(0,8);
crmax(0,8) = max(crmax(0,8),cr(0,8));
caddr[0] = max(caddr[0],0);
if(cr(0,8) < cw(0,8)) {
r6 = buff(0,8);
} else {
if(pw(0,8) != co(8,cr(0,8))) {
ASSUME(cr(0,8) >= old_cr);
}
pw(0,8) = co(8,cr(0,8));
r6 = mem(8,cr(0,8));
}
ASSUME(creturn[0] >= cr(0,8));
// %call15 = call i32 @pthread_join(i64 noundef %5, i8** noundef null), !dbg !113
// dumbsy: Guess
old_cdy = cdy[0];
cdy[0] = get_rng(0,NCONTEXT-1);
// Check
ASSUME(cdy[0] >= old_cdy);
ASSUME(cdy[0] >= cisb[0]);
ASSUME(cdy[0] >= cdl[0]);
ASSUME(cdy[0] >= cds[0]);
ASSUME(cdy[0] >= cctrl[0]);
ASSUME(cdy[0] >= cw(0,7+0));
ASSUME(cdy[0] >= cw(0,8+0));
ASSUME(cdy[0] >= cw(0,0+0));
ASSUME(cdy[0] >= cw(0,0+1));
ASSUME(cdy[0] >= cw(0,0+2));
ASSUME(cdy[0] >= cw(0,3+0));
ASSUME(cdy[0] >= cw(0,4+0));
ASSUME(cdy[0] >= cw(0,5+0));
ASSUME(cdy[0] >= cw(0,6+0));
ASSUME(cdy[0] >= cr(0,7+0));
ASSUME(cdy[0] >= cr(0,8+0));
ASSUME(cdy[0] >= cr(0,0+0));
ASSUME(cdy[0] >= cr(0,0+1));
ASSUME(cdy[0] >= cr(0,0+2));
ASSUME(cdy[0] >= cr(0,3+0));
ASSUME(cdy[0] >= cr(0,4+0));
ASSUME(cdy[0] >= cr(0,5+0));
ASSUME(cdy[0] >= cr(0,6+0));
ASSUME(creturn[0] >= cdy[0]);
ASSUME(cdy[0] >= creturn[3]);
// call void @llvm.dbg.value(metadata i64* @atom_0_X0_1, metadata !161, metadata !DIExpression()), !dbg !206
// %6 = load atomic i64, i64* @atom_0_X0_1 seq_cst, align 8, !dbg !115
// LD: Guess
old_cr = cr(0,3);
cr(0,3) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,3)] == 0);
ASSUME(cr(0,3) >= iw(0,3));
ASSUME(cr(0,3) >= 0);
ASSUME(cr(0,3) >= cdy[0]);
ASSUME(cr(0,3) >= cisb[0]);
ASSUME(cr(0,3) >= cdl[0]);
ASSUME(cr(0,3) >= cl[0]);
// Update
creg_r7 = cr(0,3);
crmax(0,3) = max(crmax(0,3),cr(0,3));
caddr[0] = max(caddr[0],0);
if(cr(0,3) < cw(0,3)) {
r7 = buff(0,3);
} else {
if(pw(0,3) != co(3,cr(0,3))) {
ASSUME(cr(0,3) >= old_cr);
}
pw(0,3) = co(3,cr(0,3));
r7 = mem(3,cr(0,3));
}
ASSUME(creturn[0] >= cr(0,3));
// call void @llvm.dbg.value(metadata i64 %6, metadata !163, metadata !DIExpression()), !dbg !206
// %conv = trunc i64 %6 to i32, !dbg !116
// call void @llvm.dbg.value(metadata i32 %conv, metadata !160, metadata !DIExpression()), !dbg !174
// call void @llvm.dbg.value(metadata i64* @atom_1_X0_1, metadata !165, metadata !DIExpression()), !dbg !209
// %7 = load atomic i64, i64* @atom_1_X0_1 seq_cst, align 8, !dbg !118
// LD: Guess
old_cr = cr(0,4);
cr(0,4) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,4)] == 0);
ASSUME(cr(0,4) >= iw(0,4));
ASSUME(cr(0,4) >= 0);
ASSUME(cr(0,4) >= cdy[0]);
ASSUME(cr(0,4) >= cisb[0]);
ASSUME(cr(0,4) >= cdl[0]);
ASSUME(cr(0,4) >= cl[0]);
// Update
creg_r8 = cr(0,4);
crmax(0,4) = max(crmax(0,4),cr(0,4));
caddr[0] = max(caddr[0],0);
if(cr(0,4) < cw(0,4)) {
r8 = buff(0,4);
} else {
if(pw(0,4) != co(4,cr(0,4))) {
ASSUME(cr(0,4) >= old_cr);
}
pw(0,4) = co(4,cr(0,4));
r8 = mem(4,cr(0,4));
}
ASSUME(creturn[0] >= cr(0,4));
// call void @llvm.dbg.value(metadata i64 %7, metadata !167, metadata !DIExpression()), !dbg !209
// %conv19 = trunc i64 %7 to i32, !dbg !119
// call void @llvm.dbg.value(metadata i32 %conv19, metadata !164, metadata !DIExpression()), !dbg !174
// call void @llvm.dbg.value(metadata i64* @atom_2_X0_1, metadata !169, metadata !DIExpression()), !dbg !212
// %8 = load atomic i64, i64* @atom_2_X0_1 seq_cst, align 8, !dbg !121
// LD: Guess
old_cr = cr(0,5);
cr(0,5) = get_rng(0,NCONTEXT-1);// 0 ASSIGN LDCOM
// Check
ASSUME(active[cr(0,5)] == 0);
ASSUME(cr(0,5) >= iw(0,5));
ASSUME(cr(0,5) >= 0);
ASSUME(cr(0,5) >= cdy[0]);
ASSUME(cr(0,5) >= cisb[0]);
ASSUME(cr(0,5) >= cdl[0]);
ASSUME(cr(0,5) >= cl[0]);
// Update
creg_r9 = cr(0,5);
crmax(0,5) = max(crmax(0,5),cr(0,5));
caddr[0] = max(caddr[0],0);
if(cr(0,5) < cw(0,5)) {
r9 = buff(0,5);
} else {
if(pw(0,5) != co(5,cr(0,5))) {
ASSUME(cr(0,5) >= old_cr);
}
pw(0,5) = co(5,cr(0,5));
r9 = mem(5,cr(0,5));
}
ASSUME(creturn[0] >= cr(0,5));
// call void @llvm.dbg.value(metadata i64 %8, metadata !171, metadata !DIExpression()), !dbg !212
// %conv23 = trunc i64 %8 to i32, !dbg !122
// call void @llvm.dbg.value(metadata i32 %conv23, metadata !168, metadata !DIExpression()), !dbg !174
// %and = and i32 %conv19, %conv23, !dbg !123
creg_r10 = max(creg_r8,creg_r9);
ASSUME(active[creg_r10] == 0);
r10 = r8 & r9;
// call void @llvm.dbg.value(metadata i32 %and, metadata !172, metadata !DIExpression()), !dbg !174
// %and24 = and i32 %conv, %and, !dbg !124
creg_r11 = max(creg_r7,creg_r10);
ASSUME(active[creg_r11] == 0);
r11 = r7 & r10;
// call void @llvm.dbg.value(metadata i32 %and24, metadata !173, metadata !DIExpression()), !dbg !174
// %cmp = icmp eq i32 %and24, 1, !dbg !125
// br i1 %cmp, label %if.then, label %if.end, !dbg !127
old_cctrl = cctrl[0];
cctrl[0] = get_rng(0,NCONTEXT-1);
ASSUME(cctrl[0] >= old_cctrl);
ASSUME(cctrl[0] >= creg_r11);
ASSUME(cctrl[0] >= 0);
if((r11==1)) {
goto T0BLOCK1;
} else {
goto T0BLOCK2;
}
T0BLOCK1:
// call void @__assert_fail(i8* noundef getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8* noundef getelementptr inbounds ([107 x i8], [107 x i8]* @.str.1, i64 0, i64 0), i32 noundef 75, i8* noundef getelementptr inbounds ([23 x i8], [23 x i8]* @__PRETTY_FUNCTION__.main, i64 0, i64 0)) #8, !dbg !128
// unreachable, !dbg !128
r12 = 1;
T0BLOCK2:
// %9 = bitcast i64* %thr2 to i8*, !dbg !131
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %9) #7, !dbg !131
// %10 = bitcast i64* %thr1 to i8*, !dbg !131
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %10) #7, !dbg !131
// %11 = bitcast i64* %thr0 to i8*, !dbg !131
// call void @llvm.lifetime.end.p0i8(i64 8, i8* %11) #7, !dbg !131
// ret i32 0, !dbg !132
ret_thread_0 = 0;
ASSERT(r12== 0);
}
| [
"tuan-phong.ngo@it.uu.se"
] | tuan-phong.ngo@it.uu.se |
14234d326c9b14a70dcebe2a0b0aeda941ed9568 | adc044646ef23ab5c228c2471fdf7f09c701ede5 | /Lab_1_2021_RT/Material.h | 4d7e470f831e2e1734770c71a5c3c44d82adf56d | [] | no_license | SavvaSalomatin/KGSalomatin | f27ad235e920d1a00d0ad6a76acaeb8b6290350b | fc1492aac852cdad2158b056e451cc89b44127b1 | refs/heads/main | 2023-04-11T04:57:53.408065 | 2021-04-25T20:52:22 | 2021-04-25T20:52:22 | 356,037,293 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,253 | h | #ifndef RT_SAMPLE_NEW_MATERIAL_H
#define RT_SAMPLE_NEW_MATERIAL_H
#include "LiteMath.h"
#include "RayTracer.h"
using namespace HydraLiteMath;
class Material;
class SurfHit
{
public:
bool hit; // наличие пересечения
float3 hitPoint; // точка пересечения
float3 normal; // вектор нормали к поверхности в точке пересечения
float t; // расстояние от начала луча до точки пересечения
std::shared_ptr<Material> m_ptr; //материал объекта, с которым нашли пересечение
SurfHit() : hit(false), hitPoint(), normal(), m_ptr(nullptr), t(-1) {};
~SurfHit() = default;
SurfHit& operator= (const SurfHit& rhs);
};
class Material
{
public:
Material() {};
~Material() {};
virtual bool Scatter(const Ray& ray_in, const SurfHit& surf, float3& attenuation, Ray& ray_out) = 0;
};
class IdealMirror : public Material
{
public:
IdealMirror( const float3& a_color) : Material(), color(a_color) {};
bool Scatter(const Ray& ray_in, const SurfHit& surf, float3& attenuation, Ray& ray_out) override;
float3 color;
};
class Glass : public Material
{
public:
Glass(const float3& a_color, const float& a_prelomcoef) : Material(), color(a_color), prelomcoef(a_prelomcoef) {};
bool Scatter(const Ray& ray_in, const SurfHit& surf, float3& attenuation, Ray& ray_out) override;
float3 color;
float prelomcoef;
};
class Diffuse : public Material
{
public:
Diffuse(const float3& a_color) : Material(), color(a_color) {};
bool Scatter(const Ray& ray_in, const SurfHit& surf, float3& attenuation, Ray& ray_out) override;
float3 color;
};
class Gloss : public Material
{
public:
Gloss(const float3& a_color) : Material(), color(a_color) {};
bool Scatter(const Ray& ray_in, const SurfHit& surf, float3& attenuation, Ray& ray_out) override;
float3 color;
};
class Light : public Material
{
public:
Light(const float3& a_color, const float& a_intensity) : Material(), color(a_color), intensity(a_intensity) {};
bool Scatter(const Ray& ray_in, const SurfHit& surf, float3& attenuation, Ray& ray_out) override;
float3 color;
float intensity;
};
#endif //RT_SAMPLE_NEW_MATERIAL_H
| [
"salomatin.as1804@asugubkin.ru"
] | salomatin.as1804@asugubkin.ru |
e50368b4b6473d69c44daa8fd7cc875ec3b065fb | 9ff8e317e7293033e3983c5e6660adc4eff75762 | /Gamecore/math/Plane.h | 779b673b8229a2f14230ca33552fa529fabf093e | [] | no_license | rasputtim/SGF | b26fd29487b93c8e67c73f866635830796970116 | d8af92216bf4e86aeb452fda841c73932de09b65 | refs/heads/master | 2020-03-28T21:55:14.668643 | 2018-11-03T21:15:32 | 2018-11-03T21:15:32 | 147,579,544 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 10,996 | h | /*
SGF - Salvat Game Fabric (https://sourceforge.net/projects/sgfabric/)
Copyright (C) 2010-2011 Salvatore Giannotta Filho <a_materasu@hotmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the freeMem Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the freeMem Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __MATH_PLANE_H__
#define __MATH_PLANE_H__
/*
===============================================================================
3D plane with equation: a * x + b * y + c * z + d = 0
===============================================================================
*/
class CVector3D;
class CMatriz3D;
#define ON_EPSILON 0.1f
#define DEGENERATE_DIST_EPSILON 1e-4f
#define SIDE_FRONT 0
#define SIDE_BACK 1
#define SIDE_ON 2
#define SIDE_CROSS 3
// plane sides
#define PLANESIDE_FRONT 0
#define PLANESIDE_BACK 1
#define PLANESIDE_ON 2
#define PLANESIDE_CROSS 3
// plane types
#define PLANETYPE_X 0
#define PLANETYPE_Y 1
#define PLANETYPE_Z 2
#define PLANETYPE_NEGX 3
#define PLANETYPE_NEGY 4
#define PLANETYPE_NEGZ 5
#define PLANETYPE_TRUEAXIAL 6 // all types < 6 are true axial planes
#define PLANETYPE_ZEROX 6
#define PLANETYPE_ZEROY 7
#define PLANETYPE_ZEROZ 8
#define PLANETYPE_NONAXIAL 9
class CPlane {
public:
CPlane( void );
CPlane( float a, float b, float c, float d );
CPlane( const CVector3D &normal, const float dist );
float operator[]( int index ) const;
float & operator[]( int index );
CPlane operator-() const; // flips plane
CPlane & operator=( const CVector3D &v ); // sets normal and sets CPlane::d to zero
CPlane operator+( const CPlane &p ) const; // add plane equations
CPlane operator-( const CPlane &p ) const; // subtract plane equations
CPlane & operator*=( const CMatriz3D &m ); // Normal() *= m
bool Compare( const CPlane &p ) const; // exact compare, no epsilon
bool Compare( const CPlane &p, const float epsilon ) const; // compare with epsilon
bool Compare( const CPlane &p, const float normalEps, const float distEps ) const; // compare with epsilon
bool operator==( const CPlane &p ) const; // exact compare, no epsilon
bool operator!=( const CPlane &p ) const; // exact compare, no epsilon
void Zero( void ); // zero plane
void SetNormal( const CVector3D &normal ); // sets the normal
const CVector3D & Normal( void ) const; // reference to const normal
CVector3D & Normal( void ); // reference to normal
float Normalize( bool fixDegenerate = true ); // only normalizes the plane normal, does not adjust d
bool FixDegenerateNormal( void ); // fix degenerate normal
bool FixDegeneracies( float distEpsilon ); // fix degenerate normal and dist
float Dist( void ) const; // returns: -d
void SetDist( const float dist ); // sets: d = -dist
int Type( void ) const; // returns plane type
bool FromPoints( const CVector3D &p1, const CVector3D &p2, const CVector3D &p3, bool fixDegenerate = true );
bool FromVecs( const CVector3D &dir1, const CVector3D &dir2, const CVector3D &p, bool fixDegenerate = true );
void FitThroughPoint( const CVector3D &p ); // assumes normal is valid
bool HeightFit( const CVector3D *points, const int numPoints );
CPlane Translate( const CVector3D &translation ) const;
CPlane & TranslateSelf( const CVector3D &translation );
CPlane Rotate( const CVector3D &origin, const CMatriz3D &axis ) const;
CPlane & RotateSelf( const CVector3D &origin, const CMatriz3D &axis );
float Distance( const CVector3D &v ) const;
int Side( const CVector3D &v, const float epsilon = 0.0f ) const;
bool LineIntersection( const CVector3D &start, const CVector3D &end ) const;
// intersection point is start + dir * scale
bool RayIntersection( const CVector3D &start, const CVector3D &dir, float &scale ) const;
bool PlaneIntersection( const CPlane &plane, CVector3D &start, CVector3D &dir ) const;
int GetDimension( void ) const;
const CVector4D & ToVec4( void ) const;
CVector4D & ToVec4( void );
const float * ToFloatPtr( void ) const;
float * ToFloatPtr( void );
const char * ToString( int precision = 2 ) const;
private:
float a;
float b;
float c;
float d;
};
extern CPlane plane_origin;
#define plane_zero plane_origin
SGF_INLINE_FORCED CPlane::CPlane( void ) {
}
SGF_INLINE_FORCED CPlane::CPlane( float a, float b, float c, float d ) {
this->a = a;
this->b = b;
this->c = c;
this->d = d;
}
SGF_INLINE_FORCED CPlane::CPlane( const CVector3D &normal, const float dist ) {
this->a = normal.x;
this->b = normal.y;
this->c = normal.z;
this->d = -dist;
}
SGF_INLINE_FORCED float CPlane::operator[]( int index ) const {
return ( &a )[ index ];
}
SGF_INLINE_FORCED float& CPlane::operator[]( int index ) {
return ( &a )[ index ];
}
SGF_INLINE_FORCED CPlane CPlane::operator-() const {
return CPlane( -a, -b, -c, -d );
}
SGF_INLINE_FORCED CPlane &CPlane::operator=( const CVector3D &v ) {
a = v.x;
b = v.y;
c = v.z;
d = 0;
return *this;
}
SGF_INLINE_FORCED CPlane CPlane::operator+( const CPlane &p ) const {
return CPlane( a + p.a, b + p.b, c + p.c, d + p.d );
}
SGF_INLINE_FORCED CPlane CPlane::operator-( const CPlane &p ) const {
return CPlane( a - p.a, b - p.b, c - p.c, d - p.d );
}
SGF_INLINE_FORCED CPlane &CPlane::operator*=( const CMatriz3D &m ) {
Normal() *= m;
return *this;
}
SGF_INLINE_FORCED bool CPlane::Compare( const CPlane &p ) const {
return ( a == p.a && b == p.b && c == p.c && d == p.d );
}
SGF_INLINE_FORCED bool CPlane::Compare( const CPlane &p, const float epsilon ) const {
if ( CMath::Fabs( a - p.a ) > epsilon ) {
return false;
}
if ( CMath::Fabs( b - p.b ) > epsilon ) {
return false;
}
if ( CMath::Fabs( c - p.c ) > epsilon ) {
return false;
}
if ( CMath::Fabs( d - p.d ) > epsilon ) {
return false;
}
return true;
}
SGF_INLINE_FORCED bool CPlane::Compare( const CPlane &p, const float normalEps, const float distEps ) const {
if ( CMath::Fabs( d - p.d ) > distEps ) {
return false;
}
if ( !Normal().Compare( p.Normal(), normalEps ) ) {
return false;
}
return true;
}
SGF_INLINE_FORCED bool CPlane::operator==( const CPlane &p ) const {
return Compare( p );
}
SGF_INLINE_FORCED bool CPlane::operator!=( const CPlane &p ) const {
return !Compare( p );
}
SGF_INLINE_FORCED void CPlane::Zero( void ) {
a = b = c = d = 0.0f;
}
SGF_INLINE_FORCED void CPlane::SetNormal( const CVector3D &normal ) {
a = normal.x;
b = normal.y;
c = normal.z;
}
SGF_INLINE_FORCED const CVector3D &CPlane::Normal( void ) const {
return *reinterpret_cast<const CVector3D *>(&a);
}
SGF_INLINE_FORCED CVector3D &CPlane::Normal( void ) {
return *reinterpret_cast<CVector3D *>(&a);
}
SGF_INLINE_FORCED float CPlane::Normalize( bool fixDegenerate ) {
float length = reinterpret_cast<CVector3D *>(&a)->Normalize();
if ( fixDegenerate ) {
FixDegenerateNormal();
}
return length;
}
SGF_INLINE_FORCED bool CPlane::FixDegenerateNormal( void ) {
return Normal().FixDegenerateNormal();
}
SGF_INLINE_FORCED bool CPlane::FixDegeneracies( float distEpsilon ) {
bool fixedNormal = FixDegenerateNormal();
// only fix dist if the normal was degenerate
if ( fixedNormal ) {
if ( CMath::Fabs( d - CMath::Rint( d ) ) < distEpsilon ) {
d = CMath::Rint( d );
}
}
return fixedNormal;
}
SGF_INLINE_FORCED float CPlane::Dist( void ) const {
return -d;
}
SGF_INLINE_FORCED void CPlane::SetDist( const float dist ) {
d = -dist;
}
SGF_INLINE_FORCED bool CPlane::FromPoints( const CVector3D &p1, const CVector3D &p2, const CVector3D &p3, bool fixDegenerate ) {
Normal() = (p1 - p2).Cross( p3 - p2 );
if ( Normalize( fixDegenerate ) == 0.0f ) {
return false;
}
d = -( Normal() * p2 );
return true;
}
SGF_INLINE_FORCED bool CPlane::FromVecs( const CVector3D &dir1, const CVector3D &dir2, const CVector3D &p, bool fixDegenerate ) {
Normal() = dir1.Cross( dir2 );
if ( Normalize( fixDegenerate ) == 0.0f ) {
return false;
}
d = -( Normal() * p );
return true;
}
SGF_INLINE_FORCED void CPlane::FitThroughPoint( const CVector3D &p ) {
d = -( Normal() * p );
}
SGF_INLINE_FORCED CPlane CPlane::Translate( const CVector3D &translation ) const {
return CPlane( a, b, c, d - translation * Normal() );
}
SGF_INLINE_FORCED CPlane &CPlane::TranslateSelf( const CVector3D &translation ) {
d -= translation * Normal();
return *this;
}
SGF_INLINE_FORCED CPlane CPlane::Rotate( const CVector3D &origin, const CMatriz3D &axis ) const {
CPlane p;
p.Normal() = Normal() * axis;
p.d = d + origin * Normal() - origin * p.Normal();
return p;
}
SGF_INLINE_FORCED CPlane &CPlane::RotateSelf( const CVector3D &origin, const CMatriz3D &axis ) {
d += origin * Normal();
Normal() *= axis;
d -= origin * Normal();
return *this;
}
SGF_INLINE_FORCED float CPlane::Distance( const CVector3D &v ) const {
return a * v.x + b * v.y + c * v.z + d;
}
SGF_INLINE_FORCED int CPlane::Side( const CVector3D &v, const float epsilon ) const {
float dist = Distance( v );
if ( dist > epsilon ) {
return PLANESIDE_FRONT;
}
else if ( dist < -epsilon ) {
return PLANESIDE_BACK;
}
else {
return PLANESIDE_ON;
}
}
SGF_INLINE_FORCED bool CPlane::LineIntersection( const CVector3D &start, const CVector3D &end ) const {
float d1, d2, fraction;
d1 = Normal() * start + d;
d2 = Normal() * end + d;
if ( d1 == d2 ) {
return false;
}
if ( d1 > 0.0f && d2 > 0.0f ) {
return false;
}
if ( d1 < 0.0f && d2 < 0.0f ) {
return false;
}
fraction = ( d1 / ( d1 - d2 ) );
return ( fraction >= 0.0f && fraction <= 1.0f );
}
SGF_INLINE_FORCED bool CPlane::RayIntersection( const CVector3D &start, const CVector3D &dir, float &scale ) const {
float d1, d2;
d1 = Normal() * start + d;
d2 = Normal() * dir;
if ( d2 == 0.0f ) {
return false;
}
scale = -( d1 / d2 );
return true;
}
SGF_INLINE_FORCED int CPlane::GetDimension( void ) const {
return 4;
}
SGF_INLINE_FORCED const CVector4D &CPlane::ToVec4( void ) const {
return *reinterpret_cast<const CVector4D *>(&a);
}
SGF_INLINE_FORCED CVector4D &CPlane::ToVec4( void ) {
return *reinterpret_cast<CVector4D *>(&a);
}
SGF_INLINE_FORCED const float *CPlane::ToFloatPtr( void ) const {
return reinterpret_cast<const float *>(&a);
}
SGF_INLINE_FORCED float *CPlane::ToFloatPtr( void ) {
return reinterpret_cast<float *>(&a);
}
#endif /* !__MATH_PLANE_H__ */
| [
"rasputtim@hotmail.com"
] | rasputtim@hotmail.com |
4ff81002b9e361c70db68c33fa9f8280bd3dc3a7 | eb0de1a391bf912f7834737e0a56e5c13be5097d | /Playground/HallSensor/EepromUtil.cpp | 70eba91a29e18ff29faeae5e95f8377c824fefea | [
"MIT"
] | permissive | cbries/utilities | b3ec91b76db0e7c30166bfe04959e6cd156a3566 | 86ce97d2c3e0d13b9beb0fc6ec79d31945c14461 | refs/heads/master | 2022-12-13T00:08:47.757700 | 2021-09-30T07:13:29 | 2021-09-30T07:13:29 | 31,171,182 | 1 | 0 | MIT | 2022-06-23T10:16:15 | 2015-02-22T17:15:12 | C++ | UTF-8 | C++ | false | false | 5,721 | cpp | //
// Eeprom utilites library
//
// From http://playground.arduino.cc/Code/EepromUtil
//
#include "EepromUtil.h"
//
// Absolute min and max eeprom addresses.
// Actual values are hardware-dependent.
//
// These values can be changed e.g. to protect
// eeprom cells outside this range.
//
const int EEPROM_MIN_ADDR = 0;
const int EEPROM_MAX_ADDR = 1023;
void EepromUtil::eeprom_erase_all() {
char b = 0xff;
int i;
for (i = EEPROM_MIN_ADDR; i <= EEPROM_MAX_ADDR; i++) {
EEPROM.write(i, b);
}
}
//
// Returns true if the address is between the
// minimum and maximum allowed values,
// false otherwise.
//
// This function is used by the other, higher-level functions
// to prevent bugs and runtime errors due to invalid addresses.
//
boolean EepromUtil::eeprom_is_addr_ok(int addr) {
return ((addr >= EEPROM_MIN_ADDR) && (addr <= EEPROM_MAX_ADDR));
}
//
// Writes a sequence of bytes to eeprom starting at the specified address.
// Returns true if the whole array is successfully written.
// Returns false if the start or end addresses aren't between
// the minimum and maximum allowed values.
// When returning false, nothing gets written to eeprom.
//
boolean EepromUtil::eeprom_write_bytes(int startAddr, const byte* array, int numBytes) {
// counter
int i;
// both first byte and last byte addresses must fall within
// the allowed range
if (!eeprom_is_addr_ok(startAddr) || !eeprom_is_addr_ok(startAddr + numBytes)) {
return false;
}
for (i = 0; i < numBytes; i++) {
EEPROM.write(startAddr + i, array[i]);
}
return true;
}
//
// Reads the specified number of bytes from the specified address into the provided buffer.
// Returns true if all the bytes are successfully read.
// Returns false if the star or end addresses aren't between
// the minimum and maximum allowed values.
// When returning false, the provided array is untouched.
//
// Note: the caller must ensure that array[] has enough space
// to store at most numBytes bytes.
//
boolean EepromUtil::eeprom_read_bytes(int startAddr, byte array[], int numBytes) {
int i;
// both first byte and last byte addresses must fall within
// the allowed range
if (!eeprom_is_addr_ok(startAddr) || !eeprom_is_addr_ok(startAddr + numBytes)) {
return false;
}
for (i = 0; i < numBytes; i++) {
array[i] = EEPROM.read(startAddr + i);
}
return true;
}
//
// Writes an int variable at the specified address.
// Returns true if the variable value is successfully written.
// Returns false if the specified address is outside the
// allowed range or too close to the maximum value
// to store all of the bytes (an int variable requires
// more than one byte).
//
boolean EepromUtil::eeprom_write_int(int addr, int value) {
byte *ptr;
ptr = (byte*)&value;
return eeprom_write_bytes(addr, ptr, sizeof(value));
}
//
// Reads an integer value at the specified address.
// Returns true if the variable is successfully read.
// Returns false if the specified address is outside the
// allowed range or too close to the maximum vlaue
// to hold all of the bytes (an int variable requires
// more than one byte).
//
boolean EepromUtil::eeprom_read_int(int addr, int* value) {
return eeprom_read_bytes(addr, (byte*)value, sizeof(int));
}
//
// Writes a string starting at the specified address.
// Returns true if the whole string is successfully written.
// Returns false if the address of one or more bytes
// fall outside the allowed range.
// If false is returned, nothing gets written to the eeprom.
//
boolean EepromUtil::eeprom_write_string(int addr, char* string) {
// actual number of bytes to be written
int numBytes;
// we'll need to write the string contents
// plus the string terminator byte (0x00)
numBytes = strlen(string) + 1;
return eeprom_write_bytes(addr, (const byte*)string, numBytes);
}
//
// Reads a string starting from the specified address.
// Returns true if at least one byte (even only the
// string terminator one) is read.
// Returns false if the start address falls outside
// or declare buffer size os zero.
// the allowed range.
// The reading might stop for several reasons:
// - no more space in the provided buffer
// - last eeprom address reached
// - string terminator byte (0x00) encountered.
// The last condition is what should normally occur.
//
boolean EepromUtil::eeprom_read_string(int addr, char* buffer, int bufSize) {
// byte read from eeprom
byte ch;
// number of bytes read so far
int bytesRead;
// check start address
if (!eeprom_is_addr_ok(addr)) {
return false;
}
// how can we store bytes in an empty buffer ?
if (bufSize == 0) {
return false;
}
// is there is room for the string terminator only,
// no reason to go further
if (bufSize == 1) {
buffer[0] = 0;
return true;
}
// initialize byte counter
bytesRead = 0;
// read next byte from eeprom
ch = EEPROM.read(addr + bytesRead);
// store it into the user buffer
buffer[bytesRead] = ch;
// increment byte counter
bytesRead++;
// stop conditions:
// - the character just read is the string terminator one (0x00)
// - we have filled the user buffer
// - we have reached the last eeprom address
while ( (ch != 0x00) && (bytesRead < bufSize) && ((addr + bytesRead) <= EEPROM_MAX_ADDR) ) {
// if no stop condition is met, read the next byte from eeprom
ch = EEPROM.read(addr + bytesRead);
// store it into the user buffer
buffer[bytesRead] = ch;
// increment byte counter
bytesRead++;
}
// make sure the user buffer has a string terminator
// (0x00) as its last byte
if ((ch != 0x00) && (bytesRead >= 1)) {
buffer[bytesRead - 1] = 0;
}
return true;
} | [
"mail@christianbenjaminries.de"
] | mail@christianbenjaminries.de |
8f649b44a354c9d73395073268616b3dfff0557f | 99f711303beb42a7edd17643a87422e815a004b1 | /bonusAnimal.cpp | 3a98903683a4e8a8bbb18482d316cb07f2f717f4 | [] | no_license | wellheup/CS162_ZooTycoon | 5b773a97ce8aefca477c783af392c12068ff48c2 | 4f511a69ab15bff18ee50ed1e0e37f49e27bba8c | refs/heads/master | 2023-02-10T07:21:07.609498 | 2021-01-06T23:04:19 | 2021-01-06T23:04:19 | 327,449,143 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 314 | cpp | /*********************************************************************
** Author: Phillip Wellheuser CS 162-400
** Date: 4/28/19
** Description: Implements Tiger subclass
*********************************************************************/
#include "animal.hpp"
#include "bonusAnimal.hpp"
| [
"wellheup@oregonstate.edu"
] | wellheup@oregonstate.edu |
c70482567fa6ce8027c5aeafec4d55f314070b06 | e57cef9362f540ca996ae694f1497a0b21e443a5 | /src/Core/x/xParCmd.cpp | 5daaf84f5173e914485b465e0cff25ff28a58f2c | [] | no_license | sonich2401/bfbbdecomp | 78d75f33ad6ae94f1085e721e872eafd5a302fcd | 5f58b62505f8929a72ccf2aa118a1539eb3a5bd6 | refs/heads/master | 2023-01-30T19:43:18.389533 | 2020-12-06T12:29:47 | 2020-12-06T12:29:47 | 319,242,292 | 1 | 0 | null | 2020-12-07T07:48:05 | 2020-12-07T07:48:04 | null | UTF-8 | C++ | false | false | 3,531 | cpp | #include "xParCmd.h"
#include <types.h>
// func_80036B8C
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdInit__Fv")
// func_80036DC0
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdRegister__FUiUiPFP7xParCmdP9xParGroupf_v")
// func_80036DE0
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdGetSize__FUi")
// func_80036E2C
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdGetUpdateFunc__FUi")
// func_80036E78
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdKillSlow_Update__FP7xParCmdP9xParGroupf")
// func_80036F1C
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdAge_Update__FP7xParCmdP9xParGroupf")
// func_80036F4C
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdFollow_Update__FP7xParCmdP9xParGroupf")
// func_80037030
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdOrbitPoint_Update__FP7xParCmdP9xParGroupf")
// func_80037114
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdOrbitLine_Update__FP7xParCmdP9xParGroupf")
// func_80037228
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdAccelerate_Update__FP7xParCmdP9xParGroupf")
// func_800372C4
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdMove_Update__FP7xParCmdP9xParGroupf")
// func_80037338
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdMoveRandom_Update__FP7xParCmdP9xParGroupf")
// func_80037414
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdMoveRandomPar_Update__FP7xParCmdP9xParGroupf")
// func_800374B8
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdScale3rdPolyReg_Update__FP7xParCmdP9xParGroupf")
// func_800374BC
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdSmokeAlpha_Update__FP7xParCmdP9xParGroupf")
// func_800374C0
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdScale_Update__FP7xParCmdP9xParGroupf")
// func_800374C4
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdAlpha3rdPolyReg_Update__FP7xParCmdP9xParGroupf")
// func_800374C8
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdRandomVelocityPar_Update__FP7xParCmdP9xParGroupf")
// func_800375BC
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdApplyWind_Update__FP7xParCmdP9xParGroupf")
// func_80037608
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdRotPar_Update__FP7xParCmdP9xParGroupf")
// func_80037780
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdVelocityApply_Update__FP7xParCmdP9xParGroupf")
// func_800377C8
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdRotateAround_Update__FP7xParCmdP9xParGroupf")
// func_800378F0
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdTex_Update__FP7xParCmdP9xParGroupf")
// func_800378F4
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdTexAnim_Update__FP7xParCmdP9xParGroupf")
// func_80037C98
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdCollideFall_Update__FP7xParCmdP9xParGroupf")
// func_80037CF8
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmdCollideFallSticky_Update__FP7xParCmdP9xParGroupf")
// func_80037D7C
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmd_DampenSpeed_Update__FP7xParCmdP9xParGroupf")
// func_80037DEC
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmd_SizeInOut_Update__FP7xParCmdP9xParGroupf")
// func_80037F38
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmd_AlphaInOut_Update__FP7xParCmdP9xParGroupf")
// func_800380CC
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xParCmd_Shaper_Update__FP7xParCmdP9xParGroupf")
// func_80038390
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xVec3LengthFast__Ffff")
// func_800383C4
#pragma GLOBAL_ASM("asm/Core/x/xParCmd.s", "xMat3x3RMulVec__FP5xVec3PC7xMat3x3PC5xVec3")
| [
"noreply@github.com"
] | sonich2401.noreply@github.com |
d2e004cffdc78483d1f67e0c89c8b0d458c3ad5e | c70384fc815d0611100fd86f9c25abdd4c04c036 | /neural-cpp/specs/create_training_data_spec.cpp | 61c1e6a1202150295a5da2b5be1482aefadd9978 | [] | no_license | MarkRedeman/neural-networks | 29317153efb91f2e31e404e727c14b4b5bfad097 | 39f39851ea0858d977ef3c1f5a10dfe5b30075bc | refs/heads/master | 2020-04-05T23:19:07.332972 | 2016-01-25T06:51:14 | 2016-01-25T06:51:14 | 49,136,674 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,219 | cpp | #include <bandit/bandit.h>
using namespace bandit;
#include "../src/create_training_data.h"
#include "../src/Is_A_Set_Of_Labels.h"
#include "../src/Rosenblatt_Algorithm.h"
#include "../src/Energy_Above_Threshold.h"
go_bandit([](){
describe("Creating training data for the perceptron algorithm", [&](){
it("creates a random dichotomy of data", [&](){
Dichotomy dichotomy = create_training_data(2, 1);
AssertThat(dichotomy.labels, HasLength(1));
AssertThat(dichotomy.samples, HasLength(1));
AssertThat(dichotomy.samples[0], HasLength(2));
AssertThat(dichotomy.labels, Fulfills(Is_A_Set_Of_Labels()));
});
it("creates a large set of random labels and samples", [&](){
Dichotomy dichotomy = create_training_data(2, 100);
AssertThat(dichotomy.labels, HasLength(100));
AssertThat(dichotomy.samples, HasLength(100));
AssertThat(dichotomy.samples[0], HasLength(2));
AssertThat(dichotomy.labels, Fulfills(Is_A_Set_Of_Labels()));
});
it("creates a set of random labels and high dimensional samples", [&](){
Dichotomy dichotomy = create_training_data(50, 1);
AssertThat(dichotomy.labels, HasLength(1));
AssertThat(dichotomy.samples, HasLength(1));
AssertThat(dichotomy.samples[0], HasLength(50));
AssertThat(dichotomy.labels, Fulfills(Is_A_Set_Of_Labels()));
});
});
describe("Create training data based on a teacher", [&](){
it("Creates a normally distributed set of samples with labels based on a teacher perceptron", [&]() {
std::vector<double> teacher = { 1.0, 1.0 };
Dichotomy dichotomy = create_training_data(teacher, 20);
AssertThat(dichotomy.labels, HasLength(20));
AssertThat(dichotomy.samples, HasLength(20));
AssertThat(dichotomy.samples[0], HasLength(2));
AssertThat(dichotomy.labels, Fulfills(Is_A_Set_Of_Labels()));
Rosenblatt_Algorithm_Result result(teacher, 0, 0);
AssertThat(result, Fulfills(Energy_Above_Threshold(dichotomy)));
});
});
});
| [
"markredeman@gmail.com"
] | markredeman@gmail.com |
a6540dac70d2bf1f493588b7458207bcda2d10f2 | 4d107a97633559963f6510767bb9297febbcbb02 | /applications/SolidMechanicsApplication/custom_conditions/elastic_conditions/axisymmetric_point_elastic_condition.hpp | 5e4fdef91a4db2476b57ebcd4e5d2f984b29f5a9 | [
"BSD-2-Clause"
] | permissive | asroy/Kratos | 45dc4a9ad77a2b203ab2e0c6c5fe030633433181 | e89d6808670d4d645319c7678da548b37825abe3 | refs/heads/master | 2021-03-24T13:28:43.618915 | 2017-12-19T15:38:20 | 2017-12-19T15:38:20 | 102,793,791 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,343 | hpp | //
// Project Name: KratosSolidMechanicsApplication $
// Created by: $Author: JMCarbonell $
// Last modified by: $Co-Author: $
// Date: $Date: August 2017 $
// Revision: $Revision: 0.0 $
//
//
#if !defined(KRATOS_AXISYMMETRIC_POINT_ELASTIC_CONDITION_H_INCLUDED )
#define KRATOS_AXISYMMETRIC_POINT_ELASTIC_CONDITION_H_INCLUDED
// System includes
// External includes
// Project includes
#include "custom_conditions/elastic_conditions/point_elastic_condition.hpp"
namespace Kratos
{
///@name Kratos Globals
///@{
///@}
///@name Type Definitions
///@{
///@}
///@name Enum's
///@{
///@}
///@name Functions
///@{
///@}
///@name Kratos Classes
///@{
/// Axisymmetric point elastic condition for 2D geometries
class KRATOS_API(SOLID_MECHANICS_APPLICATION) AxisymmetricPointElasticCondition
: public PointElasticCondition
{
public:
///@name Type Definitions
///@{
// Counted pointer of AxisymmetricPointElasticCondition
KRATOS_CLASS_POINTER_DEFINITION( AxisymmetricPointElasticCondition );
///@}
///@name Life Cycle
///@{
/// Default constructor.
AxisymmetricPointElasticCondition( IndexType NewId, GeometryType::Pointer pGeometry );
AxisymmetricPointElasticCondition( IndexType NewId, GeometryType::Pointer pGeometry, PropertiesType::Pointer pProperties );
/// Copy constructor
AxisymmetricPointElasticCondition( AxisymmetricPointElasticCondition const& rOther);
/// Destructor
virtual ~AxisymmetricPointElasticCondition();
///@}
///@name Operators
///@{
///@}
///@name Operations
///@{
/**
* creates a new condition pointer
* @param NewId: the ID of the new condition
* @param ThisNodes: the nodes of the new condition
* @param pProperties: the properties assigned to the new condition
* @return a Pointer to the new condition
*/
Condition::Pointer Create(IndexType NewId,
NodesArrayType const& ThisNodes,
PropertiesType::Pointer pProperties ) const override;
/**
* clones the selected condition variables, creating a new one
* @param NewId: the ID of the new condition
* @param ThisNodes: the nodes of the new condition
* @param pProperties: the properties assigned to the new condition
* @return a Pointer to the new condition
*/
Condition::Pointer Clone(IndexType NewId,
NodesArrayType const& ThisNodes) const override;
//************************************************************************************
//************************************************************************************
/**
* This function provides the place to perform checks on the completeness of the input.
* It is designed to be called only once (or anyway, not often) typically at the beginning
* of the calculations, so to verify that nothing is missing from the input
* or that no common error is found.
* @param rCurrentProcessInfo
*/
virtual int Check( const ProcessInfo& rCurrentProcessInfo ) override;
///@}
///@name Access
///@{
///@}
///@name Inquiry
///@{
///@}
///@name Input and output
///@{
///@}
///@name Friends
///@{
///@}
protected:
///@name Protected static Member Variables
///@{
///@}
///@name Protected member Variables
///@{
AxisymmetricPointElasticCondition() {};
///@}
///@name Protected Operators
///@{
///@}
///@name Protected Operations
///@{
/**
* Calculate Condition Kinematics
*/
virtual void CalculateKinematics(ConditionVariables& rVariables,
const double& rPointNumber) override;
/**
* Calculation and addition of the matrices of the LHS
*/
virtual void CalculateAndAddLHS(LocalSystemComponents& rLocalSystem,
ConditionVariables& rVariables,
double& rIntegrationWeight) override;
/**
* Calculation and addition of the vectors of the RHS
*/
virtual void CalculateAndAddRHS(LocalSystemComponents& rLocalSystem,
ConditionVariables& rVariables,
double& rIntegrationWeight) override;
/**
* Calculation of the contidion radius (axisymmetry)
*/
void CalculateRadius(double & rCurrentRadius,
double & rReferenceRadius);
///@}
///@name Protected Access
///@{
///@}
///@name Protected Inquiry
///@{
///@}
///@name Protected LifeCycle
///@{
///@}
private:
///@name Static Member Variables
///@{
///@}
///@name Member Variables
///@{
///@}
///@name Private Operators
///@{
///@}
///@name Private Operations
///@{
///@}
///@name Private Access
///@{
///@}
///@name Private Inquiry
///@{
///@}
///@name Serialization
///@{
friend class Serializer;
virtual void save(Serializer& rSerializer) const override;
virtual void load(Serializer& rSerializer) override;
}; // class AxisymmetricPointElasticCondition.
} // namespace Kratos.
#endif // KRATOS_AXISYMMETRIC_POINT_ELASTIC_CONDITION_H_INCLUDED defined
| [
"cpuigbo@cimne.upc.edu"
] | cpuigbo@cimne.upc.edu |
091bc6946610f8ecbfce23f1d1cf87e3bfa9de72 | 3149e2e17725eaf95b25e67274e0c7356d2bea0d | /src/qt/guiutil.h | 64a806db7de99fae3985b93a8ab62485e5262791 | [
"MIT"
] | permissive | Samsufi/GAL | 89642a83dba1f4b1c78b14efd471a7d0bf0b9348 | d64c4faac60d073d3e86c87ceedf3058dfade6cc | refs/heads/master | 2020-03-18T18:06:00.291246 | 2018-05-27T18:56:08 | 2018-05-27T18:56:08 | 135,071,466 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,809 | h | // Copyright (c) 2011-2013 The Bitcoin developers
// Copyright (c) 2017-2018 The GALR developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_QT_GUIUTIL_H
#define BITCOIN_QT_GUIUTIL_H
#include "amount.h"
#include <QEvent>
#include <QHeaderView>
#include <QMessageBox>
#include <QObject>
#include <QProgressBar>
#include <QString>
#include <QTableView>
#include <QTableWidget>
#include <boost/filesystem.hpp>
class QValidatedLineEdit;
class SendCoinsRecipient;
QT_BEGIN_NAMESPACE
class QAbstractItemView;
class QDateTime;
class QFont;
class QLineEdit;
class QUrl;
class QWidget;
QT_END_NAMESPACE
/** Utility functions used by the GALR Qt UI.
*/
namespace GUIUtil
{
// Create human-readable string from date
QString dateTimeStr(const QDateTime& datetime);
QString dateTimeStr(qint64 nTime);
// Render GALR addresses in monospace font
QFont bitcoinAddressFont();
// Set up widgets for address and amounts
void setupAddressWidget(QValidatedLineEdit* widget, QWidget* parent);
void setupAmountWidget(QLineEdit* widget, QWidget* parent);
// Parse "galr:" URI into recipient object, return true on successful parsing
bool parseBitcoinURI(const QUrl& uri, SendCoinsRecipient* out);
bool parseBitcoinURI(QString uri, SendCoinsRecipient* out);
QString formatBitcoinURI(const SendCoinsRecipient& info);
// Returns true if given address+amount meets "dust" definition
bool isDust(const QString& address, const CAmount& amount);
// HTML escaping for rich text controls
QString HtmlEscape(const QString& str, bool fMultiLine = false);
QString HtmlEscape(const std::string& str, bool fMultiLine = false);
/** Copy a field of the currently selected entry of a view to the clipboard. Does nothing if nothing
is selected.
@param[in] column Data column to extract from the model
@param[in] role Data role to extract from the model
@see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress
*/
void copyEntryData(QAbstractItemView* view, int column, int role = Qt::EditRole);
/** Return a field of the currently selected entry as a QString. Does nothing if nothing
is selected.
@param[in] column Data column to extract from the model
@param[in] role Data role to extract from the model
@see TransactionView::copyLabel, TransactionView::copyAmount, TransactionView::copyAddress
*/
QString getEntryData(QAbstractItemView *view, int column, int role);
void setClipboard(const QString& str);
/** Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix
when no suffix is provided by the user.
@param[in] parent Parent window (or 0)
@param[in] caption Window caption (or empty, for default)
@param[in] dir Starting directory (or empty, to default to documents directory)
@param[in] filter Filter specification such as "Comma Separated Files (*.csv)"
@param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0).
Can be useful when choosing the save file format based on suffix.
*/
QString getSaveFileName(QWidget* parent, const QString& caption, const QString& dir, const QString& filter, QString* selectedSuffixOut);
/** Get open filename, convenience wrapper for QFileDialog::getOpenFileName.
@param[in] parent Parent window (or 0)
@param[in] caption Window caption (or empty, for default)
@param[in] dir Starting directory (or empty, to default to documents directory)
@param[in] filter Filter specification such as "Comma Separated Files (*.csv)"
@param[out] selectedSuffixOut Pointer to return the suffix (file type) that was selected (or 0).
Can be useful when choosing the save file format based on suffix.
*/
QString getOpenFileName(QWidget* parent, const QString& caption, const QString& dir, const QString& filter, QString* selectedSuffixOut);
/** Get connection type to call object slot in GUI thread with invokeMethod. The call will be blocking.
@returns If called from the GUI thread, return a Qt::DirectConnection.
If called from another thread, return a Qt::BlockingQueuedConnection.
*/
Qt::ConnectionType blockingGUIThreadConnection();
// Determine whether a widget is hidden behind other windows
bool isObscured(QWidget* w);
// Open debug.log
void openDebugLogfile();
// Open galr.conf
void openConfigfile();
// Open masternode.conf
void openMNConfigfile();
// Browse backup folder
void showBackups();
// Replace invalid default fonts with known good ones
void SubstituteFonts(const QString& language);
/** Qt event filter that intercepts ToolTipChange events, and replaces the tooltip with a rich text
representation if needed. This assures that Qt can word-wrap long tooltip messages.
Tooltips longer than the provided size threshold (in characters) are wrapped.
*/
class ToolTipToRichTextFilter : public QObject
{
Q_OBJECT
public:
explicit ToolTipToRichTextFilter(int size_threshold, QObject* parent = 0);
protected:
bool eventFilter(QObject* obj, QEvent* evt);
private:
int size_threshold;
};
/**
* Makes a QTableView last column feel as if it was being resized from its left border.
* Also makes sure the column widths are never larger than the table's viewport.
* In Qt, all columns are resizable from the right, but it's not intuitive resizing the last column from the right.
* Usually our second to last columns behave as if stretched, and when on strech mode, columns aren't resizable
* interactively or programatically.
*
* This helper object takes care of this issue.
*
*/
class TableViewLastColumnResizingFixer : public QObject
{
Q_OBJECT
public:
TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth);
void stretchColumnWidth(int column);
private:
QTableView* tableView;
int lastColumnMinimumWidth;
int allColumnsMinimumWidth;
int lastColumnIndex;
int columnCount;
int secondToLastColumnIndex;
void adjustTableColumnsWidth();
int getAvailableWidthForColumn(int column);
int getColumnsWidth();
void connectViewHeadersSignals();
void disconnectViewHeadersSignals();
void setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode);
void resizeColumn(int nColumnIndex, int width);
private slots:
void on_sectionResized(int logicalIndex, int oldSize, int newSize);
void on_geometriesChanged();
};
/**
* Extension to QTableWidgetItem that facilitates proper ordering for "DHMS"
* strings (primarily used in the masternode's "active" listing).
*/
class DHMSTableWidgetItem : public QTableWidgetItem
{
public:
DHMSTableWidgetItem(const int64_t seconds);
virtual bool operator<(QTableWidgetItem const& item) const;
private:
// Private backing value for DHMS string, used for sorting.
int64_t value;
};
bool GetStartOnSystemStartup();
bool SetStartOnSystemStartup(bool fAutoStart);
/** Save window size and position */
void saveWindowGeometry(const QString& strSetting, QWidget* parent);
/** Restore window size and position */
void restoreWindowGeometry(const QString& strSetting, const QSize& defaultSizeIn, QWidget* parent);
/** Load global CSS theme */
QString loadStyleSheet();
/** Check whether a theme is not build-in */
bool isExternal(QString theme);
/* Convert QString to OS specific boost path through UTF-8 */
boost::filesystem::path qstringToBoostPath(const QString& path);
/* Convert OS specific boost path to QString through UTF-8 */
QString boostPathToQString(const boost::filesystem::path& path);
/* Convert seconds into a QString with days, hours, mins, secs */
QString formatDurationStr(int secs);
/* Format CNodeStats.nServices bitmask into a user-readable string */
QString formatServicesStr(quint64 mask);
/* Format a CNodeCombinedStats.dPingTime into a user-readable string or display N/A, if 0*/
QString formatPingTime(double dPingTime);
/* Format a CNodeCombinedStats.nTimeOffset into a user-readable string. */
QString formatTimeOffset(int64_t nTimeOffset);
#if defined(Q_OS_MAC) && QT_VERSION >= 0x050000
// workaround for Qt OSX Bug:
// https://bugreports.qt-project.org/browse/QTBUG-15631
// QProgressBar uses around 10% CPU even when app is in background
class ProgressBar : public QProgressBar
{
bool event(QEvent* e)
{
return (e->type() != QEvent::StyleAnimationUpdate) ? QProgressBar::event(e) : false;
}
};
#else
typedef QProgressBar ProgressBar;
#endif
} // namespace GUIUtil
#endif // BITCOIN_QT_GUIUTIL_H
| [
"samuel.ly99@gmail.com"
] | samuel.ly99@gmail.com |
ff56db71cf29012ff4d18ec76665628248b080c9 | 083100943aa21e05d2eb0ad745349331dd35239a | /aws-cpp-sdk-kinesis/source/model/GetRecordsResult.cpp | 03101d69486a979118a4271d0056f6c137c14cb4 | [
"JSON",
"MIT",
"Apache-2.0"
] | permissive | bmildner/aws-sdk-cpp | d853faf39ab001b2878de57aa7ba132579d1dcd2 | 983be395fdff4ec944b3bcfcd6ead6b4510b2991 | refs/heads/master | 2021-01-15T16:52:31.496867 | 2015-09-10T06:57:18 | 2015-09-10T06:57:18 | 41,954,994 | 1 | 0 | null | 2015-09-05T08:57:22 | 2015-09-05T08:57:22 | null | UTF-8 | C++ | false | false | 1,832 | cpp | /*
* Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include <aws/kinesis/model/GetRecordsResult.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <aws/core/AmazonWebServiceResult.h>
#include <aws/core/utils/UnreferencedParam.h>
#include <utility>
using namespace Aws::Kinesis::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
using namespace Aws;
GetRecordsResult::GetRecordsResult() :
m_millisBehindLatest(0)
{
}
GetRecordsResult::GetRecordsResult(const AmazonWebServiceResult<JsonValue>& result) :
m_millisBehindLatest(0)
{
*this = result;
}
GetRecordsResult& GetRecordsResult::operator =(const AmazonWebServiceResult<JsonValue>& result)
{
const JsonValue& jsonValue = result.GetPayload();
if(jsonValue.ValueExists("Records"))
{
Array<JsonValue> recordsJsonList = jsonValue.GetArray("Records");
for(unsigned recordsIndex = 0; recordsIndex < recordsJsonList.GetLength(); ++recordsIndex)
{
m_records.push_back(recordsJsonList[recordsIndex].AsObject());
}
}
if(jsonValue.ValueExists("NextShardIterator"))
{
m_nextShardIterator = jsonValue.GetString("NextShardIterator");
}
if(jsonValue.ValueExists("MillisBehindLatest"))
{
m_millisBehindLatest = jsonValue.GetInt64("MillisBehindLatest");
}
return *this;
}
| [
"henso@amazon.com"
] | henso@amazon.com |
3bcf29c18b27a00cae8216392d1edd1cbc5be65f | 475d7edc1983327b468a8f6d1ef3c6ad0f49c890 | /SET1/colour/colour/color.cc | 56798005b1133cf5ee9f8d40eebdd84112e87db6 | [] | no_license | 99002657/SET_1 | a8b8b17bde06b9a5c541d5c572275fe378f187ec | 7156c759c936ec6c5d12dd791698d2b106cbecd3 | refs/heads/master | 2022-12-19T23:56:26.124360 | 2020-09-19T07:15:00 | 2020-09-19T07:15:00 | 296,802,903 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 530 | cc | #include<iostream>
#include "color.h"
Color::Color():m_r(0), m_g(0), m_b(0)
{
}
Color::Color(int r, int g, int b) :
m_r(r), m_g(g), m_b(b)
{
}
Color::Color(color_t)
{
}
int Color:: invert()
{
m_r = 255 - m_r;
m_b = 255 - m_b;
m_g= 255 - m_g;
return m_r;
}
int Color:: greencolor()
{
return m_g;
}
int Color:: redcolor()
{
return m_r;
}
int Color:: bluecolor()
{
return m_b;
}
void Color:: display(){
std::cout << m_r << "," << m_g << ","<< m_b << "\n";
}
| [
"noreply@github.com"
] | 99002657.noreply@github.com |
8ce79160c9e0f3f1b2b6dc405059275035f4f687 | 6494946d8db9db58f57c68253a8d0b658998c8ef | /Engine/Source/Renderer/Backend/Vulkan/Renderer Backend Layer/External/stb_font_consolas_24_latin1.inl | 5d8eafb6274ef944f25aa681e2dada20df2eb653 | [] | no_license | DhirajWishal/DynamikEngine-Prototype | bc7dbad1d8c13d2489bcfdc7d6f22e55932f5b7b | 0a95277c394b69e66f79342f028834458694af93 | refs/heads/master | 2022-11-10T00:02:30.496607 | 2020-06-27T04:46:03 | 2020-06-27T04:46:03 | 198,091,316 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 45,820 | inl | // Font generated by stb_font_inl_generator.c (4/1 bpp)
//
// Following instructions show how to use the only included font, whatever it is, in
// a generic way so you can replace it with any other font by changing the include.
// To use multiple fonts, replace STB_SOMEFONT_* below with STB_FONT_consolas_24_latin1_*,
// and separately install each font. Note that the CREATE function call has a
// totally different name; it's just 'stb_font_consolas_24_latin1'.
//
/* // Example usage:
static stb_fontchar fontdata[STB_SOMEFONT_NUM_CHARS];
static void init(void)
{
// optionally replace both STB_SOMEFONT_BITMAP_HEIGHT with STB_SOMEFONT_BITMAP_HEIGHT_POW2
static unsigned char fontpixels[STB_SOMEFONT_BITMAP_HEIGHT][STB_SOMEFONT_BITMAP_WIDTH];
STB_SOMEFONT_CREATE(fontdata, fontpixels, STB_SOMEFONT_BITMAP_HEIGHT);
... create texture ...
// for best results rendering 1:1 pixels texels, use nearest-neighbor sampling
// if allowed to scale up, use bilerp
}
// This function positions characters on integer coordinates, and assumes 1:1 texels to pixels
// Appropriate if nearest-neighbor sampling is used
static void draw_string_integer(int x, int y, char *str) // draw with top-left point x,y
{
... use texture ...
... turn on alpha blending and gamma-correct alpha blending ...
glBegin(GL_QUADS);
while (*str) {
int char_codepoint = *str++;
stb_fontchar *cd = &fontdata[char_codepoint - STB_SOMEFONT_FIRST_CHAR];
glTexCoord2f(cd->s0, cd->t0); glVertex2i(x + cd->x0, y + cd->y0);
glTexCoord2f(cd->s1, cd->t0); glVertex2i(x + cd->x1, y + cd->y0);
glTexCoord2f(cd->s1, cd->t1); glVertex2i(x + cd->x1, y + cd->y1);
glTexCoord2f(cd->s0, cd->t1); glVertex2i(x + cd->x0, y + cd->y1);
// if bilerping, in D3D9 you'll need a half-pixel offset here for 1:1 to behave correct
x += cd->advance_int;
}
glEnd();
}
// This function positions characters on float coordinates, and doesn't require 1:1 texels to pixels
// Appropriate if bilinear filtering is used
static void draw_string_float(float x, float y, char *str) // draw with top-left point x,y
{
... use texture ...
... turn on alpha blending and gamma-correct alpha blending ...
glBegin(GL_QUADS);
while (*str) {
int char_codepoint = *str++;
stb_fontchar *cd = &fontdata[char_codepoint - STB_SOMEFONT_FIRST_CHAR];
glTexCoord2f(cd->s0f, cd->t0f); glVertex2f(x + cd->x0f, y + cd->y0f);
glTexCoord2f(cd->s1f, cd->t0f); glVertex2f(x + cd->x1f, y + cd->y0f);
glTexCoord2f(cd->s1f, cd->t1f); glVertex2f(x + cd->x1f, y + cd->y1f);
glTexCoord2f(cd->s0f, cd->t1f); glVertex2f(x + cd->x0f, y + cd->y1f);
// if bilerping, in D3D9 you'll need a half-pixel offset here for 1:1 to behave correct
x += cd->advance;
}
glEnd();
}
*/
#pragma once
#ifndef STB_FONTCHAR__TYPEDEF
#define STB_FONTCHAR__TYPEDEF
typedef struct
{
// coordinates if using integer positioning
float s0, t0, s1, t1;
signed short x0, y0, x1, y1;
int advance_int;
// coordinates if using floating positioning
float s0f, t0f, s1f, t1f;
float x0f, y0f, x1f, y1f;
float advance;
} stb_fontchar;
#endif
#define STB_FONT_consolas_24_latin1_BITMAP_WIDTH 256
#define STB_FONT_consolas_24_latin1_BITMAP_HEIGHT 170
#define STB_FONT_consolas_24_latin1_BITMAP_HEIGHT_POW2 256
#define STB_FONT_consolas_24_latin1_FIRST_CHAR 32
#define STB_FONT_consolas_24_latin1_NUM_CHARS 224
#define STB_FONT_consolas_24_latin1_LINE_SPACING 16
static unsigned int stb__consolas_24_latin1_pixels[] = {
0x08262131,0xff904400,0x3ffe1fff,0x3b2206ff,0x2007913f,0x0000defa,
0x64c00f32,0x0de5c402,0x00a614c0,0x4002ae62,0x98014c19,0x01aa881c,
0x00d54400,0xb880154c,0x8330020b,0x1e980029,0xaa7d5dd4,0x2001d94f,
0x3332a6e8,0x999ff0ff,0x37ffa207,0x2600df12,0x8000fffd,0x3fa005fd,
0xfdff700f,0x8ffc409f,0x3ea02ff8,0x200dffff,0x0bfe0ff8,0x7d407ee0,
0xfd10001f,0x9fff5007,0xcffff880,0x1ff104eb,0x320017fc,0x7d77e40f,
0x17ee9f54,0xfd027ec0,0x7dc01fe1,0x0037c40d,0xb0017f22,0xffe8007f,
0x7dc3fd80,0x741ff104,0x59ff701f,0x7401dfd7,0x2003f60e,0x3fa200fc,
0x0ff44001,0x7dc6fdc0,0x32236604,0x3ba00eff,0x31003f60,0xdf90dd57,
0xd93ea9f5,0x037e403f,0x803fc3fa,0x06f882fd,0x2006f980,0xa8800098,
0xf903fb81,0x88040401,0x1ff441ff,0x0fb00000,0x00000000,0x00020000,
0xffffa800,0xfadfb86f,0x7fc49f54,0x803ff301,0x200ff0fe,0x06f880fe,
0x0000ff00,0x05f88000,0x40000fe6,0x0ff504fc,0x81540153,0x100affb9,
0x22001573,0x31000ab9,0x26200157,0x731000ab,0xcffb8015,0x7dc4ffda,
0x89f54fad,0x3fe80ff9,0x0ff0fe80,0x3e203fa0,0x807ddb36,0x01dd107f,
0xdddb076c,0x1fb8bddd,0x1dd12fc0,0x3ff076c0,0x3f60ffc0,0xe98ff102,
0xa84fffff,0x00dfffff,0x37ffffea,0x3fffea00,0x3fea00df,0x2a00dfff,
0x80dfffff,0x3bb61ff8,0x3eb3ea3f,0x7f909f54,0xfd005fa8,0x7f401fe1,
0xffaef880,0x1fe05ffe,0xdf504fd8,0xfffffff8,0x9db33746,0x09fb1b6b,
0x80ff1bea,0x817ec2fd,0x33fe67f8,0x7dc3acfa,0x0efebacf,0xebacffb8,
0xcffb80ef,0xb80efeba,0xefebacff,0xbacffb80,0x27e40efe,0x20df59f1,
0x509f54fa,0x003fd8bf,0x401fe1fd,0x9fff107e,0x7407fe61,0x20ff500f,
0x6f9803fd,0x777ccfe2,0x7fa8db6f,0x37cc7fb0,0x5fb0ff60,0x3fe9fe20,
0x3ff105f3,0x7c43fe88,0x21ff441f,0x7f441ff8,0x220ffc43,0x0ffc43fe,
0x3ff0ffa2,0x267f97d4,0x9f54fadf,0x1ff8ff10,0x1fe1fd00,0x7c417e20,
0x704fb84f,0x217f405f,0xf9800ff8,0x47f47ea6,0xfd0f95f8,0x260ff885,
0x21fe406f,0x2ff102fd,0x207ea6f9,0x8ff504fc,0x8ff504fc,0x8ff504fc,
0x8ff504fc,0x8ff504fc,0x3fd3e47f,0x553eafea,0x261ff04f,0x1fd000ff,
0xefcc81fe,0x260ff101,0x9bfb105f,0x7d45fb81,0x64df3005,0x9f34f98f,
0x517ee1f2,0x407f98bf,0x817ec2fd,0x5cbf57f8,0x201ff80f,0x807fe1ff,
0x807fe1ff,0x807fe1ff,0x807fe1ff,0xf8df31ff,0x47e4bf65,0x203514fa,
0x00df52fd,0x107f87f4,0x7c403fff,0x440df306,0x7fc41ffe,0x4c00bf60,
0x97ddf66f,0xf10db2fa,0x2217ec1f,0x20ff407f,0x2ff102fd,0x7c1f64fb,
0xff17ec07,0x1fe2fd80,0x03fc5fb0,0x407f8bf6,0x4cdf32fd,0x9d4ff22f,
0x9f7004fa,0xfe8013ee,0x6cc40ff0,0x20df103f,0x3bf506f9,0x7c4ff601,
0xd9be6007,0x47f23f96,0x227fb06d,0x203ff07f,0x17ec0ff8,0x4df57f88,
0x406f986e,0x80df33fd,0x80df33fd,0x80df33fd,0x80df33fd,0x64ff13fd,
0x2a0bf60f,0x29f9004f,0x3fa005fa,0x1be00ff0,0x5fa837c4,0xfa801f90,
0x4c009f76,0x87edba6f,0x2a09f0fd,0x3209f76f,0xb0bf704f,0x4dfe205f,
0xf30bf0ff,0xf33fc80d,0xf33fc80d,0xf33fc80d,0xf33fc80d,0x3e3fc80d,
0x03fd1ba7,0x3f6009f5,0x7400ff13,0x3a00ff0f,0x906f880f,0x401fa07f,
0x001fe9ff,0xf96e9be6,0x017cdfe3,0x203fd3ff,0x7fd43ff9,0xf102fd81,
0x27d7fecf,0xfb01fe63,0xfb01fe65,0xfb01fe65,0xfb01fe65,0xfb01fe65,
0x1fc4ff45,0x9f501ff1,0xfe8bfe00,0x3e1fd001,0x101fd007,0x40df50df,
0xfbf9007e,0x26f9800d,0xfdb9f56d,0x7e401fb7,0x7fdc06fd,0xb02ffede,
0x89fe205f,0x4feefffc,0x1fe80ff1,0x1fe80ff1,0x1fe80ff1,0x1fe80ff1,
0x1fe80ff1,0xb87ef7f2,0x2a9f505f,0x647f984f,0x21fd002f,0x01fd007f,
0xfb99dff1,0x803f403f,0x4003fff8,0x6c5f26f9,0x01ffe8ef,0x401fffc4,
0x01dfffda,0x2fd40ff2,0x0e77ff4c,0x3fe203ff,0x7c407fe0,0x4407fe0f,
0x407fe0ff,0x07fe0ff8,0xff107fc4,0x807fd4fd,0x509f54fa,0x004fa8bf,
0x401fe1fd,0xfff880fe,0x7400deff,0x01ff6007,0x0fb9be60,0x7ec00302,
0x027dc007,0x4fc827dc,0x3f203f70,0xfc8bf704,0xfc8bf704,0xfc8bf704,
0xfc8bf704,0xf30bf704,0x07ffd9df,0x84faa7d4,0x07fc41fe,0x07f87f40,
0xdf101fd0,0x07f80022,0x2000ff60,0x00fe65fa,0x001fec00,0x98103fe6,
0x0ffcc1ff,0xff100fc8,0x440ffa87,0x07fd43ff,0xff50ffe2,0x543ff881,
0x1ffc40ff,0x7dc03fea,0x5401dfff,0xfc89f54f,0xd00df705,0x6c01fe1f,
0x006f883f,0xf5006f98,0x9fb0001f,0xa80006e8,0xfd8000ff,0xfc86fcdf,
0x04ffecdf,0xdff701f6,0x2e07ffd9,0x3ffeceff,0xfd9dff70,0x3bfee07f,
0xf703ffec,0x07ffd9df,0x5000cfec,0xfa93ea9f,0x013f600f,0x401fe1fd,
0x37c41efb,0x013f6600,0x33007fea,0x2e07fdc4,0xf500505f,0x7e40003f,
0xfd703fff,0x6e805dff,0xdfffea80,0x7fff5401,0x7ff5401d,0x7f5401df,
0x75401dff,0x7c01dfff,0x54fa8005,0x00bfe29f,0x775c3fd1,0xddff0ffe,
0x7fff409d,0x2600df12,0xf300effe,0xf7007fff,0x207fffdf,0x7fdcdffb,
0x07ffff30,0x80022000,0x0017e001,0x00060003,0x0018000c,0x07220030,
0x7d53ea00,0x26007fb4,0x3bbbae6f,0x9ddddb0e,0xd12ecb80,0x0f3a600b,
0x0019bd30,0x073bbb22,0x17bdb730,0x00337a60,0x00000000,0x00000000,
0x00000000,0x00000000,0x4d3ea9f5,0x00154004,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x20000000,0x009f54fa,
0x77777400,0xeeeeeeee,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x4c000000,0x0007d33e,0x77777740,0x0eeeeeee,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x54400000,0x2a20001a,0x0154c01a,0x54400b20,
0xaaa98000,0x99953100,0x032e0059,0x10053066,0x22004177,0x04c801aa,
0x01aa8800,0x500d5440,0x51017997,0x51000035,0x0bb88035,0x00d54402,
0x0007fea0,0xf500ffa2,0x3e6009ff,0x3fef9803,0xfffff700,0xffffb89f,
0xf8804fff,0x3e0ff886,0x3ffe202f,0x5404ebcf,0x0fec01ff,0x07fd1000,
0x103fe880,0x05fffffd,0x80007fea,0x7c403fe8,0x04ebcfff,0x88003ff5,
0x3a2001fe,0x46fdc01f,0x7dc404fb,0x6baec00b,0xabcffd80,0x3fff24ec,
0x804fb9df,0x41dd03fb,0x236600fd,0x800effc8,0x3e601fe8,0x3fd10005,
0x01fe8800,0x008833f6,0x20007fa2,0xd9801fe8,0x00effc88,0x00007fa2,
0x00000000,0x9fffffd5,0x036cf640,0x98407bee,0xf54fffff,0x001fd009,
0x00020000,0x0007f400,0x44000000,0x0000007f,0x00200000,0x40153000,
0xa802a62a,0x2a802a62,0x33fb7ff2,0x3bfa204d,0x007fe201,0x53fffff2,
0x27d404fa,0x40015540,0x553002aa,0x50555555,0x01aa807f,0x554c1544,
0xf82aaaaa,0x2aa8002f,0x802aa800,0x50aa02a9,0x55555555,0xf102fd81,
0xf8817ecf,0x7c40bf67,0x1f61ff37,0x5c02aa80,0xfff9005f,0x013ea9ff,
0xff8803fb,0x3fe2002f,0xfffc802f,0xdf07ffff,0x6406fb80,0xffffc85f,
0xffb87fff,0x3ffe2003,0x3ffe2002,0x41ffe402,0x7fffc6f8,0x6c0fffff,
0x6cff102f,0x6cff102f,0x2eff102f,0x4401ba5f,0x3f202fff,0xffff7003,
0x8813ea9f,0xfffa805f,0x3ffea004,0xaacfc804,0x5f902aaa,0xf103ff80,
0x559f901f,0xff985555,0xfa802eff,0x3ea004ff,0x7fe404ff,0x5546f886,
0x0aaadfda,0x7f8817ec,0x3fc40bf6,0x5fe205fb,0x4017e7fa,0x3604fffa,
0xfff3002f,0x813ea9ff,0xafd802fc,0x2bf6007f,0x03fc807f,0x2a02fc40,
0x04fd80ff,0x3fa007f9,0x404ffd89,0x2007fafd,0x6407fafd,0x37c42fef,
0xfd809f70,0x7ecff102,0x7ecff102,0x3e2ff102,0xb004faef,0x7f40ff5f,
0x3fff2002,0x7c09f54f,0xfd7f8807,0x3aff1003,0x01fe401f,0x3a00fec0,
0x807fcc4f,0x5f9803fc,0xf8827fd4,0xf1003fd7,0xfc807faf,0x037c46fb,
0x2fd809f7,0x17ecff10,0x0bf67f88,0xffd33fc4,0x7f88019f,0x0bfa03fd,
0x29ffd500,0x07f504fa,0x13ee9f50,0x27dd3ea0,0x2000ff20,0x7fcc04fa,
0xfc80ff60,0x886f9803,0x74fa81ff,0x29f5009f,0x2bf204fb,0x81be22fd,
0x17ec04fb,0x0bf67f88,0x05fb3fc4,0x3fae1fe2,0x53ea03ff,0x07fb04fb,
0x4fa84c00,0xfb001fd0,0x3601fe65,0xc80ff32f,0x1fd0003f,0xdf34fd80,
0xf003fc80,0xb07f905f,0x201fe65f,0x40ff32fd,0x226faafc,0x013ee06f,
0x9fe205fb,0x4ff102fd,0x0ff102fd,0x417ff7ee,0x20ff32fd,0x500006fb,
0x00bf309f,0x01fe8ff1,0x03fd1fe2,0x777777e4,0x01fdc04e,0x0bf63fe2,
0xdddddf90,0x43ffa89d,0x23fc43fb,0x1fe201fe,0x4bf203fd,0x40df11fe,
0x17ec04fb,0x0bf67f88,0x05fb3fc4,0x9be41fe2,0x23fc43ff,0x2ff881fe,
0x84fa8000,0x5fa801fc,0xbf5027e4,0x3f204fc8,0x06ffffff,0x7e4037c4,
0xffc806fe,0xa86fffff,0x0ff89eff,0x13f22fd4,0x27e45fa8,0x2bf52fc8,
0x13ee06f8,0x3e205fb0,0x7c40bf67,0x7c40bf67,0x2fdcdb07,0x09f917ea,
0x0620bff2,0x3e227d40,0x985fb006,0x30bf607f,0x01fe40ff,0x8803f900,
0xfc801fff,0x7fec4003,0x42fd82ff,0x0bf607f9,0x8bf20ff3,0x206f89ff,
0x17ec04fb,0x0bf67f88,0x05fb3fc4,0xb2f41fe2,0x4c2fd89f,0x3fff607f,
0x5004fedd,0x802fb89f,0x99999ff8,0x9ff881ff,0x01ff9999,0x4c0007f9,
0x05fb805f,0x20007f90,0xff886fe9,0x1ff99999,0x9999ff88,0x2fc81ff9,
0x81be33ee,0x1fe404fb,0x0ff25fa8,0x07f92fd4,0x9f04d7ea,0x7c43ff71,
0xff99999f,0x3fffaa01,0x7f9002ce,0xff5007e8,0x9fffffff,0xffffff50,
0x3f209fff,0x07f40003,0x64013ee0,0x3a20003f,0x7fffd42f,0xa84fffff,
0xffffffff,0x222fc84f,0x2e06f9ff,0x827dc04f,0x413ee4fc,0x413ee4fc,
0xfdffb4fc,0xfa87ffff,0xffffffff,0x0077c404,0x9f517f40,0x3337f600,
0xd86fdccc,0xdcccccdf,0x007f906f,0x5c04fa80,0x07f9004f,0x6c2fe800,
0xdcccccdf,0xccdfd86f,0xc86fdccc,0x37e7e42f,0xf9809f70,0x30ffcc1f,
0x1ff983ff,0xff307fe6,0x3fffb6a3,0xcdfd80ce,0x06fdcccc,0x37601fd4,
0x6c6fd989,0x0ff8800f,0xff887fe0,0x3207fe00,0x7f80003f,0xc8027dc0,
0x4c15003f,0x3fe20ffb,0xf887fe00,0x907fe00f,0x6fff885f,0x32013ee0,
0x4ffecdff,0xfecdffc8,0xcdffc84f,0x3f704ffe,0xf007fc40,0x00fe403f,
0xdfffffb1,0xa802fcc3,0x527ec05f,0x84fd80bf,0xeeeeeefc,0x80bee006,
0xdf9004fb,0xf8dddddd,0x41ffffff,0x27ec05fa,0x4fd80bf5,0x7fe417e4,
0x7ff776c6,0xfd700eee,0x75c05dff,0x2e02efff,0x202efffe,0x17ea00fc,
0x14c09fb0,0x82cdba80,0x7fb001ca,0x3f66fa80,0x6437d403,0x7fffffff,
0xb80f2200,0xfff9004f,0xcb8fffff,0x7fb02cdd,0x3f66fa80,0x3237d403,
0x46ff882f,0xffffffff,0x8001800f,0x90018001,0x403fd80b,0x000006fa,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x0d544000,0x2600aa60,0x54c014c1,0x14c19802,0x400154c0,
0xcb9802c9,0x0332e02c,0x30a60f22,0x00332a05,0x4000b260,0x0cca83cc,
0x01e64000,0x2e200b26,0x6644020b,0x00cca801,0xe8803ca8,0x7ffd403f,
0xf83fe204,0x3ffea02f,0xf83fe204,0x3ffea02f,0x3f7ee004,0x3ffff604,
0x7f7ec0ef,0x220fe40f,0x05ff11ff,0xa8003bee,0x6c003fff,0x03bee05f,
0x202fec00,0x2203fffa,0x4eacffff,0x9d95ff70,0x9003bee0,0x1fe880bf,
0x7dc6fdc0,0xfd83ba04,0xf71bf700,0xfb077409,0x2e37ee01,0x2a7d004f,
0x261bf907,0x54fea4fd,0x2213ea3f,0x807fa0ff,0xfa800ef9,0xb003fc8d,
0x1df3007f,0x403fd800,0x03fc8dfa,0xdffb31d3,0xfffdb881,0x3be603ef,
0x0017f200,0x00000000,0x00000000,0x7b8dd800,0x6f981ff0,0x8a7c47ee,
0x020200ee,0x22002620,0x4c400cc1,0x00262000,0x18800988,0x011000cc,
0x0ffb7fe2,0xf9004c40,0x5555550b,0xaa981555,0x982aaaaa,0x2aaaaaaa,
0xaaaaaaa8,0x555540aa,0x200aaaaa,0x7cc002aa,0x86f882ff,0x44bee5fa,
0x0005f94f,0x00000000,0x00000000,0x00000000,0x001ff982,0xff0bf900,
0x1fffffff,0xffffffc8,0xffffc87f,0xfff87fff,0x40ffffff,0xffffffff,
0x5fff100f,0x26013000,0x30ffd45f,0xf33fb3bf,0x9dfb7009,0xcefdb801,
0x677edc00,0x677edc00,0xdfdb7100,0x3b6e203b,0xb7101def,0x2203bdfd,
0x01defedb,0x01bffb2a,0x7039dfb7,0xfb5550bf,0xfc81555b,0x82aaaaac,
0xaaaaacfc,0xdfdaaa82,0x55540aaa,0x00aaadfd,0x1009fff5,0x83bdfdb7,
0x07bee5f9,0x7f4fffee,0x76f7ec00,0xbdfb02ff,0x3f605ffd,0xb02ffede,
0x05ffdbdf,0xfffddff7,0xfddff705,0xdff705ff,0xf705fffd,0x05fffddf,
0x5ffddffb,0xffdffd30,0x404fb87f,0x1fe404fb,0x0007f900,0xfb8013ee,
0xff5fb004,0xfddff700,0x8afcc5ff,0x426200ff,0x27e402fc,0x9f903fea,
0x7e40ffa8,0x3207fd44,0x207fd44f,0x43fdc419,0x43fdc419,0x43fdc419,
0x23fdc419,0x1bea0dfc,0x3ff513fa,0x3ee027dc,0x001fe404,0x2e0007f9,
0x13ee004f,0x0ff5fe20,0xff710660,0x07f8afcc,0xf1017e60,0xf88ff20d,
0x7c47f906,0x7c47f906,0x4007f906,0x3fe000ff,0x003fe000,0x0df30ff8,
0x05fa87fa,0x027dcbf9,0x7f9013ee,0x001fe400,0x2e004fb8,0x74fa804f,
0x7fc0009f,0x27fcbf30,0x5400fe80,0x549f504f,0x549f504f,0x549f504f,
0x009f504f,0xfb000fec,0x00fec003,0x0fee3fb0,0x05f927e4,0x04fb9be2,
0x3f2027dc,0x00ff2003,0x70027dc0,0x25fb009f,0x360007f9,0x7ccbf31f,
0x4bee00df,0x77dc1dec,0x5feeeeee,0x3bbbbbee,0x3bee5fee,0x5feeeeee,
0x3bbbbbee,0xec985fee,0x981ffffe,0x1ffffeec,0xfffeec98,0xfeec981f,
0x05fb1fff,0x01fe97ea,0x403fa9fe,0x77e404fb,0xc84eeeee,0x4eeeeeef,
0x70027dc0,0x47f8809f,0x764c01fe,0xf31ffffe,0x80efe98b,0xffbfd5f8,
0x77777e43,0x3f24eeee,0xeeeeeeee,0x3bbbbf24,0x3f24eeee,0xeeeeeeee,
0x6677fdc4,0x7fdc1ffc,0x41ffccce,0xfccceffb,0x677fdc1f,0x3fb1ffcc,
0x1fe97ea0,0x03fa9fe0,0x3f2027dc,0x86ffffff,0xfffffffc,0x0027dc06,
0x5fa809f7,0xff7027e4,0x23ff999d,0x4fe885f9,0x33f98fe8,0x002fdc9f,
0x7dc00bf7,0x017ee005,0xfd81ff88,0x3607fe21,0x207fe21f,0x07fe21fd,
0x817e47f6,0x40bf64fb,0x007266f8,0x3fc809f7,0x000ff200,0xf70027dc,
0x4c2fd809,0x03ff107f,0x417e63fb,0xb9fdc6f9,0xffa97e1f,0x01ff5000,
0x4003fea0,0xf5000ffa,0xfa87fa0b,0x7d43fd05,0x7d43fd05,0x3ee3fd05,
0x7e45fb05,0x000bf704,0x3fc809f7,0x000ff200,0xf70027dc,0x4cffc409,
0xa81ff999,0x263fd05f,0x44df305f,0x7c4bea6f,0x80067f44,0xfd000cfe,
0x33fa0019,0x446fa800,0x1bea1ffd,0x7d43ffb1,0x50ffec46,0x1ffd88df,
0x7fa85ff1,0x3e60ffc4,0x700faa1f,0x03fc809f,0x4000ff20,0x3ee004fb,
0x3fffea04,0xa84fffff,0x8ffec46f,0xfb9935f9,0xf10fec5f,0xf983fb7d,
0x0eccbdff,0x65efffcc,0x7ffcc0ec,0x4c0eccbd,0xeccbdfff,0x373bfe20,
0x3e21feff,0xfeffdcef,0x373bfe21,0x3e21feff,0xfeffdcef,0x3737fee1,
0xdffb82ff,0x7fc3ffdc,0x2027dc07,0x3f2003fc,0x09f70003,0xfb027dc0,
0xfb99999b,0xb9dff10d,0x3e63fdff,0x45dfff35,0xfffa83fa,0xffffb102,
0xffb101df,0xb101dfff,0x01dfffff,0xdfffffb1,0xdfffe981,0x7f4c1fc8,
0x41fc8dff,0xc8dfffe9,0x7fff4c1f,0x7541fc8d,0x2a01efff,0xc81efffe,
0x027dc05f,0xfc800ff2,0x09f70003,0xf8827dc0,0x207fe00f,0xc8dfffe9,
0x0002201f,0x02620008,0x20009880,0x26200098,0x40008800,0x00440008,
0x06000220,0x40600600,0xeeffeeed,0x7777e40e,0xefc86eee,0xd86eeeee,
0xeeeffeee,0x7ff776c0,0x0bf50eee,0x02204fd8,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0xffffff80,0x7fe40fff,0xc87fffff,
0x7fffffff,0xfffffff8,0x7fffc0ff,0xfb0fffff,0x006fa807,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x40f32000,0xca814c29,0x055cc00c,0x203cc800,0x98014c29,0x0bb8802c,
0x40044002,0x298003c8,0x0310014c,0x8000b260,0x157300cb,0x76c17a20,
0x00f32000,0x32a0aa62,0x027d400c,0xf882fec0,0x205ff11f,0x3ee00efb,
0x36001eff,0x47fe205f,0x7d402ff8,0x3fe203ff,0x204eacff,0x203ffffa,
0x7c4006f8,0x005ff11f,0x3fea01f6,0x3fb0003f,0x4fffff98,0x1fd06f88,
0x8817f600,0x706ffffb,0x7ff401df,0x80ff6000,0x07fa0ff8,0x5100ef98,
0xb005ffd7,0x0ff8807f,0xdfa807fa,0x1d303fc8,0x201dffb3,0x2ffdcffa,
0x8800df10,0x007fa0ff,0x37ea02fc,0xd8003fc8,0x26ffea1f,0x37c44feb,
0xfd800fe8,0x37ffe603,0x3be602ac,0x400bf700,0x10100098,0x20013100,
0x26200ffb,0x00202000,0x20019831,0x717ec008,0x01be20bf,0xb7004040,
0x18807fff,0x7ec000cc,0xff10bfa1,0xfe837c41,0x1004c400,0x310007ff,
0x00000001,0x20000000,0x000004fd,0x00000000,0x6f983fe0,0x0000df10,
0xfeffe980,0x000001ff,0x17ea3fb0,0x0df127dc,0x200003fa,0x000003fc,
0x05e88026,0x82f443d9,0x417a21ec,0x17ee01ec,0x00e77edc,0x80e77edc,
0x03d905e8,0x8073bf6e,0x413ee2fe,0x7ddb36f8,0x3bfb6e20,0xf13fe81d,
0x6dc03ffd,0x65401cef,0xf91ffdee,0x44dfd305,0x701fd06f,0x7c0bdddd,
0x7775c007,0x407f305e,0x45fb06f8,0x45fb06f8,0x05fb06f8,0x3fa61fdc,
0x303fffef,0x7fffdffd,0x3f60df10,0x7f7ff4c2,0x2df903ff,0xdf100ffa,
0x0bffdff5,0xfffddff7,0x5f52fdc5,0xffd309f7,0xb107fffd,0x3fffdfff,
0xfff707f6,0xfe837c4f,0x7ffffc80,0x2aa2bf30,0xffff9009,0x8813ea0f,
0x445fb06f,0x445fb06f,0x205fb06f,0x27f40ff9,0x3fa07fea,0x220ffd44,
0xe85fb06f,0x40ffd44f,0x01efeff8,0x4c33ffe2,0x220cc1ff,0xd8bf27fb,
0x9fd0bf17,0x7e41ffa8,0xfe8ff42d,0xff3dfb10,0x0fe837c4,0xfa83fc40,
0x2fffffee,0xfa83fc40,0x6c1be204,0x6c1be22f,0x6c1be22f,0x3fffe62f,
0xfc82fd44,0xfc82fd45,0xfd837c45,0x7e417ea2,0x00bffb05,0x9f709ff1,
0xfe87fc00,0x547f93e0,0x44bf905f,0x3e3fb07f,0xf0dff98f,0x303fe21f,
0x7f8803ff,0x537bff70,0x7c403ff9,0x4409f507,0x445fb06f,0x445fb06f,
0x4c5fb06f,0x05f902ef,0x05f91be2,0x0df11be2,0x02fc8bf6,0xefe88df1,
0x88ff11ff,0x00bf307f,0x50fe8fec,0x3f23fc5f,0x7dcdf102,0x3fa3fb04,
0x13fc3ffc,0x7ff445ff,0xb83fc401,0x40bf904f,0x09f507f8,0x2fd837c4,
0x17ec1be2,0x8bf60df1,0x07fa04f9,0x00ff47f8,0xb06f88ff,0xf00ff45f,
0xdfb4fd8f,0x6f88df31,0xd930df30,0x323ffffd,0x37c4fb2f,0x27f807fa,
0x23fb03fc,0x7c41effd,0x337ffe27,0x202efbef,0x09f707f8,0x7f881be6,
0x7c40bf50,0x7c45fb06,0x7c45fb06,0x7cc5fb06,0xf807fa04,0xff00ff47,
0x5fb06f88,0x4ff00ff4,0x56ff47f8,0x9837c45f,0x677fdc6f,0x9f51ffcc,
0x745fa97e,0xfd9fe01f,0x3f23fb02,0x225fa80d,0xb0dffeef,0x83fc409f,
0x0ff105fa,0x5fb83fc4,0x7ec1be20,0x7ec1be22,0x7ec1be22,0xfd80b222,
0xfd8df102,0xf88df102,0x7ec5fb06,0x7ccdf102,0x17fffc46,0x2fd41be2,
0x3fb03ff1,0x44bf3fe2,0x817ec1fe,0x413f26f8,0x20df31fe,0x45be22fd,
0x07f88000,0x17ea0ff1,0xbf707f88,0x7c40ff80,0x2207fc2f,0x207fc2ff,
0x64002ff8,0xc8bf704f,0xf0bf704f,0x22ff881f,0x4bf704fc,0xfffa87f9,
0xfc837c40,0x7f417ea3,0x373ffea1,0x04fc84ff,0x42fdcbf7,0x0ffa1ffb,
0x06f88ff5,0xb03fc400,0x02fe889f,0x2fdc1fe2,0xfe88bfe0,0xd117fc2f,
0x22ff85ff,0x3a62ffe8,0x307fe204,0x1ff883ff,0x7fc0ffcc,0x88bffa22,
0x0ffcc1ff,0xffd50ffe,0xfa86f883,0x36237d46,0x7ffd41ff,0x3ff102ef,
0x3e21ff98,0x87ffea1f,0xffdcdff9,0x00037c41,0xff981fe2,0x404fecbd,
0x0bf707f8,0xefcdffb8,0x6ffdc2fd,0x5c2fdefc,0xfdefcdff,0xb803ff62,
0x3ffdcdff,0xfb9bff70,0x37fee07f,0x5c2fdefc,0x3ffdcdff,0xffceffa8,
0x3e20efef,0x1ffdccef,0x7ee77fc4,0x5fd41fef,0x9bff7001,0xffb07ffb,
0x83f99fdb,0x81dfffd8,0xcc8006f8,0x1cccffcc,0x177ffec4,0xcffcccc8,
0x00df71cc,0xf71bffd5,0x1bffd505,0xffd505f7,0x7dc5f71b,0xfffea806,
0x7ff5401e,0x7f5401ef,0xa82fb8df,0x201efffe,0xd1dfffea,0xfffdb8bf,
0xffd300de,0xd83f91bf,0xffea8007,0x3ff201ef,0x0c03f93e,0x20017a20,
0xffffffff,0x3e00603f,0xffffffff,0x4400bd73,0x00044000,0x00020022,
0x000c0006,0x00c00044,0x01000040,0x3c800440,0x2000c000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x55530000,0x53035555,0x54c00557,
0xba9800aa,0x2aaaa60a,0x2a600aaa,0x0032e009,0x32205950,0x020bb883,
0x3c881654,0x6440736e,0x09999953,0x80357510,0x209aca98,0x20aa00a9,
0x2e014c29,0x0164c03f,0x1dd127dc,0x64c076c0,0xfffffc82,0x7ffe44ff,
0x3ee03fff,0x904fffff,0x2bffffff,0xfffffffc,0xfffffb81,0x000fe80d,
0x320bffd3,0x7fffc41f,0x3fa64eac,0x6c3f905f,0x1fc80ffd,0x40fffff9,
0xefffffc8,0xfffffc81,0x440bf65f,0x88ffc47f,0x1ffe02ff,0x203fffa8,
0x3f62fff8,0x3a0df504,0x567e40ff,0x5dc1aaaa,0x81ffdb9a,0xecabcffd,
0x5e7ff444,0x55535dca,0xfd83fd55,0x0efc989c,0xea8007f4,0x84fa85fa,
0xeffd98e9,0x217ebaa0,0x83fb04fa,0x266624fa,0x2fbf607f,0x360ffda9,
0x3baabcef,0x3fc40bf6,0x1fe83fe2,0x7d413f60,0x3e03fc8d,0x41fea1ff,
0x1ffd03fd,0x40001fc8,0x0f7dc4fe,0x8077ec08,0xf70ff400,0xfd17ea07,
0x45f88001,0x11000ee8,0x3a22fc40,0x22ffe40e,0xff100ee8,0x3e03fe20,
0x003ff32f,0x1fe205fb,0x20000404,0x9300cc18,0xf885fd05,0x9035100f,
0xfb80003f,0x4007fe25,0x20000ffa,0x4cdf11fe,0x743f91bb,0x2fc4000f,
0x80000bf2,0x417e45f8,0x3f23fda9,0x441fe202,0x2e5fb06f,0x05fb005f,
0x80001fe2,0x00000098,0x5fa8bf70,0x003f9000,0x3ee2fc80,0x00ff6005,
0x3ee3fd00,0x22ffff52,0x3603fa4f,0x265f884e,0x2a9d104f,0xbf101cfd,
0xc99827cc,0x8809f34f,0x10bfa07f,0x007fd4ff,0x7f8817ec,0x02f7775c,
0xeeb82fb8,0x440005ee,0x70bf60ff,0xf90bdddd,0xf3000335,0x001fe41d,
0xe80003fd,0xdf11f91f,0x3fa5f823,0x44077ec0,0x4403fa5f,0xffeefcdf,
0x3fa5f884,0x21dfff00,0x3fc400fe,0xf519ff50,0x177f447f,0x7c40bf60,
0x3ffffe47,0xfc82fb80,0x80007fff,0x90ff13fd,0xf90fffff,0x205bffff,
0xd85feee8,0x83fe002f,0x403cccc9,0x3eafb1fe,0x07f4fb03,0x90980bfb,
0x7ffc405f,0x2603fea3,0x4cc05f90,0x2200bf20,0x7ffcc07f,0xffe981ff,
0x02fd80be,0x3fc40ff1,0x2017e440,0xa80007f8,0x8809f76f,0xdccca87f,
0xff982fff,0x3fa0cfff,0xa8ff1002,0x7406ffff,0x0beadd1f,0x361fd3ec,
0x17e6005f,0xff07ff10,0x002fcc03,0x7c4017e6,0x7ffec407,0x3ffae03f,
0x8817ec3f,0x81fe207f,0x403fffd9,0x2da807f8,0x07fa7fe0,0x6400ff10,
0x6fd9807f,0x7c400bf6,0x37d4cc47,0x8bec7fa0,0x7f4dd04f,0x74005fd8,
0x83fc400f,0x03fa02fd,0x2001fd00,0x3fa607f8,0x405ffc8c,0x3f65ffda,
0x440ff102,0x273fa07f,0x03fc4009,0xfc80fffc,0x7f8806fd,0x007fe200,
0x03fc97f4,0x7cc03fe0,0xfc8ff406,0x7c737fd0,0x01bf7fa5,0x33265f70,
0xfd837c42,0xd915f702,0x997dc05b,0x0ff102cc,0x3fe617fc,0xb2ffa802,
0x81fe205f,0x0bf307f8,0xe807f880,0xfff103ff,0x00ff1007,0xf9002fe8,
0xe801bee7,0x80df303f,0x267f51fe,0x47f37ffd,0x002ffafe,0x27ff4bf1,
0x17ec1be2,0xecfaafc4,0x3a5f881f,0x0ff104ff,0x2fe417e6,0x7f94fc80,
0xf8817ea0,0x8009f707,0xff9807f8,0x401ff603,0x3e2007f8,0x23fd000f,
0xf5002ff8,0x40df301f,0x11fa0ff9,0x1fd07ec1,0xfd005ff3,0x113eff21,
0x20bf60df,0x17dc20fe,0xfbfc87f4,0x2e0ff104,0x00bf704f,0x827dcff2,
0x1fe204fc,0x220037dc,0x03ff007f,0xf8801fec,0x09fb1007,0xff91bee0,
0xefe83105,0x20bb7cc0,0x77d46fc8,0x7f43fc80,0x5c03ff50,0x9f39f33f,
0x5fb06f88,0xfe883fb8,0xcf99fdc0,0x0ff104f9,0x3fa03fea,0x8ffcc013,
0x7fcc1ff9,0x441fe201,0x3e2003ff,0x206fb807,0xf1000ffa,0xfb999b0f,
0xb999b0bf,0xfd881fff,0x44feddff,0xecdeffe8,0xffbdfd6f,0x59df703f,
0x1fd09fd7,0x7c40ffdc,0x3bfbbf66,0x7ec1be23,0x3e61be22,0xfb37c41e,
0xf107dfdd,0x667ff40f,0x3bf66ffc,0x44ffedcd,0xffecdffc,0x703fc404,
0x88013bff,0x3bfb207f,0x003ff500,0x7ff43fc4,0xfff02dff,0xea807dff,
0x702cefff,0x25bffffd,0x00dfffeb,0x0b7fff66,0x3ff207f4,0xdd90fec0,
0x37c47dfd,0x07f62fd8,0x6c357ff5,0x3fbbb21f,0xff99993e,0x7dc43999,
0x2e0bffff,0x2dffffff,0x5dfffd70,0x3ff33320,0x7fd41ccc,0x666644ff,
0x3e1cccff,0xffff983d,0xfcccc803,0x1331cccf,0x00026600,0x00cc0004,
0x00100011,0x1dfb01fd,0x4f980fea,0x2fd837c4,0xfff707f5,0x980fea9f,
0x3ffffe4f,0x3103ffff,0x00133001,0xffff8018,0x503fffff,0xffff87b9,
0x003fffff,0x20019bd3,0xffffffff,0x0000003f,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x02ae6200,
0xdddfd910,0xdd9501dd,0x0f223b9b,0x00014400,0x22179995,0x07ddb34e,
0x23deedb8,0x0d4c02a8,0x55440055,0x4c40009a,0x551001ab,0x2aa35555,
0xaaaaaaaa,0x5555530a,0x5554c555,0xaaaa8009,0x57510009,0x00aaa001,
0xff5013ee,0xf101bfff,0xddffd9bf,0xfeeffd81,0x00df11ff,0x22001fe0,
0x12fffffe,0xffdff5bf,0xddffd30b,0x103fe8ff,0x01fe21ff,0xffffffa8,
0x7ffd401d,0x7e401eff,0xdf4fffff,0xdddddddd,0x3ffff21f,0x3ff67fff,
0xf00dffff,0x07ffffff,0x1fffffe4,0x80bffe20,0xf702fff8,0x1dfd759f,
0x27e43fd8,0x3fa06fe4,0x2000df11,0xdfd8007f,0x3fe21312,0x83ff30cf,
0x26140dfe,0x23fd80ff,0x3ea007f8,0x3ffecbae,0x9339ff30,0xefef805f,
0x021f1aaa,0x559f90f8,0x67ec5555,0x82ffecba,0xffecabff,0xa9adfd83,
0x3fea03ff,0x0fffc04f,0x3a20ffc4,0x7c43fc3f,0x6c07fc47,0x000df11f,
0x3fe001fe,0x213fe201,0x017f24fb,0x37cc4fd8,0x3bffffe2,0xb85fa81d,
0x83fd80ff,0x2fdfd400,0x85dfd0f8,0xb007f90f,0x81ff705f,0x547fc87f,
0x206f986f,0x4c07fafd,0x209f902c,0x21fe27fa,0x837dc7f8,0x00df11fd,
0x3bffbba6,0xf301eeee,0x307f880d,0x000ff4bf,0x17f43ff1,0x3b733fe2,
0x82fd43ff,0x00fe85fc,0x05f9fe80,0xf27dc41f,0x3600ff21,0xf8bfb02f,
0x320ff887,0x105fb03f,0x0007faff,0x3fe01ff8,0xbf70bfa1,0x3fb04fc8,
0x67ed5be2,0x7ffffcc1,0x302fffff,0x06f880bf,0x007fcdf3,0x2fd57ee0,
0x7fd43fc4,0x7cc17ea1,0x98007f87,0x1f05f8cf,0x643e1f50,0x02fd803f,
0x887f8ff3,0xb817ec7f,0xf74fa83f,0x03fc0009,0xcffa8bf6,0x7ec0ffda,
0x3e23fb02,0x4ffeefce,0xf3001fe0,0x306f880b,0x001fe2df,0x407f57f4,
0x49f907f8,0x03fe05fa,0x3f9000ff,0x203e0bf1,0x3f21f1f9,0x202fd803,
0x321fe0ff,0xb81fec5f,0xf32fd84f,0x1be6000f,0x6ff47fb0,0xfc80dfff,
0x3e23fd03,0x03fea4ff,0x7ffc03fc,0x7fffffff,0x27d41be2,0xf50001fd,
0x1fe207ff,0xffeeb7d4,0xa8ffc1ee,0x2aaaaffa,0xeff8b7c0,0x4cc1f1ee,
0x3f21f0fd,0x24eeeeee,0x87fe02fd,0xefecbbff,0x64077d40,0x3a3fc45f,
0x6f98001f,0x4f99fe40,0x709f7002,0x0ffe23ff,0x03fc07fe,0x67fee664,
0x1be24ccc,0x07f71fe4,0x881bf600,0x3ebf707f,0x742fffff,0xffffff1f,
0x3ee01fff,0x3dddff13,0x06f7c43e,0x3ffff21f,0x0bf66fff,0x3ffe1fe8,
0xfd00bfff,0x9fffb99f,0x27e45fa8,0x0ff30150,0x3df52fd8,0xa83fe200,
0x0ff11fff,0x03fc0bf6,0xf1017e60,0x4c6fb88d,0x74040bff,0xeeeffeee,
0x7f41fe21,0xff817ea3,0x333ff331,0x887f4033,0x3e21f05f,0x07f90f80,
0x7fc05fb0,0x3f267fe1,0x3ffb200e,0x7ec3fccf,0xfe83fcc2,0x203fc40f,
0xfffd11fe,0xfb05bfff,0x3fb9fd9f,0x17ec1be2,0x7cc007f8,0x677fc405,
0xfc81fffc,0xe87ecdff,0xeeeffeee,0xf931fe21,0x882fd41f,0x003fc0ff,
0x82fc4bf3,0x43e03a0f,0x2fd803fc,0x3fc1ff10,0x320013f2,0x267fe22f,
0x441ff999,0x1ff82fff,0x7e41ff10,0x4fffeeed,0xfb3effc8,0x7ec1be23,
0x9800ff02,0x7ffc405f,0x2e00dfff,0x405ffffe,0x3fe204fb,0x41efffee,
0x0df705fa,0x7fe400ff,0x1f05ffff,0x7f90f804,0x2e05fb00,0x3e23fc6f,
0x07f4000f,0xfffffff5,0x1dfb09ff,0x3ee09f90,0x7dc17ee5,0x23fb0207,
0x05fb06f8,0xf98007fa,0x08b7c405,0x803be200,0x99dfc999,0x77fffc41,
0x10bf503d,0x00ff07ff,0x3bbbbfe2,0x3ea1f05f,0x07f90f82,0xff105fb0,
0x4fc87f85,0xfb0ff200,0xfb99999b,0xff88060d,0xfb07fd43,0x003fe205,
0x06f88fec,0x13f605fb,0x4405f980,0x7f50006f,0xffffff80,0x1fe21fff,
0x7545fa80,0x200ff06f,0x82fc43fb,0x1f03d30f,0x3f600ff2,0x7c2ffd42,
0x400ff987,0x7fc46fd9,0x0007fe00,0x3fb3bfee,0xc837ec3f,0x47f6005f,
0x05fb06f8,0x3733ffe6,0x880bf301,0x3f90006f,0xdfdaaa80,0x1fe20aaa,
0xfeeffa80,0x7f6c0dff,0x3eeeeeef,0x9ff103fa,0x2003e599,0xddddf90f,
0x777ecddd,0xff05fffe,0xddb13f60,0xfa819fff,0x0027ec05,0x1dfffea8,
0xeeefff98,0x36000eff,0x360df11f,0x3ffaa02f,0x0bf301ff,0x30006f88,
0x04fb8005,0xfa801fe2,0xf01cefff,0xffffffff,0x2217e69f,0xff5fffff,
0xffffffff,0x3ffff21f,0x3ff67fff,0x3e01ceef,0x741ff307,0xfb01cdef,
0x006fa807,0xeb880180,0x8002ceee,0x20df11ec,0x013002fd,0x74405f98,
0x00000005,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0xaaaa8000,0xaaa98099,0x31aaaaaa,0x55555555,0x260aaa00,
0x2055100a,0x2aa0d42a,0x0aaaaaaa,0x0aa60551,0x40335555,0x455302a9,
0xaaaaaaa9,0x803551aa,0x02aa22a8,0x03530aa8,0x01551a88,0x0154c550,
0x2aaaaa55,0x00aaaaaa,0x751002aa,0x80551015,0xfffffff8,0x3ffff20c,
0xf95fffff,0x0fffffff,0xfb0fff70,0x7c1be205,0xfff0fe65,0x21ffffff,
0x2ff886f8,0x3fffffe2,0x07fec0bf,0xfff737fc,0x2bffffff,0x2fe406fb,
0x7fd413fa,0xf9807f50,0xfa809fb4,0x220fff26,0xffffff6f,0x501fffff,
0x36203ffd,0x4c3fffff,0x57fc406f,0x2a5ffcba,0xdccccccc,0x555bf95f,
0xff880555,0x102fd87f,0xfa93e0df,0x6fed5542,0x0df10aaa,0xaff887fd,
0x6c5ffeba,0x3ffd43ff,0x99999993,0x81ffc9ff,0x7fcc0ff8,0xf517f441,
0xf53f9809,0x323fc80f,0x56f886ff,0x55bfb555,0x7ff4c155,0x7bfd01ff,
0x7cc3ff95,0x443fc406,0x3fd000ff,0x6c000ff2,0x2fd87fbf,0x9f10df10,
0x9f700fdc,0x9fb1be20,0xff10ff10,0x3637f747,0xdf7007ee,0xfd80ffa8,
0xfc8bf904,0x2a027cc5,0xf807fe3f,0x0bfbf21f,0x13ee0df1,0xff9dff98,
0xbf905501,0x3e2037cc,0x3003fd07,0x001fe4df,0x43fc67d4,0x4df102fd,
0xdaadfbaa,0x4fb81abf,0x2fdcdf10,0xbf907f88,0xf887e774,0xff8807dc,
0x7cc4fe81,0x25ff100f,0x2fcc0ff9,0x4fd8bea0,0xbfc8df30,0xb837c46f,
0xff0e404f,0x26f98003,0x3fc406f9,0x5fb007f8,0x22001fe4,0xd87f88ff,
0x74df102f,0xffffffff,0x04fb85ff,0x03be6df1,0x6fa83fc4,0x7dcfe7ba,
0x7ec00fd9,0x6c1ff304,0x47fd403f,0x45f883fe,0xfa8bee09,0xfc87f906,
0x1be22fda,0x3e0027dc,0x37cc001f,0x7f880df3,0xf9804fc8,0x2001fe46,
0xb0ff12fd,0x21be205f,0x701f61fb,0x23be209f,0x1fe201ff,0x3adf2fec,
0x803f6dd6,0xa7ec06fa,0xdfb006f9,0xa9be20df,0xff07ee3f,0xfc81fd03,
0x1be26faa,0x3e0027dc,0x2fdc001f,0xff880df3,0x002ffeee,0xcefc85fb,
0xfa82cccc,0x3f61fe25,0xfeeeeeee,0x1ba0fc86,0x3e209f70,0x7c402fef,
0x3e2ff887,0x367f5f95,0x03ff100f,0x2fd8ff88,0x03fff100,0x64df937c,
0x2627ec1f,0xfd2fc86f,0x7dc1be23,0x00ffc004,0x7cc5fd10,0x7fffc406,
0x4c02efff,0xffffc86f,0x0fe85fff,0x3ff61fe2,0x6fffffff,0x202fc7c8,
0xfff104fb,0x9ff8805f,0x7c5ffdb9,0x321fff35,0x009fb01f,0x001bfbf2,
0x37c01ffd,0x03f23fff,0x83fc8df5,0x22bf52fc,0x009f706f,0x36001ff8,
0x2037cc5f,0x7fe447f8,0x320bf601,0x099999cf,0x1fe217e4,0x37c40bf6,
0x7013e3ec,0x2bbe209f,0x3fe200ff,0x443fffff,0xfc97fa5f,0x2006fa81,
0x2001fff8,0x3a05fffb,0x329f9f57,0x3a1ff80f,0x3e2fc80f,0xf706f89f,
0x01ff8009,0xf981df90,0xc83fc406,0x20df305f,0xef9803fc,0x9ff99999,
0x2205fb09,0xdffdd56f,0x20ddffdd,0x2df104fb,0xff100efb,0xf1013599,
0x3f917dcb,0x4001ff88,0x3e6005fb,0xfd02ff9f,0x3edbe3f2,0x0df33fd8,
0x8cfb8bf2,0x009f706f,0xfc801ff8,0x406f980e,0x0df507f8,0x1fe40ff6,
0x7ffffdc0,0xb4ffffff,0x4dbe205f,0xfdccefcc,0x09f704cd,0x05fd9be2,
0x3e600ff1,0x3617e405,0x4fb8004f,0x7dcffa00,0x5f8fd80f,0x2a0fb3f9,
0x3207f76f,0x3e7fe22f,0x8009f706,0x77e401ff,0x880df300,0x309fb07f,
0x01fe40ff,0x6666664c,0xfb2ccffc,0xf11be205,0x2e017d49,0x44df104f,
0x07f883ff,0xfb809f30,0x0003bea2,0x7dc013ee,0x7e427f46,0xdd9f32fb,
0x07f47fc0,0x67e42fc8,0x009f706f,0x3f201ff8,0x01be600e,0xffa88ff1,
0x3203fd82,0x7c40003f,0xf102fd87,0x3ee4f88d,0x8827dc01,0x20ffcc6f,
0x9f3007f8,0xff13fb80,0x13ee0003,0xf30bfe20,0x47efc83f,0x3f606eff,
0x0bf206fc,0x2e0dfff1,0x0ffc004f,0x4c00efc8,0x77fc406f,0x983fffee,
0x0ff200ff,0xb0ff1000,0x31be205f,0x6c07e47f,0xeeeffeee,0xff70df10,
0xa803fc41,0xc9fdc04f,0xffffffff,0x013ee06f,0x37e417f6,0xff917fee,
0x1fffd40b,0xff905f90,0xb013ee0d,0xdddffddd,0x3ffffe67,0xff36ffff,
0x15dddddd,0x19dfffff,0xf900ff60,0x7f880007,0xdf102fd8,0x03f22fa8,
0x3ffffffe,0x20df10ff,0x01fe26fd,0x3ee027d4,0xffffffb3,0x7dc0dfff,
0x807fdc04,0x3fee4ff8,0x202ffcc2,0x3f200fff,0x706ff882,0xffff809f,
0xf34fffff,0xffffffff,0x3ffffe6d,0x00003fff,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x80322000,
0x8026200b,0x6c40001c,0xdb880000,0x2e01defe,0xe881cefd,0x6d43d905,
0xdfd98cef,0x00054400,0x207bddb7,0x700cefdb,0xc83ddfdb,0x21bd505e,
0xd52ed8bd,0xeeeed81b,0xaa986eee,0x2017540a,0x2e1d74e9,0x77441dfd,
0x6c03b600,0x40df504f,0x7ff304fa,0x0ffe6000,0x7dc04fa8,0x42fffeef,
0xfffeffe9,0xfd837c43,0x3bff7be2,0x7406fdef,0xffe9807f,0xefd87fee,
0x7f42ffed,0x442feeef,0x17fc43ff,0xf3ffdb9f,0xfffe8bfd,0x7dc7ffff,
0x3ea1ffff,0xfca7d404,0x1fffefc9,0x6fa81fec,0x32ebfe20,0x2a01ff9b,
0x13fe604f,0x805ff700,0x20cc04fa,0x27f47fb8,0x6f887fea,0x36145fb0,
0x405f90ff,0xdfe807fe,0x513f2140,0x417ee1ff,0x361ff980,0x5c77fc4f,
0x200fd4ef,0xf70cc3fe,0x2e02fccb,0x45fdf93f,0x837d45fc,0x7fd403fd,
0x403fffff,0x7f4404fa,0x1efc800d,0x0004fa80,0x82fd43fe,0x41be25fc,
0x97ee02fd,0x072204fa,0xf100bf90,0x7e4ff20d,0xab7e4003,0xf52ff86f,
0x32007ecf,0x37cc405f,0x9174cdf1,0x307ff23f,0x883ff0df,0x7fc400ff,
0x402ffc9c,0xdfb004fa,0x03bf6201,0x00027d40,0x40bf23fb,0x41be26f8,
0x8fea02fd,0xe80004f9,0x04fa801f,0x0bfee9f5,0x1ff9fd00,0xb27d4ff0,
0x077d401f,0x37fff644,0x365fc9fe,0xd107f90f,0xfb89f90b,0x645fb804,
0x7777645f,0x205eeeff,0x7f441ffb,0x5ccccc04,0x981999df,0x1ffffeec,
0x13fc03fd,0x88bf60df,0xeeefeedb,0x266665fe,0x41999999,0xefb800ff,
0x5feeeeee,0x0077fff6,0x7c0bffe2,0x0fd8fea7,0x3203ff30,0x746f99af,
0x3f43ffa7,0xf88005f9,0x6c00ff47,0x363fcc2f,0xffffffff,0x8ffdc07f,
0xff805ff8,0xffffffff,0x33bfee1f,0x3fd1ffcc,0x0df13fc0,0xcffe8bf6,
0x2ccccefd,0x3ffffffe,0xff11ffff,0x3bbbf200,0x4c4eeeee,0x200efffd,
0xff00ffe8,0x01fb1fd4,0x37c05fd1,0x98fd8df5,0x64df3fcf,0x2fd8002f,
0x3f600df3,0x2a03fc42,0x3fe6004f,0x201ffd43,0xcefdcccc,0x3ff10ccc,
0x0bf63fb0,0x0df137c4,0x52fd4bf6,0xcccc809f,0x0ccccccc,0x3ee003fe,
0xfd510005,0x77f7ec0d,0x8fea7f80,0x04fd80fd,0x37ff6fec,0x3e3f27ee,
0x017e4bf6,0x3fcafd40,0xf989fb00,0x8027d406,0xfd302ffb,0x027d4009,
0x47fa0bf5,0x8bf704fc,0x97fc40ff,0x01bea2fc,0x01ff4000,0x00007fd4,
0xdf701ff1,0xa9fe17f6,0xf703f63f,0x17b7100d,0x5ebfa877,0x7e49f5f9,
0xd1ff0002,0x3bea001f,0xf500ff60,0x03df9009,0x800dfe88,0x1bea04fa,
0x3e23ffb1,0x20ffcc1f,0x3ffa22ff,0x3fa27f72,0x0054001f,0x8102ffea,
0x30000cfe,0x23ff30ff,0x53fc3ff8,0xf307ec7f,0x4c00001f,0xfbf32fdf,
0x80017e47,0x2005fdfc,0xfffdfff8,0x1027d401,0x6c001dfb,0x27d400ef,
0xfb9dff10,0x7fdc3fdf,0xb83ffdcd,0xfdefcdff,0x7dd9df12,0x403b99ff,
0xffd806fd,0x7cc7ecdf,0x0eccbdff,0xffb999dd,0x4c3ff889,0xfa9fe1ff,
0xfff83f63,0x32eeeeee,0x7ddddddd,0xff07ffc4,0x0017e45f,0x002fff98,
0x37ffbbf6,0x8164c06f,0x70005fe8,0x27d403ff,0x37fffa60,0x7f541fc8,
0x3aa01eff,0x22fb8dff,0xff90efeb,0x3ff403ff,0xffffea80,0xffffd885,
0xffffb0ef,0x0bfb05df,0x53fc3ff2,0xff07ec7f,0x5fffffff,0x3bbbbba6,
0x322ffc3e,0x00bf20ff,0x2006fe80,0x09fb06fb,0x001f4400,0x98807ea0,
0x00011000,0x00088003,0x26002601,0x0088002c,0x4cc01310,0x00000009,
0x00000000,0x00000000,0x4407ee00,0x3333264f,0x002ccccc,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x40000000,
0x3fee0400,0x4fffffff,0x74400000,0x4039fb54,0x64400aa9,0xb9800001,
0x000001bc,0x03372a00,0x4017bb93,0x16dc04c9,0x200e65c4,0x333100a8,
0x81333333,0x4cc40bb9,0x09999999,0x26057700,0x257714c2,0x00000bb9,
0x40000000,0xfeefcdf8,0x7fff444f,0x80be202f,0xc81d705c,0x40dfdcdf,
0x3203645c,0xfd83320d,0x3f21ffff,0x6cc0ffff,0x3fe207ff,0x3fffea0f,
0x41bf604f,0xfffffffa,0x0efb84ff,0x3ffffff2,0xfd802fff,0x11ff880d,
0x54ffa3ff,0x000000ff,0x44000000,0x3fea3fff,0x3ee6ff60,0x8fc46a0f,
0x717fa238,0x557641df,0x7ec5d88a,0x7d40ff23,0x1731be65,0x32049fb1,
0x3f7fe23f,0x897ffc07,0x05fd10ff,0x5107fbf5,0x55555555,0x543be603,
0xebbbbbbb,0x01fec02f,0xd1fe83fa,0x001fe67f,0x00000000,0x3e0ffe20,
0xfc8bf31f,0x5cfd3fa3,0x57fa20ff,0x27e60efb,0x3f8afcfa,0x0fe83fa2,
0x07fa0fe8,0x7ec0bf70,0x03fc45c2,0x1fd4bfea,0x75ba13ea,0x8800000f,
0x05f90009,0x808004c4,0x3fccbf60,0x00000000,0x83fc4000,0xa87f52fd,
0x77f7544f,0xefe880bf,0x6ab5c0ef,0xbf317299,0x8ff22fcc,0x7f4403fc,
0x027ff542,0xff880ff1,0x4f987f70,0x44f98fdc,0x99999998,0x20000099,
0x000002fc,0x37c4bf60,0x00000000,0x837c4000,0xb8bf32fd,0x1ffe883f,
0x407ff440,0x21ddf54d,0x362fc86b,0x7ccdf12f,0x42ff4406,0x103ffdc9,
0x25fc80ff,0x117e45f9,0x2a1fd8bf,0xffffffff,0x3200004f,0x0000002f,
0x037c47f2,0x00000000,0xd837c400,0x223ff12f,0x37f220fe,0xf701dfdf,
0x2ab90bff,0x88b90fae,0xd8df10ff,0x5407f62f,0x7f9804ff,0xd910ff10,
0xbdfe81df,0x207e46fd,0x2eee66f8,0x02bbbbbb,0x00000000,0x00000000,
0x00000000,0x17ec1be2,0x87ffdff7,0xfd33f2fe,0xfe8efb81,0xdb547d45,
0x22fd89d4,0x137c42fd,0xbffb81df,0xff700999,0x3a61fe20,0xfffb102d,
0xb827cc19,0x6d40003f,0x2ca8103d,0xffb80dcc,0x55534fff,0x00000555,
0x00000000,0x7ec1be20,0x40e6e4c2,0x20c3f109,0xbfd10efb,0x99339dd8,
0xf527dc1f,0xfb93ee0b,0x3ffffe25,0xffddb2ff,0xffffe85f,0x010001ff,
0x00130062,0x2ffffdc0,0x7ffccbee,0x503fff11,0x3a799999,0x007fffff,
0x00000000,0x0df10000,0x10000bf6,0x2077405f,0x3ba20fe8,0x741fda9b,
0xfd007f46,0x999076c1,0x3ae39999,0xccb80bde,0x0000cccc,0x80000000,
0x8dfd89fe,0xfff50fd8,0x00fffe65,0x333332e0,0x00000004,0x10000000,
0x4cbf60df,0x3eeeeeee,0x04401510,0xdfb70088,0x00202019,0x00000101,
0x00000000,0x7c400000,0x2ffffec5,0x1ffd1bfa,0x00000000,0x00000000,
0x20df1000,0xdddd32fd,0x00007ddd,0x00000000,0x00000000,0x00000000,
0x06a00000,0x80413bae,0x00000009,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
};
static signed short stb__consolas_24_latin1_x[224] = { 0,5,3,0,1,0,0,5,3,3,1,0,2,3,
4,1,1,1,1,1,0,2,1,1,1,1,4,2,1,1,2,3,0,0,1,1,1,2,2,0,1,2,2,1,
2,0,1,0,1,0,1,1,1,1,0,0,0,0,1,4,1,3,1,0,0,1,1,1,1,1,0,1,1,2,
1,2,2,1,1,1,1,1,2,2,0,1,0,0,0,0,1,1,5,2,0,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,5,1,1,1,0,
5,1,0,0,2,1,1,3,1,0,2,1,2,3,0,1,1,4,5,2,2,1,0,0,0,2,0,0,0,0,
0,0,-1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,1,0,0,
0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,
};
static signed short stb__consolas_24_latin1_y[224] = { 17,0,0,1,-1,0,0,0,-1,-1,0,4,13,9,
13,0,1,1,1,1,1,1,1,1,1,1,5,5,4,7,4,0,0,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,20,0,5,0,5,0,5,0,5,0,0,
0,0,0,5,5,5,5,5,5,5,1,5,5,5,5,5,5,0,-3,0,8,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,17,5,-1,1,2,1,
-3,0,0,1,1,5,9,9,0,1,0,2,0,0,0,5,0,8,17,0,1,5,0,0,0,5,-3,-3,-3,-3,
-3,-4,1,1,-3,-3,-3,-3,-3,-3,-3,-3,1,-3,-3,-3,-3,-3,-3,5,-1,-3,-3,-3,-3,-3,1,0,0,0,
0,0,0,-1,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,2,0,0,0,0,0,0,0,
};
static unsigned short stb__consolas_24_latin1_w[224] = { 0,4,8,13,11,13,14,3,8,7,11,13,7,8,
5,11,12,11,11,11,13,10,11,11,11,11,5,7,10,11,10,8,14,14,11,11,12,10,10,12,11,10,9,12,
10,13,11,13,11,14,12,11,12,11,14,13,13,14,11,6,11,7,11,14,8,11,11,11,11,11,13,12,11,10,
10,11,10,12,11,12,11,11,11,10,12,11,13,13,13,13,11,10,3,10,13,12,12,12,12,12,12,12,12,12,
12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,4,10,11,12,13,
3,11,11,14,9,11,11,8,11,10,9,11,9,8,12,12,11,5,3,9,9,11,13,13,13,8,14,14,14,14,
14,14,14,11,12,12,12,12,12,12,12,12,13,12,13,13,13,13,13,11,13,12,12,12,12,14,11,11,12,12,
12,12,12,12,13,11,12,12,12,12,12,12,12,12,11,12,13,13,13,13,13,13,12,12,12,12,12,13,11,13,
};
static unsigned short stb__consolas_24_latin1_h[224] = { 0,18,6,16,21,18,18,6,23,23,11,13,9,3,
5,20,17,16,16,17,16,17,17,16,17,16,13,17,14,7,14,18,22,16,16,17,16,16,16,17,16,16,17,16,
16,16,16,17,16,21,16,17,16,17,16,16,16,16,16,22,20,22,9,2,6,13,18,13,18,13,17,17,17,17,
22,17,17,12,12,13,17,17,12,13,17,13,12,12,12,17,12,22,25,22,5,16,16,16,16,16,16,16,16,16,
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,0,17,21,16,15,16,
25,20,6,17,12,11,6,3,11,5,9,15,10,10,6,17,20,5,4,10,12,11,17,17,17,17,20,20,20,20,
20,21,16,20,20,20,20,20,20,20,20,20,16,20,21,21,21,21,21,11,21,21,21,21,21,20,16,18,18,18,
18,18,18,19,13,16,18,18,18,18,17,17,17,17,18,17,18,18,18,18,18,13,18,18,18,18,18,22,22,22,
};
static unsigned short stb__consolas_24_latin1_s[224] = { 252,250,247,62,40,106,104,252,17,9,70,
48,159,238,215,91,183,221,233,12,36,1,222,13,152,220,247,223,37,189,26,
40,100,232,1,24,194,183,25,36,50,76,49,87,245,112,196,1,100,129,207,
164,208,176,181,167,153,138,126,34,146,26,177,26,201,62,119,127,171,139,65,
15,40,245,89,74,141,176,48,74,79,28,225,151,52,87,237,211,162,231,189,
41,1,64,201,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,252,247,157,
143,1,103,5,186,235,59,201,118,210,238,94,227,167,14,130,140,222,196,79,
221,252,149,60,106,86,113,127,201,198,213,66,118,103,52,155,67,133,173,14,
27,241,1,40,53,129,228,168,182,196,210,224,82,238,1,14,27,144,158,117,
94,172,185,198,211,131,81,99,91,133,159,146,120,234,209,210,188,224,100,236,
49,157,90,63,113,144,27,1,77,14,75,52,115, };
static unsigned short stb__consolas_24_latin1_t[224] = { 13,49,156,125,27,49,70,1,1,1,156,
142,156,163,163,27,70,125,125,89,125,89,70,125,89,107,107,89,142,156,142,
70,1,107,125,89,107,107,125,89,125,125,89,125,125,125,125,107,125,1,107,
89,125,89,125,125,125,125,125,1,27,1,156,24,156,142,70,142,70,142,107,
107,107,89,1,89,89,142,156,142,107,107,142,142,107,142,142,142,142,89,142,
1,1,1,163,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,13,70,1,
107,142,107,1,27,156,89,142,156,156,163,156,163,156,142,156,156,156,70,27,
163,8,156,156,156,89,89,89,89,27,27,49,27,27,27,107,27,27,27,49,
49,27,49,49,49,107,27,1,1,1,1,1,156,1,27,27,27,1,27,107,
49,49,49,49,49,70,49,142,107,49,49,49,49,70,70,89,89,49,89,49,
70,70,70,70,142,70,70,70,70,70,1,1,1, };
static unsigned short stb__consolas_24_latin1_a[224] = { 211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,211,
211,211,211,211,211,211,211,211, };
// Call this function with
// font: NULL or array length
// data: NULL or specified size
// height: STB_FONT_consolas_24_latin1_BITMAP_HEIGHT or STB_FONT_consolas_24_latin1_BITMAP_HEIGHT_POW2
// return value: spacing between lines
static void stb_font_consolas_24_latin1(stb_fontchar font[STB_FONT_consolas_24_latin1_NUM_CHARS],
unsigned char data[STB_FONT_consolas_24_latin1_BITMAP_HEIGHT][STB_FONT_consolas_24_latin1_BITMAP_WIDTH],
int height)
{
int i, j;
if (data != 0) {
unsigned int* bits = stb__consolas_24_latin1_pixels;
unsigned int bitpack = *bits++, numbits = 32;
for (i = 0; i < STB_FONT_consolas_24_latin1_BITMAP_WIDTH * height; ++i)
data[0][i] = 0; // zero entire bitmap
for (j = 1; j < STB_FONT_consolas_24_latin1_BITMAP_HEIGHT - 1; ++j) {
for (i = 1; i < STB_FONT_consolas_24_latin1_BITMAP_WIDTH - 1; ++i) {
unsigned int value;
if (numbits == 0) bitpack = *bits++, numbits = 32;
value = bitpack & 1;
bitpack >>= 1, --numbits;
if (value) {
if (numbits < 3) bitpack = *bits++, numbits = 32;
data[j][i] = (bitpack & 7) * 0x20 + 0x1f;
bitpack >>= 3, numbits -= 3;
}
else {
data[j][i] = 0;
}
}
}
}
// build font description
if (font != 0) {
float recip_width = 1.0f / STB_FONT_consolas_24_latin1_BITMAP_WIDTH;
float recip_height = 1.0f / height;
for (i = 0; i < STB_FONT_consolas_24_latin1_NUM_CHARS; ++i) {
// pad characters so they bilerp from empty space around each character
font[i].s0 = (stb__consolas_24_latin1_s[i]) * recip_width;
font[i].t0 = (stb__consolas_24_latin1_t[i]) * recip_height;
font[i].s1 = (stb__consolas_24_latin1_s[i] + stb__consolas_24_latin1_w[i]) * recip_width;
font[i].t1 = (stb__consolas_24_latin1_t[i] + stb__consolas_24_latin1_h[i]) * recip_height;
font[i].x0 = stb__consolas_24_latin1_x[i];
font[i].y0 = stb__consolas_24_latin1_y[i];
font[i].x1 = stb__consolas_24_latin1_x[i] + stb__consolas_24_latin1_w[i];
font[i].y1 = stb__consolas_24_latin1_y[i] + stb__consolas_24_latin1_h[i];
font[i].advance_int = (stb__consolas_24_latin1_a[i] + 8) >> 4;
font[i].s0f = (stb__consolas_24_latin1_s[i] - 0.5f) * recip_width;
font[i].t0f = (stb__consolas_24_latin1_t[i] - 0.5f) * recip_height;
font[i].s1f = (stb__consolas_24_latin1_s[i] + stb__consolas_24_latin1_w[i] + 0.5f) * recip_width;
font[i].t1f = (stb__consolas_24_latin1_t[i] + stb__consolas_24_latin1_h[i] + 0.5f) * recip_height;
font[i].x0f = stb__consolas_24_latin1_x[i] - 0.5f;
font[i].y0f = stb__consolas_24_latin1_y[i] - 0.5f;
font[i].x1f = stb__consolas_24_latin1_x[i] + stb__consolas_24_latin1_w[i] + 0.5f;
font[i].y1f = stb__consolas_24_latin1_y[i] + stb__consolas_24_latin1_h[i] + 0.5f;
font[i].advance = stb__consolas_24_latin1_a[i] / 16.0f;
}
}
}
#ifndef STB_SOMEFONT_CREATE
#define STB_SOMEFONT_CREATE stb_font_consolas_24_latin1
#define STB_SOMEFONT_BITMAP_WIDTH STB_FONT_consolas_24_latin1_BITMAP_WIDTH
#define STB_SOMEFONT_BITMAP_HEIGHT STB_FONT_consolas_24_latin1_BITMAP_HEIGHT
#define STB_SOMEFONT_BITMAP_HEIGHT_POW2 STB_FONT_consolas_24_latin1_BITMAP_HEIGHT_POW2
#define STB_SOMEFONT_FIRST_CHAR STB_FONT_consolas_24_latin1_FIRST_CHAR
#define STB_SOMEFONT_NUM_CHARS STB_FONT_consolas_24_latin1_NUM_CHARS
#define STB_SOMEFONT_LINE_SPACING STB_FONT_consolas_24_latin1_LINE_SPACING
#endif | [
"wishaldhiraj@gmail.com"
] | wishaldhiraj@gmail.com |
53cf63979a0d9aadf85dc7cc78a2fe7dc8883dc2 | 77bfdfce66c76e75016585a4401ea450f70d0647 | /PRAC7/main_prac7.cpp | 6336ca435dccf0079e11c8fa66db9aa39f6c2164 | [] | no_license | Ernsst/lab | 57b33cecbbcacff2fc57130adcbcb2c813fe150f | 39e30b1e97a3910272f0e28b03e8433f0def7e52 | refs/heads/master | 2020-03-26T01:04:57.717997 | 2018-11-02T19:35:56 | 2018-11-02T19:35:56 | 144,351,186 | 0 | 0 | null | null | null | null | ISO-8859-1 | C++ | false | false | 12,655 | cpp | //Semestre 2019 - 1
//************************************************************//
//************************************************************//
//************** Alumno (s): *********************************//
//************* HERNANDEZ HINOJOSA ERNESTO
// ACTIVIDAD DE de lab PRACTICA 67 ******//
//************* SE IMPLEMENTO DESDE VISUAL STUDIO 2017 ******//
//la animacion corre sin teclas, para navegar son las teclas que nos proporciono el prof.
//************************************************************//
#include "Main.h"
// Variables used to calculate frames per second: (Windows)
DWORD dwFrames = 0;
DWORD dwCurrentTime = 0;
DWORD dwLastUpdateTime = 0;
DWORD dwElapsedTime = 0;
//Variables used to create movement
int sol=0;
int mercurio = 0;
int lunaT = 0;
int marteT = 0;
int marteT2 = 0;
int jupiterT = 0;
int jupiterT2= 0;
int jupiterT3 = 0;
int saturnoT = 0;
int saturnoT2 = 0;
float camaraZ = 0.0;
float camaraX = 0.0;
GLfloat SunDiffuse[] = { 1.0f, 1.0f, 1.0f, 1.0f }; // Diffuse Light Values
GLfloat SunSpecular[] = { 1.0, 1.0, 1.0, 1.0 }; // Specular Light Values
GLfloat SunPosition[] = { 0.0f, 0.0f, 0.0f, 1.0f }; // Light Position
GLfloat MercuryDiffuse[] = { 1.0f, 1.0f, 1.0f, .0f }; // Mercurio
GLfloat MercurySpecular[] = { 2.0, 2.5, 2.5, 1.0 };
GLfloat MercuryShininess[] = { 50.0 };
GLfloat VenusDiffuse[] = { 0.97f, 0.95f, 0.7f, 1.0f }; // Venus
GLfloat VenusSpecular[] = { 2.0, 2.5, 2.5, 1.0 };
GLfloat VenusShininess[] = { 50.0 };
GLfloat EarthDiffuse[] = { 0.2f, 0.2f, 1.0f, 1.0f }; // Tierra
GLfloat EarthSpecular[] = { 0.8, 0.8, 0.8, 1.0 };
GLfloat EarthShininess[] = { 50.0 };
GLfloat MDiffuse[] = { 0.5f, 0.2f, 0.6f, 1.0f };
GLfloat MSpecular[] = { 0.3, 0.4, 0.2, 1.0 };
GLfloat MShininess[] = { 50.0 };
GLfloat M2Diffuse[] = { 0.2f, 0.9f, 0.2f, 1.0f };
GLfloat M2Specular[] = { 0.3, 1.0, 1.0, 1.0 };
GLfloat M2Shininess[] = { 70.0 };
GLfloat MoonDiffuse[] = { 0.8f, 0.8f, 0.8f, 1.0f }; // Luna
GLfloat MoonSpecular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat MoonShininess[] = { 50.0 };
GLfloat MarsDiffuse[] = { 0.8f, 0.4f, 0.1f, 1.0f }; // Marte
GLfloat MarsSpecular[] = { 1.0, 0.5, 0.0, 1.0 };
GLfloat MarsShininess[] = { 50.0 };
GLfloat JupiterDiffuse[] = { 0.7f, 0.8f, 0.7f, 1.0f }; // Jupiter
GLfloat JupiterSpecular[] = { 1.0, 0.5, 0.0, 1.0 };
GLfloat JupiterShininess[] = { 50.0 };
GLfloat Sat1Diffuse[] = { 0.9f, 0.9f, 0.8f, 1.0f }; // Jupiter Sat1
GLfloat Sat1Specular[] = { 1.0, 0.5, 0.0, 1.0 };
GLfloat Sat1Shininess[] = { 50.0 };
GLfloat Sat2Diffuse[] = { 0.7f, 0.4f, 0.2f, 1.0f }; // Jupiter Sat2
GLfloat Sat2Specular[] = { 1.0, 0.5, 0.0, 1.0 };
GLfloat Sat2Shininess[] = { 50.0 };
GLfloat Sat3Diffuse[] = { 0.5f, 0.6f, 0.2f, 1.0f }; // Jupiter Sat3
GLfloat Sat3Specular[] = { 1.0, 1.0, 1.0, 1.0 };
GLfloat Sat3Shininess[] = { 50.0 };
GLfloat SaturnoDiffuse[] = { 0.9f, 0.9f, 0.55f, 1.0f }; // Saturno
GLfloat SaturnoSpecular[] = { 1.0, 0.5, 0.0, 1.0 };
GLfloat SaturnoShininess[] = { 50.0 };
GLfloat AnilloDiffuse[] = { 0.9f, 0.5f, 0.2f, 1.0f }; // Saturno Anillo
GLfloat AnilloSpecular[] = { 1.0, 0.5, 0.0, 1.0 };
GLfloat AnilloShininess[] = { 50.0 };
GLfloat UranoDiffuse[] = { 0.4f, 0.0f, 1.0f, 1.0f }; //Urano
GLfloat UranoSpecular[] = { 1.0, 0.5, 0.0, 1.0 };
GLfloat UranoShininess[] = { 50.0 };
GLfloat NepDiffuse[] = { 0.25f, 0.8f, 0.7f, 1.0f }; //Neptuno
GLfloat NepSpecular[] = { 1.0, 0.5, 0.0, 1.0 };
GLfloat NepShininess[] = { 50.0 };
void InitGL ( GLvoid ) // Inicializamos parametros
{
glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Negro de fondo
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT1);
glLightfv(GL_LIGHT1, GL_DIFFUSE, SunDiffuse);
glLightfv(GL_LIGHT1, GL_SPECULAR, SunDiffuse);
glClearDepth(1.0f); // Configuramos Depth Buffer
glEnable(GL_DEPTH_TEST); // Habilitamos Depth Testing
glDepthFunc(GL_LEQUAL); // Tipo de Depth Testing a realizar
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
}
void display ( void ) // Creamos la funcion donde se dibuja
{
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glTranslatef(camaraX,0.0,-5.0+camaraZ); //camara
glPushMatrix();
glRotatef(sol, 0.0, 1.0, 0.0); //El Sol gira sobre su eje pivote traslasuci
glPushMatrix(); //general
glColor3f(1.0, 1.0, 0.0); //Sol amarillo
glDisable(GL_LIGHTING);
glutSolidSphere(1.9, 50, 50); //Draw Sun (radio,H,V);
glEnable(GL_LIGHTING);
glPopMatrix();
glPushMatrix(); //mercurio
glRotatef(sol, 0, 1, 0); //traslación
glTranslatef(3.2,0,0); //distancia del sol
//pivote para que rote
glRotatef(mercurio, 0, 1,0); //Rotacion
glColor3f(0.2,1.0,0.4);
glMaterialfv(GL_FRONT, GL_DIFFUSE, MercuryDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, MercurySpecular);
glMaterialfv(GL_FRONT, GL_SHININESS, MercuryShininess);
glutSolidSphere(0.3,50,50);
glPopMatrix();
glPushMatrix(); //venus
glRotatef(sol, 0, 1, 0); //traslación
glTranslatef(5.0, 0, 0); //distancia del sol
//pivote para que rote
glRotatef(mercurio, 0, 1, 0); //Rotacion
glColor3f(1.0, 0.2, 0.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, VenusDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, VenusSpecular);
glMaterialfv(GL_FRONT, GL_SHININESS, VenusShininess);
glutSolidSphere(0.5, 50, 50);
glPopMatrix();
glPushMatrix(); //tierra
glRotatef(sol, 0, 1, 0); //traslación
glTranslatef(8.2, 0, 0); //distancia del sol
//pivote para que rote
glRotatef(lunaT, 0, 1, 0); //Rotacion
glColor3f(0.0, 0.0, 1.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, EarthDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, EarthSpecular);
glMaterialfv(GL_FRONT, GL_SHININESS, EarthShininess);
glutSolidSphere(0.7, 50, 50);
glRotatef(45, 1, 0, 0); //luna acomodado a 45
glColor3f(1.0, 1.0, 1.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, MoonDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, MoonSpecular);
glMaterialfv(GL_FRONT, GL_SHININESS, MoonShininess);
glTranslatef(1.5, 0, 0);
glutSolidSphere(0.3, 50, 50 );
glPopMatrix();
glPushMatrix(); //marte
glRotatef(sol, 0, 1, 0); //traslación
glTranslatef(14.2, 0, 0); //distancia del sol
//pivote para que rote
glRotatef(marteT, 0, 1, 0); //Rotacion
glColor3f(0.5, 0.07, 0.3);
glMaterialfv(GL_FRONT, GL_DIFFUSE, MarsDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, MarsSpecular);
glMaterialfv(GL_FRONT, GL_SHININESS, MarsShininess);
glutSolidSphere(0.4, 50, 50);
glPushMatrix();
glRotatef(marteT2, 1, 0, 0); //luna acomodado a 45
glColor3f(0.3, 1.0, 1.0);
glTranslatef(1.5, 0, 0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, MDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, MSpecular);
glMaterialfv(GL_FRONT, GL_SHININESS, MShininess);
glutSolidSphere(0.2, 50, 50);
glPushMatrix();
glRotatef(45, 1, 0, 0); //luna2 acomodado a 45
glColor3f(1.0, 0.5, 1.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, M2Diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, M2Specular);
glMaterialfv(GL_FRONT, GL_SHININESS, M2Shininess);
glTranslatef(1.5, 0, 0);
glutSolidSphere(0.2, 50, 50);
glPopMatrix();
glPopMatrix();
glPopMatrix();
glPushMatrix(); //jupiter
glRotatef(sol, 0, 1, 0); //traslación
glTranslatef(22.2, 0, 0); //distancia del sol
//pivote para que rote
glRotatef(jupiterT, 0, 1, 0); //Rotacion
glColor3f(1.0, 0.5019, 0.0);
glMaterialfv(GL_FRONT, GL_DIFFUSE, JupiterDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, JupiterSpecular);
glMaterialfv(GL_FRONT, GL_SHININESS, JupiterShininess);
glutSolidSphere(1, 50, 50);
glPushMatrix();
glRotatef(45, 1, 0, 0); //luna acomodado a 45
glColor3f(0.6, 0.0, 0.0);
glTranslatef(1.5, 0, 0);
glutSolidSphere(0.3, 50, 50);
glPushMatrix();
glRotatef(-jupiterT2, 1, 0, 0); //luna2 acomodado a 45
glColor3f(1.0, 0.4, 0.4);
glTranslatef(1.5, 0, 0);
glutSolidSphere(0.3, 50, 50);
glPushMatrix();
glRotatef(-jupiterT3, 1, 0, 0); //luna3 acomodado a 45
glColor3f(0.2, 1.0, 1.0);
glTranslatef(1.5, 0, 0);
glutSolidSphere(0.3, 50, 50);
glPopMatrix();
glPopMatrix();
glPopMatrix();
glPopMatrix();
glPushMatrix(); //saturno
glRotatef(sol, 0, 1, 0); //traslación
glTranslatef(30.2, 0, 0); //distancia del sol
//pivote para que rote
glRotatef(saturnoT, 0, 1, 0); //Rotacion
glColor3f(0.5, 0.5, 0.5);
glMaterialfv(GL_FRONT, GL_DIFFUSE, Sat1Diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, Sat1Specular);
glMaterialfv(GL_FRONT, GL_SHININESS, Sat1Shininess);
glutSolidSphere(0.8, 50, 50);
glRotatef(45, 1, 0, 0); //toroide acomodado a 45
glColor3f(1.0, 1.0, 1.0);
glutSolidTorus(0.2, 0.7, 15, 15);
glRotatef(-45, 1, 0, 0); //toroide acomodado a 45
glColor3f(1.0, 0, 1.0);
glutSolidTorus(0.2, 0.7, 15, 15);
glPopMatrix();
glPushMatrix(); //saturno
glRotatef(sol, 0, 1, 0); //traslación
glTranslatef(35.2, 0, 0); //distancia del sol
//pivote para que rote
//glRotatef(mercurio, 0, 1, 0); //Rotacion
glColor3f(0.2, 1.0, 0.2);
glMaterialfv(GL_FRONT, GL_DIFFUSE, AnilloDiffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, AnilloSpecular);
glMaterialfv(GL_FRONT, GL_SHININESS, AnilloShininess);
glutSolidSphere(0.9, 50, 50);
glPopMatrix();
glPopMatrix();
glutSwapBuffers ( );
}
void animacion()
{
// Calculate the number of frames per one second:
//dwFrames++;
dwCurrentTime = GetTickCount(); // Even better to use timeGetTime()
dwElapsedTime = dwCurrentTime - dwLastUpdateTime;
if(dwElapsedTime >= 30)
{
sol = (sol - 1) % 360;
mercurio = (mercurio - 5) % 360;
lunaT = (lunaT - 5) % 360;
marteT = (marteT - 5) % 360;
marteT2 = (marteT2 +2) % 360;
jupiterT = (jupiterT - 4) % 360;
jupiterT2 = (jupiterT + 3) % 360;
jupiterT3 = (jupiterT2 - 4) % 360;
saturnoT = (saturnoT - 2) % 360;
saturnoT2 = (saturnoT - 2) % 360;
dwLastUpdateTime = dwCurrentTime;
}
glutPostRedisplay();
}
void reshape ( int width , int height ) // Creamos funcion Reshape
{
if (height==0) // Prevenir division entre cero
{
height=1;
}
glViewport(0,0,width,height);
glMatrixMode(GL_PROJECTION); // Seleccionamos Projection Matrix
glLoadIdentity();
// Tipo de Vista
glFrustum (-0.1, 0.1,-0.1, 0.1, 0.1, 50.0);
glMatrixMode(GL_MODELVIEW); // Seleccionamos Modelview Matrix
//glLoadIdentity();
}
void keyboard ( unsigned char key, int x, int y ) // Create Keyboard Function
{
switch ( key ) {
case 'w': //Movimientos de camara
case 'W':
camaraZ +=0.5f;
break;
case 's':
case 'S':
camaraZ -=0.5f;
break;
case 'a':
case 'A':
camaraX -= 0.5f;
break;
case 'd':
case 'D':
camaraX += 0.5f;
break;
case 'i': //Movimientos de Luz
case 'I':
break;
case 'k':
case 'K':
break;
case 'l': //Activamos/desactivamos luz
case 'L':
break;
case 27: // Cuando Esc es presionado...
exit ( 0 ); // Salimos del programa
break;
default: // Cualquier otra
break;
}
glutPostRedisplay();
}
void arrow_keys ( int a_keys, int x, int y ) // Funcion para manejo de teclas especiales (arrow keys)
{
switch ( a_keys ) {
case GLUT_KEY_UP: // Presionamos tecla ARRIBA...
break;
case GLUT_KEY_DOWN: // Presionamos tecla ABAJO...
break;
case GLUT_KEY_LEFT:
break;
case GLUT_KEY_RIGHT:
break;
default:
break;
}
glutPostRedisplay();
}
int main ( int argc, char** argv ) // Main Function
{
glutInit (&argc, argv); // Inicializamos OpenGL
glutInitDisplayMode (GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH); // Display Mode (Clores RGB y alpha | Buffer Doble )
glutInitWindowSize (500, 500); // Tamaño de la Ventana
glutInitWindowPosition (20, 60); //Posicion de la Ventana
glutCreateWindow ("Practica 6"); // Nombre de la Ventana
InitGL (); // Parametros iniciales de la aplicacion
glutDisplayFunc ( display ); //Indicamos a Glut función de dibujo
glutReshapeFunc ( reshape ); //Indicamos a Glut función en caso de cambio de tamano
glutKeyboardFunc ( keyboard ); //Indicamos a Glut función de manejo de teclado
glutSpecialFunc ( arrow_keys ); //Otras
glutIdleFunc ( animacion ); //por cada frame de dibujo
glutMainLoop ( ); //
return 0;
} | [
"ernestodezsa"
] | ernestodezsa |
c3fa1a2b3b8b2f3b9a0ed0a55a95ca6fde0f9f3c | 634b22b2690d05dbd6f7d6ef680db98cea7b85da | /src/bitcoin-cli.cpp | 9412d60be892b84b1fb7dcf27f1979518136fc68 | [
"MIT"
] | permissive | XGSTeam/nacacoin | f770a3e0275205395ddb88f26d946a271954e43c | 69c2ba19e1ea0c30e7bcc90ef6f0571be6a5c0c9 | refs/heads/master | 2023-04-20T20:24:49.054365 | 2021-04-26T22:00:00 | 2021-04-26T22:00:00 | 289,020,782 | 1 | 3 | MIT | 2020-10-04T18:45:41 | 2020-08-20T13:59:13 | C++ | UTF-8 | C++ | false | false | 22,622 | cpp | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <chainparamsbase.h>
#include <clientversion.h>
#include <fs.h>
#include <rpc/client.h>
#include <rpc/protocol.h>
#include <util.h>
#include <utilstrencodings.h>
#include <memory>
#include <stdio.h>
#include <event2/buffer.h>
#include <event2/keyvalq_struct.h>
#include <support/events.h>
#include <univalue.h>
static const char DEFAULT_RPCCONNECT[] = "127.0.0.1";
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
static const bool DEFAULT_NAMED=false;
static const int CONTINUE_EXECUTION=-1;
static void SetupCliArgs()
{
const auto defaultBaseParams = CreateBaseChainParams(CBaseChainParams::MAIN);
const auto testnetBaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET);
gArgs.AddArg("-?", "This help message", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-version", "Print version and exit", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-conf=<file>", strprintf("Specify configuration file. Relative paths will be prefixed by datadir location. (default: %s)", BITCOIN_CONF_FILENAME), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-datadir=<dir>", "Specify data directory", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-getinfo", "Get general information from the remote server. Note that unlike server-side RPC calls, the results of -getinfo is the result of multiple non-atomic requests. Some entries in the result may represent results from different states (e.g. wallet balance may be as of a different block from the chain state reported)", false, OptionsCategory::OPTIONS);
SetupChainParamsBaseOptions();
gArgs.AddArg("-named", strprintf("Pass named instead of positional arguments (default: %s)", DEFAULT_NAMED), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcclienttimeout=<n>", strprintf("Timeout in seconds during HTTP requests, or 0 for no timeout. (default: %d)", DEFAULT_HTTP_CLIENT_TIMEOUT), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcconnect=<ip>", strprintf("Send commands to node running on <ip> (default: %s)", DEFAULT_RPCCONNECT), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpccookiefile=<loc>", _("Location of the auth cookie. Relative paths will be prefixed by a net-specific datadir location. (default: data dir)"), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcpassword=<pw>", "Password for JSON-RPC connections", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcport=<port>", strprintf("Connect to JSON-RPC on <port> (default: %u or testnet: %u)", defaultBaseParams->RPCPort(), testnetBaseParams->RPCPort()), false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcuser=<user>", "Username for JSON-RPC connections", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcwait", "Wait for RPC server to start", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcwallet=<walletname>", "Send RPC for non-default wallet on RPC server (needs to exactly match corresponding -wallet option passed to nacacoind)", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-stdin", "Read extra arguments from standard input, one per line until EOF/Ctrl-D (recommended for sensitive information such as passphrases). When combined with -stdinrpcpass, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
gArgs.AddArg("-stdinrpcpass", "Read RPC password from standard input as a single line. When combined with -stdin, the first line from standard input is used for the RPC password.", false, OptionsCategory::OPTIONS);
// Hidden
gArgs.AddArg("-h", "", false, OptionsCategory::HIDDEN);
gArgs.AddArg("-help", "", false, OptionsCategory::HIDDEN);
}
/** libevent event log callback */
static void libevent_log_cb(int severity, const char *msg)
{
#ifndef EVENT_LOG_ERR // EVENT_LOG_ERR was added in 2.0.19; but before then _EVENT_LOG_ERR existed.
# define EVENT_LOG_ERR _EVENT_LOG_ERR
#endif
// Ignore everything other than errors
if (severity >= EVENT_LOG_ERR) {
throw std::runtime_error(strprintf("libevent error: %s", msg));
}
}
//////////////////////////////////////////////////////////////////////////////
//
// Start
//
//
// Exception thrown on connection error. This error is used to determine
// when to wait if -rpcwait is given.
//
class CConnectionFailed : public std::runtime_error
{
public:
explicit inline CConnectionFailed(const std::string& msg) :
std::runtime_error(msg)
{}
};
//
// This function returns either one of EXIT_ codes when it's expected to stop the process or
// CONTINUE_EXECUTION when it's expected to continue further.
//
static int AppInitRPC(int argc, char* argv[])
{
//
// Parameters
//
SetupCliArgs();
std::string error;
if (!gArgs.ParseParameters(argc, argv, error)) {
fprintf(stderr, "Error parsing command line arguments: %s\n", error.c_str());
return EXIT_FAILURE;
}
if (argc < 2 || HelpRequested(gArgs) || gArgs.IsArgSet("-version")) {
std::string strUsage = PACKAGE_NAME " RPC client version " + FormatFullVersion() + "\n";
if (!gArgs.IsArgSet("-version")) {
strUsage += "\n"
"Usage: nacacoin-cli [options] <command> [params] Send command to " PACKAGE_NAME "\n"
"or: nacacoin-cli [options] -named <command> [name=value]... Send command to " PACKAGE_NAME " (with named arguments)\n"
"or: nacacoin-cli [options] help List commands\n"
"or: nacacoin-cli [options] help <command> Get help for a command\n";
strUsage += "\n" + gArgs.GetHelpMessage();
}
fprintf(stdout, "%s", strUsage.c_str());
if (argc < 2) {
fprintf(stderr, "Error: too few parameters\n");
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
if (!fs::is_directory(GetDataDir(false))) {
fprintf(stderr, "Error: Specified data directory \"%s\" does not exist.\n", gArgs.GetArg("-datadir", "").c_str());
return EXIT_FAILURE;
}
if (!gArgs.ReadConfigFiles(error, true)) {
fprintf(stderr, "Error reading configuration file: %s\n", error.c_str());
return EXIT_FAILURE;
}
// Check for -testnet or -regtest parameter (BaseParams() calls are only valid after this clause)
try {
SelectBaseParams(gArgs.GetChainName());
} catch (const std::exception& e) {
fprintf(stderr, "Error: %s\n", e.what());
return EXIT_FAILURE;
}
if (gArgs.GetBoolArg("-rpcssl", false))
{
fprintf(stderr, "Error: SSL mode for RPC (-rpcssl) is no longer supported.\n");
return EXIT_FAILURE;
}
return CONTINUE_EXECUTION;
}
/** Reply structure for request_done to fill in */
struct HTTPReply
{
HTTPReply(): status(0), error(-1) {}
int status;
int error;
std::string body;
};
static const char *http_errorstring(int code)
{
switch(code) {
#if LIBEVENT_VERSION_NUMBER >= 0x02010300
case EVREQ_HTTP_TIMEOUT:
return "timeout reached";
case EVREQ_HTTP_EOF:
return "EOF reached";
case EVREQ_HTTP_INVALID_HEADER:
return "error while reading header, or invalid header";
case EVREQ_HTTP_BUFFER_ERROR:
return "error encountered while reading or writing";
case EVREQ_HTTP_REQUEST_CANCEL:
return "request was canceled";
case EVREQ_HTTP_DATA_TOO_LONG:
return "response body is larger than allowed";
#endif
default:
return "unknown";
}
}
static void http_request_done(struct evhttp_request *req, void *ctx)
{
HTTPReply *reply = static_cast<HTTPReply*>(ctx);
if (req == nullptr) {
/* If req is nullptr, it means an error occurred while connecting: the
* error code will have been passed to http_error_cb.
*/
reply->status = 0;
return;
}
reply->status = evhttp_request_get_response_code(req);
struct evbuffer *buf = evhttp_request_get_input_buffer(req);
if (buf)
{
size_t size = evbuffer_get_length(buf);
const char *data = (const char*)evbuffer_pullup(buf, size);
if (data)
reply->body = std::string(data, size);
evbuffer_drain(buf, size);
}
}
#if LIBEVENT_VERSION_NUMBER >= 0x02010300
static void http_error_cb(enum evhttp_request_error err, void *ctx)
{
HTTPReply *reply = static_cast<HTTPReply*>(ctx);
reply->error = err;
}
#endif
/** Class that handles the conversion from a command-line to a JSON-RPC request,
* as well as converting back to a JSON object that can be shown as result.
*/
class BaseRequestHandler
{
public:
virtual ~BaseRequestHandler() {}
virtual UniValue PrepareRequest(const std::string& method, const std::vector<std::string>& args) = 0;
virtual UniValue ProcessReply(const UniValue &batch_in) = 0;
};
/** Process getinfo requests */
class GetinfoRequestHandler: public BaseRequestHandler
{
public:
const int ID_NETWORKINFO = 0;
const int ID_BLOCKCHAININFO = 1;
const int ID_WALLETINFO = 2;
/** Create a simulated `getinfo` request. */
UniValue PrepareRequest(const std::string& method, const std::vector<std::string>& args) override
{
if (!args.empty()) {
throw std::runtime_error("-getinfo takes no arguments");
}
UniValue result(UniValue::VARR);
result.push_back(JSONRPCRequestObj("getnetworkinfo", NullUniValue, ID_NETWORKINFO));
result.push_back(JSONRPCRequestObj("getblockchaininfo", NullUniValue, ID_BLOCKCHAININFO));
result.push_back(JSONRPCRequestObj("getwalletinfo", NullUniValue, ID_WALLETINFO));
return result;
}
/** Collect values from the batch and form a simulated `getinfo` reply. */
UniValue ProcessReply(const UniValue &batch_in) override
{
UniValue result(UniValue::VOBJ);
std::vector<UniValue> batch = JSONRPCProcessBatchReply(batch_in, 3);
// Errors in getnetworkinfo() and getblockchaininfo() are fatal, pass them on
// getwalletinfo() is allowed to fail in case there is no wallet.
if (!batch[ID_NETWORKINFO]["error"].isNull()) {
return batch[ID_NETWORKINFO];
}
if (!batch[ID_BLOCKCHAININFO]["error"].isNull()) {
return batch[ID_BLOCKCHAININFO];
}
result.pushKV("version", batch[ID_NETWORKINFO]["result"]["version"]);
result.pushKV("protocolversion", batch[ID_NETWORKINFO]["result"]["protocolversion"]);
if (!batch[ID_WALLETINFO].isNull()) {
result.pushKV("walletversion", batch[ID_WALLETINFO]["result"]["walletversion"]);
result.pushKV("balance", batch[ID_WALLETINFO]["result"]["balance"]);
}
result.pushKV("blocks", batch[ID_BLOCKCHAININFO]["result"]["blocks"]);
result.pushKV("timeoffset", batch[ID_NETWORKINFO]["result"]["timeoffset"]);
result.pushKV("connections", batch[ID_NETWORKINFO]["result"]["connections"]);
result.pushKV("proxy", batch[ID_NETWORKINFO]["result"]["networks"][0]["proxy"]);
result.pushKV("difficulty", batch[ID_BLOCKCHAININFO]["result"]["difficulty"]);
result.pushKV("testnet", UniValue(batch[ID_BLOCKCHAININFO]["result"]["chain"].get_str() == "test"));
if (!batch[ID_WALLETINFO].isNull()) {
result.pushKV("walletversion", batch[ID_WALLETINFO]["result"]["walletversion"]);
result.pushKV("balance", batch[ID_WALLETINFO]["result"]["balance"]);
result.pushKV("keypoololdest", batch[ID_WALLETINFO]["result"]["keypoololdest"]);
result.pushKV("keypoolsize", batch[ID_WALLETINFO]["result"]["keypoolsize"]);
if (!batch[ID_WALLETINFO]["result"]["unlocked_until"].isNull()) {
result.pushKV("unlocked_until", batch[ID_WALLETINFO]["result"]["unlocked_until"]);
}
result.pushKV("paytxfee", batch[ID_WALLETINFO]["result"]["paytxfee"]);
}
result.pushKV("relayfee", batch[ID_NETWORKINFO]["result"]["relayfee"]);
result.pushKV("warnings", batch[ID_NETWORKINFO]["result"]["warnings"]);
return JSONRPCReplyObj(result, NullUniValue, 1);
}
};
/** Process default single requests */
class DefaultRequestHandler: public BaseRequestHandler {
public:
UniValue PrepareRequest(const std::string& method, const std::vector<std::string>& args) override
{
UniValue params;
if(gArgs.GetBoolArg("-named", DEFAULT_NAMED)) {
params = RPCConvertNamedValues(method, args);
} else {
params = RPCConvertValues(method, args);
}
return JSONRPCRequestObj(method, params, 1);
}
UniValue ProcessReply(const UniValue &reply) override
{
return reply.get_obj();
}
};
static UniValue CallRPC(BaseRequestHandler *rh, const std::string& strMethod, const std::vector<std::string>& args)
{
std::string host;
// In preference order, we choose the following for the port:
// 1. -rpcport
// 2. port in -rpcconnect (ie following : in ipv4 or ]: in ipv6)
// 3. default port for chain
int port = BaseParams().RPCPort();
SplitHostPort(gArgs.GetArg("-rpcconnect", DEFAULT_RPCCONNECT), port, host);
port = gArgs.GetArg("-rpcport", port);
// Obtain event base
raii_event_base base = obtain_event_base();
// Synchronously look up hostname
raii_evhttp_connection evcon = obtain_evhttp_connection_base(base.get(), host, port);
evhttp_connection_set_timeout(evcon.get(), gArgs.GetArg("-rpcclienttimeout", DEFAULT_HTTP_CLIENT_TIMEOUT));
HTTPReply response;
raii_evhttp_request req = obtain_evhttp_request(http_request_done, (void*)&response);
if (req == nullptr)
throw std::runtime_error("create http request failed");
#if LIBEVENT_VERSION_NUMBER >= 0x02010300
evhttp_request_set_error_cb(req.get(), http_error_cb);
#endif
// Get credentials
std::string strRPCUserColonPass;
bool failedToGetAuthCookie = false;
if (gArgs.GetArg("-rpcpassword", "") == "") {
// Try fall back to cookie-based authentication if no password is provided
if (!GetAuthCookie(&strRPCUserColonPass)) {
failedToGetAuthCookie = true;
}
} else {
strRPCUserColonPass = gArgs.GetArg("-rpcuser", "") + ":" + gArgs.GetArg("-rpcpassword", "");
}
struct evkeyvalq* output_headers = evhttp_request_get_output_headers(req.get());
assert(output_headers);
evhttp_add_header(output_headers, "Host", host.c_str());
evhttp_add_header(output_headers, "Connection", "close");
evhttp_add_header(output_headers, "Authorization", (std::string("Basic ") + EncodeBase64(strRPCUserColonPass)).c_str());
// Attach request data
std::string strRequest = rh->PrepareRequest(strMethod, args).write() + "\n";
struct evbuffer* output_buffer = evhttp_request_get_output_buffer(req.get());
assert(output_buffer);
evbuffer_add(output_buffer, strRequest.data(), strRequest.size());
// check if we should use a special wallet endpoint
std::string endpoint = "/";
if (!gArgs.GetArgs("-rpcwallet").empty()) {
std::string walletName = gArgs.GetArg("-rpcwallet", "");
char *encodedURI = evhttp_uriencode(walletName.c_str(), walletName.size(), false);
if (encodedURI) {
endpoint = "/wallet/"+ std::string(encodedURI);
free(encodedURI);
}
else {
throw CConnectionFailed("uri-encode failed");
}
}
int r = evhttp_make_request(evcon.get(), req.get(), EVHTTP_REQ_POST, endpoint.c_str());
req.release(); // ownership moved to evcon in above call
if (r != 0) {
throw CConnectionFailed("send http request failed");
}
event_base_dispatch(base.get());
if (response.status == 0) {
std::string responseErrorMessage;
if (response.error != -1) {
responseErrorMessage = strprintf(" (error code %d - \"%s\")", response.error, http_errorstring(response.error));
}
throw CConnectionFailed(strprintf("Could not connect to the server %s:%d%s\n\nMake sure the nacacoind server is running and that you are connecting to the correct RPC port.", host, port, responseErrorMessage));
} else if (response.status == HTTP_UNAUTHORIZED) {
if (failedToGetAuthCookie) {
throw std::runtime_error(strprintf(
"Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (%s)",
GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME)).string().c_str()));
} else {
throw std::runtime_error("Authorization failed: Incorrect rpcuser or rpcpassword");
}
} else if (response.status >= 400 && response.status != HTTP_BAD_REQUEST && response.status != HTTP_NOT_FOUND && response.status != HTTP_INTERNAL_SERVER_ERROR)
throw std::runtime_error(strprintf("server returned HTTP error %d", response.status));
else if (response.body.empty())
throw std::runtime_error("no response from server");
// Parse reply
UniValue valReply(UniValue::VSTR);
if (!valReply.read(response.body))
throw std::runtime_error("couldn't parse reply from server");
const UniValue reply = rh->ProcessReply(valReply);
if (reply.empty())
throw std::runtime_error("expected reply to have result, error and id properties");
return reply;
}
static int CommandLineRPC(int argc, char *argv[])
{
std::string strPrint;
int nRet = 0;
try {
// Skip switches
while (argc > 1 && IsSwitchChar(argv[1][0])) {
argc--;
argv++;
}
std::string rpcPass;
if (gArgs.GetBoolArg("-stdinrpcpass", false)) {
if (!std::getline(std::cin, rpcPass)) {
throw std::runtime_error("-stdinrpcpass specified but failed to read from standard input");
}
gArgs.ForceSetArg("-rpcpassword", rpcPass);
}
std::vector<std::string> args = std::vector<std::string>(&argv[1], &argv[argc]);
if (gArgs.GetBoolArg("-stdin", false)) {
// Read one arg per line from stdin and append
std::string line;
while (std::getline(std::cin, line)) {
args.push_back(line);
}
}
std::unique_ptr<BaseRequestHandler> rh;
std::string method;
if (gArgs.GetBoolArg("-getinfo", false)) {
rh.reset(new GetinfoRequestHandler());
method = "";
} else {
rh.reset(new DefaultRequestHandler());
if (args.size() < 1) {
throw std::runtime_error("too few parameters (need at least command)");
}
method = args[0];
args.erase(args.begin()); // Remove trailing method name from arguments vector
}
// Execute and handle connection failures with -rpcwait
const bool fWait = gArgs.GetBoolArg("-rpcwait", false);
do {
try {
const UniValue reply = CallRPC(rh.get(), method, args);
// Parse reply
const UniValue& result = find_value(reply, "result");
const UniValue& error = find_value(reply, "error");
if (!error.isNull()) {
// Error
int code = error["code"].get_int();
if (fWait && code == RPC_IN_WARMUP)
throw CConnectionFailed("server in warmup");
strPrint = "error: " + error.write();
nRet = abs(code);
if (error.isObject())
{
UniValue errCode = find_value(error, "code");
UniValue errMsg = find_value(error, "message");
strPrint = errCode.isNull() ? "" : "error code: "+errCode.getValStr()+"\n";
if (errMsg.isStr())
strPrint += "error message:\n"+errMsg.get_str();
if (errCode.isNum() && errCode.get_int() == RPC_WALLET_NOT_SPECIFIED) {
strPrint += "\nTry adding \"-rpcwallet=<filename>\" option to nacacoin-cli command line.";
}
}
} else {
// Result
if (result.isNull())
strPrint = "";
else if (result.isStr())
strPrint = result.get_str();
else
strPrint = result.write(2);
}
// Connection succeeded, no need to retry.
break;
}
catch (const CConnectionFailed&) {
if (fWait)
MilliSleep(1000);
else
throw;
}
} while (fWait);
}
catch (const boost::thread_interrupted&) {
throw;
}
catch (const std::exception& e) {
strPrint = std::string("error: ") + e.what();
nRet = EXIT_FAILURE;
}
catch (...) {
PrintExceptionContinue(nullptr, "CommandLineRPC()");
throw;
}
if (strPrint != "") {
fprintf((nRet == 0 ? stdout : stderr), "%s\n", strPrint.c_str());
}
return nRet;
}
int main(int argc, char* argv[])
{
SetupEnvironment();
if (!SetupNetworking()) {
fprintf(stderr, "Error: Initializing networking failed\n");
return EXIT_FAILURE;
}
event_set_log_callback(&libevent_log_cb);
try {
int ret = AppInitRPC(argc, argv);
if (ret != CONTINUE_EXECUTION)
return ret;
}
catch (const std::exception& e) {
PrintExceptionContinue(&e, "AppInitRPC()");
return EXIT_FAILURE;
} catch (...) {
PrintExceptionContinue(nullptr, "AppInitRPC()");
return EXIT_FAILURE;
}
int ret = EXIT_FAILURE;
try {
ret = CommandLineRPC(argc, argv);
}
catch (const std::exception& e) {
PrintExceptionContinue(&e, "CommandLineRPC()");
} catch (...) {
PrintExceptionContinue(nullptr, "CommandLineRPC()");
}
return ret;
}
| [
"lemurnaca@nacacoin.org"
] | lemurnaca@nacacoin.org |
d7a43deb1e82745ced4875072f6c300191700d3b | a68c444d56d0bb6b5e0bb8ccbb76bfb081ba6b07 | /CowNetControllerV4/us/cownet/timers/PeriodicEvent.cpp | f6904beac77f4bf84832848aec1cf13627c3b68c | [] | no_license | fitzpatricksrus/Pinduino | 03040b99bdc27daecf6743a63a1a9a5d6f1b0a51 | 45bfdd5ca34163dc44ceb91380d36a7307c4f2df | refs/heads/master | 2020-04-06T07:05:09.429566 | 2016-06-30T02:23:51 | 2016-06-30T02:23:51 | 24,709,921 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 731 | cpp | /*
* PeriodicEvent.cpp
*
* Created on: Jul 31, 2015
* Author: Dad
*/
#include "PeriodicEvent.h"
#include "TimerUtil.h"
namespace us_cownet_timers {
PeriodicEvent::PeriodicEvent(bool isTickerIn, unsigned long periodIn)
: isTickerEvent(isTickerIn), period(periodIn), lastEvent(0)
{
}
PeriodicEvent::PeriodicEvent(const PeriodicEvent& other)
: isTickerEvent(other.isTickerEvent), period(other.period), lastEvent(0)
{
}
PeriodicEvent::~PeriodicEvent() {
}
bool PeriodicEvent::isTime() {
unsigned long now = (isTickerEvent) ? TimerUtil::INSTANCE.currentTicks() : TimerUtil::INSTANCE.currentTimeMicros();
if (now - lastEvent > period) {
lastEvent = now;
return true;
} else {
return false;
}
}
} //namespace
| [
"junk@fitzpatircksr.us"
] | junk@fitzpatircksr.us |
196658722ecfa5b82998640163e6fe052431811f | c0a217968537f0d7e1acaf3b04c08369c6d5cfe1 | /Lab 3/lab3 Test.cpp | 96a9019ed7ac38ce954349f0c98b714b9c475501 | [] | no_license | Hanel32/C_Code_Dump | 6b7c9565a70d8ec5148dff1558424c53a03ec8a9 | e3784af922d40e952226a16cee6bffd31526770b | refs/heads/master | 2021-07-10T16:07:07.795528 | 2017-10-14T19:07:08 | 2017-10-14T19:07:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,542 | cpp | #include <stdio.h>
#include <math.h>
#include <conio.h>
float a, b, c, x, x1, x2;
float multi;
int caseC;
char cont = 'y';
int main()
{
void testModulation();
printf("\n\n\t\tSolve quadratic equation for giving A,B,C coefficient\n");
while(cont == 'y' || cont == 'Y')
{
caseC = 1;
printf("\n\t\t\tPlease input A: ");
scanf("%f", &a);
printf("\n\n\t\t\t\t B: ");
scanf("%f", &b);
printf("\n\n\t\t\t\t C: ");
scanf("%f", &c);
multi = (b*b) - (4.*a*c);
if(multi > 0)
{
caseC = 2;
}
else if(multi < 0)
{
caseC = 3;
}
else if(multi == 0)
{
caseC = 4;
}
switch(caseC)
{
case 1:
{
printf("\n\n\t\t\tInvalid entry. The program will now close. Press any button.");
}
case 2:
{
int testModulation();
}
case 3:
{
x1 = -b/(2*a);
x2 = sqrt(-multi)/(2*a);
printf("\n\t\tTwo complex roots, X1 = %.3f + %.3fi, X2 = %.3f - %.3fi",x1, x2, x1, x2);
printf("\n\n\t\t\tDo more (Y/N)? ");
scanf("%s", &cont);
break;
}
case 4:
{
if(a == 0 && b == 0 && c == 0)
{
printf("\n\t\t\tInfinite Solutions.");
printf("\n\n\t\t\tDo more (Y/N)? ");
scanf("%s", &cont);
break;
}
else if(a == 0 && b == 0 && c != 0)
{
printf("\n\t\t\tContradict Equation.");
printf("\n\n\t\t\tDo more (Y/N)? ");
scanf("%s", &cont);
break;
}
else
{
x1 = (-b + (sqrt(multi)))/(2.*a);
printf("\n\t\t\tRepeated root, X = %f", x1);
printf("\n\n\t\t\tDo more (Y/N)? ");
scanf("%s", &cont);
break;
}
}
default:
{
printf("Invalid input. Try again.");
break;
}
}
}
getch();
}
int testModulation()
{
if(a == 0 && b != 0 && c != 0)
{
x = -c / b;
printf("\n\t\t\tSingle Root. x = %f ", x);
printf("\n\n\t\t\tDo more (Y/N)? ");
scanf("%s", &cont);
}
else
{
x1 = (-b + (sqrt(multi)))/(2.*a);
x2 = (-b - (sqrt(multi)))/(2.*a);
printf("\n\t\t\tTwo real roots, X1 = %3.2f, X2 = %3.2f", x1, x2);
printf("\n\n\t\t\tDo more (Y/N)? ");
scanf("%s", &cont);
}
}
| [
"noreply@github.com"
] | Hanel32.noreply@github.com |
efeb2ed32cd21e132549e244c78a5273e7f3ee7a | 6e7b02f56aaf65f155886df5adee072429275168 | /xcode_pok2/Classes/Native/Bulk_UnityEngine.AudioModule_0.cpp | d630fe5ae501c39364665c044a751c03c024d404 | [] | no_license | zhaifengacm/HelloPokemon | 8e781fa7348a07c1a68a61e480f033fa435d7549 | d0950b0fffcf1bff35e0d22c9bf369da45d4ecd5 | refs/heads/master | 2020-06-03T13:59:40.882395 | 2019-06-12T23:41:12 | 2019-06-12T23:41:12 | 191,595,074 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 232,819 | cpp | #include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <cstring>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <limits>
#include <assert.h>
#include <stdint.h>
#include "il2cpp-class-internals.h"
#include "codegen/il2cpp-codegen.h"
#include "il2cpp-object-internals.h"
template <typename T1>
struct VirtActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeObject* obj, T1 p1)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
struct VirtActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename R>
struct VirtFuncInvoker0
{
typedef R (*Func)(void*, const RuntimeMethod*);
static inline R Invoke (Il2CppMethodSlot slot, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj);
return ((Func)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename T1, typename T2>
struct VirtActionInvoker2
{
typedef void (*Action)(void*, T1, T2, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeObject* obj, T1 p1, T2 p2)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_virtual_invoke_data(slot, obj);
((Action)invokeData.methodPtr)(obj, p1, p2, invokeData.method);
}
};
template <typename T1>
struct GenericVirtActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj, T1 p1)
{
VirtualInvokeData invokeData;
il2cpp_codegen_get_generic_virtual_invoke_data(method, obj, &invokeData);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
struct GenericVirtActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj)
{
VirtualInvokeData invokeData;
il2cpp_codegen_get_generic_virtual_invoke_data(method, obj, &invokeData);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename T1>
struct InterfaceActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj, T1 p1)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
struct InterfaceActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (Il2CppMethodSlot slot, RuntimeClass* declaringInterface, RuntimeObject* obj)
{
const VirtualInvokeData& invokeData = il2cpp_codegen_get_interface_invoke_data(slot, obj, declaringInterface);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
template <typename T1>
struct GenericInterfaceActionInvoker1
{
typedef void (*Action)(void*, T1, const RuntimeMethod*);
static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj, T1 p1)
{
VirtualInvokeData invokeData;
il2cpp_codegen_get_generic_interface_invoke_data(method, obj, &invokeData);
((Action)invokeData.methodPtr)(obj, p1, invokeData.method);
}
};
struct GenericInterfaceActionInvoker0
{
typedef void (*Action)(void*, const RuntimeMethod*);
static inline void Invoke (const RuntimeMethod* method, RuntimeObject* obj)
{
VirtualInvokeData invokeData;
il2cpp_codegen_get_generic_interface_invoke_data(method, obj, &invokeData);
((Action)invokeData.methodPtr)(obj, invokeData.method);
}
};
// UnityEngine.AudioClip
struct AudioClip_t3680889665;
// UnityEngine.Object
struct Object_t631007953;
// System.Single[]
struct SingleU5BU5D_t1444911251;
// UnityEngine.AudioClip/PCMReaderCallback
struct PCMReaderCallback_t1677636661;
// UnityEngine.AudioClip/PCMSetPositionCallback
struct PCMSetPositionCallback_t1059417452;
// System.IAsyncResult
struct IAsyncResult_t767004451;
// System.AsyncCallback
struct AsyncCallback_t3962456242;
// UnityEngine.AudioExtensionDefinition
struct AudioExtensionDefinition_t3271167678;
// System.Type
struct Type_t;
// System.String
struct String_t;
// System.String[]
struct StringU5BU5D_t1281789340;
// UnityEngine.AudioSourceExtension
struct AudioSourceExtension_t3064908834;
// UnityEngine.AudioSource
struct AudioSource_t3935305588;
// System.Collections.Generic.List`1<UnityEngine.AudioSpatializerExtensionDefinition>
struct List_1_t2069970928;
// System.Collections.Generic.List`1<System.Object>
struct List_1_t257213610;
// UnityEngine.AudioSpatializerExtensionDefinition
struct AudioSpatializerExtensionDefinition_t597896186;
// System.Collections.Generic.List`1<UnityEngine.AudioAmbisonicExtensionDefinition>
struct List_1_t1295534336;
// UnityEngine.AudioAmbisonicExtensionDefinition
struct AudioAmbisonicExtensionDefinition_t4118426890;
// UnityEngine.AudioListenerExtension
struct AudioListenerExtension_t3242956547;
// UnityEngine.AudioListener
struct AudioListener_t2734094699;
// System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension>
struct List_1_t242016280;
// UnityEngine.Behaviour
struct Behaviour_t1437897464;
// UnityEngine.ScriptableObject
struct ScriptableObject_t2528358522;
// UnityEngine.AudioSettings/AudioConfigurationChangeHandler
struct AudioConfigurationChangeHandler_t2089929874;
// UnityEngine.WebCamTexture
struct WebCamTexture_t1514609158;
// UnityEngine.Texture
struct Texture_t3661962703;
// UnityEngine.WebCamDevice[]
struct WebCamDeviceU5BU5D_t4294070825;
// UnityEngine.AudioSpatializerExtensionDefinition[]
struct AudioSpatializerExtensionDefinitionU5BU5D_t143577823;
// System.Char[]
struct CharU5BU5D_t3528271667;
// UnityEngine.AudioAmbisonicExtensionDefinition[]
struct AudioAmbisonicExtensionDefinitionU5BU5D_t954184591;
// UnityEngine.AudioSourceExtension[]
struct AudioSourceExtensionU5BU5D_t4125762839;
// System.Void
struct Void_t1185182177;
// System.Reflection.MethodInfo
struct MethodInfo_t;
// System.DelegateData
struct DelegateData_t1677132599;
// System.Type[]
struct TypeU5BU5D_t3940880105;
// System.Reflection.MemberFilter
struct MemberFilter_t426314064;
extern RuntimeClass* Object_t631007953_il2cpp_TypeInfo_var;
extern const uint32_t AudioClip__ctor_m1211547677_MetadataUsageId;
extern RuntimeClass* Int32_t2950945753_il2cpp_TypeInfo_var;
extern const uint32_t PCMSetPositionCallback_BeginInvoke_m2701134198_MetadataUsageId;
extern RuntimeClass* StringU5BU5D_t1281789340_il2cpp_TypeInfo_var;
extern RuntimeClass* String_t_il2cpp_TypeInfo_var;
extern RuntimeClass* Type_t_il2cpp_TypeInfo_var;
extern String_t* _stringLiteral3452614530;
extern String_t* _stringLiteral3450517380;
extern const uint32_t AudioExtensionDefinition_GetExtensionType_m1450823952_MetadataUsageId;
extern RuntimeClass* AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var;
extern const RuntimeMethod* List_1_GetEnumerator_m1716448724_RuntimeMethod_var;
extern const RuntimeMethod* Enumerator_get_Current_m615903654_RuntimeMethod_var;
extern const RuntimeMethod* Enumerator_MoveNext_m2697843606_RuntimeMethod_var;
extern const RuntimeMethod* Enumerator_Dispose_m3198901590_RuntimeMethod_var;
extern const uint32_t AudioExtensionManager_AddSpatializerExtension_m820561940_MetadataUsageId;
extern const RuntimeMethod* List_1_GetEnumerator_m2295013814_RuntimeMethod_var;
extern const RuntimeMethod* Enumerator_get_Current_m967136761_RuntimeMethod_var;
extern const RuntimeMethod* Enumerator_MoveNext_m1000499844_RuntimeMethod_var;
extern const RuntimeMethod* Enumerator_Dispose_m405442337_RuntimeMethod_var;
extern const uint32_t AudioExtensionManager_AddAmbisonicDecoderExtension_m3197702864_MetadataUsageId;
extern const uint32_t AudioExtensionManager_WriteExtensionProperties_m1988587615_MetadataUsageId;
extern const uint32_t AudioExtensionManager_AddSpatializerExtension_m3915849352_MetadataUsageId;
extern const uint32_t AudioExtensionManager_WriteExtensionProperties_m3028464154_MetadataUsageId;
extern const RuntimeMethod* List_1_Add_m2957197106_RuntimeMethod_var;
extern const RuntimeMethod* List_1_get_Count_m3844406869_RuntimeMethod_var;
extern const uint32_t AudioExtensionManager_AddExtensionToManager_m3475649283_MetadataUsageId;
extern const RuntimeMethod* List_1_get_Item_m1395253538_RuntimeMethod_var;
extern const RuntimeMethod* List_1_set_Item_m845928814_RuntimeMethod_var;
extern const RuntimeMethod* List_1_RemoveAt_m2462508318_RuntimeMethod_var;
extern const uint32_t AudioExtensionManager_RemoveExtensionFromManager_m442924172_MetadataUsageId;
extern RuntimeClass* AudioListener_t2734094699_il2cpp_TypeInfo_var;
extern const uint32_t AudioExtensionManager_Update_m3269307447_MetadataUsageId;
extern const uint32_t AudioExtensionManager_GetReadyToPlay_m1557263244_MetadataUsageId;
extern String_t* _stringLiteral4035105846;
extern const uint32_t AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104_MetadataUsageId;
extern RuntimeClass* List_1_t2069970928_il2cpp_TypeInfo_var;
extern RuntimeClass* List_1_t1295534336_il2cpp_TypeInfo_var;
extern RuntimeClass* List_1_t242016280_il2cpp_TypeInfo_var;
extern const RuntimeMethod* List_1__ctor_m3866378638_RuntimeMethod_var;
extern const RuntimeMethod* List_1__ctor_m4205755667_RuntimeMethod_var;
extern const RuntimeMethod* List_1__ctor_m69557434_RuntimeMethod_var;
extern const uint32_t AudioExtensionManager__cctor_m1361600190_MetadataUsageId;
extern RuntimeClass* AudioListenerExtension_t3242956547_il2cpp_TypeInfo_var;
extern const uint32_t AudioListener_AddExtension_m994751216_MetadataUsageId;
extern RuntimeClass* AudioSettings_t3587374600_il2cpp_TypeInfo_var;
extern const uint32_t AudioSettings_InvokeOnAudioConfigurationChanged_m3131294153_MetadataUsageId;
extern const uint32_t AudioSettings_InvokeOnAudioManagerUpdate_m4044425648_MetadataUsageId;
extern const uint32_t AudioSettings_InvokeOnAudioSourcePlay_m3298744573_MetadataUsageId;
extern RuntimeClass* Boolean_t97287965_il2cpp_TypeInfo_var;
extern const uint32_t AudioConfigurationChangeHandler_BeginInvoke_m4104069447_MetadataUsageId;
extern RuntimeClass* AudioSourceExtension_t3064908834_il2cpp_TypeInfo_var;
extern const uint32_t AudioSource_AddSpatializerExtension_m2560794359_MetadataUsageId;
extern const uint32_t AudioSource_AddAmbisonicExtension_m304476911_MetadataUsageId;
extern String_t* _stringLiteral757602046;
extern const uint32_t WebCamTexture__ctor_m2601640589_MetadataUsageId;
struct SingleU5BU5D_t1444911251;
struct StringU5BU5D_t1281789340;
struct WebCamDeviceU5BU5D_t4294070825;
#ifndef U3CMODULEU3E_T692745533_H
#define U3CMODULEU3E_T692745533_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// <Module>
struct U3CModuleU3E_t692745533
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // U3CMODULEU3E_T692745533_H
#ifndef RUNTIMEOBJECT_H
#define RUNTIMEOBJECT_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Object
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEOBJECT_H
struct Il2CppArrayBounds;
#ifndef RUNTIMEARRAY_H
#define RUNTIMEARRAY_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Array
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMEARRAY_H
#ifndef MEMBERINFO_T_H
#define MEMBERINFO_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Reflection.MemberInfo
struct MemberInfo_t : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MEMBERINFO_T_H
#ifndef LIST_1_T2069970928_H
#define LIST_1_T2069970928_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.AudioSpatializerExtensionDefinition>
struct List_1_t2069970928 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
AudioSpatializerExtensionDefinitionU5BU5D_t143577823* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t2069970928, ____items_1)); }
inline AudioSpatializerExtensionDefinitionU5BU5D_t143577823* get__items_1() const { return ____items_1; }
inline AudioSpatializerExtensionDefinitionU5BU5D_t143577823** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(AudioSpatializerExtensionDefinitionU5BU5D_t143577823* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t2069970928, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t2069970928, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
};
struct List_1_t2069970928_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
AudioSpatializerExtensionDefinitionU5BU5D_t143577823* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t2069970928_StaticFields, ___EmptyArray_4)); }
inline AudioSpatializerExtensionDefinitionU5BU5D_t143577823* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline AudioSpatializerExtensionDefinitionU5BU5D_t143577823** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(AudioSpatializerExtensionDefinitionU5BU5D_t143577823* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T2069970928_H
#ifndef STRING_T_H
#define STRING_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.String
struct String_t : public RuntimeObject
{
public:
// System.Int32 System.String::length
int32_t ___length_0;
// System.Char System.String::start_char
Il2CppChar ___start_char_1;
public:
inline static int32_t get_offset_of_length_0() { return static_cast<int32_t>(offsetof(String_t, ___length_0)); }
inline int32_t get_length_0() const { return ___length_0; }
inline int32_t* get_address_of_length_0() { return &___length_0; }
inline void set_length_0(int32_t value)
{
___length_0 = value;
}
inline static int32_t get_offset_of_start_char_1() { return static_cast<int32_t>(offsetof(String_t, ___start_char_1)); }
inline Il2CppChar get_start_char_1() const { return ___start_char_1; }
inline Il2CppChar* get_address_of_start_char_1() { return &___start_char_1; }
inline void set_start_char_1(Il2CppChar value)
{
___start_char_1 = value;
}
};
struct String_t_StaticFields
{
public:
// System.String System.String::Empty
String_t* ___Empty_2;
// System.Char[] System.String::WhiteChars
CharU5BU5D_t3528271667* ___WhiteChars_3;
public:
inline static int32_t get_offset_of_Empty_2() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___Empty_2)); }
inline String_t* get_Empty_2() const { return ___Empty_2; }
inline String_t** get_address_of_Empty_2() { return &___Empty_2; }
inline void set_Empty_2(String_t* value)
{
___Empty_2 = value;
Il2CppCodeGenWriteBarrier((&___Empty_2), value);
}
inline static int32_t get_offset_of_WhiteChars_3() { return static_cast<int32_t>(offsetof(String_t_StaticFields, ___WhiteChars_3)); }
inline CharU5BU5D_t3528271667* get_WhiteChars_3() const { return ___WhiteChars_3; }
inline CharU5BU5D_t3528271667** get_address_of_WhiteChars_3() { return &___WhiteChars_3; }
inline void set_WhiteChars_3(CharU5BU5D_t3528271667* value)
{
___WhiteChars_3 = value;
Il2CppCodeGenWriteBarrier((&___WhiteChars_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // STRING_T_H
#ifndef AUDIOEXTENSIONDEFINITION_T3271167678_H
#define AUDIOEXTENSIONDEFINITION_T3271167678_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioExtensionDefinition
struct AudioExtensionDefinition_t3271167678 : public RuntimeObject
{
public:
// System.String UnityEngine.AudioExtensionDefinition::assemblyName
String_t* ___assemblyName_0;
// System.String UnityEngine.AudioExtensionDefinition::extensionNamespace
String_t* ___extensionNamespace_1;
// System.String UnityEngine.AudioExtensionDefinition::extensionTypeName
String_t* ___extensionTypeName_2;
// System.Type UnityEngine.AudioExtensionDefinition::extensionType
Type_t * ___extensionType_3;
public:
inline static int32_t get_offset_of_assemblyName_0() { return static_cast<int32_t>(offsetof(AudioExtensionDefinition_t3271167678, ___assemblyName_0)); }
inline String_t* get_assemblyName_0() const { return ___assemblyName_0; }
inline String_t** get_address_of_assemblyName_0() { return &___assemblyName_0; }
inline void set_assemblyName_0(String_t* value)
{
___assemblyName_0 = value;
Il2CppCodeGenWriteBarrier((&___assemblyName_0), value);
}
inline static int32_t get_offset_of_extensionNamespace_1() { return static_cast<int32_t>(offsetof(AudioExtensionDefinition_t3271167678, ___extensionNamespace_1)); }
inline String_t* get_extensionNamespace_1() const { return ___extensionNamespace_1; }
inline String_t** get_address_of_extensionNamespace_1() { return &___extensionNamespace_1; }
inline void set_extensionNamespace_1(String_t* value)
{
___extensionNamespace_1 = value;
Il2CppCodeGenWriteBarrier((&___extensionNamespace_1), value);
}
inline static int32_t get_offset_of_extensionTypeName_2() { return static_cast<int32_t>(offsetof(AudioExtensionDefinition_t3271167678, ___extensionTypeName_2)); }
inline String_t* get_extensionTypeName_2() const { return ___extensionTypeName_2; }
inline String_t** get_address_of_extensionTypeName_2() { return &___extensionTypeName_2; }
inline void set_extensionTypeName_2(String_t* value)
{
___extensionTypeName_2 = value;
Il2CppCodeGenWriteBarrier((&___extensionTypeName_2), value);
}
inline static int32_t get_offset_of_extensionType_3() { return static_cast<int32_t>(offsetof(AudioExtensionDefinition_t3271167678, ___extensionType_3)); }
inline Type_t * get_extensionType_3() const { return ___extensionType_3; }
inline Type_t ** get_address_of_extensionType_3() { return &___extensionType_3; }
inline void set_extensionType_3(Type_t * value)
{
___extensionType_3 = value;
Il2CppCodeGenWriteBarrier((&___extensionType_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOEXTENSIONDEFINITION_T3271167678_H
#ifndef LIST_1_T1295534336_H
#define LIST_1_T1295534336_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.AudioAmbisonicExtensionDefinition>
struct List_1_t1295534336 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
AudioAmbisonicExtensionDefinitionU5BU5D_t954184591* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t1295534336, ____items_1)); }
inline AudioAmbisonicExtensionDefinitionU5BU5D_t954184591* get__items_1() const { return ____items_1; }
inline AudioAmbisonicExtensionDefinitionU5BU5D_t954184591** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(AudioAmbisonicExtensionDefinitionU5BU5D_t954184591* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t1295534336, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t1295534336, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
};
struct List_1_t1295534336_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
AudioAmbisonicExtensionDefinitionU5BU5D_t954184591* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t1295534336_StaticFields, ___EmptyArray_4)); }
inline AudioAmbisonicExtensionDefinitionU5BU5D_t954184591* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline AudioAmbisonicExtensionDefinitionU5BU5D_t954184591** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(AudioAmbisonicExtensionDefinitionU5BU5D_t954184591* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T1295534336_H
#ifndef LIST_1_T242016280_H
#define LIST_1_T242016280_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension>
struct List_1_t242016280 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
AudioSourceExtensionU5BU5D_t4125762839* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t242016280, ____items_1)); }
inline AudioSourceExtensionU5BU5D_t4125762839* get__items_1() const { return ____items_1; }
inline AudioSourceExtensionU5BU5D_t4125762839** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(AudioSourceExtensionU5BU5D_t4125762839* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((&____items_1), value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t242016280, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t242016280, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
};
struct List_1_t242016280_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::EmptyArray
AudioSourceExtensionU5BU5D_t4125762839* ___EmptyArray_4;
public:
inline static int32_t get_offset_of_EmptyArray_4() { return static_cast<int32_t>(offsetof(List_1_t242016280_StaticFields, ___EmptyArray_4)); }
inline AudioSourceExtensionU5BU5D_t4125762839* get_EmptyArray_4() const { return ___EmptyArray_4; }
inline AudioSourceExtensionU5BU5D_t4125762839** get_address_of_EmptyArray_4() { return &___EmptyArray_4; }
inline void set_EmptyArray_4(AudioSourceExtensionU5BU5D_t4125762839* value)
{
___EmptyArray_4 = value;
Il2CppCodeGenWriteBarrier((&___EmptyArray_4), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // LIST_1_T242016280_H
#ifndef VALUETYPE_T3640485471_H
#define VALUETYPE_T3640485471_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.ValueType
struct ValueType_t3640485471 : public RuntimeObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.ValueType
struct ValueType_t3640485471_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.ValueType
struct ValueType_t3640485471_marshaled_com
{
};
#endif // VALUETYPE_T3640485471_H
#ifndef AUDIOSETTINGS_T3587374600_H
#define AUDIOSETTINGS_T3587374600_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioSettings
struct AudioSettings_t3587374600 : public RuntimeObject
{
public:
public:
};
struct AudioSettings_t3587374600_StaticFields
{
public:
// UnityEngine.AudioSettings/AudioConfigurationChangeHandler UnityEngine.AudioSettings::OnAudioConfigurationChanged
AudioConfigurationChangeHandler_t2089929874 * ___OnAudioConfigurationChanged_0;
public:
inline static int32_t get_offset_of_OnAudioConfigurationChanged_0() { return static_cast<int32_t>(offsetof(AudioSettings_t3587374600_StaticFields, ___OnAudioConfigurationChanged_0)); }
inline AudioConfigurationChangeHandler_t2089929874 * get_OnAudioConfigurationChanged_0() const { return ___OnAudioConfigurationChanged_0; }
inline AudioConfigurationChangeHandler_t2089929874 ** get_address_of_OnAudioConfigurationChanged_0() { return &___OnAudioConfigurationChanged_0; }
inline void set_OnAudioConfigurationChanged_0(AudioConfigurationChangeHandler_t2089929874 * value)
{
___OnAudioConfigurationChanged_0 = value;
Il2CppCodeGenWriteBarrier((&___OnAudioConfigurationChanged_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOSETTINGS_T3587374600_H
#ifndef ENUMERATOR_T3184778213_H
#define ENUMERATOR_T3184778213_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1/Enumerator<UnityEngine.AudioAmbisonicExtensionDefinition>
struct Enumerator_t3184778213
{
public:
// System.Collections.Generic.List`1<T> System.Collections.Generic.List`1/Enumerator::l
List_1_t1295534336 * ___l_0;
// System.Int32 System.Collections.Generic.List`1/Enumerator::next
int32_t ___next_1;
// System.Int32 System.Collections.Generic.List`1/Enumerator::ver
int32_t ___ver_2;
// T System.Collections.Generic.List`1/Enumerator::current
AudioAmbisonicExtensionDefinition_t4118426890 * ___current_3;
public:
inline static int32_t get_offset_of_l_0() { return static_cast<int32_t>(offsetof(Enumerator_t3184778213, ___l_0)); }
inline List_1_t1295534336 * get_l_0() const { return ___l_0; }
inline List_1_t1295534336 ** get_address_of_l_0() { return &___l_0; }
inline void set_l_0(List_1_t1295534336 * value)
{
___l_0 = value;
Il2CppCodeGenWriteBarrier((&___l_0), value);
}
inline static int32_t get_offset_of_next_1() { return static_cast<int32_t>(offsetof(Enumerator_t3184778213, ___next_1)); }
inline int32_t get_next_1() const { return ___next_1; }
inline int32_t* get_address_of_next_1() { return &___next_1; }
inline void set_next_1(int32_t value)
{
___next_1 = value;
}
inline static int32_t get_offset_of_ver_2() { return static_cast<int32_t>(offsetof(Enumerator_t3184778213, ___ver_2)); }
inline int32_t get_ver_2() const { return ___ver_2; }
inline int32_t* get_address_of_ver_2() { return &___ver_2; }
inline void set_ver_2(int32_t value)
{
___ver_2 = value;
}
inline static int32_t get_offset_of_current_3() { return static_cast<int32_t>(offsetof(Enumerator_t3184778213, ___current_3)); }
inline AudioAmbisonicExtensionDefinition_t4118426890 * get_current_3() const { return ___current_3; }
inline AudioAmbisonicExtensionDefinition_t4118426890 ** get_address_of_current_3() { return &___current_3; }
inline void set_current_3(AudioAmbisonicExtensionDefinition_t4118426890 * value)
{
___current_3 = value;
Il2CppCodeGenWriteBarrier((&___current_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ENUMERATOR_T3184778213_H
#ifndef WEBCAMDEVICE_T1322781432_H
#define WEBCAMDEVICE_T1322781432_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.WebCamDevice
struct WebCamDevice_t1322781432
{
public:
// System.String UnityEngine.WebCamDevice::m_Name
String_t* ___m_Name_0;
// System.Int32 UnityEngine.WebCamDevice::m_Flags
int32_t ___m_Flags_1;
public:
inline static int32_t get_offset_of_m_Name_0() { return static_cast<int32_t>(offsetof(WebCamDevice_t1322781432, ___m_Name_0)); }
inline String_t* get_m_Name_0() const { return ___m_Name_0; }
inline String_t** get_address_of_m_Name_0() { return &___m_Name_0; }
inline void set_m_Name_0(String_t* value)
{
___m_Name_0 = value;
Il2CppCodeGenWriteBarrier((&___m_Name_0), value);
}
inline static int32_t get_offset_of_m_Flags_1() { return static_cast<int32_t>(offsetof(WebCamDevice_t1322781432, ___m_Flags_1)); }
inline int32_t get_m_Flags_1() const { return ___m_Flags_1; }
inline int32_t* get_address_of_m_Flags_1() { return &___m_Flags_1; }
inline void set_m_Flags_1(int32_t value)
{
___m_Flags_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.WebCamDevice
struct WebCamDevice_t1322781432_marshaled_pinvoke
{
char* ___m_Name_0;
int32_t ___m_Flags_1;
};
// Native definition for COM marshalling of UnityEngine.WebCamDevice
struct WebCamDevice_t1322781432_marshaled_com
{
Il2CppChar* ___m_Name_0;
int32_t ___m_Flags_1;
};
#endif // WEBCAMDEVICE_T1322781432_H
#ifndef ENUMERATOR_T3959214805_H
#define ENUMERATOR_T3959214805_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1/Enumerator<UnityEngine.AudioSpatializerExtensionDefinition>
struct Enumerator_t3959214805
{
public:
// System.Collections.Generic.List`1<T> System.Collections.Generic.List`1/Enumerator::l
List_1_t2069970928 * ___l_0;
// System.Int32 System.Collections.Generic.List`1/Enumerator::next
int32_t ___next_1;
// System.Int32 System.Collections.Generic.List`1/Enumerator::ver
int32_t ___ver_2;
// T System.Collections.Generic.List`1/Enumerator::current
AudioSpatializerExtensionDefinition_t597896186 * ___current_3;
public:
inline static int32_t get_offset_of_l_0() { return static_cast<int32_t>(offsetof(Enumerator_t3959214805, ___l_0)); }
inline List_1_t2069970928 * get_l_0() const { return ___l_0; }
inline List_1_t2069970928 ** get_address_of_l_0() { return &___l_0; }
inline void set_l_0(List_1_t2069970928 * value)
{
___l_0 = value;
Il2CppCodeGenWriteBarrier((&___l_0), value);
}
inline static int32_t get_offset_of_next_1() { return static_cast<int32_t>(offsetof(Enumerator_t3959214805, ___next_1)); }
inline int32_t get_next_1() const { return ___next_1; }
inline int32_t* get_address_of_next_1() { return &___next_1; }
inline void set_next_1(int32_t value)
{
___next_1 = value;
}
inline static int32_t get_offset_of_ver_2() { return static_cast<int32_t>(offsetof(Enumerator_t3959214805, ___ver_2)); }
inline int32_t get_ver_2() const { return ___ver_2; }
inline int32_t* get_address_of_ver_2() { return &___ver_2; }
inline void set_ver_2(int32_t value)
{
___ver_2 = value;
}
inline static int32_t get_offset_of_current_3() { return static_cast<int32_t>(offsetof(Enumerator_t3959214805, ___current_3)); }
inline AudioSpatializerExtensionDefinition_t597896186 * get_current_3() const { return ___current_3; }
inline AudioSpatializerExtensionDefinition_t597896186 ** get_address_of_current_3() { return &___current_3; }
inline void set_current_3(AudioSpatializerExtensionDefinition_t597896186 * value)
{
___current_3 = value;
Il2CppCodeGenWriteBarrier((&___current_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ENUMERATOR_T3959214805_H
#ifndef ENUMERATOR_T2146457487_H
#define ENUMERATOR_T2146457487_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.List`1/Enumerator<System.Object>
struct Enumerator_t2146457487
{
public:
// System.Collections.Generic.List`1<T> System.Collections.Generic.List`1/Enumerator::l
List_1_t257213610 * ___l_0;
// System.Int32 System.Collections.Generic.List`1/Enumerator::next
int32_t ___next_1;
// System.Int32 System.Collections.Generic.List`1/Enumerator::ver
int32_t ___ver_2;
// T System.Collections.Generic.List`1/Enumerator::current
RuntimeObject * ___current_3;
public:
inline static int32_t get_offset_of_l_0() { return static_cast<int32_t>(offsetof(Enumerator_t2146457487, ___l_0)); }
inline List_1_t257213610 * get_l_0() const { return ___l_0; }
inline List_1_t257213610 ** get_address_of_l_0() { return &___l_0; }
inline void set_l_0(List_1_t257213610 * value)
{
___l_0 = value;
Il2CppCodeGenWriteBarrier((&___l_0), value);
}
inline static int32_t get_offset_of_next_1() { return static_cast<int32_t>(offsetof(Enumerator_t2146457487, ___next_1)); }
inline int32_t get_next_1() const { return ___next_1; }
inline int32_t* get_address_of_next_1() { return &___next_1; }
inline void set_next_1(int32_t value)
{
___next_1 = value;
}
inline static int32_t get_offset_of_ver_2() { return static_cast<int32_t>(offsetof(Enumerator_t2146457487, ___ver_2)); }
inline int32_t get_ver_2() const { return ___ver_2; }
inline int32_t* get_address_of_ver_2() { return &___ver_2; }
inline void set_ver_2(int32_t value)
{
___ver_2 = value;
}
inline static int32_t get_offset_of_current_3() { return static_cast<int32_t>(offsetof(Enumerator_t2146457487, ___current_3)); }
inline RuntimeObject * get_current_3() const { return ___current_3; }
inline RuntimeObject ** get_address_of_current_3() { return &___current_3; }
inline void set_current_3(RuntimeObject * value)
{
___current_3 = value;
Il2CppCodeGenWriteBarrier((&___current_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ENUMERATOR_T2146457487_H
#ifndef PROPERTYNAME_T3749835189_H
#define PROPERTYNAME_T3749835189_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.PropertyName
struct PropertyName_t3749835189
{
public:
// System.Int32 UnityEngine.PropertyName::id
int32_t ___id_0;
public:
inline static int32_t get_offset_of_id_0() { return static_cast<int32_t>(offsetof(PropertyName_t3749835189, ___id_0)); }
inline int32_t get_id_0() const { return ___id_0; }
inline int32_t* get_address_of_id_0() { return &___id_0; }
inline void set_id_0(int32_t value)
{
___id_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // PROPERTYNAME_T3749835189_H
#ifndef INTPTR_T_H
#define INTPTR_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.IntPtr
struct IntPtr_t
{
public:
// System.Void* System.IntPtr::m_value
void* ___m_value_0;
public:
inline static int32_t get_offset_of_m_value_0() { return static_cast<int32_t>(offsetof(IntPtr_t, ___m_value_0)); }
inline void* get_m_value_0() const { return ___m_value_0; }
inline void** get_address_of_m_value_0() { return &___m_value_0; }
inline void set_m_value_0(void* value)
{
___m_value_0 = value;
}
};
struct IntPtr_t_StaticFields
{
public:
// System.IntPtr System.IntPtr::Zero
intptr_t ___Zero_1;
public:
inline static int32_t get_offset_of_Zero_1() { return static_cast<int32_t>(offsetof(IntPtr_t_StaticFields, ___Zero_1)); }
inline intptr_t get_Zero_1() const { return ___Zero_1; }
inline intptr_t* get_address_of_Zero_1() { return &___Zero_1; }
inline void set_Zero_1(intptr_t value)
{
___Zero_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INTPTR_T_H
#ifndef BOOLEAN_T97287965_H
#define BOOLEAN_T97287965_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Boolean
struct Boolean_t97287965
{
public:
// System.Boolean System.Boolean::m_value
bool ___m_value_2;
public:
inline static int32_t get_offset_of_m_value_2() { return static_cast<int32_t>(offsetof(Boolean_t97287965, ___m_value_2)); }
inline bool get_m_value_2() const { return ___m_value_2; }
inline bool* get_address_of_m_value_2() { return &___m_value_2; }
inline void set_m_value_2(bool value)
{
___m_value_2 = value;
}
};
struct Boolean_t97287965_StaticFields
{
public:
// System.String System.Boolean::FalseString
String_t* ___FalseString_0;
// System.String System.Boolean::TrueString
String_t* ___TrueString_1;
public:
inline static int32_t get_offset_of_FalseString_0() { return static_cast<int32_t>(offsetof(Boolean_t97287965_StaticFields, ___FalseString_0)); }
inline String_t* get_FalseString_0() const { return ___FalseString_0; }
inline String_t** get_address_of_FalseString_0() { return &___FalseString_0; }
inline void set_FalseString_0(String_t* value)
{
___FalseString_0 = value;
Il2CppCodeGenWriteBarrier((&___FalseString_0), value);
}
inline static int32_t get_offset_of_TrueString_1() { return static_cast<int32_t>(offsetof(Boolean_t97287965_StaticFields, ___TrueString_1)); }
inline String_t* get_TrueString_1() const { return ___TrueString_1; }
inline String_t** get_address_of_TrueString_1() { return &___TrueString_1; }
inline void set_TrueString_1(String_t* value)
{
___TrueString_1 = value;
Il2CppCodeGenWriteBarrier((&___TrueString_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BOOLEAN_T97287965_H
#ifndef ENUM_T4135868527_H
#define ENUM_T4135868527_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Enum
struct Enum_t4135868527 : public ValueType_t3640485471
{
public:
public:
};
struct Enum_t4135868527_StaticFields
{
public:
// System.Char[] System.Enum::split_char
CharU5BU5D_t3528271667* ___split_char_0;
public:
inline static int32_t get_offset_of_split_char_0() { return static_cast<int32_t>(offsetof(Enum_t4135868527_StaticFields, ___split_char_0)); }
inline CharU5BU5D_t3528271667* get_split_char_0() const { return ___split_char_0; }
inline CharU5BU5D_t3528271667** get_address_of_split_char_0() { return &___split_char_0; }
inline void set_split_char_0(CharU5BU5D_t3528271667* value)
{
___split_char_0 = value;
Il2CppCodeGenWriteBarrier((&___split_char_0), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of System.Enum
struct Enum_t4135868527_marshaled_pinvoke
{
};
// Native definition for COM marshalling of System.Enum
struct Enum_t4135868527_marshaled_com
{
};
#endif // ENUM_T4135868527_H
#ifndef VOID_T1185182177_H
#define VOID_T1185182177_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void
struct Void_t1185182177
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // VOID_T1185182177_H
#ifndef SINGLE_T1397266774_H
#define SINGLE_T1397266774_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Single
struct Single_t1397266774
{
public:
// System.Single System.Single::m_value
float ___m_value_7;
public:
inline static int32_t get_offset_of_m_value_7() { return static_cast<int32_t>(offsetof(Single_t1397266774, ___m_value_7)); }
inline float get_m_value_7() const { return ___m_value_7; }
inline float* get_address_of_m_value_7() { return &___m_value_7; }
inline void set_m_value_7(float value)
{
___m_value_7 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // SINGLE_T1397266774_H
#ifndef INT32_T2950945753_H
#define INT32_T2950945753_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Int32
struct Int32_t2950945753
{
public:
// System.Int32 System.Int32::m_value
int32_t ___m_value_2;
public:
inline static int32_t get_offset_of_m_value_2() { return static_cast<int32_t>(offsetof(Int32_t2950945753, ___m_value_2)); }
inline int32_t get_m_value_2() const { return ___m_value_2; }
inline int32_t* get_address_of_m_value_2() { return &___m_value_2; }
inline void set_m_value_2(int32_t value)
{
___m_value_2 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // INT32_T2950945753_H
#ifndef PLAYABLEHANDLE_T1095853803_H
#define PLAYABLEHANDLE_T1095853803_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Playables.PlayableHandle
struct PlayableHandle_t1095853803
{
public:
// System.IntPtr UnityEngine.Playables.PlayableHandle::m_Handle
intptr_t ___m_Handle_0;
// System.Int32 UnityEngine.Playables.PlayableHandle::m_Version
int32_t ___m_Version_1;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(PlayableHandle_t1095853803, ___m_Handle_0)); }
inline intptr_t get_m_Handle_0() const { return ___m_Handle_0; }
inline intptr_t* get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(intptr_t value)
{
___m_Handle_0 = value;
}
inline static int32_t get_offset_of_m_Version_1() { return static_cast<int32_t>(offsetof(PlayableHandle_t1095853803, ___m_Version_1)); }
inline int32_t get_m_Version_1() const { return ___m_Version_1; }
inline int32_t* get_address_of_m_Version_1() { return &___m_Version_1; }
inline void set_m_Version_1(int32_t value)
{
___m_Version_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // PLAYABLEHANDLE_T1095853803_H
#ifndef AUDIOAMBISONICEXTENSIONDEFINITION_T4118426890_H
#define AUDIOAMBISONICEXTENSIONDEFINITION_T4118426890_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioAmbisonicExtensionDefinition
struct AudioAmbisonicExtensionDefinition_t4118426890 : public RuntimeObject
{
public:
// UnityEngine.PropertyName UnityEngine.AudioAmbisonicExtensionDefinition::ambisonicPluginName
PropertyName_t3749835189 ___ambisonicPluginName_0;
// UnityEngine.AudioExtensionDefinition UnityEngine.AudioAmbisonicExtensionDefinition::definition
AudioExtensionDefinition_t3271167678 * ___definition_1;
public:
inline static int32_t get_offset_of_ambisonicPluginName_0() { return static_cast<int32_t>(offsetof(AudioAmbisonicExtensionDefinition_t4118426890, ___ambisonicPluginName_0)); }
inline PropertyName_t3749835189 get_ambisonicPluginName_0() const { return ___ambisonicPluginName_0; }
inline PropertyName_t3749835189 * get_address_of_ambisonicPluginName_0() { return &___ambisonicPluginName_0; }
inline void set_ambisonicPluginName_0(PropertyName_t3749835189 value)
{
___ambisonicPluginName_0 = value;
}
inline static int32_t get_offset_of_definition_1() { return static_cast<int32_t>(offsetof(AudioAmbisonicExtensionDefinition_t4118426890, ___definition_1)); }
inline AudioExtensionDefinition_t3271167678 * get_definition_1() const { return ___definition_1; }
inline AudioExtensionDefinition_t3271167678 ** get_address_of_definition_1() { return &___definition_1; }
inline void set_definition_1(AudioExtensionDefinition_t3271167678 * value)
{
___definition_1 = value;
Il2CppCodeGenWriteBarrier((&___definition_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOAMBISONICEXTENSIONDEFINITION_T4118426890_H
#ifndef PLAYABLEOUTPUTHANDLE_T4208053793_H
#define PLAYABLEOUTPUTHANDLE_T4208053793_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Playables.PlayableOutputHandle
struct PlayableOutputHandle_t4208053793
{
public:
// System.IntPtr UnityEngine.Playables.PlayableOutputHandle::m_Handle
intptr_t ___m_Handle_0;
// System.Int32 UnityEngine.Playables.PlayableOutputHandle::m_Version
int32_t ___m_Version_1;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(PlayableOutputHandle_t4208053793, ___m_Handle_0)); }
inline intptr_t get_m_Handle_0() const { return ___m_Handle_0; }
inline intptr_t* get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(intptr_t value)
{
___m_Handle_0 = value;
}
inline static int32_t get_offset_of_m_Version_1() { return static_cast<int32_t>(offsetof(PlayableOutputHandle_t4208053793, ___m_Version_1)); }
inline int32_t get_m_Version_1() const { return ___m_Version_1; }
inline int32_t* get_address_of_m_Version_1() { return &___m_Version_1; }
inline void set_m_Version_1(int32_t value)
{
___m_Version_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // PLAYABLEOUTPUTHANDLE_T4208053793_H
#ifndef AUDIOSPATIALIZEREXTENSIONDEFINITION_T597896186_H
#define AUDIOSPATIALIZEREXTENSIONDEFINITION_T597896186_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioSpatializerExtensionDefinition
struct AudioSpatializerExtensionDefinition_t597896186 : public RuntimeObject
{
public:
// UnityEngine.PropertyName UnityEngine.AudioSpatializerExtensionDefinition::spatializerName
PropertyName_t3749835189 ___spatializerName_0;
// UnityEngine.AudioExtensionDefinition UnityEngine.AudioSpatializerExtensionDefinition::definition
AudioExtensionDefinition_t3271167678 * ___definition_1;
public:
inline static int32_t get_offset_of_spatializerName_0() { return static_cast<int32_t>(offsetof(AudioSpatializerExtensionDefinition_t597896186, ___spatializerName_0)); }
inline PropertyName_t3749835189 get_spatializerName_0() const { return ___spatializerName_0; }
inline PropertyName_t3749835189 * get_address_of_spatializerName_0() { return &___spatializerName_0; }
inline void set_spatializerName_0(PropertyName_t3749835189 value)
{
___spatializerName_0 = value;
}
inline static int32_t get_offset_of_definition_1() { return static_cast<int32_t>(offsetof(AudioSpatializerExtensionDefinition_t597896186, ___definition_1)); }
inline AudioExtensionDefinition_t3271167678 * get_definition_1() const { return ___definition_1; }
inline AudioExtensionDefinition_t3271167678 ** get_address_of_definition_1() { return &___definition_1; }
inline void set_definition_1(AudioExtensionDefinition_t3271167678 * value)
{
___definition_1 = value;
Il2CppCodeGenWriteBarrier((&___definition_1), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOSPATIALIZEREXTENSIONDEFINITION_T597896186_H
#ifndef BINDINGFLAGS_T2721792723_H
#define BINDINGFLAGS_T2721792723_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Reflection.BindingFlags
struct BindingFlags_t2721792723
{
public:
// System.Int32 System.Reflection.BindingFlags::value__
int32_t ___value___1;
public:
inline static int32_t get_offset_of_value___1() { return static_cast<int32_t>(offsetof(BindingFlags_t2721792723, ___value___1)); }
inline int32_t get_value___1() const { return ___value___1; }
inline int32_t* get_address_of_value___1() { return &___value___1; }
inline void set_value___1(int32_t value)
{
___value___1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BINDINGFLAGS_T2721792723_H
#ifndef RUNTIMETYPEHANDLE_T3027515415_H
#define RUNTIMETYPEHANDLE_T3027515415_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.RuntimeTypeHandle
struct RuntimeTypeHandle_t3027515415
{
public:
// System.IntPtr System.RuntimeTypeHandle::value
intptr_t ___value_0;
public:
inline static int32_t get_offset_of_value_0() { return static_cast<int32_t>(offsetof(RuntimeTypeHandle_t3027515415, ___value_0)); }
inline intptr_t get_value_0() const { return ___value_0; }
inline intptr_t* get_address_of_value_0() { return &___value_0; }
inline void set_value_0(intptr_t value)
{
___value_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // RUNTIMETYPEHANDLE_T3027515415_H
#ifndef AUDIOEXTENSIONMANAGER_T3220897493_H
#define AUDIOEXTENSIONMANAGER_T3220897493_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioExtensionManager
struct AudioExtensionManager_t3220897493 : public RuntimeObject
{
public:
public:
};
struct AudioExtensionManager_t3220897493_StaticFields
{
public:
// System.Collections.Generic.List`1<UnityEngine.AudioSpatializerExtensionDefinition> UnityEngine.AudioExtensionManager::m_ListenerSpatializerExtensionDefinitions
List_1_t2069970928 * ___m_ListenerSpatializerExtensionDefinitions_0;
// System.Collections.Generic.List`1<UnityEngine.AudioSpatializerExtensionDefinition> UnityEngine.AudioExtensionManager::m_SourceSpatializerExtensionDefinitions
List_1_t2069970928 * ___m_SourceSpatializerExtensionDefinitions_1;
// System.Collections.Generic.List`1<UnityEngine.AudioAmbisonicExtensionDefinition> UnityEngine.AudioExtensionManager::m_SourceAmbisonicDecoderExtensionDefinitions
List_1_t1295534336 * ___m_SourceAmbisonicDecoderExtensionDefinitions_2;
// System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension> UnityEngine.AudioExtensionManager::m_SourceExtensionsToUpdate
List_1_t242016280 * ___m_SourceExtensionsToUpdate_3;
// System.Int32 UnityEngine.AudioExtensionManager::m_NextStopIndex
int32_t ___m_NextStopIndex_4;
// System.Boolean UnityEngine.AudioExtensionManager::m_BuiltinDefinitionsRegistered
bool ___m_BuiltinDefinitionsRegistered_5;
// UnityEngine.PropertyName UnityEngine.AudioExtensionManager::m_SpatializerName
PropertyName_t3749835189 ___m_SpatializerName_6;
// UnityEngine.PropertyName UnityEngine.AudioExtensionManager::m_SpatializerExtensionName
PropertyName_t3749835189 ___m_SpatializerExtensionName_7;
// UnityEngine.PropertyName UnityEngine.AudioExtensionManager::m_ListenerSpatializerExtensionName
PropertyName_t3749835189 ___m_ListenerSpatializerExtensionName_8;
public:
inline static int32_t get_offset_of_m_ListenerSpatializerExtensionDefinitions_0() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_ListenerSpatializerExtensionDefinitions_0)); }
inline List_1_t2069970928 * get_m_ListenerSpatializerExtensionDefinitions_0() const { return ___m_ListenerSpatializerExtensionDefinitions_0; }
inline List_1_t2069970928 ** get_address_of_m_ListenerSpatializerExtensionDefinitions_0() { return &___m_ListenerSpatializerExtensionDefinitions_0; }
inline void set_m_ListenerSpatializerExtensionDefinitions_0(List_1_t2069970928 * value)
{
___m_ListenerSpatializerExtensionDefinitions_0 = value;
Il2CppCodeGenWriteBarrier((&___m_ListenerSpatializerExtensionDefinitions_0), value);
}
inline static int32_t get_offset_of_m_SourceSpatializerExtensionDefinitions_1() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_SourceSpatializerExtensionDefinitions_1)); }
inline List_1_t2069970928 * get_m_SourceSpatializerExtensionDefinitions_1() const { return ___m_SourceSpatializerExtensionDefinitions_1; }
inline List_1_t2069970928 ** get_address_of_m_SourceSpatializerExtensionDefinitions_1() { return &___m_SourceSpatializerExtensionDefinitions_1; }
inline void set_m_SourceSpatializerExtensionDefinitions_1(List_1_t2069970928 * value)
{
___m_SourceSpatializerExtensionDefinitions_1 = value;
Il2CppCodeGenWriteBarrier((&___m_SourceSpatializerExtensionDefinitions_1), value);
}
inline static int32_t get_offset_of_m_SourceAmbisonicDecoderExtensionDefinitions_2() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_SourceAmbisonicDecoderExtensionDefinitions_2)); }
inline List_1_t1295534336 * get_m_SourceAmbisonicDecoderExtensionDefinitions_2() const { return ___m_SourceAmbisonicDecoderExtensionDefinitions_2; }
inline List_1_t1295534336 ** get_address_of_m_SourceAmbisonicDecoderExtensionDefinitions_2() { return &___m_SourceAmbisonicDecoderExtensionDefinitions_2; }
inline void set_m_SourceAmbisonicDecoderExtensionDefinitions_2(List_1_t1295534336 * value)
{
___m_SourceAmbisonicDecoderExtensionDefinitions_2 = value;
Il2CppCodeGenWriteBarrier((&___m_SourceAmbisonicDecoderExtensionDefinitions_2), value);
}
inline static int32_t get_offset_of_m_SourceExtensionsToUpdate_3() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_SourceExtensionsToUpdate_3)); }
inline List_1_t242016280 * get_m_SourceExtensionsToUpdate_3() const { return ___m_SourceExtensionsToUpdate_3; }
inline List_1_t242016280 ** get_address_of_m_SourceExtensionsToUpdate_3() { return &___m_SourceExtensionsToUpdate_3; }
inline void set_m_SourceExtensionsToUpdate_3(List_1_t242016280 * value)
{
___m_SourceExtensionsToUpdate_3 = value;
Il2CppCodeGenWriteBarrier((&___m_SourceExtensionsToUpdate_3), value);
}
inline static int32_t get_offset_of_m_NextStopIndex_4() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_NextStopIndex_4)); }
inline int32_t get_m_NextStopIndex_4() const { return ___m_NextStopIndex_4; }
inline int32_t* get_address_of_m_NextStopIndex_4() { return &___m_NextStopIndex_4; }
inline void set_m_NextStopIndex_4(int32_t value)
{
___m_NextStopIndex_4 = value;
}
inline static int32_t get_offset_of_m_BuiltinDefinitionsRegistered_5() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_BuiltinDefinitionsRegistered_5)); }
inline bool get_m_BuiltinDefinitionsRegistered_5() const { return ___m_BuiltinDefinitionsRegistered_5; }
inline bool* get_address_of_m_BuiltinDefinitionsRegistered_5() { return &___m_BuiltinDefinitionsRegistered_5; }
inline void set_m_BuiltinDefinitionsRegistered_5(bool value)
{
___m_BuiltinDefinitionsRegistered_5 = value;
}
inline static int32_t get_offset_of_m_SpatializerName_6() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_SpatializerName_6)); }
inline PropertyName_t3749835189 get_m_SpatializerName_6() const { return ___m_SpatializerName_6; }
inline PropertyName_t3749835189 * get_address_of_m_SpatializerName_6() { return &___m_SpatializerName_6; }
inline void set_m_SpatializerName_6(PropertyName_t3749835189 value)
{
___m_SpatializerName_6 = value;
}
inline static int32_t get_offset_of_m_SpatializerExtensionName_7() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_SpatializerExtensionName_7)); }
inline PropertyName_t3749835189 get_m_SpatializerExtensionName_7() const { return ___m_SpatializerExtensionName_7; }
inline PropertyName_t3749835189 * get_address_of_m_SpatializerExtensionName_7() { return &___m_SpatializerExtensionName_7; }
inline void set_m_SpatializerExtensionName_7(PropertyName_t3749835189 value)
{
___m_SpatializerExtensionName_7 = value;
}
inline static int32_t get_offset_of_m_ListenerSpatializerExtensionName_8() { return static_cast<int32_t>(offsetof(AudioExtensionManager_t3220897493_StaticFields, ___m_ListenerSpatializerExtensionName_8)); }
inline PropertyName_t3749835189 get_m_ListenerSpatializerExtensionName_8() const { return ___m_ListenerSpatializerExtensionName_8; }
inline PropertyName_t3749835189 * get_address_of_m_ListenerSpatializerExtensionName_8() { return &___m_ListenerSpatializerExtensionName_8; }
inline void set_m_ListenerSpatializerExtensionName_8(PropertyName_t3749835189 value)
{
___m_ListenerSpatializerExtensionName_8 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOEXTENSIONMANAGER_T3220897493_H
#ifndef OBJECT_T631007953_H
#define OBJECT_T631007953_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Object
struct Object_t631007953 : public RuntimeObject
{
public:
// System.IntPtr UnityEngine.Object::m_CachedPtr
intptr_t ___m_CachedPtr_0;
public:
inline static int32_t get_offset_of_m_CachedPtr_0() { return static_cast<int32_t>(offsetof(Object_t631007953, ___m_CachedPtr_0)); }
inline intptr_t get_m_CachedPtr_0() const { return ___m_CachedPtr_0; }
inline intptr_t* get_address_of_m_CachedPtr_0() { return &___m_CachedPtr_0; }
inline void set_m_CachedPtr_0(intptr_t value)
{
___m_CachedPtr_0 = value;
}
};
struct Object_t631007953_StaticFields
{
public:
// System.Int32 UnityEngine.Object::OffsetOfInstanceIDInCPlusPlusObject
int32_t ___OffsetOfInstanceIDInCPlusPlusObject_1;
public:
inline static int32_t get_offset_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return static_cast<int32_t>(offsetof(Object_t631007953_StaticFields, ___OffsetOfInstanceIDInCPlusPlusObject_1)); }
inline int32_t get_OffsetOfInstanceIDInCPlusPlusObject_1() const { return ___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline int32_t* get_address_of_OffsetOfInstanceIDInCPlusPlusObject_1() { return &___OffsetOfInstanceIDInCPlusPlusObject_1; }
inline void set_OffsetOfInstanceIDInCPlusPlusObject_1(int32_t value)
{
___OffsetOfInstanceIDInCPlusPlusObject_1 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.Object
struct Object_t631007953_marshaled_pinvoke
{
intptr_t ___m_CachedPtr_0;
};
// Native definition for COM marshalling of UnityEngine.Object
struct Object_t631007953_marshaled_com
{
intptr_t ___m_CachedPtr_0;
};
#endif // OBJECT_T631007953_H
#ifndef DELEGATE_T1188392813_H
#define DELEGATE_T1188392813_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Delegate
struct Delegate_t1188392813 : public RuntimeObject
{
public:
// System.IntPtr System.Delegate::method_ptr
Il2CppMethodPointer ___method_ptr_0;
// System.IntPtr System.Delegate::invoke_impl
intptr_t ___invoke_impl_1;
// System.Object System.Delegate::m_target
RuntimeObject * ___m_target_2;
// System.IntPtr System.Delegate::method
intptr_t ___method_3;
// System.IntPtr System.Delegate::delegate_trampoline
intptr_t ___delegate_trampoline_4;
// System.IntPtr System.Delegate::method_code
intptr_t ___method_code_5;
// System.Reflection.MethodInfo System.Delegate::method_info
MethodInfo_t * ___method_info_6;
// System.Reflection.MethodInfo System.Delegate::original_method_info
MethodInfo_t * ___original_method_info_7;
// System.DelegateData System.Delegate::data
DelegateData_t1677132599 * ___data_8;
public:
inline static int32_t get_offset_of_method_ptr_0() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_ptr_0)); }
inline Il2CppMethodPointer get_method_ptr_0() const { return ___method_ptr_0; }
inline Il2CppMethodPointer* get_address_of_method_ptr_0() { return &___method_ptr_0; }
inline void set_method_ptr_0(Il2CppMethodPointer value)
{
___method_ptr_0 = value;
}
inline static int32_t get_offset_of_invoke_impl_1() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___invoke_impl_1)); }
inline intptr_t get_invoke_impl_1() const { return ___invoke_impl_1; }
inline intptr_t* get_address_of_invoke_impl_1() { return &___invoke_impl_1; }
inline void set_invoke_impl_1(intptr_t value)
{
___invoke_impl_1 = value;
}
inline static int32_t get_offset_of_m_target_2() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___m_target_2)); }
inline RuntimeObject * get_m_target_2() const { return ___m_target_2; }
inline RuntimeObject ** get_address_of_m_target_2() { return &___m_target_2; }
inline void set_m_target_2(RuntimeObject * value)
{
___m_target_2 = value;
Il2CppCodeGenWriteBarrier((&___m_target_2), value);
}
inline static int32_t get_offset_of_method_3() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_3)); }
inline intptr_t get_method_3() const { return ___method_3; }
inline intptr_t* get_address_of_method_3() { return &___method_3; }
inline void set_method_3(intptr_t value)
{
___method_3 = value;
}
inline static int32_t get_offset_of_delegate_trampoline_4() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___delegate_trampoline_4)); }
inline intptr_t get_delegate_trampoline_4() const { return ___delegate_trampoline_4; }
inline intptr_t* get_address_of_delegate_trampoline_4() { return &___delegate_trampoline_4; }
inline void set_delegate_trampoline_4(intptr_t value)
{
___delegate_trampoline_4 = value;
}
inline static int32_t get_offset_of_method_code_5() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_code_5)); }
inline intptr_t get_method_code_5() const { return ___method_code_5; }
inline intptr_t* get_address_of_method_code_5() { return &___method_code_5; }
inline void set_method_code_5(intptr_t value)
{
___method_code_5 = value;
}
inline static int32_t get_offset_of_method_info_6() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___method_info_6)); }
inline MethodInfo_t * get_method_info_6() const { return ___method_info_6; }
inline MethodInfo_t ** get_address_of_method_info_6() { return &___method_info_6; }
inline void set_method_info_6(MethodInfo_t * value)
{
___method_info_6 = value;
Il2CppCodeGenWriteBarrier((&___method_info_6), value);
}
inline static int32_t get_offset_of_original_method_info_7() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___original_method_info_7)); }
inline MethodInfo_t * get_original_method_info_7() const { return ___original_method_info_7; }
inline MethodInfo_t ** get_address_of_original_method_info_7() { return &___original_method_info_7; }
inline void set_original_method_info_7(MethodInfo_t * value)
{
___original_method_info_7 = value;
Il2CppCodeGenWriteBarrier((&___original_method_info_7), value);
}
inline static int32_t get_offset_of_data_8() { return static_cast<int32_t>(offsetof(Delegate_t1188392813, ___data_8)); }
inline DelegateData_t1677132599 * get_data_8() const { return ___data_8; }
inline DelegateData_t1677132599 ** get_address_of_data_8() { return &___data_8; }
inline void set_data_8(DelegateData_t1677132599 * value)
{
___data_8 = value;
Il2CppCodeGenWriteBarrier((&___data_8), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // DELEGATE_T1188392813_H
#ifndef TEXTURE_T3661962703_H
#define TEXTURE_T3661962703_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Texture
struct Texture_t3661962703 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TEXTURE_T3661962703_H
#ifndef AUDIOCLIPPLAYABLE_T785069022_H
#define AUDIOCLIPPLAYABLE_T785069022_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Audio.AudioClipPlayable
struct AudioClipPlayable_t785069022
{
public:
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::m_Handle
PlayableHandle_t1095853803 ___m_Handle_0;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioClipPlayable_t785069022, ___m_Handle_0)); }
inline PlayableHandle_t1095853803 get_m_Handle_0() const { return ___m_Handle_0; }
inline PlayableHandle_t1095853803 * get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(PlayableHandle_t1095853803 value)
{
___m_Handle_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOCLIPPLAYABLE_T785069022_H
#ifndef COMPONENT_T1923634451_H
#define COMPONENT_T1923634451_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Component
struct Component_t1923634451 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // COMPONENT_T1923634451_H
#ifndef MULTICASTDELEGATE_T_H
#define MULTICASTDELEGATE_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.MulticastDelegate
struct MulticastDelegate_t : public Delegate_t1188392813
{
public:
// System.MulticastDelegate System.MulticastDelegate::prev
MulticastDelegate_t * ___prev_9;
// System.MulticastDelegate System.MulticastDelegate::kpm_next
MulticastDelegate_t * ___kpm_next_10;
public:
inline static int32_t get_offset_of_prev_9() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___prev_9)); }
inline MulticastDelegate_t * get_prev_9() const { return ___prev_9; }
inline MulticastDelegate_t ** get_address_of_prev_9() { return &___prev_9; }
inline void set_prev_9(MulticastDelegate_t * value)
{
___prev_9 = value;
Il2CppCodeGenWriteBarrier((&___prev_9), value);
}
inline static int32_t get_offset_of_kpm_next_10() { return static_cast<int32_t>(offsetof(MulticastDelegate_t, ___kpm_next_10)); }
inline MulticastDelegate_t * get_kpm_next_10() const { return ___kpm_next_10; }
inline MulticastDelegate_t ** get_address_of_kpm_next_10() { return &___kpm_next_10; }
inline void set_kpm_next_10(MulticastDelegate_t * value)
{
___kpm_next_10 = value;
Il2CppCodeGenWriteBarrier((&___kpm_next_10), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // MULTICASTDELEGATE_T_H
#ifndef SCRIPTABLEOBJECT_T2528358522_H
#define SCRIPTABLEOBJECT_T2528358522_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.ScriptableObject
struct ScriptableObject_t2528358522 : public Object_t631007953
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Native definition for P/Invoke marshalling of UnityEngine.ScriptableObject
struct ScriptableObject_t2528358522_marshaled_pinvoke : public Object_t631007953_marshaled_pinvoke
{
};
// Native definition for COM marshalling of UnityEngine.ScriptableObject
struct ScriptableObject_t2528358522_marshaled_com : public Object_t631007953_marshaled_com
{
};
#endif // SCRIPTABLEOBJECT_T2528358522_H
#ifndef TYPE_T_H
#define TYPE_T_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Type
struct Type_t : public MemberInfo_t
{
public:
// System.RuntimeTypeHandle System.Type::_impl
RuntimeTypeHandle_t3027515415 ____impl_1;
public:
inline static int32_t get_offset_of__impl_1() { return static_cast<int32_t>(offsetof(Type_t, ____impl_1)); }
inline RuntimeTypeHandle_t3027515415 get__impl_1() const { return ____impl_1; }
inline RuntimeTypeHandle_t3027515415 * get_address_of__impl_1() { return &____impl_1; }
inline void set__impl_1(RuntimeTypeHandle_t3027515415 value)
{
____impl_1 = value;
}
};
struct Type_t_StaticFields
{
public:
// System.Char System.Type::Delimiter
Il2CppChar ___Delimiter_2;
// System.Type[] System.Type::EmptyTypes
TypeU5BU5D_t3940880105* ___EmptyTypes_3;
// System.Reflection.MemberFilter System.Type::FilterAttribute
MemberFilter_t426314064 * ___FilterAttribute_4;
// System.Reflection.MemberFilter System.Type::FilterName
MemberFilter_t426314064 * ___FilterName_5;
// System.Reflection.MemberFilter System.Type::FilterNameIgnoreCase
MemberFilter_t426314064 * ___FilterNameIgnoreCase_6;
// System.Object System.Type::Missing
RuntimeObject * ___Missing_7;
public:
inline static int32_t get_offset_of_Delimiter_2() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___Delimiter_2)); }
inline Il2CppChar get_Delimiter_2() const { return ___Delimiter_2; }
inline Il2CppChar* get_address_of_Delimiter_2() { return &___Delimiter_2; }
inline void set_Delimiter_2(Il2CppChar value)
{
___Delimiter_2 = value;
}
inline static int32_t get_offset_of_EmptyTypes_3() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___EmptyTypes_3)); }
inline TypeU5BU5D_t3940880105* get_EmptyTypes_3() const { return ___EmptyTypes_3; }
inline TypeU5BU5D_t3940880105** get_address_of_EmptyTypes_3() { return &___EmptyTypes_3; }
inline void set_EmptyTypes_3(TypeU5BU5D_t3940880105* value)
{
___EmptyTypes_3 = value;
Il2CppCodeGenWriteBarrier((&___EmptyTypes_3), value);
}
inline static int32_t get_offset_of_FilterAttribute_4() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___FilterAttribute_4)); }
inline MemberFilter_t426314064 * get_FilterAttribute_4() const { return ___FilterAttribute_4; }
inline MemberFilter_t426314064 ** get_address_of_FilterAttribute_4() { return &___FilterAttribute_4; }
inline void set_FilterAttribute_4(MemberFilter_t426314064 * value)
{
___FilterAttribute_4 = value;
Il2CppCodeGenWriteBarrier((&___FilterAttribute_4), value);
}
inline static int32_t get_offset_of_FilterName_5() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___FilterName_5)); }
inline MemberFilter_t426314064 * get_FilterName_5() const { return ___FilterName_5; }
inline MemberFilter_t426314064 ** get_address_of_FilterName_5() { return &___FilterName_5; }
inline void set_FilterName_5(MemberFilter_t426314064 * value)
{
___FilterName_5 = value;
Il2CppCodeGenWriteBarrier((&___FilterName_5), value);
}
inline static int32_t get_offset_of_FilterNameIgnoreCase_6() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___FilterNameIgnoreCase_6)); }
inline MemberFilter_t426314064 * get_FilterNameIgnoreCase_6() const { return ___FilterNameIgnoreCase_6; }
inline MemberFilter_t426314064 ** get_address_of_FilterNameIgnoreCase_6() { return &___FilterNameIgnoreCase_6; }
inline void set_FilterNameIgnoreCase_6(MemberFilter_t426314064 * value)
{
___FilterNameIgnoreCase_6 = value;
Il2CppCodeGenWriteBarrier((&___FilterNameIgnoreCase_6), value);
}
inline static int32_t get_offset_of_Missing_7() { return static_cast<int32_t>(offsetof(Type_t_StaticFields, ___Missing_7)); }
inline RuntimeObject * get_Missing_7() const { return ___Missing_7; }
inline RuntimeObject ** get_address_of_Missing_7() { return &___Missing_7; }
inline void set_Missing_7(RuntimeObject * value)
{
___Missing_7 = value;
Il2CppCodeGenWriteBarrier((&___Missing_7), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // TYPE_T_H
#ifndef AUDIOCLIP_T3680889665_H
#define AUDIOCLIP_T3680889665_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioClip
struct AudioClip_t3680889665 : public Object_t631007953
{
public:
// UnityEngine.AudioClip/PCMReaderCallback UnityEngine.AudioClip::m_PCMReaderCallback
PCMReaderCallback_t1677636661 * ___m_PCMReaderCallback_2;
// UnityEngine.AudioClip/PCMSetPositionCallback UnityEngine.AudioClip::m_PCMSetPositionCallback
PCMSetPositionCallback_t1059417452 * ___m_PCMSetPositionCallback_3;
public:
inline static int32_t get_offset_of_m_PCMReaderCallback_2() { return static_cast<int32_t>(offsetof(AudioClip_t3680889665, ___m_PCMReaderCallback_2)); }
inline PCMReaderCallback_t1677636661 * get_m_PCMReaderCallback_2() const { return ___m_PCMReaderCallback_2; }
inline PCMReaderCallback_t1677636661 ** get_address_of_m_PCMReaderCallback_2() { return &___m_PCMReaderCallback_2; }
inline void set_m_PCMReaderCallback_2(PCMReaderCallback_t1677636661 * value)
{
___m_PCMReaderCallback_2 = value;
Il2CppCodeGenWriteBarrier((&___m_PCMReaderCallback_2), value);
}
inline static int32_t get_offset_of_m_PCMSetPositionCallback_3() { return static_cast<int32_t>(offsetof(AudioClip_t3680889665, ___m_PCMSetPositionCallback_3)); }
inline PCMSetPositionCallback_t1059417452 * get_m_PCMSetPositionCallback_3() const { return ___m_PCMSetPositionCallback_3; }
inline PCMSetPositionCallback_t1059417452 ** get_address_of_m_PCMSetPositionCallback_3() { return &___m_PCMSetPositionCallback_3; }
inline void set_m_PCMSetPositionCallback_3(PCMSetPositionCallback_t1059417452 * value)
{
___m_PCMSetPositionCallback_3 = value;
Il2CppCodeGenWriteBarrier((&___m_PCMSetPositionCallback_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOCLIP_T3680889665_H
#ifndef AUDIOPLAYABLEOUTPUT_T2664391219_H
#define AUDIOPLAYABLEOUTPUT_T2664391219_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Audio.AudioPlayableOutput
struct AudioPlayableOutput_t2664391219
{
public:
// UnityEngine.Playables.PlayableOutputHandle UnityEngine.Audio.AudioPlayableOutput::m_Handle
PlayableOutputHandle_t4208053793 ___m_Handle_0;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioPlayableOutput_t2664391219, ___m_Handle_0)); }
inline PlayableOutputHandle_t4208053793 get_m_Handle_0() const { return ___m_Handle_0; }
inline PlayableOutputHandle_t4208053793 * get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(PlayableOutputHandle_t4208053793 value)
{
___m_Handle_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOPLAYABLEOUTPUT_T2664391219_H
#ifndef AUDIOMIXERPLAYABLE_T3520548497_H
#define AUDIOMIXERPLAYABLE_T3520548497_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Audio.AudioMixerPlayable
struct AudioMixerPlayable_t3520548497
{
public:
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::m_Handle
PlayableHandle_t1095853803 ___m_Handle_0;
public:
inline static int32_t get_offset_of_m_Handle_0() { return static_cast<int32_t>(offsetof(AudioMixerPlayable_t3520548497, ___m_Handle_0)); }
inline PlayableHandle_t1095853803 get_m_Handle_0() const { return ___m_Handle_0; }
inline PlayableHandle_t1095853803 * get_address_of_m_Handle_0() { return &___m_Handle_0; }
inline void set_m_Handle_0(PlayableHandle_t1095853803 value)
{
___m_Handle_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOMIXERPLAYABLE_T3520548497_H
#ifndef AUDIOSOURCEEXTENSION_T3064908834_H
#define AUDIOSOURCEEXTENSION_T3064908834_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioSourceExtension
struct AudioSourceExtension_t3064908834 : public ScriptableObject_t2528358522
{
public:
// UnityEngine.AudioSource UnityEngine.AudioSourceExtension::m_audioSource
AudioSource_t3935305588 * ___m_audioSource_2;
// System.Int32 UnityEngine.AudioSourceExtension::m_ExtensionManagerUpdateIndex
int32_t ___m_ExtensionManagerUpdateIndex_3;
public:
inline static int32_t get_offset_of_m_audioSource_2() { return static_cast<int32_t>(offsetof(AudioSourceExtension_t3064908834, ___m_audioSource_2)); }
inline AudioSource_t3935305588 * get_m_audioSource_2() const { return ___m_audioSource_2; }
inline AudioSource_t3935305588 ** get_address_of_m_audioSource_2() { return &___m_audioSource_2; }
inline void set_m_audioSource_2(AudioSource_t3935305588 * value)
{
___m_audioSource_2 = value;
Il2CppCodeGenWriteBarrier((&___m_audioSource_2), value);
}
inline static int32_t get_offset_of_m_ExtensionManagerUpdateIndex_3() { return static_cast<int32_t>(offsetof(AudioSourceExtension_t3064908834, ___m_ExtensionManagerUpdateIndex_3)); }
inline int32_t get_m_ExtensionManagerUpdateIndex_3() const { return ___m_ExtensionManagerUpdateIndex_3; }
inline int32_t* get_address_of_m_ExtensionManagerUpdateIndex_3() { return &___m_ExtensionManagerUpdateIndex_3; }
inline void set_m_ExtensionManagerUpdateIndex_3(int32_t value)
{
___m_ExtensionManagerUpdateIndex_3 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOSOURCEEXTENSION_T3064908834_H
#ifndef PCMSETPOSITIONCALLBACK_T1059417452_H
#define PCMSETPOSITIONCALLBACK_T1059417452_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioClip/PCMSetPositionCallback
struct PCMSetPositionCallback_t1059417452 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // PCMSETPOSITIONCALLBACK_T1059417452_H
#ifndef PCMREADERCALLBACK_T1677636661_H
#define PCMREADERCALLBACK_T1677636661_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioClip/PCMReaderCallback
struct PCMReaderCallback_t1677636661 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // PCMREADERCALLBACK_T1677636661_H
#ifndef BEHAVIOUR_T1437897464_H
#define BEHAVIOUR_T1437897464_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Behaviour
struct Behaviour_t1437897464 : public Component_t1923634451
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // BEHAVIOUR_T1437897464_H
#ifndef ASYNCCALLBACK_T3962456242_H
#define ASYNCCALLBACK_T3962456242_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.AsyncCallback
struct AsyncCallback_t3962456242 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // ASYNCCALLBACK_T3962456242_H
#ifndef AUDIOCONFIGURATIONCHANGEHANDLER_T2089929874_H
#define AUDIOCONFIGURATIONCHANGEHANDLER_T2089929874_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioSettings/AudioConfigurationChangeHandler
struct AudioConfigurationChangeHandler_t2089929874 : public MulticastDelegate_t
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOCONFIGURATIONCHANGEHANDLER_T2089929874_H
#ifndef AUDIOLISTENEREXTENSION_T3242956547_H
#define AUDIOLISTENEREXTENSION_T3242956547_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioListenerExtension
struct AudioListenerExtension_t3242956547 : public ScriptableObject_t2528358522
{
public:
// UnityEngine.AudioListener UnityEngine.AudioListenerExtension::m_audioListener
AudioListener_t2734094699 * ___m_audioListener_2;
public:
inline static int32_t get_offset_of_m_audioListener_2() { return static_cast<int32_t>(offsetof(AudioListenerExtension_t3242956547, ___m_audioListener_2)); }
inline AudioListener_t2734094699 * get_m_audioListener_2() const { return ___m_audioListener_2; }
inline AudioListener_t2734094699 ** get_address_of_m_audioListener_2() { return &___m_audioListener_2; }
inline void set_m_audioListener_2(AudioListener_t2734094699 * value)
{
___m_audioListener_2 = value;
Il2CppCodeGenWriteBarrier((&___m_audioListener_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOLISTENEREXTENSION_T3242956547_H
#ifndef WEBCAMTEXTURE_T1514609158_H
#define WEBCAMTEXTURE_T1514609158_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.WebCamTexture
struct WebCamTexture_t1514609158 : public Texture_t3661962703
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // WEBCAMTEXTURE_T1514609158_H
#ifndef AUDIOSOURCE_T3935305588_H
#define AUDIOSOURCE_T3935305588_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioSource
struct AudioSource_t3935305588 : public Behaviour_t1437897464
{
public:
// UnityEngine.AudioSourceExtension UnityEngine.AudioSource::spatializerExtension
AudioSourceExtension_t3064908834 * ___spatializerExtension_2;
// UnityEngine.AudioSourceExtension UnityEngine.AudioSource::ambisonicExtension
AudioSourceExtension_t3064908834 * ___ambisonicExtension_3;
public:
inline static int32_t get_offset_of_spatializerExtension_2() { return static_cast<int32_t>(offsetof(AudioSource_t3935305588, ___spatializerExtension_2)); }
inline AudioSourceExtension_t3064908834 * get_spatializerExtension_2() const { return ___spatializerExtension_2; }
inline AudioSourceExtension_t3064908834 ** get_address_of_spatializerExtension_2() { return &___spatializerExtension_2; }
inline void set_spatializerExtension_2(AudioSourceExtension_t3064908834 * value)
{
___spatializerExtension_2 = value;
Il2CppCodeGenWriteBarrier((&___spatializerExtension_2), value);
}
inline static int32_t get_offset_of_ambisonicExtension_3() { return static_cast<int32_t>(offsetof(AudioSource_t3935305588, ___ambisonicExtension_3)); }
inline AudioSourceExtension_t3064908834 * get_ambisonicExtension_3() const { return ___ambisonicExtension_3; }
inline AudioSourceExtension_t3064908834 ** get_address_of_ambisonicExtension_3() { return &___ambisonicExtension_3; }
inline void set_ambisonicExtension_3(AudioSourceExtension_t3064908834 * value)
{
___ambisonicExtension_3 = value;
Il2CppCodeGenWriteBarrier((&___ambisonicExtension_3), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOSOURCE_T3935305588_H
#ifndef AUDIOLISTENER_T2734094699_H
#define AUDIOLISTENER_T2734094699_H
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioListener
struct AudioListener_t2734094699 : public Behaviour_t1437897464
{
public:
// UnityEngine.AudioListenerExtension UnityEngine.AudioListener::spatializerExtension
AudioListenerExtension_t3242956547 * ___spatializerExtension_2;
public:
inline static int32_t get_offset_of_spatializerExtension_2() { return static_cast<int32_t>(offsetof(AudioListener_t2734094699, ___spatializerExtension_2)); }
inline AudioListenerExtension_t3242956547 * get_spatializerExtension_2() const { return ___spatializerExtension_2; }
inline AudioListenerExtension_t3242956547 ** get_address_of_spatializerExtension_2() { return &___spatializerExtension_2; }
inline void set_spatializerExtension_2(AudioListenerExtension_t3242956547 * value)
{
___spatializerExtension_2 = value;
Il2CppCodeGenWriteBarrier((&___spatializerExtension_2), value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#endif // AUDIOLISTENER_T2734094699_H
// System.Single[]
struct SingleU5BU5D_t1444911251 : public RuntimeArray
{
public:
ALIGN_FIELD (8) float m_Items[1];
public:
inline float GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline float* GetAddressAt(il2cpp_array_size_t index)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items + index;
}
inline void SetAt(il2cpp_array_size_t index, float value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
}
inline float GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline float* GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, float value)
{
m_Items[index] = value;
}
};
// System.String[]
struct StringU5BU5D_t1281789340 : public RuntimeArray
{
public:
ALIGN_FIELD (8) String_t* m_Items[1];
public:
inline String_t* GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline String_t** GetAddressAt(il2cpp_array_size_t index)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items + index;
}
inline void SetAt(il2cpp_array_size_t index, String_t* value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
Il2CppCodeGenWriteBarrier(m_Items + index, value);
}
inline String_t* GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline String_t** GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, String_t* value)
{
m_Items[index] = value;
Il2CppCodeGenWriteBarrier(m_Items + index, value);
}
};
// UnityEngine.WebCamDevice[]
struct WebCamDeviceU5BU5D_t4294070825 : public RuntimeArray
{
public:
ALIGN_FIELD (8) WebCamDevice_t1322781432 m_Items[1];
public:
inline WebCamDevice_t1322781432 GetAt(il2cpp_array_size_t index) const
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items[index];
}
inline WebCamDevice_t1322781432 * GetAddressAt(il2cpp_array_size_t index)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
return m_Items + index;
}
inline void SetAt(il2cpp_array_size_t index, WebCamDevice_t1322781432 value)
{
IL2CPP_ARRAY_BOUNDS_CHECK(index, (uint32_t)(this)->max_length);
m_Items[index] = value;
}
inline WebCamDevice_t1322781432 GetAtUnchecked(il2cpp_array_size_t index) const
{
return m_Items[index];
}
inline WebCamDevice_t1322781432 * GetAddressAtUnchecked(il2cpp_array_size_t index)
{
return m_Items + index;
}
inline void SetAtUnchecked(il2cpp_array_size_t index, WebCamDevice_t1322781432 value)
{
m_Items[index] = value;
}
};
// System.Collections.Generic.List`1/Enumerator<!0> System.Collections.Generic.List`1<System.Object>::GetEnumerator()
extern "C" IL2CPP_METHOD_ATTR Enumerator_t2146457487 List_1_GetEnumerator_m2930774921_gshared (List_1_t257213610 * __this, const RuntimeMethod* method);
// !0 System.Collections.Generic.List`1/Enumerator<System.Object>::get_Current()
extern "C" IL2CPP_METHOD_ATTR RuntimeObject * Enumerator_get_Current_m470245444_gshared (Enumerator_t2146457487 * __this, const RuntimeMethod* method);
// System.Boolean System.Collections.Generic.List`1/Enumerator<System.Object>::MoveNext()
extern "C" IL2CPP_METHOD_ATTR bool Enumerator_MoveNext_m2142368520_gshared (Enumerator_t2146457487 * __this, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1/Enumerator<System.Object>::Dispose()
extern "C" IL2CPP_METHOD_ATTR void Enumerator_Dispose_m3007748546_gshared (Enumerator_t2146457487 * __this, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<System.Object>::Add(!0)
extern "C" IL2CPP_METHOD_ATTR void List_1_Add_m3338814081_gshared (List_1_t257213610 * __this, RuntimeObject * p0, const RuntimeMethod* method);
// System.Int32 System.Collections.Generic.List`1<System.Object>::get_Count()
extern "C" IL2CPP_METHOD_ATTR int32_t List_1_get_Count_m2934127733_gshared (List_1_t257213610 * __this, const RuntimeMethod* method);
// !0 System.Collections.Generic.List`1<System.Object>::get_Item(System.Int32)
extern "C" IL2CPP_METHOD_ATTR RuntimeObject * List_1_get_Item_m2287542950_gshared (List_1_t257213610 * __this, int32_t p0, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<System.Object>::set_Item(System.Int32,!0)
extern "C" IL2CPP_METHOD_ATTR void List_1_set_Item_m1979164443_gshared (List_1_t257213610 * __this, int32_t p0, RuntimeObject * p1, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<System.Object>::RemoveAt(System.Int32)
extern "C" IL2CPP_METHOD_ATTR void List_1_RemoveAt_m2730968292_gshared (List_1_t257213610 * __this, int32_t p0, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<System.Object>::.ctor()
extern "C" IL2CPP_METHOD_ATTR void List_1__ctor_m2321703786_gshared (List_1_t257213610 * __this, const RuntimeMethod* method);
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::GetHandle()
extern "C" IL2CPP_METHOD_ATTR PlayableHandle_t1095853803 AudioClipPlayable_GetHandle_m1762771314 (AudioClipPlayable_t785069022 * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.Playables.PlayableHandle::op_Equality(UnityEngine.Playables.PlayableHandle,UnityEngine.Playables.PlayableHandle)
extern "C" IL2CPP_METHOD_ATTR bool PlayableHandle_op_Equality_m3344837515 (RuntimeObject * __this /* static, unused */, PlayableHandle_t1095853803 p0, PlayableHandle_t1095853803 p1, const RuntimeMethod* method);
// System.Boolean UnityEngine.Audio.AudioClipPlayable::Equals(UnityEngine.Audio.AudioClipPlayable)
extern "C" IL2CPP_METHOD_ATTR bool AudioClipPlayable_Equals_m3705880618 (AudioClipPlayable_t785069022 * __this, AudioClipPlayable_t785069022 ___other0, const RuntimeMethod* method);
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::GetHandle()
extern "C" IL2CPP_METHOD_ATTR PlayableHandle_t1095853803 AudioMixerPlayable_GetHandle_m57919556 (AudioMixerPlayable_t3520548497 * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.Audio.AudioMixerPlayable::Equals(UnityEngine.Audio.AudioMixerPlayable)
extern "C" IL2CPP_METHOD_ATTR bool AudioMixerPlayable_Equals_m1649866213 (AudioMixerPlayable_t3520548497 * __this, AudioMixerPlayable_t3520548497 ___other0, const RuntimeMethod* method);
// System.Void UnityEngine.Object::.ctor()
extern "C" IL2CPP_METHOD_ATTR void Object__ctor_m1087895580 (Object_t631007953 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.AudioClip/PCMReaderCallback::Invoke(System.Single[])
extern "C" IL2CPP_METHOD_ATTR void PCMReaderCallback_Invoke_m2948796957 (PCMReaderCallback_t1677636661 * __this, SingleU5BU5D_t1444911251* ___data0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioClip/PCMSetPositionCallback::Invoke(System.Int32)
extern "C" IL2CPP_METHOD_ATTR void PCMSetPositionCallback_Invoke_m2167694991 (PCMSetPositionCallback_t1059417452 * __this, int32_t ___position0, const RuntimeMethod* method);
// System.String System.String::Concat(System.String[])
extern "C" IL2CPP_METHOD_ATTR String_t* String_Concat_m1809518182 (RuntimeObject * __this /* static, unused */, StringU5BU5D_t1281789340* p0, const RuntimeMethod* method);
// System.Type System.Type::GetType(System.String)
extern "C" IL2CPP_METHOD_ATTR Type_t * Type_GetType_m1693760368 (RuntimeObject * __this /* static, unused */, String_t* p0, const RuntimeMethod* method);
// System.Boolean UnityEngine.AudioSource::get_spatialize()
extern "C" IL2CPP_METHOD_ATTR bool AudioSource_get_spatialize_m3609701298 (AudioSource_t3935305588 * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.Object::op_Inequality(UnityEngine.Object,UnityEngine.Object)
extern "C" IL2CPP_METHOD_ATTR bool Object_op_Inequality_m4071470834 (RuntimeObject * __this /* static, unused */, Object_t631007953 * p0, Object_t631007953 * p1, const RuntimeMethod* method);
// System.Void UnityEngine.AudioExtensionManager::RegisterBuiltinDefinitions()
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method);
// System.Collections.Generic.List`1/Enumerator<!0> System.Collections.Generic.List`1<UnityEngine.AudioSpatializerExtensionDefinition>::GetEnumerator()
#define List_1_GetEnumerator_m1716448724(__this, method) (( Enumerator_t3959214805 (*) (List_1_t2069970928 *, const RuntimeMethod*))List_1_GetEnumerator_m2930774921_gshared)(__this, method)
// !0 System.Collections.Generic.List`1/Enumerator<UnityEngine.AudioSpatializerExtensionDefinition>::get_Current()
#define Enumerator_get_Current_m615903654(__this, method) (( AudioSpatializerExtensionDefinition_t597896186 * (*) (Enumerator_t3959214805 *, const RuntimeMethod*))Enumerator_get_Current_m470245444_gshared)(__this, method)
// System.String UnityEngine.AudioSettings::GetSpatializerPluginName()
extern "C" IL2CPP_METHOD_ATTR String_t* AudioSettings_GetSpatializerPluginName_m1324100978 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method);
// UnityEngine.PropertyName UnityEngine.PropertyName::op_Implicit(System.String)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 PropertyName_op_Implicit_m1633828199 (RuntimeObject * __this /* static, unused */, String_t* p0, const RuntimeMethod* method);
// System.Boolean UnityEngine.PropertyName::op_Equality(UnityEngine.PropertyName,UnityEngine.PropertyName)
extern "C" IL2CPP_METHOD_ATTR bool PropertyName_op_Equality_m2761233272 (RuntimeObject * __this /* static, unused */, PropertyName_t3749835189 p0, PropertyName_t3749835189 p1, const RuntimeMethod* method);
// System.Type UnityEngine.AudioExtensionDefinition::GetExtensionType()
extern "C" IL2CPP_METHOD_ATTR Type_t * AudioExtensionDefinition_GetExtensionType_m1450823952 (AudioExtensionDefinition_t3271167678 * __this, const RuntimeMethod* method);
// UnityEngine.AudioSourceExtension UnityEngine.AudioSource::AddSpatializerExtension(System.Type)
extern "C" IL2CPP_METHOD_ATTR AudioSourceExtension_t3064908834 * AudioSource_AddSpatializerExtension_m2560794359 (AudioSource_t3935305588 * __this, Type_t * ___extensionType0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioSourceExtension::set_audioSource(UnityEngine.AudioSource)
extern "C" IL2CPP_METHOD_ATTR void AudioSourceExtension_set_audioSource_m3729768988 (AudioSourceExtension_t3064908834 * __this, AudioSource_t3935305588 * ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioExtensionManager::WriteExtensionProperties(UnityEngine.AudioSourceExtension,System.String)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_WriteExtensionProperties_m1988587615 (RuntimeObject * __this /* static, unused */, AudioSourceExtension_t3064908834 * ___extension0, String_t* ___extensionName1, const RuntimeMethod* method);
// System.Boolean System.Collections.Generic.List`1/Enumerator<UnityEngine.AudioSpatializerExtensionDefinition>::MoveNext()
#define Enumerator_MoveNext_m2697843606(__this, method) (( bool (*) (Enumerator_t3959214805 *, const RuntimeMethod*))Enumerator_MoveNext_m2142368520_gshared)(__this, method)
// System.Void System.Collections.Generic.List`1/Enumerator<UnityEngine.AudioSpatializerExtensionDefinition>::Dispose()
#define Enumerator_Dispose_m3198901590(__this, method) (( void (*) (Enumerator_t3959214805 *, const RuntimeMethod*))Enumerator_Dispose_m3007748546_gshared)(__this, method)
// System.Collections.Generic.List`1/Enumerator<!0> System.Collections.Generic.List`1<UnityEngine.AudioAmbisonicExtensionDefinition>::GetEnumerator()
#define List_1_GetEnumerator_m2295013814(__this, method) (( Enumerator_t3184778213 (*) (List_1_t1295534336 *, const RuntimeMethod*))List_1_GetEnumerator_m2930774921_gshared)(__this, method)
// !0 System.Collections.Generic.List`1/Enumerator<UnityEngine.AudioAmbisonicExtensionDefinition>::get_Current()
#define Enumerator_get_Current_m967136761(__this, method) (( AudioAmbisonicExtensionDefinition_t4118426890 * (*) (Enumerator_t3184778213 *, const RuntimeMethod*))Enumerator_get_Current_m470245444_gshared)(__this, method)
// System.String UnityEngine.AudioSettings::GetAmbisonicDecoderPluginName()
extern "C" IL2CPP_METHOD_ATTR String_t* AudioSettings_GetAmbisonicDecoderPluginName_m19603540 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method);
// UnityEngine.AudioSourceExtension UnityEngine.AudioSource::AddAmbisonicExtension(System.Type)
extern "C" IL2CPP_METHOD_ATTR AudioSourceExtension_t3064908834 * AudioSource_AddAmbisonicExtension_m304476911 (AudioSource_t3935305588 * __this, Type_t * ___extensionType0, const RuntimeMethod* method);
// System.Boolean System.Collections.Generic.List`1/Enumerator<UnityEngine.AudioAmbisonicExtensionDefinition>::MoveNext()
#define Enumerator_MoveNext_m1000499844(__this, method) (( bool (*) (Enumerator_t3184778213 *, const RuntimeMethod*))Enumerator_MoveNext_m2142368520_gshared)(__this, method)
// System.Void System.Collections.Generic.List`1/Enumerator<UnityEngine.AudioAmbisonicExtensionDefinition>::Dispose()
#define Enumerator_Dispose_m405442337(__this, method) (( void (*) (Enumerator_t3184778213 *, const RuntimeMethod*))Enumerator_Dispose_m3007748546_gshared)(__this, method)
// UnityEngine.PropertyName UnityEngine.PropertyName::op_Implicit(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 PropertyName_op_Implicit_m114733813 (RuntimeObject * __this /* static, unused */, int32_t p0, const RuntimeMethod* method);
// UnityEngine.AudioSource UnityEngine.AudioSourceExtension::get_audioSource()
extern "C" IL2CPP_METHOD_ATTR AudioSource_t3935305588 * AudioSourceExtension_get_audioSource_m1465006871 (AudioSourceExtension_t3064908834 * __this, const RuntimeMethod* method);
// UnityEngine.PropertyName UnityEngine.AudioSource::ReadExtensionName(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 AudioSource_ReadExtensionName_m725112169 (AudioSource_t3935305588 * __this, int32_t ___sourceIndex0, const RuntimeMethod* method);
// UnityEngine.PropertyName UnityEngine.AudioSource::ReadExtensionPropertyName(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 AudioSource_ReadExtensionPropertyName_m2761820692 (AudioSource_t3935305588 * __this, int32_t ___sourceIndex0, const RuntimeMethod* method);
// System.Single UnityEngine.AudioSource::ReadExtensionPropertyValue(System.Int32)
extern "C" IL2CPP_METHOD_ATTR float AudioSource_ReadExtensionPropertyValue_m72717540 (AudioSource_t3935305588 * __this, int32_t ___sourceIndex0, const RuntimeMethod* method);
// System.Int32 UnityEngine.AudioSource::GetNumExtensionProperties()
extern "C" IL2CPP_METHOD_ATTR int32_t AudioSource_GetNumExtensionProperties_m1231815209 (AudioSource_t3935305588 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.AudioSource::ClearExtensionProperties(UnityEngine.PropertyName)
extern "C" IL2CPP_METHOD_ATTR void AudioSource_ClearExtensionProperties_m2116074582 (AudioSource_t3935305588 * __this, PropertyName_t3749835189 ___extensionName0, const RuntimeMethod* method);
// UnityEngine.AudioListenerExtension UnityEngine.AudioListener::AddExtension(System.Type)
extern "C" IL2CPP_METHOD_ATTR AudioListenerExtension_t3242956547 * AudioListener_AddExtension_m994751216 (AudioListener_t2734094699 * __this, Type_t * ___extensionType0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioListenerExtension::set_audioListener(UnityEngine.AudioListener)
extern "C" IL2CPP_METHOD_ATTR void AudioListenerExtension_set_audioListener_m3412289012 (AudioListenerExtension_t3242956547 * __this, AudioListener_t2734094699 * ___value0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioExtensionManager::WriteExtensionProperties(UnityEngine.AudioListenerExtension,System.String)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_WriteExtensionProperties_m3028464154 (RuntimeObject * __this /* static, unused */, AudioListenerExtension_t3242956547 * ___extension0, String_t* ___extensionName1, const RuntimeMethod* method);
// UnityEngine.AudioListener UnityEngine.AudioListenerExtension::get_audioListener()
extern "C" IL2CPP_METHOD_ATTR AudioListener_t2734094699 * AudioListenerExtension_get_audioListener_m3597041395 (AudioListenerExtension_t3242956547 * __this, const RuntimeMethod* method);
// UnityEngine.PropertyName UnityEngine.AudioListener::ReadExtensionName(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 AudioListener_ReadExtensionName_m929423100 (AudioListener_t2734094699 * __this, int32_t ___listenerIndex0, const RuntimeMethod* method);
// UnityEngine.PropertyName UnityEngine.AudioListener::ReadExtensionPropertyName(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 AudioListener_ReadExtensionPropertyName_m3416271339 (AudioListener_t2734094699 * __this, int32_t ___listenerIndex0, const RuntimeMethod* method);
// System.Single UnityEngine.AudioListener::ReadExtensionPropertyValue(System.Int32)
extern "C" IL2CPP_METHOD_ATTR float AudioListener_ReadExtensionPropertyValue_m2443832840 (AudioListener_t2734094699 * __this, int32_t ___listenerIndex0, const RuntimeMethod* method);
// System.Int32 UnityEngine.AudioListener::GetNumExtensionProperties()
extern "C" IL2CPP_METHOD_ATTR int32_t AudioListener_GetNumExtensionProperties_m3139224773 (AudioListener_t2734094699 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.AudioListener::ClearExtensionProperties(UnityEngine.PropertyName)
extern "C" IL2CPP_METHOD_ATTR void AudioListener_ClearExtensionProperties_m3849891634 (AudioListener_t2734094699 * __this, PropertyName_t3749835189 ___extensionName0, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension>::Add(!0)
#define List_1_Add_m2957197106(__this, p0, method) (( void (*) (List_1_t242016280 *, AudioSourceExtension_t3064908834 *, const RuntimeMethod*))List_1_Add_m3338814081_gshared)(__this, p0, method)
// System.Int32 System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension>::get_Count()
#define List_1_get_Count_m3844406869(__this, method) (( int32_t (*) (List_1_t242016280 *, const RuntimeMethod*))List_1_get_Count_m2934127733_gshared)(__this, method)
// !0 System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension>::get_Item(System.Int32)
#define List_1_get_Item_m1395253538(__this, p0, method) (( AudioSourceExtension_t3064908834 * (*) (List_1_t242016280 *, int32_t, const RuntimeMethod*))List_1_get_Item_m2287542950_gshared)(__this, p0, method)
// System.Void System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension>::set_Item(System.Int32,!0)
#define List_1_set_Item_m845928814(__this, p0, p1, method) (( void (*) (List_1_t242016280 *, int32_t, AudioSourceExtension_t3064908834 *, const RuntimeMethod*))List_1_set_Item_m1979164443_gshared)(__this, p0, p1, method)
// System.Void System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension>::RemoveAt(System.Int32)
#define List_1_RemoveAt_m2462508318(__this, p0, method) (( void (*) (List_1_t242016280 *, int32_t, const RuntimeMethod*))List_1_RemoveAt_m2730968292_gshared)(__this, p0, method)
// UnityEngine.Object UnityEngine.AudioExtensionManager::GetAudioListener()
extern "C" IL2CPP_METHOD_ATTR Object_t631007953 * AudioExtensionManager_GetAudioListener_m817760607 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method);
// UnityEngine.AudioListenerExtension UnityEngine.AudioExtensionManager::AddSpatializerExtension(UnityEngine.AudioListener)
extern "C" IL2CPP_METHOD_ATTR AudioListenerExtension_t3242956547 * AudioExtensionManager_AddSpatializerExtension_m3915849352 (RuntimeObject * __this /* static, unused */, AudioListener_t2734094699 * ___listener0, const RuntimeMethod* method);
// System.Boolean UnityEngine.Object::op_Equality(UnityEngine.Object,UnityEngine.Object)
extern "C" IL2CPP_METHOD_ATTR bool Object_op_Equality_m1810815630 (RuntimeObject * __this /* static, unused */, Object_t631007953 * p0, Object_t631007953 * p1, const RuntimeMethod* method);
// System.Boolean UnityEngine.Behaviour::get_enabled()
extern "C" IL2CPP_METHOD_ATTR bool Behaviour_get_enabled_m753527255 (Behaviour_t1437897464 * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.AudioSource::get_isPlaying()
extern "C" IL2CPP_METHOD_ATTR bool AudioSource_get_isPlaying_m1896551654 (AudioSource_t3935305588 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.AudioExtensionManager::RemoveExtensionFromManager(UnityEngine.AudioSourceExtension)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_RemoveExtensionFromManager_m442924172 (RuntimeObject * __this /* static, unused */, AudioSourceExtension_t3064908834 * ___extension0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioExtensionManager::AddExtensionToManager(UnityEngine.AudioSourceExtension)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_AddExtensionToManager_m3475649283 (RuntimeObject * __this /* static, unused */, AudioSourceExtension_t3064908834 * ___extension0, const RuntimeMethod* method);
// System.Boolean System.String::op_Equality(System.String,System.String)
extern "C" IL2CPP_METHOD_ATTR bool String_op_Equality_m920492651 (RuntimeObject * __this /* static, unused */, String_t* p0, String_t* p1, const RuntimeMethod* method);
// System.Void System.Collections.Generic.List`1<UnityEngine.AudioSpatializerExtensionDefinition>::.ctor()
#define List_1__ctor_m3866378638(__this, method) (( void (*) (List_1_t2069970928 *, const RuntimeMethod*))List_1__ctor_m2321703786_gshared)(__this, method)
// System.Void System.Collections.Generic.List`1<UnityEngine.AudioAmbisonicExtensionDefinition>::.ctor()
#define List_1__ctor_m4205755667(__this, method) (( void (*) (List_1_t1295534336 *, const RuntimeMethod*))List_1__ctor_m2321703786_gshared)(__this, method)
// System.Void System.Collections.Generic.List`1<UnityEngine.AudioSourceExtension>::.ctor()
#define List_1__ctor_m69557434(__this, method) (( void (*) (List_1_t242016280 *, const RuntimeMethod*))List_1__ctor_m2321703786_gshared)(__this, method)
// System.Void UnityEngine.AudioListener::INTERNAL_CALL_ReadExtensionName(UnityEngine.AudioListener,System.Int32,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioListener_INTERNAL_CALL_ReadExtensionName_m4145804327 (RuntimeObject * __this /* static, unused */, AudioListener_t2734094699 * ___self0, int32_t ___listenerIndex1, PropertyName_t3749835189 * ___value2, const RuntimeMethod* method);
// System.Void UnityEngine.AudioListener::INTERNAL_CALL_ReadExtensionPropertyName(UnityEngine.AudioListener,System.Int32,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioListener_INTERNAL_CALL_ReadExtensionPropertyName_m330480156 (RuntimeObject * __this /* static, unused */, AudioListener_t2734094699 * ___self0, int32_t ___listenerIndex1, PropertyName_t3749835189 * ___value2, const RuntimeMethod* method);
// System.Void UnityEngine.AudioListener::INTERNAL_CALL_ClearExtensionProperties(UnityEngine.AudioListener,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioListener_INTERNAL_CALL_ClearExtensionProperties_m2036387607 (RuntimeObject * __this /* static, unused */, AudioListener_t2734094699 * ___self0, PropertyName_t3749835189 * ___extensionName1, const RuntimeMethod* method);
// UnityEngine.ScriptableObject UnityEngine.ScriptableObject::CreateInstance(System.Type)
extern "C" IL2CPP_METHOD_ATTR ScriptableObject_t2528358522 * ScriptableObject_CreateInstance_m2611081756 (RuntimeObject * __this /* static, unused */, Type_t * p0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::Invoke(System.Boolean)
extern "C" IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler_Invoke_m1233557945 (AudioConfigurationChangeHandler_t2089929874 * __this, bool ___deviceWasChanged0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioExtensionManager::Update()
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_Update_m3269307447 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method);
// UnityEngine.AudioSourceExtension UnityEngine.AudioExtensionManager::AddSpatializerExtension(UnityEngine.AudioSource)
extern "C" IL2CPP_METHOD_ATTR AudioSourceExtension_t3064908834 * AudioExtensionManager_AddSpatializerExtension_m820561940 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___source0, const RuntimeMethod* method);
// System.Void UnityEngine.AudioExtensionManager::GetReadyToPlay(UnityEngine.AudioSourceExtension)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_GetReadyToPlay_m1557263244 (RuntimeObject * __this /* static, unused */, AudioSourceExtension_t3064908834 * ___extension0, const RuntimeMethod* method);
// UnityEngine.AudioClip UnityEngine.AudioSource::get_clip()
extern "C" IL2CPP_METHOD_ATTR AudioClip_t3680889665 * AudioSource_get_clip_m1234340632 (AudioSource_t3935305588 * __this, const RuntimeMethod* method);
// System.Boolean UnityEngine.AudioClip::get_ambisonic()
extern "C" IL2CPP_METHOD_ATTR bool AudioClip_get_ambisonic_m3815052287 (AudioClip_t3680889665 * __this, const RuntimeMethod* method);
// UnityEngine.AudioSourceExtension UnityEngine.AudioExtensionManager::AddAmbisonicDecoderExtension(UnityEngine.AudioSource)
extern "C" IL2CPP_METHOD_ATTR AudioSourceExtension_t3064908834 * AudioExtensionManager_AddAmbisonicDecoderExtension_m3197702864 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___source0, const RuntimeMethod* method);
// System.Boolean UnityEngine.AudioSource::get_spatializeInternal()
extern "C" IL2CPP_METHOD_ATTR bool AudioSource_get_spatializeInternal_m2117549793 (AudioSource_t3935305588 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.AudioSource::INTERNAL_CALL_ReadExtensionName(UnityEngine.AudioSource,System.Int32,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioSource_INTERNAL_CALL_ReadExtensionName_m36001502 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___self0, int32_t ___sourceIndex1, PropertyName_t3749835189 * ___value2, const RuntimeMethod* method);
// System.Void UnityEngine.AudioSource::INTERNAL_CALL_ReadExtensionPropertyName(UnityEngine.AudioSource,System.Int32,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioSource_INTERNAL_CALL_ReadExtensionPropertyName_m3643462071 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___self0, int32_t ___sourceIndex1, PropertyName_t3749835189 * ___value2, const RuntimeMethod* method);
// System.Void UnityEngine.AudioSource::INTERNAL_CALL_ClearExtensionProperties(UnityEngine.AudioSource,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioSource_INTERNAL_CALL_ClearExtensionProperties_m2159298662 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___self0, PropertyName_t3749835189 * ___extensionName1, const RuntimeMethod* method);
// System.String UnityEngine.WebCamDevice::get_name()
extern "C" IL2CPP_METHOD_ATTR String_t* WebCamDevice_get_name_m3782173082 (WebCamDevice_t1322781432 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.Texture::.ctor()
extern "C" IL2CPP_METHOD_ATTR void Texture__ctor_m3554519797 (Texture_t3661962703 * __this, const RuntimeMethod* method);
// System.Void UnityEngine.WebCamTexture::Internal_CreateWebCamTexture(UnityEngine.WebCamTexture,System.String,System.Int32,System.Int32,System.Int32)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_Internal_CreateWebCamTexture_m2861130443 (RuntimeObject * __this /* static, unused */, WebCamTexture_t1514609158 * ___self0, String_t* ___scriptingDevice1, int32_t ___requestedWidth2, int32_t ___requestedHeight3, int32_t ___maxFramerate4, const RuntimeMethod* method);
// System.Void UnityEngine.WebCamTexture::INTERNAL_CALL_Play(UnityEngine.WebCamTexture)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_INTERNAL_CALL_Play_m701961556 (RuntimeObject * __this /* static, unused */, WebCamTexture_t1514609158 * ___self0, const RuntimeMethod* method);
// System.Void UnityEngine.WebCamTexture::INTERNAL_CALL_Stop(UnityEngine.WebCamTexture)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_INTERNAL_CALL_Stop_m2114762857 (RuntimeObject * __this /* static, unused */, WebCamTexture_t1514609158 * ___self0, const RuntimeMethod* method);
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioClipPlayable::GetHandle()
extern "C" IL2CPP_METHOD_ATTR PlayableHandle_t1095853803 AudioClipPlayable_GetHandle_m1762771314 (AudioClipPlayable_t785069022 * __this, const RuntimeMethod* method)
{
PlayableHandle_t1095853803 V_0;
memset(&V_0, 0, sizeof(V_0));
{
PlayableHandle_t1095853803 L_0 = __this->get_m_Handle_0();
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
PlayableHandle_t1095853803 L_1 = V_0;
return L_1;
}
}
extern "C" PlayableHandle_t1095853803 AudioClipPlayable_GetHandle_m1762771314_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
AudioClipPlayable_t785069022 * _thisAdjusted = reinterpret_cast<AudioClipPlayable_t785069022 *>(__this + 1);
return AudioClipPlayable_GetHandle_m1762771314(_thisAdjusted, method);
}
// System.Boolean UnityEngine.Audio.AudioClipPlayable::Equals(UnityEngine.Audio.AudioClipPlayable)
extern "C" IL2CPP_METHOD_ATTR bool AudioClipPlayable_Equals_m3705880618 (AudioClipPlayable_t785069022 * __this, AudioClipPlayable_t785069022 ___other0, const RuntimeMethod* method)
{
bool V_0 = false;
{
PlayableHandle_t1095853803 L_0 = AudioClipPlayable_GetHandle_m1762771314(__this, /*hidden argument*/NULL);
PlayableHandle_t1095853803 L_1 = AudioClipPlayable_GetHandle_m1762771314((&___other0), /*hidden argument*/NULL);
bool L_2 = PlayableHandle_op_Equality_m3344837515(NULL /*static, unused*/, L_0, L_1, /*hidden argument*/NULL);
V_0 = L_2;
goto IL_0019;
}
IL_0019:
{
bool L_3 = V_0;
return L_3;
}
}
extern "C" bool AudioClipPlayable_Equals_m3705880618_AdjustorThunk (RuntimeObject * __this, AudioClipPlayable_t785069022 ___other0, const RuntimeMethod* method)
{
AudioClipPlayable_t785069022 * _thisAdjusted = reinterpret_cast<AudioClipPlayable_t785069022 *>(__this + 1);
return AudioClipPlayable_Equals_m3705880618(_thisAdjusted, ___other0, method);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Playables.PlayableHandle UnityEngine.Audio.AudioMixerPlayable::GetHandle()
extern "C" IL2CPP_METHOD_ATTR PlayableHandle_t1095853803 AudioMixerPlayable_GetHandle_m57919556 (AudioMixerPlayable_t3520548497 * __this, const RuntimeMethod* method)
{
PlayableHandle_t1095853803 V_0;
memset(&V_0, 0, sizeof(V_0));
{
PlayableHandle_t1095853803 L_0 = __this->get_m_Handle_0();
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
PlayableHandle_t1095853803 L_1 = V_0;
return L_1;
}
}
extern "C" PlayableHandle_t1095853803 AudioMixerPlayable_GetHandle_m57919556_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
AudioMixerPlayable_t3520548497 * _thisAdjusted = reinterpret_cast<AudioMixerPlayable_t3520548497 *>(__this + 1);
return AudioMixerPlayable_GetHandle_m57919556(_thisAdjusted, method);
}
// System.Boolean UnityEngine.Audio.AudioMixerPlayable::Equals(UnityEngine.Audio.AudioMixerPlayable)
extern "C" IL2CPP_METHOD_ATTR bool AudioMixerPlayable_Equals_m1649866213 (AudioMixerPlayable_t3520548497 * __this, AudioMixerPlayable_t3520548497 ___other0, const RuntimeMethod* method)
{
bool V_0 = false;
{
PlayableHandle_t1095853803 L_0 = AudioMixerPlayable_GetHandle_m57919556(__this, /*hidden argument*/NULL);
PlayableHandle_t1095853803 L_1 = AudioMixerPlayable_GetHandle_m57919556((&___other0), /*hidden argument*/NULL);
bool L_2 = PlayableHandle_op_Equality_m3344837515(NULL /*static, unused*/, L_0, L_1, /*hidden argument*/NULL);
V_0 = L_2;
goto IL_0019;
}
IL_0019:
{
bool L_3 = V_0;
return L_3;
}
}
extern "C" bool AudioMixerPlayable_Equals_m1649866213_AdjustorThunk (RuntimeObject * __this, AudioMixerPlayable_t3520548497 ___other0, const RuntimeMethod* method)
{
AudioMixerPlayable_t3520548497 * _thisAdjusted = reinterpret_cast<AudioMixerPlayable_t3520548497 *>(__this + 1);
return AudioMixerPlayable_Equals_m1649866213(_thisAdjusted, ___other0, method);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void UnityEngine.AudioClip::.ctor()
extern "C" IL2CPP_METHOD_ATTR void AudioClip__ctor_m1211547677 (AudioClip_t3680889665 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioClip__ctor_m1211547677_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
__this->set_m_PCMReaderCallback_2((PCMReaderCallback_t1677636661 *)NULL);
__this->set_m_PCMSetPositionCallback_3((PCMSetPositionCallback_t1059417452 *)NULL);
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
Object__ctor_m1087895580(__this, /*hidden argument*/NULL);
return;
}
}
// System.Boolean UnityEngine.AudioClip::get_ambisonic()
extern "C" IL2CPP_METHOD_ATTR bool AudioClip_get_ambisonic_m3815052287 (AudioClip_t3680889665 * __this, const RuntimeMethod* method)
{
typedef bool (*AudioClip_get_ambisonic_m3815052287_ftn) (AudioClip_t3680889665 *);
static AudioClip_get_ambisonic_m3815052287_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioClip_get_ambisonic_m3815052287_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioClip::get_ambisonic()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.AudioClip::InvokePCMReaderCallback_Internal(System.Single[])
extern "C" IL2CPP_METHOD_ATTR void AudioClip_InvokePCMReaderCallback_Internal_m224395634 (AudioClip_t3680889665 * __this, SingleU5BU5D_t1444911251* ___data0, const RuntimeMethod* method)
{
{
PCMReaderCallback_t1677636661 * L_0 = __this->get_m_PCMReaderCallback_2();
if (!L_0)
{
goto IL_0018;
}
}
{
PCMReaderCallback_t1677636661 * L_1 = __this->get_m_PCMReaderCallback_2();
SingleU5BU5D_t1444911251* L_2 = ___data0;
NullCheck(L_1);
PCMReaderCallback_Invoke_m2948796957(L_1, L_2, /*hidden argument*/NULL);
}
IL_0018:
{
return;
}
}
// System.Void UnityEngine.AudioClip::InvokePCMSetPositionCallback_Internal(System.Int32)
extern "C" IL2CPP_METHOD_ATTR void AudioClip_InvokePCMSetPositionCallback_Internal_m3097960898 (AudioClip_t3680889665 * __this, int32_t ___position0, const RuntimeMethod* method)
{
{
PCMSetPositionCallback_t1059417452 * L_0 = __this->get_m_PCMSetPositionCallback_3();
if (!L_0)
{
goto IL_0018;
}
}
{
PCMSetPositionCallback_t1059417452 * L_1 = __this->get_m_PCMSetPositionCallback_3();
int32_t L_2 = ___position0;
NullCheck(L_1);
PCMSetPositionCallback_Invoke_m2167694991(L_1, L_2, /*hidden argument*/NULL);
}
IL_0018:
{
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
extern "C" void DelegatePInvokeWrapper_PCMReaderCallback_t1677636661 (PCMReaderCallback_t1677636661 * __this, SingleU5BU5D_t1444911251* ___data0, const RuntimeMethod* method)
{
typedef void (DEFAULT_CALL *PInvokeFunc)(float*);
PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(il2cpp_codegen_get_method_pointer(((RuntimeDelegate*)__this)->method));
// Marshaling of parameter '___data0' to native representation
float* ____data0_marshaled = NULL;
if (___data0 != NULL)
{
____data0_marshaled = reinterpret_cast<float*>((___data0)->GetAddressAtUnchecked(0));
}
// Native function invocation
il2cppPInvokeFunc(____data0_marshaled);
}
// System.Void UnityEngine.AudioClip/PCMReaderCallback::.ctor(System.Object,System.IntPtr)
extern "C" IL2CPP_METHOD_ATTR void PCMReaderCallback__ctor_m4269754975 (PCMReaderCallback_t1677636661 * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method)
{
__this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1));
__this->set_method_3(___method1);
__this->set_m_target_2(___object0);
}
// System.Void UnityEngine.AudioClip/PCMReaderCallback::Invoke(System.Single[])
extern "C" IL2CPP_METHOD_ATTR void PCMReaderCallback_Invoke_m2948796957 (PCMReaderCallback_t1677636661 * __this, SingleU5BU5D_t1444911251* ___data0, const RuntimeMethod* method)
{
if(__this->get_prev_9() != NULL)
{
PCMReaderCallback_Invoke_m2948796957((PCMReaderCallback_t1677636661 *)__this->get_prev_9(), ___data0, method);
}
Il2CppMethodPointer targetMethodPointer = __this->get_method_ptr_0();
RuntimeMethod* targetMethod = (RuntimeMethod*)(__this->get_method_3());
RuntimeObject* targetThis = __this->get_m_target_2();
il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod);
bool ___methodIsStatic = MethodIsStatic(targetMethod);
if (___methodIsStatic)
{
if (il2cpp_codegen_method_parameter_count(targetMethod) == 1)
{
// open
{
typedef void (*FunctionPointerType) (RuntimeObject *, SingleU5BU5D_t1444911251*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(NULL, ___data0, targetMethod);
}
}
else
{
// closed
{
typedef void (*FunctionPointerType) (RuntimeObject *, void*, SingleU5BU5D_t1444911251*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(NULL, targetThis, ___data0, targetMethod);
}
}
}
else
{
if (il2cpp_codegen_method_parameter_count(targetMethod) == 1)
{
// closed
if (il2cpp_codegen_method_is_virtual(targetMethod) && !il2cpp_codegen_object_is_of_sealed_type(targetThis) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this))
{
if (il2cpp_codegen_method_is_generic_instance(targetMethod))
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
GenericInterfaceActionInvoker1< SingleU5BU5D_t1444911251* >::Invoke(targetMethod, targetThis, ___data0);
else
GenericVirtActionInvoker1< SingleU5BU5D_t1444911251* >::Invoke(targetMethod, targetThis, ___data0);
}
else
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
InterfaceActionInvoker1< SingleU5BU5D_t1444911251* >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), targetThis, ___data0);
else
VirtActionInvoker1< SingleU5BU5D_t1444911251* >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), targetThis, ___data0);
}
}
else
{
typedef void (*FunctionPointerType) (void*, SingleU5BU5D_t1444911251*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___data0, targetMethod);
}
}
else
{
// open
if (il2cpp_codegen_method_is_virtual(targetMethod) && !il2cpp_codegen_object_is_of_sealed_type(targetThis) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this))
{
if (il2cpp_codegen_method_is_generic_instance(targetMethod))
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
GenericInterfaceActionInvoker0::Invoke(targetMethod, ___data0);
else
GenericVirtActionInvoker0::Invoke(targetMethod, ___data0);
}
else
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
InterfaceActionInvoker0::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), ___data0);
else
VirtActionInvoker0::Invoke(il2cpp_codegen_method_get_slot(targetMethod), ___data0);
}
}
else
{
typedef void (*FunctionPointerType) (SingleU5BU5D_t1444911251*, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(___data0, targetMethod);
}
}
}
}
// System.IAsyncResult UnityEngine.AudioClip/PCMReaderCallback::BeginInvoke(System.Single[],System.AsyncCallback,System.Object)
extern "C" IL2CPP_METHOD_ATTR RuntimeObject* PCMReaderCallback_BeginInvoke_m3391809637 (PCMReaderCallback_t1677636661 * __this, SingleU5BU5D_t1444911251* ___data0, AsyncCallback_t3962456242 * ___callback1, RuntimeObject * ___object2, const RuntimeMethod* method)
{
void *__d_args[2] = {0};
__d_args[0] = ___data0;
return (RuntimeObject*)il2cpp_codegen_delegate_begin_invoke((RuntimeDelegate*)__this, __d_args, (RuntimeDelegate*)___callback1, (RuntimeObject*)___object2);
}
// System.Void UnityEngine.AudioClip/PCMReaderCallback::EndInvoke(System.IAsyncResult)
extern "C" IL2CPP_METHOD_ATTR void PCMReaderCallback_EndInvoke_m3916876196 (PCMReaderCallback_t1677636661 * __this, RuntimeObject* ___result0, const RuntimeMethod* method)
{
il2cpp_codegen_delegate_end_invoke((Il2CppAsyncResult*) ___result0, 0);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
extern "C" void DelegatePInvokeWrapper_PCMSetPositionCallback_t1059417452 (PCMSetPositionCallback_t1059417452 * __this, int32_t ___position0, const RuntimeMethod* method)
{
typedef void (DEFAULT_CALL *PInvokeFunc)(int32_t);
PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(il2cpp_codegen_get_method_pointer(((RuntimeDelegate*)__this)->method));
// Native function invocation
il2cppPInvokeFunc(___position0);
}
// System.Void UnityEngine.AudioClip/PCMSetPositionCallback::.ctor(System.Object,System.IntPtr)
extern "C" IL2CPP_METHOD_ATTR void PCMSetPositionCallback__ctor_m2909837933 (PCMSetPositionCallback_t1059417452 * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method)
{
__this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1));
__this->set_method_3(___method1);
__this->set_m_target_2(___object0);
}
// System.Void UnityEngine.AudioClip/PCMSetPositionCallback::Invoke(System.Int32)
extern "C" IL2CPP_METHOD_ATTR void PCMSetPositionCallback_Invoke_m2167694991 (PCMSetPositionCallback_t1059417452 * __this, int32_t ___position0, const RuntimeMethod* method)
{
if(__this->get_prev_9() != NULL)
{
PCMSetPositionCallback_Invoke_m2167694991((PCMSetPositionCallback_t1059417452 *)__this->get_prev_9(), ___position0, method);
}
Il2CppMethodPointer targetMethodPointer = __this->get_method_ptr_0();
RuntimeMethod* targetMethod = (RuntimeMethod*)(__this->get_method_3());
RuntimeObject* targetThis = __this->get_m_target_2();
il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod);
bool ___methodIsStatic = MethodIsStatic(targetMethod);
if (___methodIsStatic)
{
if (il2cpp_codegen_method_parameter_count(targetMethod) == 1)
{
// open
{
typedef void (*FunctionPointerType) (RuntimeObject *, int32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(NULL, ___position0, targetMethod);
}
}
else
{
// closed
{
typedef void (*FunctionPointerType) (RuntimeObject *, void*, int32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(NULL, targetThis, ___position0, targetMethod);
}
}
}
else
{
{
// closed
if (il2cpp_codegen_method_is_virtual(targetMethod) && !il2cpp_codegen_object_is_of_sealed_type(targetThis) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this))
{
if (il2cpp_codegen_method_is_generic_instance(targetMethod))
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
GenericInterfaceActionInvoker1< int32_t >::Invoke(targetMethod, targetThis, ___position0);
else
GenericVirtActionInvoker1< int32_t >::Invoke(targetMethod, targetThis, ___position0);
}
else
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
InterfaceActionInvoker1< int32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), targetThis, ___position0);
else
VirtActionInvoker1< int32_t >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), targetThis, ___position0);
}
}
else
{
typedef void (*FunctionPointerType) (void*, int32_t, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___position0, targetMethod);
}
}
}
}
// System.IAsyncResult UnityEngine.AudioClip/PCMSetPositionCallback::BeginInvoke(System.Int32,System.AsyncCallback,System.Object)
extern "C" IL2CPP_METHOD_ATTR RuntimeObject* PCMSetPositionCallback_BeginInvoke_m2701134198 (PCMSetPositionCallback_t1059417452 * __this, int32_t ___position0, AsyncCallback_t3962456242 * ___callback1, RuntimeObject * ___object2, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (PCMSetPositionCallback_BeginInvoke_m2701134198_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
void *__d_args[2] = {0};
__d_args[0] = Box(Int32_t2950945753_il2cpp_TypeInfo_var, &___position0);
return (RuntimeObject*)il2cpp_codegen_delegate_begin_invoke((RuntimeDelegate*)__this, __d_args, (RuntimeDelegate*)___callback1, (RuntimeObject*)___object2);
}
// System.Void UnityEngine.AudioClip/PCMSetPositionCallback::EndInvoke(System.IAsyncResult)
extern "C" IL2CPP_METHOD_ATTR void PCMSetPositionCallback_EndInvoke_m1405765992 (PCMSetPositionCallback_t1059417452 * __this, RuntimeObject* ___result0, const RuntimeMethod* method)
{
il2cpp_codegen_delegate_end_invoke((Il2CppAsyncResult*) ___result0, 0);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Type UnityEngine.AudioExtensionDefinition::GetExtensionType()
extern "C" IL2CPP_METHOD_ATTR Type_t * AudioExtensionDefinition_GetExtensionType_m1450823952 (AudioExtensionDefinition_t3271167678 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionDefinition_GetExtensionType_m1450823952_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
Type_t * V_0 = NULL;
{
Type_t * L_0 = __this->get_extensionType_3();
if (L_0)
{
goto IL_004d;
}
}
{
StringU5BU5D_t1281789340* L_1 = ((StringU5BU5D_t1281789340*)SZArrayNew(StringU5BU5D_t1281789340_il2cpp_TypeInfo_var, (uint32_t)5));
String_t* L_2 = __this->get_extensionNamespace_1();
NullCheck(L_1);
ArrayElementTypeCheck (L_1, L_2);
(L_1)->SetAt(static_cast<il2cpp_array_size_t>(0), (String_t*)L_2);
StringU5BU5D_t1281789340* L_3 = L_1;
NullCheck(L_3);
ArrayElementTypeCheck (L_3, _stringLiteral3452614530);
(L_3)->SetAt(static_cast<il2cpp_array_size_t>(1), (String_t*)_stringLiteral3452614530);
StringU5BU5D_t1281789340* L_4 = L_3;
String_t* L_5 = __this->get_extensionTypeName_2();
NullCheck(L_4);
ArrayElementTypeCheck (L_4, L_5);
(L_4)->SetAt(static_cast<il2cpp_array_size_t>(2), (String_t*)L_5);
StringU5BU5D_t1281789340* L_6 = L_4;
NullCheck(L_6);
ArrayElementTypeCheck (L_6, _stringLiteral3450517380);
(L_6)->SetAt(static_cast<il2cpp_array_size_t>(3), (String_t*)_stringLiteral3450517380);
StringU5BU5D_t1281789340* L_7 = L_6;
String_t* L_8 = __this->get_assemblyName_0();
NullCheck(L_7);
ArrayElementTypeCheck (L_7, L_8);
(L_7)->SetAt(static_cast<il2cpp_array_size_t>(4), (String_t*)L_8);
IL2CPP_RUNTIME_CLASS_INIT(String_t_il2cpp_TypeInfo_var);
String_t* L_9 = String_Concat_m1809518182(NULL /*static, unused*/, L_7, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Type_t_il2cpp_TypeInfo_var);
Type_t * L_10 = il2cpp_codegen_get_type((Il2CppMethodPointer)&Type_GetType_m1693760368, L_9, "UnityEngine.AudioModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
__this->set_extensionType_3(L_10);
}
IL_004d:
{
Type_t * L_11 = __this->get_extensionType_3();
V_0 = L_11;
goto IL_0059;
}
IL_0059:
{
Type_t * L_12 = V_0;
return L_12;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.Object UnityEngine.AudioExtensionManager::GetAudioListener()
extern "C" IL2CPP_METHOD_ATTR Object_t631007953 * AudioExtensionManager_GetAudioListener_m817760607 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
typedef Object_t631007953 * (*AudioExtensionManager_GetAudioListener_m817760607_ftn) ();
static AudioExtensionManager_GetAudioListener_m817760607_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioExtensionManager_GetAudioListener_m817760607_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioExtensionManager::GetAudioListener()");
Object_t631007953 * retVal = _il2cpp_icall_func();
return retVal;
}
// UnityEngine.AudioSourceExtension UnityEngine.AudioExtensionManager::AddSpatializerExtension(UnityEngine.AudioSource)
extern "C" IL2CPP_METHOD_ATTR AudioSourceExtension_t3064908834 * AudioExtensionManager_AddSpatializerExtension_m820561940 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___source0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_AddSpatializerExtension_m820561940_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
AudioSourceExtension_t3064908834 * V_0 = NULL;
AudioSpatializerExtensionDefinition_t597896186 * V_1 = NULL;
Enumerator_t3959214805 V_2;
memset(&V_2, 0, sizeof(V_2));
AudioSourceExtension_t3064908834 * V_3 = NULL;
Exception_t * __last_unhandled_exception = 0;
NO_UNUSED_WARNING (__last_unhandled_exception);
Exception_t * __exception_local = 0;
NO_UNUSED_WARNING (__exception_local);
int32_t __leave_target = 0;
NO_UNUSED_WARNING (__leave_target);
{
AudioSource_t3935305588 * L_0 = ___source0;
NullCheck(L_0);
bool L_1 = AudioSource_get_spatialize_m3609701298(L_0, /*hidden argument*/NULL);
if (L_1)
{
goto IL_0013;
}
}
{
V_0 = (AudioSourceExtension_t3064908834 *)NULL;
goto IL_00dc;
}
IL_0013:
{
AudioSource_t3935305588 * L_2 = ___source0;
NullCheck(L_2);
AudioSourceExtension_t3064908834 * L_3 = L_2->get_spatializerExtension_2();
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_4 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_3, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_4)
{
goto IL_0030;
}
}
{
AudioSource_t3935305588 * L_5 = ___source0;
NullCheck(L_5);
AudioSourceExtension_t3064908834 * L_6 = L_5->get_spatializerExtension_2();
V_0 = L_6;
goto IL_00dc;
}
IL_0030:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104(NULL /*static, unused*/, /*hidden argument*/NULL);
List_1_t2069970928 * L_7 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceSpatializerExtensionDefinitions_1();
NullCheck(L_7);
Enumerator_t3959214805 L_8 = List_1_GetEnumerator_m1716448724(L_7, /*hidden argument*/List_1_GetEnumerator_m1716448724_RuntimeMethod_var);
V_2 = L_8;
}
IL_0041:
try
{ // begin try (depth: 1)
{
goto IL_00b6;
}
IL_0046:
{
AudioSpatializerExtensionDefinition_t597896186 * L_9 = Enumerator_get_Current_m615903654((&V_2), /*hidden argument*/Enumerator_get_Current_m615903654_RuntimeMethod_var);
V_1 = L_9;
String_t* L_10 = AudioSettings_GetSpatializerPluginName_m1324100978(NULL /*static, unused*/, /*hidden argument*/NULL);
PropertyName_t3749835189 L_11 = PropertyName_op_Implicit_m1633828199(NULL /*static, unused*/, L_10, /*hidden argument*/NULL);
AudioSpatializerExtensionDefinition_t597896186 * L_12 = V_1;
NullCheck(L_12);
PropertyName_t3749835189 L_13 = L_12->get_spatializerName_0();
bool L_14 = PropertyName_op_Equality_m2761233272(NULL /*static, unused*/, L_11, L_13, /*hidden argument*/NULL);
if (!L_14)
{
goto IL_00b5;
}
}
IL_0069:
{
AudioSource_t3935305588 * L_15 = ___source0;
AudioSpatializerExtensionDefinition_t597896186 * L_16 = V_1;
NullCheck(L_16);
AudioExtensionDefinition_t3271167678 * L_17 = L_16->get_definition_1();
NullCheck(L_17);
Type_t * L_18 = AudioExtensionDefinition_GetExtensionType_m1450823952(L_17, /*hidden argument*/NULL);
NullCheck(L_15);
AudioSourceExtension_t3064908834 * L_19 = AudioSource_AddSpatializerExtension_m2560794359(L_15, L_18, /*hidden argument*/NULL);
V_3 = L_19;
AudioSourceExtension_t3064908834 * L_20 = V_3;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_21 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_20, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_21)
{
goto IL_00b4;
}
}
IL_0088:
{
AudioSourceExtension_t3064908834 * L_22 = V_3;
AudioSource_t3935305588 * L_23 = ___source0;
NullCheck(L_22);
AudioSourceExtension_set_audioSource_m3729768988(L_22, L_23, /*hidden argument*/NULL);
AudioSource_t3935305588 * L_24 = ___source0;
AudioSourceExtension_t3064908834 * L_25 = V_3;
NullCheck(L_24);
L_24->set_spatializerExtension_2(L_25);
AudioSourceExtension_t3064908834 * L_26 = V_3;
AudioSpatializerExtensionDefinition_t597896186 * L_27 = V_1;
NullCheck(L_27);
AudioExtensionDefinition_t3271167678 * L_28 = L_27->get_definition_1();
NullCheck(L_28);
Type_t * L_29 = AudioExtensionDefinition_GetExtensionType_m1450823952(L_28, /*hidden argument*/NULL);
NullCheck(L_29);
String_t* L_30 = VirtFuncInvoker0< String_t* >::Invoke(8 /* System.String System.Reflection.MemberInfo::get_Name() */, L_29);
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_WriteExtensionProperties_m1988587615(NULL /*static, unused*/, L_26, L_30, /*hidden argument*/NULL);
AudioSourceExtension_t3064908834 * L_31 = V_3;
V_0 = L_31;
IL2CPP_LEAVE(0xDC, FINALLY_00c7);
}
IL_00b4:
{
}
IL_00b5:
{
}
IL_00b6:
{
bool L_32 = Enumerator_MoveNext_m2697843606((&V_2), /*hidden argument*/Enumerator_MoveNext_m2697843606_RuntimeMethod_var);
if (L_32)
{
goto IL_0046;
}
}
IL_00c2:
{
IL2CPP_LEAVE(0xD5, FINALLY_00c7);
}
} // end try (depth: 1)
catch(Il2CppExceptionWrapper& e)
{
__last_unhandled_exception = (Exception_t *)e.ex;
goto FINALLY_00c7;
}
FINALLY_00c7:
{ // begin finally (depth: 1)
Enumerator_Dispose_m3198901590((&V_2), /*hidden argument*/Enumerator_Dispose_m3198901590_RuntimeMethod_var);
IL2CPP_END_FINALLY(199)
} // end finally (depth: 1)
IL2CPP_CLEANUP(199)
{
IL2CPP_JUMP_TBL(0xDC, IL_00dc)
IL2CPP_JUMP_TBL(0xD5, IL_00d5)
IL2CPP_RETHROW_IF_UNHANDLED(Exception_t *)
}
IL_00d5:
{
V_0 = (AudioSourceExtension_t3064908834 *)NULL;
goto IL_00dc;
}
IL_00dc:
{
AudioSourceExtension_t3064908834 * L_33 = V_0;
return L_33;
}
}
// UnityEngine.AudioSourceExtension UnityEngine.AudioExtensionManager::AddAmbisonicDecoderExtension(UnityEngine.AudioSource)
extern "C" IL2CPP_METHOD_ATTR AudioSourceExtension_t3064908834 * AudioExtensionManager_AddAmbisonicDecoderExtension_m3197702864 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___source0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_AddAmbisonicDecoderExtension_m3197702864_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
AudioSourceExtension_t3064908834 * V_0 = NULL;
AudioAmbisonicExtensionDefinition_t4118426890 * V_1 = NULL;
Enumerator_t3184778213 V_2;
memset(&V_2, 0, sizeof(V_2));
AudioSourceExtension_t3064908834 * V_3 = NULL;
Exception_t * __last_unhandled_exception = 0;
NO_UNUSED_WARNING (__last_unhandled_exception);
Exception_t * __exception_local = 0;
NO_UNUSED_WARNING (__exception_local);
int32_t __leave_target = 0;
NO_UNUSED_WARNING (__leave_target);
{
AudioSource_t3935305588 * L_0 = ___source0;
NullCheck(L_0);
AudioSourceExtension_t3064908834 * L_1 = L_0->get_ambisonicExtension_3();
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_2 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_1, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_2)
{
goto IL_001e;
}
}
{
AudioSource_t3935305588 * L_3 = ___source0;
NullCheck(L_3);
AudioSourceExtension_t3064908834 * L_4 = L_3->get_ambisonicExtension_3();
V_0 = L_4;
goto IL_00b4;
}
IL_001e:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104(NULL /*static, unused*/, /*hidden argument*/NULL);
List_1_t1295534336 * L_5 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceAmbisonicDecoderExtensionDefinitions_2();
NullCheck(L_5);
Enumerator_t3184778213 L_6 = List_1_GetEnumerator_m2295013814(L_5, /*hidden argument*/List_1_GetEnumerator_m2295013814_RuntimeMethod_var);
V_2 = L_6;
}
IL_002f:
try
{ // begin try (depth: 1)
{
goto IL_008e;
}
IL_0034:
{
AudioAmbisonicExtensionDefinition_t4118426890 * L_7 = Enumerator_get_Current_m967136761((&V_2), /*hidden argument*/Enumerator_get_Current_m967136761_RuntimeMethod_var);
V_1 = L_7;
String_t* L_8 = AudioSettings_GetAmbisonicDecoderPluginName_m19603540(NULL /*static, unused*/, /*hidden argument*/NULL);
PropertyName_t3749835189 L_9 = PropertyName_op_Implicit_m1633828199(NULL /*static, unused*/, L_8, /*hidden argument*/NULL);
AudioAmbisonicExtensionDefinition_t4118426890 * L_10 = V_1;
NullCheck(L_10);
PropertyName_t3749835189 L_11 = L_10->get_ambisonicPluginName_0();
bool L_12 = PropertyName_op_Equality_m2761233272(NULL /*static, unused*/, L_9, L_11, /*hidden argument*/NULL);
if (!L_12)
{
goto IL_008d;
}
}
IL_0057:
{
AudioSource_t3935305588 * L_13 = ___source0;
AudioAmbisonicExtensionDefinition_t4118426890 * L_14 = V_1;
NullCheck(L_14);
AudioExtensionDefinition_t3271167678 * L_15 = L_14->get_definition_1();
NullCheck(L_15);
Type_t * L_16 = AudioExtensionDefinition_GetExtensionType_m1450823952(L_15, /*hidden argument*/NULL);
NullCheck(L_13);
AudioSourceExtension_t3064908834 * L_17 = AudioSource_AddAmbisonicExtension_m304476911(L_13, L_16, /*hidden argument*/NULL);
V_3 = L_17;
AudioSourceExtension_t3064908834 * L_18 = V_3;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_19 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_18, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_19)
{
goto IL_008c;
}
}
IL_0076:
{
AudioSourceExtension_t3064908834 * L_20 = V_3;
AudioSource_t3935305588 * L_21 = ___source0;
NullCheck(L_20);
AudioSourceExtension_set_audioSource_m3729768988(L_20, L_21, /*hidden argument*/NULL);
AudioSource_t3935305588 * L_22 = ___source0;
AudioSourceExtension_t3064908834 * L_23 = V_3;
NullCheck(L_22);
L_22->set_ambisonicExtension_3(L_23);
AudioSourceExtension_t3064908834 * L_24 = V_3;
V_0 = L_24;
IL2CPP_LEAVE(0xB4, FINALLY_009f);
}
IL_008c:
{
}
IL_008d:
{
}
IL_008e:
{
bool L_25 = Enumerator_MoveNext_m1000499844((&V_2), /*hidden argument*/Enumerator_MoveNext_m1000499844_RuntimeMethod_var);
if (L_25)
{
goto IL_0034;
}
}
IL_009a:
{
IL2CPP_LEAVE(0xAD, FINALLY_009f);
}
} // end try (depth: 1)
catch(Il2CppExceptionWrapper& e)
{
__last_unhandled_exception = (Exception_t *)e.ex;
goto FINALLY_009f;
}
FINALLY_009f:
{ // begin finally (depth: 1)
Enumerator_Dispose_m405442337((&V_2), /*hidden argument*/Enumerator_Dispose_m405442337_RuntimeMethod_var);
IL2CPP_END_FINALLY(159)
} // end finally (depth: 1)
IL2CPP_CLEANUP(159)
{
IL2CPP_JUMP_TBL(0xB4, IL_00b4)
IL2CPP_JUMP_TBL(0xAD, IL_00ad)
IL2CPP_RETHROW_IF_UNHANDLED(Exception_t *)
}
IL_00ad:
{
V_0 = (AudioSourceExtension_t3064908834 *)NULL;
goto IL_00b4;
}
IL_00b4:
{
AudioSourceExtension_t3064908834 * L_26 = V_0;
return L_26;
}
}
// System.Void UnityEngine.AudioExtensionManager::WriteExtensionProperties(UnityEngine.AudioSourceExtension,System.String)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_WriteExtensionProperties_m1988587615 (RuntimeObject * __this /* static, unused */, AudioSourceExtension_t3064908834 * ___extension0, String_t* ___extensionName1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_WriteExtensionProperties_m1988587615_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
int32_t V_0 = 0;
PropertyName_t3749835189 V_1;
memset(&V_1, 0, sizeof(V_1));
float V_2 = 0.0f;
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
PropertyName_t3749835189 L_0 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SpatializerExtensionName_7();
PropertyName_t3749835189 L_1 = PropertyName_op_Implicit_m114733813(NULL /*static, unused*/, 0, /*hidden argument*/NULL);
bool L_2 = PropertyName_op_Equality_m2761233272(NULL /*static, unused*/, L_0, L_1, /*hidden argument*/NULL);
if (!L_2)
{
goto IL_0021;
}
}
{
String_t* L_3 = ___extensionName1;
PropertyName_t3749835189 L_4 = PropertyName_op_Implicit_m1633828199(NULL /*static, unused*/, L_3, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_SpatializerExtensionName_7(L_4);
}
IL_0021:
{
V_0 = 0;
goto IL_006d;
}
IL_0028:
{
AudioSourceExtension_t3064908834 * L_5 = ___extension0;
NullCheck(L_5);
AudioSource_t3935305588 * L_6 = AudioSourceExtension_get_audioSource_m1465006871(L_5, /*hidden argument*/NULL);
int32_t L_7 = V_0;
NullCheck(L_6);
PropertyName_t3749835189 L_8 = AudioSource_ReadExtensionName_m725112169(L_6, L_7, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
PropertyName_t3749835189 L_9 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SpatializerExtensionName_7();
bool L_10 = PropertyName_op_Equality_m2761233272(NULL /*static, unused*/, L_8, L_9, /*hidden argument*/NULL);
if (!L_10)
{
goto IL_0068;
}
}
{
AudioSourceExtension_t3064908834 * L_11 = ___extension0;
NullCheck(L_11);
AudioSource_t3935305588 * L_12 = AudioSourceExtension_get_audioSource_m1465006871(L_11, /*hidden argument*/NULL);
int32_t L_13 = V_0;
NullCheck(L_12);
PropertyName_t3749835189 L_14 = AudioSource_ReadExtensionPropertyName_m2761820692(L_12, L_13, /*hidden argument*/NULL);
V_1 = L_14;
AudioSourceExtension_t3064908834 * L_15 = ___extension0;
NullCheck(L_15);
AudioSource_t3935305588 * L_16 = AudioSourceExtension_get_audioSource_m1465006871(L_15, /*hidden argument*/NULL);
int32_t L_17 = V_0;
NullCheck(L_16);
float L_18 = AudioSource_ReadExtensionPropertyValue_m72717540(L_16, L_17, /*hidden argument*/NULL);
V_2 = L_18;
AudioSourceExtension_t3064908834 * L_19 = ___extension0;
PropertyName_t3749835189 L_20 = V_1;
float L_21 = V_2;
NullCheck(L_19);
VirtActionInvoker2< PropertyName_t3749835189 , float >::Invoke(4 /* System.Void UnityEngine.AudioSourceExtension::WriteExtensionProperty(UnityEngine.PropertyName,System.Single) */, L_19, L_20, L_21);
}
IL_0068:
{
int32_t L_22 = V_0;
V_0 = ((int32_t)il2cpp_codegen_add((int32_t)L_22, (int32_t)1));
}
IL_006d:
{
int32_t L_23 = V_0;
AudioSourceExtension_t3064908834 * L_24 = ___extension0;
NullCheck(L_24);
AudioSource_t3935305588 * L_25 = AudioSourceExtension_get_audioSource_m1465006871(L_24, /*hidden argument*/NULL);
NullCheck(L_25);
int32_t L_26 = AudioSource_GetNumExtensionProperties_m1231815209(L_25, /*hidden argument*/NULL);
if ((((int32_t)L_23) < ((int32_t)L_26)))
{
goto IL_0028;
}
}
{
AudioSourceExtension_t3064908834 * L_27 = ___extension0;
NullCheck(L_27);
AudioSource_t3935305588 * L_28 = AudioSourceExtension_get_audioSource_m1465006871(L_27, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
PropertyName_t3749835189 L_29 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SpatializerExtensionName_7();
NullCheck(L_28);
AudioSource_ClearExtensionProperties_m2116074582(L_28, L_29, /*hidden argument*/NULL);
return;
}
}
// UnityEngine.AudioListenerExtension UnityEngine.AudioExtensionManager::AddSpatializerExtension(UnityEngine.AudioListener)
extern "C" IL2CPP_METHOD_ATTR AudioListenerExtension_t3242956547 * AudioExtensionManager_AddSpatializerExtension_m3915849352 (RuntimeObject * __this /* static, unused */, AudioListener_t2734094699 * ___listener0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_AddSpatializerExtension_m3915849352_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
AudioListenerExtension_t3242956547 * V_0 = NULL;
AudioSpatializerExtensionDefinition_t597896186 * V_1 = NULL;
Enumerator_t3959214805 V_2;
memset(&V_2, 0, sizeof(V_2));
AudioListenerExtension_t3242956547 * V_3 = NULL;
Exception_t * __last_unhandled_exception = 0;
NO_UNUSED_WARNING (__last_unhandled_exception);
Exception_t * __exception_local = 0;
NO_UNUSED_WARNING (__exception_local);
int32_t __leave_target = 0;
NO_UNUSED_WARNING (__leave_target);
{
AudioListener_t2734094699 * L_0 = ___listener0;
NullCheck(L_0);
AudioListenerExtension_t3242956547 * L_1 = L_0->get_spatializerExtension_2();
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_2 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_1, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_2)
{
goto IL_001e;
}
}
{
AudioListener_t2734094699 * L_3 = ___listener0;
NullCheck(L_3);
AudioListenerExtension_t3242956547 * L_4 = L_3->get_spatializerExtension_2();
V_0 = L_4;
goto IL_00e4;
}
IL_001e:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104(NULL /*static, unused*/, /*hidden argument*/NULL);
List_1_t2069970928 * L_5 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_ListenerSpatializerExtensionDefinitions_0();
NullCheck(L_5);
Enumerator_t3959214805 L_6 = List_1_GetEnumerator_m1716448724(L_5, /*hidden argument*/List_1_GetEnumerator_m1716448724_RuntimeMethod_var);
V_2 = L_6;
}
IL_002f:
try
{ // begin try (depth: 1)
{
goto IL_00be;
}
IL_0034:
{
AudioSpatializerExtensionDefinition_t597896186 * L_7 = Enumerator_get_Current_m615903654((&V_2), /*hidden argument*/Enumerator_get_Current_m615903654_RuntimeMethod_var);
V_1 = L_7;
String_t* L_8 = AudioSettings_GetSpatializerPluginName_m1324100978(NULL /*static, unused*/, /*hidden argument*/NULL);
PropertyName_t3749835189 L_9 = PropertyName_op_Implicit_m1633828199(NULL /*static, unused*/, L_8, /*hidden argument*/NULL);
AudioSpatializerExtensionDefinition_t597896186 * L_10 = V_1;
NullCheck(L_10);
PropertyName_t3749835189 L_11 = L_10->get_spatializerName_0();
bool L_12 = PropertyName_op_Equality_m2761233272(NULL /*static, unused*/, L_9, L_11, /*hidden argument*/NULL);
if (L_12)
{
goto IL_0071;
}
}
IL_0057:
{
String_t* L_13 = AudioSettings_GetAmbisonicDecoderPluginName_m19603540(NULL /*static, unused*/, /*hidden argument*/NULL);
PropertyName_t3749835189 L_14 = PropertyName_op_Implicit_m1633828199(NULL /*static, unused*/, L_13, /*hidden argument*/NULL);
AudioSpatializerExtensionDefinition_t597896186 * L_15 = V_1;
NullCheck(L_15);
PropertyName_t3749835189 L_16 = L_15->get_spatializerName_0();
bool L_17 = PropertyName_op_Equality_m2761233272(NULL /*static, unused*/, L_14, L_16, /*hidden argument*/NULL);
if (!L_17)
{
goto IL_00bd;
}
}
IL_0071:
{
AudioListener_t2734094699 * L_18 = ___listener0;
AudioSpatializerExtensionDefinition_t597896186 * L_19 = V_1;
NullCheck(L_19);
AudioExtensionDefinition_t3271167678 * L_20 = L_19->get_definition_1();
NullCheck(L_20);
Type_t * L_21 = AudioExtensionDefinition_GetExtensionType_m1450823952(L_20, /*hidden argument*/NULL);
NullCheck(L_18);
AudioListenerExtension_t3242956547 * L_22 = AudioListener_AddExtension_m994751216(L_18, L_21, /*hidden argument*/NULL);
V_3 = L_22;
AudioListenerExtension_t3242956547 * L_23 = V_3;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_24 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_23, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_24)
{
goto IL_00bc;
}
}
IL_0090:
{
AudioListenerExtension_t3242956547 * L_25 = V_3;
AudioListener_t2734094699 * L_26 = ___listener0;
NullCheck(L_25);
AudioListenerExtension_set_audioListener_m3412289012(L_25, L_26, /*hidden argument*/NULL);
AudioListener_t2734094699 * L_27 = ___listener0;
AudioListenerExtension_t3242956547 * L_28 = V_3;
NullCheck(L_27);
L_27->set_spatializerExtension_2(L_28);
AudioListenerExtension_t3242956547 * L_29 = V_3;
AudioSpatializerExtensionDefinition_t597896186 * L_30 = V_1;
NullCheck(L_30);
AudioExtensionDefinition_t3271167678 * L_31 = L_30->get_definition_1();
NullCheck(L_31);
Type_t * L_32 = AudioExtensionDefinition_GetExtensionType_m1450823952(L_31, /*hidden argument*/NULL);
NullCheck(L_32);
String_t* L_33 = VirtFuncInvoker0< String_t* >::Invoke(8 /* System.String System.Reflection.MemberInfo::get_Name() */, L_32);
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_WriteExtensionProperties_m3028464154(NULL /*static, unused*/, L_29, L_33, /*hidden argument*/NULL);
AudioListenerExtension_t3242956547 * L_34 = V_3;
V_0 = L_34;
IL2CPP_LEAVE(0xE4, FINALLY_00cf);
}
IL_00bc:
{
}
IL_00bd:
{
}
IL_00be:
{
bool L_35 = Enumerator_MoveNext_m2697843606((&V_2), /*hidden argument*/Enumerator_MoveNext_m2697843606_RuntimeMethod_var);
if (L_35)
{
goto IL_0034;
}
}
IL_00ca:
{
IL2CPP_LEAVE(0xDD, FINALLY_00cf);
}
} // end try (depth: 1)
catch(Il2CppExceptionWrapper& e)
{
__last_unhandled_exception = (Exception_t *)e.ex;
goto FINALLY_00cf;
}
FINALLY_00cf:
{ // begin finally (depth: 1)
Enumerator_Dispose_m3198901590((&V_2), /*hidden argument*/Enumerator_Dispose_m3198901590_RuntimeMethod_var);
IL2CPP_END_FINALLY(207)
} // end finally (depth: 1)
IL2CPP_CLEANUP(207)
{
IL2CPP_JUMP_TBL(0xE4, IL_00e4)
IL2CPP_JUMP_TBL(0xDD, IL_00dd)
IL2CPP_RETHROW_IF_UNHANDLED(Exception_t *)
}
IL_00dd:
{
V_0 = (AudioListenerExtension_t3242956547 *)NULL;
goto IL_00e4;
}
IL_00e4:
{
AudioListenerExtension_t3242956547 * L_36 = V_0;
return L_36;
}
}
// System.Void UnityEngine.AudioExtensionManager::WriteExtensionProperties(UnityEngine.AudioListenerExtension,System.String)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_WriteExtensionProperties_m3028464154 (RuntimeObject * __this /* static, unused */, AudioListenerExtension_t3242956547 * ___extension0, String_t* ___extensionName1, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_WriteExtensionProperties_m3028464154_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
int32_t V_0 = 0;
PropertyName_t3749835189 V_1;
memset(&V_1, 0, sizeof(V_1));
float V_2 = 0.0f;
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
PropertyName_t3749835189 L_0 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_ListenerSpatializerExtensionName_8();
PropertyName_t3749835189 L_1 = PropertyName_op_Implicit_m114733813(NULL /*static, unused*/, 0, /*hidden argument*/NULL);
bool L_2 = PropertyName_op_Equality_m2761233272(NULL /*static, unused*/, L_0, L_1, /*hidden argument*/NULL);
if (!L_2)
{
goto IL_0021;
}
}
{
String_t* L_3 = ___extensionName1;
PropertyName_t3749835189 L_4 = PropertyName_op_Implicit_m1633828199(NULL /*static, unused*/, L_3, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_ListenerSpatializerExtensionName_8(L_4);
}
IL_0021:
{
V_0 = 0;
goto IL_006d;
}
IL_0028:
{
AudioListenerExtension_t3242956547 * L_5 = ___extension0;
NullCheck(L_5);
AudioListener_t2734094699 * L_6 = AudioListenerExtension_get_audioListener_m3597041395(L_5, /*hidden argument*/NULL);
int32_t L_7 = V_0;
NullCheck(L_6);
PropertyName_t3749835189 L_8 = AudioListener_ReadExtensionName_m929423100(L_6, L_7, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
PropertyName_t3749835189 L_9 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_ListenerSpatializerExtensionName_8();
bool L_10 = PropertyName_op_Equality_m2761233272(NULL /*static, unused*/, L_8, L_9, /*hidden argument*/NULL);
if (!L_10)
{
goto IL_0068;
}
}
{
AudioListenerExtension_t3242956547 * L_11 = ___extension0;
NullCheck(L_11);
AudioListener_t2734094699 * L_12 = AudioListenerExtension_get_audioListener_m3597041395(L_11, /*hidden argument*/NULL);
int32_t L_13 = V_0;
NullCheck(L_12);
PropertyName_t3749835189 L_14 = AudioListener_ReadExtensionPropertyName_m3416271339(L_12, L_13, /*hidden argument*/NULL);
V_1 = L_14;
AudioListenerExtension_t3242956547 * L_15 = ___extension0;
NullCheck(L_15);
AudioListener_t2734094699 * L_16 = AudioListenerExtension_get_audioListener_m3597041395(L_15, /*hidden argument*/NULL);
int32_t L_17 = V_0;
NullCheck(L_16);
float L_18 = AudioListener_ReadExtensionPropertyValue_m2443832840(L_16, L_17, /*hidden argument*/NULL);
V_2 = L_18;
AudioListenerExtension_t3242956547 * L_19 = ___extension0;
PropertyName_t3749835189 L_20 = V_1;
float L_21 = V_2;
NullCheck(L_19);
VirtActionInvoker2< PropertyName_t3749835189 , float >::Invoke(4 /* System.Void UnityEngine.AudioListenerExtension::WriteExtensionProperty(UnityEngine.PropertyName,System.Single) */, L_19, L_20, L_21);
}
IL_0068:
{
int32_t L_22 = V_0;
V_0 = ((int32_t)il2cpp_codegen_add((int32_t)L_22, (int32_t)1));
}
IL_006d:
{
int32_t L_23 = V_0;
AudioListenerExtension_t3242956547 * L_24 = ___extension0;
NullCheck(L_24);
AudioListener_t2734094699 * L_25 = AudioListenerExtension_get_audioListener_m3597041395(L_24, /*hidden argument*/NULL);
NullCheck(L_25);
int32_t L_26 = AudioListener_GetNumExtensionProperties_m3139224773(L_25, /*hidden argument*/NULL);
if ((((int32_t)L_23) < ((int32_t)L_26)))
{
goto IL_0028;
}
}
{
AudioListenerExtension_t3242956547 * L_27 = ___extension0;
NullCheck(L_27);
AudioListener_t2734094699 * L_28 = AudioListenerExtension_get_audioListener_m3597041395(L_27, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
PropertyName_t3749835189 L_29 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_ListenerSpatializerExtensionName_8();
NullCheck(L_28);
AudioListener_ClearExtensionProperties_m3849891634(L_28, L_29, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.AudioExtensionManager::AddExtensionToManager(UnityEngine.AudioSourceExtension)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_AddExtensionToManager_m3475649283 (RuntimeObject * __this /* static, unused */, AudioSourceExtension_t3064908834 * ___extension0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_AddExtensionToManager_m3475649283_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104(NULL /*static, unused*/, /*hidden argument*/NULL);
AudioSourceExtension_t3064908834 * L_0 = ___extension0;
NullCheck(L_0);
int32_t L_1 = L_0->get_m_ExtensionManagerUpdateIndex_3();
if ((!(((uint32_t)L_1) == ((uint32_t)(-1)))))
{
goto IL_0031;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
List_1_t242016280 * L_2 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
AudioSourceExtension_t3064908834 * L_3 = ___extension0;
NullCheck(L_2);
List_1_Add_m2957197106(L_2, L_3, /*hidden argument*/List_1_Add_m2957197106_RuntimeMethod_var);
AudioSourceExtension_t3064908834 * L_4 = ___extension0;
List_1_t242016280 * L_5 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
NullCheck(L_5);
int32_t L_6 = List_1_get_Count_m3844406869(L_5, /*hidden argument*/List_1_get_Count_m3844406869_RuntimeMethod_var);
NullCheck(L_4);
L_4->set_m_ExtensionManagerUpdateIndex_3(((int32_t)il2cpp_codegen_subtract((int32_t)L_6, (int32_t)1)));
}
IL_0031:
{
return;
}
}
// System.Void UnityEngine.AudioExtensionManager::RemoveExtensionFromManager(UnityEngine.AudioSourceExtension)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_RemoveExtensionFromManager_m442924172 (RuntimeObject * __this /* static, unused */, AudioSourceExtension_t3064908834 * ___extension0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_RemoveExtensionFromManager_m442924172_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
int32_t V_0 = 0;
int32_t V_1 = 0;
{
AudioSourceExtension_t3064908834 * L_0 = ___extension0;
NullCheck(L_0);
int32_t L_1 = L_0->get_m_ExtensionManagerUpdateIndex_3();
V_0 = L_1;
int32_t L_2 = V_0;
if ((((int32_t)L_2) < ((int32_t)0)))
{
goto IL_0060;
}
}
{
int32_t L_3 = V_0;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
List_1_t242016280 * L_4 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
NullCheck(L_4);
int32_t L_5 = List_1_get_Count_m3844406869(L_4, /*hidden argument*/List_1_get_Count_m3844406869_RuntimeMethod_var);
if ((((int32_t)L_3) >= ((int32_t)L_5)))
{
goto IL_0060;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
List_1_t242016280 * L_6 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
NullCheck(L_6);
int32_t L_7 = List_1_get_Count_m3844406869(L_6, /*hidden argument*/List_1_get_Count_m3844406869_RuntimeMethod_var);
V_1 = ((int32_t)il2cpp_codegen_subtract((int32_t)L_7, (int32_t)1));
List_1_t242016280 * L_8 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
int32_t L_9 = V_0;
List_1_t242016280 * L_10 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
int32_t L_11 = V_1;
NullCheck(L_10);
AudioSourceExtension_t3064908834 * L_12 = List_1_get_Item_m1395253538(L_10, L_11, /*hidden argument*/List_1_get_Item_m1395253538_RuntimeMethod_var);
NullCheck(L_8);
List_1_set_Item_m845928814(L_8, L_9, L_12, /*hidden argument*/List_1_set_Item_m845928814_RuntimeMethod_var);
List_1_t242016280 * L_13 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
int32_t L_14 = V_0;
NullCheck(L_13);
AudioSourceExtension_t3064908834 * L_15 = List_1_get_Item_m1395253538(L_13, L_14, /*hidden argument*/List_1_get_Item_m1395253538_RuntimeMethod_var);
int32_t L_16 = V_0;
NullCheck(L_15);
L_15->set_m_ExtensionManagerUpdateIndex_3(L_16);
List_1_t242016280 * L_17 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
int32_t L_18 = V_1;
NullCheck(L_17);
List_1_RemoveAt_m2462508318(L_17, L_18, /*hidden argument*/List_1_RemoveAt_m2462508318_RuntimeMethod_var);
}
IL_0060:
{
AudioSourceExtension_t3064908834 * L_19 = ___extension0;
NullCheck(L_19);
L_19->set_m_ExtensionManagerUpdateIndex_3((-1));
return;
}
}
// System.Void UnityEngine.AudioExtensionManager::Update()
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_Update_m3269307447 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_Update_m3269307447_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
AudioListener_t2734094699 * V_0 = NULL;
AudioListenerExtension_t3242956547 * V_1 = NULL;
int32_t V_2 = 0;
int32_t V_3 = 0;
int32_t V_4 = 0;
AudioSourceExtension_t3064908834 * V_5 = NULL;
int32_t G_B10_0 = 0;
int32_t G_B13_0 = 0;
int32_t G_B21_0 = 0;
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104(NULL /*static, unused*/, /*hidden argument*/NULL);
Object_t631007953 * L_0 = AudioExtensionManager_GetAudioListener_m817760607(NULL /*static, unused*/, /*hidden argument*/NULL);
V_0 = ((AudioListener_t2734094699 *)IsInstSealed((RuntimeObject*)L_0, AudioListener_t2734094699_il2cpp_TypeInfo_var));
AudioListener_t2734094699 * L_1 = V_0;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_2 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_1, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_2)
{
goto IL_0038;
}
}
{
AudioListener_t2734094699 * L_3 = V_0;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioListenerExtension_t3242956547 * L_4 = AudioExtensionManager_AddSpatializerExtension_m3915849352(NULL /*static, unused*/, L_3, /*hidden argument*/NULL);
V_1 = L_4;
AudioListenerExtension_t3242956547 * L_5 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_6 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_5, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_6)
{
goto IL_0037;
}
}
{
AudioListenerExtension_t3242956547 * L_7 = V_1;
NullCheck(L_7);
VirtActionInvoker0::Invoke(5 /* System.Void UnityEngine.AudioListenerExtension::ExtensionUpdate() */, L_7);
}
IL_0037:
{
}
IL_0038:
{
V_2 = 0;
goto IL_0053;
}
IL_003f:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
List_1_t242016280 * L_8 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
int32_t L_9 = V_2;
NullCheck(L_8);
AudioSourceExtension_t3064908834 * L_10 = List_1_get_Item_m1395253538(L_8, L_9, /*hidden argument*/List_1_get_Item_m1395253538_RuntimeMethod_var);
NullCheck(L_10);
VirtActionInvoker0::Invoke(7 /* System.Void UnityEngine.AudioSourceExtension::ExtensionUpdate() */, L_10);
int32_t L_11 = V_2;
V_2 = ((int32_t)il2cpp_codegen_add((int32_t)L_11, (int32_t)1));
}
IL_0053:
{
int32_t L_12 = V_2;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
List_1_t242016280 * L_13 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
NullCheck(L_13);
int32_t L_14 = List_1_get_Count_m3844406869(L_13, /*hidden argument*/List_1_get_Count_m3844406869_RuntimeMethod_var);
if ((((int32_t)L_12) < ((int32_t)L_14)))
{
goto IL_003f;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
int32_t L_15 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_NextStopIndex_4();
List_1_t242016280 * L_16 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
NullCheck(L_16);
int32_t L_17 = List_1_get_Count_m3844406869(L_16, /*hidden argument*/List_1_get_Count_m3844406869_RuntimeMethod_var);
if ((((int32_t)L_15) < ((int32_t)L_17)))
{
goto IL_007d;
}
}
{
G_B10_0 = 0;
goto IL_0082;
}
IL_007d:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
int32_t L_18 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_NextStopIndex_4();
G_B10_0 = L_18;
}
IL_0082:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_NextStopIndex_4(G_B10_0);
List_1_t242016280 * L_19 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
NullCheck(L_19);
int32_t L_20 = List_1_get_Count_m3844406869(L_19, /*hidden argument*/List_1_get_Count_m3844406869_RuntimeMethod_var);
if ((((int32_t)L_20) <= ((int32_t)0)))
{
goto IL_00aa;
}
}
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
List_1_t242016280 * L_21 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
NullCheck(L_21);
int32_t L_22 = List_1_get_Count_m3844406869(L_21, /*hidden argument*/List_1_get_Count_m3844406869_RuntimeMethod_var);
G_B13_0 = ((int32_t)il2cpp_codegen_add((int32_t)1, (int32_t)((int32_t)((int32_t)L_22/(int32_t)8))));
goto IL_00ab;
}
IL_00aa:
{
G_B13_0 = 0;
}
IL_00ab:
{
V_3 = G_B13_0;
V_4 = 0;
goto IL_0148;
}
IL_00b4:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
List_1_t242016280 * L_23 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
int32_t L_24 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_NextStopIndex_4();
NullCheck(L_23);
AudioSourceExtension_t3064908834 * L_25 = List_1_get_Item_m1395253538(L_23, L_24, /*hidden argument*/List_1_get_Item_m1395253538_RuntimeMethod_var);
V_5 = L_25;
AudioSourceExtension_t3064908834 * L_26 = V_5;
NullCheck(L_26);
AudioSource_t3935305588 * L_27 = AudioSourceExtension_get_audioSource_m1465006871(L_26, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_28 = Object_op_Equality_m1810815630(NULL /*static, unused*/, L_27, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (L_28)
{
goto IL_00fa;
}
}
{
AudioSourceExtension_t3064908834 * L_29 = V_5;
NullCheck(L_29);
AudioSource_t3935305588 * L_30 = AudioSourceExtension_get_audioSource_m1465006871(L_29, /*hidden argument*/NULL);
NullCheck(L_30);
bool L_31 = Behaviour_get_enabled_m753527255(L_30, /*hidden argument*/NULL);
if (!L_31)
{
goto IL_00fa;
}
}
{
AudioSourceExtension_t3064908834 * L_32 = V_5;
NullCheck(L_32);
AudioSource_t3935305588 * L_33 = AudioSourceExtension_get_audioSource_m1465006871(L_32, /*hidden argument*/NULL);
NullCheck(L_33);
bool L_34 = AudioSource_get_isPlaying_m1896551654(L_33, /*hidden argument*/NULL);
if (L_34)
{
goto IL_010f;
}
}
IL_00fa:
{
AudioSourceExtension_t3064908834 * L_35 = V_5;
NullCheck(L_35);
VirtActionInvoker0::Invoke(6 /* System.Void UnityEngine.AudioSourceExtension::Stop() */, L_35);
AudioSourceExtension_t3064908834 * L_36 = V_5;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_RemoveExtensionFromManager_m442924172(NULL /*static, unused*/, L_36, /*hidden argument*/NULL);
goto IL_0141;
}
IL_010f:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
int32_t L_37 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_NextStopIndex_4();
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_NextStopIndex_4(((int32_t)il2cpp_codegen_add((int32_t)L_37, (int32_t)1)));
int32_t L_38 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_NextStopIndex_4();
List_1_t242016280 * L_39 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_SourceExtensionsToUpdate_3();
NullCheck(L_39);
int32_t L_40 = List_1_get_Count_m3844406869(L_39, /*hidden argument*/List_1_get_Count_m3844406869_RuntimeMethod_var);
if ((((int32_t)L_38) < ((int32_t)L_40)))
{
goto IL_0136;
}
}
{
G_B21_0 = 0;
goto IL_013b;
}
IL_0136:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
int32_t L_41 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_NextStopIndex_4();
G_B21_0 = L_41;
}
IL_013b:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_NextStopIndex_4(G_B21_0);
}
IL_0141:
{
int32_t L_42 = V_4;
V_4 = ((int32_t)il2cpp_codegen_add((int32_t)L_42, (int32_t)1));
}
IL_0148:
{
int32_t L_43 = V_4;
int32_t L_44 = V_3;
if ((((int32_t)L_43) < ((int32_t)L_44)))
{
goto IL_00b4;
}
}
{
return;
}
}
// System.Void UnityEngine.AudioExtensionManager::GetReadyToPlay(UnityEngine.AudioSourceExtension)
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_GetReadyToPlay_m1557263244 (RuntimeObject * __this /* static, unused */, AudioSourceExtension_t3064908834 * ___extension0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_GetReadyToPlay_m1557263244_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
AudioSourceExtension_t3064908834 * L_0 = ___extension0;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_0, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_001b;
}
}
{
AudioSourceExtension_t3064908834 * L_2 = ___extension0;
NullCheck(L_2);
VirtActionInvoker0::Invoke(5 /* System.Void UnityEngine.AudioSourceExtension::Play() */, L_2);
AudioSourceExtension_t3064908834 * L_3 = ___extension0;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_AddExtensionToManager_m3475649283(NULL /*static, unused*/, L_3, /*hidden argument*/NULL);
}
IL_001b:
{
return;
}
}
// System.Void UnityEngine.AudioExtensionManager::RegisterBuiltinDefinitions()
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager_RegisterBuiltinDefinitions_m2742744104_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
bool V_0 = false;
{
V_0 = (bool)0;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
bool L_0 = ((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->get_m_BuiltinDefinitionsRegistered_5();
if (L_0)
{
goto IL_004d;
}
}
{
bool L_1 = V_0;
if (L_1)
{
goto IL_0028;
}
}
{
String_t* L_2 = AudioSettings_GetSpatializerPluginName_m1324100978(NULL /*static, unused*/, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(String_t_il2cpp_TypeInfo_var);
bool L_3 = String_op_Equality_m920492651(NULL /*static, unused*/, L_2, _stringLiteral4035105846, /*hidden argument*/NULL);
if (!L_3)
{
goto IL_002a;
}
}
IL_0028:
{
}
IL_002a:
{
bool L_4 = V_0;
if (L_4)
{
goto IL_0044;
}
}
{
String_t* L_5 = AudioSettings_GetAmbisonicDecoderPluginName_m19603540(NULL /*static, unused*/, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(String_t_il2cpp_TypeInfo_var);
bool L_6 = String_op_Equality_m920492651(NULL /*static, unused*/, L_5, _stringLiteral4035105846, /*hidden argument*/NULL);
if (!L_6)
{
goto IL_0046;
}
}
IL_0044:
{
}
IL_0046:
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_BuiltinDefinitionsRegistered_5((bool)1);
}
IL_004d:
{
return;
}
}
// System.Void UnityEngine.AudioExtensionManager::.cctor()
extern "C" IL2CPP_METHOD_ATTR void AudioExtensionManager__cctor_m1361600190 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioExtensionManager__cctor_m1361600190_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
List_1_t2069970928 * L_0 = (List_1_t2069970928 *)il2cpp_codegen_object_new(List_1_t2069970928_il2cpp_TypeInfo_var);
List_1__ctor_m3866378638(L_0, /*hidden argument*/List_1__ctor_m3866378638_RuntimeMethod_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_ListenerSpatializerExtensionDefinitions_0(L_0);
List_1_t2069970928 * L_1 = (List_1_t2069970928 *)il2cpp_codegen_object_new(List_1_t2069970928_il2cpp_TypeInfo_var);
List_1__ctor_m3866378638(L_1, /*hidden argument*/List_1__ctor_m3866378638_RuntimeMethod_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_SourceSpatializerExtensionDefinitions_1(L_1);
List_1_t1295534336 * L_2 = (List_1_t1295534336 *)il2cpp_codegen_object_new(List_1_t1295534336_il2cpp_TypeInfo_var);
List_1__ctor_m4205755667(L_2, /*hidden argument*/List_1__ctor_m4205755667_RuntimeMethod_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_SourceAmbisonicDecoderExtensionDefinitions_2(L_2);
List_1_t242016280 * L_3 = (List_1_t242016280 *)il2cpp_codegen_object_new(List_1_t242016280_il2cpp_TypeInfo_var);
List_1__ctor_m69557434(L_3, /*hidden argument*/List_1__ctor_m69557434_RuntimeMethod_var);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_SourceExtensionsToUpdate_3(L_3);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_NextStopIndex_4(0);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_BuiltinDefinitionsRegistered_5((bool)0);
PropertyName_t3749835189 L_4 = PropertyName_op_Implicit_m114733813(NULL /*static, unused*/, 0, /*hidden argument*/NULL);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_SpatializerName_6(L_4);
PropertyName_t3749835189 L_5 = PropertyName_op_Implicit_m114733813(NULL /*static, unused*/, 0, /*hidden argument*/NULL);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_SpatializerExtensionName_7(L_5);
PropertyName_t3749835189 L_6 = PropertyName_op_Implicit_m114733813(NULL /*static, unused*/, 0, /*hidden argument*/NULL);
((AudioExtensionManager_t3220897493_StaticFields*)il2cpp_codegen_static_fields_for(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var))->set_m_ListenerSpatializerExtensionName_8(L_6);
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Int32 UnityEngine.AudioListener::GetNumExtensionProperties()
extern "C" IL2CPP_METHOD_ATTR int32_t AudioListener_GetNumExtensionProperties_m3139224773 (AudioListener_t2734094699 * __this, const RuntimeMethod* method)
{
typedef int32_t (*AudioListener_GetNumExtensionProperties_m3139224773_ftn) (AudioListener_t2734094699 *);
static AudioListener_GetNumExtensionProperties_m3139224773_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioListener_GetNumExtensionProperties_m3139224773_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioListener::GetNumExtensionProperties()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// UnityEngine.PropertyName UnityEngine.AudioListener::ReadExtensionName(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 AudioListener_ReadExtensionName_m929423100 (AudioListener_t2734094699 * __this, int32_t ___listenerIndex0, const RuntimeMethod* method)
{
PropertyName_t3749835189 V_0;
memset(&V_0, 0, sizeof(V_0));
PropertyName_t3749835189 V_1;
memset(&V_1, 0, sizeof(V_1));
{
int32_t L_0 = ___listenerIndex0;
AudioListener_INTERNAL_CALL_ReadExtensionName_m4145804327(NULL /*static, unused*/, __this, L_0, (&V_0), /*hidden argument*/NULL);
PropertyName_t3749835189 L_1 = V_0;
V_1 = L_1;
goto IL_0011;
}
IL_0011:
{
PropertyName_t3749835189 L_2 = V_1;
return L_2;
}
}
// System.Void UnityEngine.AudioListener::INTERNAL_CALL_ReadExtensionName(UnityEngine.AudioListener,System.Int32,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioListener_INTERNAL_CALL_ReadExtensionName_m4145804327 (RuntimeObject * __this /* static, unused */, AudioListener_t2734094699 * ___self0, int32_t ___listenerIndex1, PropertyName_t3749835189 * ___value2, const RuntimeMethod* method)
{
typedef void (*AudioListener_INTERNAL_CALL_ReadExtensionName_m4145804327_ftn) (AudioListener_t2734094699 *, int32_t, PropertyName_t3749835189 *);
static AudioListener_INTERNAL_CALL_ReadExtensionName_m4145804327_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioListener_INTERNAL_CALL_ReadExtensionName_m4145804327_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioListener::INTERNAL_CALL_ReadExtensionName(UnityEngine.AudioListener,System.Int32,UnityEngine.PropertyName&)");
_il2cpp_icall_func(___self0, ___listenerIndex1, ___value2);
}
// UnityEngine.PropertyName UnityEngine.AudioListener::ReadExtensionPropertyName(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 AudioListener_ReadExtensionPropertyName_m3416271339 (AudioListener_t2734094699 * __this, int32_t ___listenerIndex0, const RuntimeMethod* method)
{
PropertyName_t3749835189 V_0;
memset(&V_0, 0, sizeof(V_0));
PropertyName_t3749835189 V_1;
memset(&V_1, 0, sizeof(V_1));
{
int32_t L_0 = ___listenerIndex0;
AudioListener_INTERNAL_CALL_ReadExtensionPropertyName_m330480156(NULL /*static, unused*/, __this, L_0, (&V_0), /*hidden argument*/NULL);
PropertyName_t3749835189 L_1 = V_0;
V_1 = L_1;
goto IL_0011;
}
IL_0011:
{
PropertyName_t3749835189 L_2 = V_1;
return L_2;
}
}
// System.Void UnityEngine.AudioListener::INTERNAL_CALL_ReadExtensionPropertyName(UnityEngine.AudioListener,System.Int32,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioListener_INTERNAL_CALL_ReadExtensionPropertyName_m330480156 (RuntimeObject * __this /* static, unused */, AudioListener_t2734094699 * ___self0, int32_t ___listenerIndex1, PropertyName_t3749835189 * ___value2, const RuntimeMethod* method)
{
typedef void (*AudioListener_INTERNAL_CALL_ReadExtensionPropertyName_m330480156_ftn) (AudioListener_t2734094699 *, int32_t, PropertyName_t3749835189 *);
static AudioListener_INTERNAL_CALL_ReadExtensionPropertyName_m330480156_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioListener_INTERNAL_CALL_ReadExtensionPropertyName_m330480156_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioListener::INTERNAL_CALL_ReadExtensionPropertyName(UnityEngine.AudioListener,System.Int32,UnityEngine.PropertyName&)");
_il2cpp_icall_func(___self0, ___listenerIndex1, ___value2);
}
// System.Single UnityEngine.AudioListener::ReadExtensionPropertyValue(System.Int32)
extern "C" IL2CPP_METHOD_ATTR float AudioListener_ReadExtensionPropertyValue_m2443832840 (AudioListener_t2734094699 * __this, int32_t ___listenerIndex0, const RuntimeMethod* method)
{
typedef float (*AudioListener_ReadExtensionPropertyValue_m2443832840_ftn) (AudioListener_t2734094699 *, int32_t);
static AudioListener_ReadExtensionPropertyValue_m2443832840_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioListener_ReadExtensionPropertyValue_m2443832840_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioListener::ReadExtensionPropertyValue(System.Int32)");
float retVal = _il2cpp_icall_func(__this, ___listenerIndex0);
return retVal;
}
// System.Void UnityEngine.AudioListener::ClearExtensionProperties(UnityEngine.PropertyName)
extern "C" IL2CPP_METHOD_ATTR void AudioListener_ClearExtensionProperties_m3849891634 (AudioListener_t2734094699 * __this, PropertyName_t3749835189 ___extensionName0, const RuntimeMethod* method)
{
{
AudioListener_INTERNAL_CALL_ClearExtensionProperties_m2036387607(NULL /*static, unused*/, __this, (&___extensionName0), /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.AudioListener::INTERNAL_CALL_ClearExtensionProperties(UnityEngine.AudioListener,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioListener_INTERNAL_CALL_ClearExtensionProperties_m2036387607 (RuntimeObject * __this /* static, unused */, AudioListener_t2734094699 * ___self0, PropertyName_t3749835189 * ___extensionName1, const RuntimeMethod* method)
{
typedef void (*AudioListener_INTERNAL_CALL_ClearExtensionProperties_m2036387607_ftn) (AudioListener_t2734094699 *, PropertyName_t3749835189 *);
static AudioListener_INTERNAL_CALL_ClearExtensionProperties_m2036387607_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioListener_INTERNAL_CALL_ClearExtensionProperties_m2036387607_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioListener::INTERNAL_CALL_ClearExtensionProperties(UnityEngine.AudioListener,UnityEngine.PropertyName&)");
_il2cpp_icall_func(___self0, ___extensionName1);
}
// UnityEngine.AudioListenerExtension UnityEngine.AudioListener::AddExtension(System.Type)
extern "C" IL2CPP_METHOD_ATTR AudioListenerExtension_t3242956547 * AudioListener_AddExtension_m994751216 (AudioListener_t2734094699 * __this, Type_t * ___extensionType0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioListener_AddExtension_m994751216_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
AudioListenerExtension_t3242956547 * V_0 = NULL;
{
AudioListenerExtension_t3242956547 * L_0 = __this->get_spatializerExtension_2();
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Equality_m1810815630(NULL /*static, unused*/, L_0, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_0025;
}
}
{
Type_t * L_2 = ___extensionType0;
ScriptableObject_t2528358522 * L_3 = ScriptableObject_CreateInstance_m2611081756(NULL /*static, unused*/, L_2, /*hidden argument*/NULL);
__this->set_spatializerExtension_2(((AudioListenerExtension_t3242956547 *)IsInstClass((RuntimeObject*)L_3, AudioListenerExtension_t3242956547_il2cpp_TypeInfo_var)));
}
IL_0025:
{
AudioListenerExtension_t3242956547 * L_4 = __this->get_spatializerExtension_2();
V_0 = L_4;
goto IL_0031;
}
IL_0031:
{
AudioListenerExtension_t3242956547 * L_5 = V_0;
return L_5;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioListener UnityEngine.AudioListenerExtension::get_audioListener()
extern "C" IL2CPP_METHOD_ATTR AudioListener_t2734094699 * AudioListenerExtension_get_audioListener_m3597041395 (AudioListenerExtension_t3242956547 * __this, const RuntimeMethod* method)
{
AudioListener_t2734094699 * V_0 = NULL;
{
AudioListener_t2734094699 * L_0 = __this->get_m_audioListener_2();
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
AudioListener_t2734094699 * L_1 = V_0;
return L_1;
}
}
// System.Void UnityEngine.AudioListenerExtension::set_audioListener(UnityEngine.AudioListener)
extern "C" IL2CPP_METHOD_ATTR void AudioListenerExtension_set_audioListener_m3412289012 (AudioListenerExtension_t3242956547 * __this, AudioListener_t2734094699 * ___value0, const RuntimeMethod* method)
{
{
AudioListener_t2734094699 * L_0 = ___value0;
__this->set_m_audioListener_2(L_0);
return;
}
}
// System.Void UnityEngine.AudioListenerExtension::WriteExtensionProperty(UnityEngine.PropertyName,System.Single)
extern "C" IL2CPP_METHOD_ATTR void AudioListenerExtension_WriteExtensionProperty_m4064727398 (AudioListenerExtension_t3242956547 * __this, PropertyName_t3749835189 ___propertyName0, float ___propertyValue1, const RuntimeMethod* method)
{
{
return;
}
}
// System.Void UnityEngine.AudioListenerExtension::ExtensionUpdate()
extern "C" IL2CPP_METHOD_ATTR void AudioListenerExtension_ExtensionUpdate_m1303405084 (AudioListenerExtension_t3242956547 * __this, const RuntimeMethod* method)
{
{
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.String UnityEngine.AudioSettings::GetSpatializerPluginName()
extern "C" IL2CPP_METHOD_ATTR String_t* AudioSettings_GetSpatializerPluginName_m1324100978 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
typedef String_t* (*AudioSettings_GetSpatializerPluginName_m1324100978_ftn) ();
static AudioSettings_GetSpatializerPluginName_m1324100978_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSettings_GetSpatializerPluginName_m1324100978_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSettings::GetSpatializerPluginName()");
String_t* retVal = _il2cpp_icall_func();
return retVal;
}
// System.Void UnityEngine.AudioSettings::InvokeOnAudioConfigurationChanged(System.Boolean)
extern "C" IL2CPP_METHOD_ATTR void AudioSettings_InvokeOnAudioConfigurationChanged_m3131294153 (RuntimeObject * __this /* static, unused */, bool ___deviceWasChanged0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioSettings_InvokeOnAudioConfigurationChanged_m3131294153_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
AudioConfigurationChangeHandler_t2089929874 * L_0 = ((AudioSettings_t3587374600_StaticFields*)il2cpp_codegen_static_fields_for(AudioSettings_t3587374600_il2cpp_TypeInfo_var))->get_OnAudioConfigurationChanged_0();
if (!L_0)
{
goto IL_0016;
}
}
{
AudioConfigurationChangeHandler_t2089929874 * L_1 = ((AudioSettings_t3587374600_StaticFields*)il2cpp_codegen_static_fields_for(AudioSettings_t3587374600_il2cpp_TypeInfo_var))->get_OnAudioConfigurationChanged_0();
bool L_2 = ___deviceWasChanged0;
NullCheck(L_1);
AudioConfigurationChangeHandler_Invoke_m1233557945(L_1, L_2, /*hidden argument*/NULL);
}
IL_0016:
{
return;
}
}
// System.Void UnityEngine.AudioSettings::InvokeOnAudioManagerUpdate()
extern "C" IL2CPP_METHOD_ATTR void AudioSettings_InvokeOnAudioManagerUpdate_m4044425648 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioSettings_InvokeOnAudioManagerUpdate_m4044425648_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_Update_m3269307447(NULL /*static, unused*/, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.AudioSettings::InvokeOnAudioSourcePlay(UnityEngine.AudioSource)
extern "C" IL2CPP_METHOD_ATTR void AudioSettings_InvokeOnAudioSourcePlay_m3298744573 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___source0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioSettings_InvokeOnAudioSourcePlay_m3298744573_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
AudioSourceExtension_t3064908834 * V_0 = NULL;
AudioSourceExtension_t3064908834 * V_1 = NULL;
{
AudioSource_t3935305588 * L_0 = ___source0;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioSourceExtension_t3064908834 * L_1 = AudioExtensionManager_AddSpatializerExtension_m820561940(NULL /*static, unused*/, L_0, /*hidden argument*/NULL);
V_0 = L_1;
AudioSourceExtension_t3064908834 * L_2 = V_0;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_3 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_2, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_3)
{
goto IL_001a;
}
}
{
AudioSourceExtension_t3064908834 * L_4 = V_0;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_GetReadyToPlay_m1557263244(NULL /*static, unused*/, L_4, /*hidden argument*/NULL);
}
IL_001a:
{
AudioSource_t3935305588 * L_5 = ___source0;
NullCheck(L_5);
AudioClip_t3680889665 * L_6 = AudioSource_get_clip_m1234340632(L_5, /*hidden argument*/NULL);
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_7 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_6, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_7)
{
goto IL_0056;
}
}
{
AudioSource_t3935305588 * L_8 = ___source0;
NullCheck(L_8);
AudioClip_t3680889665 * L_9 = AudioSource_get_clip_m1234340632(L_8, /*hidden argument*/NULL);
NullCheck(L_9);
bool L_10 = AudioClip_get_ambisonic_m3815052287(L_9, /*hidden argument*/NULL);
if (!L_10)
{
goto IL_0056;
}
}
{
AudioSource_t3935305588 * L_11 = ___source0;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioSourceExtension_t3064908834 * L_12 = AudioExtensionManager_AddAmbisonicDecoderExtension_m3197702864(NULL /*static, unused*/, L_11, /*hidden argument*/NULL);
V_1 = L_12;
AudioSourceExtension_t3064908834 * L_13 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_14 = Object_op_Inequality_m4071470834(NULL /*static, unused*/, L_13, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_14)
{
goto IL_0055;
}
}
{
AudioSourceExtension_t3064908834 * L_15 = V_1;
IL2CPP_RUNTIME_CLASS_INIT(AudioExtensionManager_t3220897493_il2cpp_TypeInfo_var);
AudioExtensionManager_GetReadyToPlay_m1557263244(NULL /*static, unused*/, L_15, /*hidden argument*/NULL);
}
IL_0055:
{
}
IL_0056:
{
return;
}
}
// System.String UnityEngine.AudioSettings::GetAmbisonicDecoderPluginName()
extern "C" IL2CPP_METHOD_ATTR String_t* AudioSettings_GetAmbisonicDecoderPluginName_m19603540 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
typedef String_t* (*AudioSettings_GetAmbisonicDecoderPluginName_m19603540_ftn) ();
static AudioSettings_GetAmbisonicDecoderPluginName_m19603540_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSettings_GetAmbisonicDecoderPluginName_m19603540_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSettings::GetAmbisonicDecoderPluginName()");
String_t* retVal = _il2cpp_icall_func();
return retVal;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
extern "C" void DelegatePInvokeWrapper_AudioConfigurationChangeHandler_t2089929874 (AudioConfigurationChangeHandler_t2089929874 * __this, bool ___deviceWasChanged0, const RuntimeMethod* method)
{
typedef void (DEFAULT_CALL *PInvokeFunc)(int32_t);
PInvokeFunc il2cppPInvokeFunc = reinterpret_cast<PInvokeFunc>(il2cpp_codegen_get_method_pointer(((RuntimeDelegate*)__this)->method));
// Native function invocation
il2cppPInvokeFunc(static_cast<int32_t>(___deviceWasChanged0));
}
// System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::.ctor(System.Object,System.IntPtr)
extern "C" IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler__ctor_m1059338375 (AudioConfigurationChangeHandler_t2089929874 * __this, RuntimeObject * ___object0, intptr_t ___method1, const RuntimeMethod* method)
{
__this->set_method_ptr_0(il2cpp_codegen_get_method_pointer((RuntimeMethod*)___method1));
__this->set_method_3(___method1);
__this->set_m_target_2(___object0);
}
// System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::Invoke(System.Boolean)
extern "C" IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler_Invoke_m1233557945 (AudioConfigurationChangeHandler_t2089929874 * __this, bool ___deviceWasChanged0, const RuntimeMethod* method)
{
if(__this->get_prev_9() != NULL)
{
AudioConfigurationChangeHandler_Invoke_m1233557945((AudioConfigurationChangeHandler_t2089929874 *)__this->get_prev_9(), ___deviceWasChanged0, method);
}
Il2CppMethodPointer targetMethodPointer = __this->get_method_ptr_0();
RuntimeMethod* targetMethod = (RuntimeMethod*)(__this->get_method_3());
RuntimeObject* targetThis = __this->get_m_target_2();
il2cpp_codegen_raise_execution_engine_exception_if_method_is_not_found(targetMethod);
bool ___methodIsStatic = MethodIsStatic(targetMethod);
if (___methodIsStatic)
{
if (il2cpp_codegen_method_parameter_count(targetMethod) == 1)
{
// open
{
typedef void (*FunctionPointerType) (RuntimeObject *, bool, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(NULL, ___deviceWasChanged0, targetMethod);
}
}
else
{
// closed
{
typedef void (*FunctionPointerType) (RuntimeObject *, void*, bool, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(NULL, targetThis, ___deviceWasChanged0, targetMethod);
}
}
}
else
{
{
// closed
if (il2cpp_codegen_method_is_virtual(targetMethod) && !il2cpp_codegen_object_is_of_sealed_type(targetThis) && il2cpp_codegen_delegate_has_invoker((Il2CppDelegate*)__this))
{
if (il2cpp_codegen_method_is_generic_instance(targetMethod))
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
GenericInterfaceActionInvoker1< bool >::Invoke(targetMethod, targetThis, ___deviceWasChanged0);
else
GenericVirtActionInvoker1< bool >::Invoke(targetMethod, targetThis, ___deviceWasChanged0);
}
else
{
if (il2cpp_codegen_method_is_interface_method(targetMethod))
InterfaceActionInvoker1< bool >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), il2cpp_codegen_method_get_declaring_type(targetMethod), targetThis, ___deviceWasChanged0);
else
VirtActionInvoker1< bool >::Invoke(il2cpp_codegen_method_get_slot(targetMethod), targetThis, ___deviceWasChanged0);
}
}
else
{
typedef void (*FunctionPointerType) (void*, bool, const RuntimeMethod*);
((FunctionPointerType)targetMethodPointer)(targetThis, ___deviceWasChanged0, targetMethod);
}
}
}
}
// System.IAsyncResult UnityEngine.AudioSettings/AudioConfigurationChangeHandler::BeginInvoke(System.Boolean,System.AsyncCallback,System.Object)
extern "C" IL2CPP_METHOD_ATTR RuntimeObject* AudioConfigurationChangeHandler_BeginInvoke_m4104069447 (AudioConfigurationChangeHandler_t2089929874 * __this, bool ___deviceWasChanged0, AsyncCallback_t3962456242 * ___callback1, RuntimeObject * ___object2, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioConfigurationChangeHandler_BeginInvoke_m4104069447_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
void *__d_args[2] = {0};
__d_args[0] = Box(Boolean_t97287965_il2cpp_TypeInfo_var, &___deviceWasChanged0);
return (RuntimeObject*)il2cpp_codegen_delegate_begin_invoke((RuntimeDelegate*)__this, __d_args, (RuntimeDelegate*)___callback1, (RuntimeObject*)___object2);
}
// System.Void UnityEngine.AudioSettings/AudioConfigurationChangeHandler::EndInvoke(System.IAsyncResult)
extern "C" IL2CPP_METHOD_ATTR void AudioConfigurationChangeHandler_EndInvoke_m4175380841 (AudioConfigurationChangeHandler_t2089929874 * __this, RuntimeObject* ___result0, const RuntimeMethod* method)
{
il2cpp_codegen_delegate_end_invoke((Il2CppAsyncResult*) ___result0, 0);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioClip UnityEngine.AudioSource::get_clip()
extern "C" IL2CPP_METHOD_ATTR AudioClip_t3680889665 * AudioSource_get_clip_m1234340632 (AudioSource_t3935305588 * __this, const RuntimeMethod* method)
{
typedef AudioClip_t3680889665 * (*AudioSource_get_clip_m1234340632_ftn) (AudioSource_t3935305588 *);
static AudioSource_get_clip_m1234340632_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSource_get_clip_m1234340632_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSource::get_clip()");
AudioClip_t3680889665 * retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.AudioSource::get_isPlaying()
extern "C" IL2CPP_METHOD_ATTR bool AudioSource_get_isPlaying_m1896551654 (AudioSource_t3935305588 * __this, const RuntimeMethod* method)
{
typedef bool (*AudioSource_get_isPlaying_m1896551654_ftn) (AudioSource_t3935305588 *);
static AudioSource_get_isPlaying_m1896551654_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSource_get_isPlaying_m1896551654_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSource::get_isPlaying()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.AudioSource::get_spatializeInternal()
extern "C" IL2CPP_METHOD_ATTR bool AudioSource_get_spatializeInternal_m2117549793 (AudioSource_t3935305588 * __this, const RuntimeMethod* method)
{
typedef bool (*AudioSource_get_spatializeInternal_m2117549793_ftn) (AudioSource_t3935305588 *);
static AudioSource_get_spatializeInternal_m2117549793_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSource_get_spatializeInternal_m2117549793_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSource::get_spatializeInternal()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Boolean UnityEngine.AudioSource::get_spatialize()
extern "C" IL2CPP_METHOD_ATTR bool AudioSource_get_spatialize_m3609701298 (AudioSource_t3935305588 * __this, const RuntimeMethod* method)
{
bool V_0 = false;
{
bool L_0 = AudioSource_get_spatializeInternal_m2117549793(__this, /*hidden argument*/NULL);
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
bool L_1 = V_0;
return L_1;
}
}
// System.Int32 UnityEngine.AudioSource::GetNumExtensionProperties()
extern "C" IL2CPP_METHOD_ATTR int32_t AudioSource_GetNumExtensionProperties_m1231815209 (AudioSource_t3935305588 * __this, const RuntimeMethod* method)
{
typedef int32_t (*AudioSource_GetNumExtensionProperties_m1231815209_ftn) (AudioSource_t3935305588 *);
static AudioSource_GetNumExtensionProperties_m1231815209_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSource_GetNumExtensionProperties_m1231815209_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSource::GetNumExtensionProperties()");
int32_t retVal = _il2cpp_icall_func(__this);
return retVal;
}
// UnityEngine.PropertyName UnityEngine.AudioSource::ReadExtensionName(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 AudioSource_ReadExtensionName_m725112169 (AudioSource_t3935305588 * __this, int32_t ___sourceIndex0, const RuntimeMethod* method)
{
PropertyName_t3749835189 V_0;
memset(&V_0, 0, sizeof(V_0));
PropertyName_t3749835189 V_1;
memset(&V_1, 0, sizeof(V_1));
{
int32_t L_0 = ___sourceIndex0;
AudioSource_INTERNAL_CALL_ReadExtensionName_m36001502(NULL /*static, unused*/, __this, L_0, (&V_0), /*hidden argument*/NULL);
PropertyName_t3749835189 L_1 = V_0;
V_1 = L_1;
goto IL_0011;
}
IL_0011:
{
PropertyName_t3749835189 L_2 = V_1;
return L_2;
}
}
// System.Void UnityEngine.AudioSource::INTERNAL_CALL_ReadExtensionName(UnityEngine.AudioSource,System.Int32,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioSource_INTERNAL_CALL_ReadExtensionName_m36001502 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___self0, int32_t ___sourceIndex1, PropertyName_t3749835189 * ___value2, const RuntimeMethod* method)
{
typedef void (*AudioSource_INTERNAL_CALL_ReadExtensionName_m36001502_ftn) (AudioSource_t3935305588 *, int32_t, PropertyName_t3749835189 *);
static AudioSource_INTERNAL_CALL_ReadExtensionName_m36001502_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSource_INTERNAL_CALL_ReadExtensionName_m36001502_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSource::INTERNAL_CALL_ReadExtensionName(UnityEngine.AudioSource,System.Int32,UnityEngine.PropertyName&)");
_il2cpp_icall_func(___self0, ___sourceIndex1, ___value2);
}
// UnityEngine.PropertyName UnityEngine.AudioSource::ReadExtensionPropertyName(System.Int32)
extern "C" IL2CPP_METHOD_ATTR PropertyName_t3749835189 AudioSource_ReadExtensionPropertyName_m2761820692 (AudioSource_t3935305588 * __this, int32_t ___sourceIndex0, const RuntimeMethod* method)
{
PropertyName_t3749835189 V_0;
memset(&V_0, 0, sizeof(V_0));
PropertyName_t3749835189 V_1;
memset(&V_1, 0, sizeof(V_1));
{
int32_t L_0 = ___sourceIndex0;
AudioSource_INTERNAL_CALL_ReadExtensionPropertyName_m3643462071(NULL /*static, unused*/, __this, L_0, (&V_0), /*hidden argument*/NULL);
PropertyName_t3749835189 L_1 = V_0;
V_1 = L_1;
goto IL_0011;
}
IL_0011:
{
PropertyName_t3749835189 L_2 = V_1;
return L_2;
}
}
// System.Void UnityEngine.AudioSource::INTERNAL_CALL_ReadExtensionPropertyName(UnityEngine.AudioSource,System.Int32,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioSource_INTERNAL_CALL_ReadExtensionPropertyName_m3643462071 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___self0, int32_t ___sourceIndex1, PropertyName_t3749835189 * ___value2, const RuntimeMethod* method)
{
typedef void (*AudioSource_INTERNAL_CALL_ReadExtensionPropertyName_m3643462071_ftn) (AudioSource_t3935305588 *, int32_t, PropertyName_t3749835189 *);
static AudioSource_INTERNAL_CALL_ReadExtensionPropertyName_m3643462071_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSource_INTERNAL_CALL_ReadExtensionPropertyName_m3643462071_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSource::INTERNAL_CALL_ReadExtensionPropertyName(UnityEngine.AudioSource,System.Int32,UnityEngine.PropertyName&)");
_il2cpp_icall_func(___self0, ___sourceIndex1, ___value2);
}
// System.Single UnityEngine.AudioSource::ReadExtensionPropertyValue(System.Int32)
extern "C" IL2CPP_METHOD_ATTR float AudioSource_ReadExtensionPropertyValue_m72717540 (AudioSource_t3935305588 * __this, int32_t ___sourceIndex0, const RuntimeMethod* method)
{
typedef float (*AudioSource_ReadExtensionPropertyValue_m72717540_ftn) (AudioSource_t3935305588 *, int32_t);
static AudioSource_ReadExtensionPropertyValue_m72717540_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSource_ReadExtensionPropertyValue_m72717540_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSource::ReadExtensionPropertyValue(System.Int32)");
float retVal = _il2cpp_icall_func(__this, ___sourceIndex0);
return retVal;
}
// System.Void UnityEngine.AudioSource::ClearExtensionProperties(UnityEngine.PropertyName)
extern "C" IL2CPP_METHOD_ATTR void AudioSource_ClearExtensionProperties_m2116074582 (AudioSource_t3935305588 * __this, PropertyName_t3749835189 ___extensionName0, const RuntimeMethod* method)
{
{
AudioSource_INTERNAL_CALL_ClearExtensionProperties_m2159298662(NULL /*static, unused*/, __this, (&___extensionName0), /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.AudioSource::INTERNAL_CALL_ClearExtensionProperties(UnityEngine.AudioSource,UnityEngine.PropertyName&)
extern "C" IL2CPP_METHOD_ATTR void AudioSource_INTERNAL_CALL_ClearExtensionProperties_m2159298662 (RuntimeObject * __this /* static, unused */, AudioSource_t3935305588 * ___self0, PropertyName_t3749835189 * ___extensionName1, const RuntimeMethod* method)
{
typedef void (*AudioSource_INTERNAL_CALL_ClearExtensionProperties_m2159298662_ftn) (AudioSource_t3935305588 *, PropertyName_t3749835189 *);
static AudioSource_INTERNAL_CALL_ClearExtensionProperties_m2159298662_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (AudioSource_INTERNAL_CALL_ClearExtensionProperties_m2159298662_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.AudioSource::INTERNAL_CALL_ClearExtensionProperties(UnityEngine.AudioSource,UnityEngine.PropertyName&)");
_il2cpp_icall_func(___self0, ___extensionName1);
}
// UnityEngine.AudioSourceExtension UnityEngine.AudioSource::AddSpatializerExtension(System.Type)
extern "C" IL2CPP_METHOD_ATTR AudioSourceExtension_t3064908834 * AudioSource_AddSpatializerExtension_m2560794359 (AudioSource_t3935305588 * __this, Type_t * ___extensionType0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioSource_AddSpatializerExtension_m2560794359_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
AudioSourceExtension_t3064908834 * V_0 = NULL;
{
AudioSourceExtension_t3064908834 * L_0 = __this->get_spatializerExtension_2();
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Equality_m1810815630(NULL /*static, unused*/, L_0, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_0025;
}
}
{
Type_t * L_2 = ___extensionType0;
ScriptableObject_t2528358522 * L_3 = ScriptableObject_CreateInstance_m2611081756(NULL /*static, unused*/, L_2, /*hidden argument*/NULL);
__this->set_spatializerExtension_2(((AudioSourceExtension_t3064908834 *)IsInstClass((RuntimeObject*)L_3, AudioSourceExtension_t3064908834_il2cpp_TypeInfo_var)));
}
IL_0025:
{
AudioSourceExtension_t3064908834 * L_4 = __this->get_spatializerExtension_2();
V_0 = L_4;
goto IL_0031;
}
IL_0031:
{
AudioSourceExtension_t3064908834 * L_5 = V_0;
return L_5;
}
}
// UnityEngine.AudioSourceExtension UnityEngine.AudioSource::AddAmbisonicExtension(System.Type)
extern "C" IL2CPP_METHOD_ATTR AudioSourceExtension_t3064908834 * AudioSource_AddAmbisonicExtension_m304476911 (AudioSource_t3935305588 * __this, Type_t * ___extensionType0, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (AudioSource_AddAmbisonicExtension_m304476911_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
AudioSourceExtension_t3064908834 * V_0 = NULL;
{
AudioSourceExtension_t3064908834 * L_0 = __this->get_ambisonicExtension_3();
IL2CPP_RUNTIME_CLASS_INIT(Object_t631007953_il2cpp_TypeInfo_var);
bool L_1 = Object_op_Equality_m1810815630(NULL /*static, unused*/, L_0, (Object_t631007953 *)NULL, /*hidden argument*/NULL);
if (!L_1)
{
goto IL_0025;
}
}
{
Type_t * L_2 = ___extensionType0;
ScriptableObject_t2528358522 * L_3 = ScriptableObject_CreateInstance_m2611081756(NULL /*static, unused*/, L_2, /*hidden argument*/NULL);
__this->set_ambisonicExtension_3(((AudioSourceExtension_t3064908834 *)IsInstClass((RuntimeObject*)L_3, AudioSourceExtension_t3064908834_il2cpp_TypeInfo_var)));
}
IL_0025:
{
AudioSourceExtension_t3064908834 * L_4 = __this->get_ambisonicExtension_3();
V_0 = L_4;
goto IL_0031;
}
IL_0031:
{
AudioSourceExtension_t3064908834 * L_5 = V_0;
return L_5;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// UnityEngine.AudioSource UnityEngine.AudioSourceExtension::get_audioSource()
extern "C" IL2CPP_METHOD_ATTR AudioSource_t3935305588 * AudioSourceExtension_get_audioSource_m1465006871 (AudioSourceExtension_t3064908834 * __this, const RuntimeMethod* method)
{
AudioSource_t3935305588 * V_0 = NULL;
{
AudioSource_t3935305588 * L_0 = __this->get_m_audioSource_2();
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
AudioSource_t3935305588 * L_1 = V_0;
return L_1;
}
}
// System.Void UnityEngine.AudioSourceExtension::set_audioSource(UnityEngine.AudioSource)
extern "C" IL2CPP_METHOD_ATTR void AudioSourceExtension_set_audioSource_m3729768988 (AudioSourceExtension_t3064908834 * __this, AudioSource_t3935305588 * ___value0, const RuntimeMethod* method)
{
{
AudioSource_t3935305588 * L_0 = ___value0;
__this->set_m_audioSource_2(L_0);
return;
}
}
// System.Void UnityEngine.AudioSourceExtension::WriteExtensionProperty(UnityEngine.PropertyName,System.Single)
extern "C" IL2CPP_METHOD_ATTR void AudioSourceExtension_WriteExtensionProperty_m2866033202 (AudioSourceExtension_t3064908834 * __this, PropertyName_t3749835189 ___propertyName0, float ___propertyValue1, const RuntimeMethod* method)
{
{
return;
}
}
// System.Void UnityEngine.AudioSourceExtension::Play()
extern "C" IL2CPP_METHOD_ATTR void AudioSourceExtension_Play_m420799475 (AudioSourceExtension_t3064908834 * __this, const RuntimeMethod* method)
{
{
return;
}
}
// System.Void UnityEngine.AudioSourceExtension::Stop()
extern "C" IL2CPP_METHOD_ATTR void AudioSourceExtension_Stop_m387892536 (AudioSourceExtension_t3064908834 * __this, const RuntimeMethod* method)
{
{
return;
}
}
// System.Void UnityEngine.AudioSourceExtension::ExtensionUpdate()
extern "C" IL2CPP_METHOD_ATTR void AudioSourceExtension_ExtensionUpdate_m2790353999 (AudioSourceExtension_t3064908834 * __this, const RuntimeMethod* method)
{
{
return;
}
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Conversion methods for marshalling of: UnityEngine.WebCamDevice
extern "C" void WebCamDevice_t1322781432_marshal_pinvoke(const WebCamDevice_t1322781432& unmarshaled, WebCamDevice_t1322781432_marshaled_pinvoke& marshaled)
{
marshaled.___m_Name_0 = il2cpp_codegen_marshal_string(unmarshaled.get_m_Name_0());
marshaled.___m_Flags_1 = unmarshaled.get_m_Flags_1();
}
extern "C" void WebCamDevice_t1322781432_marshal_pinvoke_back(const WebCamDevice_t1322781432_marshaled_pinvoke& marshaled, WebCamDevice_t1322781432& unmarshaled)
{
unmarshaled.set_m_Name_0(il2cpp_codegen_marshal_string_result(marshaled.___m_Name_0));
int32_t unmarshaled_m_Flags_temp_1 = 0;
unmarshaled_m_Flags_temp_1 = marshaled.___m_Flags_1;
unmarshaled.set_m_Flags_1(unmarshaled_m_Flags_temp_1);
}
// Conversion method for clean up from marshalling of: UnityEngine.WebCamDevice
extern "C" void WebCamDevice_t1322781432_marshal_pinvoke_cleanup(WebCamDevice_t1322781432_marshaled_pinvoke& marshaled)
{
il2cpp_codegen_marshal_free(marshaled.___m_Name_0);
marshaled.___m_Name_0 = NULL;
}
// Conversion methods for marshalling of: UnityEngine.WebCamDevice
extern "C" void WebCamDevice_t1322781432_marshal_com(const WebCamDevice_t1322781432& unmarshaled, WebCamDevice_t1322781432_marshaled_com& marshaled)
{
marshaled.___m_Name_0 = il2cpp_codegen_marshal_bstring(unmarshaled.get_m_Name_0());
marshaled.___m_Flags_1 = unmarshaled.get_m_Flags_1();
}
extern "C" void WebCamDevice_t1322781432_marshal_com_back(const WebCamDevice_t1322781432_marshaled_com& marshaled, WebCamDevice_t1322781432& unmarshaled)
{
unmarshaled.set_m_Name_0(il2cpp_codegen_marshal_bstring_result(marshaled.___m_Name_0));
int32_t unmarshaled_m_Flags_temp_1 = 0;
unmarshaled_m_Flags_temp_1 = marshaled.___m_Flags_1;
unmarshaled.set_m_Flags_1(unmarshaled_m_Flags_temp_1);
}
// Conversion method for clean up from marshalling of: UnityEngine.WebCamDevice
extern "C" void WebCamDevice_t1322781432_marshal_com_cleanup(WebCamDevice_t1322781432_marshaled_com& marshaled)
{
il2cpp_codegen_marshal_free_bstring(marshaled.___m_Name_0);
marshaled.___m_Name_0 = NULL;
}
// System.String UnityEngine.WebCamDevice::get_name()
extern "C" IL2CPP_METHOD_ATTR String_t* WebCamDevice_get_name_m3782173082 (WebCamDevice_t1322781432 * __this, const RuntimeMethod* method)
{
String_t* V_0 = NULL;
{
String_t* L_0 = __this->get_m_Name_0();
V_0 = L_0;
goto IL_000d;
}
IL_000d:
{
String_t* L_1 = V_0;
return L_1;
}
}
extern "C" String_t* WebCamDevice_get_name_m3782173082_AdjustorThunk (RuntimeObject * __this, const RuntimeMethod* method)
{
WebCamDevice_t1322781432 * _thisAdjusted = reinterpret_cast<WebCamDevice_t1322781432 *>(__this + 1);
return WebCamDevice_get_name_m3782173082(_thisAdjusted, method);
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Void UnityEngine.WebCamTexture::.ctor()
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture__ctor_m2601640589 (WebCamTexture_t1514609158 * __this, const RuntimeMethod* method)
{
static bool s_Il2CppMethodInitialized;
if (!s_Il2CppMethodInitialized)
{
il2cpp_codegen_initialize_method (WebCamTexture__ctor_m2601640589_MetadataUsageId);
s_Il2CppMethodInitialized = true;
}
{
Texture__ctor_m3554519797(__this, /*hidden argument*/NULL);
WebCamTexture_Internal_CreateWebCamTexture_m2861130443(NULL /*static, unused*/, __this, _stringLiteral757602046, 0, 0, 0, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.WebCamTexture::Internal_CreateWebCamTexture(UnityEngine.WebCamTexture,System.String,System.Int32,System.Int32,System.Int32)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_Internal_CreateWebCamTexture_m2861130443 (RuntimeObject * __this /* static, unused */, WebCamTexture_t1514609158 * ___self0, String_t* ___scriptingDevice1, int32_t ___requestedWidth2, int32_t ___requestedHeight3, int32_t ___maxFramerate4, const RuntimeMethod* method)
{
typedef void (*WebCamTexture_Internal_CreateWebCamTexture_m2861130443_ftn) (WebCamTexture_t1514609158 *, String_t*, int32_t, int32_t, int32_t);
static WebCamTexture_Internal_CreateWebCamTexture_m2861130443_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_Internal_CreateWebCamTexture_m2861130443_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::Internal_CreateWebCamTexture(UnityEngine.WebCamTexture,System.String,System.Int32,System.Int32,System.Int32)");
_il2cpp_icall_func(___self0, ___scriptingDevice1, ___requestedWidth2, ___requestedHeight3, ___maxFramerate4);
}
// System.Void UnityEngine.WebCamTexture::Play()
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_Play_m3866603461 (WebCamTexture_t1514609158 * __this, const RuntimeMethod* method)
{
{
WebCamTexture_INTERNAL_CALL_Play_m701961556(NULL /*static, unused*/, __this, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.WebCamTexture::INTERNAL_CALL_Play(UnityEngine.WebCamTexture)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_INTERNAL_CALL_Play_m701961556 (RuntimeObject * __this /* static, unused */, WebCamTexture_t1514609158 * ___self0, const RuntimeMethod* method)
{
typedef void (*WebCamTexture_INTERNAL_CALL_Play_m701961556_ftn) (WebCamTexture_t1514609158 *);
static WebCamTexture_INTERNAL_CALL_Play_m701961556_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_INTERNAL_CALL_Play_m701961556_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::INTERNAL_CALL_Play(UnityEngine.WebCamTexture)");
_il2cpp_icall_func(___self0);
}
// System.Void UnityEngine.WebCamTexture::Stop()
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_Stop_m3471034432 (WebCamTexture_t1514609158 * __this, const RuntimeMethod* method)
{
{
WebCamTexture_INTERNAL_CALL_Stop_m2114762857(NULL /*static, unused*/, __this, /*hidden argument*/NULL);
return;
}
}
// System.Void UnityEngine.WebCamTexture::INTERNAL_CALL_Stop(UnityEngine.WebCamTexture)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_INTERNAL_CALL_Stop_m2114762857 (RuntimeObject * __this /* static, unused */, WebCamTexture_t1514609158 * ___self0, const RuntimeMethod* method)
{
typedef void (*WebCamTexture_INTERNAL_CALL_Stop_m2114762857_ftn) (WebCamTexture_t1514609158 *);
static WebCamTexture_INTERNAL_CALL_Stop_m2114762857_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_INTERNAL_CALL_Stop_m2114762857_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::INTERNAL_CALL_Stop(UnityEngine.WebCamTexture)");
_il2cpp_icall_func(___self0);
}
// System.Boolean UnityEngine.WebCamTexture::get_isPlaying()
extern "C" IL2CPP_METHOD_ATTR bool WebCamTexture_get_isPlaying_m3525118025 (WebCamTexture_t1514609158 * __this, const RuntimeMethod* method)
{
typedef bool (*WebCamTexture_get_isPlaying_m3525118025_ftn) (WebCamTexture_t1514609158 *);
static WebCamTexture_get_isPlaying_m3525118025_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_get_isPlaying_m3525118025_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::get_isPlaying()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
// System.Void UnityEngine.WebCamTexture::set_deviceName(System.String)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_set_deviceName_m2479609938 (WebCamTexture_t1514609158 * __this, String_t* ___value0, const RuntimeMethod* method)
{
typedef void (*WebCamTexture_set_deviceName_m2479609938_ftn) (WebCamTexture_t1514609158 *, String_t*);
static WebCamTexture_set_deviceName_m2479609938_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_set_deviceName_m2479609938_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::set_deviceName(System.String)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Void UnityEngine.WebCamTexture::set_requestedFPS(System.Single)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_set_requestedFPS_m1422816314 (WebCamTexture_t1514609158 * __this, float ___value0, const RuntimeMethod* method)
{
typedef void (*WebCamTexture_set_requestedFPS_m1422816314_ftn) (WebCamTexture_t1514609158 *, float);
static WebCamTexture_set_requestedFPS_m1422816314_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_set_requestedFPS_m1422816314_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::set_requestedFPS(System.Single)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Void UnityEngine.WebCamTexture::set_requestedWidth(System.Int32)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_set_requestedWidth_m1301971691 (WebCamTexture_t1514609158 * __this, int32_t ___value0, const RuntimeMethod* method)
{
typedef void (*WebCamTexture_set_requestedWidth_m1301971691_ftn) (WebCamTexture_t1514609158 *, int32_t);
static WebCamTexture_set_requestedWidth_m1301971691_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_set_requestedWidth_m1301971691_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::set_requestedWidth(System.Int32)");
_il2cpp_icall_func(__this, ___value0);
}
// System.Void UnityEngine.WebCamTexture::set_requestedHeight(System.Int32)
extern "C" IL2CPP_METHOD_ATTR void WebCamTexture_set_requestedHeight_m3636279808 (WebCamTexture_t1514609158 * __this, int32_t ___value0, const RuntimeMethod* method)
{
typedef void (*WebCamTexture_set_requestedHeight_m3636279808_ftn) (WebCamTexture_t1514609158 *, int32_t);
static WebCamTexture_set_requestedHeight_m3636279808_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_set_requestedHeight_m3636279808_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::set_requestedHeight(System.Int32)");
_il2cpp_icall_func(__this, ___value0);
}
// UnityEngine.WebCamDevice[] UnityEngine.WebCamTexture::get_devices()
extern "C" IL2CPP_METHOD_ATTR WebCamDeviceU5BU5D_t4294070825* WebCamTexture_get_devices_m844246756 (RuntimeObject * __this /* static, unused */, const RuntimeMethod* method)
{
typedef WebCamDeviceU5BU5D_t4294070825* (*WebCamTexture_get_devices_m844246756_ftn) ();
static WebCamTexture_get_devices_m844246756_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_get_devices_m844246756_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::get_devices()");
WebCamDeviceU5BU5D_t4294070825* retVal = _il2cpp_icall_func();
return retVal;
}
// System.Boolean UnityEngine.WebCamTexture::get_didUpdateThisFrame()
extern "C" IL2CPP_METHOD_ATTR bool WebCamTexture_get_didUpdateThisFrame_m567567483 (WebCamTexture_t1514609158 * __this, const RuntimeMethod* method)
{
typedef bool (*WebCamTexture_get_didUpdateThisFrame_m567567483_ftn) (WebCamTexture_t1514609158 *);
static WebCamTexture_get_didUpdateThisFrame_m567567483_ftn _il2cpp_icall_func;
if (!_il2cpp_icall_func)
_il2cpp_icall_func = (WebCamTexture_get_didUpdateThisFrame_m567567483_ftn)il2cpp_codegen_resolve_icall ("UnityEngine.WebCamTexture::get_didUpdateThisFrame()");
bool retVal = _il2cpp_icall_func(__this);
return retVal;
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| [
"zhaifengacm@icloud.com"
] | zhaifengacm@icloud.com |
d087db5104231d2ce713eefb50859c9ccbf858cf | e09af34f2d646e64b2ad2075bd3b250a635cb214 | /SDK/SoT_wld_feature_shipwreck_bay_terrain_functions.cpp | b59cf0125ad88cf181c406f01f408baf3e7b4a51 | [] | no_license | zanzo420/SoT-SDK | 349e6f8b4afcd7756879d8ce5416af86705d8a79 | 5bc545e1822151b3519666a1ed8fef1ba259fc52 | refs/heads/master | 2023-07-14T17:41:58.212853 | 2021-09-01T04:01:29 | 2021-09-01T04:01:29 | 138,799,955 | 1 | 0 | null | 2020-02-20T19:41:03 | 2018-06-26T22:21:26 | C++ | UTF-8 | C++ | false | false | 370 | cpp | // Sea of Thieves (2.0) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "SoT_wld_feature_shipwreck_bay_terrain_classes.hpp"
namespace SDK
{
//---------------------------------------------------------------------------
//Functions
//---------------------------------------------------------------------------
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"30532128+pubgsdk@users.noreply.github.com"
] | 30532128+pubgsdk@users.noreply.github.com |
f149f26c1e71e8e504f96fd4776d22387497c0b9 | bec57aaea91919248d940050538f2d27f9197793 | /design/logger_rate_limiter.cpp | 4427735c35f617dcc8ee65f5b0876cc4ceb70505 | [] | no_license | sparkfiresprairie/cpc | a58c3fc73c86dd9e5895af3a98295febc4d5bf50 | 657fa7c1fe828f44bbca86a056a50801add25e87 | refs/heads/master | 2021-01-21T06:31:03.075528 | 2017-04-16T04:53:15 | 2017-04-16T04:53:15 | 83,247,069 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,024 | cpp | //
// Created by Xingyuan Wang on 3/17/17.
//
/*
Design a logger system that receive stream of messages along with its timestamps,
each message should be printed if and only if it is not printed in the last 10 seconds.
Given a message and a timestamp (in seconds granularity), return true if the message
should be printed in the given timestamp, otherwise returns false.
It is possible that several messages arrive roughly at the same time.
Example:
Logger logger = new Logger();
// logging string "foo" at timestamp 1
logger.shouldPrintMessage(1, "foo"); returns true;
// logging string "bar" at timestamp 2
logger.shouldPrintMessage(2,"bar"); returns true;
// logging string "foo" at timestamp 3
logger.shouldPrintMessage(3,"foo"); returns false;
// logging string "bar" at timestamp 8
logger.shouldPrintMessage(8,"bar"); returns false;
// logging string "foo" at timestamp 10
logger.shouldPrintMessage(10,"foo"); returns false;
// logging string "foo" at timestamp 11
logger.shouldPrintMessage(11,"foo"); returns true;
*/
#include "Design.h"
class Logger {
unordered_map<string, int> hm;
public:
/** Initialize your data structure here. */
Logger() {}
/** Returns true if the message should be printed in the given timestamp, otherwise returns false.
If this method returns false, the message will not be printed.
The timestamp is in seconds granularity. */
bool shouldPrintMessage(int timestamp, string message) {
if (hm.find(message) == hm.end()) {
hm[message] = timestamp;
return true;
} else {
if (timestamp - hm[message] >= 10) {
hm[message] = timestamp;
return true;
}
return false;
}
}
};
/**
* Your Logger object will be instantiated and called as such:
* Logger obj = new Logger();
* bool param_1 = obj.shouldPrintMessage(timestamp,message);
*/
// time: O(1) | [
"xingyuan.wang.zju@gmail.com"
] | xingyuan.wang.zju@gmail.com |
09f19c21cc8ef81e08fd35aac2cec944964e40cb | 9ca6aedbc9690f94d033dbda6df094bc53b17d13 | /src/CppUtil/Basic/Shape/Sphere.cpp | 887b9ce80c7b4f6db60fef2893b8e80014d94374 | [] | no_license | blizmax/Learn-RTX | f04f163281c098b3da6779a1dd79b751f9915590 | 565ff572c44c3eda2ab8f1b9e4a314818efcd7c7 | refs/heads/main | 2023-09-01T21:53:29.125352 | 2021-10-25T07:29:36 | 2021-10-25T07:29:36 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,190 | cpp | #include <CppUtil/Basic/Sphere.h>
#include <cmath>
using namespace CppUtil::Basic;
Sphere::Sphere(size_t n)
: Shape((n + 1)*(n + 1), 2 * n*n) {
// normal 和 pos 的值相同
normalArr = vertexArr;
texCoordsArr = new Array2D<float>(vertexNum, 2);
indexArr = new Array2D<size_t>(triNum, 3);
//----------
float inc = 1.0f / n;
for (size_t i = 0; i <= n; i++) {
float u = inc * i;
for (size_t j = 0; j <= n; j++) {
float v = inc * j;
float theta = PI * (1-u);
float phi = 2 * PI * v;
// 右手系: 上y, 右x, 垂直屏幕外为 z
vertexArr->At(i*(n + 1) + j, 0) = sinf(theta) * sinf(phi);
vertexArr->At(i*(n + 1) + j, 1) = cosf(theta);
vertexArr->At(i*(n + 1) + j, 2) = sinf(theta) * cosf(phi);
// u 对应纵轴所以应该是纹理坐标的 t
// v 对应横轴所以应该是纹理坐标的 s
texCoordsArr->At(i*(n + 1) + j, 0) = v;
texCoordsArr->At(i*(n + 1) + j, 1) = u;
}
}
//------------
for (size_t i = 0; i < n; i++) {
for (size_t j = 0; j < n; j++) {
// 左下 右下 左上
indexArr->At(2 * (i*n + j), 0) = i * (n + 1) + j;
indexArr->At(2 * (i*n + j), 1) = i * (n + 1) + j + 1;
indexArr->At(2 * (i*n + j), 2) = (i + 1) * (n + 1) + j;
// 右上 右下 左上
indexArr->At(2 * (i*n + j) + 1, 0) = (i + 1) * (n + 1) + j + 1;
indexArr->At(2 * (i*n + j) + 1, 1) = i * (n + 1) + j + 1;
indexArr->At(2 * (i*n + j) + 1, 2) = (i + 1) * (n + 1) + j;
}
}
}
Sphere::~Sphere() {
// normalArr 和 vertexArr 相同, 故无需释放normalArr
normalArr = nullptr;
delete texCoordsArr;
texCoordsArr = nullptr;
delete indexArr;
indexArr = nullptr;
}
float * Sphere::GetNormalArr() {
if (normalArr == nullptr)
return nullptr;
return normalArr->GetData();
}
float * Sphere::GetTexCoordsArr() {
if (texCoordsArr == nullptr)
return nullptr;
return texCoordsArr->GetData();
}
size_t * Sphere::GetIndexArr() {
if (indexArr == nullptr)
return nullptr;
return indexArr->GetData();
}
size_t Sphere::GetNormalArrSize() {
return normalArr->GetMemSize();
}
size_t Sphere::GetTexCoordsArrSize() {
return texCoordsArr->GetMemSize();
}
size_t Sphere::GetIndexArrSize() {
return indexArr->GetMemSize();
} | [
"31715507+Heacker-c@users.noreply.github.com"
] | 31715507+Heacker-c@users.noreply.github.com |
248cdefdca778fc4789d9b424f3048d38cd6c0dc | e70259035b317ab4e7069859829546b1af939f37 | /Glitter/Headers/BoundingBox.h | d5947f20ccc6fb5d5c5a94f1bdb37d1a76970e0c | [
"MIT"
] | permissive | jalexanderqed/RayTracer | 50f39c1bd3af8f80655e089f165e516255675e8a | 58de9f07b0c0f88292c3760402e29a70e1805af9 | refs/heads/master | 2020-03-07T12:34:47.718886 | 2018-10-12T03:48:21 | 2018-10-12T03:48:21 | 127,481,202 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 581 | h | #ifndef BOUNDING_BOX_H
#define BOUNDING_BOX_H
#include <algorithm>
#include <glm/glm.hpp>
#include "scene_io.h"
#include "IntersectionPrimitives.h"
class BoundingBox {
public:
glm::vec3 vMax;
glm::vec3 vMin;
BoundingBox();
BoundingBox(const PolygonIO* poly);
BoundingBox(const SphereIO* sphere);
void apply(const BoundingBox& box);
bool intersect(const glm::vec3& vec, const glm::vec3& origin, glm::vec3& res);
bool inside(glm::vec3 point);
};
BoundingBox boundScene(SceneIO* scene);
BoundingBox boundPolySet(const PolySetIO* polySet);
#endif // !BOUNDING_BOX_H
| [
"jalexander.qed@gmail.com"
] | jalexander.qed@gmail.com |
7c088f36525c5ac5cbf211805fa55c808d3be640 | ba93e07b97137d6769a61327946d287b18643d67 | /coarseSuf/src/TriangleInfo.cpp | 583df28e2fc0e0a418e16c5e74b7286e7cb4b614 | [] | no_license | winmad/PointContour | 5a269632099dbc05dbb6fd545e7413a881dbf9c1 | 1d9be354ab7f6567a637e54473ac04f95bd7dd9a | refs/heads/master | 2020-05-01T12:54:20.894064 | 2015-06-16T13:08:20 | 2015-06-16T13:08:20 | 23,320,517 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 176 | cpp | #include "TriangleInfo.h"
namespace coarseSuf
{
TriangleInfo::TriangleInfo(){
}
TriangleInfo::~TriangleInfo(){
}
int TriangleInfo::getSize(){
return 0;
}
} | [
"winmad.wlf@gmail.com"
] | winmad.wlf@gmail.com |
35a4f6bddea95961c19e04512e030b9b527e069c | 045fe863d65a681e2b90e9015be80346136cb63d | /Ej 01 Hora del Tren/Problema01 Hora del Tren/Source.cpp | de72e55b0a887b171a81217ae8640284c8ffddb2 | [
"Apache-2.0"
] | permissive | Alfon-III/Estructura-de-Datos-FDI | 571c820ff420fccdf78a8d945e026208f907c32c | dc04a48b9cc4c2501e7237c5c7983db30f188fc4 | refs/heads/master | 2022-08-28T19:52:43.664545 | 2020-05-30T10:19:04 | 2020-05-30T10:19:04 | 268,055,711 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,260 | cpp | #include <iostream>
#include <fstream>
#include "Hora.h"
using namespace std;
/*
4 2
06:40:30 12:50:00 19:20:00 21:25:00
10:20:00
22:00:00
6 3
00:00:00 09:30:00 16:40:30 17:00:00 20:10:40 22:35:00
20:10:40
08:61:30
08:40:30
0 0
*/
bool resuelveCaso() {
int n, casos;
Horas trenes[1000];
Horas consultas[1000];
cin >> n >> casos;
while (n != 0 && casos != 0) {
//Obtenemos los datos de los trenes
try {
for (int i = 0; i < n; i++) {
cin >> trenes[i];
}
//Guardamos las consultas
for (int i = 0; i < casos; i++) {
cin >> consultas[i];
}
//Comprobamos para cada caso...
int aux = 0;
for (int i = 0; i < casos; i++) {
if (!consultas[i].esErroneo()) {
while (aux < n && trenes[aux] < consultas[i]) {
aux++;
}
if (aux == n) {
cout << "NO" << endl;
}
else {
cout << trenes[aux] << endl;
}
}
else {
cout << "ERROR" << endl;
}
aux = 0;
}
cout << "---" << endl;
}
catch (std::invalid_argument& ia) {
std::cout << ia.what() << '\n';
}
catch (...) {
cout << "Excepcion no tratada" << endl;
}
cin >> n >> casos;
}
return false;
}
int main() {
while (resuelveCaso()) {
} // Resolvemos todos los casos
return 0;
}
| [
"altercer@ucm.es"
] | altercer@ucm.es |
a356e48e572ebf83d146bc4aec1d7a7d49763f76 | beaad89960151e0063c2f468171701f92e186120 | /src/parallel/life.cc | 31bd52957f8c202286b13c110bb674e9d6fdd72f | [
"MIT"
] | permissive | ronaldosvieira/threads-life | ae9826f83b26d2eb500bbab007bac911d1703092 | 7c36d2a745d7a7dd65280bd111f3d91c6208eed9 | refs/heads/master | 2021-01-19T09:21:56.575450 | 2017-02-15T23:06:21 | 2017-02-15T23:06:21 | 82,102,899 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,488 | cc | /*
* The Game of Life
*
* a cell is born, if it has exactly three neighbours
* a cell dies of loneliness, if it has less than two neighbours
* a cell dies of overcrowding, if it has more than three neighbours
* a cell survives to the next generation, if it does not die of loneliness
* or overcrowding
*
* In this version, a 2D array of ints is used. A 1 cell is on, a 0 cell is off.
* The game plays a number of steps (given by the input), printing to the screen each time. 'x' printed
* means on, space means off.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <chrono>
#include <pthread.h>
using std::cin;
using std::cout;
using std::endl;
using namespace std::chrono;
typedef unsigned char cell_t;
typedef struct {
int id;
int startl, endl;
int size, steps;
} thread_arg, *ptr_thread_arg;
const int NUM_THREADS = 4;
pthread_barrier_t barrier;
cell_t **prev, **next, **tmp;
cell_t **allocate_board (int size) {
cell_t **board = (cell_t **) malloc(size * sizeof(cell_t*));
int i;
for (i = 0; i < size; i++) {
board[i] = (cell_t *) malloc(size * sizeof(cell_t));
}
return board;
}
void free_board(cell_t **board, int size) {
int i;
for (i = 0; i < size; i++) {
free(board[i]);
}
free(board);
}
/* return the number of on cells adjacent to the i,j cell */
int adjacent_to(cell_t **board, int size, int i, int j) {
int k, l, count = 0;
int sk = (i > 0)? i - 1 : i;
int ek = (i + 1 < size)? i + 1 : i;
int sl = (j > 0)? j - 1 : j;
int el = (j + 1 < size)? j + 1 : j;
for (k = sk; k <= ek; k++) {
for (l = sl; l <= el; l++) {
count += board[k][l];
}
}
count -= board[i][j];
return count;
}
void* play_thread(void *arg) {
ptr_thread_arg t_arg = (ptr_thread_arg) arg;
for (int k = 0; k < t_arg->steps; ++k) {
/* for each cell, apply the rules of Life */
for (int i = t_arg->startl; i < t_arg->endl; i++) {
for (int j = 0; j < t_arg->size; j++) {
int a = adjacent_to(prev, t_arg->size, i, j);
if (a == 2) next[i][j] = prev[i][j];
if (a == 3) next[i][j] = 1;
if (a < 2) next[i][j] = 0;
if (a > 3) next[i][j] = 0;
}
}
pthread_barrier_wait(&barrier);
if (t_arg->id == 0) {
#ifdef DEBUG
printf("%d ----------\n", i);
print(next, size);
#endif
tmp = next;
next = prev;
prev = tmp;
}
pthread_barrier_wait(&barrier);
}
}
/* print the life board */
void print(cell_t **board, int size) {
int i, j;
/* for each row */
for (j = 0; j < size; j++) {
/* print each column position... */
for (i = 0; i < size; i++) {
printf("%c", board[i][j]? 'x' : ' ');
}
/* followed by a carriage return */
printf("\n");
}
}
/* read a file into the life board */
void read_file(FILE *f, cell_t **board, int size) {
int i, j;
char *s = (char *) malloc(size + 10);
char c;
for (j = 0; j < size; j++) {
/* get a string */
fgets(s, size + 10, f);
/* copy the string to the life board */
for (i = 0; i < size; i++) {
//c=fgetc(f);
//putchar(c);
board[i][j] = s[i] == 'x';
}
//fscanf(f,"\n");
}
}
int main() {
high_resolution_clock::time_point start, end;
int size, steps;
FILE *f;
f = fopen("examples/1000,100", "r");
fscanf(f, "%d %d", &size, &steps);
prev = allocate_board(size);
read_file(f, prev, size);
fclose(f);
next = allocate_board(size);
int i, j;
#ifdef DEBUG
printf("Initial \n");
print(prev, size);
printf("----------\n");
#endif
pthread_t threads[NUM_THREADS];
thread_arg args[NUM_THREADS];
pthread_barrier_init(&barrier, NULL, NUM_THREADS);
for (int i = 0; i < NUM_THREADS; ++i) {
args[i].id = i;
args[i].size = size;
args[i].steps = steps;
args[i].startl = (int) ((1.0f * size / NUM_THREADS) * i);
args[i].endl = (int) ((1.0f * size / NUM_THREADS) * (i + 1));
}
start = high_resolution_clock::now();
for (int i = 0; i < NUM_THREADS; ++i) {
pthread_create(&(threads[i]), NULL, play_thread, &(args[i]));
}
for (int i = 0; i < NUM_THREADS; ++i) {
pthread_join(threads[i], NULL);
}
end = high_resolution_clock::now();
long dif = duration_cast<nanoseconds>(end - start).count();
printf("Elasped time: %ld nanoseconds.\n", dif);
pthread_barrier_destroy(&barrier);
//print(prev,size);
free_board(prev,size);
free_board(next,size);
}
| [
"ronaldoesv@gmail.com"
] | ronaldoesv@gmail.com |
df4410d68e9a4d50b9d0c31a33dd21ef13bedcbc | 26b4ff893da4c79a85dc6b53485fc2c882de66c4 | /CSUSB/CSE 420 - Computer Graphics/cse420/.fr-nwrhzZ/cse420/lab3_professor/turtle/draw_demo.cpp | 34d932a6c174eeb93bd1c54e1d4ccea61aad5cf6 | [] | no_license | DGMeyer96/School | 61a54109579523dcd2ebf7419178bcf2f775e273 | 1d26378078f1abc28db5dc23e3610861cc07cbf9 | refs/heads/master | 2020-10-01T06:17:51.685208 | 2020-08-05T04:49:24 | 2020-08-05T04:49:24 | 227,474,422 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,065 | cpp | /*
draw_demo.cpp
Demonstrate the use of turtle grapics using the surface class developed
by T.L. Yu
@Author: T.L. Yu, April 15, 2006
*/
#include <SDL/SDL.h>
#include <stdlib.h>
#include <stdio.h>
#include "draw.h"
#include "surface.h"
//draw a hook
void draw_hook ( Surface &surf, int L )
{
surf.forward ( L, 1 );
surf.turn( 90 );
surf.forward ( L/5, 1 );
surf.turn ( 90 );
surf.forward ( L/3, 1 );
}
//draw an n-sided regular polygon
void draw_polygon ( Surface &surf, int n, int radius, float rotAngle )
{
if ( n < 3 ) return; //bad number of sides
int cx = surf.getCP().x;
int cy = surf.getCP().y;
double angle = rotAngle * 3.14159265 / 180; //initial angle
double angleInc = 2 * 3.14159265 / n; //angle increment
surf.moveTo ( ( int) (radius * cos( angle ) + cx),
( int ) ( radius * sin ( angle ) + cy ) );
for ( int k = 0; k < n; k++ ) { //repeat n times
angle += angleInc;
surf.lineTo ( ( int) (radius * cos( angle ) + cx),
( int ) ( radius * sin ( angle ) + cy ) );
}
} //draw_polygon
//draw rosette with N-sided polygon
void rosette (Surface &surf, int N, int radius )
{
if ( N < 3 ) return;
Point pt[N+1];
int cx = surf.getCP().x;
int cy = surf.getCP().y;
double angle = 0; //initial angle
double angleInc = 2 * 3.14159265 / N; //angle increment
pt[0] = Point ( ( int) (radius * cos( angle ) + cx),
( int ) ( radius * sin ( angle ) + cy ) );
for ( int k = 1; k < N; k++ ) { //repeat n times
angle += angleInc;
pt[k] = Point ( ( int) (radius * cos( angle ) + cx),
( int ) ( radius * sin ( angle ) + cy ) );
}
for ( int i = 0; i < N - 1; i++ ) {
for ( int j = i + 1; j < N; j++ ) {
surf.moveTo ( pt[i] ); //connect all vertices
surf.lineTo ( pt[j] );
}
}
} //rosette
int main()
{
#ifndef ARM
const int VWIDTH = 640;
const int VHEIGHT = 480;
#else
const int VWIDTH = 320;
const int VHEIGHT = 240;
#endif
const Point center ( VWIDTH/2, VHEIGHT/2 ); //center of screen
Surface surf( VWIDTH, VHEIGHT, "Draw_demo" );
surf.clearScreen(); //clear screen
surf.updateSurface();
SDL_Delay ( 1000 ); //dealy one second, just for demo
surf.setBackgroundColor ( 0xe0, 0xe0, 0xe0 ); //set background to grey
//draw a hook
surf.setColor ( 0xff, 0, 0 ); //using red color
surf.moveTo ( center ); //move to center of screen
surf.turnTo ( 0 ); //points horizontally
draw_hook ( surf, 60 );
//draw a star
surf.setColor ( 0, 0xff, 0 ); //using green color
surf.moveTo ( center.x + 90, center.y );
surf.turnTo ( 0 ); //points horizontally
draw_star ( surf, 50 );
//draw an octagon
surf.setColor ( 0, 0, 0xff ); //using blue color
surf.moveTo ( center.x, center.y - 90 );
draw_polygon ( surf, 8, 40, 0 ); //draw an octagon
//draw an 8-sided rosette
surf.setColor ( 0, 0, 0 ); //using black color
surf.moveTo ( center.x - 90, center.y + 90 );
rosette ( surf, 8, 50 );
surf.updateSurface();
SDL_Delay ( 10000 ); //display 10 seconds before exit
return 1;
}
| [
"005051094@coyote.csusb.edu"
] | 005051094@coyote.csusb.edu |
ed70bce2742dae92629489e873baeb87657815a3 | 399b5e377fdd741fe6e7b845b70491b9ce2cccfd | /LLVM_src/clang/lib/CodeGen/CGBuilder.h | bc2f2eee05fee127b5ed33c15ee4c5323ce5eae3 | [
"Apache-2.0",
"LLVM-exception",
"NCSA"
] | permissive | zslwyuan/LLVM-9-for-Light-HLS | 6ebdd03769c6b55e5eec923cb89e4a8efc7dc9ab | ec6973122a0e65d963356e0fb2bff7488150087c | refs/heads/master | 2021-06-30T20:12:46.289053 | 2020-12-07T07:52:19 | 2020-12-07T07:52:19 | 203,967,206 | 1 | 3 | null | 2019-10-29T14:45:36 | 2019-08-23T09:25:42 | C++ | UTF-8 | C++ | false | false | 13,192 | h | //===-- CGBuilder.h - Choose IRBuilder implementation ----------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LIB_CODEGEN_CGBUILDER_H
#define LLVM_CLANG_LIB_CODEGEN_CGBUILDER_H
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/IRBuilder.h"
#include "Address.h"
#include "CodeGenTypeCache.h"
namespace clang {
namespace CodeGen {
class CodeGenFunction;
/// This is an IRBuilder insertion helper that forwards to
/// CodeGenFunction::InsertHelper, which adds necessary metadata to
/// instructions.
class CGBuilderInserter : protected llvm::IRBuilderDefaultInserter {
public:
CGBuilderInserter() = default;
explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}
protected:
/// This forwards to CodeGenFunction::InsertHelper.
void InsertHelper(llvm::Instruction *I, const llvm::Twine &Name,
llvm::BasicBlock *BB,
llvm::BasicBlock::iterator InsertPt) const;
private:
CodeGenFunction *CGF = nullptr;
};
typedef CGBuilderInserter CGBuilderInserterTy;
typedef llvm::IRBuilder<llvm::ConstantFolder, CGBuilderInserterTy>
CGBuilderBaseTy;
class CGBuilderTy : public CGBuilderBaseTy {
/// Storing a reference to the type cache here makes it a lot easier
/// to build natural-feeling, target-specific IR.
const CodeGenTypeCache &TypeCache;
public:
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::LLVMContext &C)
: CGBuilderBaseTy(C), TypeCache(TypeCache) {}
CGBuilderTy(const CodeGenTypeCache &TypeCache,
llvm::LLVMContext &C, const llvm::ConstantFolder &F,
const CGBuilderInserterTy &Inserter)
: CGBuilderBaseTy(C, F, Inserter), TypeCache(TypeCache) {}
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::Instruction *I)
: CGBuilderBaseTy(I), TypeCache(TypeCache) {}
CGBuilderTy(const CodeGenTypeCache &TypeCache, llvm::BasicBlock *BB)
: CGBuilderBaseTy(BB), TypeCache(TypeCache) {}
llvm::ConstantInt *getSize(CharUnits N) {
return llvm::ConstantInt::get(TypeCache.SizeTy, N.getQuantity());
}
llvm::ConstantInt *getSize(uint64_t N) {
return llvm::ConstantInt::get(TypeCache.SizeTy, N);
}
// Note that we intentionally hide the CreateLoad APIs that don't
// take an alignment.
llvm::LoadInst *CreateLoad(Address Addr, const llvm::Twine &Name = "") {
return CreateAlignedLoad(Addr.getPointer(),
Addr.getAlignment().getQuantity(),
Name);
}
llvm::LoadInst *CreateLoad(Address Addr, const char *Name) {
// This overload is required to prevent string literals from
// ending up in the IsVolatile overload.
return CreateAlignedLoad(Addr.getPointer(),
Addr.getAlignment().getQuantity(),
Name);
}
llvm::LoadInst *CreateLoad(Address Addr, bool IsVolatile,
const llvm::Twine &Name = "") {
return CreateAlignedLoad(Addr.getPointer(),
Addr.getAlignment().getQuantity(),
IsVolatile,
Name);
}
using CGBuilderBaseTy::CreateAlignedLoad;
llvm::LoadInst *CreateAlignedLoad(llvm::Value *Addr, CharUnits Align,
const llvm::Twine &Name = "") {
return CreateAlignedLoad(Addr, Align.getQuantity(), Name);
}
llvm::LoadInst *CreateAlignedLoad(llvm::Value *Addr, CharUnits Align,
const char *Name) {
return CreateAlignedLoad(Addr, Align.getQuantity(), Name);
}
llvm::LoadInst *CreateAlignedLoad(llvm::Type *Ty, llvm::Value *Addr,
CharUnits Align,
const llvm::Twine &Name = "") {
assert(Addr->getType()->getPointerElementType() == Ty);
return CreateAlignedLoad(Addr, Align.getQuantity(), Name);
}
// Note that we intentionally hide the CreateStore APIs that don't
// take an alignment.
llvm::StoreInst *CreateStore(llvm::Value *Val, Address Addr,
bool IsVolatile = false) {
return CreateAlignedStore(Val, Addr.getPointer(),
Addr.getAlignment().getQuantity(), IsVolatile);
}
using CGBuilderBaseTy::CreateAlignedStore;
llvm::StoreInst *CreateAlignedStore(llvm::Value *Val, llvm::Value *Addr,
CharUnits Align, bool IsVolatile = false) {
return CreateAlignedStore(Val, Addr, Align.getQuantity(), IsVolatile);
}
// FIXME: these "default-aligned" APIs should be removed,
// but I don't feel like fixing all the builtin code right now.
llvm::StoreInst *CreateDefaultAlignedStore(llvm::Value *Val,
llvm::Value *Addr,
bool IsVolatile = false) {
return CGBuilderBaseTy::CreateStore(Val, Addr, IsVolatile);
}
/// Emit a load from an i1 flag variable.
llvm::LoadInst *CreateFlagLoad(llvm::Value *Addr,
const llvm::Twine &Name = "") {
assert(Addr->getType()->getPointerElementType() == getInt1Ty());
return CreateAlignedLoad(getInt1Ty(), Addr, CharUnits::One(), Name);
}
/// Emit a store to an i1 flag variable.
llvm::StoreInst *CreateFlagStore(bool Value, llvm::Value *Addr) {
assert(Addr->getType()->getPointerElementType() == getInt1Ty());
return CreateAlignedStore(getInt1(Value), Addr, CharUnits::One());
}
using CGBuilderBaseTy::CreateBitCast;
Address CreateBitCast(Address Addr, llvm::Type *Ty,
const llvm::Twine &Name = "") {
return Address(CreateBitCast(Addr.getPointer(), Ty, Name),
Addr.getAlignment());
}
using CGBuilderBaseTy::CreateAddrSpaceCast;
Address CreateAddrSpaceCast(Address Addr, llvm::Type *Ty,
const llvm::Twine &Name = "") {
return Address(CreateAddrSpaceCast(Addr.getPointer(), Ty, Name),
Addr.getAlignment());
}
/// Cast the element type of the given address to a different type,
/// preserving information like the alignment and address space.
Address CreateElementBitCast(Address Addr, llvm::Type *Ty,
const llvm::Twine &Name = "") {
auto PtrTy = Ty->getPointerTo(Addr.getAddressSpace());
return CreateBitCast(Addr, PtrTy, Name);
}
using CGBuilderBaseTy::CreatePointerBitCastOrAddrSpaceCast;
Address CreatePointerBitCastOrAddrSpaceCast(Address Addr, llvm::Type *Ty,
const llvm::Twine &Name = "") {
llvm::Value *Ptr =
CreatePointerBitCastOrAddrSpaceCast(Addr.getPointer(), Ty, Name);
return Address(Ptr, Addr.getAlignment());
}
using CGBuilderBaseTy::CreateStructGEP;
Address CreateStructGEP(Address Addr, unsigned Index, CharUnits Offset,
const llvm::Twine &Name = "") {
return Address(CreateStructGEP(Addr.getElementType(),
Addr.getPointer(), Index, Name),
Addr.getAlignment().alignmentAtOffset(Offset));
}
Address CreateStructGEP(Address Addr, unsigned Index,
const llvm::StructLayout *Layout,
const llvm::Twine &Name = "") {
auto Offset = CharUnits::fromQuantity(Layout->getElementOffset(Index));
return CreateStructGEP(Addr, Index, Offset, Name);
}
/// Given
/// %addr = [n x T]* ...
/// produce
/// %name = getelementptr inbounds %addr, i64 0, i64 index
/// where i64 is actually the target word size.
///
/// This API assumes that drilling into an array like this is always
/// an inbounds operation.
///
/// \param EltSize - the size of the type T in bytes
Address CreateConstArrayGEP(Address Addr, uint64_t Index, CharUnits EltSize,
const llvm::Twine &Name = "") {
return Address(CreateInBoundsGEP(Addr.getPointer(),
{getSize(CharUnits::Zero()),
getSize(Index)},
Name),
Addr.getAlignment().alignmentAtOffset(Index * EltSize));
}
/// Given
/// %addr = T* ...
/// produce
/// %name = getelementptr inbounds %addr, i64 index
/// where i64 is actually the target word size.
///
/// \param EltSize - the size of the type T in bytes
Address CreateConstInBoundsGEP(Address Addr, uint64_t Index,
CharUnits EltSize,
const llvm::Twine &Name = "") {
return Address(CreateInBoundsGEP(Addr.getElementType(), Addr.getPointer(),
getSize(Index), Name),
Addr.getAlignment().alignmentAtOffset(Index * EltSize));
}
/// Given
/// %addr = T* ...
/// produce
/// %name = getelementptr inbounds %addr, i64 index
/// where i64 is actually the target word size.
///
/// \param EltSize - the size of the type T in bytes
Address CreateConstGEP(Address Addr, uint64_t Index, CharUnits EltSize,
const llvm::Twine &Name = "") {
return Address(CreateGEP(Addr.getElementType(), Addr.getPointer(),
getSize(Index), Name),
Addr.getAlignment().alignmentAtOffset(Index * EltSize));
}
/// Given a pointer to i8, adjust it by a given constant offset.
Address CreateConstInBoundsByteGEP(Address Addr, CharUnits Offset,
const llvm::Twine &Name = "") {
assert(Addr.getElementType() == TypeCache.Int8Ty);
return Address(CreateInBoundsGEP(Addr.getPointer(), getSize(Offset), Name),
Addr.getAlignment().alignmentAtOffset(Offset));
}
Address CreateConstByteGEP(Address Addr, CharUnits Offset,
const llvm::Twine &Name = "") {
assert(Addr.getElementType() == TypeCache.Int8Ty);
return Address(CreateGEP(Addr.getPointer(), getSize(Offset), Name),
Addr.getAlignment().alignmentAtOffset(Offset));
}
using CGBuilderBaseTy::CreateConstInBoundsGEP2_32;
Address CreateConstInBoundsGEP2_32(Address Addr, unsigned Idx0,
unsigned Idx1, const llvm::DataLayout &DL,
const llvm::Twine &Name = "") {
auto *GEP = cast<llvm::GetElementPtrInst>(CreateConstInBoundsGEP2_32(
Addr.getElementType(), Addr.getPointer(), Idx0, Idx1, Name));
llvm::APInt Offset(
DL.getIndexSizeInBits(Addr.getType()->getPointerAddressSpace()), 0,
/*IsSigned=*/true);
if (!GEP->accumulateConstantOffset(DL, Offset))
llvm_unreachable("offset of GEP with constants is always computable");
return Address(GEP, Addr.getAlignment().alignmentAtOffset(
CharUnits::fromQuantity(Offset.getSExtValue())));
}
llvm::Value *CreateConstInBoundsByteGEP(llvm::Value *Ptr, CharUnits Offset,
const llvm::Twine &Name = "") {
assert(Ptr->getType()->getPointerElementType() == TypeCache.Int8Ty);
return CreateInBoundsGEP(Ptr, getSize(Offset), Name);
}
llvm::Value *CreateConstByteGEP(llvm::Value *Ptr, CharUnits Offset,
const llvm::Twine &Name = "") {
assert(Ptr->getType()->getPointerElementType() == TypeCache.Int8Ty);
return CreateGEP(Ptr, getSize(Offset), Name);
}
using CGBuilderBaseTy::CreateMemCpy;
llvm::CallInst *CreateMemCpy(Address Dest, Address Src, llvm::Value *Size,
bool IsVolatile = false) {
return CreateMemCpy(Dest.getPointer(), Dest.getAlignment().getQuantity(),
Src.getPointer(), Src.getAlignment().getQuantity(),
Size,IsVolatile);
}
llvm::CallInst *CreateMemCpy(Address Dest, Address Src, uint64_t Size,
bool IsVolatile = false) {
return CreateMemCpy(Dest.getPointer(), Dest.getAlignment().getQuantity(),
Src.getPointer(), Src.getAlignment().getQuantity(),
Size, IsVolatile);
}
using CGBuilderBaseTy::CreateMemMove;
llvm::CallInst *CreateMemMove(Address Dest, Address Src, llvm::Value *Size,
bool IsVolatile = false) {
return CreateMemMove(Dest.getPointer(), Dest.getAlignment().getQuantity(),
Src.getPointer(), Src.getAlignment().getQuantity(),
Size, IsVolatile);
}
using CGBuilderBaseTy::CreateMemSet;
llvm::CallInst *CreateMemSet(Address Dest, llvm::Value *Value,
llvm::Value *Size, bool IsVolatile = false) {
return CreateMemSet(Dest.getPointer(), Value, Size,
Dest.getAlignment().getQuantity(), IsVolatile);
}
};
} // end namespace CodeGen
} // end namespace clang
#endif
| [
"tliang@connect.ust.hk"
] | tliang@connect.ust.hk |
b58dddb7cfcb393a40348bdc3517deb2dcdd60cb | f501d690498272785564db8e4bf2420eeff23a0b | /thirdparty/rocksdb/db/plain_table_db_test.cc | 0b60332e53aba30e0f7b9795a18249e81cffc2d1 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"Zlib",
"MIT-0",
"LicenseRef-scancode-openssl",
"ISC",
"LicenseRef-scancode-ssleay-windows",
"OpenSSL",
"JSON",
"BSL-1.0",
"curl",
"LicenseRef-scancode-public-domain",
"MIT",
"BSD-2-Clause",
"BSD-1-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"LicenseRef-scancode-bsd-unchanged",
"GPL-2.0-only"
] | permissive | phrocker/nifi-minifi-cpp | 04bad621c1f82c0ab3ef3fffb5085d64939ef290 | 97a05c1bdb6bfd40f5f33da01cf0893060350ef4 | refs/heads/master | 2020-12-30T23:23:01.041185 | 2019-08-27T07:50:15 | 2019-08-28T17:25:00 | 80,614,745 | 3 | 1 | Apache-2.0 | 2019-06-14T11:46:17 | 2017-02-01T11:41:22 | C++ | UTF-8 | C++ | false | false | 40,541 | cc | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
//
// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.
#ifndef ROCKSDB_LITE
#include <algorithm>
#include <set>
#include "db/db_impl.h"
#include "db/version_set.h"
#include "db/write_batch_internal.h"
#include "rocksdb/cache.h"
#include "rocksdb/compaction_filter.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h"
#include "rocksdb/filter_policy.h"
#include "rocksdb/slice_transform.h"
#include "rocksdb/table.h"
#include "table/bloom_block.h"
#include "table/meta_blocks.h"
#include "table/plain_table_factory.h"
#include "table/plain_table_key_coding.h"
#include "table/plain_table_reader.h"
#include "table/table_builder.h"
#include "util/filename.h"
#include "util/hash.h"
#include "util/logging.h"
#include "util/mutexlock.h"
#include "util/string_util.h"
#include "util/testharness.h"
#include "util/testutil.h"
#include "utilities/merge_operators.h"
using std::unique_ptr;
namespace rocksdb {
class PlainTableKeyDecoderTest : public testing::Test {};
TEST_F(PlainTableKeyDecoderTest, ReadNonMmap) {
std::string tmp;
Random rnd(301);
const uint32_t kLength = 2222;
Slice contents = test::RandomString(&rnd, kLength, &tmp);
test::StringSource* string_source =
new test::StringSource(contents, 0, false);
unique_ptr<RandomAccessFileReader> file_reader(
test::GetRandomAccessFileReader(string_source));
unique_ptr<PlainTableReaderFileInfo> file_info(new PlainTableReaderFileInfo(
std::move(file_reader), EnvOptions(), kLength));
{
PlainTableFileReader reader(file_info.get());
const uint32_t kReadSize = 77;
for (uint32_t pos = 0; pos < kLength; pos += kReadSize) {
uint32_t read_size = std::min(kLength - pos, kReadSize);
Slice out;
ASSERT_TRUE(reader.Read(pos, read_size, &out));
ASSERT_EQ(0, out.compare(tmp.substr(pos, read_size)));
}
ASSERT_LT(uint32_t(string_source->total_reads()), kLength / kReadSize / 2);
}
std::vector<std::vector<std::pair<uint32_t, uint32_t>>> reads = {
{{600, 30}, {590, 30}, {600, 20}, {600, 40}},
{{800, 20}, {100, 20}, {500, 20}, {1500, 20}, {100, 20}, {80, 20}},
{{1000, 20}, {500, 20}, {1000, 50}},
{{1000, 20}, {500, 20}, {500, 20}},
{{1000, 20}, {500, 20}, {200, 20}, {500, 20}},
{{1000, 20}, {500, 20}, {200, 20}, {1000, 50}},
{{600, 500}, {610, 20}, {100, 20}},
{{500, 100}, {490, 100}, {550, 50}},
};
std::vector<int> num_file_reads = {2, 6, 2, 2, 4, 3, 2, 2};
for (size_t i = 0; i < reads.size(); i++) {
string_source->set_total_reads(0);
PlainTableFileReader reader(file_info.get());
for (auto p : reads[i]) {
Slice out;
ASSERT_TRUE(reader.Read(p.first, p.second, &out));
ASSERT_EQ(0, out.compare(tmp.substr(p.first, p.second)));
}
ASSERT_EQ(num_file_reads[i], string_source->total_reads());
}
}
class PlainTableDBTest : public testing::Test,
public testing::WithParamInterface<bool> {
protected:
private:
std::string dbname_;
Env* env_;
DB* db_;
bool mmap_mode_;
Options last_options_;
public:
PlainTableDBTest() : env_(Env::Default()) {}
~PlainTableDBTest() {
delete db_;
EXPECT_OK(DestroyDB(dbname_, Options()));
}
void SetUp() override {
mmap_mode_ = GetParam();
dbname_ = test::TmpDir() + "/plain_table_db_test";
EXPECT_OK(DestroyDB(dbname_, Options()));
db_ = nullptr;
Reopen();
}
// Return the current option configuration.
Options CurrentOptions() {
Options options;
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 0;
plain_table_options.bloom_bits_per_key = 2;
plain_table_options.hash_table_ratio = 0.8;
plain_table_options.index_sparseness = 3;
plain_table_options.huge_page_tlb_size = 0;
plain_table_options.encoding_type = kPrefix;
plain_table_options.full_scan_mode = false;
plain_table_options.store_index_in_file = false;
options.table_factory.reset(NewPlainTableFactory(plain_table_options));
options.memtable_factory.reset(NewHashLinkListRepFactory(4, 0, 3, true));
options.prefix_extractor.reset(NewFixedPrefixTransform(8));
options.allow_mmap_reads = mmap_mode_;
options.allow_concurrent_memtable_write = false;
return options;
}
DBImpl* dbfull() {
return reinterpret_cast<DBImpl*>(db_);
}
void Reopen(Options* options = nullptr) {
ASSERT_OK(TryReopen(options));
}
void Close() {
delete db_;
db_ = nullptr;
}
void DestroyAndReopen(Options* options = nullptr) {
//Destroy using last options
Destroy(&last_options_);
ASSERT_OK(TryReopen(options));
}
void Destroy(Options* options) {
delete db_;
db_ = nullptr;
ASSERT_OK(DestroyDB(dbname_, *options));
}
Status PureReopen(Options* options, DB** db) {
return DB::Open(*options, dbname_, db);
}
Status TryReopen(Options* options = nullptr) {
delete db_;
db_ = nullptr;
Options opts;
if (options != nullptr) {
opts = *options;
} else {
opts = CurrentOptions();
opts.create_if_missing = true;
}
last_options_ = opts;
return DB::Open(opts, dbname_, &db_);
}
Status Put(const Slice& k, const Slice& v) {
return db_->Put(WriteOptions(), k, v);
}
Status Delete(const std::string& k) {
return db_->Delete(WriteOptions(), k);
}
std::string Get(const std::string& k, const Snapshot* snapshot = nullptr) {
ReadOptions options;
options.snapshot = snapshot;
std::string result;
Status s = db_->Get(options, k, &result);
if (s.IsNotFound()) {
result = "NOT_FOUND";
} else if (!s.ok()) {
result = s.ToString();
}
return result;
}
int NumTableFilesAtLevel(int level) {
std::string property;
EXPECT_TRUE(db_->GetProperty(
"rocksdb.num-files-at-level" + NumberToString(level), &property));
return atoi(property.c_str());
}
// Return spread of files per level
std::string FilesPerLevel() {
std::string result;
size_t last_non_zero_offset = 0;
for (int level = 0; level < db_->NumberLevels(); level++) {
int f = NumTableFilesAtLevel(level);
char buf[100];
snprintf(buf, sizeof(buf), "%s%d", (level ? "," : ""), f);
result += buf;
if (f > 0) {
last_non_zero_offset = result.size();
}
}
result.resize(last_non_zero_offset);
return result;
}
std::string IterStatus(Iterator* iter) {
std::string result;
if (iter->Valid()) {
result = iter->key().ToString() + "->" + iter->value().ToString();
} else {
result = "(invalid)";
}
return result;
}
};
TEST_P(PlainTableDBTest, Empty) {
ASSERT_TRUE(dbfull() != nullptr);
ASSERT_EQ("NOT_FOUND", Get("0000000000000foo"));
}
extern const uint64_t kPlainTableMagicNumber;
class TestPlainTableReader : public PlainTableReader {
public:
TestPlainTableReader(const EnvOptions& env_options,
const InternalKeyComparator& icomparator,
EncodingType encoding_type, uint64_t file_size,
int bloom_bits_per_key, double hash_table_ratio,
size_t index_sparseness,
const TableProperties* table_properties,
unique_ptr<RandomAccessFileReader>&& file,
const ImmutableCFOptions& ioptions,
bool* expect_bloom_not_match, bool store_index_in_file,
uint32_t column_family_id,
const std::string& column_family_name)
: PlainTableReader(ioptions, std::move(file), env_options, icomparator,
encoding_type, file_size, table_properties),
expect_bloom_not_match_(expect_bloom_not_match) {
Status s = MmapDataIfNeeded();
EXPECT_TRUE(s.ok());
s = PopulateIndex(const_cast<TableProperties*>(table_properties),
bloom_bits_per_key, hash_table_ratio, index_sparseness,
2 * 1024 * 1024);
EXPECT_TRUE(s.ok());
TableProperties* props = const_cast<TableProperties*>(table_properties);
EXPECT_EQ(column_family_id, static_cast<uint32_t>(props->column_family_id));
EXPECT_EQ(column_family_name, props->column_family_name);
if (store_index_in_file) {
auto bloom_version_ptr = props->user_collected_properties.find(
PlainTablePropertyNames::kBloomVersion);
EXPECT_TRUE(bloom_version_ptr != props->user_collected_properties.end());
EXPECT_EQ(bloom_version_ptr->second, std::string("1"));
if (ioptions.bloom_locality > 0) {
auto num_blocks_ptr = props->user_collected_properties.find(
PlainTablePropertyNames::kNumBloomBlocks);
EXPECT_TRUE(num_blocks_ptr != props->user_collected_properties.end());
}
}
}
virtual ~TestPlainTableReader() {}
private:
virtual bool MatchBloom(uint32_t hash) const override {
bool ret = PlainTableReader::MatchBloom(hash);
if (*expect_bloom_not_match_) {
EXPECT_TRUE(!ret);
} else {
EXPECT_TRUE(ret);
}
return ret;
}
bool* expect_bloom_not_match_;
};
extern const uint64_t kPlainTableMagicNumber;
class TestPlainTableFactory : public PlainTableFactory {
public:
explicit TestPlainTableFactory(bool* expect_bloom_not_match,
const PlainTableOptions& options,
uint32_t column_family_id,
std::string column_family_name)
: PlainTableFactory(options),
bloom_bits_per_key_(options.bloom_bits_per_key),
hash_table_ratio_(options.hash_table_ratio),
index_sparseness_(options.index_sparseness),
store_index_in_file_(options.store_index_in_file),
expect_bloom_not_match_(expect_bloom_not_match),
column_family_id_(column_family_id),
column_family_name_(std::move(column_family_name)) {}
Status NewTableReader(
const TableReaderOptions& table_reader_options,
unique_ptr<RandomAccessFileReader>&& file, uint64_t file_size,
unique_ptr<TableReader>* table,
bool prefetch_index_and_filter_in_cache) const override {
TableProperties* props = nullptr;
auto s =
ReadTableProperties(file.get(), file_size, kPlainTableMagicNumber,
table_reader_options.ioptions, &props);
EXPECT_TRUE(s.ok());
if (store_index_in_file_) {
BlockHandle bloom_block_handle;
s = FindMetaBlock(file.get(), file_size, kPlainTableMagicNumber,
table_reader_options.ioptions,
BloomBlockBuilder::kBloomBlock, &bloom_block_handle);
EXPECT_TRUE(s.ok());
BlockHandle index_block_handle;
s = FindMetaBlock(file.get(), file_size, kPlainTableMagicNumber,
table_reader_options.ioptions,
PlainTableIndexBuilder::kPlainTableIndexBlock,
&index_block_handle);
EXPECT_TRUE(s.ok());
}
auto& user_props = props->user_collected_properties;
auto encoding_type_prop =
user_props.find(PlainTablePropertyNames::kEncodingType);
assert(encoding_type_prop != user_props.end());
EncodingType encoding_type = static_cast<EncodingType>(
DecodeFixed32(encoding_type_prop->second.c_str()));
std::unique_ptr<PlainTableReader> new_reader(new TestPlainTableReader(
table_reader_options.env_options,
table_reader_options.internal_comparator, encoding_type, file_size,
bloom_bits_per_key_, hash_table_ratio_, index_sparseness_, props,
std::move(file), table_reader_options.ioptions, expect_bloom_not_match_,
store_index_in_file_, column_family_id_, column_family_name_));
*table = std::move(new_reader);
return s;
}
private:
int bloom_bits_per_key_;
double hash_table_ratio_;
size_t index_sparseness_;
bool store_index_in_file_;
bool* expect_bloom_not_match_;
const uint32_t column_family_id_;
const std::string column_family_name_;
};
TEST_P(PlainTableDBTest, Flush) {
for (size_t huge_page_tlb_size = 0; huge_page_tlb_size <= 2 * 1024 * 1024;
huge_page_tlb_size += 2 * 1024 * 1024) {
for (EncodingType encoding_type : {kPlain, kPrefix}) {
for (int bloom_bits = 0; bloom_bits <= 117; bloom_bits += 117) {
for (int total_order = 0; total_order <= 1; total_order++) {
for (int store_index_in_file = 0; store_index_in_file <= 1;
++store_index_in_file) {
Options options = CurrentOptions();
options.create_if_missing = true;
// Set only one bucket to force bucket conflict.
// Test index interval for the same prefix to be 1, 2 and 4
if (total_order) {
options.prefix_extractor.reset();
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 0;
plain_table_options.bloom_bits_per_key = bloom_bits;
plain_table_options.hash_table_ratio = 0;
plain_table_options.index_sparseness = 2;
plain_table_options.huge_page_tlb_size = huge_page_tlb_size;
plain_table_options.encoding_type = encoding_type;
plain_table_options.full_scan_mode = false;
plain_table_options.store_index_in_file = store_index_in_file;
options.table_factory.reset(
NewPlainTableFactory(plain_table_options));
} else {
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 0;
plain_table_options.bloom_bits_per_key = bloom_bits;
plain_table_options.hash_table_ratio = 0.75;
plain_table_options.index_sparseness = 16;
plain_table_options.huge_page_tlb_size = huge_page_tlb_size;
plain_table_options.encoding_type = encoding_type;
plain_table_options.full_scan_mode = false;
plain_table_options.store_index_in_file = store_index_in_file;
options.table_factory.reset(
NewPlainTableFactory(plain_table_options));
}
DestroyAndReopen(&options);
uint64_t int_num;
ASSERT_TRUE(dbfull()->GetIntProperty(
"rocksdb.estimate-table-readers-mem", &int_num));
ASSERT_EQ(int_num, 0U);
ASSERT_OK(Put("1000000000000foo", "v1"));
ASSERT_OK(Put("0000000000000bar", "v2"));
ASSERT_OK(Put("1000000000000foo", "v3"));
dbfull()->TEST_FlushMemTable();
ASSERT_TRUE(dbfull()->GetIntProperty(
"rocksdb.estimate-table-readers-mem", &int_num));
ASSERT_GT(int_num, 0U);
TablePropertiesCollection ptc;
reinterpret_cast<DB*>(dbfull())->GetPropertiesOfAllTables(&ptc);
ASSERT_EQ(1U, ptc.size());
auto row = ptc.begin();
auto tp = row->second;
if (!store_index_in_file) {
ASSERT_EQ(total_order ? "4" : "12",
(tp->user_collected_properties)
.at("plain_table_hash_table_size"));
ASSERT_EQ("0", (tp->user_collected_properties)
.at("plain_table_sub_index_size"));
} else {
ASSERT_EQ("0", (tp->user_collected_properties)
.at("plain_table_hash_table_size"));
ASSERT_EQ("0", (tp->user_collected_properties)
.at("plain_table_sub_index_size"));
}
ASSERT_EQ("v3", Get("1000000000000foo"));
ASSERT_EQ("v2", Get("0000000000000bar"));
}
}
}
}
}
}
TEST_P(PlainTableDBTest, Flush2) {
for (size_t huge_page_tlb_size = 0; huge_page_tlb_size <= 2 * 1024 * 1024;
huge_page_tlb_size += 2 * 1024 * 1024) {
for (EncodingType encoding_type : {kPlain, kPrefix}) {
for (int bloom_bits = 0; bloom_bits <= 117; bloom_bits += 117) {
for (int total_order = 0; total_order <= 1; total_order++) {
for (int store_index_in_file = 0; store_index_in_file <= 1;
++store_index_in_file) {
if (encoding_type == kPrefix && total_order) {
continue;
}
if (!bloom_bits && store_index_in_file) {
continue;
}
if (total_order && store_index_in_file) {
continue;
}
bool expect_bloom_not_match = false;
Options options = CurrentOptions();
options.create_if_missing = true;
// Set only one bucket to force bucket conflict.
// Test index interval for the same prefix to be 1, 2 and 4
PlainTableOptions plain_table_options;
if (total_order) {
options.prefix_extractor = nullptr;
plain_table_options.hash_table_ratio = 0;
plain_table_options.index_sparseness = 2;
} else {
plain_table_options.hash_table_ratio = 0.75;
plain_table_options.index_sparseness = 16;
}
plain_table_options.user_key_len = kPlainTableVariableLength;
plain_table_options.bloom_bits_per_key = bloom_bits;
plain_table_options.huge_page_tlb_size = huge_page_tlb_size;
plain_table_options.encoding_type = encoding_type;
plain_table_options.store_index_in_file = store_index_in_file;
options.table_factory.reset(new TestPlainTableFactory(
&expect_bloom_not_match, plain_table_options,
0 /* column_family_id */, kDefaultColumnFamilyName));
DestroyAndReopen(&options);
ASSERT_OK(Put("0000000000000bar", "b"));
ASSERT_OK(Put("1000000000000foo", "v1"));
dbfull()->TEST_FlushMemTable();
ASSERT_OK(Put("1000000000000foo", "v2"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v2", Get("1000000000000foo"));
ASSERT_OK(Put("0000000000000eee", "v3"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v3", Get("0000000000000eee"));
ASSERT_OK(Delete("0000000000000bar"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("NOT_FOUND", Get("0000000000000bar"));
ASSERT_OK(Put("0000000000000eee", "v5"));
ASSERT_OK(Put("9000000000000eee", "v5"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v5", Get("0000000000000eee"));
// Test Bloom Filter
if (bloom_bits > 0) {
// Neither key nor value should exist.
expect_bloom_not_match = true;
ASSERT_EQ("NOT_FOUND", Get("5_not00000000bar"));
// Key doesn't exist any more but prefix exists.
if (total_order) {
ASSERT_EQ("NOT_FOUND", Get("1000000000000not"));
ASSERT_EQ("NOT_FOUND", Get("0000000000000not"));
}
expect_bloom_not_match = false;
}
}
}
}
}
}
}
TEST_P(PlainTableDBTest, Iterator) {
for (size_t huge_page_tlb_size = 0; huge_page_tlb_size <= 2 * 1024 * 1024;
huge_page_tlb_size += 2 * 1024 * 1024) {
for (EncodingType encoding_type : {kPlain, kPrefix}) {
for (int bloom_bits = 0; bloom_bits <= 117; bloom_bits += 117) {
for (int total_order = 0; total_order <= 1; total_order++) {
if (encoding_type == kPrefix && total_order == 1) {
continue;
}
bool expect_bloom_not_match = false;
Options options = CurrentOptions();
options.create_if_missing = true;
// Set only one bucket to force bucket conflict.
// Test index interval for the same prefix to be 1, 2 and 4
if (total_order) {
options.prefix_extractor = nullptr;
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 16;
plain_table_options.bloom_bits_per_key = bloom_bits;
plain_table_options.hash_table_ratio = 0;
plain_table_options.index_sparseness = 2;
plain_table_options.huge_page_tlb_size = huge_page_tlb_size;
plain_table_options.encoding_type = encoding_type;
options.table_factory.reset(new TestPlainTableFactory(
&expect_bloom_not_match, plain_table_options,
0 /* column_family_id */, kDefaultColumnFamilyName));
} else {
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 16;
plain_table_options.bloom_bits_per_key = bloom_bits;
plain_table_options.hash_table_ratio = 0.75;
plain_table_options.index_sparseness = 16;
plain_table_options.huge_page_tlb_size = huge_page_tlb_size;
plain_table_options.encoding_type = encoding_type;
options.table_factory.reset(new TestPlainTableFactory(
&expect_bloom_not_match, plain_table_options,
0 /* column_family_id */, kDefaultColumnFamilyName));
}
DestroyAndReopen(&options);
ASSERT_OK(Put("1000000000foo002", "v_2"));
ASSERT_OK(Put("0000000000000bar", "random"));
ASSERT_OK(Put("1000000000foo001", "v1"));
ASSERT_OK(Put("3000000000000bar", "bar_v"));
ASSERT_OK(Put("1000000000foo003", "v__3"));
ASSERT_OK(Put("1000000000foo004", "v__4"));
ASSERT_OK(Put("1000000000foo005", "v__5"));
ASSERT_OK(Put("1000000000foo007", "v__7"));
ASSERT_OK(Put("1000000000foo008", "v__8"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v1", Get("1000000000foo001"));
ASSERT_EQ("v__3", Get("1000000000foo003"));
Iterator* iter = dbfull()->NewIterator(ReadOptions());
iter->Seek("1000000000foo000");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo001", iter->key().ToString());
ASSERT_EQ("v1", iter->value().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo002", iter->key().ToString());
ASSERT_EQ("v_2", iter->value().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo003", iter->key().ToString());
ASSERT_EQ("v__3", iter->value().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo004", iter->key().ToString());
ASSERT_EQ("v__4", iter->value().ToString());
iter->Seek("3000000000000bar");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("3000000000000bar", iter->key().ToString());
ASSERT_EQ("bar_v", iter->value().ToString());
iter->Seek("1000000000foo000");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo001", iter->key().ToString());
ASSERT_EQ("v1", iter->value().ToString());
iter->Seek("1000000000foo005");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo005", iter->key().ToString());
ASSERT_EQ("v__5", iter->value().ToString());
iter->Seek("1000000000foo006");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo007", iter->key().ToString());
ASSERT_EQ("v__7", iter->value().ToString());
iter->Seek("1000000000foo008");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo008", iter->key().ToString());
ASSERT_EQ("v__8", iter->value().ToString());
if (total_order == 0) {
iter->Seek("1000000000foo009");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("3000000000000bar", iter->key().ToString());
}
// Test Bloom Filter
if (bloom_bits > 0) {
if (!total_order) {
// Neither key nor value should exist.
expect_bloom_not_match = true;
iter->Seek("2not000000000bar");
ASSERT_TRUE(!iter->Valid());
ASSERT_EQ("NOT_FOUND", Get("2not000000000bar"));
expect_bloom_not_match = false;
} else {
expect_bloom_not_match = true;
ASSERT_EQ("NOT_FOUND", Get("2not000000000bar"));
expect_bloom_not_match = false;
}
}
delete iter;
}
}
}
}
}
namespace {
std::string MakeLongKey(size_t length, char c) {
return std::string(length, c);
}
} // namespace
TEST_P(PlainTableDBTest, IteratorLargeKeys) {
Options options = CurrentOptions();
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 0;
plain_table_options.bloom_bits_per_key = 0;
plain_table_options.hash_table_ratio = 0;
options.table_factory.reset(NewPlainTableFactory(plain_table_options));
options.create_if_missing = true;
options.prefix_extractor.reset();
DestroyAndReopen(&options);
std::string key_list[] = {
MakeLongKey(30, '0'),
MakeLongKey(16, '1'),
MakeLongKey(32, '2'),
MakeLongKey(60, '3'),
MakeLongKey(90, '4'),
MakeLongKey(50, '5'),
MakeLongKey(26, '6')
};
for (size_t i = 0; i < 7; i++) {
ASSERT_OK(Put(key_list[i], ToString(i)));
}
dbfull()->TEST_FlushMemTable();
Iterator* iter = dbfull()->NewIterator(ReadOptions());
iter->Seek(key_list[0]);
for (size_t i = 0; i < 7; i++) {
ASSERT_TRUE(iter->Valid());
ASSERT_EQ(key_list[i], iter->key().ToString());
ASSERT_EQ(ToString(i), iter->value().ToString());
iter->Next();
}
ASSERT_TRUE(!iter->Valid());
delete iter;
}
namespace {
std::string MakeLongKeyWithPrefix(size_t length, char c) {
return "00000000" + std::string(length - 8, c);
}
} // namespace
TEST_P(PlainTableDBTest, IteratorLargeKeysWithPrefix) {
Options options = CurrentOptions();
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 16;
plain_table_options.bloom_bits_per_key = 0;
plain_table_options.hash_table_ratio = 0.8;
plain_table_options.index_sparseness = 3;
plain_table_options.huge_page_tlb_size = 0;
plain_table_options.encoding_type = kPrefix;
options.table_factory.reset(NewPlainTableFactory(plain_table_options));
options.create_if_missing = true;
DestroyAndReopen(&options);
std::string key_list[] = {
MakeLongKeyWithPrefix(30, '0'), MakeLongKeyWithPrefix(16, '1'),
MakeLongKeyWithPrefix(32, '2'), MakeLongKeyWithPrefix(60, '3'),
MakeLongKeyWithPrefix(90, '4'), MakeLongKeyWithPrefix(50, '5'),
MakeLongKeyWithPrefix(26, '6')};
for (size_t i = 0; i < 7; i++) {
ASSERT_OK(Put(key_list[i], ToString(i)));
}
dbfull()->TEST_FlushMemTable();
Iterator* iter = dbfull()->NewIterator(ReadOptions());
iter->Seek(key_list[0]);
for (size_t i = 0; i < 7; i++) {
ASSERT_TRUE(iter->Valid());
ASSERT_EQ(key_list[i], iter->key().ToString());
ASSERT_EQ(ToString(i), iter->value().ToString());
iter->Next();
}
ASSERT_TRUE(!iter->Valid());
delete iter;
}
TEST_P(PlainTableDBTest, IteratorReverseSuffixComparator) {
Options options = CurrentOptions();
options.create_if_missing = true;
// Set only one bucket to force bucket conflict.
// Test index interval for the same prefix to be 1, 2 and 4
test::SimpleSuffixReverseComparator comp;
options.comparator = ∁
DestroyAndReopen(&options);
ASSERT_OK(Put("1000000000foo002", "v_2"));
ASSERT_OK(Put("0000000000000bar", "random"));
ASSERT_OK(Put("1000000000foo001", "v1"));
ASSERT_OK(Put("3000000000000bar", "bar_v"));
ASSERT_OK(Put("1000000000foo003", "v__3"));
ASSERT_OK(Put("1000000000foo004", "v__4"));
ASSERT_OK(Put("1000000000foo005", "v__5"));
ASSERT_OK(Put("1000000000foo007", "v__7"));
ASSERT_OK(Put("1000000000foo008", "v__8"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v1", Get("1000000000foo001"));
ASSERT_EQ("v__3", Get("1000000000foo003"));
Iterator* iter = dbfull()->NewIterator(ReadOptions());
iter->Seek("1000000000foo009");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo008", iter->key().ToString());
ASSERT_EQ("v__8", iter->value().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo007", iter->key().ToString());
ASSERT_EQ("v__7", iter->value().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo005", iter->key().ToString());
ASSERT_EQ("v__5", iter->value().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo004", iter->key().ToString());
ASSERT_EQ("v__4", iter->value().ToString());
iter->Seek("3000000000000bar");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("3000000000000bar", iter->key().ToString());
ASSERT_EQ("bar_v", iter->value().ToString());
iter->Seek("1000000000foo005");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo005", iter->key().ToString());
ASSERT_EQ("v__5", iter->value().ToString());
iter->Seek("1000000000foo006");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo005", iter->key().ToString());
ASSERT_EQ("v__5", iter->value().ToString());
iter->Seek("1000000000foo008");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("1000000000foo008", iter->key().ToString());
ASSERT_EQ("v__8", iter->value().ToString());
iter->Seek("1000000000foo000");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("3000000000000bar", iter->key().ToString());
delete iter;
}
TEST_P(PlainTableDBTest, HashBucketConflict) {
for (size_t huge_page_tlb_size = 0; huge_page_tlb_size <= 2 * 1024 * 1024;
huge_page_tlb_size += 2 * 1024 * 1024) {
for (unsigned char i = 1; i <= 3; i++) {
Options options = CurrentOptions();
options.create_if_missing = true;
// Set only one bucket to force bucket conflict.
// Test index interval for the same prefix to be 1, 2 and 4
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 16;
plain_table_options.bloom_bits_per_key = 0;
plain_table_options.hash_table_ratio = 0;
plain_table_options.index_sparseness = 2 ^ i;
plain_table_options.huge_page_tlb_size = huge_page_tlb_size;
options.table_factory.reset(NewPlainTableFactory(plain_table_options));
DestroyAndReopen(&options);
ASSERT_OK(Put("5000000000000fo0", "v1"));
ASSERT_OK(Put("5000000000000fo1", "v2"));
ASSERT_OK(Put("5000000000000fo2", "v"));
ASSERT_OK(Put("2000000000000fo0", "v3"));
ASSERT_OK(Put("2000000000000fo1", "v4"));
ASSERT_OK(Put("2000000000000fo2", "v"));
ASSERT_OK(Put("2000000000000fo3", "v"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v1", Get("5000000000000fo0"));
ASSERT_EQ("v2", Get("5000000000000fo1"));
ASSERT_EQ("v3", Get("2000000000000fo0"));
ASSERT_EQ("v4", Get("2000000000000fo1"));
ASSERT_EQ("NOT_FOUND", Get("5000000000000bar"));
ASSERT_EQ("NOT_FOUND", Get("2000000000000bar"));
ASSERT_EQ("NOT_FOUND", Get("5000000000000fo8"));
ASSERT_EQ("NOT_FOUND", Get("2000000000000fo8"));
ReadOptions ro;
Iterator* iter = dbfull()->NewIterator(ro);
iter->Seek("5000000000000fo0");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo0", iter->key().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo1", iter->key().ToString());
iter->Seek("5000000000000fo1");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo1", iter->key().ToString());
iter->Seek("2000000000000fo0");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("2000000000000fo0", iter->key().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("2000000000000fo1", iter->key().ToString());
iter->Seek("2000000000000fo1");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("2000000000000fo1", iter->key().ToString());
iter->Seek("2000000000000bar");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("2000000000000fo0", iter->key().ToString());
iter->Seek("5000000000000bar");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo0", iter->key().ToString());
iter->Seek("2000000000000fo8");
ASSERT_TRUE(!iter->Valid() ||
options.comparator->Compare(iter->key(), "20000001") > 0);
iter->Seek("5000000000000fo8");
ASSERT_TRUE(!iter->Valid());
iter->Seek("1000000000000fo2");
ASSERT_TRUE(!iter->Valid());
iter->Seek("3000000000000fo2");
ASSERT_TRUE(!iter->Valid());
iter->Seek("8000000000000fo2");
ASSERT_TRUE(!iter->Valid());
delete iter;
}
}
}
TEST_P(PlainTableDBTest, HashBucketConflictReverseSuffixComparator) {
for (size_t huge_page_tlb_size = 0; huge_page_tlb_size <= 2 * 1024 * 1024;
huge_page_tlb_size += 2 * 1024 * 1024) {
for (unsigned char i = 1; i <= 3; i++) {
Options options = CurrentOptions();
options.create_if_missing = true;
test::SimpleSuffixReverseComparator comp;
options.comparator = ∁
// Set only one bucket to force bucket conflict.
// Test index interval for the same prefix to be 1, 2 and 4
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 16;
plain_table_options.bloom_bits_per_key = 0;
plain_table_options.hash_table_ratio = 0;
plain_table_options.index_sparseness = 2 ^ i;
plain_table_options.huge_page_tlb_size = huge_page_tlb_size;
options.table_factory.reset(NewPlainTableFactory(plain_table_options));
DestroyAndReopen(&options);
ASSERT_OK(Put("5000000000000fo0", "v1"));
ASSERT_OK(Put("5000000000000fo1", "v2"));
ASSERT_OK(Put("5000000000000fo2", "v"));
ASSERT_OK(Put("2000000000000fo0", "v3"));
ASSERT_OK(Put("2000000000000fo1", "v4"));
ASSERT_OK(Put("2000000000000fo2", "v"));
ASSERT_OK(Put("2000000000000fo3", "v"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v1", Get("5000000000000fo0"));
ASSERT_EQ("v2", Get("5000000000000fo1"));
ASSERT_EQ("v3", Get("2000000000000fo0"));
ASSERT_EQ("v4", Get("2000000000000fo1"));
ASSERT_EQ("NOT_FOUND", Get("5000000000000bar"));
ASSERT_EQ("NOT_FOUND", Get("2000000000000bar"));
ASSERT_EQ("NOT_FOUND", Get("5000000000000fo8"));
ASSERT_EQ("NOT_FOUND", Get("2000000000000fo8"));
ReadOptions ro;
Iterator* iter = dbfull()->NewIterator(ro);
iter->Seek("5000000000000fo1");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo1", iter->key().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo0", iter->key().ToString());
iter->Seek("5000000000000fo1");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo1", iter->key().ToString());
iter->Seek("2000000000000fo1");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("2000000000000fo1", iter->key().ToString());
iter->Next();
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("2000000000000fo0", iter->key().ToString());
iter->Seek("2000000000000fo1");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("2000000000000fo1", iter->key().ToString());
iter->Seek("2000000000000var");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("2000000000000fo3", iter->key().ToString());
iter->Seek("5000000000000var");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo2", iter->key().ToString());
std::string seek_key = "2000000000000bar";
iter->Seek(seek_key);
ASSERT_TRUE(!iter->Valid() ||
options.prefix_extractor->Transform(iter->key()) !=
options.prefix_extractor->Transform(seek_key));
iter->Seek("1000000000000fo2");
ASSERT_TRUE(!iter->Valid());
iter->Seek("3000000000000fo2");
ASSERT_TRUE(!iter->Valid());
iter->Seek("8000000000000fo2");
ASSERT_TRUE(!iter->Valid());
delete iter;
}
}
}
TEST_P(PlainTableDBTest, NonExistingKeyToNonEmptyBucket) {
Options options = CurrentOptions();
options.create_if_missing = true;
// Set only one bucket to force bucket conflict.
// Test index interval for the same prefix to be 1, 2 and 4
PlainTableOptions plain_table_options;
plain_table_options.user_key_len = 16;
plain_table_options.bloom_bits_per_key = 0;
plain_table_options.hash_table_ratio = 0;
plain_table_options.index_sparseness = 5;
options.table_factory.reset(NewPlainTableFactory(plain_table_options));
DestroyAndReopen(&options);
ASSERT_OK(Put("5000000000000fo0", "v1"));
ASSERT_OK(Put("5000000000000fo1", "v2"));
ASSERT_OK(Put("5000000000000fo2", "v3"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v1", Get("5000000000000fo0"));
ASSERT_EQ("v2", Get("5000000000000fo1"));
ASSERT_EQ("v3", Get("5000000000000fo2"));
ASSERT_EQ("NOT_FOUND", Get("8000000000000bar"));
ASSERT_EQ("NOT_FOUND", Get("1000000000000bar"));
Iterator* iter = dbfull()->NewIterator(ReadOptions());
iter->Seek("5000000000000bar");
ASSERT_TRUE(iter->Valid());
ASSERT_EQ("5000000000000fo0", iter->key().ToString());
iter->Seek("5000000000000fo8");
ASSERT_TRUE(!iter->Valid());
iter->Seek("1000000000000fo2");
ASSERT_TRUE(!iter->Valid());
iter->Seek("8000000000000fo2");
ASSERT_TRUE(!iter->Valid());
delete iter;
}
static std::string Key(int i) {
char buf[100];
snprintf(buf, sizeof(buf), "key_______%06d", i);
return std::string(buf);
}
static std::string RandomString(Random* rnd, int len) {
std::string r;
test::RandomString(rnd, len, &r);
return r;
}
TEST_P(PlainTableDBTest, CompactionTrigger) {
Options options = CurrentOptions();
options.write_buffer_size = 120 << 10; // 100KB
options.num_levels = 3;
options.level0_file_num_compaction_trigger = 3;
Reopen(&options);
Random rnd(301);
for (int num = 0; num < options.level0_file_num_compaction_trigger - 1;
num++) {
std::vector<std::string> values;
// Write 120KB (10 values, each 12K)
for (int i = 0; i < 10; i++) {
values.push_back(RandomString(&rnd, 12000));
ASSERT_OK(Put(Key(i), values[i]));
}
ASSERT_OK(Put(Key(999), ""));
dbfull()->TEST_WaitForFlushMemTable();
ASSERT_EQ(NumTableFilesAtLevel(0), num + 1);
}
//generate one more file in level-0, and should trigger level-0 compaction
std::vector<std::string> values;
for (int i = 0; i < 12; i++) {
values.push_back(RandomString(&rnd, 10000));
ASSERT_OK(Put(Key(i), values[i]));
}
ASSERT_OK(Put(Key(999), ""));
dbfull()->TEST_WaitForCompact();
ASSERT_EQ(NumTableFilesAtLevel(0), 0);
ASSERT_EQ(NumTableFilesAtLevel(1), 1);
}
TEST_P(PlainTableDBTest, AdaptiveTable) {
Options options = CurrentOptions();
options.create_if_missing = true;
options.table_factory.reset(NewPlainTableFactory());
DestroyAndReopen(&options);
ASSERT_OK(Put("1000000000000foo", "v1"));
ASSERT_OK(Put("0000000000000bar", "v2"));
ASSERT_OK(Put("1000000000000foo", "v3"));
dbfull()->TEST_FlushMemTable();
options.create_if_missing = false;
std::shared_ptr<TableFactory> dummy_factory;
std::shared_ptr<TableFactory> block_based_factory(
NewBlockBasedTableFactory());
options.table_factory.reset(NewAdaptiveTableFactory(
block_based_factory, dummy_factory, dummy_factory));
Reopen(&options);
ASSERT_EQ("v3", Get("1000000000000foo"));
ASSERT_EQ("v2", Get("0000000000000bar"));
ASSERT_OK(Put("2000000000000foo", "v4"));
ASSERT_OK(Put("3000000000000bar", "v5"));
dbfull()->TEST_FlushMemTable();
ASSERT_EQ("v4", Get("2000000000000foo"));
ASSERT_EQ("v5", Get("3000000000000bar"));
Reopen(&options);
ASSERT_EQ("v3", Get("1000000000000foo"));
ASSERT_EQ("v2", Get("0000000000000bar"));
ASSERT_EQ("v4", Get("2000000000000foo"));
ASSERT_EQ("v5", Get("3000000000000bar"));
options.table_factory.reset(NewBlockBasedTableFactory());
Reopen(&options);
ASSERT_NE("v3", Get("1000000000000foo"));
options.table_factory.reset(NewPlainTableFactory());
Reopen(&options);
ASSERT_NE("v5", Get("3000000000000bar"));
}
INSTANTIATE_TEST_CASE_P(PlainTableDBTest, PlainTableDBTest, ::testing::Bool());
} // namespace rocksdb
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
#else
#include <stdio.h>
int main(int argc, char** argv) {
fprintf(stderr, "SKIPPED as plain table is not supported in ROCKSDB_LITE\n");
return 0;
}
#endif // !ROCKSDB_LITE
| [
"phrocker@apache.org"
] | phrocker@apache.org |
3e968c2d9cacac76eb4305098908d72351c83d95 | 3614d02dc00b4970ae31775ab9b40c043fcb5168 | /InventoryManagement/InventoryManagement/AssemblyInfo.cpp | bab2231ab5ef17d8a6518629ebfbe21ef7b99b9b | [] | no_license | rajchow/Raj | 3c75fdb4cdf77c39459daf06bf1f55be44327d24 | 133d259fb513ba0e46a2d0c746c718d07a9fffcc | refs/heads/master | 2016-09-06T02:05:19.736409 | 2012-11-13T06:23:41 | 2012-11-13T06:23:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,326 | cpp | #include "stdafx.h"
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::CompilerServices;
using namespace System::Runtime::InteropServices;
using namespace System::Security::Permissions;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly:AssemblyTitleAttribute("InventoryManagementSystem")];
[assembly:AssemblyDescriptionAttribute("")];
[assembly:AssemblyConfigurationAttribute("")];
[assembly:AssemblyCompanyAttribute("")];
[assembly:AssemblyProductAttribute("InventoryManagementSystem")];
[assembly:AssemblyCopyrightAttribute("Copyright (c) 2012")];
[assembly:AssemblyTrademarkAttribute("")];
[assembly:AssemblyCultureAttribute("")];
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the value or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly:AssemblyVersionAttribute("1.0.*")];
[assembly:ComVisible(false)];
[assembly:CLSCompliantAttribute(true)];
[assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];
| [
"raj.chowdhury@uleth.ca"
] | raj.chowdhury@uleth.ca |
b2374636c7a815b595df6d732138cddb6025ccf8 | 5da7acab91c9d64406338a149538ab2d34820e10 | /third_party/mlir/include/mlir/IR/SymbolTable.h | 3b89d73a8af71f7c1a00b86a389c6efde87e6fa7 | [
"Apache-2.0"
] | permissive | H4NG-MAN/tensorflow | 32b818b9b1172abd03acb27b154c6c48d94feb93 | 432b55a161e70db42103d38d3e18c165dd0c7fde | refs/heads/master | 2023-06-28T23:03:12.286796 | 2019-12-07T16:18:25 | 2019-12-07T16:18:25 | 212,573,936 | 2 | 0 | Apache-2.0 | 2023-06-26T17:18:26 | 2019-10-03T12:25:23 | C++ | UTF-8 | C++ | false | false | 4,141 | h | //===- SymbolTable.h - MLIR Symbol Table Class ------------------*- C++ -*-===//
//
// Copyright 2019 The MLIR 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 MLIR_IR_SYMBOLTABLE_H
#define MLIR_IR_SYMBOLTABLE_H
#include "mlir/IR/OpDefinition.h"
#include "llvm/ADT/StringMap.h"
namespace mlir {
class Identifier;
class MLIRContext;
class Operation;
/// This class allows for representing and managing the symbol table used by
/// operations with the 'SymbolTable' trait.
class SymbolTable {
public:
/// Build a symbol table with the symbols within the given operation.
SymbolTable(Operation *op);
/// Look up a symbol with the specified name, returning null if no such
/// name exists. Names never include the @ on them.
Operation *lookup(StringRef name) const;
template <typename T> T lookup(StringRef name) const {
return dyn_cast_or_null<T>(lookup(name));
}
/// Erase the given symbol from the table.
void erase(Operation *symbol);
/// Insert a new symbol into the table, and rename it as necessary to avoid
/// collisions.
void insert(Operation *symbol);
/// Returns the context held by this symbol table.
MLIRContext *getContext() const { return context; }
/// Return the name of the attribute used for symbol names.
static StringRef getSymbolAttrName() { return "sym_name"; }
/// Returns the operation registered with the given symbol name with the
/// regions of 'symbolTableOp'. 'symbolTableOp' is required to be an operation
/// with the 'OpTrait::SymbolTable' trait.
static Operation *lookupSymbolIn(Operation *symbolTableOp, StringRef symbol);
/// Returns the operation registered with the given symbol name within the
/// closes parent operation of, or including, 'from' with the
/// 'OpTrait::SymbolTable' trait. Returns nullptr if no valid symbol was
/// found.
static Operation *lookupNearestSymbolFrom(Operation *from, StringRef symbol);
private:
MLIRContext *context;
/// This is a mapping from a name to the symbol with that name.
llvm::StringMap<Operation *> symbolTable;
/// This is used when name conflicts are detected.
unsigned uniquingCounter = 0;
};
//===----------------------------------------------------------------------===//
// SymbolTable Trait Types
//===----------------------------------------------------------------------===//
namespace OpTrait {
namespace impl {
LogicalResult verifySymbolTable(Operation *op);
} // namespace impl
/// A trait used to provide symbol table functionalities to a region operation.
/// This operation must hold exactly 1 region. Once attached, all operations
/// that are directly within the region, i.e not including those within child
/// regions, that contain a 'SymbolTable::getSymbolAttrName()' StringAttr will
/// be verified to ensure that the names are uniqued.
template <typename ConcreteType>
class SymbolTable : public TraitBase<ConcreteType, SymbolTable> {
public:
static LogicalResult verifyTrait(Operation *op) {
return impl::verifySymbolTable(op);
}
/// Look up a symbol with the specified name, returning null if no such
/// name exists. Symbol names never include the @ on them. Note: This
/// performs a linear scan of held symbols.
Operation *lookupSymbol(StringRef name) {
return mlir::SymbolTable::lookupSymbolIn(this->getOperation(), name);
}
template <typename T> T lookupSymbol(StringRef name) {
return dyn_cast_or_null<T>(lookupSymbol(name));
}
};
} // end namespace OpTrait
} // end namespace mlir
#endif // MLIR_IR_SYMBOLTABLE_H
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
631bdbeadb7e5fd3766423ccd53d36f6f8357441 | d39f7a039477196ab1d31953548578f77efa2cb9 | /smallest_number_of_notes.cpp | 1d14767e3bef51e88c41bdba1dd83ba8f480e8ff | [] | no_license | TheAbhisar/cpp_workspace | 22631bbea09c48b7120147d13f99f6be3174bf93 | de088086d9edb7135f439265f1fe420537f0b594 | refs/heads/main | 2023-05-03T14:59:25.417344 | 2021-05-28T06:28:15 | 2021-05-28T06:28:15 | 355,159,793 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 418 | cpp | #include <iostream>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
long int n,sum=0;
cin>>n;
int a[]={100,50,10,5,2,1};
while(n>0){
for(int i=0;i<6;i++){
int x;
x=n/a[i];
sum=sum + x;
n=n-x*(a[i]);
}
cout<<sum<<endl;
}
return 0;
} | [
"abhisar97@gmail.com"
] | abhisar97@gmail.com |
bfde5a06736b69894f1ed4ad39eb3b05628ab8bf | 73020030a511bbbbaf537c9f0049ed9ec58f13dd | /Unary operators/src/Unary operators.cpp | 32b8359f1cd3de06257d72456168b6548d678625 | [] | no_license | Sagar-Pro3/c_c-master | 1275f6088f881fd7b97d5b325c51ded8ec1c9e0a | 874b172792547b91e2668c71948158e5fc05034b | refs/heads/main | 2023-03-09T15:45:06.148084 | 2021-02-27T04:08:53 | 2021-02-27T04:08:53 | 335,394,298 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 540 | cpp | //============================================================================
// Name : Unary.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
#include <iostream>
using namespace std;
class unary {
public:
int a, b;
void operator -() {
a = -a;
b = -b;
/*a = -a;
b = -b;*/
}
void set(int x, int y) {
a = x;
b = y;
}
void display() {
cout << a;
cout << b;
}
};
int main() {
unary u1;
u1.set(1, 2);
-u1;
u1.display();
return 0;
}
| [
"noreply@github.com"
] | Sagar-Pro3.noreply@github.com |
911e7954f68db888f8db4fabd169258c61421c40 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5686313294495744_0/C++/johnjq/OPTIMIZED_C.cpp | 8b9752e3fc46cf3a25530022d14ba9d085fb825f | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 11,905 | cpp | //////////////////////////////////////////////////// BEGIN OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// BEGIN OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// BEGIN OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// BEGIN OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// BEGIN OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// BEGIN OF SOLUTION ////////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
void preprocess() {
}
void process_testcase(const int testcase, const int should_run) {
int n;
cin>>n;
string topics[n][2];
for (int i = 0; i < n; ++i)
cin>>topics[i][0]>>topics[i][1];
if (should_run) {
int best_real = n;
for (int stt = 0, end_stt=1<<n; stt<end_stt; ++stt) {
int real = __builtin_popcount(stt);
if (real < best_real) {
set<string> available_first, available_second;
for (int i = 0; i < n; ++i)
if (stt&(1<<i))
available_first.insert(topics[i][0]),
available_second.insert(topics[i][1]);
/*printf("stt = %d\n", stt);
for (const string x : available_first) printf("\tfirst: %s\n", x.c_str());
for (const string x : available_second) printf("\tsecond: %s\n", x.c_str());*/
bool okay = true;
for (int i = 0; i < n; ++i) {
if (!(stt&(1<<i))) {
if (!available_first.count(topics[i][0]) || !available_second.count(topics[i][1])) {
okay = false;
break;
}
}
}
if (okay) {
//printf("state %d is valid\n", stt);
best_real = real;
}
}
}
cout<<"Case #"<<testcase<<": "<<n-best_real<<endl;
}
}
//////////////////////////////////////////////////// END OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// END OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// END OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// END OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// END OF SOLUTION ////////////////////////////////////////////////////
//////////////////////////////////////////////////// END OF SOLUTION ////////////////////////////////////////////////////
#include <unistd.h>
#include <errno.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
void naive(const char* input_filename, const char* output_filename) {
// Redirect standard input
if (!freopen(input_filename, "r", stdin)) {
fprintf(stderr, "unable to open input file: %s\n", input_filename);
exit(4);
}
// Redirect standard output
if (!freopen(output_filename, "w", stdout)) {
fprintf(stderr, "unable to open output file: %s\n", output_filename);
exit(5);
}
// Preprocess
preprocess();
// Sequentially process testcases
int testcases;
scanf("%d", &testcases);
for (int testcase = 1; testcase <= testcases; ++testcase)
process_testcase(testcase, 1);
}
void better(const char* input_filename, const char* output_filename) {
// Redirect standard input
if (!freopen(input_filename, "r", stdin)) {
fprintf(stderr, "unable to open input file: %s\n", input_filename);
exit(6);
}
// Open output file
FILE* const output_file = fopen(output_filename, "w");
if (!output_file) {
fprintf(stderr, "unable to open output file: %s\n", output_filename);
exit(7);
}
// Retrieve the number of cores
const int cores = sysconf(_SC_NPROCESSORS_ONLN);
printf("Number of cores: %d\n", cores);
// Retrieve the number of testcases
int testcases;
scanf("%d ", &testcases);
printf("Number of testcases: %d\n", testcases);
// Retrieve testcase sizes
int testcase_size[testcases+1];
int pos = ftell(stdin);
for (int testcase = 1; testcase <= testcases; ++testcase) {
const int old_pos = pos;
process_testcase(testcase, 0);
scanf(" ");
pos = ftell(stdin);
testcase_size[testcase] = pos - old_pos;
}
// Make sure that the entire input has been read
if (getchar() != EOF) {
fprintf(stderr, "the entire input has not been read\n");
exit(8);
}
// Preprocess
preprocess();
// Start children processes
int children_input_pipe[testcases+1][2], children_output_pipe[testcases+1][2];
pid_t children_pid[testcases+1];
for (int testcase = 1; testcase <= testcases; ++testcase) {
// Create the pipes
if (pipe(children_input_pipe[testcase]) < 0) {
fprintf(stderr, "unable to create child input pipe\n");
exit(9);
}
if (pipe(children_output_pipe[testcase]) < 0) {
fprintf(stderr, "unable to create child output pipe\n");
exit(10);
}
// Create the child process
children_pid[testcase] = fork();
if (children_pid[testcase] < 0) {
fprintf(stderr, "unable to create child process\n");
exit(11);
}
if (children_pid[testcase] == 0) {
// Redirect stderr to /dev/null
if (!freopen("/dev/null", "w", stderr)) {
exit(12);
}
// Close the write-end of the input pipe
if (close(children_input_pipe[testcase][1]) < 0) {
exit(13);
}
// Close the read-end of the output pipe
if (close(children_output_pipe[testcase][0]) < 0) {
exit(14);
}
// Redirect the read-end of the input pipe to stdin
if (dup2(children_input_pipe[testcase][0], STDIN_FILENO) < 0) {
exit(15);
}
// Redirect the write-end of the output pipe to stdout
if (dup2(children_output_pipe[testcase][1], STDOUT_FILENO) < 0) {
exit(16);
}
// Process a testcase
process_testcase(testcase, 1);
// Close the read-end of the input pipe
if (close(children_input_pipe[testcase][0]) < 0) {
exit(17);
}
// Close the write-end of the output pipe
if (close(children_output_pipe[testcase][1]) < 0) {
exit(18);
}
// Exit
exit(0);
}
// Close the read-end of the input pipe
if (close(children_input_pipe[testcase][0]) < 0) {
fprintf(stderr, "unable to close the read-end of the input pipe from the parent\n");
exit(19);
}
// Close the write-end of the output pipe
if (close(children_output_pipe[testcase][1]) < 0) {
fprintf(stderr, "unable to close the write-end of the output pipe from the parent\n");
exit(20);
}
}
// Rewind standard input by reopening the file
if (!freopen(input_filename, "r", stdin)) {
fprintf(stderr, "unable to reopen input file: %s\n", input_filename);
exit(21);
}
// Skip the number of tescases
scanf("%*d ");
// Read testcases and send them to the corresponding processes
int children_running = 0;
for (int testcase = 1; testcase <= testcases; ++testcase) {
// Wait
if (children_running == cores) {
int status;
if (wait(&status) < 0) {
fprintf(stderr, "unable to wait for child process\n");
exit(22);
}
if (status != 0) {
fprintf(stderr, "child process did not terminate successfully: %d\n", status);
exit(23);
}
} else {
++children_running;
}
// Forward testcase to the corresponding child process
printf("Starting case %d...\n", testcase);
const int BUFFER_SIZE = 4096;
char buffer[BUFFER_SIZE];
int remaining_bytes = testcase_size[testcase];
while (remaining_bytes > 0) {
const int bytes_requested = BUFFER_SIZE <= remaining_bytes ? BUFFER_SIZE : remaining_bytes;
const int bytes_read = fread(buffer, sizeof(char), bytes_requested, stdin);
if (bytes_requested != bytes_read) {
fprintf(stderr, "error while reading data from input file\n");
exit(24);
}
write(children_input_pipe[testcase][1], buffer, bytes_read);
remaining_bytes -= bytes_read;
}
// Close the write-end of the input pipe
if (close(children_input_pipe[testcase][1]) < 0) {
fprintf(stderr, "unable to close the write-end of the input pipe from the parent");
exit(25);
}
}
// Make sure that all children terminate successfully
while (children_running > 0) {
int status;
if (wait(&status) < 0) {
fprintf(stderr, "unable to wait for child process\n");
exit(26);
}
if (status != 0) {
fprintf(stderr, "child process did not terminate successfully\n");
exit(27);
}
--children_running;
}
// Write results to the output file
puts("Writing results...");
for (int testcase = 1; testcase <= testcases; ++testcase) {
const int BUFFER_SIZE = 4096;
char buffer[BUFFER_SIZE];
for (;;) {
const int bytes_read = read(children_output_pipe[testcase][0], buffer, BUFFER_SIZE);
if (bytes_read == 0)
break;
fwrite(buffer, sizeof(char), bytes_read, output_file);
}
// Close the read-end of the output pipe
if (close(children_output_pipe[testcase][0]) < 0) {
fprintf(stderr, "unable to close the read-end of the output pipe from the parent");
exit(28);
}
}
// Close the output file
fclose(output_file);
// Display finish message
puts("Finished!");
}
int main(int argc, char** argv) {
// Validate arguments
if (argc != 2) {
fprintf(stderr, "expected one argument, received %d instead\n", argc-1);
exit(1);
}
const int filename_len = strlen(argv[1]);
if (filename_len > 70) {
fprintf(stderr, "input filename is too long\n");
exit(2);
}
if (filename_len < 3 || argv[1][filename_len-3] != '.' || argv[1][filename_len-2] != 'i' || argv[1][filename_len-1] != 'n') {
fprintf(stderr, "input filename does not end with '.in'\n");
exit(3);
}
// Retrieve filenames
char input_filename[80];
strcpy(input_filename, argv[1]);
char output_filename[80];
strcpy(output_filename, argv[1]);
output_filename[filename_len-2] = 'o';
output_filename[filename_len-1] = 'u';
output_filename[filename_len] = 't';
output_filename[filename_len+1] = '\0';
// Process testcases
#ifdef SEQUENTIAL
naive(input_filename, output_filename);
#else
better(input_filename, output_filename);
#endif
}
| [
"alexandra1.back@gmail.com"
] | alexandra1.back@gmail.com |
ab1c021485db4efcbc7469a83c10c1e33f49ebf1 | 334f2246503eecb8d3cb99b074b7ce2f2f47955f | /src/g3dxml/XMLRectifiedGridReader.cpp | e63fa7cec584e5efc3e4f394715da9cafce7fe35 | [
"MIT"
] | permissive | WuZixing/Geo3DML-CPP | 4c61d8705cdbf889359425be984a8152e3100bc0 | 29f5948b6de08d9600823ff7622df0fb5e1acedc | refs/heads/master | 2023-08-17T16:27:44.558334 | 2023-07-29T13:50:56 | 2023-07-29T13:50:56 | 145,398,120 | 11 | 6 | MIT | 2023-05-16T06:31:35 | 2018-08-20T09:44:13 | C | UTF-8 | C++ | false | false | 4,168 | cpp | // UTF-8编码
#include <g3dxml/XMLRectifiedGridReader.h>
#include <geo3dml/Utils.h>
using namespace g3dxml;
const std::string XMLRectifiedGridReader::Element = "RectifiedGrid";
const std::string XMLRectifiedGridReader::Element_Low = "low";
const std::string XMLRectifiedGridReader::Element_High = "high";
const std::string XMLRectifiedGridReader::Element_Origin = "Point";
const std::string XMLRectifiedGridReader::Element_OffsetVector = "offsetVector";
/// @brief 构造函数。
/// @param factory Geo3DML对象的工厂类对象。该对象的内存由调用者负责管理。
XMLRectifiedGridReader::XMLRectifiedGridReader(geo3dml::ObjectFactory* factory) : XMLIO() {
g3dFactory_ = factory;
}
XMLRectifiedGridReader::~XMLRectifiedGridReader() {
}
geo3dml::RectifiedGrid* XMLRectifiedGridReader::ReadGrid(xmlTextReaderPtr reader) {
geo3dml::RectifiedGrid* grid = nullptr;
std::string id = XMLReaderHelper::AttributeGMLID(reader);
std::string str = XMLReaderHelper::Attribute(reader, "gml:dimension");
int dim = strtol(str.c_str(), nullptr, 10);
if (dim != 3) {
SetStatus(false, std::string("unsupported dimension: ") + str);
return grid;
}
int lowI = 0, lowJ = 0, lowK = 0, highI = -1, highJ = -1, highK = -1;
geo3dml::Point3D origin;
geo3dml::Vector3D vectors[3] = {
geo3dml::Vector3D(1, 0, 0), geo3dml::Vector3D(0, 1, 0), geo3dml::Vector3D(0, 0, 1)
};
int vecIndex = -1;
int status = xmlTextReaderRead(reader);
while (status == 1) {
const char* localName = (const char*)xmlTextReaderConstLocalName(reader);
int nodeType = xmlTextReaderNodeType(reader);
if (nodeType == XML_READER_TYPE_END_ELEMENT && geo3dml::IsiEqual(localName, Element)) {
break;
} else if (nodeType == XML_READER_TYPE_ELEMENT) {
if (geo3dml::IsiEqual(localName, Element_Low)) {
if (!XMLReaderHelper::TextNode(reader, Element_Low, str)) {
SetStatus(false, str);
break;
}
char* end = nullptr;
lowI = strtol(str.c_str(), &end, 10);
lowJ = strtol(end, &end, 10);
lowK = strtol(end, nullptr, 10);
} else if (geo3dml::IsiEqual(localName, Element_High)) {
if (!XMLReaderHelper::TextNode(reader, Element_High, str)) {
SetStatus(false, str);
break;
}
char* end = nullptr;
highI = strtol(str.c_str(), &end, 10);
highJ = strtol(end, &end, 10);
highK = strtol(end, nullptr, 10);
} else if (geo3dml::IsiEqual(localName, Element_Origin)) {
if (!XMLReaderHelper::TextNode(reader, Element_Origin, str)) {
SetStatus(false, str);
break;
}
char* end = nullptr;
origin.x = strtod(str.c_str(), &end);
origin.y = strtod(end, &end);
origin.z = strtod(end, nullptr);
} else if (geo3dml::IsiEqual(localName, Element_OffsetVector)) {
if (!XMLReaderHelper::TextNode(reader, Element_OffsetVector, str)) {
SetStatus(false, str);
break;
}
++vecIndex;
if (vecIndex < 3) {
char* end = nullptr;
vectors[vecIndex].X(strtod(str.c_str(), &end));
vectors[vecIndex].Y(strtod(end, &end));
vectors[vecIndex].Z(strtod(end, nullptr));
}
}
}
status = xmlTextReaderRead(reader);
}
if (status != 1) {
std::string err = XMLReaderHelper::FormatErrorMessageWithPosition(reader, "missing end element of " + Element);
SetStatus(false, err);
}
if (IsOK()) {
grid = g3dFactory_->NewRectifiedGrid(origin, vectors[0], vectors[1], vectors[2], highI, highJ, highK, lowI, lowJ, lowK);
if (grid != nullptr) {
grid->SetID(id);
}
}
return grid;
}
| [
"wzixing@qq.com"
] | wzixing@qq.com |
6a381046a7c6d4f3b9d608e59ab2c9a1a82a8f01 | cf2d7c2b137ed39b20667a41271057c8aef2389a | /calculatinghash.cpp | 32c1351f74561b5988c9414be5e9ed2a8ca47a20 | [] | no_license | blockchain-samples/mySimple_blockchain | f5e181736b24210c0dee3fa9d1aebf86fcb5200d | b42ebf83f7e7c6fd26830af5bfed78026562fa20 | refs/heads/master | 2022-01-13T18:49:00.939569 | 2019-05-18T16:53:37 | 2019-05-18T16:53:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 49 | cpp | #include<iostream>
#include<string>
main()
{
}
| [
"amiabir19@gmail.com"
] | amiabir19@gmail.com |
8ae6c058c40eb5a1b6daa117f25e8e2d1682bacf | 5fc5955fc122f5fec54ca61e0b74d95a24842bf0 | /2014/Summer1/Assignments/Lab8/DynamicQueues.cpp | 0053a6b0ae200cdb7e305247c4b1620bae197598 | [] | no_license | jannunzi/CS1500 | 7ed14c46179c519a854389ee929f802abdbc747f | 46eddc4ce5d5f23413eced02c62f58a07cf3a9eb | refs/heads/master | 2020-06-01T09:22:01.025380 | 2015-06-24T12:54:51 | 2015-06-24T12:54:51 | 14,442,407 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,375 | cpp | #include <iostream>
#include <string>
using namespace std;
// structure representing a donut
struct Donut
{
string flavor = "";
float price = 0.0;
// constructor to initialize member variables
Donut(string flvr, float prc)
{
flavor = flvr;
price = prc;
}
// default, no argument constructor
Donut(){}
};
// structure representing a collection of donuts
struct DonutTray
{
// dynamic array of pointers to donuts
// first * is for the dynamic array
// second * is for pointer to donut
Donut** donuts;
// maximum number of donuts in tray
int capacity;
// boundary indices of queue
int front = 0, back = 0;
// how many donuts are currently in the queue
int count = 0;
// constructor to initialize the tray
DonutTray(int size)
{
// set the capacity and allocate the array
capacity = size;
donuts = new Donut*[capacity];
}
};
// putting and removing donuts from the tray
void enqueueDonut(DonutTray* tray, Donut* donut);
Donut* dequeueDonut(DonutTray* tray);
// display a single donut and the whole tray
void displayDonut(Donut* donut);
void displayDonutTray(DonutTray* tray);
int main()
{
Donut donuts1[10];
Donut donut1("Flavor 1", 0.54);
donuts1[0] = donut1;
Donut * donut2 = new Donut("Flavor 2", 0.56);
// create some donuts
Donut* chocolate = new Donut("Chocolate", 0.99);
Donut* boston = new Donut("Boston Crm", 0.99);
Donut* jelly = new Donut("Jelly", 0.99);
Donut* glazed = new Donut("Glazed", 0.99);
Donut* eclair = new Donut("Eclair", 0.99);
Donut* snowy = new Donut("Snowy", 0.99);
Donut* moon = new Donut("Moonraker", 0.99);
// create a small tray that can hold 5 donuts
DonutTray* tray = new DonutTray(5);
// add 4 donuts to the tray and display it
enqueueDonut(tray, chocolate);
enqueueDonut(tray, boston);
enqueueDonut(tray, jelly);
enqueueDonut(tray, glazed);
displayDonutTray(tray);
// remove a donut from the tray, display the donut and tray
Donut* donut = dequeueDonut(tray);
displayDonut(donut);
displayDonutTray(tray);
// add two more donuts and display the tray
enqueueDonut(tray, eclair);
enqueueDonut(tray, snowy);
displayDonutTray(tray);
// remove and display two donuts, and add one more
donut = dequeueDonut(tray);
displayDonut(donut);
donut = dequeueDonut(tray);
displayDonut(donut);
enqueueDonut(tray, moon);
// display final tray
displayDonutTray(tray);
}
| [
"jannunzi@gmail.com"
] | jannunzi@gmail.com |
b2a64f3ffaeabc810cfce820d9f514537dd16e7f | 80b35536213bcb6529f6a6ec5404e8552e1397ee | /CTreeCtrlXML/CTreeCtrlXML/CTreeCtrlXMLDlg.h | ccc484e80cf7f751182f19e7baca6d13fe2dc7c7 | [] | no_license | Fatih-stack/Aricanli | 29fa3eb7b90938dde9b89c6adfaecb042aaec91a | c5206862eb2301cee4cb4d341ce8f929e93dc737 | refs/heads/main | 2023-06-30T17:43:37.115976 | 2021-08-04T11:06:53 | 2021-08-04T11:06:53 | 390,956,223 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 966 | h | // CTreeCtrlXMLDlg.h : header file
//
#pragma once
#include "afxcmn.h"
// Use our new class CTreeCtrlXML
#include "TreeCtrlXML.h"
#include "resource.h"
// CCTreeCtrlXMLDlg dialog
class CCTreeCtrlXMLDlg : public CDialog
{
// Construction
public:
CCTreeCtrlXMLDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_CTREECTRLXML_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CTreeCtrlXML m_demoTree; // The tree control object
CListCtrl m_listCtrl; // The list control object
afx_msg void OnTvnSelchangedTree1(NMHDR* pNMHDR, LRESULT* pResult);
afx_msg void OnLvnItemchangedList1(NMHDR* pNMHDR, LRESULT* pResult);
};
| [
"55389140+Fatih-stack@users.noreply.github.com"
] | 55389140+Fatih-stack@users.noreply.github.com |
548c7b55befc6061aaf15e6315d86289723beb77 | 531c8038dcb82d5e1e82d1ec612bbad4ef4eabb5 | /C++/1102C - Doors Breaking and Repairing.cpp | 798a834a344a5dfcb0e7eaa4dd287acdfd7ced0d | [] | no_license | csongor9999/Codeforces | 3add98b0292900b61dae62296ffba7f733186617 | 55128b6b106f32d39a89b8f21ceaf8c1b0030afb | refs/heads/master | 2021-06-17T09:56:08.275140 | 2021-02-21T00:57:58 | 2021-02-21T00:57:58 | 152,790,151 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 597 | cpp | #include <iostream>
#include <set>
#include <algorithm>
using namespace std;
int main(){
int n,x,y;
cin>>n>>x>>y;
int db = 0;
multiset <int> doors;
multiset <int>::iterator it;
for(int i=0;i<n;i++) {
int sv;
cin>>sv;
doors.insert(sv);
}
int j=0;
while(j<1000 && db!=n) {
it = doors.begin();
if(*it-x==0) {
db++;
doors.erase(it);
it = doors.begin();
doors.insert(*it+y);
doors.erase(it);
}
}
return 0;
}
| [
"noreply@github.com"
] | csongor9999.noreply@github.com |
203b8a98350ea9236f38a4e0aa74a0f6d965104c | 44e01961f29f7d6261696cd44ea1463ef778e3e2 | /StringListGenerator/main.cpp | 16bf27a678e4ece5b58fe2ab710f0b988bb58c30 | [
"MIT"
] | permissive | Pujolsluis/StringListGenerator | 76311a0810e3971f0747e566c5c4bd75613d4206 | 2d7d900151a128b0142053bb3ea50a615cdcc9c5 | refs/heads/master | 2020-03-09T13:41:21.919179 | 2018-04-09T19:55:43 | 2018-04-09T19:55:43 | 128,817,442 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 906 | cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
vector<string> inputList;
string inputString;
// Line break sentence list.
while(getline(cin, inputString)){
inputList.push_back(inputString);
}
// Space separated word list.
/*
while(cin >> inputString){
inputList.push_back(inputString);
}
*/
// If you wish to sort the list after reading it uncomment the line below.
// sort(inputList.begin(), inputList.end());
cout << "---- DONE READING INPUT FILE ----" << endl;
for(int i=0; i<inputList.size(); i++){
if (i != inputList.size()-1){
cout << "\"" << inputList[i] << "\"," << endl;
} else {
cout << "\"" << inputList[i] << "\"" << endl;
}
}
cout << "---- DONE PRINTING OUTPUT ----" << endl;
return 0;
}
| [
"luispujols@hotmail.com"
] | luispujols@hotmail.com |
c45e0e73fd362c1243c376ca734b2a2079e447e4 | dde739606fdd48dfecff729f4bc2d114de369924 | /ToMysql.cpp | 56362bb1614aa7387a615a817eb762b4d8e27f85 | [] | no_license | MinfonTsai/AutoAppInstall | 38a9448fafa5e02a6a7cbc0247538c606b22af0e | 754beeca1b6a9c562955c6fa1b295077972c9b37 | refs/heads/master | 2021-01-25T08:19:54.954269 | 2017-06-08T14:03:48 | 2017-06-08T14:03:48 | 93,756,515 | 0 | 0 | null | null | null | null | BIG5 | C++ | false | false | 2,320 | cpp | #include "stdafx.h"
#include "tomysql.h"
//=======================================================================
//初始化數據
int ToMysql::ConnMySQL(char *host,char * port ,char * Db,char * user,char* passwd,char * charset,char * Msg)
{
if( mysql_init(&mysql) == NULL )
{
Msg = "inital mysql handle error";
return 1;
}
if (mysql_real_connect(&mysql,host,user,passwd,Db,0,NULL,0) == NULL)
{
Msg = "Failed to connect to database: Error";
return 1;
}
if(mysql_set_character_set(&mysql,"GBK") != 0)
{
Msg = "mysql_set_character_set Error";
return 1;
}
return 0;
}
//=======================================================================
//查詢資料
string ToMysql::SelectData(char * SQL,int Cnum,char * Msg)
{
MYSQL_ROW m_row;
MYSQL_RES *m_res;
char sql[2048];
sprintf(sql,SQL);
int rnum = 0;
char rg = 0x06;//行隔開
char cg = {0x05};//欄位隔開
if(mysql_query(&mysql,sql) != 0)
{
Msg = "select ps_info Error";
return "";
}
m_res = mysql_store_result(&mysql);
if(m_res==NULL)
{
Msg = "select username Error";
return "";
}
string str("");
while(m_row = mysql_fetch_row(m_res))
{
for(int i = 0;i < Cnum;i++)
{
str += m_row[i];
str += rg;
}
str += rg;
rnum++;
}
mysql_free_result(m_res);
return str;
}
//===================================================================
//插入資料
int ToMysql::InsertData(char * SQL,char * Msg)
{
char sql[2048];
sprintf(sql,SQL);
if(mysql_query(&mysql,sql) != 0)
{
Msg = "Insert Data Error";
return 1;
}
return 0;
}
//===================================================================
//更新資料
int ToMysql::UpdateData(char * SQL,char * Msg)
{
char sql[2048];
sprintf(sql,SQL);
if(mysql_query(&mysql,sql) != 0)
{
Msg = "Update Data Error";
return 1;
}
return 0;
}
//===================================================================
//刪除資料
int ToMysql::DeleteData(char * SQL,char * Msg)
{
char sql[2048];
sprintf(sql,SQL);
if(mysql_query(&mysql,sql) != 0)
{
Msg = "Delete Data error";
return 1;
}
return 0;
}
//===================================================================
//關閉資料庫連接
void ToMysql::CloseMySQLConn()
{
mysql_close(&mysql);
}
| [
"minfon@foxmail.com"
] | minfon@foxmail.com |
aedee1995c5cf029cf985047f138c9c5384b8cac | 3626a948afd2cea604bd79706613b90de49cde5a | /temperature.h | c4a3e539fe1ff40f77890a986685245f6642c402 | [] | no_license | lupton4/HunterLupton-CSCI20-Spring2018 | e32a03ee8ce32cdc49a246ab4d13318ce571618c | 139d89419c29e574bad4655d7960c52d6c90f17d | refs/heads/master | 2021-09-06T23:50:09.650695 | 2018-02-13T16:36:39 | 2018-02-13T16:36:39 | 118,704,629 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,411 | h | /*
* Name : temperature.h
* Author : Hunter Lupton
* Description : Class Header File
* With help form: Jacob
*/
#ifndef TEMPERATURE_H
#define TEMPERATURE_H
#include <string>
#include <sstream>
using std::string;
using std::stringstream;
/*
* Class Temperature.
* A class that converts temperatures. It will always internally store the value
* in kelvin.
*/
class Temperature {
public:
/*
* Constructor #1.
* Sets kelvin_ to 0
*/
Temperature();
/*
* Constructor #2.
* Sets kelvin_ to the supplied value
* @param double kelvin - The value to set the internal kelvin to
*/
Temperature(double kelvin);
/*
* Constructor #3.
* Converts the supplied temperature to kelvin and internally stores it.
* The temperature's unit will be provided in the second argument.
* If the second argument is not value (i.e. not 'F' or 'C') assume the
* temperature is in kelvin
* @param double temp - The value to set the internal kelvin to once
* - converted.
* @param char unit - The type of unit temp is. Will be either 'F' or 'C',
* case-insensitive
*/
Temperature(double temp, char unit);
/*
* The temperature will come in as kelvin and this function will set the
* internal temp to this value
* @param double kelvin - The value to set the internal kelvin to.
*/
void SetTempFromKelvin(double kelvin);
/*
* The temperature will come in as Celsius and this function will set the
* internal temp to this value, once converted to kelvin
* Formula: k = c + 273.15
* @param double celsius - The value (in celsius) to set the internal kelvin
* - to.
*/
void SetTempFromCelsius(double celsius);
/*
* The temperature will come in as Fahrenheit and this function will set the
* internal temp to this value, once converted to kelvin
* Formula: k = (5.0 * (f - 32) / 9) + 273.15
* @param double fahrenheit - The value (in fahrenheit) to set the internal
* - kelvin to.
*/
void SetTempFromFahrenheit(double fahrenheit);
/*
* Gets the internal temperature in Kelvin.
* @return double - The temperature in Kelvin
*/
double GetTempAsKelvin() const;
/*
* Returns the internal temp converted to Celsius
* Formula: k - 273.15
* @return double - The temperature in Celsius
*/
double GetTempAsCelsius() const;
/*
* Returns the internal temp converted to Fahrenheit
* Formula: ((c * 9.0) / 5) + 32;
* @return double - The temperature in Fahrenheit
*/
double GetTempAsFahrenheit() const;
/*
* Get a string representation of the temperature.
* The string will be formatted as:
* "TEMP UNIT"
* where TEMP is the temperature to 2 decimal places and UNIT is either
* "Kelvin", "Celsius", or "Fahrenheit".
* The conversion to perform is denoted by the parameter.
* If the unit given through the argument is invalid, set the string to:
* "Invalid Unit"
* @uses stringstream
* @param char unit - The conversion to perform, either 'K', 'C' or 'F',
* defaults to 'K' and is case-insensitive
* @return string - A string representation of the temperature or invalid if
* the provided unit is not recognized
*/
string ToString(char unit = 'K') const;
private:
double kelvin_;
};
#endif
| [
"noreply@github.com"
] | lupton4.noreply@github.com |
ab0d885a00a5027481f8cf6a662ee12067dcaf0b | 706df2ab7b753741ac830309e4da2716585bd3e4 | /ImageProcessor/GaussianBlur.h | 77fe41400f60ec228dbcb8dfccb0632c41744915 | [] | no_license | huyuji/slider2 | 4fe11bff894d3e09c928734f8205d46bb063cd34 | 391bf161e0bcc019a3be53989343595a4a2e830f | refs/heads/master | 2021-01-10T10:10:01.817029 | 2016-04-11T19:39:19 | 2016-04-11T19:39:19 | 47,346,898 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 593 | h | #pragma once
#ifndef idBA2E79BA_A355_49E8_8FE8D7A44594D3B3
#define idBA2E79BA_A355_49E8_8FE8D7A44594D3B3
#include <string>
#include <boost/property_tree/ptree.hpp>
#include "Operation.h"
namespace ImageProcessor
{
class GaussianBlur : public Operation
{
public:
GaussianBlur(const boost::property_tree::ptree& params);
virtual cv::Mat operator()(const cv::Mat& image);
private:
void denormalizeParams();
double m_alpha;
double m_beta;
double m_ksize;
double m_sigc;
double m_sigx;
};
}
#endif // header
| [
"yuji.hu@curvedental.com"
] | yuji.hu@curvedental.com |
3692506235e4f167a2bb341ac69f517452a85190 | d4a78a9099884c1e1c203f7e5b78b844de053ff7 | /tensorflow/compiler/xla/service/hlo_module_dce_test.cc | f6e2866204955ac024c2b6f972de449cc3df4c15 | [
"Apache-2.0"
] | permissive | pint1022/tensorflow | b4b7632c0f833135a0bb37ab5a939a6c1ec51ef6 | ab1f872bbcf7749112f76a7f9ba17406e8fbbf4e | refs/heads/master | 2020-04-15T00:16:48.132100 | 2019-02-05T17:48:11 | 2019-02-05T17:48:11 | 164,233,910 | 2 | 2 | Apache-2.0 | 2019-01-05T16:53:25 | 2019-01-05T16:53:25 | null | UTF-8 | C++ | false | false | 20,013 | cc | /* Copyright 2018 The TensorFlow 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.
==============================================================================*/
#include "tensorflow/compiler/xla/service/hlo_module_dce.h"
#include "tensorflow/compiler/xla/service/hlo_computation.h"
#include "tensorflow/compiler/xla/service/hlo_instruction.h"
#include "tensorflow/compiler/xla/service/hlo_module.h"
#include "tensorflow/compiler/xla/service/hlo_opcode.h"
#include "tensorflow/compiler/xla/service/hlo_parser.h"
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/tests/hlo_test_base.h"
#include "tensorflow/compiler/xla/tests/literal_test_util.h"
#include "tensorflow/compiler/xla/tests/test_utils.h"
#include "tensorflow/compiler/xla/types.h"
#include "tensorflow/core/lib/core/status_test_util.h"
#include "tensorflow/core/platform/types.h"
namespace xla {
namespace {
class HloModuleDceTest : public HloTestBase {
protected:
HloModuleDceTest() {}
// Returns whether the given instruction exists in the given computation.
bool HasInstruction(const HloComputation& computation,
const HloInstruction* instruction) {
return absl::c_linear_search(computation.instructions(), instruction);
}
// Returns whether the while instruction with name 'while_name' in
// 'computation' passes through its tuple element at 'tuple_index' from
// parameter to root instruction.
bool WhileBodyHasPassThroughTupleElement(const HloComputation* computation,
const string& while_name,
const int64 tuple_index) {
for (auto* instruction : computation->instructions()) {
if (instruction->opcode() == HloOpcode::kWhile &&
instruction->name() == while_name) {
auto* while_body_comp = instruction->while_body();
auto* while_body_param = while_body_comp->parameter_instruction(0);
auto* while_body_root = while_body_comp->root_instruction();
if (while_body_root->opcode() != HloOpcode::kTuple) {
return false;
}
auto* operand = while_body_root->operand(tuple_index);
if (operand->opcode() == HloOpcode::kGetTupleElement &&
operand->tuple_index() == tuple_index &&
operand->operand(0) == while_body_param) {
return true;
}
return false;
}
}
return false;
}
};
// Tests that a while with all outputs live is unmodified.
TEST_F(HloModuleDceTest, WhileWithLiveOutputs) {
auto module = ParseHloString(R"(
HloModule SimpleLoop
SimpleLoop.body {
loop_var.1 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.1 = s32[] get-tuple-element(loop_var.1), index=0
constant.1 = s32[] constant(1)
add = s32[] add(get-tuple-element.1, constant.1)
get-tuple-element.2 = s32[3]{0} get-tuple-element(loop_var.1), index=1
multiply = s32[3]{0} multiply(get-tuple-element.2, get-tuple-element.2)
ROOT tuple = (s32[], s32[3]{0}) tuple(add, multiply)
}
SimpleLoop.condition {
loop_var.2 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.3 = s32[] get-tuple-element(loop_var.2), index=0
constant.2 = s32[] constant(5)
ROOT less-than = pred[] less-than(get-tuple-element.3, constant.2)
}
ENTRY SimpleLoop {
constant.3 = s32[] constant(0)
constant.4 = s32[3]{0} constant({0, 1, 2})
tuple.1 = (s32[], s32[3]{0}) tuple(constant.3, constant.4)
ROOT while = (s32[], s32[3]{0}) while(tuple.1), condition=
SimpleLoop.condition, body=SimpleLoop.body
})")
.ValueOrDie();
HloModuleDCE dce;
EXPECT_FALSE(dce.Run(module.get()).ValueOrDie());
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 0));
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 1));
}
// Tests a while loop with one unused output (which is used in the while loop
// body by an instruction with side-effects: rng) is unmodified.
TEST_F(HloModuleDceTest, WhileWithUnusedSideEffectingTupleElement) {
auto module = ParseHloString(R"(
HloModule SimpleLoop
SimpleLoop.body {
loop_var.1 = (s32[], f32[]) parameter(0)
get-tuple-element.1 = s32[] get-tuple-element(loop_var.1), index=0
constant.1 = s32[] constant(1)
add = s32[] add(get-tuple-element.1, constant.1)
get-tuple-element.2 = f32[] get-tuple-element(loop_var.1), index=1
constant.2 = f32[] constant(1.0)
rng = f32[] rng(constant.2, get-tuple-element.2), distribution=rng_uniform
add.1 = s32[] add(get-tuple-element.2, constant.2)
ROOT tuple = (s32[], f32[]) tuple(add, add.1)
}
SimpleLoop.condition {
loop_var.2 = (s32[], f32[]) parameter(0)
get-tuple-element.3 = s32[] get-tuple-element(loop_var.2), index=0
constant.3 = s32[] constant(5)
ROOT less-than = pred[] less-than(get-tuple-element.3, constant.3)
}
ENTRY SimpleLoop {
constant.4 = s32[] constant(0)
constant.5 = f32[] constant(0.0)
tuple.1 = (s32[], f32[]) tuple(constant.4, constant.5)
while = (s32[], f32[]) while(tuple.1), condition=
SimpleLoop.condition, body=SimpleLoop.body
ROOT get-tuple-element.4 = s32[] get-tuple-element(while), index=0
})")
.ValueOrDie();
HloModuleDCE dce;
EXPECT_FALSE(dce.Run(module.get()).ValueOrDie());
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 0));
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 1));
}
// Tests that a while loop with one dead tuple element at {1} has its while
// loop body modified to make that tuple element pass-through the while body.
TEST_F(HloModuleDceTest, OneWhileWithDeadTupleElement) {
auto module = ParseHloString(R"(
HloModule SimpleLoop
SimpleLoop.body {
loop_var.1 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.1 = s32[] get-tuple-element(loop_var.1), index=0
constant.1 = s32[] constant(1)
add = s32[] add(get-tuple-element.1, constant.1)
get-tuple-element.2 = s32[3]{0} get-tuple-element(loop_var.1), index=1
multiply = s32[3]{0} multiply(get-tuple-element.2, get-tuple-element.2)
ROOT tuple = (s32[], s32[3]{0}) tuple(add, multiply)
}
SimpleLoop.condition {
loop_var.2 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.3 = s32[] get-tuple-element(loop_var.2), index=0
constant.2 = s32[] constant(5)
ROOT less-than = pred[] less-than(get-tuple-element.3, constant.2)
}
ENTRY SimpleLoop {
constant.3 = s32[] constant(0)
constant.4 = s32[3]{0} constant({0, 1, 2})
tuple.1 = (s32[], s32[3]{0}) tuple(constant.3, constant.4)
while = (s32[], s32[3]{0}) while(tuple.1), condition=
SimpleLoop.condition, body=SimpleLoop.body
ROOT get-tuple-element.4 = s32[] get-tuple-element(while), index=0
})")
.ValueOrDie();
HloModuleDCE dce;
// While tuple element {1} should not be pass-through before ModuleDCE.
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 1));
EXPECT_TRUE(dce.Run(module.get()).ValueOrDie());
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 0));
// While tuple element {1} should now be pass-through after ModuleDCE.
EXPECT_TRUE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 1));
}
// Tests that a tuple element {1} used by condition computation (which appears
// dead in while.body{1} and at while.result{1}) propgates liveness of this
// tuple element to while.body{1} and at while.result{1}.
TEST_F(HloModuleDceTest, OneWhileWithTupleElementUsedByCond) {
auto module = ParseHloString(R"(
HloModule SimpleLoop
SimpleLoop.body {
loop_var.1 = (s32[], s32[]) parameter(0)
get-tuple-element.1 = s32[] get-tuple-element(loop_var.1), index=0
constant.1 = s32[] constant(1)
add = s32[] add(get-tuple-element.1, constant.1)
get-tuple-element.2 = s32[] get-tuple-element(loop_var.1), index=1
multiply = s32[] multiply(get-tuple-element.2, get-tuple-element.2)
ROOT tuple = (s32[], s32[]) tuple(add, multiply)
}
SimpleLoop.condition {
loop_var.2 = (s32[], s32[]) parameter(0)
get-tuple-element.3 = s32[] get-tuple-element(loop_var.2), index=1
constant.2 = s32[] constant(5)
ROOT less-than = pred[] less-than(get-tuple-element.3, constant.2)
}
ENTRY SimpleLoop {
constant.3 = s32[] constant(0)
constant.4 = s32[] constant(0)
tuple.1 = (s32[], s32[]) tuple(constant.3, constant.4)
while = (s32[], s32[]) while(tuple.1), condition=
SimpleLoop.condition, body=SimpleLoop.body
ROOT get-tuple-element.4 = s32[] get-tuple-element(while), index=0
})")
.ValueOrDie();
HloModuleDCE dce;
// While tuple element {1} should not be pass-through before ModuleDCE.
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 1));
EXPECT_FALSE(dce.Run(module.get()).ValueOrDie());
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 0));
// While tuple element {1} still be pass-through after ModuleDCE.
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 1));
}
// Tests that HloModuleDCE can remove a dead tuple element at index {1} between
// two dependent while loops.
TEST_F(HloModuleDceTest, TwoWhilesWithDeadTupleElement) {
auto module = ParseHloString(R"(
HloModule SimpleLoop
SimpleLoop.body0 {
loop_var.1 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.1 = s32[] get-tuple-element(loop_var.1), index=0
constant.1 = s32[] constant(1)
add = s32[] add(get-tuple-element.1, constant.1)
get-tuple-element.2 = s32[3]{0} get-tuple-element(loop_var.1), index=1
multiply = s32[3]{0} multiply(get-tuple-element.2, get-tuple-element.2)
ROOT tuple = (s32[], s32[3]{0}) tuple(add, multiply)
}
SimpleLoop.condition0 {
loop_var.2 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.3 = s32[] get-tuple-element(loop_var.2), index=0
constant.2 = s32[] constant(5)
ROOT less-than = pred[] less-than(get-tuple-element.3, constant.2)
}
SimpleLoop.body1 {
loop_var.3 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.4 = s32[] get-tuple-element(loop_var.3), index=0
constant.3 = s32[] constant(1)
add.1 = s32[] add(get-tuple-element.4, constant.3)
get-tuple-element.5 = s32[3]{0} get-tuple-element(loop_var.3), index=1
multiply.1 = s32[3]{0} multiply(get-tuple-element.5, get-tuple-element.5)
ROOT tuple.1 = (s32[], s32[3]{0}) tuple(add.1, multiply.1)
}
SimpleLoop.condition1 {
loop_var.4 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.6 = s32[] get-tuple-element(loop_var.4), index=0
constant.4 = s32[] constant(5)
ROOT less-than.1 = pred[] less-than(get-tuple-element.6, constant.4)
}
ENTRY SimpleLoop {
constant.5 = s32[] constant(0)
constant.6 = s32[3]{0} constant({0, 1, 2})
tuple.2 = (s32[], s32[3]{0}) tuple(constant.5, constant.6)
while.1 = (s32[], s32[3]{0}) while(tuple.2), condition=
SimpleLoop.condition0, body=SimpleLoop.body0
get-tuple-element.7 = s32[] get-tuple-element(while.1), index=0
tuple.3 = (s32[], s32[3]{0}) tuple(get-tuple-element.7, constant.6)
while.2 = (s32[], s32[3]{0}) while(tuple.3), condition=
SimpleLoop.condition1, body=SimpleLoop.body1
ROOT get-tuple-element.8 = s32[] get-tuple-element(while.2), index=0
})")
.ValueOrDie();
HloModuleDCE dce;
// Before HloModuleDCE while.1 and while.2 should not have pass-thru elements.
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.1", 1));
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.2", 1));
EXPECT_TRUE(dce.Run(module.get()).ValueOrDie());
// After HloModuleDCE while.1 and while.2 should have pass-thru elements,
// after being modified to pass through unused tuple element {1}.
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.1", 0));
EXPECT_TRUE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.1", 1));
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.2", 0));
EXPECT_TRUE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.2", 1));
}
// Tests that HloModuleDCE can remove a dead tuple element at while.1{0} and
// while.2{1}, between two dependent while loops.
TEST_F(HloModuleDceTest, TwoWhilesWithDeadTupleElementSwizzled) {
auto module = ParseHloString(R"(
HloModule SimpleLoop
SimpleLoop.body0 {
loop_var.1 = (s32[3]{0}, s32[]) parameter(0)
get-tuple-element.1 = s32[] get-tuple-element(loop_var.1), index=1
constant.1 = s32[] constant(1)
add = s32[] add(get-tuple-element.1, constant.1)
get-tuple-element.2 = s32[3]{0} get-tuple-element(loop_var.1), index=0
multiply = s32[3]{0} multiply(get-tuple-element.2, get-tuple-element.2)
ROOT tuple = (s32[3]{0}, s32[]) tuple(multiply, add)
}
SimpleLoop.condition0 {
loop_var.2 = (s32[3]{0}, s32[]) parameter(0)
get-tuple-element.3 = s32[] get-tuple-element(loop_var.2), index=1
constant.2 = s32[] constant(5)
ROOT less-than = pred[] less-than(get-tuple-element.3, constant.2)
}
SimpleLoop.body1 {
loop_var.3 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.4 = s32[] get-tuple-element(loop_var.3), index=0
constant.3 = s32[] constant(1)
add.1 = s32[] add(get-tuple-element.4, constant.3)
get-tuple-element.5 = s32[3]{0} get-tuple-element(loop_var.3), index=1
multiply.1 = s32[3]{0} multiply(get-tuple-element.5, get-tuple-element.5)
ROOT tuple.1 = (s32[], s32[3]{0}) tuple(add.1, multiply.1)
}
SimpleLoop.condition1 {
loop_var.4 = (s32[], s32[3]{0}) parameter(0)
get-tuple-element.6 = s32[] get-tuple-element(loop_var.4), index=0
constant.4 = s32[] constant(5)
ROOT less-than.1 = pred[] less-than(get-tuple-element.6, constant.4)
}
ENTRY SimpleLoop {
constant.5 = s32[] constant(0)
constant.6 = s32[3]{0} constant({0, 1, 2})
tuple.2 = (s32[3]{0}, s32[]) tuple(constant.6, constant.5)
while.1 = (s32[3]{0}, s32[]) while(tuple.2), condition=
SimpleLoop.condition0, body=SimpleLoop.body0
get-tuple-element.7 = s32[] get-tuple-element(while.1), index=1
tuple.3 = (s32[], s32[3]{0}) tuple(get-tuple-element.7, constant.6)
while.2 = (s32[], s32[3]{0}) while(tuple.3), condition=
SimpleLoop.condition1, body=SimpleLoop.body1
ROOT get-tuple-element.8 = s32[] get-tuple-element(while.2), index=0
})")
.ValueOrDie();
HloModuleDCE dce;
// Before HloModuleDCE while.1{0} and while.2{1} should not be pass-thru.
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.1", 0));
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.2", 1));
EXPECT_TRUE(dce.Run(module.get()).ValueOrDie());
// After HloModuleDCE while.1{0} and while.2{1} not be pass-thru elements.
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.1", 1));
EXPECT_TRUE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.1", 0));
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.2", 0));
EXPECT_TRUE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while.2", 1));
}
// Tests that a while whose body has outfeed operations is not DCE-ed.
TEST_F(HloModuleDceTest, WhileWithOutfeed) {
auto module = ParseHloString(R"(
HloModule OutfeedLoop
WhileBody {
body_param = (s32[]) parameter(0)
token0 = token[] after-all()
constant.2 = s32[] constant(2)
outfeed_tuple = (s32[]) outfeed(constant.2, token0)
get-tuple-element.1 = s32[] get-tuple-element(body_param), index=0
constant.1 = s32[] constant(1)
add = s32[] add(get-tuple-element.1, constant.1)
ROOT tuple = (s32[]) tuple(add)
}
WhileCondition {
cond_param = (s32[]) parameter(0)
get-tuple-element.3 = s32[] get-tuple-element(cond_param), index=0
constant.2 = s32[] constant(10)
ROOT less-than = pred[] less-than(get-tuple-element.3, constant.2)
}
ENTRY SimpleLoop {
constant.3 = s32[] constant(0)
tuple.1 = (s32[]) tuple(constant.3)
while = (s32[]) while(tuple.1), condition=WhileCondition,
body=WhileBody
ROOT rtuple = () tuple()
})")
.ValueOrDie();
HloModuleDCE dce;
EXPECT_FALSE(dce.Run(module.get()).ValueOrDie());
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 0));
}
// Tests that if a loop variable is not referenced outside of a kWhile, the loop
// variable changes are not elided within the loop body, if the condition
// computation uses them.
TEST_F(HloModuleDceTest, WhileWithOnlyLoopVariableBumping) {
auto module = ParseHloString(R"(
HloModule InfiniteLoop
WhileBody {
body_param = (s32[], s32[]) parameter(0)
get-tuple-element.1 = s32[] get-tuple-element(body_param), index=0
get-tuple-element.2 = s32[] get-tuple-element(body_param), index=1
constant.1 = s32[] constant(1)
add = s32[] add(get-tuple-element.1, constant.1)
ROOT tuple = (s32[], s32[]) tuple(add, get-tuple-element.2)
}
WhileCondition {
cond_param = (s32[], s32[]) parameter(0)
get-tuple-element.3 = s32[] get-tuple-element(cond_param), index=0
constant.2 = s32[] constant(10)
ROOT less-than = pred[] less-than(get-tuple-element.3, constant.2)
}
ENTRY SimpleLoop {
p0 = (s32[]) parameter(0)
get-tuple-element.5 = s32[] get-tuple-element(p0), index=0
constant.3 = s32[] constant(0)
tuple.1 = (s32[], s32[]) tuple(constant.3, get-tuple-element.5)
while = (s32[], s32[]) while(tuple.1), condition=WhileCondition,
body=WhileBody
ROOT get-tuple-element.4 = s32[] get-tuple-element(while), index=1
})")
.ValueOrDie();
HloModuleDCE dce;
EXPECT_FALSE(dce.Run(module.get()).ValueOrDie());
EXPECT_FALSE(WhileBodyHasPassThroughTupleElement(module->entry_computation(),
"while", 0));
}
} // namespace
} // namespace xla
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
9bd2ac1e36eec4d7f572a69a2f92aa09a8cece68 | 0bf7eeb15acf89888b5e2ca06afc59a562b708cb | /RDA5981_SDK_MbedOS515_V1.3.7/RDA5981_SDK_MbedOS515_V1.3.7/features/TARGET_RDA/FEATURE_SPIFBD/SPIFBlockDevice.cpp | 9e09c5ed50f667a78c4727236b5c30056de53468 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Trion/rda8955_Development | ee3acd3877467573a7eb4badf3aa160aacd7a40e | 8fec60e71a79f3eff110f6e75b2b00fc18ba1127 | refs/heads/master | 2023-03-21T17:05:36.094081 | 2019-08-30T11:10:36 | 2019-08-30T11:10:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,540 | cpp | /* mbed Microcontroller Library
* Copyright (c) 2016 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "SPIFBlockDevice.h"
// Read/write/erase sizes
#define SPIF_READ_SIZE 1
#define SPIF_PROG_SIZE 1
#define SPIF_SE_SIZE 4096
#define SPIF_TIMEOUT 10000
// Debug available
#define SPIF_DEBUG 0
// MX25R Series Register Command Table.
enum ops {
SPIF_NOP = 0x00, // No operation
SPIF_READ = 0x03, // Read data
SPIF_PROG = 0x02, // Program data
SPIF_SE = 0x20, // 4KB Sector Erase
SPIF_CE = 0xc7, // Chip Erase
SPIF_SFDP = 0x5a, // Read SFDP
SPIF_WREN = 0x06, // Write Enable
SPIF_WRDI = 0x04, // Write Disable
SPIF_RDSR = 0x05, // Read Status Register
SPIF_RDID = 0x9f, // Read Manufacturer and JDEC Device ID
};
// Status register from RDSR
// [- stuff -| wel | wip ]
// [- 6 -| 1 | 1 ]
#define SPIF_WEL 0x2
#define SPIF_WIP 0x1
SPIFBlockDevice::SPIFBlockDevice(
PinName mosi, PinName miso, PinName sclk, PinName cs, int freq)
: _spi(mosi, miso, sclk), _cs(cs), _size(0)
{
_cs = 1;
#ifdef TARGET_UNO_91H
_spi.format(8, 1);
#endif
_spi.frequency(freq);
}
int SPIFBlockDevice::init()
{
// Check for vendor specific hacks, these should move into more general
// handling when possible. RDID is not used to verify a device is attached.
uint8_t id[3];
_cmdread(SPIF_RDID, 0, 3, 0x0, id);
switch (id[0]) {
case 0xbf:
// SST devices come preset with block protection
// enabled for some regions, issue gbpu instruction to clear
_wren();
_cmdwrite(0x98, 0, 0, 0x0, NULL);
break;
}
// Check that device is doing ok
int err = _sync();
if (err) {
return BD_ERROR_DEVICE_ERROR;
}
// Check JEDEC serial flash discoverable parameters for device
// specific info
uint8_t header[16];
_cmdread(SPIF_SFDP, 4, 16, 0x0, header);
// Verify SFDP signature for sanity
// Also check that major/minor version is acceptable
if (!(memcmp(&header[0], "SFDP", 4) == 0 && header[5] == 1)) {
return BD_ERROR_DEVICE_ERROR;
}
// The SFDP spec indicates the standard table is always at offset 0
// in the parameter headers, we check just to be safe
if (!(header[8] == 0 && header[10] == 1)) {
return BD_ERROR_DEVICE_ERROR;
}
// Parameter table pointer, spi commands are BE, SFDP is LE,
// also sfdp command expects extra read wait byte
uint32_t table_addr = (
(header[14] << 24) |
(header[13] << 16) |
(header[12] << 8 ));
uint8_t table[8];
_cmdread(SPIF_SFDP, 4, 8, table_addr, table);
// Check erase size, currently only supports 4kbytes
// TODO support erase size != 4kbytes?
// TODO support other erase opcodes from the sector descriptions
if ((table[0] & 0x3) != 0x1 || table[1] != SPIF_SE) {
return BD_ERROR_DEVICE_ERROR;
}
// Check address size, currently only supports 3byte addresses
// TODO support address > 3bytes?
// TODO check for devices larger than 2Gbits?
if ((table[2] & 0x4) != 0 || (table[7] & 0x80) != 0) {
return BD_ERROR_DEVICE_ERROR;
}
// Get device density, stored as size in bits - 1
uint32_t density = (
(table[7] << 24) |
(table[6] << 16) |
(table[5] << 8 ) |
(table[4] << 0 ));
_size = (density/8) + 1;
return 0;
}
int SPIFBlockDevice::deinit()
{
// Latch write disable just to keep noise
// from changing the device
_cmdwrite(SPIF_WRDI, 0, 0, 0x0, NULL);
return 0;
}
void SPIFBlockDevice::_cmdread(
uint8_t op, uint32_t addrc, uint32_t retc,
uint32_t addr, uint8_t *rets)
{
_cs = 0;
_spi.write(op);
for (uint32_t i = 0; i < addrc; i++) {
_spi.write(0xff & (addr >> 8*(addrc-1 - i)));
}
for (uint32_t i = 0; i < retc; i++) {
rets[i] = _spi.write(0);
}
_cs = 1;
if (SPIF_DEBUG) {
printf("spif <- %02x", op);
for (uint32_t i = 0; i < addrc; i++) {
if (i < addrc) {
printf("%02lx", 0xff & (addr >> 8*(addrc-1 - i)));
} else {
printf(" ");
}
}
printf(" ");
for (uint32_t i = 0; i < 16 && i < retc; i++) {
printf("%02x", rets[i]);
}
if (retc > 16) {
printf("...");
}
printf("\n");
}
}
void SPIFBlockDevice::_cmdwrite(
uint8_t op, uint32_t addrc, uint32_t argc,
uint32_t addr, const uint8_t *args)
{
_cs = 0;
_spi.write(op);
for (uint32_t i = 0; i < addrc; i++) {
_spi.write(0xff & (addr >> 8*(addrc-1 - i)));
}
for (uint32_t i = 0; i < argc; i++) {
_spi.write(args[i]);
}
_cs = 1;
if (SPIF_DEBUG) {
printf("spif -> %02x", op);
for (uint32_t i = 0; i < addrc; i++) {
if (i < addrc) {
printf("%02lx", 0xff & (addr >> 8*(addrc-1 - i)));
} else {
printf(" ");
}
}
printf(" ");
for (uint32_t i = 0; i < 16 && i < argc; i++) {
printf("%02x", args[i]);
}
if (argc > 16) {
printf("...");
}
printf("\n");
}
}
int SPIFBlockDevice::_sync()
{
for (int i = 0; i < SPIF_TIMEOUT; i++) {
// Read status register until write not-in-progress
uint8_t status;
_cmdread(SPIF_RDSR, 0, 1, 0x0, &status);
// Check WIP bit
if (!(status & SPIF_WIP)) {
return 0;
}
wait_ms(1);
}
return BD_ERROR_DEVICE_ERROR;
}
int SPIFBlockDevice::_wren()
{
_cmdwrite(SPIF_WREN, 0, 0, 0x0, NULL);
for (int i = 0; i < SPIF_TIMEOUT; i++) {
// Read status register until write latch is enabled
uint8_t status;
_cmdread(SPIF_RDSR, 0, 1, 0x0, &status);
// Check WEL bit
if (status & SPIF_WEL) {
return 0;
}
wait_ms(1);
}
return BD_ERROR_DEVICE_ERROR;
}
int SPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
{
// Check the address and size fit onto the chip.
MBED_ASSERT(is_valid_read(addr, size));
_cmdread(SPIF_READ, 3, size, addr, static_cast<uint8_t *>(buffer));
return 0;
}
int SPIFBlockDevice::program(const void *buffer, bd_addr_t addr, bd_size_t size)
{
// Check the address and size fit onto the chip.
MBED_ASSERT(is_valid_program(addr, size));
while (size > 0) {
int err = _wren();
if (err) {
return err;
}
// Write up to 256 bytes a page
// TODO handle unaligned programs
uint32_t off = addr % 256;
uint32_t chunk = (off + size < 256) ? size : (256-off);
_cmdwrite(SPIF_PROG, 3, chunk, addr, static_cast<const uint8_t *>(buffer));
buffer = static_cast<const uint8_t*>(buffer) + chunk;
addr += chunk;
size -= chunk;
wait_ms(1);
err = _sync();
if (err) {
return err;
}
}
return 0;
}
int SPIFBlockDevice::erase(bd_addr_t addr, bd_size_t size)
{
// Check the address and size fit onto the chip.
MBED_ASSERT(is_valid_erase(addr, size));
while (size > 0) {
int err = _wren();
if (err) {
return err;
}
// Erase 4kbyte sectors
// TODO support other erase sizes?
uint32_t chunk = 4096;
_cmdwrite(SPIF_SE, 3, 0, addr, NULL);
addr += chunk;
size -= chunk;
err = _sync();
if (err) {
return err;
}
}
return 0;
}
bd_size_t SPIFBlockDevice::get_read_size() const
{
return SPIF_READ_SIZE;
}
bd_size_t SPIFBlockDevice::get_program_size() const
{
return SPIF_PROG_SIZE;
}
bd_size_t SPIFBlockDevice::get_erase_size() const
{
return SPIF_SE_SIZE;
}
bd_size_t SPIFBlockDevice::size() const
{
return _size;
}
| [
"2535418266@qq.com"
] | 2535418266@qq.com |
742a3e0d3b4a1f1b2812b38a89347194776b4bde | deb97bd0ef0d428da15e23648ff17a77b4869db5 | /Source/DetailCustomization/Customization.h | f4b96bafbbc6ee06c95cf8976a5210528b5d03c6 | [] | no_license | Shirty/DetailsCustomization | c2b3e3fe6ac81813494715da5938164725ba7bac | aacfa8227022e2391dd27727fa1c91c29660b8c4 | refs/heads/master | 2021-01-10T15:43:24.399578 | 2015-11-07T18:00:55 | 2015-11-07T18:00:55 | 45,713,674 | 4 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 369 | h | #include "SharedPointer.h"
#include "IDetailCustomization.h"
class FExampleCustomization : public IDetailCustomization
{
public:
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
static TSharedRef<IDetailCustomization> MakeInstance()
{
return MakeShareable(new FExampleCustomization());
}
TArray<TWeakObjectPtr<UObject>> Objects;
}; | [
"shirtykezrat@gmail.com"
] | shirtykezrat@gmail.com |
ef8e8c48c670f22d37e0d51d6562818e0f6bd79e | 606d031ab6468d98f698379b8ada16ce137fac61 | /sistemmodel.h | e898d2a5428a52c479256393eb4608cc31bb1290 | [
"MIT"
] | permissive | situkangsayur/MouseHandTrackingLK | 1fa32a8fff4c35aad68e172aa75a9dda8aad62cd | 52a9e2c125d77231e73b1b314834168533fc6fbf | refs/heads/master | 2020-08-30T14:37:55.936241 | 2019-08-08T09:09:00 | 2019-08-08T09:09:00 | 67,471,532 | 16 | 8 | null | null | null | null | UTF-8 | C++ | false | false | 2,005 | h | /**
* MouseHandTracking is an application to control mouse pointer of the computer with hand gesture via camera
* Copyright (C) 2011 Hendri Karisma
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* contact author at situkangsayur[at]gmail[dot]com
*/
#ifndef SISTEMMODEL_H
#define SISTEMMODEL_H
#include "iostream"
#include "listener.h"
#include "cv.h"
//#include "handtracking.h"
class SistemModel
{
private :
int ptX;
int ptY;
CvPoint point;
listener *listen;
IplImage *image;
IplImage *countur;
int state;
public:
SistemModel();
void setPtX(int ptX);
void setPtY(int ptY);
int getPtX();
int getPtY();
void setImage(IplImage *image);
void setCountur(IplImage *countur);
void setPoint(CvPoint points);
CvPoint getPoint();
void setState(int state);
int getState();
void setListener(listener *list);
void doHandTracking();
void doStopHandTracking();
void getHistogram();
void getContour();
void setSingkronisasiMouse();
void singkronisasiHis();
void loadCountur();
void tampilPetunjuk();
//void doTracking();
protected :
void fireOnStart();
void fireOnStop();
void fireOnHistogram();
void fireOnContour();
void fireOnSingkronisasi();
void fireOnTracking();
void fireOnLoadCountur();
void fireOnPetunjuk();
};
#endif // SISTEMMODEL_H
| [
"situkangsayur@gmail.com"
] | situkangsayur@gmail.com |
7ce4f1ec73fd8513014d6c4457ed589d053cf167 | b89223f2e4a3e47308dec4fb271e9639e65d6617 | /Symulator/src/citem.cpp | 6a10da5a2499c23d56ebfdfaa53d227fcbfaba18 | [] | no_license | matmarczuk/Symulator-farmy | 7613290d9be1d1bd145d61811ff56fea577e9404 | c22f67381b0f5f5f6cfbcf3baa1b9e5e749afea4 | refs/heads/master | 2020-03-18T13:22:04.343641 | 2018-12-06T12:36:40 | 2018-12-06T12:36:40 | 134,778,664 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 40 | cpp | #include "citem.h"
CItem::CItem()
{
}
| [
"marczuk@live.it"
] | marczuk@live.it |
53a36559697b915b676314374aad628e4e7788e6 | 807a3a72360f8bf166938ee9d6263210bf4de228 | /NetworkRecorder/src/NetworkRecorder.cpp | bed8c6ade1cff8800421c34c7786114a68aab3a9 | [] | no_license | alb3rtobr/logAnalyzer | 6b453ef22fa4c5b8f69a74f673396c8532dc410d | f43d6824cca6f6078257fa751886825d263b38b2 | refs/heads/master | 2021-04-18T20:06:32.057449 | 2018-03-25T21:49:46 | 2018-03-25T21:49:46 | 126,640,870 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 252 | cpp |
#include "NetworkRecorder.h"
const std::string OUTPUT_FILENAME="network_issues.log";
const std::vector<std::string> FILTERS={"timeout"};
NetworkRecorder::NetworkRecorder(const std::string& name)
:FileRecorderFilter(name,OUTPUT_FILENAME,FILTERS){
}
| [
"alb3rtobr@users.noreply.github.com"
] | alb3rtobr@users.noreply.github.com |
8b53383350e629e6c2fa749c0713c32a65f62896 | 7e9a73cf9e01b353945b53c91556536641a02137 | /td/telegram/BackgroundManager.cpp | 084142abda9c7735efae89b00b5fb70116539dcd | [
"JSON",
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | permissive | tdlib/td | a3036bf50a834f68337f8dc451165d4dd474b6e1 | 470c36ceef780ff6189bbd8e2f889941ca828247 | refs/heads/master | 2023-09-04T01:37:21.754421 | 2023-08-24T09:21:04 | 2023-08-24T09:21:04 | 115,883,761 | 6,323 | 1,497 | BSL-1.0 | 2023-09-04T19:10:38 | 2017-12-31T20:23:47 | C++ | UTF-8 | C++ | false | false | 57,785 | cpp | //
// Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2023
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#include "td/telegram/BackgroundManager.h"
#include "td/telegram/AccessRights.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/BackgroundType.hpp"
#include "td/telegram/ContactsManager.h"
#include "td/telegram/DialogId.h"
#include "td/telegram/Document.h"
#include "td/telegram/DocumentsManager.h"
#include "td/telegram/DocumentsManager.hpp"
#include "td/telegram/FileReferenceManager.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/files/FileType.h"
#include "td/telegram/Global.h"
#include "td/telegram/MessagesManager.h"
#include "td/telegram/PhotoFormat.h"
#include "td/telegram/Td.h"
#include "td/telegram/TdDb.h"
#include "td/telegram/telegram_api.h"
#include "td/telegram/UpdatesManager.h"
#include "td/db/SqliteKeyValueAsync.h"
#include "td/utils/algorithm.h"
#include "td/utils/buffer.h"
#include "td/utils/common.h"
#include "td/utils/format.h"
#include "td/utils/logging.h"
#include "td/utils/misc.h"
#include "td/utils/Slice.h"
#include "td/utils/SliceBuilder.h"
#include "td/utils/tl_helpers.h"
#include <algorithm>
namespace td {
class GetBackgroundQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
BackgroundId background_id_;
string background_name_;
public:
explicit GetBackgroundQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(BackgroundId background_id, const string &background_name,
telegram_api::object_ptr<telegram_api::InputWallPaper> &&input_wallpaper) {
background_id_ = background_id;
background_name_ = background_name;
send_query(G()->net_query_creator().create(telegram_api::account_getWallPaper(std::move(input_wallpaper))));
}
void on_result(BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_getWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error());
}
td_->background_manager_->on_get_background(background_id_, background_name_, result_ptr.move_as_ok(), true);
promise_.set_value(Unit());
}
void on_error(Status status) final {
LOG(INFO) << "Receive error for GetBackgroundQuery for " << background_id_ << "/" << background_name_ << ": "
<< status;
promise_.set_error(std::move(status));
}
};
class GetBackgroundsQuery final : public Td::ResultHandler {
Promise<telegram_api::object_ptr<telegram_api::account_WallPapers>> promise_;
public:
explicit GetBackgroundsQuery(Promise<telegram_api::object_ptr<telegram_api::account_WallPapers>> &&promise)
: promise_(std::move(promise)) {
}
void send() {
send_query(G()->net_query_creator().create(telegram_api::account_getWallPapers(0)));
}
void on_result(BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_getWallPapers>(packet);
if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error());
}
promise_.set_value(result_ptr.move_as_ok());
}
void on_error(Status status) final {
promise_.set_error(std::move(status));
}
};
class SetChatWallPaperQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
DialogId dialog_id_;
bool is_remove_ = false;
public:
explicit SetChatWallPaperQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(DialogId dialog_id, telegram_api::object_ptr<telegram_api::InputWallPaper> input_wallpaper,
telegram_api::object_ptr<telegram_api::wallPaperSettings> settings, MessageId old_message_id) {
dialog_id_ = dialog_id;
is_remove_ = input_wallpaper == nullptr && settings == nullptr;
if (is_remove_) {
td_->messages_manager_->on_update_dialog_background(dialog_id_, nullptr);
}
int32 flags = 0;
auto input_peer = td_->messages_manager_->get_input_peer(dialog_id, AccessRights::Write);
if (input_peer == nullptr) {
return on_error(Status::Error(400, "Can't access the chat"));
}
if (input_wallpaper != nullptr) {
flags |= telegram_api::messages_setChatWallPaper::WALLPAPER_MASK;
}
if (settings != nullptr) {
flags |= telegram_api::messages_setChatWallPaper::SETTINGS_MASK;
}
if (old_message_id.is_valid()) {
flags |= telegram_api::messages_setChatWallPaper::ID_MASK;
}
send_query(G()->net_query_creator().create(
telegram_api::messages_setChatWallPaper(flags, std::move(input_peer), std::move(input_wallpaper),
std::move(settings), old_message_id.get_server_message_id().get())));
}
void on_result(BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::messages_setChatWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error());
}
auto ptr = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for SetChatWallPaperQuery: " << to_string(ptr);
if (is_remove_) {
td_->messages_manager_->on_update_dialog_background(dialog_id_, nullptr);
}
td_->updates_manager_->on_get_updates(std::move(ptr), std::move(promise_));
}
void on_error(Status status) final {
if (is_remove_) {
td_->messages_manager_->reload_dialog_info_full(dialog_id_, "SetChatWallPaperQuery");
}
promise_.set_error(std::move(status));
}
};
class InstallBackgroundQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
public:
explicit InstallBackgroundQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(telegram_api::object_ptr<telegram_api::InputWallPaper> input_wallpaper, const BackgroundType &type) {
send_query(G()->net_query_creator().create(
telegram_api::account_installWallPaper(std::move(input_wallpaper), type.get_input_wallpaper_settings())));
}
void on_result(BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_installWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error());
}
LOG_IF(INFO, !result_ptr.ok()) << "Receive false from account.installWallPaper";
promise_.set_value(Unit());
}
void on_error(Status status) final {
promise_.set_error(std::move(status));
}
};
class UploadBackgroundQuery final : public Td::ResultHandler {
Promise<td_api::object_ptr<td_api::background>> promise_;
FileId file_id_;
BackgroundType type_;
DialogId dialog_id_;
bool for_dark_theme_;
public:
explicit UploadBackgroundQuery(Promise<td_api::object_ptr<td_api::background>> &&promise)
: promise_(std::move(promise)) {
}
void send(FileId file_id, tl_object_ptr<telegram_api::InputFile> &&input_file, const BackgroundType &type,
DialogId dialog_id, bool for_dark_theme) {
CHECK(input_file != nullptr);
file_id_ = file_id;
type_ = type;
dialog_id_ = dialog_id;
for_dark_theme_ = for_dark_theme;
int32 flags = 0;
if (dialog_id.is_valid()) {
flags |= telegram_api::account_uploadWallPaper::FOR_CHAT_MASK;
}
send_query(G()->net_query_creator().create(telegram_api::account_uploadWallPaper(
flags, false /*ignored*/, std::move(input_file), type_.get_mime_type(), type_.get_input_wallpaper_settings())));
}
void on_result(BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_uploadWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error());
}
td_->background_manager_->on_uploaded_background_file(file_id_, type_, dialog_id_, for_dark_theme_,
result_ptr.move_as_ok(), std::move(promise_));
}
void on_error(Status status) final {
CHECK(file_id_.is_valid());
auto bad_parts = FileManager::get_missing_file_parts(status);
if (!bad_parts.empty()) {
// TODO td_->background_manager_->on_upload_background_file_parts_missing(file_id_, std::move(bad_parts));
// return;
} else {
if (status.code() != 429 && status.code() < 500 && !G()->close_flag()) {
td_->file_manager_->delete_partial_remote_location(file_id_);
}
}
td_->file_manager_->cancel_upload(file_id_);
promise_.set_error(std::move(status));
}
};
class UnsaveBackgroundQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
public:
explicit UnsaveBackgroundQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send(telegram_api::object_ptr<telegram_api::InputWallPaper> input_wallpaper) {
send_query(G()->net_query_creator().create(telegram_api::account_saveWallPaper(
std::move(input_wallpaper), true, telegram_api::make_object<telegram_api::wallPaperSettings>())));
}
void on_result(BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_saveWallPaper>(packet);
if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error());
}
bool result = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for save background: " << result;
promise_.set_value(Unit());
}
void on_error(Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for save background: " << status;
}
promise_.set_error(std::move(status));
}
};
class ResetBackgroundsQuery final : public Td::ResultHandler {
Promise<Unit> promise_;
public:
explicit ResetBackgroundsQuery(Promise<Unit> &&promise) : promise_(std::move(promise)) {
}
void send() {
send_query(G()->net_query_creator().create(telegram_api::account_resetWallPapers()));
}
void on_result(BufferSlice packet) final {
auto result_ptr = fetch_result<telegram_api::account_resetWallPapers>(packet);
if (result_ptr.is_error()) {
return on_error(result_ptr.move_as_error());
}
bool result = result_ptr.move_as_ok();
LOG(INFO) << "Receive result for reset backgrounds: " << result;
promise_.set_value(Unit());
}
void on_error(Status status) final {
if (!G()->is_expected_error(status)) {
LOG(ERROR) << "Receive error for reset backgrounds: " << status;
}
promise_.set_error(std::move(status));
}
};
class BackgroundManager::UploadBackgroundFileCallback final : public FileManager::UploadCallback {
public:
void on_upload_ok(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) final {
send_closure_later(G()->background_manager(), &BackgroundManager::on_upload_background_file, file_id,
std::move(input_file));
}
void on_upload_encrypted_ok(FileId file_id, tl_object_ptr<telegram_api::InputEncryptedFile> input_file) final {
UNREACHABLE();
}
void on_upload_secure_ok(FileId file_id, tl_object_ptr<telegram_api::InputSecureFile> input_file) final {
UNREACHABLE();
}
void on_upload_error(FileId file_id, Status error) final {
send_closure_later(G()->background_manager(), &BackgroundManager::on_upload_background_file_error, file_id,
std::move(error));
}
};
BackgroundManager::BackgroundManager(Td *td, ActorShared<> parent) : td_(td), parent_(std::move(parent)) {
upload_background_file_callback_ = std::make_shared<UploadBackgroundFileCallback>();
}
template <class StorerT>
void BackgroundManager::Background::store(StorerT &storer) const {
bool has_file_id = file_id.is_valid();
BEGIN_STORE_FLAGS();
STORE_FLAG(is_creator);
STORE_FLAG(is_default);
STORE_FLAG(is_dark);
STORE_FLAG(has_file_id);
STORE_FLAG(has_new_local_id);
END_STORE_FLAGS();
td::store(id, storer);
td::store(access_hash, storer);
td::store(name, storer);
if (has_file_id) {
storer.context()->td().get_actor_unsafe()->documents_manager_->store_document(file_id, storer);
}
td::store(type, storer);
}
template <class ParserT>
void BackgroundManager::Background::parse(ParserT &parser) {
bool has_file_id;
BEGIN_PARSE_FLAGS();
PARSE_FLAG(is_creator);
PARSE_FLAG(is_default);
PARSE_FLAG(is_dark);
PARSE_FLAG(has_file_id);
PARSE_FLAG(has_new_local_id);
END_PARSE_FLAGS();
td::parse(id, parser);
td::parse(access_hash, parser);
td::parse(name, parser);
if (has_file_id) {
file_id = parser.context()->td().get_actor_unsafe()->documents_manager_->parse_document(parser);
} else {
file_id = FileId();
}
td::parse(type, parser);
}
class BackgroundManager::BackgroundLogEvent {
public:
Background background_;
BackgroundType set_type_;
template <class StorerT>
void store(StorerT &storer) const {
td::store(background_, storer);
td::store(set_type_, storer);
}
template <class ParserT>
void parse(ParserT &parser) {
td::parse(background_, parser);
td::parse(set_type_, parser);
}
};
class BackgroundManager::BackgroundsLogEvent {
public:
vector<Background> backgrounds_;
template <class StorerT>
void store(StorerT &storer) const {
td::store(backgrounds_, storer);
}
template <class ParserT>
void parse(ParserT &parser) {
td::parse(backgrounds_, parser);
}
};
void BackgroundManager::start_up() {
max_local_background_id_ = BackgroundId(to_integer<int64>(G()->td_db()->get_binlog_pmc()->get("max_bg_id")));
// first parse all log events and fix max_local_background_id_ value
bool has_selected_background[2] = {false, false};
BackgroundLogEvent selected_background_log_event[2];
for (int i = 0; i < 2; i++) {
bool for_dark_theme = i != 0;
auto log_event_string = G()->td_db()->get_binlog_pmc()->get(get_background_database_key(for_dark_theme));
if (!log_event_string.empty()) {
has_selected_background[i] = true;
log_event_parse(selected_background_log_event[i], log_event_string).ensure();
const Background &background = selected_background_log_event[i].background_;
if (background.has_new_local_id && background.id.is_local() && !background.type.has_file() &&
background.id.get() > max_local_background_id_.get()) {
set_max_local_background_id(background.id);
}
}
}
for (int i = 0; i < 2; i++) {
bool for_dark_theme = i != 0;
auto log_event_string = G()->td_db()->get_binlog_pmc()->get(get_local_backgrounds_database_key(for_dark_theme));
if (!log_event_string.empty()) {
BackgroundsLogEvent log_event;
log_event_parse(log_event, log_event_string).ensure();
for (const auto &background : log_event.backgrounds_) {
CHECK(background.has_new_local_id);
CHECK(background.id.is_valid());
CHECK(background.id.is_local());
CHECK(!background.type.has_file());
CHECK(!background.file_id.is_valid());
if (background.id.get() > max_local_background_id_.get()) {
set_max_local_background_id(background.id);
}
add_background(background, true);
local_background_ids_[for_dark_theme].push_back(background.id);
}
}
}
// then add selected backgrounds fixing their ID
for (int i = 0; i < 2; i++) {
bool for_dark_theme = i != 0;
if (has_selected_background[i]) {
Background &background = selected_background_log_event[i].background_;
bool need_resave = false;
if (!background.has_new_local_id && !background.type.has_file()) {
background.has_new_local_id = true;
background.id = get_next_local_background_id();
need_resave = true;
}
CHECK(background.id.is_valid());
if (background.file_id.is_valid() != background.type.has_file()) {
LOG(ERROR) << "Failed to load " << background.id << " of " << background.type;
need_resave = true;
} else {
set_background_id_[for_dark_theme] = background.id;
set_background_type_[for_dark_theme] = selected_background_log_event[i].set_type_;
add_background(background, false);
}
if (need_resave) {
save_background_id(for_dark_theme);
}
}
send_update_selected_background(for_dark_theme);
}
}
void BackgroundManager::tear_down() {
parent_.reset();
}
void BackgroundManager::store_background(BackgroundId background_id, LogEventStorerCalcLength &storer) {
const auto *background = get_background(background_id);
CHECK(background != nullptr);
store(*background, storer);
}
void BackgroundManager::store_background(BackgroundId background_id, LogEventStorerUnsafe &storer) {
const auto *background = get_background(background_id);
CHECK(background != nullptr);
store(*background, storer);
}
void BackgroundManager::parse_background(BackgroundId &background_id, LogEventParser &parser) {
Background background;
parse(background, parser);
CHECK(background.has_new_local_id);
if (background.file_id.is_valid() != background.type.has_file() || !background.id.is_valid()) {
parser.set_error(PSTRING() << "Failed to load " << background.id);
background_id = BackgroundId();
return;
}
if (background.id.is_local() && !background.type.has_file() && background.id.get() > max_local_background_id_.get()) {
set_max_local_background_id(background.id);
}
background_id = background.id;
add_background(background, false);
}
void BackgroundManager::get_backgrounds(bool for_dark_theme,
Promise<td_api::object_ptr<td_api::backgrounds>> &&promise) {
pending_get_backgrounds_queries_.emplace_back(for_dark_theme, std::move(promise));
if (pending_get_backgrounds_queries_.size() == 1) {
auto request_promise = PromiseCreator::lambda(
[actor_id = actor_id(this)](Result<telegram_api::object_ptr<telegram_api::account_WallPapers>> result) {
send_closure(actor_id, &BackgroundManager::on_get_backgrounds, std::move(result));
});
td_->create_handler<GetBackgroundsQuery>(std::move(request_promise))->send();
}
}
void BackgroundManager::reload_background_from_server(
BackgroundId background_id, const string &background_name,
telegram_api::object_ptr<telegram_api::InputWallPaper> &&input_wallpaper, Promise<Unit> &&promise) const {
TRY_STATUS_PROMISE(promise, G()->close_status());
td_->create_handler<GetBackgroundQuery>(std::move(promise))
->send(background_id, background_name, std::move(input_wallpaper));
}
void BackgroundManager::reload_background(BackgroundId background_id, int64 access_hash, Promise<Unit> &&promise) {
reload_background_from_server(
background_id, string(),
telegram_api::make_object<telegram_api::inputWallPaper>(background_id.get(), access_hash), std::move(promise));
}
std::pair<BackgroundId, BackgroundType> BackgroundManager::search_background(const string &name,
Promise<Unit> &&promise) {
auto params_pos = name.find('?');
string slug = params_pos >= name.size() ? name : name.substr(0, params_pos);
auto it = name_to_background_id_.find(slug);
if (it != name_to_background_id_.end()) {
CHECK(!BackgroundType::is_background_name_local(slug));
const auto *background = get_background(it->second);
CHECK(background != nullptr);
promise.set_value(Unit());
BackgroundType type = background->type;
type.apply_parameters_from_link(name);
return {it->second, std::move(type)};
}
if (slug.empty()) {
promise.set_error(Status::Error(400, "Background name must be non-empty"));
return {};
}
if (BackgroundType::is_background_name_local(slug)) {
auto r_type = BackgroundType::get_local_background_type(name);
if (r_type.is_error()) {
promise.set_error(r_type.move_as_error());
return {};
}
auto background_id = add_local_background(r_type.ok());
promise.set_value(Unit());
return {background_id, r_type.ok()};
}
if (G()->use_sqlite_pmc() && loaded_from_database_backgrounds_.count(slug) == 0) {
auto &queries = being_loaded_from_database_backgrounds_[slug];
queries.push_back(std::move(promise));
if (queries.size() == 1) {
LOG(INFO) << "Trying to load background " << slug << " from database";
G()->td_db()->get_sqlite_pmc()->get(
get_background_name_database_key(slug), PromiseCreator::lambda([slug](string value) mutable {
send_closure(G()->background_manager(), &BackgroundManager::on_load_background_from_database,
std::move(slug), std::move(value));
}));
}
return {};
}
reload_background_from_server(BackgroundId(), slug, telegram_api::make_object<telegram_api::inputWallPaperSlug>(slug),
std::move(promise));
return {};
}
void BackgroundManager::on_load_background_from_database(string name, string value) {
if (G()->close_flag()) {
return;
}
auto promises_it = being_loaded_from_database_backgrounds_.find(name);
CHECK(promises_it != being_loaded_from_database_backgrounds_.end());
auto promises = std::move(promises_it->second);
CHECK(!promises.empty());
being_loaded_from_database_backgrounds_.erase(promises_it);
loaded_from_database_backgrounds_.insert(name);
CHECK(!BackgroundType::is_background_name_local(name));
if (name_to_background_id_.count(name) == 0 && !value.empty()) {
LOG(INFO) << "Successfully loaded background " << name << " of size " << value.size() << " from database";
Background background;
auto status = log_event_parse(background, value);
if (status.is_error() || !background.type.has_file() || !background.file_id.is_valid() ||
!background.id.is_valid()) {
LOG(ERROR) << "Can't load background " << name << ": " << status << ' ' << format::as_hex_dump<4>(Slice(value));
} else {
if (background.name != name) {
LOG(ERROR) << "Expected background " << name << ", but received " << background.name;
name_to_background_id_.emplace(std::move(name), background.id);
}
add_background(background, false);
}
}
set_promises(promises);
}
td_api::object_ptr<td_api::updateSelectedBackground> BackgroundManager::get_update_selected_background_object(
bool for_dark_theme) const {
return td_api::make_object<td_api::updateSelectedBackground>(
for_dark_theme,
get_background_object(set_background_id_[for_dark_theme], for_dark_theme, &set_background_type_[for_dark_theme]));
}
void BackgroundManager::send_update_selected_background(bool for_dark_theme) const {
send_closure(G()->td(), &Td::send_update, get_update_selected_background_object(for_dark_theme));
}
Result<FileId> BackgroundManager::prepare_input_file(const tl_object_ptr<td_api::InputFile> &input_file) {
TRY_RESULT(file_id, td_->file_manager_->get_input_file_id(FileType::Background, input_file, {}, false, false));
FileView file_view = td_->file_manager_->get_file_view(file_id);
if (file_view.is_encrypted()) {
return Status::Error(400, "Can't use encrypted file");
}
if (!file_view.has_local_location() && !file_view.has_generate_location()) {
return Status::Error(400, "Need local or generate location to upload background");
}
return std::move(file_id);
}
void BackgroundManager::set_max_local_background_id(BackgroundId background_id) {
CHECK(background_id.is_local());
CHECK(background_id.get() > max_local_background_id_.get());
max_local_background_id_ = background_id;
G()->td_db()->get_binlog_pmc()->set("max_bg_id", to_string(max_local_background_id_.get()));
}
BackgroundId BackgroundManager::get_next_local_background_id() {
set_max_local_background_id(BackgroundId(max_local_background_id_.get() + 1));
return max_local_background_id_;
}
BackgroundId BackgroundManager::add_local_background(const BackgroundType &type) {
Background background;
background.id = get_next_local_background_id();
background.is_creator = true;
background.is_default = false;
background.is_dark = type.is_dark();
background.type = type;
background.name = type.get_link();
add_background(background, true);
return background.id;
}
void BackgroundManager::set_background(const td_api::InputBackground *input_background,
const td_api::BackgroundType *background_type, bool for_dark_theme,
Promise<td_api::object_ptr<td_api::background>> &&promise) {
TRY_RESULT_PROMISE(promise, type, BackgroundType::get_background_type(background_type, 0));
if (input_background == nullptr) {
if (background_type == nullptr) {
set_background_id(BackgroundId(), BackgroundType(), for_dark_theme);
return promise.set_value(nullptr);
}
if (type.has_file()) {
return promise.set_error(Status::Error(400, "Input background must be non-empty for the background type"));
}
auto background_id = add_local_background(type);
set_background_id(background_id, type, for_dark_theme);
local_background_ids_[for_dark_theme].insert(local_background_ids_[for_dark_theme].begin(), background_id);
save_local_backgrounds(for_dark_theme);
return promise.set_value(get_background_object(background_id, for_dark_theme, nullptr));
}
switch (input_background->get_id()) {
case td_api::inputBackgroundLocal::ID: {
if (!type.has_file()) {
return promise.set_error(Status::Error(400, "Can't specify local file for the background type"));
}
CHECK(background_type != nullptr);
auto background_local = static_cast<const td_api::inputBackgroundLocal *>(input_background);
TRY_RESULT_PROMISE(promise, file_id, prepare_input_file(background_local->background_));
LOG(INFO) << "Receive file " << file_id << " for input background";
CHECK(file_id.is_valid());
auto it = file_id_to_background_id_.find(file_id);
if (it != file_id_to_background_id_.end()) {
return set_background(it->second, type, for_dark_theme, std::move(promise));
}
upload_background_file(file_id, type, DialogId(), for_dark_theme, std::move(promise));
break;
}
case td_api::inputBackgroundRemote::ID: {
auto background_remote = static_cast<const td_api::inputBackgroundRemote *>(input_background);
return set_background(BackgroundId(background_remote->background_id_), std::move(type), for_dark_theme,
std::move(promise));
}
case td_api::inputBackgroundPrevious::ID:
return promise.set_error(Status::Error(400, "Can't use a previous background"));
default:
UNREACHABLE();
}
}
void BackgroundManager::set_dialog_background(DialogId dialog_id, const td_api::InputBackground *input_background,
const td_api::BackgroundType *background_type, int32 dark_theme_dimming,
Promise<Unit> &&promise) {
if (!td_->messages_manager_->have_dialog_force(dialog_id, "set_dialog_background")) {
return promise.set_error(Status::Error(400, "Chat not found"));
}
if (!td_->messages_manager_->have_input_peer(dialog_id, AccessRights::Write)) {
return promise.set_error(Status::Error(400, "Can't access the chat"));
}
switch (dialog_id.get_type()) {
case DialogType::User:
break;
case DialogType::Chat:
case DialogType::Channel:
return promise.set_error(Status::Error(400, "Can't change background in the chat"));
case DialogType::SecretChat: {
auto user_id = td_->contacts_manager_->get_secret_chat_user_id(dialog_id.get_secret_chat_id());
if (!user_id.is_valid()) {
return promise.set_error(Status::Error(400, "Can't access the user"));
}
dialog_id = DialogId(user_id);
break;
}
case DialogType::None:
default:
UNREACHABLE();
}
TRY_RESULT_PROMISE(promise, type, BackgroundType::get_background_type(background_type, dark_theme_dimming));
if (input_background == nullptr) {
if (type.has_file()) {
return promise.set_error(Status::Error(400, "Input background must be non-empty for the background type"));
}
if (background_type == nullptr) {
return send_set_dialog_background_query(dialog_id, nullptr, nullptr, MessageId(), std::move(promise));
} else {
return send_set_dialog_background_query(dialog_id,
telegram_api::make_object<telegram_api::inputWallPaperNoFile>(0),
type.get_input_wallpaper_settings(), MessageId(), std::move(promise));
}
}
switch (input_background->get_id()) {
case td_api::inputBackgroundLocal::ID: {
if (!type.has_file()) {
return promise.set_error(Status::Error(400, "Can't specify local file for the background type"));
}
CHECK(background_type != nullptr);
auto background_local = static_cast<const td_api::inputBackgroundLocal *>(input_background);
TRY_RESULT_PROMISE(promise, file_id, prepare_input_file(background_local->background_));
LOG(INFO) << "Receive file " << file_id << " for input background";
CHECK(file_id.is_valid());
auto it = file_id_to_background_id_.find(file_id);
if (it != file_id_to_background_id_.end()) {
return do_set_dialog_background(dialog_id, it->second, type, std::move(promise));
}
auto upload_promise =
PromiseCreator::lambda([actor_id = actor_id(this), dialog_id, type, promise = std::move(promise)](
Result<td_api::object_ptr<td_api::background>> &&result) mutable {
if (result.is_error()) {
return promise.set_error(result.move_as_error());
}
send_closure(actor_id, &BackgroundManager::do_set_dialog_background, dialog_id,
BackgroundId(result.ok()->id_), std::move(type), std::move(promise));
});
upload_background_file(file_id, type, dialog_id, false, std::move(upload_promise));
break;
}
case td_api::inputBackgroundRemote::ID: {
auto background_remote = static_cast<const td_api::inputBackgroundRemote *>(input_background);
return do_set_dialog_background(dialog_id, BackgroundId(background_remote->background_id_), std::move(type),
std::move(promise));
}
case td_api::inputBackgroundPrevious::ID: {
auto background_previous = static_cast<const td_api::inputBackgroundPrevious *>(input_background);
MessageId message_id(background_previous->message_id_);
if (!message_id.is_valid() || !message_id.is_server()) {
return promise.set_error(Status::Error(400, "Invalid message identifier specified"));
}
return send_set_dialog_background_query(
dialog_id, nullptr, background_type == nullptr ? nullptr : type.get_input_wallpaper_settings(), message_id,
std::move(promise));
}
default:
UNREACHABLE();
}
}
void BackgroundManager::do_set_dialog_background(DialogId dialog_id, BackgroundId background_id, BackgroundType type,
Promise<Unit> &&promise) {
TRY_STATUS_PROMISE(promise, G()->close_status());
const auto *background = get_background(background_id);
if (background == nullptr) {
return promise.set_error(Status::Error(400, "Background to set not found"));
}
if (!type.has_file()) {
type = background->type;
} else if (!background->type.has_equal_type(type)) {
return promise.set_error(Status::Error(400, "Background type mismatch"));
}
send_set_dialog_background_query(
dialog_id, telegram_api::make_object<telegram_api::inputWallPaper>(background_id.get(), background->access_hash),
type.get_input_wallpaper_settings(), MessageId(), std::move(promise));
}
void BackgroundManager::send_set_dialog_background_query(
DialogId dialog_id, telegram_api::object_ptr<telegram_api::InputWallPaper> input_wallpaper,
telegram_api::object_ptr<telegram_api::wallPaperSettings> settings, MessageId old_message_id,
Promise<Unit> &&promise) {
td_->create_handler<SetChatWallPaperQuery>(std::move(promise))
->send(dialog_id, std::move(input_wallpaper), std::move(settings), old_message_id);
}
void BackgroundManager::set_background(BackgroundId background_id, BackgroundType type, bool for_dark_theme,
Promise<td_api::object_ptr<td_api::background>> &&promise) {
LOG(INFO) << "Set " << background_id << " with " << type;
const auto *background = get_background(background_id);
if (background == nullptr) {
return promise.set_error(Status::Error(400, "Background to set not found"));
}
if (!type.has_file()) {
type = background->type;
} else if (!background->type.has_equal_type(type)) {
return promise.set_error(Status::Error(400, "Background type mismatch"));
}
if (set_background_id_[for_dark_theme] == background_id && set_background_type_[for_dark_theme] == type) {
return promise.set_value(get_background_object(background_id, for_dark_theme, nullptr));
}
LOG(INFO) << "Install " << background_id << " with " << type;
if (!type.has_file()) {
set_background_id(background_id, type, for_dark_theme);
return promise.set_value(get_background_object(background_id, for_dark_theme, nullptr));
}
auto query_promise = PromiseCreator::lambda([actor_id = actor_id(this), background_id, type, for_dark_theme,
promise = std::move(promise)](Result<Unit> &&result) mutable {
send_closure(actor_id, &BackgroundManager::on_installed_background, background_id, type, for_dark_theme,
std::move(result), std::move(promise));
});
td_->create_handler<InstallBackgroundQuery>(std::move(query_promise))
->send(telegram_api::make_object<telegram_api::inputWallPaper>(background_id.get(), background->access_hash),
type);
}
void BackgroundManager::on_installed_background(BackgroundId background_id, BackgroundType type, bool for_dark_theme,
Result<Unit> &&result,
Promise<td_api::object_ptr<td_api::background>> &&promise) {
if (result.is_error()) {
return promise.set_error(result.move_as_error());
}
size_t i;
for (i = 0; i < installed_backgrounds_.size(); i++) {
if (installed_backgrounds_[i].first == background_id) {
installed_backgrounds_[i].second = type;
break;
}
}
if (i == installed_backgrounds_.size()) {
installed_backgrounds_.insert(installed_backgrounds_.begin(), {background_id, type});
}
set_background_id(background_id, type, for_dark_theme);
promise.set_value(get_background_object(background_id, for_dark_theme, nullptr));
}
string BackgroundManager::get_background_database_key(bool for_dark_theme) {
return for_dark_theme ? "bgd" : "bg";
}
string BackgroundManager::get_local_backgrounds_database_key(bool for_dark_theme) {
return for_dark_theme ? "bgsd" : "bgs";
}
void BackgroundManager::save_background_id(bool for_dark_theme) {
string key = get_background_database_key(for_dark_theme);
auto background_id = set_background_id_[for_dark_theme];
if (background_id.is_valid()) {
const Background *background = get_background(background_id);
CHECK(background != nullptr);
BackgroundLogEvent log_event{*background, set_background_type_[for_dark_theme]};
G()->td_db()->get_binlog_pmc()->set(key, log_event_store(log_event).as_slice().str());
} else {
G()->td_db()->get_binlog_pmc()->erase(key);
}
}
void BackgroundManager::set_background_id(BackgroundId background_id, const BackgroundType &type, bool for_dark_theme) {
if (background_id == set_background_id_[for_dark_theme] && set_background_type_[for_dark_theme] == type) {
return;
}
set_background_id_[for_dark_theme] = background_id;
set_background_type_[for_dark_theme] = type;
save_background_id(for_dark_theme);
send_update_selected_background(for_dark_theme);
}
void BackgroundManager::save_local_backgrounds(bool for_dark_theme) {
string key = get_local_backgrounds_database_key(for_dark_theme);
auto &background_ids = local_background_ids_[for_dark_theme];
const size_t MAX_LOCAL_BACKGROUNDS = 100;
while (background_ids.size() > MAX_LOCAL_BACKGROUNDS) {
background_ids.pop_back();
}
if (!background_ids.empty()) {
BackgroundsLogEvent log_event;
log_event.backgrounds_ = transform(background_ids, [&](BackgroundId background_id) {
const Background *background = get_background(background_id);
CHECK(background != nullptr);
return *background;
});
G()->td_db()->get_binlog_pmc()->set(key, log_event_store(log_event).as_slice().str());
} else {
G()->td_db()->get_binlog_pmc()->erase(key);
}
}
void BackgroundManager::upload_background_file(FileId file_id, const BackgroundType &type, DialogId dialog_id,
bool for_dark_theme,
Promise<td_api::object_ptr<td_api::background>> &&promise) {
auto upload_file_id = td_->file_manager_->dup_file_id(file_id, "upload_background_file");
bool is_inserted = being_uploaded_files_
.emplace(upload_file_id, UploadedFileInfo(type, dialog_id, for_dark_theme, std::move(promise)))
.second;
CHECK(is_inserted);
LOG(INFO) << "Ask to upload background file " << upload_file_id;
td_->file_manager_->upload(upload_file_id, upload_background_file_callback_, 1, 0);
}
void BackgroundManager::on_upload_background_file(FileId file_id, tl_object_ptr<telegram_api::InputFile> input_file) {
LOG(INFO) << "Background file " << file_id << " has been uploaded";
auto it = being_uploaded_files_.find(file_id);
CHECK(it != being_uploaded_files_.end());
auto type = it->second.type_;
auto dialog_id = it->second.dialog_id_;
auto for_dark_theme = it->second.for_dark_theme_;
auto promise = std::move(it->second.promise_);
being_uploaded_files_.erase(it);
do_upload_background_file(file_id, type, dialog_id, for_dark_theme, std::move(input_file), std::move(promise));
}
void BackgroundManager::on_upload_background_file_error(FileId file_id, Status status) {
if (G()->close_flag()) {
// do not fail upload if closing
return;
}
LOG(WARNING) << "Background file " << file_id << " has upload error " << status;
CHECK(status.is_error());
auto it = being_uploaded_files_.find(file_id);
CHECK(it != being_uploaded_files_.end());
auto promise = std::move(it->second.promise_);
being_uploaded_files_.erase(it);
promise.set_error(Status::Error(status.code() > 0 ? status.code() : 500,
status.message())); // TODO CHECK that status has always a code
}
void BackgroundManager::do_upload_background_file(FileId file_id, const BackgroundType &type, DialogId dialog_id,
bool for_dark_theme,
tl_object_ptr<telegram_api::InputFile> &&input_file,
Promise<td_api::object_ptr<td_api::background>> &&promise) {
TRY_STATUS_PROMISE(promise, G()->close_status());
if (input_file == nullptr) {
FileView file_view = td_->file_manager_->get_file_view(file_id);
file_id = file_view.get_main_file_id();
auto it = file_id_to_background_id_.find(file_id);
if (it != file_id_to_background_id_.end()) {
if (dialog_id.is_valid()) {
return promise.set_value(get_background_object(it->second, for_dark_theme, nullptr));
}
return set_background(it->second, type, for_dark_theme, std::move(promise));
}
return promise.set_error(Status::Error(500, "Failed to reupload background"));
}
td_->create_handler<UploadBackgroundQuery>(std::move(promise))
->send(file_id, std::move(input_file), type, dialog_id, for_dark_theme);
}
void BackgroundManager::on_uploaded_background_file(FileId file_id, const BackgroundType &type, DialogId dialog_id,
bool for_dark_theme,
telegram_api::object_ptr<telegram_api::WallPaper> wallpaper,
Promise<td_api::object_ptr<td_api::background>> &&promise) {
CHECK(wallpaper != nullptr);
auto added_background = on_get_background(BackgroundId(), string(), std::move(wallpaper), true);
auto background_id = added_background.first;
if (!background_id.is_valid()) {
td_->file_manager_->cancel_upload(file_id);
return promise.set_error(Status::Error(500, "Receive wrong uploaded background"));
}
LOG_IF(ERROR, added_background.second != type)
<< "Type of uploaded background has changed from " << type << " to " << added_background.second;
const auto *background = get_background(background_id);
CHECK(background != nullptr);
if (!background->file_id.is_valid()) {
td_->file_manager_->cancel_upload(file_id);
return promise.set_error(Status::Error(500, "Receive wrong uploaded background without file"));
}
LOG_STATUS(td_->file_manager_->merge(background->file_id, file_id));
if (!dialog_id.is_valid()) {
set_background_id(background_id, type, for_dark_theme);
}
promise.set_value(get_background_object(background_id, for_dark_theme, nullptr));
}
void BackgroundManager::remove_background(BackgroundId background_id, Promise<Unit> &&promise) {
const auto *background = get_background(background_id);
if (background == nullptr) {
return promise.set_error(Status::Error(400, "Background not found"));
}
auto query_promise = PromiseCreator::lambda(
[actor_id = actor_id(this), background_id, promise = std::move(promise)](Result<Unit> &&result) mutable {
send_closure(actor_id, &BackgroundManager::on_removed_background, background_id, std::move(result),
std::move(promise));
});
if (!background->type.has_file()) {
if (!background->id.is_local()) {
return td_->create_handler<UnsaveBackgroundQuery>(std::move(query_promise))
->send(telegram_api::make_object<telegram_api::inputWallPaperNoFile>(background_id.get()));
} else {
return query_promise.set_value(Unit());
}
}
td_->create_handler<UnsaveBackgroundQuery>(std::move(query_promise))
->send(telegram_api::make_object<telegram_api::inputWallPaper>(background_id.get(), background->access_hash));
}
void BackgroundManager::on_removed_background(BackgroundId background_id, Result<Unit> &&result,
Promise<Unit> &&promise) {
if (result.is_error()) {
return promise.set_error(result.move_as_error());
}
td::remove_if(installed_backgrounds_,
[background_id](const auto &background) { return background.first == background_id; });
if (background_id == set_background_id_[0]) {
set_background_id(BackgroundId(), BackgroundType(), false);
}
if (background_id == set_background_id_[1]) {
set_background_id(BackgroundId(), BackgroundType(), true);
}
if (background_id.is_local()) {
if (td::remove(local_background_ids_[0], background_id)) {
save_local_backgrounds(false);
}
if (td::remove(local_background_ids_[1], background_id)) {
save_local_backgrounds(true);
}
}
promise.set_value(Unit());
}
void BackgroundManager::reset_backgrounds(Promise<Unit> &&promise) {
auto query_promise =
PromiseCreator::lambda([actor_id = actor_id(this), promise = std::move(promise)](Result<Unit> &&result) mutable {
send_closure(actor_id, &BackgroundManager::on_reset_background, std::move(result), std::move(promise));
});
td_->create_handler<ResetBackgroundsQuery>(std::move(query_promise))->send();
}
void BackgroundManager::on_reset_background(Result<Unit> &&result, Promise<Unit> &&promise) {
if (result.is_error()) {
return promise.set_error(result.move_as_error());
}
installed_backgrounds_.clear();
set_background_id(BackgroundId(), BackgroundType(), false);
set_background_id(BackgroundId(), BackgroundType(), true);
if (!local_background_ids_[0].empty()) {
local_background_ids_[0].clear();
save_local_backgrounds(false);
}
if (!local_background_ids_[1].empty()) {
local_background_ids_[1].clear();
save_local_backgrounds(true);
}
promise.set_value(Unit());
}
void BackgroundManager::add_background(const Background &background, bool replace_type) {
LOG(INFO) << "Add " << background.id << " of " << background.type;
CHECK(background.id.is_valid());
auto &result_ptr = backgrounds_[background.id];
if (result_ptr == nullptr) {
result_ptr = make_unique<Background>();
}
auto *result = result_ptr.get();
FileSourceId file_source_id;
auto it = background_id_to_file_source_id_.find(background.id);
if (it != background_id_to_file_source_id_.end()) {
CHECK(!result->id.is_valid());
file_source_id = it->second.second;
background_id_to_file_source_id_.erase(it);
}
if (!result->id.is_valid()) {
result->id = background.id;
result->type = background.type;
} else {
CHECK(result->id == background.id);
if (replace_type) {
result->type = background.type;
}
}
result->access_hash = background.access_hash;
result->is_creator = background.is_creator;
result->is_default = background.is_default;
result->is_dark = background.is_dark;
if (result->name != background.name) {
if (!result->name.empty()) {
LOG(ERROR) << "Background name has changed from " << result->name << " to " << background.name;
// keep correspondence from previous name to background ID
// it will not harm, because background names can't be reassigned
// name_to_background_id_.erase(result->name);
}
result->name = background.name;
if (!BackgroundType::is_background_name_local(result->name)) {
name_to_background_id_.emplace(result->name, result->id);
loaded_from_database_backgrounds_.erase(result->name); // don't needed anymore
}
}
if (result->file_id != background.file_id) {
if (result->file_id.is_valid()) {
if (!background.file_id.is_valid() ||
td_->file_manager_->get_file_view(result->file_id).get_main_file_id() !=
td_->file_manager_->get_file_view(background.file_id).get_main_file_id()) {
LOG(ERROR) << "Background file has changed from " << result->file_id << " to " << background.file_id;
file_id_to_background_id_.erase(result->file_id);
result->file_source_id = FileSourceId();
}
CHECK(!file_source_id.is_valid());
}
if (file_source_id.is_valid()) {
result->file_source_id = file_source_id;
}
result->file_id = background.file_id;
if (result->file_id.is_valid()) {
if (!result->file_source_id.is_valid()) {
result->file_source_id =
td_->file_reference_manager_->create_background_file_source(result->id, result->access_hash);
}
for (auto file_id : Document(Document::Type::General, result->file_id).get_file_ids(td_)) {
td_->file_manager_->add_file_source(file_id, result->file_source_id);
}
file_id_to_background_id_.emplace(result->file_id, result->id);
}
} else {
// if file_source_id is valid, then this is a new background with result->file_id == FileId()
// then background.file_id == FileId(), then this is a fill background, which can't have file_source_id
CHECK(!file_source_id.is_valid());
}
}
BackgroundManager::Background *BackgroundManager::get_background_ref(BackgroundId background_id) {
auto p = backgrounds_.find(background_id);
if (p == backgrounds_.end()) {
return nullptr;
} else {
return p->second.get();
}
}
const BackgroundManager::Background *BackgroundManager::get_background(BackgroundId background_id) const {
auto p = backgrounds_.find(background_id);
if (p == backgrounds_.end()) {
return nullptr;
} else {
return p->second.get();
}
}
string BackgroundManager::get_background_name_database_key(const string &name) {
return PSTRING() << "bgn" << name;
}
std::pair<BackgroundId, BackgroundType> BackgroundManager::on_get_background(
BackgroundId expected_background_id, const string &expected_background_name,
telegram_api::object_ptr<telegram_api::WallPaper> wallpaper_ptr, bool replace_type) {
if (wallpaper_ptr == nullptr) {
return {};
}
if (wallpaper_ptr->get_id() == telegram_api::wallPaperNoFile::ID) {
auto wallpaper = move_tl_object_as<telegram_api::wallPaperNoFile>(wallpaper_ptr);
if (wallpaper->settings_ == nullptr) {
LOG(ERROR) << "Receive wallPaperNoFile without settings: " << to_string(wallpaper);
return {};
}
auto background_id = BackgroundId(wallpaper->id_);
if (background_id.is_local()) {
LOG(ERROR) << "Receive " << to_string(wallpaper);
return {};
}
if (!background_id.is_valid()) {
background_id = get_next_local_background_id();
}
Background background;
background.id = background_id;
background.is_creator = false;
background.is_default = wallpaper->default_;
background.is_dark = wallpaper->dark_;
background.type = BackgroundType(true, false, std::move(wallpaper->settings_));
background.name = background.type.get_link();
add_background(background, replace_type);
return {background_id, background.type};
}
auto wallpaper = move_tl_object_as<telegram_api::wallPaper>(wallpaper_ptr);
auto background_id = BackgroundId(wallpaper->id_);
if (!background_id.is_valid() || background_id.is_local() ||
BackgroundType::is_background_name_local(wallpaper->slug_)) {
LOG(ERROR) << "Receive " << to_string(wallpaper);
return {};
}
if (expected_background_id.is_valid() && background_id != expected_background_id) {
LOG(ERROR) << "Expected " << expected_background_id << ", but receive " << to_string(wallpaper);
}
int32 document_id = wallpaper->document_->get_id();
if (document_id == telegram_api::documentEmpty::ID) {
LOG(ERROR) << "Receive " << to_string(wallpaper);
return {};
}
CHECK(document_id == telegram_api::document::ID);
bool is_pattern = wallpaper->pattern_;
Document document = td_->documents_manager_->on_get_document(
telegram_api::move_object_as<telegram_api::document>(wallpaper->document_), DialogId(), nullptr,
Document::Type::General, is_pattern ? DocumentsManager::Subtype::Pattern : DocumentsManager::Subtype::Background);
if (!document.file_id.is_valid()) {
LOG(ERROR) << "Receive wrong document in " << to_string(wallpaper);
return {};
}
CHECK(document.type == Document::Type::General); // guaranteed by is_background parameter to on_get_document
Background background;
background.id = background_id;
background.access_hash = wallpaper->access_hash_;
background.is_creator = wallpaper->creator_;
background.is_default = wallpaper->default_;
background.is_dark = wallpaper->dark_;
background.type = BackgroundType(false, is_pattern, std::move(wallpaper->settings_));
background.name = std::move(wallpaper->slug_);
background.file_id = document.file_id;
add_background(background, replace_type);
if (!expected_background_name.empty() && background.name != expected_background_name) {
LOG(ERROR) << "Expected background " << expected_background_name << ", but receive " << background.name;
name_to_background_id_.emplace(expected_background_name, background_id);
}
if (G()->use_sqlite_pmc()) {
LOG(INFO) << "Save " << background_id << " to database with name " << background.name;
CHECK(!BackgroundType::is_background_name_local(background.name));
G()->td_db()->get_sqlite_pmc()->set(get_background_name_database_key(background.name),
log_event_store(background).as_slice().str(), Auto());
}
return {background_id, background.type};
}
void BackgroundManager::on_get_backgrounds(Result<telegram_api::object_ptr<telegram_api::account_WallPapers>> result) {
auto promises = std::move(pending_get_backgrounds_queries_);
CHECK(!promises.empty());
reset_to_empty(pending_get_backgrounds_queries_);
if (result.is_error()) {
// do not clear installed_backgrounds_
auto error = result.move_as_error();
for (auto &promise : promises) {
promise.second.set_error(error.clone());
}
return;
}
auto wallpapers_ptr = result.move_as_ok();
LOG(INFO) << "Receive " << to_string(wallpapers_ptr);
if (wallpapers_ptr->get_id() == telegram_api::account_wallPapersNotModified::ID) {
for (auto &promise : promises) {
promise.second.set_value(get_backgrounds_object(promise.first));
}
return;
}
installed_backgrounds_.clear();
auto wallpapers = telegram_api::move_object_as<telegram_api::account_wallPapers>(wallpapers_ptr);
for (auto &wallpaper : wallpapers->wallpapers_) {
auto background = on_get_background(BackgroundId(), string(), std::move(wallpaper), false);
if (background.first.is_valid()) {
installed_backgrounds_.push_back(std::move(background));
}
}
for (auto &promise : promises) {
promise.second.set_value(get_backgrounds_object(promise.first));
}
}
td_api::object_ptr<td_api::background> BackgroundManager::get_background_object(BackgroundId background_id,
bool for_dark_theme,
const BackgroundType *type) const {
const auto *background = get_background(background_id);
if (background == nullptr) {
return nullptr;
}
if (type == nullptr) {
type = &background->type;
// first check another set_background_id to get correct type if both backgrounds are the same
if (background_id == set_background_id_[1 - static_cast<int>(for_dark_theme)]) {
type = &set_background_type_[1 - static_cast<int>(for_dark_theme)];
}
if (background_id == set_background_id_[for_dark_theme]) {
type = &set_background_type_[for_dark_theme];
}
}
return td_api::make_object<td_api::background>(
background->id.get(), background->is_default, background->is_dark, background->name,
td_->documents_manager_->get_document_object(background->file_id, PhotoFormat::Png),
type->get_background_type_object());
}
td_api::object_ptr<td_api::backgrounds> BackgroundManager::get_backgrounds_object(bool for_dark_theme) const {
auto backgrounds = transform(installed_backgrounds_,
[this, for_dark_theme](const std::pair<BackgroundId, BackgroundType> &background) {
return get_background_object(background.first, for_dark_theme, &background.second);
});
auto background_id = set_background_id_[for_dark_theme];
bool have_background = false;
for (const auto &background : installed_backgrounds_) {
if (background_id == background.first) {
have_background = true;
break;
}
}
if (background_id.is_valid() && !have_background) {
backgrounds.push_back(get_background_object(background_id, for_dark_theme, nullptr));
}
for (auto local_background_id : local_background_ids_[for_dark_theme]) {
if (local_background_id != background_id) {
backgrounds.push_back(get_background_object(local_background_id, for_dark_theme, nullptr));
}
}
std::stable_sort(backgrounds.begin(), backgrounds.end(),
[background_id, for_dark_theme](const td_api::object_ptr<td_api::background> &lhs,
const td_api::object_ptr<td_api::background> &rhs) {
auto get_order = [background_id,
for_dark_theme](const td_api::object_ptr<td_api::background> &background) {
if (background->id_ == background_id.get()) {
return 0;
}
int theme_score = background->is_dark_ == for_dark_theme ? 0 : 1;
int local_score = BackgroundId(background->id_).is_local() ? 0 : 2;
return 1 + local_score + theme_score;
};
return get_order(lhs) < get_order(rhs);
});
return td_api::make_object<td_api::backgrounds>(std::move(backgrounds));
}
FileSourceId BackgroundManager::get_background_file_source_id(BackgroundId background_id, int64 access_hash) {
if (!background_id.is_valid()) {
return FileSourceId();
}
Background *background = get_background_ref(background_id);
if (background != nullptr) {
if (!background->file_source_id.is_valid()) {
background->file_source_id =
td_->file_reference_manager_->create_background_file_source(background_id, background->access_hash);
}
return background->file_source_id;
}
auto &result = background_id_to_file_source_id_[background_id];
if (result.first == 0) {
result.first = access_hash;
}
if (!result.second.is_valid()) {
result.second = td_->file_reference_manager_->create_background_file_source(background_id, result.first);
}
return result.second;
}
void BackgroundManager::get_current_state(vector<td_api::object_ptr<td_api::Update>> &updates) const {
if (td_->auth_manager_->is_bot()) {
return;
}
updates.push_back(get_update_selected_background_object(false));
updates.push_back(get_update_selected_background_object(true));
}
} // namespace td
| [
"levlam@telegram.org"
] | levlam@telegram.org |
a2e75bcebbb53282d221a9e56d94d7775f0fafde | d94330a71001e79db8230841a8f2da342af73d52 | /graph/articulation_point_easy_version.cpp | 1d73d78cbf1d9f4897b726b2eb8460aa8cb78906 | [] | no_license | wxr031/DSA | ef2d7f7c697f5bc5428acfab4cc6fff5111d0140 | 680daaa39d5b00e196c8dcb0a0b1b27e236a0db2 | refs/heads/master | 2018-08-28T04:45:26.211811 | 2018-06-03T11:46:43 | 2018-06-03T11:46:43 | 110,069,612 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,281 | cpp | #include <iostream>
#include <vector>
#include <list>
using namespace std;
class graph {
int vertex;
list<int> *adj;
void ap_aux(int, int, int&, vector<bool> &, vector<int> &, vector<int> &);
public:
graph(int);
void add_edge(int, int);
void print_all_articulation_points();
};
graph::graph(int v) {
vertex = v;
adj = new list<int>[v];
}
void graph::add_edge(int source, int dest) {
adj[source].push_back(dest);
adj[dest].push_back(source);
}
void graph::ap_aux(int curr, int parent, int &assign, vector<bool> &visited,
vector<int> &dfs_num, vector<int> &min_num) {
visited[curr] = true;
dfs_num[curr] = min_num[curr] = ++assign;
bool is_ap = false;
cout << "$" << curr << "$" << endl;
for(list<int>::iterator it = adj[curr].begin(); it != adj[curr].end(); ++it) {
if(*it != parent) {
if(!visited[*it]) {
ap_aux(*it, curr, assign, visited, dfs_num, min_num);
if(min_num[*it] > dfs_num[curr])
cout << curr << " ";
}
min_num[curr] = min(min_num[curr], min_num[*it]);
}
}
}
void graph::print_all_articulation_points() {
int assign = 0;
vector<bool> visited(vertex, false);
vector<int> dfs_num(vertex);
vector<int> min_num(vertex);
visited[0] = true;
dfs_num[0] = min_num[vertex] = ++assign;
int child = 0;
for(list<int>::iterator it = adj[0].begin(); it != adj[0].end(); ++it) {
if(!visited[*it]) {
ap_aux(*it, 0, assign, visited, dfs_num, min_num);
++child;
}
}
if(child > 1)
cout << "0" << endl;
else cout << endl;
}
int main() {
cout << "\nArticulation points in first graph \n";
graph g1(8);
g1.add_edge(1, 0);
g1.add_edge(0, 2);
g1.add_edge(3, 1);
g1.add_edge(1, 4);
g1.add_edge(2, 4);
g1.add_edge(2, 5);
g1.add_edge(4, 7);
g1.add_edge(6, 4);
g1.print_all_articulation_points();
cout << "\nArticulation points in second graph \n";
graph g2(4);
g2.add_edge(0, 1);
g2.add_edge(1, 2);
g2.add_edge(2, 3);
g2.print_all_articulation_points();
cout << "\nArticulation points in third graph \n";
graph g3(7);
g3.add_edge(0, 1);
g3.add_edge(1, 2);
g3.add_edge(2, 0);
g3.add_edge(1, 3);
g3.add_edge(1, 4);
g3.add_edge(1, 6);
g3.add_edge(3, 5);
g3.add_edge(4, 5);
g3.print_all_articulation_points();
}
| [
"wxr031@gmail.com"
] | wxr031@gmail.com |
3d7428e76c32e1edab36f3d5fd65afd3ef953da4 | f3e813535f75fb461e2306f1ad18596ac233e758 | /odb_api_bundle-0.17.6-Source/eckit/src/eckit/container/CacheLRU.h | 75a7c6dc3b3f7980895c0b2f708b66f4a29e8956 | [
"Apache-2.0"
] | permissive | vyesubabu/metview | 47f9de3eb5f1bf418e513ed306aa2279635b79c7 | 74c2b9bc28673001fd02e00194e92c53a897fb62 | refs/heads/master | 2021-05-17T16:42:41.697859 | 2018-04-09T15:08:19 | 2018-04-09T15:08:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,520 | h | /*
* (C) Copyright 1996-2017 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation nor
* does it submit to any jurisdiction.
*/
/// @author Tiago Quintino
/// @date Dec 2015
#ifndef eckit_container_CacheLRU_h
#define eckit_container_CacheLRU_h
#include <iosfwd>
#include <map>
#include <list>
#include "eckit/exception/Exceptions.h"
#include "eckit/log/CodeLocation.h"
#include "eckit/memory/NonCopyable.h"
namespace eckit {
//----------------------------------------------------------------------------------------------------------------------
template< typename K, typename V >
class CacheLRU : private NonCopyable {
public: // types
typedef K key_type;
typedef V value_type;
struct Entry {
key_type key_;
value_type value_;
Entry(const key_type& k, const value_type& v) : key_(k), value_(v) {}
friend std::ostream& operator<<(std::ostream& s,const Entry& e) {
s << "key=" << e.key_;
return s;
}
};
typedef Entry entry_type;
typedef std::list<entry_type> storage_type;
typedef typename storage_type::iterator storage_iterator;
typedef std::map<key_type,storage_iterator> map_type;
typedef void (*purge_handler_type)(key_type&, value_type&);
public: // methods
CacheLRU(size_t capacity, purge_handler_type purge = 0);
~CacheLRU();
/// Inserts an entry into the cache, overwrites if already exists
/// @returns true if a key already existed
bool insert(const key_type& key, const value_type& value);
/// Accesses a key that must already exist
/// @throws OutOfRange exception is key not in cache
value_type access(const key_type& key);
/// Extracts the key from the cache without purging
/// @pre Key must exist in cache
/// @throws OutOfRange exception if key not in cache
value_type extract(const key_type& key);
/// Remove a key-value pair from the cache
/// No effect if key is not present
///
/// @return true if removed
bool remove(const key_type& key);
/// @returns true if the key exists in the cache
bool exists(const key_type& key) const;
/// Clears all entries in the cache
void clear();
/// @returns the maximum size of the cache
size_t capacity() const { return capacity_; }
/// @returns the current (used) size of the cache
size_t size() const { return storage_.size(); }
/// resizes the cache capacity
void capacity( size_t size );
void print(std::ostream& os) const;
friend std::ostream& operator<<(std::ostream& s,const CacheLRU& p) { p.print(s); return s; }
private: // methods
void erase(typename map_type::iterator itr);
void trim();
void moveToFront(typename map_type::iterator itr);
value_type& valueFrom(typename map_type::iterator itr) const { return itr->second->value_; }
void purge(key_type& key, value_type& value) const;
private: // members
storage_type storage_;
map_type map_;
size_t capacity_;
purge_handler_type purge_;
};
//----------------------------------------------------------------------------------------------------------------------
} // namespace eckit
#include "CacheLRU.cc"
#endif
| [
"Xin.L.Zhang@noaa.gov"
] | Xin.L.Zhang@noaa.gov |
6fc76e53e69f94eba0e7310886360cf618c49acb | be56b1241df7d49370310796b510654859d60c8e | /算法竞赛入门/3个数的全排列.cpp | 3ec938413047063d92ea406f768b67d95cba53a6 | [] | no_license | NCU-ZW/The-First-Project | 967888c732f1896521505d2f8a4b17e96b4f89b9 | fc5656ae5f97746ced5d943662dea148dbaf89e8 | refs/heads/master | 2021-01-22T00:58:31.130451 | 2015-04-21T05:41:11 | 2015-04-21T05:41:11 | 34,261,944 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 675 | cpp | #include <stdio.h>
#define N 3
int a[N];
void perm(int);
void print();
void swap(int, int);
int main()
{
int i;
for(i = 0; i<N; i++)
a[i] = i + 97;
perm(0);
}
void perm(int offset)
{
int i;
if(offset == N-1)
{
print();
return;
}
for(i = offset; i < N; i++)
{
swap(i, offset);
perm(offset + 1);
swap(i, offset);
}
}
void print()
{
int i;
for(i = 0; i < N; i++)
printf(" %c ",a[i]);
printf("\n");
}
void swap(int i, int offset)
{
int temp;
temp = a[offset];
a[offset] = a[i];
a[i] = temp;
}
| [
"zhoudongxu929@163.com"
] | zhoudongxu929@163.com |
a9e7491a476b2c14d661998bc226af0574eaddc2 | 89d7c404af1a1ac6f86a67a61f412b316e82ca78 | /zoom_sdk_c_sharp_wrap/meeting_sharing_dotnet_wrap.h | c19bb7a5544eaac1512143027480a68520383684 | [] | no_license | wuscier/Classroom | 1def2ced6b71a11be5c4d2bff6d378ffe1a39170 | 492130fca9d133cf0ab080f8731881c7995986bb | refs/heads/master | 2021-09-04T19:06:25.068155 | 2018-01-21T13:40:51 | 2018-01-21T13:40:51 | 115,183,676 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,413 | h | #pragma once
using namespace System;
#include "zoom_sdk_dotnet_wrap_def.h"
namespace ZOOM_SDK_DOTNET_WRAP {
public enum class SharingStatus : int
{
Sharing_Self_Send_Begin,
Sharing_Self_Send_End,
Sharing_Other_Share_Begin,
Sharing_Other_Share_End,
Sharing_View_Other_Sharing,
Sharing_Pause,
Sharing_Resume,
};
public value class ViewableShareSource sealed
{
public:
unsigned int userid;
bool isShowingInFirstView;
bool isShowingInSecondView;
bool isCanBeRemoteControl;
};
public enum class ShareType : int
{
SHARE_TYPE_UNKNOWN, //unknown
SHARE_TYPE_AS, //application share
SHARE_TYPE_DS, //desktop share
SHARE_TYPE_WB, //whiteboard share
SHARE_TYPE_AIRHOST, //mobile device from PC
SHARE_TYPE_CAMERA, //camera share
SHARE_TYPE_DATA, //data share
};
public value class ShareInfo sealed
{
public:
ShareType eShareType; //share type, refer to ShareType
HWNDDotNet hwndSharedApp; //handle of sharing application or whiteboard, it is valid only when eShareType is SHARE_TYPE_AS or SHARE_TYPE_WB
String^ monitorID; //monitor id of sharing desktop, it is valid only when eShareType is SHARE_TYPE_DS
};
public delegate void onSharingStatus(SharingStatus status, unsigned int userId);
public delegate void onLockShareStatus(bool bLocked);
public delegate void onShareContentNotification(ShareInfo^ shareInfo);
public interface class IMeetingShareControllerDotNetWrap
{
public:
SDKError StartAppShare(HWNDDotNet hwndSharedApp);
SDKError StartMonitorShare(String^ monitorID);
SDKError StartAirPlayShare();
SDKError StopShare();
SDKError BlockWindowFromScreenshare(bool bBlock, HWNDDotNet hWnd);
SDKError LockShare();
SDKError UnlockShare();
SDKError SwitchToFitWindowModeWhenViewShare(SDKViewType type);
SDKError SwitchToOriginalSizeModeWhenViewShare(SDKViewType type);
SDKError PauseCurrentSharing();
SDKError ResumeCurrentSharing();
array <unsigned int >^ GetViewableShareSourceList();
SDKError GetViewabltShareSourceByUserID(unsigned int userid, ViewableShareSource^ shareSource);
SDKError ViewShare(unsigned int userid, SDKViewType type);
SDKError ShowShareOptionDialog();
bool CanStartShare();
SDKError IsShareLocked(bool^ bLocked);
void Add_CB_onSharingStatus(onSharingStatus^ cb);
void Add_CB_onLockShareStatus(onLockShareStatus^ cb);
void Add_CB_onShareContentNotification(onShareContentNotification^ cb);
};
public ref class CMeetingShareControllerDotNetWrap sealed : public IMeetingShareControllerDotNetWrap
{
public:
static property CMeetingShareControllerDotNetWrap^ Instance
{
CMeetingShareControllerDotNetWrap^ get() { return m_Instance; }
}
void BindEvent();
virtual SDKError StartAppShare(HWNDDotNet hwndSharedApp);
virtual SDKError StartMonitorShare(String^ monitorID);
virtual SDKError StartAirPlayShare();
virtual SDKError StopShare();
virtual SDKError BlockWindowFromScreenshare(bool bBlock, HWNDDotNet hWnd);
virtual SDKError LockShare();
virtual SDKError UnlockShare();
virtual SDKError SwitchToFitWindowModeWhenViewShare(SDKViewType type);
virtual SDKError SwitchToOriginalSizeModeWhenViewShare(SDKViewType type);
virtual SDKError PauseCurrentSharing();
virtual SDKError ResumeCurrentSharing();
virtual array <unsigned int >^ GetViewableShareSourceList();
virtual SDKError GetViewabltShareSourceByUserID(unsigned int userid, ViewableShareSource^ shareSource);
virtual SDKError ViewShare(unsigned int userid, SDKViewType type);
virtual SDKError ShowShareOptionDialog();
virtual bool CanStartShare();
virtual SDKError IsShareLocked(bool^ bLocked);
virtual void Add_CB_onSharingStatus(onSharingStatus^ cb)
{
event_onSharingStatus += cb;
}
virtual void Add_CB_onLockShareStatus(onLockShareStatus^ cb)
{
event_onLockShareStatus += cb;
}
virtual void Add_CB_onShareContentNotification(onShareContentNotification^ cb)
{
event_onShareContentNotification += cb;
}
void ProcSharingStatus(SharingStatus status, unsigned int userId);
void ProcLockShareStatus(bool bLocked);
void ProcShareContentNotification(ShareInfo^ shareInfo);
private:
event onSharingStatus^ event_onSharingStatus;
event onLockShareStatus^ event_onLockShareStatus;
event onShareContentNotification^ event_onShareContentNotification;
static CMeetingShareControllerDotNetWrap^ m_Instance = gcnew CMeetingShareControllerDotNetWrap;
};
} | [
"wuxu@shengtao.net"
] | wuxu@shengtao.net |
f2375e35f765118721eaccc60bc4d3468dc5ffc9 | 947a4b48f592700a06cb332758ef8406a3808809 | /banking_system_step8_v0.8/AccountHandler.cpp | 1f98c4f523911ca974a0d455c34b10f86348403a | [] | no_license | 95kim1/banking-system | b5da741a6aa4f11164c326ff1d76da01e9f23da3 | 78d79969840310a04e97f3a771efea2ef670e0e7 | refs/heads/main | 2023-08-01T11:36:57.642701 | 2021-09-06T14:01:56 | 2021-09-06T14:01:56 | 401,977,902 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 5,015 | cpp | /*
* 파일이름: AccountHandler.cpp
* 작성자: sh.kim
* 업데이트 정보: [2021, 09, 04] 파일버전 0.8
*/
#include "CommonDeclare.h"
#include "AccountHandler.h"
#include "Account.h"
#include "NormalAccount.h"
#include "HighCreditAccount.h"
/*
* 클래스명: AccountHandler
* 유형: Control class
*/
// 생성자
AccountHandler::AccountHandler(const int capacity)
: mAccArr(capacity)
{}
// 메뉴화면 출력
void AccountHandler::ShowMenu()
{
std::cout << " ---------Menu--------" << std::endl;
std::cout << " 1. 계좌개설" << std::endl;
std::cout << " 2. 입 금" << std::endl;
std::cout << " 3. 출 금" << std::endl;
std::cout << " 4. 전체 잔액조회" << std::endl;
std::cout << " 5. 프로그램 종료" << std::endl;
std::cout << " ---------------------" << std::endl;
}
// 타이틀 출력함수
void AccountHandler::DisplayTitle(const char* title)
{
std::cout << std::endl;
std::cout << "--------------------------" << std::endl;
std::cout << " " << title << std::endl;
std::cout << "--------------------------" << std::endl << std::endl;
}
// 모든 계좌 조회
void AccountHandler::ShowAllInfo()
{
int i;
int len = mAccArr.GetSize();
DisplayTitle("전체 잔액조회 시작");
for (i = 0; i < len; i++)
{
mAccArr[i]->ShowInfo();
std::cout << std::endl;
}
DisplayTitle("전체 잔액조회 종료");
}
// 메뉴 선택하기
int AccountHandler::ChooseMenu()
{
int menuNum;
while(1)
{
INPUT_FUNC("# 선택: ", menuNum);
if (1 <= menuNum && menuNum <= 5)
{
break;
}
std::cout << "@ 잘못된 번호 입니다." << std::endl;
}
return menuNum;
}
// 해당 계좌가 저장된 배열 인덱스 찾기
int AccountHandler::FindAccountIdx(int id)
{
int i;
int len = mAccArr.GetSize();
for (i = 0; i < len; i++)
{
if (id == mAccArr[i]->GetId())
{
return i;
}
}
return -1;
}
// 보통 계좌 개설
void AccountHandler::CreateNormalAccount()
{
int id;
unsigned long long balance;
int rate;
int index;
char name[NAME_LEN];
INPUT_FUNC("# 계좌번호: ", id);
index = FindAccountIdx(id);
if (index >= 0)
{
std::cout << std::endl << "@ 이미 개설한 계좌번호입니다." << std::endl;
DisplayTitle("계좌개설 종료");
return;
}
INPUT_FUNC("# 이 름: ", name);
INPUT_FUNC("# 잔 액: ", balance);
INPUT_FUNC("# 이자율(%): ", rate);
mAccArr.PushBack(new NormalAccount(id, balance, name, rate));
}
// 신용 계좌 개설
void AccountHandler::CreateHighCreditAccount()
{
int id;
unsigned long long balance;
int rate;
int level;
int index;
char name[NAME_LEN];
INPUT_FUNC("# 계좌번호: ", id);
index = FindAccountIdx(id);
if (index >= 0)
{
std::cout << std::endl << "@ 이미 개설한 계좌번호입니다." << std::endl;
DisplayTitle("계좌개설 종료");
return;
}
INPUT_FUNC("# 이 름: ", name);
INPUT_FUNC("# 잔 액: ", balance);
INPUT_FUNC("# 이자율(%): ", rate);
INPUT_FUNC("# 신용등급(1toA 2toB 3toC): ", level);
mAccArr.PushBack(new HighCreditAccount(id, balance, name, rate, level));
}
// 계좌개설 메인함수
void AccountHandler::CreateAccount()
{
int type;
DisplayTitle("계좌개설 시작");
std::cout << "[계좌종류선택]" << std::endl;
std::cout << "1.보통예금계좌 2.신용신뢰계좌" << std::endl;
INPUT_FUNC("# 선택: ", type);
std::cout << std::endl;
if (type == NORMAL)
{
std::cout << "[보통계좌 개설]" << std::endl;
CreateNormalAccount();
}
else
{
std::cout << "[신용신뢰계좌 개설]" << std::endl;
CreateHighCreditAccount();
}
DisplayTitle("계좌개설 종료");
}
// 입금하기 메인함수
void AccountHandler::DepositeMoney()
{
int id;
unsigned long long money;
int index;
DisplayTitle("입금하기 시작");
INPUT_FUNC("#계좌번호: ", id);
index = FindAccountIdx(id);
if (index == -1)
{
std::cout << std::endl << "@ 등록되지 않은 계좌번호입니다." << std::endl;
DisplayTitle("입금하기 종료");
return;
}
INPUT_FUNC("# 입금할 금액: ", money);
mAccArr[index]->DepositeMoney(money);
std::cout << std::endl << "@ 입금 완료." << std::endl;
DisplayTitle("입금하기 종료");
}
// 출금하기 메인함수
void AccountHandler::WithdrawMoney()
{
int id;
unsigned long long money;
int index;
DisplayTitle("출금하기 시작");
INPUT_FUNC("# 계좌번호: ", id);
index = FindAccountIdx(id);
if (index == -1)
{
std::cout << std::endl << "@ 등록되지 않은 계좌번호입니다." << std::endl;
DisplayTitle("출금하기 종료");
return;
}
INPUT_FUNC("# 출금할 금액: ", money);
if (money > mAccArr[index]->GetBalance())
{
std::cout << std::endl << "@ 잔액 부족." << std::endl;
}
else
{
mAccArr[index]->WithdrawMoney(money);
std::cout << std::endl << "@ 출금 완료." << std::endl;
}
DisplayTitle("출금하기 종료");
}
| [
"95kim1@naver.com"
] | 95kim1@naver.com |
6d50d0bb0cf109ac0cd9aa3e677312dcd310c484 | 21962c612aa4ff50a1b0150932ed92aaa56c7726 | /src/default/aw_notificationmanagerfactory_default.cpp | 11c63ac7d23f0cf4a592b1638c3d9eca2feab45d | [
"MIT"
] | permissive | angelsware/aw-plugin-local-notifications | 0e246d48f2447fd0ac3d41415e336ae844415f9f | 4d92746237e83e1eb3ae801cefdbc35f7cfea2cb | refs/heads/master | 2020-08-14T02:14:04.920033 | 2020-01-06T21:34:39 | 2020-01-06T21:34:39 | 215,078,889 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 373 | cpp | #include <localnotifications/aw_notificationmanagerfactory.h>
#include "aw_notificationmanager_default.h"
namespace LocalNotifications {
INotificationManager* CNotificationManagerFactory::create() {
return new CNotificationManager_Default();
}
void CNotificationManagerFactory::destroy(INotificationManager* notificationManager) {
delete notificationManager;
}
}
| [
"joachim.klahr@gmail.com"
] | joachim.klahr@gmail.com |
72d0ac5789c4867651709fe70ca7a24221c336a7 | e543beb033fd4feb8e41a97c003d177398b56eaa | /topics/Constructors.cpp | 0eb4527ce4b76e40123e2491e4a13d537bfda014 | [] | no_license | Vladi756/Intermediate-CPP | 30a977c154d32b4acc8ea76c26e3158d4e3fe76e | c13ea418fe17f27a794b4e9f3d029d62546e2ec7 | refs/heads/main | 2023-03-29T02:33:52.325226 | 2021-03-31T18:01:39 | 2021-03-31T18:01:39 | 342,294,279 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 940 | cpp | #include <iostream>
using namespace std;
class Book { // A class is the template for a complex data type.
public:
string title;
string author;
int pages;
Book(string aTitle, string aAuthor, int aPages) {
title = aTitle;
author = aAuthor;
pages = aPages;
}
};
int main()
{
Book book1("Lord of the Rings", "J.R.R Tolkien", 1241); // An object is an actual instance of the blueprint (class) from above.
/* Multiple objects can be created with the same class. */
cout << book1.pages << endl;
cout << book1.author;
book1.title = "Harry Potter"; // Attributes can still be changes even with constructor.
return 0;
}
/* Classes are a great way to model real life entities, and a crucial concept that every
C++ developer must understand thouroughly. */
| [
"noreply@github.com"
] | Vladi756.noreply@github.com |
74d4566bcf5e96181cf2322855328f04dd16c8ea | 154ad9b7b26b5c52536bbd83cdaf0a359e6125c3 | /content/browser/service_worker/service_worker_register_job.cc | b6125adcb1a3cd6c9b1b53c56484531aff98081a | [
"BSD-3-Clause"
] | permissive | bopopescu/jstrace | 6cc239d57e3a954295b67fa6b8875aabeb64f3e2 | 2069a7b0a2e507a07cd9aacec4d9290a3178b815 | refs/heads/master | 2021-06-14T09:08:34.738245 | 2017-05-03T23:17:06 | 2017-05-03T23:17:06 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 23,069 | cc | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/service_worker/service_worker_register_job.h"
#include <stdint.h>
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/browser/service_worker/embedded_worker_status.h"
#include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_job_coordinator.h"
#include "content/browser/service_worker/service_worker_metrics.h"
#include "content/browser/service_worker/service_worker_registration.h"
#include "content/browser/service_worker/service_worker_storage.h"
#include "content/browser/service_worker/service_worker_write_to_cache_job.h"
#include "content/common/service_worker/service_worker_messages.h"
#include "content/common/service_worker/service_worker_types.h"
#include "content/common/service_worker/service_worker_utils.h"
#include "content/public/browser/browser_thread.h"
#include "net/base/net_errors.h"
namespace content {
namespace {
void RunSoon(const base::Closure& closure) {
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, closure);
}
} // namespace
typedef ServiceWorkerRegisterJobBase::RegistrationJobType RegistrationJobType;
ServiceWorkerRegisterJob::ServiceWorkerRegisterJob(
base::WeakPtr<ServiceWorkerContextCore> context,
const GURL& pattern,
const GURL& script_url)
: context_(context),
job_type_(REGISTRATION_JOB),
pattern_(pattern),
script_url_(script_url),
phase_(INITIAL),
doom_installing_worker_(false),
is_promise_resolved_(false),
should_uninstall_on_failure_(false),
force_bypass_cache_(false),
skip_script_comparison_(false),
promise_resolved_status_(SERVICE_WORKER_OK),
weak_factory_(this) {}
ServiceWorkerRegisterJob::ServiceWorkerRegisterJob(
base::WeakPtr<ServiceWorkerContextCore> context,
ServiceWorkerRegistration* registration,
bool force_bypass_cache,
bool skip_script_comparison)
: context_(context),
job_type_(UPDATE_JOB),
pattern_(registration->pattern()),
phase_(INITIAL),
doom_installing_worker_(false),
is_promise_resolved_(false),
should_uninstall_on_failure_(false),
force_bypass_cache_(force_bypass_cache),
skip_script_comparison_(skip_script_comparison),
promise_resolved_status_(SERVICE_WORKER_OK),
weak_factory_(this) {
internal_.registration = registration;
}
ServiceWorkerRegisterJob::~ServiceWorkerRegisterJob() {
DCHECK(!context_ ||
phase_ == INITIAL || phase_ == COMPLETE || phase_ == ABORT)
<< "Jobs should only be interrupted during shutdown.";
}
void ServiceWorkerRegisterJob::AddCallback(
const RegistrationCallback& callback,
ServiceWorkerProviderHost* provider_host) {
if (!is_promise_resolved_) {
callbacks_.push_back(callback);
if (provider_host)
provider_host->AddScopedProcessReferenceToPattern(pattern_);
return;
}
RunSoon(base::Bind(callback, promise_resolved_status_,
promise_resolved_status_message_,
base::RetainedRef(promise_resolved_registration_)));
}
void ServiceWorkerRegisterJob::Start() {
BrowserThread::PostAfterStartupTask(
FROM_HERE, base::ThreadTaskRunnerHandle::Get(),
base::Bind(&ServiceWorkerRegisterJob::StartImpl,
weak_factory_.GetWeakPtr()));
}
void ServiceWorkerRegisterJob::StartImpl() {
SetPhase(START);
ServiceWorkerStorage::FindRegistrationCallback next_step;
if (job_type_ == REGISTRATION_JOB) {
next_step = base::Bind(
&ServiceWorkerRegisterJob::ContinueWithRegistration,
weak_factory_.GetWeakPtr());
} else {
next_step = base::Bind(
&ServiceWorkerRegisterJob::ContinueWithUpdate,
weak_factory_.GetWeakPtr());
}
scoped_refptr<ServiceWorkerRegistration> registration =
context_->storage()->GetUninstallingRegistration(pattern_);
if (registration.get())
RunSoon(base::Bind(next_step, SERVICE_WORKER_OK, registration));
else
context_->storage()->FindRegistrationForPattern(pattern_, next_step);
}
void ServiceWorkerRegisterJob::Abort() {
SetPhase(ABORT);
CompleteInternal(SERVICE_WORKER_ERROR_ABORT, std::string());
// Don't have to call FinishJob() because the caller takes care of removing
// the jobs from the queue.
}
bool ServiceWorkerRegisterJob::Equals(ServiceWorkerRegisterJobBase* job) const {
if (job->GetType() != job_type_)
return false;
ServiceWorkerRegisterJob* register_job =
static_cast<ServiceWorkerRegisterJob*>(job);
if (job_type_ == UPDATE_JOB)
return register_job->pattern_ == pattern_;
DCHECK_EQ(REGISTRATION_JOB, job_type_);
return register_job->pattern_ == pattern_ &&
register_job->script_url_ == script_url_;
}
RegistrationJobType ServiceWorkerRegisterJob::GetType() const {
return job_type_;
}
void ServiceWorkerRegisterJob::DoomInstallingWorker() {
doom_installing_worker_ = true;
if (phase_ == INSTALL)
Complete(SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED, std::string());
}
ServiceWorkerRegisterJob::Internal::Internal() {}
ServiceWorkerRegisterJob::Internal::~Internal() {}
void ServiceWorkerRegisterJob::set_registration(
scoped_refptr<ServiceWorkerRegistration> registration) {
DCHECK(phase_ == START || phase_ == REGISTER) << phase_;
DCHECK(!internal_.registration.get());
internal_.registration = std::move(registration);
}
ServiceWorkerRegistration* ServiceWorkerRegisterJob::registration() {
DCHECK(phase_ >= REGISTER || job_type_ == UPDATE_JOB) << phase_;
return internal_.registration.get();
}
void ServiceWorkerRegisterJob::set_new_version(
ServiceWorkerVersion* version) {
DCHECK(phase_ == UPDATE) << phase_;
DCHECK(!internal_.new_version.get());
internal_.new_version = version;
}
ServiceWorkerVersion* ServiceWorkerRegisterJob::new_version() {
DCHECK(phase_ >= UPDATE) << phase_;
return internal_.new_version.get();
}
void ServiceWorkerRegisterJob::SetPhase(Phase phase) {
switch (phase) {
case INITIAL:
NOTREACHED();
break;
case START:
DCHECK(phase_ == INITIAL) << phase_;
break;
case REGISTER:
DCHECK(phase_ == START) << phase_;
break;
case UPDATE:
DCHECK(phase_ == START || phase_ == REGISTER) << phase_;
break;
case INSTALL:
DCHECK(phase_ == UPDATE) << phase_;
break;
case STORE:
DCHECK(phase_ == INSTALL) << phase_;
break;
case COMPLETE:
DCHECK(phase_ != INITIAL && phase_ != COMPLETE) << phase_;
break;
case ABORT:
break;
}
phase_ = phase;
}
// This function corresponds to the steps in [[Register]] following
// "Let registration be the result of running the [[GetRegistration]] algorithm.
// Throughout this file, comments in quotes are excerpts from the spec.
void ServiceWorkerRegisterJob::ContinueWithRegistration(
ServiceWorkerStatusCode status,
scoped_refptr<ServiceWorkerRegistration> existing_registration) {
DCHECK_EQ(REGISTRATION_JOB, job_type_);
if (status != SERVICE_WORKER_ERROR_NOT_FOUND && status != SERVICE_WORKER_OK) {
Complete(status);
return;
}
if (!existing_registration.get() || existing_registration->is_uninstalled()) {
RegisterAndContinue();
return;
}
DCHECK(existing_registration->GetNewestVersion());
// "If scriptURL is equal to registration.[[ScriptURL]], then:"
if (existing_registration->GetNewestVersion()->script_url() == script_url_) {
// "Set registration.[[Uninstalling]] to false."
existing_registration->AbortPendingClear(base::Bind(
&ServiceWorkerRegisterJob::ContinueWithRegistrationForSameScriptUrl,
weak_factory_.GetWeakPtr(),
existing_registration));
return;
}
if (existing_registration->is_uninstalling()) {
existing_registration->AbortPendingClear(base::Bind(
&ServiceWorkerRegisterJob::ContinueWithUninstallingRegistration,
weak_factory_.GetWeakPtr(),
existing_registration));
return;
}
// "Return the result of running the [[Update]] algorithm, or its equivalent,
// passing registration as the argument."
set_registration(existing_registration);
UpdateAndContinue();
}
void ServiceWorkerRegisterJob::ContinueWithUpdate(
ServiceWorkerStatusCode status,
scoped_refptr<ServiceWorkerRegistration> existing_registration) {
DCHECK_EQ(UPDATE_JOB, job_type_);
if (status != SERVICE_WORKER_OK) {
Complete(status);
return;
}
if (existing_registration.get() != registration()) {
Complete(SERVICE_WORKER_ERROR_NOT_FOUND);
return;
}
// A previous job may have unregistered this registration.
if (registration()->is_uninstalling() ||
!registration()->GetNewestVersion()) {
Complete(SERVICE_WORKER_ERROR_NOT_FOUND);
return;
}
DCHECK(script_url_.is_empty());
script_url_ = registration()->GetNewestVersion()->script_url();
// TODO(michaeln): If the last update check was less than 24 hours
// ago, depending on the freshness of the cached worker script we
// may be able to complete the update job right here.
UpdateAndContinue();
}
// Creates a new ServiceWorkerRegistration.
void ServiceWorkerRegisterJob::RegisterAndContinue() {
SetPhase(REGISTER);
int64_t registration_id = context_->storage()->NewRegistrationId();
if (registration_id == kInvalidServiceWorkerRegistrationId) {
Complete(SERVICE_WORKER_ERROR_ABORT);
return;
}
set_registration(
new ServiceWorkerRegistration(pattern_, registration_id, context_));
AddRegistrationToMatchingProviderHosts(registration());
UpdateAndContinue();
}
void ServiceWorkerRegisterJob::ContinueWithUninstallingRegistration(
scoped_refptr<ServiceWorkerRegistration> existing_registration,
ServiceWorkerStatusCode status) {
if (status != SERVICE_WORKER_OK) {
Complete(status);
return;
}
should_uninstall_on_failure_ = true;
set_registration(existing_registration);
UpdateAndContinue();
}
void ServiceWorkerRegisterJob::ContinueWithRegistrationForSameScriptUrl(
scoped_refptr<ServiceWorkerRegistration> existing_registration,
ServiceWorkerStatusCode status) {
if (status != SERVICE_WORKER_OK) {
Complete(status);
return;
}
set_registration(existing_registration);
// "If newestWorker is not null, and scriptURL is equal to
// newestWorker.scriptURL, then:
// Return a promise resolved with registration."
// We resolve only if there's an active version. If there's not,
// then there is either no version or only a waiting version from
// the last browser session; it makes sense to proceed with registration in
// either case.
DCHECK(!existing_registration->installing_version());
if (existing_registration->active_version()) {
ResolvePromise(status, std::string(), existing_registration.get());
Complete(SERVICE_WORKER_OK);
return;
}
// "Return the result of running the [[Update]] algorithm, or its equivalent,
// passing registration as the argument."
UpdateAndContinue();
}
// This function corresponds to the spec's [[Update]] algorithm.
void ServiceWorkerRegisterJob::UpdateAndContinue() {
SetPhase(UPDATE);
context_->storage()->NotifyInstallingRegistration(registration());
int64_t version_id = context_->storage()->NewVersionId();
if (version_id == kInvalidServiceWorkerVersionId) {
Complete(SERVICE_WORKER_ERROR_ABORT);
return;
}
// "Let worker be a new ServiceWorker object..." and start
// the worker.
set_new_version(new ServiceWorkerVersion(registration(), script_url_,
version_id, context_));
new_version()->set_force_bypass_cache_for_scripts(force_bypass_cache_);
if (registration()->has_installed_version() && !skip_script_comparison_) {
new_version()->set_pause_after_download(true);
new_version()->embedded_worker()->AddListener(this);
} else {
new_version()->set_pause_after_download(false);
}
new_version()->StartWorker(
ServiceWorkerMetrics::EventType::INSTALL,
base::Bind(&ServiceWorkerRegisterJob::OnStartWorkerFinished,
weak_factory_.GetWeakPtr()));
}
void ServiceWorkerRegisterJob::OnStartWorkerFinished(
ServiceWorkerStatusCode status) {
BumpLastUpdateCheckTimeIfNeeded();
if (status == SERVICE_WORKER_OK) {
InstallAndContinue();
return;
}
// "If serviceWorker fails to start up..." then reject the promise with an
// error and abort.
if (status == SERVICE_WORKER_ERROR_TIMEOUT) {
Complete(status, "Timed out while trying to start the Service Worker.");
return;
}
const net::URLRequestStatus& main_script_status =
new_version()->script_cache_map()->main_script_status();
std::string message;
if (main_script_status.status() != net::URLRequestStatus::SUCCESS) {
message = new_version()->script_cache_map()->main_script_status_message();
if (message.empty())
message = kFetchScriptError;
}
Complete(status, message);
}
// This function corresponds to the spec's [[Install]] algorithm.
void ServiceWorkerRegisterJob::InstallAndContinue() {
SetPhase(INSTALL);
// "Set registration.installingWorker to worker."
DCHECK(!registration()->installing_version());
registration()->SetInstallingVersion(new_version());
// "Run the Update State algorithm passing registration's installing worker
// and installing as the arguments."
new_version()->SetStatus(ServiceWorkerVersion::INSTALLING);
// "Resolve registrationPromise with registration."
ResolvePromise(SERVICE_WORKER_OK, std::string(), registration());
// "Fire a simple event named updatefound..."
registration()->NotifyUpdateFound();
// "Fire an event named install..."
new_version()->RunAfterStartWorker(
ServiceWorkerMetrics::EventType::INSTALL,
base::Bind(&ServiceWorkerRegisterJob::DispatchInstallEvent,
weak_factory_.GetWeakPtr()),
base::Bind(&ServiceWorkerRegisterJob::OnInstallFailed,
weak_factory_.GetWeakPtr()));
// A subsequent registration job may terminate our installing worker. It can
// only do so after we've started the worker and dispatched the install
// event, as those are atomic substeps in the [[Install]] algorithm.
if (doom_installing_worker_)
Complete(SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED);
}
void ServiceWorkerRegisterJob::DispatchInstallEvent() {
DCHECK_EQ(ServiceWorkerVersion::INSTALLING, new_version()->status())
<< new_version()->status();
DCHECK_EQ(EmbeddedWorkerStatus::RUNNING, new_version()->running_status())
<< "Worker stopped too soon after it was started.";
int request_id = new_version()->StartRequest(
ServiceWorkerMetrics::EventType::INSTALL,
base::Bind(&ServiceWorkerRegisterJob::OnInstallFailed,
weak_factory_.GetWeakPtr()));
new_version()
->RegisterRequestCallback<ServiceWorkerHostMsg_InstallEventFinished>(
request_id, base::Bind(&ServiceWorkerRegisterJob::OnInstallFinished,
weak_factory_.GetWeakPtr()));
new_version()->DispatchEvent({request_id},
ServiceWorkerMsg_InstallEvent(request_id));
}
void ServiceWorkerRegisterJob::OnInstallFinished(
int request_id,
blink::WebServiceWorkerEventResult result,
bool has_fetch_handler) {
new_version()->FinishRequest(
request_id, result == blink::WebServiceWorkerEventResultCompleted);
ServiceWorkerStatusCode status = SERVICE_WORKER_ERROR_FAILED;
switch (result) {
case blink::WebServiceWorkerEventResultCompleted:
status = SERVICE_WORKER_OK;
break;
case blink::WebServiceWorkerEventResultRejected:
status = SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED;
break;
default:
NOTREACHED();
}
if (status != SERVICE_WORKER_OK) {
OnInstallFailed(status);
return;
}
ServiceWorkerMetrics::RecordInstallEventStatus(status);
SetPhase(STORE);
DCHECK(!registration()->last_update_check().is_null());
new_version()->set_has_fetch_handler(has_fetch_handler);
context_->storage()->StoreRegistration(
registration(),
new_version(),
base::Bind(&ServiceWorkerRegisterJob::OnStoreRegistrationComplete,
weak_factory_.GetWeakPtr()));
}
void ServiceWorkerRegisterJob::OnInstallFailed(ServiceWorkerStatusCode status) {
ServiceWorkerMetrics::RecordInstallEventStatus(status);
if (status != SERVICE_WORKER_OK) {
Complete(status, std::string("ServiceWorker failed to install: ") +
ServiceWorkerStatusToString(status));
} else {
NOTREACHED() << "OnInstallFailed should not handle SERVICE_WORKER_OK";
}
}
void ServiceWorkerRegisterJob::OnStoreRegistrationComplete(
ServiceWorkerStatusCode status) {
if (status != SERVICE_WORKER_OK) {
Complete(status);
return;
}
// "9. If registration.waitingWorker is not null, then:..."
if (registration()->waiting_version()) {
// 1. Set redundantWorker to registration’s waiting worker.
// 2. Terminate redundantWorker.
registration()->waiting_version()->StopWorker(
base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
// TODO(falken): Move this further down. The spec says to set status to
// 'redundant' after promoting the new version to .waiting attribute and
// 'installed' status.
registration()->waiting_version()->SetStatus(
ServiceWorkerVersion::REDUNDANT);
}
// "10. Set registration.waitingWorker to registration.installingWorker."
// "11. Set registration.installingWorker to null."
registration()->SetWaitingVersion(new_version());
// "12. Run the [[UpdateState]] algorithm passing registration.waitingWorker
// and "installed" as the arguments."
new_version()->SetStatus(ServiceWorkerVersion::INSTALLED);
// "If registration's waiting worker's skip waiting flag is set:" then
// activate the worker immediately otherwise "wait until no service worker
// client is using registration as their service worker registration."
registration()->ActivateWaitingVersionWhenReady();
Complete(SERVICE_WORKER_OK);
}
void ServiceWorkerRegisterJob::Complete(ServiceWorkerStatusCode status) {
Complete(status, std::string());
}
void ServiceWorkerRegisterJob::Complete(ServiceWorkerStatusCode status,
const std::string& status_message) {
CompleteInternal(status, status_message);
context_->job_coordinator()->FinishJob(pattern_, this);
}
void ServiceWorkerRegisterJob::CompleteInternal(
ServiceWorkerStatusCode status,
const std::string& status_message) {
SetPhase(COMPLETE);
if (new_version()) {
new_version()->set_pause_after_download(false);
new_version()->embedded_worker()->RemoveListener(this);
}
if (status != SERVICE_WORKER_OK) {
if (registration()) {
if (should_uninstall_on_failure_)
registration()->ClearWhenReady();
if (new_version()) {
if (status == SERVICE_WORKER_ERROR_EXISTS)
new_version()->SetStartWorkerStatusCode(SERVICE_WORKER_ERROR_EXISTS);
else
new_version()->ReportError(status, status_message);
registration()->UnsetVersion(new_version());
new_version()->Doom();
}
if (!registration()->waiting_version() &&
!registration()->active_version()) {
registration()->NotifyRegistrationFailed();
context_->storage()->DeleteRegistration(
registration()->id(),
registration()->pattern().GetOrigin(),
base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
}
}
if (!is_promise_resolved_)
ResolvePromise(status, status_message, NULL);
}
DCHECK(callbacks_.empty());
if (registration()) {
context_->storage()->NotifyDoneInstallingRegistration(
registration(), new_version(), status);
if (registration()->has_installed_version())
registration()->set_is_uninstalled(false);
}
}
void ServiceWorkerRegisterJob::ResolvePromise(
ServiceWorkerStatusCode status,
const std::string& status_message,
ServiceWorkerRegistration* registration) {
DCHECK(!is_promise_resolved_);
is_promise_resolved_ = true;
promise_resolved_status_ = status;
promise_resolved_status_message_ = status_message,
promise_resolved_registration_ = registration;
for (std::vector<RegistrationCallback>::iterator it = callbacks_.begin();
it != callbacks_.end();
++it) {
it->Run(status, status_message, registration);
}
callbacks_.clear();
}
void ServiceWorkerRegisterJob::AddRegistrationToMatchingProviderHosts(
ServiceWorkerRegistration* registration) {
DCHECK(registration);
for (std::unique_ptr<ServiceWorkerContextCore::ProviderHostIterator> it =
context_->GetProviderHostIterator();
!it->IsAtEnd(); it->Advance()) {
ServiceWorkerProviderHost* host = it->GetProviderHost();
if (host->IsHostToRunningServiceWorker())
continue;
if (!ServiceWorkerUtils::ScopeMatches(registration->pattern(),
host->document_url()))
continue;
host->AddMatchingRegistration(registration);
}
}
void ServiceWorkerRegisterJob::OnScriptLoaded() {
DCHECK(new_version()->pause_after_download());
new_version()->set_pause_after_download(false);
net::URLRequestStatus status =
new_version()->script_cache_map()->main_script_status();
if (!status.is_success()) {
// OnScriptLoaded signifies a successful network load, which translates into
// a script cache error only in the byte-for-byte identical case.
DCHECK_EQ(status.error(),
ServiceWorkerWriteToCacheJob::kIdenticalScriptError);
BumpLastUpdateCheckTimeIfNeeded();
ResolvePromise(SERVICE_WORKER_OK, std::string(), registration());
Complete(SERVICE_WORKER_ERROR_EXISTS,
"The updated worker is identical to the incumbent.");
return;
}
new_version()->embedded_worker()->ResumeAfterDownload();
}
void ServiceWorkerRegisterJob::BumpLastUpdateCheckTimeIfNeeded() {
// Bump the last update check time only when the register/update job fetched
// the version having bypassed the network cache. We assume that the
// BYPASS_CACHE flag evicts an existing cache entry, so even if the install
// ultimately failed for whatever reason, we know the version in the HTTP
// cache is not stale, so it's OK to bump the update check time.
if (new_version()->embedded_worker()->network_accessed_for_script() ||
new_version()->force_bypass_cache_for_scripts() ||
registration()->last_update_check().is_null()) {
registration()->set_last_update_check(base::Time::Now());
if (registration()->has_installed_version())
context_->storage()->UpdateLastUpdateCheckTime(registration());
}
}
} // namespace content
| [
"zzbthechaos@gmail.com"
] | zzbthechaos@gmail.com |
0ccce7c70b43dd50d870bcf2b04f5edfcc093efb | c2774a0f06f5652155ee4ef6c475e69b779707d8 | /src/qt/bitcoinaddressvalidator.cpp | 97cedf27d89d21da730d2cb81dbc352eda761807 | [
"MIT"
] | permissive | futurexcoin/FuturexcoCore | 7228eb6f5ab4386e8feff77f6b55c0b0d03df1db | 6f585cb7eabbdd28af5583d6d260f9b1d47c0ef0 | refs/heads/master | 2020-06-07T06:29:45.100171 | 2019-06-24T09:31:18 | 2019-06-24T09:31:18 | 192,949,031 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,721 | cpp | // Copyright (c) 2011-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2018-2019 The futurexco Core developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "bitcoinaddressvalidator.h"
#include "base58.h"
/* Base58 characters are:
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
This is:
- All numbers except for '0'
- All upper-case letters except for 'I' and 'O'
- All lower-case letters except for 'l'
*/
BitcoinAddressEntryValidator::BitcoinAddressEntryValidator(QObject* parent) : QValidator(parent)
{
}
QValidator::State BitcoinAddressEntryValidator::validate(QString& input, int& pos) const
{
Q_UNUSED(pos);
// Empty address is "intermediate" input
if (input.isEmpty())
return QValidator::Intermediate;
// Correction
for (int idx = 0; idx < input.size();) {
bool removeChar = false;
QChar ch = input.at(idx);
// Corrections made are very conservative on purpose, to avoid
// users unexpectedly getting away with typos that would normally
// be detected, and thus sending to the wrong address.
switch (ch.unicode()) {
// Qt categorizes these as "Other_Format" not "Separator_Space"
case 0x200B: // ZERO WIDTH SPACE
case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE
removeChar = true;
break;
default:
break;
}
// Remove whitespace
if (ch.isSpace())
removeChar = true;
// To next character
if (removeChar)
input.remove(idx, 1);
else
++idx;
}
// Validation
QValidator::State state = QValidator::Acceptable;
for (int idx = 0; idx < input.size(); ++idx) {
int ch = input.at(idx).unicode();
if (((ch >= '0' && ch <= '9') ||
(ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z')) &&
ch != 'l' && ch != 'I' && ch != '0' && ch != 'O') {
// Alphanumeric and not a 'forbidden' character
} else {
state = QValidator::Invalid;
}
}
return state;
}
BitcoinAddressCheckValidator::BitcoinAddressCheckValidator(QObject* parent) : QValidator(parent)
{
}
QValidator::State BitcoinAddressCheckValidator::validate(QString& input, int& pos) const
{
Q_UNUSED(pos);
// Validate the passed futurexco address
CBitcoinAddress addr(input.toStdString());
if (addr.IsValid())
return QValidator::Acceptable;
return QValidator::Invalid;
}
| [
"futurexcoin@gmail.com"
] | futurexcoin@gmail.com |
5b1034ebb08cb3c4ea1e855fa3c95738039d6248 | 724507b6814376361cede2fbd8788cf33a17123b | /hylib/loki/test/DeletableSingleton/DeletableSingleton.cpp | 9a7a34ef89b319af0016d9991866a76670e552b5 | [] | no_license | hyperfact/rhythm | 103c56f09a63aa0d78f4eab186a9f89a2f47f7ce | 77dde2504f2364c0f7e4712659432937c2800174 | refs/heads/master | 2021-01-17T08:17:55.133675 | 2016-11-09T07:00:33 | 2016-11-09T07:00:33 | 9,600,905 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,989 | cpp | ////////////////////////////////////////////////////////////////////////////////
// The Loki Library
// Copyright (c) 2005 by Curtis Krauskopf
// Copyright (c) 2005 by Peter Kuemmel
//
// Code covered by the MIT License
// The authors make no representations about the suitability of this software
// for any purpose. It is provided "as is" without express or implied warranty.
////////////////////////////////////////////////////////////////////////////////
// Show an example of a Loki policy that uses DeletableSingleton.
//
// Expected output:
//
// LogClass::LogClass()
// LogClass singleton instantiated
// Going to manually delete LogBook.
// LogClass::~LogClass()
// LogClass::LogClass()
// LogClass reinstantiated.
// Going to terminate program now.
// LogClass::~LogClass()
//
#include <iostream>
#include <loki/Singleton.h> // for Loki::SingletonHolder
using namespace std; // okay for small programs
using namespace Loki; // okay for small programs
// A singleton LogClass object derived from the Example class.
// Its longevity is set by the user on the command line.
//
class LogClass
{
public:
LogClass()
{
print("LogClass::LogClass()");
};
~LogClass()
{
print("LogClass::~LogClass()");
}
void print(const char *s)
{
cout << s << endl;
}
};
typedef SingletonHolder<LogClass, CreateUsingNew, DeletableSingleton> LogBook;
class Example
{
public:
void method()
{
cout << "test\n";
}
};
int main()
{
// Instantiate both singletons by calling them...
LogBook::Instance().print("LogClass singleton instantiated");
LogBook::Instance().print("Going to manually delete LogBook.");
DeletableSingleton<LogClass>::GracefulDelete();
LogBook::Instance().print("LogClass reinstantiated.");
LogBook::Instance().print("Going to terminate program now.");
#if defined(__BORLANDC__) || defined(_MSC_VER)
system("PAUSE");
#endif
return 0;
}
| [
"huaiyu@miglab.com"
] | huaiyu@miglab.com |
258d6d0fe93295bfd0f008f9e14fad8e2b436414 | 8e8c17ec61cff93b9cec23d643f01ca3b713ca5e | /src/capi/impl/capi_visualization.cpp | 9b6fc539333d82766af1ac27c6521d59d70db7b8 | [
"BSD-3-Clause"
] | permissive | whosnail/turicreate | bc4030a17ceb470d3cc631661dd05cca4f4f32a1 | 71de6254190199d5b10be2f30abd50b1fcec6d40 | refs/heads/master | 2020-08-28T19:56:52.078276 | 2019-10-26T01:13:28 | 2019-10-26T01:13:28 | 217,804,395 | 1 | 0 | BSD-3-Clause | 2019-10-27T04:23:03 | 2019-10-27T04:23:03 | null | UTF-8 | C++ | false | false | 6,639 | cpp | /* Copyright © 2018 Apple Inc. All rights reserved.
*
* Use of this source code is governed by a BSD-3-clause license that can
* be found in the LICENSE.txt file or at
* https://opensource.org/licenses/BSD-3-Clause
*/
#include <capi/TuriCreate.h>
#include <capi/impl/capi_error_handling.hpp>
#include <capi/impl/capi_initialization_internal.hpp>
#include <capi/impl/capi_wrapper_structs.hpp>
#include <core/export.hpp>
#include <core/data/flexible_type/flexible_type.hpp>
#include <visualization/server/show.hpp>
static turi::flexible_type optional_str(const char *str) {
if (str == nullptr) {
return turi::FLEX_UNDEFINED;
}
return turi::flex_string(str);
}
extern "C" {
EXPORT tc_plot* tc_plot_create_1d(const tc_sarray* sa, const char* title,
const char* x_axis_title,
const char* y_axis_title,
const tc_parameters*, tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, sa, "sarray", NULL);
std::shared_ptr<turi::model_base> plot =
sa->value.plot(optional_str(title), optional_str(x_axis_title), optional_str(y_axis_title));
return new_tc_plot(
std::dynamic_pointer_cast<turi::visualization::Plot>(plot));
ERROR_HANDLE_END(error, NULL);
}
EXPORT tc_plot* tc_plot_create_2d(const tc_sarray* sa_x, const tc_sarray* sa_y,
const char* title, const char* x_axis_title,
const char* y_axis_title,
const tc_parameters*, tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, sa_x, "sarray_x", NULL);
CHECK_NOT_NULL(error, sa_y, "sarray_y", NULL);
std::shared_ptr<turi::model_base> plot = turi::visualization::plot(
sa_x->value, sa_y->value,
optional_str(x_axis_title), optional_str(y_axis_title), optional_str(title));
return new_tc_plot(
std::dynamic_pointer_cast<turi::visualization::Plot>(plot));
ERROR_HANDLE_END(error, NULL);
}
EXPORT tc_plot* tc_plot_create_sframe_summary(const tc_sframe* sf,
const tc_parameters* params,
tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, sf, "sframe", NULL);
std::shared_ptr<turi::model_base> plot = sf->value.plot();
return new_tc_plot(
std::dynamic_pointer_cast<turi::visualization::Plot>(plot));
ERROR_HANDLE_END(error, NULL);
}
EXPORT tc_plot* tc_plot_create_from_vega(const char* vega_spec,
const tc_parameters* params,
tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, vega_spec, "vega_spec", NULL);
return new_tc_plot(std::make_shared<turi::visualization::Plot>(vega_spec));
ERROR_HANDLE_END(error, NULL);
}
EXPORT tc_flexible_type* tc_plot_get_vega_spec(const tc_plot* plot,
tc_plot_variation variation,
const tc_parameters*,
tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, plot, "plot", NULL);
std::string vega_spec = plot->value->get_spec(variation);
return tc_ft_create_from_string(vega_spec.data(), vega_spec.size(), error);
ERROR_HANDLE_END(error, NULL);
}
EXPORT tc_flexible_type* tc_plot_get_next_data(const tc_plot* plot,
const tc_parameters*,
tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, plot, "plot", NULL);
std::string vega_data = plot->value->get_next_data();
return tc_ft_create_from_string(vega_data.data(), vega_data.size(), error);
ERROR_HANDLE_END(error, NULL);
}
EXPORT bool tc_plot_finished_streaming(const tc_plot* plot,
const tc_parameters*, tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, plot, "plot", true);
return plot->value->finished_streaming();
ERROR_HANDLE_END(error, true);
}
EXPORT tc_flexible_type* tc_plot_get_url(const tc_plot* plot, const tc_parameters* params, tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, plot, "plot", NULL);
std::string url = plot->value->get_url();
return tc_ft_create_from_string(url.data(), url.size(), error);
ERROR_HANDLE_END(error, NULL);
}
#ifdef __APPLE__
#ifndef TC_BUILD_IOS
EXPORT void tc_plot_render_final_into_context(const tc_plot* plot,
tc_plot_variation variation,
CGContextRef context,
const tc_parameters *params,
tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, plot, "plot");
CHECK_NOT_NULL(error, context, "context");
plot->value->materialize();
bool result = plot->value->render(context, variation);
ASSERT_TRUE(result);
ERROR_HANDLE_END(error);
}
EXPORT bool tc_plot_render_next_into_context(const tc_plot* plot,
tc_plot_variation variation,
CGContextRef context,
const tc_parameters *params,
tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, plot, "plot", true);
CHECK_NOT_NULL(error, context, "context", true);
return plot->value->render(context, variation);
ERROR_HANDLE_END(error, true);
}
EXPORT void tc_plot_render_vega_spec_into_context(const char * vega_spec,
CGContextRef context,
const tc_parameters *params,
tc_error** error) {
ERROR_HANDLE_START();
turi::ensure_server_initialized();
CHECK_NOT_NULL(error, vega_spec, "vega_spec");
CHECK_NOT_NULL(error, context, "context");
turi::visualization::Plot::render(vega_spec, context);
ERROR_HANDLE_END(error);
}
#endif // TC_BUILD_IOS
#endif // __APPLE__
} // extern "C"
| [
"noreply@github.com"
] | whosnail.noreply@github.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.